Skip to content

Commit

Permalink
Merge branch 'master' into UISAUTCOMP-135
Browse files Browse the repository at this point in the history
  • Loading branch information
BogdanDenis authored Dec 20, 2024
2 parents c874a07 + 91dc2d4 commit eda8e15
Show file tree
Hide file tree
Showing 16 changed files with 65 additions and 155 deletions.
2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"react/hook-use-state": "error",
"react/no-array-index-key": "error",
"react/no-multi-comp": "error",
"react/require-default-props": "error",
"react/require-default-props": "off",
"react/jsx-key": "error",
"react/jsx-max-props-per-line": "error",
"object-curly-newline": ["error", {
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## [5.1.0] (IN PROGRESS)

- [UISAUTCOMP-136](https://folio-org.atlassian.net/browse/UISAUTCOMP-136) Spitfire - migrate to shared CI workflows.
- [UISAUTCOMP-118](https://folio-org.atlassian.net/browse/UISAUTCOMP-118) React v19: refactor away from default props for functional components.

## [5.0.3] (IN PROGRESS)

Expand Down
15 changes: 4 additions & 11 deletions lib/AuthoritiesSearchForm/AuthoritiesSearchForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ const propTypes = {
const AuthoritiesSearchForm = ({
isAuthoritiesLoading,
onSubmitSearch,
onShowDetailView,
resetSelectedRows,
hasAdvancedSearch,
hasQueryOption,
hasMatchSelection,
hasAdvancedSearch = false,
hasQueryOption = true,
hasMatchSelection = false,
onShowDetailView = noop,
}) => {
const intl = useIntl();

Expand Down Expand Up @@ -228,11 +228,4 @@ const AuthoritiesSearchForm = ({

AuthoritiesSearchForm.propTypes = propTypes;

AuthoritiesSearchForm.defaultProps = {
hasAdvancedSearch: false,
hasQueryOption: true,
hasMatchSelection: false,
onShowDetailView: noop,
};

export default AuthoritiesSearchForm;
26 changes: 8 additions & 18 deletions lib/AuthoritiesSearchPane/AuthoritiesSearchPane.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,20 @@ const propTypes = {
};

const AuthoritiesSearchPane = ({
excludedFilters,
isFilterPaneVisible,
toggleFilterPane,
isLoading,
onSubmitSearch,
resetSelectedRows,
query,
hasAdvancedSearch,
hasQueryOption,
hasMatchSelection,
height,
tenantId,
onShowDetailView,
firstPageQuery,
excludedFilters = {},
resetSelectedRows = noop,
hasAdvancedSearch = false,
hasQueryOption = true,
hasMatchSelection = false,
height = null,
onShowDetailView = noop,
tenantId = null,
}) => {
const intl = useIntl();
const { navigationSegmentValue } = useContext(AuthoritiesSearchContext);
Expand Down Expand Up @@ -103,15 +103,5 @@ const AuthoritiesSearchPane = ({
};

AuthoritiesSearchPane.propTypes = propTypes;
AuthoritiesSearchPane.defaultProps = {
excludedFilters: {},
resetSelectedRows: noop,
hasAdvancedSearch: false,
hasQueryOption: true,
hasMatchSelection: false,
height: null,
onShowDetailView: noop,
tenantId: null,
};

export default AuthoritiesSearchPane;
8 changes: 2 additions & 6 deletions lib/AuthoritySourceFilter/AuthoritySourceFilter.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ const propTypes = {

const AuthoritySourceFilter = ({
open,
selectedValues,
selectedValues = [],
onClearFilter,
options,
onFilterChange,
handleSectionToggle,
isLoading,
tenantId,
tenantId = null,
}) => {
const intl = useIntl();
const { sourceFiles, isLoading: isSourceFilesLoading } = useAuthoritySourceFiles({ tenantId });
Expand Down Expand Up @@ -83,10 +83,6 @@ const AuthoritySourceFilter = ({
);
};

AuthoritySourceFilter.defaultProps = {
selectedValues: [],
tenantId: null,
};
AuthoritySourceFilter.propTypes = propTypes;

export default AuthoritySourceFilter;
12 changes: 3 additions & 9 deletions lib/BrowseFilters/BrowseFilters.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ const propTypes = {
};

const BrowseFilters = ({
cqlQuery,
excludedFilters,
tenantId,
cqlQuery = '',
excludedFilters = [],
tenantId = null,
}) => {
const intl = useIntl();
const {
Expand Down Expand Up @@ -115,10 +115,4 @@ const BrowseFilters = ({

BrowseFilters.propTypes = propTypes;

BrowseFilters.defaultProps = {
cqlQuery: '',
excludedFilters: [],
tenantId: null,
};

export default BrowseFilters;
9 changes: 2 additions & 7 deletions lib/CheckboxFacet/CheckboxFacet.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ const CheckboxFacet = ({
open,
handleSectionToggle,
name,
options,
onFilterChange,
selectedValues,
disabled,
onClearFilter,
selectedValues = [],
options = [],
}) => {
return (
<Accordion
Expand All @@ -58,11 +58,6 @@ const CheckboxFacet = ({
);
};

CheckboxFacet.defaultProps = {
selectedValues: [],
options: [],
};

CheckboxFacet.propTypes = propTypes;

export default CheckboxFacet;
7 changes: 1 addition & 6 deletions lib/FacetOptionFormatter/FacetOptionFormatter.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const propTypes = {
searchTerm: PropTypes.string,
};

const FacetOptionFormatter = ({ option, searchTerm }) => {
const FacetOptionFormatter = ({ option = null, searchTerm = '' }) => {
if (!option) {
return null;
}
Expand All @@ -26,9 +26,4 @@ const FacetOptionFormatter = ({ option, searchTerm }) => {

FacetOptionFormatter.propTypes = propTypes;

FacetOptionFormatter.defaultProps = {
option: null,
searchTerm: '',
};

export default FacetOptionFormatter;
20 changes: 7 additions & 13 deletions lib/MultiSelectionFacet/MultiSelectionFacet.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,15 @@ const MultiSelectionFacet = ({
handleSectionToggle,
name,
onFilterChange,
options,
selectedValues,
onClearFilter,
displayClearButton,
formatMissingOption,
selectedValues = [],
options = [],
formatMissingOption = value => ({
label: value,
value,
totalRecords: 0,
}),
...props
}) => {
const onChange = newOptions => {
Expand Down Expand Up @@ -96,16 +100,6 @@ const MultiSelectionFacet = ({
);
};

MultiSelectionFacet.defaultProps = {
selectedValues: [],
options: [],
formatMissingOption: value => ({
label: value,
value,
totalRecords: 0,
}),
};

MultiSelectionFacet.propTypes = propTypes;

export default MultiSelectionFacet;
9 changes: 2 additions & 7 deletions lib/ReferencesFilter/ReferencesFilter.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ const propTypes = {
};

const ReferencesFilter = ({
activeFilters,
closedByDefault = true,
disabled,
id,
onChange,
name,
navigationSegment,
activeFilters = [],
disabled = false,
}) => (
<AcqCheckboxFilter
activeFilters={activeFilters}
Expand All @@ -36,10 +36,5 @@ const ReferencesFilter = ({
);

ReferencesFilter.propTypes = propTypes;
ReferencesFilter.defaultProps = {
activeFilters: [],
closedByDefault: false,
disabled: false,
};

export { ReferencesFilter };
12 changes: 3 additions & 9 deletions lib/SearchFilters/SearchFilters.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ const propTypes = {

const SearchFilters = ({
isSearching,
cqlQuery,
excludedFilters,
tenantId,
cqlQuery = '',
excludedFilters = [],
tenantId = null,
}) => {
const intl = useIntl();
const {
Expand Down Expand Up @@ -161,10 +161,4 @@ const SearchFilters = ({

SearchFilters.propTypes = propTypes;

SearchFilters.defaultProps = {
cqlQuery: '',
excludedFilters: [],
tenantId: null,
};

export default SearchFilters;
61 changes: 21 additions & 40 deletions lib/SearchResultsList/SearchResultsList.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,32 +57,37 @@ const propTypes = {

const SearchResultsList = ({
authorities,
columnWidths,
columnMapping,
error,
formatter,
totalResults,
loading,
loaded,
pageSize,
onNeedMoreData,
visibleColumns,
showSortIndicator,
sortableColumns,
sortedColumn,
sortOrder,
onHeaderClick,
isFilterPaneVisible,
query,
toggleFilterPane,
hasFilters,
hidePageIndices,
hasNextPage,
hasPrevPage,
renderHeadingRef,
itemToView,
nonInteractiveHeaders,
onRowFocus,
columnMapping = {},
error = null,
formatter = {},
columnWidths = {
[searchResultListColumns.SELECT]: { min: 30, max: 30 },
[searchResultListColumns.AUTH_REF_TYPE]: { min: 200 },
[searchResultListColumns.HEADING_REF]: { min: 400 },
[searchResultListColumns.HEADING_TYPE]: { min: 200 },
},
hidePageIndices = false,
hasNextPage = null,
hasPrevPage = null,
itemToView = null,
onRowFocus = null,
onHeaderClick = null,
showSortIndicator = false,
sortableColumns = [],
sortedColumn = null,
sortOrder = null,
totalResults = NaN,
nonInteractiveHeaders = [],
}) => {
const intl = useIntl();
const [selectedAuthorityRecord, setSelectedAuthorityRecord] = useContext(SelectedAuthorityRecordContext);
Expand Down Expand Up @@ -219,28 +224,4 @@ const SearchResultsList = ({

SearchResultsList.propTypes = propTypes;

SearchResultsList.defaultProps = {
columnMapping: {},
error: null,
formatter: {},
columnWidths: {
[searchResultListColumns.SELECT]: { min: 30, max: 30 },
[searchResultListColumns.AUTH_REF_TYPE]: { min: 200 },
[searchResultListColumns.HEADING_REF]: { min: 400 },
[searchResultListColumns.HEADING_TYPE]: { min: 200 },
},
hidePageIndices: false,
hasNextPage: null,
hasPrevPage: null,
itemToView: null,
onRowFocus: null,
onHeaderClick: null,
showSortIndicator: false,
sortableColumns: [],
sortedColumn: null,
sortOrder: null,
totalResults: NaN,
nonInteractiveHeaders: [],
};

export default SearchResultsList;
20 changes: 6 additions & 14 deletions lib/SearchTextareaField/SearchTextareaField.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ const propTypes = {
};

const SearchTextareaField = ({
className,
id,
value,
loading,
searchableIndexes,
placeholder,
disabled,
onSubmitSearch,
textAreaRef,
disabled = false,
loading = false,
className = '',
placeholder = '',
textAreaRef = null,
value = '',
...rest
}) => {
const intl = useIntl();
Expand Down Expand Up @@ -112,13 +112,5 @@ const SearchTextareaField = ({
};

SearchTextareaField.propTypes = propTypes;
SearchTextareaField.defaultProps = {
disabled: false,
loading: false,
className: '',
placeholder: '',
textAreaRef: null,
value: '',
};

export default SearchTextareaField;
Loading

0 comments on commit eda8e15

Please sign in to comment.