alfresco-ng2-components/docs/search-control.component.md
Vito 4ac523df11 [ADF-1761] Search component refactoring (#2623)
* [ADF-1761] refactoring search

* [ADF-1761] added click exit strategy and selection for list items

* [ADF-1761] removed old search component replaced with the new implementation

* [ADF-1761] removed old component and replaced with the refactored version

* [ADF-1761] added the new tests for search control component

* [ADF-1761] added test for refactored search component

* [ADF-1761] fixed minor twitch start styling the list

* [ADF-1761] fixed test

* [ADF-1761] removed unused import

* [ADF-1761] added search integrations with files component

* [ADF-1761] rebased branch on lates development

* [ADF-1761] added blur management for search

* [ADF-1761] fixed wrong behaviour on blur

* [ADF - 1761] fixed responsiveness on smaller resolution

* [ADF-1761] reduced font and added white line

* [ADF-1761] fixed some blur behaviour

* [ADF-1761] added some fix for on blur behaviour

* [ADF-1761] fixed some behaviour on blur

* [ADF-1761] fix for angular 5

* [ADF-1761] changed name from search integration to search result into demoshell

* [ADF-1761] fixed wrong change name

* [ADF-1761] added documentation for search control component

* [ADF-1761] added documentation for search component

* [ADF-1761] fixed wrong link into documentation

* [ADF-1761] fixed image for simple example

* [ADF-1761] added some improvements and removed duplicated code

* [ADF-1761] renamed directive to searchAutocomplete

* [ADF-1761] added some changes after Peer review
2017-11-09 19:24:38 +00:00

2.7 KiB

Search component

Displays a input text which shows find-as-you-type suggestions.

adf-search-control

Basic usage

<adf-search-control 
    [highlight]="true"
    (optionClicked)="onItemClicked($event)"
    (submit)="onSearchSubmit($event)">
</adf-search-control>

Properties

Name Type Default Description
searchTerm string Search term to pre-populate the field with
inputType string "text" Type of the input field to render, e.g. "search" or "text" (default)
autocomplete boolean true Whether the browser should offer field auto-completion for the input field to the user.
highlight boolean false Use the true value if you want to see the searched word highlighted.
expandable boolean true Whether to use an expanding search control, if false then a regular input is used.
liveSearchEnabled boolean true Whether find-as-you-type suggestions should be offered for matching content items. Set to false to disable.
liveSearchRoot string "-root-" NodeRef or node name where the search should start.
liveSearchResultType string Node type to filter live search results by, e.g. 'cm:content'.
liveSearchMaxResults number 5 Maximum number of results to show in the live search.
liveSearchResultSort string Criteria to sort live search results by, must be one of "name" , "modifiedAt" or "createdAt"

Events

Name Description
searchChange Emitted when the search term is changed. The search term is provided in the 'value' property of the returned object. If the term is less than three characters in length then the term is truncated to an empty string.
submit Emitted when the search is submitted pressing ENTER button. The search term is provided as value of the event.
optionClicked Emitted when a file item from the list of find-as-you-type results is selected

Details

<adf-search-control 
    [highlight]="true"
    (optionClicked)="onItemClicked($event)"
    (submit)="onSearchSubmit($event)">
</adf-search-control>

Example of a component that uses the search control. In this example the search term is simply logged to the console but instead the component could emit an event to be consumed upstream, or it could trigger a change inside a search results component embedded inside the same component.