Skip to content

Commit

Permalink
chore: make clearFilter available
Browse files Browse the repository at this point in the history
  • Loading branch information
matbmapspeople committed Sep 18, 2024
1 parent 73cefe8 commit 0a20f90
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 2 deletions.
6 changes: 6 additions & 0 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [13.20.4] - 2024-09-18

### Changed

- `clearFilter` function for `mi-dropdown` is public and can be used outside the component.

## [13.20.3] - 2024-09-18

### Added
Expand Down
4 changes: 4 additions & 0 deletions packages/components/src/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,10 @@ export namespace Components {
"unit": UnitSystem;
}
interface MiDropdown {
/**
* Clear filter.
*/
"clearFilter": () => Promise<void>;
/**
* Sets the disabled state for the dropdown.
*/
Expand Down
5 changes: 3 additions & 2 deletions packages/components/src/components/dropdown/dropdown.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, Element, Event, EventEmitter, Host, JSX, Prop, State, Watch, Listen, h } from '@stencil/core';
import { Component, Element, Event, EventEmitter, Host, JSX, Prop, State, Watch, Listen, h, Method } from '@stencil/core';
import fuzzysort from 'fuzzysort';
import { SortOrder } from '../../enums/sort-order.enum';

Expand Down Expand Up @@ -499,7 +499,8 @@ export class Dropdown {
/**
* Clear filter.
*/
clearFilter(): void {
@Method()
public clearFilter(): void {
if (this.filterElement) {
this.filterElement.value = '';
this.filterElement.focus();
Expand Down
13 changes: 13 additions & 0 deletions packages/components/src/components/dropdown/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,19 @@ mi-dropdown::part(button) {
| `change` | Triggers an event when the selection is changed. | `CustomEvent<any>` |


## Methods

### `clearFilter() => Promise<void>`

Clear filter.

#### Returns

Type: `Promise<void>`




## Shadow Parts

| Part | Description |
Expand Down

0 comments on commit 0a20f90

Please sign in to comment.