Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
nielslyngsoe committed Nov 27, 2024
1 parent 8adfe87 commit d61f99a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
10 changes: 5 additions & 5 deletions packages/uui-table/lib/uui-table-row.element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import { defineElement } from '@umbraco-ui/uui-base/lib/registration';
import { css, html, LitElement } from 'lit';
import { queryAssignedElements } from 'lit/decorators.js';

import { UUITableCellElement } from './uui-table-cell.element';

/**
* Table row element with option to set is as selectable. Parent for uui-table-cell. Must be a child of uui-table.
* @element uui-table-row
Expand Down Expand Up @@ -50,13 +48,15 @@ export class UUITableRowElement extends SelectOnlyMixin(
private slotCellNodes?: unknown[];

protected updated(changedProperties: Map<string | number | symbol, unknown>) {
if (changedProperties.has('selectOnly')) this.updateChildSelectOnly();
if (changedProperties.has('selectOnly')) {
this.updateChildSelectOnly();
}
}

private updateChildSelectOnly() {
if (this.slotCellNodes) {
this.slotCellNodes.forEach(el => {
if (el instanceof UUITableCellElement) {
this.slotCellNodes.forEach((el: any) => {
if (el.disableChildInteraction !== undefined) {
el.disableChildInteraction = this.selectOnly;
}
});
Expand Down
8 changes: 6 additions & 2 deletions packages/uui-table/lib/uui-table-row.story.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ import { html } from 'lit';
import type { Meta, StoryObj } from '@storybook/web-components';
import { ArrayOfUmbracoWords } from '../../../storyhelpers/UmbracoWordGenerator';

import '@umbraco-ui/uui-table';
import '@umbraco-ui/uui-input';
import '@umbraco-ui/uui-button';

const meta: Meta = {
id: 'uui-table-row',
component: 'uui-table-row',
Expand All @@ -12,14 +16,14 @@ const meta: Meta = {
<uui-table>
<uui-table-row
?selectable=${args.selectable}
?selectOnly=${args.selectOnly}>
?select-only=${args.selectOnly}>
${ArrayOfUmbracoWords(5).map(
el => html`<uui-table-cell>${el}</uui-table-cell>`,
)}
</uui-table-row>
<uui-table-row
?selectable=${args.selectable}
?selectOnly=${args.selectOnly}>
?select-only=${args.selectOnly}>
<uui-table-cell>
<uui-input placeholder="Type your own thing"></uui-input>
</uui-table-cell>
Expand Down

0 comments on commit d61f99a

Please sign in to comment.