@griddo/ax 1.69.7 → 1.71.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/jest/componentsMock.js +0 -26
- package/package.json +4 -3
- package/src/__tests__/components/ElementsTooltip/ElementsTooltip.test.tsx +97 -0
- package/src/__tests__/components/EmptyState/EmptyState.test.tsx +78 -0
- package/src/__tests__/components/Fields/AnalyticsField/PageAnalytics/PageAnalytics.test.tsx +0 -14
- package/src/__tests__/components/Fields/AnalyticsField/StructuredDataAnalytics/StructuredDataAnalytics.test.tsx +0 -15
- package/src/__tests__/components/Fields/ArrayFieldGroup/ArrayFieldGroup.test.tsx +6 -15
- package/src/__tests__/components/Fields/AsyncCheckGroup/AsyncCheckGroup.test.tsx +1 -13
- package/src/__tests__/components/Fields/AsyncSelect/AsyncSelect.test.tsx +1 -19
- package/src/__tests__/components/Fields/ColorPicker/ColorPicker.test.tsx +1 -10
- package/src/__tests__/components/Fields/ComponentArray/ComponentArray.test.tsx +1 -22
- package/src/__tests__/components/Fields/ComponentArray/MixableComponentArray/MixableComponentArray.test.tsx +4 -24
- package/src/__tests__/components/Fields/ComponentArray/MixableComponentArray/PasteModuleButton/PasteModuleButton.test.tsx +6 -12
- package/src/__tests__/components/Fields/ComponentArray/SameComponentArray/SameComponentArray.test.tsx +1 -20
- package/src/__tests__/components/Fields/ComponentContainer/ComponentContainer.test.tsx +559 -0
- package/src/__tests__/components/Fields/HiddenField/HiddenField.test.tsx +1 -7
- package/src/__tests__/components/Fields/ImageField/ImageField.test.tsx +471 -0
- package/src/__tests__/components/Fields/MultiCheckSelect/MultiCheckSelect.test.tsx +1 -15
- package/src/__tests__/components/Fields/NoteField/NoteField.test.tsx +1 -6
- package/src/__tests__/components/Fields/NumberField/NumberField.test.tsx +1 -14
- package/src/__tests__/components/Fields/RadioField/RadioField.test.tsx +1 -11
- package/src/__tests__/components/Fields/ReferenceField/ReferenceField.test.tsx +77 -13
- package/src/__tests__/components/Fields/RichText/RichText.test.tsx +1 -12
- package/src/__tests__/components/Fields/Select/Select.test.tsx +1 -21
- package/src/__tests__/components/Fields/SliderField/SliderField.test.tsx +1 -14
- package/src/__tests__/components/Fields/TagField/TagField.test.tsx +3 -3
- package/src/__tests__/components/Fields/TimeField/HourInput/HourInput.test.tsx +142 -0
- package/src/__tests__/components/Fields/TimeField/TimeField.test.tsx +100 -0
- package/src/__tests__/components/Fields/ToggleField/ToggleField.test.tsx +1 -9
- package/src/__tests__/components/Fields/Tooltip/Tooltip.test.tsx +151 -0
- package/src/__tests__/components/Fields/VisualUniqueSelection/ImageSelection/ImageSelection.test.tsx +1 -13
- package/src/__tests__/components/Fields/VisualUniqueSelection/ScrollableSelection/ScrollableSelection.test.tsx +3 -17
- package/src/__tests__/components/Fields/VisualUniqueSelection/VisualUniqueSelection.test.tsx +2 -28
- package/src/__tests__/components/TableList/TableList.test.tsx +119 -0
- package/src/__tests__/components/Tabs/Tabs.test.tsx +202 -0
- package/src/__tests__/components/Tag/Tag.test.tsx +138 -0
- package/src/__tests__/components/Toast/Toast.test.tsx +100 -0
- package/src/api/navigation.tsx +1 -1
- package/src/components/Browser/index.tsx +1 -1
- package/src/components/Button/index.tsx +3 -3
- package/src/components/ConfigPanel/NavigationForm/Field/index.tsx +14 -3
- package/src/components/ElementsTooltip/index.tsx +10 -9
- package/src/components/EmptyState/index.tsx +2 -2
- package/src/components/Fields/ArrayFieldGroup/index.tsx +1 -1
- package/src/components/Fields/AsyncCheckGroup/index.tsx +1 -1
- package/src/components/Fields/AsyncSelect/index.tsx +1 -1
- package/src/components/Fields/ComponentContainer/index.tsx +7 -6
- package/src/components/Fields/ComponentContainer/style.tsx +2 -2
- package/src/components/Fields/HiddenField/index.tsx +1 -1
- package/src/components/Fields/ImageField/index.tsx +10 -5
- package/src/components/Fields/MultiCheckSelect/index.tsx +3 -3
- package/src/components/Fields/NumberField/index.tsx +2 -1
- package/src/components/Fields/ReferenceField/ItemList/Item/index.tsx +5 -7
- package/src/components/Fields/ReferenceField/ItemList/Item/style.tsx +2 -2
- package/src/components/Fields/ReferenceField/ItemList/index.tsx +1 -1
- package/src/components/Fields/RichText/index.tsx +10 -6
- package/src/components/Fields/Select/index.tsx +1 -1
- package/src/components/Fields/SliderField/index.tsx +1 -1
- package/src/components/Fields/TimeField/HourInput/index.tsx +103 -0
- package/src/components/Fields/TimeField/HourInput/style.tsx +19 -0
- package/src/components/Fields/TimeField/HourInput/utils.tsx +35 -0
- package/src/components/Fields/TimeField/index.tsx +57 -0
- package/src/components/Fields/TimeField/style.tsx +37 -0
- package/src/components/Fields/index.tsx +2 -0
- package/src/components/FloatingMenu/index.tsx +1 -1
- package/src/components/Gallery/GalleryFilters/Type/index.tsx +50 -0
- package/src/components/Gallery/GalleryFilters/Type/style.tsx +39 -0
- package/src/components/Gallery/GalleryPanel/DetailPanel/index.tsx +2 -1
- package/src/components/Gallery/GalleryPanel/GalleryDragAndDrop/style.tsx +3 -3
- package/src/components/Gallery/hooks.tsx +10 -4
- package/src/components/Gallery/index.tsx +2 -0
- package/src/components/Icon/index.tsx +1 -1
- package/src/components/Loading/index.tsx +1 -1
- package/src/components/Pagination/index.tsx +1 -1
- package/src/components/SideModal/SideModalOption/index.tsx +4 -2
- package/src/components/SideModal/index.tsx +1 -1
- package/src/components/TableList/index.tsx +6 -6
- package/src/components/TableList/style.tsx +1 -1
- package/src/components/Tabs/index.tsx +19 -7
- package/src/components/Tag/index.tsx +6 -6
- package/src/components/Toast/index.tsx +4 -4
- package/src/components/Tooltip/index.tsx +5 -3
- package/src/components/index.tsx +2 -0
- package/src/containers/Navigation/Defaults/actions.tsx +10 -5
- package/src/containers/Navigation/Defaults/utils.tsx +13 -4
- package/src/containers/Sites/actions.tsx +7 -0
- package/src/containers/Sites/constants.tsx +1 -0
- package/src/containers/Sites/interfaces.tsx +6 -0
- package/src/containers/Sites/reducer.tsx +4 -0
- package/src/containers/StructuredData/actions.tsx +21 -8
- package/src/containers/StructuredData/constants.tsx +2 -0
- package/src/containers/StructuredData/interfaces.tsx +7 -1
- package/src/containers/StructuredData/reducer.tsx +5 -1
- package/src/helpers/fields.tsx +2 -2
- package/src/helpers/schemas.tsx +2 -2
- package/src/hooks/forms.tsx +2 -1
- package/src/modules/App/Routing/NavMenu/index.tsx +9 -1
- package/src/modules/Content/BulkHeader/TableHeader/index.tsx +1 -1
- package/src/modules/Content/hooks.tsx +19 -12
- package/src/modules/Content/index.tsx +23 -14
- package/src/modules/Navigation/Defaults/DefaultsEditor/Editor/DefaultsBrowser/index.tsx +3 -0
- package/src/modules/Navigation/Defaults/DefaultsEditor/Editor/index.tsx +3 -1
- package/src/modules/Navigation/Defaults/DefaultsEditor/index.tsx +16 -18
- package/src/modules/Navigation/Defaults/DefaultsEditor/utils.tsx +37 -0
- package/src/modules/StructuredData/Form/ConnectedField/index.tsx +3 -2
- package/src/modules/StructuredData/Form/index.tsx +22 -17
- package/src/modules/StructuredData/StructuredDataList/hooks.tsx +30 -20
- package/src/modules/StructuredData/StructuredDataList/index.tsx +24 -14
- package/src/types/index.tsx +8 -7
|
@@ -11,7 +11,7 @@ import * as S from "./style";
|
|
|
11
11
|
const ConnectedField = (props: IProps) => {
|
|
12
12
|
const { field, site, form, fieldKey, updateFormValue, disabled, errors, deleteError, theme } = props;
|
|
13
13
|
|
|
14
|
-
const value = form
|
|
14
|
+
const value = form?.content && form.content[fieldKey];
|
|
15
15
|
const error = errors.find((err: any) => err.key === field.key);
|
|
16
16
|
|
|
17
17
|
const handleChange = (newValue: any) => updateFormValue({ [fieldKey]: newValue });
|
|
@@ -22,7 +22,7 @@ const ConnectedField = (props: IProps) => {
|
|
|
22
22
|
let innerFields: JSX.Element[] = [];
|
|
23
23
|
|
|
24
24
|
if (isConditional || isArrayGroup) {
|
|
25
|
-
innerFields = getStructuredDataInnerFields(field.fields, form
|
|
25
|
+
innerFields = getStructuredDataInnerFields(field.fields, form?.content, updateFormValue, theme, errors);
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
const fieldProps = {
|
|
@@ -37,6 +37,7 @@ const ConnectedField = (props: IProps) => {
|
|
|
37
37
|
error,
|
|
38
38
|
deleteError,
|
|
39
39
|
theme,
|
|
40
|
+
delayed: false,
|
|
40
41
|
};
|
|
41
42
|
|
|
42
43
|
return (
|
|
@@ -40,12 +40,11 @@ const Form = (props: IProps) => {
|
|
|
40
40
|
validated,
|
|
41
41
|
validateForm,
|
|
42
42
|
currentStructuredDataId,
|
|
43
|
-
resetForm,
|
|
44
43
|
skipReviewOnPublish,
|
|
45
44
|
} = props;
|
|
46
45
|
|
|
47
|
-
const [isNewStructuredData, setIsNewStructuredData] = useState(!
|
|
48
|
-
const { isDirty, resetDirty } = useIsDirty(form);
|
|
46
|
+
const [isNewStructuredData, setIsNewStructuredData] = useState(!currentStructuredDataId);
|
|
47
|
+
const { isDirty, resetDirty, setIsDirty } = useIsDirty(form);
|
|
49
48
|
|
|
50
49
|
const { fields } = schema;
|
|
51
50
|
|
|
@@ -60,17 +59,25 @@ const Form = (props: IProps) => {
|
|
|
60
59
|
const theme = getDefaultTheme();
|
|
61
60
|
|
|
62
61
|
useEffect(() => {
|
|
63
|
-
|
|
64
|
-
|
|
62
|
+
const handleGetContent = async (dataID: number) => {
|
|
63
|
+
await getDataContent(dataID);
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
if (currentStructuredDataId) {
|
|
67
|
+
handleGetContent(currentStructuredDataId);
|
|
68
|
+
} else {
|
|
69
|
+
setIsDirty(true);
|
|
70
|
+
}
|
|
71
|
+
|
|
65
72
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
66
|
-
}, [
|
|
73
|
+
}, []);
|
|
67
74
|
|
|
68
75
|
const Fields =
|
|
69
76
|
fields &&
|
|
70
77
|
fields.map((field: any, i: number) => {
|
|
71
78
|
const { type, key } = field;
|
|
72
79
|
if (key === "title") {
|
|
73
|
-
title = form
|
|
80
|
+
title = form?.content && form.content[key] ? form.content[key] : "";
|
|
74
81
|
}
|
|
75
82
|
return (
|
|
76
83
|
<ConnectedField
|
|
@@ -116,14 +123,14 @@ const Form = (props: IProps) => {
|
|
|
116
123
|
|
|
117
124
|
const getSaveLabel = () => {
|
|
118
125
|
if (isNewStructuredData) return "Save";
|
|
119
|
-
return form
|
|
126
|
+
return form?.draft ? "Save" : "Save & publish";
|
|
120
127
|
};
|
|
121
128
|
|
|
122
129
|
const handleSaveAndPublish = () => (isNewStructuredData || form.draft ? handleSave(false) : handleSave(true));
|
|
123
130
|
|
|
124
131
|
const rightButtonProps = {
|
|
125
132
|
label: isSaving ? "Saving" : getSaveLabel(),
|
|
126
|
-
disabled: isSaving || isDisabled,
|
|
133
|
+
disabled: isSaving || isDisabled || !isDirty,
|
|
127
134
|
action: handleSaveAndPublish,
|
|
128
135
|
};
|
|
129
136
|
|
|
@@ -142,7 +149,7 @@ const Form = (props: IProps) => {
|
|
|
142
149
|
const getCurrentLanguages = () => {
|
|
143
150
|
const availables: any[] = [];
|
|
144
151
|
|
|
145
|
-
form
|
|
152
|
+
form?.dataLanguages &&
|
|
146
153
|
form.dataLanguages.forEach(
|
|
147
154
|
(dataLang: any) =>
|
|
148
155
|
languages &&
|
|
@@ -228,7 +235,7 @@ const Form = (props: IProps) => {
|
|
|
228
235
|
|
|
229
236
|
const downArrowMenu = {
|
|
230
237
|
displayed: true,
|
|
231
|
-
button: getPublishButton(form
|
|
238
|
+
button: getPublishButton(form?.draft),
|
|
232
239
|
options: [
|
|
233
240
|
{
|
|
234
241
|
label: "Review",
|
|
@@ -243,7 +250,7 @@ const Form = (props: IProps) => {
|
|
|
243
250
|
],
|
|
244
251
|
};
|
|
245
252
|
|
|
246
|
-
const status = form.draft === true || form.draft === undefined ? "offline" : "active";
|
|
253
|
+
const status = !form || form.draft === true || form.draft === undefined ? "offline" : "active";
|
|
247
254
|
|
|
248
255
|
const languageProps = {
|
|
249
256
|
lang: isDataTranslatable ? lang : null,
|
|
@@ -273,7 +280,7 @@ const Form = (props: IProps) => {
|
|
|
273
280
|
pageStatus={status}
|
|
274
281
|
downArrowMenu={downArrowMenu}
|
|
275
282
|
isFromEditor={true}
|
|
276
|
-
currentPageID={form
|
|
283
|
+
currentPageID={form?.id}
|
|
277
284
|
errors={errors}
|
|
278
285
|
>
|
|
279
286
|
{isDisabled && (
|
|
@@ -305,7 +312,7 @@ const Form = (props: IProps) => {
|
|
|
305
312
|
|
|
306
313
|
interface IProps {
|
|
307
314
|
schema: any;
|
|
308
|
-
form: any;
|
|
315
|
+
form: any | null;
|
|
309
316
|
site: ISite | null;
|
|
310
317
|
currentStructuredData: any;
|
|
311
318
|
isSaving: boolean;
|
|
@@ -322,13 +329,12 @@ interface IProps {
|
|
|
322
329
|
createStructuredDataContent: (payload: any) => Promise<boolean>;
|
|
323
330
|
updateStructuredDataContent: (payload: any) => Promise<boolean>;
|
|
324
331
|
setLanguage(lang: { locale: string; id: number | null }): void;
|
|
325
|
-
getDataContent(id: number): void
|
|
332
|
+
getDataContent(id: number): Promise<void>;
|
|
326
333
|
setHistoryPush(path: string, isEditor?: boolean): void;
|
|
327
334
|
getSiteDataPack(packID: string): void;
|
|
328
335
|
setDataStatus(id: number, status: string): Promise<boolean>;
|
|
329
336
|
deleteStructuredDataContent(id: number): Promise<boolean>;
|
|
330
337
|
validateForm(publish?: boolean): Promise<boolean>;
|
|
331
|
-
resetForm(): void;
|
|
332
338
|
}
|
|
333
339
|
|
|
334
340
|
const mapStateToProps = (state: IRootState) => ({
|
|
@@ -359,7 +365,6 @@ const mapDispatchToProps = {
|
|
|
359
365
|
setDataStatus: structuredDataActions.setStatusStructuredDataContent,
|
|
360
366
|
deleteStructuredDataContent: structuredDataActions.deleteStructuredDataContent,
|
|
361
367
|
validateForm: structuredDataActions.validateForm,
|
|
362
|
-
resetForm: structuredDataActions.resetForm,
|
|
363
368
|
};
|
|
364
369
|
|
|
365
370
|
export default connect(mapStateToProps, mapDispatchToProps)(Form);
|
|
@@ -17,7 +17,10 @@ const useSortedListStatus = (): IUseSortedListStatus => {
|
|
|
17
17
|
};
|
|
18
18
|
};
|
|
19
19
|
|
|
20
|
-
const useFilterQuery = (
|
|
20
|
+
const useFilterQuery = (
|
|
21
|
+
currentStructuredData: IStructuredData | null,
|
|
22
|
+
values: Record<string, IStructuredDataQueryValues> | null
|
|
23
|
+
): IUseFilterQuery => {
|
|
21
24
|
const structuredDataType = currentStructuredData ? currentStructuredData.id : "all";
|
|
22
25
|
const initialQueryValues = {
|
|
23
26
|
types: "all",
|
|
@@ -29,16 +32,7 @@ const useFilterQuery = (currentStructuredData: IStructuredData | null): IUseFilt
|
|
|
29
32
|
related: "all",
|
|
30
33
|
};
|
|
31
34
|
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
useEffect(() => {
|
|
35
|
-
if (!query[structuredDataType]) {
|
|
36
|
-
setQuery((state) => ({ [structuredDataType]: initialQueryValues, ...state }));
|
|
37
|
-
}
|
|
38
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
39
|
-
}, [structuredDataType]);
|
|
40
|
-
|
|
41
|
-
const setFilterQuery = (filterValues: IStructuredDataQueryValues) => {
|
|
35
|
+
const getFilterQuery = (filterValues: IStructuredDataQueryValues) => {
|
|
42
36
|
const { types, translated, liveStatus, order, filterSites, categories, related } = filterValues;
|
|
43
37
|
let filterQuery = "";
|
|
44
38
|
|
|
@@ -61,9 +55,22 @@ const useFilterQuery = (currentStructuredData: IStructuredData | null): IUseFilt
|
|
|
61
55
|
return filterQuery;
|
|
62
56
|
};
|
|
63
57
|
|
|
58
|
+
const initState = values ? values : { all: initialQueryValues };
|
|
59
|
+
const [state, setState] = useState<Record<string, IStructuredDataQueryValues>>(initState);
|
|
60
|
+
|
|
61
|
+
const initQuery = values && values[structuredDataType] ? getFilterQuery(values[structuredDataType]) : "";
|
|
62
|
+
const [query, setQuery] = useState(initQuery);
|
|
63
|
+
|
|
64
|
+
useEffect(() => {
|
|
65
|
+
if (!state[structuredDataType]) {
|
|
66
|
+
setState((state) => ({ [structuredDataType]: initialQueryValues, ...state }));
|
|
67
|
+
}
|
|
68
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
69
|
+
}, [structuredDataType]);
|
|
70
|
+
|
|
64
71
|
const setFiltersSelection = (pointer: string, filter: string, isAscendent?: boolean) => {
|
|
65
72
|
const { types, translated, liveStatus, order, filterSites, categories, related } =
|
|
66
|
-
|
|
73
|
+
state[structuredDataType] || initialQueryValues;
|
|
67
74
|
const orderMethod = isAscendent ? "asc" : "desc";
|
|
68
75
|
const filterValues = {
|
|
69
76
|
types: pointer === "types" ? filter : types,
|
|
@@ -75,18 +82,21 @@ const useFilterQuery = (currentStructuredData: IStructuredData | null): IUseFilt
|
|
|
75
82
|
related: pointer === "related" ? filter : related,
|
|
76
83
|
};
|
|
77
84
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
85
|
+
setState((state) => ({ ...state, [structuredDataType]: filterValues }));
|
|
86
|
+
const filterQuery = getFilterQuery(filterValues);
|
|
87
|
+
setQuery(filterQuery);
|
|
81
88
|
};
|
|
82
89
|
|
|
83
|
-
const resetFilterQuery = () =>
|
|
90
|
+
const resetFilterQuery = () => {
|
|
91
|
+
setState({ [structuredDataType]: initialQueryValues });
|
|
92
|
+
setQuery("");
|
|
93
|
+
};
|
|
84
94
|
|
|
85
95
|
return {
|
|
86
96
|
setFiltersSelection,
|
|
87
|
-
setFilterQuery,
|
|
88
97
|
resetFilterQuery,
|
|
89
|
-
filterValues:
|
|
98
|
+
filterValues: state,
|
|
99
|
+
query,
|
|
90
100
|
};
|
|
91
101
|
};
|
|
92
102
|
|
|
@@ -96,10 +106,10 @@ interface IUseSortedListStatus {
|
|
|
96
106
|
}
|
|
97
107
|
|
|
98
108
|
interface IUseFilterQuery {
|
|
99
|
-
setFiltersSelection(pointer: string, filter: string, isAscendent?: boolean):
|
|
100
|
-
setFilterQuery(filterValues: IStructuredDataQueryValues): string;
|
|
109
|
+
setFiltersSelection(pointer: string, filter: string, isAscendent?: boolean): void;
|
|
101
110
|
resetFilterQuery(): void;
|
|
102
111
|
filterValues: Record<string, IStructuredDataQueryValues>;
|
|
112
|
+
query: string;
|
|
103
113
|
}
|
|
104
114
|
|
|
105
115
|
export { useSortedListStatus, useFilterQuery };
|
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
IPage,
|
|
17
17
|
ICheck,
|
|
18
18
|
IColumn,
|
|
19
|
+
IStructuredDataQueryValues,
|
|
19
20
|
} from "@ax/types";
|
|
20
21
|
import {
|
|
21
22
|
ISetCurrentPageIDAction,
|
|
@@ -86,6 +87,8 @@ const StructuredDataList = (props: IProps): JSX.Element => {
|
|
|
86
87
|
resetCurrentSiteErrorPages,
|
|
87
88
|
currentSiteErrorPages,
|
|
88
89
|
skipReviewOnPublish,
|
|
90
|
+
setContentFilters,
|
|
91
|
+
contentFilters,
|
|
89
92
|
} = props;
|
|
90
93
|
|
|
91
94
|
const itemsPerPage = 50;
|
|
@@ -108,8 +111,12 @@ const StructuredDataList = (props: IProps): JSX.Element => {
|
|
|
108
111
|
const { isOpen: isNewOpen, toggleModal: toggleNewModal } = useModal();
|
|
109
112
|
const { isOpen: isDeleteOpen, toggleModal: toggleDeleteModal } = useModal();
|
|
110
113
|
const { sortedListStatus, setSortedListStatus } = useSortedListStatus();
|
|
111
|
-
const {
|
|
112
|
-
|
|
114
|
+
const {
|
|
115
|
+
setFiltersSelection,
|
|
116
|
+
filterValues,
|
|
117
|
+
resetFilterQuery,
|
|
118
|
+
query: currentFilterQuery,
|
|
119
|
+
} = useFilterQuery(currentStructuredData, contentFilters);
|
|
113
120
|
const history = useHistory();
|
|
114
121
|
const [isFirstRender, setIsFirstRender] = useState(true);
|
|
115
122
|
const [deleteAllVersions, setDeleteAllVersions] = useState(false);
|
|
@@ -218,6 +225,7 @@ const StructuredDataList = (props: IProps): JSX.Element => {
|
|
|
218
225
|
setIsFirstRender(false);
|
|
219
226
|
resetPageEditor();
|
|
220
227
|
resetCurrentSiteErrorPages();
|
|
228
|
+
resetForm();
|
|
221
229
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
222
230
|
}, []);
|
|
223
231
|
|
|
@@ -264,10 +272,7 @@ const StructuredDataList = (props: IProps): JSX.Element => {
|
|
|
264
272
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
265
273
|
}, [currentDataContent]);
|
|
266
274
|
|
|
267
|
-
const resetFilterValues = () =>
|
|
268
|
-
resetFilterQuery();
|
|
269
|
-
setCurrentFilterQuery("");
|
|
270
|
-
};
|
|
275
|
+
const resetFilterValues = () => resetFilterQuery();
|
|
271
276
|
|
|
272
277
|
useEffect(() => {
|
|
273
278
|
if (!isFirstRender && !isLoading) {
|
|
@@ -296,6 +301,11 @@ const StructuredDataList = (props: IProps): JSX.Element => {
|
|
|
296
301
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
297
302
|
}, []);
|
|
298
303
|
|
|
304
|
+
useEffect(() => {
|
|
305
|
+
setContentFilters(filterValues);
|
|
306
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
307
|
+
}, [filterValues]);
|
|
308
|
+
|
|
299
309
|
const handleClick = (isFromPage?: boolean, globalPage?: IPage, forceLive?: boolean) => {
|
|
300
310
|
if (isFromPage && globalPage) {
|
|
301
311
|
const pageID = globalPage.haveDraftPage && !forceLive ? globalPage.haveDraftPage : globalPage.id;
|
|
@@ -312,7 +322,7 @@ const StructuredDataList = (props: IProps): JSX.Element => {
|
|
|
312
322
|
|
|
313
323
|
const createNewData = () => {
|
|
314
324
|
setCurrentDataID(null);
|
|
315
|
-
resetForm();
|
|
325
|
+
resetForm(true);
|
|
316
326
|
handleClick();
|
|
317
327
|
};
|
|
318
328
|
|
|
@@ -404,17 +414,13 @@ const StructuredDataList = (props: IProps): JSX.Element => {
|
|
|
404
414
|
const sortedState = getSortedListStatus(orderPointer, isAscending);
|
|
405
415
|
setSortedListStatus(sortedState);
|
|
406
416
|
|
|
407
|
-
|
|
408
|
-
const filterQuery = setFilterQuery(filtersSelection);
|
|
409
|
-
setCurrentFilterQuery(filterQuery);
|
|
417
|
+
setFiltersSelection("order", orderPointer, isAscending);
|
|
410
418
|
};
|
|
411
419
|
|
|
412
420
|
const filterItems = async (filterPointer: string, filtersSelected: string) => {
|
|
413
421
|
setPage(firstPage);
|
|
414
422
|
if (!isStructuredDataFromPage && filterPointer === "categories") filterPointer = "related";
|
|
415
|
-
|
|
416
|
-
const filterQuery = setFilterQuery(filtersSelection);
|
|
417
|
-
setCurrentFilterQuery(filterQuery);
|
|
423
|
+
setFiltersSelection(filterPointer, filtersSelected);
|
|
418
424
|
};
|
|
419
425
|
|
|
420
426
|
const currentDataColumnsState = currentStructuredData ? columnsState[structuredDataType] || [] : columnsState["all"];
|
|
@@ -637,6 +643,7 @@ const mapStateToProps = (state: IRootState) => ({
|
|
|
637
643
|
currentSitePages: state.sites.currentSitePages,
|
|
638
644
|
currentSiteErrorPages: state.sites.currentSiteErrorPages,
|
|
639
645
|
skipReviewOnPublish: state.app.globalSettings.skipReviewOnPublish,
|
|
646
|
+
contentFilters: state.structuredData.contentFilters,
|
|
640
647
|
});
|
|
641
648
|
|
|
642
649
|
const mapDispatchToProps = {
|
|
@@ -661,11 +668,12 @@ const mapDispatchToProps = {
|
|
|
661
668
|
getAnalytics: analyticsActions.getAnalytics,
|
|
662
669
|
setCurrentDataID: structuredDataActions.setCurrentDataID,
|
|
663
670
|
resetCurrentSiteErrorPages: sitesActions.resetCurrentSiteErrorPages,
|
|
671
|
+
setContentFilters: structuredDataActions.setContentFilters,
|
|
664
672
|
};
|
|
665
673
|
|
|
666
674
|
interface IDispatchProps {
|
|
667
675
|
setHistoryPush(route: string, isEditor?: boolean): void;
|
|
668
|
-
resetForm(): void;
|
|
676
|
+
resetForm(setDefault?: boolean): void;
|
|
669
677
|
setLanguage(lang: { locale: string; id: number }): void;
|
|
670
678
|
getStructuredDataContents(params: IGetStructuredDataParams): void;
|
|
671
679
|
setSelectedStructuredData(id: string, scope: string): void;
|
|
@@ -685,6 +693,7 @@ interface IDispatchProps {
|
|
|
685
693
|
getAnalytics(): void;
|
|
686
694
|
setCurrentDataID(id: number | null): void;
|
|
687
695
|
resetCurrentSiteErrorPages: () => Promise<void>;
|
|
696
|
+
setContentFilters(contentFilters: Record<string, IStructuredDataQueryValues> | null): void;
|
|
688
697
|
}
|
|
689
698
|
|
|
690
699
|
interface ICategoriesProps {
|
|
@@ -702,6 +711,7 @@ interface ICategoriesProps {
|
|
|
702
711
|
currentSitePages: IPage[];
|
|
703
712
|
currentSiteErrorPages: number[];
|
|
704
713
|
skipReviewOnPublish?: boolean;
|
|
714
|
+
contentFilters: Record<string, IStructuredDataQueryValues> | null;
|
|
705
715
|
}
|
|
706
716
|
|
|
707
717
|
type IProps = ICategoriesProps & IDispatchProps;
|
package/src/types/index.tsx
CHANGED
|
@@ -140,20 +140,21 @@ export interface ISchemaField {
|
|
|
140
140
|
export interface IImage {
|
|
141
141
|
id?: number;
|
|
142
142
|
name: string;
|
|
143
|
-
|
|
143
|
+
title: string;
|
|
144
|
+
description: string;
|
|
144
145
|
alt: string;
|
|
146
|
+
tags: string[];
|
|
145
147
|
url: string;
|
|
148
|
+
thumb: string;
|
|
146
149
|
publicId: string;
|
|
147
|
-
|
|
150
|
+
damId: string;
|
|
151
|
+
published: Date;
|
|
148
152
|
size: number;
|
|
149
153
|
width: number;
|
|
150
154
|
height: number;
|
|
151
|
-
published: Date;
|
|
152
|
-
description: string;
|
|
153
|
-
thumb: string;
|
|
154
|
-
tags: string[];
|
|
155
|
-
file: File;
|
|
156
155
|
orientation: string;
|
|
156
|
+
site: string;
|
|
157
|
+
file?: File;
|
|
157
158
|
}
|
|
158
159
|
|
|
159
160
|
export interface IUrlField {
|