update jsonpath library

This commit is contained in:
2024-02-08 14:28:40 +00:00
parent f034f4be3d
commit 2af463fbe9
67 changed files with 961 additions and 966 deletions
+12 -15
View File
@@ -4,7 +4,7 @@ import DatePicker, { registerLocale, setDefaultLocale } from "react-datepicker";
import React, { useCallback, useEffect, useMemo, useState } from "react";
import "react-datepicker/dist/react-datepicker.css";
import moment from "moment";
import jsonpath from "jsonpath";
import { JSONPath as jsonpath } from "jsonpath-plus";
import fieldLookup from "../../data/crmfieldlookuptranslations.json";
import pickListLookup from "../../data/picklistLookups.json";
import useTranslation from "next-translate/useTranslation";
@@ -1157,9 +1157,9 @@ const RenderPickList = ({
}) => {
let { t } = useTranslation();
var dropdownObj = jsonpath.query(
picklistData,
"$..value[?(@.LogicalName=='" + datafieldname + "')]..Options"
var dropdownObj = jsonpath(
"$..value[?(@.LogicalName=='" + datafieldname + "')]..Options",
picklistData
);
dropdownObj = dropdownObj[0];
return (
@@ -1379,14 +1379,11 @@ export const FieldsTranslations = (label) => {
const { locale } = router;
const { appealtypes } = router.query;
let formObj = jsonpath.query(fieldLookup, "$['" + appealtypes + "']");
let formObj = jsonpath("$['" + appealtypes + "']", fieldLookup);
let labelTrans =
router.locale == "cy"
? jsonpath.query(
formObj,
"$..[?(@.value=='" + label + "')].value_cy"
)
? jsonpath("$..[?(@.value=='" + label + "')].value_cy", formObj)
: label;
return labelTrans;
};
@@ -1398,9 +1395,9 @@ const PickListTranslations = (optionValue) => {
//console.log(optionValue);
let optionTrans =
router.locale == "cy"
? jsonpath.query(
pickListLookup,
'$..[?(@.value=="' + optionValue + '")].value_cy'
? jsonpath(
'$..[?(@.value=="' + optionValue + '")].value_cy',
pickListLookup
)
: optionValue;
//console.log(optionTrans, optionValue);
@@ -1573,9 +1570,9 @@ const RenderFileUpload = (field) => {
const filelistObj = field.fileList || {};
const blobList = jsonpath.query(
filelistObj,
"$..[?(@.documentType=='" + field.documentTypeCode + "')]"
const blobList = jsonpath(
"$..[?(@.documentType=='" + field.documentTypeCode + "')]",
filelistObj
);
const deleteThisBlob = async (