Skip to content

Commit

Permalink
1444 split select & autocomplete
Browse files Browse the repository at this point in the history
  • Loading branch information
atlwendy authored and benjamincharity committed Jun 5, 2019
1 parent d237269 commit 314df47
Show file tree
Hide file tree
Showing 55 changed files with 3,079 additions and 3,256 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ for each feature.
| Feature | Notes | Status | Demo | Docs | Usage |
|----------------------------------------|-----------------------------------------------------------|:------------------:|---------------------------------|------------------------------|--------------------------------|
| alert | | | | | |
| [autocomplete][src-autocomplete] | Deprecated in favor of the new `TsInputComponent` | :hankey: | [Demo][demo-autocomplete] | [Docs][autocomplete-docs] | [Usage][autocomplete-usage] |
| [autocomplete][src-autocomplete] | | :white_check_mark: | [Demo][demo-autocomplete] | [Docs][autocomplete-docs] | [Usage][autocomplete-usage] |
| [autofocus][src-autofocus] | Focus a focusable element on load | :white_check_mark: | [Demo][demo-autofocus] | [Docs][autofocus-docs] | [Usage][autofocus-usage] |
| badge | | | | | |
| [button][src-button] | | :white_check_mark: | [Demo][demo-button] | [Docs][button-docs] | |
Expand Down
88 changes: 34 additions & 54 deletions demo/app/components/autocomplete/autocomplete.component.html
Original file line number Diff line number Diff line change
@@ -1,61 +1,41 @@
<ts-card tsVerticalSpacing>
<h3 tsCardTitle tsVerticalSpacing="small--0">Demo Controls</h3>

<div tsVerticalSpacing>
<ts-checkbox [(ngModel)]="delayApiResponse" tsVerticalSpacing>
Delay API response
</ts-checkbox>
<ts-card tsVerticalSpacing fxFlex>
<form
novalidate
fxLayout="column"
fxLayout.gt-sm="row"
fxLayoutGap="1rem"
>
<h3 tsCardTitle tsVerticalSpacing="small--1">
Autocomplete
</h3>

<div>
<label>
Minimum characters required:
<input type="text" [(ngModel)]="minCharacters">
</label>
</div>
</div>

<div>
<button (click)="updateSelections()">Dynamically update selections</button>
<br>
<button (click)="log(myForm.value)">Log form value</button>
</div>
</ts-card>

<ts-card>
<form name="myForm" novalidate>
<ts-autocomplete
label="Autocomplete Example"
hint="Begin typing to select.."
[formControl]="stateCtrl"
[allowMultiple]="true"
[allowDuplicateSelections]="true"
[reopenAfterSelection]="false"
[showProgress]="fakeAsync"
(queryChange)="queryHasChanged($event)"
(duplicateSelection)="duplicate($event)"
tsVerticalSpacing
[options]="users$ | async"
[selectionsControl]="myForm.get('selections')"
[displayWith]="displayFn"
[initialSelections]="null"
[minimumCharacters]="minCharacters"
[showProgress]="inProgress"
label="Single selection"
hint="Begin typing to search..."
theme="primary"
(optionSelected)="added($event)"
(optionRemoved)="removed($event)"
(selection)="selection($event)"
#auto="tsAutocomplete"
></ts-autocomplete>
>

<ts-autocomplete
tsVerticalSpacing
[options]="users$ | async"
[selectionsControl]="myForm.get('selectionsMultiple')"
[displayWith]="displayFn"
[initialSelections]="null"
[minimumCharacters]="minCharacters"
[multiple]="comparator"
[showProgress]="inProgress"
label="Multiple selections"
hint="Begin typing to search..."
theme="primary"
(optionSelected)="added($event)"
(optionRemoved)="removed($event)"
(selection)="selection($event)"
#auto="tsAutocomplete"
></ts-autocomplete>
<ts-option
[value]="state.name"
[option]="state"
*ngFor="let state of filteredStates | async"
>
{{ state.name }}
</ts-option>

</ts-autocomplete>

<div>
FormControl value: {{ stateCtrl.value | json }}
</div>
</form>
</ts-card>

Loading

0 comments on commit 314df47

Please sign in to comment.