Skip to content

Commit

Permalink
Exposed the placeholder for the select type cells
Browse files Browse the repository at this point in the history
  • Loading branch information
sorina-ocheana committed Jun 28, 2024
1 parent b370218 commit 41b5de8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export type ModusTableCellEditorType =
| typeof CELL_EDIT_TYPE_DATE;

export type ModusTableCellDateEditorArgs = { format: string };
export type ModusTableCellSelectEditorArgs = { options: unknown[]; optionsDisplayProp?: string };
export type ModusTableCellSelectEditorArgs = { options: unknown[]; optionsDisplayProp?: string; placeholder?: string };
export type ModusTableCellAutocompleteEditorArgs = {
options: ModusAutocompleteOption[];
noResultsFoundText: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ export class ModusTableCellEditor {
const args = this.args as ModusTableCellSelectEditorArgs;
const options = args?.options || [];
const optionsDisplayProp = args?.optionsDisplayProp || valueKey;
const placeholder = args?.placeholder;
const selectedOption = options.find((option) => option[optionsDisplayProp] === this.value) as unknown;

function handleEnter(e: KeyboardEvent, callback: (e: KeyboardEvent) => void) {
Expand All @@ -193,6 +194,7 @@ export class ModusTableCellEditor {
options-display-prop={optionsDisplayProp}
size="large"
options={options}
placeholder={placeholder}
onInputBlur={this.handleBlur}
onKeyDown={(e) => handleEnter(e, this.handleKeyDown)}
onValueChange={(e: CustomEvent<unknown>) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@

## Properties

| Property | Attribute | Description | Type | Default |
| ------------- | ----------- | ----------- | ----------------------------------------------------------------------------- | ----------- |
| `args` | -- | | `{ format: string; } \| { options: unknown[]; optionsDisplayProp?: string; }` | `undefined` |
| `dataType` | `data-type` | | `string` | `undefined` |
| `keyDown` | -- | | `(e: KeyboardEvent, newValue: string) => void` | `undefined` |
| `type` | `type` | | `string` | `undefined` |
| `value` | -- | | `unknown` | `undefined` |
| `valueChange` | -- | | `(newValue: string) => void` | `undefined` |
| Property | Attribute | Description | Type | Default |
| ------------- | ----------- | ----------- | --------------------------------------------------------------------------------------------------- | ----------- |
| `args` | -- | | `{ format: string; } \| { options: unknown[]; optionsDisplayProp?: string; placeholder?: string; }` | `undefined` |
| `dataType` | `data-type` | | `string` | `undefined` |
| `keyDown` | -- | | `(e: KeyboardEvent, newValue: string) => void` | `undefined` |
| `type` | `type` | | `string` | `undefined` |
| `value` | -- | | `unknown` | `undefined` |
| `valueChange` | -- | | `(newValue: string) => void` | `undefined` |


## Dependencies
Expand Down

0 comments on commit 41b5de8

Please sign in to comment.