-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* added component * added base handlers for click and focus * added recalculating overlay position after select/deselect * added autocomplete * added example with filtered options * added text-overflow * added tags WIP * added autocomplete in example * base functional WIP SAVE * fixed logic and added examples * fixed focus and review notes * deleted form-field from first example * added tests for autocomplete and tags (not all worked) * added tests * changed placeholder color * A200 added in box-shadow * dark theme in tag-input
- Loading branch information
1 parent
cb254ba
commit 76a98ab
Showing
70 changed files
with
7,849 additions
and
279 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
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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
export * from './dispatch-events'; | ||
export * from './event-objects'; | ||
export * from './type-in-element'; | ||
export * from './element-focus'; | ||
export * from './mock-ng-zone'; | ||
export * from './wrapped-error-message'; |
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,13 @@ | ||
import { dispatchFakeEvent } from './dispatch-events'; | ||
|
||
/** | ||
* Focuses an input, sets its value and dispatches | ||
* the `input` event, simulating the user typing. | ||
* @param value Value to be set on the input. | ||
* @param element Element onto which to set the value. | ||
*/ | ||
export function typeInElement(value: string, element: HTMLInputElement) { | ||
element.focus(); | ||
element.value = value; | ||
dispatchFakeEvent(element, 'input'); | ||
} |
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,75 @@ | ||
import { Component, NgModule, OnInit, ViewEncapsulation } from '@angular/core'; | ||
import { FormControl, FormsModule, ReactiveFormsModule, Validators } from '@angular/forms'; | ||
import { BrowserModule } from '@angular/platform-browser'; | ||
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; | ||
import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; | ||
import { McAutocompleteModule, McAutocompleteSelectedEvent } from '@ptsecurity/mosaic/autocomplete'; | ||
import { McButtonModule } from '@ptsecurity/mosaic/button'; | ||
import { McFormFieldModule } from '@ptsecurity/mosaic/form-field'; | ||
import { McIconModule } from '@ptsecurity/mosaic/icon'; | ||
import { McInputModule } from '@ptsecurity/mosaic/input'; | ||
import { Observable } from 'rxjs'; | ||
import { map, startWith } from 'rxjs/operators'; | ||
|
||
|
||
@Component({ | ||
selector: 'app', | ||
template: require('./template.html'), | ||
styleUrls: ['./styles.scss'], | ||
encapsulation: ViewEncapsulation.None | ||
}) | ||
export class DemoComponent implements OnInit { | ||
options = [ | ||
'One', 'Two', 'Three', 'Four', 'Five', 'Longest text (0123456789 qwertyuiopasdfghjklzxcvbnm)', 'Волгоград', | ||
'Воронеж', 'Ейск', 'Екабпилс', 'Екатеринбург', 'Екатериновка', 'Екатеринославка', 'Екаша', 'Екибастуз', | ||
'Екпинди', 'Елань', 'Елец', 'Казань', 'Краснодар', 'Красноярск', 'Москва', 'Нижний Новгород', 'Новосибирск', | ||
'Омск', 'Пермь', 'Ростов-на-Дону', 'Самара', 'Санкт-Петербург', 'Уфа', 'Челябинск' | ||
]; | ||
|
||
filteredOptions: Observable<string[]>; | ||
|
||
formControl = new FormControl('', Validators.required); | ||
|
||
onSelectionChange($event: McAutocompleteSelectedEvent) { | ||
console.log(`onSelectionChange: ${$event}`); | ||
} | ||
|
||
ngOnInit(): void { | ||
this.filteredOptions = this.formControl.valueChanges | ||
.pipe( | ||
startWith(''), | ||
map((value) => this.filter(value)) | ||
); | ||
} | ||
|
||
private filter(value: string): string[] { | ||
const filterValue = value.toLowerCase(); | ||
|
||
return this.options.filter((option) => option.toLowerCase().includes(filterValue)); | ||
} | ||
|
||
} | ||
|
||
|
||
@NgModule({ | ||
declarations: [DemoComponent], | ||
imports: [ | ||
BrowserAnimationsModule, | ||
BrowserModule, | ||
FormsModule, | ||
McAutocompleteModule, | ||
|
||
McInputModule, | ||
McButtonModule, | ||
McFormFieldModule, | ||
McIconModule, | ||
ReactiveFormsModule | ||
], | ||
bootstrap: [DemoComponent] | ||
}) | ||
export class DemoModule {} | ||
|
||
platformBrowserDynamic() | ||
.bootstrapModule(DemoModule) | ||
.catch((error) => console.error(error)); | ||
|
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,13 @@ | ||
@import '~@ptsecurity/mosaic-icons/dist/styles/mc-icons'; | ||
|
||
@import '../../lib/core/theming/prebuilt/default-theme'; | ||
//@import '../../lib/core/theming/prebuilt/dark-theme'; | ||
|
||
|
||
.dev-container { | ||
width: 300px; | ||
|
||
border: 1px solid red; | ||
|
||
padding: 24px; | ||
} |
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,12 @@ | ||
<br><br><br><br><br><br><br> | ||
|
||
<div style="height: 20px">{{ formControl.value }}</div> | ||
|
||
<div class="dev-container"> | ||
<mc-form-field> | ||
<input type="text" mcInput [mcAutocomplete]="auto" [formControl]="formControl"/> | ||
<mc-autocomplete #auto="mcAutocomplete"> | ||
<mc-option *ngFor="let option of filteredOptions | async" [value]="option">{{ option }}</mc-option> | ||
</mc-autocomplete> | ||
</mc-form-field> | ||
</div> |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.