fix(ts_web): resolve TypeScript nullability and event typing issues across web components

This commit is contained in:
2026-04-01 05:00:21 +00:00
parent b1c8a7446e
commit af1f660486
78 changed files with 429 additions and 399 deletions

View File

@@ -52,12 +52,12 @@ export class DeesTable<T> extends DeesElement {
@property({
type: String,
})
accessor key: string;
accessor key!: string;
@property({
type: String,
})
accessor label: string;
accessor label!: string;
@property({
type: Boolean,
@@ -83,7 +83,7 @@ export class DeesTable<T> extends DeesElement {
type: String,
reflect: true,
})
accessor dataName: string;
accessor dataName!: string;
@property({
@@ -127,7 +127,7 @@ export class DeesTable<T> extends DeesElement {
@property({
type: Object,
})
accessor selectedDataRow: T;
accessor selectedDataRow!: T;
@property({
type: Array,
@@ -359,7 +359,7 @@ export class DeesTable<T> extends DeesElement {
if (elementArg.tagName === 'TR') {
return elementArg;
} else {
return getTr(elementArg.parentElement);
return getTr(elementArg.parentElement!);
}
};
return html`
@@ -393,8 +393,8 @@ export class DeesTable<T> extends DeesElement {
}}
@drop=${async (eventArg: DragEvent) => {
eventArg.preventDefault();
const newFiles = [];
for (const file of Array.from(eventArg.dataTransfer.files)) {
const newFiles: File[] = [];
for (const file of Array.from(eventArg.dataTransfer!.files)) {
this.files.push(file);
newFiles.push(file);
this.requestUpdate();
@@ -548,8 +548,8 @@ export class DeesTable<T> extends DeesElement {
type: ['header'],
actionFunc: async () => {
console.log('open search');
const searchGrid = this.shadowRoot.querySelector('.searchGrid');
searchGrid.classList.toggle('hidden');
const searchGrid = this.shadowRoot!.querySelector('.searchGrid');
searchGrid!.classList.toggle('hidden');
}
});
console.log(this.dataActions);
@@ -609,7 +609,7 @@ export class DeesTable<T> extends DeesElement {
const domtools = await this.domtoolsPromise;
await domtools.convenience.smartdelay.delayFor(0);
// Get the table element
const table = this.shadowRoot.querySelector('table');
const table = this.shadowRoot!.querySelector('table');
if (!table) return;
// Get the first row's cells to measure the widths
@@ -718,7 +718,7 @@ export class DeesTable<T> extends DeesElement {
if (!this._rowIdMap.has(key)) {
this._rowIdMap.set(key, String(++this._rowIdCounter));
}
return this._rowIdMap.get(key);
return this._rowIdMap.get(key)!;
}
private isRowSelected(row: T): boolean {
@@ -818,7 +818,7 @@ export class DeesTable<T> extends DeesElement {
input.blur();
}
if (saveArg) {
itemArg[key] = input.value as any; // Convert string to T (you might need better type casting depending on your data structure)
(itemArg as any)[key] = input.value as any; // Convert string to T (you might need better type casting depending on your data structure)
this.changeSubject.next(this);
}
input.remove();