@anglr/select 17.0.0-beta.20260702112309 → 17.0.0
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/package.json +1 -1
- package/readme.md +42 -2
- package/version.bak +1 -1
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -36,6 +36,7 @@ Angular component representing an HTML `<select>`. Fully plugin-based and signal
|
|
|
36
36
|
- [Multiple Select](#multiple-select)
|
|
37
37
|
- [Edit / Type-ahead Mode](#edit--type-ahead-mode)
|
|
38
38
|
- [Live Search (Filter)](#live-search-filter)
|
|
39
|
+
- [Search Highlighting](#search-highlighting)
|
|
39
40
|
- [Custom Templates](#custom-templates)
|
|
40
41
|
- [Lazy / Dynamic Options](#lazy--dynamic-options)
|
|
41
42
|
- [Dynamic Options with Remote Data](#dynamic-options-with-remote-data)
|
|
@@ -274,6 +275,9 @@ export class MyComponent
|
|
|
274
275
|
| `NormalStateTagTemplate` | `[normalStateTagTemplate]` | Custom template for individual tags in multi-select normal state |
|
|
275
276
|
| `OptionTemplate` | `[optionTemplate]` | Custom template for each option in the popup |
|
|
276
277
|
| `OptionGroupTemplate` | `[optionGroupTemplate]` | Custom template for option group headers |
|
|
278
|
+
| `HighlightInstance` | `[highlightInstance]` | Manages `::highlight(search-query)` CSS Highlight API ranges for the popup (bound to `SimplePopup`) |
|
|
279
|
+
| `HighlightSearch` | `[highlightSearch]` | Attached to a popup option element; produces `Range` objects for every occurrence of the live-search query in its text nodes |
|
|
280
|
+
| `HighlightText` | `[highlightText]` | Marks an inner element inside a custom `optionTemplate` whose text should participate in search highlighting (nested under `HighlightSearch`) |
|
|
277
281
|
| `WithDirectAccess` | `ng-select[withDirectAccess]` | Two-way value binding without a form control |
|
|
278
282
|
|
|
279
283
|
---
|
|
@@ -324,7 +328,7 @@ Every plugin implements the `SelectPlugin` base interface and receives:
|
|
|
324
328
|
| **LiveSearch** | `NoLiveSearch` | `FilterLiveSearch`, `EditLiveSearch` | Text-based filtering of options |
|
|
325
329
|
| **NormalState** | `SimpleNormalState` | `EditNormalState` | Closed-state appearance (value, caret, cancel button) |
|
|
326
330
|
| **OptionsHandler** | `SimpleOptionsHandler` | `NoOptionsHandler` | Options list management, filtering, add-new-option |
|
|
327
|
-
| **Popup** | `SimplePopup` | — | Dropdown panel rendering |
|
|
331
|
+
| **Popup** | `SimplePopup` | — | Dropdown panel rendering (supports live-search text highlighting via the CSS Highlight API) |
|
|
328
332
|
| **Positioner** | `CommonPositioner` | `PopoverPositioner`, `NoPositioner` | Popup positioning (z-index, absolute, popover API) |
|
|
329
333
|
| **ReadonlyState** | *(same as NormalState)* | Custom component | Display when readonly |
|
|
330
334
|
| **ValueHandler** | `StaticValueHandler` | `DynamicValueHandler` | Selected value storage, single/multi-select logic |
|
|
@@ -504,7 +508,8 @@ effect(() =>
|
|
|
504
508
|
|
|
505
509
|
| Pipe | Pure | Description |
|
|
506
510
|
|---|---|---|
|
|
507
|
-
| `displayValue` | No | Transforms `SelectOption` or `SelectOption[]` into a display string |
|
|
511
|
+
| `displayValue` | No | Transforms `SelectOption` or `SelectOption[]` into a display string (for normal/readonly state) |
|
|
512
|
+
| `displayOptionValue` | No | Transforms a single `SelectOption` shown in the popup into a display string; falls back to `displaySelectedValue` when `displayOptionValue` is not configured on `SelectBusOptions` |
|
|
508
513
|
| `hasValue` | Yes | Returns `true` when the option(s) represent a selected value |
|
|
509
514
|
| `getPlugin` | Yes | Retrieves a typed plugin instance from another plugin |
|
|
510
515
|
| `addNewOption` | Yes | Produces the "add new option" label for synthetic options |
|
|
@@ -576,6 +581,8 @@ All visual aspects are driven by CSS custom properties. Here are the key ones:
|
|
|
576
581
|
| `--select-popup-container-borderColor` | `#acacac` | Popup border |
|
|
577
582
|
| `--select-popup-option-active-background` | *(derived from container)* | Hovered option |
|
|
578
583
|
| `--select-popup-option-selected-background` | *(derived from container)* | Selected option |
|
|
584
|
+
| `--select-popup-option-searchHighlight-textDecoration` | `underline` | Decoration applied to `::highlight(search-query)` matches inside the popup |
|
|
585
|
+
| `--select-popup-option-searchHighlight-textShadow` | `0 0 2px hsl(from currentColor h s 45%)` | Shadow applied to `::highlight(search-query)` matches inside the popup |
|
|
579
586
|
|
|
580
587
|
**Live Search**
|
|
581
588
|
|
|
@@ -886,6 +893,39 @@ export class LiveSearchSampleComponent
|
|
|
886
893
|
</ng-select>
|
|
887
894
|
```
|
|
888
895
|
|
|
896
|
+
### Search Highlighting
|
|
897
|
+
|
|
898
|
+
For custom option templates, wrap the highlightable spans with the `HighlightText` directive so nested text nodes are registered with the parent `HighlightSearch`:
|
|
899
|
+
|
|
900
|
+
```typescript
|
|
901
|
+
import {HighlightText, NormalStateTemplate, Option, OptionTemplate, Select} from '@anglr/select';
|
|
902
|
+
|
|
903
|
+
@Component(
|
|
904
|
+
{
|
|
905
|
+
imports:
|
|
906
|
+
[
|
|
907
|
+
Select,
|
|
908
|
+
Option,
|
|
909
|
+
HighlightText,
|
|
910
|
+
OptionTemplate,
|
|
911
|
+
NormalStateTemplate,
|
|
912
|
+
],
|
|
913
|
+
})
|
|
914
|
+
export class HighlightedTemplateComponent { /* ... */ }
|
|
915
|
+
```
|
|
916
|
+
|
|
917
|
+
```html
|
|
918
|
+
<ng-select [selectOptions]="selectOptions" [formField]="field">
|
|
919
|
+
<ng-option value="a" text="Apple"/>
|
|
920
|
+
<ng-option value="b" text="Banana"/>
|
|
921
|
+
|
|
922
|
+
<span *optionTemplate="let option">
|
|
923
|
+
<strong>{{ option.value() }}</strong>
|
|
924
|
+
<span highlightText> - {{ option.text() }}</span>
|
|
925
|
+
</span>
|
|
926
|
+
</ng-select>
|
|
927
|
+
```
|
|
928
|
+
|
|
889
929
|
### Custom Templates
|
|
890
930
|
|
|
891
931
|
Use `[normalStateTemplate]` and `[optionTemplate]` to completely customize rendering:
|
package/version.bak
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
17.0.0
|
|
1
|
+
17.0.0
|