From 41b5de8dbc77aeb4b147fa19b7738e504bce9e44 Mon Sep 17 00:00:00 2001 From: Sorina-Andreea Ocheana Date: Fri, 28 Jun 2024 16:45:53 +0300 Subject: [PATCH] Exposed the placeholder for the select type cells --- .../modus-table/models/modus-table.models.ts | 2 +- .../modus-table-cell-editor.tsx | 2 ++ .../parts/cell/modus-table-cell-editor/readme.md | 16 ++++++++-------- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/stencil-workspace/src/components/modus-table/models/modus-table.models.ts b/stencil-workspace/src/components/modus-table/models/modus-table.models.ts index 435fcacd8..f3c9e7501 100644 --- a/stencil-workspace/src/components/modus-table/models/modus-table.models.ts +++ b/stencil-workspace/src/components/modus-table/models/modus-table.models.ts @@ -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; diff --git a/stencil-workspace/src/components/modus-table/parts/cell/modus-table-cell-editor/modus-table-cell-editor.tsx b/stencil-workspace/src/components/modus-table/parts/cell/modus-table-cell-editor/modus-table-cell-editor.tsx index e35ac683c..f15af5213 100644 --- a/stencil-workspace/src/components/modus-table/parts/cell/modus-table-cell-editor/modus-table-cell-editor.tsx +++ b/stencil-workspace/src/components/modus-table/parts/cell/modus-table-cell-editor/modus-table-cell-editor.tsx @@ -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) { @@ -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) => { diff --git a/stencil-workspace/src/components/modus-table/parts/cell/modus-table-cell-editor/readme.md b/stencil-workspace/src/components/modus-table/parts/cell/modus-table-cell-editor/readme.md index 2fa317ea8..11ed4ccc1 100644 --- a/stencil-workspace/src/components/modus-table/parts/cell/modus-table-cell-editor/readme.md +++ b/stencil-workspace/src/components/modus-table/parts/cell/modus-table-cell-editor/readme.md @@ -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