@veeqo/ui 9.8.0 → 9.9.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/dist/components/ActionMenu/ActionMenu.cjs +1 -0
- package/dist/components/ActionMenu/ActionMenu.cjs.map +1 -1
- package/dist/components/ActionMenu/ActionMenu.js +1 -0
- package/dist/components/ActionMenu/ActionMenu.js.map +1 -1
- package/dist/components/DataGrid/DataGrid.cjs +129 -0
- package/dist/components/DataGrid/DataGrid.cjs.map +1 -0
- package/dist/components/DataGrid/DataGrid.d.ts +21 -0
- package/dist/components/DataGrid/DataGrid.js +123 -0
- package/dist/components/DataGrid/DataGrid.js.map +1 -0
- package/dist/components/DataGrid/DataGrid.module.css.cjs +13 -0
- package/dist/components/DataGrid/DataGrid.module.css.cjs.map +1 -0
- package/dist/components/DataGrid/DataGrid.module.css.js +10 -0
- package/dist/components/DataGrid/DataGrid.module.css.js.map +1 -0
- package/dist/components/DataGrid/components/Body/Body.cjs +21 -0
- package/dist/components/DataGrid/components/Body/Body.cjs.map +1 -0
- package/dist/components/DataGrid/components/Body/Body.d.ts +23 -0
- package/dist/components/DataGrid/components/Body/Body.js +14 -0
- package/dist/components/DataGrid/components/Body/Body.js.map +1 -0
- package/dist/components/DataGrid/components/Body/BodyCell/BodyCell.cjs +31 -0
- package/dist/components/DataGrid/components/Body/BodyCell/BodyCell.cjs.map +1 -0
- package/dist/components/DataGrid/components/Body/BodyCell/BodyCell.d.ts +18 -0
- package/dist/components/DataGrid/components/Body/BodyCell/BodyCell.js +25 -0
- package/dist/components/DataGrid/components/Body/BodyCell/BodyCell.js.map +1 -0
- package/dist/components/DataGrid/components/Body/BodyCell/BodyCell.module.css.cjs +11 -0
- package/dist/components/DataGrid/components/Body/BodyCell/BodyCell.module.css.cjs.map +1 -0
- package/dist/components/DataGrid/components/Body/BodyCell/BodyCell.module.css.js +9 -0
- package/dist/components/DataGrid/components/Body/BodyCell/BodyCell.module.css.js.map +1 -0
- package/dist/components/DataGrid/components/Body/BodyCell/index.d.ts +1 -0
- package/dist/components/DataGrid/components/Body/Row/Row.cjs +14 -0
- package/dist/components/DataGrid/components/Body/Row/Row.cjs.map +1 -0
- package/dist/components/DataGrid/components/Body/Row/Row.d.ts +18 -0
- package/dist/components/DataGrid/components/Body/Row/Row.js +8 -0
- package/dist/components/DataGrid/components/Body/Row/Row.js.map +1 -0
- package/dist/components/DataGrid/components/Body/Row/index.d.ts +1 -0
- package/dist/components/DataGrid/components/Body/index.d.ts +1 -0
- package/dist/components/DataGrid/components/CellContent/CellContent.cjs +21 -0
- package/dist/components/DataGrid/components/CellContent/CellContent.cjs.map +1 -0
- package/dist/components/DataGrid/components/CellContent/CellContent.d.ts +15 -0
- package/dist/components/DataGrid/components/CellContent/CellContent.js +15 -0
- package/dist/components/DataGrid/components/CellContent/CellContent.js.map +1 -0
- package/dist/components/DataGrid/components/CellContent/CellContent.module.css.cjs +11 -0
- package/dist/components/DataGrid/components/CellContent/CellContent.module.css.cjs.map +1 -0
- package/dist/components/DataGrid/components/CellContent/CellContent.module.css.js +9 -0
- package/dist/components/DataGrid/components/CellContent/CellContent.module.css.js.map +1 -0
- package/dist/components/DataGrid/components/CellContent/index.d.ts +1 -0
- package/dist/components/DataGrid/components/Columns/Columns.cjs +56 -0
- package/dist/components/DataGrid/components/Columns/Columns.cjs.map +1 -0
- package/dist/components/DataGrid/components/Columns/Columns.d.ts +17 -0
- package/dist/components/DataGrid/components/Columns/Columns.js +50 -0
- package/dist/components/DataGrid/components/Columns/Columns.js.map +1 -0
- package/dist/components/DataGrid/components/Columns/index.d.ts +1 -0
- package/dist/components/DataGrid/components/Footer/Footer.cjs +18 -0
- package/dist/components/DataGrid/components/Footer/Footer.cjs.map +1 -0
- package/dist/components/DataGrid/components/Footer/Footer.d.ts +15 -0
- package/dist/components/DataGrid/components/Footer/Footer.js +12 -0
- package/dist/components/DataGrid/components/Footer/Footer.js.map +1 -0
- package/dist/components/DataGrid/components/Footer/FooterCell/FooterCell.cjs +33 -0
- package/dist/components/DataGrid/components/Footer/FooterCell/FooterCell.cjs.map +1 -0
- package/dist/components/DataGrid/components/Footer/FooterCell/FooterCell.d.ts +18 -0
- package/dist/components/DataGrid/components/Footer/FooterCell/FooterCell.js +27 -0
- package/dist/components/DataGrid/components/Footer/FooterCell/FooterCell.js.map +1 -0
- package/dist/components/DataGrid/components/Footer/FooterCell/FooterCell.module.css.cjs +11 -0
- package/dist/components/DataGrid/components/Footer/FooterCell/FooterCell.module.css.cjs.map +1 -0
- package/dist/components/DataGrid/components/Footer/FooterCell/FooterCell.module.css.js +9 -0
- package/dist/components/DataGrid/components/Footer/FooterCell/FooterCell.module.css.js.map +1 -0
- package/dist/components/DataGrid/components/Footer/FooterCell/index.d.ts +1 -0
- package/dist/components/DataGrid/components/Footer/index.d.ts +1 -0
- package/dist/components/DataGrid/components/GridContainer/Container/Container.cjs +23 -0
- package/dist/components/DataGrid/components/GridContainer/Container/Container.cjs.map +1 -0
- package/dist/components/DataGrid/components/GridContainer/Container/Container.d.ts +21 -0
- package/dist/components/DataGrid/components/GridContainer/Container/Container.js +17 -0
- package/dist/components/DataGrid/components/GridContainer/Container/Container.js.map +1 -0
- package/dist/components/DataGrid/components/GridContainer/Container/Container.module.css.cjs +17 -0
- package/dist/components/DataGrid/components/GridContainer/Container/Container.module.css.cjs.map +1 -0
- package/dist/components/DataGrid/components/GridContainer/Container/Container.module.css.js +12 -0
- package/dist/components/DataGrid/components/GridContainer/Container/Container.module.css.js.map +1 -0
- package/dist/components/DataGrid/components/GridContainer/Container/index.d.ts +1 -0
- package/dist/components/DataGrid/components/GridContainer/GridContainer.cjs +30 -0
- package/dist/components/DataGrid/components/GridContainer/GridContainer.cjs.map +1 -0
- package/dist/components/DataGrid/components/GridContainer/GridContainer.d.ts +49 -0
- package/dist/components/DataGrid/components/GridContainer/GridContainer.js +24 -0
- package/dist/components/DataGrid/components/GridContainer/GridContainer.js.map +1 -0
- package/dist/components/DataGrid/components/GridContainer/GridContainer.module.css.cjs +11 -0
- package/dist/components/DataGrid/components/GridContainer/GridContainer.module.css.cjs.map +1 -0
- package/dist/components/DataGrid/components/GridContainer/GridContainer.module.css.js +9 -0
- package/dist/components/DataGrid/components/GridContainer/GridContainer.module.css.js.map +1 -0
- package/dist/components/DataGrid/components/GridContainer/index.d.ts +1 -0
- package/dist/components/DataGrid/components/Header/Header.cjs +20 -0
- package/dist/components/DataGrid/components/Header/Header.cjs.map +1 -0
- package/dist/components/DataGrid/components/Header/Header.d.ts +13 -0
- package/dist/components/DataGrid/components/Header/Header.js +14 -0
- package/dist/components/DataGrid/components/Header/Header.js.map +1 -0
- package/dist/components/DataGrid/components/Header/HeaderCell/HeaderCell.cjs +64 -0
- package/dist/components/DataGrid/components/Header/HeaderCell/HeaderCell.cjs.map +1 -0
- package/dist/components/DataGrid/components/Header/HeaderCell/HeaderCell.d.ts +22 -0
- package/dist/components/DataGrid/components/Header/HeaderCell/HeaderCell.js +58 -0
- package/dist/components/DataGrid/components/Header/HeaderCell/HeaderCell.js.map +1 -0
- package/dist/components/DataGrid/components/Header/HeaderCell/HeaderCell.module.css.cjs +19 -0
- package/dist/components/DataGrid/components/Header/HeaderCell/HeaderCell.module.css.cjs.map +1 -0
- package/dist/components/DataGrid/components/Header/HeaderCell/HeaderCell.module.css.js +13 -0
- package/dist/components/DataGrid/components/Header/HeaderCell/HeaderCell.module.css.js.map +1 -0
- package/dist/components/DataGrid/components/Header/HeaderCell/SortIcon/SortIcon.cjs +29 -0
- package/dist/components/DataGrid/components/Header/HeaderCell/SortIcon/SortIcon.cjs.map +1 -0
- package/dist/components/DataGrid/components/Header/HeaderCell/SortIcon/SortIcon.d.ts +10 -0
- package/dist/components/DataGrid/components/Header/HeaderCell/SortIcon/SortIcon.js +23 -0
- package/dist/components/DataGrid/components/Header/HeaderCell/SortIcon/SortIcon.js.map +1 -0
- package/dist/components/DataGrid/components/Header/HeaderCell/SortIcon/index.d.ts +1 -0
- package/dist/components/DataGrid/components/Header/HeaderCell/index.d.ts +1 -0
- package/dist/components/DataGrid/components/Header/Resizer/Resizer.cjs +25 -0
- package/dist/components/DataGrid/components/Header/Resizer/Resizer.cjs.map +1 -0
- package/dist/components/DataGrid/components/Header/Resizer/Resizer.d.ts +21 -0
- package/dist/components/DataGrid/components/Header/Resizer/Resizer.js +19 -0
- package/dist/components/DataGrid/components/Header/Resizer/Resizer.js.map +1 -0
- package/dist/components/DataGrid/components/Header/Resizer/Resizer.module.css.cjs +11 -0
- package/dist/components/DataGrid/components/Header/Resizer/Resizer.module.css.cjs.map +1 -0
- package/dist/components/DataGrid/components/Header/Resizer/Resizer.module.css.js +9 -0
- package/dist/components/DataGrid/components/Header/Resizer/Resizer.module.css.js.map +1 -0
- package/dist/components/DataGrid/components/Header/Resizer/index.d.ts +1 -0
- package/dist/components/DataGrid/components/Header/index.d.ts +1 -0
- package/dist/components/DataGrid/components/index.d.ts +5 -0
- package/dist/components/DataGrid/constants.cjs +12 -0
- package/dist/components/DataGrid/constants.cjs.map +1 -0
- package/dist/components/DataGrid/constants.d.ts +4 -0
- package/dist/components/DataGrid/constants.js +7 -0
- package/dist/components/DataGrid/constants.js.map +1 -0
- package/dist/components/DataGrid/hooks/index.d.ts +3 -0
- package/dist/components/DataGrid/hooks/usePinnedColumnLayout.cjs +39 -0
- package/dist/components/DataGrid/hooks/usePinnedColumnLayout.cjs.map +1 -0
- package/dist/components/DataGrid/hooks/usePinnedColumnLayout.d.ts +15 -0
- package/dist/components/DataGrid/hooks/usePinnedColumnLayout.js +37 -0
- package/dist/components/DataGrid/hooks/usePinnedColumnLayout.js.map +1 -0
- package/dist/components/DataGrid/hooks/usePinnedColumnStyles.cjs +22 -0
- package/dist/components/DataGrid/hooks/usePinnedColumnStyles.cjs.map +1 -0
- package/dist/components/DataGrid/hooks/usePinnedColumnStyles.d.ts +13 -0
- package/dist/components/DataGrid/hooks/usePinnedColumnStyles.js +20 -0
- package/dist/components/DataGrid/hooks/usePinnedColumnStyles.js.map +1 -0
- package/dist/components/DataGrid/hooks/useSortingState.cjs +40 -0
- package/dist/components/DataGrid/hooks/useSortingState.cjs.map +1 -0
- package/dist/components/DataGrid/hooks/useSortingState.d.ts +23 -0
- package/dist/components/DataGrid/hooks/useSortingState.js +38 -0
- package/dist/components/DataGrid/hooks/useSortingState.js.map +1 -0
- package/dist/components/DataGrid/index.d.ts +1 -0
- package/dist/components/DataGrid/types/AriaRoles.d.ts +4 -0
- package/dist/components/DataGrid/types/ColumnDefinition.d.ts +77 -0
- package/dist/components/DataGrid/types/DataGridProps.d.ts +85 -0
- package/dist/components/DataGrid/types/PinnedColumnState.d.ts +4 -0
- package/dist/components/DataGrid/types/SortState.d.ts +5 -0
- package/dist/components/DataGrid/types/declarations.d.ts +9 -0
- package/dist/components/DataGrid/types/enums.d.ts +3 -0
- package/dist/components/DataGrid/types/index.d.ts +6 -0
- package/dist/components/DataGrid/utils/ColumnMapper.cjs +96 -0
- package/dist/components/DataGrid/utils/ColumnMapper.cjs.map +1 -0
- package/dist/components/DataGrid/utils/ColumnMapper.d.ts +10 -0
- package/dist/components/DataGrid/utils/ColumnMapper.js +94 -0
- package/dist/components/DataGrid/utils/ColumnMapper.js.map +1 -0
- package/dist/components/DataGrid/utils/getAriaRoles.cjs +11 -0
- package/dist/components/DataGrid/utils/getAriaRoles.cjs.map +1 -0
- package/dist/components/DataGrid/utils/getAriaRoles.d.ts +2 -0
- package/dist/components/DataGrid/utils/getAriaRoles.js +9 -0
- package/dist/components/DataGrid/utils/getAriaRoles.js.map +1 -0
- package/dist/components/DataGrid/utils/index.d.ts +4 -0
- package/dist/components/DataGrid/utils/isLastColumn.cjs +11 -0
- package/dist/components/DataGrid/utils/isLastColumn.cjs.map +1 -0
- package/dist/components/DataGrid/utils/isLastColumn.d.ts +2 -0
- package/dist/components/DataGrid/utils/isLastColumn.js +9 -0
- package/dist/components/DataGrid/utils/isLastColumn.js.map +1 -0
- package/dist/components/DataGrid/utils/pinnedColumnUtils.cjs +33 -0
- package/dist/components/DataGrid/utils/pinnedColumnUtils.cjs.map +1 -0
- package/dist/components/DataGrid/utils/pinnedColumnUtils.d.ts +4 -0
- package/dist/components/DataGrid/utils/pinnedColumnUtils.js +30 -0
- package/dist/components/DataGrid/utils/pinnedColumnUtils.js.map +1 -0
- package/dist/components/DataTable/DataTable.cjs +5 -2
- package/dist/components/DataTable/DataTable.cjs.map +1 -1
- package/dist/components/DataTable/DataTable.js +5 -2
- package/dist/components/DataTable/DataTable.js.map +1 -1
- package/dist/components/DataTable/hooks/index.d.ts +0 -1
- package/dist/components/DataTable/index.d.ts +1 -1
- package/dist/components/FilterTag/FilterTag.cjs +1 -0
- package/dist/components/FilterTag/FilterTag.cjs.map +1 -1
- package/dist/components/FilterTag/FilterTag.js +1 -0
- package/dist/components/FilterTag/FilterTag.js.map +1 -1
- package/dist/components/SelectDropdown/ListItem/ListItem.cjs +1 -0
- package/dist/components/SelectDropdown/ListItem/ListItem.cjs.map +1 -1
- package/dist/components/SelectDropdown/ListItem/ListItem.js +1 -0
- package/dist/components/SelectDropdown/ListItem/ListItem.js.map +1 -1
- package/dist/components/VideoModal/VideoModal.cjs +1 -0
- package/dist/components/VideoModal/VideoModal.cjs.map +1 -1
- package/dist/components/VideoModal/VideoModal.js +1 -0
- package/dist/components/VideoModal/VideoModal.js.map +1 -1
- package/dist/components/View/View.cjs +1 -0
- package/dist/components/View/View.cjs.map +1 -1
- package/dist/components/View/View.js +1 -0
- package/dist/components/View/View.js.map +1 -1
- package/dist/components/ViewTab/ViewTab.cjs +1 -0
- package/dist/components/ViewTab/ViewTab.cjs.map +1 -1
- package/dist/components/ViewTab/ViewTab.js +1 -0
- package/dist/components/ViewTab/ViewTab.js.map +1 -1
- package/dist/components/index.d.ts +2 -1
- package/dist/hooks/index.d.ts +3 -0
- package/dist/{components/DataTable/hooks → hooks}/useDragToScroll.cjs +10 -2
- package/dist/hooks/useDragToScroll.cjs.map +1 -0
- package/dist/hooks/useDragToScroll.d.ts +12 -0
- package/dist/{components/DataTable/hooks → hooks}/useDragToScroll.js +10 -2
- package/dist/hooks/useDragToScroll.js.map +1 -0
- package/dist/hooks/useIntersectionObserver.cjs +57 -0
- package/dist/hooks/useIntersectionObserver.cjs.map +1 -0
- package/dist/hooks/useIntersectionObserver.d.ts +15 -0
- package/dist/hooks/useIntersectionObserver.js +51 -0
- package/dist/hooks/useIntersectionObserver.js.map +1 -0
- package/dist/hooks/useResizeObserver.cjs +67 -0
- package/dist/hooks/useResizeObserver.cjs.map +1 -0
- package/dist/hooks/useResizeObserver.d.ts +18 -0
- package/dist/hooks/useResizeObserver.js +61 -0
- package/dist/hooks/useResizeObserver.js.map +1 -0
- package/dist/index.cjs +8 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/theme/index.d.ts +1 -0
- package/dist/theme/modules/layers.cjs +1 -0
- package/dist/theme/modules/layers.cjs.map +1 -1
- package/dist/theme/modules/layers.d.ts +1 -0
- package/dist/theme/modules/layers.js +1 -0
- package/dist/theme/modules/layers.js.map +1 -1
- package/package.json +2 -1
- package/dist/components/DataTable/hooks/useDragToScroll.cjs.map +0 -1
- package/dist/components/DataTable/hooks/useDragToScroll.d.ts +0 -2
- package/dist/components/DataTable/hooks/useDragToScroll.js.map +0 -1
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import { DeepKeys } from '@tanstack/react-table';
|
|
3
|
+
export type ColumnAlignment = 'left' | 'center' | 'right';
|
|
4
|
+
export type ColumnAccessor<T> = (row: T) => any;
|
|
5
|
+
/**
|
|
6
|
+
* Basic column definition.
|
|
7
|
+
*/
|
|
8
|
+
export type BaseColumnDefinition = {
|
|
9
|
+
/**
|
|
10
|
+
* Column ID, this must be a string.
|
|
11
|
+
*/
|
|
12
|
+
id: string;
|
|
13
|
+
/**
|
|
14
|
+
* Column title.
|
|
15
|
+
*/
|
|
16
|
+
title: string;
|
|
17
|
+
/**
|
|
18
|
+
* Column alignment, used to control alignment of content within cells.
|
|
19
|
+
*/
|
|
20
|
+
align?: ColumnAlignment;
|
|
21
|
+
/**
|
|
22
|
+
* Indicates that the cell in this column is the header for its row.
|
|
23
|
+
*/
|
|
24
|
+
rowHeader?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Indicates whether the column is resizeable or not. If a column is resizeable, sizing should be
|
|
27
|
+
* provided to ensure columns are given necessary default width's for your content.
|
|
28
|
+
*/
|
|
29
|
+
resizeable?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Indicates whether the column is sortable or not.
|
|
32
|
+
*/
|
|
33
|
+
sortable?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Column width, only used when resizeable columns are enabled, otherwise the default table
|
|
36
|
+
* layout algorithm will be used to determine the best fit.
|
|
37
|
+
* @default 150
|
|
38
|
+
*/
|
|
39
|
+
width?: number;
|
|
40
|
+
/**
|
|
41
|
+
* Minimum column width, only used when resizeable columns are enabled.
|
|
42
|
+
* @default 120
|
|
43
|
+
*/
|
|
44
|
+
minWidth?: number;
|
|
45
|
+
/**
|
|
46
|
+
* Maximum column width, only used when resizeable columns are enabled.
|
|
47
|
+
* @default Number.MAX_SAFE_INTEGER
|
|
48
|
+
*/
|
|
49
|
+
maxWidth?: number;
|
|
50
|
+
/**
|
|
51
|
+
* Optional getter used to create an `aria-label` for the column header. If none is provided, the
|
|
52
|
+
* column's `title` will be used.
|
|
53
|
+
*/
|
|
54
|
+
getAriaLabel?: () => string;
|
|
55
|
+
/**
|
|
56
|
+
* Optional render method used to render a column footer.
|
|
57
|
+
*/
|
|
58
|
+
renderFooter?: () => ReactElement;
|
|
59
|
+
/**
|
|
60
|
+
* Optional render method used to render a custom column header in place of the column title.
|
|
61
|
+
*/
|
|
62
|
+
renderHeader?: () => ReactElement;
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* Column which has an underlying value in the model, can be sorted.
|
|
66
|
+
*/
|
|
67
|
+
export type DataColumnDefinition<T> = BaseColumnDefinition & {
|
|
68
|
+
field: DeepKeys<T> | ColumnAccessor<T>;
|
|
69
|
+
renderCell?: (fieldValue: any, row: T) => ReactElement | null | string;
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* Column which is purely for display, not part of the model, cannot be sorted.
|
|
73
|
+
*/
|
|
74
|
+
export type DisplayColumnDefinition<T> = BaseColumnDefinition & {
|
|
75
|
+
renderCell: (row: T) => ReactElement | null | string;
|
|
76
|
+
};
|
|
77
|
+
export type ColumnDefinition<T> = DataColumnDefinition<T> | DisplayColumnDefinition<T>;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import React, { AriaAttributes, ReactElement } from 'react';
|
|
2
|
+
import { SizeScale } from 'Theme/modules/sizes';
|
|
3
|
+
import { BorderMode, ResizeMode } from './enums';
|
|
4
|
+
import { ColumnDefinition } from './ColumnDefinition';
|
|
5
|
+
import { SortState } from './SortState';
|
|
6
|
+
import { PinnedColumnState } from './PinnedColumnState';
|
|
7
|
+
export type CustomState = {
|
|
8
|
+
iconSlot: ReactElement;
|
|
9
|
+
heading: string;
|
|
10
|
+
subHeading?: string;
|
|
11
|
+
};
|
|
12
|
+
export type DataGridProps = Pick<AriaAttributes, 'aria-label'> & {
|
|
13
|
+
/** General config */
|
|
14
|
+
/**
|
|
15
|
+
* Density, controls the spacing between rows in the table.
|
|
16
|
+
*
|
|
17
|
+
* @default 'base'
|
|
18
|
+
*/
|
|
19
|
+
density?: keyof SizeScale;
|
|
20
|
+
/**
|
|
21
|
+
* Enable/disable row striping.
|
|
22
|
+
*
|
|
23
|
+
* @default true
|
|
24
|
+
*/
|
|
25
|
+
striped?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Border mode, controls the border displayed in the container around the grid.
|
|
28
|
+
*
|
|
29
|
+
* @default 'full'
|
|
30
|
+
*/
|
|
31
|
+
borderMode?: BorderMode;
|
|
32
|
+
/**
|
|
33
|
+
* Resize mode, used to control whether or not columns within the grid can be resized. Use `onChange` to have columns resize as the user drags, `onEnd` to have them resize after the user
|
|
34
|
+
* releases the resize bar, or `off` to disable column resizing.
|
|
35
|
+
*
|
|
36
|
+
* If column resizing is disabled, columns will be sized according to the best fit as decided by the browser's table rendering algorithm.
|
|
37
|
+
*
|
|
38
|
+
* If column resizing is enabled, columns will be rendered with fixed column widths.
|
|
39
|
+
*
|
|
40
|
+
* @default 'off'
|
|
41
|
+
*/
|
|
42
|
+
resizeMode?: ResizeMode;
|
|
43
|
+
/**
|
|
44
|
+
* Additional styles to be applied to the grid container.
|
|
45
|
+
*/
|
|
46
|
+
containerStyle?: React.CSSProperties;
|
|
47
|
+
/** Columns */
|
|
48
|
+
/**
|
|
49
|
+
* Column definitions. It is not recommended that you modify these once the table has been initialized, since internal state
|
|
50
|
+
* is built based around the initial set of column definitions passed to the component.
|
|
51
|
+
*
|
|
52
|
+
* If you need to control visibility, pinning, or ordering, you can do so through other props (`hiddenColumns`, `columnOrder`, and `pinnedColumns`).
|
|
53
|
+
*/
|
|
54
|
+
columns: ColumnDefinition<any>[];
|
|
55
|
+
/**
|
|
56
|
+
* Hidden columns, an array of column ID's, can be used to hide columns in the table.
|
|
57
|
+
*/
|
|
58
|
+
hiddenColumns?: string[];
|
|
59
|
+
/**
|
|
60
|
+
* Column ordering, an array of column ID's, can be used to reorder columns in the table.
|
|
61
|
+
*/
|
|
62
|
+
columnOrdering?: string[];
|
|
63
|
+
/**
|
|
64
|
+
* Pinned columns, an object with two arrays of column ID's, one for columns pinned to the left and another for the right.
|
|
65
|
+
*/
|
|
66
|
+
pinnedColumns?: PinnedColumnState;
|
|
67
|
+
/** Rows */
|
|
68
|
+
/**
|
|
69
|
+
* Data to render within the table.
|
|
70
|
+
*/
|
|
71
|
+
data: any[];
|
|
72
|
+
/**
|
|
73
|
+
* Getter which returns the ID to use for a row (a string). If one isn't provided, the row index will be used instead.
|
|
74
|
+
*/
|
|
75
|
+
getRowId?: (row: any, index: number, parent?: any) => string;
|
|
76
|
+
/** Sorting */
|
|
77
|
+
/**
|
|
78
|
+
* The current sort state, including the selected column ID and sort direction.
|
|
79
|
+
*/
|
|
80
|
+
sortState?: SortState;
|
|
81
|
+
/**
|
|
82
|
+
* Handler called when the sort state changes.
|
|
83
|
+
*/
|
|
84
|
+
onSortChanged?: (sortState: SortState) => void;
|
|
85
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { ResizeMode, BorderMode } from './enums';
|
|
2
|
+
export { DataGridProps } from './DataGridProps';
|
|
3
|
+
export { AriaRoles } from './AriaRoles';
|
|
4
|
+
export { ColumnDefinition } from './ColumnDefinition';
|
|
5
|
+
export { SortState } from './SortState';
|
|
6
|
+
export { PinnedColumnState } from './PinnedColumnState';
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var reactTable = require('@tanstack/react-table');
|
|
4
|
+
var constants = require('../constants.cjs');
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Helper method which checks whether a given column definition is a `DataColumn`.
|
|
8
|
+
* @param column The column definition to check.
|
|
9
|
+
* @returns True if the column definition is a `DataColumn`, false otherwise.
|
|
10
|
+
*/
|
|
11
|
+
const isDataColumn = (column) => {
|
|
12
|
+
return column.field !== undefined;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Maps a column alignment to the equivalent flexbox alignment.
|
|
16
|
+
* @param align The column alingment to map.
|
|
17
|
+
* @returns The flexbox alignment.
|
|
18
|
+
*/
|
|
19
|
+
function alignmentToFlex(align) {
|
|
20
|
+
switch (align) {
|
|
21
|
+
case 'left':
|
|
22
|
+
return 'flex-start';
|
|
23
|
+
case 'center':
|
|
24
|
+
return 'center';
|
|
25
|
+
case 'right':
|
|
26
|
+
return 'flex-end';
|
|
27
|
+
default:
|
|
28
|
+
return 'flex-start';
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Validates a column definition, ensuring required properties are defined and values make sense.
|
|
33
|
+
* @param definition The column definition to validate.
|
|
34
|
+
* @throws Error if the column definition is invalid.
|
|
35
|
+
*/
|
|
36
|
+
const validateColumnDefinition = (definition) => {
|
|
37
|
+
if (!definition.id) {
|
|
38
|
+
throw new Error("[ColumnMapper] Column definition is missing an 'id' property.");
|
|
39
|
+
}
|
|
40
|
+
if (!isDataColumn(definition)) {
|
|
41
|
+
if (!definition.renderCell) {
|
|
42
|
+
throw new Error(`[ColumnMapper] Column '${definition.id}' is a display column but is missing a 'renderCell' property.`);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
if (definition.width && definition.minWidth && definition.width < definition.minWidth) {
|
|
46
|
+
throw new Error(`[ColumnMapper] Column '${definition.id}' has a size of ${definition.width} which is smaller than its minimum size of ${definition.minWidth}.`);
|
|
47
|
+
}
|
|
48
|
+
if (definition.width && definition.maxWidth && definition.width > definition.maxWidth) {
|
|
49
|
+
throw new Error(`[ColumnMapper] Column '${definition.id}' has a size of ${definition.width} which is larger than its maximum size of ${definition.maxWidth}.`);
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Mapper which validates and converts our ColumnDefinition's to a ColumnDef for use in TanStack Table.
|
|
54
|
+
*/
|
|
55
|
+
class ColumnMapper {
|
|
56
|
+
constructor() {
|
|
57
|
+
this.columnHelper = reactTable.createColumnHelper();
|
|
58
|
+
}
|
|
59
|
+
mapColumnDefinition(definition) {
|
|
60
|
+
var _a, _b, _c, _d, _e, _f;
|
|
61
|
+
const sharedColumnProps = {
|
|
62
|
+
id: definition.id,
|
|
63
|
+
enableResizing: !!definition.resizeable,
|
|
64
|
+
enableSorting: !!definition.sortable,
|
|
65
|
+
header: (_a = definition.renderHeader) !== null && _a !== undefined ? _a : definition.title,
|
|
66
|
+
footer: definition.renderFooter,
|
|
67
|
+
size: (_b = definition.width) !== null && _b !== undefined ? _b : constants.DEFAULT_COLUMN_WIDTH,
|
|
68
|
+
maxSize: (_c = definition.maxWidth) !== null && _c !== undefined ? _c : constants.DEFAULT_COLUMN_MAXIMUM_WIDTH,
|
|
69
|
+
minSize: (_d = definition.minWidth) !== null && _d !== undefined ? _d : constants.DEFAULT_COLUMN_MINIMUM_WIDTH,
|
|
70
|
+
meta: {
|
|
71
|
+
rowHeader: !!definition.rowHeader,
|
|
72
|
+
// Generate flex and text alignment based off column.align
|
|
73
|
+
justifyContent: alignmentToFlex((_e = definition.align) !== null && _e !== undefined ? _e : constants.DEFAULT_CELL_ALIGN),
|
|
74
|
+
textAlign: (_f = definition.align) !== null && _f !== undefined ? _f : constants.DEFAULT_CELL_ALIGN,
|
|
75
|
+
getAriaLabel: definition.getAriaLabel,
|
|
76
|
+
},
|
|
77
|
+
};
|
|
78
|
+
validateColumnDefinition(definition);
|
|
79
|
+
if (isDataColumn(definition)) {
|
|
80
|
+
return this.columnHelper.accessor(definition.field, {
|
|
81
|
+
...sharedColumnProps,
|
|
82
|
+
// enableSorting: definition.sortable ?? false,
|
|
83
|
+
cell: definition.renderCell
|
|
84
|
+
? (context) => definition.renderCell(context.getValue(), context.row.original)
|
|
85
|
+
: (context) => context.getValue(),
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
return this.columnHelper.display({
|
|
89
|
+
...sharedColumnProps,
|
|
90
|
+
cell: (context) => definition.renderCell(context.row.original),
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
exports.ColumnMapper = ColumnMapper;
|
|
96
|
+
//# sourceMappingURL=ColumnMapper.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ColumnMapper.cjs","sources":["../../../../src/components/DataGrid/utils/ColumnMapper.ts"],"sourcesContent":["import { ColumnDef, ColumnHelper, createColumnHelper } from '@tanstack/react-table';\nimport { ColumnDefinition, DataColumnDefinition, ColumnAlignment } from '../types/ColumnDefinition';\nimport {\n DEFAULT_CELL_ALIGN,\n DEFAULT_COLUMN_MAXIMUM_WIDTH,\n DEFAULT_COLUMN_MINIMUM_WIDTH,\n DEFAULT_COLUMN_WIDTH,\n} from '../constants';\n\n/**\n * Helper method which checks whether a given column definition is a `DataColumn`.\n * @param column The column definition to check.\n * @returns True if the column definition is a `DataColumn`, false otherwise.\n */\nconst isDataColumn = <T>(column: ColumnDefinition<T>): column is DataColumnDefinition<T> => {\n return (column as DataColumnDefinition<T>).field !== undefined;\n};\n\n/**\n * Maps a column alignment to the equivalent flexbox alignment.\n * @param align The column alingment to map.\n * @returns The flexbox alignment.\n */\nfunction alignmentToFlex(align: ColumnAlignment) {\n switch (align) {\n case 'left':\n return 'flex-start';\n case 'center':\n return 'center';\n case 'right':\n return 'flex-end';\n default:\n return 'flex-start';\n }\n}\n\n/**\n * Validates a column definition, ensuring required properties are defined and values make sense.\n * @param definition The column definition to validate.\n * @throws Error if the column definition is invalid.\n */\nconst validateColumnDefinition = (definition: ColumnDefinition<any>) => {\n if (!definition.id) {\n throw new Error(\"[ColumnMapper] Column definition is missing an 'id' property.\");\n }\n\n if (!isDataColumn(definition)) {\n if (!definition.renderCell) {\n throw new Error(\n `[ColumnMapper] Column '${definition.id}' is a display column but is missing a 'renderCell' property.`,\n );\n }\n }\n\n if (definition.width && definition.minWidth && definition.width < definition.minWidth) {\n throw new Error(\n `[ColumnMapper] Column '${definition.id}' has a size of ${definition.width} which is smaller than its minimum size of ${definition.minWidth}.`,\n );\n }\n\n if (definition.width && definition.maxWidth && definition.width > definition.maxWidth) {\n throw new Error(\n `[ColumnMapper] Column '${definition.id}' has a size of ${definition.width} which is larger than its maximum size of ${definition.maxWidth}.`,\n );\n }\n};\n\n/**\n * Mapper which validates and converts our ColumnDefinition's to a ColumnDef for use in TanStack Table.\n */\nexport class ColumnMapper {\n private columnHelper: ColumnHelper<any>;\n\n constructor() {\n this.columnHelper = createColumnHelper<any>();\n }\n\n mapColumnDefinition(definition: ColumnDefinition<any>): ColumnDef<any, any> {\n const sharedColumnProps = {\n id: definition.id,\n enableResizing: !!definition.resizeable,\n enableSorting: !!definition.sortable,\n\n header: definition.renderHeader ?? definition.title,\n footer: definition.renderFooter,\n\n size: definition.width ?? DEFAULT_COLUMN_WIDTH,\n maxSize: definition.maxWidth ?? DEFAULT_COLUMN_MAXIMUM_WIDTH,\n minSize: definition.minWidth ?? DEFAULT_COLUMN_MINIMUM_WIDTH,\n\n meta: {\n rowHeader: !!definition.rowHeader,\n // Generate flex and text alignment based off column.align\n justifyContent: alignmentToFlex(definition.align ?? DEFAULT_CELL_ALIGN),\n textAlign: definition.align ?? DEFAULT_CELL_ALIGN,\n getAriaLabel: definition.getAriaLabel,\n },\n };\n\n validateColumnDefinition(definition);\n\n if (isDataColumn(definition)) {\n return this.columnHelper.accessor(definition.field, {\n ...sharedColumnProps,\n // enableSorting: definition.sortable ?? false,\n cell: definition.renderCell\n ? (context) => definition.renderCell!(context.getValue(), context.row.original)\n : (context) => context.getValue(),\n });\n }\n\n return this.columnHelper.display({\n ...sharedColumnProps,\n cell: (context) => definition.renderCell(context.row.original),\n });\n }\n}\n"],"names":["createColumnHelper","DEFAULT_COLUMN_WIDTH","DEFAULT_COLUMN_MAXIMUM_WIDTH","DEFAULT_COLUMN_MINIMUM_WIDTH","DEFAULT_CELL_ALIGN"],"mappings":";;;;;AASA;;;;AAIG;AACH,MAAM,YAAY,GAAG,CAAI,MAA2B,KAAuC;AACzF,IAAA,OAAQ,MAAkC,CAAC,KAAK,KAAK,SAAS;AAChE,CAAC;AAED;;;;AAIG;AACH,SAAS,eAAe,CAAC,KAAsB,EAAA;AAC7C,IAAA,QAAQ,KAAK;AACX,QAAA,KAAK,MAAM;AACT,YAAA,OAAO,YAAY;AACrB,QAAA,KAAK,QAAQ;AACX,YAAA,OAAO,QAAQ;AACjB,QAAA,KAAK,OAAO;AACV,YAAA,OAAO,UAAU;AACnB,QAAA;AACE,YAAA,OAAO,YAAY;AACtB;AACH;AAEA;;;;AAIG;AACH,MAAM,wBAAwB,GAAG,CAAC,UAAiC,KAAI;AACrE,IAAA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AA,IAAI,EAAE,CAAC,OAAO,KAAK,UAAU,CAAC,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC;AAC/D,SAAA,CAAC;;AAEL;;;;"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ColumnDef } from '@tanstack/react-table';
|
|
2
|
+
import { ColumnDefinition } from '../types/ColumnDefinition';
|
|
3
|
+
/**
|
|
4
|
+
* Mapper which validates and converts our ColumnDefinition's to a ColumnDef for use in TanStack Table.
|
|
5
|
+
*/
|
|
6
|
+
export declare class ColumnMapper {
|
|
7
|
+
private columnHelper;
|
|
8
|
+
constructor();
|
|
9
|
+
mapColumnDefinition(definition: ColumnDefinition<any>): ColumnDef<any, any>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { createColumnHelper } from '@tanstack/react-table';
|
|
2
|
+
import { DEFAULT_COLUMN_WIDTH, DEFAULT_COLUMN_MAXIMUM_WIDTH, DEFAULT_COLUMN_MINIMUM_WIDTH, DEFAULT_CELL_ALIGN } from '../constants.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Helper method which checks whether a given column definition is a `DataColumn`.
|
|
6
|
+
* @param column The column definition to check.
|
|
7
|
+
* @returns True if the column definition is a `DataColumn`, false otherwise.
|
|
8
|
+
*/
|
|
9
|
+
const isDataColumn = (column) => {
|
|
10
|
+
return column.field !== undefined;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Maps a column alignment to the equivalent flexbox alignment.
|
|
14
|
+
* @param align The column alingment to map.
|
|
15
|
+
* @returns The flexbox alignment.
|
|
16
|
+
*/
|
|
17
|
+
function alignmentToFlex(align) {
|
|
18
|
+
switch (align) {
|
|
19
|
+
case 'left':
|
|
20
|
+
return 'flex-start';
|
|
21
|
+
case 'center':
|
|
22
|
+
return 'center';
|
|
23
|
+
case 'right':
|
|
24
|
+
return 'flex-end';
|
|
25
|
+
default:
|
|
26
|
+
return 'flex-start';
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Validates a column definition, ensuring required properties are defined and values make sense.
|
|
31
|
+
* @param definition The column definition to validate.
|
|
32
|
+
* @throws Error if the column definition is invalid.
|
|
33
|
+
*/
|
|
34
|
+
const validateColumnDefinition = (definition) => {
|
|
35
|
+
if (!definition.id) {
|
|
36
|
+
throw new Error("[ColumnMapper] Column definition is missing an 'id' property.");
|
|
37
|
+
}
|
|
38
|
+
if (!isDataColumn(definition)) {
|
|
39
|
+
if (!definition.renderCell) {
|
|
40
|
+
throw new Error(`[ColumnMapper] Column '${definition.id}' is a display column but is missing a 'renderCell' property.`);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
if (definition.width && definition.minWidth && definition.width < definition.minWidth) {
|
|
44
|
+
throw new Error(`[ColumnMapper] Column '${definition.id}' has a size of ${definition.width} which is smaller than its minimum size of ${definition.minWidth}.`);
|
|
45
|
+
}
|
|
46
|
+
if (definition.width && definition.maxWidth && definition.width > definition.maxWidth) {
|
|
47
|
+
throw new Error(`[ColumnMapper] Column '${definition.id}' has a size of ${definition.width} which is larger than its maximum size of ${definition.maxWidth}.`);
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Mapper which validates and converts our ColumnDefinition's to a ColumnDef for use in TanStack Table.
|
|
52
|
+
*/
|
|
53
|
+
class ColumnMapper {
|
|
54
|
+
constructor() {
|
|
55
|
+
this.columnHelper = createColumnHelper();
|
|
56
|
+
}
|
|
57
|
+
mapColumnDefinition(definition) {
|
|
58
|
+
var _a, _b, _c, _d, _e, _f;
|
|
59
|
+
const sharedColumnProps = {
|
|
60
|
+
id: definition.id,
|
|
61
|
+
enableResizing: !!definition.resizeable,
|
|
62
|
+
enableSorting: !!definition.sortable,
|
|
63
|
+
header: (_a = definition.renderHeader) !== null && _a !== undefined ? _a : definition.title,
|
|
64
|
+
footer: definition.renderFooter,
|
|
65
|
+
size: (_b = definition.width) !== null && _b !== undefined ? _b : DEFAULT_COLUMN_WIDTH,
|
|
66
|
+
maxSize: (_c = definition.maxWidth) !== null && _c !== undefined ? _c : DEFAULT_COLUMN_MAXIMUM_WIDTH,
|
|
67
|
+
minSize: (_d = definition.minWidth) !== null && _d !== undefined ? _d : DEFAULT_COLUMN_MINIMUM_WIDTH,
|
|
68
|
+
meta: {
|
|
69
|
+
rowHeader: !!definition.rowHeader,
|
|
70
|
+
// Generate flex and text alignment based off column.align
|
|
71
|
+
justifyContent: alignmentToFlex((_e = definition.align) !== null && _e !== undefined ? _e : DEFAULT_CELL_ALIGN),
|
|
72
|
+
textAlign: (_f = definition.align) !== null && _f !== undefined ? _f : DEFAULT_CELL_ALIGN,
|
|
73
|
+
getAriaLabel: definition.getAriaLabel,
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
validateColumnDefinition(definition);
|
|
77
|
+
if (isDataColumn(definition)) {
|
|
78
|
+
return this.columnHelper.accessor(definition.field, {
|
|
79
|
+
...sharedColumnProps,
|
|
80
|
+
// enableSorting: definition.sortable ?? false,
|
|
81
|
+
cell: definition.renderCell
|
|
82
|
+
? (context) => definition.renderCell(context.getValue(), context.row.original)
|
|
83
|
+
: (context) => context.getValue(),
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
return this.columnHelper.display({
|
|
87
|
+
...sharedColumnProps,
|
|
88
|
+
cell: (context) => definition.renderCell(context.row.original),
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export { ColumnMapper };
|
|
94
|
+
//# sourceMappingURL=ColumnMapper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ColumnMapper.js","sources":["../../../../src/components/DataGrid/utils/ColumnMapper.ts"],"sourcesContent":["import { ColumnDef, ColumnHelper, createColumnHelper } from '@tanstack/react-table';\nimport { ColumnDefinition, DataColumnDefinition, ColumnAlignment } from '../types/ColumnDefinition';\nimport {\n DEFAULT_CELL_ALIGN,\n DEFAULT_COLUMN_MAXIMUM_WIDTH,\n DEFAULT_COLUMN_MINIMUM_WIDTH,\n DEFAULT_COLUMN_WIDTH,\n} from '../constants';\n\n/**\n * Helper method which checks whether a given column definition is a `DataColumn`.\n * @param column The column definition to check.\n * @returns True if the column definition is a `DataColumn`, false otherwise.\n */\nconst isDataColumn = <T>(column: ColumnDefinition<T>): column is DataColumnDefinition<T> => {\n return (column as DataColumnDefinition<T>).field !== undefined;\n};\n\n/**\n * Maps a column alignment to the equivalent flexbox alignment.\n * @param align The column alingment to map.\n * @returns The flexbox alignment.\n */\nfunction alignmentToFlex(align: ColumnAlignment) {\n switch (align) {\n case 'left':\n return 'flex-start';\n case 'center':\n return 'center';\n case 'right':\n return 'flex-end';\n default:\n return 'flex-start';\n }\n}\n\n/**\n * Validates a column definition, ensuring required properties are defined and values make sense.\n * @param definition The column definition to validate.\n * @throws Error if the column definition is invalid.\n */\nconst validateColumnDefinition = (definition: ColumnDefinition<any>) => {\n if (!definition.id) {\n throw new Error(\"[ColumnMapper] Column definition is missing an 'id' property.\");\n }\n\n if (!isDataColumn(definition)) {\n if (!definition.renderCell) {\n throw new Error(\n `[ColumnMapper] Column '${definition.id}' is a display column but is missing a 'renderCell' property.`,\n );\n }\n }\n\n if (definition.width && definition.minWidth && definition.width < definition.minWidth) {\n throw new Error(\n `[ColumnMapper] Column '${definition.id}' has a size of ${definition.width} which is smaller than its minimum size of ${definition.minWidth}.`,\n );\n }\n\n if (definition.width && definition.maxWidth && definition.width > definition.maxWidth) {\n throw new Error(\n `[ColumnMapper] Column '${definition.id}' has a size of ${definition.width} which is larger than its maximum size of ${definition.maxWidth}.`,\n );\n }\n};\n\n/**\n * Mapper which validates and converts our ColumnDefinition's to a ColumnDef for use in TanStack Table.\n */\nexport class ColumnMapper {\n private columnHelper: ColumnHelper<any>;\n\n constructor() {\n this.columnHelper = createColumnHelper<any>();\n }\n\n mapColumnDefinition(definition: ColumnDefinition<any>): ColumnDef<any, any> {\n const sharedColumnProps = {\n id: definition.id,\n enableResizing: !!definition.resizeable,\n enableSorting: !!definition.sortable,\n\n header: definition.renderHeader ?? definition.title,\n footer: definition.renderFooter,\n\n size: definition.width ?? DEFAULT_COLUMN_WIDTH,\n maxSize: definition.maxWidth ?? DEFAULT_COLUMN_MAXIMUM_WIDTH,\n minSize: definition.minWidth ?? DEFAULT_COLUMN_MINIMUM_WIDTH,\n\n meta: {\n rowHeader: !!definition.rowHeader,\n // Generate flex and text alignment based off column.align\n justifyContent: alignmentToFlex(definition.align ?? DEFAULT_CELL_ALIGN),\n textAlign: definition.align ?? DEFAULT_CELL_ALIGN,\n getAriaLabel: definition.getAriaLabel,\n },\n };\n\n validateColumnDefinition(definition);\n\n if (isDataColumn(definition)) {\n return this.columnHelper.accessor(definition.field, {\n ...sharedColumnProps,\n // enableSorting: definition.sortable ?? false,\n cell: definition.renderCell\n ? (context) => definition.renderCell!(context.getValue(), context.row.original)\n : (context) => context.getValue(),\n });\n }\n\n return this.columnHelper.display({\n ...sharedColumnProps,\n cell: (context) => definition.renderCell(context.row.original),\n });\n }\n}\n"],"names":[],"mappings":";;;AASA;;;;AAIG;AACH,MAAM,YAAY,GAAG,CAAI,MAA2B,KAAuC;AACzF,IAAA,OAAQ,MAAkC,CAAC,KAAK,KAAK,SAAS;AAChE,CAAC;AAED;;;;AAIG;AACH,SAAS,eAAe,CAAC,KAAsB,EAAA;AAC7C,IAAA,QAAQ,KAAK;AACX,QAAA,KAAK,MAAM;AACT,YAAA,OAAO,YAAY;AACrB,QAAA,KAAK,QAAQ;AACX,YAAA,OAAO,QAAQ;AACjB,QAAA,KAAK,OAAO;AACV,YAAA,OAAO,UAAU;AACnB,QAAA;AACE,YAAA,OAAO,YAAY;AACtB;AACH;AAEA;;;;AAIG;AACH,MAAM,wBAAwB,GAAG,CAAC,UAAiC,KAAI;AACrE,IAAA,IAAI,CAAC,UAAU,CAAC,EAAE,EAAE;AAClB,QAAA,MAAM,IAAI,KAAK,CAA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AC,QAAQ,CAAC;AAC/D,SAAA,CAAC;;AAEL;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getAriaRoles.cjs","sources":["../../../../src/components/DataGrid/utils/getAriaRoles.ts"],"sourcesContent":["import { AriaRoles } from '../types/AriaRoles';\n\nexport const getAriaRoles = (): AriaRoles => {\n return {\n table: 'table',\n cell: 'cell',\n };\n};\n"],"names":[],"mappings":";;AAEO,MAAM,YAAY,GAAG,MAAgB;IAC1C,OAAO;AACL,QAAA,KAAK,EAAE,OAAO;AACd,QAAA,IAAI,EAAE,MAAM;KACb;AACH;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getAriaRoles.js","sources":["../../../../src/components/DataGrid/utils/getAriaRoles.ts"],"sourcesContent":["import { AriaRoles } from '../types/AriaRoles';\n\nexport const getAriaRoles = (): AriaRoles => {\n return {\n table: 'table',\n cell: 'cell',\n };\n};\n"],"names":[],"mappings":"AAEO,MAAM,YAAY,GAAG,MAAgB;IAC1C,OAAO;AACL,QAAA,KAAK,EAAE,OAAO;AACd,QAAA,IAAI,EAAE,MAAM;KACb;AACH;;;;"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const isLastColumn = (table, column) => {
|
|
4
|
+
if (table.getIsSomeColumnsPinned('right')) {
|
|
5
|
+
return column.getIsLastColumn('right');
|
|
6
|
+
}
|
|
7
|
+
return column.getIsLastColumn();
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
exports.isLastColumn = isLastColumn;
|
|
11
|
+
//# sourceMappingURL=isLastColumn.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isLastColumn.cjs","sources":["../../../../src/components/DataGrid/utils/isLastColumn.ts"],"sourcesContent":["import { Column, Table } from '@tanstack/react-table';\n\nexport const isLastColumn = (table: Table<any>, column: Column<any, any>) => {\n if (table.getIsSomeColumnsPinned('right')) {\n return column.getIsLastColumn('right');\n }\n\n return column.getIsLastColumn();\n};\n"],"names":[],"mappings":";;MAEa,YAAY,GAAG,CAAC,KAAiB,EAAE,MAAwB,KAAI;AAC1E,IAAA,IAAI,KAAK,CAAC,sBAAsB,CAAC,OAAO,CAAC,EAAE;AACzC,QAAA,OAAO,MAAM,CAAC,eAAe,CAAC,OAAO,CAAC;AACvC;AAED,IAAA,OAAO,MAAM,CAAC,eAAe,EAAE;AACjC;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isLastColumn.js","sources":["../../../../src/components/DataGrid/utils/isLastColumn.ts"],"sourcesContent":["import { Column, Table } from '@tanstack/react-table';\n\nexport const isLastColumn = (table: Table<any>, column: Column<any, any>) => {\n if (table.getIsSomeColumnsPinned('right')) {\n return column.getIsLastColumn('right');\n }\n\n return column.getIsLastColumn();\n};\n"],"names":[],"mappings":"MAEa,YAAY,GAAG,CAAC,KAAiB,EAAE,MAAwB,KAAI;AAC1E,IAAA,IAAI,KAAK,CAAC,sBAAsB,CAAC,OAAO,CAAC,EAAE;AACzC,QAAA,OAAO,MAAM,CAAC,eAAe,CAAC,OAAO,CAAC;AACvC;AAED,IAAA,OAAO,MAAM,CAAC,eAAe,EAAE;AACjC;;;;"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var DataGrid_module = require('../DataGrid.module.css.cjs');
|
|
4
|
+
|
|
5
|
+
const getPinnedColumnStyles = (column) => {
|
|
6
|
+
const isPinned = column.getIsPinned();
|
|
7
|
+
if (!isPinned) {
|
|
8
|
+
return {};
|
|
9
|
+
}
|
|
10
|
+
return {
|
|
11
|
+
left: isPinned === 'left' ? `var(--${column.id}-start)` : undefined,
|
|
12
|
+
right: isPinned === 'right' ? `var(--${column.id}-after)` : undefined,
|
|
13
|
+
opacity: isPinned ? 0.95 : undefined,
|
|
14
|
+
position: isPinned ? 'sticky' : undefined,
|
|
15
|
+
zIndex: isPinned ? 1 : undefined,
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
const getPinnedColumnClassNames = (column) => {
|
|
19
|
+
const isPinned = column.getIsPinned();
|
|
20
|
+
const isLastLeftPinnedColumn = isPinned === 'left' && column.getIsLastColumn('left');
|
|
21
|
+
const isFirstRightPinnedColumn = isPinned === 'right' && column.getIsFirstColumn('right');
|
|
22
|
+
if (isLastLeftPinnedColumn) {
|
|
23
|
+
return DataGrid_module.pinnedColumnLeft;
|
|
24
|
+
}
|
|
25
|
+
if (isFirstRightPinnedColumn) {
|
|
26
|
+
return DataGrid_module.pinnedColumnRight;
|
|
27
|
+
}
|
|
28
|
+
return '';
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
exports.getPinnedColumnClassNames = getPinnedColumnClassNames;
|
|
32
|
+
exports.getPinnedColumnStyles = getPinnedColumnStyles;
|
|
33
|
+
//# sourceMappingURL=pinnedColumnUtils.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pinnedColumnUtils.cjs","sources":["../../../../src/components/DataGrid/utils/pinnedColumnUtils.ts"],"sourcesContent":["import { Column } from '@tanstack/react-table';\nimport { CSSProperties } from 'react';\n\nimport { pinnedColumnLeft, pinnedColumnRight } from '../DataGrid.module.css';\n\nexport const getPinnedColumnStyles = (column: Column<any>): CSSProperties => {\n const isPinned = column.getIsPinned();\n\n if (!isPinned) {\n return {};\n }\n\n return {\n left: isPinned === 'left' ? `var(--${column.id}-start)` : undefined,\n right: isPinned === 'right' ? `var(--${column.id}-after)` : undefined,\n opacity: isPinned ? 0.95 : undefined,\n position: isPinned ? 'sticky' : undefined,\n zIndex: isPinned ? 1 : undefined,\n };\n};\n\nexport const getPinnedColumnClassNames = (column: Column<any>) => {\n const isPinned = column.getIsPinned();\n\n const isLastLeftPinnedColumn = isPinned === 'left' && column.getIsLastColumn('left');\n const isFirstRightPinnedColumn = isPinned === 'right' && column.getIsFirstColumn('right');\n\n if (isLastLeftPinnedColumn) {\n return pinnedColumnLeft;\n }\n\n if (isFirstRightPinnedColumn) {\n return pinnedColumnRight;\n }\n\n return '';\n};\n"],"names":["pinnedColumnLeft","pinnedColumnRight"],"mappings":";;;;AAKa,MAAA,qBAAqB,GAAG,CAAC,MAAmB,KAAmB;AAC1E,IAAA,MAAM,QAAQ,GAAG,MAAM,CAAC,WAAW,EAAE;IAErC,IAAI,CAAC,QAAQ,EAAE;AACb,QAAA,OAAO,EAAE;AACV;IAED,OAAO;AACL,QAAA,IAAI,EAAE,QAAQ,KAAK,MAAM,GAAG,CAAS,MAAA,EAAA,MAAM,CAAC,EAAE,CAAA,OAAA,CAAS,GAAG,SAAS;AACnE,QAAA,KAAK,EAAE,QAAQ,KAAK,OAAO,GAAG,CAAS,MAAA,EAAA,MAAM,CAAC,EAAE,CAAA,OAAA,CAAS,GAAG,SAAS;QACrE,OAAO,EAAE,QAAQ,GAAG,IAAI,GAAG,SAAS;QACpC,QAAQ,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS;QACzC,MAAM,EAAE,QAAQ,GAAG,CAAC,GAAG,SAAS;KACjC;AACH;AAEa,MAAA,yBAAyB,GAAG,CAAC,MAAmB,KAAI;AAC/D,IAAA,MAAM,QAAQ,GAAG,MAAM,CAAC,WAAW,EAAE;AAErC,IAAA,MAAM,sBAAsB,GAAG,QAAQ,KAAK,MAAM,IAAI,MAAM,CAAC,eAAe,CAAC,MAAM,CAAC;AACpF,IAAA,MAAM,wBAAwB,GAAG,QAAQ,KAAK,OAAO,IAAI,MAAM,CAAC,gBAAgB,CAAC,OAAO,CAAC;AAEzF,IAAA,IAAI,sBAAsB,EAAE;AAC1B,QAAA,OAAOA,gCAAgB;AACxB;AAED,IAAA,IAAI,wBAAwB,EAAE;AAC5B,QAAA,OAAOC,iCAAiB;AACzB;AAED,IAAA,OAAO,EAAE;AACX;;;;;"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { pinnedColumnLeft, pinnedColumnRight } from '../DataGrid.module.css.js';
|
|
2
|
+
|
|
3
|
+
const getPinnedColumnStyles = (column) => {
|
|
4
|
+
const isPinned = column.getIsPinned();
|
|
5
|
+
if (!isPinned) {
|
|
6
|
+
return {};
|
|
7
|
+
}
|
|
8
|
+
return {
|
|
9
|
+
left: isPinned === 'left' ? `var(--${column.id}-start)` : undefined,
|
|
10
|
+
right: isPinned === 'right' ? `var(--${column.id}-after)` : undefined,
|
|
11
|
+
opacity: isPinned ? 0.95 : undefined,
|
|
12
|
+
position: isPinned ? 'sticky' : undefined,
|
|
13
|
+
zIndex: isPinned ? 1 : undefined,
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
const getPinnedColumnClassNames = (column) => {
|
|
17
|
+
const isPinned = column.getIsPinned();
|
|
18
|
+
const isLastLeftPinnedColumn = isPinned === 'left' && column.getIsLastColumn('left');
|
|
19
|
+
const isFirstRightPinnedColumn = isPinned === 'right' && column.getIsFirstColumn('right');
|
|
20
|
+
if (isLastLeftPinnedColumn) {
|
|
21
|
+
return pinnedColumnLeft;
|
|
22
|
+
}
|
|
23
|
+
if (isFirstRightPinnedColumn) {
|
|
24
|
+
return pinnedColumnRight;
|
|
25
|
+
}
|
|
26
|
+
return '';
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export { getPinnedColumnClassNames, getPinnedColumnStyles };
|
|
30
|
+
//# sourceMappingURL=pinnedColumnUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pinnedColumnUtils.js","sources":["../../../../src/components/DataGrid/utils/pinnedColumnUtils.ts"],"sourcesContent":["import { Column } from '@tanstack/react-table';\nimport { CSSProperties } from 'react';\n\nimport { pinnedColumnLeft, pinnedColumnRight } from '../DataGrid.module.css';\n\nexport const getPinnedColumnStyles = (column: Column<any>): CSSProperties => {\n const isPinned = column.getIsPinned();\n\n if (!isPinned) {\n return {};\n }\n\n return {\n left: isPinned === 'left' ? `var(--${column.id}-start)` : undefined,\n right: isPinned === 'right' ? `var(--${column.id}-after)` : undefined,\n opacity: isPinned ? 0.95 : undefined,\n position: isPinned ? 'sticky' : undefined,\n zIndex: isPinned ? 1 : undefined,\n };\n};\n\nexport const getPinnedColumnClassNames = (column: Column<any>) => {\n const isPinned = column.getIsPinned();\n\n const isLastLeftPinnedColumn = isPinned === 'left' && column.getIsLastColumn('left');\n const isFirstRightPinnedColumn = isPinned === 'right' && column.getIsFirstColumn('right');\n\n if (isLastLeftPinnedColumn) {\n return pinnedColumnLeft;\n }\n\n if (isFirstRightPinnedColumn) {\n return pinnedColumnRight;\n }\n\n return '';\n};\n"],"names":[],"mappings":";;AAKa,MAAA,qBAAqB,GAAG,CAAC,MAAmB,KAAmB;AAC1E,IAAA,MAAM,QAAQ,GAAG,MAAM,CAAC,WAAW,EAAE;IAErC,IAAI,CAAC,QAAQ,EAAE;AACb,QAAA,OAAO,EAAE;AACV;IAED,OAAO;AACL,QAAA,IAAI,EAAE,QAAQ,KAAK,MAAM,GAAG,CAAS,MAAA,EAAA,MAAM,CAAC,EAAE,CAAA,OAAA,CAAS,GAAG,SAAS;AACnE,QAAA,KAAK,EAAE,QAAQ,KAAK,OAAO,GAAG,CAAS,MAAA,EAAA,MAAM,CAAC,EAAE,CAAA,OAAA,CAAS,GAAG,SAAS;QACrE,OAAO,EAAE,QAAQ,GAAG,IAAI,GAAG,SAAS;QACpC,QAAQ,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS;QACzC,MAAM,EAAE,QAAQ,GAAG,CAAC,GAAG,SAAS;KACjC;AACH;AAEa,MAAA,yBAAyB,GAAG,CAAC,MAAmB,KAAI;AAC/D,IAAA,MAAM,QAAQ,GAAG,MAAM,CAAC,WAAW,EAAE;AAErC,IAAA,MAAM,sBAAsB,GAAG,QAAQ,KAAK,MAAM,IAAI,MAAM,CAAC,eAAe,CAAC,MAAM,CAAC;AACpF,IAAA,MAAM,wBAAwB,GAAG,QAAQ,KAAK,OAAO,IAAI,MAAM,CAAC,gBAAgB,CAAC,OAAO,CAAC;AAEzF,IAAA,IAAI,sBAAsB,EAAE;AAC1B,QAAA,OAAO,gBAAgB;AACxB;AAED,IAAA,IAAI,wBAAwB,EAAE;AAC5B,QAAA,OAAO,iBAAiB;AACzB;AAED,IAAA,OAAO,EAAE;AACX;;;;"}
|
|
@@ -3,6 +3,10 @@
|
|
|
3
3
|
var React = require('react');
|
|
4
4
|
var Stack = require('../Stack/Stack.cjs');
|
|
5
5
|
var Text = require('../Text/Text.cjs');
|
|
6
|
+
require('../../hooks/useFocusVisible.cjs');
|
|
7
|
+
require('uid/secure');
|
|
8
|
+
var useDragToScroll = require('../../hooks/useDragToScroll.cjs');
|
|
9
|
+
require('lodash.throttle');
|
|
6
10
|
var generateTableCss = require('./utils/generateTableCss.cjs');
|
|
7
11
|
require('./types.cjs');
|
|
8
12
|
require('../../theme/modules/shadows.cjs');
|
|
@@ -11,7 +15,6 @@ require('../../theme/modules/text.cjs');
|
|
|
11
15
|
require('styled-components');
|
|
12
16
|
var useCellWidths = require('./hooks/useCellWidths.cjs');
|
|
13
17
|
var useColumns = require('./hooks/useColumns.cjs');
|
|
14
|
-
var useDragToScroll = require('./hooks/useDragToScroll.cjs');
|
|
15
18
|
var useScrollPosition = require('./hooks/useScrollPosition.cjs');
|
|
16
19
|
var useSelection = require('./hooks/useSelection.cjs');
|
|
17
20
|
var renderCell = require('./renderers/renderCell.cjs');
|
|
@@ -51,7 +54,7 @@ const DataTable = ({ actionBarSlot, borderMode, columns: initialColumns, emptySt
|
|
|
51
54
|
const scrollContainerRef = React.useRef(null);
|
|
52
55
|
const tableRef = React.useRef(null);
|
|
53
56
|
const intersectionTargetRef = React.useRef(null);
|
|
54
|
-
useDragToScroll.useDragToScroll(scrollContainerRef);
|
|
57
|
+
useDragToScroll.useDragToScroll({ targetRef: scrollContainerRef, ignoreClassName: 'th-divider' });
|
|
55
58
|
// Configure row selection
|
|
56
59
|
const enabledRowIds = rows.map((row) => row.id).filter((id) => !(disabledRowIds === null || disabledRowIds === undefined ? undefined : disabledRowIds.includes(id)));
|
|
57
60
|
const { selectionEnabled, selectedRowIds, selectionColumn, setSelected } = useSelection.useSelection({
|