From 70ab06190fb6390cfa79fc3930a908bed02a2f27 Mon Sep 17 00:00:00 2001 From: Tsanie Date: Fri, 8 Mar 2024 11:02:04 +0800 Subject: [PATCH] change: structure of GridDropdownColumn --- lib/ui/css/grid.scss | 16 ++++++++++++++++ lib/ui/grid/column.js | 12 ++++++++++-- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/lib/ui/css/grid.scss b/lib/ui/css/grid.scss index 093bd84..0873d04 100644 --- a/lib/ui/css/grid.scss +++ b/lib/ui/css/grid.scss @@ -412,6 +412,22 @@ } } + .ui-drop-span { + margin: 0; + + >span { + margin: var(--spacing-cell); + display: block; + overflow: hidden; + text-overflow: ellipsis; + white-space: pre; + + &.wrap { + @include wrap(); + } + } + } + .ui-drop-wrapper { height: var(--row-height); width: 100%; diff --git a/lib/ui/grid/column.js b/lib/ui/grid/column.js index a16c361..cc316cd 100644 --- a/lib/ui/grid/column.js +++ b/lib/ui/grid/column.js @@ -322,6 +322,14 @@ const SymbolDropdown = Symbol.for('ui-dropdown'); export class GridDropdownColumn extends GridColumn { static get canEdit() { return true }; + /** + * @ignore + * @returns {HTMLElement} + */ + static create() { + return createElement('span', 'ui-drop-span', createElement('span')); + } + /** * @ignore * @param {Function} trigger @@ -360,7 +368,7 @@ export class GridDropdownColumn extends GridColumn { if (element.tagName === 'DIV') { return element.children[0].children[0]; } - return element; + return element.children[0]; } /** @@ -424,7 +432,7 @@ export class GridDropdownColumn extends GridColumn { if (data != null) { val = data[opts?.textKey ?? 'text']; } - super.setValue(element, val); + element.children[0].innerText = val; } /**