fix(core): update

This commit is contained in:
2023-10-24 14:18:03 +02:00
parent cd9b028e9b
commit 64074e37fc
5 changed files with 96 additions and 38 deletions

View File

@ -61,8 +61,8 @@ export interface ITableAction<T = any> {
}
export interface ITableActionDataArg<T> {
item: T,
table: DeesTable<T>,
item: T;
table: DeesTable<T>;
}
export type TDisplayFunction<T = any> = (itemArg: T) => object;
@ -396,6 +396,8 @@ export class DeesTable<T> extends DeesElement {
</div>
<div class="headingSeparation"></div>
<dees-input-text></dees-input-text>
<!-- the actual table -->
<style></style>
${this.data.length > 0
@ -524,10 +526,11 @@ export class DeesTable<T> extends DeesElement {
${this.getActionsForType('inRow').map(
(actionArg) => html`<div
class="action"
@click=${() => actionArg.actionFunc({
item: itemArg,
table: this,
})}
@click=${() =>
actionArg.actionFunc({
item: itemArg,
table: this,
})}
>
${actionArg.iconName
? html`
@ -584,8 +587,7 @@ export class DeesTable<T> extends DeesElement {
`;
}
public async firstUpdated() {
}
public async firstUpdated() {}
public async updated(changedProperties: Map<string | number | symbol, unknown>): Promise<void> {
super.updated(changedProperties);
@ -609,7 +611,8 @@ export class DeesTable<T> extends DeesElement {
// Get computed width
const width = window.getComputedStyle(cell).width;
if (cell.textContent.includes('Actions')) {
const neededWidth = this.dataActions.filter(actionArg => actionArg.type.includes('inRow')).length * 35;
const neededWidth =
this.dataActions.filter((actionArg) => actionArg.type.includes('inRow')).length * 35;
cell.style.width = `${Math.max(neededWidth, 68)}px`;
} else {
cell.style.width = width;
@ -620,7 +623,7 @@ export class DeesTable<T> extends DeesElement {
});
await done.promise;
}
}
};
if (cells[cells.length - 1].textContent.includes('Actions')) {
await handleColumnByIndex(cells.length - 1, true);