Skip to content

Commit 685cb53

Browse files
authored
Merge pull request #69 from qualcomm/olaf/combobox-angular-highlight
feat: wire `highlightMatchingText` in angular combobox Signed-off-by: Dustin Pham <dustinpham95@gmail.com>
2 parents 7f8c639 + 34101c8 commit 685cb53

9 files changed

Lines changed: 49 additions & 15 deletions

File tree

packages/docs/angular-docs/src/routes/components+/combobox+/demos/combobox-highlight-demo.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import type {ComboboxInputValueChangeDetails} from "@qualcomm-ui/core/combobox"
66

77
import {countries} from "./country-list"
88

9-
// TODO: highlightMatchingText prop not yet implemented in Angular
109
@Component({
1110
imports: [ComboboxModule],
1211
selector: "combobox-highlight-demo",

packages/frameworks/angular-core/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# @qualcomm-ui/angular-core
22

3+
## 1.1.0 (2025/11/30)
4+
5+
### Features
6+
7+
- wire highlightMatchingText in angular combobox
8+
39
## 1.0.6 (2025/11/25)
410

511
### Miscellaneous Chores

packages/frameworks/angular-core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@qualcomm-ui/angular-core",
33
"description": "Design-agnostic Angular building blocks and utilities.",
4-
"version": "1.0.6",
4+
"version": "1.1.0",
55
"author": "Ryan Bower",
66
"license": "BSD-3-Clause-Clear",
77
"repository": "https://github.com/qualcomm/qualcomm-ui",

packages/frameworks/angular-core/src/highlight/highlight.directive.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ import {highlightWord} from "@qualcomm-ui/utils/highlight-word"
99
@Component({
1010
selector: "[q-highlight]",
1111
standalone: true,
12+
// prevent prettier formatting from introducing whitespaces in the markup
13+
// prettier-ignore
1214
template: `
1315
@for (chunk of chunks(); track $index) {
1416
@if (chunk.match) {
1517
<mark>{{ chunk.text }}</mark>
16-
} @else {
17-
{{ chunk.text }}
18-
}
18+
} @else {{{chunk.text}}}
1919
}
2020
`,
2121
})

packages/frameworks/angular/CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# @qualcomm-ui/angular
22

3+
## 1.6.0 (2025/11/30)
4+
5+
### Features
6+
7+
- wire highlightMatchingText in angular combobox
8+
9+
### Miscellaneous Chores
10+
11+
- **deps:** update dependencies [@qualcomm-ui/angular-core]
12+
313
## 1.5.0 (2025/11/25)
414

515
### Features

packages/frameworks/angular/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@qualcomm-ui/angular",
3-
"version": "1.5.0",
3+
"version": "1.6.0",
44
"author": "Ryan Bower",
55
"license": "BSD-3-Clause-Clear",
66
"description": "QUI Angular Components",
@@ -56,7 +56,7 @@
5656
"@floating-ui/dom": "^1.7.0",
5757
"@jsdevtools/coverage-istanbul-loader": "~3.0.5",
5858
"@module-federation/enhanced": "0.21.2",
59-
"@qualcomm-ui/angular-core": "workspace:^1.0.6",
59+
"@qualcomm-ui/angular-core": "workspace:^1.1.0",
6060
"@qualcomm-ui/cli": "workspace:^1",
6161
"@qualcomm-ui/core": "workspace:^1.0.8",
6262
"@qualcomm-ui/qds-core": "workspace:^1.6.0",
@@ -99,7 +99,7 @@
9999
"@angular/forms": ">=20.1.0 <21",
100100
"@angular/platform-browser": ">=20.1.0 <21",
101101
"@angular/platform-browser-dynamic": ">=20.1.0 <21",
102-
"@qualcomm-ui/angular-core": "workspace:^1.0.6",
102+
"@qualcomm-ui/angular-core": "workspace:^1.1.0",
103103
"@qualcomm-ui/core": "workspace:^1.0.8",
104104
"@qualcomm-ui/qds-core": "workspace:^1.6.0",
105105
"@qualcomm-ui/utils": "workspace:^1.0.3",

packages/frameworks/angular/src/combobox/combobox-items.component.ts

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
22
// SPDX-License-Identifier: BSD-3-Clause-Clear
33

4-
import {Component} from "@angular/core"
4+
import {booleanAttribute, Component, input} from "@angular/core"
55

66
import {useComboboxContext} from "@qualcomm-ui/angular-core/combobox"
7+
import type {Booleanish} from "@qualcomm-ui/utils/coercion"
78

89
@Component({
910
selector: "q-combobox-items",
@@ -21,14 +22,32 @@ import {useComboboxContext} from "@qualcomm-ui/angular-core/combobox"
2122
track comboboxContext().collection.getItemValue(item)
2223
) {
2324
<div q-combobox-item [item]="item">
24-
<span q-combobox-item-text>
25-
{{ comboboxContext().collection.stringifyItem(item) }}
26-
</span>
25+
@if (highlightMatchingText()) {
26+
<span
27+
ignoreCase
28+
q-combobox-item-text
29+
q-highlight
30+
[query]="comboboxContext().inputValue"
31+
[text]="comboboxContext().collection.stringifyItem(item)"
32+
></span>
33+
} @else {
34+
<span q-combobox-item-text>
35+
{{ comboboxContext().collection.stringifyItem(item) }}
36+
</span>
37+
}
2738
<span q-combobox-item-indicator></span>
2839
</div>
2940
}
3041
`,
3142
})
3243
export class ComboboxItemsComponent {
44+
/**
45+
* Set to `true` to highlight option text matches during filtering.
46+
*/
47+
readonly highlightMatchingText = input<boolean | undefined, Booleanish>(
48+
undefined,
49+
{transform: booleanAttribute},
50+
)
51+
3352
protected readonly comboboxContext = useComboboxContext()
3453
}

packages/frameworks/angular/src/combobox/combobox.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ import {provideQdsComboboxContext} from "./qds-combobox-context.service"
9595
ignoreCase
9696
q-combobox-item-text
9797
q-highlight
98-
[query]="inputValue()"
98+
[query]="comboboxContext.context().inputValue"
9999
[text]="collection().stringifyItem(item)"
100100
></span>
101101
} @else {
@@ -125,7 +125,7 @@ import {provideQdsComboboxContext} from "./qds-combobox-context.service"
125125
ignoreCase
126126
q-combobox-item-text
127127
q-highlight
128-
[query]="inputValue()"
128+
[query]="comboboxContext.context().inputValue"
129129
[text]="collection().stringifyItem(item)"
130130
></span>
131131
} @else {

pnpm-lock.yaml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)