@evergis/react 4.0.68 → 4.0.72
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/index.js +11 -7
- package/dist/index.js.map +1 -1
- package/dist/react.esm.js +11 -7
- package/dist/react.esm.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -10659,6 +10659,7 @@ const TextFilter = ({ type, filter }) => {
|
|
|
10659
10659
|
eqlParameters,
|
|
10660
10660
|
});
|
|
10661
10661
|
const { value, setValue, onChange, options, setOptions } = useAutoCompleteControl();
|
|
10662
|
+
const isFreeTextInput = React.useMemo(() => !variants && (!searchFilter?.attributeAlias || !searchFilter?.attributeValue), [variants, searchFilter?.attributeAlias, searchFilter?.attributeValue]);
|
|
10662
10663
|
const setFilterValue = React.useCallback(newValue => {
|
|
10663
10664
|
changeFilters({
|
|
10664
10665
|
[filterName]: {
|
|
@@ -10676,18 +10677,21 @@ const TextFilter = ({ type, filter }) => {
|
|
|
10676
10677
|
setValue(multiSelect ? "" : lastSelected?.text || "");
|
|
10677
10678
|
}, [multiSelect, setFilterValue, setValue]);
|
|
10678
10679
|
const onBlur = React.useCallback(() => {
|
|
10679
|
-
if (
|
|
10680
|
-
setFilterValue(
|
|
10680
|
+
if (isFreeTextInput) {
|
|
10681
|
+
setFilterValue(value || "");
|
|
10682
|
+
}
|
|
10683
|
+
else if (variants) {
|
|
10684
|
+
setFilterValue(value ? [value] : []);
|
|
10681
10685
|
}
|
|
10682
10686
|
else {
|
|
10683
10687
|
setOptions([]);
|
|
10684
10688
|
}
|
|
10685
|
-
}, [variants, setFilterValue, value, setOptions]);
|
|
10689
|
+
}, [isFreeTextInput, variants, setFilterValue, value, setOptions]);
|
|
10686
10690
|
const onKeyUp = React.useCallback(e => {
|
|
10687
10691
|
if (e.key === "Enter") {
|
|
10688
|
-
setFilterValue([value]);
|
|
10692
|
+
setFilterValue(isFreeTextInput ? value || "" : value ? [value] : []);
|
|
10689
10693
|
}
|
|
10690
|
-
}, [setFilterValue, value]);
|
|
10694
|
+
}, [isFreeTextInput, setFilterValue, value]);
|
|
10691
10695
|
const { asyncCallback, loadNext } = uilibGl.useAsyncAutocomplete({
|
|
10692
10696
|
options,
|
|
10693
10697
|
setOptions: variants ? () => { } : setOptions,
|
|
@@ -10739,7 +10743,7 @@ const TextFilter = ({ type, filter }) => {
|
|
|
10739
10743
|
}, [filterName, filters]);
|
|
10740
10744
|
if (!configFilter)
|
|
10741
10745
|
return null;
|
|
10742
|
-
return (jsxRuntime.jsx(TextFilterContainer, { children: jsxRuntime.jsx(uilibGl.AutoComplete, { value: value, placeholder: placeholder, options: variants || options, zIndex: 100, width: width ? `${width}px` : "17.25rem", menuHeight: height ? `${height}px` : "10rem", withInfiniteScroll: !variants, infiniteScrollProps: variants ? undefined : infiniteScrollProps, multiSelect: multiSelect, selected: selected, setOptions: variants ? undefined : setOptions, onChange: onChange, onSelect: onSelect, onGetInnerRef: ref => (suggestRef.current = ref), asyncCallback: variants ? undefined : search, onBlur: onBlur, onKeyUp: variants && !variants.length ? onKeyUp : undefined }) }));
|
|
10746
|
+
return (jsxRuntime.jsx(TextFilterContainer, { children: jsxRuntime.jsx(uilibGl.AutoComplete, { value: value, placeholder: placeholder, options: variants || options, zIndex: 100, width: width ? `${width}px` : "17.25rem", menuHeight: height ? `${height}px` : "10rem", withInfiniteScroll: !variants, infiniteScrollProps: variants ? undefined : infiniteScrollProps, multiSelect: multiSelect, selected: selected, setOptions: variants ? undefined : setOptions, onChange: onChange, onSelect: onSelect, onGetInnerRef: ref => (suggestRef.current = ref), asyncCallback: variants ? undefined : search, onBlur: onBlur, onKeyUp: isFreeTextInput || (variants && !variants.length) ? onKeyUp : undefined }) }));
|
|
10743
10747
|
};
|
|
10744
10748
|
|
|
10745
10749
|
const getListOptions = (items, filterName, configFilters) => {
|
|
@@ -12183,7 +12187,7 @@ const useChartData = ({ element, type }) => {
|
|
|
12183
12187
|
]);
|
|
12184
12188
|
const [data, setData] = React.useState(fetchedData);
|
|
12185
12189
|
React.useEffect(() => {
|
|
12186
|
-
if (!loading
|
|
12190
|
+
if (!loading) {
|
|
12187
12191
|
setData(fetchedData);
|
|
12188
12192
|
}
|
|
12189
12193
|
}, [loading, fetchedData]);
|