-
Notifications
You must be signed in to change notification settings - Fork 476
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1. Adding support for multiple occurrences 2. Adding support for multiple highlights 3. Adding support for case-sensitive mode
- Loading branch information
Showing
15 changed files
with
449 additions
and
61 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
27 changes: 27 additions & 0 deletions
27
projects/demo/src/modules/directives/highlight/examples/2/index.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,27 @@ | ||
<tui-input | ||
tuiTextfieldIconLeft="tuiIconSearchLarge" | ||
[(ngModel)]="search" | ||
> | ||
Search | ||
</tui-input> | ||
<table | ||
class="tui-space_top-4" | ||
[tuiHighlight]="search" | ||
[tuiHighlightColor]="'#228B22'" | ||
[tuiHighlightMultiOccurrences]="true" | ||
> | ||
<thead> | ||
<tr> | ||
<th>Member</th> | ||
<th>Nickname</th> | ||
<th>Fate</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr *ngFor="let row of rows"> | ||
<td *ngFor="let cell of row"> | ||
{{ cell }} | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> |
17 changes: 17 additions & 0 deletions
17
projects/demo/src/modules/directives/highlight/examples/2/index.less
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,17 @@ | ||
:host { | ||
display: block; | ||
} | ||
|
||
table { | ||
width: 100%; | ||
border-spacing: 0; | ||
} | ||
|
||
th, | ||
td { | ||
text-align: left; | ||
border: 1px solid var(--tui-base-03); | ||
height: 3.375rem; | ||
padding: 0 1rem; | ||
vertical-align: middle; | ||
} |
22 changes: 22 additions & 0 deletions
22
projects/demo/src/modules/directives/highlight/examples/2/index.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,22 @@ | ||
import {Component} from '@angular/core'; | ||
import {changeDetection} from '@demo/emulate/change-detection'; | ||
import {encapsulation} from '@demo/emulate/encapsulation'; | ||
|
||
@Component({ | ||
selector: 'tui-highlight-example-2', | ||
templateUrl: './index.html', | ||
styleUrls: ['./index.less'], | ||
changeDetection, | ||
encapsulation, | ||
}) | ||
export class TuiHighlightExample2 { | ||
search = ''; | ||
|
||
readonly rows = [ | ||
['King Arthur', '-', 'Arrested'], | ||
['Sir Bedevere', 'The Wise', 'Arrested'], | ||
['Sir Lancelot', 'The Brave', 'Arrested'], | ||
['Sir Galahad', 'The Chaste', 'Killed'], | ||
['Sir Robin', 'The Not-Quite-So-Brave-As-Sir-Lancelot', 'Killed'], | ||
]; | ||
} |
21 changes: 21 additions & 0 deletions
21
projects/demo/src/modules/directives/highlight/examples/3/index.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,21 @@ | ||
<table | ||
class="tui-space_top-4" | ||
[tuiHighlight]="regexp" | ||
[tuiHighlightColor]="'#228B22'" | ||
[tuiHighlightMultiOccurrences]="true" | ||
> | ||
<thead> | ||
<tr> | ||
<th>Member</th> | ||
<th>Nickname</th> | ||
<th>Fate</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr *ngFor="let row of rows"> | ||
<td *ngFor="let cell of row"> | ||
{{ cell }} | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> |
17 changes: 17 additions & 0 deletions
17
projects/demo/src/modules/directives/highlight/examples/3/index.less
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,17 @@ | ||
:host { | ||
display: block; | ||
} | ||
|
||
table { | ||
width: 100%; | ||
border-spacing: 0; | ||
} | ||
|
||
th, | ||
td { | ||
text-align: left; | ||
border: 1px solid var(--tui-base-03); | ||
height: 3.375rem; | ||
padding: 0 1rem; | ||
vertical-align: middle; | ||
} |
22 changes: 22 additions & 0 deletions
22
projects/demo/src/modules/directives/highlight/examples/3/index.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,22 @@ | ||
import {Component} from '@angular/core'; | ||
import {changeDetection} from '@demo/emulate/change-detection'; | ||
import {encapsulation} from '@demo/emulate/encapsulation'; | ||
|
||
@Component({ | ||
selector: 'tui-highlight-example-3', | ||
templateUrl: './index.html', | ||
styleUrls: ['./index.less'], | ||
changeDetection, | ||
encapsulation, | ||
}) | ||
export class TuiHighlightExample3 { | ||
readonly rows = [ | ||
['King Arthur', '-', 'Arrested'], | ||
['Sir Bedevere', 'The Wise', 'Arrested'], | ||
['Sir Lancelot', 'The Brave', 'Arrested'], | ||
['Sir Galahad', 'The Chaste', 'Killed'], | ||
['Sir Robin', 'The Not-Quite-So-Brave-As-Sir-Lancelot', 'Killed'], | ||
]; | ||
|
||
readonly regexp = [/S[a-z]+/g, /A[a-z]+/g]; | ||
} |
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 @@ | ||
import {ChangeDetectionStrategy, Component, HostBinding} from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'tui-highlight', | ||
template: '', | ||
styleUrls: ['./highlight.style.less'], | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
}) | ||
export class TuiHighlightComponent { | ||
@HostBinding('style.left.px') | ||
left = NaN; | ||
|
||
@HostBinding('style.top.px') | ||
top = NaN; | ||
|
||
@HostBinding('style.width.px') | ||
width = NaN; | ||
|
||
@HostBinding('style.height.px') | ||
height = NaN; | ||
} |
Oops, something went wrong.