From 1d09d670179a6291d5c68b08af0bc51bcd4d7ee5 Mon Sep 17 00:00:00 2001 From: Jianrong Yu <95995341+Jianrong-Yu@users.noreply.github.com> Date: Fri, 18 Oct 2024 19:48:46 -0700 Subject: [PATCH 1/4] fix(AnalyticalTable): fix the typing onRowClick of AnalyticalTable --- packages/main/src/components/AnalyticalTable/types/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/main/src/components/AnalyticalTable/types/index.ts b/packages/main/src/components/AnalyticalTable/types/index.ts index 04c42189ffd..236f2bfb74e 100644 --- a/packages/main/src/components/AnalyticalTable/types/index.ts +++ b/packages/main/src/components/AnalyticalTable/types/index.ts @@ -541,8 +541,8 @@ interface OnAutoResizeMouseEvent extends Omit { detail: { columnId: string; width: number; nativeDetail: 2 }; } -interface OnRowClickEvent extends Omit { - detail: { detail: { row: unknown; nativeDetail: number } }; +interface OnRowClickEvent extends Omit { + detail: { row: unknown; nativeDetail: number }; } export interface AnalyticalTablePropTypes extends Omit { From 00da3d4aeabb4871aece28215c2c4f35c4aeb5c1 Mon Sep 17 00:00:00 2001 From: Jianrong Yu <95995341+Jianrong-Yu@users.noreply.github.com> Date: Mon, 21 Oct 2024 11:27:18 -0700 Subject: [PATCH 2/4] fix(AnalyticalTable): fix the typing accessor of AnalyticalTable --- packages/main/src/components/AnalyticalTable/types/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/main/src/components/AnalyticalTable/types/index.ts b/packages/main/src/components/AnalyticalTable/types/index.ts index 236f2bfb74e..b99a68cc1a3 100644 --- a/packages/main/src/components/AnalyticalTable/types/index.ts +++ b/packages/main/src/components/AnalyticalTable/types/index.ts @@ -329,7 +329,7 @@ export interface AnalyticalTableColumnDefinition { * __Note__: You can also specify deeply nested values with accessors like `info.hobby` or even `address[0].street` * __Note__: If no `accessor` is set, or the `accessor` is a function, the `id` property has to be set. */ - accessor?: string | ((row: RowType, rowIndex: number) => any); + accessor?: string | ((row: Record, rowIndex: number) => any); /** * Defines the unique ID for the column. It is used by reference in things like sorting, grouping, filtering etc. * From 0378005d11796ff7eb94c987f60c1fcd6b05f55f Mon Sep 17 00:00:00 2001 From: Jianrong Yu <95995341+Jianrong-Yu@users.noreply.github.com> Date: Wed, 23 Oct 2024 08:45:47 -0700 Subject: [PATCH 3/4] fix(AnalyticalTable): apply suggestions from code review about enhance the types of accessor and onRowClick Co-authored-by: Lukas Harbarth --- packages/main/src/components/AnalyticalTable/types/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/main/src/components/AnalyticalTable/types/index.ts b/packages/main/src/components/AnalyticalTable/types/index.ts index b99a68cc1a3..5c29274b63f 100644 --- a/packages/main/src/components/AnalyticalTable/types/index.ts +++ b/packages/main/src/components/AnalyticalTable/types/index.ts @@ -329,7 +329,7 @@ export interface AnalyticalTableColumnDefinition { * __Note__: You can also specify deeply nested values with accessors like `info.hobby` or even `address[0].street` * __Note__: If no `accessor` is set, or the `accessor` is a function, the `id` property has to be set. */ - accessor?: string | ((row: Record, rowIndex: number) => any); + accessor?: string | ((originalRow: Record, rowIndex: number, row: RowType, parentRows: RowType[], data: Record[]) => any); /** * Defines the unique ID for the column. It is used by reference in things like sorting, grouping, filtering etc. * @@ -542,7 +542,7 @@ interface OnAutoResizeMouseEvent extends Omit { } interface OnRowClickEvent extends Omit { - detail: { row: unknown; nativeDetail: number }; + detail: { row: RowType; nativeDetail: number }; } export interface AnalyticalTablePropTypes extends Omit { From c91ab7bc8b91c6bede040551836912396a2533c5 Mon Sep 17 00:00:00 2001 From: Jianrong Yu Date: Thu, 24 Oct 2024 09:37:43 -0700 Subject: [PATCH 4/4] refactor(AnalyticalTable): prettier the type changes on accessor --- .../main/src/components/AnalyticalTable/types/index.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/main/src/components/AnalyticalTable/types/index.ts b/packages/main/src/components/AnalyticalTable/types/index.ts index 5c29274b63f..7c069bf95ab 100644 --- a/packages/main/src/components/AnalyticalTable/types/index.ts +++ b/packages/main/src/components/AnalyticalTable/types/index.ts @@ -329,7 +329,15 @@ export interface AnalyticalTableColumnDefinition { * __Note__: You can also specify deeply nested values with accessors like `info.hobby` or even `address[0].street` * __Note__: If no `accessor` is set, or the `accessor` is a function, the `id` property has to be set. */ - accessor?: string | ((originalRow: Record, rowIndex: number, row: RowType, parentRows: RowType[], data: Record[]) => any); + accessor?: + | string + | (( + originalRow: Record, + rowIndex: number, + row: RowType, + parentRows: RowType[], + data: Record[] + ) => any); /** * Defines the unique ID for the column. It is used by reference in things like sorting, grouping, filtering etc. *