diff --git a/CHANGELOG.md b/CHANGELOG.md index 6bf6c032..8f0d2c94 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## (IN PROGRESS) * Add common util which will provide translations for `ControlledVocab`. Refs UISACQCOMP-123. +* Add handlers for search field and reset all button in `PluginFindRecordModal` component. Refs UISACQCOMP-124. ## [3.3.0](https://github.com/folio-org/stripes-acq-components/tree/v3.3.0) (2022-10-18) [Full Changelog](https://github.com/folio-org/stripes-acq-components/compare/v3.2.4...v3.3.0) diff --git a/lib/PluginFindRecord/PluginFindRecordModal.js b/lib/PluginFindRecord/PluginFindRecordModal.js index 5d7a69b1..4f6d85f5 100644 --- a/lib/PluginFindRecord/PluginFindRecordModal.js +++ b/lib/PluginFindRecord/PluginFindRecordModal.js @@ -162,6 +162,7 @@ class PluginFindRecordModal extends React.Component { sortableColumns = visibleColumns, getRecordLabel, intl, + onSearchChange, } = this.props; const { checkedMap, isAllChecked } = this.state; @@ -302,7 +303,10 @@ class PluginFindRecordModal extends React.Component { data-test-plugin-search-input marginBottom0 name="query" - onChange={getSearchHandlers().query} + onChange={(e) => { + onSearchChange(e.target.value); + getSearchHandlers().query(e); + }} onClear={getSearchHandlers().reset} value={searchValue.query} /> @@ -323,7 +327,10 @@ class PluginFindRecordModal extends React.Component { disabled={!(filterChanged || searchChanged)} fullWidth id="clickable-reset-all" - onClick={resetAll} + onClick={() => { + onSearchChange(''); + resetAll(); + }} > @@ -424,6 +431,7 @@ PluginFindRecordModal.propTypes = { validateSelectedRecords: PropTypes.func, getRecordLabel: PropTypes.func, intl: PropTypes.object.isRequired, + onSearchChange: PropTypes.func, }; PluginFindRecordModal.defaultProps = { @@ -435,6 +443,7 @@ PluginFindRecordModal.defaultProps = { modalLabel: '', onSaveMultiple: noop, renderNewBtn: noop, + onSearchChange: noop, resultsFormatter: {}, };