@griddo/ax 10.6.1 → 10.6.2
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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@griddo/ax",
|
|
3
3
|
"description": "Griddo Author Experience",
|
|
4
|
-
"version": "10.6.
|
|
4
|
+
"version": "10.6.2",
|
|
5
5
|
"authors": [
|
|
6
6
|
"Álvaro Sánchez' <alvaro.sanches@secuoyas.com>",
|
|
7
7
|
"Carlos Torres <carlos.torres@secuoyas.com>",
|
|
@@ -232,5 +232,5 @@
|
|
|
232
232
|
"publishConfig": {
|
|
233
233
|
"access": "public"
|
|
234
234
|
},
|
|
235
|
-
"gitHead": "
|
|
235
|
+
"gitHead": "ef432960c88ef815e7c788be85c61955f717b6c4"
|
|
236
236
|
}
|
|
@@ -92,8 +92,8 @@ const SideModal = (props: ISideModalProps): JSX.Element | null => {
|
|
|
92
92
|
const selectedClass = isSelected ? "selected" : "";
|
|
93
93
|
|
|
94
94
|
return (
|
|
95
|
-
<MenuItem key={`${value}${i}`} className={selectedClass}>
|
|
96
|
-
<S.NavLink
|
|
95
|
+
<MenuItem key={`${value}${i}`} className={selectedClass} onClick={filterOptions}>
|
|
96
|
+
<S.NavLink data-testid="side-modal-nav-link">
|
|
97
97
|
<S.Link data-testid="side-modal-link" active={isSelected}>
|
|
98
98
|
{label}
|
|
99
99
|
</S.Link>
|
|
@@ -40,7 +40,11 @@ const OptionTable = (props: IOptionTableProps): JSX.Element => {
|
|
|
40
40
|
});
|
|
41
41
|
};
|
|
42
42
|
|
|
43
|
-
const currentType = currentStructuredData
|
|
43
|
+
const currentType = currentStructuredData
|
|
44
|
+
? currentStructuredData.dataPacks[0]
|
|
45
|
+
: filters.length
|
|
46
|
+
? filters[0].value
|
|
47
|
+
: "";
|
|
44
48
|
|
|
45
49
|
const initialState: IOptionTableStore = {
|
|
46
50
|
columnValues: filterOptions(currentType, "type"),
|
|
@@ -125,10 +129,17 @@ const OptionTable = (props: IOptionTableProps): JSX.Element => {
|
|
|
125
129
|
});
|
|
126
130
|
|
|
127
131
|
setValues(filteredOptionsByDataPack);
|
|
128
|
-
|
|
132
|
+
|
|
133
|
+
const currentStructuredDataTemplate: string | undefined =
|
|
129
134
|
currentStructuredData && currentStructuredData.schema.templates
|
|
130
135
|
? currentStructuredData.schema.templates[0]
|
|
131
|
-
:
|
|
136
|
+
: undefined;
|
|
137
|
+
|
|
138
|
+
const selectedTemplate =
|
|
139
|
+
filteredOptionsByDataPack.find((opt) => opt.value === currentStructuredDataTemplate)?.value ||
|
|
140
|
+
filteredOptionsByDataPack[0]?.value ||
|
|
141
|
+
"";
|
|
142
|
+
|
|
132
143
|
selectOption(selectedTemplate, filteredOptionsByDataPack);
|
|
133
144
|
};
|
|
134
145
|
|
|
@@ -4,34 +4,38 @@ import { pageStatus } from "@ax/containers/PageEditor/interfaces";
|
|
|
4
4
|
import { IDataPack, IPage, IStructuredData } from "@ax/types";
|
|
5
5
|
|
|
6
6
|
const getTemplatesFilters = (activatedDataPacks: IDataPack[]) => {
|
|
7
|
-
const filters: { label: string; value: string; mode: string }[] = [];
|
|
8
7
|
const activatedDataPacksIds = getActivatedDataPacksIds(activatedDataPacks);
|
|
9
8
|
const { templates } = schemas;
|
|
10
9
|
|
|
11
|
-
Object.keys(templates)
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
10
|
+
const filters: { label: string; value: string; mode?: string }[] = Object.keys(templates)
|
|
11
|
+
.filter((templateName: string) => !templates[templateName].dataPacks)
|
|
12
|
+
.map((templateName: string) => templates[templateName].type);
|
|
13
|
+
|
|
14
|
+
Object.keys(templates)
|
|
15
|
+
.filter((templateName: string) => Array.isArray(templates[templateName].dataPacks))
|
|
16
|
+
.forEach((templateName: string) => {
|
|
17
|
+
const { type, dataPacks } = templates[templateName];
|
|
18
|
+
const isActivated = activatedDataPacksIds.some((id: string) => dataPacks.indexOf(id) >= 0);
|
|
19
|
+
|
|
20
|
+
if (isActivated) {
|
|
21
|
+
dataPacks.forEach((dataPack: string) => {
|
|
22
|
+
const currentDataPack = activatedDataPacks.find(
|
|
23
|
+
(activatedDataPack: IDataPack) => dataPack === activatedDataPack.id
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
if (currentDataPack) {
|
|
27
|
+
filters.push({
|
|
28
|
+
label: currentDataPack?.title,
|
|
29
|
+
value: currentDataPack?.id,
|
|
30
|
+
mode: type.mode,
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
});
|
|
33
36
|
|
|
34
37
|
const uniqueFilters: { label: string; value: string; mode: string }[] = filterDuplicatedValues(filters);
|
|
38
|
+
|
|
35
39
|
return uniqueFilters;
|
|
36
40
|
};
|
|
37
41
|
|
|
@@ -103,9 +107,6 @@ const getOptionFilters = (options: IStructuredData[], activatedDataPacks: IDataP
|
|
|
103
107
|
const filters = [...templateFilters, ...mappedOptions];
|
|
104
108
|
const uniqueFilters = [...new Map(filters.map((item: any) => [item.value, item])).values()];
|
|
105
109
|
const sortedUniqueFilters = uniqueFilters.sort((a, b) => a.label.localeCompare(b.label));
|
|
106
|
-
const staticFilterIdx = sortedUniqueFilters.findIndex((filter) => filter.value === "static");
|
|
107
|
-
const staticFilter = sortedUniqueFilters.splice(staticFilterIdx, 1);
|
|
108
|
-
sortedUniqueFilters.unshift(...staticFilter);
|
|
109
110
|
return sortedUniqueFilters;
|
|
110
111
|
};
|
|
111
112
|
|