@cccsaurora/howler-ui 2.12.0-dev.41 → 2.12.0-dev.42
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.
|
@@ -3,14 +3,13 @@ import ReactJson, {} from '@microlink/react-json-view';
|
|
|
3
3
|
import { Clear } from '@mui/icons-material';
|
|
4
4
|
import { IconButton, Skeleton, Stack } from '@mui/material';
|
|
5
5
|
import { useAppTheme } from '@cccsaurora/howler-ui/commons/components/app/hooks';
|
|
6
|
+
import Phrase from '@cccsaurora/howler-ui/components/elements/addons/search/phrase/Phrase';
|
|
6
7
|
import { useMyLocalStorageItem } from '@cccsaurora/howler-ui/components/hooks/useMyLocalStorage';
|
|
7
8
|
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
8
9
|
import { useTranslation } from 'react-i18next';
|
|
9
10
|
import { StorageKey } from '@cccsaurora/howler-ui/utils/constants';
|
|
10
11
|
import Throttler from '@cccsaurora/howler-ui/utils/Throttler';
|
|
11
|
-
import
|
|
12
|
-
// eslint-disable-next-line import/no-unresolved
|
|
13
|
-
import JSONWorker from './worker?worker';
|
|
12
|
+
import { removeEmpty, searchObject } from '@cccsaurora/howler-ui/utils/utils';
|
|
14
13
|
const THROTTLER = new Throttler(150);
|
|
15
14
|
const JSONViewer = ({ data, collapse = true }) => {
|
|
16
15
|
const { t } = useTranslation();
|
|
@@ -19,16 +18,13 @@ const JSONViewer = ({ data, collapse = true }) => {
|
|
|
19
18
|
const [flat] = useMyLocalStorageItem(StorageKey.FLATTEN_JSON);
|
|
20
19
|
const [query, setQuery] = useState('');
|
|
21
20
|
const [result, setResult] = useState(null);
|
|
22
|
-
const jsonWorker = useMemo(() => new JSONWorker(), []);
|
|
23
21
|
useEffect(() => {
|
|
24
22
|
THROTTLER.debounce(() => {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
};
|
|
23
|
+
const filteredData = removeEmpty(data, compact);
|
|
24
|
+
const searchedData = searchObject(filteredData, query, flat);
|
|
25
|
+
setResult(searchedData);
|
|
29
26
|
});
|
|
30
|
-
|
|
31
|
-
}, [compact, data, flat, jsonWorker, query]);
|
|
27
|
+
}, [compact, data, flat, query]);
|
|
32
28
|
const hasError = useMemo(() => {
|
|
33
29
|
try {
|
|
34
30
|
new RegExp(query);
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { removeEmpty, searchObject } from '@cccsaurora/howler-ui/utils/utils';
|
|
2
|
-
onmessage = (e) => {
|
|
3
|
-
const [data, compact, query, flat] = e.data;
|
|
4
|
-
const filteredData = removeEmpty(data, compact);
|
|
5
|
-
const searchedData = searchObject(filteredData, query, flat);
|
|
6
|
-
postMessage([searchedData]);
|
|
7
|
-
};
|