Collections: Add selection mode toggle in UmbTableElement update lifecycle (#20486)
* Add selection mode toggle in UmbTableElement update lifecycle * Update src/Umbraco.Web.UI.Client/src/packages/core/components/table/table.element.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Markup attribute consistency --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: leekelleher <leekelleher@gmail.com>
This commit is contained in:
@@ -157,6 +157,13 @@ export class UmbTableElement extends UmbLitElement {
|
|||||||
@state()
|
@state()
|
||||||
private _selectionMode = false;
|
private _selectionMode = false;
|
||||||
|
|
||||||
|
override updated(changedProperties: Map<string | number | symbol, unknown>) {
|
||||||
|
super.updated(changedProperties);
|
||||||
|
if (changedProperties.has('selection')) {
|
||||||
|
this._selectionMode = this.selection.length > 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#sorter = new UmbSorterController<UmbTableItem>(this, {
|
#sorter = new UmbSorterController<UmbTableItem>(this, {
|
||||||
getUniqueOfElement: (element) => {
|
getUniqueOfElement: (element) => {
|
||||||
return element.dataset.sortableId;
|
return element.dataset.sortableId;
|
||||||
@@ -291,7 +298,7 @@ export class UmbTableElement extends UmbLitElement {
|
|||||||
return html`
|
return html`
|
||||||
<uui-table-row
|
<uui-table-row
|
||||||
data-sortable-id=${item.id}
|
data-sortable-id=${item.id}
|
||||||
?selectable="${this.config.allowSelection && !this._sortable}"
|
?selectable=${this.config.allowSelection && !this._sortable}
|
||||||
?select-only=${this._selectionMode}
|
?select-only=${this._selectionMode}
|
||||||
?selected=${this._isSelected(item.id)}
|
?selected=${this._isSelected(item.id)}
|
||||||
@selected=${() => this._selectRow(item.id)}
|
@selected=${() => this._selectRow(item.id)}
|
||||||
|
|||||||
Reference in New Issue
Block a user