-
Notifications
You must be signed in to change notification settings - Fork 585
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…fixes #56) * Using string.match not regexp.test * Added stripTags to filtering values * Fixed line breaking on city array * Backed out child filter change * fixed highlights and slect value display * fixed lint errors * Added RichDemo example
- Loading branch information
Showing
6 changed files
with
175 additions
and
16 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
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
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
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,21 @@ | ||
<div style="width: 300px; margin-bottom: 20px;"> | ||
<h3>Select a color</h3> | ||
<ng-select [allowClear]="true" | ||
[items]="items" | ||
[disabled]="disabled" | ||
(data)="refreshValue($event)" | ||
(selected)="selected($event)" | ||
(removed)="removed($event)" | ||
(typed)="typed($event)" | ||
placeholder="No color selected"> | ||
</ng-select> | ||
<p></p> | ||
<pre>{{value.text}}</pre> | ||
<div> | ||
<button type="button" class="btn btn-primary" | ||
[(ngModel)]="disabledV" btnCheckbox | ||
btnCheckboxTrue="1" btnCheckboxFalse="0"> | ||
{{disabled === '1' ? 'Enable' : 'Disable'}} | ||
</button> | ||
</div> | ||
</div> |
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,104 @@ | ||
import { | ||
Component, | ||
OnInit, | ||
ViewEncapsulation | ||
} from 'angular2/core'; | ||
import {CORE_DIRECTIVES, FORM_DIRECTIVES, NgClass} from 'angular2/common'; | ||
import {ButtonCheckbox} from 'ng2-bootstrap/ng2-bootstrap'; | ||
|
||
import {SELECT_DIRECTIVES} from '../../../ng2-select'; | ||
|
||
const COLORS = [ | ||
{ 'name': 'Blue 10', 'hex': '#C0E6FF' }, | ||
{ 'name': 'Blue 20', 'hex': '#7CC7FF' }, | ||
{ 'name': 'Blue 30', 'hex': '#5AAAFA' }, | ||
{ 'name': 'Blue 40', 'hex': '#5596E6' }, | ||
{ 'name': 'Blue 50', 'hex': '#4178BE' }, | ||
{ 'name': 'Blue 60', 'hex': '#325C80' }, | ||
{ 'name': 'Blue 70', 'hex': '#264A60' }, | ||
{ 'name': 'Blue 80', 'hex': '#1D3649' }, | ||
{ 'name': 'Blue 90', 'hex': '#152935' }, | ||
{ 'name': 'Blue 100', 'hex': '#010205' }, | ||
{ 'name': 'Green 10', 'hex': '#C8F08F' }, | ||
{ 'name': 'Green 20', 'hex': '#B4E051' }, | ||
{ 'name': 'Green 30', 'hex': '#8CD211' }, | ||
{ 'name': 'Green 40', 'hex': '#5AA700' }, | ||
{ 'name': 'Green 50', 'hex': '#4B8400' }, | ||
{ 'name': 'Green 60', 'hex': '#2D660A' }, | ||
{ 'name': 'Green 70', 'hex': '#144D14' }, | ||
{ 'name': 'Green 80', 'hex': '#0A3C02' }, | ||
{ 'name': 'Green 90', 'hex': '#0C2808' }, | ||
{ 'name': 'Green 100', 'hex': '#010200' }, | ||
{ 'name': 'Red 10', 'hex': '#FFD2DD' }, | ||
{ 'name': 'Red 20', 'hex': '#FFA5B4' }, | ||
{ 'name': 'Red 30', 'hex': '#FF7D87' }, | ||
{ 'name': 'Red 40', 'hex': '#FF5050' }, | ||
{ 'name': 'Red 50', 'hex': '#E71D32' }, | ||
{ 'name': 'Red 60', 'hex': '#AD1625' }, | ||
{ 'name': 'Red 70', 'hex': '#8C101C' }, | ||
{ 'name': 'Red 80', 'hex': '#6E0A1E' }, | ||
{ 'name': 'Red 90', 'hex': '#4C0A17' }, | ||
{ 'name': 'Red 100', 'hex': '#040001' }, | ||
{ 'name': 'Yellow 10', 'hex': '#FDE876' }, | ||
{ 'name': 'Yellow 20', 'hex': '#FDD600' }, | ||
{ 'name': 'Yellow 30', 'hex': '#EFC100' }, | ||
{ 'name': 'Yellow 40', 'hex': '#BE9B00' }, | ||
{ 'name': 'Yellow 50', 'hex': '#8C7300' }, | ||
{ 'name': 'Yellow 60', 'hex': '#735F00' }, | ||
{ 'name': 'Yellow 70', 'hex': '#574A00' }, | ||
{ 'name': 'Yellow 80', 'hex': '#3C3200' }, | ||
{ 'name': 'Yellow 90', 'hex': '#281E00' }, | ||
{ 'name': 'Yellow 100', 'hex': '#020100' } | ||
]; | ||
|
||
// webpack html imports | ||
let template = require('./rich-demo.html'); | ||
|
||
@Component({ | ||
selector: 'rich-demo', | ||
template: template, | ||
styles: [`colorbox,.colorbox { display:inline-block; height:14px; width:14px;margin-right:4px; border:1px solid #000;}`], | ||
directives: [SELECT_DIRECTIVES, NgClass, CORE_DIRECTIVES, FORM_DIRECTIVES, ButtonCheckbox], | ||
encapsulation: ViewEncapsulation.None // Enable dynamic HTML styles | ||
}) | ||
export class RichDemo implements OnInit { | ||
private value:any = {}; | ||
private _disabledV:string = '0'; | ||
private disabled:boolean = false; | ||
private items:Array<any> = []; | ||
|
||
ngOnInit() { | ||
COLORS.forEach( c => { | ||
this.items.push( { | ||
id : c.hex, | ||
text: `<colorbox style='background-color:${c.hex};'></colorbox>${c.name} (${c.hex})` | ||
}); | ||
}); | ||
} | ||
|
||
private get disabledV():string { | ||
return this._disabledV; | ||
} | ||
|
||
private set disabledV(value:string) { | ||
this._disabledV = value; | ||
this.disabled = this._disabledV === '1'; | ||
} | ||
|
||
private selected(value:any) { | ||
console.log('Selected value is: ', value); | ||
} | ||
|
||
private removed(value:any) { | ||
console.log('Removed value is: ', value); | ||
} | ||
|
||
private typed(value:any) { | ||
console.log('New search input: ', value); | ||
} | ||
|
||
private refreshValue(value:any) { | ||
this.value = value; | ||
} | ||
} | ||
|
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