tp-react-elements-dev 1.14.14 → 1.15.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.
- package/dist/_virtual/index.esm10.js +2 -2
- package/dist/_virtual/index.esm11.js +2 -2
- package/dist/_virtual/index.esm12.js +2 -2
- package/dist/_virtual/index.esm4.js +2 -2
- package/dist/_virtual/index.esm5.js +2 -2
- package/dist/_virtual/index.esm6.js +2 -2
- package/dist/_virtual/index.esm7.js +2 -2
- package/dist/_virtual/index.esm9.js +2 -2
- package/dist/components/Form/FormConstants.esm.js +6 -0
- package/dist/components/Form/FormRender.esm.js +3 -0
- package/dist/components/FormComponents/Select/SingleSelectSearchApi.d.ts +6 -2
- package/dist/components/FormComponents/Select/SingleSelectSearchApi.esm.js +82 -199
- package/dist/components/FormComponents/index.esm.js +2 -2
- package/dist/node_modules/axios/index.esm.js +25 -0
- package/dist/node_modules/axios/lib/adapters/adapters.esm.js +128 -0
- package/dist/node_modules/axios/lib/adapters/fetch.esm.js +288 -0
- package/dist/node_modules/axios/lib/adapters/xhr.esm.js +202 -0
- package/dist/node_modules/axios/lib/axios.esm.js +86 -0
- package/dist/node_modules/axios/lib/cancel/CancelToken.esm.js +133 -0
- package/dist/node_modules/axios/lib/cancel/CanceledError.esm.js +23 -0
- package/dist/node_modules/axios/lib/cancel/isCancel.esm.js +5 -0
- package/dist/node_modules/axios/lib/core/Axios.esm.js +236 -0
- package/dist/node_modules/axios/lib/core/AxiosError.esm.js +108 -0
- package/dist/node_modules/axios/lib/core/AxiosHeaders.esm.js +312 -0
- package/dist/node_modules/axios/lib/core/InterceptorManager.esm.js +69 -0
- package/dist/node_modules/axios/lib/core/buildFullPath.esm.js +22 -0
- package/dist/node_modules/axios/lib/core/dispatchRequest.esm.js +81 -0
- package/dist/node_modules/axios/lib/core/mergeConfig.esm.js +106 -0
- package/dist/node_modules/axios/lib/core/settle.esm.js +27 -0
- package/dist/node_modules/axios/lib/core/transformData.esm.js +28 -0
- package/dist/node_modules/axios/lib/defaults/index.esm.js +159 -0
- package/dist/node_modules/axios/lib/defaults/transitional.esm.js +7 -0
- package/dist/node_modules/axios/lib/env/data.esm.js +3 -0
- package/dist/node_modules/axios/lib/helpers/AxiosURLSearchParams.esm.js +56 -0
- package/dist/node_modules/axios/lib/helpers/HttpStatusCode.esm.js +77 -0
- package/dist/node_modules/axios/lib/helpers/bind.esm.js +14 -0
- package/dist/node_modules/axios/lib/helpers/buildURL.esm.js +67 -0
- package/dist/node_modules/axios/lib/helpers/combineURLs.esm.js +15 -0
- package/dist/node_modules/axios/lib/helpers/composeSignals.esm.js +48 -0
- package/dist/node_modules/axios/lib/helpers/cookies.esm.js +54 -0
- package/dist/node_modules/axios/lib/helpers/formDataToJSON.esm.js +93 -0
- package/dist/node_modules/axios/lib/helpers/isAbsoluteURL.esm.js +15 -0
- package/dist/node_modules/axios/lib/helpers/isAxiosError.esm.js +14 -0
- package/dist/node_modules/axios/lib/helpers/isURLSameOrigin.esm.js +16 -0
- package/dist/node_modules/axios/lib/helpers/null.esm.js +4 -0
- package/dist/node_modules/axios/lib/helpers/parseHeaders.esm.js +55 -0
- package/dist/node_modules/axios/lib/helpers/parseProtocol.esm.js +6 -0
- package/dist/node_modules/axios/lib/helpers/progressEventReducer.esm.js +46 -0
- package/dist/node_modules/axios/lib/helpers/resolveConfig.esm.js +62 -0
- package/dist/node_modules/axios/lib/helpers/speedometer.esm.js +53 -0
- package/dist/node_modules/axios/lib/helpers/spread.esm.js +28 -0
- package/dist/node_modules/axios/lib/helpers/throttle.esm.js +44 -0
- package/dist/node_modules/axios/lib/helpers/toFormData.esm.js +219 -0
- package/dist/node_modules/axios/lib/helpers/toURLEncodedForm.esm.js +19 -0
- package/dist/node_modules/axios/lib/helpers/trackStream.esm.js +88 -0
- package/dist/node_modules/axios/lib/helpers/validator.esm.js +99 -0
- package/dist/node_modules/axios/lib/platform/browser/classes/Blob.esm.js +3 -0
- package/dist/node_modules/axios/lib/platform/browser/classes/FormData.esm.js +3 -0
- package/dist/node_modules/axios/lib/platform/browser/classes/URLSearchParams.esm.js +5 -0
- package/dist/node_modules/axios/lib/platform/browser/index.esm.js +15 -0
- package/dist/node_modules/axios/lib/platform/common/utils.esm.js +45 -0
- package/dist/node_modules/axios/lib/platform/index.esm.js +9 -0
- package/dist/node_modules/axios/lib/utils.esm.js +782 -0
- package/dist/node_modules/prop-types/index.esm.js +1 -1
- package/dist/node_modules/react-date-range/dist/accessibility/index.esm.js +1 -1
- package/dist/node_modules/react-date-range/dist/components/Calendar/index.esm.js +1 -1
- package/dist/node_modules/react-date-range/dist/components/DateRange/index.esm.js +1 -1
- package/dist/node_modules/react-date-range/dist/components/DateRangePicker/index.esm.js +1 -1
- package/dist/node_modules/react-date-range/dist/components/DayCell/index.esm.js +1 -1
- package/dist/node_modules/react-date-range/dist/components/DefinedRange/index.esm.js +1 -1
- package/dist/node_modules/react-date-range/dist/components/InputRangeField/index.esm.js +1 -1
- package/dist/utils/Interface/FormInterface.d.ts +7 -1
- package/package.json +2 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var
|
|
1
|
+
var accessibility = {};
|
|
2
2
|
|
|
3
|
-
export {
|
|
3
|
+
export { accessibility as __exports };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var
|
|
1
|
+
var DayCell = {};
|
|
2
2
|
|
|
3
|
-
export {
|
|
3
|
+
export { DayCell as __exports };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var
|
|
1
|
+
var InputRangeField = {};
|
|
2
2
|
|
|
3
|
-
export {
|
|
3
|
+
export { InputRangeField as __exports };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var
|
|
1
|
+
var DateRange = {};
|
|
2
2
|
|
|
3
|
-
export {
|
|
3
|
+
export { DateRange as __exports };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var
|
|
1
|
+
var DateRangePicker = {};
|
|
2
2
|
|
|
3
|
-
export {
|
|
3
|
+
export { DateRangePicker as __exports };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var
|
|
1
|
+
var DefinedRange = {};
|
|
2
2
|
|
|
3
|
-
export {
|
|
3
|
+
export { DefinedRange as __exports };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var
|
|
1
|
+
var Calendar = {};
|
|
2
2
|
|
|
3
|
-
export {
|
|
3
|
+
export { Calendar as __exports };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var
|
|
1
|
+
var propTypes = {exports: {}};
|
|
2
2
|
|
|
3
|
-
export {
|
|
3
|
+
export { propTypes as __module };
|
|
@@ -9,6 +9,11 @@ const useFormValidatingContext = (formArray) => {
|
|
|
9
9
|
const base = validationShape[field.name] || Yup.mixed();
|
|
10
10
|
validationShape[field.name] = base.test('custom-check', field.customErrorMessage || 'Invalid value', (value) => (field.customValidation ? field.customValidation(value) : true));
|
|
11
11
|
};
|
|
12
|
+
// Add null check to prevent forEach error
|
|
13
|
+
if (!formArray || !Array.isArray(formArray)) {
|
|
14
|
+
const validationSchema = Yup.object().shape(validationShape);
|
|
15
|
+
return { validationSchema, initialValues };
|
|
16
|
+
}
|
|
12
17
|
formArray.forEach((field) => {
|
|
13
18
|
switch (field.inputType) {
|
|
14
19
|
case 'text':
|
|
@@ -217,6 +222,7 @@ const useFormValidatingContext = (formArray) => {
|
|
|
217
222
|
}
|
|
218
223
|
break;
|
|
219
224
|
case 'select':
|
|
225
|
+
case 'single-select-search':
|
|
220
226
|
case 'autocomplete-select': // alias for searchable select
|
|
221
227
|
initialValues[field.name] = '';
|
|
222
228
|
if (field.required && field.errorMessage) {
|
|
@@ -15,6 +15,7 @@ import FormActiveSwitch from './FormActiveSwitch.esm.js';
|
|
|
15
15
|
import FormTextFieldWithSelect from '../FormComponents/FormTextFieldWithSelect/FormTextFieldWithSelect.esm.js';
|
|
16
16
|
import DateRangePickerComponent from '../DateRangePicker/DateRangePicker.esm.js';
|
|
17
17
|
import RichTextEditorWrapper from '../FormComponents/RichTextEditor/RichTextEditorWrapper.esm.js';
|
|
18
|
+
import SingleSelectSearchApi from '../FormComponents/Select/SingleSelectSearchApi.esm.js';
|
|
18
19
|
|
|
19
20
|
// Lazy-loaded heavy components
|
|
20
21
|
// const RichTextEditorWrapper = lazy(() =>
|
|
@@ -83,6 +84,8 @@ const RenderForm = (props) => {
|
|
|
83
84
|
// Autocomplete multi-select with checkboxes
|
|
84
85
|
case 'autocomplete-multi-select':
|
|
85
86
|
return jsx(MultiSelectAutocomplete, { props: props, variant: variant });
|
|
87
|
+
case 'single-select-search':
|
|
88
|
+
return jsx(SingleSelectSearchApi, { props: props, variant: variant });
|
|
86
89
|
// Dropdown select (non auto-complete)
|
|
87
90
|
case 'select-v2':
|
|
88
91
|
case 'basic-select': // new alias
|
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { FormRenderProps, VariantProps } from '../../../utils';
|
|
2
|
+
declare const SingleSelectSearchApi: ({ props, variant, }: {
|
|
3
|
+
props: FormRenderProps;
|
|
4
|
+
variant: VariantProps;
|
|
5
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export default SingleSelectSearchApi;
|
|
@@ -1,200 +1,83 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
// import { makeStyles } from "@mui/styles";
|
|
11
|
-
// import React, { useEffect, useState } from "react";
|
|
12
|
-
// import { Controller } from "react-hook-form";
|
|
13
|
-
// import { ErrorMessageComponent, OptionRender } from "../Form.styles";
|
|
14
|
-
// import { FormRenderProps } from "../../../Utilities/Interface/FormInterface";
|
|
15
|
-
// const useStyles = makeStyles((theme) => ({
|
|
16
|
-
// option: {
|
|
17
|
-
// fontSize: "11px", // Adjust the font size as needed
|
|
18
|
-
// },
|
|
19
|
-
// option2: {
|
|
20
|
-
// fontSize: "14px",
|
|
21
|
-
// },
|
|
22
|
-
// }));
|
|
23
|
-
// const SingleSelectSearchApi = ({ props }: { props: FormRenderProps }) => {
|
|
24
|
-
// const classes = useStyles();
|
|
25
|
-
// const [searchValue, setSearchValue] = useState<string>("");
|
|
26
|
-
// const [optionsFetched, setOptionsFetched] = useState([]);
|
|
27
|
-
// const [isLoading, setIsLoading] = useState<boolean>(false);
|
|
28
|
-
// console.log(
|
|
29
|
-
// props.getValues(props.item.name),
|
|
30
|
-
// "props.getValues(props.item.name)"
|
|
31
|
-
// );
|
|
32
|
-
// useEffect(() => {
|
|
33
|
-
// const controller = new AbortController();
|
|
34
|
-
// const signal = controller.signal;
|
|
35
|
-
// if (props?.item?.autoFIll && props.getValues(props.item.name)) {
|
|
36
|
-
// setSearchValue(props.getValues(props.item.name));
|
|
37
|
-
// setOptionsFetched([]);
|
|
38
|
-
// } else if (props.getValues(props.item.name)) {
|
|
39
|
-
// setSearchValue(props.getValues(props.item.name));
|
|
40
|
-
// }
|
|
41
|
-
// // if(searchValue!==''){
|
|
42
|
-
// setIsLoading(true);
|
|
43
|
-
// props.item.AxiosInstance.get(
|
|
44
|
-
// props.item.ApiInstance + `&${props.item.searchInstance}=${searchValue}`,
|
|
45
|
-
// {
|
|
46
|
-
// signal,
|
|
47
|
-
// headers: {
|
|
48
|
-
// Authorization: `Bearer ${props.item.tokenInstance}`,
|
|
49
|
-
// },
|
|
50
|
-
// }
|
|
51
|
-
// )
|
|
52
|
-
// .then((res) => {
|
|
53
|
-
// setOptionsFetched(res.data);
|
|
54
|
-
// setIsLoading(false);
|
|
55
|
-
// props.item.setLoadedPaginationOptions &&
|
|
56
|
-
// props.item.setLoadedPaginationOptions(res.data);
|
|
57
|
-
// })
|
|
58
|
-
// .catch((err) => {
|
|
59
|
-
// console.log(err, "error");
|
|
60
|
-
// });
|
|
61
|
-
// return () => controller.abort();
|
|
62
|
-
// // }
|
|
63
|
-
// }, [
|
|
64
|
-
// searchValue,
|
|
65
|
-
// props.getValues(props.item.name),
|
|
66
|
-
// props.item.ApiInstance,
|
|
67
|
-
// props?.item?.autoFIll,
|
|
68
|
-
// props?.item?.tokenInstance
|
|
69
|
-
// ]);
|
|
70
|
-
// useEffect(() => {
|
|
71
|
-
// if (props.item?.ApiInstanceReferal) {
|
|
72
|
-
// setSearchValue("");
|
|
73
|
-
// }
|
|
74
|
-
// }, [props.item?.ApiInstanceReferal]);
|
|
75
|
-
// const isOptionEqualToValue = (option: any, value: any) =>
|
|
76
|
-
// option?.value === value?.value; // Assuming there's a 'value' property in your options
|
|
77
|
-
// return (
|
|
78
|
-
// <Controller
|
|
79
|
-
// control={props.control}
|
|
80
|
-
// name={props.item.name}
|
|
81
|
-
// render={({ field }) => (
|
|
82
|
-
// <>
|
|
83
|
-
// <Autocomplete
|
|
84
|
-
// {...field}
|
|
85
|
-
// value={
|
|
86
|
-
// props.getValues(props.item.name)
|
|
87
|
-
// ? optionsFetched?.find(
|
|
88
|
-
// (item) => item?.value === props.getValues(props.item.name)
|
|
89
|
-
// )
|
|
90
|
-
// : null
|
|
91
|
-
// }
|
|
92
|
-
// onChange={(_, newValue) => {
|
|
93
|
-
// // field.onChange(newValue);
|
|
94
|
-
// props.setValue(props.item.name, newValue?.value);
|
|
95
|
-
// props?.item?.onChangeFn &&
|
|
96
|
-
// props?.item?.onChangeFn(newValue?.value);
|
|
97
|
-
// props?.clearErrors && props?.clearErrors(props.item.name);
|
|
98
|
-
// }}
|
|
99
|
-
// size="small"
|
|
100
|
-
// sx={{
|
|
101
|
-
// "& .MuiAutocomplete-input": {
|
|
102
|
-
// padding: "0px 0px 0px 5px !important",
|
|
103
|
-
// },
|
|
104
|
-
// "& .css-erkti9-MuiFormLabel-root-MuiInputLabel-root ": {
|
|
105
|
-
// top: "-5px",
|
|
106
|
-
// },
|
|
107
|
-
// }}
|
|
108
|
-
// disabled={props.item.disable}
|
|
109
|
-
// options={optionsFetched}
|
|
110
|
-
// classes={{
|
|
111
|
-
// option:
|
|
112
|
-
// props.item.size === "extrasmall"
|
|
113
|
-
// ? classes.option
|
|
114
|
-
// : classes.option2,
|
|
115
|
-
// }}
|
|
116
|
-
// getOptionLabel={(option) => option.label}
|
|
117
|
-
// renderInput={(params) => {
|
|
118
|
-
// return (
|
|
119
|
-
// <Tooltip
|
|
120
|
-
// title={params.inputProps.value && params.inputProps.value}
|
|
121
|
-
// >
|
|
122
|
-
// <TextField
|
|
123
|
-
// {...params}
|
|
124
|
-
// onChange={(e) => {
|
|
125
|
-
// setSearchValue(e.target.value);
|
|
126
|
-
// }}
|
|
127
|
-
// placeholder={props.item.placeholder}
|
|
128
|
-
// label={props.item.label}
|
|
129
|
-
// />
|
|
130
|
-
// </Tooltip>
|
|
131
|
-
// );
|
|
132
|
-
// }}
|
|
133
|
-
// PaperComponent={({ children }) => (
|
|
134
|
-
// <div
|
|
135
|
-
// style={{
|
|
136
|
-
// background: "#fff",
|
|
137
|
-
// }}
|
|
138
|
-
// >
|
|
139
|
-
// {isLoading ? (
|
|
140
|
-
// <Stack padding={2} spacing={1}>
|
|
141
|
-
// <Skeleton
|
|
142
|
-
// variant="rectangular"
|
|
143
|
-
// width={"100%"}
|
|
144
|
-
// height={20}
|
|
145
|
-
// />
|
|
146
|
-
// <Skeleton
|
|
147
|
-
// variant="rectangular"
|
|
148
|
-
// width={"100%"}
|
|
149
|
-
// height={20}
|
|
150
|
-
// />
|
|
151
|
-
// <Skeleton
|
|
152
|
-
// variant="rectangular"
|
|
153
|
-
// width={"100%"}
|
|
154
|
-
// height={20}
|
|
155
|
-
// />
|
|
156
|
-
// <Skeleton
|
|
157
|
-
// variant="rectangular"
|
|
158
|
-
// width={"100%"}
|
|
159
|
-
// height={20}
|
|
160
|
-
// />
|
|
161
|
-
// <Skeleton
|
|
162
|
-
// variant="rectangular"
|
|
163
|
-
// width={"100%"}
|
|
164
|
-
// height={20}
|
|
165
|
-
// />
|
|
166
|
-
// <Skeleton
|
|
167
|
-
// variant="rectangular"
|
|
168
|
-
// width={"100%"}
|
|
169
|
-
// height={20}
|
|
170
|
-
// />
|
|
171
|
-
// </Stack>
|
|
172
|
-
// ) : (
|
|
173
|
-
// children
|
|
174
|
-
// )}
|
|
175
|
-
// </div>
|
|
176
|
-
// )}
|
|
177
|
-
// isOptionEqualToValue={isOptionEqualToValue}
|
|
178
|
-
// />
|
|
179
|
-
// {props?.item?.helperText && (
|
|
180
|
-
// <span
|
|
181
|
-
// style={{
|
|
182
|
-
// fontSize: "11px",
|
|
183
|
-
// color: "#3651d3",
|
|
184
|
-
// }}
|
|
185
|
-
// >
|
|
186
|
-
// ({props?.item?.helperText})
|
|
187
|
-
// </span>
|
|
188
|
-
// )}
|
|
189
|
-
// <ErrorMessageComponent>
|
|
190
|
-
// <ErrorMessage errors={props.errors} name={props.item.name} />
|
|
191
|
-
// </ErrorMessageComponent>
|
|
192
|
-
// </>
|
|
193
|
-
// )}
|
|
194
|
-
// />
|
|
195
|
-
// );
|
|
196
|
-
// };
|
|
197
|
-
// export default SingleSelectSearchApi;
|
|
198
|
-
var undefined$1 = undefined;
|
|
1
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
|
+
import { Autocomplete, Stack, Skeleton, Tooltip, TextField } from '@mui/material';
|
|
3
|
+
import { useState, useEffect } from 'react';
|
|
4
|
+
import { Controller } from 'react-hook-form';
|
|
5
|
+
import '../../../node_modules/axios/index.esm.js';
|
|
6
|
+
import 'dayjs';
|
|
7
|
+
import { renderLabel } from '../../../utils/Constants/FormConstants.esm.js';
|
|
8
|
+
import FormBottomField from '../FormBottomField/FormBottomField.esm.js';
|
|
9
|
+
import axios from '../../../node_modules/axios/lib/axios.esm.js';
|
|
199
10
|
|
|
200
|
-
|
|
11
|
+
// Create axios instance or import your configured jwtAxios
|
|
12
|
+
const jwtAxios = axios.create();
|
|
13
|
+
const SingleSelectSearchApi = ({ props, variant, }) => {
|
|
14
|
+
const [searchValue, setSearchValue] = useState('');
|
|
15
|
+
const [optionsFetched, setOptionsFetched] = useState([]);
|
|
16
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
// eslint-disable-next-line no-undef
|
|
19
|
+
const controller = new AbortController();
|
|
20
|
+
const signal = controller.signal;
|
|
21
|
+
if (props?.item?.autoFIll && props.getValues(props.item.name)) {
|
|
22
|
+
setSearchValue(props.getValues(props.item.name));
|
|
23
|
+
setOptionsFetched([]);
|
|
24
|
+
}
|
|
25
|
+
else if (props.getValues(props.item.name)) {
|
|
26
|
+
setSearchValue('');
|
|
27
|
+
}
|
|
28
|
+
setIsLoading(true);
|
|
29
|
+
jwtAxios
|
|
30
|
+
.get(props.item.api + `&${props.item.searchValue || 'searchvalue'}=${searchValue}`, {
|
|
31
|
+
signal,
|
|
32
|
+
headers: props.item.jwtHeader,
|
|
33
|
+
})
|
|
34
|
+
.then((res) => {
|
|
35
|
+
setOptionsFetched(res.data);
|
|
36
|
+
setIsLoading(false);
|
|
37
|
+
props.item.setLoadList && props.item.setLoadList(res.data);
|
|
38
|
+
})
|
|
39
|
+
.catch((err) => {
|
|
40
|
+
console.log(err, 'error');
|
|
41
|
+
setIsLoading(false);
|
|
42
|
+
});
|
|
43
|
+
// }
|
|
44
|
+
// }
|
|
45
|
+
return () => controller.abort();
|
|
46
|
+
}, [searchValue, props.item.api, props.getValues(props.item.name), props?.item?.autoFIll]);
|
|
47
|
+
// useEffect(() => {
|
|
48
|
+
// setSearchValue('');
|
|
49
|
+
// }, [props.item?.changeValue]);
|
|
50
|
+
const isOptionEqualToValue = (option, value) => option?.value === value?.value; // Assuming there's a 'value' property in your options
|
|
51
|
+
return (jsx(Controller, { control: props.control, name: props.item.name, render: ({ field }) => (jsxs(Fragment, { children: [renderLabel(variant, props), jsx(Autocomplete, { ...field, value: props.getValues(props.item.name)
|
|
52
|
+
? optionsFetched?.find((item) => item.value === props.getValues(props.item.name))
|
|
53
|
+
: null, onChange: (_, newValue) => {
|
|
54
|
+
// field.onChange(newValue);
|
|
55
|
+
props.setValue(props.item.name, newValue?.value);
|
|
56
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
|
57
|
+
props?.item?.onChangeFn && props?.item?.onChangeFn(newValue?.value);
|
|
58
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
|
59
|
+
props?.clearErrors && props?.clearErrors(props.item.name);
|
|
60
|
+
}, size: "small", sx: {
|
|
61
|
+
'& .MuiAutocomplete-input': {
|
|
62
|
+
padding: '0px 0px 0px 5px !important',
|
|
63
|
+
},
|
|
64
|
+
'& .css-erkti9-MuiFormLabel-root-MuiInputLabel-root ': {
|
|
65
|
+
top: '-5px',
|
|
66
|
+
},
|
|
67
|
+
'& .MuiAutocomplete-option': {
|
|
68
|
+
fontSize: '16px',
|
|
69
|
+
},
|
|
70
|
+
}, disabled: props.item.disable, options: optionsFetched, getOptionLabel: (option) => option.label, renderInput: (params) => {
|
|
71
|
+
return (jsx(Tooltip, { title: params.inputProps.value && params.inputProps.value, children: jsx(TextField, { ...params, onChange: (e) => {
|
|
72
|
+
setSearchValue(e.target.value);
|
|
73
|
+
}, placeholder: props.item.placeholder, label: props.item.label }) }));
|
|
74
|
+
}, PaperComponent: ({ children }) => (jsx("div", { style: {
|
|
75
|
+
background: '#fff',
|
|
76
|
+
}, children: isLoading ? (jsxs(Stack, { padding: 2, spacing: 1, children: [jsx(Skeleton, { variant: "rectangular", width: '100%', height: 20 }), jsx(Skeleton, { variant: "rectangular", width: '100%', height: 20 }), jsx(Skeleton, { variant: "rectangular", width: '100%', height: 20 }), jsx(Skeleton, { variant: "rectangular", width: '100%', height: 20 }), jsx(Skeleton, { variant: "rectangular", width: '100%', height: 20 }), jsx(Skeleton, { variant: "rectangular", width: '100%', height: 20 })] })) : (children) })), isOptionEqualToValue: isOptionEqualToValue }), props?.item?.helperText && (jsxs("span", { style: {
|
|
77
|
+
fontFamily: 'Roboto-Reg',
|
|
78
|
+
fontSize: '11px',
|
|
79
|
+
color: '#3651d3',
|
|
80
|
+
}, children: ["(", props?.item?.helperText, ")"] })), jsx(FormBottomField, { ...props })] })) }));
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
export { SingleSelectSearchApi as default };
|
|
@@ -32,7 +32,7 @@ import '@mui/icons-material/UploadFile';
|
|
|
32
32
|
import '@mui/icons-material/PictureAsPdf';
|
|
33
33
|
import '@mui/icons-material/TableChart';
|
|
34
34
|
import '@mui/icons-material/Description';
|
|
35
|
-
export { default as FormErrorField } from './FormErrorField/FormErrorField.esm.js';
|
|
36
|
-
export { default as HelperText } from './HelperText/HelperText.esm.js';
|
|
37
35
|
export { default as RichTextEditor } from './RichTextEditor/RichTextEditor.esm.js';
|
|
38
36
|
export { default as RichTextEditorWrapper } from './RichTextEditor/RichTextEditorWrapper.esm.js';
|
|
37
|
+
export { default as FormErrorField } from './FormErrorField/FormErrorField.esm.js';
|
|
38
|
+
export { default as HelperText } from './HelperText/HelperText.esm.js';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import axios from './lib/axios.esm.js';
|
|
2
|
+
|
|
3
|
+
// This module is intended to unwrap Axios default export as named.
|
|
4
|
+
// Keep top-level export same with static properties
|
|
5
|
+
// so that it can keep same with es module or cjs
|
|
6
|
+
const {
|
|
7
|
+
Axios,
|
|
8
|
+
AxiosError,
|
|
9
|
+
CanceledError,
|
|
10
|
+
isCancel,
|
|
11
|
+
CancelToken,
|
|
12
|
+
VERSION,
|
|
13
|
+
all,
|
|
14
|
+
Cancel,
|
|
15
|
+
isAxiosError,
|
|
16
|
+
spread,
|
|
17
|
+
toFormData,
|
|
18
|
+
AxiosHeaders,
|
|
19
|
+
HttpStatusCode,
|
|
20
|
+
formToJSON,
|
|
21
|
+
getAdapter,
|
|
22
|
+
mergeConfig
|
|
23
|
+
} = axios;
|
|
24
|
+
|
|
25
|
+
export { Axios, AxiosError, AxiosHeaders, Cancel, CancelToken, CanceledError, HttpStatusCode, VERSION, all, axios as default, formToJSON, getAdapter, isAxiosError, isCancel, mergeConfig, spread, toFormData };
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import utils from '../utils.esm.js';
|
|
2
|
+
import httpAdapter from '../helpers/null.esm.js';
|
|
3
|
+
import xhrAdapter from './xhr.esm.js';
|
|
4
|
+
import { getFetch } from './fetch.esm.js';
|
|
5
|
+
import AxiosError from '../core/AxiosError.esm.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Known adapters mapping.
|
|
9
|
+
* Provides environment-specific adapters for Axios:
|
|
10
|
+
* - `http` for Node.js
|
|
11
|
+
* - `xhr` for browsers
|
|
12
|
+
* - `fetch` for fetch API-based requests
|
|
13
|
+
*
|
|
14
|
+
* @type {Object<string, Function|Object>}
|
|
15
|
+
*/
|
|
16
|
+
const knownAdapters = {
|
|
17
|
+
http: httpAdapter,
|
|
18
|
+
xhr: xhrAdapter,
|
|
19
|
+
fetch: {
|
|
20
|
+
get: getFetch,
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
// Assign adapter names for easier debugging and identification
|
|
25
|
+
utils.forEach(knownAdapters, (fn, value) => {
|
|
26
|
+
if (fn) {
|
|
27
|
+
try {
|
|
28
|
+
Object.defineProperty(fn, 'name', { value });
|
|
29
|
+
} catch (e) {
|
|
30
|
+
// eslint-disable-next-line no-empty
|
|
31
|
+
}
|
|
32
|
+
Object.defineProperty(fn, 'adapterName', { value });
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Render a rejection reason string for unknown or unsupported adapters
|
|
38
|
+
*
|
|
39
|
+
* @param {string} reason
|
|
40
|
+
* @returns {string}
|
|
41
|
+
*/
|
|
42
|
+
const renderReason = (reason) => `- ${reason}`;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Check if the adapter is resolved (function, null, or false)
|
|
46
|
+
*
|
|
47
|
+
* @param {Function|null|false} adapter
|
|
48
|
+
* @returns {boolean}
|
|
49
|
+
*/
|
|
50
|
+
const isResolvedHandle = (adapter) => utils.isFunction(adapter) || adapter === null || adapter === false;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Get the first suitable adapter from the provided list.
|
|
54
|
+
* Tries each adapter in order until a supported one is found.
|
|
55
|
+
* Throws an AxiosError if no adapter is suitable.
|
|
56
|
+
*
|
|
57
|
+
* @param {Array<string|Function>|string|Function} adapters - Adapter(s) by name or function.
|
|
58
|
+
* @param {Object} config - Axios request configuration
|
|
59
|
+
* @throws {AxiosError} If no suitable adapter is available
|
|
60
|
+
* @returns {Function} The resolved adapter function
|
|
61
|
+
*/
|
|
62
|
+
function getAdapter(adapters, config) {
|
|
63
|
+
adapters = utils.isArray(adapters) ? adapters : [adapters];
|
|
64
|
+
|
|
65
|
+
const { length } = adapters;
|
|
66
|
+
let nameOrAdapter;
|
|
67
|
+
let adapter;
|
|
68
|
+
|
|
69
|
+
const rejectedReasons = {};
|
|
70
|
+
|
|
71
|
+
for (let i = 0; i < length; i++) {
|
|
72
|
+
nameOrAdapter = adapters[i];
|
|
73
|
+
let id;
|
|
74
|
+
|
|
75
|
+
adapter = nameOrAdapter;
|
|
76
|
+
|
|
77
|
+
if (!isResolvedHandle(nameOrAdapter)) {
|
|
78
|
+
adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
|
|
79
|
+
|
|
80
|
+
if (adapter === undefined) {
|
|
81
|
+
throw new AxiosError(`Unknown adapter '${id}'`);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (adapter && (utils.isFunction(adapter) || (adapter = adapter.get(config)))) {
|
|
86
|
+
break;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
rejectedReasons[id || '#' + i] = adapter;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
if (!adapter) {
|
|
93
|
+
const reasons = Object.entries(rejectedReasons)
|
|
94
|
+
.map(([id, state]) => `adapter ${id} ` +
|
|
95
|
+
(state === false ? 'is not supported by the environment' : 'is not available in the build')
|
|
96
|
+
);
|
|
97
|
+
|
|
98
|
+
let s = length ?
|
|
99
|
+
(reasons.length > 1 ? 'since :\n' + reasons.map(renderReason).join('\n') : ' ' + renderReason(reasons[0])) :
|
|
100
|
+
'as no adapter specified';
|
|
101
|
+
|
|
102
|
+
throw new AxiosError(
|
|
103
|
+
`There is no suitable adapter to dispatch the request ` + s,
|
|
104
|
+
'ERR_NOT_SUPPORT'
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
return adapter;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Exports Axios adapters and utility to resolve an adapter
|
|
113
|
+
*/
|
|
114
|
+
var adapters = {
|
|
115
|
+
/**
|
|
116
|
+
* Resolve an adapter from a list of adapter names or functions.
|
|
117
|
+
* @type {Function}
|
|
118
|
+
*/
|
|
119
|
+
getAdapter,
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Exposes all known adapters
|
|
123
|
+
* @type {Object<string, Function|Object>}
|
|
124
|
+
*/
|
|
125
|
+
adapters: knownAdapters
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
export { adapters as default };
|