@griddo/ax 10.4.36 → 10.5.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/package.json +2 -2
- package/src/api/checkgroups.tsx +1 -1
- package/src/api/structuredData.tsx +109 -18
- package/src/components/Fields/AsyncCheckGroup/index.tsx +56 -19
- package/src/components/Fields/AsyncCheckGroup/style.tsx +21 -4
- package/src/components/Fields/CheckField/style.tsx +1 -1
- package/src/components/Fields/NoteField/style.tsx +1 -1
- package/src/components/Fields/ReferenceField/AutoPanel/AutoItem/index.tsx +58 -20
- package/src/components/Fields/ReferenceField/AutoPanel/AutoItem/style.tsx +20 -1
- package/src/components/Fields/ReferenceField/Context/index.tsx +9 -9
- package/src/components/LanguageMenu/index.tsx +1 -1
- package/src/components/Tag/index.tsx +3 -2
- package/src/components/Tag/style.tsx +5 -4
- package/src/containers/StructuredData/actions.tsx +169 -82
- package/src/containers/StructuredData/constants.tsx +2 -2
- package/src/containers/StructuredData/interfaces.tsx +16 -9
- package/src/containers/StructuredData/reducer.tsx +11 -7
- package/src/containers/StructuredData/utils.tsx +2 -2
- package/src/global.d.ts +0 -1
- package/src/modules/Categories/CategoriesList/BulkHeader/TableHeader/index.tsx +10 -3
- package/src/modules/Categories/CategoriesList/BulkHeader/TableHeader/style.tsx +12 -6
- package/src/modules/Categories/CategoriesList/BulkHeader/index.tsx +21 -2
- package/src/modules/Categories/CategoriesList/CategoryItem/index.tsx +131 -63
- package/src/modules/Categories/CategoriesList/CategoryItem/style.tsx +67 -7
- package/src/modules/Categories/CategoriesList/CategoryNav/index.tsx +2 -8
- package/src/modules/Categories/CategoriesList/CategoryPanel/Form/index.tsx +88 -33
- package/src/modules/Categories/CategoriesList/CategoryPanel/index.tsx +130 -56
- package/src/modules/Categories/CategoriesList/CategoryPanel/style.tsx +1 -1
- package/src/modules/Categories/CategoriesList/atoms.tsx +46 -19
- package/src/modules/Categories/CategoriesList/helpers.tsx +116 -0
- package/src/modules/Categories/CategoriesList/hooks.tsx +61 -0
- package/src/modules/Categories/CategoriesList/index.tsx +283 -97
- package/src/modules/Categories/CategoriesList/style.tsx +54 -2
- package/src/modules/Categories/CategoriesList/utils.tsx +34 -14
- package/src/modules/StructuredData/StructuredDataList/StructuredDataItem/index.tsx +1 -1
- package/src/modules/Users/UserList/hooks.tsx +5 -4
- package/src/types/index.tsx +64 -3
- package/tsconfig.paths.json +0 -1
|
@@ -14,7 +14,7 @@ const TableWrapper = styled.div`
|
|
|
14
14
|
`;
|
|
15
15
|
|
|
16
16
|
const EmptyWrapper = styled.div`
|
|
17
|
-
height: ${p =>
|
|
17
|
+
height: ${(p) => `calc(100vh - (${p.theme.spacing.xl} * 3))`};
|
|
18
18
|
display: flex;
|
|
19
19
|
align-items: center;
|
|
20
20
|
`;
|
|
@@ -27,4 +27,56 @@ const ModalContent = styled.div`
|
|
|
27
27
|
}
|
|
28
28
|
`;
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
const Droppable = styled.div`
|
|
31
|
+
width: 100%;
|
|
32
|
+
|
|
33
|
+
[data-react-beautiful-dnd-droppable] {
|
|
34
|
+
padding-bottom: 100px;
|
|
35
|
+
}
|
|
36
|
+
`;
|
|
37
|
+
|
|
38
|
+
const Draggable = styled.div``;
|
|
39
|
+
|
|
40
|
+
const Notification = styled.div`
|
|
41
|
+
${(p) => p.theme.textStyle.uiXS};
|
|
42
|
+
color: ${(p) => p.theme.color.textMediumEmphasis};
|
|
43
|
+
background-color: ${(p) => p.theme.color.uiBackground03};
|
|
44
|
+
margin-bottom: ${(p) => p.theme.spacing.xs};
|
|
45
|
+
border-radius: ${(p) => p.theme.radii.s};
|
|
46
|
+
padding: ${(p) => p.theme.spacing.s};
|
|
47
|
+
`;
|
|
48
|
+
|
|
49
|
+
const Intro = styled.div`
|
|
50
|
+
${(p) => p.theme.textStyle.uiM};
|
|
51
|
+
color: ${(p) => p.theme.color.textMediumEmphasis};
|
|
52
|
+
padding: ${(p) => p.theme.spacing.m};
|
|
53
|
+
border-bottom: 1px solid ${(p) => p.theme.color.uiLine};
|
|
54
|
+
`;
|
|
55
|
+
|
|
56
|
+
const IntroTitle = styled.div`
|
|
57
|
+
${(p) => p.theme.textStyle.headingM};
|
|
58
|
+
color: ${(p) => p.theme.color.textHighEmphasis};
|
|
59
|
+
margin-bottom: ${(p) => p.theme.spacing.xs};
|
|
60
|
+
`;
|
|
61
|
+
|
|
62
|
+
const SearchTags = styled.div`
|
|
63
|
+
& > div:nth-child(1) {
|
|
64
|
+
margin-bottom: ${(p) => p.theme.spacing.xs};
|
|
65
|
+
}
|
|
66
|
+
& > div:nth-child(2) {
|
|
67
|
+
margin-bottom: ${(p) => p.theme.spacing.xs};
|
|
68
|
+
}
|
|
69
|
+
`;
|
|
70
|
+
|
|
71
|
+
export {
|
|
72
|
+
CategoryListWrapper,
|
|
73
|
+
TableWrapper,
|
|
74
|
+
EmptyWrapper,
|
|
75
|
+
ModalContent,
|
|
76
|
+
Draggable,
|
|
77
|
+
Droppable,
|
|
78
|
+
Notification,
|
|
79
|
+
Intro,
|
|
80
|
+
IntroTitle,
|
|
81
|
+
SearchTags,
|
|
82
|
+
};
|
|
@@ -1,20 +1,40 @@
|
|
|
1
|
-
import { IDataLanguage,
|
|
1
|
+
import { ICategoryGroup, IDataLanguage, IStructuredDataCategory } from "@ax/types";
|
|
2
2
|
|
|
3
3
|
const getAllLangCategoriesIds = (
|
|
4
|
-
currentCategories:
|
|
5
|
-
selectedItems: Record<string, number[]
|
|
6
|
-
getAllVersions: boolean
|
|
4
|
+
currentCategories: (IStructuredDataCategory | ICategoryGroup)[],
|
|
5
|
+
selectedItems: Record<string, number[]>
|
|
7
6
|
): number[] => {
|
|
8
7
|
let langsCategoryIds: number[] = [];
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
8
|
+
|
|
9
|
+
const selectedCategories = currentCategories.filter((category) => selectedItems.all.includes(category.id));
|
|
10
|
+
langsCategoryIds = selectedCategories.reduce((ids: number[], category: IStructuredDataCategory | ICategoryGroup) => {
|
|
11
|
+
const langsCategoryIds = category.dataLanguages.map((lang: IDataLanguage) => lang.id);
|
|
12
|
+
return [...ids, ...langsCategoryIds];
|
|
13
|
+
}, []);
|
|
14
|
+
|
|
15
|
+
return langsCategoryIds;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const filterCategoriesAndGroups = (
|
|
19
|
+
currentCategories: (IStructuredDataCategory | ICategoryGroup)[]
|
|
20
|
+
): { groups: ICategoryGroup[]; categories: IStructuredDataCategory[] } => {
|
|
21
|
+
const groups = currentCategories.filter(
|
|
22
|
+
(cat: IStructuredDataCategory | ICategoryGroup) => cat.type === "group"
|
|
23
|
+
) as ICategoryGroup[];
|
|
24
|
+
|
|
25
|
+
const categories = currentCategories.filter(
|
|
26
|
+
(cat: IStructuredDataCategory | ICategoryGroup) => cat.type === "category"
|
|
27
|
+
) as IStructuredDataCategory[];
|
|
28
|
+
|
|
29
|
+
return { groups, categories };
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const isCategoryGroup = (obj: any): obj is ICategoryGroup => {
|
|
33
|
+
return obj && Object.prototype.hasOwnProperty.call(obj, "type") && obj.type === "group";
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const isCategory = (obj: any): obj is IStructuredDataCategory => {
|
|
37
|
+
return obj && Object.prototype.hasOwnProperty.call(obj, "type") && obj.type === "category";
|
|
18
38
|
};
|
|
19
39
|
|
|
20
|
-
export { getAllLangCategoriesIds }
|
|
40
|
+
export { getAllLangCategoriesIds, filterCategoriesAndGroups, isCategoryGroup, isCategory };
|
|
@@ -264,7 +264,7 @@ interface IStructuredDataItemProps {
|
|
|
264
264
|
updateForm: (form: any) => void;
|
|
265
265
|
setLanguage(lang: { locale: string; id: number | null }): void;
|
|
266
266
|
deleteStructuredDataContent(id: number): Promise<boolean>;
|
|
267
|
-
setEntity(entity: string): void;
|
|
267
|
+
setEntity(entity: string | null): void;
|
|
268
268
|
getDataContent(id: number, lang: { locale: string; id: number }): void;
|
|
269
269
|
resetForm(): void;
|
|
270
270
|
isSelected: boolean;
|
|
@@ -31,9 +31,10 @@ const useFilterQuery = () => {
|
|
|
31
31
|
let filterQuery = "";
|
|
32
32
|
|
|
33
33
|
const currentQuery = (pointer: string, values: IQueryValue[]): string => {
|
|
34
|
-
const stringValues =
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
const stringValues =
|
|
35
|
+
Array.isArray(values) && values.length
|
|
36
|
+
? values.map((value) => (value.value !== "all" ? value.value : "")).join(",")
|
|
37
|
+
: "";
|
|
37
38
|
|
|
38
39
|
return !stringValues.length
|
|
39
40
|
? filterQuery
|
|
@@ -69,7 +70,7 @@ const useFilterQuery = () => {
|
|
|
69
70
|
const resetFilterQuery = () => {
|
|
70
71
|
setQuery(initialQueryValues);
|
|
71
72
|
setCurrentFilterQuery("");
|
|
72
|
-
}
|
|
73
|
+
};
|
|
73
74
|
|
|
74
75
|
return {
|
|
75
76
|
setFiltersSelection,
|
package/src/types/index.tsx
CHANGED
|
@@ -13,6 +13,7 @@ import { IRedirectsState } from "@ax/containers/Redirects/reducer";
|
|
|
13
13
|
import { IAnalyticsState } from "@ax/containers/Analytics/reducer";
|
|
14
14
|
import { IIntegrationsState } from "@ax/containers/Integrations/reducer";
|
|
15
15
|
import { IFileDriveState } from "@ax/containers/FileDrive/reducer";
|
|
16
|
+
import { Id } from "react-beautiful-dnd";
|
|
16
17
|
|
|
17
18
|
export interface IBreadcrumbItem {
|
|
18
19
|
editorID: number;
|
|
@@ -349,6 +350,7 @@ export interface IGetStructuredDataParams {
|
|
|
349
350
|
relatedFields?: boolean;
|
|
350
351
|
order?: string;
|
|
351
352
|
lang?: number;
|
|
353
|
+
groupingCategories?: boolean;
|
|
352
354
|
}
|
|
353
355
|
|
|
354
356
|
export interface IMenu {
|
|
@@ -453,8 +455,9 @@ export interface IStructuredData {
|
|
|
453
455
|
|
|
454
456
|
export interface IDataLanguage {
|
|
455
457
|
id: number;
|
|
456
|
-
site: number;
|
|
457
458
|
language: number;
|
|
459
|
+
site: null | number;
|
|
460
|
+
page: null | number;
|
|
458
461
|
}
|
|
459
462
|
|
|
460
463
|
export interface IPageLanguage {
|
|
@@ -490,15 +493,54 @@ export interface IStructuredDataContent {
|
|
|
490
493
|
schema: any;
|
|
491
494
|
modified: Date;
|
|
492
495
|
language: number;
|
|
493
|
-
relatedSite?: number;
|
|
496
|
+
relatedSite?: number | null;
|
|
494
497
|
relatedPage?: IRelatedPage;
|
|
495
498
|
dataLanguages: IDataLanguage[];
|
|
496
|
-
entity: string;
|
|
499
|
+
entity: string | null;
|
|
497
500
|
structuredData: string;
|
|
498
501
|
fromPage: boolean;
|
|
499
502
|
dataPacks: string[];
|
|
500
503
|
}
|
|
501
504
|
|
|
505
|
+
export interface IStructuredDataCategory {
|
|
506
|
+
contentId: number;
|
|
507
|
+
type: "category";
|
|
508
|
+
structuredData: string;
|
|
509
|
+
parentGroup: number;
|
|
510
|
+
position: number;
|
|
511
|
+
id: number;
|
|
512
|
+
relatedSite: number | null;
|
|
513
|
+
relatedPage: number | null;
|
|
514
|
+
content: { title: string; code: string };
|
|
515
|
+
entity: string | null;
|
|
516
|
+
draft: boolean;
|
|
517
|
+
published: Date;
|
|
518
|
+
modified: Date;
|
|
519
|
+
deleted: boolean;
|
|
520
|
+
pendingPublishing: boolean;
|
|
521
|
+
language: number;
|
|
522
|
+
originalLanguage: number;
|
|
523
|
+
canBeTranslated: boolean;
|
|
524
|
+
dataLanguages: IDataLanguage[];
|
|
525
|
+
children: [];
|
|
526
|
+
isExpanded?: boolean;
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
export interface ICategoryGroup {
|
|
530
|
+
id: number;
|
|
531
|
+
type: "group";
|
|
532
|
+
structuredData: string;
|
|
533
|
+
parentGroup: number;
|
|
534
|
+
position: number;
|
|
535
|
+
selectable: boolean;
|
|
536
|
+
content: { title: string };
|
|
537
|
+
language: number;
|
|
538
|
+
children: (ICategoryGroup | IStructuredDataCategory)[];
|
|
539
|
+
isExpanded?: boolean;
|
|
540
|
+
entity: string | null;
|
|
541
|
+
dataLanguages: IDataLanguage[];
|
|
542
|
+
}
|
|
543
|
+
|
|
502
544
|
export interface ICategory {
|
|
503
545
|
id?: number;
|
|
504
546
|
name: string;
|
|
@@ -508,6 +550,25 @@ export interface ICategory {
|
|
|
508
550
|
isNew: boolean;
|
|
509
551
|
}
|
|
510
552
|
|
|
553
|
+
export interface ICategoryGroupParams {
|
|
554
|
+
title: string;
|
|
555
|
+
structuredData: string;
|
|
556
|
+
language?: number;
|
|
557
|
+
selectable: boolean;
|
|
558
|
+
entity: string | null;
|
|
559
|
+
relatedSite?: number | "global";
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
export interface IOrderCategoryParams {
|
|
563
|
+
contentId: number;
|
|
564
|
+
type: "category" | "group";
|
|
565
|
+
parentGroup: number;
|
|
566
|
+
position: number;
|
|
567
|
+
structuredData: string;
|
|
568
|
+
relatedSite: number | null;
|
|
569
|
+
language: number;
|
|
570
|
+
}
|
|
571
|
+
|
|
511
572
|
export interface ILanguage {
|
|
512
573
|
id: number;
|
|
513
574
|
locale: string;
|
package/tsconfig.paths.json
CHANGED