Skip to content

Commit

Permalink
Merge branch 'master' into STSMACOM-838
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnC-80 authored Jul 22, 2024
2 parents fe0812c + 1de75c4 commit 8f313bc
Show file tree
Hide file tree
Showing 8 changed files with 335 additions and 21 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@
* Use `react-quill` compatible with `react` `v18`. Refs STSMACOM-821.
* `<ControlledVocab>` - pass override headers to PUT method, new prop to hide "New" button. Refs STSMACOM-825.
* `<SearchAndSort>` - re-position Advanced search button when search panel does not have enough space. Refs STSMACOM-830.
* Implement new `<ProfilePicture>` component. Refs STSMACOM-817.
* Extend `ViewMetadata` component to accept a child render function for custom rendering. Refs STSMACOM-828.
* Improve AdvancedSearch parsing algorithm to keep repeated spaces in queries. Fixes STSMACOM-837.
* Support Optimistic Locking in Tags. Refs STSMACOM-839.
* Supply boolean value to enabled option of useQuery. STSMACOM-778.
* Add an optional `isCursorAtEnd` property for `SearchField`. Pass `resetSelectedItem` to `onDismissDetail`. STSMACOM-841.
* Add check for the error status when error occurs during adding tag. STSMACOM-844.
* Add `requiredFields` prop to `DateRangeFilter` to support open-ended date ranges. STSMACOM-838.

## [9.1.1] (IN PROGRESS)
Expand Down
11 changes: 9 additions & 2 deletions lib/SearchAndSort/SearchAndSort.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ class SearchAndSort extends React.Component {
]),
inputType: PropTypes.string,
isCountHidden: PropTypes.bool,
isCursorAtEnd: PropTypes.bool,
location: PropTypes.shape({ // provided by withRouter
pathname: PropTypes.string.isRequired,
search: PropTypes.string.isRequired,
Expand Down Expand Up @@ -824,16 +825,20 @@ class SearchAndSort extends React.Component {
}
};

resetSelectedItem = () => {
this.setState({ selectedItem: undefined });
};

collapseDetails = () => {
const {
packageInfo: { stripes },
onDismissDetail,
} = this.props;

if (onDismissDetail) {
onDismissDetail();
onDismissDetail(this.resetSelectedItem);
} else {
this.setState({ selectedItem: undefined });
this.resetSelectedItem();
}

this.transitionToParams({ _path: `${stripes.route}/view` });
Expand Down Expand Up @@ -1202,6 +1207,7 @@ class SearchAndSort extends React.Component {
inputType,
indexRef,
inputRef,
isCursorAtEnd,
} = this.props;
const {
locallyChangedSearchTerm,
Expand Down Expand Up @@ -1240,6 +1246,7 @@ class SearchAndSort extends React.Component {
onSubmitSearch={this.onSubmitSearch}
indexRef={indexRef}
inputRef={inputRef}
isCursorAtEnd={isCursorAtEnd}
/>
)}
</FormattedMessage>
Expand Down
22 changes: 21 additions & 1 deletion lib/SearchAndSort/tests/SearchAndSort-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ const Pane = HTML.extend('pane')

describe('SearchAndSort Query Navigation', () => {
const onResetAllSpy = sinon.spy();
const onDismissDetailSpy = sinon.spy();
const filterPane = Pane('Search & filter');
setupApplication({
component: (
Expand All @@ -51,9 +52,18 @@ describe('SearchAndSort Query Navigation', () => {
onResetAll={onResetAllSpy}
title="Test samples"
module={{ displayName: 'Test samples' }}
viewRecordComponent={(props) => <PaneComponent {...props}>content</PaneComponent>}
viewRecordComponent={(props) => (
<PaneComponent
dismissible
onClose={onDismissDetailSpy}
{...props}
>
content
</PaneComponent>
)}
detailProps={{ paneTitle: 'Single User' }}
showSingleResult
onDismissDetail={onDismissDetailSpy}
/>)
});

Expand All @@ -64,6 +74,7 @@ describe('SearchAndSort Query Navigation', () => {
});
await this.server.createList('user', 1000);

onDismissDetailSpy.resetHistory();
onResetAllSpy.resetHistory();
window.localStorage.setItem('@folio/ui-dummy/filterPaneVisibility', true);
});
Expand Down Expand Up @@ -162,6 +173,15 @@ describe('SearchAndSort Query Navigation', () => {
it('sends screen-reader message to SRStatus component', () => SRStatusInteractor({ text: 'Search returned 1 result' }).exists());

it('opens the pane of the single result', () => Pane('Single User').exists());

describe('when closing details view', () => {
it('should call onDismissDetail callback with a function', async () => {
await Pane('Single User').find(IconButton({ icon: 'times' })).click();

expect(onDismissDetailSpy.called).to.be.true;
expect(onDismissDetailSpy.firstCall.args[0]).to.be.a('function');
})

Check failure on line 183 in lib/SearchAndSort/tests/SearchAndSort-test.js

View workflow job for this annotation

GitHub Actions / build-npm

Missing semicolon

Check failure on line 183 in lib/SearchAndSort/tests/SearchAndSort-test.js

View workflow job for this annotation

GitHub Actions / build-npm

Missing semicolon
})

Check failure on line 184 in lib/SearchAndSort/tests/SearchAndSort-test.js

View workflow job for this annotation

GitHub Actions / build-npm

Missing semicolon

Check failure on line 184 in lib/SearchAndSort/tests/SearchAndSort-test.js

View workflow job for this annotation

GitHub Actions / build-npm

Missing semicolon
});

describe('advanced search', () => {
Expand Down
2 changes: 1 addition & 1 deletion lib/Tags/Tags.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ class Tags extends React.Component {
};

onError = error => {
const errorId = error.status === OPTIMISTIC_LOCKING_STATUS
const errorId = error.status === OPTIMISTIC_LOCKING_STATUS || error.response?.status === OPTIMISTIC_LOCKING_STATUS
? 'stripes-components.optimisticLocking.saveError'
: 'stripes-smart-components.cannotSaveTagToRecord';

Expand Down
22 changes: 11 additions & 11 deletions translations/stripes-smart-components/fr_FR.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"cddd.header.currentDueDate": "Date d'échéance actuelle",
"cddd.header.barcode": "Code-barres",
"cddd.header.loanPolicy": "Règle de prêt",
"cddd.warning.dueDateAfterPatronExpiration": "La nouvelle date d'échéance est postérieure à celle de l'utilisateur",
"cddd.warning.dueDateAfterPatronExpiration": "La nouvelle date d'échéance est postérieure à celle de l'usager",
"cddd.warning.dueDateWhenLibraryClosed": "La nouvelle date d'échéance tombe pendant la fermeture de la bibliothèque.",
"cddd.warning.dueDateInPast": "La nouvelle date d'échéance ne peut être antérieure",
"cv.cannotDeleteTermHeader": "Impossible de supprimer {type}",
Expand Down Expand Up @@ -55,11 +55,11 @@
"new": "Nouveau",
"hideSearchPane": "Réduire le volet Rechercher et filtrer",
"showSearchPane": "Développer le volet Rechercher et filtrer",
"numberOfFilters": "{count, number} {count, plural, one { filtre appliqué } other { filtres appliqués }}",
"numberOfFilters": "{count, number} {count, plural, one {filtre appliqué} other {filtres appliqués}}",
"permissionError": "Erreur d'autorisation",
"permissionsDoNotAllowAccess": "Désolé, vos autorisations ne vous permettent pas d'accéder à cette page.",
"searchResults": "Résultats de la recherche {objectName}",
"searchReturnedResults": "La recherche a retourné {count, number} {count, plural, one { résultat } other { résultats }}",
"searchReturnedResults": "La recherche a retourné {count, number} {count, plural, one {résultat} other {résultats}}",
"resetAll": "Tout réinitialiser",
"whoAreYouActingAs": "Vous agissez en tant que ?",
"self": "Auto",
Expand All @@ -68,9 +68,9 @@
"searchCriteria": "Saisir les critères de recherche pour lancer la recherche",
"cddd.date": "Date",
"cddd.time": "Heure",
"searchResultsCountHeader": "{count, number} {count, plural, one { enregistrement trouvé } other { enregistrements trouvés }}",
"searchResultsCountHeader": "{count, number} {count, plural, one {notice trouvée} other {notices trouvées}}",
"tags": "Mots-clés",
"numberOfTags": "{count, number} {count, plural, one { mot-clé } other { mots-clés }}",
"numberOfTags": "{count, number} {count, plural, one {mot-clé} other {mots-clés}}",
"deleteTag": "Enlever le mot-clé",
"enterATag": "Valider",
"tagsTextArea": "Zone de texte du mot-clé",
Expand Down Expand Up @@ -125,7 +125,7 @@
"notes.assignNote": "Attribuer une note",
"notes.noteSearch": "Recherche de notes",
"notes.noteAssignmentStatus": "Statut d'affectation de la note",
"notes.found": "{quantity, number} {quantity, plural, one { note trouvée } other { notes trouvée }}",
"notes.found": "{quantity, number} {quantity, plural, one {note trouvée} other {notes trouvées}}",
"status": "Statut",
"assigned": "Attribué",
"unassigned": "Non attribué",
Expand All @@ -137,7 +137,7 @@
"notes.deleteNote": "Supprimer la note",
"notes.unassignNote": "Annuler l'attribution de la note",
"notes.unassign.confirm.message": "La note <b>{title}</b> sera <b>non affectée</b>.",
"notes.delete.confirm.message": "La note <b> {title} </b> sera définitivement <b> supprimée </b> . Cette note est rattachée à <b> {resourcesNumber, number} </b> {resourcesNumber, plural, one { ressource } other { ressources }}",
"notes.delete.confirm.message": "La note <b>{title}</b> sera définitivement <b>supprimée</b>. Cette note est rattachée à <b>{resourcesNumber, number}</b> {resourcesNumber, plural, one {ressource} other {ressources}}",
"notes.editNoteTitle": "Modifier: {noteTitle}",
"notes.noteTypesMissing": "Impossible de sauvegarder la note. Un type de note doit être sélectionné",
"addressEdit.useAddressAsPrimaryAddress": "Utiliser l'adresse {index} comme adresse principale",
Expand Down Expand Up @@ -201,7 +201,7 @@
"customFields.settings.accordion.hidden": "(Caché)",
"customFields.recordAccordion.defaultName": "Champs personnalisés",
"customFields.errorOccurred": "Impossible de mettre à jour en raison d'une erreur de module. Veuillez réessayer. Si le problème persiste, veuillez contacter votre administrateur système.",
"cddd.header.effectiveCallNumber": "Chaîne de caractères de la cote",
"cddd.header.effectiveCallNumber": "Cote intégrale",
"cddd.itemDeclaredLost": "Impossible de modifier la date d'échéance: l'article est déclaré perdu",
"cddd.itemDeclaredLostWarning": "L'objet est déclaré perdu",
"customFields.required.checked": "Oui",
Expand Down Expand Up @@ -241,7 +241,7 @@
"customFields.dragDrop.returned": "Le champ {name} a été renvoyé à sa position de départ de {position}",
"customFields.fieldTypes.RADIO_BUTTON": "Bouton radio (?)",
"cddd.itemClaimedReturned": "Due date change failed: item is Claimed returned",
"cddd.itemClaimedReturnedWarning": "Item is Claimed returned",
"cddd.itemClaimedReturnedWarning": "L'exemplaire est Déclaré rendu",
"customFields.settings.accordionTitle": "Titre \"accordéon\"",
"customFields.select.placeholder": "Sélectionnez un {fieldLabel}",
"customFields.new": "Nouveau",
Expand All @@ -256,15 +256,15 @@
"cddd.itemAgedToLostWarning": "L'exemplaire est considéré comme perdu",
"customFields.dropdown.default": "Valeur par défaut",
"cddd.itemAgedToLost": "Échec de la modification de la date d'échéance: l'exemplaire est considéré comme perdu",
"success.message": "L ' {entry} <strong> {name} </strong> a été <strong> {action} </strong> avec succès.",
"success.message": "L' {entry} <strong>{name}</strong> a été <strong>{action}</strong> avec succès.",
"address.primary": "Principal",
"ll.remoteLabel": "À distance",
"columnManager.showColumns": "Afficher les colonnes",
"address.alternate": "Autre",
"notes.displayAsPopup.label": "Afficher la note sous forme de pop-up",
"notes.displayAsPopup.checkout": "App. prêter",
"notes.displayAsPopup.users": "Application utilisateurs",
"notes.popupModal.label": "Note pour l'utilisateur",
"notes.popupModal.label": "Note pour l'usager",
"notes.popupModal.delete": "Supprimer la note",
"notes.close": "Fermer",
"customFields.noCustomFieldsFound": "Aucun champ personnalisé trouvé",
Expand Down
Loading

0 comments on commit 8f313bc

Please sign in to comment.