-
Notifications
You must be signed in to change notification settings - Fork 478
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 4. Adding support for regexp
- Loading branch information
Showing
37 changed files
with
1,000 additions
and
141 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 @@ | ||
export type TuiArrayOrValue<T> = T | readonly T[]; |
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,5 @@ | ||
import type {TuiArrayOrValue} from '@taiga-ui/cdk/types'; | ||
|
||
export function tuiToArray<T>(value: TuiArrayOrValue<T>): readonly T[] { | ||
return value instanceof Array ? 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
3 changes: 3 additions & 0 deletions
3
projects/demo/src/modules/directives/highlight/examples/1/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
26 changes: 26 additions & 0 deletions
26
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,26 @@ | ||
<tui-input | ||
tuiTextfieldIconLeft="tuiIconSearchLarge" | ||
[(ngModel)]="search" | ||
> | ||
Search | ||
</tui-input> | ||
<table | ||
tuiHighlightMultiOccurrences | ||
class="tui-space_top-4" | ||
[tuiHighlight]="search" | ||
> | ||
<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> |
20 changes: 20 additions & 0 deletions
20
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,20 @@ | ||
:host { | ||
display: block; | ||
--tui-highlight-background: var(--tui-primary); | ||
--tui-highlight-radius: 5px; | ||
--tui-highlight-color: var(--tui-base-01); | ||
} | ||
|
||
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'], | ||
encapsulation, | ||
changeDetection, | ||
}) | ||
export class TuiHighlightExample2 { | ||
protected search = ''; | ||
|
||
protected 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'], | ||
]; | ||
} |
20 changes: 20 additions & 0 deletions
20
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,20 @@ | ||
<table | ||
tuiHighlightMultiOccurrences | ||
class="tui-space_top-4" | ||
[tuiHighlight]="regexp" | ||
> | ||
<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> |
20 changes: 20 additions & 0 deletions
20
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,20 @@ | ||
:host { | ||
display: block; | ||
--tui-highlight-background: var(--tui-primary); | ||
--tui-highlight-radius: 5px; | ||
--tui-highlight-color: var(--tui-base-01); | ||
} | ||
|
||
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'], | ||
encapsulation, | ||
changeDetection, | ||
}) | ||
export class TuiHighlightExample3 { | ||
protected 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'], | ||
]; | ||
|
||
protected readonly regexp = [/S[a-z]+/g, /A[a-z]+/g]; | ||
} |
20 changes: 20 additions & 0 deletions
20
projects/demo/src/modules/directives/highlight/examples/4/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,20 @@ | ||
<table | ||
tuiHighlightMultiOccurrences | ||
class="tui-space_top-4" | ||
[tuiHighlight]="search | tuiToRegexp" | ||
> | ||
<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> |
20 changes: 20 additions & 0 deletions
20
projects/demo/src/modules/directives/highlight/examples/4/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,20 @@ | ||
:host { | ||
display: block; | ||
--tui-highlight-background: var(--tui-primary); | ||
--tui-highlight-radius: 5px; | ||
--tui-highlight-color: var(--tui-base-01); | ||
} | ||
|
||
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; | ||
} |
23 changes: 23 additions & 0 deletions
23
projects/demo/src/modules/directives/highlight/examples/4/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,23 @@ | ||
import {Component} from '@angular/core'; | ||
import {changeDetection} from '@demo/emulate/change-detection'; | ||
import {encapsulation} from '@demo/emulate/encapsulation'; | ||
|
||
@Component({ | ||
selector: 'tui-highlight-example-4', | ||
templateUrl: './index.html', | ||
styleUrls: ['./index.less'], | ||
encapsulation, | ||
changeDetection, | ||
}) | ||
export class TuiHighlightExample4 { | ||
protected 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'], | ||
]; | ||
|
||
/* cspell:disable-next-line */ | ||
protected readonly search = ['Sir', 'Arrested', 'killed']; | ||
} |
4 changes: 2 additions & 2 deletions
4
projects/demo/src/modules/directives/highlight/examples/import/import-module.md
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
2 changes: 1 addition & 1 deletion
2
projects/demo/src/modules/directives/highlight/examples/import/insert-template.md
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,7 +1,7 @@ | ||
```html | ||
<div | ||
class="block" | ||
[tuiHighlight]="query" | ||
[tuiHighlightColor]="'#228B22'" | ||
> | ||
... | ||
</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
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
Oops, something went wrong.