tp-react-elements-dev 1.6.0 → 1.6.1

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.
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import { Theme } from "@emotion/react";
3
3
  import { SxProps } from "@mui/material";
4
- import { AxiosInstance } from "axios";
4
+ import { AxiosStatic } from "axios";
5
5
  export declare const renderLabel: (label: string, isRequired?: boolean, alignRight?: boolean) => import("react/jsx-runtime").JSX.Element;
6
6
  export declare function formatDateMonthAndYear(date: any): string;
7
7
  interface OptionsProps {
@@ -41,7 +41,7 @@ export interface FormSectionPropsItem {
41
41
  fileType?: 'excel' | 'pdf' | 'all' | '';
42
42
  handleFileError?: (message: string) => void;
43
43
  doNotAllowPaste?: boolean;
44
- AxiosInstance?: AxiosInstance | any;
44
+ AxiosInstance?: AxiosStatic | any;
45
45
  ApiInstance?: string | any;
46
46
  setLoadedPaginationOptions?: string | any;
47
47
  autoFIll?: boolean | any;
package/dist/index.esm.js CHANGED
@@ -52796,6 +52796,7 @@ const SingleSelectSearchApi = ({ props }) => {
52796
52796
  const [searchValue, setSearchValue] = useState("");
52797
52797
  const [optionsFetched, setOptionsFetched] = useState([]);
52798
52798
  const [isLoading, setIsLoading] = useState(false);
52799
+ console.log(props.getValues(props.item.name), 'props.getValues(props.item.name)');
52799
52800
  useEffect(() => {
52800
52801
  var _a;
52801
52802
  const controller = new AbortController();
@@ -52805,11 +52806,14 @@ const SingleSelectSearchApi = ({ props }) => {
52805
52806
  setOptionsFetched([]);
52806
52807
  }
52807
52808
  else if (props.getValues(props.item.name)) {
52808
- setSearchValue('');
52809
+ setSearchValue(props.getValues(props.item.name));
52809
52810
  }
52811
+ // if(searchValue!==''){
52810
52812
  setIsLoading(true);
52811
52813
  props.item.AxiosInstance
52812
- .get(props.item.ApiInstance + `&${props.item.searchInstance}=${searchValue}`, { signal })
52814
+ .get(props.item.ApiInstance + `&${props.item.searchInstance}=${searchValue}`, { signal, headers: {
52815
+ Authorization: `Bearer ${'eyJhbGciOiJodHRwOi8vd3d3LnczLm9yZy8yMDAxLzA0L3htbGRzaWctbW9yZSNobWFjLXNoYTUxMiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1lIjoidHAwMjAiLCJVc2VyTmFtZSI6InRwMDIwIiwiVXNlcklkIjoiMjkiLCJBcHBsaWNhdGlvblR5cGUiOiJUQ0EiLCJSb2xlSWQiOiIxIiwiZXhwIjoxNzMwODc0NTcyfQ.ggDsISUnLFA6m2Bu2aOiyKasSmI2WFzw-gxO0umUpyoICDrZLXoJ15OsyKGrf9y6dy41D9Q0RvX__xU09zJRgA'}`
52816
+ } })
52813
52817
  .then((res) => {
52814
52818
  setOptionsFetched(res.data);
52815
52819
  setIsLoading(false);
@@ -52817,12 +52821,15 @@ const SingleSelectSearchApi = ({ props }) => {
52817
52821
  })
52818
52822
  .catch((err) => {
52819
52823
  console.log(err, "error");
52820
- setIsLoading(false);
52821
52824
  });
52822
52825
  return () => controller.abort();
52823
- }, [searchValue, props.item.ApiInstance, props.getValues(props.item.name), (_a = props === null || props === void 0 ? void 0 : props.item) === null || _a === void 0 ? void 0 : _a.autoFIll]);
52826
+ // }
52827
+ }, [searchValue, props.item.ApiInstance, (_a = props === null || props === void 0 ? void 0 : props.item) === null || _a === void 0 ? void 0 : _a.autoFIll]);
52824
52828
  useEffect(() => {
52825
- setSearchValue("");
52829
+ var _a;
52830
+ if ((_a = props.item) === null || _a === void 0 ? void 0 : _a.ApiInstanceReferal) {
52831
+ setSearchValue("");
52832
+ }
52826
52833
  }, [(_b = props.item) === null || _b === void 0 ? void 0 : _b.ApiInstanceReferal]);
52827
52834
  const isOptionEqualToValue = (option, value) => (option === null || option === void 0 ? void 0 : option.value) === (value === null || value === void 0 ? void 0 : value.value); // Assuming there's a 'value' property in your options
52828
52835
  return (jsxRuntimeExports.jsx(Controller, { control: props.control, name: props.item.name, render: ({ field }) => {