@propellerads/table 4.3.0 → 4.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/types.tsx CHANGED
@@ -85,6 +85,7 @@ export type TableProps = {
85
85
  showLoadingState?: boolean,
86
86
  LoadingCellComponent?: FunctionComponent<DefaultObject>,
87
87
  noDataMessage?: string | ReactElement
88
+ rowSubComponent?: (row: StandardRow) => ReactElement
88
89
  }
89
90
 
90
91
  export type TableOptions = {
@@ -135,7 +136,7 @@ export type ColumnWithSort = HeaderGroup<DefaultObject> & Partial<UseSortByColum
135
136
 
136
137
  export type StandardColumn = Column<DefaultObject>
137
138
 
138
- export type StandardRow = Row<DefaultObject>
139
+ export type StandardRow = Row<DefaultObject> & { isExpanded?: boolean }
139
140
 
140
141
  export type SelectableRow = Row<{ id: string }> & UseRowSelectRowProps<DefaultObject>
141
142
 
@@ -10,10 +10,12 @@ const useLoadingState = (
10
10
  LoadingCellComponent: FunctionComponent<DefaultObject>,
11
11
  ): LoadingState => {
12
12
  const loadingColumns: Column<DefaultObject>[] | undefined = useMemo(() => (showLoadingState && loading ? columns
13
- .map(({maxWidth, width, Header}: Column, key: number) => {
13
+ .map(({
14
+ maxWidth, width, Header, accessor,
15
+ }: Column) => {
14
16
  const column: Column<DefaultObject> = {
15
17
  Cell: () => <LoadingCellComponent />,
16
- accessor: `empty_${key}`,
18
+ accessor: accessor as string,
17
19
  };
18
20
  if (maxWidth) {
19
21
  column.maxWidth = maxWidth;