@griddo/ax 11.0.28 → 11.0.29
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": "11.0.
|
|
4
|
+
"version": "11.0.29",
|
|
5
5
|
"authors": [
|
|
6
6
|
"Álvaro Sánchez' <alvaro.sanches@secuoyas.com>",
|
|
7
7
|
"Carlos Torres <carlos.torres@secuoyas.com>",
|
|
@@ -225,5 +225,5 @@
|
|
|
225
225
|
"publishConfig": {
|
|
226
226
|
"access": "public"
|
|
227
227
|
},
|
|
228
|
-
"gitHead": "
|
|
228
|
+
"gitHead": "46bcf3e1dc17aac2ad3b982f4c7f36c462bf1139"
|
|
229
229
|
}
|
|
@@ -32,19 +32,21 @@ const getTaxonomies = (data: IStructuredData[]) => data.filter((item: IStructure
|
|
|
32
32
|
const getTypes = (data: IStructuredData[]) => data.filter((item: IStructuredData) => !item.taxonomy);
|
|
33
33
|
const filterStructuredDataByID = (data: any, id: string) => data.find((item: any) => item.id === id);
|
|
34
34
|
|
|
35
|
-
const evaluateDataComputedFields = (structuredData: any, fields:
|
|
35
|
+
const evaluateDataComputedFields = async (structuredData: any, fields: ISchemaField[]) => {
|
|
36
36
|
const updatedData = deepClone(structuredData);
|
|
37
37
|
const data = {
|
|
38
38
|
operation: "save",
|
|
39
39
|
apiUrl: process.env.REACT_APP_API_ENDPOINT,
|
|
40
40
|
publicApiUrl: process.env.REACT_APP_PUBLIC_API_ENDPOINT,
|
|
41
41
|
};
|
|
42
|
-
|
|
42
|
+
|
|
43
|
+
for (const field of fields) {
|
|
43
44
|
if (Object.prototype.hasOwnProperty.call(field, "computed")) {
|
|
44
45
|
const computedFunction = eval(`(${field.computed})`);
|
|
45
46
|
updatedData.content[field.key] = await computedFunction(structuredData.content, data);
|
|
46
47
|
}
|
|
47
|
-
}
|
|
48
|
+
}
|
|
49
|
+
|
|
48
50
|
return updatedData;
|
|
49
51
|
};
|
|
50
52
|
|
package/src/forms/editor.tsx
CHANGED
|
@@ -199,7 +199,7 @@ const checkMaxModules = (content: any, type: string): { isMaxModules: boolean; e
|
|
|
199
199
|
};
|
|
200
200
|
};
|
|
201
201
|
|
|
202
|
-
const evaluateComputedFields = (page:
|
|
202
|
+
const evaluateComputedFields = async (page: IPage, operation: "save" | "refresh") => {
|
|
203
203
|
const updatedPage = deepClone(page);
|
|
204
204
|
const pageSchemaContent = getTemplate(page.template.templateType).content;
|
|
205
205
|
const data = {
|
|
@@ -207,12 +207,12 @@ const evaluateComputedFields = (page: any, operation: "save" | "refresh") => {
|
|
|
207
207
|
apiUrl: process.env.REACT_APP_API_ENDPOINT,
|
|
208
208
|
publicApiUrl: process.env.REACT_APP_PUBLIC_API_ENDPOINT,
|
|
209
209
|
};
|
|
210
|
-
|
|
210
|
+
for (const field of pageSchemaContent) {
|
|
211
211
|
if (Object.prototype.hasOwnProperty.call(field, "computed")) {
|
|
212
212
|
const computedFunction = eval(`(${field.computed})`);
|
|
213
213
|
updatedPage.template[field.key] = await computedFunction(page, data);
|
|
214
214
|
}
|
|
215
|
-
}
|
|
215
|
+
}
|
|
216
216
|
|
|
217
217
|
return updatedPage;
|
|
218
218
|
};
|