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) {
+1 -1
View File
@@ -1,4 +1,4 @@
import jsonpath from "jsonpath";
import { JSONPath as jsonpath } from "jsonpath-plus";
import useTranslation from "next-translate/useTranslation";
import { useRouter } from "next/router";
import { connect } from "react-redux";
+4 -4
View File
@@ -4,7 +4,7 @@ import { useRouter } from "next/router";
import useTranslation from "next-translate/useTranslation";
import xpath from "xpath";
import BuildField from "./buildfield";
import jsonpath from "jsonpath";
import { JSONPath as jsonpath } from "jsonpath-plus";
import FileUpload from "./fileupload";
export default function BuildRow(props) {
@@ -104,11 +104,11 @@ export default function BuildRow(props) {
dateEnd = !_.isEmpty(dateEnd) && dateEnd[0].value;
const isRequiredField = jsonpath.query(
mandatoryFieldsData,
const isRequiredField = jsonpath(
"$..value[?(@.LogicalName=='" +
datafieldname[0].value +
"')]"
"')]",
mandatoryFieldsData
);
if (datafieldname[0].value == "pinswg_fileUpload") {
+1 -1
View File
@@ -24,7 +24,7 @@ import {
} from "../../actions";
import { FieldsTranslations } from "../elements";
import jsonpath from "jsonpath";
import { JSONPath as jsonpath } from "jsonpath-plus";
import BuildProgress from "./buildprogress";
let BuildSection = (props) => {
+7 -7
View File
@@ -1,4 +1,4 @@
import jsonpath from "jsonpath";
import { JSONPath as jsonpath } from "jsonpath-plus";
import useTranslation from "next-translate/useTranslation";
import { useRouter } from "next/router";
import { connect } from "react-redux";
@@ -101,12 +101,12 @@ let CreateCase = (props) => {
value={optionsObj[key].accountid}
>
{router.locale == "cy"
? jsonpath.query(
transLookup,
? jsonpath(
'$..[?(@.value=="' +
optionsObj[key]
.name +
'")].value_cy'
'")].value_cy',
transLookup
)
: optionsObj[key].name}
</option>
@@ -192,12 +192,12 @@ let CreateCase = (props) => {
)
? ""
: router.locale == "cy"
? jsonpath.query(
transLookup,
? jsonpath(
'$..[?(@.value=="' +
optionsObj[key]
.value +
'")].value_cy'
'")].value_cy',
transLookup
)
: optionsObj[key].value}
</option>
+1 -1
View File
@@ -3,7 +3,7 @@
// import { useState, useEffect } from "react";
// import { useRouter } from "next/router";
// import useTranslation from "next-translate/useTranslation";
// import jsonpath from "jsonpath";
// import { JSONPath as jsonpath } from "jsonpath-plus";
// import _ from "lodash";
// const FileUpload = () => {