Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Table: Exposed the placeholder for the select type cells #2657

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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