Skip to content

Commit

Permalink
Merge pull request #1037 from Infineon/1023-multi-select-implement-a-…
Browse files Browse the repository at this point in the history
…show-search-prop

Multiselect: implemented search-enabled prop
  • Loading branch information
tishoyanchev authored Mar 8, 2024
2 parents d04e50e + ff41904 commit e45cc80
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 16 deletions.
1 change: 1 addition & 0 deletions packages/components-vue/lib/components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ export const IfxMultiselect = /*@__PURE__*/ defineContainer<JSX.IfxMultiselect>(
'label',
'placeholder',
'maxItemCount',
'searchEnabled',
'ifxSelect',
'ifxMultiselectIsOpen'
]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,12 @@ export default {
size: "m",
batchSize: 10,
maxItemCount: 10,
searchEnabled: true,
error: false,
errorMessage: 'Some error',
label: '',
disabled: false,
placeholder: 'Placeholder'


},
argTypes: {
size: {
Expand Down Expand Up @@ -72,6 +71,11 @@ export default {
options: [true, false],
control: { type: 'radio' },
},
searchEnabled: {
name: 'Enable search',
options: [true, false],
control: { type: 'radio' }
},
error: {
name: 'Error',
options: [true, false],
Expand Down Expand Up @@ -117,7 +121,8 @@ const DefaultTemplate = (args) => {
error-message='${args.errorMessage}'
label='${args.label}'
placeholder='${args.placeholder}'
disabled='${args.disabled}'>
disabled='${args.disabled}'
search-enabled='${args.searchEnabled}'>
</ifx-multiselect>`;

setTimeout(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export class Multiselect {
@State() isLoading: boolean = false;
@State() loadedOptions: Option[] = [];
@State() filteredOptions: Option[] = [];

@Prop() searchEnabled: boolean = true


@Event() ifxSelect: EventEmitter;
Expand Down Expand Up @@ -488,7 +488,7 @@ export class Multiselect {
<div class="ifx-multiselect-dropdown-menu"
onScroll={(event) => this.handleScroll(event)}
style={{ '--dynamic-z-index': this.zIndex.toString() }}>
<input type="text" role="textbox" class="search-input" onInput={(event) => this.handleSearch(event.target)} placeholder="Search..."></input>
{this.searchEnabled && <input type="text" role="textbox" class="search-input" onInput={(event) => this.handleSearch(event.target)} placeholder="Search..."></input>}
{this.filteredOptions.map((option, index) => this.renderOption(option, index))}
{this.isLoading && <div>Loading more options...</div>}
</div>
Expand Down
23 changes: 12 additions & 11 deletions packages/components/src/components/select/multi-select/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,18 @@

## Properties

| Property | Attribute | Description | Type | Default |
| -------------- | ---------------- | ----------- | ----------------- | ----------------- |
| `batchSize` | `batch-size` | | `number` | `50` |
| `disabled` | `disabled` | | `boolean` | `false` |
| `error` | `error` | | `boolean` | `false` |
| `errorMessage` | `error-message` | | `string` | `"Error"` |
| `label` | `label` | | `string` | `""` |
| `maxItemCount` | `max-item-count` | | `number` | `undefined` |
| `options` | `options` | | `any[] \| string` | `undefined` |
| `placeholder` | `placeholder` | | `string` | `""` |
| `size` | `size` | | `string` | `'medium (40px)'` |
| Property | Attribute | Description | Type | Default |
| --------------- | ---------------- | ----------- | ----------------- | ----------------- |
| `batchSize` | `batch-size` | | `number` | `50` |
| `disabled` | `disabled` | | `boolean` | `false` |
| `error` | `error` | | `boolean` | `false` |
| `errorMessage` | `error-message` | | `string` | `"Error"` |
| `label` | `label` | | `string` | `""` |
| `maxItemCount` | `max-item-count` | | `number` | `undefined` |
| `options` | `options` | | `any[] \| string` | `undefined` |
| `placeholder` | `placeholder` | | `string` | `""` |
| `searchEnabled` | `search-enabled` | | `boolean` | `true` |
| `size` | `size` | | `string` | `'medium (40px)'` |


## Events
Expand Down

0 comments on commit e45cc80

Please sign in to comment.