diff --git a/package.json b/package.json index 8d0061e..83e603c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "focus-search", - "version": "3.0.1-beta1", + "version": "3.0.1-beta5", "description": "Serach FOCUS", "main": "src/index.js", "scripts": { diff --git a/src/behaviours/paginate.js b/src/behaviours/paginate.js index e13dfa2..d03e393 100644 --- a/src/behaviours/paginate.js +++ b/src/behaviours/paginate.js @@ -1,6 +1,7 @@ import React, {PropTypes, PureComponent} from 'react'; import {slice, set} from 'lodash'; import Button from 'focus-components/button'; +import i18next from 'i18next'; export default () => { return (ComponentToConnect) => { @@ -28,18 +29,17 @@ export default () => { } render() { const {top} = this.state; - const {totalCount, isOtherAction} = this.props; + const {totalCount, isOtherAction, data} = this.props; return (
-
{top} / {totalCount}
+
{data.length < top ? data.length : top} {i18next.t(`search.paginate.totalCount`)}
- {!isOtherAction &&
-
); } diff --git a/src/behaviours/search.js b/src/behaviours/search.js index 45c3470..61f497e 100644 --- a/src/behaviours/search.js +++ b/src/behaviours/search.js @@ -5,7 +5,7 @@ import {map} from 'lodash/map'; import isArray from 'lodash/isArray'; import isUndefined from 'lodash/isUndefined'; import {loadLine} from '../actions/single-action-creator'; -import {get, set} from 'lodash'; +import {get, set, omit, keys} from 'lodash'; const SEARCH_CONTEXT_TYPE = { @@ -48,10 +48,11 @@ export function getResultsForGroup(groups, searchMetadata){ }); }; -export function getResultsForList(list = [], searchMetadata, listType) { +export function getResultsForList(list = [], searchMetadata, listType, selectedFacet) { const metadatas = extractMedatadas(searchMetadata.getListMetadata(listType, list)); return { ...metadatas, + groupList: metadatas.groupList && metadatas.groupList.reduce((acc, element) => { if(keys(selectedFacet).indexOf(element) === -1) {acc.push(element); } return acc }, [] ), data: list, listType }; @@ -116,10 +117,12 @@ export function connect(searchOptions) { const scope = hasDefinedScopes ? criteriaScope || 'all' : undefined; const hasScope = hasDefinedScopes ? !isUndefined(get(criteria, 'query.scope')) : false; const groupSelect = get(criteria, 'group'); + const selectedFacet = get(criteria, 'selectedFacets') const term = get(criteria, 'query.term'); - const results = hasGroups ? getResultsForGroup(data, searchMetadata) : getResultsForList(data, searchMetadata, listType); + const results = hasGroups ? getResultsForGroup(data, searchMetadata) : getResultsForList(data, searchMetadata, listType, selectedFacet); const facetInformations = facetListWithselectedInformation(this.props); - + console.log(facetInformations) + console.log(selectedFacet) set(results, 'totalCount', totalCount); set(results, 'groupSelect', groupSelect); diff --git a/src/components/searchbar.js b/src/components/searchbar.js index 7e2ff6d..b0feea6 100644 --- a/src/components/searchbar.js +++ b/src/components/searchbar.js @@ -26,9 +26,11 @@ export class SearchBarInput extends PureComponent { if(onChange) onChange({term: value}); } render() { + console.log(this.props.placeholder) return ( @@ -92,7 +94,7 @@ SearchBarScopeSelection.defaultProps = { export default class SearchBar extends PureComponent { render() { - const {hasFocus, onChange, queryAction, queryActionWait, scope, scopeAction, scopes, term} = this.props; + const {hasFocus, onChange, queryAction, queryActionWait, scope, scopeAction, scopes, term, placeholder} = this.props; const hasScopes = scopes && scopes.length > 0; return (
@@ -103,7 +105,7 @@ export default class SearchBar extends PureComponent { scopes={scopes} scope={scope} /> } - +
); }