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
+6 -9
View File
@@ -2,7 +2,7 @@ import Link from "next/link";
import { useRouter } from "next/router";
import useTranslation from "next-translate/useTranslation";
import xpath from "xpath";
import jsonpath from "jsonpath";
import { JSONPath as jsonpath } from "jsonpath-plus";
import BuildCheckField from "./buildCheckfield";
import { useSelector, shallowEqual, connect } from "react-redux";
import fieldLookup from "../../data/crmfieldlookuptranslations.json";
@@ -63,14 +63,11 @@ let BuildCheckRow = (props) => {
const { locale } = router;
const { appealtypes } = router.query;
let formObj = jsonpath.query(fieldLookup, "$['" + appealtypes + "']");
let formObj = jsonpath(fieldLookup, "$['" + appealtypes + "']");
let labelTrans =
router.locale == "cy"
? jsonpath.query(
formObj,
"$..[?(@.value=='" + label + "')].value_cy"
)
? jsonpath("$..[?(@.value=='" + label + "')].value_cy", formObj)
: label;
return labelTrans;
};
@@ -88,11 +85,11 @@ let BuildCheckRow = (props) => {
var rows = xpath.select("//label/@description", doc);
var fieldtype = xpath.select("//@classid", doc);
var datafieldname = xpath.select("//@datafieldname", doc);
const isRequiredField = jsonpath.query(
mandatoryFieldsData,
const isRequiredField = jsonpath(
"$..value[?(@.LogicalName=='" +
datafieldname[0].value +
"')]"
"')]",
mandatoryFieldsData
);
// if (datafieldname[0].value.indexOf("fileUpload") > 0) {