feat(dees-table): improve inline cell editors with integrated input styling and auto-open dropdowns
This commit is contained in:
@@ -2023,6 +2023,10 @@ export class DeesTable<T> extends DeesElement {
|
||||
'.editingCell dees-input-tags'
|
||||
) as any;
|
||||
el?.focus?.();
|
||||
// Dropdown editors should auto-open so the user can pick immediately.
|
||||
if (el?.tagName === 'DEES-INPUT-DROPDOWN') {
|
||||
el.updateComplete?.then(() => el.toggleSelectionBox?.());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -2090,8 +2094,13 @@ export class DeesTable<T> extends DeesElement {
|
||||
case 'dropdown': {
|
||||
const options = (col.editorOptions?.options as any[]) ?? [];
|
||||
const selected =
|
||||
options.find((o: any) => (o?.option ?? o?.key ?? o) === value) ?? null;
|
||||
options.find((o: any) => {
|
||||
if (o == null) return false;
|
||||
if (typeof o === 'string') return o === raw;
|
||||
return o.key === raw || o.option === raw;
|
||||
}) ?? null;
|
||||
return html`<dees-input-dropdown
|
||||
.vintegrated=${true}
|
||||
.options=${options}
|
||||
.selectedOption=${selected}
|
||||
@selectedOption=${(e: CustomEvent<any>) => {
|
||||
@@ -2121,6 +2130,7 @@ export class DeesTable<T> extends DeesElement {
|
||||
case 'text':
|
||||
default:
|
||||
return html`<dees-input-text
|
||||
.vintegrated=${true}
|
||||
.value=${value == null ? '' : String(value)}
|
||||
@focusout=${(e: any) => onTextCommit(e.target)}
|
||||
@keydown=${(e: KeyboardEvent) => this.__handleEditorKey(e, item, col)}
|
||||
|
||||
Reference in New Issue
Block a user