@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/CHANGELOG.md +13 -0
- package/dist/table.cjs.development.js +35 -21
- package/dist/table.cjs.development.js.map +1 -1
- package/dist/table.cjs.production.min.js +1 -1
- package/dist/table.cjs.production.min.js.map +1 -1
- package/dist/table.esm.js +37 -23
- package/dist/table.esm.js.map +1 -1
- package/dist/types.d.ts +4 -1
- package/package.json +2 -2
- package/src/index.tsx +125 -72
- package/src/types.tsx +2 -1
- package/src/useLoadingState.tsx +4 -2
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
|
|
package/src/useLoadingState.tsx
CHANGED
|
@@ -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(({
|
|
13
|
+
.map(({
|
|
14
|
+
maxWidth, width, Header, accessor,
|
|
15
|
+
}: Column) => {
|
|
14
16
|
const column: Column<DefaultObject> = {
|
|
15
17
|
Cell: () => <LoadingCellComponent />,
|
|
16
|
-
accessor:
|
|
18
|
+
accessor: accessor as string,
|
|
17
19
|
};
|
|
18
20
|
if (maxWidth) {
|
|
19
21
|
column.maxWidth = maxWidth;
|