@k-int/stripes-kint-components 4.4.3 → 4.5.0
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/CHANGELOG.md +8 -5
- package/es/lib/CustomProperties/View/CustomPropertyCard.js +2 -2
- package/es/lib/QueryTypedown/QueryTypedown.js +8 -1
- package/es/lib/ResponsiveButtonGroup/ResponsiveButtonGroup.js +5 -2
- package/es/lib/ResponsiveButtonGroup/useResponsiveButtonGroupSizing.js +5 -1
- package/es/lib/hooks/useHelperApp.js +11 -4
- package/junit.xml +139 -139
- package/package.json +1 -1
- package/src/artifacts/coverage-jest/lcov-report/ActionList/ActionList.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/ActionList/ActionListFieldArray.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/ActionList/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/ActionList/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Config/CustomPropertiesLookup.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Config/CustomPropertiesSettings.js.html +128 -50
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Config/CustomPropertyForm.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Config/CustomPropertyView.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Config/index.html +15 -15
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Config/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Edit/CustomPropertiesEdit.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Edit/CustomPropertiesEditCtx.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Edit/CustomPropertiesListField.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Edit/CustomPropertyField.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Edit/CustomPropertyFormCard.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Edit/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Edit/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Edit/testResources.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/CustomPropertiesFilter.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/CustomPropertiesFilterField.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/CustomPropertiesFilterFieldArray.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/CustomPropertiesFilterForm.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/CustomPropertiesRule.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/testResources.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/useOperators.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/useParseActiveFilterStrings.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/useValueProps.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/View/CustomPropertiesView.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/View/CustomPropertiesViewCtx.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/View/CustomPropertyCard.js.html +5 -5
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/View/index.html +4 -4
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/View/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/View/testResources.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/CycleButton/CycleButton.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/CycleButton/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/CycleButton/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/EditableRefdataCategoryList/EditableRefdataCategoryList.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/EditableRefdataCategoryList/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/EditableRefdataCategoryList/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/EditableRefdataList/EditableRefdataList.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/EditableRefdataList/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/EditableRefdataList/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/EditableSettingsList.js.html +13 -4
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/EditableSettingsListFieldArray.js.html +12 -3
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/EditSettingValue.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/RenderSettingValue.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/SettingField.js.html +38 -23
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/index.html +15 -15
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/index.html +4 -4
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/FormModal/FormModal.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/FormModal/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/FormModal/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/FormattedKintMessage/FormattedKintMessage.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/FormattedKintMessage/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/FormattedKintMessage/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/IconSelect/IconSelect.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/IconSelect/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/IconSelect/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/NoResultsMessage/NoResultsMessage.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/NoResultsMessage/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/NoResultsMessage/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/QueryTypedown/QueryTypedown.js.html +23 -8
- package/src/artifacts/coverage-jest/lcov-report/QueryTypedown/index.html +7 -7
- package/src/artifacts/coverage-jest/lcov-report/QueryTypedown/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/RefdataButtons/RefdataButtons.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/RefdataButtons/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/RefdataButtons/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/ResponsiveButtonGroup/ResponsiveButtonGroup.js.html +11 -2
- package/src/artifacts/coverage-jest/lcov-report/ResponsiveButtonGroup/index.html +7 -7
- package/src/artifacts/coverage-jest/lcov-report/ResponsiveButtonGroup/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/ResponsiveButtonGroup/useResponsiveButtonGroupSizing.js.html +20 -5
- package/src/artifacts/coverage-jest/lcov-report/RichSelect/RichSelect.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/RichSelect/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/RichSelect/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/RichSelect/useSelectedOption.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SASQLookupComponent/SASQLookupComponent.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SASQLookupComponent/TableBody/TableBody.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SASQLookupComponent/TableBody/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SASQLookupComponent/TableBody/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SASQLookupComponent/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SASQLookupComponent/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SASQRoute/SASQRoute.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SASQRoute/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SASQRoute/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SASQViewComponent/SASQViewComponent.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SASQViewComponent/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SASQViewComponent/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SearchField/SearchField.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SearchField/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SearchField/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SettingPage/SettingPage.js.html +12 -3
- package/src/artifacts/coverage-jest/lcov-report/SettingPage/SettingPagePane.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SettingPage/index.html +3 -3
- package/src/artifacts/coverage-jest/lcov-report/SettingPage/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/Typedown/Typedown.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/Typedown/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/Typedown/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/constants/customProperties.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/constants/eventCodes.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/constants/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/contexts/SettingsContext.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/contexts/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/contexts/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/index.html +10 -10
- package/src/artifacts/coverage-jest/lcov-report/hooks/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/useTypedown.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/useTypedownData.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/useTypedownToggle.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/useActiveElement.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/useCustomProperties.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/useHelperApp.js.html +30 -18
- package/src/artifacts/coverage-jest/lcov-report/hooks/useIntlKey.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/useIntlKeyStore.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/useInvalidateRefdata.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/useKintIntl.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/useKiwtFieldArray.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/useKiwtSASQuery.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/useLocalStorageState.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/useMutateCustomProperties.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/useMutateRefdataCategory.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/useMutateRefdataValue.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/useQIndex.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/useRefdata.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/useSASQQueryMeta.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/useTemplates.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/index.html +43 -43
- package/src/artifacts/coverage-jest/lcov-report/settingsHooks/index.html +3 -3
- package/src/artifacts/coverage-jest/lcov-report/settingsHooks/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/settingsHooks/useAppSettings.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/settingsHooks/useSettingSection.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/settingsHooks/useSettings.js.html +9 -3
- package/src/artifacts/coverage-jest/lcov-report/utils/buildUrl.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/utils/generateKiwtQuery.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/utils/generateKiwtQueryParams.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/utils/groupCustomPropertiesByCtx.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/utils/highlightString.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/utils/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/utils/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/utils/matchString.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/utils/parseErrorResponse.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/utils/parseKiwtQueryGroups.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/utils/refdataOptions.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/utils/refdataQueryKey.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/utils/selectorSafe.js.html +45 -3
- package/src/artifacts/coverage-jest/lcov-report/utils/sortByLabel.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/utils/toCamelCase.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/utils/typedownQueryKey.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/validators/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/validators/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/validators/validators.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov.info +388 -342
- package/src/lib/CustomProperties/View/CustomPropertyCard.js +3 -3
- package/src/lib/QueryTypedown/QueryTypedown.js +8 -3
- package/src/lib/ResponsiveButtonGroup/ResponsiveButtonGroup.js +3 -0
- package/src/lib/ResponsiveButtonGroup/useResponsiveButtonGroupSizing.js +5 -0
- package/src/lib/hooks/useHelperApp.js +14 -10
|
@@ -34,7 +34,7 @@ const CustomPropertyCard = ({
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
const internalFalse = customProperty?.internal === false ||
|
|
37
|
-
|
|
37
|
+
(customProperty?.internal === undefined && customPropertyDefinition.defaultInternal === false);
|
|
38
38
|
|
|
39
39
|
const renderValue = () => {
|
|
40
40
|
if (!customProperty) {
|
|
@@ -133,8 +133,8 @@ const CustomPropertyCard = ({
|
|
|
133
133
|
}
|
|
134
134
|
>
|
|
135
135
|
{kintIntl.formatKintMessage({
|
|
136
|
-
id: 'customProperties.internalFalse',
|
|
137
|
-
overrideValue: labelOverrides.internalFalse
|
|
136
|
+
id: internalFalse ? 'customProperties.internalFalse' : 'customProperties.internalTrue',
|
|
137
|
+
overrideValue: internalFalse ? labelOverrides.internalFalse : labelOverrides.internalTrue,
|
|
138
138
|
})}
|
|
139
139
|
</KeyValue>
|
|
140
140
|
</Col>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
|
|
4
4
|
import Typedown from '../Typedown';
|
|
@@ -12,11 +12,16 @@ const QueryTypedown = ({
|
|
|
12
12
|
}) => {
|
|
13
13
|
const [callPath, setCallPath] = useState(pathMutator(null, path));
|
|
14
14
|
const data = dataFormatter(useTypedownData(path, callPath));
|
|
15
|
+
const [userQuery, setUserQuery] = useState('');
|
|
15
16
|
|
|
16
17
|
const onType = e => {
|
|
17
|
-
|
|
18
|
+
setUserQuery(e.target.value);
|
|
18
19
|
};
|
|
19
20
|
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
setCallPath(pathMutator(userQuery, path));
|
|
23
|
+
}, [path, pathMutator, userQuery]);
|
|
24
|
+
|
|
20
25
|
return (
|
|
21
26
|
<Typedown
|
|
22
27
|
{...rest}
|
|
@@ -29,7 +34,7 @@ const QueryTypedown = ({
|
|
|
29
34
|
QueryTypedown.propTypes = {
|
|
30
35
|
dataFormatter: PropTypes.func,
|
|
31
36
|
path: PropTypes.string,
|
|
32
|
-
pathMutator: PropTypes.func
|
|
37
|
+
pathMutator: PropTypes.func,
|
|
33
38
|
};
|
|
34
39
|
|
|
35
40
|
export default QueryTypedown;
|
|
@@ -19,6 +19,7 @@ const propTypes = {
|
|
|
19
19
|
className: PropTypes.string,
|
|
20
20
|
dropdownTriggerProps: PropTypes.object,
|
|
21
21
|
fullWidth: PropTypes.bool,
|
|
22
|
+
id: PropTypes.string,
|
|
22
23
|
marginBottom0: PropTypes.bool,
|
|
23
24
|
selectedIndex: PropTypes.number,
|
|
24
25
|
tagName: PropTypes.string,
|
|
@@ -47,6 +48,7 @@ const ResponsiveButtonGroup = (props) => {
|
|
|
47
48
|
className,
|
|
48
49
|
dropdownTriggerProps = {},
|
|
49
50
|
fullWidth = false, // Only bother with this when buttonGroupWidth < ContainerWidth
|
|
51
|
+
id,
|
|
50
52
|
marginBottom0, // Will ONLL control the margin of the dropdown button
|
|
51
53
|
selectedIndex,
|
|
52
54
|
tagName: Tag = 'div',
|
|
@@ -61,6 +63,7 @@ const ResponsiveButtonGroup = (props) => {
|
|
|
61
63
|
ready,
|
|
62
64
|
} = useResponsiveButtonGroupSizing({
|
|
63
65
|
buttons: childButtons,
|
|
66
|
+
id
|
|
64
67
|
});
|
|
65
68
|
|
|
66
69
|
const buttonThreshold = calculateCumulativeThreshold(cachedSizeArray, containerWidth);
|
|
@@ -5,8 +5,12 @@ import { useResizeDetector } from 'react-resize-detector';
|
|
|
5
5
|
import { debounce } from 'lodash';
|
|
6
6
|
|
|
7
7
|
const useResponsiveButtonGroupSizing = ({
|
|
8
|
+
id,
|
|
8
9
|
buttons = [],
|
|
9
10
|
}) => {
|
|
11
|
+
const eventString = 'responsive-button-group-loaded' + (id ? `-${id}` : '');
|
|
12
|
+
const loadedEvent = new Event(eventString);
|
|
13
|
+
|
|
10
14
|
const isMounted = useRef(false);
|
|
11
15
|
useEffect(() => {
|
|
12
16
|
isMounted.current = true;
|
|
@@ -46,6 +50,7 @@ const useResponsiveButtonGroupSizing = ({
|
|
|
46
50
|
if (!cachedSizeArray?.length && sizeArray?.length) {
|
|
47
51
|
setCachedSizeArray(sizeArray);
|
|
48
52
|
setReady(true);
|
|
53
|
+
document.dispatchEvent(loadedEvent);
|
|
49
54
|
}
|
|
50
55
|
}
|
|
51
56
|
}, 150), [cachedSizeArray, sizeArray]);
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
|
2
2
|
import { useHistory, useLocation } from 'react-router-dom';
|
|
3
|
+
|
|
3
4
|
import queryString from 'query-string';
|
|
5
|
+
import isEqual from 'lodash/isEqual';
|
|
6
|
+
|
|
7
|
+
let helperObject = {};
|
|
4
8
|
|
|
5
9
|
const useHelperApp = (helpers) => {
|
|
6
10
|
const history = useHistory();
|
|
@@ -18,6 +22,11 @@ const useHelperApp = (helpers) => {
|
|
|
18
22
|
};
|
|
19
23
|
|
|
20
24
|
useEffect(() => {
|
|
25
|
+
// Keep object outside of hook to avoid redraw, oncly change when keys change
|
|
26
|
+
if (!isEqual(Object.keys(helperObject), Object.keys(helpers))) {
|
|
27
|
+
helperObject = helpers;
|
|
28
|
+
}
|
|
29
|
+
|
|
21
30
|
if (currentHelper !== query?.helper) {
|
|
22
31
|
const newQuery = {
|
|
23
32
|
...query,
|
|
@@ -29,12 +38,7 @@ const useHelperApp = (helpers) => {
|
|
|
29
38
|
search: `?${queryString.stringify(newQuery)}`
|
|
30
39
|
});
|
|
31
40
|
}
|
|
32
|
-
}, [
|
|
33
|
-
currentHelper,
|
|
34
|
-
history,
|
|
35
|
-
location,
|
|
36
|
-
query
|
|
37
|
-
]);
|
|
41
|
+
}, [currentHelper, helpers, history, location, query]);
|
|
38
42
|
|
|
39
43
|
// Set the HelperComponent
|
|
40
44
|
const HelperComponent = useMemo(() => ((props) => {
|
|
@@ -42,7 +46,7 @@ const useHelperApp = (helpers) => {
|
|
|
42
46
|
|
|
43
47
|
let Component = null;
|
|
44
48
|
|
|
45
|
-
Component =
|
|
49
|
+
Component = helperObject[query?.helper];
|
|
46
50
|
|
|
47
51
|
if (!Component) return null;
|
|
48
52
|
|
|
@@ -52,15 +56,15 @@ const useHelperApp = (helpers) => {
|
|
|
52
56
|
{...props}
|
|
53
57
|
/>
|
|
54
58
|
);
|
|
55
|
-
}), [handleToggleHelper, query.helper
|
|
59
|
+
}), [handleToggleHelper, query.helper]);
|
|
56
60
|
|
|
57
61
|
// Set up the helperToggleFunctions
|
|
58
62
|
const helperToggleFunctions = {};
|
|
59
|
-
Object.keys(
|
|
63
|
+
Object.keys(helperObject).forEach(h => {
|
|
60
64
|
helperToggleFunctions[h] = () => handleToggleHelper(h);
|
|
61
65
|
});
|
|
62
66
|
|
|
63
|
-
return { HelperComponent, helperToggleFunctions, isOpen };
|
|
67
|
+
return { currentHelper, HelperComponent, helperToggleFunctions, isOpen };
|
|
64
68
|
};
|
|
65
69
|
|
|
66
70
|
export default useHelperApp;
|