forked from valor-software/ngx-bootstrap
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #136 from valor-software/development
Allow to dispatch fn traits
- Loading branch information
Showing
13 changed files
with
398 additions
and
109 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<input [(ngModel)]="selected" | ||
[typeahead]="states" | ||
class="form-control"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import { Component } from '@angular/core'; | ||
import { TypeaheadConfig } from 'ngx-bootstrap/typeahead'; | ||
|
||
// such override allows to keep some initial values | ||
export function getTypeaheadConfig(): TypeaheadConfig { | ||
return Object.assign(new TypeaheadConfig(), { hideResultsOnBlur: false }); | ||
} | ||
|
||
@Component({ | ||
selector: 'demo-typeahead-config', | ||
templateUrl: './config.html', | ||
providers: [{ provide: TypeaheadConfig, useFactory: getTypeaheadConfig }] | ||
}) | ||
export class DemoTypeaheadConfigComponent { | ||
selected: string; | ||
states: string[] = [ | ||
'Alabama', | ||
'Alaska', | ||
'Arizona', | ||
'Arkansas', | ||
'California', | ||
'Colorado', | ||
'Connecticut', | ||
'Delaware', | ||
'Florida', | ||
'Georgia', | ||
'Hawaii', | ||
'Idaho', | ||
'Illinois', | ||
'Indiana', | ||
'Iowa', | ||
'Kansas', | ||
'Kentucky', | ||
'Louisiana', | ||
'Maine', | ||
'Maryland', | ||
'Massachusetts', | ||
'Michigan', | ||
'Minnesota', | ||
'Mississippi', | ||
'Missouri', | ||
'Montana', | ||
'Nebraska', | ||
'Nevada', | ||
'New Hampshire', | ||
'New Jersey', | ||
'New Mexico', | ||
'New York', | ||
'North Dakota', | ||
'North Carolina', | ||
'Ohio', | ||
'Oklahoma', | ||
'Oregon', | ||
'Pennsylvania', | ||
'Rhode Island', | ||
'South Carolina', | ||
'South Dakota', | ||
'Tennessee', | ||
'Texas', | ||
'Utah', | ||
'Vermont', | ||
'Virginia', | ||
'Washington', | ||
'West Virginia', | ||
'Wisconsin', | ||
'Wyoming' | ||
]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,100 +1,41 @@ | ||
import { DemoTypeaheadAsyncComponent } from './async/async'; | ||
import { DemoTypeaheadBasicComponent } from './basic/basic'; | ||
import { DemoTypeaheadItemTemplateComponent } from './item-template/item-template'; | ||
import { DemoTypeaheadConfigComponent } from './config/config'; | ||
import { DemoTypeaheadContainerComponent } from './container/container'; | ||
import { DemoTypeaheadDelayComponent } from './delay/delay'; | ||
import { DemoTypeaheadDropupComponent } from './dropup/dropup'; | ||
import { DemoTypeaheadFieldComponent } from './field/field'; | ||
import { DemoTypeaheadAsyncComponent } from './async/async'; | ||
import { DemoTypeaheadReactiveFormComponent } from './reactive-form/reactive-form'; | ||
import { DemoTypeaheadFormComponent } from './form/form'; | ||
import { DemoTypeaheadGroupingComponent } from './grouping/grouping'; | ||
import { DemoTypeaheadDropupComponent } from './dropup/dropup'; | ||
import { DemoTypeaheadScrollableComponent } from './scrollable/scrollable'; | ||
import { DemoTypeaheadDelayComponent } from './delay/delay'; | ||
import { DemoTypeaheadItemTemplateComponent } from './item-template/item-template'; | ||
import { DemoTypeaheadLatinizeComponent } from './latinize/latinize'; | ||
import { DemoTypeaheadNoResultComponent } from './no-result/no-result'; | ||
import { DemoTypeaheadOnBlurComponent } from './on-blur/on-blur'; | ||
import { DemoTypeaheadContainerComponent } from './container/container'; | ||
import { DemoTypeaheadSingleWorldComponent } from './single-world/single-world'; | ||
import { DemoTypeaheadPhraseDelimitersComponent } from './phrase-delimiters/phrase-delimiters'; | ||
import { DemoTypeaheadFormComponent } from './form/form'; | ||
import { DemoTypeaheadOnSelectComponent } from './on-select/on-select'; | ||
import { DemoTypeaheadPhraseDelimitersComponent } from './phrase-delimiters/phrase-delimiters'; | ||
import { DemoTypeaheadReactiveFormComponent } from './reactive-form/reactive-form'; | ||
import { DemoTypeaheadScrollableComponent } from './scrollable/scrollable'; | ||
import { DemoTypeaheadShowOnBlurComponent } from './show-on-blur/show-on-blur'; | ||
import { DemoTypeaheadSingleWorldComponent } from './single-world/single-world'; | ||
|
||
export const DEMO_COMPONENTS = [ | ||
DemoTypeaheadAsyncComponent, | ||
DemoTypeaheadBasicComponent, | ||
DemoTypeaheadItemTemplateComponent, | ||
DemoTypeaheadConfigComponent, | ||
DemoTypeaheadContainerComponent, | ||
DemoTypeaheadDelayComponent, | ||
DemoTypeaheadDropupComponent, | ||
DemoTypeaheadFieldComponent, | ||
DemoTypeaheadAsyncComponent, | ||
DemoTypeaheadReactiveFormComponent, | ||
DemoTypeaheadFormComponent, | ||
DemoTypeaheadGroupingComponent, | ||
DemoTypeaheadSingleWorldComponent, | ||
DemoTypeaheadPhraseDelimitersComponent, | ||
DemoTypeaheadDropupComponent, | ||
DemoTypeaheadScrollableComponent, | ||
DemoTypeaheadDelayComponent, | ||
DemoTypeaheadItemTemplateComponent, | ||
DemoTypeaheadLatinizeComponent, | ||
DemoTypeaheadNoResultComponent, | ||
DemoTypeaheadOnBlurComponent, | ||
DemoTypeaheadLatinizeComponent, | ||
DemoTypeaheadContainerComponent, | ||
DemoTypeaheadFormComponent, | ||
DemoTypeaheadOnSelectComponent | ||
DemoTypeaheadOnSelectComponent, | ||
DemoTypeaheadPhraseDelimitersComponent, | ||
DemoTypeaheadReactiveFormComponent, | ||
DemoTypeaheadScrollableComponent, | ||
DemoTypeaheadShowOnBlurComponent, | ||
DemoTypeaheadSingleWorldComponent | ||
]; | ||
|
||
export const DEMOS = { | ||
static: { | ||
component: require('!!raw-loader?lang=typescript!./basic/basic.ts'), | ||
html: require('!!raw-loader?lang=markup!./basic/basic.html') | ||
}, | ||
itemTemplate: { | ||
component: require('!!raw-loader?lang=typescript!./item-template/item-template.ts'), | ||
html: require('!!raw-loader?lang=markup!./item-template/item-template.html') | ||
}, | ||
field: { | ||
component: require('!!raw-loader?lang=typescript!./field/field.ts'), | ||
html: require('!!raw-loader?lang=markup!./field/field.html') | ||
}, | ||
async: { | ||
component: require('!!raw-loader?lang=typescript!./async/async.ts'), | ||
html: require('!!raw-loader?lang=markup!./async/async.html') | ||
}, | ||
delay: { | ||
component: require('!!raw-loader?lang=typescript!./delay/delay.ts'), | ||
html: require('!!raw-loader?lang=markup!./delay/delay.html') | ||
}, | ||
latinize: { | ||
component: require('!!raw-loader?lang=typescript!./latinize/latinize.ts'), | ||
html: require('!!raw-loader?lang=markup!./latinize/latinize.html') | ||
}, | ||
form: { | ||
component: require('!!raw-loader?lang=typescript!./form/form.ts'), | ||
html: require('!!raw-loader?lang=markup!./form/form.html') | ||
}, | ||
reactiveForm: { | ||
component: require('!!raw-loader?lang=typescript!./reactive-form/reactive-form.ts'), | ||
html: require('!!raw-loader?lang=markup!./reactive-form/reactive-form.html') | ||
}, | ||
grouping: { | ||
component: require('!!raw-loader?lang=typescript!./grouping/grouping.ts'), | ||
html: require('!!raw-loader?lang=markup!./grouping/grouping.html') | ||
}, | ||
dropup: { | ||
component: require('!!raw-loader?lang=typescript!./dropup/dropup.ts'), | ||
html: require('!!raw-loader?lang=markup!./dropup/dropup.html') | ||
}, | ||
noResult: { | ||
component: require('!!raw-loader?lang=typescript!./no-result/no-result.ts'), | ||
html: require('!!raw-loader?lang=markup!./no-result/no-result.html') | ||
}, | ||
onBlur: { | ||
component: require('!!raw-loader?lang=typescript!./on-blur/on-blur.ts'), | ||
html: require('!!raw-loader?lang=markup!./on-blur/on-blur.html') | ||
}, | ||
container: { | ||
component: require('!!raw-loader?lang=typescript!./container/container.ts'), | ||
html: require('!!raw-loader?lang=markup!./container/container.html') | ||
}, | ||
scrollable: { | ||
component: require('!!raw-loader?lang=typescript!./scrollable/scrollable.ts'), | ||
html: require('!!raw-loader?lang=markup!./scrollable/scrollable.html') | ||
}, | ||
onSelect: { | ||
component: require('!!raw-loader?lang=typescript!./on-select/on-select.ts'), | ||
html: require('!!raw-loader?lang=markup!./on-select/on-select.html') | ||
} | ||
}; |
11 changes: 11 additions & 0 deletions
11
demo/src/app/components/+typeahead/demos/show-on-blur/show-on-blur.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<button type="button" class="btn btn-primary mb-3" | ||
(click)="typeaheadHideResultsOnBlur = !typeaheadHideResultsOnBlur">Toggle typeaheadHideResultsOnBlur | ||
</button> | ||
<pre class="card card-block card-header mb-3"> | ||
typeaheadHideResultsOnBlur: {{typeaheadHideResultsOnBlur}} | ||
Model: {{selected | json}} | ||
</pre> | ||
<input [(ngModel)]="selected" | ||
[typeahead]="states" | ||
[typeaheadHideResultsOnBlur]="typeaheadHideResultsOnBlur" | ||
class="form-control"> |
62 changes: 62 additions & 0 deletions
62
demo/src/app/components/+typeahead/demos/show-on-blur/show-on-blur.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import { Component } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'demo-typeahead-show-on-blur', | ||
templateUrl: './show-on-blur.html' | ||
}) | ||
export class DemoTypeaheadShowOnBlurComponent { | ||
typeaheadHideResultsOnBlur = false; | ||
selected: string; | ||
states = [ | ||
'Alabama', | ||
'Alaska', | ||
'Arizona', | ||
'Arkansas', | ||
'California', | ||
'Colorado', | ||
'Connecticut', | ||
'Delaware', | ||
'Florida', | ||
'Georgia', | ||
'Hawaii', | ||
'Idaho', | ||
'Illinois', | ||
'Indiana', | ||
'Iowa', | ||
'Kansas', | ||
'Kentucky', | ||
'Louisiana', | ||
'Maine', | ||
'Maryland', | ||
'Massachusetts', | ||
'Michigan', | ||
'Minnesota', | ||
'Mississippi', | ||
'Missouri', | ||
'Montana', | ||
'Nebraska', | ||
'Nevada', | ||
'New Hampshire', | ||
'New Jersey', | ||
'New Mexico', | ||
'New York', | ||
'North Dakota', | ||
'North Carolina', | ||
'Ohio', | ||
'Oklahoma', | ||
'Oregon', | ||
'Pennsylvania', | ||
'Rhode Island', | ||
'South Carolina', | ||
'South Dakota', | ||
'Tennessee', | ||
'Texas', | ||
'Utah', | ||
'Vermont', | ||
'Virginia', | ||
'Washington', | ||
'West Virginia', | ||
'Wisconsin', | ||
'Wyoming' | ||
]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.