@digital-ai/dot-components 2.16.0 → 2.17.1
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/CHANGE_LOG.md +20 -10
- package/README.md +5 -0
- package/index.esm.js +359 -205
- package/index.umd.js +513 -349
- package/lib/components/table/Table.d.ts +4 -2
- package/lib/components/table/Table.stories.d.ts +3 -1
- package/lib/components/table/Table.stories.data.d.ts +59 -0
- package/lib/components/table/TableBody.d.ts +3 -2
- package/lib/components/table/TableBodyCollapsibleTable.d.ts +8 -0
- package/lib/components/table/TableBodyCollapsibleTable.styles.d.ts +2 -0
- package/lib/components/table/TableBodyExpandCollapseCell.d.ts +8 -0
- package/lib/components/table/TableBodyExpandCollapseCell.styles.d.ts +3 -0
- package/lib/components/table/TableHeader.d.ts +3 -2
- package/lib/components/table/TableRow.d.ts +3 -2
- package/lib/components/table/utils/helpers.d.ts +1 -0
- package/lib/components/table/utils/models.d.ts +19 -0
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@ import { CommonProps } from '../CommonProps';
|
|
|
3
3
|
import { DotColumnHeader, Order } from './TableHeader';
|
|
4
4
|
import { RowsPerPageOption } from './TablePagination';
|
|
5
5
|
import { TypographyVariant } from '../typography/Typography';
|
|
6
|
-
import { MultiSelect } from './utils/models';
|
|
6
|
+
import { CollapsibleTableOptions, MultiSelect } from './utils/models';
|
|
7
7
|
export declare const TABLE_TYPOGRAPHY_VARIANT = "body1";
|
|
8
8
|
export interface TableRowProps extends CommonProps {
|
|
9
9
|
/** row identifier that will be passed to onRowClick callback */
|
|
@@ -16,6 +16,8 @@ export interface TableRowProps extends CommonProps {
|
|
|
16
16
|
export interface TableProps extends CommonProps {
|
|
17
17
|
/** Typography variant which will be used for table body cell values **/
|
|
18
18
|
bodyTypography?: TypographyVariant;
|
|
19
|
+
/** Optional collapsible-table object **/
|
|
20
|
+
collapsibleTableOptions?: CollapsibleTableOptions;
|
|
19
21
|
/** The table header columns */
|
|
20
22
|
columns: Array<DotColumnHeader>;
|
|
21
23
|
/** Total number of items for paginated table.
|
|
@@ -68,4 +70,4 @@ export declare function stableSort<T>(array: T[], comparator: (order: T, orderBy
|
|
|
68
70
|
* A wrapper component around the Table component from @material-ui. This component can be used for
|
|
69
71
|
* creating a common structure for tables in the system.
|
|
70
72
|
*/
|
|
71
|
-
export declare const DotTable: ({ ariaLabel, bodyTypography, className, columns, count, data, "data-testid": dataTestId, emptyMessage, footerTypography, headerTypography, labelRowsPerPage, loading, maxHeight, multiSelect, order, orderBy, onRowClick, onUpdateData, page, rowsPerPage, rowsPerPageOptions, stickyHeader, sortable, toolbar, }: TableProps) => JSX.Element;
|
|
73
|
+
export declare const DotTable: ({ ariaLabel, bodyTypography, className, collapsibleTableOptions, columns, count, data, "data-testid": dataTestId, emptyMessage, footerTypography, headerTypography, labelRowsPerPage, loading, maxHeight, multiSelect, order, orderBy, onRowClick, onUpdateData, page, rowsPerPage, rowsPerPageOptions, stickyHeader, sortable, toolbar, }: TableProps) => JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Story, ComponentMeta } from '@storybook/react';
|
|
2
2
|
import { TableProps } from './Table';
|
|
3
|
-
declare const _default: ComponentMeta<({ ariaLabel, bodyTypography, className, columns, count, data, "data-testid": dataTestId, emptyMessage, footerTypography, headerTypography, labelRowsPerPage, loading, maxHeight, multiSelect, order, orderBy, onRowClick, onUpdateData, page, rowsPerPage, rowsPerPageOptions, stickyHeader, sortable, toolbar, }: TableProps) => JSX.Element>;
|
|
3
|
+
declare const _default: ComponentMeta<({ ariaLabel, bodyTypography, className, collapsibleTableOptions, columns, count, data, "data-testid": dataTestId, emptyMessage, footerTypography, headerTypography, labelRowsPerPage, loading, maxHeight, multiSelect, order, orderBy, onRowClick, onUpdateData, page, rowsPerPage, rowsPerPageOptions, stickyHeader, sortable, toolbar, }: TableProps) => JSX.Element>;
|
|
4
4
|
export default _default;
|
|
5
5
|
export declare const Default: Story;
|
|
6
6
|
export declare const LocallyPaginatedTable: Story;
|
|
@@ -9,3 +9,5 @@ export declare const WithActionMenu: Story;
|
|
|
9
9
|
export declare const WithCheckboxSelection: Story;
|
|
10
10
|
export declare const EmptyTable: Story;
|
|
11
11
|
export declare const WithCustomPaginationOptions: Story;
|
|
12
|
+
export declare const WithCollapsibleTable: Story;
|
|
13
|
+
export declare const WithCollapsibleTableAsyncLoad: Story;
|
|
@@ -103,4 +103,63 @@ export declare const paginatedData: {
|
|
|
103
103
|
hit: string;
|
|
104
104
|
};
|
|
105
105
|
}[];
|
|
106
|
+
export declare const collapsibleTableData: ({
|
|
107
|
+
id: string;
|
|
108
|
+
className: string;
|
|
109
|
+
selected: boolean;
|
|
110
|
+
rowData: {
|
|
111
|
+
title: string;
|
|
112
|
+
hometown: string;
|
|
113
|
+
fans: number;
|
|
114
|
+
delete: JSX.Element;
|
|
115
|
+
className: string;
|
|
116
|
+
nestedTable: {
|
|
117
|
+
series: string;
|
|
118
|
+
releaseYear: string;
|
|
119
|
+
}[];
|
|
120
|
+
};
|
|
121
|
+
} | {
|
|
122
|
+
id: string;
|
|
123
|
+
rowData: {
|
|
124
|
+
title: string;
|
|
125
|
+
hometown: string;
|
|
126
|
+
fans: number;
|
|
127
|
+
delete: JSX.Element;
|
|
128
|
+
className?: undefined;
|
|
129
|
+
nestedTable?: undefined;
|
|
130
|
+
};
|
|
131
|
+
className?: undefined;
|
|
132
|
+
selected?: undefined;
|
|
133
|
+
})[];
|
|
134
|
+
export declare const carMockDataColumns: ({
|
|
135
|
+
id: string;
|
|
136
|
+
label: string;
|
|
137
|
+
width: string;
|
|
138
|
+
truncate: boolean;
|
|
139
|
+
align?: undefined;
|
|
140
|
+
} | {
|
|
141
|
+
id: string;
|
|
142
|
+
label: string;
|
|
143
|
+
width: string;
|
|
144
|
+
align: TextAlignment;
|
|
145
|
+
truncate?: undefined;
|
|
146
|
+
})[];
|
|
147
|
+
export declare const carMockData: {
|
|
148
|
+
id: string;
|
|
149
|
+
rowData: {
|
|
150
|
+
carMake: string;
|
|
151
|
+
vin: string;
|
|
152
|
+
};
|
|
153
|
+
}[];
|
|
154
|
+
export declare const carMockNestedTableColumns: {
|
|
155
|
+
id: string;
|
|
156
|
+
label: string;
|
|
157
|
+
}[];
|
|
158
|
+
export declare const carMockNestedTableData: {
|
|
159
|
+
id: string;
|
|
160
|
+
rowData: {
|
|
161
|
+
type: string;
|
|
162
|
+
model: string;
|
|
163
|
+
}[];
|
|
164
|
+
}[];
|
|
106
165
|
export declare const MultiSelectTable: (props: TableProps) => JSX.Element;
|
|
@@ -3,8 +3,9 @@ import { DotColumnHeader } from './TableHeader';
|
|
|
3
3
|
import { TableRowProps } from './Table';
|
|
4
4
|
import { CommonProps } from '../CommonProps';
|
|
5
5
|
import { TypographyVariant } from '../typography/Typography';
|
|
6
|
-
import { MultiSelectBody } from './utils/models';
|
|
6
|
+
import { CollapsibleTableBody, MultiSelectBody } from './utils/models';
|
|
7
7
|
export interface TableBodyProps extends CommonProps {
|
|
8
|
+
collapsibleTableBody?: CollapsibleTableBody;
|
|
8
9
|
/** The table column headers */
|
|
9
10
|
columns: Array<DotColumnHeader>;
|
|
10
11
|
/** The table body row data */
|
|
@@ -22,4 +23,4 @@ export interface TableBodyProps extends CommonProps {
|
|
|
22
23
|
* A wrapper component around the TableBody component from @material-ui. This component can be used
|
|
23
24
|
* to determine the functionality of the table.
|
|
24
25
|
*/
|
|
25
|
-
export declare const DotTableBody: ({ columns, data, emptyMessage, multiSelectBody, onRowClick, typography, }: TableBodyProps) => JSX.Element;
|
|
26
|
+
export declare const DotTableBody: ({ collapsibleTableBody, columns, data, emptyMessage, multiSelectBody, onRowClick, typography, }: TableBodyProps) => JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { CollapsibleTableBody } from './utils/models';
|
|
2
|
+
export interface DotBodyCollapsibleTableProps {
|
|
3
|
+
collapsibleTableBody: CollapsibleTableBody;
|
|
4
|
+
isExpanded: boolean;
|
|
5
|
+
loading?: boolean;
|
|
6
|
+
rowData: unknown;
|
|
7
|
+
}
|
|
8
|
+
export declare const DotBodyCollapsibleTable: ({ collapsibleTableBody, isExpanded, loading, rowData, }: DotBodyCollapsibleTableProps) => JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import { CommonProps } from '../CommonProps';
|
|
3
|
+
export interface DotBodyExpandCollapseCellProps extends CommonProps {
|
|
4
|
+
isExpanded: boolean;
|
|
5
|
+
onRowExpandCollapse: (isExpanded: boolean, rowId: string) => void;
|
|
6
|
+
rowId: string;
|
|
7
|
+
}
|
|
8
|
+
export declare const DotBodyExpandCollapseCell: ({ ariaLabel, className, "data-testid": dataTestId, isExpanded, onRowExpandCollapse, rowId, }: DotBodyExpandCollapseCellProps) => ReactElement;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TextAlignment } from './TableCell';
|
|
2
2
|
import { TypographyVariant } from '../typography/Typography';
|
|
3
|
-
import { MultiSelectHeader } from './utils/models';
|
|
3
|
+
import { CollapsibleTableOptions, MultiSelectHeader } from './utils/models';
|
|
4
4
|
export interface DotColumnHeader {
|
|
5
5
|
align?: TextAlignment;
|
|
6
6
|
id: string;
|
|
@@ -11,6 +11,7 @@ export interface DotColumnHeader {
|
|
|
11
11
|
}
|
|
12
12
|
export declare type Order = 'asc' | 'desc';
|
|
13
13
|
export interface HeaderProps {
|
|
14
|
+
collapsibleTableOptions?: CollapsibleTableOptions;
|
|
14
15
|
columns: Array<DotColumnHeader>;
|
|
15
16
|
multiSelectHeader?: MultiSelectHeader;
|
|
16
17
|
onRequestSort: (property: string) => void;
|
|
@@ -24,4 +25,4 @@ export interface HeaderProps {
|
|
|
24
25
|
* A wrapper component around the TableHead component from @material-ui. This component can be used
|
|
25
26
|
* to determine the functionality of the table header.
|
|
26
27
|
*/
|
|
27
|
-
export declare const DotHeaderRow: ({ columns, multiSelectHeader, onRequestSort, order, orderBy, sortable, typography, }: HeaderProps) => JSX.Element;
|
|
28
|
+
export declare const DotHeaderRow: ({ collapsibleTableOptions, columns, multiSelectHeader, onRequestSort, order, orderBy, sortable, typography, }: HeaderProps) => JSX.Element;
|
|
@@ -3,13 +3,14 @@ import { DotColumnHeader } from './TableHeader';
|
|
|
3
3
|
import { CommonProps } from '../CommonProps';
|
|
4
4
|
import { TableRowProps } from './Table';
|
|
5
5
|
import { TypographyVariant } from '../typography/Typography';
|
|
6
|
-
import { MultiSelectBody } from './utils/models';
|
|
6
|
+
import { CollapsibleTableBody, MultiSelectBody } from './utils/models';
|
|
7
7
|
export interface EmptyRowProps {
|
|
8
8
|
cols: number;
|
|
9
9
|
message?: string;
|
|
10
10
|
typography: TypographyVariant;
|
|
11
11
|
}
|
|
12
12
|
export interface RowProps extends CommonProps {
|
|
13
|
+
collapsibleTableBody: CollapsibleTableBody;
|
|
13
14
|
/** The table column headers */
|
|
14
15
|
columns: Array<DotColumnHeader>;
|
|
15
16
|
/** The table body row data */
|
|
@@ -31,5 +32,5 @@ export interface RowProps extends CommonProps {
|
|
|
31
32
|
* A wrapper component around the TableRow component from @material-ui. This component can be used
|
|
32
33
|
* for manipulating data prior to displaying the data inside the table
|
|
33
34
|
*/
|
|
34
|
-
export declare const DotTableRow: ({ columns, className, data, multiSelectBody, onActionMenuTrigger, onClick, rowKey, selected, typography, }: RowProps) => JSX.Element;
|
|
35
|
+
export declare const DotTableRow: ({ collapsibleTableBody, columns, className, data, multiSelectBody, onActionMenuTrigger, onClick, rowKey, selected, typography, }: RowProps) => JSX.Element;
|
|
35
36
|
export declare const EmptyDotRow: ({ cols, message, typography, }: EmptyRowProps) => JSX.Element;
|
|
@@ -5,3 +5,4 @@ export declare const getFormattedTableCellValue: (value: any, typographyVariant:
|
|
|
5
5
|
export declare const getContainerMaxHeightStyle: (stickyHeader?: boolean, maxHeight?: string) => string;
|
|
6
6
|
export declare const getSelectedRowIds: (id: string, isChecked: boolean, selectedIds: string[]) => string[];
|
|
7
7
|
export declare const getBulkSelectedRowIds: (isChecked: boolean, selectedIds: string[], pageData: TableRowProps[]) => string[];
|
|
8
|
+
export declare const getExpandedRowIds: (expandedIds: string[], id: string, isExpand: boolean) => string[];
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { TableRowProps } from '../Table';
|
|
3
|
+
import { DotColumnHeader } from '../TableHeader';
|
|
3
4
|
export declare type RowSelectionChangeHandler = (isChecked: boolean, rowId: string) => void;
|
|
4
5
|
export declare type MultiSelectState = 'unchecked' | 'checked' | 'indeterminate';
|
|
5
6
|
export declare type TableRowSelectChangeHandler = (isChecked: boolean, selectedTableRowIds: string[]) => void;
|
|
@@ -19,4 +20,22 @@ export interface MultiSelectHeader extends MultiSelectTableBase {
|
|
|
19
20
|
export interface MultiSelectBody extends MultiSelectTableBase {
|
|
20
21
|
onCheckIndividualChange?: RowSelectionChangeHandler;
|
|
21
22
|
}
|
|
23
|
+
interface CollapsibleTableBase {
|
|
24
|
+
/** The nested-table header columns */
|
|
25
|
+
nestedTableColumns: Array<DotColumnHeader>;
|
|
26
|
+
/** Name of the property which has nested table data in rowData object */
|
|
27
|
+
nestedTableDataPropName: string;
|
|
28
|
+
/** Optional message that is shown if nested-table data is empty */
|
|
29
|
+
nestedTableEmptyMessage?: string;
|
|
30
|
+
/** Optional heading for nested-table */
|
|
31
|
+
nestedTableTitle?: string;
|
|
32
|
+
}
|
|
33
|
+
export interface CollapsibleTableOptions extends CollapsibleTableBase {
|
|
34
|
+
/** Row click (expand) event callback for async loading of nested-table data */
|
|
35
|
+
onRowExpand?: (rowId: string, setLoading: (loading: boolean) => void) => void;
|
|
36
|
+
}
|
|
37
|
+
export interface CollapsibleTableBody extends CollapsibleTableBase {
|
|
38
|
+
expandedTableRowIds: string[];
|
|
39
|
+
onRowExpandCollapseTable?: (isExpanded: boolean, rowId: string, setLoading: (loading: boolean) => void) => void;
|
|
40
|
+
}
|
|
22
41
|
export {};
|