@tejaskedare/search-highlight-pipe 1.0.1 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +69 -34
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,63 +1,98 @@
|
|
|
1
|
-
#
|
|
1
|
+
# 🔍 Angular Search Highlight Pipe
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A lightweight Angular pipe to highlight search text dynamically in UI.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
---
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
## 📦 Installation
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
|
-
|
|
10
|
+
npm install @tejaskedare/search-highlight-pipe
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
---
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
## 🚀 Usage
|
|
16
|
+
|
|
17
|
+
### 1. Import (Standalone)
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
import { SearchHighlightPipe } from '@tejaskedare/search-highlight-pipe';
|
|
21
|
+
|
|
22
|
+
@Component({
|
|
23
|
+
standalone: true,
|
|
24
|
+
imports: [SearchHighlightPipe],
|
|
25
|
+
})
|
|
26
|
+
export class AppComponent {}
|
|
17
27
|
```
|
|
18
28
|
|
|
19
|
-
|
|
29
|
+
---
|
|
20
30
|
|
|
21
|
-
|
|
31
|
+
### 2. Use in Template
|
|
22
32
|
|
|
23
|
-
```
|
|
24
|
-
|
|
33
|
+
```html
|
|
34
|
+
<div [innerHTML]="text | searchHighlight: searchTerm"></div>
|
|
25
35
|
```
|
|
26
36
|
|
|
27
|
-
|
|
37
|
+
---
|
|
28
38
|
|
|
29
|
-
|
|
39
|
+
## 🎨 Styling
|
|
30
40
|
|
|
31
|
-
|
|
41
|
+
```css
|
|
42
|
+
.highlight {
|
|
43
|
+
background-color: yellow;
|
|
44
|
+
font-weight: bold;
|
|
45
|
+
}
|
|
46
|
+
```
|
|
32
47
|
|
|
33
|
-
|
|
34
|
-
```bash
|
|
35
|
-
cd dist/text-utils
|
|
36
|
-
```
|
|
48
|
+
---
|
|
37
49
|
|
|
38
|
-
|
|
39
|
-
```bash
|
|
40
|
-
npm publish
|
|
41
|
-
```
|
|
50
|
+
## ⚙️ Features
|
|
42
51
|
|
|
43
|
-
|
|
52
|
+
* Highlights matching text dynamically
|
|
53
|
+
* Case-insensitive search
|
|
54
|
+
* Safe HTML rendering using Angular DomSanitizer
|
|
55
|
+
* Supports custom CSS class
|
|
44
56
|
|
|
45
|
-
|
|
57
|
+
---
|
|
46
58
|
|
|
47
|
-
|
|
48
|
-
|
|
59
|
+
## 🔧 Parameters
|
|
60
|
+
|
|
61
|
+
| Parameter | Type | Description |
|
|
62
|
+
| ---------- | ------ | ------------------------- |
|
|
63
|
+
| value | string | Original text |
|
|
64
|
+
| searchText | string | Text to highlight |
|
|
65
|
+
| className | string | (Optional) CSS class name |
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## 💡 Example
|
|
70
|
+
|
|
71
|
+
```ts
|
|
72
|
+
text = "Angular makes development easier";
|
|
73
|
+
searchTerm = "angular";
|
|
49
74
|
```
|
|
50
75
|
|
|
51
|
-
|
|
76
|
+
👉 Output:
|
|
52
77
|
|
|
53
|
-
|
|
78
|
+
* "Angular" will be highlighted
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## 📁 Package
|
|
54
83
|
|
|
55
|
-
```bash
|
|
56
|
-
ng e2e
|
|
57
84
|
```
|
|
85
|
+
@tejaskedare/search-highlight-pipe
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## 👨💻 Author
|
|
91
|
+
|
|
92
|
+
Tejas Kedare
|
|
58
93
|
|
|
59
|
-
|
|
94
|
+
---
|
|
60
95
|
|
|
61
|
-
##
|
|
96
|
+
## 📜 License
|
|
62
97
|
|
|
63
|
-
|
|
98
|
+
MIT
|