@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
|
@@ -62,16 +62,16 @@ describe('SettingField', () => {
|
|
|
62
62
|
})
|
|
63
63
|
}));
|
|
64
64
|
});
|
|
65
|
-
it(
|
|
65
|
+
it("renders ".concat(expectedRender), () => {
|
|
66
66
|
const {
|
|
67
67
|
getByText
|
|
68
68
|
} = renderComponent;
|
|
69
69
|
expect(getByText(expectedRender)).toBeInTheDocument();
|
|
70
70
|
});
|
|
71
|
-
test(
|
|
71
|
+
test("renders the ".concat(expectedButton, " button"), () => {
|
|
72
72
|
(0, _stripesErmTesting.Button)('Edit').exists();
|
|
73
73
|
});
|
|
74
|
-
describe(
|
|
74
|
+
describe("clicking the ".concat(expectedButton, " button"), () => {
|
|
75
75
|
beforeEach(async () => {
|
|
76
76
|
await (0, _react2.waitFor)(async () => {
|
|
77
77
|
await (0, _stripesErmTesting.Button)(expectedButton).click();
|
|
@@ -9,29 +9,37 @@ var _reactFinalForm = require("react-final-form");
|
|
|
9
9
|
var _components = require("@folio/stripes/components");
|
|
10
10
|
var _hooks = require("../hooks");
|
|
11
11
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
+
const _excluded = ["footer", "onClose"],
|
|
13
|
+
_excluded2 = ["children", "intlKey", "intlNS", "labelOverrides", "modalProps", "onError", "onSubmit", "onSuccess"];
|
|
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 FormModal = _ref => {
|
|
14
23
|
let {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
} = _ref;
|
|
24
|
+
children,
|
|
25
|
+
intlKey: passedIntlKey,
|
|
26
|
+
intlNS: passedIntlNS,
|
|
27
|
+
labelOverrides = {},
|
|
28
|
+
modalProps: {
|
|
29
|
+
footer,
|
|
30
|
+
onClose
|
|
31
|
+
},
|
|
32
|
+
onError,
|
|
33
|
+
// Optional handler to run onSuccess for default handleSaveAndClear
|
|
34
|
+
onSubmit,
|
|
35
|
+
onSuccess // Optional handler to run onSuccess for default handleSaveAndClear
|
|
36
|
+
} = _ref,
|
|
37
|
+
modalProps = _objectWithoutProperties(_ref.modalProps, _excluded),
|
|
38
|
+
formProps = _objectWithoutProperties(_ref, _excluded2);
|
|
31
39
|
const kintIntl = (0, _hooks.useKintIntl)(passedIntlKey, passedIntlNS);
|
|
32
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFinalForm.Form, {
|
|
33
|
-
onSubmit: onSubmit
|
|
34
|
-
|
|
40
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFinalForm.Form, _objectSpread(_objectSpread({
|
|
41
|
+
onSubmit: onSubmit
|
|
42
|
+
}, formProps), {}, {
|
|
35
43
|
children: _ref2 => {
|
|
36
44
|
let {
|
|
37
45
|
handleSubmit,
|
|
@@ -130,15 +138,15 @@ const FormModal = _ref => {
|
|
|
130
138
|
})]
|
|
131
139
|
});
|
|
132
140
|
};
|
|
133
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Modal, {
|
|
141
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Modal, _objectSpread(_objectSpread({
|
|
134
142
|
enforceFocus: false,
|
|
135
143
|
footer: renderFooter(),
|
|
136
|
-
onClose: handleClose
|
|
137
|
-
|
|
144
|
+
onClose: handleClose
|
|
145
|
+
}, modalProps), {}, {
|
|
138
146
|
children: children
|
|
139
|
-
});
|
|
147
|
+
}));
|
|
140
148
|
}
|
|
141
|
-
});
|
|
149
|
+
}));
|
|
142
150
|
};
|
|
143
151
|
FormModal.propTypes = {
|
|
144
152
|
children: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.node), _propTypes.default.node, _propTypes.default.func]),
|
|
@@ -8,30 +8,38 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
8
8
|
var _reactIntl = require("react-intl");
|
|
9
9
|
var _hooks = require("../hooks");
|
|
10
10
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
+
const _excluded = ["fallbackMessage", "id", "intlKey", "intlNS", "overrideValue"]; // This works analogously to useKintIntl's "formatKintMessage"
|
|
11
12
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
-
|
|
13
|
+
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; }
|
|
14
|
+
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; }
|
|
15
|
+
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; }
|
|
16
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
17
|
+
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); }
|
|
18
|
+
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; }
|
|
19
|
+
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
20
|
const FormattedKintMessage = _ref => {
|
|
21
|
+
var _intlObj$messages2;
|
|
14
22
|
let {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
23
|
+
fallbackMessage,
|
|
24
|
+
id,
|
|
25
|
+
intlKey: passedIntlKey,
|
|
26
|
+
intlNS: passedIntlNS,
|
|
27
|
+
overrideValue
|
|
28
|
+
} = _ref,
|
|
29
|
+
formattedMessageProps = _objectWithoutProperties(_ref, _excluded);
|
|
22
30
|
const intlKey = (0, _hooks.useIntlKey)(passedIntlKey, passedIntlNS);
|
|
23
31
|
const intlObj = (0, _reactIntl.useIntl)();
|
|
24
32
|
if (overrideValue) {
|
|
33
|
+
var _intlObj$messages;
|
|
25
34
|
// Version 3 is a breaking change, where labelOverrides must be strings.
|
|
26
35
|
if (typeof overrideValue !== 'string') {
|
|
27
36
|
throw new Error('Override values must be strings as of stripes-kint-components ^3.0.0');
|
|
28
37
|
}
|
|
29
|
-
if (intlObj.messages
|
|
38
|
+
if ((_intlObj$messages = intlObj.messages) !== null && _intlObj$messages !== void 0 && _intlObj$messages[overrideValue]) {
|
|
30
39
|
// We've been passed a key as an override, return formattedMessage with it
|
|
31
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
|
|
32
|
-
id: overrideValue
|
|
33
|
-
|
|
34
|
-
});
|
|
40
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, _objectSpread({
|
|
41
|
+
id: overrideValue
|
|
42
|
+
}, formattedMessageProps));
|
|
35
43
|
}
|
|
36
44
|
// At this stage we have an overrideValue that's not a key, return it.
|
|
37
45
|
return overrideValue;
|
|
@@ -40,20 +48,19 @@ const FormattedKintMessage = _ref => {
|
|
|
40
48
|
// If key does not exist in intl, and we have a specified "fallbackMessage", use that
|
|
41
49
|
|
|
42
50
|
// (FallbackMessage works like defaultMessage but with no warning)
|
|
43
|
-
if (!intlObj.messages
|
|
51
|
+
if (!((_intlObj$messages2 = intlObj.messages) !== null && _intlObj$messages2 !== void 0 && _intlObj$messages2["".concat(intlKey, ".").concat(id)]) && fallbackMessage) {
|
|
52
|
+
var _intlObj$messages3;
|
|
44
53
|
// Allow fallback message to be an intl key
|
|
45
|
-
if (intlObj.messages
|
|
46
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
|
|
47
|
-
id: fallbackMessage
|
|
48
|
-
|
|
49
|
-
});
|
|
54
|
+
if ((_intlObj$messages3 = intlObj.messages) !== null && _intlObj$messages3 !== void 0 && _intlObj$messages3[fallbackMessage]) {
|
|
55
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, _objectSpread({
|
|
56
|
+
id: fallbackMessage
|
|
57
|
+
}, formattedMessageProps));
|
|
50
58
|
}
|
|
51
59
|
return fallbackMessage;
|
|
52
60
|
}
|
|
53
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
|
|
54
|
-
id:
|
|
55
|
-
|
|
56
|
-
});
|
|
61
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, _objectSpread({
|
|
62
|
+
id: "".concat(intlKey, ".").concat(id)
|
|
63
|
+
}, formattedMessageProps));
|
|
57
64
|
};
|
|
58
65
|
FormattedKintMessage.propTypes = {
|
|
59
66
|
fallbackMessage: _propTypes.default.string,
|
|
@@ -12,10 +12,18 @@ var _IconSelect = _interopRequireDefault(require("../../../styles/IconSelect.css
|
|
|
12
12
|
var _RichSelect = _interopRequireWildcard(require("../RichSelect"));
|
|
13
13
|
var _FormattedKintMessage = _interopRequireDefault(require("../FormattedKintMessage"));
|
|
14
14
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
|
+
const _excluded = ["className"]; // A form component which acts as a "Select for states with corresponding icons"
|
|
15
16
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
16
17
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
17
|
-
|
|
18
|
+
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; }
|
|
19
|
+
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; }
|
|
20
|
+
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; }
|
|
21
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
22
|
+
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); }
|
|
23
|
+
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; }
|
|
24
|
+
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; }
|
|
18
25
|
const IconSelect = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
26
|
+
var _selectedOption$butto;
|
|
19
27
|
let {
|
|
20
28
|
ariaLabel,
|
|
21
29
|
disabled = false,
|
|
@@ -42,15 +50,16 @@ const IconSelect = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
42
50
|
};
|
|
43
51
|
|
|
44
52
|
// Options with notSet
|
|
45
|
-
const options = [notSet
|
|
53
|
+
const options = [notSet !== null && notSet !== void 0 ? notSet : defaultNotSet, ...userOptions];
|
|
46
54
|
const [richSelectRef, selectedOption] = (0, _RichSelect.useSelectedOption)();
|
|
47
55
|
(0, _react.useImperativeHandle)(ref, () => ({
|
|
48
56
|
selectedOption
|
|
49
57
|
}));
|
|
50
|
-
const {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
58
|
+
const _ref2 = (_selectedOption$butto = selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.buttonProps) !== null && _selectedOption$butto !== void 0 ? _selectedOption$butto : {},
|
|
59
|
+
{
|
|
60
|
+
className: iconButtonClassName
|
|
61
|
+
} = _ref2,
|
|
62
|
+
buttonProps = _objectWithoutProperties(_ref2, _excluded);
|
|
54
63
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_RichSelect.default, {
|
|
55
64
|
ref: richSelectRef,
|
|
56
65
|
ariaLabel: ariaLabel,
|
|
@@ -62,36 +71,37 @@ const IconSelect = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
62
71
|
onChange: onChange,
|
|
63
72
|
options: options,
|
|
64
73
|
renderOption: opt => {
|
|
74
|
+
var _opt$label2;
|
|
65
75
|
if (opt.icon) {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
76
|
+
var _opt$label;
|
|
77
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Icon, _objectSpread(_objectSpread({
|
|
78
|
+
icon: opt.icon
|
|
79
|
+
}, opt.iconProps), {}, {
|
|
80
|
+
children: (_opt$label = opt.label) !== null && _opt$label !== void 0 ? _opt$label : opt.value
|
|
81
|
+
}));
|
|
71
82
|
}
|
|
72
|
-
return opt.label
|
|
83
|
+
return (_opt$label2 = opt.label) !== null && _opt$label2 !== void 0 ? _opt$label2 : opt.value;
|
|
73
84
|
},
|
|
74
|
-
renderTrigger:
|
|
85
|
+
renderTrigger: _ref3 => {
|
|
86
|
+
var _selectedOption$icon;
|
|
75
87
|
let {
|
|
76
88
|
onToggle,
|
|
77
89
|
triggerRef,
|
|
78
90
|
keyHandler,
|
|
79
91
|
ariaProps,
|
|
80
92
|
getTriggerProps
|
|
81
|
-
} =
|
|
82
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.IconButton, {
|
|
93
|
+
} = _ref3;
|
|
94
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.IconButton, _objectSpread(_objectSpread(_objectSpread({
|
|
83
95
|
ref: triggerRef,
|
|
84
96
|
disabled: disabled,
|
|
85
|
-
icon: selectedOption
|
|
97
|
+
icon: (_selectedOption$icon = selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.icon) !== null && _selectedOption$icon !== void 0 ? _selectedOption$icon : 'ellipsis',
|
|
86
98
|
marginBottom0: true,
|
|
87
99
|
onClick: onToggle,
|
|
88
100
|
onKeyDown: keyHandler,
|
|
89
|
-
type: "button"
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
...ariaProps
|
|
94
|
-
});
|
|
101
|
+
type: "button"
|
|
102
|
+
}, _objectSpread({
|
|
103
|
+
className: (0, _classnames.default)(_IconSelect.default.buttonStyle, iconButtonClassName)
|
|
104
|
+
}, buttonProps)), getTriggerProps()), ariaProps));
|
|
95
105
|
},
|
|
96
106
|
required: required,
|
|
97
107
|
value: value
|
|
@@ -13,6 +13,7 @@ var _hooks = require("../hooks");
|
|
|
13
13
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
14
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
15
|
const NoResultsMessage = _ref => {
|
|
16
|
+
var _ref2;
|
|
16
17
|
let {
|
|
17
18
|
icon: userIcon,
|
|
18
19
|
intlKey: passedIntlKey,
|
|
@@ -55,18 +56,18 @@ const NoResultsMessage = _ref => {
|
|
|
55
56
|
} else if (isError) {
|
|
56
57
|
// Request failure
|
|
57
58
|
icon = 'exclamation-circle';
|
|
58
|
-
label = error
|
|
59
|
+
label = error === null || error === void 0 ? void 0 : error.message;
|
|
59
60
|
}
|
|
60
61
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
61
62
|
className: _NoResultsMessage.default.noResultsMessage,
|
|
62
63
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
63
64
|
className: _NoResultsMessage.default.noResultsMessageLabelWrap,
|
|
64
65
|
children: [(icon || userIcon) && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Icon, {
|
|
65
|
-
icon: userIcon
|
|
66
|
+
icon: userIcon !== null && userIcon !== void 0 ? userIcon : icon,
|
|
66
67
|
iconRootClass: _NoResultsMessage.default.noResultsMessageIcon
|
|
67
68
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
68
69
|
className: _NoResultsMessage.default.noResultsMessageLabel,
|
|
69
|
-
children: userLabel
|
|
70
|
+
children: (_ref2 = userLabel !== null && userLabel !== void 0 ? userLabel : labelOverrides.noResultsLabel) !== null && _ref2 !== void 0 ? _ref2 : label
|
|
70
71
|
})]
|
|
71
72
|
}), !filterPaneIsVisible && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
|
|
72
73
|
buttonClass: _NoResultsMessage.default.noResultsMessageButton,
|
|
@@ -74,7 +75,7 @@ const NoResultsMessage = _ref => {
|
|
|
74
75
|
onClick: toggleFilterPane,
|
|
75
76
|
children: kintIntl.formatKintMessage({
|
|
76
77
|
id: 'showFilters',
|
|
77
|
-
overrideValue: labelOverrides
|
|
78
|
+
overrideValue: labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides.showFilters
|
|
78
79
|
})
|
|
79
80
|
})]
|
|
80
81
|
});
|
|
@@ -9,19 +9,27 @@ var _react = require("react");
|
|
|
9
9
|
var _noop = _interopRequireDefault(require("lodash/noop"));
|
|
10
10
|
var _components = require("@folio/stripes/components");
|
|
11
11
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
+
const _excluded = ["onBlur", "onChange", "input", "value"];
|
|
12
13
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
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; }
|
|
13
21
|
const NumberField = props => {
|
|
14
22
|
const {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
23
|
+
onBlur: passedOnBlur = _noop.default,
|
|
24
|
+
onChange: passedOnChange = _noop.default,
|
|
25
|
+
input,
|
|
26
|
+
value
|
|
27
|
+
} = props,
|
|
28
|
+
rest = _objectWithoutProperties(props, _excluded);
|
|
21
29
|
|
|
22
30
|
// Treat TextField ALWAYS as a controlled component, whether or not NumberField itself is controlled
|
|
23
31
|
// This enforces the behaviour whereby 1e2 -> 100 in the typed field automatically
|
|
24
|
-
const [forceControl, setForceControl] = (0, _react.useState)(value
|
|
32
|
+
const [forceControl, setForceControl] = (0, _react.useState)(value !== null && value !== void 0 ? value : input === null || input === void 0 ? void 0 : input.value);
|
|
25
33
|
const inputRef = (0, _react.useRef)();
|
|
26
34
|
const userInputRef = (0, _react.useRef)();
|
|
27
35
|
const [numValue, setNumValue] = (0, _react.useState)('');
|
|
@@ -31,7 +39,7 @@ const NumberField = props => {
|
|
|
31
39
|
|
|
32
40
|
// Allow direct control of field
|
|
33
41
|
(0, _react.useEffect)(() => {
|
|
34
|
-
const valueToUse = value
|
|
42
|
+
const valueToUse = value !== null && value !== void 0 ? value : input.value;
|
|
35
43
|
if (!valueToUse && numValue) {
|
|
36
44
|
// Make sure to empty out if it's cleared. Treating '' as empty instead of undefined
|
|
37
45
|
setNumValue('');
|
|
@@ -45,7 +53,7 @@ const NumberField = props => {
|
|
|
45
53
|
}, [forceControl, numValue, value, input]);
|
|
46
54
|
const handleChange = e => {
|
|
47
55
|
// Actually set the value in the form
|
|
48
|
-
if (input
|
|
56
|
+
if (input !== null && input !== void 0 && input.onChange) {
|
|
49
57
|
input.onChange(e);
|
|
50
58
|
}
|
|
51
59
|
|
|
@@ -70,9 +78,9 @@ const NumberField = props => {
|
|
|
70
78
|
}
|
|
71
79
|
};
|
|
72
80
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
73
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.TextField, {
|
|
74
|
-
ref: userInputRef
|
|
75
|
-
|
|
81
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.TextField, _objectSpread(_objectSpread({
|
|
82
|
+
ref: userInputRef
|
|
83
|
+
}, rest), {}, {
|
|
76
84
|
// Keep an eye on this
|
|
77
85
|
onBlur: event => {
|
|
78
86
|
// Make sure blur propogates to input
|
|
@@ -84,15 +92,15 @@ const NumberField = props => {
|
|
|
84
92
|
onChange: handleUserChange,
|
|
85
93
|
type: "number",
|
|
86
94
|
value: forceControl
|
|
87
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
|
|
88
|
-
ref: inputRef
|
|
89
|
-
|
|
95
|
+
})), /*#__PURE__*/(0, _jsxRuntime.jsx)("input", _objectSpread(_objectSpread({
|
|
96
|
+
ref: inputRef
|
|
97
|
+
}, input), {}, {
|
|
90
98
|
hidden: true,
|
|
91
|
-
id: input
|
|
99
|
+
id: input === null || input === void 0 ? void 0 : input.name,
|
|
92
100
|
onChange: handleChange,
|
|
93
101
|
type: "number",
|
|
94
102
|
value: numValue
|
|
95
|
-
})]
|
|
103
|
+
}))]
|
|
96
104
|
});
|
|
97
105
|
};
|
|
98
106
|
NumberField.propTypes = {
|
|
@@ -33,7 +33,8 @@ const testSubmitValues = expectedValues => {
|
|
|
33
33
|
});
|
|
34
34
|
it('submits with expected values', async () => {
|
|
35
35
|
await (0, _react2.waitFor)(() => {
|
|
36
|
-
|
|
36
|
+
var _onSubmit$mock$calls;
|
|
37
|
+
expect((_onSubmit$mock$calls = onSubmit.mock.calls) === null || _onSubmit$mock$calls === void 0 || (_onSubmit$mock$calls = _onSubmit$mock$calls[0]) === null || _onSubmit$mock$calls === void 0 ? void 0 : _onSubmit$mock$calls[0]).toEqual(expectedValues);
|
|
37
38
|
});
|
|
38
39
|
});
|
|
39
40
|
});
|
|
@@ -75,7 +76,7 @@ const ControlledComponent = () => {
|
|
|
75
76
|
describe.each([['Non-Controlled', /*#__PURE__*/(0, _jsxRuntime.jsx)(NonControlledComponent, {})], ['Controlled', /*#__PURE__*/(0, _jsxRuntime.jsx)(ControlledComponent, {})]])('NumberField', (controlType, component) => {
|
|
76
77
|
let _renderComponent;
|
|
77
78
|
let textField;
|
|
78
|
-
describe(
|
|
79
|
+
describe("Regular usage (".concat(controlType, ")"), () => {
|
|
79
80
|
beforeEach(async () => {
|
|
80
81
|
onSubmit.mockClear();
|
|
81
82
|
_renderComponent = (0, _helpers.renderWithKintHarness)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_stripesErmTesting.TestForm, {
|
|
@@ -95,7 +96,7 @@ describe.each([['Non-Controlled', /*#__PURE__*/(0, _jsxRuntime.jsx)(NonControlle
|
|
|
95
96
|
}], ['negative numbers', '-100', '-100', {
|
|
96
97
|
[NUMBER_FIELD_INPUT_ID]: '-100'
|
|
97
98
|
}]])('Typing', (characterType, typedChars, expectedDisplay, expectedSubmit) => {
|
|
98
|
-
describe(
|
|
99
|
+
describe("typing ".concat(characterType), () => {
|
|
99
100
|
beforeEach(async () => {
|
|
100
101
|
await (0, _react2.waitFor)(async () => {
|
|
101
102
|
await _userEvent.default.type(textField, typedChars);
|
|
@@ -120,7 +121,7 @@ describe.each([['Non-Controlled', /*#__PURE__*/(0, _jsxRuntime.jsx)(NonControlle
|
|
|
120
121
|
[NUMBER_FIELD_INPUT_ID]: '-100'
|
|
121
122
|
}, '-100', {
|
|
122
123
|
[NUMBER_FIELD_INPUT_ID]: '-100'
|
|
123
|
-
}]])(
|
|
124
|
+
}]])("Initial values (".concat(controlType, ")"), (describeTitle, initialValues, displayValue, expectedSubmit) => {
|
|
124
125
|
describe(describeTitle, () => {
|
|
125
126
|
beforeEach(async () => {
|
|
126
127
|
onSubmit.mockClear();
|
|
@@ -158,7 +159,7 @@ describe.each([['Non-Controlled', /*#__PURE__*/(0, _jsxRuntime.jsx)(NonControlle
|
|
|
158
159
|
children: component
|
|
159
160
|
}));
|
|
160
161
|
textField = getTextField();
|
|
161
|
-
}]])(
|
|
162
|
+
}]])("ERM-3391: state change underneath component (".concat(controlType, ")"), (clearType, beforeEachFunc) => {
|
|
162
163
|
describe(clearType, () => {
|
|
163
164
|
beforeEach(beforeEachFunc);
|
|
164
165
|
it('renders text field', () => {
|
|
@@ -179,7 +180,7 @@ describe.each([['Non-Controlled', /*#__PURE__*/(0, _jsxRuntime.jsx)(NonControlle
|
|
|
179
180
|
});
|
|
180
181
|
}
|
|
181
182
|
});
|
|
182
|
-
it(
|
|
183
|
+
it("renders text field with display value: ".concat(expectedValue), async () => {
|
|
183
184
|
await (0, _react2.waitFor)(() => {
|
|
184
185
|
expect(textField).toHaveDisplayValue(expectedValue);
|
|
185
186
|
});
|
|
@@ -9,15 +9,23 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
9
9
|
var _Typedown = _interopRequireDefault(require("../Typedown"));
|
|
10
10
|
var _typedownHooks = require("../hooks/typedownHooks");
|
|
11
11
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
+
const _excluded = ["dataFormatter", "path", "pathMutator"];
|
|
12
13
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
14
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
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; }
|
|
14
22
|
const QueryTypedown = _ref => {
|
|
15
23
|
let {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
24
|
+
dataFormatter = d => d,
|
|
25
|
+
path,
|
|
26
|
+
pathMutator
|
|
27
|
+
} = _ref,
|
|
28
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
21
29
|
const [callPath, setCallPath] = (0, _react.useState)(pathMutator(null, path));
|
|
22
30
|
const data = dataFormatter((0, _typedownHooks.useTypedownData)(path, callPath));
|
|
23
31
|
const [userQuery, setUserQuery] = (0, _react.useState)('');
|
|
@@ -27,11 +35,10 @@ const QueryTypedown = _ref => {
|
|
|
27
35
|
(0, _react.useEffect)(() => {
|
|
28
36
|
setCallPath(pathMutator(userQuery, path));
|
|
29
37
|
}, [path, pathMutator, userQuery]);
|
|
30
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typedown.default, {
|
|
31
|
-
...rest,
|
|
38
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typedown.default, _objectSpread(_objectSpread({}, rest), {}, {
|
|
32
39
|
dataOptions: data,
|
|
33
40
|
onType: onType
|
|
34
|
-
});
|
|
41
|
+
}));
|
|
35
42
|
};
|
|
36
43
|
QueryTypedown.propTypes = {
|
|
37
44
|
dataFormatter: _propTypes.default.func,
|
|
@@ -10,6 +10,11 @@ var _reactIntl = require("react-intl");
|
|
|
10
10
|
var _components = require("@folio/stripes/components");
|
|
11
11
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
12
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
+
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; }
|
|
14
|
+
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; }
|
|
15
|
+
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; }
|
|
16
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
17
|
+
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); }
|
|
13
18
|
const RefdataButtons = props => {
|
|
14
19
|
// Render the right number of buttons:
|
|
15
20
|
const {
|
|
@@ -32,7 +37,7 @@ const RefdataButtons = props => {
|
|
|
32
37
|
'checked': input.value === option.value,
|
|
33
38
|
'fullWidth': true,
|
|
34
39
|
'label': labelTranslations ? intl.formatMessage({
|
|
35
|
-
id:
|
|
40
|
+
id: "".concat(labelTranslations.key, ".").concat(option.value),
|
|
36
41
|
defaultMessage: option.label
|
|
37
42
|
}) : option.label,
|
|
38
43
|
'marginBottom0': true,
|
|
@@ -41,10 +46,8 @@ const RefdataButtons = props => {
|
|
|
41
46
|
};
|
|
42
47
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Col, {
|
|
43
48
|
xs: dynamicColumnWidth ? 12 / numberOfButtons : 12 / maximumColumns,
|
|
44
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.RadioButton, {
|
|
45
|
-
|
|
46
|
-
})
|
|
47
|
-
}, `${input.name}:${option.id}`);
|
|
49
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.RadioButton, _objectSpread({}, buttonProps))
|
|
50
|
+
}, "".concat(input.name, ":").concat(option.id));
|
|
48
51
|
});
|
|
49
52
|
};
|
|
50
53
|
const returnRows = dataOptions => {
|
|
@@ -71,7 +74,7 @@ const RefdataButtons = props => {
|
|
|
71
74
|
return chunkedDataOptions.map((cdo, index) => {
|
|
72
75
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Row, {
|
|
73
76
|
children: buttonRender(cdo, false)
|
|
74
|
-
},
|
|
77
|
+
}, "".concat(props.input.name, ":row").concat(index));
|
|
75
78
|
});
|
|
76
79
|
};
|
|
77
80
|
return returnRows(props.dataOptions);
|