@natoora-libs/core 0.1.16-dev-doug-7 → 0.1.16-dev-doug-8

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.
@@ -7823,7 +7823,7 @@ var TableDesktop = ({
7823
7823
  import { Checkbox as Checkbox6, FormControlLabel as FormControlLabel4 } from "@mui/material";
7824
7824
 
7825
7825
  // src/components/TableDesktopEditableComponent/TableDesktopNumericField.tsx
7826
- import { useState as useState18, useRef as useRef5 } from "react";
7826
+ import { useState as useState18, useRef as useRef5, useMemo as useMemo4 } from "react";
7827
7827
  import { TextField as TextField8 } from "@mui/material";
7828
7828
  import { jsx as jsx120 } from "react/jsx-runtime";
7829
7829
  var TableDesktopNumericField = ({
@@ -7834,13 +7834,15 @@ var TableDesktopNumericField = ({
7834
7834
  field,
7835
7835
  variant = "standard",
7836
7836
  size,
7837
+ validateInput,
7837
7838
  onUpdateEditableCell
7838
7839
  }) => {
7839
7840
  const [input, setInput] = useState18(initialValue);
7840
7841
  const oldValue = useRef5(initialValue);
7842
+ const isDirty = useMemo4(() => input !== oldValue.current, [input, oldValue.current]);
7843
+ const hasValidationError = useMemo4(() => isDirty && !validateInput?.(input), [input, validateInput, isDirty]);
7841
7844
  const commitValue = (value) => {
7842
- const isDirty = value !== oldValue.current;
7843
- if (!onUpdateEditableCell || !isDirty) {
7845
+ if (hasValidationError || !onUpdateEditableCell || !isDirty) {
7844
7846
  return;
7845
7847
  }
7846
7848
  oldValue.current = value;
@@ -7861,6 +7863,7 @@ var TableDesktopNumericField = ({
7861
7863
  value: input,
7862
7864
  disabled,
7863
7865
  label: inputLabel,
7866
+ error: hasValidationError,
7864
7867
  onKeyDown: handleKeyDown,
7865
7868
  onChange: (e) => {
7866
7869
  e.target.value = e.target.value.replace(/\D/g, "");
@@ -7952,7 +7955,7 @@ var TableDesktopSmartSelect = memo22(({
7952
7955
  });
7953
7956
 
7954
7957
  // src/components/TableDesktopEditableComponent/TableDesktopTextField.tsx
7955
- import { useMemo as useMemo4, useState as useState20, useRef as useRef6 } from "react";
7958
+ import { useMemo as useMemo5, useState as useState20, useRef as useRef6 } from "react";
7956
7959
  import { TextField as TextField9 } from "@mui/material";
7957
7960
  import { jsx as jsx122 } from "react/jsx-runtime";
7958
7961
  var TableDesktopTextField = ({
@@ -7968,9 +7971,9 @@ var TableDesktopTextField = ({
7968
7971
  }) => {
7969
7972
  const [input, setInput] = useState20(initialValue);
7970
7973
  const oldValue = useRef6(initialValue);
7971
- const hasValidationError = useMemo4(() => !validateInput?.(input), [input, validateInput]);
7974
+ const isDirty = useMemo5(() => input !== oldValue.current, [input, oldValue.current]);
7975
+ const hasValidationError = useMemo5(() => isDirty && !validateInput?.(input), [input, validateInput]);
7972
7976
  const commitValue = (value) => {
7973
- const isDirty = value !== oldValue.current;
7974
7977
  if (hasValidationError || !onUpdateEditableCell || !isDirty) {
7975
7978
  return;
7976
7979
  }
@@ -8085,6 +8088,7 @@ var TableDesktopEditableComponent = ({
8085
8088
  field,
8086
8089
  initialValue: editInitialValue ?? "",
8087
8090
  inputLabel: inputLabel ?? "",
8091
+ validateInput,
8088
8092
  onUpdateEditableCell
8089
8093
  }
8090
8094
  )