@griddo/ax 10.3.23 → 10.3.25
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/__tests__/components/Gallery/GalleryFilters/Orientation/Orientation.test.tsx +5 -2
- package/src/__tests__/components/Gallery/GalleryFilters/SortBy/SortBy.test.tsx +5 -4
- package/src/__tests__/components/Gallery/GalleryFilters/Type/Type.test.tsx +5 -2
- package/src/__tests__/components/TableFilters/CategoryFilter/CategoryFilter.test.tsx +12 -11
- package/src/__tests__/components/TableFilters/DateFilter/DateFilter.test.tsx +17 -16
- package/src/__tests__/components/TableFilters/LiveFilter/LiveFilter.test.tsx +14 -13
- package/src/__tests__/components/TableFilters/NameFilter/NameFilter.test.tsx +21 -20
- package/src/__tests__/components/TableFilters/RoleFilter/RoleFilter.test.tsx +6 -5
- package/src/__tests__/components/TableFilters/SiteFilter/SiteFilter.test.tsx +8 -7
- package/src/__tests__/components/TableFilters/StatusFilter/StatusFilter.test.tsx +21 -20
- package/src/__tests__/components/TableFilters/TranslationsFilter/TranslationsFilter.test.tsx +24 -23
- package/src/__tests__/components/TableFilters/TypeFilter/TypeFilter.test.tsx +6 -5
- package/src/__tests__/components/TableFilters/UsersFilter/UsersFilter.test.tsx +17 -16
- package/src/api/sites.tsx +5 -9
- package/src/components/Button/index.tsx +3 -1
- package/src/components/Button/style.tsx +6 -0
- package/src/components/ConfigPanel/Form/ConnectedField/PageConnectedField/TemplateManager/index.tsx +2 -2
- package/src/components/ConfigPanel/Form/ConnectedField/PageConnectedField/index.tsx +1 -1
- package/src/components/Fields/ArrayFieldGroup/ArrayFieldInline/index.tsx +3 -2
- package/src/components/Fields/ArrayFieldGroup/ArrayFieldItem/index.tsx +3 -1
- package/src/components/Fields/ArrayFieldGroup/index.tsx +5 -2
- package/src/components/Fields/CheckField/style.tsx +2 -2
- package/src/components/Fields/ColorPicker/index.tsx +4 -2
- package/src/components/Fields/ColorPicker/style.tsx +4 -0
- package/src/components/Fields/DateField/DatePickerInput/index.tsx +1 -1
- package/src/components/Fields/FileField/index.tsx +3 -1
- package/src/components/Fields/FileField/style.tsx +9 -4
- package/src/components/Fields/SliderField/index.tsx +4 -2
- package/src/components/Fields/SliderField/style.tsx +53 -4
- package/src/components/Fields/TimeField/style.tsx +6 -5
- package/src/components/FileGallery/index.tsx +26 -16
- package/src/components/FileGallery/style.tsx +12 -1
- package/src/components/FilterTagsBar/index.tsx +61 -0
- package/src/components/FilterTagsBar/style.tsx +30 -0
- package/src/components/FloatingMenu/index.tsx +5 -1
- package/src/components/Gallery/GalleryFilters/Orientation/index.tsx +14 -6
- package/src/components/Gallery/GalleryFilters/SortBy/index.tsx +24 -8
- package/src/components/Gallery/GalleryFilters/Type/index.tsx +22 -9
- package/src/components/Gallery/GalleryPanel/GalleryDragAndDrop/style.tsx +2 -1
- package/src/components/Gallery/hooks.tsx +37 -23
- package/src/components/Gallery/index.tsx +38 -20
- package/src/components/Gallery/style.tsx +15 -2
- package/src/components/MainWrapper/AppBar/index.tsx +3 -0
- package/src/components/MainWrapper/index.tsx +1 -0
- package/src/components/SearchTagsBar/index.tsx +43 -0
- package/src/components/SearchTagsBar/style.tsx +30 -0
- package/src/components/TableFilters/CategoryFilter/index.tsx +17 -10
- package/src/components/TableFilters/CheckGroupFilter/index.tsx +12 -9
- package/src/components/TableFilters/DateFilter/index.tsx +3 -2
- package/src/components/TableFilters/LastAccessFilter/index.tsx +4 -4
- package/src/components/TableFilters/LiveFilter/index.tsx +26 -22
- package/src/components/TableFilters/NameFilter/index.tsx +4 -3
- package/src/components/TableFilters/PermissionsFilter/index.tsx +4 -3
- package/src/components/TableFilters/RoleFilter/index.tsx +17 -7
- package/src/components/TableFilters/SiteFilter/index.tsx +23 -8
- package/src/components/TableFilters/StateFilter/index.tsx +15 -6
- package/src/components/TableFilters/StatusFilter/index.tsx +3 -2
- package/src/components/TableFilters/TranslationsFilter/index.tsx +19 -11
- package/src/components/TableFilters/TypeFilter/index.tsx +9 -5
- package/src/components/TableFilters/UsersFilter/index.tsx +4 -3
- package/src/components/Tag/index.tsx +5 -4
- package/src/components/index.tsx +4 -0
- package/src/containers/Navigation/Menu/actions.tsx +1 -13
- package/src/containers/Navigation/Menu/constants.tsx +0 -1
- package/src/containers/Navigation/Menu/interfaces.tsx +1 -7
- package/src/containers/Navigation/Menu/reducer.tsx +0 -4
- package/src/containers/Sites/actions.tsx +2 -1
- package/src/containers/Sites/interfaces.tsx +2 -2
- package/src/containers/Sites/reducer.tsx +2 -2
- package/src/containers/StructuredData/actions.tsx +2 -1
- package/src/forms/editor.tsx +1 -1
- package/src/modules/Categories/CategoriesList/CategoryItem/style.tsx +2 -0
- package/src/modules/Content/BulkHeader/TableHeader/index.tsx +26 -14
- package/src/modules/Content/BulkHeader/index.tsx +3 -3
- package/src/modules/Content/PageItem/index.tsx +21 -23
- package/src/modules/Content/PageItem/style.tsx +2 -0
- package/src/modules/Content/hooks.tsx +23 -13
- package/src/modules/Content/index.tsx +44 -11
- package/src/modules/Content/style.tsx +19 -1
- package/src/modules/FileDrive/Breadcrumb/style.tsx +1 -1
- package/src/modules/FileDrive/FileDragAndDrop/index.tsx +7 -6
- package/src/modules/FileDrive/FileDragAndDrop/style.tsx +2 -0
- package/src/modules/FileDrive/FileFilters/SortBy/index.tsx +24 -8
- package/src/modules/FileDrive/FileFilters/Type/index.tsx +26 -22
- package/src/modules/FileDrive/hooks.tsx +28 -13
- package/src/modules/FileDrive/index.tsx +31 -18
- package/src/modules/FileDrive/style.tsx +20 -1
- package/src/modules/Navigation/Defaults/Item/style.tsx +2 -0
- package/src/modules/Navigation/Menus/List/Nav/index.tsx +10 -12
- package/src/modules/Navigation/Menus/List/Table/SidePanel/index.tsx +0 -2
- package/src/modules/Navigation/Menus/List/index.tsx +8 -5
- package/src/modules/Redirects/BulkHeader/TableHeader/index.tsx +4 -2
- package/src/modules/Redirects/BulkHeader/index.tsx +3 -2
- package/src/modules/Redirects/hooks.tsx +23 -15
- package/src/modules/Redirects/index.tsx +61 -44
- package/src/modules/Redirects/style.tsx +10 -0
- package/src/modules/Settings/Integrations/BulkHeader/TableHeader/index.tsx +7 -11
- package/src/modules/Settings/Integrations/BulkHeader/index.tsx +4 -8
- package/src/modules/Settings/Integrations/hooks.tsx +23 -19
- package/src/modules/Settings/Integrations/index.tsx +22 -26
- package/src/modules/Settings/Integrations/style.tsx +7 -0
- package/src/modules/Sites/SitesList/GridView/GridHeaderFilter/index.tsx +8 -7
- package/src/modules/Sites/SitesList/ListView/BulkHeader/TableHeader/index.tsx +10 -5
- package/src/modules/Sites/SitesList/ListView/BulkHeader/index.tsx +4 -3
- package/src/modules/Sites/SitesList/hooks.tsx +26 -20
- package/src/modules/Sites/SitesList/index.tsx +53 -22
- package/src/modules/Sites/SitesList/style.tsx +16 -0
- package/src/modules/StructuredData/StructuredDataList/BulkHeader/TableHeader/index.tsx +3 -3
- package/src/modules/StructuredData/StructuredDataList/BulkHeader/index.tsx +3 -3
- package/src/modules/StructuredData/StructuredDataList/GlobalPageItem/index.tsx +3 -3
- package/src/modules/StructuredData/StructuredDataList/GlobalPageItem/style.tsx +2 -0
- package/src/modules/StructuredData/StructuredDataList/StructuredDataItem/style.tsx +2 -0
- package/src/modules/StructuredData/StructuredDataList/hooks.tsx +25 -15
- package/src/modules/StructuredData/StructuredDataList/index.tsx +57 -14
- package/src/modules/StructuredData/StructuredDataList/style.tsx +10 -1
- package/src/modules/Users/Roles/BulkHeader/TableHeader/index.tsx +2 -2
- package/src/modules/Users/Roles/BulkHeader/index.tsx +2 -5
- package/src/modules/Users/Roles/hooks.tsx +24 -15
- package/src/modules/Users/Roles/index.tsx +7 -18
- package/src/modules/Users/UserList/BulkHeader/TableHeader/index.tsx +5 -18
- package/src/modules/Users/UserList/BulkHeader/index.tsx +15 -13
- package/src/modules/Users/UserList/hooks.tsx +27 -25
- package/src/modules/Users/UserList/index.tsx +69 -43
- package/src/modules/Users/UserList/style.tsx +10 -1
- package/src/types/index.tsx +19 -13
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
|
|
3
3
|
import { Icon, FloatingMenu, ListTitle, ListItem } from "@ax/components";
|
|
4
|
+
import { IQueryValue } from "@ax/types";
|
|
4
5
|
|
|
5
6
|
import * as S from "./style";
|
|
6
7
|
|
|
7
8
|
const PermissionsFilter = ({ sortItems, sortedState }: IPermissionsHeaderProps): JSX.Element => {
|
|
8
9
|
const { isAscending, sortedByPermissions } = sortedState;
|
|
9
|
-
const sortAscendingPermissions = () => sortItems("permissions", true);
|
|
10
|
-
const sortDescendingPermissions = () => sortItems("permissions", false);
|
|
10
|
+
const sortAscendingPermissions = () => sortItems([{ value: "permissions", label: "permissions"}], true);
|
|
11
|
+
const sortDescendingPermissions = () => sortItems([{ value: "permissions", label: "permissions"}], false);
|
|
11
12
|
|
|
12
13
|
const SortedStateArrow = () =>
|
|
13
14
|
isAscending ? <Icon name="FullArrowUp" size="16" /> : <Icon name="FullArrowDown" size="16" />;
|
|
@@ -44,7 +45,7 @@ interface IPermissionsHeaderProps {
|
|
|
44
45
|
isAscending: boolean;
|
|
45
46
|
sortedByPermissions: boolean;
|
|
46
47
|
};
|
|
47
|
-
sortItems(orderPointer:
|
|
48
|
+
sortItems(orderPointer: IQueryValue[], isAscendent: boolean): void;
|
|
48
49
|
}
|
|
49
50
|
|
|
50
51
|
export default PermissionsFilter;
|
|
@@ -2,7 +2,7 @@ import React, { useLayoutEffect, useState } from "react";
|
|
|
2
2
|
|
|
3
3
|
import { CheckGroup, FloatingMenu, Icon, ListTitle } from "@ax/components";
|
|
4
4
|
import { areEquals } from "@ax/helpers";
|
|
5
|
-
import { IFilterValue } from "@ax/types";
|
|
5
|
+
import { IFilterValue, IQueryValue } from "@ax/types";
|
|
6
6
|
|
|
7
7
|
import * as S from "./style";
|
|
8
8
|
|
|
@@ -10,11 +10,18 @@ const RoleFilter = (props: IRoleFilterProps): JSX.Element => {
|
|
|
10
10
|
const { filterItems, value, pointer, center = true, label = "Roles", selectAllOption = "all", filters } = props;
|
|
11
11
|
|
|
12
12
|
const initialState = [selectAllOption];
|
|
13
|
-
const
|
|
13
|
+
const parsedValue =
|
|
14
|
+
value && Array.isArray(value[pointer]) && value[pointer].length
|
|
15
|
+
? value[pointer].map((val: IQueryValue) => val.value)
|
|
16
|
+
: initialState;
|
|
17
|
+
const [selectedValue, setSelectedValue] = useState(parsedValue);
|
|
14
18
|
|
|
15
19
|
useLayoutEffect(() => {
|
|
16
|
-
const
|
|
17
|
-
|
|
20
|
+
const parsedValue =
|
|
21
|
+
value && Array.isArray(value[pointer]) && value[pointer].length
|
|
22
|
+
? value[pointer].map((val: IQueryValue) => val.value)
|
|
23
|
+
: initialState;
|
|
24
|
+
setSelectedValue(parsedValue);
|
|
18
25
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
19
26
|
}, [value]);
|
|
20
27
|
|
|
@@ -23,7 +30,10 @@ const RoleFilter = (props: IRoleFilterProps): JSX.Element => {
|
|
|
23
30
|
selection = initialState;
|
|
24
31
|
}
|
|
25
32
|
setSelectedValue(selection);
|
|
26
|
-
const queryFilters = selection.
|
|
33
|
+
const queryFilters: IQueryValue[] = selection.map((value: string | number) => {
|
|
34
|
+
const label = filters && filters.find((opt: IFilterValue) => opt.value === value);
|
|
35
|
+
return { value, label: label?.title || "" };
|
|
36
|
+
});
|
|
27
37
|
filterItems(pointer, queryFilters);
|
|
28
38
|
};
|
|
29
39
|
|
|
@@ -49,8 +59,8 @@ const RoleFilter = (props: IRoleFilterProps): JSX.Element => {
|
|
|
49
59
|
};
|
|
50
60
|
|
|
51
61
|
export interface IRoleFilterProps {
|
|
52
|
-
filterItems(pointer: string, filter:
|
|
53
|
-
value:
|
|
62
|
+
filterItems(pointer: string, filter: IQueryValue[]): void;
|
|
63
|
+
value: Record<string, IQueryValue[]>;
|
|
54
64
|
pointer: string;
|
|
55
65
|
center?: boolean;
|
|
56
66
|
label?: string;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React, { useEffect, useLayoutEffect, useState } from "react";
|
|
2
2
|
|
|
3
3
|
import { CheckGroup, FloatingMenu, Icon, ListTitle } from "@ax/components";
|
|
4
|
-
import { areEquals,
|
|
4
|
+
import { areEquals, isReqOk } from "@ax/helpers";
|
|
5
5
|
import { selects } from "@ax/api";
|
|
6
|
-
import { IFilterValue } from "@ax/types";
|
|
6
|
+
import { IFilterValue, IQueryValue } from "@ax/types";
|
|
7
7
|
|
|
8
8
|
import * as S from "./style";
|
|
9
9
|
|
|
@@ -25,12 +25,18 @@ const SiteFilter = (props: ISiteFilterProps): JSX.Element => {
|
|
|
25
25
|
} = props;
|
|
26
26
|
|
|
27
27
|
const initialState = [selectAllOption];
|
|
28
|
-
const
|
|
28
|
+
const parsedValue =
|
|
29
|
+
Array.isArray(value[pointer]) && value[pointer].length
|
|
30
|
+
? value[pointer].map((val: IQueryValue) => val.value)
|
|
31
|
+
: initialState;
|
|
32
|
+
const [selectedValue, setSelectedValue] = useState(parsedValue);
|
|
29
33
|
const [options, setOptions] = useState(filters);
|
|
30
34
|
|
|
31
35
|
useLayoutEffect(() => {
|
|
32
|
-
const
|
|
33
|
-
|
|
36
|
+
const parsedValue =
|
|
37
|
+
Array.isArray(value[pointer]) && value[pointer].length
|
|
38
|
+
? value[pointer].map((val: IQueryValue) => val.value)
|
|
39
|
+
: initialState;
|
|
34
40
|
setSelectedValue(parsedValue);
|
|
35
41
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
36
42
|
}, [value]);
|
|
@@ -71,7 +77,10 @@ const SiteFilter = (props: ISiteFilterProps): JSX.Element => {
|
|
|
71
77
|
selection = initialState;
|
|
72
78
|
}
|
|
73
79
|
setSelectedValue(selection);
|
|
74
|
-
const queryFilters = selection.
|
|
80
|
+
const queryFilters: IQueryValue[] = selection.map((value: string | number) => {
|
|
81
|
+
const label = options.find((opt: IFilterValue) => opt.value === value);
|
|
82
|
+
return { value, label: label?.title || "" };
|
|
83
|
+
});
|
|
75
84
|
filterItems(pointer, queryFilters);
|
|
76
85
|
};
|
|
77
86
|
|
|
@@ -90,14 +99,20 @@ const SiteFilter = (props: ISiteFilterProps): JSX.Element => {
|
|
|
90
99
|
<FloatingMenu Button={Header} position="left" closeOnSelect={false} isCheckGroup={true}>
|
|
91
100
|
<ListTitle>Filter by Site</ListTitle>
|
|
92
101
|
<S.ChecksWrapper>
|
|
93
|
-
<CheckGroup
|
|
102
|
+
<CheckGroup
|
|
103
|
+
options={options}
|
|
104
|
+
value={selectedValue}
|
|
105
|
+
onChange={setQuery}
|
|
106
|
+
selectAllOption={selectAllOption}
|
|
107
|
+
multipleSelection={true}
|
|
108
|
+
/>
|
|
94
109
|
</S.ChecksWrapper>
|
|
95
110
|
</FloatingMenu>
|
|
96
111
|
);
|
|
97
112
|
};
|
|
98
113
|
|
|
99
114
|
export interface ISiteFilterProps {
|
|
100
|
-
filterItems(pointer: string, filter:
|
|
115
|
+
filterItems(pointer: string, filter: IQueryValue[]): void;
|
|
101
116
|
value: any;
|
|
102
117
|
pointer: string;
|
|
103
118
|
center?: boolean;
|
|
@@ -3,24 +3,33 @@ import React, { useEffect, useState } from "react";
|
|
|
3
3
|
import { Icon, FloatingMenu, ListTitle, ListItem } from "@ax/components";
|
|
4
4
|
|
|
5
5
|
import * as S from "./style";
|
|
6
|
+
import { IQueryValue } from "@ax/types";
|
|
6
7
|
|
|
7
8
|
const StateFilter = (props: IProps): JSX.Element => {
|
|
8
9
|
const { value, filterItems } = props;
|
|
9
10
|
|
|
10
|
-
const [
|
|
11
|
+
const initialState = value && value.length ? value[0].value.toString() : "all";
|
|
12
|
+
const [selectedValue, setSelectedValue] = useState<string>(initialState);
|
|
11
13
|
|
|
12
14
|
const isFilterActived = selectedValue !== "all";
|
|
13
15
|
|
|
16
|
+
const filters: Record<string, string> = {
|
|
17
|
+
all: "All",
|
|
18
|
+
enable: "Enabled",
|
|
19
|
+
disable: "Disabled",
|
|
20
|
+
};
|
|
21
|
+
|
|
14
22
|
useEffect(() => {
|
|
15
|
-
value &&
|
|
23
|
+
const filterValue = value && value.length ? value[0].value.toString() : "all";
|
|
24
|
+
value && setSelectedValue(filterValue);
|
|
16
25
|
}, [value]);
|
|
17
26
|
|
|
18
|
-
const setFilterQuery = (selection:
|
|
27
|
+
const setFilterQuery = (selection: string) => {
|
|
19
28
|
if (!selection.length) {
|
|
20
29
|
selection = "";
|
|
21
30
|
}
|
|
22
31
|
setSelectedValue(selection);
|
|
23
|
-
filterItems("filterState", selection);
|
|
32
|
+
filterItems("filterState", [{ value: selection, label: filters[selection] }]);
|
|
24
33
|
};
|
|
25
34
|
|
|
26
35
|
const sortAllStates = () => setFilterQuery("all");
|
|
@@ -59,8 +68,8 @@ const StateFilter = (props: IProps): JSX.Element => {
|
|
|
59
68
|
};
|
|
60
69
|
|
|
61
70
|
interface IProps {
|
|
62
|
-
filterItems(pointer: string, filter:
|
|
63
|
-
value:
|
|
71
|
+
filterItems(pointer: string, filter: IQueryValue[]): void;
|
|
72
|
+
value: IQueryValue[];
|
|
64
73
|
}
|
|
65
74
|
|
|
66
75
|
export default StateFilter;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
|
|
3
3
|
import { Icon, FloatingMenu, ListTitle, ListItem } from "@ax/components";
|
|
4
|
+
import { IQueryValue } from "@ax/types";
|
|
4
5
|
|
|
5
6
|
import * as S from "./style";
|
|
6
7
|
|
|
@@ -8,7 +9,7 @@ const StatusFilter = (props: IStatusFilterProps) => {
|
|
|
8
9
|
const { sortItems, sortedState, isStructuredData } = props;
|
|
9
10
|
const { isAscending, sortedByDate } = sortedState;
|
|
10
11
|
const value = isStructuredData ? "date" : "modified";
|
|
11
|
-
const sortByModifiedDate = (isAscending: boolean) => sortItems(value, isAscending);
|
|
12
|
+
const sortByModifiedDate = (isAscending: boolean) => sortItems([{ value, label: value }], isAscending);
|
|
12
13
|
|
|
13
14
|
const sortOldestModifiedDate = () => sortByModifiedDate(true);
|
|
14
15
|
const sortMostRecentModifiedDate = () => sortByModifiedDate(false);
|
|
@@ -46,7 +47,7 @@ const StatusFilter = (props: IStatusFilterProps) => {
|
|
|
46
47
|
|
|
47
48
|
export interface IStatusFilterProps {
|
|
48
49
|
sortedState: any;
|
|
49
|
-
sortItems(orderPointer:
|
|
50
|
+
sortItems(orderPointer: IQueryValue[], isAscendent: boolean): any;
|
|
50
51
|
isStructuredData?: boolean;
|
|
51
52
|
}
|
|
52
53
|
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import React, { useState } from "react";
|
|
1
|
+
import React, { useEffect, useState } from "react";
|
|
2
2
|
|
|
3
3
|
import { CheckGroup, FloatingMenu, Icon, ListTitle } from "@ax/components";
|
|
4
|
-
import { areEquals
|
|
4
|
+
import { areEquals } from "@ax/helpers";
|
|
5
|
+
import { IFilterValue, IQueryValue } from "@ax/types";
|
|
5
6
|
|
|
6
7
|
import * as S from "./style";
|
|
7
8
|
|
|
8
9
|
const TranslationsFilter = (props: ITranslationsFilterProps): JSX.Element => {
|
|
9
10
|
const { filterItems, value } = props;
|
|
10
11
|
|
|
11
|
-
const filters = [
|
|
12
|
+
const filters: IFilterValue[] = [
|
|
12
13
|
{
|
|
13
14
|
name: "all",
|
|
14
15
|
value: "all",
|
|
@@ -21,16 +22,23 @@ const TranslationsFilter = (props: ITranslationsFilterProps): JSX.Element => {
|
|
|
21
22
|
},
|
|
22
23
|
];
|
|
23
24
|
|
|
24
|
-
const storedValue = value.split(",");
|
|
25
|
-
const parsedValue = storedValue.map((value) => (isNumber(value) ? parseInt(value) : value));
|
|
26
|
-
const [initialState] = useState(parsedValue);
|
|
27
25
|
const selectAllOption = "all";
|
|
28
|
-
const
|
|
26
|
+
const pointer = "translated";
|
|
27
|
+
const parsedValue = Array.isArray(value) && value.length ? value.map((value) => value.value) : [selectAllOption];
|
|
28
|
+
const [selectedValue, setSelectedValue] = useState(parsedValue);
|
|
29
|
+
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
const arrayValues = Array.isArray(value) && value.length ? value.map((value) => value.value) : [selectAllOption];
|
|
32
|
+
setSelectedValue(arrayValues);
|
|
33
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
34
|
+
}, [value]);
|
|
29
35
|
|
|
30
36
|
const setQuery = (selection: any) => {
|
|
31
37
|
setSelectedValue(selection);
|
|
32
|
-
const queryFilters = selection.
|
|
33
|
-
|
|
38
|
+
const queryFilters: IQueryValue[] = selection.map((value: string | number) => {
|
|
39
|
+
const label = filters.find((opt: IFilterValue) => opt.value === value);
|
|
40
|
+
return { value, label: label?.title || "" };
|
|
41
|
+
});
|
|
34
42
|
filterItems(pointer, queryFilters);
|
|
35
43
|
};
|
|
36
44
|
|
|
@@ -56,8 +64,8 @@ const TranslationsFilter = (props: ITranslationsFilterProps): JSX.Element => {
|
|
|
56
64
|
};
|
|
57
65
|
|
|
58
66
|
export interface ITranslationsFilterProps {
|
|
59
|
-
filterItems(pointer: string, filter:
|
|
60
|
-
value:
|
|
67
|
+
filterItems(pointer: string, filter: IQueryValue[]): void;
|
|
68
|
+
value: IQueryValue[];
|
|
61
69
|
}
|
|
62
70
|
|
|
63
71
|
export default TranslationsFilter;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { useEffect, useState } from "react";
|
|
2
2
|
import { CheckGroup, FloatingMenu, Icon, ListTitle } from "@ax/components";
|
|
3
3
|
import { areEquals } from "@ax/helpers";
|
|
4
|
+
import { IQueryValue } from "@ax/types";
|
|
4
5
|
|
|
5
6
|
import * as S from "./style";
|
|
6
7
|
|
|
@@ -9,11 +10,11 @@ const TypeFilter = (props: ITypeFilterProps): JSX.Element => {
|
|
|
9
10
|
|
|
10
11
|
const initialState = ["all"];
|
|
11
12
|
const selectAllOption = "all";
|
|
12
|
-
const arrayValues = value ? value.
|
|
13
|
+
const arrayValues = Array.isArray(value) && value.length ? value.map((val) => val.value) : initialState;
|
|
13
14
|
const [selectedValue, setSelectedValue] = useState(arrayValues);
|
|
14
15
|
|
|
15
16
|
useEffect(() => {
|
|
16
|
-
const arrayValues = value ? value.
|
|
17
|
+
const arrayValues = Array.isArray(value) && value.length ? value.map((val) => val.value) : initialState;
|
|
17
18
|
setSelectedValue(arrayValues);
|
|
18
19
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
19
20
|
}, [value]);
|
|
@@ -23,7 +24,10 @@ const TypeFilter = (props: ITypeFilterProps): JSX.Element => {
|
|
|
23
24
|
selection = initialState;
|
|
24
25
|
}
|
|
25
26
|
setSelectedValue(selection);
|
|
26
|
-
const queryFilters = selection.
|
|
27
|
+
const queryFilters: IQueryValue[] = selection.map((value: string | number) => {
|
|
28
|
+
const label = filters.find((opt: IFilter) => opt.value === value);
|
|
29
|
+
return { value, label: label?.title || "" };
|
|
30
|
+
});
|
|
27
31
|
filterItems(pointer, queryFilters);
|
|
28
32
|
};
|
|
29
33
|
|
|
@@ -61,10 +65,10 @@ interface IFilter {
|
|
|
61
65
|
}
|
|
62
66
|
|
|
63
67
|
export interface ITypeFilterProps {
|
|
64
|
-
filterItems(pointer: string, filter:
|
|
68
|
+
filterItems(pointer: string, filter: IQueryValue[]): void;
|
|
65
69
|
filters: IFilter[];
|
|
66
70
|
pointer: string;
|
|
67
|
-
value?:
|
|
71
|
+
value?: IQueryValue[];
|
|
68
72
|
}
|
|
69
73
|
|
|
70
74
|
export default TypeFilter;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
|
|
3
3
|
import { Icon, FloatingMenu, ListTitle, ListItem } from "@ax/components";
|
|
4
|
+
import { IQueryValue } from "@ax/types";
|
|
4
5
|
|
|
5
6
|
import * as S from "./style";
|
|
6
7
|
|
|
@@ -8,13 +9,13 @@ const UsersFilter = (props: IUsersFilterProps): JSX.Element => {
|
|
|
8
9
|
const { sortItems, sortedState } = props;
|
|
9
10
|
const { isAscending, sortedByUsers } = sortedState;
|
|
10
11
|
|
|
11
|
-
const sortByUsers = (isAscending: boolean) => sortItems(
|
|
12
|
+
const sortByUsers = (isAscending: boolean) => sortItems([{ value: "users", label: "users"}], isAscending);
|
|
12
13
|
const sortAscendingUsers = () => sortByUsers(true);
|
|
13
14
|
const sortDescendingUsers = () => sortByUsers(false);
|
|
14
15
|
|
|
15
16
|
const SortedStateArrow = () =>
|
|
16
17
|
isAscending ? <Icon name="FullArrowUp" size="16" /> : <Icon name="FullArrowDown" size="16" />;
|
|
17
|
-
|
|
18
|
+
|
|
18
19
|
const isActive = sortedByUsers;
|
|
19
20
|
const title = 'Users';
|
|
20
21
|
|
|
@@ -48,7 +49,7 @@ const UsersFilter = (props: IUsersFilterProps): JSX.Element => {
|
|
|
48
49
|
|
|
49
50
|
export interface IUsersFilterProps {
|
|
50
51
|
sortedState: any;
|
|
51
|
-
sortItems(orderPointer:
|
|
52
|
+
sortItems(orderPointer: IQueryValue[], isAscendent: boolean): void;
|
|
52
53
|
pointer?: string;
|
|
53
54
|
}
|
|
54
55
|
|
|
@@ -4,7 +4,7 @@ import { Icon } from "@ax/components";
|
|
|
4
4
|
import * as S from "./style";
|
|
5
5
|
|
|
6
6
|
const Tag = (props: ITagProps): JSX.Element => {
|
|
7
|
-
const { type, text, color, icon, rounded = true, onDeleteAction } = props;
|
|
7
|
+
const { type, text, color, icon, rounded = true, className, onDeleteAction } = props;
|
|
8
8
|
|
|
9
9
|
const handleClick = () => {
|
|
10
10
|
if (onDeleteAction) {
|
|
@@ -21,14 +21,14 @@ const Tag = (props: ITagProps): JSX.Element => {
|
|
|
21
21
|
switch (type) {
|
|
22
22
|
case "status":
|
|
23
23
|
return (
|
|
24
|
-
<S.TagStatus data-testid="tag-status">
|
|
24
|
+
<S.TagStatus className={className} data-testid="tag-status">
|
|
25
25
|
<S.Bullet color={color} />
|
|
26
26
|
{text}
|
|
27
27
|
</S.TagStatus>
|
|
28
28
|
);
|
|
29
29
|
case "square":
|
|
30
30
|
return (
|
|
31
|
-
<S.TagSquare color={color} data-testid="tag-square">
|
|
31
|
+
<S.TagSquare color={color} className={className} data-testid="tag-square">
|
|
32
32
|
{icon && (
|
|
33
33
|
<S.IconTag>
|
|
34
34
|
<Icon name={icon} size="16" />
|
|
@@ -39,7 +39,7 @@ const Tag = (props: ITagProps): JSX.Element => {
|
|
|
39
39
|
);
|
|
40
40
|
default:
|
|
41
41
|
return (
|
|
42
|
-
<S.TagFixed color={color} rounded={rounded} data-testid="tag-fixed">
|
|
42
|
+
<S.TagFixed color={color} rounded={rounded} className={className} data-testid="tag-fixed">
|
|
43
43
|
<S.TagText>
|
|
44
44
|
<S.Title data-testid="tag-fixed-title">{text}</S.Title>
|
|
45
45
|
{deleteIcon}
|
|
@@ -56,6 +56,7 @@ export interface ITagProps {
|
|
|
56
56
|
rounded?: boolean;
|
|
57
57
|
icon?: string;
|
|
58
58
|
onDeleteAction?: () => void;
|
|
59
|
+
className?: string;
|
|
59
60
|
}
|
|
60
61
|
|
|
61
62
|
export default Tag;
|
package/src/components/index.tsx
CHANGED
|
@@ -71,6 +71,7 @@ import ErrorToast from "./ErrorToast";
|
|
|
71
71
|
import FieldContainer from "./FieldContainer";
|
|
72
72
|
import FieldsBehavior from "./FieldsBehavior";
|
|
73
73
|
import FileGallery from "./FileGallery";
|
|
74
|
+
import FilterTagsBar from "./FilterTagsBar";
|
|
74
75
|
import Flag from "./Flag";
|
|
75
76
|
import FloatingMenu from "./FloatingMenu";
|
|
76
77
|
import FloatingPanel from "./FloatingPanel";
|
|
@@ -95,6 +96,7 @@ import ProgressBar from "./ProgressBar";
|
|
|
95
96
|
import ReorderArrows from "./ReorderArrows";
|
|
96
97
|
import ResizePanel from "./ResizePanel";
|
|
97
98
|
import SearchField from "./SearchField";
|
|
99
|
+
import SearchTagsBar from "./SearchTagsBar";
|
|
98
100
|
import SideModal from "./SideModal";
|
|
99
101
|
import SubNav from "./SubNav";
|
|
100
102
|
import TableCounter from "./TableCounter";
|
|
@@ -178,6 +180,7 @@ export {
|
|
|
178
180
|
FieldContainer,
|
|
179
181
|
FieldsBehavior,
|
|
180
182
|
FileGallery,
|
|
183
|
+
FilterTagsBar,
|
|
181
184
|
Flag,
|
|
182
185
|
FloatingMenu,
|
|
183
186
|
FloatingPanel,
|
|
@@ -202,6 +205,7 @@ export {
|
|
|
202
205
|
ReorderArrows,
|
|
203
206
|
ResizePanel,
|
|
204
207
|
SearchField,
|
|
208
|
+
SearchTagsBar,
|
|
205
209
|
SideModal,
|
|
206
210
|
SubNav,
|
|
207
211
|
TableCounter,
|
|
@@ -8,7 +8,6 @@ import { IMenuItem, IMenu } from "@ax/types";
|
|
|
8
8
|
import {
|
|
9
9
|
SET_ORIGINAL_MENUS,
|
|
10
10
|
SET_EDITOR_MENU,
|
|
11
|
-
SET_TYPE,
|
|
12
11
|
SET_ID,
|
|
13
12
|
SET_ITEM,
|
|
14
13
|
SET_MENU_FORM_DATA,
|
|
@@ -19,7 +18,6 @@ import {
|
|
|
19
18
|
ISetSavedMenus,
|
|
20
19
|
ISetEditorMenu,
|
|
21
20
|
ISetId,
|
|
22
|
-
ISetMenuType,
|
|
23
21
|
ISetItem,
|
|
24
22
|
ISetMenuForm,
|
|
25
23
|
ISetSavedMenu,
|
|
@@ -57,13 +55,6 @@ function setId(id: number): ISetId {
|
|
|
57
55
|
};
|
|
58
56
|
}
|
|
59
57
|
|
|
60
|
-
function setType(type: string): ISetMenuType {
|
|
61
|
-
return {
|
|
62
|
-
type: SET_TYPE,
|
|
63
|
-
payload: { type },
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
|
|
67
58
|
function setItem(item: IMenuItem): ISetItem {
|
|
68
59
|
return {
|
|
69
60
|
type: SET_ITEM,
|
|
@@ -98,7 +89,7 @@ const getStateValues = (getState: any) => {
|
|
|
98
89
|
};
|
|
99
90
|
|
|
100
91
|
function setEditorMenuContent(menus: IMenu[], menuType: string, dispatch: Dispatch) {
|
|
101
|
-
const menu: any = menus.find((menu: IMenu) => menu.name === menuType);
|
|
92
|
+
const menu: any = menus.find((menu: IMenu) => menu.name === menuType) || menus[0];
|
|
102
93
|
const currentMenu = generateEditorIDs(menu).pageContent;
|
|
103
94
|
const id = menu.id;
|
|
104
95
|
|
|
@@ -136,7 +127,6 @@ function getCurrentMenu(menuType: string): (dispatch: Dispatch, getState: any) =
|
|
|
136
127
|
return async (dispatch, getState) => {
|
|
137
128
|
try {
|
|
138
129
|
dispatch(setIsLoading(true));
|
|
139
|
-
dispatch(setType(menuType));
|
|
140
130
|
const { savedMenus } = getStateValues(getState);
|
|
141
131
|
setEditorMenuContent(savedMenus, menuType, dispatch);
|
|
142
132
|
updateTotalItems(dispatch, getState);
|
|
@@ -301,7 +291,6 @@ function resetItemValues(): (dispatch: Dispatch) => Promise<void> {
|
|
|
301
291
|
const resetMenuValues = (dispatch: Dispatch) => {
|
|
302
292
|
dispatch(setSavedMenus([]));
|
|
303
293
|
dispatch(setEditorMenu([]));
|
|
304
|
-
dispatch(setType("MainMenu"));
|
|
305
294
|
dispatch(setMenuFormData(menuInitialState.form));
|
|
306
295
|
};
|
|
307
296
|
|
|
@@ -326,7 +315,6 @@ export {
|
|
|
326
315
|
setSavedMenus,
|
|
327
316
|
setEditorMenu,
|
|
328
317
|
setId,
|
|
329
|
-
setType,
|
|
330
318
|
setItem,
|
|
331
319
|
setEditorMenuContent,
|
|
332
320
|
getMenus,
|
|
@@ -3,7 +3,6 @@ export const NAME: string = "menu";
|
|
|
3
3
|
export const SET_ORIGINAL_MENUS: string = `${NAME}/SET_ORIGINAL_MENUS`;
|
|
4
4
|
export const SET_ORIGINAL_MENU: string = `${NAME}/SET_CURRENT_ORIGINAL_MENU`;
|
|
5
5
|
export const SET_EDITOR_MENU: string = `${NAME}/SET_EDITOR_MENU`;
|
|
6
|
-
export const SET_TYPE: string = `${NAME}/SET_MENU_TYPE`;
|
|
7
6
|
export const SET_ID: string = `${NAME}/SET_ID`;
|
|
8
7
|
export const SET_ITEM: string = `${NAME}/SET_ITEM`;
|
|
9
8
|
export const SET_MENU_FORM_DATA: string = `${NAME}/SET_MENU_FORM_DATA`;
|
|
@@ -4,7 +4,6 @@ import {
|
|
|
4
4
|
SET_ORIGINAL_MENU,
|
|
5
5
|
SET_EDITOR_MENU,
|
|
6
6
|
SET_ID,
|
|
7
|
-
SET_TYPE,
|
|
8
7
|
SET_ITEM,
|
|
9
8
|
SET_MENU_FORM_DATA,
|
|
10
9
|
} from "./constants";
|
|
@@ -29,11 +28,6 @@ export interface ISetId {
|
|
|
29
28
|
payload: { id: number };
|
|
30
29
|
}
|
|
31
30
|
|
|
32
|
-
export interface ISetMenuType {
|
|
33
|
-
type: typeof SET_TYPE;
|
|
34
|
-
payload: { type: string };
|
|
35
|
-
}
|
|
36
|
-
|
|
37
31
|
export interface ISetItem {
|
|
38
32
|
type: typeof SET_ITEM;
|
|
39
33
|
payload: { item: any };
|
|
@@ -49,4 +43,4 @@ export interface ISetTotalItems {
|
|
|
49
43
|
payload: { totalItems: number };
|
|
50
44
|
}
|
|
51
45
|
|
|
52
|
-
export type MenuActionsCreators = ISetSavedMenus & ISetEditorMenu &
|
|
46
|
+
export type MenuActionsCreators = ISetSavedMenus & ISetEditorMenu & ISetItem & ISetTotalItems;
|
|
@@ -2,7 +2,6 @@ import {
|
|
|
2
2
|
SET_ORIGINAL_MENUS,
|
|
3
3
|
SET_ORIGINAL_MENU,
|
|
4
4
|
SET_EDITOR_MENU,
|
|
5
|
-
SET_TYPE,
|
|
6
5
|
SET_ID,
|
|
7
6
|
SET_ITEM,
|
|
8
7
|
SET_MENU_FORM_DATA,
|
|
@@ -17,7 +16,6 @@ export interface IMenuState {
|
|
|
17
16
|
savedMenu: any;
|
|
18
17
|
editorMenu: any;
|
|
19
18
|
id: number | null;
|
|
20
|
-
type: string;
|
|
21
19
|
item: IMenuItem | null;
|
|
22
20
|
form: IMenuForm;
|
|
23
21
|
totalItems: number;
|
|
@@ -30,7 +28,6 @@ const initialState = {
|
|
|
30
28
|
elements: [],
|
|
31
29
|
},
|
|
32
30
|
id: null,
|
|
33
|
-
type: "MainMenu",
|
|
34
31
|
item: null,
|
|
35
32
|
form: {
|
|
36
33
|
url: null,
|
|
@@ -47,7 +44,6 @@ function reducer(state = initialState, action: MenuActionsCreators): IMenuState
|
|
|
47
44
|
case SET_ORIGINAL_MENUS:
|
|
48
45
|
case SET_ORIGINAL_MENU:
|
|
49
46
|
case SET_EDITOR_MENU:
|
|
50
|
-
case SET_TYPE:
|
|
51
47
|
case SET_ID:
|
|
52
48
|
case SET_ITEM:
|
|
53
49
|
case SET_MENU_FORM_DATA:
|
|
@@ -40,6 +40,7 @@ import {
|
|
|
40
40
|
IPage,
|
|
41
41
|
IGetSitesParams,
|
|
42
42
|
ISiteListConfig,
|
|
43
|
+
IQueryValue,
|
|
43
44
|
} from "@ax/types";
|
|
44
45
|
import { sites, languages, dataPack, social, structuredData, analytics, pages } from "@ax/api";
|
|
45
46
|
import { appActions } from "@ax/containers/App";
|
|
@@ -104,7 +105,7 @@ function setCurrentSiteErrorPages(currentSiteErrorPages: number[]): ISetCurrentS
|
|
|
104
105
|
return { type: SET_CURRENT_SITE_ERROR_PAGES, payload: { currentSiteErrorPages } };
|
|
105
106
|
}
|
|
106
107
|
|
|
107
|
-
function setContentFilters(contentFilters: Record<string,
|
|
108
|
+
function setContentFilters(contentFilters: Record<string, IQueryValue[]> | null): ISetContentFilters {
|
|
108
109
|
return { type: SET_CONTENT_FILTERS, payload: { contentFilters } };
|
|
109
110
|
}
|
|
110
111
|
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
SET_SITES_TOTAL_ITEMS,
|
|
15
15
|
SET_CONFIG,
|
|
16
16
|
} from "./constants";
|
|
17
|
-
import { ISite, ISiteListConfig } from "@ax/types";
|
|
17
|
+
import { IQueryValue, ISite, ISiteListConfig } from "@ax/types";
|
|
18
18
|
|
|
19
19
|
export interface ISetFilter {
|
|
20
20
|
type: typeof SET_FILTER;
|
|
@@ -78,7 +78,7 @@ export interface ISetCurrentSiteErrorPages {
|
|
|
78
78
|
|
|
79
79
|
export interface ISetContentFilters {
|
|
80
80
|
type: typeof SET_CONTENT_FILTERS;
|
|
81
|
-
payload: { contentFilters: Record<string,
|
|
81
|
+
payload: { contentFilters: Record<string, IQueryValue[]> | null };
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
export interface ISetConfig {
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
SET_CONFIG,
|
|
16
16
|
} from "./constants";
|
|
17
17
|
|
|
18
|
-
import { ISite, IPage, ILanguage, ISiteListConfig } from "@ax/types";
|
|
18
|
+
import { ISite, IPage, ILanguage, ISiteListConfig, IQueryValue } from "@ax/types";
|
|
19
19
|
|
|
20
20
|
import { SitesActionsCreators } from "./interfaces";
|
|
21
21
|
|
|
@@ -32,7 +32,7 @@ export interface ISitesState {
|
|
|
32
32
|
currentSiteLanguages: ILanguage[];
|
|
33
33
|
savedSiteInfo: any;
|
|
34
34
|
currentSiteErrorPages: number[];
|
|
35
|
-
contentFilters: Record<string,
|
|
35
|
+
contentFilters: Record<string, IQueryValue[]> | null;
|
|
36
36
|
config: ISiteListConfig;
|
|
37
37
|
}
|
|
38
38
|
|
|
@@ -132,7 +132,7 @@ function updateFormValue(valueObj: any): (dispatch: Dispatch, getState: any) =>
|
|
|
132
132
|
const {
|
|
133
133
|
structuredData: { form },
|
|
134
134
|
} = getState();
|
|
135
|
-
|
|
135
|
+
const updatedForm = { ...form, content: { ...form?.content, ...valueObj } };
|
|
136
136
|
|
|
137
137
|
dispatch(updateForm(updatedForm));
|
|
138
138
|
};
|
|
@@ -598,6 +598,7 @@ function resetStructuredData(): (dispatch: Dispatch) => void {
|
|
|
598
598
|
}
|
|
599
599
|
};
|
|
600
600
|
}
|
|
601
|
+
|
|
601
602
|
function getDataContentTranslation(langID: number): (dispatch: Dispatch, getState: any) => Promise<boolean> {
|
|
602
603
|
return async (dispatch, getState) => {
|
|
603
604
|
try {
|
package/src/forms/editor.tsx
CHANGED
|
@@ -70,7 +70,7 @@ const generateEditorIDs = (originalPageContent: any) => {
|
|
|
70
70
|
return component;
|
|
71
71
|
};
|
|
72
72
|
|
|
73
|
-
let pageContent = deepClone(originalPageContent);
|
|
73
|
+
let pageContent = (originalPageContent && deepClone(originalPageContent)) || {};
|
|
74
74
|
pageContent = setEditorID(pageContent, null);
|
|
75
75
|
|
|
76
76
|
return { pageContent };
|