Merged PR 2442: remove lodash dependecies on _.has

Related work items: #23754
This commit is contained in:
Robert Bond
2026-06-29 13:08:06 +00:00
parent 7b6af58065
commit ff699735c7
85 changed files with 870 additions and 952 deletions
@@ -4,6 +4,7 @@ import useTranslation from "next-translate/useTranslation";
import { Field } from "redux-form";
import { RenderDatePicker } from "./renderDatePicker";
import { validateField } from "../validationUtils";
import { hasOwn } from "../../utils";
const dateDiffInDays = (a, b) => {
const _MS_PER_DAY = 1000 * 60 * 60 * 24;
@@ -31,7 +32,7 @@ export function DateFieldPicker(props) {
const showIfHasParentShowValue =
parentField != false &&
!_.isEmpty(formProps[form]) &&
_.has(formProps[form].values, parentField) &&
hasOwn(formProps[form].values, parentField) &&
formProps[form].values[parentField] == parentFieldShowOnValue;
const requiredMessage = t("newappeal:is-required-label");
+2 -2
View File
@@ -5,7 +5,7 @@ import { Field } from "redux-form";
import { RenderTextfield } from "./renderTextfield";
import { RenderDecimalField } from "./renderDecimalField";
import { validateField } from "../validationUtils";
import { hasOwn } from "../../utils";
const isVisibleByInclusion = ({
parentField,
form,
@@ -14,7 +14,7 @@ const isVisibleByInclusion = ({
}) =>
parentField != false &&
!_.isEmpty(formProps[form]) &&
_.has(formProps[form].values, parentField) &&
hasOwn(formProps[form].values, parentField) &&
parentFieldShowOnValue.indexOf(
formProps[form].values[parentField].toString()
) > -1;
+2 -2
View File
@@ -3,7 +3,7 @@ import _ from "lodash";
import { FieldArray, change } from "redux-form";
import { useDispatch } from "react-redux";
import { RenderSubFields } from "./renderSubFields";
import { hasOwn } from "../../utils";
export const FieldArrayForm = (props) => {
const {
name,
@@ -19,7 +19,7 @@ export const FieldArrayForm = (props) => {
var showIfHasParentShowValue =
parentField != false &&
!_.isEmpty(formProps[form]) &&
_.has(formProps[form].values, parentField) &&
hasOwn(formProps[form].values, parentField) &&
parentFieldShowOnValue.indexOf(
formProps[form].values[parentField].toString()
) > -1;
+2 -2
View File
@@ -4,7 +4,7 @@ import useTranslation from "next-translate/useTranslation";
import { Field } from "redux-form";
import { RenderTextfield } from "./renderTextfield";
import { validateField } from "../validationUtils";
import { hasOwn } from "../../utils";
const isVisibleByInclusion = ({
parentField,
form,
@@ -13,7 +13,7 @@ const isVisibleByInclusion = ({
}) =>
parentField != false &&
!_.isEmpty(formProps[form]) &&
_.has(formProps[form].values, parentField) &&
hasOwn(formProps[form].values, parentField) &&
parentFieldShowOnValue.indexOf(
formProps[form].values[parentField].toString()
) > -1;
+2 -1
View File
@@ -4,6 +4,7 @@ import useTranslation from "next-translate/useTranslation";
import { Field } from "redux-form";
import { RenderRadio } from "./renderRadio";
import { validateField } from "../validationUtils";
import { hasOwn } from "../../utils";
const isVisibleByInclusion = ({
parentField,
@@ -13,7 +14,7 @@ const isVisibleByInclusion = ({
}) =>
parentField != false &&
!_.isEmpty(formProps[form]) &&
_.has(formProps[form].values, parentField) &&
hasOwn(formProps[form].values, parentField) &&
parentFieldShowOnValue.indexOf(
formProps[form].values[parentField].toString()
) > -1;
+4 -3
View File
@@ -4,6 +4,7 @@ import useTranslation from "next-translate/useTranslation";
import { useRouter } from "next/router";
import { Field } from "redux-form";
import { RenderYesNo } from "./renderYesNo";
import { hasOwn } from "../../utils";
export function YesNofield(props) {
const router = useRouter();
@@ -17,7 +18,7 @@ export function YesNofield(props) {
const showIfHasParentShowValue =
parentField != false &&
!_.isEmpty(formProps[form]) &&
_.has(formProps[form].values, parentField) &&
hasOwn(formProps[form].values, parentField) &&
parentFieldShowOnValue.indexOf(
formProps[form].values[parentField].toString()
) > -1;
@@ -36,7 +37,7 @@ export function YesNofield(props) {
validate={[required]}
errorMsg={t("newappeal:select-an-option-label")}
component={RenderYesNo}
inline={_.has(props, "inline") ? props.inline : "true"}
inline={hasOwn(props, "inline") ? props.inline : "true"}
requiredDocumentLabel={props.requiredDocumentLabel}
requiredDocumentValue={props.requiredDocumentValue}
setDocumentsList={props.setDocumentsList}
@@ -54,7 +55,7 @@ export function YesNofield(props) {
validate={[required]}
errorMsg={t("newappeal:select-an-option-label")}
component={RenderYesNo}
inline={_.has(props, "inline") ? props.inline : "true"}
inline={hasOwn(props, "inline") ? props.inline : "true"}
requiredDocumentLabel={props.requiredDocumentLabel}
requiredDocumentValue={props.requiredDocumentValue}
setDocumentsList={props.setDocumentsList}
+2 -1
View File
@@ -1,4 +1,5 @@
import _ from "lodash";
import { hasOwn } from "../utils";
import useTranslation from "next-translate/useTranslation";
import { useRouter } from "next/router";
import React, { useEffect } from "react";
@@ -40,7 +41,7 @@ const getValidationMessages = (t) => ({
const hasParentFieldValue = ({ parentField, form, formProps }) =>
parentField != false &&
!_.isEmpty(formProps[form]) &&
_.has(formProps[form].values, parentField);
hasOwn(formProps[form].values, parentField);
const isVisibleByEquality = ({
parentField,