@bytebrand/fe-ui-core 4.2.33 → 4.2.35
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/package.json
CHANGED
|
@@ -5,6 +5,7 @@ import MaterialAutocomplete from '../../../_common/MaterialAutocomplete/Material
|
|
|
5
5
|
import MaterialSelect from '../../../_common/MaterialSelect/MaterialSelect';
|
|
6
6
|
import MaterialField from '../../../_common/MaterialField/MaterialField';
|
|
7
7
|
import IconSVG from '../../../_common/IconSVG/IconSVG';
|
|
8
|
+
import _debounce from 'lodash/debounce';
|
|
8
9
|
|
|
9
10
|
import styles from './MakeModel.styl';
|
|
10
11
|
|
|
@@ -17,6 +18,8 @@ export interface IMakeModelProps {
|
|
|
17
18
|
t?: any;
|
|
18
19
|
}
|
|
19
20
|
|
|
21
|
+
const DEBOUNCE_TIME: number = 700;
|
|
22
|
+
|
|
20
23
|
class MakeModel extends React.Component<IMakeModelProps> {
|
|
21
24
|
renderLabel = (option: any): React.ReactNode => {
|
|
22
25
|
const { t } = this.props;
|
|
@@ -54,6 +57,13 @@ class MakeModel extends React.Component<IMakeModelProps> {
|
|
|
54
57
|
return bodyType ? <MaterialSelect {...ddProps} /> : <MaterialAutocomplete {...ddProps} />;
|
|
55
58
|
};
|
|
56
59
|
|
|
60
|
+
debaunceOnFilterChange = _debounce( // is used for the text field to add a delay and not make a search request for each key stroke
|
|
61
|
+
(name: string, value: string, index: number) => {
|
|
62
|
+
this.props.onChange(name, value, index)
|
|
63
|
+
},
|
|
64
|
+
DEBOUNCE_TIME
|
|
65
|
+
);
|
|
66
|
+
|
|
57
67
|
renderTextField = (props: any) => {
|
|
58
68
|
const { name, values, index, placeholder } = props;
|
|
59
69
|
|
|
@@ -62,7 +72,7 @@ class MakeModel extends React.Component<IMakeModelProps> {
|
|
|
62
72
|
placeholder,
|
|
63
73
|
size: 'custom',
|
|
64
74
|
value: values,
|
|
65
|
-
onChange: (value: string, name: string) => this.
|
|
75
|
+
onChange: (value: string, name: string) => this.debaunceOnFilterChange(name, value, index)
|
|
66
76
|
};
|
|
67
77
|
|
|
68
78
|
return (<MaterialField {...textFieldProps} />);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
2
|
import { TextField, IconButton } from '@mui/material';
|
|
3
3
|
import { ThemeProvider } from '@mui/material/styles';
|
|
4
4
|
import { Theme } from './MaterialField.styled';
|
|
@@ -43,11 +43,13 @@ const MaterialField: React.FC<IVehicleModalProps> = ({
|
|
|
43
43
|
placeholder
|
|
44
44
|
}: IVehicleModalProps) => {
|
|
45
45
|
const [showPassword, setShowPassword] = React.useState(false);
|
|
46
|
+
const [enteredValue, setEnteredValue] = useState(value);
|
|
46
47
|
|
|
47
48
|
const onHandleChange = (event?: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => {
|
|
48
49
|
const value = event.currentTarget.value;
|
|
49
50
|
const name = event.currentTarget.name;
|
|
50
51
|
|
|
52
|
+
setEnteredValue(event.target.value);
|
|
51
53
|
onChange(value, name, event);
|
|
52
54
|
};
|
|
53
55
|
|
|
@@ -67,7 +69,7 @@ const MaterialField: React.FC<IVehicleModalProps> = ({
|
|
|
67
69
|
fullWidth={true}
|
|
68
70
|
autoComplete={autoComplete}
|
|
69
71
|
label={label}
|
|
70
|
-
value={
|
|
72
|
+
value={enteredValue}
|
|
71
73
|
name={name}
|
|
72
74
|
sx={sx}
|
|
73
75
|
error={!!error}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import _get from 'lodash/get';
|
|
3
3
|
import _startsWith from 'lodash/startsWith';
|
|
4
|
+
import _debounce from 'lodash/debounce';
|
|
4
5
|
import qs from 'qs';
|
|
5
6
|
import { observer } from 'mobx-react';
|
|
6
7
|
import { toJS } from 'mobx';
|
|
7
8
|
import { checkRangeValuesOnEqual, getGroupValuesForQuery } from '../../../../framework/utils/CommonUtils';
|
|
8
9
|
import { FilterBlockFactory } from '../../../SearchFilters/common/FilterBlock/FilterBlockFactory';
|
|
9
10
|
import { FilterGroups, IFilters } from '../../../SearchFilters/FiltersFactory';
|
|
10
|
-
import { MANUFACTURER_KEY, MM_GROUPS_EXCLUDE_KEY, MODEL_KEY, RANGE_FILTERS, SERIES_KEY, SUPER_ADMIN_FILTER_NAME } from '../../../../framework/constants/Search';
|
|
11
|
+
import { MANUFACTURER_KEY, MM_GROUPS_EXCLUDE_KEY, MODEL_KEY, RANGE_FILTERS, SERIES_KEY, SUPER_ADMIN_FILTER_NAME, SUB_MODEL_KEY } from '../../../../framework/constants/Search';
|
|
11
12
|
import { MMS_GROUPS_KEY, OBJECT_FILTERS } from '../../../../framework/constants/SearchWidget';
|
|
12
13
|
import { resolveMmsValue } from '../../../../framework/utils/FiltersUtils';
|
|
13
14
|
import FilterBlock from '../../../SearchFilters/common/FilterBlock/FilterBlock';
|