@k-int/stripes-kint-components 5.25.2 → 5.25.3
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 +7 -0
- package/es/__mocks__/@folio/stripes/components.js +7 -3
- package/es/__mocks__/@folio/stripes/core.js +6 -4
- package/es/__mocks__/@folio/stripes/smart-components.js +6 -4
- package/es/__mocks__/react-query.js +6 -4
- package/es/__mocks__/react-router-dom.js +6 -6
- package/es/lib/ActionList/ActionList.js +33 -26
- package/es/lib/ActionList/ActionListFieldArray.js +119 -103
- package/es/lib/ComboButton/ComboButton.js +47 -42
- package/es/lib/CustomProperties/Config/CustomPropertiesLookup.js +17 -11
- package/es/lib/CustomProperties/Config/CustomPropertiesSettings.js +46 -42
- package/es/lib/CustomProperties/Config/CustomPropertyForm.js +58 -58
- package/es/lib/CustomProperties/Config/CustomPropertyForm.test.js +8 -4
- package/es/lib/CustomProperties/Config/CustomPropertyView.js +33 -32
- package/es/lib/CustomProperties/Config/CustomPropertyView.test.js +1 -1
- package/es/lib/CustomProperties/Edit/CustomPropertiesEdit.js +1 -1
- package/es/lib/CustomProperties/Edit/CustomPropertiesEditCtx.js +3 -3
- package/es/lib/CustomProperties/Edit/CustomPropertiesListField.js +35 -29
- package/es/lib/CustomProperties/Edit/CustomPropertyField.js +59 -61
- package/es/lib/CustomProperties/Edit/CustomPropertyField.test.js +20 -20
- package/es/lib/CustomProperties/Edit/CustomPropertyFormCard.js +2 -2
- package/es/lib/CustomProperties/Edit/CustomPropertyFormCard.test.js +1 -1
- package/es/lib/CustomProperties/Edit/testResources.js +12 -11
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilter.js +33 -22
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilterField.js +35 -23
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilterField.test.js +1 -1
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilterFieldArray.js +6 -6
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilterForm.js +6 -3
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilterForm.test.js +8 -4
- package/es/lib/CustomProperties/Filter/CustomPropertiesRule.js +17 -14
- package/es/lib/CustomProperties/Filter/testResources.js +2 -1
- package/es/lib/CustomProperties/Filter/useParseActiveFilterStrings.js +2 -1
- package/es/lib/CustomProperties/View/CustomPropertiesView.js +1 -1
- package/es/lib/CustomProperties/View/CustomPropertiesViewCtx.js +26 -18
- package/es/lib/CustomProperties/View/CustomPropertiesViewCtx.test.js +6 -3
- package/es/lib/CustomProperties/View/CustomPropertyCard.js +11 -7
- package/es/lib/CycleButton/CycleButton.js +17 -9
- package/es/lib/EditableRefdataCategoryList/EditableRefdataCategoryList.js +46 -30
- package/es/lib/EditableRefdataList/EditableRefdataList.js +43 -33
- package/es/lib/EditableSettingsList/EditableSettingsListFieldArray/EditableSettingsListFieldArray.js +9 -5
- package/es/lib/EditableSettingsList/SettingField/EditSettingValue/EditSettingValue.js +6 -6
- package/es/lib/EditableSettingsList/SettingField/RenderSettingValue/RenderSettingValue.js +12 -10
- package/es/lib/EditableSettingsList/SettingField/SettingField.js +12 -8
- package/es/lib/EditableSettingsList/SettingField/SettingField.test.js +3 -3
- package/es/lib/FormModal/FormModal.js +32 -24
- package/es/lib/FormattedKintMessage/FormattedKintMessage.js +30 -23
- package/es/lib/IconSelect/IconSelect.js +32 -22
- package/es/lib/NoResultsMessage/NoResultsMessage.js +5 -4
- package/es/lib/NumberField/NumberField.js +25 -17
- package/es/lib/NumberField/NumberField.test.js +7 -6
- package/es/lib/QueryTypedown/QueryTypedown.js +15 -8
- package/es/lib/RefdataButtons/RefdataButtons.js +9 -6
- package/es/lib/RefdataCategoriesSettings/RefdataCategoriesSettings.js +26 -19
- package/es/lib/ResponsiveButtonGroup/ResponsiveButtonGroup.js +60 -48
- package/es/lib/ResponsiveButtonGroup/useResponsiveButtonGroupSizing.js +6 -5
- package/es/lib/RichSelect/RichSelect.js +36 -31
- package/es/lib/RichSelect/useSelectedOption.js +2 -1
- package/es/lib/SASQLookupComponent/SASQLookupComponent.js +94 -91
- package/es/lib/SASQLookupComponent/TableBody/TableBody.js +51 -41
- package/es/lib/SASQRoute/SASQRoute.js +29 -25
- package/es/lib/SASQViewComponent/SASQViewComponent.js +76 -68
- package/es/lib/SearchField/SearchField.js +13 -7
- package/es/lib/SearchKeyControl/SearchKeyControl.js +13 -8
- package/es/lib/SearchKeyControl/SearchKeyControl.test.js +6 -2
- package/es/lib/SettingPage/SettingPagePane/SettingPagePane.js +2 -2
- package/es/lib/SettingsFormContainer/SettingsFormContainer.js +35 -30
- package/es/lib/Tags/Tags.js +8 -5
- package/es/lib/Tags/hooks/useTags.js +1 -1
- package/es/lib/Tags/hooks/useTagsEnabled.js +1 -1
- package/es/lib/Tags/tagsConfig.js +1 -1
- package/es/lib/Typedown/Typedown.js +28 -21
- package/es/lib/hooks/__mocks__/index.js +7 -3
- package/es/lib/hooks/intlHooks/useIntlKeyStore/useIntlKeyStore.js +26 -20
- package/es/lib/hooks/intlHooks/useKintIntl/useKintIntl.js +34 -24
- package/es/lib/hooks/typedownHooks/useTypedown.js +2 -2
- package/es/lib/hooks/typedownHooks/useTypedownToggle.js +2 -2
- package/es/lib/hooks/useActionListRef.js +1 -1
- package/es/lib/hooks/useActiveElement.js +1 -1
- package/es/lib/hooks/useCustomProperties.js +10 -6
- package/es/lib/hooks/useHelperApp.js +16 -13
- package/es/lib/hooks/useKiwtFieldArray.js +8 -7
- package/es/lib/hooks/useKiwtSASQuery.js +19 -15
- package/es/lib/hooks/useLocalPageStore.js +10 -7
- package/es/lib/hooks/useModConfigEntries.js +2 -2
- package/es/lib/hooks/useMutateCustomProperties/useMutateCustomProperties.js +17 -10
- package/es/lib/hooks/useMutateGeneric/useMutateGeneric.js +2 -2
- package/es/lib/hooks/useMutateModConfigEntry.js +2 -2
- package/es/lib/hooks/useMutateRefdataCategory/useMutateRefdataCategory.js +21 -15
- package/es/lib/hooks/useMutateRefdataValue/useMutateRefdataValue.js +23 -16
- package/es/lib/hooks/usePrevNextPagination.js +19 -17
- package/es/lib/hooks/useQIndex.js +14 -11
- package/es/lib/hooks/useRefdata.js +3 -3
- package/es/lib/hooks/useTemplates.js +4 -4
- package/es/lib/settingsHooks/useAppSettings/useAppSettings.js +11 -7
- package/es/lib/settingsHooks/useSettingSection/useSettingSection.js +18 -12
- package/es/lib/settingsHooks/useSettings/useSettings.js +60 -60
- package/es/lib/utils/buildUrl.js +3 -2
- package/es/lib/utils/filterParsers/deparseKiwtQueryFilters.js +5 -5
- package/es/lib/utils/filterParsers/parseKiwtQueryFilters.js +2 -2
- package/es/lib/utils/filterParsers/parseKiwtQueryGroups.js +5 -4
- package/es/lib/utils/filterParsers/parseKiwtQueryString.js +1 -1
- package/es/lib/utils/generateKiwtQueryParams/generateKiwtQueryParams.js +82 -70
- package/es/lib/utils/groupCustomPropertiesByCtx.js +9 -5
- package/es/lib/utils/matchString.js +7 -5
- package/es/lib/utils/parseErrorResponse.js +4 -3
- package/es/lib/utils/selectorSafe.js +3 -2
- package/es/lib/utils/sortByLabel.js +3 -2
- package/es/lib/validators/validators.js +9 -6
- package/package.json +1 -1
- package/styles/TypeDown.css +3 -1
|
@@ -9,86 +9,94 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
9
9
|
var _reactQuery = require("react-query");
|
|
10
10
|
var _core = require("@folio/stripes/core");
|
|
11
11
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
+
const _excluded = ["fetchParameters", "history", "id", "location", "match", "path", "viewQueryPromise", "viewResponseTransform", "ViewComponent", "viewQueryNamespaceGenerator"],
|
|
13
|
+
_excluded2 = ["data"];
|
|
12
14
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
16
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
17
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
18
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
19
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
20
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
21
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
13
22
|
const SASQViewComponent = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
23
|
+
var _fetchParameters$item, _match$params, _match$params3;
|
|
14
24
|
let {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
25
|
+
fetchParameters,
|
|
26
|
+
history,
|
|
27
|
+
id,
|
|
28
|
+
location,
|
|
29
|
+
match,
|
|
30
|
+
path,
|
|
31
|
+
viewQueryPromise = _ref2 => {
|
|
32
|
+
let {
|
|
33
|
+
endpoint,
|
|
34
|
+
ky,
|
|
35
|
+
resourceId
|
|
36
|
+
} = _ref2;
|
|
37
|
+
return ky.get("".concat(endpoint, "/").concat(resourceId)).json();
|
|
38
|
+
},
|
|
39
|
+
viewResponseTransform = response => response,
|
|
40
|
+
ViewComponent,
|
|
41
|
+
viewQueryNamespaceGenerator = _ref3 => {
|
|
42
|
+
let {
|
|
43
|
+
namespace,
|
|
44
|
+
componentId,
|
|
45
|
+
id: passedId
|
|
46
|
+
} = _ref3;
|
|
47
|
+
const queryNamespace = [namespace, 'SASQ'];
|
|
48
|
+
if (componentId) {
|
|
49
|
+
queryNamespace.push(componentId);
|
|
50
|
+
}
|
|
51
|
+
queryNamespace.push('view');
|
|
52
|
+
queryNamespace.push(passedId);
|
|
53
|
+
return queryNamespace;
|
|
40
54
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
return queryNamespace;
|
|
44
|
-
},
|
|
45
|
-
...props
|
|
46
|
-
} = _ref;
|
|
55
|
+
} = _ref,
|
|
56
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
47
57
|
const {
|
|
48
58
|
0: namespace
|
|
49
59
|
} = (0, _core.useNamespace)();
|
|
50
60
|
|
|
51
61
|
// If itemEndpoint is available, use that, otherwise use standard endpoint
|
|
52
|
-
const endpoint = fetchParameters
|
|
62
|
+
const endpoint = (_fetchParameters$item = fetchParameters === null || fetchParameters === void 0 ? void 0 : fetchParameters.itemEndpoint) !== null && _fetchParameters$item !== void 0 ? _fetchParameters$item : fetchParameters === null || fetchParameters === void 0 ? void 0 : fetchParameters.endpoint;
|
|
53
63
|
const ky = (0, _core.useOkapiKy)();
|
|
54
|
-
const {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
64
|
+
const _useQuery = (0, _reactQuery.useQuery)(viewQueryNamespaceGenerator({
|
|
65
|
+
componentId: id,
|
|
66
|
+
namespace,
|
|
67
|
+
endpoint,
|
|
68
|
+
id: match === null || match === void 0 || (_match$params = match.params) === null || _match$params === void 0 ? void 0 : _match$params.id,
|
|
69
|
+
match
|
|
70
|
+
}), () => {
|
|
71
|
+
var _match$params2;
|
|
72
|
+
return viewQueryPromise({
|
|
73
|
+
ky,
|
|
74
|
+
resourceId: match === null || match === void 0 || (_match$params2 = match.params) === null || _match$params2 === void 0 ? void 0 : _match$params2.id,
|
|
75
|
+
endpoint
|
|
76
|
+
});
|
|
77
|
+
}, {
|
|
78
|
+
enabled: !!(match !== null && match !== void 0 && (_match$params3 = match.params) !== null && _match$params3 !== void 0 && _match$params3.id),
|
|
79
|
+
// select is a parameter supported by useQuery to transform the response
|
|
80
|
+
// Could be possible to instead pass this down along with the queryOptions
|
|
81
|
+
// Additionally this is assuming the viewResponseTransform is a func as opposed to an object
|
|
82
|
+
select: selectData => {
|
|
83
|
+
return viewResponseTransform(selectData);
|
|
84
|
+
}
|
|
85
|
+
}),
|
|
86
|
+
{
|
|
87
|
+
data = {}
|
|
88
|
+
} = _useQuery,
|
|
89
|
+
rest = _objectWithoutProperties(_useQuery, _excluded2);
|
|
78
90
|
(0, _react.useImperativeHandle)(ref, () => ({
|
|
79
|
-
queryProps: {
|
|
80
|
-
data
|
|
81
|
-
|
|
82
|
-
}
|
|
91
|
+
queryProps: _objectSpread({
|
|
92
|
+
data
|
|
93
|
+
}, rest)
|
|
83
94
|
}));
|
|
84
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(ViewComponent, {
|
|
85
|
-
onClose: () => history.push(
|
|
86
|
-
queryProps: {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
resource: data,
|
|
90
|
-
...props
|
|
91
|
-
});
|
|
95
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(ViewComponent, _objectSpread({
|
|
96
|
+
onClose: () => history.push("".concat(path).concat(location.search)),
|
|
97
|
+
queryProps: _objectSpread({}, rest),
|
|
98
|
+
resource: data
|
|
99
|
+
}, props));
|
|
92
100
|
});
|
|
93
101
|
SASQViewComponent.propTypes = {
|
|
94
102
|
fetchParameters: _propTypes.default.object,
|
|
@@ -9,8 +9,15 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
9
9
|
var _components = require("@folio/stripes/components");
|
|
10
10
|
var _SearchField = _interopRequireDefault(require("../../../styles/SearchField.css"));
|
|
11
11
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
+
const _excluded = ["ariaLabel"]; // Accepts the same props as TextField
|
|
12
13
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
-
|
|
14
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
15
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
16
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
17
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
18
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
19
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
20
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
14
21
|
const propTypes = {
|
|
15
22
|
ariaLabel: _propTypes.default.string,
|
|
16
23
|
clearSearchId: _propTypes.default.string,
|
|
@@ -19,22 +26,21 @@ const propTypes = {
|
|
|
19
26
|
};
|
|
20
27
|
const SearchField = props => {
|
|
21
28
|
const {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
29
|
+
ariaLabel
|
|
30
|
+
} = props,
|
|
31
|
+
rest = _objectWithoutProperties(props, _excluded);
|
|
25
32
|
const searchIcon = /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Icon, {
|
|
26
33
|
icon: "search",
|
|
27
34
|
iconClassName: _SearchField.default.searchIcon,
|
|
28
35
|
size: "small"
|
|
29
36
|
});
|
|
30
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.TextField, {
|
|
31
|
-
...rest,
|
|
37
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.TextField, _objectSpread(_objectSpread({}, rest), {}, {
|
|
32
38
|
"aria-label": rest['aria-label'] || ariaLabel,
|
|
33
39
|
focussedclass: _SearchField.default.isFocused,
|
|
34
40
|
hasClearIcon: true,
|
|
35
41
|
startControl: searchIcon,
|
|
36
42
|
type: "search"
|
|
37
|
-
});
|
|
43
|
+
}));
|
|
38
44
|
};
|
|
39
45
|
SearchField.propTypes = propTypes;
|
|
40
46
|
var _default = exports.default = SearchField;
|
|
@@ -21,15 +21,19 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
|
|
|
21
21
|
} = _ref;
|
|
22
22
|
// This component expects a qIndex comprising of a comma separated list
|
|
23
23
|
const [qIndex, setQIndex] = (0, _hooks.useQIndex)();
|
|
24
|
-
const qIndexArray = (0, _react.useMemo)(() =>
|
|
24
|
+
const qIndexArray = (0, _react.useMemo)(() => {
|
|
25
|
+
var _qIndex$split$map, _qIndex$split;
|
|
26
|
+
return (_qIndex$split$map = qIndex === null || qIndex === void 0 || (_qIndex$split = qIndex.split(',')) === null || _qIndex$split === void 0 ? void 0 : _qIndex$split.map(index => index.trim())) !== null && _qIndex$split$map !== void 0 ? _qIndex$split$map : [];
|
|
27
|
+
}, [qIndex]);
|
|
25
28
|
|
|
26
29
|
// Memoise this process so keyState changes if and only if options/qIndex change
|
|
27
30
|
const createKeyState = (0, _react.useCallback)(() => options.reduce((acc, curr) => {
|
|
31
|
+
var _curr$indexes$length, _curr$indexes, _curr$label;
|
|
28
32
|
// Is in use if URL contains ALL of the indexes
|
|
29
|
-
const subindexes = (curr
|
|
33
|
+
const subindexes = ((_curr$indexes$length = curr === null || curr === void 0 || (_curr$indexes = curr.indexes) === null || _curr$indexes === void 0 ? void 0 : _curr$indexes.length) !== null && _curr$indexes$length !== void 0 ? _curr$indexes$length : 0) > 0 ? curr.indexes : [curr.key];
|
|
30
34
|
acc[curr.key] = {
|
|
31
35
|
inUse: subindexes.every(si => qIndexArray.includes(si)),
|
|
32
|
-
label: curr.label
|
|
36
|
+
label: (_curr$label = curr.label) !== null && _curr$label !== void 0 ? _curr$label : curr.key,
|
|
33
37
|
subIndexes: curr.indexes
|
|
34
38
|
};
|
|
35
39
|
return acc;
|
|
@@ -52,6 +56,7 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
|
|
|
52
56
|
defaultToPageOne: false
|
|
53
57
|
});
|
|
54
58
|
const handleSearchKeyChange = (0, _react.useCallback)(_ref2 => {
|
|
59
|
+
var _value$subIndexes$len, _value$subIndexes;
|
|
55
60
|
let {
|
|
56
61
|
e: {
|
|
57
62
|
target: {
|
|
@@ -62,7 +67,7 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
|
|
|
62
67
|
value
|
|
63
68
|
} = _ref2;
|
|
64
69
|
// Set up which indexes need to change
|
|
65
|
-
const indicesToChange = (value
|
|
70
|
+
const indicesToChange = ((_value$subIndexes$len = value === null || value === void 0 || (_value$subIndexes = value.subIndexes) === null || _value$subIndexes === void 0 ? void 0 : _value$subIndexes.length) !== null && _value$subIndexes$len !== void 0 ? _value$subIndexes$len : 0) > 0 ? value.subIndexes : [key];
|
|
66
71
|
|
|
67
72
|
// If false, we must remove from the qIndex
|
|
68
73
|
if (!targetIsChecked) {
|
|
@@ -79,7 +84,7 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
|
|
|
79
84
|
qIndexArray.push(ind);
|
|
80
85
|
});
|
|
81
86
|
}
|
|
82
|
-
setQIndex(qIndexArray
|
|
87
|
+
setQIndex(qIndexArray === null || qIndexArray === void 0 ? void 0 : qIndexArray.join(','));
|
|
83
88
|
if (currentPage) {
|
|
84
89
|
resetPage();
|
|
85
90
|
}
|
|
@@ -97,15 +102,15 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
|
|
|
97
102
|
}
|
|
98
103
|
*/
|
|
99
104
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Checkbox, {
|
|
100
|
-
checked: value
|
|
105
|
+
checked: value === null || value === void 0 ? void 0 : value.inUse,
|
|
101
106
|
className: _SearchKeyControl.default.searchKeyControlElement,
|
|
102
|
-
label: value
|
|
107
|
+
label: value === null || value === void 0 ? void 0 : value.label,
|
|
103
108
|
onChange: e => handleSearchKeyChange({
|
|
104
109
|
e,
|
|
105
110
|
key,
|
|
106
111
|
value
|
|
107
112
|
})
|
|
108
|
-
},
|
|
113
|
+
}, "search-key-control-".concat(key));
|
|
109
114
|
})
|
|
110
115
|
})
|
|
111
116
|
});
|
|
@@ -7,9 +7,13 @@ var _SearchKeyControl = _interopRequireDefault(require("./SearchKeyControl"));
|
|
|
7
7
|
var _jest = require("../../../test/jest");
|
|
8
8
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
9
9
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
11
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
12
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
13
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
14
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
10
15
|
const mockUseQIndex = jest.fn();
|
|
11
|
-
jest.mock('../hooks', () => ({
|
|
12
|
-
...jest.requireActual('../hooks'),
|
|
16
|
+
jest.mock('../hooks', () => _objectSpread(_objectSpread({}, jest.requireActual('../hooks')), {}, {
|
|
13
17
|
useQIndex: () => mockUseQIndex()
|
|
14
18
|
}));
|
|
15
19
|
describe('SearchKeyControl', () => {
|
|
@@ -20,9 +20,9 @@ const SettingPagePane = _ref => {
|
|
|
20
20
|
const kintIntl = (0, _hooks.useKintIntl)(passedIntlKey, passedIntlNS);
|
|
21
21
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Pane, {
|
|
22
22
|
defaultWidth: "fill",
|
|
23
|
-
id:
|
|
23
|
+
id: "settings-".concat(sectionName),
|
|
24
24
|
paneTitle: kintIntl.formatKintMessage({
|
|
25
|
-
id:
|
|
25
|
+
id: "settings.settingsSection.".concat((0, _utils.toCamelCase)(sectionName)),
|
|
26
26
|
fallbackMessage: sectionName
|
|
27
27
|
}),
|
|
28
28
|
children: children
|
|
@@ -8,25 +8,33 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
8
8
|
var _core = require("@folio/stripes/core");
|
|
9
9
|
var _hooks = require("../hooks");
|
|
10
10
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
-
|
|
11
|
+
const _excluded = ["ConfigFormComponent", "configName", "getInitialValues", "intlKey", "intlNS", "labelOverrides", "moduleName", "scope"];
|
|
12
12
|
/*
|
|
13
13
|
* API is similar to ConfigManager
|
|
14
14
|
*
|
|
15
15
|
* DEPRECATED -- As far as I can see this is now unused anyway
|
|
16
16
|
* KInt modules are swapping to AppSettings instead of mod-settings, so no centralised components should be needed
|
|
17
|
-
*/
|
|
17
|
+
*/
|
|
18
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
19
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
20
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
21
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
22
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
23
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
24
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
25
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
26
|
+
const SettingsFormContainer = _ref => {
|
|
18
27
|
let {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
} = _ref;
|
|
28
|
+
ConfigFormComponent,
|
|
29
|
+
configName,
|
|
30
|
+
getInitialValues: passedGetInitialValues,
|
|
31
|
+
intlKey: passedIntlKey,
|
|
32
|
+
intlNS: passedIntlNS,
|
|
33
|
+
labelOverrides = {},
|
|
34
|
+
moduleName,
|
|
35
|
+
scope // We don't use this currently but it's here for future reference
|
|
36
|
+
} = _ref,
|
|
37
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
30
38
|
// eslint-disable-next-line no-console
|
|
31
39
|
console.warn('SettingsFormContainer is deprecated, as it utilises mod-config');
|
|
32
40
|
const callout = (0, _core.useCallout)();
|
|
@@ -54,20 +62,18 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
|
|
|
54
62
|
} = (0, _hooks.useMutateModConfigEntry)({
|
|
55
63
|
configName,
|
|
56
64
|
moduleName,
|
|
57
|
-
id: settings
|
|
65
|
+
id: settings === null || settings === void 0 ? void 0 : settings.id
|
|
58
66
|
});
|
|
59
67
|
const onSubmit = values => {
|
|
60
|
-
const setting = {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
})
|
|
70
|
-
};
|
|
68
|
+
const setting = _objectSpread(_objectSpread({}, settings), {}, {
|
|
69
|
+
value: JSON.stringify(values)
|
|
70
|
+
}, moduleName ? {
|
|
71
|
+
module: moduleName,
|
|
72
|
+
configName
|
|
73
|
+
} : {
|
|
74
|
+
scope,
|
|
75
|
+
key: configName
|
|
76
|
+
});
|
|
71
77
|
editSettings(setting).then(() => {
|
|
72
78
|
callout.sendCallout({
|
|
73
79
|
message: kintIntl.formatKintMessage({
|
|
@@ -75,7 +81,7 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
|
|
|
75
81
|
id: 'settingSaveSuccess',
|
|
76
82
|
intlKey: passedIntlKey,
|
|
77
83
|
intlNS: passedIntlNS,
|
|
78
|
-
overrideValue: labelOverrides
|
|
84
|
+
overrideValue: labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides.settingSaveSuccess
|
|
79
85
|
}),
|
|
80
86
|
type: 'success'
|
|
81
87
|
});
|
|
@@ -95,11 +101,10 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
|
|
|
95
101
|
style: {
|
|
96
102
|
width: '100%'
|
|
97
103
|
},
|
|
98
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(ConfigFormComponent, {
|
|
104
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(ConfigFormComponent, _objectSpread({
|
|
99
105
|
initialValues: getInitialValues(),
|
|
100
|
-
onSubmit: onSubmit
|
|
101
|
-
|
|
102
|
-
})
|
|
106
|
+
onSubmit: onSubmit
|
|
107
|
+
}, rest))
|
|
103
108
|
});
|
|
104
109
|
};
|
|
105
110
|
SettingsFormContainer.propTypes = {
|
package/es/lib/Tags/Tags.js
CHANGED
|
@@ -17,6 +17,7 @@ var _hooks2 = require("../hooks");
|
|
|
17
17
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
18
18
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
19
19
|
const Tags = _ref => {
|
|
20
|
+
var _entity$tags3, _entity$tags$length, _entity$tags4;
|
|
20
21
|
let {
|
|
21
22
|
invalidateLinks = [],
|
|
22
23
|
// If there are other queries that need invalidating, pass those here
|
|
@@ -59,7 +60,7 @@ const Tags = _ref => {
|
|
|
59
60
|
json: data
|
|
60
61
|
}).then(() => {
|
|
61
62
|
queryClient.invalidateQueries(link);
|
|
62
|
-
if (invalidateLinks
|
|
63
|
+
if (invalidateLinks !== null && invalidateLinks !== void 0 && invalidateLinks.length) {
|
|
63
64
|
invalidateLinks.forEach(il => queryClient.invalidateQueries(il));
|
|
64
65
|
}
|
|
65
66
|
}));
|
|
@@ -84,7 +85,8 @@ const Tags = _ref => {
|
|
|
84
85
|
// add tag to the list of entity tags
|
|
85
86
|
// istanbul ignore next
|
|
86
87
|
const saveEntityTags = tagsToSave => {
|
|
87
|
-
|
|
88
|
+
var _entity$tags;
|
|
89
|
+
const tagListMap = ((_entity$tags = entity === null || entity === void 0 ? void 0 : entity.tags) !== null && _entity$tags !== void 0 ? _entity$tags : []).map(tag => ({
|
|
88
90
|
'value': tag.value
|
|
89
91
|
}));
|
|
90
92
|
const tagsMap = tagsToSave.map(tag => ({
|
|
@@ -100,7 +102,8 @@ const Tags = _ref => {
|
|
|
100
102
|
saveTags(addTags);
|
|
101
103
|
};
|
|
102
104
|
const onRemove = tag => {
|
|
103
|
-
|
|
105
|
+
var _entity$tags2;
|
|
106
|
+
const tagToDelete = ((_entity$tags2 = entity === null || entity === void 0 ? void 0 : entity.tags) !== null && _entity$tags2 !== void 0 ? _entity$tags2 : []).filter(t => t.value.toLowerCase() === tag.toLowerCase());
|
|
104
107
|
putEntity({
|
|
105
108
|
tags: [{
|
|
106
109
|
id: tagToDelete[0].id,
|
|
@@ -108,7 +111,7 @@ const Tags = _ref => {
|
|
|
108
111
|
}]
|
|
109
112
|
});
|
|
110
113
|
};
|
|
111
|
-
const entityTags = (entity
|
|
114
|
+
const entityTags = ((_entity$tags3 = entity === null || entity === void 0 ? void 0 : entity.tags) !== null && _entity$tags3 !== void 0 ? _entity$tags3 : []).map(tag => tag.value.toLowerCase());
|
|
112
115
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Pane, {
|
|
113
116
|
defaultWidth: "20%",
|
|
114
117
|
dismissible: true,
|
|
@@ -118,7 +121,7 @@ const Tags = _ref => {
|
|
|
118
121
|
id: 'numberOfTags',
|
|
119
122
|
overrideValue: labelOverrides.numberOfTags
|
|
120
123
|
}, {
|
|
121
|
-
count: entity
|
|
124
|
+
count: (_entity$tags$length = entity === null || entity === void 0 || (_entity$tags4 = entity.tags) === null || _entity$tags4 === void 0 ? void 0 : _entity$tags4.length) !== null && _entity$tags$length !== void 0 ? _entity$tags$length : 0
|
|
122
125
|
}),
|
|
123
126
|
paneTitle: kintIntl.formatKintMessage({
|
|
124
127
|
id: 'tags',
|
|
@@ -9,7 +9,7 @@ var _core = require("@folio/stripes/core");
|
|
|
9
9
|
var _tagsConfig = require("../tagsConfig");
|
|
10
10
|
const useTags = (namespaceArray, options) => {
|
|
11
11
|
const ky = (0, _core.useOkapiKy)();
|
|
12
|
-
const nsArray = namespaceArray
|
|
12
|
+
const nsArray = namespaceArray !== null && namespaceArray !== void 0 ? namespaceArray : _tagsConfig.tagNamespaceArray;
|
|
13
13
|
return (0, _reactQuery.useQuery)(nsArray, () => ky.get(_tagsConfig.defaultTagQuery).json(), options);
|
|
14
14
|
};
|
|
15
15
|
var _default = exports.default = useTags;
|
|
@@ -10,7 +10,7 @@ var _endpoints = require("../../constants/endpoints");
|
|
|
10
10
|
const tagsEnabledQueryKey = exports.tagsEnabledQueryKey = [_endpoints.MOD_SETTINGS_ENDPOINT, 'query=(module==TAGS and configName==tags_enabled)', 'stripes-kint-components', 'useTagsEnabled'];
|
|
11
11
|
const useTagsEnabled = () => {
|
|
12
12
|
const ky = (0, _core.useOkapiKy)();
|
|
13
|
-
const queryObject = (0, _reactQuery.useQuery)(tagsEnabledQueryKey, () => ky.get(
|
|
13
|
+
const queryObject = (0, _reactQuery.useQuery)(tagsEnabledQueryKey, () => ky.get("".concat(_endpoints.MOD_SETTINGS_ENDPOINT, "?query=(module==TAGS and configName==tags_enabled)")).json());
|
|
14
14
|
const {
|
|
15
15
|
data: {
|
|
16
16
|
configs: {
|
|
@@ -7,4 +7,4 @@ exports.tagsPath = exports.tagNamespaceArray = exports.defaultTagsParams = expor
|
|
|
7
7
|
const tagNamespaceArray = exports.tagNamespaceArray = ['tags', 'stripes-kint-components', 'Tags'];
|
|
8
8
|
const tagsPath = exports.tagsPath = 'tags';
|
|
9
9
|
const defaultTagsParams = exports.defaultTagsParams = ['limit=1000', 'query=cql.allRecords%3D1%20sortby%20label'];
|
|
10
|
-
const defaultTagQuery = exports.defaultTagQuery =
|
|
10
|
+
const defaultTagQuery = exports.defaultTagQuery = "".concat(tagsPath, "?").concat(defaultTagsParams === null || defaultTagsParams === void 0 ? void 0 : defaultTagsParams.join('&'));
|
|
@@ -7,7 +7,7 @@ exports.default = void 0;
|
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
9
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
10
|
-
var
|
|
10
|
+
var _get3 = _interopRequireDefault(require("lodash/get"));
|
|
11
11
|
var _components = require("@folio/stripes/components");
|
|
12
12
|
var _SearchField = _interopRequireDefault(require("../SearchField"));
|
|
13
13
|
var _TypeDown = _interopRequireDefault(require("../../../styles/TypeDown.css"));
|
|
@@ -40,7 +40,7 @@ const Typedown = _ref => {
|
|
|
40
40
|
// A way to pass any styles that need to be applied globally on selection
|
|
41
41
|
uniqueIdentificationPath = 'id'
|
|
42
42
|
} = _ref;
|
|
43
|
-
const selectedUniqueId = (0,
|
|
43
|
+
const selectedUniqueId = (0, _get3.default)(input.value, uniqueIdentificationPath);
|
|
44
44
|
|
|
45
45
|
// Display data needs to be in line with data options but also able to react to default handleType
|
|
46
46
|
const [displayData, setDisplayData] = (0, _react.useState)(dataOptions);
|
|
@@ -54,18 +54,25 @@ const Typedown = _ref => {
|
|
|
54
54
|
|
|
55
55
|
// Setup default handleType
|
|
56
56
|
const handleType = e => {
|
|
57
|
-
|
|
57
|
+
var _e$target, _e$target2;
|
|
58
|
+
const regex = new RegExp("".concat(e.target.value.toLowerCase()));
|
|
58
59
|
if (onType) {
|
|
59
60
|
onType(e);
|
|
60
|
-
} else if (filterPath && e
|
|
61
|
-
setDisplayData(dataOptions.filter(item =>
|
|
62
|
-
|
|
63
|
-
|
|
61
|
+
} else if (filterPath && e !== null && e !== void 0 && (_e$target = e.target) !== null && _e$target !== void 0 && _e$target.value) {
|
|
62
|
+
setDisplayData(dataOptions.filter(item => {
|
|
63
|
+
var _get;
|
|
64
|
+
return (_get = (0, _get3.default)(item, filterPath)) === null || _get === void 0 || (_get = _get.toLowerCase()) === null || _get === void 0 ? void 0 : _get.match(regex);
|
|
65
|
+
}));
|
|
66
|
+
} else if (e !== null && e !== void 0 && (_e$target2 = e.target) !== null && _e$target2 !== void 0 && _e$target2.value) {
|
|
67
|
+
setDisplayData(dataOptions.filter(item => {
|
|
68
|
+
var _get2;
|
|
69
|
+
return (_get2 = (0, _get3.default)(item, uniqueIdentificationPath)) === null || _get2 === void 0 || (_get2 = _get2.toLowerCase()) === null || _get2 === void 0 ? void 0 : _get2.match(regex);
|
|
70
|
+
}));
|
|
64
71
|
} else {
|
|
65
72
|
setDisplayData(dataOptions);
|
|
66
73
|
}
|
|
67
74
|
setCurrentlyTyped(e.target.value);
|
|
68
|
-
if (displayData.length === 1 && (0,
|
|
75
|
+
if (displayData.length === 1 && (0, _get3.default)(displayData[0], filterPath) === e.target.value) {
|
|
69
76
|
setExactMatch(true);
|
|
70
77
|
} else {
|
|
71
78
|
setExactMatch(false);
|
|
@@ -98,7 +105,7 @@ const Typedown = _ref => {
|
|
|
98
105
|
let optionIsSelected = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
99
106
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
100
107
|
className: _TypeDown.default.listItem,
|
|
101
|
-
children: renderListItem ? renderListItem(option, currentlyTyped, exactMatch, optionIsSelected) : (0,
|
|
108
|
+
children: renderListItem ? renderListItem(option, currentlyTyped, exactMatch, optionIsSelected) : (0, _get3.default)(option, uniqueIdentificationPath)
|
|
102
109
|
});
|
|
103
110
|
}, [currentlyTyped, exactMatch, renderListItem, uniqueIdentificationPath]);
|
|
104
111
|
const handleChange = (0, _react.useCallback)(value => {
|
|
@@ -110,23 +117,23 @@ const Typedown = _ref => {
|
|
|
110
117
|
const dropDown = (0, _react.useCallback)(() => {
|
|
111
118
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
112
119
|
className: _TypeDown.default.dropdownMenu,
|
|
113
|
-
id:
|
|
120
|
+
id: "typedown-parent-".concat((0, _selectorSafe.default)(input.name), "-menu"),
|
|
114
121
|
style: {
|
|
115
|
-
'--searchWidth':
|
|
122
|
+
'--searchWidth': "".concat(searchWidth, "px")
|
|
116
123
|
},
|
|
117
124
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
118
125
|
ref: listRef,
|
|
119
126
|
className: _TypeDown.default.listContainer,
|
|
120
127
|
id: "typedown-list",
|
|
121
|
-
children: displayData
|
|
122
|
-
const isSelectedEval = isSelected ? isSelected(input.value, d) : (0,
|
|
123
|
-
const selectedCSS = selectedStyles
|
|
128
|
+
children: displayData !== null && displayData !== void 0 && displayData.length ? displayData === null || displayData === void 0 ? void 0 : displayData.map((d, index) => {
|
|
129
|
+
const isSelectedEval = isSelected ? isSelected(input.value, d) : (0, _get3.default)(input.value, uniqueIdentificationPath) === (0, _get3.default)(d, uniqueIdentificationPath);
|
|
130
|
+
const selectedCSS = selectedStyles !== null && selectedStyles !== void 0 ? selectedStyles : _TypeDown.default.selectedMenuButton;
|
|
124
131
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
|
|
125
132
|
className: (0, _classnames.default)(_TypeDown.default.fullWidth, _TypeDown.default.menuButton, {
|
|
126
|
-
[
|
|
133
|
+
["".concat(selectedCSS)]: isSelectedEval
|
|
127
134
|
}),
|
|
128
135
|
"data-selected": isSelectedEval,
|
|
129
|
-
id:
|
|
136
|
+
id: "typedown-button-[".concat(index, "]"),
|
|
130
137
|
onClick: () => {
|
|
131
138
|
handleChange(d);
|
|
132
139
|
handleNextFocus();
|
|
@@ -134,12 +141,12 @@ const Typedown = _ref => {
|
|
|
134
141
|
onKeyDown: listKeyDownHandler,
|
|
135
142
|
type: "button",
|
|
136
143
|
children: renderItem(d, isSelectedEval)
|
|
137
|
-
},
|
|
144
|
+
}, "typedown-button-[".concat(index, "]"));
|
|
138
145
|
}) : endOfList || /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.EndOfList, {})
|
|
139
146
|
}), renderFooter && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
140
147
|
ref: footerRef,
|
|
141
148
|
className: _TypeDown.default.footer,
|
|
142
|
-
id:
|
|
149
|
+
id: "typedown-footer-".concat((0, _selectorSafe.default)(input.name)),
|
|
143
150
|
children: renderFooter(displayData, currentlyTyped, exactMatch)
|
|
144
151
|
})]
|
|
145
152
|
});
|
|
@@ -147,11 +154,11 @@ const Typedown = _ref => {
|
|
|
147
154
|
const renderSearchField = () => {
|
|
148
155
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
149
156
|
ref: triggerRef,
|
|
150
|
-
id:
|
|
157
|
+
id: "typedown-parent-".concat((0, _selectorSafe.default)(input.name), "-searchField"),
|
|
151
158
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_SearchField.default
|
|
152
159
|
// Pass meta through so correct styling gets applied to the TextField
|
|
153
160
|
, {
|
|
154
|
-
id:
|
|
161
|
+
id: "typedown-searchField-".concat((0, _selectorSafe.default)(input.name)),
|
|
155
162
|
label: label,
|
|
156
163
|
marginBottom0: true,
|
|
157
164
|
meta: meta,
|
|
@@ -167,7 +174,7 @@ const Typedown = _ref => {
|
|
|
167
174
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
168
175
|
ref: resizeRef,
|
|
169
176
|
className: (0, _classnames.default)(_TypeDown.default.typedown, className),
|
|
170
|
-
id:
|
|
177
|
+
id: "typedown-id-".concat(id),
|
|
171
178
|
children: [renderSearchField(), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Popper, {
|
|
172
179
|
anchorRef: triggerRef,
|
|
173
180
|
className: (0, _classnames.default)(_TypeDown.default.dropdown, _TypeDown.default.fullWidth),
|