@economic/taco 2.26.19 → 2.27.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. package/dist/components/Report/Report.d.ts +1 -1
  2. package/dist/components/Report/types.d.ts +1 -1
  3. package/dist/components/Report/useReport.d.ts +2 -2
  4. package/dist/components/Select2/Select2.d.ts +2 -0
  5. package/dist/components/Select2/utilities.d.ts +2 -0
  6. package/dist/esm/packages/taco/src/components/Datepicker/useDatepicker.js +1 -1
  7. package/dist/esm/packages/taco/src/components/Datepicker/useDatepicker.js.map +1 -1
  8. package/dist/esm/packages/taco/src/components/Report/useReport.js.map +1 -1
  9. package/dist/esm/packages/taco/src/components/Select2/Select2.js +14 -2
  10. package/dist/esm/packages/taco/src/components/Select2/Select2.js.map +1 -1
  11. package/dist/esm/packages/taco/src/components/Select2/components/Option.js +2 -6
  12. package/dist/esm/packages/taco/src/components/Select2/components/Option.js.map +1 -1
  13. package/dist/esm/packages/taco/src/components/Select2/components/Trigger.js +3 -6
  14. package/dist/esm/packages/taco/src/components/Select2/components/Trigger.js.map +1 -1
  15. package/dist/esm/packages/taco/src/components/Select2/utilities.js +14 -1
  16. package/dist/esm/packages/taco/src/components/Select2/utilities.js.map +1 -1
  17. package/dist/esm/packages/taco/src/components/Table3/components/Editing/Alert.js +2 -2
  18. package/dist/esm/packages/taco/src/components/Table3/components/Editing/Alert.js.map +1 -1
  19. package/dist/esm/packages/taco/src/primitives/Table/Core/Table.js +4 -2
  20. package/dist/esm/packages/taco/src/primitives/Table/Core/Table.js.map +1 -1
  21. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Footer/Footer.js +15 -6
  22. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Footer/Footer.js.map +1 -1
  23. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Print/Print.js +15 -6
  24. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Print/Print.js.map +1 -1
  25. package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableRenderer.js +10 -3
  26. package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableRenderer.js.map +1 -1
  27. package/dist/esm/packages/taco/src/primitives/Table/Core/useTable.js.map +1 -1
  28. package/dist/esm/packages/taco/src/utils/date.js +2 -2
  29. package/dist/esm/packages/taco/src/utils/date.js.map +1 -1
  30. package/dist/primitives/Table/Core/components/Footer/Footer.d.ts +11 -2
  31. package/dist/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterColumn.d.ts +1 -1
  32. package/dist/primitives/Table/Core/features/useTableRenderer.d.ts +1 -1
  33. package/dist/primitives/Table/Core/useTable.d.ts +1 -1
  34. package/dist/taco.cjs.development.js +73 -31
  35. package/dist/taco.cjs.development.js.map +1 -1
  36. package/dist/taco.cjs.production.min.js +1 -1
  37. package/dist/taco.cjs.production.min.js.map +1 -1
  38. package/dist/utils/date.d.ts +1 -1
  39. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"Alert.js","sources":["../../../../../../../../../src/components/Table3/components/Editing/Alert.tsx"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable, TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport { ScrollToOptions as ReactVirtualScrollToOptions } from '@tanstack/react-virtual';\nimport { Alert as BaseAlert, AlertProps as BaseAlertProps } from '../../../Alert/Alert';\nimport { TableRef } from '../../../../primitives/Table/types';\nimport { Tooltip } from '../../../Tooltip/Tooltip';\nimport { useLocalization } from '../../../Provider/Localization';\nimport { Dialog, DialogProps } from '../../../Dialog/Dialog';\nimport { Group } from '../../../Group/Group';\nimport { Button } from '../../../Button/Button';\n\ntype AlertProps<TType = unknown> = Omit<BaseAlertProps, 'children'> & {\n scrollToIndex: (index: number, options: ReactVirtualScrollToOptions) => void;\n table: ReactTable<TType>;\n tableRef: React.RefObject<TableRef>;\n};\n\nexport function Alert<TType = unknown>(props: AlertProps<TType>) {\n const { scrollToIndex, table, tableRef, ...attributes } = props;\n const { texts } = useLocalization();\n const validationTexts = texts.table3.editing.validation;\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n const [showFilterResetDialog, setShowFilterResetDialog] = React.useState<string | false>(false);\n\n const pendingChangesWithErrors = tableMeta.editing.getErrors<TType>();\n\n // mark errors being rendered as seen\n React.useEffect(() => {\n pendingChangesWithErrors.forEach(error => {\n tableMeta.editing.setRowErrorsSeen(error.rowId);\n });\n }, [pendingChangesWithErrors]);\n\n function scrollToRow(rowIndex: number) {\n tableMeta.rowActive.setRowActiveIndex(rowIndex);\n scrollToIndex(rowIndex, { align: 'center' });\n\n requestAnimationFrame(() => {\n const cell = tableRef.current?.querySelector(\n 'tbody > tr[data-row-active=\"true\"] > td[data-cell-editing-invalid=\"true\"]'\n );\n\n if (cell) {\n (cell as HTMLElement).focus?.();\n }\n });\n }\n\n // generate the \"N unsaved entries\" title\n const title = (\n pendingChangesWithErrors.length === 1 ? validationTexts.alert.titleOne : validationTexts.alert.titlePlural\n ).replace('[COUNT]', String(pendingChangesWithErrors.length));\n\n // generate links to each invalid row, to go into the error message\n const links: React.ReactNode[] = [];\n const rowIdentityColumn = tableMeta.rowIdentityColumnId ? table.getColumn(tableMeta.rowIdentityColumnId) : undefined;\n\n pendingChangesWithErrors.forEach((error, index) => {\n // if appropriate, concatenate the item with the text \"and\"\n if (pendingChangesWithErrors.length > 1 && index === pendingChangesWithErrors.length - 1) {\n links.push(validationTexts.alert.messageAnd);\n }\n\n const handleClick = () => {\n const rowIndex = table.getRowModel().rows.findIndex(row => row.id === error.rowId);\n\n if (rowIndex > -1) {\n scrollToRow(rowIndex);\n } else {\n setShowFilterResetDialog(error.rowId);\n }\n };\n\n let tooltip;\n\n if (error.pendingChange._meta.errors.row) {\n tooltip = error.pendingChange._meta.errors.row;\n } else {\n const firstCellErrorColumnId = Object.keys(error.pendingChange._meta.errors.cells)[0];\n const columnName = table.getAllColumns().find(column => column.id === firstCellErrorColumnId)?.columnDef.meta?.header;\n tooltip = `${columnName}: ${error.pendingChange._meta.errors.cells[firstCellErrorColumnId]}`;\n }\n\n links.push(\n <Tooltip key={error.rowId} title={tooltip}>\n <span className=\"text-blue\" onClick={handleClick} role=\"button\">\n {rowIdentityColumn ? error.pendingChange._meta.original[rowIdentityColumn.id] : error.rowId}\n </span>\n </Tooltip>\n );\n\n // if appropriate, concatenate the item with the text \",\"\n if (pendingChangesWithErrors.length > 2 && index < pendingChangesWithErrors.length - 2) {\n links.push(', ');\n }\n });\n\n // generate the \"Row N is incomplete and hasn't been saved\" error message\n const message = (links.length === 1 ? validationTexts.alert.messageOne : validationTexts.alert.messagePlural)\n .split(/(\\[\\w+\\])/)\n .map(part => {\n if (part === '[COLUMN]') {\n return rowIdentityColumn?.columnDef.meta?.header ?? validationTexts.alert.messageRow;\n }\n\n if (part === '[ROW]') {\n return links;\n }\n\n return part;\n });\n\n const handleResetFilters = () => {\n table.resetGlobalFilter();\n table.resetColumnFilters();\n\n requestAnimationFrame(() => {\n const rowIndex = table.getRowModel().rows.findIndex(row => row.id === showFilterResetDialog);\n\n if (rowIndex > -1) {\n scrollToRow(rowIndex);\n }\n\n setShowFilterResetDialog(false);\n });\n };\n\n return (\n <>\n <BaseAlert {...attributes} state=\"error\">\n <span className=\"font-bold\">{title}</span>\n {message}\n </BaseAlert>\n <FilterResetDialog\n open={showFilterResetDialog !== false}\n onChange={() => setShowFilterResetDialog(false)}\n onSubmit={handleResetFilters}\n />\n </>\n );\n}\n\ntype FilterResetDialogProps = Omit<DialogProps, 'children'> & {\n onSubmit: () => void;\n};\n\nfunction FilterResetDialog(props: FilterResetDialogProps) {\n const { onSubmit: handleSubmit, ...dialogProps } = props;\n const { texts } = useLocalization();\n\n return (\n <Dialog {...dialogProps} size=\"xs\">\n <Dialog.Content aria-label=\"Create a new account\">\n <Dialog.Title>{texts.table3.editing.validation.resetFiltersDialog.title}</Dialog.Title>\n\n <p>{texts.table3.editing.validation.resetFiltersDialog.description}</p>\n\n <Dialog.Footer>\n <Group>\n <Dialog.Close>\n <Button>{texts.table3.editing.validation.resetFiltersDialog.cancel}</Button>\n </Dialog.Close>\n <Button appearance=\"primary\" onClick={handleSubmit}>\n {texts.table3.editing.validation.resetFiltersDialog.confirm}\n </Button>\n </Group>\n </Dialog.Footer>\n </Dialog.Content>\n </Dialog>\n );\n}\n"],"names":["Alert","props","scrollToIndex","table","tableRef","attributes","texts","useLocalization","validationTexts","table3","editing","validation","tableMeta","options","meta","showFilterResetDialog","setShowFilterResetDialog","React","useState","pendingChangesWithErrors","getErrors","useEffect","forEach","error","setRowErrorsSeen","rowId","scrollToRow","rowIndex","rowActive","setRowActiveIndex","align","requestAnimationFrame","cell","_tableRef$current","current","querySelector","_cell$focus","focus","call","title","length","alert","titleOne","titlePlural","replace","String","links","rowIdentityColumn","rowIdentityColumnId","getColumn","undefined","index","push","messageAnd","handleClick","getRowModel","rows","findIndex","row","id","tooltip","pendingChange","_meta","errors","_table$getAllColumns$","_table$getAllColumns$2","firstCellErrorColumnId","Object","keys","cells","columnName","getAllColumns","find","column","columnDef","header","Tooltip","key","className","onClick","role","original","message","messageOne","messagePlural","split","map","part","_rowIdentityColumn$co","_rowIdentityColumn$co2","messageRow","handleResetFilters","resetGlobalFilter","resetColumnFilters","BaseAlert","state","FilterResetDialog","open","onChange","onSubmit","handleSubmit","dialogProps","Dialog","size","Content","Title","resetFiltersDialog","description","Footer","Group","Close","Button","cancel","appearance","confirm"],"mappings":";;;;;;;;SAiBgBA,KAAKA,CAAkBC,KAAwB;EAC3D,MAAM;IAAEC,aAAa;IAAEC,KAAK;IAAEC,QAAQ;IAAE,GAAGC;GAAY,GAAGJ,KAAK;EAC/D,MAAM;IAAEK;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAMC,eAAe,GAAGF,KAAK,CAACG,MAAM,CAACC,OAAO,CAACC,UAAU;EACvD,MAAMC,SAAS,GAAGT,KAAK,CAACU,OAAO,CAACC,IAA6B;EAC7D,MAAM,CAACC,qBAAqB,EAAEC,wBAAwB,CAAC,GAAGC,cAAK,CAACC,QAAQ,CAAiB,KAAK,CAA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6BAAC8F,MAAM;IAACE,UAAU,EAAC,SAAS;IAAClC,OAAO,EAAEqB;KACjC9F,KAAK,CAACG,MAAM,CAACC,OAAO,CAACC,UAAU,CAAC+F,kBAAkB,CAACQ,OAAO,CACtD,CACL,CACI,CACH,CACZ;AAEjB;;;;"}
1
+ {"version":3,"file":"Alert.js","sources":["../../../../../../../../../src/components/Table3/components/Editing/Alert.tsx"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable, TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport { ScrollToOptions as ReactVirtualScrollToOptions } from '@tanstack/react-virtual';\nimport { Alert as BaseAlert, AlertProps as BaseAlertProps } from '../../../Alert/Alert';\nimport { TableRef } from '../../../../primitives/Table/types';\nimport { Tooltip } from '../../../Tooltip/Tooltip';\nimport { useLocalization } from '../../../Provider/Localization';\nimport { Dialog, DialogProps } from '../../../Dialog/Dialog';\nimport { Group } from '../../../Group/Group';\nimport { Button } from '../../../Button/Button';\n\ntype AlertProps<TType = unknown> = Omit<BaseAlertProps, 'children'> & {\n scrollToIndex: (index: number, options: ReactVirtualScrollToOptions) => void;\n table: ReactTable<TType>;\n tableRef: React.RefObject<TableRef>;\n};\n\nexport function Alert<TType = unknown>(props: AlertProps<TType>) {\n const { scrollToIndex, table, tableRef, ...attributes } = props;\n const { texts } = useLocalization();\n const validationTexts = texts.table3.editing.validation;\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n const [showFilterResetDialog, setShowFilterResetDialog] = React.useState<string | false>(false);\n\n const pendingChangesWithErrors = tableMeta.editing.getErrors<TType>();\n\n // mark errors being rendered as seen\n React.useEffect(() => {\n pendingChangesWithErrors.forEach(error => {\n tableMeta.editing.setRowErrorsSeen(error.rowId);\n });\n }, [pendingChangesWithErrors]);\n\n function scrollToRow(rowIndex: number) {\n tableMeta.rowActive.setRowActiveIndex(rowIndex);\n scrollToIndex(rowIndex, { align: 'center' });\n\n requestAnimationFrame(() => {\n const cell = tableRef.current?.querySelector(\n 'tbody > tr[data-row-active=\"true\"] > td[data-cell-editing-invalid=\"true\"]'\n );\n\n if (cell) {\n (cell as HTMLElement).focus?.();\n }\n });\n }\n\n // generate the \"N unsaved entries\" title\n const title = (\n pendingChangesWithErrors.length === 1 ? validationTexts.alert.titleOne : validationTexts.alert.titlePlural\n ).replace('[COUNT]', String(pendingChangesWithErrors.length));\n\n // generate links to each invalid row, to go into the error message\n const links: React.ReactNode[] = [];\n const rowIdentityColumn = tableMeta.rowIdentityColumnId ? table.getColumn(tableMeta.rowIdentityColumnId) : undefined;\n\n pendingChangesWithErrors.forEach((error, index) => {\n // if appropriate, concatenate the item with the text \"and\"\n if (pendingChangesWithErrors.length > 1 && index === pendingChangesWithErrors.length - 1) {\n links.push(validationTexts.alert.messageAnd);\n }\n const rowIndex = table.getRowModel().rows.findIndex(row => row.id === error.rowId);\n\n const handleClick = () => {\n if (rowIndex > -1) {\n scrollToRow(rowIndex);\n } else {\n setShowFilterResetDialog(error.rowId);\n }\n };\n\n let tooltip;\n\n if (error.pendingChange._meta.errors.row) {\n tooltip = error.pendingChange._meta.errors.row;\n } else {\n const firstCellErrorColumnId = Object.keys(error.pendingChange._meta.errors.cells)[0];\n const columnName = table.getAllColumns().find(column => column.id === firstCellErrorColumnId)?.columnDef.meta?.header;\n tooltip = `${columnName}: ${error.pendingChange._meta.errors.cells[firstCellErrorColumnId]}`;\n }\n\n links.push(\n <Tooltip key={error.rowId} title={tooltip}>\n <span className=\"text-blue\" onClick={handleClick} role=\"button\">\n {rowIdentityColumn ? error.pendingChange._meta.original[rowIdentityColumn.id] : rowIndex + 1}\n </span>\n </Tooltip>\n );\n\n // if appropriate, concatenate the item with the text \",\"\n if (pendingChangesWithErrors.length > 2 && index < pendingChangesWithErrors.length - 2) {\n links.push(', ');\n }\n });\n\n // generate the \"Row N is incomplete and hasn't been saved\" error message\n const message = (links.length === 1 ? validationTexts.alert.messageOne : validationTexts.alert.messagePlural)\n .split(/(\\[\\w+\\])/)\n .map(part => {\n if (part === '[COLUMN]') {\n return rowIdentityColumn?.columnDef.meta?.header ?? validationTexts.alert.messageRow;\n }\n\n if (part === '[ROW]') {\n return links;\n }\n\n return part;\n });\n\n const handleResetFilters = () => {\n table.resetGlobalFilter();\n table.resetColumnFilters();\n\n requestAnimationFrame(() => {\n const rowIndex = table.getRowModel().rows.findIndex(row => row.id === showFilterResetDialog);\n\n if (rowIndex > -1) {\n scrollToRow(rowIndex);\n }\n\n setShowFilterResetDialog(false);\n });\n };\n\n return (\n <>\n <BaseAlert {...attributes} state=\"error\">\n <span className=\"font-bold\">{title}</span>\n {message}\n </BaseAlert>\n <FilterResetDialog\n open={showFilterResetDialog !== false}\n onChange={() => setShowFilterResetDialog(false)}\n onSubmit={handleResetFilters}\n />\n </>\n );\n}\n\ntype FilterResetDialogProps = Omit<DialogProps, 'children'> & {\n onSubmit: () => void;\n};\n\nfunction FilterResetDialog(props: FilterResetDialogProps) {\n const { onSubmit: handleSubmit, ...dialogProps } = props;\n const { texts } = useLocalization();\n\n return (\n <Dialog {...dialogProps} size=\"xs\">\n <Dialog.Content aria-label=\"Create a new account\">\n <Dialog.Title>{texts.table3.editing.validation.resetFiltersDialog.title}</Dialog.Title>\n\n <p>{texts.table3.editing.validation.resetFiltersDialog.description}</p>\n\n <Dialog.Footer>\n <Group>\n <Dialog.Close>\n <Button>{texts.table3.editing.validation.resetFiltersDialog.cancel}</Button>\n </Dialog.Close>\n <Button appearance=\"primary\" onClick={handleSubmit}>\n {texts.table3.editing.validation.resetFiltersDialog.confirm}\n </Button>\n </Group>\n </Dialog.Footer>\n </Dialog.Content>\n </Dialog>\n );\n}\n"],"names":["Alert","props","scrollToIndex","table","tableRef","attributes","texts","useLocalization","validationTexts","table3","editing","validation","tableMeta","options","meta","showFilterResetDialog","setShowFilterResetDialog","React","useState","pendingChangesWithErrors","getErrors","useEffect","forEach","error","setRowErrorsSeen","rowId","scrollToRow","rowIndex","rowActive","setRowActiveIndex","align","requestAnimationFrame","cell","_tableRef$current","current","querySelector","_cell$focus","focus","call","title","length","alert","titleOne","titlePlural","replace","String","links","rowIdentityColumn","rowIdentityColumnId","getColumn","undefined","index","push","messageAnd","getRowModel","rows","findIndex","row","id","handleClick","tooltip","pendingChange","_meta","errors","_table$getAllColumns$","_table$getAllColumns$2","firstCellErrorColumnId","Object","keys","cells","columnName","getAllColumns","find","column","columnDef","header","Tooltip","key","className","onClick","role","original","message","messageOne","messagePlural","split","map","part","_rowIdentityColumn$co","_rowIdentityColumn$co2","messageRow","handleResetFilters","resetGlobalFilter","resetColumnFilters","BaseAlert","state","FilterResetDialog","open","onChange","onSubmit","handleSubmit","dialogProps","Dialog","size","Content","Title","resetFiltersDialog","description","Footer","Group","Close","Button","cancel","appearance","confirm"],"mappings":";;;;;;;;SAiBgBA,KAAKA,CAAkBC,KAAwB;EAC3D,MAAM;IAAEC,aAAa;IAAEC,KAAK;IAAEC,QAAQ;IAAE,GAAGC;GAAY,GAAGJ,KAAK;EAC/D,MAAM;IAAEK;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAMC,eAAe,GAAGF,KAAK,CAACG,MAAM,CAACC,OAAO,CAACC,UAAU;EACvD,MAAMC,SAAS,GAAGT,KAAK,CAACU,OAAO,CAACC,IAA6B;EAC7D,MAAM,CAACC,qBAAqB,EAAEC,wBAAwB,CAAC,GAAGC,cAAK,CAACC,QAAQ,CAAiB,KAAK,CAAC;EAE/F,MAAMC,wBAAwB,GAAGP,SAAS,CAACF,OAAO,CAACU,SAAS,EAAS;;EAGrEH,cAAK,CAACI,SAAS,CAAC;IACZF,wBAAwB,CAACG,OAAO,CAACC,KAAK;MAClCX,SAAS,CAACF,OAAO,CAACc,gBAAgB,CAACD,KAAK,CAACE,KAAK,CAAC;KAClD,CAAC;GACL,EAAE,CAACN,wBAAwB,CAAC,CAAC;EAE9B,SAASO,WAAWA,CAACC,QAAgB;IACjCf,SAAS,CAACgB,SAAS,CAACC,iBAAiB,CAACF,QAAQ,CAAC;IAC/CzB,aAAa,CAACyB,Q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E,6BAAC+E,iBAAiB;IACdC,IAAI,EAAElF,qBAAqB,KAAK,KAAK;IACrCmF,QAAQ,EAAEA,MAAMlF,wBAAwB,CAAC,KAAK,CAAC;IAC/CmF,QAAQ,EAAER;IACZ,CACH;AAEX;AAMA,SAASK,iBAAiBA,CAAC/F,KAA6B;EACpD,MAAM;IAAEkG,QAAQ,EAAEC,YAAY;IAAE,GAAGC;GAAa,GAAGpG,KAAK;EACxD,MAAM;IAAEK;GAAO,GAAGC,eAAe,EAAE;EAEnC,oBACIU,6BAACqF,MAAM,oBAAKD,WAAW;IAAEE,IAAI,EAAC;mBAC1BtF,6BAACqF,MAAM,CAACE,OAAO;kBAAY;kBACvBvF,6BAACqF,MAAM,CAACG,KAAK,QAAEnG,KAAK,CAACG,MAAM,CAACC,OAAO,CAACC,UAAU,CAAC+F,kBAAkB,CAACnE,KAAK,CAAgB,eAEvFtB,wCAAIX,KAAK,CAACG,MAAM,CAACC,OAAO,CAACC,UAAU,CAAC+F,kBAAkB,CAACC,WAAW,CAAK,eAEvE1F,6BAACqF,MAAM,CAACM,MAAM,qBACV3F,6BAAC4F,KAAK,qBACF5F,6BAACqF,MAAM,CAACQ,KAAK,qBACT7F,6BAAC8F,MAAM,QAAEzG,KAAK,CAACG,MAAM,CAACC,OAAO,CAACC,UAAU,CAAC+F,kBAAkB,CAACM,MAAM,CAAU,CACjE,eACf/F,6BAAC8F,MAAM;IAACE,UAAU,EAAC,SAAS;IAAClC,OAAO,EAAEqB;KACjC9F,KAAK,CAACG,MAAM,CAACC,OAAO,CAACC,UAAU,CAAC+F,kBAAkB,CAACQ,OAAO,CACtD,CACL,CACI,CACH,CACZ;AAEjB;;;;"}
@@ -2,7 +2,7 @@ import React__default from 'react';
2
2
  import { FocusScope } from '@react-aria/focus';
3
3
  import { Header } from './components/Header/Header.js';
4
4
  import { Body } from './components/Body/Body.js';
5
- import { Footer } from './components/Footer/Footer.js';
5
+ import { Foot } from './components/Footer/Footer.js';
6
6
  import { EmptyStateBody } from './components/Body/EmptyStateBody.js';
7
7
  import { TableToolbar } from './components/Toolbar/Toolbar.js';
8
8
 
@@ -45,7 +45,9 @@ function TableGrid(props) {
45
45
  enableHorizontalArrowKeyNavigation: enableHorizontalArrowKeyNavigation,
46
46
  table: table.instance,
47
47
  style: table.renderer.style
48
- }, table.renderer.rows), table.meta.footer.isEnabled ? ( /*#__PURE__*/React__default.createElement("tfoot", null, /*#__PURE__*/React__default.createElement("tr", null, table.instance.getFooterGroups()[0].headers.map(Footer)))) : null)) : ( /*#__PURE__*/React__default.createElement(EmptyStateBody, {
48
+ }, table.renderer.rows), table.meta.footer.isEnabled ? /*#__PURE__*/React__default.createElement(Foot, {
49
+ table: table.instance
50
+ }) : null)) : ( /*#__PURE__*/React__default.createElement(EmptyStateBody, {
49
51
  emptyState: table.props.emptyState
50
52
  })))));
51
53
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Table.js","sources":["../../../../../../../../src/primitives/Table/Core/Table.tsx"],"sourcesContent":["import React from 'react';\nimport { FocusScope } from '@react-aria/focus';\nimport { Header } from './components/Header/Header';\nimport { Body } from './components/Body/Body';\nimport { Footer } from './components/Footer/Footer';\nimport { EmptyStateBody } from './components/Body/EmptyStateBody';\nimport { useTableReturnValue } from './useTable';\nimport { TableToolbar } from './components/Toolbar/Toolbar';\nimport './style.css';\n\ntype TableProps = {\n children: JSX.Element | Array<JSX.Element | null>;\n};\n\nexport function Table(props: TableProps) {\n return <>{props.children}</>;\n}\nTable.Toolbar = TableToolbar;\nTable.Grid = TableGrid;\n\nexport type TableGridProps<TType = unknown> = React.TableHTMLAttributes<HTMLTableElement> & {\n 'data-taco': string;\n enableHorizontalArrowKeyNavigation?: boolean;\n table: useTableReturnValue<TType>;\n};\n\nexport function TableGrid<TType = unknown>(props: TableGridProps<TType>) {\n const { enableHorizontalArrowKeyNavigation, table, ...attributes } = props;\n const handleFocus =\n table.meta.rowActive.rowActiveIndex === undefined\n ? (event: React.FocusEvent) => {\n table.meta.rowActive.handleFocus(event, table.meta.length, table.renderer.scrollToIndex);\n }\n : undefined;\n\n return (\n <>\n <style>{table.stylesheet}</style>\n <FocusScope>\n <table\n {...attributes}\n id={table.id}\n data-table-font-size={table.meta.fontSize.size}\n data-table-grouped={!!table.state.grouping?.length}\n data-table-horizontally-scrolled={table.meta.columnFreezing.isHorizontallyScrolled ? true : undefined}\n data-table-status={table.meta.server.isEnabled ? (table.meta.server.isReady ? 'ready' : undefined) : 'ready'}\n data-table-pause-hover={table.meta.rowActive.isHoverStatePaused ? true : undefined}\n data-table-resizing={table.state.columnSizingInfo.isResizingColumn ? true : undefined}\n data-table-row-height={table.meta.rowHeight.height}\n onFocus={handleFocus}\n onScroll={table.meta.columnFreezing.handleScroll}\n ref={table.ref}\n style={table.style}\n tabIndex={-1}>\n <thead>\n {table.instance.getHeaderGroups().map(headerGroup => (\n <tr key={headerGroup.id}>\n {headerGroup.headers.map(props => (\n <Header key={props.id} header={props} scrollToIndex={table.renderer.scrollToIndex} />\n ))}\n </tr>\n ))}\n </thead>\n {table.instance.getRowModel().rows.length ? (\n <>\n <Body\n enableHorizontalArrowKeyNavigation={enableHorizontalArrowKeyNavigation}\n table={table.instance}\n style={table.renderer.style}>\n {table.renderer.rows}\n </Body>\n {table.meta.footer.isEnabled ? (\n <tfoot>\n <tr>{table.instance.getFooterGroups()[0].headers.map(Footer)}</tr>\n </tfoot>\n ) : null}\n </>\n ) : (\n <EmptyStateBody emptyState={table.props.emptyState} />\n )}\n </table>\n </FocusScope>\n </>\n );\n}\n"],"names":["Table","props","React","children","Toolbar","TableToolbar","Grid","TableGrid","enableHorizontalArrowKeyNavigation","table","attributes","handleFocus","meta","rowActive","rowActiveIndex","undefined","event","length","renderer","scrollToIndex","stylesheet","FocusScope","id","fontSize","size","_table$state$grouping","state","grouping","columnFreezing","isHorizontallyScrolled","server","isEnabled","isReady","isHoverStatePaused","columnSizingInfo","isResizingColumn","rowHeight","height","onFocus","onScroll","handleScroll","ref","style","tabIndex","instance","getHeaderGroups","map","headerGroup","key","headers","Header","header","getRowModel","rows","Body","footer","getFooterGroups","Footer","EmptyStateBody","emptyState"],"mappings":";;;;;;;;SAcgBA,KAAKA,CAACC,KAAiB;EACnC,oBAAOC,4DAAGD,KAAK,CAACE,QAAQ,CAAI;AAChC;AACAH,KAAK,CAACI,OAAO,GAAGC,YAAY;AAC5BL,KAAK,CAACM,IAAI,GAAGC,SAAS;SAQNA,SAASA,CAAkBN,KAA4B;;EACnE,MAAM;IAAEO,kCAAkC;IAAEC,KAAK;IAAE,GAAGC;GAAY,GAAGT,KAAK;EAC1E,MAAMU,WAAW,GACbF,KAAK,CAACG,IAAI,CAACC,SAAS,CAACC,cAAc,KAAKC,SAAS,GAC1CC,KAAuB;IACpBP,KAAK,CAACG,IAAI,CAACC,SAAS,CAACF,WAAW,CAACK,KAAK,EAAEP,KAAK,CAACG,IAAI,CAACK,MAAM,EAAER,KAAK,CAACS,QAAQ,CAACC,aAAa,CAAC;GAC3F,GACDJ,SAAS;EAEnB,oBACIb,yEACIA,4CAAQO,KAAK,CAACW,UAAU,CAAS,eACjClB,6BAACmB,UAAU,qBACPnB,wDACQQ,UAAU;IACdY,EAAE,EAAEb,KAAK,CAACa,EAAE;4BACUb,KAAK,CAACG,IAAI,CAACW,QAAQ,CAACC,IAAI;0BAC1B,CAAC,GAAAC,qBAAA,GAAChB,KAAK,CAACiB,KAAK,CAACC,QAAQ,cAAAF,qBAAA,eAApBA,qBAAA,CAAsBR,MAAM;wCAChBR,KAAK,CAACG,IAAI,CAACgB,cAAc,CAACC,sBAAsB,GAAG,IAAI,GAAGd,SAAS;yBAClFN,KAAK,CAACG,IAAI,CAACkB,MAAM,CAACC,SAAS,GAAItB,KAAK,CAACG,IAAI,CAACkB,MAAM,CAACE,OAAO,GAAG,OAAO,GAAGjB,SAAS,GAAI,OAAO;8BACpFN,KAAK,CAACG,IAAI,CAACC,SAAS,CAACoB,kBAAkB,GAAG,IAAI,GAAGlB,SAAS;2BAC7DN,K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CACzD,CACG,CACC,CACd;AAEX;;;;"}
1
+ {"version":3,"file":"Table.js","sources":["../../../../../../../../src/primitives/Table/Core/Table.tsx"],"sourcesContent":["import React from 'react';\nimport { FocusScope } from '@react-aria/focus';\nimport { Header } from './components/Header/Header';\nimport { Body } from './components/Body/Body';\nimport { Foot } from './components/Footer/Footer';\nimport { EmptyStateBody } from './components/Body/EmptyStateBody';\nimport { useTableReturnValue } from './useTable';\nimport { TableToolbar } from './components/Toolbar/Toolbar';\nimport './style.css';\n\ntype TableProps = {\n children: JSX.Element | Array<JSX.Element | null>;\n};\n\nexport function Table(props: TableProps) {\n return <>{props.children}</>;\n}\nTable.Toolbar = TableToolbar;\nTable.Grid = TableGrid;\n\nexport type TableGridProps<TType = unknown> = React.TableHTMLAttributes<HTMLTableElement> & {\n 'data-taco': string;\n enableHorizontalArrowKeyNavigation?: boolean;\n table: useTableReturnValue<TType>;\n};\n\nexport function TableGrid<TType = unknown>(props: TableGridProps<TType>) {\n const { enableHorizontalArrowKeyNavigation, table, ...attributes } = props;\n const handleFocus =\n table.meta.rowActive.rowActiveIndex === undefined\n ? (event: React.FocusEvent) => {\n table.meta.rowActive.handleFocus(event, table.meta.length, table.renderer.scrollToIndex);\n }\n : undefined;\n\n return (\n <>\n <style>{table.stylesheet}</style>\n <FocusScope>\n <table\n {...attributes}\n id={table.id}\n data-table-font-size={table.meta.fontSize.size}\n data-table-grouped={!!table.state.grouping?.length}\n data-table-horizontally-scrolled={table.meta.columnFreezing.isHorizontallyScrolled ? true : undefined}\n data-table-status={table.meta.server.isEnabled ? (table.meta.server.isReady ? 'ready' : undefined) : 'ready'}\n data-table-pause-hover={table.meta.rowActive.isHoverStatePaused ? true : undefined}\n data-table-resizing={table.state.columnSizingInfo.isResizingColumn ? true : undefined}\n data-table-row-height={table.meta.rowHeight.height}\n onFocus={handleFocus}\n onScroll={table.meta.columnFreezing.handleScroll}\n ref={table.ref}\n style={table.style}\n tabIndex={-1}>\n <thead>\n {table.instance.getHeaderGroups().map(headerGroup => (\n <tr key={headerGroup.id}>\n {headerGroup.headers.map(props => (\n <Header key={props.id} header={props} scrollToIndex={table.renderer.scrollToIndex} />\n ))}\n </tr>\n ))}\n </thead>\n {table.instance.getRowModel().rows.length ? (\n <>\n <Body\n enableHorizontalArrowKeyNavigation={enableHorizontalArrowKeyNavigation}\n table={table.instance}\n style={table.renderer.style}>\n {table.renderer.rows}\n </Body>\n {table.meta.footer.isEnabled ? <Foot table={table.instance} /> : null}\n </>\n ) : (\n <EmptyStateBody emptyState={table.props.emptyState} />\n )}\n </table>\n </FocusScope>\n </>\n );\n}\n"],"names":["Table","props","React","children","Toolbar","TableToolbar","Grid","TableGrid","enableHorizontalArrowKeyNavigation","table","attributes","handleFocus","meta","rowActive","rowActiveIndex","undefined","event","length","renderer","scrollToIndex","stylesheet","FocusScope","id","fontSize","size","_table$state$grouping","state","grouping","columnFreezing","isHorizontallyScrolled","server","isEnabled","isReady","isHoverStatePaused","columnSizingInfo","isResizingColumn","rowHeight","height","onFocus","onScroll","handleScroll","ref","style","tabIndex","instance","getHeaderGroups","map","headerGroup","key","headers","Header","header","getRowModel","rows","Body","footer","Foot","EmptyStateBody","emptyState"],"mappings":";;;;;;;;SAcgBA,KAAKA,CAACC,KAAiB;EACnC,oBAAOC,4DAAGD,KAAK,CAACE,QAAQ,CAAI;AAChC;AACAH,KAAK,CAACI,OAAO,GAAGC,YAAY;AAC5BL,KAAK,CAACM,IAAI,GAAGC,SAAS;SAQNA,SAASA,CAAkBN,KAA4B;;EACnE,MAAM;IAAEO,kCAAkC;IAAEC,KAAK;IAAE,GAAGC;GAAY,GAAGT,KAAK;EAC1E,MAAMU,WAAW,GACbF,KAAK,CAACG,IAAI,CAACC,SAAS,CAACC,cAAc,KAAKC,SAAS,GAC1CC,KAAuB;IACpBP,KAAK,CAACG,IAAI,CAACC,SAAS,CAACF,WAAW,CAACK,KAAK,EAAEP,KAAK,CAACG,IAAI,CAACK,MAAM,EAAER,KAAK,CAACS,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MAAM,EAAElD,KAAK;IAAEkB,aAAa,EAAEV,KAAK,CAACS,QAAQ,CAACC;IAAiB,CACxF,CAAC,CACD,CACR,CAAC,CACE,EACPV,KAAK,CAACmC,QAAQ,CAACQ,WAAW,EAAE,CAACC,IAAI,CAACpC,MAAM,kBACrCf,yEACIA,6BAACoD,IAAI;IACD9C,kCAAkC,EAAEA,kCAAkC;IACtEC,KAAK,EAAEA,KAAK,CAACmC,QAAQ;IACrBF,KAAK,EAAEjC,KAAK,CAACS,QAAQ,CAACwB;KACrBjC,KAAK,CAACS,QAAQ,CAACmC,IAAI,CACjB,EACN5C,KAAK,CAACG,IAAI,CAAC2C,MAAM,CAACxB,SAAS,gBAAG7B,6BAACsD,IAAI;IAAC/C,KAAK,EAAEA,KAAK,CAACmC;IAAY,GAAG,IAAI,CACtE,mBAEH1C,6BAACuD,cAAc;IAACC,UAAU,EAAEjD,KAAK,CAACR,KAAK,CAACyD;IAAc,CACzD,CACG,CACC,CACd;AAEX;;;;"}
@@ -2,16 +2,25 @@ import React__default from 'react';
2
2
  import { flexRender } from '@tanstack/react-table';
3
3
  import { Summary } from './Summary.js';
4
4
 
5
- function Footer(header) {
6
- return /*#__PURE__*/React__default.createElement(MemoedFooter, {
5
+ function Foot(props) {
6
+ const nonGroupedHeaders = props.table.getFooterGroups()[0].headers.filter(header => !header.column.getIsGrouped());
7
+ return /*#__PURE__*/React__default.createElement("tfoot", null, /*#__PURE__*/React__default.createElement("tr", null, nonGroupedHeaders.map((header, index) => ( /*#__PURE__*/React__default.createElement(Footer, {
7
8
  key: header.id,
8
- footer: header
9
+ header: header,
10
+ index: index
11
+ })))));
12
+ }
13
+ function Footer(props) {
14
+ return /*#__PURE__*/React__default.createElement(MemoedFooter, {
15
+ footer: props.header,
16
+ index: props.index
9
17
  });
10
18
  }
11
19
  const MemoedFooter = /*#__PURE__*/React__default.memo(function MemoedFooter(props) {
12
20
  var _footer$subHeaders, _footer$subHeaders$fi;
13
21
  const {
14
- footer
22
+ footer,
23
+ index
15
24
  } = props;
16
25
  const columnMeta = footer.column.columnDef.meta;
17
26
  // getIsPinned returns true for split header groups, even if the split group has no pinned sub headers
@@ -24,7 +33,7 @@ const MemoedFooter = /*#__PURE__*/React__default.memo(function MemoedFooter(prop
24
33
  }
25
34
  let content;
26
35
  let align;
27
- if (footer.index === 0) {
36
+ if (index === 0) {
28
37
  align = 'left';
29
38
  content = /*#__PURE__*/React__default.createElement(Summary, {
30
39
  table: footer.getContext().table
@@ -42,5 +51,5 @@ const MemoedFooter = /*#__PURE__*/React__default.memo(function MemoedFooter(prop
42
51
  }, content);
43
52
  });
44
53
 
45
- export { Footer };
54
+ export { Foot, Footer };
46
55
  //# sourceMappingURL=Footer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Footer.js","sources":["../../../../../../../../../../src/primitives/Table/Core/components/Footer/Footer.tsx"],"sourcesContent":["import React from 'react';\nimport { Header as ReactTableHeader, ColumnMeta as ReactTableColumnMeta, flexRender } from '@tanstack/react-table';\nimport { Summary } from './Summary';\n\nexport function Footer<TType = unknown>(header: ReactTableHeader<TType, unknown>) {\n return <MemoedFooter key={header.id} footer={header} />;\n}\n\nexport type MemoedFooterProps<TType = unknown> = {\n footer: ReactTableHeader<TType, unknown>;\n};\n\nconst MemoedFooter = React.memo(function MemoedFooter<TType = unknown>(props: MemoedFooterProps<TType>) {\n const { footer } = props;\n const columnMeta = footer.column.columnDef.meta as ReactTableColumnMeta<TType, unknown>;\n\n // getIsPinned returns true for split header groups, even if the split group has no pinned sub headers\n const isHeaderGroup = !!footer.subHeaders?.length;\n const isPinned = isHeaderGroup\n ? footer.subHeaders.find(x => x.column.getIsPinned())?.column.getIsPinned()\n : footer.column.getIsPinned();\n\n const style: React.CSSProperties = {};\n\n if (isPinned) {\n // pinned columns should be offset from either the left or right\n style[isPinned] = `${footer.column.getStart(isPinned) - 1}px`;\n }\n\n let content;\n let align;\n\n if (footer.index === 0) {\n align = 'left';\n content = <Summary table={footer.getContext().table} />;\n } else {\n align = columnMeta.align;\n content = footer.isPlaceholder ? null : flexRender(footer.column.columnDef.footer, footer.getContext());\n }\n\n return (\n <td\n key={footer.id}\n data-cell-align={align}\n data-cell-id={footer.id}\n data-cell-pinned={isPinned ? isPinned : undefined}\n style={style}>\n {content}\n </td>\n );\n}) as <TType = unknown>(props: MemoedFooterProps<TType>) => JSX.Element;\n"],"names":["Footer","header","React","MemoedFooter","key","id","footer","memo","props","columnMeta","column","columnDef","meta","isHeaderGroup","_footer$subHeaders","subHeaders","length","isPinned","_footer$subHeaders$fi","find","x","getIsPinned","style","getStart","content","align","index","Summary","table","getContext","isPlaceholder","flexRender","undefined"],"mappings":";;;;SAIgBA,MAAMA,CAAkBC,MAAwC;EAC5E,oBAAOC,6BAACC,YAAY;IAACC,GAAG,EAAEH,MAAM,CAACI,EAAE;IAAEC,MAAM,EAAEL;IAAU;AAC3D;AAMA,MAAME,YAAY,gBAAGD,cAAK,CAACK,IAAI,CAAC,SAASJ,YAAYA,CAAkBK,KAA+B;;EAClG,MAAM;IAAEF;GAAQ,GAAGE,KAAK;EACxB,MAAMC,UAAU,GAAGH,MAAM,CAACI,MAAM,CAACC,SAAS,CAACC,IAA4C;;EAGvF,MAAMC,aAAa,GAAG,CAAC,GAAAC,kBAAA,GAACR,MAAM,CAACS,UAAU,cAAAD,kBAAA,eAAjBA,kBAAA,CAAmBE,MAAM;EACjD,MAAMC,QAAQ,GAAGJ,aAAa,IAAAK,qBAAA,GACxBZ,MAAM,CAACS,UAAU,CAACI,IAAI,CAACC,CAAC,IAAIA,CAAC,CAACV,MAAM,CAACW,WAAW,EAAE,CAAC,cAAAH,qBAAA,uBAAnDA,qBAAA,CAAqDR,MAAM,CAACW,WAAW,EAAE,GACzEf,MAAM,CAACI,MAAM,CAACW,WAAW,EAAE;EAEjC,MAAMC,KAAK,GAAwB,EAAE;EAErC,IAAIL,QAAQ,EAAE;;IAEVK,KAAK,CAACL,QAAQ,CAAC,MAAMX,MAAM,CAACI,MAAM,CAACa,QAAQ,CAACN,QAAQ,CAAC,GAAG,KAAK;;EAGjE,IAAIO,OAAO;EACX,IAAIC,KAAK;EAET,IAAInB,MAAM,CAACoB,KAAK,KAAK,CAAC,EAAE;IACpBD,KAAK,GAAG,MAAM;IACdD,OAAO,gBAAGtB,6BAACyB,OAAO;MAACC,KAAK,EAAEtB,MAAM,CAACuB,UAAU,EAAE,CAACD;MAAS;GAC1D,MAAM;IACHH,KAAK,GAAGhB,UAAU,CAACgB,KAAK;IACxBD,OAAO,GAAGlB,MAAM,CAACwB,aAAa,GAAG,IAAI,GAAGC,UAAU,CAACzB,MAAM,CAACI,MAAM,CAACC,SAAS,CAACL,MAAM,EAAEA,MAAM,CAACuB,UAAU,EAAE,CAAC;;EAG3G,oBACI3B;IACIE,GAAG,EAAEE,MAAM,CAACD,EAAE;uBACGoB,KAAK;oBACRnB,MAAM,CAACD,EAAE;wBACLY,QAAQ,GAAGA,QAAQ,GAAGe,SAAS;IACjDV,KAAK,EAAEA;KACNE,OAAO,CACP;AAEb,CAAC,CAAsE;;;;"}
1
+ {"version":3,"file":"Footer.js","sources":["../../../../../../../../../../src/primitives/Table/Core/components/Footer/Footer.tsx"],"sourcesContent":["import React from 'react';\nimport {\n Header as ReactTableHeader,\n ColumnMeta as ReactTableColumnMeta,\n flexRender,\n Table as ReactTable,\n} from '@tanstack/react-table';\nimport { Summary } from './Summary';\n\nexport type FootProps<TType = unknown> = {\n table: ReactTable<TType>;\n};\nexport function Foot<TType = unknown>(props: FootProps<TType>) {\n const nonGroupedHeaders = props.table.getFooterGroups()[0].headers.filter(header => !header.column.getIsGrouped());\n return (\n <tfoot>\n <tr>\n {nonGroupedHeaders.map((header, index) => (\n <Footer key={header.id} header={header} index={index} />\n ))}\n </tr>\n </tfoot>\n );\n}\n\nexport type FooterProps<TType = unknown> = {\n header: ReactTableHeader<TType, unknown>;\n index: number;\n};\nexport function Footer<TType = unknown>(props: FooterProps<TType>) {\n return <MemoedFooter footer={props.header} index={props.index} />;\n}\n\nexport type MemoedFooterProps<TType = unknown> = {\n footer: ReactTableHeader<TType, unknown>;\n index: number;\n};\nconst MemoedFooter = React.memo(function MemoedFooter<TType = unknown>(props: MemoedFooterProps<TType>) {\n const { footer, index } = props;\n const columnMeta = footer.column.columnDef.meta as ReactTableColumnMeta<TType, unknown>;\n\n // getIsPinned returns true for split header groups, even if the split group has no pinned sub headers\n const isHeaderGroup = !!footer.subHeaders?.length;\n const isPinned = isHeaderGroup\n ? footer.subHeaders.find(x => x.column.getIsPinned())?.column.getIsPinned()\n : footer.column.getIsPinned();\n\n const style: React.CSSProperties = {};\n\n if (isPinned) {\n // pinned columns should be offset from either the left or right\n style[isPinned] = `${footer.column.getStart(isPinned) - 1}px`;\n }\n\n let content;\n let align;\n\n if (index === 0) {\n align = 'left';\n content = <Summary table={footer.getContext().table} />;\n } else {\n align = columnMeta.align;\n content = footer.isPlaceholder ? null : flexRender(footer.column.columnDef.footer, footer.getContext());\n }\n\n return (\n <td\n key={footer.id}\n data-cell-align={align}\n data-cell-id={footer.id}\n data-cell-pinned={isPinned ? isPinned : undefined}\n style={style}>\n {content}\n </td>\n );\n}) as <TType = unknown>(props: MemoedFooterProps<TType>) => JSX.Element;\n"],"names":["Foot","props","nonGroupedHeaders","table","getFooterGroups","headers","filter","header","column","getIsGrouped","React","map","index","Footer","key","id","MemoedFooter","footer","memo","columnMeta","columnDef","meta","isHeaderGroup","_footer$subHeaders","subHeaders","length","isPinned","_footer$subHeaders$fi","find","x","getIsPinned","style","getStart","content","align","Summary","getContext","isPlaceholder","flexRender","undefined"],"mappings":";;;;SAYgBA,IAAIA,CAAkBC,KAAuB;EACzD,MAAMC,iBAAiB,GAAGD,KAAK,CAACE,KAAK,CAACC,eAAe,EAAE,CAAC,CAAC,CAAC,CAACC,OAAO,CAACC,MAAM,CAACC,MAAM,IAAI,CAACA,MAAM,CAACC,MAAM,CAACC,YAAY,EAAE,CAAC;EAClH,oBACIC,yDACIA,yCACKR,iBAAiB,CAAC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Ec,MAAM,CAACmB,UAAU,EAAE,CAACjC;MAAS;GAC1D,MAAM;IACH+B,KAAK,GAAGf,UAAU,CAACe,KAAK;IACxBD,OAAO,GAAGhB,MAAM,CAACoB,aAAa,GAAG,IAAI,GAAGC,UAAU,CAACrB,MAAM,CAACT,MAAM,CAACY,SAAS,CAACH,MAAM,EAAEA,MAAM,CAACmB,UAAU,EAAE,CAAC;;EAG3G,oBACI1B;IACII,GAAG,EAAEG,MAAM,CAACF,EAAE;uBACGmB,KAAK;oBACRjB,MAAM,CAACF,EAAE;wBACLW,QAAQ,GAAGA,QAAQ,GAAGa,SAAS;IACjDR,KAAK,EAAEA;KACNE,OAAO,CACP;AAEb,CAAC,CAAsE;;;;"}
@@ -55,12 +55,21 @@ function Print(props) {
55
55
  // do this here because Safari doesn't support the beforeprint event
56
56
  togglePrinting(true);
57
57
  requestAnimationFrame(() => {
58
- try {
59
- // window.print doesn't always work in Safari :man_shrugging:
60
- document.execCommand('print', false, undefined);
61
- } catch {
62
- window.print();
63
- }
58
+ requestAnimationFrame(() => {
59
+ const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
60
+ if (isSafari) {
61
+ try {
62
+ // Try using document.execCommand for printing in Safari
63
+ document.execCommand('print', false, undefined);
64
+ } catch (error) {
65
+ // If document.execCommand fails or throws an error, fallback to window.print()
66
+ window.print();
67
+ }
68
+ } else {
69
+ // Execute window.print() for all other browsers
70
+ window.print();
71
+ }
72
+ });
64
73
  });
65
74
  }, 150);
66
75
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Print.js","sources":["../../../../../../../../../../../../src/primitives/Table/Core/components/Toolbar/components/Print/Print.tsx"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable, TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport { IconButton } from '../../../../../../../components/IconButton/IconButton';\nimport { useLocalization } from '../../../../../../../components/Provider/Localization';\nimport { useToast } from '../../../../../../../components/Toast/Toaster';\nimport { TableRef } from '../../../../../types';\nimport { PrintDialog } from './PrintDialog';\nimport { Shortcut } from '../../../../../../../components/Shortcut/Shortcut';\n\nexport type PrintProps<TType = unknown> = {\n table: ReactTable<TType>;\n tableId: string;\n tableRef: React.RefObject<TableRef>;\n};\n\nexport function Print<TType = unknown>(props: PrintProps<TType>) {\n const { table, tableId, tableRef } = props;\n const { texts } = useLocalization();\n const ref = React.useRef<HTMLButtonElement>(null);\n const lastScrollTopRef = React.useRef<number>();\n const toast = useToast();\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n const { allRows, orientation, size, splitGroups } = tableMeta.printing.settings;\n\n const togglePrinting = React.useCallback(\n enabled => {\n tableMeta.printing.setIsPrinting(enabled);\n\n if (tableRef.current) {\n if (enabled) {\n lastScrollTopRef.current = tableRef.current.scrollTop;\n } else if (lastScrollTopRef.current !== undefined) {\n tableRef.current.scrollTop = lastScrollTopRef.current;\n lastScrollTopRef.current = undefined;\n }\n }\n },\n [tableRef.current]\n );\n\n React.useEffect(() => {\n const afterPrint = () => {\n togglePrinting(false);\n };\n\n window.addEventListener('afterprint', afterPrint);\n\n return () => {\n window.removeEventListener('afterprint', afterPrint);\n };\n }, []);\n\n const print = async () => {\n const toastRef = toast.loading(texts.table.print.loading);\n\n if (tableMeta.server.isEnabled && tableMeta.server.loadAllIfNeeded) {\n try {\n await tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters, undefined);\n } catch (error) {\n const errorMessage = `${texts.table.print.error}: ${error}`;\n console.error(errorMessage);\n toastRef.error(errorMessage);\n }\n }\n\n // this might close immediately if the dataset is small - this is okay\n toastRef.close();\n\n // use a timeout to let the toast close, otherwise it freezes mid animation when the print dialog opens\n setTimeout(() => {\n // do this here because Safari doesn't support the beforeprint event\n togglePrinting(true);\n\n requestAnimationFrame(() => {\n try {\n // window.print doesn't always work in Safari :man_shrugging:\n document.execCommand('print', false, undefined);\n } catch {\n window.print();\n }\n });\n }, 150);\n };\n\n const printStyle = [`@page { size: ${size} ${orientation}; }`];\n\n if (!allRows) {\n printStyle.push(`table[data-taco^='table']#${tableId} tr:not([data-row-selected=\"true\"]) { display: none; }`);\n }\n\n if (splitGroups) {\n printStyle.push(`table[data-taco^='table']#${tableId} tr[data-row-group]:not(:first-child) { break-before: page; }`);\n }\n\n const shortcut = { key: 'p', meta: true, shift: false };\n const tooltip = (\n <>\n {texts.table.print.tooltip}\n <Shortcut className=\"ml-2\" keys={shortcut} />\n </>\n );\n\n return (\n <>\n <style media=\"print\">{printStyle.join('\\n')}</style>\n <IconButton\n icon=\"print\"\n aria-label={texts.table.print.tooltip}\n dialog={dialogProps => (\n <PrintDialog\n {...dialogProps}\n table={table}\n onAccept={print}\n orientation={orientation}\n setOrientation={value => tableMeta.printing.setSetting('orientation', value)}\n size={size}\n setSize={value => tableMeta.printing.setSetting('size', value)}\n allRows={allRows}\n setAllRows={value => tableMeta.printing.setSetting('allRows', value)}\n splitGroups={splitGroups}\n setSplitGroups={value => tableMeta.printing.setSetting('splitGroups', value)}\n />\n )}\n ref={ref}\n shortcut={shortcut}\n tooltip={tooltip}\n />\n </>\n );\n}\n"],"names":["Print","props","table","tableId","tableRef","texts","useLocalization","ref","React","useRef","lastScrollTopRef","toast","useToast","tableMeta","options","meta","allRows","orientation","size","splitGroups","printing","settings","togglePrinting","useCallback","enabled","setIsPrinting","current","scrollTop","undefined","useEffect","afterPrint","window","addEventListener","removeEventListener","print","toastRef","close","setTimeout","requestAnimationFrame","document","execCommand","loading","_temp2","server","isEnabled","loadAllIfNeeded","_temp","_catch","Promise","resolve","getState","sorting","columnFilters","then","error","errorMessage","console","_temp3","e","reject","printStyle","push","shortcut","key","shift","tooltip","Shortcut","className","keys","media","join","IconButton","icon","dialog","dialogProps","PrintDialog","onAccept","setOrientation","value","setSetting","setSize","setAllRows","setSplitGroups"],"mappings":";;;;;;;;SAegBA,KAAKA,CAAkBC,KAAwB;EAC3D,MAAM;IAAEC,KAAK;IAAEC,OAAO;IAAEC;GAAU,GAAGH,KAAK;EAC1C,MA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AQ,EAAEA,QAAQ;IAClBG,OAAO,EAAEA;IACX,CACH;AAEX;;;;"}
1
+ {"version":3,"file":"Print.js","sources":["../../../../../../../../../../../../src/primitives/Table/Core/components/Toolbar/components/Print/Print.tsx"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable, TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport { IconButton } from '../../../../../../../components/IconButton/IconButton';\nimport { useLocalization } from '../../../../../../../components/Provider/Localization';\nimport { useToast } from '../../../../../../../components/Toast/Toaster';\nimport { TableRef } from '../../../../../types';\nimport { PrintDialog } from './PrintDialog';\nimport { Shortcut } from '../../../../../../../components/Shortcut/Shortcut';\n\nexport type PrintProps<TType = unknown> = {\n table: ReactTable<TType>;\n tableId: string;\n tableRef: React.RefObject<TableRef>;\n};\n\nexport function Print<TType = unknown>(props: PrintProps<TType>) {\n const { table, tableId, tableRef } = props;\n const { texts } = useLocalization();\n const ref = React.useRef<HTMLButtonElement>(null);\n const lastScrollTopRef = React.useRef<number>();\n const toast = useToast();\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n const { allRows, orientation, size, splitGroups } = tableMeta.printing.settings;\n\n const togglePrinting = React.useCallback(\n enabled => {\n tableMeta.printing.setIsPrinting(enabled);\n\n if (tableRef.current) {\n if (enabled) {\n lastScrollTopRef.current = tableRef.current.scrollTop;\n } else if (lastScrollTopRef.current !== undefined) {\n tableRef.current.scrollTop = lastScrollTopRef.current;\n lastScrollTopRef.current = undefined;\n }\n }\n },\n [tableRef.current]\n );\n\n React.useEffect(() => {\n const afterPrint = () => {\n togglePrinting(false);\n };\n\n window.addEventListener('afterprint', afterPrint);\n\n return () => {\n window.removeEventListener('afterprint', afterPrint);\n };\n }, []);\n\n const print = async () => {\n const toastRef = toast.loading(texts.table.print.loading);\n\n if (tableMeta.server.isEnabled && tableMeta.server.loadAllIfNeeded) {\n try {\n await tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters, undefined);\n } catch (error) {\n const errorMessage = `${texts.table.print.error}: ${error}`;\n console.error(errorMessage);\n toastRef.error(errorMessage);\n }\n }\n\n // this might close immediately if the dataset is small - this is okay\n toastRef.close();\n\n // use a timeout to let the toast close, otherwise it freezes mid animation when the print dialog opens\n setTimeout(() => {\n // do this here because Safari doesn't support the beforeprint event\n togglePrinting(true);\n\n requestAnimationFrame(() => {\n requestAnimationFrame(() => {\n const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);\n\n if (isSafari) {\n try {\n // Try using document.execCommand for printing in Safari\n document.execCommand('print', false, undefined);\n } catch (error) {\n // If document.execCommand fails or throws an error, fallback to window.print()\n window.print();\n }\n } else {\n // Execute window.print() for all other browsers\n window.print();\n }\n });\n });\n }, 150);\n };\n\n const printStyle = [`@page { size: ${size} ${orientation}; }`];\n\n if (!allRows) {\n printStyle.push(`table[data-taco^='table']#${tableId} tr:not([data-row-selected=\"true\"]) { display: none; }`);\n }\n\n if (splitGroups) {\n printStyle.push(`table[data-taco^='table']#${tableId} tr[data-row-group]:not(:first-child) { break-before: page; }`);\n }\n\n const shortcut = { key: 'p', meta: true, shift: false };\n const tooltip = (\n <>\n {texts.table.print.tooltip}\n <Shortcut className=\"ml-2\" keys={shortcut} />\n </>\n );\n\n return (\n <>\n <style media=\"print\">{printStyle.join('\\n')}</style>\n <IconButton\n icon=\"print\"\n aria-label={texts.table.print.tooltip}\n dialog={dialogProps => (\n <PrintDialog\n {...dialogProps}\n table={table}\n onAccept={print}\n orientation={orientation}\n setOrientation={value => tableMeta.printing.setSetting('orientation', value)}\n size={size}\n setSize={value => tableMeta.printing.setSetting('size', value)}\n allRows={allRows}\n setAllRows={value => tableMeta.printing.setSetting('allRows', value)}\n splitGroups={splitGroups}\n setSplitGroups={value => tableMeta.printing.setSetting('splitGroups', value)}\n />\n )}\n ref={ref}\n shortcut={shortcut}\n tooltip={tooltip}\n />\n </>\n );\n}\n"],"names":["Print","props","table","tableId","tableRef","texts","useLocalization","ref","React","useRef","lastScrollTopRef","toast","useToast","tableMeta","options","meta","allRows","orientation","size","splitGroups","printing","settings","togglePrinting","useCallback","enabled","setIsPrinting","current","scrollTop","undefined","useEffect","afterPrint","window","addEventListener","removeEventListener","print","toastRef","close","setTimeout","requestAnimationFrame","isSafari","test","navigator","userAgent","document","execCommand","error","loading","_temp2","server","isEnabled","loadAllIfNeeded","_temp","_catch","Promise","resolve","getState","sorting","columnFilters","then","errorMessage","console","_temp3","e","reject","printStyle","push","shortcut","key","shift","tooltip","Shortcut","className","keys","media","join","IconButton","icon","dialog","dialogProps","PrintDialog","onAccept","setOrientation","value","setSetting","setSize","setAllRows","setSplitGroups"],"mappings":";;;;;;;;SAegBA,KAAKA,CAAkBC,KAAwB;EAC3D,MAAM;IAAEC,KAAK;IAAEC,OAAO;IAAEC;GAAU,GAAGH,KAAK;EAC1C,MAAM;IAAEI;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAMC,GAAG,GAAGC,cAAK,CAACC,MAAM,CAAoB,IAAI,CAAC;EACjD,MAAMC,gBAAgB,GAAGF,cAAK,CAACC,MAAM,EAAU;EAC/C,MAAME,KAAK,GAAGC,QAAQ,EAAE;EACxB,MAAMC,SAAS,GAAGX,KAAK,CAACY,OAAO,CAACC,IAA6B;EAC7D,MAAM;IAAEC,OAAO;IAAEC,WAAW;IAAEC,IAAI;IAAEC;GAAa,GAAGN,SAAS,CAACO,QAAQ,CAACC,QAAQ;EAE/E,MAAMC,cAAc,GAAGd,cAAK,CAACe,WAAW,CACpCC,OAAO;IACHX,SAAS,CAACO,QAAQ,CAACK,aAAa,CAACD,OAAO,CAAC;IAEzC,IAAIpB,QAAQ,CAACsB,OAAO,EAAE;MAClB,IAAIF,OAAO,EAAE;QACTd,gBAAgB,CAACgB,OAAO,GAAGtB,QAAQ,CAACsB,OAAO,CAACC,SAAS;OACxD,MAAM,IAAIjB,gBAAgB,CAACgB,OAAO,KAAKE,SAAS,EAAE;QAC/CxB,QAAQ,CAACsB,OAAO,CAACC,SAAS,GAAGjB,gB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AAK,CAACgC,KAAK,CAACmC,OAAO;IACrCQ,MAAM,EAAEC,WAAW,mBACftE,6BAACuE,WAAW,oBACJD,WAAW;MACf5E,KAAK,EAAEA,KAAK;MACZ8E,QAAQ,EAAE9C,KAAK;MACfjB,WAAW,EAAEA,WAAW;MACxBgE,cAAc,EAAEC,KAAK,IAAIrE,SAAS,CAACO,QAAQ,CAAC+D,UAAU,CAAC,aAAa,EAAED,KAAK,CAAC;MAC5EhE,IAAI,EAAEA,IAAI;MACVkE,OAAO,EAAEF,KAAK,IAAIrE,SAAS,CAACO,QAAQ,CAAC+D,UAAU,CAAC,MAAM,EAAED,KAAK,CAAC;MAC9DlE,OAAO,EAAEA,OAAO;MAChBqE,UAAU,EAAEH,KAAK,IAAIrE,SAAS,CAACO,QAAQ,CAAC+D,UAAU,CAAC,SAAS,EAAED,KAAK,CAAC;MACpE/D,WAAW,EAAEA,WAAW;MACxBmE,cAAc,EAAEJ,KAAK,IAAIrE,SAAS,CAACO,QAAQ,CAAC+D,UAAU,CAAC,aAAa,EAAED,KAAK;OAC7E,CACL;IACD3E,GAAG,EAAEA,GAAG;IACR2D,QAAQ,EAAEA,QAAQ;IAClBG,OAAO,EAAEA;IACX,CACH;AAEX;;;;"}
@@ -6,10 +6,11 @@ import { Row } from '../components/Row/Row.js';
6
6
  const TABLE_SCROLL_PADDING_BOTTOM = 36;
7
7
  const TABLE_PADDING_BOTTOM = 120;
8
8
  function useTableRenderer(renderers, table, tableRef, defaultRowActiveIndex) {
9
- var _table$getState$group, _virtualItems$;
9
+ var _table$getState$group, _ref, _virtualItems$padding, _virtualItems$padding2, _ref2, _virtualItems;
10
10
  const tableMeta = table.options.meta;
11
11
  const rows = table.getRowModel().rows;
12
12
  const HEADER_OFFSET_TOTAL = HEADER_ROW_HEIGHT_ESTIMATE * table.getHeaderGroups().length;
13
+ const isTableGrouped = !!((_table$getState$group = table.getState().grouping) !== null && _table$getState$group !== void 0 && _table$getState$group.length);
13
14
  // expanded rows
14
15
  const {
15
16
  createRowMeasurer,
@@ -23,7 +24,7 @@ function useTableRenderer(renderers, table, tableRef, defaultRowActiveIndex) {
23
24
  getScrollElement: () => tableRef.current,
24
25
  overscan: tableMeta.printing.isPrinting ? rows.length : undefined,
25
26
  rangeExtractor,
26
- scrollPaddingStart: (_table$getState$group = table.getState().grouping) !== null && _table$getState$group !== void 0 && _table$getState$group.length ? HEADER_ROW_HEIGHT_ESTIMATE : undefined,
27
+ scrollPaddingStart: isTableGrouped ? HEADER_ROW_HEIGHT_ESTIMATE : undefined,
27
28
  scrollPaddingEnd: HEADER_OFFSET_TOTAL + TABLE_SCROLL_PADDING_BOTTOM,
28
29
  paddingEnd: TABLE_PADDING_BOTTOM
29
30
  });
@@ -56,10 +57,12 @@ function useTableRenderer(renderers, table, tableRef, defaultRowActiveIndex) {
56
57
  }
57
58
  }
58
59
  }, [virtualItems.length, tableRef.current]);
60
+ // use row 1 not 0, because 0 might be sticky in grouped tables and it's start value will always be 0
61
+ const paddingStartIndex = isTableGrouped && rows.length > 1 ? 1 : 0;
59
62
  // styling for offsetting rows - this "is" the virtualisation
60
63
  const [paddingTop, paddingBottom] = virtualItems.length > 0 ? [
61
64
  // use row 1 not 0, because 0 might be sticky in grouped tables and it's start value will always be 0
62
- Math.max(0, ((_virtualItems$ = virtualItems[1]) !== null && _virtualItems$ !== void 0 ? _virtualItems$ : virtualItems[0]).start - virtualiser.options.scrollMargin - virtualItems[0].size), Math.max(0, virtualiser.getTotalSize() - virtualItems[virtualItems.length - 1].end)] : [0, 0];
65
+ Math.max(0, (_ref = ((_virtualItems$padding = virtualItems[paddingStartIndex]) === null || _virtualItems$padding === void 0 ? void 0 : _virtualItems$padding.start) - virtualiser.options.scrollMargin - ((_virtualItems$padding2 = virtualItems[paddingStartIndex]) === null || _virtualItems$padding2 === void 0 ? void 0 : _virtualItems$padding2.size)) !== null && _ref !== void 0 ? _ref : 0), Math.max(0, (_ref2 = virtualiser.getTotalSize() - ((_virtualItems = virtualItems[virtualItems.length - 1]) === null || _virtualItems === void 0 ? void 0 : _virtualItems.end)) !== null && _ref2 !== void 0 ? _ref2 : 0)] : [0, 0];
63
66
  // ensure default active rows are scrolled to
64
67
  React__default.useEffect(() => {
65
68
  if (defaultRowActiveIndex) {
@@ -79,6 +82,10 @@ function useTableRenderer(renderers, table, tableRef, defaultRowActiveIndex) {
79
82
  paddingTop
80
83
  };
81
84
  content = virtualItems.map(virtualRow => {
85
+ // there appears to be a react-virtual bug where it inserts a single `undefined` item at the end of the row, which crashes here
86
+ if (!virtualRow) {
87
+ return null;
88
+ }
82
89
  const row = rows[virtualRow.index];
83
90
  const measureRow = createRowMeasurer(virtualiser.resizeItem, virtualRow);
84
91
  return /*#__PURE__*/React__default.createElement(Row, {
@@ -1 +1 @@
1
- {"version":3,"file":"useTableRenderer.js","sources":["../../../../../../../../../src/primitives/Table/Core/features/useTableRenderer.tsx"],"sourcesContent":["import React, { CSSProperties } from 'react';\nimport { Table as ReactTable, TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport {\n useVirtualizer,\n defaultRangeExtractor,\n ScrollToOptions as ReactVirtualScrollToOptions,\n VirtualItem,\n} from '@tanstack/react-virtual';\nimport { HEADER_ROW_HEIGHT_ESTIMATE, ROW_HEIGHT_ESTIMATES } from '../util/rows';\nimport { Row } from '../components/Row/Row';\nimport { useTableRenderers } from '../types';\nimport { TableRef } from '../../types';\n\nconst TABLE_SCROLL_PADDING_BOTTOM = 36;\nconst TABLE_PADDING_BOTTOM = 120;\n\nexport function useTableRenderer<TType = unknown>(\n renderers: useTableRenderers<TType>,\n table: ReactTable<TType>,\n tableRef: React.RefObject<TableRef>,\n defaultRowActiveIndex?: number | undefined\n) {\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n const rows = table.getRowModel().rows;\n const HEADER_OFFSET_TOTAL = HEADER_ROW_HEIGHT_ESTIMATE * table.getHeaderGroups().length;\n\n // expanded rows\n const { createRowMeasurer, estimateSize } = useRowHeightVirtualisation<TType>(table);\n\n // row groups\n const rangeExtractor = useRowGroupVirtualisation<TType>(table);\n\n const virtualiser = useVirtualizer({\n count: rows.length,\n estimateSize,\n getScrollElement: () => tableRef.current,\n overscan: tableMeta.printing.isPrinting ? rows.length : undefined,\n rangeExtractor,\n scrollPaddingStart: table.getState().grouping?.length ? HEADER_ROW_HEIGHT_ESTIMATE : undefined,\n scrollPaddingEnd: HEADER_OFFSET_TOTAL + TABLE_SCROLL_PADDING_BOTTOM,\n paddingEnd: TABLE_PADDING_BOTTOM,\n });\n\n const virtualItems = virtualiser.getVirtualItems();\n\n const scrollToIndex = React.useCallback(\n (index: number, options: ReactVirtualScrollToOptions = { align: 'auto', behavior: 'smooth' }) => {\n const notSmooth: ReactVirtualScrollToOptions = { ...options, behavior: 'auto' };\n\n if (tableRef.current) {\n if (index === 0) {\n virtualiser.scrollToOffset(0, notSmooth);\n } else if (index >= virtualItems.length - 1) {\n // scrolling to the last row isn't easy when rows have dynamic height\n // because you don't know all the heights until they render...\n // so when you skip to the last you don't know if \"the end\" is actually the end\n virtualiser.scrollToIndex(index, notSmooth);\n\n // https://github.com/TanStack/virtual/issues/216\n setTimeout(() => {\n virtualiser.scrollToIndex(index, notSmooth);\n\n setTimeout(() => {\n virtualiser.scrollToIndex(index, notSmooth);\n }, 150);\n }, 150);\n } else {\n virtualiser.scrollToIndex(index, options);\n }\n }\n },\n [virtualItems.length, tableRef.current]\n );\n\n // styling for offsetting rows - this \"is\" the virtualisation\n const [paddingTop, paddingBottom] =\n virtualItems.length > 0\n ? [\n // use row 1 not 0, because 0 might be sticky in grouped tables and it's start value will always be 0\n Math.max(\n 0,\n (virtualItems[1] ?? virtualItems[0]).start - virtualiser.options.scrollMargin - virtualItems[0].size\n ),\n Math.max(0, virtualiser.getTotalSize() - virtualItems[virtualItems.length - 1].end),\n ]\n : [0, 0];\n\n // ensure default active rows are scrolled to\n React.useEffect(() => {\n if (defaultRowActiveIndex) {\n scrollToIndex(defaultRowActiveIndex, { align: 'center', behavior: 'auto' });\n }\n }, []);\n\n // rendered output\n let style: CSSProperties = {};\n let content: JSX.Element[] | null = null;\n\n if (rows.length) {\n style = {\n height: `${virtualiser.getTotalSize()}px`,\n paddingBottom,\n paddingTop,\n };\n content = virtualItems.map(virtualRow => {\n const row = rows[virtualRow.index];\n const measureRow = createRowMeasurer(virtualiser.resizeItem, virtualRow);\n return (\n <Row\n key={row.id}\n row={row}\n index={virtualRow.index}\n table={table}\n measureRow={measureRow}\n renderer={renderers.row}\n cellRenderer={renderers.cell}\n />\n );\n });\n }\n\n return {\n rows: content,\n style,\n scrollToIndex,\n };\n}\n\n// support varying row heights - variable row heights, row expansion\nfunction useRowHeightVirtualisation<TType = unknown>(table: ReactTable<TType>) {\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n const rows = table.getRowModel().rows;\n const expandedState = table.getState().expanded;\n\n const [expandedRowHeightsCache, setExpandedRowHeightsCache] = React.useState<Record<number, number>>({});\n\n // look at all registered expanded row heights and use them to form a more accurate average size\n // it might be worth considering if taking the max, or an upper bound, would be better\n const averageExpandedRowHeight = React.useMemo(() => {\n const values: number[] = Object.values(expandedRowHeightsCache);\n return values.length ? values.reduce((a, b) => a + b, 0) / values.length : 0;\n }, [expandedRowHeightsCache]);\n\n // row heights\n const estimateSize = React.useCallback(\n (index: number) => {\n const rowHeight = tableMeta.rowHeight.height\n ? ROW_HEIGHT_ESTIMATES[tableMeta.rowHeight.height]\n : ROW_HEIGHT_ESTIMATES.medium;\n\n if (expandedState === true || rows[index]?.getIsExpanded?.()) {\n return rowHeight + averageExpandedRowHeight;\n }\n\n return rowHeight;\n },\n [tableMeta.rowHeight.height, averageExpandedRowHeight, expandedState]\n );\n\n const createRowMeasurer = React.useCallback(\n (resizeItem: (item: VirtualItem, size: number) => void, virtualRow: VirtualItem) =>\n (rowHeight: number, expansionHeight?: number) => {\n // register the expansion height so that it can be used to determine an average\n if (expansionHeight) {\n setExpandedRowHeightsCache(cache => ({ ...cache, [virtualRow.index]: expansionHeight }));\n }\n\n // update the whole row's size to include the expanded height\n resizeItem(virtualRow, rowHeight + (expansionHeight ?? 0));\n },\n []\n );\n\n return { estimateSize, createRowMeasurer };\n}\n\n// support virtualised row groups (where the row group headers are sticky)\nfunction useRowGroupVirtualisation<TType = unknown>(table: ReactTable<TType>) {\n const rows = table.getRowModel().rows;\n const isTableGrouped = !!table.getState().grouping.length;\n\n const rowGroupIndexes = React.useMemo(() => {\n const indexes: number[] = [];\n\n if (isTableGrouped) {\n rows.forEach((row, index) => {\n if (row.getIsGrouped()) {\n indexes.push(index);\n }\n });\n }\n\n return indexes;\n }, []);\n\n // this is taken from the react-virtual docs/examples\n const rangeExtractor = React.useCallback(\n range => {\n const activeRowGroupIndex =\n [...rowGroupIndexes].reverse().find(index => range.startIndex >= index) ?? rowGroupIndexes[0];\n\n const next = new Set([activeRowGroupIndex, ...defaultRangeExtractor(range)]);\n return [...next].sort((a, b) => a - b);\n },\n [rowGroupIndexes]\n );\n\n return isTableGrouped ? rangeExtractor : undefined;\n}\n"],"names":["TABLE_SCROLL_PADDING_BOTTOM","TABLE_PADDING_BOTTOM","useTableRenderer","renderers","table","tableRef","defaultRowActiveIndex","tableMeta","options","meta","rows","getRowModel","HEADER_OFFSET_TOTAL","HEADER_ROW_HEIGHT_ESTIMATE","getHeaderGroups","length","createRowMeasurer","estimateSize","useRowHeightVirtualisation","rangeExtractor","useRowGroupVirtualisation","virtualiser","useVirtualizer","count","getScrollElement","current","overscan","printing","isPrinting","undefined","scrollPaddingStart","_table$getState$group","getState","grouping","scrollPaddingEnd","paddingEnd","virtualItems","getVirtualItems","scrollToIndex","React","useCallback","index","align","behavior","notSmooth","scrollToOffset","setTimeout","paddingTop","paddingBottom","Math","max","_virtualItems$","start","scrollMargin","size","getTotalSize","end","useEffect","style","content","height","map","virtualRow","row","measureRow","resizeItem","Row","key","id","renderer","cellRenderer","cell","expandedState","expanded","expandedRowHeightsCache","setExpandedRowHeightsCache","useState","averageExpandedRowHeight","useMemo","values","Object","reduce","a","b","rowHeight","ROW_HEIGHT_ESTIMATES","medium","_rows$index","_rows$index$getIsExpa","getIsExpanded","call","expansionHeight","cache","isTableGrouped","rowGroupIndexes","indexes","forEach","getIsGrouped","push","range","activeRowGroupIndex","_reverse$find","reverse","find","startIndex","next","Set","defaultRangeExtractor","sort"],"mappings":";;;;;AAaA,MAAMA,2BAA2B,GAAG,EAAE;AACtC,MAAMC,oBAAoB,GAAG,GAAG;SAEhBC,gBAAgBA,CAC5BC,SAAmC,EACnCC,KAAwB,EACxBC,QAAmC,EACnCC,qBAA0C;;EAE1C,MAAMC,SAAS,GAAGH,KAAK,CAACI,OAAO,CAACC,IAA6B;EAC7D,MAAMC,IAAI,GAAGN,KAAK,CAACO,WAAW,EAAE,CAACD,IAAI;EACrC,MAAME,mBAAmB,GAAGC,0BAA0B,GAAGT,KAAK,CAACU,eAAe,EAAE,CAACC,MAAM;;EAGvF,MAAM;IAAEC,iBAAiB;IAAEC;GAAc,GAAGC,0BAA0B,CAAQd,KAAK,CAAC;;EAGpF,MAAMe,cAAc,GAAGC,yBAAyB,CAAQhB,KAAK,CAAC;EAE9D,MAAMiB,WAAW,GAAGC,cAAc,CAAC;IAC/BC,KAAK,EAAEb,IAAI,CAACK,MAAM;IAClBE,YAAY;IACZO,gBAAgB,EAAEA,MAAMnB,QAAQ,CAACoB,OAAO;IACxCC,QAAQ,EAAEnB,SAAS,CAACoB,QAAQ,CAACC,UAAU,GAAGlB,IAAI,CAACK,MAAM,GAAGc,SAAS;IACjEV,cAAc;IACdW,kBAAkB,EAAE,CAAAC,qBAAA,GAAA3B,KAAK,CAAC4B,QAAQ,EAAE,CAACC,QAAQ,cAAAF,qBAAA,eAAzBA,qBAAA,CAA2BhB,MAAM,GAAGF,0BAA0B,GAAGgB,SAAS;IAC9FK,gBAAgB,EAAEtB,mBAAmB,GAAGZ,2BAA2B;IACnEmC,UAAU,EAAElC;GACf,CAAC;EAEF,MAAMmC,YAAY,GAAGf,WAAW,CAACgB,eAA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AO,CAAC,GAAGM,IAAI,CAAC,CAACG,IAAI,CAAC,CAAC1B,CAAC,EAAEC,CAAC,KAAKD,CAAC,GAAGC,CAAC,CAAC;GACzC,EACD,CAACW,eAAe,CAAC,CACpB;EAED,OAAOD,cAAc,GAAG1E,cAAc,GAAGU,SAAS;AACtD;;;;"}
1
+ {"version":3,"file":"useTableRenderer.js","sources":["../../../../../../../../../src/primitives/Table/Core/features/useTableRenderer.tsx"],"sourcesContent":["import React, { CSSProperties } from 'react';\nimport { Table as ReactTable, TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport {\n useVirtualizer,\n defaultRangeExtractor,\n ScrollToOptions as ReactVirtualScrollToOptions,\n VirtualItem,\n} from '@tanstack/react-virtual';\nimport { HEADER_ROW_HEIGHT_ESTIMATE, ROW_HEIGHT_ESTIMATES } from '../util/rows';\nimport { Row } from '../components/Row/Row';\nimport { useTableRenderers } from '../types';\nimport { TableRef } from '../../types';\n\nconst TABLE_SCROLL_PADDING_BOTTOM = 36;\nconst TABLE_PADDING_BOTTOM = 120;\n\nexport function useTableRenderer<TType = unknown>(\n renderers: useTableRenderers<TType>,\n table: ReactTable<TType>,\n tableRef: React.RefObject<TableRef>,\n defaultRowActiveIndex?: number | undefined\n) {\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n const rows = table.getRowModel().rows;\n const HEADER_OFFSET_TOTAL = HEADER_ROW_HEIGHT_ESTIMATE * table.getHeaderGroups().length;\n const isTableGrouped = !!table.getState().grouping?.length;\n\n // expanded rows\n const { createRowMeasurer, estimateSize } = useRowHeightVirtualisation<TType>(table);\n\n // row groups\n const rangeExtractor = useRowGroupVirtualisation<TType>(table);\n\n const virtualiser = useVirtualizer({\n count: rows.length,\n estimateSize,\n getScrollElement: () => tableRef.current,\n overscan: tableMeta.printing.isPrinting ? rows.length : undefined,\n rangeExtractor,\n scrollPaddingStart: isTableGrouped ? HEADER_ROW_HEIGHT_ESTIMATE : undefined,\n scrollPaddingEnd: HEADER_OFFSET_TOTAL + TABLE_SCROLL_PADDING_BOTTOM,\n paddingEnd: TABLE_PADDING_BOTTOM,\n });\n\n const virtualItems = virtualiser.getVirtualItems();\n\n const scrollToIndex = React.useCallback(\n (index: number, options: ReactVirtualScrollToOptions = { align: 'auto', behavior: 'smooth' }) => {\n const notSmooth: ReactVirtualScrollToOptions = { ...options, behavior: 'auto' };\n\n if (tableRef.current) {\n if (index === 0) {\n virtualiser.scrollToOffset(0, notSmooth);\n } else if (index >= virtualItems.length - 1) {\n // scrolling to the last row isn't easy when rows have dynamic height\n // because you don't know all the heights until they render...\n // so when you skip to the last you don't know if \"the end\" is actually the end\n virtualiser.scrollToIndex(index, notSmooth);\n\n // https://github.com/TanStack/virtual/issues/216\n setTimeout(() => {\n virtualiser.scrollToIndex(index, notSmooth);\n\n setTimeout(() => {\n virtualiser.scrollToIndex(index, notSmooth);\n }, 150);\n }, 150);\n } else {\n virtualiser.scrollToIndex(index, options);\n }\n }\n },\n [virtualItems.length, tableRef.current]\n );\n\n // use row 1 not 0, because 0 might be sticky in grouped tables and it's start value will always be 0\n const paddingStartIndex = isTableGrouped && rows.length > 1 ? 1 : 0;\n\n // styling for offsetting rows - this \"is\" the virtualisation\n const [paddingTop, paddingBottom] =\n virtualItems.length > 0\n ? [\n // use row 1 not 0, because 0 might be sticky in grouped tables and it's start value will always be 0\n Math.max(\n 0,\n virtualItems[paddingStartIndex]?.start -\n virtualiser.options.scrollMargin -\n virtualItems[paddingStartIndex]?.size ?? 0\n ),\n Math.max(0, virtualiser.getTotalSize() - virtualItems[virtualItems.length - 1]?.end ?? 0),\n ]\n : [0, 0];\n\n // ensure default active rows are scrolled to\n React.useEffect(() => {\n if (defaultRowActiveIndex) {\n scrollToIndex(defaultRowActiveIndex, { align: 'center', behavior: 'auto' });\n }\n }, []);\n\n // rendered output\n let style: CSSProperties = {};\n let content: (JSX.Element | null)[] | null = null;\n\n if (rows.length) {\n style = {\n height: `${virtualiser.getTotalSize()}px`,\n paddingBottom,\n paddingTop,\n };\n content = virtualItems.map(virtualRow => {\n // there appears to be a react-virtual bug where it inserts a single `undefined` item at the end of the row, which crashes here\n if (!virtualRow) {\n return null;\n }\n\n const row = rows[virtualRow.index];\n const measureRow = createRowMeasurer(virtualiser.resizeItem, virtualRow);\n return (\n <Row\n key={row.id}\n row={row}\n index={virtualRow.index}\n table={table}\n measureRow={measureRow}\n renderer={renderers.row}\n cellRenderer={renderers.cell}\n />\n );\n });\n }\n\n return {\n rows: content,\n style,\n scrollToIndex,\n };\n}\n\n// support varying row heights - variable row heights, row expansion\nfunction useRowHeightVirtualisation<TType = unknown>(table: ReactTable<TType>) {\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n const rows = table.getRowModel().rows;\n const expandedState = table.getState().expanded;\n\n const [expandedRowHeightsCache, setExpandedRowHeightsCache] = React.useState<Record<number, number>>({});\n\n // look at all registered expanded row heights and use them to form a more accurate average size\n // it might be worth considering if taking the max, or an upper bound, would be better\n const averageExpandedRowHeight = React.useMemo(() => {\n const values: number[] = Object.values(expandedRowHeightsCache);\n return values.length ? values.reduce((a, b) => a + b, 0) / values.length : 0;\n }, [expandedRowHeightsCache]);\n\n // row heights\n const estimateSize = React.useCallback(\n (index: number) => {\n const rowHeight = tableMeta.rowHeight.height\n ? ROW_HEIGHT_ESTIMATES[tableMeta.rowHeight.height]\n : ROW_HEIGHT_ESTIMATES.medium;\n\n if (expandedState === true || rows[index]?.getIsExpanded?.()) {\n return rowHeight + averageExpandedRowHeight;\n }\n\n return rowHeight;\n },\n [tableMeta.rowHeight.height, averageExpandedRowHeight, expandedState]\n );\n\n const createRowMeasurer = React.useCallback(\n (resizeItem: (item: VirtualItem, size: number) => void, virtualRow: VirtualItem) =>\n (rowHeight: number, expansionHeight?: number) => {\n // register the expansion height so that it can be used to determine an average\n if (expansionHeight) {\n setExpandedRowHeightsCache(cache => ({ ...cache, [virtualRow.index]: expansionHeight }));\n }\n\n // update the whole row's size to include the expanded height\n resizeItem(virtualRow, rowHeight + (expansionHeight ?? 0));\n },\n []\n );\n\n return { estimateSize, createRowMeasurer };\n}\n\n// support virtualised row groups (where the row group headers are sticky)\nfunction useRowGroupVirtualisation<TType = unknown>(table: ReactTable<TType>) {\n const rows = table.getRowModel().rows;\n const isTableGrouped = !!table.getState().grouping.length;\n\n const rowGroupIndexes = React.useMemo(() => {\n const indexes: number[] = [];\n\n if (isTableGrouped) {\n rows.forEach((row, index) => {\n if (row.getIsGrouped()) {\n indexes.push(index);\n }\n });\n }\n\n return indexes;\n }, []);\n\n // this is taken from the react-virtual docs/examples\n const rangeExtractor = React.useCallback(\n range => {\n const activeRowGroupIndex =\n [...rowGroupIndexes].reverse().find(index => range.startIndex >= index) ?? rowGroupIndexes[0];\n\n const next = new Set([activeRowGroupIndex, ...defaultRangeExtractor(range)]);\n return [...next].sort((a, b) => a - b);\n },\n [rowGroupIndexes]\n );\n\n return isTableGrouped ? rangeExtractor : undefined;\n}\n"],"names":["TABLE_SCROLL_PADDING_BOTTOM","TABLE_PADDING_BOTTOM","useTableRenderer","renderers","table","tableRef","defaultRowActiveIndex","tableMeta","options","meta","rows","getRowModel","HEADER_OFFSET_TOTAL","HEADER_ROW_HEIGHT_ESTIMATE","getHeaderGroups","length","isTableGrouped","_table$getState$group","getState","grouping","createRowMeasurer","estimateSize","useRowHeightVirtualisation","rangeExtractor","useRowGroupVirtualisation","virtualiser","useVirtualizer","count","getScrollElement","current","overscan","printing","isPrinting","undefined","scrollPaddingStart","scrollPaddingEnd","paddingEnd","virtualItems","getVirtualItems","scrollToIndex","React","useCallback","index","align","behavior","notSmooth","scrollToOffset","setTimeout","paddingStartIndex","paddingTop","paddingBottom","Math","max","_ref","_virtualItems$padding","start","scrollMargin","_virtualItems$padding2","size","_ref2","getTotalSize","_virtualItems","end","useEffect","style","content","height","map","virtualRow","row","measureRow","resizeItem","Row","key","id","renderer","cellRenderer","cell","expandedState","expanded","expandedRowHeightsCache","setExpandedRowHeightsCache","useState","averageExpandedRowHeight","useMemo","values","Object","reduce","a","b","rowHeight","ROW_HEIGHT_ESTIMATES","medium","_rows$index","_rows$index$getIsExpa","getIsExpanded","call","expansionHeight","cache","rowGroupIndexes","indexes","forEach","getIsGrouped","push","range","activeRowGroupIndex","_reverse$find","reverse","find","startIndex","next","Set","defaultRangeExtractor","sort"],"mappings":";;;;;AAaA,MAAMA,2BAA2B,GAAG,EAAE;AACtC,MAAMC,oBAAoB,GAAG,GAAG;SAEhBC,gBAAgBA,CAC5BC,SAAmC,EACnCC,KAAwB,EACxBC,QAAmC,EACnCC,qBAA0C;;EAE1C,MAAMC,SAAS,GAAGH,KAAK,CAACI,OAAO,CAACC,IAA6B;EAC7D,MAAMC,IAAI,GAAGN,KAAK,CAACO,WAAW,EAAE,CAACD,IAAI;EACrC,MAAME,mBAAmB,GAAGC,0BAA0B,GAAGT,KAAK,CAACU,eAAe,EAAE,CAACC,MAAM;EACvF,MAAMC,cAAc,GAAG,CAAC,GAAAC,qBAAA,GAACb,KAAK,CAACc,QAAQ,EAAE,CAACC,QAAQ,cAAAF,qBAAA,eAAzBA,qBAAA,CAA2BF,MAAM;;EAG1D,MAAM;IAAEK,iBAAiB;IAAEC;GAAc,GAAGC,0BAA0B,CAAQlB,KAAK,CAAC;;EAGpF,MAAMmB,cAAc,GAAGC,yBAAyB,CAAQpB,KAAK,CAAC;EAE9D,MAAMqB,WAAW,GAAGC,cAAc,CAAC;IAC/BC,KAAK,EAAEjB,IAAI,CAACK,MAAM;IAClBM,YAAY;IACZO,gBAAgB,EAAEA,MAAMvB,QAAQ,CAACwB,OAAO;IACxCC,QAAQ,EAAEvB,SAAS,CAACwB,QAAQ,CAACC,UAAU,GAAGtB,IAAI,CAACK,MAAM,GAAGkB,SAAS;IACjEV,cAAc;IACdW,kBAAkB,EAAElB,cAAc,GAAGH,0BAA0B,GAAGoB,SAAS;IAC3EE,gBAAgB,EAAEvB,mBAAmB,GAAGZ,2BAA2B;IACnEoC,UAAU,EAAEnC;GACf,CAAC;EAEF,MAAMoC,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ACpC+D,KAAK;;IACD,MAAMC,mBAAmB,IAAAC,aAAA,GACrB,CAAC,GAAGP,eAAe,CAAC,CAACQ,OAAO,EAAE,CAACC,IAAI,CAAClE,KAAK,IAAI8D,KAAK,CAACK,UAAU,IAAInE,KAAK,CAAC,cAAAgE,aAAA,cAAAA,aAAA,GAAIP,eAAe,CAAC,CAAC,CAAC;IAEjG,MAAMW,IAAI,GAAG,IAAIC,GAAG,CAAC,CAACN,mBAAmB,EAAE,GAAGO,qBAAqB,CAACR,KAAK,CAAC,CAAC,CAAC;IAC5E,OAAO,CAAC,GAAGM,IAAI,CAAC,CAACG,IAAI,CAAC,CAACzB,CAAC,EAAEC,CAAC,KAAKD,CAAC,GAAGC,CAAC,CAAC;GACzC,EACD,CAACU,eAAe,CAAC,CACpB;EAED,OAAOnF,cAAc,GAAGO,cAAc,GAAGU,SAAS;AACtD;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"useTable.js","sources":["../../../../../../../../src/primitives/Table/Core/useTable.ts"],"sourcesContent":["import { Table as ReactTable, TableMeta as ReactTableMeta, TableState as ReactTableState } from '@tanstack/react-table';\nimport { ScrollToOptions as ReactVirtualScrollToOptions } from '@tanstack/react-virtual';\nimport { useMergedRef } from '../../../hooks/useMergedRef';\nimport { TableCustomSettingsRenderer, TableEmptyStateRenderer, TableProps } from '../types';\nimport { useTableManager } from '../useTableManager/useTableManager';\nimport { useTableStyle } from './features/useTableStyle';\nimport { useTableGlobalShortcuts } from './features/useTableGlobalShortcuts';\nimport { useTableRef } from './features/useTableRef';\nimport { useTableRenderer } from './features/useTableRenderer';\nimport { useTableRowActiveListener } from './listeners/useTableRowActiveListener';\nimport { TableRef } from '../types';\nimport { useTableRenderers } from './types';\nimport { renderer as rowActions } from './components/Columns/Internal/Actions';\nimport { renderer as rowDrag } from './components/Columns/Internal/Drag';\nimport { renderer as rowExpansion } from './components/Columns/Internal/Expansion';\nimport { renderer as rowSelection } from './components/Columns/Internal/Selection';\nimport { useTableManagerInternalColumns } from '../useTableManager/types';\n\nconst INTERNAL_RENDERERS = {\n rowActions,\n rowDrag,\n rowExpansion,\n rowSelection,\n};\n\nexport type useTableReturnValue<TType = unknown> = {\n id: string;\n instance: ReactTable<TType>;\n meta: ReactTableMeta<TType>;\n props: {\n customSettings: TableCustomSettingsRenderer | undefined;\n emptyState: TableEmptyStateRenderer | undefined;\n toolbarLeft: JSX.Element | undefined;\n toolbarPanel: JSX.Element | undefined;\n toolbarRight: JSX.Element | undefined;\n };\n ref: React.RefObject<TableRef>;\n renderer: {\n rows: JSX.Element[] | null;\n style: React.CSSProperties;\n scrollToIndex: (index: number, options?: ReactVirtualScrollToOptions) => void;\n };\n style: React.CSSProperties;\n stylesheet: string;\n state: ReactTableState;\n};\n\nexport function useTable<TType = unknown, TMeta = {}>(\n props: TableProps<TType>,\n externalRef: React.Ref<TableRef>,\n renderers: useTableRenderers<TType>,\n meta?: Partial<ReactTableMeta<TType>> & TMeta\n): useTableReturnValue<TType> {\n // create a ref and merge with the consumer's ref\n const ref = useMergedRef<TableRef>(externalRef);\n // configure the table\n const manager = useTableManager<TType>(props, meta, INTERNAL_RENDERERS as useTableManagerInternalColumns<TType>);\n // configure the virtualised renderer\n const renderer = useTableRenderer<TType>(renderers, manager.instance, ref, props.defaultRowActiveIndex);\n // configure dynamic styling\n const { style, stylesheet } = useTableStyle(manager.id, manager.instance);\n // configure global keyboard shortcuts\n useTableGlobalShortcuts(manager.instance, ref, renderer.scrollToIndex);\n // augment the ref with some helper functions\n useTableRef(manager.instance, ref);\n\n // listeners - they are here and not in useTableManager because they rely on the dom and the table ref\n useTableRowActiveListener(manager.instance, ref);\n\n return {\n ...manager,\n props: {\n customSettings: props.customSettings,\n emptyState: props.emptyState,\n toolbarLeft: props.toolbarLeft,\n toolbarPanel: props.toolbarPanel,\n toolbarRight: props.toolbarRight,\n },\n renderer,\n style,\n stylesheet,\n ref,\n };\n}\n"],"names":["INTERNAL_RENDERERS","rowActions","rowDrag","rowExpansion","rowSelection","useTable","props","externalRef","renderers","meta","ref","useMergedRef","manager","useTableManager","renderer","useTableRenderer","instance","defaultRowActiveIndex","style","stylesheet","useTableStyle","id","useTableGlobalShortcuts","scrollToIndex","useTableRef","useTableRowActiveListener","customSettings","emptyState","toolbarLeft","toolbarPanel","toolbarRight"],"mappings":";;;;;;;;;;;;AAkBA,MAAMA,kBAAkB,GAAG;cACvBC,QAAU;WACVC,UAAO;gBACPC,UAAY;gBACZC;CACH;SAwBeC,QAAQA,CACpBC,KAAwB,EACxBC,WAAgC,EAChCC,SAAmC,EACnCC,IAA6C;;EAG7C,MAAMC,GAAG,GAAGC,YAAY,CAAWJ,WAAW,CAAC;;EAE/C,MAAMK,OAAO,GAAGC,eAAe,CAAQP,KAAK,EAAEG,IAAI,EAAET,kBAA2D,CAAC;;EAEhH,MAAMc,QAAQ,GAAGC,gBAAgB,CAAQP,SAAS,EAAEI,OAAO,CAACI,QAAQ,EAAEN,GAAG,EAAEJ,KAAK,CAACW,qBAAqB,CAAC;;EAEvG,MAAM;IAAEC,KAAK;IAAEC;GAAY,GAAGC,aAAa,CAACR,OAAO,CAACS,EAAE,EAAET,OAAO,CAACI,QAAQ,CAAC;;EAEzEM,uBAAuB,CAACV,OAAO,CAACI,QAAQ,EAAEN,GAAG,EAAEI,QAAQ,CAACS,aAAa,CAAC;;EAEtEC,WAAW,CAACZ,OAAO,CAACI,QAAQ,EAAEN,GAAG,CAAC;;EAGlCe,yBAAyB,CAACb,OAAO,CAACI,QAAQ,EAAEN,GAAG,CAAC;EAEhD,OAAO;IACH,GAAGE,OAAO;IACVN,KAAK,EAAE;MACHoB,cAAc,EAAEpB,KAAK,CAACoB,cAAc;MACpCC,UAAU,EAAErB,KAAK,CAACqB,UAAU;MAC5BC,WAAW,EAAEtB,KAAK,CAACsB,WAAW;MAC9BC,YAAY,EAAEvB,KAAK,CAACuB,YAAY;MAChCC,YAAY,EAAExB,KAAK,CAACwB;KACvB;IACDhB,QAAQ;IACRI,KAAK;IACLC,UAAU;IACVT;GACH;AACL;;;;"}
1
+ {"version":3,"file":"useTable.js","sources":["../../../../../../../../src/primitives/Table/Core/useTable.ts"],"sourcesContent":["import { Table as ReactTable, TableMeta as ReactTableMeta, TableState as ReactTableState } from '@tanstack/react-table';\nimport { ScrollToOptions as ReactVirtualScrollToOptions } from '@tanstack/react-virtual';\nimport { useMergedRef } from '../../../hooks/useMergedRef';\nimport { TableCustomSettingsRenderer, TableEmptyStateRenderer, TableProps } from '../types';\nimport { useTableManager } from '../useTableManager/useTableManager';\nimport { useTableStyle } from './features/useTableStyle';\nimport { useTableGlobalShortcuts } from './features/useTableGlobalShortcuts';\nimport { useTableRef } from './features/useTableRef';\nimport { useTableRenderer } from './features/useTableRenderer';\nimport { useTableRowActiveListener } from './listeners/useTableRowActiveListener';\nimport { TableRef } from '../types';\nimport { useTableRenderers } from './types';\nimport { renderer as rowActions } from './components/Columns/Internal/Actions';\nimport { renderer as rowDrag } from './components/Columns/Internal/Drag';\nimport { renderer as rowExpansion } from './components/Columns/Internal/Expansion';\nimport { renderer as rowSelection } from './components/Columns/Internal/Selection';\nimport { useTableManagerInternalColumns } from '../useTableManager/types';\n\nconst INTERNAL_RENDERERS = {\n rowActions,\n rowDrag,\n rowExpansion,\n rowSelection,\n};\n\nexport type useTableReturnValue<TType = unknown> = {\n id: string;\n instance: ReactTable<TType>;\n meta: ReactTableMeta<TType>;\n props: {\n customSettings: TableCustomSettingsRenderer | undefined;\n emptyState: TableEmptyStateRenderer | undefined;\n toolbarLeft: JSX.Element | undefined;\n toolbarPanel: JSX.Element | undefined;\n toolbarRight: JSX.Element | undefined;\n };\n ref: React.RefObject<TableRef>;\n renderer: {\n rows: (JSX.Element | null)[] | null;\n style: React.CSSProperties;\n scrollToIndex: (index: number, options?: ReactVirtualScrollToOptions) => void;\n };\n style: React.CSSProperties;\n stylesheet: string;\n state: ReactTableState;\n};\n\nexport function useTable<TType = unknown, TMeta = {}>(\n props: TableProps<TType>,\n externalRef: React.Ref<TableRef>,\n renderers: useTableRenderers<TType>,\n meta?: Partial<ReactTableMeta<TType>> & TMeta\n): useTableReturnValue<TType> {\n // create a ref and merge with the consumer's ref\n const ref = useMergedRef<TableRef>(externalRef);\n // configure the table\n const manager = useTableManager<TType>(props, meta, INTERNAL_RENDERERS as useTableManagerInternalColumns<TType>);\n // configure the virtualised renderer\n const renderer = useTableRenderer<TType>(renderers, manager.instance, ref, props.defaultRowActiveIndex);\n // configure dynamic styling\n const { style, stylesheet } = useTableStyle(manager.id, manager.instance);\n // configure global keyboard shortcuts\n useTableGlobalShortcuts(manager.instance, ref, renderer.scrollToIndex);\n // augment the ref with some helper functions\n useTableRef(manager.instance, ref);\n\n // listeners - they are here and not in useTableManager because they rely on the dom and the table ref\n useTableRowActiveListener(manager.instance, ref);\n\n return {\n ...manager,\n props: {\n customSettings: props.customSettings,\n emptyState: props.emptyState,\n toolbarLeft: props.toolbarLeft,\n toolbarPanel: props.toolbarPanel,\n toolbarRight: props.toolbarRight,\n },\n renderer,\n style,\n stylesheet,\n ref,\n };\n}\n"],"names":["INTERNAL_RENDERERS","rowActions","rowDrag","rowExpansion","rowSelection","useTable","props","externalRef","renderers","meta","ref","useMergedRef","manager","useTableManager","renderer","useTableRenderer","instance","defaultRowActiveIndex","style","stylesheet","useTableStyle","id","useTableGlobalShortcuts","scrollToIndex","useTableRef","useTableRowActiveListener","customSettings","emptyState","toolbarLeft","toolbarPanel","toolbarRight"],"mappings":";;;;;;;;;;;;AAkBA,MAAMA,kBAAkB,GAAG;cACvBC,QAAU;WACVC,UAAO;gBACPC,UAAY;gBACZC;CACH;SAwBeC,QAAQA,CACpBC,KAAwB,EACxBC,WAAgC,EAChCC,SAAmC,EACnCC,IAA6C;;EAG7C,MAAMC,GAAG,GAAGC,YAAY,CAAWJ,WAAW,CAAC;;EAE/C,MAAMK,OAAO,GAAGC,eAAe,CAAQP,KAAK,EAAEG,IAAI,EAAET,kBAA2D,CAAC;;EAEhH,MAAMc,QAAQ,GAAGC,gBAAgB,CAAQP,SAAS,EAAEI,OAAO,CAACI,QAAQ,EAAEN,GAAG,EAAEJ,KAAK,CAACW,qBAAqB,CAAC;;EAEvG,MAAM;IAAEC,KAAK;IAAEC;GAAY,GAAGC,aAAa,CAACR,OAAO,CAACS,EAAE,EAAET,OAAO,CAACI,QAAQ,CAAC;;EAEzEM,uBAAuB,CAACV,OAAO,CAACI,QAAQ,EAAEN,GAAG,EAAEI,QAAQ,CAACS,aAAa,CAAC;;EAEtEC,WAAW,CAACZ,OAAO,CAACI,QAAQ,EAAEN,GAAG,CAAC;;EAGlCe,yBAAyB,CAACb,OAAO,CAACI,QAAQ,EAAEN,GAAG,CAAC;EAEhD,OAAO;IACH,GAAGE,OAAO;IACVN,KAAK,EAAE;MACHoB,cAAc,EAAEpB,KAAK,CAACoB,cAAc;MACpCC,UAAU,EAAErB,KAAK,CAACqB,UAAU;MAC5BC,WAAW,EAAEtB,KAAK,CAACsB,WAAW;MAC9BC,YAAY,EAAEvB,KAAK,CAACuB,YAAY;MAChCC,YAAY,EAAExB,KAAK,CAACwB;KACvB;IACDhB,QAAQ;IACRI,KAAK;IACLC,UAAU;IACVT;GACH;AACL;;;;"}
@@ -14,7 +14,7 @@ const format = (date, mask = 'dd.mm.yy') => {
14
14
  const pad = v => String(v).length === 1 ? `0${v}` : v.toString();
15
15
  return mask.replace('dd', pad(value.getDate())).replace('mm', pad(value.getMonth() + 1)).replace('yy', String(value.getFullYear()).slice(2));
16
16
  };
17
- const parseFromCustomString = (date = '', mask = 'dd.mm.yy') => {
17
+ const parseFromCustomString = (date = '', mask = 'dd.mm.yy', defaultYear = undefined) => {
18
18
  if (!date || !date.length) {
19
19
  return undefined;
20
20
  }
@@ -48,7 +48,7 @@ const parseFromCustomString = (date = '', mask = 'dd.mm.yy') => {
48
48
  month = Number.parseInt(month, 10);
49
49
  year = Number.parseInt(year, 10);
50
50
  const currentDate = new Date();
51
- return new Date( /* year */Object.is(year, NaN) ? currentDate.getFullYear() : year, /* month */Object.is(month, NaN) ? currentDate.getMonth() : month - 1,
51
+ return new Date( /* year */Object.is(year, NaN) ? defaultYear !== null && defaultYear !== void 0 ? defaultYear : currentDate.getFullYear() : year, /* month */Object.is(month, NaN) ? currentDate.getMonth() : month - 1,
52
52
  // months are zero based in javascript, so subtract a day
53
53
  /* day */
54
54
  Object.is(day, NaN) ? currentDate.getDate() : day, /* hours */12, /* minutes */0 // set to midday to avoid UTC offset causing dates to be mismatched server side
@@ -1 +1 @@
1
- {"version":3,"file":"date.js","sources":["../../../../../../src/utils/date.ts"],"sourcesContent":["import { isDate, toDate, isValid } from 'date-fns';\n\nexport const isWeakEqual = (leftDate: Date, rightDate: Date) => {\n return (\n leftDate.getFullYear() === rightDate.getFullYear() &&\n leftDate.getMonth() === rightDate.getMonth() &&\n leftDate.getDay() === rightDate.getDay()\n );\n};\n\nexport const format = (date: Date | undefined, mask = 'dd.mm.yy'): string | undefined => {\n if (!date) {\n return undefined;\n }\n\n const value = isDate(date) ? date : toDate(date);\n\n if (!isValid(value)) {\n return undefined;\n }\n\n const pad = (v: number): string => (String(v).length === 1 ? `0${v}` : v.toString());\n\n return mask\n .replace('dd', pad(value.getDate()))\n .replace('mm', pad(value.getMonth() + 1))\n .replace('yy', String(value.getFullYear()).slice(2));\n};\n\nexport const parseFromCustomString = (date = '', mask = 'dd.mm.yy'): Date | undefined => {\n if (!date || !date.length) {\n return undefined;\n }\n\n const sanitizedMask = mask.split(/[^dmy]/);\n const dd = sanitizedMask.findIndex(x => x === 'dd');\n const mm = sanitizedMask.findIndex(x => x === 'mm');\n const yy = sanitizedMask.findIndex(x => x === 'yy' || x === 'yyyy');\n\n let day;\n let month;\n let year;\n\n const getFullYear = (y: string): string => {\n if (y && y.length === 2) {\n const z = Number.parseInt(y, 10);\n\n return z > 50 ? `19${y}` : `20${y}`;\n }\n\n return y;\n };\n\n const inputParts = date.split(/\\D/);\n\n if (inputParts.length === 1) {\n const fullDate = inputParts[0];\n const unseparatedMask = mask.replace(/[^dmy]/g, '');\n\n day = fullDate.slice(unseparatedMask.indexOf('d'), unseparatedMask.lastIndexOf('d') + 1);\n month = fullDate.slice(unseparatedMask.indexOf('m'), unseparatedMask.lastIndexOf('m') + 1);\n year = getFullYear(fullDate.slice(unseparatedMask.indexOf('y'), unseparatedMask.lastIndexOf('y') + 3)); // account for full years\n } else {\n day = inputParts[dd];\n month = inputParts[mm];\n year = getFullYear(inputParts[yy]);\n }\n\n day = Number.parseInt(day, 10);\n month = Number.parseInt(month, 10);\n year = Number.parseInt(year, 10);\n\n const currentDate = new Date();\n\n return new Date(\n /* year */ Object.is(year, NaN) ? currentDate.getFullYear() : year,\n /* month */ Object.is(month, NaN) ? currentDate.getMonth() : month - 1, // months are zero based in javascript, so subtract a day\n /* day */ Object.is(day, NaN) ? currentDate.getDate() : day,\n /* hours */ 12,\n /* minutes */ 0 // set to midday to avoid UTC offset causing dates to be mismatched server side\n );\n};\n\nexport const parseFromISOString = (date: string): Date | undefined => {\n const tempDate = new Date(date);\n return isValid(tempDate) ? parseFromCustomString(format(new Date(date))) : undefined;\n};\n"],"names":["isWeakEqual","leftDate","rightDate","getFullYear","getMonth","getDay","format","date","mask","undefined","value","isDate","toDate","isValid","pad","v","String","length","toString","replace","getDate","slice","parseFromCustomString","sanitizedMask","split","dd","findIndex","x","mm","yy","day","month","year","y","z","Number","parseInt","inputParts","fullDate","unseparatedMask","indexOf","lastIndexOf","currentDate","Date","Object","is","NaN","parseFromISOString","tempDate"],"mappings":";;MAEaA,WAAW,GAAGA,CAACC,QAAc,EAAEC,SAAe;EACvD,OACID,QAAQ,CAACE,WAAW,EAAE,KAAKD,SAAS,CAACC,WAAW,EAAE,IAClDF,QAAQ,CAACG,QAAQ,EAAE,KAAKF,SAAS,CAACE,QAAQ,EAAE,IAC5CH,QAAQ,CAACI,MAAM,EAAE,KAAKH,SAAS,CAACG,MAAM,EAAE;AAEhD;MAEaC,MAAM,GAAGA,CAACC,IAAsB,EAAEC,IAAI,GAAG,UAA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,MAAM,CAACC,QAAQ,CAACL,KAAK,EAAE,EAAE,CAAC;EAClCC,IAAI,GAAGG,MAAM,CAACC,QAAQ,CAACJ,IAAI,EAAE,EAAE,CAAC;EAEhC,MAAMU,WAAW,GAAG,IAAIC,IAAI,EAAE;EAE9B,OAAO,IAAIA,IAAI,YACAC,MAAM,CAACC,EAAE,CAACb,IAAI,EAAEc,GAAG,CAAC,GAAGJ,WAAW,CAACvC,WAAW,EAAE,GAAG6B,IAAI,aACtDY,MAAM,CAACC,EAAE,CAACd,KAAK,EAAEe,GAAG,CAAC,GAAGJ,WAAW,CAACtC,QAAQ,EAAE,GAAG2B,KAAK,GAAG,CAAC;;;EAC5Da,MAAM,CAACC,EAAE,CAACf,GAAG,EAAEgB,GAAG,CAAC,GAAGJ,WAAW,CAACtB,OAAO,EAAE,GAAGU,GAAG,aAC/C,EAAE,eACA,CAAC;GAClB;AACL;MAEaiB,kBAAkB,GAAIxC,IAAY;EAC3C,MAAMyC,QAAQ,GAAG,IAAIL,IAAI,CAACpC,IAAI,CAAC;EAC/B,OAAOM,OAAO,CAACmC,QAAQ,CAAC,GAAG1B,qBAAqB,CAAChB,MAAM,CAAC,IAAIqC,IAAI,CAACpC,IAAI,CAAC,CAAC,CAAC,GAAGE,SAAS;AACxF;;;;"}
1
+ {"version":3,"file":"date.js","sources":["../../../../../../src/utils/date.ts"],"sourcesContent":["import { isDate, toDate, isValid } from 'date-fns';\n\nexport const isWeakEqual = (leftDate: Date, rightDate: Date) => {\n return (\n leftDate.getFullYear() === rightDate.getFullYear() &&\n leftDate.getMonth() === rightDate.getMonth() &&\n leftDate.getDay() === rightDate.getDay()\n );\n};\n\nexport const format = (date: Date | undefined, mask = 'dd.mm.yy'): string | undefined => {\n if (!date) {\n return undefined;\n }\n\n const value = isDate(date) ? date : toDate(date);\n\n if (!isValid(value)) {\n return undefined;\n }\n\n const pad = (v: number): string => (String(v).length === 1 ? `0${v}` : v.toString());\n\n return mask\n .replace('dd', pad(value.getDate()))\n .replace('mm', pad(value.getMonth() + 1))\n .replace('yy', String(value.getFullYear()).slice(2));\n};\n\nexport const parseFromCustomString = (\n date = '',\n mask = 'dd.mm.yy',\n defaultYear: number | undefined = undefined\n): Date | undefined => {\n if (!date || !date.length) {\n return undefined;\n }\n\n const sanitizedMask = mask.split(/[^dmy]/);\n const dd = sanitizedMask.findIndex(x => x === 'dd');\n const mm = sanitizedMask.findIndex(x => x === 'mm');\n const yy = sanitizedMask.findIndex(x => x === 'yy' || x === 'yyyy');\n\n let day;\n let month;\n let year;\n\n const getFullYear = (y: string): string => {\n if (y && y.length === 2) {\n const z = Number.parseInt(y, 10);\n\n return z > 50 ? `19${y}` : `20${y}`;\n }\n\n return y;\n };\n\n const inputParts = date.split(/\\D/);\n\n if (inputParts.length === 1) {\n const fullDate = inputParts[0];\n const unseparatedMask = mask.replace(/[^dmy]/g, '');\n\n day = fullDate.slice(unseparatedMask.indexOf('d'), unseparatedMask.lastIndexOf('d') + 1);\n month = fullDate.slice(unseparatedMask.indexOf('m'), unseparatedMask.lastIndexOf('m') + 1);\n year = getFullYear(fullDate.slice(unseparatedMask.indexOf('y'), unseparatedMask.lastIndexOf('y') + 3)); // account for full years\n } else {\n day = inputParts[dd];\n month = inputParts[mm];\n year = getFullYear(inputParts[yy]);\n }\n\n day = Number.parseInt(day, 10);\n month = Number.parseInt(month, 10);\n year = Number.parseInt(year, 10);\n\n const currentDate = new Date();\n\n return new Date(\n /* year */ Object.is(year, NaN) ? defaultYear ?? currentDate.getFullYear() : year,\n /* month */ Object.is(month, NaN) ? currentDate.getMonth() : month - 1, // months are zero based in javascript, so subtract a day\n /* day */ Object.is(day, NaN) ? currentDate.getDate() : day,\n /* hours */ 12,\n /* minutes */ 0 // set to midday to avoid UTC offset causing dates to be mismatched server side\n );\n};\n\nexport const parseFromISOString = (date: string): Date | undefined => {\n const tempDate = new Date(date);\n return isValid(tempDate) ? parseFromCustomString(format(new Date(date))) : undefined;\n};\n"],"names":["isWeakEqual","leftDate","rightDate","getFullYear","getMonth","getDay","format","date","mask","undefined","value","isDate","toDate","isValid","pad","v","String","length","toString","replace","getDate","slice","parseFromCustomString","defaultYear","sanitizedMask","split","dd","findIndex","x","mm","yy","day","month","year","y","z","Number","parseInt","inputParts","fullDate","unseparatedMask","indexOf","lastIndexOf","currentDate","Date","Object","is","NaN","parseFromISOString","tempDate"],"mappings":";;MAEaA,WAAW,GAAGA,CAACC,QAAc,EAAEC,SAAe;EACvD,OACID,QAAQ,CAACE,WAAW,EAAE,KAAKD,SAAS,CAACC,WAAW,EAAE,IAClDF,QAAQ,CAACG,QAAQ,EAAE,KAAKF,SAAS,CAACE,QAAQ,EAAE,IAC5CH,QAAQ,CAACI,MAAM,EAAE,KAAKH,SAAS,CAACG,MAAM,EAAE;AAEhD;MAEaC,MAAM,GAAGA,CAACC,IAAsB,EAAEC,IAAI,GAAG,UAAU;EAC5D,IAAI,CAACD,IAAI,EAAE;IACP,OAAOE,SAAS;;EAGpB,MAAMC,KAAK,GAAGC,MAAM,CAACJ,IAAI,CAAC,GAAGA,IAAI,GAAGK,MAAM,CAACL,IAAI,CAAC;EAEhD,IAAI,CAACM,OAAO,CAACH,KAAK,CAAC,EAAE;IACjB,OAAOD,SAAS;;EAGpB,MAAMK,GAAG,GAAIC,CAAS,IAAcC,MAAM,CAACD,CAAC,CAAC,CAACE,MAAM,KAAK,CAAC,OAAOF,GAAG,GAAGA,CAAC,CAACG,QAAQ,EAAG;EAEpF,OAAOV,IAAI,CACNW,OAAO,CAAC,IAAI,EAAEL,GAAG,CAACJ,KAAK,CAACU,OAAO,EAAE,CAAC,CAAC,CACnCD,OAAO,CAAC,IAAI,EAAEL,GAAG,CAACJ,KAAK,CAACN,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAC,CACxCe,OAAO,CAAC,IAAI,EAAEH,MAAM,CAACN,KAAK,CAACP,WAAW,EAAE,CAAC,CAACkB,KAAK,CAAC,CAAC,CAAC,CAAC;AAC5D;MAEaC,qBAAqB,G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L,IAAI,CAACrC,IAAI,CAAC;EAC/B,OAAOM,OAAO,CAACoC,QAAQ,CAAC,GAAG3B,qBAAqB,CAAChB,MAAM,CAAC,IAAIsC,IAAI,CAACrC,IAAI,CAAC,CAAC,CAAC,GAAGE,SAAS;AACxF;;;;"}
@@ -1,6 +1,15 @@
1
1
  /// <reference types="react" />
2
- import { Header as ReactTableHeader } from '@tanstack/react-table';
3
- export declare function Footer<TType = unknown>(header: ReactTableHeader<TType, unknown>): JSX.Element;
2
+ import { Header as ReactTableHeader, Table as ReactTable } from '@tanstack/react-table';
3
+ export declare type FootProps<TType = unknown> = {
4
+ table: ReactTable<TType>;
5
+ };
6
+ export declare function Foot<TType = unknown>(props: FootProps<TType>): JSX.Element;
7
+ export declare type FooterProps<TType = unknown> = {
8
+ header: ReactTableHeader<TType, unknown>;
9
+ index: number;
10
+ };
11
+ export declare function Footer<TType = unknown>(props: FooterProps<TType>): JSX.Element;
4
12
  export declare type MemoedFooterProps<TType = unknown> = {
5
13
  footer: ReactTableHeader<TType, unknown>;
14
+ index: number;
6
15
  };
@@ -6,7 +6,7 @@ export declare type FilterColumnProps<TType = unknown> = Omit<Select2Props, 'chi
6
6
  allColumns: ReactTableColumn<TType, unknown>[];
7
7
  filters: TableFilter[];
8
8
  };
9
- export declare const FilterColumn: React.ForwardRefExoticComponent<Pick<Select2Props, "defaultValue" | "onChange" | "value" | "defaultChecked" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "nonce" | "placeholder" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "autoFocus" | "emptyValue" | "disabled" | "highlighted" | "invalid" | "multiple" | "name" | "onCreate" | "onDelete" | "onEdit" | "readOnly" | "required" | "tags" | "fontSize"> & {
9
+ export declare const FilterColumn: React.ForwardRefExoticComponent<Pick<Select2Props, "defaultValue" | "onChange" | "value" | "defaultChecked" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "nonce" | "placeholder" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "autoFocus" | "emptyValue" | "disabled" | "highlighted" | "invalid" | "loading" | "multiple" | "name" | "onCreate" | "onDelete" | "onEdit" | "readOnly" | "required" | "tags" | "fontSize"> & {
10
10
  allColumns: ReactTableColumn<unknown, unknown>[];
11
11
  filters: TableFilter[];
12
12
  } & React.RefAttributes<HTMLButtonElement>>;
@@ -4,7 +4,7 @@ import { ScrollToOptions as ReactVirtualScrollToOptions } from '@tanstack/react-
4
4
  import { useTableRenderers } from '../types';
5
5
  import { TableRef } from '../../types';
6
6
  export declare function useTableRenderer<TType = unknown>(renderers: useTableRenderers<TType>, table: ReactTable<TType>, tableRef: React.RefObject<TableRef>, defaultRowActiveIndex?: number | undefined): {
7
- rows: JSX.Element[] | null;
7
+ rows: (JSX.Element | null)[] | null;
8
8
  style: React.CSSProperties;
9
9
  scrollToIndex: (index: number, options?: ReactVirtualScrollToOptions) => void;
10
10
  };