@griddo/ax 1.56.7 → 1.57.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.
- package/config/griddo-config.js +1 -0
- package/package.json +2 -2
- package/src/components/ActionMenu/index.tsx +1 -1
- package/src/components/Fields/ComponentArray/MixableComponentArray/index.tsx +7 -1
- package/src/components/Fields/ComponentArray/MixableComponentArray/style.tsx +29 -24
- package/src/components/Fields/ComponentArray/SameComponentArray/index.tsx +7 -1
- package/src/components/Fields/ComponentArray/SameComponentArray/style.tsx +29 -24
- package/src/components/Fields/DateField/index.tsx +3 -2
- package/src/components/Fields/ReferenceField/AutoPanel/AutoItem/index.tsx +1 -1
- package/src/components/Fields/ReferenceField/AutoPanel/index.tsx +1 -1
- package/src/components/Fields/ReferenceField/ItemList/Item/index.tsx +1 -1
- package/src/components/Fields/UrlField/index.tsx +12 -1
- package/src/components/Fields/Wysiwyg/config.tsx +80 -56
- package/src/components/Fields/Wysiwyg/index.tsx +23 -6
- package/src/components/FloatingMenu/index.tsx +9 -6
- package/src/components/FloatingMenu/style.tsx +8 -6
- package/src/components/Gallery/GalleryFilters/Orientation/index.tsx +1 -1
- package/src/components/Gallery/GalleryFilters/SortBy/index.tsx +1 -1
- package/src/components/InformativeMenu/index.tsx +3 -2
- package/src/components/InformativeMenu/style.tsx +0 -1
- package/src/components/MainWrapper/AppBar/index.tsx +8 -7
- package/src/components/MainWrapper/AppBar/style.tsx +7 -0
- package/src/components/MenuItem/style.tsx +1 -0
- package/src/components/Modal/style.tsx +14 -13
- package/src/components/Nav/index.tsx +8 -3
- package/src/components/Nav/style.tsx +5 -0
- package/src/components/SearchField/index.tsx +43 -14
- package/src/components/SearchField/style.tsx +23 -10
- package/src/components/SideModal/index.tsx +24 -8
- package/src/components/SideModal/style.tsx +13 -2
- package/src/components/SubNav/style.tsx +3 -2
- package/src/containers/Navigation/Defaults/actions.tsx +26 -24
- package/src/containers/Navigation/Defaults/reducer.tsx +2 -2
- package/src/containers/PageEditor/actions.tsx +9 -8
- package/src/containers/Settings/Social/actions.tsx +9 -31
- package/src/containers/Settings/Social/constants.tsx +2 -3
- package/src/containers/Settings/Social/interfaces.tsx +2 -7
- package/src/containers/Settings/Social/reducer.tsx +3 -14
- package/src/containers/Sites/actions.tsx +3 -63
- package/src/containers/Sites/constants.tsx +0 -1
- package/src/containers/Sites/interfaces.tsx +0 -6
- package/src/containers/Sites/reducer.tsx +1 -29
- package/src/forms/editor.tsx +2 -0
- package/src/forms/validators.tsx +2 -0
- package/src/helpers/dates.tsx +23 -24
- package/src/helpers/index.tsx +2 -0
- package/src/helpers/objects.tsx +17 -2
- package/src/helpers/schemas.tsx +7 -4
- package/src/hooks/forms.tsx +23 -24
- package/src/modules/App/Routing/NavMenu/NavItem/index.tsx +10 -5
- package/src/modules/App/Routing/NavMenu/NavItem/style.tsx +13 -9
- package/src/modules/App/Routing/NavMenu/index.tsx +39 -37
- package/src/modules/App/Routing/NavMenu/style.tsx +9 -3
- package/src/modules/Categories/CategoriesList/CategoryItem/index.tsx +1 -1
- package/src/modules/Categories/CategoriesList/CategoryNav/NavItem/index.tsx +6 -3
- package/src/modules/Categories/CategoriesList/CategoryNav/NavItem/style.tsx +5 -1
- package/src/modules/Content/ContentFilters/index.tsx +6 -3
- package/src/modules/Content/ContentFilters/style.tsx +6 -1
- package/src/modules/Content/HeaderMenus/Live/index.tsx +1 -1
- package/src/modules/Content/HeaderMenus/Name/index.tsx +10 -4
- package/src/modules/Content/HeaderMenus/Status/index.tsx +7 -3
- package/src/modules/Content/HeaderMenus/Translations/index.tsx +1 -1
- package/src/modules/Content/HeaderMenus/Types/index.tsx +1 -1
- package/src/modules/Content/OptionTable/index.tsx +6 -3
- package/src/modules/Content/OptionTable/style.tsx +4 -0
- package/src/modules/Content/PageItem/index.tsx +3 -3
- package/src/modules/Content/index.tsx +5 -3
- package/src/modules/GlobalEditor/index.tsx +37 -14
- package/src/modules/Navigation/Defaults/DefaultsEditor/index.tsx +33 -13
- package/src/modules/Navigation/Defaults/Item/atoms.tsx +1 -1
- package/src/modules/Navigation/Defaults/Nav/index.tsx +8 -3
- package/src/modules/Navigation/Defaults/Nav/style.tsx +4 -0
- package/src/modules/Navigation/Defaults/index.tsx +4 -0
- package/src/modules/Navigation/Menus/List/Nav/index.tsx +8 -3
- package/src/modules/Navigation/Menus/List/Nav/style.tsx +4 -0
- package/src/modules/Navigation/Menus/List/index.tsx +3 -1
- package/src/modules/Navigation/Menus/List/style.tsx +9 -1
- package/src/modules/PageEditor/index.tsx +38 -14
- package/src/modules/Settings/ContentTypes/DataPacks/AddModal/Filter/index.tsx +1 -1
- package/src/modules/Settings/ContentTypes/DataPacks/AddModal/SortFilter/index.tsx +1 -1
- package/src/modules/Settings/ContentTypes/DataPacks/Nav/index.tsx +11 -6
- package/src/modules/Settings/ContentTypes/DataPacks/Nav/style.tsx +6 -1
- package/src/modules/Settings/Globals/index.tsx +19 -31
- package/src/modules/Settings/Languages/LanguagePanel/Form/index.tsx +1 -1
- package/src/modules/Settings/Languages/Table/Item/index.tsx +1 -1
- package/src/modules/Settings/Social/index.tsx +35 -91
- package/src/modules/Sites/SitesList/SiteModal/index.tsx +12 -27
- package/src/modules/Sites/SitesList/index.tsx +15 -15
- package/src/modules/StructuredData/StructuredDataList/ContentFilters/index.tsx +3 -1
- package/src/modules/StructuredData/StructuredDataList/ContentFilters/style.tsx +6 -1
- package/src/modules/StructuredData/StructuredDataList/GlobalPageItem/index.tsx +3 -3
- package/src/modules/StructuredData/StructuredDataList/HeaderMenus/Live/index.tsx +1 -1
- package/src/modules/StructuredData/StructuredDataList/HeaderMenus/Name/index.tsx +10 -4
- package/src/modules/StructuredData/StructuredDataList/HeaderMenus/Site/index.tsx +1 -1
- package/src/modules/StructuredData/StructuredDataList/HeaderMenus/Status/index.tsx +7 -3
- package/src/modules/StructuredData/StructuredDataList/HeaderMenus/Translations/index.tsx +1 -1
- package/src/modules/StructuredData/StructuredDataList/HeaderMenus/Types/index.tsx +1 -1
- package/src/modules/StructuredData/StructuredDataList/OptionTable/index.tsx +6 -3
- package/src/modules/StructuredData/StructuredDataList/OptionTable/style.tsx +4 -0
- package/src/modules/StructuredData/StructuredDataList/StructuredDataItem/index.tsx +1 -1
- package/src/modules/Users/UserList/HeaderMenus/Name/index.tsx +13 -5
- package/src/schemas/index.tsx +7 -0
- package/src/schemas/pages/GlobalPage.tsx +166 -0
- package/src/schemas/pages/Page.tsx +181 -0
- package/src/schemas/pages/index.tsx +4 -0
- package/src/types/index.tsx +8 -14
- package/tsconfig.paths.json +2 -1
- package/public/img/schemas/Accordion/thumbnails/thumbnail@1x.png +0 -0
- package/public/img/schemas/Accordion/thumbnails/thumbnail@2x.png +0 -0
- package/public/img/schemas/AddressCollection/thumbnails/thumbnail@1x.png +0 -0
- package/public/img/schemas/AddressCollection/thumbnails/thumbnail@2x.png +0 -0
- package/public/img/schemas/BasicBoxedCard/thumbnails/thumbnail@1x.png +0 -0
- package/public/img/schemas/BasicBoxedCard/thumbnails/thumbnail@2x.png +0 -0
- package/public/img/schemas/BasicCard/thumbnails/thumbnail@1x.png +0 -0
- package/public/img/schemas/BasicCard/thumbnails/thumbnail@2x.png +0 -0
- package/public/img/schemas/BasicContent/layouts/layout001@1x.png +0 -0
- package/public/img/schemas/BasicContent/layouts/layout001@2x.png +0 -0
- package/public/img/schemas/BasicContent/layouts/layout002@1x.png +0 -0
- package/public/img/schemas/BasicContent/layouts/layout002@2x.png +0 -0
- package/public/img/schemas/BasicContent/layouts/layout003@1x.png +0 -0
- package/public/img/schemas/BasicContent/layouts/layout003@2x.png +0 -0
- package/public/img/schemas/BasicContent/layouts/layout004@1x.png +0 -0
- package/public/img/schemas/BasicContent/layouts/layout004@2x.png +0 -0
- package/public/img/schemas/BasicContent/layouts/layout005@1x.png +0 -0
- package/public/img/schemas/BasicContent/layouts/layout005@2x.png +0 -0
- package/public/img/schemas/BasicContent/layouts/layout006@1x.png +0 -0
- package/public/img/schemas/BasicContent/layouts/layout006@2x.png +0 -0
- package/public/img/schemas/BasicContent/layouts/layout007@1x.png +0 -0
- package/public/img/schemas/BasicContent/layouts/layout007@2x.png +0 -0
- package/public/img/schemas/BasicContent/thumbnails/thumbnail@1x.png +0 -0
- package/public/img/schemas/BasicContent/thumbnails/thumbnail@2x.png +0 -0
- package/public/img/schemas/BasicIconCard/thumbnails/thumbnail@1x.png +0 -0
- package/public/img/schemas/BasicIconCard/thumbnails/thumbnail@2x.png +0 -0
- package/public/img/schemas/CardCollection/layouts/layout001@1x.png +0 -0
- package/public/img/schemas/CardCollection/layouts/layout001@2x.png +0 -0
- package/public/img/schemas/CardCollection/layouts/layout002@1x.png +0 -0
- package/public/img/schemas/CardCollection/layouts/layout002@2x.png +0 -0
- package/public/img/schemas/CardCollection/layouts/layout003@1x.png +0 -0
- package/public/img/schemas/CardCollection/layouts/layout003@2x.png +0 -0
- package/public/img/schemas/CardCollection/layouts/layout004@1x.png +0 -0
- package/public/img/schemas/CardCollection/layouts/layout004@2x.png +0 -0
- package/public/img/schemas/CardCollection/layouts/layout005@1x.png +0 -0
- package/public/img/schemas/CardCollection/layouts/layout005@2x.png +0 -0
- package/public/img/schemas/CardCollection/thumbnails/thumbnail@1x.png +0 -0
- package/public/img/schemas/CardCollection/thumbnails/thumbnail@2x.png +0 -0
- package/public/img/schemas/DownloadCollection/thumbnails/thumbnail@1x.png +0 -0
- package/public/img/schemas/DownloadCollection/thumbnails/thumbnail@2x.png +0 -0
- package/public/img/schemas/EventCard/layouts/layout001@1x.png +0 -0
- package/public/img/schemas/EventCard/layouts/layout001@2x.png +0 -0
- package/public/img/schemas/EventCard/layouts/layout002@1x.png +0 -0
- package/public/img/schemas/EventCard/layouts/layout002@2x.png +0 -0
- package/public/img/schemas/EventCard/thumbnails/thumbnail@1x.png +0 -0
- package/public/img/schemas/EventCard/thumbnails/thumbnail@2x.png +0 -0
- package/public/img/schemas/EventsDistributor/thumbnails/thumbnail@1x.png +0 -0
- package/public/img/schemas/EventsDistributor/thumbnails/thumbnail@2x.png +0 -0
- package/public/img/schemas/FeaturedAudiovisual/layouts/layout001@1x.png +0 -0
- package/public/img/schemas/FeaturedAudiovisual/layouts/layout001@2x.png +0 -0
- package/public/img/schemas/FeaturedAudiovisual/layouts/layout002@1x.png +0 -0
- package/public/img/schemas/FeaturedAudiovisual/layouts/layout002@2x.png +0 -0
- package/public/img/schemas/FeaturedAudiovisual/layouts/layout003@1x.png +0 -0
- package/public/img/schemas/FeaturedAudiovisual/layouts/layout003@2x.png +0 -0
- package/public/img/schemas/FeaturedAudiovisual/layouts/layout004@1x.png +0 -0
- package/public/img/schemas/FeaturedAudiovisual/layouts/layout004@2x.png +0 -0
- package/public/img/schemas/FeaturedAudiovisual/layouts/layout005@1x.png +0 -0
- package/public/img/schemas/FeaturedAudiovisual/layouts/layout005@2x.png +0 -0
- package/public/img/schemas/FeaturedAudiovisual/layouts/layout006@1x.png +0 -0
- package/public/img/schemas/FeaturedAudiovisual/layouts/layout006@2x.png +0 -0
- package/public/img/schemas/FeaturedAudiovisual/layouts/layout007@1x.png +0 -0
- package/public/img/schemas/FeaturedAudiovisual/layouts/layout007@2x.png +0 -0
- package/public/img/schemas/FeaturedAudiovisual/layouts/layout008@1x.png +0 -0
- package/public/img/schemas/FeaturedAudiovisual/layouts/layout008@2x.png +0 -0
- package/public/img/schemas/FeaturedAudiovisual/layouts/layout009@1x.png +0 -0
- package/public/img/schemas/FeaturedAudiovisual/layouts/layout009@2x.png +0 -0
- package/public/img/schemas/FeaturedAudiovisual/layouts/layout010@1x.png +0 -0
- package/public/img/schemas/FeaturedAudiovisual/layouts/layout010@2x.png +0 -0
- package/public/img/schemas/FeaturedAudiovisual/layouts/layout011@1x.png +0 -0
- package/public/img/schemas/FeaturedAudiovisual/layouts/layout011@2x.png +0 -0
- package/public/img/schemas/FeaturedAudiovisual/layouts/layout012@1x.png +0 -0
- package/public/img/schemas/FeaturedAudiovisual/layouts/layout012@2x.png +0 -0
- package/public/img/schemas/FeaturedAudiovisual/thumbnails/thumbnail@1x.png +0 -0
- package/public/img/schemas/FeaturedAudiovisual/thumbnails/thumbnail@2x.png +0 -0
- package/public/img/schemas/FeaturedBlock/layouts/layout001@1x.png +0 -0
- package/public/img/schemas/FeaturedBlock/layouts/layout001@2x.png +0 -0
- package/public/img/schemas/FeaturedBlock/layouts/layout002@1x.png +0 -0
- package/public/img/schemas/FeaturedBlock/layouts/layout002@2x.png +0 -0
- package/public/img/schemas/FeaturedProgram/thumbnails/thumbnail@1x.png +0 -0
- package/public/img/schemas/FeaturedProgram/thumbnails/thumbnail@2x.png +0 -0
- package/public/img/schemas/FeaturedText/thumbnails/thumbnail@1x.png +0 -0
- package/public/img/schemas/FeaturedText/thumbnails/thumbnail@2x.png +0 -0
- package/public/img/schemas/FeedbackForm/thumbnails/thumbnail@1x.png +0 -0
- package/public/img/schemas/FeedbackForm/thumbnails/thumbnail@2x.png +0 -0
- package/public/img/schemas/HeroCarousel/thumbnails/thumbnail@1x.png +0 -0
- package/public/img/schemas/HeroCarousel/thumbnails/thumbnail@2x.png +0 -0
- package/public/img/schemas/HeroImage/thumbnails/thumbnail@1x.png +0 -0
- package/public/img/schemas/HeroImage/thumbnails/thumbnail@2x.png +0 -0
- package/public/img/schemas/IconCard/thumbnails/thumbnail@1x.png +0 -0
- package/public/img/schemas/IconCard/thumbnails/thumbnail@2x.png +0 -0
- package/public/img/schemas/IconCenteredCard/thumbnails/thumbnail@1x.png +0 -0
- package/public/img/schemas/IconCenteredCard/thumbnails/thumbnail@2x.png +0 -0
- package/public/img/schemas/Image/thumbnails/thumbnail@1x.png +0 -0
- package/public/img/schemas/Image/thumbnails/thumbnail@2x.png +0 -0
- package/public/img/schemas/ImageCard/thumbnails/thumbnail@1x.png +0 -0
- package/public/img/schemas/ImageCard/thumbnails/thumbnail@2x.png +0 -0
- package/public/img/schemas/Intro/thumbnails/thumbnail@1x.png +0 -0
- package/public/img/schemas/Intro/thumbnails/thumbnail@2x.png +0 -0
- package/public/img/schemas/LogoCard/thumbnails/thumbnail@1x.png +0 -0
- package/public/img/schemas/LogoCard/thumbnails/thumbnail@2x.png +0 -0
- package/public/img/schemas/NewsDistributor/thumbnails/thumbnail@1x.png +0 -0
- package/public/img/schemas/NewsDistributor/thumbnails/thumbnail@2x.png +0 -0
- package/public/img/schemas/PersonDistributor/thumbnails/thumbnail@1x.png +0 -0
- package/public/img/schemas/PersonDistributor/thumbnails/thumbnail@2x.png +0 -0
- package/public/img/schemas/PublicationDistributor/thumbnails/thumbnail@1x.png +0 -0
- package/public/img/schemas/PublicationDistributor/thumbnails/thumbnail@2x.png +0 -0
- package/public/img/schemas/SchoolFooter/thumbnails/thumbnail@1x.png +0 -0
- package/public/img/schemas/SchoolFooter/thumbnails/thumbnail@2x.png +0 -0
- package/public/img/schemas/Slider/thumbnails/thumbnail@1x.png +0 -0
- package/public/img/schemas/Slider/thumbnails/thumbnail@2x.png +0 -0
- package/public/img/schemas/Testimonial/layouts/layout001@1x.png +0 -0
- package/public/img/schemas/Testimonial/layouts/layout001@2x.png +0 -0
- package/public/img/schemas/Testimonial/layouts/layout002@1x.png +0 -0
- package/public/img/schemas/Testimonial/layouts/layout002@2x.png +0 -0
- package/public/img/schemas/Testimonial/thumbnails/thumbnail@1x.png +0 -0
- package/public/img/schemas/Testimonial/thumbnails/thumbnail@2x.png +0 -0
- package/public/img/schemas/TextBluePanel/layouts/layout001@1x.png +0 -0
- package/public/img/schemas/TextBluePanel/layouts/layout001@2x.png +0 -0
- package/public/img/schemas/TextBluePanel/layouts/layout002@1x.png +0 -0
- package/public/img/schemas/TextBluePanel/layouts/layout002@2x.png +0 -0
- package/public/img/schemas/TextBluePanel/thumbnails/thumbnail@1x.png +0 -0
- package/public/img/schemas/TextBluePanel/thumbnails/thumbnail@2x.png +0 -0
- package/public/img/schemas/Video/thumbnails/thumbnail@1x.png +0 -0
- package/public/img/schemas/Video/thumbnails/thumbnail@2x.png +0 -0
- package/public/img/schemas/imgHeros.png +0 -0
- package/public/img/schemas/imgStandard.jpg +0 -0
- package/public/img/schemas/templates/BasicTemplate/thumbnails/thumbnail@1x.png +0 -0
- package/public/img/schemas/templates/BasicTemplate/thumbnails/thumbnail@2x.png +0 -0
- package/public/img/schemas/templates/Error404/thumbnails/thumbnail@1x.png +0 -0
- package/public/img/schemas/templates/Error404/thumbnails/thumbnail@2x.png +0 -0
- package/public/img/schemas/templates/NewsList/thumbnails/thumbnail@1x.png +0 -0
- package/public/img/schemas/templates/NewsList/thumbnails/thumbnail@2x.png +0 -0
- package/public/img/schemas/themes/LinkStyle.png +0 -0
- package/public/img/schemas/themes/LinkStyle@2x.png +0 -0
- package/public/img/schemas/themes/PrimaryStyle.png +0 -0
- package/public/img/schemas/themes/PrimaryStyle@2x.png +0 -0
- package/public/img/schemas/themes/STYLE01.png +0 -0
- package/public/img/schemas/themes/STYLE02.png +0 -0
- package/public/img/schemas/themes/STYLE03.png +0 -0
- package/public/img/schemas/themes/STYLE04.png +0 -0
- package/public/img/schemas/themes/STYLE05.png +0 -0
- package/public/img/schemas/themes/STYLE06.png +0 -0
- package/public/img/schemas/themes/SecondaryStyle.png +0 -0
- package/public/img/schemas/themes/SecondaryStyle@2x.png +0 -0
- package/src/components/MainWrapper/AppBar/SearchField/index.tsx +0 -54
- package/src/components/MainWrapper/AppBar/SearchField/style.tsx +0 -55
|
@@ -288,7 +288,7 @@ function savePage(
|
|
|
288
288
|
createDraft: boolean,
|
|
289
289
|
publishPage?: any,
|
|
290
290
|
publishDraft?: boolean
|
|
291
|
-
): (dispatch: Dispatch, getState: any) => Promise<
|
|
291
|
+
): (dispatch: Dispatch, getState: any) => Promise<boolean> {
|
|
292
292
|
return async (dispatch, getState) => {
|
|
293
293
|
try {
|
|
294
294
|
dispatch(setIsSaving(true));
|
|
@@ -358,14 +358,17 @@ function savePage(
|
|
|
358
358
|
if (selectedEditorID === rootEditorID) {
|
|
359
359
|
setSelectedContent(rootEditorID)(dispatch, getState);
|
|
360
360
|
}
|
|
361
|
+
dispatch(setIsSaving(false));
|
|
362
|
+
return true;
|
|
361
363
|
} else {
|
|
362
364
|
appActions.handleError(saveResponse)(dispatch);
|
|
365
|
+
dispatch(setIsSaving(false));
|
|
366
|
+
return false;
|
|
363
367
|
}
|
|
364
|
-
|
|
365
|
-
dispatch(setIsSaving(false));
|
|
366
368
|
} catch (e) {
|
|
367
369
|
console.log(e); // TODO: capturar error bien
|
|
368
370
|
dispatch(setIsSaving(false));
|
|
371
|
+
return false;
|
|
369
372
|
}
|
|
370
373
|
};
|
|
371
374
|
}
|
|
@@ -519,8 +522,6 @@ function addComponent(type: any, key: string): (dispatch: Dispatch, getState: an
|
|
|
519
522
|
},
|
|
520
523
|
};
|
|
521
524
|
|
|
522
|
-
generatePageContent(updatedPageContent, dispatch, getState);
|
|
523
|
-
|
|
524
525
|
if (type.editorID) {
|
|
525
526
|
setSelectedContent(type.editorID)(dispatch, getState);
|
|
526
527
|
} else {
|
|
@@ -528,6 +529,8 @@ function addComponent(type: any, key: string): (dispatch: Dispatch, getState: an
|
|
|
528
529
|
const lastElementEditorID = getLastComponentEditorID(generatedSections, component.editorID, key);
|
|
529
530
|
setSelectedContent(lastElementEditorID)(dispatch, getState);
|
|
530
531
|
}
|
|
532
|
+
|
|
533
|
+
generatePageContent(updatedPageContent, dispatch, getState);
|
|
531
534
|
};
|
|
532
535
|
}
|
|
533
536
|
|
|
@@ -626,7 +629,6 @@ function deleteModule(editorID: number, key?: string): (dispatch: Dispatch, getS
|
|
|
626
629
|
|
|
627
630
|
const updatedPageContent = {
|
|
628
631
|
...editorContent,
|
|
629
|
-
sections: [...updatedSections],
|
|
630
632
|
};
|
|
631
633
|
|
|
632
634
|
generatePageContent(updatedPageContent, dispatch, getState);
|
|
@@ -650,7 +652,6 @@ function duplicateModule(editorID: number, key?: string): (dispatch: Dispatch, g
|
|
|
650
652
|
|
|
651
653
|
const updatedPageContent = {
|
|
652
654
|
...editorContent,
|
|
653
|
-
sections: [...updatedSections],
|
|
654
655
|
};
|
|
655
656
|
|
|
656
657
|
generatePageContent(updatedPageContent, dispatch, getState);
|
|
@@ -724,7 +725,7 @@ function updateEditorContent(
|
|
|
724
725
|
dispatch(setEditorContent(updatedEditorContent));
|
|
725
726
|
|
|
726
727
|
const isNavigation = ["header", "footer"].includes(key);
|
|
727
|
-
if (isNavigation) {
|
|
728
|
+
if (isNavigation || (value && typeof value === "object")) {
|
|
728
729
|
generatePageContent(updatedEditorContent.editorContent, dispatch, getState);
|
|
729
730
|
}
|
|
730
731
|
};
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import { Dispatch } from "redux";
|
|
2
2
|
|
|
3
|
-
import { SET_SOCIAL
|
|
3
|
+
import { SET_SOCIAL } from "./constants";
|
|
4
4
|
|
|
5
|
-
import { ISetSocialAction
|
|
6
|
-
|
|
7
|
-
import { ISocialState } from "@ax/types";
|
|
8
|
-
import { initialState } from "./reducer";
|
|
5
|
+
import { ISetSocialAction } from "./interfaces";
|
|
9
6
|
|
|
10
7
|
import { appActions } from "@ax/containers/App";
|
|
11
8
|
import { handleRequest } from "@ax/helpers";
|
|
@@ -15,45 +12,27 @@ function setSocial(socialInfo: any): ISetSocialAction {
|
|
|
15
12
|
return { type: SET_SOCIAL, payload: { ...socialInfo } };
|
|
16
13
|
}
|
|
17
14
|
|
|
18
|
-
function
|
|
19
|
-
return { type: SET_FORM, payload: form };
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
function updateFormValue(valueObj: any): (dispatch: Dispatch, getState: any) => void {
|
|
23
|
-
return (dispatch, getState) => {
|
|
24
|
-
const { social } = getState();
|
|
25
|
-
const updatedForm = { ...social, ...valueObj };
|
|
26
|
-
dispatch(setForm(updatedForm));
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
function resetForm(): (dispatch: Dispatch) => void {
|
|
31
|
-
return (dispatch) => {
|
|
32
|
-
dispatch(setForm(initialState));
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
function saveSocial(): (dispatch: Dispatch, getState: any) => Promise<void> {
|
|
15
|
+
function saveSocial(form: Record<string, string>): (dispatch: Dispatch, getState: any) => Promise<boolean> {
|
|
37
16
|
return async (dispatch, getState) => {
|
|
38
17
|
try {
|
|
39
18
|
const {
|
|
40
19
|
sites: { currentSiteInfo },
|
|
41
|
-
social: form,
|
|
42
20
|
} = getState();
|
|
43
21
|
|
|
44
22
|
const responseActions = {
|
|
45
|
-
handleSuccess: (data:
|
|
23
|
+
handleSuccess: (data: Record<string, string>) => {
|
|
46
24
|
dispatch(setSocial(data));
|
|
47
|
-
|
|
25
|
+
return true;
|
|
48
26
|
},
|
|
49
27
|
handleError: (data: any) => appActions.handleError(data)(dispatch),
|
|
50
28
|
};
|
|
51
29
|
|
|
52
30
|
const callback = async () => social.updateSocial(currentSiteInfo.id, form);
|
|
53
31
|
|
|
54
|
-
await handleRequest(callback, responseActions, [appActions.setIsSaving])(dispatch);
|
|
32
|
+
return await handleRequest(callback, responseActions, [appActions.setIsSaving])(dispatch);
|
|
55
33
|
} catch (e) {
|
|
56
34
|
console.log(e);
|
|
35
|
+
return false;
|
|
57
36
|
}
|
|
58
37
|
};
|
|
59
38
|
}
|
|
@@ -66,9 +45,8 @@ function getSocial(): (dispatch: any, getState: any) => Promise<void> {
|
|
|
66
45
|
} = getState();
|
|
67
46
|
|
|
68
47
|
const responseActions = {
|
|
69
|
-
handleSuccess: (data:
|
|
48
|
+
handleSuccess: (data: Record<string, string>) => {
|
|
70
49
|
dispatch(setSocial(data));
|
|
71
|
-
dispatch(setForm(data));
|
|
72
50
|
},
|
|
73
51
|
handleError: () => console.log("Error en getSocial"),
|
|
74
52
|
};
|
|
@@ -82,4 +60,4 @@ function getSocial(): (dispatch: any, getState: any) => Promise<void> {
|
|
|
82
60
|
};
|
|
83
61
|
}
|
|
84
62
|
|
|
85
|
-
export { getSocial,
|
|
63
|
+
export { getSocial, saveSocial, setSocial };
|
|
@@ -1,14 +1,9 @@
|
|
|
1
|
-
import { SET_SOCIAL
|
|
1
|
+
import { SET_SOCIAL } from "./constants";
|
|
2
2
|
import { ISocialState } from "@ax/types";
|
|
3
3
|
|
|
4
4
|
export interface ISetSocialAction {
|
|
5
5
|
type: typeof SET_SOCIAL;
|
|
6
|
-
payload: any;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export interface ISetFormAction {
|
|
10
|
-
type: typeof SET_FORM;
|
|
11
6
|
payload: ISocialState;
|
|
12
7
|
}
|
|
13
8
|
|
|
14
|
-
export type SocialActionsCreators = ISetSocialAction
|
|
9
|
+
export type SocialActionsCreators = ISetSocialAction;
|
|
@@ -1,26 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SET_SOCIAL } from "./constants";
|
|
2
2
|
|
|
3
3
|
import { ISocialState } from "@ax/types";
|
|
4
4
|
|
|
5
5
|
import { SocialActionsCreators } from "./interfaces";
|
|
6
6
|
|
|
7
|
-
export const initialState = {
|
|
8
|
-
instagram: "",
|
|
9
|
-
linkedIn: "",
|
|
10
|
-
facebook: "",
|
|
11
|
-
twitter: "",
|
|
12
|
-
youTube: "",
|
|
13
|
-
flicker: "",
|
|
14
|
-
tiktok: "",
|
|
15
|
-
snapchat: "",
|
|
16
|
-
newsletter: "",
|
|
17
|
-
};
|
|
7
|
+
export const initialState = {};
|
|
18
8
|
|
|
19
9
|
export function reducer(state = initialState, action: SocialActionsCreators): ISocialState {
|
|
20
10
|
switch (action.type) {
|
|
21
|
-
case SET_FORM:
|
|
22
11
|
case SET_SOCIAL:
|
|
23
|
-
return { ...
|
|
12
|
+
return { ...action.payload };
|
|
24
13
|
default:
|
|
25
14
|
return state;
|
|
26
15
|
}
|
|
@@ -6,7 +6,6 @@ import {
|
|
|
6
6
|
SET_FILTER,
|
|
7
7
|
SET_TOTAL_ITEMS,
|
|
8
8
|
SET_CURRENT_SITE_LANGUAGES,
|
|
9
|
-
SET_UPDATED_FORM,
|
|
10
9
|
SET_SAVED_SITE_INFO,
|
|
11
10
|
DEFAULT_PARAMS,
|
|
12
11
|
} from "./constants";
|
|
@@ -17,7 +16,6 @@ import {
|
|
|
17
16
|
ISetFilter,
|
|
18
17
|
ISetTotalItems,
|
|
19
18
|
ISetCurrentSiteLanguagesAction,
|
|
20
|
-
ISetUpdatedFormAction,
|
|
21
19
|
ISetSavedSiteInfoAction,
|
|
22
20
|
} from "./interfaces";
|
|
23
21
|
|
|
@@ -61,64 +59,10 @@ function setCurrentSiteLanguages(currentSiteLanguages: any[]): ISetCurrentSiteLa
|
|
|
61
59
|
return { type: SET_CURRENT_SITE_LANGUAGES, payload: { currentSiteLanguages } };
|
|
62
60
|
}
|
|
63
61
|
|
|
64
|
-
function setUpdatedForm(form: ISettingsForm): ISetUpdatedFormAction {
|
|
65
|
-
return { type: SET_UPDATED_FORM, payload: { form } };
|
|
66
|
-
}
|
|
67
|
-
|
|
68
62
|
function setSavedSiteInfo(savedSiteInfo: ISite): ISetSavedSiteInfoAction {
|
|
69
63
|
return { type: SET_SAVED_SITE_INFO, payload: { savedSiteInfo } };
|
|
70
64
|
}
|
|
71
65
|
|
|
72
|
-
function updateFormValue(valueObj: any): (dispatch: Dispatch, getState: any) => void {
|
|
73
|
-
return (dispatch, getState) => {
|
|
74
|
-
const {
|
|
75
|
-
sites: { form },
|
|
76
|
-
} = getState();
|
|
77
|
-
const updatedForm = { ...form, ...valueObj };
|
|
78
|
-
dispatch(setUpdatedForm(updatedForm));
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
function updateForm(currentSiteInfo: ISite): (dispatch: Dispatch) => void {
|
|
83
|
-
return (dispatch) => {
|
|
84
|
-
const { name, path, domain, timezone, theme, favicon, smallAvatar, bigAvatar, thumbnail, defaultLanguage } =
|
|
85
|
-
currentSiteInfo;
|
|
86
|
-
const siteSettings = {
|
|
87
|
-
name,
|
|
88
|
-
path,
|
|
89
|
-
domain,
|
|
90
|
-
timezone,
|
|
91
|
-
theme,
|
|
92
|
-
favicon,
|
|
93
|
-
smallAvatar,
|
|
94
|
-
bigAvatar,
|
|
95
|
-
thumbnail,
|
|
96
|
-
defaultLanguage,
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
dispatch(setUpdatedForm(siteSettings));
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
function resetForm(): (dispatch: Dispatch) => void {
|
|
104
|
-
return (dispatch) => {
|
|
105
|
-
const form = {
|
|
106
|
-
name: "",
|
|
107
|
-
defaultLanguage: null,
|
|
108
|
-
path: "",
|
|
109
|
-
domain: null,
|
|
110
|
-
timezone: "",
|
|
111
|
-
theme: "",
|
|
112
|
-
favicon: null,
|
|
113
|
-
smallAvatar: null,
|
|
114
|
-
bigAvatar: null,
|
|
115
|
-
thumbnail: null,
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
dispatch(setUpdatedForm(form));
|
|
119
|
-
};
|
|
120
|
-
}
|
|
121
|
-
|
|
122
66
|
// TODO: hay que controlar que cuando da error la API borrar los sites ya guardados y sacar el error (ver los siguientes FIXME)
|
|
123
67
|
function getSites(token: string): (dispatch: Dispatch) => Promise<void> {
|
|
124
68
|
return async (dispatch) => {
|
|
@@ -138,12 +82,12 @@ function getSites(token: string): (dispatch: Dispatch) => Promise<void> {
|
|
|
138
82
|
};
|
|
139
83
|
}
|
|
140
84
|
|
|
141
|
-
function saveSettings(): (dispatch: Dispatch, getState: any) => Promise<boolean> {
|
|
85
|
+
function saveSettings(form: ISettingsForm): (dispatch: Dispatch, getState: any) => Promise<boolean> {
|
|
142
86
|
return async (dispatch, getState) => {
|
|
143
87
|
try {
|
|
144
88
|
dispatch(setIsSaving(true));
|
|
145
89
|
const {
|
|
146
|
-
sites: {
|
|
90
|
+
sites: { currentSiteInfo },
|
|
147
91
|
} = getState();
|
|
148
92
|
|
|
149
93
|
const saveResponse = currentSiteInfo
|
|
@@ -223,7 +167,6 @@ function setSiteInfo(currentSiteInfo: ISite): (dispatch: any, getState: any) =>
|
|
|
223
167
|
|
|
224
168
|
resetSiteValues(dispatch);
|
|
225
169
|
dispatch(setCurrentSiteInfo(currentSiteInfo));
|
|
226
|
-
updateForm(currentSiteInfo)(dispatch);
|
|
227
170
|
|
|
228
171
|
// get site languages
|
|
229
172
|
const response: any = await languages.getSiteLanguages(currentSiteInfo.id);
|
|
@@ -259,7 +202,6 @@ function setSiteInfo(currentSiteInfo: ISite): (dispatch: any, getState: any) =>
|
|
|
259
202
|
const socialResponse: any = await social.getSocial(currentSiteInfo.id);
|
|
260
203
|
if (isReqOk(socialResponse.status)) {
|
|
261
204
|
dispatch(socialActions.setSocial(socialResponse.data));
|
|
262
|
-
dispatch(socialActions.setForm(socialResponse.data));
|
|
263
205
|
} else {
|
|
264
206
|
console.log("Error en sites getSocial"); // FIXME: capturar errores mejor
|
|
265
207
|
}
|
|
@@ -419,7 +361,7 @@ function unpublishSite(siteID: number): (dispatch: Dispatch, getState: any) => P
|
|
|
419
361
|
|
|
420
362
|
const resetSiteValues = (dispatch: Dispatch) => {
|
|
421
363
|
dispatch(setFilter("unique-pages"));
|
|
422
|
-
resetDefaultsValues(dispatch);
|
|
364
|
+
resetDefaultsValues()(dispatch);
|
|
423
365
|
resetPageEditor()(dispatch);
|
|
424
366
|
resetMenuValues(dispatch);
|
|
425
367
|
dispatch(setCurrentSitePages([]));
|
|
@@ -524,8 +466,6 @@ export {
|
|
|
524
466
|
getFilteredContent,
|
|
525
467
|
getSitePages,
|
|
526
468
|
getSiteLanguages,
|
|
527
|
-
updateFormValue,
|
|
528
|
-
resetForm,
|
|
529
469
|
deleteSite,
|
|
530
470
|
publishSite,
|
|
531
471
|
unpublishSite,
|
|
@@ -6,7 +6,6 @@ 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 = `${NAME}/SET_UPDATED_FORM`;
|
|
10
9
|
export const SET_INITIAL_VALUES = `${NAME}/SET_INITIAL_VALUES`;
|
|
11
10
|
export const SET_SAVED_SITE_INFO = `${NAME}/SET_SAVED_SITE_INFO`;
|
|
12
11
|
|
|
@@ -5,7 +5,6 @@ import {
|
|
|
5
5
|
SET_FILTER,
|
|
6
6
|
SET_TOTAL_ITEMS,
|
|
7
7
|
SET_CURRENT_SITE_LANGUAGES,
|
|
8
|
-
SET_UPDATED_FORM,
|
|
9
8
|
SET_INITIAL_VALUES,
|
|
10
9
|
SET_SAVED_SITE_INFO,
|
|
11
10
|
} from "./constants";
|
|
@@ -46,11 +45,6 @@ export interface ISetCurrentSiteLanguagesAction {
|
|
|
46
45
|
payload: { currentSiteLanguages: any[] }; // FIXME: establecer type
|
|
47
46
|
}
|
|
48
47
|
|
|
49
|
-
export interface ISetUpdatedFormAction {
|
|
50
|
-
type: typeof SET_UPDATED_FORM;
|
|
51
|
-
payload: { form: any };
|
|
52
|
-
}
|
|
53
|
-
|
|
54
48
|
export interface ISetInitialValuesAction {
|
|
55
49
|
type: typeof SET_INITIAL_VALUES;
|
|
56
50
|
payload: { initialValues: any };
|
|
@@ -5,12 +5,11 @@ import {
|
|
|
5
5
|
SET_FILTER,
|
|
6
6
|
SET_TOTAL_ITEMS,
|
|
7
7
|
SET_CURRENT_SITE_LANGUAGES,
|
|
8
|
-
SET_UPDATED_FORM,
|
|
9
8
|
SET_INITIAL_VALUES,
|
|
10
9
|
SET_SAVED_SITE_INFO,
|
|
11
10
|
} from "./constants";
|
|
12
11
|
|
|
13
|
-
import { ISite, IPage, ILanguage
|
|
12
|
+
import { ISite, IPage, ILanguage } from "@ax/types";
|
|
14
13
|
|
|
15
14
|
import { SitesActionsCreators } from "./interfaces";
|
|
16
15
|
|
|
@@ -23,8 +22,6 @@ export interface ISitesState {
|
|
|
23
22
|
totalItems: number;
|
|
24
23
|
currentSiteLanguages: ILanguage[];
|
|
25
24
|
savedSiteInfo: any;
|
|
26
|
-
form: ISettingsForm;
|
|
27
|
-
initialValues: ISettingsForm;
|
|
28
25
|
}
|
|
29
26
|
|
|
30
27
|
export const initialState = {
|
|
@@ -36,30 +33,6 @@ export const initialState = {
|
|
|
36
33
|
totalItems: 0,
|
|
37
34
|
currentSiteLanguages: [],
|
|
38
35
|
savedSiteInfo: null,
|
|
39
|
-
form: {
|
|
40
|
-
name: "",
|
|
41
|
-
defaultLanguage: null,
|
|
42
|
-
path: "",
|
|
43
|
-
domain: null,
|
|
44
|
-
timezone: "",
|
|
45
|
-
theme: "",
|
|
46
|
-
favicon: null,
|
|
47
|
-
smallAvatar: null,
|
|
48
|
-
bigAvatar: null,
|
|
49
|
-
thumbnail: null,
|
|
50
|
-
},
|
|
51
|
-
initialValues: {
|
|
52
|
-
name: "",
|
|
53
|
-
defaultLanguage: null,
|
|
54
|
-
path: "",
|
|
55
|
-
domain: null,
|
|
56
|
-
timezone: "",
|
|
57
|
-
theme: "",
|
|
58
|
-
favicon: null,
|
|
59
|
-
smallAvatar: null,
|
|
60
|
-
bigAvatar: null,
|
|
61
|
-
thumbnail: null,
|
|
62
|
-
},
|
|
63
36
|
};
|
|
64
37
|
|
|
65
38
|
export function reducer(state = initialState, action: SitesActionsCreators): ISitesState {
|
|
@@ -70,7 +43,6 @@ export function reducer(state = initialState, action: SitesActionsCreators): ISi
|
|
|
70
43
|
case SET_CURRENT_SITE_PAGES:
|
|
71
44
|
case SET_TOTAL_ITEMS:
|
|
72
45
|
case SET_CURRENT_SITE_LANGUAGES:
|
|
73
|
-
case SET_UPDATED_FORM:
|
|
74
46
|
case SET_INITIAL_VALUES:
|
|
75
47
|
case SET_SAVED_SITE_INFO:
|
|
76
48
|
return { ...state, ...action.payload };
|
package/src/forms/editor.tsx
CHANGED
|
@@ -115,6 +115,7 @@ const cleanPageValues = (updatedValues: any, originalValues: any) => {
|
|
|
115
115
|
delete updatedValues["draft"];
|
|
116
116
|
delete updatedValues["hash"];
|
|
117
117
|
delete updatedValues["editing"];
|
|
118
|
+
delete updatedValues["pageLanguages"];
|
|
118
119
|
|
|
119
120
|
delete originalValues["setAsHome"];
|
|
120
121
|
delete originalValues["modified"];
|
|
@@ -126,6 +127,7 @@ const cleanPageValues = (updatedValues: any, originalValues: any) => {
|
|
|
126
127
|
delete originalValues["draft"];
|
|
127
128
|
delete originalValues["hash"];
|
|
128
129
|
delete originalValues["editing"];
|
|
130
|
+
delete originalValues["pageLanguages"];
|
|
129
131
|
|
|
130
132
|
return {
|
|
131
133
|
cleanUpdatedValues: updatedValues,
|
package/src/forms/validators.tsx
CHANGED
|
@@ -138,6 +138,8 @@ const isEmptyField = (value: any, fieldType: string) => {
|
|
|
138
138
|
return !value || ((!value.href || value.href.trim().length === 0) && !value.linkTo);
|
|
139
139
|
case "AsyncCheckGroup":
|
|
140
140
|
case "CheckGroup":
|
|
141
|
+
case "ComponentArray":
|
|
142
|
+
case "ArrayFieldGroup":
|
|
141
143
|
return !value || !value.length;
|
|
142
144
|
default:
|
|
143
145
|
return typeof value === "string" && value.trim().length === 0;
|
package/src/helpers/dates.tsx
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { format, formatDistanceToNowStrict, addMinutes, isValid, parse } from "date-fns";
|
|
2
2
|
|
|
3
|
-
const formatString = "
|
|
3
|
+
const formatString = "dd/MM/yyyy";
|
|
4
4
|
|
|
5
|
-
const dateToString = (date: Date)
|
|
5
|
+
const dateToString = (date: Date): string => format(new Date(date), formatString);
|
|
6
6
|
const stringToDate = (value: string): Date => parse(value, formatString, new Date());
|
|
7
7
|
|
|
8
|
-
const isValidDate = (value: string)
|
|
8
|
+
const isValidDate = (value: string): boolean => {
|
|
9
9
|
// eslint-disable-next-line
|
|
10
|
-
const regEx = /^[0-9]{
|
|
10
|
+
const regEx = /^[0-9]{2}[\/][0-9]{2}[\/][0-9]{4}$/g;
|
|
11
11
|
if (regEx.test(value)) {
|
|
12
12
|
const date = stringToDate(value);
|
|
13
13
|
return isValid(date);
|
|
@@ -17,12 +17,12 @@ const isValidDate = (value: string) : boolean => {
|
|
|
17
17
|
|
|
18
18
|
const getRange = (value: string) => value.split(" ").join("").trim().split("-");
|
|
19
19
|
|
|
20
|
-
const isValidDateRange = (value: string)
|
|
20
|
+
const isValidDateRange = (value: string): boolean => {
|
|
21
21
|
const range = getRange(value);
|
|
22
22
|
return isValidDate(range[0]) && isValidDate(range[1]);
|
|
23
23
|
};
|
|
24
24
|
|
|
25
|
-
const getDateRange = (value: string): {start: Date; end: Date | null} => {
|
|
25
|
+
const getDateRange = (value: string): { start: Date; end: Date | null } => {
|
|
26
26
|
const range = getRange(value);
|
|
27
27
|
|
|
28
28
|
const startDate = range[0];
|
|
@@ -33,46 +33,45 @@ const getDateRange = (value: string): {start: Date; end: Date | null} => {
|
|
|
33
33
|
|
|
34
34
|
return {
|
|
35
35
|
start: rangeStartDate,
|
|
36
|
-
end: rangeEndDate ? rangeEndDate : rangeStartDate
|
|
36
|
+
end: rangeEndDate ? rangeEndDate : rangeStartDate,
|
|
37
37
|
};
|
|
38
38
|
};
|
|
39
39
|
|
|
40
|
-
const areEqualDates = (date1: Date, date2: Date)
|
|
40
|
+
const areEqualDates = (date1: Date, date2: Date): boolean => dateToString(date1) === dateToString(date2);
|
|
41
41
|
|
|
42
|
-
const getStringifyDateRange = (start: Date, end: Date)
|
|
42
|
+
const getStringifyDateRange = (start: Date, end: Date): string => {
|
|
43
43
|
const equalRangeDates = areEqualDates(start, end);
|
|
44
44
|
|
|
45
45
|
const stringifyDates = {
|
|
46
46
|
start: start ? dateToString(start) : "",
|
|
47
|
-
end: end ? dateToString(end) : ""
|
|
47
|
+
end: end ? dateToString(end) : "",
|
|
48
48
|
};
|
|
49
49
|
|
|
50
|
-
return end && !equalRangeDates
|
|
51
|
-
|
|
52
|
-
: stringifyDates.start;
|
|
53
|
-
}
|
|
50
|
+
return end && !equalRangeDates ? `${stringifyDates.start} - ${stringifyDates.end}` : stringifyDates.start;
|
|
51
|
+
};
|
|
54
52
|
|
|
55
|
-
const getHumanLastModifiedDate = (modified: Date)
|
|
53
|
+
const getHumanLastModifiedDate = (modified: Date): string => {
|
|
56
54
|
const now = new Date();
|
|
57
55
|
const date = new Date(modified);
|
|
58
56
|
const dateWithTimezone = addMinutes(date, date.getTimezoneOffset());
|
|
59
57
|
|
|
60
58
|
const oneDay = 60 * 60 * 24 * 1000;
|
|
61
|
-
const isMoreThan24Hours =
|
|
59
|
+
const isMoreThan24Hours = now.getTime() - dateWithTimezone.getTime() > oneDay;
|
|
62
60
|
|
|
63
|
-
return isMoreThan24Hours
|
|
64
|
-
|
|
65
|
-
}
|
|
61
|
+
return isMoreThan24Hours
|
|
62
|
+
? format(dateWithTimezone, "d MMM HH:mm")
|
|
63
|
+
: formatDistanceToNowStrict(dateWithTimezone, { addSuffix: true });
|
|
64
|
+
};
|
|
66
65
|
|
|
67
|
-
const getFormattedDateWithTimezone = (date: Date, formatString: string)
|
|
66
|
+
const getFormattedDateWithTimezone = (date: Date, formatString: string): string => {
|
|
68
67
|
const objDate = new Date(date);
|
|
69
68
|
return format(addMinutes(objDate, objDate.getTimezoneOffset()), formatString);
|
|
70
|
-
}
|
|
69
|
+
};
|
|
71
70
|
|
|
72
|
-
const getDaysAgo = (date: Date)
|
|
71
|
+
const getDaysAgo = (date: Date): string => {
|
|
73
72
|
const dateObj = new Date(date);
|
|
74
73
|
return formatDistanceToNowStrict(dateObj, { addSuffix: true });
|
|
75
|
-
}
|
|
74
|
+
};
|
|
76
75
|
|
|
77
76
|
export {
|
|
78
77
|
dateToString,
|
|
@@ -84,5 +83,5 @@ export {
|
|
|
84
83
|
getStringifyDateRange,
|
|
85
84
|
getHumanLastModifiedDate,
|
|
86
85
|
getFormattedDateWithTimezone,
|
|
87
|
-
getDaysAgo
|
|
86
|
+
getDaysAgo,
|
|
88
87
|
};
|
package/src/helpers/index.tsx
CHANGED
|
@@ -29,6 +29,7 @@ import {
|
|
|
29
29
|
sortBy,
|
|
30
30
|
getNullValue,
|
|
31
31
|
removeEditorIds,
|
|
32
|
+
trimObject,
|
|
32
33
|
} from "./objects";
|
|
33
34
|
|
|
34
35
|
import {
|
|
@@ -97,6 +98,7 @@ export {
|
|
|
97
98
|
resetMultipleValues,
|
|
98
99
|
getNullValue,
|
|
99
100
|
removeEditorIds,
|
|
101
|
+
trimObject,
|
|
100
102
|
filterDuplicatedValues,
|
|
101
103
|
areEquals,
|
|
102
104
|
removeMenuEditorIds,
|
package/src/helpers/objects.tsx
CHANGED
|
@@ -2,7 +2,7 @@ import { IMenuItem } from "@ax/types";
|
|
|
2
2
|
|
|
3
3
|
const isEmptyObj = (obj: any) => {
|
|
4
4
|
for (const key in obj) {
|
|
5
|
-
if (
|
|
5
|
+
if (Object.prototype.hasOwnProperty.call(obj, key)) return false;
|
|
6
6
|
}
|
|
7
7
|
return true;
|
|
8
8
|
};
|
|
@@ -19,7 +19,9 @@ const resetMultipleValues = (containerValue: any) => {
|
|
|
19
19
|
const nullOptionKeys =
|
|
20
20
|
typeof optionValue === "object" &&
|
|
21
21
|
Object.keys(optionValue)
|
|
22
|
-
.filter(
|
|
22
|
+
.filter(
|
|
23
|
+
(key: string) => key === "component" || key === "editorID" || key === "id" || key === "parentEditorID"
|
|
24
|
+
)
|
|
23
25
|
.map((cleanKey: string) => ({ [cleanKey]: optionValue[cleanKey] }))
|
|
24
26
|
.reduce((accumulator, currValue) => {
|
|
25
27
|
return {
|
|
@@ -89,6 +91,18 @@ const removeEditorIds = (editorContent: any) => {
|
|
|
89
91
|
return cleanEditorContent;
|
|
90
92
|
};
|
|
91
93
|
|
|
94
|
+
const trimObject = (obj: any) => {
|
|
95
|
+
Object.keys(obj).forEach(function (key) {
|
|
96
|
+
if (typeof obj[key] === "string") {
|
|
97
|
+
obj[key] = obj[key].trim();
|
|
98
|
+
}
|
|
99
|
+
if (obj[key] && typeof obj[key] === "object") {
|
|
100
|
+
obj[key] = trimObject(obj[key]);
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
return obj;
|
|
104
|
+
};
|
|
105
|
+
|
|
92
106
|
export {
|
|
93
107
|
isEmptyObj,
|
|
94
108
|
deepClone,
|
|
@@ -100,4 +114,5 @@ export {
|
|
|
100
114
|
sortBy,
|
|
101
115
|
getNullValue,
|
|
102
116
|
removeEditorIds,
|
|
117
|
+
trimObject,
|
|
103
118
|
};
|
package/src/helpers/schemas.tsx
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { schemas, moduleCategories } from "components";
|
|
2
2
|
import { sortBy } from "@ax/helpers";
|
|
3
3
|
import { ModuleCategoryInfo } from "@ax/types";
|
|
4
|
+
import { pageSchemas } from "@ax/schemas";
|
|
4
5
|
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
const
|
|
6
|
+
const allSChemas = { ...schemas.all, ...pageSchemas };
|
|
7
|
+
|
|
8
|
+
const getSchema = (name: string) => allSChemas[name];
|
|
9
|
+
const getDefaultSchema = (name: string) => allSChemas[name].default;
|
|
10
|
+
const getSchemaThumbnails = (name: string) => allSChemas[name].thumbnails;
|
|
8
11
|
const getTemplate = (name: string) => schemas.templates[name];
|
|
9
12
|
const getDefaultTemplate = (name: string) => schemas.templates[name].default;
|
|
10
13
|
const getTemplateThumbnails = (name: string) => schemas.templates[name] && schemas.templates[name].thumbnails;
|
|
@@ -29,7 +32,7 @@ const getTemplateDisplayName = (template: string) => {
|
|
|
29
32
|
};
|
|
30
33
|
|
|
31
34
|
const filterByCategory = (options: any, category: string) =>
|
|
32
|
-
options.filter((option: any) =>
|
|
35
|
+
options.filter((option: any) => allSChemas[option].category === category);
|
|
33
36
|
|
|
34
37
|
const getModuleCategories = (moduleList: string[]): ModuleCategoryInfo[] => {
|
|
35
38
|
const categories: string[] = [];
|