@veeqo/ui 9.7.1 → 9.9.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/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 +104 -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 +98 -0
- package/dist/components/DataGrid/DataGrid.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 +29 -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 +23 -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 +25 -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 +19 -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 +25 -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 +19 -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 +40 -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 +34 -0
- package/dist/components/DataGrid/components/Header/HeaderCell/HeaderCell.js.map +1 -0
- package/dist/components/DataGrid/components/Header/HeaderCell/HeaderCell.module.css.cjs +15 -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 +11 -0
- package/dist/components/DataGrid/components/Header/HeaderCell/HeaderCell.module.css.js.map +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/index.d.ts +1 -0
- package/dist/components/DataGrid/types/AriaRoles.d.ts +4 -0
- package/dist/components/DataGrid/types/ColumnDefinition.d.ts +75 -0
- package/dist/components/DataGrid/types/DataGridProps.d.ts +70 -0
- package/dist/components/DataGrid/types/declarations.d.ts +9 -0
- package/dist/components/DataGrid/types/enums.d.ts +2 -0
- package/dist/components/DataGrid/types/index.d.ts +4 -0
- package/dist/components/DataGrid/utils/ColumnMapper.cjs +95 -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 +93 -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 +3 -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/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/Modal/Modal.cjs +26 -6
- package/dist/components/Modal/Modal.cjs.map +1 -1
- package/dist/components/Modal/Modal.js +27 -7
- package/dist/components/Modal/Modal.js.map +1 -1
- package/dist/components/Modal/components/Dialog/Dialog.cjs.map +1 -1
- package/dist/components/Modal/components/Dialog/Dialog.d.ts +2 -1
- package/dist/components/Modal/components/Dialog/Dialog.js.map +1 -1
- package/dist/components/Modal/components/Dialog/styled.cjs +34 -11
- package/dist/components/Modal/components/Dialog/styled.cjs.map +1 -1
- package/dist/components/Modal/components/Dialog/styled.d.ts +4 -22
- package/dist/components/Modal/components/Dialog/styled.js +34 -11
- package/dist/components/Modal/components/Dialog/styled.js.map +1 -1
- package/dist/components/Modal/components/Dialog/styles/baseStyles.cjs +13 -0
- package/dist/components/Modal/components/Dialog/styles/baseStyles.cjs.map +1 -0
- package/dist/components/Modal/components/Dialog/styles/baseStyles.d.ts +4 -0
- package/dist/components/Modal/components/Dialog/styles/baseStyles.js +11 -0
- package/dist/components/Modal/components/Dialog/styles/baseStyles.js.map +1 -0
- package/dist/components/Modal/components/Dialog/styles/modalTypeStyles.cjs +17 -0
- package/dist/components/Modal/components/Dialog/styles/modalTypeStyles.cjs.map +1 -0
- package/dist/components/Modal/components/Dialog/styles/modalTypeStyles.d.ts +6 -0
- package/dist/components/Modal/components/Dialog/styles/modalTypeStyles.js +13 -0
- package/dist/components/Modal/components/Dialog/styles/modalTypeStyles.js.map +1 -0
- package/dist/components/Modal/types.cjs +7 -0
- package/dist/components/Modal/types.cjs.map +1 -1
- package/dist/components/Modal/types.d.ts +56 -7
- package/dist/components/Modal/types.js +7 -1
- package/dist/components/Modal/types.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
|
@@ -5,6 +5,7 @@ var reactAriaComponents = require('react-aria-components');
|
|
|
5
5
|
var Dropdown = require('../Dropdown/Dropdown.cjs');
|
|
6
6
|
require('../../hooks/useFocusVisible.cjs');
|
|
7
7
|
var useId = require('../../hooks/useId.cjs');
|
|
8
|
+
require('lodash.throttle');
|
|
8
9
|
var styled = require('./styled.cjs');
|
|
9
10
|
|
|
10
11
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionMenu.cjs","sources":["../../../src/components/ActionMenu/ActionMenu.tsx"],"sourcesContent":["import React, { ReactNode, useState } from 'react';\nimport { Menu, MenuItemProps, Text } from 'react-aria-components';\nimport { Dropdown } from '../Dropdown';\nimport { useId } from '../../hooks';\nimport { ButtonProps } from '../Button/types';\nimport { MenuItem, Section } from './styled';\n\nexport type ActionMenuProps = {\n id?: string;\n menuLabel?: string;\n actions?: MenuItemProps[];\n ctaProps: ButtonProps;\n children?: ReactNode;\n};\n\nexport const ActionMenu = ({ id, menuLabel, ctaProps, actions, children }: ActionMenuProps) => {\n const [shouldShow, setShouldShow] = useState(false);\n const idComputed = useId({ id, prefix: 'action-menu' });\n\n const onKeyDown: React.KeyboardEventHandler<HTMLDialogElement> = (e) => {\n if (e.code === 'Escape' || e.code === 'Tab') setShouldShow(false);\n e.preventDefault();\n };\n\n return (\n <Dropdown\n id={idComputed}\n style={{ padding: '0' }}\n shouldShow={shouldShow}\n setShouldShow={setShouldShow}\n ctaProps={{ size: 'sm', ...ctaProps }}\n useAnchorWidth\n onKeyDown={onKeyDown}\n >\n <Menu\n onClose={() => setShouldShow(false)}\n aria-label={menuLabel || ctaProps.children?.toString()}\n >\n {actions?.map((action) => (\n <MenuItem {...action} key={action.id || action.children?.toString()} />\n ))}\n\n {children}\n </Menu>\n </Dropdown>\n );\n};\n\nActionMenu.Item = MenuItem;\nActionMenu.Section = Section;\nActionMenu.Text = Text;\n"],"names":["useState","useId","React","Dropdown","Menu","MenuItem","Section","Text"],"mappings":"
|
|
1
|
+
{"version":3,"file":"ActionMenu.cjs","sources":["../../../src/components/ActionMenu/ActionMenu.tsx"],"sourcesContent":["import React, { ReactNode, useState } from 'react';\nimport { Menu, MenuItemProps, Text } from 'react-aria-components';\nimport { Dropdown } from '../Dropdown';\nimport { useId } from '../../hooks';\nimport { ButtonProps } from '../Button/types';\nimport { MenuItem, Section } from './styled';\n\nexport type ActionMenuProps = {\n id?: string;\n menuLabel?: string;\n actions?: MenuItemProps[];\n ctaProps: ButtonProps;\n children?: ReactNode;\n};\n\nexport const ActionMenu = ({ id, menuLabel, ctaProps, actions, children }: ActionMenuProps) => {\n const [shouldShow, setShouldShow] = useState(false);\n const idComputed = useId({ id, prefix: 'action-menu' });\n\n const onKeyDown: React.KeyboardEventHandler<HTMLDialogElement> = (e) => {\n if (e.code === 'Escape' || e.code === 'Tab') setShouldShow(false);\n e.preventDefault();\n };\n\n return (\n <Dropdown\n id={idComputed}\n style={{ padding: '0' }}\n shouldShow={shouldShow}\n setShouldShow={setShouldShow}\n ctaProps={{ size: 'sm', ...ctaProps }}\n useAnchorWidth\n onKeyDown={onKeyDown}\n >\n <Menu\n onClose={() => setShouldShow(false)}\n aria-label={menuLabel || ctaProps.children?.toString()}\n >\n {actions?.map((action) => (\n <MenuItem {...action} key={action.id || action.children?.toString()} />\n ))}\n\n {children}\n </Menu>\n </Dropdown>\n );\n};\n\nActionMenu.Item = MenuItem;\nActionMenu.Section = Section;\nActionMenu.Text = Text;\n"],"names":["useState","useId","React","Dropdown","Menu","MenuItem","Section","Text"],"mappings":";;;;;;;;;;;;;;AAea,MAAA,UAAU,GAAG,CAAC,EAAE,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAmB,KAAI;;IAC5F,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAGA,cAAQ,CAAC,KAAK,CAAC;AACnD,IAAA,MAAM,UAAU,GAAGC,WAAK,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,aAAa,EAAE,CAAC;AAEvD,IAAA,MAAM,SAAS,GAAkD,CAAC,CAAC,KAAI;QACrE,IAAI,CAAC,CAAC,IAAI,KAAK,QAAQ,IAAI,CAAC,CAAC,IAAI,KAAK,KAAK;YAAE,aAAa,CAAC,KAAK,CAAC;QACjE,CAAC,CAAC,cAAc,EAAE;AACpB,KAAC;AAED,IAAA,QACEC,sBAAC,CAAA,aAAA,CAAAC,iBAAQ,EACP,EAAA,EAAE,EAAE,UAAU,EACd,KAAK,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,EACvB,UAAU,EAAE,UAAU,EACtB,aAAa,EAAE,aAAa,EAC5B,QAAQ,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,QAAQ,EAAE,EACrC,cAAc,EACd,IAAA,EAAA,SAAS,EAAE,SAAS,EAAA;QAEpBD,sBAAC,CAAA,aAAA,CAAAE,wBAAI,EACH,EAAA,OAAO,EAAE,MAAM,aAAa,CAAC,KAAK,CAAC,EAAA,YAAA,EACvB,SAAS,KAAI,CAAA,EAAA,GAAA,QAAQ,CAAC,QAAQ,MAAA,IAAA,IAAA,EAAA,KAAA,SAAA,GAAA,SAAA,GAAA,EAAA,CAAE,QAAQ,EAAE,CAAA,EAAA,EAErD,OAAO,KAAA,IAAA,IAAP,OAAO,KAAA,SAAA,GAAA,SAAA;AAAP,YAAA,OAAO,CAAE,GAAG,CAAC,CAAC,MAAM,KAAI;;gBAAC,QACxBF,qCAACG,eAAQ,EAAA,EAAA,GAAK,MAAM,EAAE,GAAG,EAAE,MAAM,CAAC,EAAE,KAAI,CAAA,EAAA,GAAA,MAAM,CAAC,QAAQ,MAAA,IAAA,IAAA,EAAA,KAAA,SAAA,GAAA,SAAA,GAAA,EAAA,CAAE,QAAQ,EAAE,CAAA,EAAI,CAAA;aACxE,CAAC;YAED,QAAQ,CACJ,CACE;AAEf;AAEA,UAAU,CAAC,IAAI,GAAGA,eAAQ;AAC1B,UAAU,CAAC,OAAO,GAAGC,cAAO;AAC5B,UAAU,CAAC,IAAI,GAAGC,wBAAI;;;;"}
|
|
@@ -3,6 +3,7 @@ import { Menu, Text } from 'react-aria-components';
|
|
|
3
3
|
import { Dropdown } from '../Dropdown/Dropdown.js';
|
|
4
4
|
import '../../hooks/useFocusVisible.js';
|
|
5
5
|
import { useId } from '../../hooks/useId.js';
|
|
6
|
+
import 'lodash.throttle';
|
|
6
7
|
import { MenuItem, Section } from './styled.js';
|
|
7
8
|
|
|
8
9
|
const ActionMenu = ({ id, menuLabel, ctaProps, actions, children }) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionMenu.js","sources":["../../../src/components/ActionMenu/ActionMenu.tsx"],"sourcesContent":["import React, { ReactNode, useState } from 'react';\nimport { Menu, MenuItemProps, Text } from 'react-aria-components';\nimport { Dropdown } from '../Dropdown';\nimport { useId } from '../../hooks';\nimport { ButtonProps } from '../Button/types';\nimport { MenuItem, Section } from './styled';\n\nexport type ActionMenuProps = {\n id?: string;\n menuLabel?: string;\n actions?: MenuItemProps[];\n ctaProps: ButtonProps;\n children?: ReactNode;\n};\n\nexport const ActionMenu = ({ id, menuLabel, ctaProps, actions, children }: ActionMenuProps) => {\n const [shouldShow, setShouldShow] = useState(false);\n const idComputed = useId({ id, prefix: 'action-menu' });\n\n const onKeyDown: React.KeyboardEventHandler<HTMLDialogElement> = (e) => {\n if (e.code === 'Escape' || e.code === 'Tab') setShouldShow(false);\n e.preventDefault();\n };\n\n return (\n <Dropdown\n id={idComputed}\n style={{ padding: '0' }}\n shouldShow={shouldShow}\n setShouldShow={setShouldShow}\n ctaProps={{ size: 'sm', ...ctaProps }}\n useAnchorWidth\n onKeyDown={onKeyDown}\n >\n <Menu\n onClose={() => setShouldShow(false)}\n aria-label={menuLabel || ctaProps.children?.toString()}\n >\n {actions?.map((action) => (\n <MenuItem {...action} key={action.id || action.children?.toString()} />\n ))}\n\n {children}\n </Menu>\n </Dropdown>\n );\n};\n\nActionMenu.Item = MenuItem;\nActionMenu.Section = Section;\nActionMenu.Text = Text;\n"],"names":["React"],"mappings":"
|
|
1
|
+
{"version":3,"file":"ActionMenu.js","sources":["../../../src/components/ActionMenu/ActionMenu.tsx"],"sourcesContent":["import React, { ReactNode, useState } from 'react';\nimport { Menu, MenuItemProps, Text } from 'react-aria-components';\nimport { Dropdown } from '../Dropdown';\nimport { useId } from '../../hooks';\nimport { ButtonProps } from '../Button/types';\nimport { MenuItem, Section } from './styled';\n\nexport type ActionMenuProps = {\n id?: string;\n menuLabel?: string;\n actions?: MenuItemProps[];\n ctaProps: ButtonProps;\n children?: ReactNode;\n};\n\nexport const ActionMenu = ({ id, menuLabel, ctaProps, actions, children }: ActionMenuProps) => {\n const [shouldShow, setShouldShow] = useState(false);\n const idComputed = useId({ id, prefix: 'action-menu' });\n\n const onKeyDown: React.KeyboardEventHandler<HTMLDialogElement> = (e) => {\n if (e.code === 'Escape' || e.code === 'Tab') setShouldShow(false);\n e.preventDefault();\n };\n\n return (\n <Dropdown\n id={idComputed}\n style={{ padding: '0' }}\n shouldShow={shouldShow}\n setShouldShow={setShouldShow}\n ctaProps={{ size: 'sm', ...ctaProps }}\n useAnchorWidth\n onKeyDown={onKeyDown}\n >\n <Menu\n onClose={() => setShouldShow(false)}\n aria-label={menuLabel || ctaProps.children?.toString()}\n >\n {actions?.map((action) => (\n <MenuItem {...action} key={action.id || action.children?.toString()} />\n ))}\n\n {children}\n </Menu>\n </Dropdown>\n );\n};\n\nActionMenu.Item = MenuItem;\nActionMenu.Section = Section;\nActionMenu.Text = Text;\n"],"names":["React"],"mappings":";;;;;;;;AAea,MAAA,UAAU,GAAG,CAAC,EAAE,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAmB,KAAI;;IAC5F,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC;AACnD,IAAA,MAAM,UAAU,GAAG,KAAK,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,aAAa,EAAE,CAAC;AAEvD,IAAA,MAAM,SAAS,GAAkD,CAAC,CAAC,KAAI;QACrE,IAAI,CAAC,CAAC,IAAI,KAAK,QAAQ,IAAI,CAAC,CAAC,IAAI,KAAK,KAAK;YAAE,aAAa,CAAC,KAAK,CAAC;QACjE,CAAC,CAAC,cAAc,EAAE;AACpB,KAAC;AAED,IAAA,QACEA,cAAC,CAAA,aAAA,CAAA,QAAQ,EACP,EAAA,EAAE,EAAE,UAAU,EACd,KAAK,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,EACvB,UAAU,EAAE,UAAU,EACtB,aAAa,EAAE,aAAa,EAC5B,QAAQ,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,QAAQ,EAAE,EACrC,cAAc,EACd,IAAA,EAAA,SAAS,EAAE,SAAS,EAAA;QAEpBA,cAAC,CAAA,aAAA,CAAA,IAAI,EACH,EAAA,OAAO,EAAE,MAAM,aAAa,CAAC,KAAK,CAAC,EAAA,YAAA,EACvB,SAAS,KAAI,CAAA,EAAA,GAAA,QAAQ,CAAC,QAAQ,MAAA,IAAA,IAAA,EAAA,KAAA,SAAA,GAAA,SAAA,GAAA,EAAA,CAAE,QAAQ,EAAE,CAAA,EAAA,EAErD,OAAO,KAAA,IAAA,IAAP,OAAO,KAAA,SAAA,GAAA,SAAA;AAAP,YAAA,OAAO,CAAE,GAAG,CAAC,CAAC,MAAM,KAAI;;gBAAC,QACxBA,6BAAC,QAAQ,EAAA,EAAA,GAAK,MAAM,EAAE,GAAG,EAAE,MAAM,CAAC,EAAE,KAAI,CAAA,EAAA,GAAA,MAAM,CAAC,QAAQ,MAAA,IAAA,IAAA,EAAA,KAAA,SAAA,GAAA,SAAA,GAAA,EAAA,CAAE,QAAQ,EAAE,CAAA,EAAI,CAAA;aACxE,CAAC;YAED,QAAQ,CACJ,CACE;AAEf;AAEA,UAAU,CAAC,IAAI,GAAG,QAAQ;AAC1B,UAAU,CAAC,OAAO,GAAG,OAAO;AAC5B,UAAU,CAAC,IAAI,GAAG,IAAI;;;;"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
var reactTable = require('@tanstack/react-table');
|
|
5
|
+
require('../../hooks/useFocusVisible.cjs');
|
|
6
|
+
require('uid/secure');
|
|
7
|
+
var useDragToScroll = require('../../hooks/useDragToScroll.cjs');
|
|
8
|
+
require('lodash.throttle');
|
|
9
|
+
var ColumnMapper = require('./utils/ColumnMapper.cjs');
|
|
10
|
+
var getAriaRoles = require('./utils/getAriaRoles.cjs');
|
|
11
|
+
var Columns = require('./components/Columns/Columns.cjs');
|
|
12
|
+
var Header = require('./components/Header/Header.cjs');
|
|
13
|
+
var Body = require('./components/Body/Body.cjs');
|
|
14
|
+
var Footer = require('./components/Footer/Footer.cjs');
|
|
15
|
+
var GridContainer = require('./components/GridContainer/GridContainer.cjs');
|
|
16
|
+
|
|
17
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
18
|
+
|
|
19
|
+
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* [WIP]
|
|
23
|
+
*
|
|
24
|
+
* A DataGrid component which renders data in a two-dimensional format, with columns and rows. Unlike the `DataTable`
|
|
25
|
+
* component, the `DataGrid` supports both flat and hierarchical (tree) data.
|
|
26
|
+
*
|
|
27
|
+
* Under the hood, it uses [TanStack Table](http://tanstack.com/table/) for table management, and aims to replicate functionality
|
|
28
|
+
* available in major third party grid components such as CloudScape's Table component, AgGrid, etc.
|
|
29
|
+
*
|
|
30
|
+
* Supported features include:
|
|
31
|
+
* - Pinning, resizing (incl. smooth resizing), reordering, and hiding of columns
|
|
32
|
+
* - Selection (single and multiple) and disabling of rows.
|
|
33
|
+
* - Rendering of arbitrarily nested data, expanding/collapsing, and custom full-width 'group' rows.
|
|
34
|
+
* - In-built keyboard navigation with arrow keys, and drag to scroll.
|
|
35
|
+
* - Configurable density.
|
|
36
|
+
*
|
|
37
|
+
* *Important: This component uses CSS modules, and therefore requires a `<ThemeProvider />` to be present on your page.*
|
|
38
|
+
*/
|
|
39
|
+
const DataGrid = ({ density = 'base', striped = true, borderMode = 'full', resizeMode = 'off', containerStyle, columns, hiddenColumns, columnOrdering, data, getRowId, 'aria-label': ariaLabel, }) => {
|
|
40
|
+
const containerRef = React.useRef(null);
|
|
41
|
+
const showFooter = React.useMemo(() => columns.some((column) => column.renderFooter), [columns]);
|
|
42
|
+
const ariaRoles = React.useMemo(() => getAriaRoles.getAriaRoles(), []);
|
|
43
|
+
const enableColumnResizing = React.useMemo(() => resizeMode !== 'off', [resizeMode]);
|
|
44
|
+
/**
|
|
45
|
+
* Mapping of column definitions.
|
|
46
|
+
*/
|
|
47
|
+
const columnMapper = React.useRef(new ColumnMapper.ColumnMapper());
|
|
48
|
+
const mappedColumnDefinitions = React.useMemo(() => {
|
|
49
|
+
const mappedColumns = columns.map((column) => columnMapper.current.mapColumnDefinition(column));
|
|
50
|
+
return mappedColumns;
|
|
51
|
+
}, [columns]);
|
|
52
|
+
/**
|
|
53
|
+
* Stable references for column states (visibility, order).
|
|
54
|
+
*/
|
|
55
|
+
// Column render order - the order of the array indicates the order on screen.
|
|
56
|
+
const columnOrder = React.useMemo(() => {
|
|
57
|
+
if (!columnOrdering || columnOrdering.length === 0) {
|
|
58
|
+
return undefined;
|
|
59
|
+
}
|
|
60
|
+
return columnOrdering;
|
|
61
|
+
}, [columnOrdering]);
|
|
62
|
+
// Column visibiilty - record of column ID's to visibility, where false/no value = hidden.
|
|
63
|
+
const columnVisibility = React.useMemo(() => {
|
|
64
|
+
// We can't have no columns visible - if the array is empty we show them all.
|
|
65
|
+
if (!hiddenColumns || hiddenColumns.length === columns.length) {
|
|
66
|
+
return undefined;
|
|
67
|
+
}
|
|
68
|
+
return columns.reduce((acc, column) => ({
|
|
69
|
+
...acc,
|
|
70
|
+
[column.id]: !hiddenColumns.includes(column.id),
|
|
71
|
+
}), {});
|
|
72
|
+
}, [hiddenColumns, columns]);
|
|
73
|
+
/**
|
|
74
|
+
* Setup the TanStack table, including mapped column definitions, row data, and any additional state such as
|
|
75
|
+
* column visibility and ordering.
|
|
76
|
+
*/
|
|
77
|
+
const table = reactTable.useReactTable({
|
|
78
|
+
data,
|
|
79
|
+
columns: mappedColumnDefinitions,
|
|
80
|
+
// Column settings
|
|
81
|
+
columnResizeMode: resizeMode === 'off' ? undefined : resizeMode,
|
|
82
|
+
enableColumnResizing,
|
|
83
|
+
// Row model
|
|
84
|
+
getRowId,
|
|
85
|
+
getCoreRowModel: reactTable.getCoreRowModel(),
|
|
86
|
+
// Inject external table state
|
|
87
|
+
state: {
|
|
88
|
+
columnOrder,
|
|
89
|
+
columnVisibility,
|
|
90
|
+
},
|
|
91
|
+
});
|
|
92
|
+
/**
|
|
93
|
+
* Other hooks
|
|
94
|
+
*/
|
|
95
|
+
useDragToScroll.useDragToScroll({ targetRef: containerRef, ignoreClassName: 'data-grid-column-resizer' });
|
|
96
|
+
return (React__default.default.createElement(GridContainer.GridContainer, { containerRef: containerRef, borderMode: borderMode, containerStyles: containerStyle, ariaRoles: ariaRoles, enableResizeableColumns: enableColumnResizing, density: density, table: table, "aria-label": ariaLabel },
|
|
97
|
+
enableColumnResizing && React__default.default.createElement(Columns.Columns, { table: table }),
|
|
98
|
+
React__default.default.createElement(Header.Header, { table: table }),
|
|
99
|
+
table.getState().columnSizingInfo.isResizingColumn ? (React__default.default.createElement(Body.MemoizedBody, { table: table, ariaRoles: ariaRoles, striped: striped })) : (React__default.default.createElement(Body.Body, { table: table, ariaRoles: ariaRoles, striped: striped })),
|
|
100
|
+
showFooter && React__default.default.createElement(Footer.Footer, { table: table, ariaRoles: ariaRoles })));
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
exports.DataGrid = DataGrid;
|
|
104
|
+
//# sourceMappingURL=DataGrid.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DataGrid.cjs","sources":["../../../src/components/DataGrid/DataGrid.tsx"],"sourcesContent":["import React, { useMemo, useRef } from 'react';\nimport { getCoreRowModel, useReactTable } from '@tanstack/react-table';\n\nimport { useDragToScroll } from '../../hooks';\n\nimport { DataGridProps } from './types';\nimport { ColumnMapper, getAriaRoles } from './utils';\nimport { GridContainer, Header, Body, Footer, Columns } from './components';\nimport { MemoizedBody } from './components/Body';\n\n/**\n * [WIP]\n *\n * A DataGrid component which renders data in a two-dimensional format, with columns and rows. Unlike the `DataTable`\n * component, the `DataGrid` supports both flat and hierarchical (tree) data.\n *\n * Under the hood, it uses [TanStack Table](http://tanstack.com/table/) for table management, and aims to replicate functionality\n * available in major third party grid components such as CloudScape's Table component, AgGrid, etc.\n *\n * Supported features include:\n * - Pinning, resizing (incl. smooth resizing), reordering, and hiding of columns\n * - Selection (single and multiple) and disabling of rows.\n * - Rendering of arbitrarily nested data, expanding/collapsing, and custom full-width 'group' rows.\n * - In-built keyboard navigation with arrow keys, and drag to scroll.\n * - Configurable density.\n *\n * *Important: This component uses CSS modules, and therefore requires a `<ThemeProvider />` to be present on your page.*\n */\nexport const DataGrid = ({\n density = 'base',\n striped = true,\n borderMode = 'full',\n resizeMode = 'off',\n containerStyle,\n columns,\n hiddenColumns,\n columnOrdering,\n data,\n getRowId,\n\n 'aria-label': ariaLabel,\n}: DataGridProps) => {\n const containerRef = useRef<HTMLTableElement>(null);\n\n const showFooter = useMemo(() => columns.some((column) => column.renderFooter), [columns]);\n const ariaRoles = useMemo(() => getAriaRoles(), []);\n const enableColumnResizing = useMemo(() => resizeMode !== 'off', [resizeMode]);\n\n /**\n * Mapping of column definitions.\n */\n const columnMapper = useRef(new ColumnMapper());\n const mappedColumnDefinitions = useMemo(() => {\n const mappedColumns = columns.map((column) => columnMapper.current.mapColumnDefinition(column));\n return mappedColumns;\n }, [columns]);\n\n /**\n * Stable references for column states (visibility, order).\n */\n\n // Column render order - the order of the array indicates the order on screen.\n const columnOrder = useMemo(() => {\n if (!columnOrdering || columnOrdering.length === 0) {\n return undefined;\n }\n\n return columnOrdering;\n }, [columnOrdering]);\n\n // Column visibiilty - record of column ID's to visibility, where false/no value = hidden.\n const columnVisibility = useMemo(() => {\n // We can't have no columns visible - if the array is empty we show them all.\n if (!hiddenColumns || hiddenColumns.length === columns.length) {\n return undefined;\n }\n\n return columns.reduce(\n (acc, column) => ({\n ...acc,\n [column.id]: !hiddenColumns.includes(column.id),\n }),\n {},\n );\n }, [hiddenColumns, columns]);\n\n /**\n * Setup the TanStack table, including mapped column definitions, row data, and any additional state such as\n * column visibility and ordering.\n */\n const table = useReactTable<any>({\n data,\n columns: mappedColumnDefinitions,\n\n // Column settings\n columnResizeMode: resizeMode === 'off' ? undefined : resizeMode,\n enableColumnResizing,\n\n // Row model\n getRowId,\n getCoreRowModel: getCoreRowModel(),\n\n // Inject external table state\n state: {\n columnOrder,\n columnVisibility,\n },\n });\n\n /**\n * Other hooks\n */\n useDragToScroll({ targetRef: containerRef, ignoreClassName: 'data-grid-column-resizer' });\n\n return (\n <GridContainer\n containerRef={containerRef}\n borderMode={borderMode}\n containerStyles={containerStyle}\n ariaRoles={ariaRoles}\n enableResizeableColumns={enableColumnResizing}\n density={density}\n table={table}\n aria-label={ariaLabel}\n >\n {/* Columns */}\n {enableColumnResizing && <Columns table={table} />}\n\n {/* Header */}\n <Header table={table} />\n\n {/* Body */}\n {table.getState().columnSizingInfo.isResizingColumn ? (\n <MemoizedBody table={table} ariaRoles={ariaRoles} striped={striped} />\n ) : (\n <Body table={table} ariaRoles={ariaRoles} striped={striped} />\n )}\n\n {/* Footer */}\n {showFooter && <Footer table={table} ariaRoles={ariaRoles} />}\n </GridContainer>\n );\n};\n"],"names":["useRef","useMemo","getAriaRoles","ColumnMapper","useReactTable","getCoreRowModel","useDragToScroll","React","GridContainer","Columns","Header","MemoizedBody","Body","Footer"],"mappings":"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"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { DataGridProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* [WIP]
|
|
5
|
+
*
|
|
6
|
+
* A DataGrid component which renders data in a two-dimensional format, with columns and rows. Unlike the `DataTable`
|
|
7
|
+
* component, the `DataGrid` supports both flat and hierarchical (tree) data.
|
|
8
|
+
*
|
|
9
|
+
* Under the hood, it uses [TanStack Table](http://tanstack.com/table/) for table management, and aims to replicate functionality
|
|
10
|
+
* available in major third party grid components such as CloudScape's Table component, AgGrid, etc.
|
|
11
|
+
*
|
|
12
|
+
* Supported features include:
|
|
13
|
+
* - Pinning, resizing (incl. smooth resizing), reordering, and hiding of columns
|
|
14
|
+
* - Selection (single and multiple) and disabling of rows.
|
|
15
|
+
* - Rendering of arbitrarily nested data, expanding/collapsing, and custom full-width 'group' rows.
|
|
16
|
+
* - In-built keyboard navigation with arrow keys, and drag to scroll.
|
|
17
|
+
* - Configurable density.
|
|
18
|
+
*
|
|
19
|
+
* *Important: This component uses CSS modules, and therefore requires a `<ThemeProvider />` to be present on your page.*
|
|
20
|
+
*/
|
|
21
|
+
export declare const DataGrid: ({ density, striped, borderMode, resizeMode, containerStyle, columns, hiddenColumns, columnOrdering, data, getRowId, "aria-label": ariaLabel, }: DataGridProps) => React.JSX.Element;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import React__default, { useRef, useMemo } from 'react';
|
|
2
|
+
import { useReactTable, getCoreRowModel } from '@tanstack/react-table';
|
|
3
|
+
import '../../hooks/useFocusVisible.js';
|
|
4
|
+
import 'uid/secure';
|
|
5
|
+
import { useDragToScroll } from '../../hooks/useDragToScroll.js';
|
|
6
|
+
import 'lodash.throttle';
|
|
7
|
+
import { ColumnMapper } from './utils/ColumnMapper.js';
|
|
8
|
+
import { getAriaRoles } from './utils/getAriaRoles.js';
|
|
9
|
+
import { Columns } from './components/Columns/Columns.js';
|
|
10
|
+
import { Header } from './components/Header/Header.js';
|
|
11
|
+
import { MemoizedBody, Body } from './components/Body/Body.js';
|
|
12
|
+
import { Footer } from './components/Footer/Footer.js';
|
|
13
|
+
import { GridContainer } from './components/GridContainer/GridContainer.js';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* [WIP]
|
|
17
|
+
*
|
|
18
|
+
* A DataGrid component which renders data in a two-dimensional format, with columns and rows. Unlike the `DataTable`
|
|
19
|
+
* component, the `DataGrid` supports both flat and hierarchical (tree) data.
|
|
20
|
+
*
|
|
21
|
+
* Under the hood, it uses [TanStack Table](http://tanstack.com/table/) for table management, and aims to replicate functionality
|
|
22
|
+
* available in major third party grid components such as CloudScape's Table component, AgGrid, etc.
|
|
23
|
+
*
|
|
24
|
+
* Supported features include:
|
|
25
|
+
* - Pinning, resizing (incl. smooth resizing), reordering, and hiding of columns
|
|
26
|
+
* - Selection (single and multiple) and disabling of rows.
|
|
27
|
+
* - Rendering of arbitrarily nested data, expanding/collapsing, and custom full-width 'group' rows.
|
|
28
|
+
* - In-built keyboard navigation with arrow keys, and drag to scroll.
|
|
29
|
+
* - Configurable density.
|
|
30
|
+
*
|
|
31
|
+
* *Important: This component uses CSS modules, and therefore requires a `<ThemeProvider />` to be present on your page.*
|
|
32
|
+
*/
|
|
33
|
+
const DataGrid = ({ density = 'base', striped = true, borderMode = 'full', resizeMode = 'off', containerStyle, columns, hiddenColumns, columnOrdering, data, getRowId, 'aria-label': ariaLabel, }) => {
|
|
34
|
+
const containerRef = useRef(null);
|
|
35
|
+
const showFooter = useMemo(() => columns.some((column) => column.renderFooter), [columns]);
|
|
36
|
+
const ariaRoles = useMemo(() => getAriaRoles(), []);
|
|
37
|
+
const enableColumnResizing = useMemo(() => resizeMode !== 'off', [resizeMode]);
|
|
38
|
+
/**
|
|
39
|
+
* Mapping of column definitions.
|
|
40
|
+
*/
|
|
41
|
+
const columnMapper = useRef(new ColumnMapper());
|
|
42
|
+
const mappedColumnDefinitions = useMemo(() => {
|
|
43
|
+
const mappedColumns = columns.map((column) => columnMapper.current.mapColumnDefinition(column));
|
|
44
|
+
return mappedColumns;
|
|
45
|
+
}, [columns]);
|
|
46
|
+
/**
|
|
47
|
+
* Stable references for column states (visibility, order).
|
|
48
|
+
*/
|
|
49
|
+
// Column render order - the order of the array indicates the order on screen.
|
|
50
|
+
const columnOrder = useMemo(() => {
|
|
51
|
+
if (!columnOrdering || columnOrdering.length === 0) {
|
|
52
|
+
return undefined;
|
|
53
|
+
}
|
|
54
|
+
return columnOrdering;
|
|
55
|
+
}, [columnOrdering]);
|
|
56
|
+
// Column visibiilty - record of column ID's to visibility, where false/no value = hidden.
|
|
57
|
+
const columnVisibility = useMemo(() => {
|
|
58
|
+
// We can't have no columns visible - if the array is empty we show them all.
|
|
59
|
+
if (!hiddenColumns || hiddenColumns.length === columns.length) {
|
|
60
|
+
return undefined;
|
|
61
|
+
}
|
|
62
|
+
return columns.reduce((acc, column) => ({
|
|
63
|
+
...acc,
|
|
64
|
+
[column.id]: !hiddenColumns.includes(column.id),
|
|
65
|
+
}), {});
|
|
66
|
+
}, [hiddenColumns, columns]);
|
|
67
|
+
/**
|
|
68
|
+
* Setup the TanStack table, including mapped column definitions, row data, and any additional state such as
|
|
69
|
+
* column visibility and ordering.
|
|
70
|
+
*/
|
|
71
|
+
const table = useReactTable({
|
|
72
|
+
data,
|
|
73
|
+
columns: mappedColumnDefinitions,
|
|
74
|
+
// Column settings
|
|
75
|
+
columnResizeMode: resizeMode === 'off' ? undefined : resizeMode,
|
|
76
|
+
enableColumnResizing,
|
|
77
|
+
// Row model
|
|
78
|
+
getRowId,
|
|
79
|
+
getCoreRowModel: getCoreRowModel(),
|
|
80
|
+
// Inject external table state
|
|
81
|
+
state: {
|
|
82
|
+
columnOrder,
|
|
83
|
+
columnVisibility,
|
|
84
|
+
},
|
|
85
|
+
});
|
|
86
|
+
/**
|
|
87
|
+
* Other hooks
|
|
88
|
+
*/
|
|
89
|
+
useDragToScroll({ targetRef: containerRef, ignoreClassName: 'data-grid-column-resizer' });
|
|
90
|
+
return (React__default.createElement(GridContainer, { containerRef: containerRef, borderMode: borderMode, containerStyles: containerStyle, ariaRoles: ariaRoles, enableResizeableColumns: enableColumnResizing, density: density, table: table, "aria-label": ariaLabel },
|
|
91
|
+
enableColumnResizing && React__default.createElement(Columns, { table: table }),
|
|
92
|
+
React__default.createElement(Header, { table: table }),
|
|
93
|
+
table.getState().columnSizingInfo.isResizingColumn ? (React__default.createElement(MemoizedBody, { table: table, ariaRoles: ariaRoles, striped: striped })) : (React__default.createElement(Body, { table: table, ariaRoles: ariaRoles, striped: striped })),
|
|
94
|
+
showFooter && React__default.createElement(Footer, { table: table, ariaRoles: ariaRoles })));
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
export { DataGrid };
|
|
98
|
+
//# sourceMappingURL=DataGrid.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DataGrid.js","sources":["../../../src/components/DataGrid/DataGrid.tsx"],"sourcesContent":["import React, { useMemo, useRef } from 'react';\nimport { getCoreRowModel, useReactTable } from '@tanstack/react-table';\n\nimport { useDragToScroll } from '../../hooks';\n\nimport { DataGridProps } from './types';\nimport { ColumnMapper, getAriaRoles } from './utils';\nimport { GridContainer, Header, Body, Footer, Columns } from './components';\nimport { MemoizedBody } from './components/Body';\n\n/**\n * [WIP]\n *\n * A DataGrid component which renders data in a two-dimensional format, with columns and rows. Unlike the `DataTable`\n * component, the `DataGrid` supports both flat and hierarchical (tree) data.\n *\n * Under the hood, it uses [TanStack Table](http://tanstack.com/table/) for table management, and aims to replicate functionality\n * available in major third party grid components such as CloudScape's Table component, AgGrid, etc.\n *\n * Supported features include:\n * - Pinning, resizing (incl. smooth resizing), reordering, and hiding of columns\n * - Selection (single and multiple) and disabling of rows.\n * - Rendering of arbitrarily nested data, expanding/collapsing, and custom full-width 'group' rows.\n * - In-built keyboard navigation with arrow keys, and drag to scroll.\n * - Configurable density.\n *\n * *Important: This component uses CSS modules, and therefore requires a `<ThemeProvider />` to be present on your page.*\n */\nexport const DataGrid = ({\n density = 'base',\n striped = true,\n borderMode = 'full',\n resizeMode = 'off',\n containerStyle,\n columns,\n hiddenColumns,\n columnOrdering,\n data,\n getRowId,\n\n 'aria-label': ariaLabel,\n}: DataGridProps) => {\n const containerRef = useRef<HTMLTableElement>(null);\n\n const showFooter = useMemo(() => columns.some((column) => column.renderFooter), [columns]);\n const ariaRoles = useMemo(() => getAriaRoles(), []);\n const enableColumnResizing = useMemo(() => resizeMode !== 'off', [resizeMode]);\n\n /**\n * Mapping of column definitions.\n */\n const columnMapper = useRef(new ColumnMapper());\n const mappedColumnDefinitions = useMemo(() => {\n const mappedColumns = columns.map((column) => columnMapper.current.mapColumnDefinition(column));\n return mappedColumns;\n }, [columns]);\n\n /**\n * Stable references for column states (visibility, order).\n */\n\n // Column render order - the order of the array indicates the order on screen.\n const columnOrder = useMemo(() => {\n if (!columnOrdering || columnOrdering.length === 0) {\n return undefined;\n }\n\n return columnOrdering;\n }, [columnOrdering]);\n\n // Column visibiilty - record of column ID's to visibility, where false/no value = hidden.\n const columnVisibility = useMemo(() => {\n // We can't have no columns visible - if the array is empty we show them all.\n if (!hiddenColumns || hiddenColumns.length === columns.length) {\n return undefined;\n }\n\n return columns.reduce(\n (acc, column) => ({\n ...acc,\n [column.id]: !hiddenColumns.includes(column.id),\n }),\n {},\n );\n }, [hiddenColumns, columns]);\n\n /**\n * Setup the TanStack table, including mapped column definitions, row data, and any additional state such as\n * column visibility and ordering.\n */\n const table = useReactTable<any>({\n data,\n columns: mappedColumnDefinitions,\n\n // Column settings\n columnResizeMode: resizeMode === 'off' ? undefined : resizeMode,\n enableColumnResizing,\n\n // Row model\n getRowId,\n getCoreRowModel: getCoreRowModel(),\n\n // Inject external table state\n state: {\n columnOrder,\n columnVisibility,\n },\n });\n\n /**\n * Other hooks\n */\n useDragToScroll({ targetRef: containerRef, ignoreClassName: 'data-grid-column-resizer' });\n\n return (\n <GridContainer\n containerRef={containerRef}\n borderMode={borderMode}\n containerStyles={containerStyle}\n ariaRoles={ariaRoles}\n enableResizeableColumns={enableColumnResizing}\n density={density}\n table={table}\n aria-label={ariaLabel}\n >\n {/* Columns */}\n {enableColumnResizing && <Columns table={table} />}\n\n {/* Header */}\n <Header table={table} />\n\n {/* Body */}\n {table.getState().columnSizingInfo.isResizingColumn ? (\n <MemoizedBody table={table} ariaRoles={ariaRoles} striped={striped} />\n ) : (\n <Body table={table} ariaRoles={ariaRoles} striped={striped} />\n )}\n\n {/* Footer */}\n {showFooter && <Footer table={table} ariaRoles={ariaRoles} />}\n </GridContainer>\n );\n};\n"],"names":["React"],"mappings":";;;;;;;;;;;;;;AAUA;;;;;;;;;;;;;;;;;AAiBG;AACU,MAAA,QAAQ,GAAG,CAAC,EACvB,OAAO,GAAG,MAAM,EAChB,OAAO,GAAG,IAAI,EACd,UAAU,GAAG,MAAM,EACnB,UAAU,GAAG,KAAK,EAClB,cAAc,EACd,OAAO,EACP,aAAa,EACb,cAAc,EACd,IAAI,EACJ,QAAQ,EAER,YAAY,EAAE,SAAS,GACT,KAAI;AAClB,IAAA,MAAM,YAAY,GAAG,MAAM,CAAmB,IAAI,CAAC;IAEnD,MAAM,UAAU,GAAG,OAAO,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,KAAK,MAAM,CAAC,YAAY,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC;AAC1F,IAAA,MAAM,SAAS,GAAG,OAAO,CAAC,MAAM,YAAY,EAAE,EAAE,EAAE,CAAC;AACnD,IAAA,MAAM,oBAAoB,GAAG,OAAO,CAAC,MAAM,UAAU,KAAK,KAAK,EAAE,CAAC,UAAU,CAAC,CAAC;AAE9E;;AAEG;IACH,MAAM,YAAY,GAAG,MAAM,CAAC,IAAI,YAAY,EAAE,CAAC;AAC/C,IAAA,MAAM,uBAAuB,GAAG,OAAO,CAAC,MAAK;QAC3C,MAAM,aAAa,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,KAAK,YAAY,CAAC,OAAO,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC;AAC/F,QAAA,OAAO,aAAa;AACtB,KAAC,EAAE,CAAC,OAAO,CAAC,CAAC;AAEb;;AAEG;;AAGH,IAAA,MAAM,WAAW,GAAG,OAAO,CAAC,MAAK;QAC/B,IAAI,CAAC,cAAc,IAAI,cAAc,CAAC,MAAM,KAAK,CAAC,EAAE;AAClD,YAAA,OAAO,SAAS;AACjB;AAED,QAAA,OAAO,cAAc;AACvB,KAAC,EAAE,CAAC,cAAc,CAAC,CAAC;;AAGpB,IAAA,MAAM,gBAAgB,GAAG,OAAO,CAAC,MAAK;;QAEpC,IAAI,CAAC,aAAa,IAAI,aAAa,CAAC,MAAM,KAAK,OAAO,CAAC,MAAM,EAAE;AAC7D,YAAA,OAAO,SAAS;AACjB;QAED,OAAO,OAAO,CAAC,MAAM,CACnB,CAAC,GAAG,EAAE,MAAM,MAAM;AAChB,YAAA,GAAG,GAAG;AACN,YAAA,CAAC,MAAM,CAAC,EAAE,GAAG,CAAC,aAAa,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;SAChD,CAAC,EACF,EAAE,CACH;AACH,KAAC,EAAE,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;AAE5B;;;AAGG;IACH,MAAM,KAAK,GAAG,aAAa,CAAM;QAC/B,IAAI;AACJ,QAAA,OAAO,EAAE,uBAAuB;;QAGhC,gBAAgB,EAAE,UAAU,KAAK,KAAK,GAAG,SAAS,GAAG,UAAU;QAC/D,oBAAoB;;QAGpB,QAAQ;QACR,eAAe,EAAE,eAAe,EAAE;;AAGlC,QAAA,KAAK,EAAE;YACL,WAAW;YACX,gBAAgB;AACjB,SAAA;AACF,KAAA,CAAC;AAEF;;AAEG;IACH,eAAe,CAAC,EAAE,SAAS,EAAE,YAAY,EAAE,eAAe,EAAE,0BAA0B,EAAE,CAAC;AAEzF,IAAA,QACEA,cAAA,CAAA,aAAA,CAAC,aAAa,EAAA,EACZ,YAAY,EAAE,YAAY,EAC1B,UAAU,EAAE,UAAU,EACtB,eAAe,EAAE,cAAc,EAC/B,SAAS,EAAE,SAAS,EACpB,uBAAuB,EAAE,oBAAoB,EAC7C,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,KAAK,gBACA,SAAS,EAAA;AAGpB,QAAA,oBAAoB,IAAIA,cAAC,CAAA,aAAA,CAAA,OAAO,IAAC,KAAK,EAAE,KAAK,EAAI,CAAA;AAGlD,QAAAA,cAAA,CAAA,aAAA,CAAC,MAAM,EAAA,EAAC,KAAK,EAAE,KAAK,EAAI,CAAA;QAGvB,KAAK,CAAC,QAAQ,EAAE,CAAC,gBAAgB,CAAC,gBAAgB,IACjDA,cAAC,CAAA,aAAA,CAAA,YAAY,IAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAA,CAAI,KAEtEA,cAAA,CAAA,aAAA,CAAC,IAAI,EAAC,EAAA,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAA,CAAI,CAC/D;AAGA,QAAA,UAAU,IAAIA,cAAA,CAAA,aAAA,CAAC,MAAM,EAAA,EAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAI,CAAA,CAC/C;AAEpB;;;;"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
var BodyCell = require('./BodyCell/BodyCell.cjs');
|
|
5
|
+
var Row = require('./Row/Row.cjs');
|
|
6
|
+
|
|
7
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
8
|
+
|
|
9
|
+
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
10
|
+
|
|
11
|
+
const Body = ({ table, striped, ariaRoles }) => {
|
|
12
|
+
return (React__default.default.createElement("tbody", { className: "data-grid-body" }, table.getRowModel().rows.map((row) => (React__default.default.createElement(Row.Row, { key: row.id, row: row, striped: striped }, row.getVisibleCells().map((cell) => (React__default.default.createElement(BodyCell.BodyCell, { cell: cell, key: cell.id, ariaRoles: ariaRoles }))))))));
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Memoized table body, used to prevent rerenders when columns are being resized.
|
|
16
|
+
*/
|
|
17
|
+
const MemoizedBody = React__default.default.memo(Body, (prev, next) => prev.table.options.data === next.table.options.data);
|
|
18
|
+
|
|
19
|
+
exports.Body = Body;
|
|
20
|
+
exports.MemoizedBody = MemoizedBody;
|
|
21
|
+
//# sourceMappingURL=Body.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Body.cjs","sources":["../../../../../src/components/DataGrid/components/Body/Body.tsx"],"sourcesContent":["import React from 'react';\nimport { Table } from '@tanstack/react-table';\n\nimport { BodyCell } from './BodyCell';\nimport { Row } from './Row';\nimport { AriaRoles } from '../../types';\n\ntype BodyProps = {\n /**\n * TanStack table instance.\n */\n table: Table<any>;\n\n /**\n * Whether the rows should be striped or not.\n */\n striped: boolean;\n\n /**\n * ARIA roles for the table.\n */\n ariaRoles: AriaRoles;\n};\n\nexport const Body = ({ table, striped, ariaRoles }: BodyProps) => {\n return (\n <tbody className=\"data-grid-body\">\n {table.getRowModel().rows.map((row) => (\n <Row key={row.id} row={row} striped={striped}>\n {row.getVisibleCells().map((cell) => (\n <BodyCell cell={cell} key={cell.id} ariaRoles={ariaRoles} />\n ))}\n </Row>\n ))}\n </tbody>\n );\n};\n\n/**\n * Memoized table body, used to prevent rerenders when columns are being resized.\n */\nexport const MemoizedBody = React.memo(\n Body,\n (prev, next) => prev.table.options.data === next.table.options.data,\n);\n"],"names":["React","Row","BodyCell"],"mappings":";;;;;;;;;;AAwBO,MAAM,IAAI,GAAG,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,EAAa,KAAI;AAC/D,IAAA,QACEA,sBAAA,CAAA,aAAA,CAAA,OAAA,EAAA,EAAO,SAAS,EAAC,gBAAgB,EAC9B,EAAA,KAAK,CAAC,WAAW,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,MAChCA,sBAAA,CAAA,aAAA,CAACC,OAAG,EAAA,EAAC,GAAG,EAAE,GAAG,CAAC,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,EACzC,EAAA,GAAG,CAAC,eAAe,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,MAC9BD,sBAAA,CAAA,aAAA,CAACE,iBAAQ,EAAA,EAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,EAAE,SAAS,EAAE,SAAS,EAAI,CAAA,CAC7D,CAAC,CACE,CACP,CAAC,CACI;AAEZ;AAEA;;AAEG;AACI,MAAM,YAAY,GAAGF,sBAAK,CAAC,IAAI,CACpC,IAAI,EACJ,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,KAAK,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI;;;;;"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Table } from '@tanstack/react-table';
|
|
3
|
+
import { AriaRoles } from '../../types';
|
|
4
|
+
type BodyProps = {
|
|
5
|
+
/**
|
|
6
|
+
* TanStack table instance.
|
|
7
|
+
*/
|
|
8
|
+
table: Table<any>;
|
|
9
|
+
/**
|
|
10
|
+
* Whether the rows should be striped or not.
|
|
11
|
+
*/
|
|
12
|
+
striped: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* ARIA roles for the table.
|
|
15
|
+
*/
|
|
16
|
+
ariaRoles: AriaRoles;
|
|
17
|
+
};
|
|
18
|
+
export declare const Body: ({ table, striped, ariaRoles }: BodyProps) => React.JSX.Element;
|
|
19
|
+
/**
|
|
20
|
+
* Memoized table body, used to prevent rerenders when columns are being resized.
|
|
21
|
+
*/
|
|
22
|
+
export declare const MemoizedBody: React.MemoExoticComponent<({ table, striped, ariaRoles }: BodyProps) => React.JSX.Element>;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
import { BodyCell } from './BodyCell/BodyCell.js';
|
|
3
|
+
import { Row } from './Row/Row.js';
|
|
4
|
+
|
|
5
|
+
const Body = ({ table, striped, ariaRoles }) => {
|
|
6
|
+
return (React__default.createElement("tbody", { className: "data-grid-body" }, table.getRowModel().rows.map((row) => (React__default.createElement(Row, { key: row.id, row: row, striped: striped }, row.getVisibleCells().map((cell) => (React__default.createElement(BodyCell, { cell: cell, key: cell.id, ariaRoles: ariaRoles }))))))));
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Memoized table body, used to prevent rerenders when columns are being resized.
|
|
10
|
+
*/
|
|
11
|
+
const MemoizedBody = React__default.memo(Body, (prev, next) => prev.table.options.data === next.table.options.data);
|
|
12
|
+
|
|
13
|
+
export { Body, MemoizedBody };
|
|
14
|
+
//# sourceMappingURL=Body.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Body.js","sources":["../../../../../src/components/DataGrid/components/Body/Body.tsx"],"sourcesContent":["import React from 'react';\nimport { Table } from '@tanstack/react-table';\n\nimport { BodyCell } from './BodyCell';\nimport { Row } from './Row';\nimport { AriaRoles } from '../../types';\n\ntype BodyProps = {\n /**\n * TanStack table instance.\n */\n table: Table<any>;\n\n /**\n * Whether the rows should be striped or not.\n */\n striped: boolean;\n\n /**\n * ARIA roles for the table.\n */\n ariaRoles: AriaRoles;\n};\n\nexport const Body = ({ table, striped, ariaRoles }: BodyProps) => {\n return (\n <tbody className=\"data-grid-body\">\n {table.getRowModel().rows.map((row) => (\n <Row key={row.id} row={row} striped={striped}>\n {row.getVisibleCells().map((cell) => (\n <BodyCell cell={cell} key={cell.id} ariaRoles={ariaRoles} />\n ))}\n </Row>\n ))}\n </tbody>\n );\n};\n\n/**\n * Memoized table body, used to prevent rerenders when columns are being resized.\n */\nexport const MemoizedBody = React.memo(\n Body,\n (prev, next) => prev.table.options.data === next.table.options.data,\n);\n"],"names":["React"],"mappings":";;;;AAwBO,MAAM,IAAI,GAAG,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,EAAa,KAAI;AAC/D,IAAA,QACEA,cAAA,CAAA,aAAA,CAAA,OAAA,EAAA,EAAO,SAAS,EAAC,gBAAgB,EAC9B,EAAA,KAAK,CAAC,WAAW,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,MAChCA,cAAA,CAAA,aAAA,CAAC,GAAG,EAAA,EAAC,GAAG,EAAE,GAAG,CAAC,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,EACzC,EAAA,GAAG,CAAC,eAAe,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,MAC9BA,cAAA,CAAA,aAAA,CAAC,QAAQ,EAAA,EAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,EAAE,SAAS,EAAE,SAAS,EAAI,CAAA,CAC7D,CAAC,CACE,CACP,CAAC,CACI;AAEZ;AAEA;;AAEG;AACI,MAAM,YAAY,GAAGA,cAAK,CAAC,IAAI,CACpC,IAAI,EACJ,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,KAAK,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI;;;;"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
var reactTable = require('@tanstack/react-table');
|
|
5
|
+
var buildClassnames = require('../../../../../utils/buildClassnames.cjs');
|
|
6
|
+
require('uid/secure');
|
|
7
|
+
var CellContent = require('../../CellContent/CellContent.cjs');
|
|
8
|
+
var BodyCell_module = require('./BodyCell.module.css.cjs');
|
|
9
|
+
|
|
10
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
11
|
+
|
|
12
|
+
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
13
|
+
|
|
14
|
+
const bodyCellClassname = buildClassnames.buildClassnames([BodyCell_module.bodyCell, 'data-grid-cell']);
|
|
15
|
+
/**
|
|
16
|
+
* Renders a cell element, and its content, for a given column and row, within the grid body.
|
|
17
|
+
*/
|
|
18
|
+
const BodyCell = ({ cell, ariaRoles }) => {
|
|
19
|
+
const { justifyContent, textAlign, rowHeader } = cell.column.columnDef.meta;
|
|
20
|
+
const CellElement = rowHeader ? 'th' : 'td';
|
|
21
|
+
return (React__default.default.createElement(CellElement, { className: bodyCellClassname, "aria-colindex": cell.column.getIndex() + 1, scope: rowHeader ? 'row' : undefined, role: rowHeader ? 'rowheader' : ariaRoles.cell },
|
|
22
|
+
React__default.default.createElement(CellContent.CellContent, { contentStyle: {
|
|
23
|
+
justifyContent,
|
|
24
|
+
textAlign,
|
|
25
|
+
} }, reactTable.flexRender(cell.column.columnDef.cell, cell.getContext()))));
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
exports.BodyCell = BodyCell;
|
|
29
|
+
//# sourceMappingURL=BodyCell.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BodyCell.cjs","sources":["../../../../../../src/components/DataGrid/components/Body/BodyCell/BodyCell.tsx"],"sourcesContent":["import React from 'react';\n\nimport { Cell, flexRender } from '@tanstack/react-table';\n\nimport { buildClassnames } from '../../../../../utils';\n\nimport { AriaRoles } from '../../../types';\nimport { CellContent } from '../../CellContent';\n\nimport { bodyCell } from './BodyCell.module.css';\n\ntype ColumnCellProps = {\n /**\n * Cell within the TanStack Table instance.\n */\n cell: Cell<any, any>;\n\n /**\n * ARIA roles for the grid.\n */\n ariaRoles: AriaRoles;\n};\n\nconst bodyCellClassname = buildClassnames([bodyCell, 'data-grid-cell']);\n\n/**\n * Renders a cell element, and its content, for a given column and row, within the grid body.\n */\nexport const BodyCell = ({ cell, ariaRoles }: ColumnCellProps) => {\n const { justifyContent, textAlign, rowHeader } = cell.column.columnDef.meta!;\n const CellElement = rowHeader ? 'th' : 'td';\n\n return (\n <CellElement\n className={bodyCellClassname}\n aria-colindex={cell.column.getIndex() + 1}\n scope={rowHeader ? 'row' : undefined}\n role={rowHeader ? 'rowheader' : ariaRoles.cell}\n >\n <CellContent\n contentStyle={\n {\n justifyContent,\n textAlign,\n } as React.CSSProperties\n }\n >\n {flexRender(cell.column.columnDef.cell, cell.getContext())}\n </CellContent>\n </CellElement>\n );\n};\n"],"names":["buildClassnames","bodyCell","React","CellContent","flexRender"],"mappings":";;;;;;;;;;;;;AAuBA,MAAM,iBAAiB,GAAGA,+BAAe,CAAC,CAACC,wBAAQ,EAAE,gBAAgB,CAAC,CAAC;AAEvE;;AAEG;AACU,MAAA,QAAQ,GAAG,CAAC,EAAE,IAAI,EAAE,SAAS,EAAmB,KAAI;AAC/D,IAAA,MAAM,EAAE,cAAc,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,IAAK;IAC5E,MAAM,WAAW,GAAG,SAAS,GAAG,IAAI,GAAG,IAAI;AAE3C,IAAA,QACEC,sBAAC,CAAA,aAAA,CAAA,WAAW,IACV,SAAS,EAAE,iBAAiB,EACb,eAAA,EAAA,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,GAAG,CAAC,EACzC,KAAK,EAAE,SAAS,GAAG,KAAK,GAAG,SAAS,EACpC,IAAI,EAAE,SAAS,GAAG,WAAW,GAAG,SAAS,CAAC,IAAI,EAAA;QAE9CA,sBAAC,CAAA,aAAA,CAAAC,uBAAW,EACV,EAAA,YAAY,EACV;gBACE,cAAc;gBACd,SAAS;AACa,aAAA,EAAA,EAGzBC,qBAAU,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC,CAC9C,CACF;AAElB;;;;"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Cell } from '@tanstack/react-table';
|
|
3
|
+
import { AriaRoles } from '../../../types';
|
|
4
|
+
type ColumnCellProps = {
|
|
5
|
+
/**
|
|
6
|
+
* Cell within the TanStack Table instance.
|
|
7
|
+
*/
|
|
8
|
+
cell: Cell<any, any>;
|
|
9
|
+
/**
|
|
10
|
+
* ARIA roles for the grid.
|
|
11
|
+
*/
|
|
12
|
+
ariaRoles: AriaRoles;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Renders a cell element, and its content, for a given column and row, within the grid body.
|
|
16
|
+
*/
|
|
17
|
+
export declare const BodyCell: ({ cell, ariaRoles }: ColumnCellProps) => React.JSX.Element;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
import { flexRender } from '@tanstack/react-table';
|
|
3
|
+
import { buildClassnames } from '../../../../../utils/buildClassnames.js';
|
|
4
|
+
import 'uid/secure';
|
|
5
|
+
import { CellContent } from '../../CellContent/CellContent.js';
|
|
6
|
+
import { bodyCell } from './BodyCell.module.css.js';
|
|
7
|
+
|
|
8
|
+
const bodyCellClassname = buildClassnames([bodyCell, 'data-grid-cell']);
|
|
9
|
+
/**
|
|
10
|
+
* Renders a cell element, and its content, for a given column and row, within the grid body.
|
|
11
|
+
*/
|
|
12
|
+
const BodyCell = ({ cell, ariaRoles }) => {
|
|
13
|
+
const { justifyContent, textAlign, rowHeader } = cell.column.columnDef.meta;
|
|
14
|
+
const CellElement = rowHeader ? 'th' : 'td';
|
|
15
|
+
return (React__default.createElement(CellElement, { className: bodyCellClassname, "aria-colindex": cell.column.getIndex() + 1, scope: rowHeader ? 'row' : undefined, role: rowHeader ? 'rowheader' : ariaRoles.cell },
|
|
16
|
+
React__default.createElement(CellContent, { contentStyle: {
|
|
17
|
+
justifyContent,
|
|
18
|
+
textAlign,
|
|
19
|
+
} }, flexRender(cell.column.columnDef.cell, cell.getContext()))));
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export { BodyCell };
|
|
23
|
+
//# sourceMappingURL=BodyCell.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BodyCell.js","sources":["../../../../../../src/components/DataGrid/components/Body/BodyCell/BodyCell.tsx"],"sourcesContent":["import React from 'react';\n\nimport { Cell, flexRender } from '@tanstack/react-table';\n\nimport { buildClassnames } from '../../../../../utils';\n\nimport { AriaRoles } from '../../../types';\nimport { CellContent } from '../../CellContent';\n\nimport { bodyCell } from './BodyCell.module.css';\n\ntype ColumnCellProps = {\n /**\n * Cell within the TanStack Table instance.\n */\n cell: Cell<any, any>;\n\n /**\n * ARIA roles for the grid.\n */\n ariaRoles: AriaRoles;\n};\n\nconst bodyCellClassname = buildClassnames([bodyCell, 'data-grid-cell']);\n\n/**\n * Renders a cell element, and its content, for a given column and row, within the grid body.\n */\nexport const BodyCell = ({ cell, ariaRoles }: ColumnCellProps) => {\n const { justifyContent, textAlign, rowHeader } = cell.column.columnDef.meta!;\n const CellElement = rowHeader ? 'th' : 'td';\n\n return (\n <CellElement\n className={bodyCellClassname}\n aria-colindex={cell.column.getIndex() + 1}\n scope={rowHeader ? 'row' : undefined}\n role={rowHeader ? 'rowheader' : ariaRoles.cell}\n >\n <CellContent\n contentStyle={\n {\n justifyContent,\n textAlign,\n } as React.CSSProperties\n }\n >\n {flexRender(cell.column.columnDef.cell, cell.getContext())}\n </CellContent>\n </CellElement>\n );\n};\n"],"names":["React"],"mappings":";;;;;;;AAuBA,MAAM,iBAAiB,GAAG,eAAe,CAAC,CAAC,QAAQ,EAAE,gBAAgB,CAAC,CAAC;AAEvE;;AAEG;AACU,MAAA,QAAQ,GAAG,CAAC,EAAE,IAAI,EAAE,SAAS,EAAmB,KAAI;AAC/D,IAAA,MAAM,EAAE,cAAc,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,IAAK;IAC5E,MAAM,WAAW,GAAG,SAAS,GAAG,IAAI,GAAG,IAAI;AAE3C,IAAA,QACEA,cAAC,CAAA,aAAA,CAAA,WAAW,IACV,SAAS,EAAE,iBAAiB,EACb,eAAA,EAAA,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,GAAG,CAAC,EACzC,KAAK,EAAE,SAAS,GAAG,KAAK,GAAG,SAAS,EACpC,IAAI,EAAE,SAAS,GAAG,WAAW,GAAG,SAAS,CAAC,IAAI,EAAA;QAE9CA,cAAC,CAAA,aAAA,CAAA,WAAW,EACV,EAAA,YAAY,EACV;gBACE,cAAc;gBACd,SAAS;AACa,aAAA,EAAA,EAGzB,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC,CAC9C,CACF;AAElB;;;;"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const cssContents = `._baseCell_1w2bt_1{box-sizing:border-box;position:relative;&:focus,&:focus-visible{box-shadow:inset var(--sizes-none) var(--sizes-none) var(--sizes-none) var(--sizes-line) var(--colors-secondary-blue-base);outline:var(--sizes-none)}}._bodyCell_w9phy_1{background-color:#fff;color:var(--text-body-small-color);font-family:var(--text-body-small-font-family);font-size:var(--text-body-small-font-size);font-weight:var(--text-body-small-font-weight);line-height:var(--text-body-small-line-height)}.data-grid-row.striped:nth-of-type(odd)>._bodyCell_w9phy_1{background-color:var(--colors-neutral-grey-lightest)}.data-grid-row.selected>._bodyCell_w9phy_1{background-color:var(--colors-brand-blue-lightest)}.data-grid-row+.data-grid-row>._bodyCell_w9phy_1{border-top:1px solid var(--colors-neutral-grey-base)}
|
|
4
|
+
/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIjxubyBzb3VyY2U+IiwiQm9keUNlbGwubW9kdWxlLmNzcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxtQkFBQSxzQkFBQSxrQkFBQSx3QkFBQSwySEFBQSwwQkFBQSxDQUFBLEFDQUEsbUJBR0UscUJBQXVCLENBRXZCLGtDQUFtQyxDQUNuQyw4Q0FBK0MsQ0FDL0MsMENBQTJDLENBQzNDLDhDQUErQyxDQUMvQyw4Q0FDRixDQUVBLDJEQUNFLG9EQUNGLENBRUEsMkNBQ0Usa0RBQ0YsQ0FFQSxpREFDRSxvREFDRiIsImZpbGUiOiJCb2R5Q2VsbC5tb2R1bGUuY3NzIiwic291cmNlc0NvbnRlbnQiOltudWxsLCIuYm9keUNlbGwge1xuICBjb21wb3NlczogYmFzZUNlbGwgZnJvbSAnLi4vLi4vLi4vRGF0YUdyaWQubW9kdWxlLmNzcyc7XG5cbiAgYmFja2dyb3VuZC1jb2xvcjogd2hpdGU7XG5cbiAgY29sb3I6IHZhcigtLXRleHQtYm9keS1zbWFsbC1jb2xvcik7XG4gIGZvbnQtZmFtaWx5OiB2YXIoLS10ZXh0LWJvZHktc21hbGwtZm9udC1mYW1pbHkpO1xuICBmb250LXNpemU6IHZhcigtLXRleHQtYm9keS1zbWFsbC1mb250LXNpemUpO1xuICBmb250LXdlaWdodDogdmFyKC0tdGV4dC1ib2R5LXNtYWxsLWZvbnQtd2VpZ2h0KTtcbiAgbGluZS1oZWlnaHQ6IHZhcigtLXRleHQtYm9keS1zbWFsbC1saW5lLWhlaWdodCk7XG59XG5cbjpnbG9iYWwoLmRhdGEtZ3JpZC1yb3cuc3RyaXBlZDpudGgtb2YtdHlwZShvZGQpKSA+IC5ib2R5Q2VsbCB7XG4gIGJhY2tncm91bmQtY29sb3I6IHZhcigtLWNvbG9ycy1uZXV0cmFsLWdyZXktbGlnaHRlc3QpO1xufVxuXG46Z2xvYmFsKC5kYXRhLWdyaWQtcm93LnNlbGVjdGVkKSA+IC5ib2R5Q2VsbCB7XG4gIGJhY2tncm91bmQtY29sb3I6IHZhcigtLWNvbG9ycy1icmFuZC1ibHVlLWxpZ2h0ZXN0KTtcbn1cblxuOmdsb2JhbCguZGF0YS1ncmlkLXJvdyArIC5kYXRhLWdyaWQtcm93KSA+IC5ib2R5Q2VsbCB7XG4gIGJvcmRlci10b3A6IDFweCBzb2xpZCB2YXIoLS1jb2xvcnMtbmV1dHJhbC1ncmV5LWJhc2UpO1xufVxuIl19 */`;
|
|
5
|
+
const style = document.createElement('style');
|
|
6
|
+
style.innerHTML = cssContents;
|
|
7
|
+
document.head.appendChild(style);
|
|
8
|
+
const bodyCell = '_bodyCell_w9phy_1 _baseCell_1w2bt_1';
|
|
9
|
+
|
|
10
|
+
exports.bodyCell = bodyCell;
|
|
11
|
+
//# sourceMappingURL=BodyCell.module.css.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BodyCell.module.css.cjs","sources":["../../../../../../src/components/DataGrid/components/Body/BodyCell/BodyCell.module.css"],"sourcesContent":[".bodyCell {\n composes: baseCell from '../../../DataGrid.module.css';\n\n background-color: white;\n\n color: var(--text-body-small-color);\n font-family: var(--text-body-small-font-family);\n font-size: var(--text-body-small-font-size);\n font-weight: var(--text-body-small-font-weight);\n line-height: var(--text-body-small-line-height);\n}\n\n:global(.data-grid-row.striped:nth-of-type(odd)) > .bodyCell {\n background-color: var(--colors-neutral-grey-lightest);\n}\n\n:global(.data-grid-row.selected) > .bodyCell {\n background-color: var(--colors-brand-blue-lightest);\n}\n\n:global(.data-grid-row + .data-grid-row) > .bodyCell {\n border-top: 1px solid var(--colors-neutral-grey-base);\n}\n"],"names":[],"mappings":";;AACA,MAAM,WAAW,GAAG,CAAC;AACrB,64CAA64C,CAAC;AAC94C,MAAM,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC;AAC7C,KAAK,CAAC,SAAS,GAAG,WAAW;AAC7B,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC;AAC3B,MAAC,QAAQ,GAAG;;;;"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
const cssContents = `._baseCell_1w2bt_1{box-sizing:border-box;position:relative;&:focus,&:focus-visible{box-shadow:inset var(--sizes-none) var(--sizes-none) var(--sizes-none) var(--sizes-line) var(--colors-secondary-blue-base);outline:var(--sizes-none)}}._bodyCell_w9phy_1{background-color:#fff;color:var(--text-body-small-color);font-family:var(--text-body-small-font-family);font-size:var(--text-body-small-font-size);font-weight:var(--text-body-small-font-weight);line-height:var(--text-body-small-line-height)}.data-grid-row.striped:nth-of-type(odd)>._bodyCell_w9phy_1{background-color:var(--colors-neutral-grey-lightest)}.data-grid-row.selected>._bodyCell_w9phy_1{background-color:var(--colors-brand-blue-lightest)}.data-grid-row+.data-grid-row>._bodyCell_w9phy_1{border-top:1px solid var(--colors-neutral-grey-base)}
|
|
2
|
+
/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIjxubyBzb3VyY2U+IiwiQm9keUNlbGwubW9kdWxlLmNzcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxtQkFBQSxzQkFBQSxrQkFBQSx3QkFBQSwySEFBQSwwQkFBQSxDQUFBLEFDQUEsbUJBR0UscUJBQXVCLENBRXZCLGtDQUFtQyxDQUNuQyw4Q0FBK0MsQ0FDL0MsMENBQTJDLENBQzNDLDhDQUErQyxDQUMvQyw4Q0FDRixDQUVBLDJEQUNFLG9EQUNGLENBRUEsMkNBQ0Usa0RBQ0YsQ0FFQSxpREFDRSxvREFDRiIsImZpbGUiOiJCb2R5Q2VsbC5tb2R1bGUuY3NzIiwic291cmNlc0NvbnRlbnQiOltudWxsLCIuYm9keUNlbGwge1xuICBjb21wb3NlczogYmFzZUNlbGwgZnJvbSAnLi4vLi4vLi4vRGF0YUdyaWQubW9kdWxlLmNzcyc7XG5cbiAgYmFja2dyb3VuZC1jb2xvcjogd2hpdGU7XG5cbiAgY29sb3I6IHZhcigtLXRleHQtYm9keS1zbWFsbC1jb2xvcik7XG4gIGZvbnQtZmFtaWx5OiB2YXIoLS10ZXh0LWJvZHktc21hbGwtZm9udC1mYW1pbHkpO1xuICBmb250LXNpemU6IHZhcigtLXRleHQtYm9keS1zbWFsbC1mb250LXNpemUpO1xuICBmb250LXdlaWdodDogdmFyKC0tdGV4dC1ib2R5LXNtYWxsLWZvbnQtd2VpZ2h0KTtcbiAgbGluZS1oZWlnaHQ6IHZhcigtLXRleHQtYm9keS1zbWFsbC1saW5lLWhlaWdodCk7XG59XG5cbjpnbG9iYWwoLmRhdGEtZ3JpZC1yb3cuc3RyaXBlZDpudGgtb2YtdHlwZShvZGQpKSA+IC5ib2R5Q2VsbCB7XG4gIGJhY2tncm91bmQtY29sb3I6IHZhcigtLWNvbG9ycy1uZXV0cmFsLWdyZXktbGlnaHRlc3QpO1xufVxuXG46Z2xvYmFsKC5kYXRhLWdyaWQtcm93LnNlbGVjdGVkKSA+IC5ib2R5Q2VsbCB7XG4gIGJhY2tncm91bmQtY29sb3I6IHZhcigtLWNvbG9ycy1icmFuZC1ibHVlLWxpZ2h0ZXN0KTtcbn1cblxuOmdsb2JhbCguZGF0YS1ncmlkLXJvdyArIC5kYXRhLWdyaWQtcm93KSA+IC5ib2R5Q2VsbCB7XG4gIGJvcmRlci10b3A6IDFweCBzb2xpZCB2YXIoLS1jb2xvcnMtbmV1dHJhbC1ncmV5LWJhc2UpO1xufVxuIl19 */`;
|
|
3
|
+
const style = document.createElement('style');
|
|
4
|
+
style.innerHTML = cssContents;
|
|
5
|
+
document.head.appendChild(style);
|
|
6
|
+
const bodyCell = '_bodyCell_w9phy_1 _baseCell_1w2bt_1';
|
|
7
|
+
|
|
8
|
+
export { bodyCell };
|
|
9
|
+
//# sourceMappingURL=BodyCell.module.css.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BodyCell.module.css.js","sources":["../../../../../../src/components/DataGrid/components/Body/BodyCell/BodyCell.module.css"],"sourcesContent":[".bodyCell {\n composes: baseCell from '../../../DataGrid.module.css';\n\n background-color: white;\n\n color: var(--text-body-small-color);\n font-family: var(--text-body-small-font-family);\n font-size: var(--text-body-small-font-size);\n font-weight: var(--text-body-small-font-weight);\n line-height: var(--text-body-small-line-height);\n}\n\n:global(.data-grid-row.striped:nth-of-type(odd)) > .bodyCell {\n background-color: var(--colors-neutral-grey-lightest);\n}\n\n:global(.data-grid-row.selected) > .bodyCell {\n background-color: var(--colors-brand-blue-lightest);\n}\n\n:global(.data-grid-row + .data-grid-row) > .bodyCell {\n border-top: 1px solid var(--colors-neutral-grey-base);\n}\n"],"names":[],"mappings":"AACA,MAAM,WAAW,GAAG,CAAC;AACrB,64CAA64C,CAAC;AAC94C,MAAM,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC;AAC7C,KAAK,CAAC,SAAS,GAAG,WAAW;AAC7B,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC;AAC3B,MAAC,QAAQ,GAAG;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { BodyCell } from './BodyCell';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
var buildClassnames = require('../../../../../utils/buildClassnames.cjs');
|
|
5
|
+
require('uid/secure');
|
|
6
|
+
|
|
7
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
8
|
+
|
|
9
|
+
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
10
|
+
|
|
11
|
+
const Row = ({ row, striped, children }) => (React__default.default.createElement("tr", { className: buildClassnames.buildClassnames(['data-grid-row', striped ? 'striped' : undefined]), key: row.id, "aria-rowindex": row.index + 2 }, children));
|
|
12
|
+
|
|
13
|
+
exports.Row = Row;
|
|
14
|
+
//# sourceMappingURL=Row.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Row.cjs","sources":["../../../../../../src/components/DataGrid/components/Body/Row/Row.tsx"],"sourcesContent":["import React from 'react';\n\nimport { Row as RowItem } from '@tanstack/react-table';\n\nimport { buildClassnames } from '../../../../../utils';\n\ntype RowProps = {\n /**\n * The row within the TanStack Table instance.\n */\n row: RowItem<any>;\n\n /**\n * Whether rows should be striped or not.\n */\n striped: boolean;\n\n /**\n * Child elements (table cells).\n */\n children: React.ReactNode;\n};\n\nexport const Row = ({ row, striped, children }: RowProps) => (\n <tr\n className={buildClassnames(['data-grid-row', striped ? 'striped' : undefined])}\n key={row.id}\n // 0-based index + header row.\n aria-rowindex={row.index + 2}\n >\n {children}\n </tr>\n);\n"],"names":["React","buildClassnames"],"mappings":";;;;;;;;;;MAuBa,GAAG,GAAG,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,QAAQ,EAAY,MACtDA,sBACE,CAAA,aAAA,CAAA,IAAA,EAAA,EAAA,SAAS,EAAEC,+BAAe,CAAC,CAAC,eAAe,EAAE,OAAO,GAAG,SAAS,GAAG,SAAS,CAAC,CAAC,EAC9E,GAAG,EAAE,GAAG,CAAC,EAAE,EAAA,eAAA,EAEI,GAAG,CAAC,KAAK,GAAG,CAAC,EAE3B,EAAA,QAAQ,CACN;;;;"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Row as RowItem } from '@tanstack/react-table';
|
|
3
|
+
type RowProps = {
|
|
4
|
+
/**
|
|
5
|
+
* The row within the TanStack Table instance.
|
|
6
|
+
*/
|
|
7
|
+
row: RowItem<any>;
|
|
8
|
+
/**
|
|
9
|
+
* Whether rows should be striped or not.
|
|
10
|
+
*/
|
|
11
|
+
striped: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Child elements (table cells).
|
|
14
|
+
*/
|
|
15
|
+
children: React.ReactNode;
|
|
16
|
+
};
|
|
17
|
+
export declare const Row: ({ row, striped, children }: RowProps) => React.JSX.Element;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
import { buildClassnames } from '../../../../../utils/buildClassnames.js';
|
|
3
|
+
import 'uid/secure';
|
|
4
|
+
|
|
5
|
+
const Row = ({ row, striped, children }) => (React__default.createElement("tr", { className: buildClassnames(['data-grid-row', striped ? 'striped' : undefined]), key: row.id, "aria-rowindex": row.index + 2 }, children));
|
|
6
|
+
|
|
7
|
+
export { Row };
|
|
8
|
+
//# sourceMappingURL=Row.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Row.js","sources":["../../../../../../src/components/DataGrid/components/Body/Row/Row.tsx"],"sourcesContent":["import React from 'react';\n\nimport { Row as RowItem } from '@tanstack/react-table';\n\nimport { buildClassnames } from '../../../../../utils';\n\ntype RowProps = {\n /**\n * The row within the TanStack Table instance.\n */\n row: RowItem<any>;\n\n /**\n * Whether rows should be striped or not.\n */\n striped: boolean;\n\n /**\n * Child elements (table cells).\n */\n children: React.ReactNode;\n};\n\nexport const Row = ({ row, striped, children }: RowProps) => (\n <tr\n className={buildClassnames(['data-grid-row', striped ? 'striped' : undefined])}\n key={row.id}\n // 0-based index + header row.\n aria-rowindex={row.index + 2}\n >\n {children}\n </tr>\n);\n"],"names":["React"],"mappings":";;;;MAuBa,GAAG,GAAG,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,QAAQ,EAAY,MACtDA,cACE,CAAA,aAAA,CAAA,IAAA,EAAA,EAAA,SAAS,EAAE,eAAe,CAAC,CAAC,eAAe,EAAE,OAAO,GAAG,SAAS,GAAG,SAAS,CAAC,CAAC,EAC9E,GAAG,EAAE,GAAG,CAAC,EAAE,EAAA,eAAA,EAEI,GAAG,CAAC,KAAK,GAAG,CAAC,EAE3B,EAAA,QAAQ,CACN;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Row } from './Row';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Body, MemoizedBody } from './Body';
|