fix(dees-table): Guard against undefined action.type in dees-table by using optional chaining and update several dependencies

This commit is contained in:
2026-02-16 16:03:23 +00:00
parent 09f0aa97dd
commit 59efa8cff0
5 changed files with 156 additions and 126 deletions

View File

@@ -232,7 +232,7 @@ export class DeesTable<T> extends DeesElement {
${directives.resolveExec(async () => {
const resultArray: TemplateResult[] = [];
for (const action of this.dataActions) {
if (!action.type.includes('header')) continue;
if (!action.type?.includes('header')) continue;
resultArray.push(
html`<div
class="headerAction"
@@ -450,7 +450,7 @@ export class DeesTable<T> extends DeesElement {
<td
@dblclick=${(e: Event) => {
const dblAction = this.dataActions.find((actionArg) =>
actionArg.type.includes('doubleClick')
actionArg.type?.includes('doubleClick')
);
if (this.editableFields.includes(editKey)) {
this.handleCellEditing(e, itemArg, editKey);
@@ -506,7 +506,7 @@ export class DeesTable<T> extends DeesElement {
${directives.resolveExec(async () => {
const resultArray: TemplateResult[] = [];
for (const action of this.dataActions) {
if (!action.type.includes('footer')) continue;
if (!action.type?.includes('footer')) continue;
resultArray.push(
html`<div
class="footerAction"
@@ -540,7 +540,7 @@ export class DeesTable<T> extends DeesElement {
super.updated(changedProperties);
this.determineColumnWidths();
if (this.searchable) {
const existing = this.dataActions.find((actionArg) => actionArg.type.includes('header') && actionArg.name === 'Search');
const existing = this.dataActions.find((actionArg) => actionArg.type?.includes('header') && actionArg.name === 'Search');
if (!existing) {
this.dataActions.unshift({
name: 'Search',
@@ -623,7 +623,7 @@ export class DeesTable<T> extends DeesElement {
const width = window.getComputedStyle(cell).width;
if (cell.textContent.includes('Actions')) {
const neededWidth =
this.dataActions.filter((actionArg) => actionArg.type.includes('inRow')).length * 36;
this.dataActions.filter((actionArg) => actionArg.type?.includes('inRow')).length * 36;
cell.style.width = `${Math.max(neededWidth, 68)}px`;
} else {
cell.style.width = width;
@@ -795,7 +795,7 @@ export class DeesTable<T> extends DeesElement {
getActionsForType(typeArg: ITableAction['type'][0]) {
const actions: ITableAction[] = [];
for (const action of this.dataActions) {
if (!action.type.includes(typeArg)) continue;
if (!action.type?.includes(typeArg)) continue;
actions.push(action);
}
return actions;