@k-int/stripes-kint-components 5.6.1 → 5.7.1
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 +14 -0
- package/es/index.js +1 -1
- package/es/lib/ActionList/ActionList.js +1 -1
- package/es/lib/ActionList/ActionListFieldArray.js +33 -38
- package/es/lib/ActionList/index.js +1 -1
- package/es/lib/ComboButton/ComboButton.js +6 -7
- package/es/lib/ComboButton/index.js +1 -1
- package/es/lib/CustomProperties/Config/CustomPropertiesLookup.js +5 -8
- package/es/lib/CustomProperties/Config/CustomPropertiesLookup.test.js +1 -1
- package/es/lib/CustomProperties/Config/CustomPropertiesSettings.js +30 -33
- package/es/lib/CustomProperties/Config/CustomPropertiesSettings.test.js +1 -1
- package/es/lib/CustomProperties/Config/CustomPropertyForm.js +59 -59
- package/es/lib/CustomProperties/Config/CustomPropertyForm.test.js +3 -3
- package/es/lib/CustomProperties/Config/CustomPropertyView.js +33 -34
- package/es/lib/CustomProperties/Config/CustomPropertyView.test.js +2 -2
- package/es/lib/CustomProperties/Config/index.js +1 -1
- package/es/lib/CustomProperties/Edit/CustomPropertiesEdit.js +2 -2
- package/es/lib/CustomProperties/Edit/CustomPropertiesEdit.test.js +1 -1
- package/es/lib/CustomProperties/Edit/CustomPropertiesEditCtx.js +4 -4
- package/es/lib/CustomProperties/Edit/CustomPropertiesEditCtx.test.js +1 -1
- package/es/lib/CustomProperties/Edit/CustomPropertiesListField.js +6 -11
- package/es/lib/CustomProperties/Edit/CustomPropertiesListField.test.js +1 -1
- package/es/lib/CustomProperties/Edit/CustomPropertyField.js +19 -26
- package/es/lib/CustomProperties/Edit/CustomPropertyField.test.js +6 -6
- package/es/lib/CustomProperties/Edit/CustomPropertyFormCard.js +3 -3
- package/es/lib/CustomProperties/Edit/CustomPropertyFormCard.test.js +2 -2
- package/es/lib/CustomProperties/Edit/index.js +1 -1
- package/es/lib/CustomProperties/Edit/testResources.js +11 -12
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilter.js +7 -12
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilter.test.js +1 -1
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilterField.js +21 -29
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilterField.test.js +2 -2
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilterFieldArray.js +7 -7
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilterFieldArray.test.js +1 -1
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilterForm.js +1 -1
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilterForm.test.js +1 -1
- package/es/lib/CustomProperties/Filter/CustomPropertiesRule.js +9 -9
- package/es/lib/CustomProperties/Filter/CustomPropertiesRule.test.js +1 -1
- package/es/lib/CustomProperties/Filter/index.js +1 -1
- package/es/lib/CustomProperties/Filter/testResources.js +1 -2
- package/es/lib/CustomProperties/Filter/useParseActiveFilterStrings.js +2 -3
- package/es/lib/CustomProperties/View/CustomPropertiesView.js +2 -2
- package/es/lib/CustomProperties/View/CustomPropertiesView.test.js +1 -1
- package/es/lib/CustomProperties/View/CustomPropertiesViewCtx.js +19 -27
- package/es/lib/CustomProperties/View/CustomPropertiesViewCtx.test.js +1 -1
- package/es/lib/CustomProperties/View/CustomPropertyCard.js +8 -12
- package/es/lib/CustomProperties/View/index.js +1 -1
- package/es/lib/CycleButton/CycleButton.js +2 -2
- package/es/lib/CycleButton/index.js +1 -1
- package/es/lib/EditableRefdataCategoryList/EditableRefdataCategoryList.js +27 -39
- package/es/lib/EditableRefdataCategoryList/index.js +1 -1
- package/es/lib/EditableRefdataList/EditableRefdataList.js +27 -34
- package/es/lib/EditableRefdataList/index.js +1 -1
- package/es/lib/EditableSettingsList/EditableSettingsList.js +1 -1
- package/es/lib/EditableSettingsList/EditableSettingsListFieldArray.js +2 -2
- package/es/lib/EditableSettingsList/EditableSettingsListFieldArray.test.js +1 -1
- package/es/lib/EditableSettingsList/SettingField/EditSettingValue.js +6 -6
- package/es/lib/EditableSettingsList/SettingField/EditSettingValue.test.js +1 -1
- package/es/lib/EditableSettingsList/SettingField/RenderSettingValue.js +11 -13
- package/es/lib/EditableSettingsList/SettingField/RenderSettingValue.test.js +1 -1
- package/es/lib/EditableSettingsList/SettingField/SettingField.js +5 -5
- package/es/lib/EditableSettingsList/SettingField/SettingField.test.js +1 -1
- package/es/lib/EditableSettingsList/SettingField/index.js +1 -1
- package/es/lib/EditableSettingsList/index.js +1 -1
- package/es/lib/FormModal/FormModal.js +1 -1
- package/es/lib/FormModal/index.js +1 -1
- package/es/lib/FormattedKintMessage/FormattedKintMessage.js +5 -8
- package/es/lib/FormattedKintMessage/index.js +1 -1
- package/es/lib/IconSelect/IconSelect.js +6 -10
- package/es/lib/IconSelect/index.js +1 -1
- package/es/lib/NoResultsMessage/NoResultsMessage.js +5 -5
- package/es/lib/NoResultsMessage/index.js +1 -1
- package/es/lib/QueryTypedown/QueryTypedown.js +1 -1
- package/es/lib/QueryTypedown/index.js +1 -1
- package/es/lib/RefdataButtons/RefdataButtons.js +4 -4
- package/es/lib/RefdataButtons/index.js +1 -1
- package/es/lib/RefdataCategoriesSettings/RefdataCategoriesSettings.js +14 -18
- package/es/lib/RefdataCategoriesSettings/index.js +1 -1
- package/es/lib/ResponsiveButtonGroup/ResponsiveButtonGroup.js +22 -29
- package/es/lib/ResponsiveButtonGroup/index.js +1 -1
- package/es/lib/ResponsiveButtonGroup/useResponsiveButtonGroupSizing.js +6 -7
- package/es/lib/RichSelect/RichSelect.js +15 -20
- package/es/lib/RichSelect/index.js +1 -1
- package/es/lib/RichSelect/useSelectedOption.js +1 -2
- package/es/lib/SASQLookupComponent/SASQLookupComponent.js +15 -18
- package/es/lib/SASQLookupComponent/TableBody/TableBody.js +8 -10
- package/es/lib/SASQLookupComponent/TableBody/index.js +1 -1
- package/es/lib/SASQLookupComponent/index.js +1 -1
- package/es/lib/SASQRoute/SASQRoute.js +3 -3
- package/es/lib/SASQRoute/index.js +1 -1
- package/es/lib/SASQViewComponent/SASQViewComponent.js +6 -10
- package/es/lib/SASQViewComponent/index.js +1 -1
- package/es/lib/SearchField/SearchField.js +1 -1
- package/es/lib/SearchField/index.js +1 -1
- package/es/lib/SettingPage/SettingPage.js +1 -1
- package/es/lib/SettingPage/SettingPagePane.js +3 -3
- package/es/lib/SettingPage/index.js +1 -1
- package/es/lib/SettingsFormContainer/SettingsFormContainer.js +3 -3
- package/es/lib/SettingsFormContainer/index.js +1 -1
- package/es/lib/Typedown/Typedown.js +35 -33
- package/es/lib/Typedown/index.js +1 -1
- package/es/lib/contexts/index.js +1 -1
- package/es/lib/hooks/__mocks__/index.js +1 -1
- package/es/lib/hooks/index.js +1 -1
- package/es/lib/hooks/typedownHooks/index.js +1 -1
- package/es/lib/hooks/typedownHooks/useTypedown.js +3 -3
- package/es/lib/hooks/typedownHooks/useTypedownToggle.js +3 -3
- package/es/lib/hooks/useActionListRef.js +1 -1
- package/es/lib/hooks/useActiveElement.js +1 -1
- package/es/lib/hooks/useCustomProperties.js +3 -3
- package/es/lib/hooks/useHelperApp.js +7 -7
- package/es/lib/hooks/useIntlKey.js +1 -1
- package/es/lib/hooks/useIntlKeyStore.js +4 -7
- package/es/lib/hooks/useKintIntl.js +6 -12
- package/es/lib/hooks/useKiwtSASQuery.js +2 -2
- package/es/lib/hooks/useModConfigEntries.js +3 -3
- package/es/lib/hooks/useMutateCustomProperties.js +8 -8
- package/es/lib/hooks/useMutateModConfigEntry.js +2 -2
- package/es/lib/hooks/useMutateRefdataCategory.js +5 -5
- package/es/lib/hooks/useMutateRefdataValue.js +7 -7
- package/es/lib/hooks/useQIndex.js +6 -6
- package/es/lib/hooks/useRefdata.js +4 -4
- package/es/lib/hooks/useTemplates.js +5 -5
- package/es/lib/settingsHooks/index.js +1 -1
- package/es/lib/settingsHooks/useAppSettings.js +7 -11
- package/es/lib/settingsHooks/useSettingSection.js +2 -2
- package/es/lib/settingsHooks/useSettings.js +4 -4
- package/es/lib/utils/buildUrl.js +3 -4
- package/es/lib/utils/filterParsers/deparseKiwtQueryFilters.js +5 -5
- package/es/lib/utils/filterParsers/index.js +1 -1
- package/es/lib/utils/filterParsers/parseKiwtQueryFilters.js +3 -3
- package/es/lib/utils/filterParsers/parseKiwtQueryGroups.js +4 -5
- package/es/lib/utils/filterParsers/parseKiwtQueryGroups.test.js +1 -1
- package/es/lib/utils/filterParsers/parseKiwtQueryString.js +2 -2
- package/es/lib/utils/generateKiwtQuery.js +1 -1
- package/es/lib/utils/generateKiwtQueryParams.js +28 -37
- package/es/lib/utils/groupCustomPropertiesByCtx.js +2 -3
- package/es/lib/utils/highlightString.js +1 -1
- package/es/lib/utils/index.js +1 -1
- package/es/lib/utils/matchString.js +6 -8
- package/es/lib/utils/parseErrorResponse.js +2 -3
- package/es/lib/utils/selectorSafe.js +2 -3
- package/es/lib/utils/sortByLabel.js +2 -3
- package/es/lib/validators/validators.js +4 -4
- package/package.json +2 -4
- package/src/lib/SASQLookupComponent/TableBody/TableBody.js +1 -1
- package/src/lib/Typedown/Typedown.js +12 -5
- package/styles/TypeDown.css +6 -1
|
@@ -9,7 +9,7 @@ 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
|
-
function _interopRequireDefault(
|
|
12
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
13
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
14
14
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
15
15
|
const QueryTypedown = _ref => {
|
|
@@ -10,4 +10,4 @@ Object.defineProperty(exports, "default", {
|
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
12
|
var _QueryTypedown = _interopRequireDefault(require("./QueryTypedown"));
|
|
13
|
-
function _interopRequireDefault(
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -9,7 +9,7 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
9
9
|
var _reactIntl = require("react-intl");
|
|
10
10
|
var _components = require("@folio/stripes/components");
|
|
11
11
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
-
function _interopRequireDefault(
|
|
12
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
13
|
const RefdataButtons = props => {
|
|
14
14
|
// Render the right number of buttons:
|
|
15
15
|
const {
|
|
@@ -32,7 +32,7 @@ const RefdataButtons = props => {
|
|
|
32
32
|
'checked': input.value === option.value,
|
|
33
33
|
'fullWidth': true,
|
|
34
34
|
'label': labelTranslations ? intl.formatMessage({
|
|
35
|
-
id:
|
|
35
|
+
id: `${labelTranslations.key}.${option.value}`,
|
|
36
36
|
defaultMessage: option.label
|
|
37
37
|
}) : option.label,
|
|
38
38
|
'marginBottom0': true,
|
|
@@ -44,7 +44,7 @@ const RefdataButtons = props => {
|
|
|
44
44
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.RadioButton, {
|
|
45
45
|
...buttonProps
|
|
46
46
|
})
|
|
47
|
-
},
|
|
47
|
+
}, `${input.name}:${option.id}`);
|
|
48
48
|
});
|
|
49
49
|
};
|
|
50
50
|
const returnRows = dataOptions => {
|
|
@@ -71,7 +71,7 @@ const RefdataButtons = props => {
|
|
|
71
71
|
return chunkedDataOptions.map((cdo, index) => {
|
|
72
72
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Row, {
|
|
73
73
|
children: buttonRender(cdo, false)
|
|
74
|
-
},
|
|
74
|
+
}, `${props.input.name}:row${index}`);
|
|
75
75
|
});
|
|
76
76
|
};
|
|
77
77
|
return returnRows(props.dataOptions);
|
|
@@ -10,4 +10,4 @@ Object.defineProperty(exports, "default", {
|
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
12
|
var _RefdataButtons = _interopRequireDefault(require("./RefdataButtons"));
|
|
13
|
-
function _interopRequireDefault(
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -12,7 +12,7 @@ var _EditableRefdataCategoryList = _interopRequireDefault(require("../EditableRe
|
|
|
12
12
|
var _EditableRefdataList = _interopRequireDefault(require("../EditableRefdataList"));
|
|
13
13
|
var _FormattedKintMessage = _interopRequireDefault(require("../FormattedKintMessage"));
|
|
14
14
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
|
-
function _interopRequireDefault(
|
|
15
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
16
|
const propTypes = {
|
|
17
17
|
afterQueryCalls: _propTypes.default.object,
|
|
18
18
|
catchQueryCalls: _propTypes.default.object,
|
|
@@ -29,7 +29,6 @@ const propTypes = {
|
|
|
29
29
|
refdataEndpoint: _propTypes.default.string
|
|
30
30
|
};
|
|
31
31
|
const RefdataCategoriesSettings = _ref => {
|
|
32
|
-
var _refdataCategory$valu;
|
|
33
32
|
let {
|
|
34
33
|
/*
|
|
35
34
|
* Set of extra booleans for controlling access to actions
|
|
@@ -59,7 +58,7 @@ const RefdataCategoriesSettings = _ref => {
|
|
|
59
58
|
};
|
|
60
59
|
const pickListValuesLabel = kintIntl.formatKintMessage({
|
|
61
60
|
id: 'settings.pickListValues',
|
|
62
|
-
overrideValue: labelOverrides
|
|
61
|
+
overrideValue: labelOverrides?.pickListValues
|
|
63
62
|
});
|
|
64
63
|
const renderViewPaneHeader = renderProps => /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.PaneHeader, {
|
|
65
64
|
...renderProps,
|
|
@@ -67,10 +66,10 @@ const RefdataCategoriesSettings = _ref => {
|
|
|
67
66
|
onClose: () => setRefdataCategory(),
|
|
68
67
|
paneTitle: kintIntl.formatKintMessage({
|
|
69
68
|
id: 'refdataCategories.config.viewPaneTitle',
|
|
70
|
-
overrideValue: labelOverrides
|
|
71
|
-
fallbackMessage: refdataCategory
|
|
69
|
+
overrideValue: labelOverrides?.viewPaneTitle,
|
|
70
|
+
fallbackMessage: refdataCategory?.desc
|
|
72
71
|
}, {
|
|
73
|
-
name: refdataCategory
|
|
72
|
+
name: refdataCategory?.desc
|
|
74
73
|
})
|
|
75
74
|
});
|
|
76
75
|
const renderLookupPaneHeader = renderProps => /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.PaneHeader, {
|
|
@@ -78,12 +77,9 @@ const RefdataCategoriesSettings = _ref => {
|
|
|
78
77
|
dismissible: true,
|
|
79
78
|
lastMenu: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.PaneMenu, {
|
|
80
79
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
|
|
81
|
-
disabled: !!
|
|
80
|
+
disabled: !!refState?.editing,
|
|
82
81
|
marginBottom0: true,
|
|
83
|
-
onClick: () =>
|
|
84
|
-
var _rdclRef$current;
|
|
85
|
-
return rdclRef === null || rdclRef === void 0 || (_rdclRef$current = rdclRef.current) === null || _rdclRef$current === void 0 ? void 0 : _rdclRef$current.create();
|
|
86
|
-
},
|
|
82
|
+
onClick: () => rdclRef?.current?.create(),
|
|
87
83
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_FormattedKintMessage.default, {
|
|
88
84
|
id: "new"
|
|
89
85
|
})
|
|
@@ -92,7 +88,7 @@ const RefdataCategoriesSettings = _ref => {
|
|
|
92
88
|
onClose: onClose,
|
|
93
89
|
paneTitle: kintIntl.formatKintMessage({
|
|
94
90
|
id: 'settings.pickLists',
|
|
95
|
-
overrideValue: labelOverrides
|
|
91
|
+
overrideValue: labelOverrides?.pickLists
|
|
96
92
|
})
|
|
97
93
|
});
|
|
98
94
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
@@ -111,13 +107,13 @@ const RefdataCategoriesSettings = _ref => {
|
|
|
111
107
|
handleRefdataCategoryClick: handleRefdataCategoryClick,
|
|
112
108
|
hideCreateButton: true,
|
|
113
109
|
onConfirmDelete: id => {
|
|
114
|
-
if (
|
|
110
|
+
if (refdataCategory?.id === id) {
|
|
115
111
|
setRefdataCategory();
|
|
116
112
|
}
|
|
117
113
|
},
|
|
118
114
|
refdataEndpoint: refdataEndpoint
|
|
119
115
|
})
|
|
120
|
-
}),
|
|
116
|
+
}), refdataCategory?.desc && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.Pane, {
|
|
121
117
|
defaultWidth: "fill",
|
|
122
118
|
id: "settings-refdataCategories-viewPane",
|
|
123
119
|
renderHeader: renderViewPaneHeader,
|
|
@@ -127,7 +123,7 @@ const RefdataCategoriesSettings = _ref => {
|
|
|
127
123
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.KeyValue, {
|
|
128
124
|
label: kintIntl.formatKintMessage({
|
|
129
125
|
id: 'refdataCategory.refdataCategory',
|
|
130
|
-
overrideValue: labelOverrides
|
|
126
|
+
overrideValue: labelOverrides?.refdataCategory
|
|
131
127
|
}),
|
|
132
128
|
value: refdataCategory.desc
|
|
133
129
|
})
|
|
@@ -136,9 +132,9 @@ const RefdataCategoriesSettings = _ref => {
|
|
|
136
132
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.KeyValue, {
|
|
137
133
|
label: kintIntl.formatKintMessage({
|
|
138
134
|
id: 'refdataCategory.noOfValues',
|
|
139
|
-
overrideValue: labelOverrides
|
|
135
|
+
overrideValue: labelOverrides?.noOfValues
|
|
140
136
|
}),
|
|
141
|
-
value: refdataCategory
|
|
137
|
+
value: refdataCategory?.values?.length
|
|
142
138
|
})
|
|
143
139
|
})]
|
|
144
140
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_EditableRefdataList.default, {
|
|
@@ -146,7 +142,7 @@ const RefdataCategoriesSettings = _ref => {
|
|
|
146
142
|
put: json => setRefdataCategory(json),
|
|
147
143
|
delete: json => setRefdataCategory(json)
|
|
148
144
|
},
|
|
149
|
-
desc: refdataCategory
|
|
145
|
+
desc: refdataCategory?.desc,
|
|
150
146
|
displayConditions: displayConditions,
|
|
151
147
|
label: pickListValuesLabel,
|
|
152
148
|
refdataEndpoint: refdataEndpoint
|
|
@@ -10,4 +10,4 @@ Object.defineProperty(exports, "default", {
|
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
12
|
var _RefdataCategoriesSettings = _interopRequireDefault(require("./RefdataCategoriesSettings"));
|
|
13
|
-
function _interopRequireDefault(
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -11,7 +11,7 @@ var _components = require("@folio/stripes/components");
|
|
|
11
11
|
var _ResponsiveButtonGroup = _interopRequireDefault(require("../../../styles/ResponsiveButtonGroup.css"));
|
|
12
12
|
var _useResponsiveButtonGroupSizing = _interopRequireDefault(require("./useResponsiveButtonGroupSizing"));
|
|
13
13
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
|
-
function _interopRequireDefault(
|
|
14
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
15
|
const propTypes = {
|
|
16
16
|
children: _propTypes.default.node,
|
|
17
17
|
className: _propTypes.default.string,
|
|
@@ -28,12 +28,12 @@ const calculateCumulativeThreshold = function (arrayOfNumbers, maximum) {
|
|
|
28
28
|
let value = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
|
|
29
29
|
// If all the numbers fit, return the last index
|
|
30
30
|
if (arrayOfNumbers.reduce((partialSum, a) => partialSum + a, 0) <= maximum) {
|
|
31
|
-
return
|
|
31
|
+
return arrayOfNumbers?.length - 1;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
// Else we'll need a down arrow button, so include that in calculations
|
|
35
35
|
const nextValue = value + arrayOfNumbers[index];
|
|
36
|
-
if (nextValue + SIZE_OF_DOWN_ARROW_BUTTON <= maximum && index + 1 <
|
|
36
|
+
if (nextValue + SIZE_OF_DOWN_ARROW_BUTTON <= maximum && index + 1 < arrayOfNumbers?.length) {
|
|
37
37
|
return calculateCumulativeThreshold(arrayOfNumbers, maximum, index + 1, nextValue);
|
|
38
38
|
}
|
|
39
39
|
return index - 1;
|
|
@@ -65,7 +65,6 @@ const ResponsiveButtonGroup = props => {
|
|
|
65
65
|
});
|
|
66
66
|
const buttonThreshold = calculateCumulativeThreshold(cachedSizeArray, containerWidth);
|
|
67
67
|
const renderActionMenuToggle = (0, _react.useCallback)(_ref => {
|
|
68
|
-
var _displayButtons$lengt;
|
|
69
68
|
let {
|
|
70
69
|
displayButtons,
|
|
71
70
|
onToggle,
|
|
@@ -79,11 +78,11 @@ const ResponsiveButtonGroup = props => {
|
|
|
79
78
|
ref: triggerRef,
|
|
80
79
|
"aria-label": "menu",
|
|
81
80
|
buttonClass: (0, _classnames.default)(_ResponsiveButtonGroup.default.width100, {
|
|
82
|
-
[
|
|
81
|
+
[`${_ResponsiveButtonGroup.default.dropdownButtonClass}`]: (displayButtons?.length ?? 0) > 0
|
|
83
82
|
}, {
|
|
84
|
-
[
|
|
83
|
+
[`${_ResponsiveButtonGroup.default.marginBottom}`]: !marginBottom0
|
|
85
84
|
}, {
|
|
86
|
-
[
|
|
85
|
+
[`${_ResponsiveButtonGroup.default.marginBottom0}`]: marginBottom0
|
|
87
86
|
}),
|
|
88
87
|
buttonStyle: selectedIndex > buttonThreshold ? 'primary' : 'default',
|
|
89
88
|
onClick: onToggle,
|
|
@@ -98,25 +97,19 @@ const ResponsiveButtonGroup = props => {
|
|
|
98
97
|
})
|
|
99
98
|
});
|
|
100
99
|
}, [buttonThreshold, dropdownTriggerProps, marginBottom0, selectedIndex]);
|
|
101
|
-
const displayButtons = (0, _react.useMemo)(() => {
|
|
102
|
-
|
|
103
|
-
return buttons === null || buttons === void 0 || (_buttons$slice = buttons.slice(0, buttonThreshold + 1)) === null || _buttons$slice === void 0 ? void 0 : _buttons$slice.map((button, index) => {
|
|
104
|
-
if (index === selectedIndex && !(button !== null && button !== void 0 && button.buttonStyle)) {
|
|
105
|
-
return /*#__PURE__*/(0, _react.cloneElement)(button, {
|
|
106
|
-
buttonStyle: 'primary'
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
return button;
|
|
110
|
-
});
|
|
111
|
-
}, [buttonThreshold, buttons, selectedIndex]);
|
|
112
|
-
const dropdownButtons = (0, _react.useMemo)(() => {
|
|
113
|
-
var _buttons$slice2;
|
|
114
|
-
return [...((_buttons$slice2 = buttons.slice(buttonThreshold + 1, buttons === null || buttons === void 0 ? void 0 : buttons.length)) === null || _buttons$slice2 === void 0 ? void 0 : _buttons$slice2.map(button => {
|
|
100
|
+
const displayButtons = (0, _react.useMemo)(() => buttons?.slice(0, buttonThreshold + 1)?.map((button, index) => {
|
|
101
|
+
if (index === selectedIndex && !button?.buttonStyle) {
|
|
115
102
|
return /*#__PURE__*/(0, _react.cloneElement)(button, {
|
|
116
|
-
buttonStyle: '
|
|
103
|
+
buttonStyle: 'primary'
|
|
117
104
|
});
|
|
118
|
-
}
|
|
119
|
-
|
|
105
|
+
}
|
|
106
|
+
return button;
|
|
107
|
+
}), [buttonThreshold, buttons, selectedIndex]);
|
|
108
|
+
const dropdownButtons = (0, _react.useMemo)(() => [...buttons.slice(buttonThreshold + 1, buttons?.length)?.map(button => {
|
|
109
|
+
return /*#__PURE__*/(0, _react.cloneElement)(button, {
|
|
110
|
+
buttonStyle: 'dropdownItem'
|
|
111
|
+
});
|
|
112
|
+
})], [buttonThreshold, buttons]);
|
|
120
113
|
|
|
121
114
|
// eslint-disable-next-line react/prop-types
|
|
122
115
|
const renderActionMenuContent = (0, _react.useCallback)(() => /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.DropdownMenu, {
|
|
@@ -136,16 +129,16 @@ const ResponsiveButtonGroup = props => {
|
|
|
136
129
|
className: "width: 100%;"
|
|
137
130
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(Tag, {
|
|
138
131
|
className: (0, _classnames.default)({
|
|
139
|
-
[
|
|
132
|
+
[`${_ResponsiveButtonGroup.default.hidden}`]: !ready
|
|
140
133
|
}, _ResponsiveButtonGroup.default.buttonGroup, {
|
|
141
|
-
[
|
|
134
|
+
[`${_ResponsiveButtonGroup.default.fullWidth}`]: ready && fullWidth
|
|
142
135
|
}, className),
|
|
143
136
|
style: fullWidth ? {
|
|
144
|
-
width:
|
|
137
|
+
width: `${containerWidth}px`
|
|
145
138
|
} : {},
|
|
146
139
|
...rest,
|
|
147
|
-
children: !ready || buttonThreshold ===
|
|
148
|
-
if (index === selectedIndex && !
|
|
140
|
+
children: !ready || buttonThreshold === cachedSizeArray?.length - 1 ? buttons?.map((button, index) => {
|
|
141
|
+
if (index === selectedIndex && !button?.buttonStyle) {
|
|
149
142
|
return /*#__PURE__*/(0, _react.cloneElement)(button, {
|
|
150
143
|
buttonStyle: 'primary'
|
|
151
144
|
});
|
|
@@ -10,4 +10,4 @@ Object.defineProperty(exports, "default", {
|
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
12
|
var _ResponsiveButtonGroup = _interopRequireDefault(require("./ResponsiveButtonGroup"));
|
|
13
|
-
function _interopRequireDefault(
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -8,13 +8,13 @@ var _react = require("react");
|
|
|
8
8
|
var _isEqual = _interopRequireDefault(require("lodash/isEqual"));
|
|
9
9
|
var _reactResizeDetector = require("react-resize-detector");
|
|
10
10
|
var _lodash = require("lodash");
|
|
11
|
-
function _interopRequireDefault(
|
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
12
|
const useResponsiveButtonGroupSizing = _ref => {
|
|
13
13
|
let {
|
|
14
14
|
id,
|
|
15
15
|
buttons = []
|
|
16
16
|
} = _ref;
|
|
17
|
-
const eventString = 'responsive-button-group-loaded' + (id ?
|
|
17
|
+
const eventString = 'responsive-button-group-loaded' + (id ? `-${id}` : '');
|
|
18
18
|
const loadedEvent = new Event(eventString);
|
|
19
19
|
const isMounted = (0, _react.useRef)(false);
|
|
20
20
|
(0, _react.useEffect)(() => {
|
|
@@ -37,8 +37,7 @@ const useResponsiveButtonGroupSizing = _ref => {
|
|
|
37
37
|
const refArray = buttons.map((_button, index) => {
|
|
38
38
|
return node => {
|
|
39
39
|
if (node !== null) {
|
|
40
|
-
|
|
41
|
-
const newSizeArray = sizeArray.slice(0, index).concat([(_node$clientWidth = node === null || node === void 0 ? void 0 : node.clientWidth) !== null && _node$clientWidth !== void 0 ? _node$clientWidth : 0]).concat(sizeArray.slice(index + 1));
|
|
40
|
+
const newSizeArray = sizeArray.slice(0, index).concat([node?.clientWidth ?? 0]).concat(sizeArray.slice(index + 1));
|
|
42
41
|
if (!(0, _isEqual.default)(sizeArray, newSizeArray)) {
|
|
43
42
|
setSizeArray(newSizeArray);
|
|
44
43
|
}
|
|
@@ -50,16 +49,16 @@ const useResponsiveButtonGroupSizing = _ref => {
|
|
|
50
49
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
51
50
|
(0, _react.useEffect)((0, _lodash.debounce)(() => {
|
|
52
51
|
if (isMounted.current) {
|
|
53
|
-
if (!
|
|
52
|
+
if (!cachedSizeArray?.length && sizeArray?.length) {
|
|
54
53
|
setCachedSizeArray(sizeArray);
|
|
55
54
|
setReady(true);
|
|
56
55
|
document.dispatchEvent(loadedEvent);
|
|
57
56
|
}
|
|
58
57
|
}
|
|
59
58
|
}, 150), [cachedSizeArray, sizeArray]);
|
|
60
|
-
const returnButtons = buttons
|
|
59
|
+
const returnButtons = buttons?.map((button, index) => {
|
|
61
60
|
return /*#__PURE__*/(0, _react.cloneElement)(button, {
|
|
62
|
-
ref: refArray
|
|
61
|
+
ref: refArray?.[index]
|
|
63
62
|
});
|
|
64
63
|
});
|
|
65
64
|
return {
|
|
@@ -10,9 +10,8 @@ var _components = require("@folio/stripes/components");
|
|
|
10
10
|
var _RichSelect = _interopRequireDefault(require("../../../styles/RichSelect.css"));
|
|
11
11
|
var _FormattedKintMessage = _interopRequireDefault(require("../FormattedKintMessage"));
|
|
12
12
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
|
-
function _interopRequireDefault(
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
14
|
const RichSelect = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
15
|
-
var _ref2, _meta$initial, _findSelectedOptionBy, _meta$initial2;
|
|
16
15
|
let {
|
|
17
16
|
ariaLabel,
|
|
18
17
|
disabled = false,
|
|
@@ -33,17 +32,17 @@ const RichSelect = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
33
32
|
value
|
|
34
33
|
} = _ref;
|
|
35
34
|
const hiddenInput = (0, _react.useRef)(null);
|
|
36
|
-
const [internalValue, setInternalValue] = (0, _react.useState)(
|
|
35
|
+
const [internalValue, setInternalValue] = (0, _react.useState)(meta?.initial ?? value ?? '');
|
|
37
36
|
const findSelectedOptionByValue = (0, _react.useCallback)(val => {
|
|
38
37
|
return userOptions.find(opt => opt.value === val);
|
|
39
38
|
}, [userOptions]);
|
|
40
|
-
const [selectedOption, setSelectedOption] = (0, _react.useState)(
|
|
39
|
+
const [selectedOption, setSelectedOption] = (0, _react.useState)(findSelectedOptionByValue(meta?.initial ?? '') ?? {});
|
|
41
40
|
(0, _react.useEffect)(() => {
|
|
42
41
|
// We treat non-undefined value/formInput values as valid values, whereas undefined is only relevant when prop has not been provided
|
|
43
|
-
if (value !== undefined && !(value ===
|
|
42
|
+
if (value !== undefined && !(value === selectedOption?.value && value === internalValue)) {
|
|
44
43
|
setSelectedOption(findSelectedOptionByValue(value));
|
|
45
44
|
setInternalValue(value);
|
|
46
|
-
} else if (
|
|
45
|
+
} else if (formInput?.value !== undefined && !(value === selectedOption?.value && value === internalValue)) {
|
|
47
46
|
setSelectedOption(findSelectedOptionByValue(formInput.value));
|
|
48
47
|
setInternalValue(formInput.value);
|
|
49
48
|
}
|
|
@@ -53,15 +52,14 @@ const RichSelect = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
53
52
|
(0, _react.useImperativeHandle)(ref, () => ({
|
|
54
53
|
selectedOption
|
|
55
54
|
}));
|
|
56
|
-
const defaultRenderTrigger =
|
|
57
|
-
var _ref4, _ref5, _ref6, _selectedOption$label;
|
|
55
|
+
const defaultRenderTrigger = _ref2 => {
|
|
58
56
|
let {
|
|
59
57
|
onToggle,
|
|
60
58
|
triggerRef,
|
|
61
59
|
keyHandler,
|
|
62
60
|
ariaProps,
|
|
63
61
|
getTriggerProps
|
|
64
|
-
} =
|
|
62
|
+
} = _ref2;
|
|
65
63
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.DropdownButton, {
|
|
66
64
|
ref: triggerRef,
|
|
67
65
|
buttonClass: _RichSelect.default.triggerButton,
|
|
@@ -74,7 +72,7 @@ const RichSelect = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
74
72
|
type: "button",
|
|
75
73
|
...getTriggerProps(),
|
|
76
74
|
...ariaProps,
|
|
77
|
-
children:
|
|
75
|
+
children: selectedOption?.label ?? selectedOption?.value ?? (internalValue || null) ?? placeholder ?? /*#__PURE__*/(0, _jsxRuntime.jsx)(_FormattedKintMessage.default, {
|
|
78
76
|
id: "pleaseSelectOption",
|
|
79
77
|
intlKey: passedIntlKey,
|
|
80
78
|
intlNS: passedIntlNS
|
|
@@ -83,7 +81,7 @@ const RichSelect = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
83
81
|
};
|
|
84
82
|
const handleChange = e => {
|
|
85
83
|
// Actually set the value in the form (If formInput exists)
|
|
86
|
-
if (formInput
|
|
84
|
+
if (formInput?.onChange) {
|
|
87
85
|
formInput.onChange(e);
|
|
88
86
|
}
|
|
89
87
|
|
|
@@ -95,20 +93,17 @@ const RichSelect = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
95
93
|
const changeField = val => {
|
|
96
94
|
(0, _components.nativeChangeFieldValue)(hiddenInput, false, val);
|
|
97
95
|
};
|
|
98
|
-
const defaultRenderOption = opt =>
|
|
99
|
-
|
|
100
|
-
return (_opt$label = opt.label) !== null && _opt$label !== void 0 ? _opt$label : opt.value;
|
|
101
|
-
};
|
|
102
|
-
const defaultRenderMenu = _ref7 => {
|
|
96
|
+
const defaultRenderOption = opt => opt.label ?? opt.value;
|
|
97
|
+
const defaultRenderMenu = _ref3 => {
|
|
103
98
|
let {
|
|
104
99
|
onToggle
|
|
105
|
-
} =
|
|
100
|
+
} = _ref3;
|
|
106
101
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.DropdownMenu, {
|
|
107
102
|
children: userOptions.map(opt => {
|
|
108
103
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
|
|
109
|
-
autoFocus:
|
|
104
|
+
autoFocus: selectedOption?.value === opt.value,
|
|
110
105
|
buttonStyle: "dropdownItem",
|
|
111
|
-
id:
|
|
106
|
+
id: `${id}-${formInput.name}-option-${opt.value}`,
|
|
112
107
|
marginBottom0: true,
|
|
113
108
|
onClick: () => {
|
|
114
109
|
// Trigger change event
|
|
@@ -126,7 +121,7 @@ const RichSelect = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
126
121
|
children: [label || ariaLabel ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Label, {
|
|
127
122
|
className: ariaLabel && 'sr-only',
|
|
128
123
|
htmlFor: id,
|
|
129
|
-
id:
|
|
124
|
+
id: `${id}-label`,
|
|
130
125
|
required: required,
|
|
131
126
|
children: ariaLabel || label
|
|
132
127
|
}) : '', /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Dropdown, {
|
|
@@ -17,4 +17,4 @@ Object.defineProperty(exports, "useSelectedOption", {
|
|
|
17
17
|
});
|
|
18
18
|
var _RichSelect = _interopRequireDefault(require("./RichSelect"));
|
|
19
19
|
var _useSelectedOption = _interopRequireDefault(require("./useSelectedOption"));
|
|
20
|
-
function _interopRequireDefault(
|
|
20
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -8,8 +8,7 @@ var _react = require("react");
|
|
|
8
8
|
const useSelectedOption = () => {
|
|
9
9
|
const [selectedOption, setSelectedOption] = (0, _react.useState)();
|
|
10
10
|
const ref = (0, _react.useCallback)(node => {
|
|
11
|
-
|
|
12
|
-
if (node !== null && (selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.value) !== ((_node$selectedOption = node.selectedOption) === null || _node$selectedOption === void 0 ? void 0 : _node$selectedOption.value)) {
|
|
11
|
+
if (node !== null && selectedOption?.value !== node.selectedOption?.value) {
|
|
13
12
|
setSelectedOption(node.selectedOption);
|
|
14
13
|
}
|
|
15
14
|
}, [selectedOption]);
|
|
@@ -15,9 +15,8 @@ var _utils = require("../utils");
|
|
|
15
15
|
var _hooks = require("../hooks");
|
|
16
16
|
var _TableBody = _interopRequireDefault(require("./TableBody"));
|
|
17
17
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
18
|
-
function _interopRequireDefault(
|
|
18
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
19
19
|
const SASQLookupComponent = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
|
|
20
|
-
var _totalData$pages$redu, _totalData$pages;
|
|
21
20
|
const {
|
|
22
21
|
children,
|
|
23
22
|
fetchParameters = {},
|
|
@@ -48,14 +47,14 @@ const SASQLookupComponent = /*#__PURE__*/(0, _react.forwardRef)((props, ref) =>
|
|
|
48
47
|
0: namespace
|
|
49
48
|
} = (0, _core.useNamespace)();
|
|
50
49
|
const ky = (0, _core.useOkapiKy)();
|
|
51
|
-
const filterPaneVisibileKey =
|
|
50
|
+
const filterPaneVisibileKey = `${namespace}-${id}-filterPaneVisibility`;
|
|
52
51
|
const fetchPageData = _ref => {
|
|
53
52
|
let {
|
|
54
53
|
pageParam = 0
|
|
55
54
|
} = _ref;
|
|
56
55
|
const queryMap = fetchParameters.SASQ_MAP;
|
|
57
56
|
queryMap.offset = pageParam;
|
|
58
|
-
return ky(
|
|
57
|
+
return ky(`${fetchParameters.endpoint}${(0, _utils.generateKiwtQuery)(queryMap, query)}`).json();
|
|
59
58
|
};
|
|
60
59
|
const [filterPaneVisible, setFilterPaneVisible] = (0, _hooks.useLocalStorageState)(filterPaneVisibileKey, true);
|
|
61
60
|
const toggleFilterPane = () => setFilterPaneVisible(!filterPaneVisible);
|
|
@@ -75,8 +74,7 @@ const SASQLookupComponent = /*#__PURE__*/(0, _react.forwardRef)((props, ref) =>
|
|
|
75
74
|
...restOfInfiniteQueryProps
|
|
76
75
|
}
|
|
77
76
|
}));
|
|
78
|
-
const data =
|
|
79
|
-
var _acc$results, _curr$results;
|
|
77
|
+
const data = totalData.pages?.reduce((acc, curr) => {
|
|
80
78
|
const newAcc = {
|
|
81
79
|
...acc
|
|
82
80
|
};
|
|
@@ -85,11 +83,11 @@ const SASQLookupComponent = /*#__PURE__*/(0, _react.forwardRef)((props, ref) =>
|
|
|
85
83
|
newAcc[key] = value;
|
|
86
84
|
}
|
|
87
85
|
}
|
|
88
|
-
const newResults = [...(
|
|
89
|
-
newResults.push(...(
|
|
86
|
+
const newResults = [...(acc.results ?? [])];
|
|
87
|
+
newResults.push(...(curr.results ?? []));
|
|
90
88
|
newAcc.results = newResults;
|
|
91
89
|
return newAcc;
|
|
92
|
-
}, {})
|
|
90
|
+
}, {}) ?? {};
|
|
93
91
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_smartComponents.SearchAndSortQuery, {
|
|
94
92
|
initialSearchState: {
|
|
95
93
|
query: ''
|
|
@@ -111,7 +109,7 @@ const SASQLookupComponent = /*#__PURE__*/(0, _react.forwardRef)((props, ref) =>
|
|
|
111
109
|
const searchHandlers = getSearchHandlers();
|
|
112
110
|
const disableReset = !filterChanged && !searchChanged;
|
|
113
111
|
const filterCount = activeFilters.string ? activeFilters.string.split(',').length : 0;
|
|
114
|
-
const Body = RenderBody
|
|
112
|
+
const Body = RenderBody ?? _TableBody.default;
|
|
115
113
|
const {
|
|
116
114
|
filterPaneFirstMenu,
|
|
117
115
|
filterPaneLastMenu,
|
|
@@ -133,12 +131,12 @@ const SASQLookupComponent = /*#__PURE__*/(0, _react.forwardRef)((props, ref) =>
|
|
|
133
131
|
};
|
|
134
132
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_smartComponents.PersistedPaneset, {
|
|
135
133
|
appId: namespace,
|
|
136
|
-
id:
|
|
134
|
+
id: `${id}-paneset`,
|
|
137
135
|
...persistedPanesetProps,
|
|
138
136
|
children: [filterPaneVisible && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Pane, {
|
|
139
137
|
defaultWidth: "20%",
|
|
140
138
|
firstMenu: filterPaneFirstMenu ? filterPaneFirstMenu(internalStateProps) : null,
|
|
141
|
-
id:
|
|
139
|
+
id: `${id}-filter-pane`,
|
|
142
140
|
lastMenu: filterPaneLastMenu ? filterPaneLastMenu(internalStateProps) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.PaneMenu, {
|
|
143
141
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_smartComponents.CollapseFilterPaneButton, {
|
|
144
142
|
onClick: toggleFilterPane
|
|
@@ -154,11 +152,10 @@ const SASQLookupComponent = /*#__PURE__*/(0, _react.forwardRef)((props, ref) =>
|
|
|
154
152
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.SearchField, {
|
|
155
153
|
ariaLabel: searchFieldAriaLabel,
|
|
156
154
|
autoFocus: true,
|
|
157
|
-
id:
|
|
155
|
+
id: `sasq-search-field-${id}`,
|
|
158
156
|
name: "query",
|
|
159
157
|
onChange: e => {
|
|
160
|
-
|
|
161
|
-
if ((_e$target = e.target) !== null && _e$target !== void 0 && _e$target.value) {
|
|
158
|
+
if (e.target?.value) {
|
|
162
159
|
searchHandlers.query(e); // SASQ needs the whole event here
|
|
163
160
|
} else {
|
|
164
161
|
searchHandlers.reset();
|
|
@@ -205,15 +202,15 @@ const SASQLookupComponent = /*#__PURE__*/(0, _react.forwardRef)((props, ref) =>
|
|
|
205
202
|
onClick: toggleFilterPane
|
|
206
203
|
})
|
|
207
204
|
}) : null,
|
|
208
|
-
id:
|
|
205
|
+
id: `${id}-main-pane`,
|
|
209
206
|
lastMenu: mainPaneLastMenu ? mainPaneLastMenu(internalStateProps) : null,
|
|
210
207
|
noOverflow: true,
|
|
211
208
|
padContent: false,
|
|
212
209
|
paneSub: kintIntl.formatKintMessage({
|
|
213
210
|
id: 'found#Values',
|
|
214
|
-
overrideValue: labelOverrides
|
|
211
|
+
overrideValue: labelOverrides?.foundValues
|
|
215
212
|
}, {
|
|
216
|
-
total: data
|
|
213
|
+
total: data?.total
|
|
217
214
|
}),
|
|
218
215
|
...restOfMainPaneProps,
|
|
219
216
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Body, {
|
|
@@ -10,9 +10,8 @@ var _reactRouterDom = require("react-router-dom");
|
|
|
10
10
|
var _components = require("@folio/stripes/components");
|
|
11
11
|
var _NoResultsMessage = _interopRequireDefault(require("../../NoResultsMessage"));
|
|
12
12
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
|
-
function _interopRequireDefault(
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
14
|
const TableBody = _ref => {
|
|
15
|
-
var _query$sort, _match$params2;
|
|
16
15
|
let {
|
|
17
16
|
data,
|
|
18
17
|
error,
|
|
@@ -27,7 +26,7 @@ const TableBody = _ref => {
|
|
|
27
26
|
mclProps: {
|
|
28
27
|
formatter = {},
|
|
29
28
|
...mclProps
|
|
30
|
-
},
|
|
29
|
+
} = {},
|
|
31
30
|
onSort,
|
|
32
31
|
path,
|
|
33
32
|
resultColumns,
|
|
@@ -36,7 +35,7 @@ const TableBody = _ref => {
|
|
|
36
35
|
toggleFilterPane,
|
|
37
36
|
query
|
|
38
37
|
} = _ref;
|
|
39
|
-
const sortOrder =
|
|
38
|
+
const sortOrder = query.sort ?? '';
|
|
40
39
|
const history = (0, _reactRouterDom.useHistory)();
|
|
41
40
|
const location = (0, _reactRouterDom.useLocation)();
|
|
42
41
|
const onNeedMoreData = (_askAmount, index) => {
|
|
@@ -51,9 +50,9 @@ const TableBody = _ref => {
|
|
|
51
50
|
// Build the list of visible columns
|
|
52
51
|
const visibleColumns = resultColumns.map(e => e.propertyPath);
|
|
53
52
|
const getRowUrl = (0, _react.useCallback)(rowData => {
|
|
54
|
-
const baseUrl =
|
|
53
|
+
const baseUrl = `${path}/${rowData?.id}`;
|
|
55
54
|
return {
|
|
56
|
-
url:
|
|
55
|
+
url: `${baseUrl}${location?.search}`,
|
|
57
56
|
path,
|
|
58
57
|
baseUrl,
|
|
59
58
|
location
|
|
@@ -78,16 +77,15 @@ const TableBody = _ref => {
|
|
|
78
77
|
return null;
|
|
79
78
|
}, [getRowUrl, history, rowNavigation]);
|
|
80
79
|
const isSelected = (0, _react.useCallback)(_ref2 => {
|
|
81
|
-
var _match$params;
|
|
82
80
|
let {
|
|
83
81
|
item
|
|
84
82
|
} = _ref2;
|
|
85
|
-
return item.id ===
|
|
86
|
-
}, [match
|
|
83
|
+
return item.id === match?.params?.id;
|
|
84
|
+
}, [match?.params?.id]);
|
|
87
85
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.MultiColumnList, {
|
|
88
86
|
autosize: true,
|
|
89
87
|
columnMapping: columnMapping,
|
|
90
|
-
contentData: data
|
|
88
|
+
contentData: data?.results,
|
|
91
89
|
formatter: getEnhancedFormatter() // Pass enhanced formatter
|
|
92
90
|
,
|
|
93
91
|
hasMargin: true,
|
|
@@ -10,4 +10,4 @@ Object.defineProperty(exports, "default", {
|
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
12
|
var _TableBody = _interopRequireDefault(require("./TableBody"));
|
|
13
|
-
function _interopRequireDefault(
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|