@griddo/ax 1.64.2 → 1.64.5
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/components/Fields/ReferenceField/AutoPanel/index.tsx +1 -0
- package/src/components/Fields/ReferenceField/Context/index.tsx +18 -19
- package/src/components/Fields/ReferenceField/ItemList/index.tsx +2 -1
- package/src/components/Fields/ReferenceField/ManualPanel/index.tsx +2 -5
- package/src/components/Fields/ReferenceField/index.tsx +3 -1
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@griddo/ax",
|
|
3
3
|
"description": "Griddo Author Experience",
|
|
4
|
-
"version": "1.64.
|
|
4
|
+
"version": "1.64.5",
|
|
5
5
|
"authors": [
|
|
6
6
|
"Álvaro Sánchez' <alvaro.sanches@secuoyas.com>",
|
|
7
7
|
"Carlos Torres <carlos.torres@secuoyas.com>",
|
|
@@ -220,5 +220,5 @@
|
|
|
220
220
|
"publishConfig": {
|
|
221
221
|
"access": "public"
|
|
222
222
|
},
|
|
223
|
-
"gitHead": "
|
|
223
|
+
"gitHead": "8dfa87287936f064b4b1c377eff929184f5507e3"
|
|
224
224
|
}
|
|
@@ -16,18 +16,15 @@ const initState = {
|
|
|
16
16
|
source: [],
|
|
17
17
|
filter: [],
|
|
18
18
|
sourceTitles: [],
|
|
19
|
+
fullRelations: false,
|
|
19
20
|
};
|
|
20
21
|
|
|
21
22
|
const ReferenceContext = createContext({ state: { ...initState } });
|
|
22
23
|
|
|
23
|
-
const ReferenceProvider = ({ modes, children }: { modes?: string[]
|
|
24
|
+
const ReferenceProvider = ({ modes, children }: { modes?: string[]; children: ReactElement }): JSX.Element => {
|
|
24
25
|
const reference = useReferenceProvider(modes);
|
|
25
26
|
|
|
26
|
-
return
|
|
27
|
-
<ReferenceContext.Provider value={reference}>
|
|
28
|
-
{children}
|
|
29
|
-
</ReferenceContext.Provider>
|
|
30
|
-
);
|
|
27
|
+
return <ReferenceContext.Provider value={reference}>{children}</ReferenceContext.Provider>;
|
|
31
28
|
};
|
|
32
29
|
|
|
33
30
|
const useReference = (): any => {
|
|
@@ -51,7 +48,7 @@ const useReferenceProvider = (modes?: string[]) => {
|
|
|
51
48
|
);
|
|
52
49
|
|
|
53
50
|
const setReorderElements = (item: IStructuredDataContent, isPush: boolean) => {
|
|
54
|
-
const { selectedItems, fixed } = state;
|
|
51
|
+
const { selectedItems, fixed, fullRelations = false } = state;
|
|
55
52
|
const newItems = moveElement(item.id, selectedItems, isPush, "id");
|
|
56
53
|
const originalItemId = item.relatedPage?.originalStructuredDataId;
|
|
57
54
|
const itemId = state.fixed.includes(originalItemId) ? originalItemId : item.id;
|
|
@@ -60,6 +57,7 @@ const useReferenceProvider = (modes?: string[]) => {
|
|
|
60
57
|
...state,
|
|
61
58
|
selectedItems: newItems,
|
|
62
59
|
fixed: newFixed,
|
|
60
|
+
fullRelations,
|
|
63
61
|
};
|
|
64
62
|
setState(newState);
|
|
65
63
|
};
|
|
@@ -73,18 +71,19 @@ const useReferenceProvider = (modes?: string[]) => {
|
|
|
73
71
|
};
|
|
74
72
|
|
|
75
73
|
export interface IReferenceState {
|
|
76
|
-
mode: string
|
|
77
|
-
order: string
|
|
78
|
-
orderDirection: string
|
|
79
|
-
quantity: number
|
|
80
|
-
items: any
|
|
81
|
-
selectedItems: any
|
|
82
|
-
fixed: any
|
|
83
|
-
search: string
|
|
84
|
-
showSelected: boolean
|
|
85
|
-
source: any
|
|
86
|
-
filter: any
|
|
87
|
-
sourceTitles: any
|
|
74
|
+
mode: string;
|
|
75
|
+
order: string;
|
|
76
|
+
orderDirection: string;
|
|
77
|
+
quantity: number;
|
|
78
|
+
items: any;
|
|
79
|
+
selectedItems: any;
|
|
80
|
+
fixed: any;
|
|
81
|
+
search: string;
|
|
82
|
+
showSelected: boolean;
|
|
83
|
+
source: any;
|
|
84
|
+
filter: any;
|
|
85
|
+
sourceTitles: any;
|
|
86
|
+
fullRelations: boolean;
|
|
88
87
|
}
|
|
89
88
|
|
|
90
89
|
export { ReferenceProvider, useReference };
|
|
@@ -13,12 +13,13 @@ const ItemList = (props: IProps) => {
|
|
|
13
13
|
const { items, currentSite, handleListDelete, handleChange } = props;
|
|
14
14
|
|
|
15
15
|
const { state, setState, setReorderElements } = useReference();
|
|
16
|
-
const { fixed, mode, selectedItems, sourceTitles } = state;
|
|
16
|
+
const { fixed, mode, selectedItems, sourceTitles, fullRelations } = state;
|
|
17
17
|
|
|
18
18
|
useEffect(() => {
|
|
19
19
|
const params = {
|
|
20
20
|
mode: "manual",
|
|
21
21
|
fixed: items,
|
|
22
|
+
fullRelations,
|
|
22
23
|
};
|
|
23
24
|
|
|
24
25
|
const getItems = async () => {
|
|
@@ -74,11 +74,8 @@ const ManualPanel = (props: IProps) => {
|
|
|
74
74
|
};
|
|
75
75
|
|
|
76
76
|
const handleAdd = () => {
|
|
77
|
-
const { mode } = state;
|
|
78
|
-
const newValue = {
|
|
79
|
-
mode,
|
|
80
|
-
fixed: state.fixed,
|
|
81
|
-
};
|
|
77
|
+
const { mode, fixed, fullRelations } = state;
|
|
78
|
+
const newValue = { mode, fixed, fullRelations };
|
|
82
79
|
onChange(newValue);
|
|
83
80
|
};
|
|
84
81
|
|
|
@@ -31,7 +31,7 @@ const ReferenceField = (props: IProps) => {
|
|
|
31
31
|
const hasMaxItems = !!(value && value.fixed && maxItems && !isAuto && value.fixed.length >= maxItems);
|
|
32
32
|
|
|
33
33
|
const handleMode = (mode: string) => {
|
|
34
|
-
const { fixed, order, quantity, filter } = state;
|
|
34
|
+
const { fixed, order, quantity, filter, fullRelations = false } = state;
|
|
35
35
|
|
|
36
36
|
const manualSources: string[] = state.selectedItems.reduce(
|
|
37
37
|
(unique: string[], selItem: IStructuredDataContent) =>
|
|
@@ -49,11 +49,13 @@ const ReferenceField = (props: IProps) => {
|
|
|
49
49
|
order,
|
|
50
50
|
quantity,
|
|
51
51
|
filter,
|
|
52
|
+
fullRelations,
|
|
52
53
|
}
|
|
53
54
|
: {
|
|
54
55
|
mode,
|
|
55
56
|
source,
|
|
56
57
|
fixed,
|
|
58
|
+
fullRelations,
|
|
57
59
|
};
|
|
58
60
|
onChange(newValue);
|
|
59
61
|
setModeAndSource(mode, resetSource);
|