@economic/taco 2.22.2 → 2.24.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (150) hide show
  1. package/dist/components/Card/Card.d.ts +1 -0
  2. package/dist/components/Checkbox/Checkbox.d.ts +2 -0
  3. package/dist/components/OverflowGroup/OverflowGroup.d.ts +1 -1
  4. package/dist/components/Provider/Localization.d.ts +4 -0
  5. package/dist/components/Report/Report.d.ts +2 -0
  6. package/dist/components/Report/components/Body/Body.d.ts +0 -1
  7. package/dist/components/Report/components/Body/EmptyStateBody.d.ts +7 -0
  8. package/dist/components/Report/components/Cell/util.d.ts +1 -1
  9. package/dist/components/Report/components/Footer/Summary.d.ts +0 -1
  10. package/dist/components/Report/components/Toolbar/components/Filters/components/Filter.d.ts +2 -2
  11. package/dist/components/Report/components/Toolbar/components/Filters/components/FilterColumn.d.ts +5 -2
  12. package/dist/components/Report/types.d.ts +2 -0
  13. package/dist/components/Report/useReport.d.ts +1 -1
  14. package/dist/components/Select2/Select2.d.ts +4 -0
  15. package/dist/components/Select2/components/Trigger.d.ts +1 -0
  16. package/dist/components/Select2/hooks/useChildren.d.ts +1 -0
  17. package/dist/components/Table3/components/toolbar/Filter/filters/components/Filter.d.ts +2 -2
  18. package/dist/components/Table3/components/toolbar/Filter/filters/components/FilterColumn.d.ts +5 -2
  19. package/dist/components/Truncate/Truncate.d.ts +2 -2
  20. package/dist/esm/index.css +128 -121
  21. package/dist/esm/packages/taco/src/components/Button/util.js +8 -8
  22. package/dist/esm/packages/taco/src/components/Button/util.js.map +1 -1
  23. package/dist/esm/packages/taco/src/components/Card/Card.js +8 -4
  24. package/dist/esm/packages/taco/src/components/Card/Card.js.map +1 -1
  25. package/dist/esm/packages/taco/src/components/Checkbox/Checkbox.js +11 -2
  26. package/dist/esm/packages/taco/src/components/Checkbox/Checkbox.js.map +1 -1
  27. package/dist/esm/packages/taco/src/components/Field/Field.js +4 -15
  28. package/dist/esm/packages/taco/src/components/Field/Field.js.map +1 -1
  29. package/dist/esm/packages/taco/src/components/Header/components/PrimaryNavigation.js +2 -2
  30. package/dist/esm/packages/taco/src/components/Header/components/PrimaryNavigation.js.map +1 -1
  31. package/dist/esm/packages/taco/src/components/Listbox/ScrollableList.js +1 -1
  32. package/dist/esm/packages/taco/src/components/OverflowGroup/OverflowGroup.js +13 -6
  33. package/dist/esm/packages/taco/src/components/OverflowGroup/OverflowGroup.js.map +1 -1
  34. package/dist/esm/packages/taco/src/components/Provider/Localization.js +5 -1
  35. package/dist/esm/packages/taco/src/components/Provider/Localization.js.map +1 -1
  36. package/dist/esm/packages/taco/src/components/Report/Report.js +11 -13
  37. package/dist/esm/packages/taco/src/components/Report/Report.js.map +1 -1
  38. package/dist/esm/packages/taco/src/components/Report/components/Body/Body.js +1 -2
  39. package/dist/esm/packages/taco/src/components/Report/components/Body/Body.js.map +1 -1
  40. package/dist/esm/packages/taco/src/components/Report/components/Body/EmptyStateBody.js +18 -0
  41. package/dist/esm/packages/taco/src/components/Report/components/Body/EmptyStateBody.js.map +1 -0
  42. package/dist/esm/packages/taco/src/components/Report/components/Cell/util.js +6 -2
  43. package/dist/esm/packages/taco/src/components/Report/components/Cell/util.js.map +1 -1
  44. package/dist/esm/packages/taco/src/components/Report/components/Footer/Footer.js +14 -2
  45. package/dist/esm/packages/taco/src/components/Report/components/Footer/Footer.js.map +1 -1
  46. package/dist/esm/packages/taco/src/components/Report/components/Footer/Summary.js +2 -2
  47. package/dist/esm/packages/taco/src/components/Report/components/Footer/Summary.js.map +1 -1
  48. package/dist/esm/packages/taco/src/components/Report/components/Internal/Selection.js +47 -11
  49. package/dist/esm/packages/taco/src/components/Report/components/Internal/Selection.js.map +1 -1
  50. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/ManageFiltersPopover.js +28 -43
  51. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/ManageFiltersPopover.js.map +1 -1
  52. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/components/Filter.js +14 -7
  53. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/components/Filter.js.map +1 -1
  54. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/components/FilterColumn.js +4 -3
  55. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/components/FilterColumn.js.map +1 -1
  56. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Print/Print.js +10 -8
  57. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Print/Print.js.map +1 -1
  58. package/dist/esm/packages/taco/src/components/Report/listeners/useTableRowActiveListener.js +2 -2
  59. package/dist/esm/packages/taco/src/components/Report/listeners/useTableRowActiveListener.js.map +1 -1
  60. package/dist/esm/packages/taco/src/components/Report/styles/useCssGridStylesheet.js +10 -6
  61. package/dist/esm/packages/taco/src/components/Report/styles/useCssGridStylesheet.js.map +1 -1
  62. package/dist/esm/packages/taco/src/components/Report/util/useTableGlobalShortcuts.js +3 -10
  63. package/dist/esm/packages/taco/src/components/Report/util/useTableGlobalShortcuts.js.map +1 -1
  64. package/dist/esm/packages/taco/src/components/SearchInput2/SearchInput2.js +2 -1
  65. package/dist/esm/packages/taco/src/components/SearchInput2/SearchInput2.js.map +1 -1
  66. package/dist/esm/packages/taco/src/components/Select2/Select2.js +44 -4
  67. package/dist/esm/packages/taco/src/components/Select2/Select2.js.map +1 -1
  68. package/dist/esm/packages/taco/src/components/Select2/components/Trigger.js +9 -4
  69. package/dist/esm/packages/taco/src/components/Select2/components/Trigger.js.map +1 -1
  70. package/dist/esm/packages/taco/src/components/Select2/hooks/useChildren.js +1 -1
  71. package/dist/esm/packages/taco/src/components/Select2/hooks/useChildren.js.map +1 -1
  72. package/dist/esm/packages/taco/src/components/Table3/Table3.js +4 -6
  73. package/dist/esm/packages/taco/src/components/Table3/Table3.js.map +1 -1
  74. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingCell.js +2 -2
  75. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingCell.js.map +1 -1
  76. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Selection.js +66 -14
  77. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Selection.js.map +1 -1
  78. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/Filters.js +27 -44
  79. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/Filters.js.map +1 -1
  80. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/Filter.js +14 -7
  81. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/Filter.js.map +1 -1
  82. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/FilterColumn.js +4 -3
  83. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/FilterColumn.js.map +1 -1
  84. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/FilterComparator.js +1 -1
  85. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/FilterComparator.js.map +1 -1
  86. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintButton.js +2 -0
  87. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintButton.js.map +1 -1
  88. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintIFrame.js +2 -1
  89. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintIFrame.js.map +1 -1
  90. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useSettings.js +1 -1
  91. package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useSettingsStateListener.js +3 -1
  92. package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useSettingsStateListener.js.map +1 -1
  93. package/dist/esm/packages/taco/src/components/Table3/hooks/useTable.js +10 -3
  94. package/dist/esm/packages/taco/src/components/Table3/hooks/useTable.js.map +1 -1
  95. package/dist/esm/packages/taco/src/components/Toast/Toaster.js +4 -3
  96. package/dist/esm/packages/taco/src/components/Toast/Toaster.js.map +1 -1
  97. package/dist/esm/packages/taco/src/components/Truncate/Truncate.js +34 -0
  98. package/dist/esm/packages/taco/src/components/Truncate/Truncate.js.map +1 -0
  99. package/dist/esm/packages/taco/src/hooks/useLocalStorage.js.map +1 -1
  100. package/dist/esm/packages/taco/src/index.js +2 -1
  101. package/dist/esm/packages/taco/src/index.js.map +1 -1
  102. package/dist/esm/packages/taco/src/primitives/Button.js +1 -0
  103. package/dist/esm/packages/taco/src/primitives/Button.js.map +1 -1
  104. package/dist/esm/packages/taco/src/primitives/Table/types.js.map +1 -1
  105. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTablePrinting.js +24 -4
  106. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTablePrinting.js.map +1 -1
  107. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableSettings.js +48 -7
  108. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableSettings.js.map +1 -1
  109. package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableSettingsListener.js +1 -1
  110. package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableSettingsListener.js.map +1 -1
  111. package/dist/esm/packages/taco/src/primitives/Table/useTable/useTable.js +11 -6
  112. package/dist/esm/packages/taco/src/primitives/Table/useTable/useTable.js.map +1 -1
  113. package/dist/esm/packages/taco/src/primitives/Table/useTable/util/columns.js +33 -7
  114. package/dist/esm/packages/taco/src/primitives/Table/useTable/util/columns.js.map +1 -1
  115. package/dist/esm/packages/taco/src/primitives/Table/useTable/util/presets.js +5 -5
  116. package/dist/esm/packages/taco/src/primitives/Table/useTable/util/presets.js.map +1 -1
  117. package/dist/esm/packages/taco/src/primitives/Table/useTable/util/search.js +14 -1
  118. package/dist/esm/packages/taco/src/primitives/Table/useTable/util/search.js.map +1 -1
  119. package/dist/esm/packages/taco/src/primitives/Table/useTable/util/settings.js +0 -1
  120. package/dist/esm/packages/taco/src/primitives/Table/useTable/util/settings.js.map +1 -1
  121. package/dist/esm/packages/taco/src/primitives/Table/useTableDataLoader.js +127 -3
  122. package/dist/esm/packages/taco/src/primitives/Table/useTableDataLoader.js.map +1 -1
  123. package/dist/esm/packages/taco/src/utils/dom.js +12 -3
  124. package/dist/esm/packages/taco/src/utils/dom.js.map +1 -1
  125. package/dist/esm/packages/taco/src/utils/hooks/useTruncated.js +4 -4
  126. package/dist/esm/packages/taco/src/utils/hooks/useTruncated.js.map +1 -1
  127. package/dist/esm/packages/taco/src/utils/keyboard.js +2 -2
  128. package/dist/esm/packages/taco/src/utils/keyboard.js.map +1 -1
  129. package/dist/hooks/useLocalStorage.d.ts +2 -1
  130. package/dist/index.css +128 -121
  131. package/dist/index.d.ts +1 -0
  132. package/dist/primitives/Table/types.d.ts +12 -2
  133. package/dist/primitives/Table/useTable/features/useTablePrinting.d.ts +10 -3
  134. package/dist/primitives/Table/useTable/features/useTableSettings.d.ts +2 -2
  135. package/dist/primitives/Table/useTable/useTable.d.ts +2 -1
  136. package/dist/primitives/Table/useTable/util/settings.d.ts +0 -1
  137. package/dist/taco.cjs.development.js +814 -455
  138. package/dist/taco.cjs.development.js.map +1 -1
  139. package/dist/taco.cjs.production.min.js +1 -1
  140. package/dist/taco.cjs.production.min.js.map +1 -1
  141. package/dist/utils/dom.d.ts +3 -1
  142. package/dist/utils/hooks/useTruncated.d.ts +1 -1
  143. package/package.json +2 -2
  144. package/types.json +9339 -9261
  145. package/dist/components/Report/components/Toolbar/components/Filters/components/Placeholder.d.ts +0 -12
  146. package/dist/components/Table3/components/toolbar/Filter/filters/components/Placeholder.d.ts +0 -12
  147. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/components/Placeholder.js +0 -41
  148. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/components/Placeholder.js.map +0 -1
  149. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/Placeholder.js +0 -41
  150. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/Placeholder.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"Report.js","sources":["../../../../../../../src/components/Report/Report.tsx"],"sourcesContent":["import React from 'react';\nimport { FocusScope } from '@react-aria/focus';\nimport { fixedForwardRef } from '../../types';\nimport { useMergedRef } from '../../hooks/useMergedRef';\nimport { useReport } from './useReport';\nimport { ReportColumnProps, ReportGroupProps, ReportProps } from './types';\nimport { Header } from './components/Header/Header';\nimport { Body } from './components/Body/Body';\nimport { Footer } from './components/Footer/Footer';\nimport { Summary } from './components/Footer/Summary';\nimport { Toolbar } from './components/Toolbar/Toolbar';\nimport { TableRef } from '../../primitives/Table/types';\nimport { useStylesheet } from './styles/useStylesheet';\nimport { useTableRenderer } from './util/useTableRenderer';\nimport { useTableGlobalShortcuts } from './util/useTableGlobalShortcuts';\nimport './style.css';\n\nfunction Column<TType = unknown>(_: ReportColumnProps<TType>) {\n return null;\n}\n\nfunction Group(_: ReportGroupProps) {\n return null;\n}\n\nexport const Report = fixedForwardRef<TableRef, ReportProps>(function Report<TType = unknown>(\n props: ReportProps<TType>,\n ref: React.Ref<TableRef>\n) {\n const tableRef = useMergedRef<TableRef>(ref);\n const report = useReport<TType>(props, tableRef);\n const renderer = useTableRenderer(report.instance, tableRef, props.defaultRowActiveIndex);\n const stylesheet = useStylesheet(props.id, report.instance);\n useTableGlobalShortcuts(report.instance, tableRef, renderer.scrollToIndex);\n\n const handleFocus =\n report.meta.rowActive.rowActiveIndex === undefined\n ? (event: React.FocusEvent) => {\n report.meta.rowActive.handleFocus(event, report.length, renderer.scrollToIndex);\n }\n : undefined;\n\n return (\n <>\n {stylesheet}\n <Toolbar\n customSettings={props.customSettings}\n left={props.toolbarLeft}\n length={report.length}\n right={props.toolbarRight}\n scrollToIndex={renderer.scrollToIndex}\n table={report.instance}\n tableId={props.id}\n tableRef={tableRef}\n />\n {props.toolbarPanel ? <div className=\"mb-4\">{props.toolbarPanel}</div> : undefined}\n <FocusScope>\n <table\n id={props.id}\n data-taco=\"report\"\n data-table-font-size={report.meta.fontSize.size}\n data-table-horizontally-scrolled={report.meta.columnFreezing.isHorizontallyScrolled ? true : undefined}\n data-table-pause-hover={report.meta.rowActive.isHoverStatePaused ? true : undefined}\n data-table-resizing={report.state.columnSizingInfo.isResizingColumn ? true : undefined}\n data-table-row-height={report.meta.rowHeight.height}\n data-table-grouped={!!report.state.grouping?.length}\n onFocus={handleFocus}\n onScroll={report.meta.columnFreezing.handleScroll}\n ref={tableRef}\n tabIndex={-1}>\n <thead>\n {report.instance.getHeaderGroups().map(headerGroup => (\n <tr key={headerGroup.id}>{headerGroup.headers.map(Header)}</tr>\n ))}\n </thead>\n <Body length={report.length} table={report.instance} style={renderer.style}>\n {renderer.rows}\n </Body>\n {report.meta.footer.isEnabled ? (\n <tfoot>\n <tr>{report.instance.getFooterGroups()[0].headers.map(Footer)}</tr>\n </tfoot>\n ) : null}\n </table>\n {report.meta.footer.isEnabled ? <Summary length={report.length} table={report.instance} /> : null}\n </FocusScope>\n </>\n );\n}) as (<TType = unknown>(props: ReportProps<TType> & React.RefAttributes<TableRef>) => JSX.Element) & {\n Column: typeof Column;\n Group: typeof Group;\n};\nReport.Column = Column;\nReport.Group = Group;\n\nexport * from './types';\n"],"names":["Column","_","Group","Report","fixedForwardRef","props","ref","tableRef","useMergedRef","report","useReport","renderer","useTableRenderer","instance","defaultRowActiveIndex","stylesheet","useStylesheet","id","useTableGlobalShortcuts","scrollToIndex","handleFocus","meta","rowActive","rowActiveIndex","undefined","event","length","React","Toolbar","customSettings","left","toolbarLeft","right","toolbarRight","table","tableId","toolbarPanel","className","FocusScope","fontSize","size","columnFreezing","isHorizontallyScrolled","isHoverStatePaused","state","columnSizingInfo","isResizingColumn","rowHeight","height","_report$state$groupin","grouping","onFocus","onScroll","handleScroll","tabIndex","getHeaderGroups","map","headerGroup","key","headers","Header","Body","style","rows","footer","isEnabled","getFooterGroups","Footer","Summary"],"mappings":";;;;;;;;;;;;;;AAiBA,SAASA,MAAMA,CAAkBC,CAA2B;EACxD,OAAO,IAA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C,CAACP,OAAO,CAACH,GAAG,CAACW,MAAM,CAAC,CAAM,CAC/D,IACR,IAAI,CACJ,EACP1D,MAAM,CAACY,IAAI,CAAC2C,MAAM,CAACC,SAAS,gBAAGtC,6BAACyC,OAAO;IAAC1C,MAAM,EAAEjB,MAAM,CAACiB,MAAM;IAAEQ,KAAK,EAAEzB,MAAM,CAACI;IAAY,GAAG,IAAI,CACxF,CACd;AAEX,CAAC;AAIDV,MAAM,CAACH,MAAM,GAAGA,MAAM;AACtBG,MAAM,CAACD,KAAK,GAAGA,KAAK;;;;"}
1
+ {"version":3,"file":"Report.js","sources":["../../../../../../../src/components/Report/Report.tsx"],"sourcesContent":["import React from 'react';\nimport { FocusScope } from '@react-aria/focus';\nimport { fixedForwardRef } from '../../types';\nimport { useMergedRef } from '../../hooks/useMergedRef';\nimport { useReport } from './useReport';\nimport { ReportColumnProps, ReportGroupProps, ReportProps } from './types';\nimport { Header } from './components/Header/Header';\nimport { Body } from './components/Body/Body';\nimport { Footer } from './components/Footer/Footer';\nimport { Toolbar } from './components/Toolbar/Toolbar';\nimport { TableRef } from '../../primitives/Table/types';\nimport { useStylesheet } from './styles/useStylesheet';\nimport { useTableRenderer } from './util/useTableRenderer';\nimport { useTableGlobalShortcuts } from './util/useTableGlobalShortcuts';\nimport { EmptyStateBody } from './components/Body/EmptyStateBody';\nimport './style.css';\n\nfunction Column<TType = unknown>(_: ReportColumnProps<TType>) {\n return null;\n}\n\nfunction Group(_: ReportGroupProps) {\n return null;\n}\n\nexport const Report = fixedForwardRef<TableRef, ReportProps>(function Report<TType = unknown>(\n props: ReportProps<TType>,\n ref: React.Ref<TableRef>\n) {\n const tableRef = useMergedRef<TableRef>(ref);\n const report = useReport<TType>(props, tableRef);\n const renderer = useTableRenderer<TType>(report.instance, tableRef, props.defaultRowActiveIndex);\n const stylesheet = useStylesheet(report.id, report.instance);\n useTableGlobalShortcuts(report.instance, tableRef, renderer.scrollToIndex);\n\n const handleFocus =\n report.meta.rowActive.rowActiveIndex === undefined\n ? (event: React.FocusEvent) => {\n report.meta.rowActive.handleFocus(event, report.meta.length, renderer.scrollToIndex);\n }\n : undefined;\n\n return (\n <>\n {stylesheet}\n <Toolbar\n customSettings={props.customSettings}\n left={props.toolbarLeft}\n length={report.meta.length}\n right={props.toolbarRight}\n scrollToIndex={renderer.scrollToIndex}\n table={report.instance}\n tableId={report.id}\n tableRef={tableRef}\n />\n {props.toolbarPanel ? <div className=\"mb-4\">{props.toolbarPanel}</div> : undefined}\n <FocusScope>\n <table\n id={report.id}\n data-taco=\"report\"\n data-table-font-size={report.meta.fontSize.size}\n data-table-horizontally-scrolled={report.meta.columnFreezing.isHorizontallyScrolled ? true : undefined}\n data-table-pause-hover={report.meta.rowActive.isHoverStatePaused ? true : undefined}\n data-table-resizing={report.state.columnSizingInfo.isResizingColumn ? true : undefined}\n data-table-row-height={report.meta.rowHeight.height}\n data-table-grouped={!!report.state.grouping?.length}\n onFocus={handleFocus}\n onScroll={report.meta.columnFreezing.handleScroll}\n ref={tableRef}\n tabIndex={-1}>\n <thead>\n {report.instance.getHeaderGroups().map(headerGroup => (\n <tr key={headerGroup.id}>{headerGroup.headers.map(Header)}</tr>\n ))}\n </thead>\n {renderer.rows?.length ? (\n <>\n <Body table={report.instance} style={renderer.style}>\n {renderer.rows}\n </Body>\n {report.meta.footer.isEnabled ? (\n <tfoot>\n <tr>{report.instance.getFooterGroups()[0].headers.map(Footer)}</tr>\n </tfoot>\n ) : null}\n </>\n ) : (\n <EmptyStateBody emptyState={props.emptyState} />\n )}\n </table>\n </FocusScope>\n </>\n );\n}) as (<TType = unknown>(props: ReportProps<TType> & React.RefAttributes<TableRef>) => JSX.Element) & {\n Column: typeof Column;\n Group: typeof Group;\n};\nReport.Column = Column;\nReport.Group = Group;\n\nexport * from './types';\n"],"names":["Column","_","Group","Report","fixedForwardRef","props","ref","tableRef","useMergedRef","report","useReport","renderer","useTableRenderer","instance","defaultRowActiveIndex","stylesheet","useStylesheet","id","useTableGlobalShortcuts","scrollToIndex","handleFocus","meta","rowActive","rowActiveIndex","undefined","event","length","React","Toolbar","customSettings","left","toolbarLeft","right","toolbarRight","table","tableId","toolbarPanel","className","FocusScope","fontSize","size","columnFreezing","isHorizontallyScrolled","isHoverStatePaused","state","columnSizingInfo","isResizingColumn","rowHeight","height","_report$state$groupin","grouping","onFocus","onScroll","handleScroll","tabIndex","getHeaderGroups","map","headerGroup","key","headers","Header","_renderer$rows","rows","Body","style","footer","isEnabled","getFooterGroups","Footer","EmptyStateBody","emptyState"],"mappings":";;;;;;;;;;;;;;AAiBA,SAASA,MAAMA,CAAkBC,CAA2B;EACxD,OAAO,IAAI;AACf;AAEA,SAASC,KAAKA,CAACD,CAAmB;EAC9B,OAAO,IAAI;AACf;MAEaE,MAAM,gBAAGC,eAAe,CAAwB,SAASD,MAAMA,CACxEE,KAAyB,EACzBC,GAAwB;;EAExB,MAAMC,QAAQ,GAAGC,YAAY,CAAWF,GAAG,CAAC;EAC5C,MAAMG,MAAM,GAAGC,SAAS,CAAQL,KAAK,EAAEE,QAAQ,CAAC;EAChD,MAAMI,QAAQ,GAAGC,gBAAgB,CAAQH,MAAM,CAACI,QAAQ,EAAEN,QAAQ,EAAEF,KAAK,CAACS,qBAAqB,CAAC;EAChG,MAAMC,UAAU,GAAGC,aAAa,CAACP,MAAM,CAACQ,EAAE,EAAER,MAAM,CAACI,QAAQ,CAAC;EAC5DK,uBAAuB,CAACT,MAAM,CAACI,QAAQ,EAAEN,QAAQ,EAAEI,QAAQ,CAACQ,aAAa,CAAC;EAE1E,MAAMC,WAAW,GACbX,MAAM,CAACY,IAAI,CAACC,SAAS,CAACC,cAAc,KAAKC,SAAS,GAC3CC,KAAuB;IACpBhB,MAAM,CAACY,IAAI,CAACC,SAAS,CAACF,WAAW,CAACK,KAAK,EAAEhB,MAAM,CAACY,IAAI,CAACK,MAAM,EAAEf,QAAQ,CAACQ,aAAa,CAAC;GACvF,GACDK,SAAS;EAEnB,oBACIG,4DACKZ,U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BAC9C9B;IAAI+B,GAAG,EAAED,WAAW,CAACxC;KAAKwC,WAAW,CAACE,OAAO,CAACH,GAAG,CAACI,MAAM,CAAC,CAAM,CAClE,CAAC,CACE,EACP,CAAAC,cAAA,GAAAlD,QAAQ,CAACmD,IAAI,cAAAD,cAAA,eAAbA,cAAA,CAAenC,MAAM,kBAClBC,yEACIA,6BAACoC,IAAI;IAAC7B,KAAK,EAAEzB,MAAM,CAACI,QAAQ;IAAEmD,KAAK,EAAErD,QAAQ,CAACqD;KACzCrD,QAAQ,CAACmD,IAAI,CACX,EACNrD,MAAM,CAACY,IAAI,CAAC4C,MAAM,CAACC,SAAS,kBACzBvC,yDACIA,yCAAKlB,MAAM,CAACI,QAAQ,CAACsD,eAAe,EAAE,CAAC,CAAC,CAAC,CAACR,OAAO,CAACH,GAAG,CAACY,MAAM,CAAC,CAAM,CAC/D,IACR,IAAI,CACT,mBAEHzC,6BAAC0C,cAAc;IAACC,UAAU,EAAEjE,KAAK,CAACiE;IAAc,CACnD,CACG,CACC,CACd;AAEX,CAAC;AAIDnE,MAAM,CAACH,MAAM,GAAGA,MAAM;AACtBG,MAAM,CAACD,KAAK,GAAGA,KAAK;;;;"}
@@ -4,7 +4,6 @@ import { useAugmentedFocusManager } from './util.js';
4
4
  function Body(props) {
5
5
  const {
6
6
  enableArrowKeyFocusing = false,
7
- length,
8
7
  table,
9
8
  ...attributes
10
9
  } = props;
@@ -19,7 +18,7 @@ function Body(props) {
19
18
  }
20
19
  if (tableMeta.rowActive.rowActiveIndex !== undefined) {
21
20
  const isFirstRow = tableMeta.rowActive.rowActiveIndex === 0;
22
- const isLastRow = tableMeta.rowActive.rowActiveIndex === length - 1;
21
+ const isLastRow = tableMeta.rowActive.rowActiveIndex === tableMeta.length - 1;
23
22
  if (event.key === 'Tab' || enableArrowKeyFocusing && (event.key === 'ArrowLeft' || event.key === 'ArrowRight')) {
24
23
  tableMeta.rowActive.setHoverStatePaused(true);
25
24
  const focusedElement = event.shiftKey || event.key === 'ArrowLeft' ? focusManager.focusPrevious() : focusManager.focusNext();
@@ -1 +1 @@
1
- {"version":3,"file":"Body.js","sources":["../../../../../../../../../src/components/Report/components/Body/Body.tsx"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable, TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport { useAugmentedFocusManager } from './util';\n\ntype BodyProps<TType = unknown> = React.HTMLAttributes<HTMLTableSectionElement> & {\n enableArrowKeyFocusing?: boolean;\n length: number;\n table: ReactTable<TType>;\n};\n\nexport function Body<TType = unknown>(props: BodyProps<TType>) {\n const { enableArrowKeyFocusing = false, length, table, ...attributes } = props;\n const ref = React.useRef<HTMLTableSectionElement>(null);\n const focusManager = useAugmentedFocusManager();\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n\n // some rows won't have anything focusable in, and we don't want tab to move between rows in that case\n const focusableElementsInRowCountRef = React.useRef(0);\n\n const handleKeyDown = (event: React.KeyboardEvent) => {\n if (event.isDefaultPrevented() || event.isPropagationStopped()) {\n return;\n }\n\n if (tableMeta.rowActive.rowActiveIndex !== undefined) {\n const isFirstRow = tableMeta.rowActive.rowActiveIndex === 0;\n const isLastRow = tableMeta.rowActive.rowActiveIndex === length - 1;\n\n if (event.key === 'Tab' || (enableArrowKeyFocusing && (event.key === 'ArrowLeft' || event.key === 'ArrowRight'))) {\n tableMeta.rowActive.setHoverStatePaused(true);\n\n const focusedElement =\n event.shiftKey || event.key === 'ArrowLeft' ? focusManager.focusPrevious() : focusManager.focusNext();\n\n if (focusedElement) {\n // override default behaviour, since we're handling focus internally now\n event.preventDefault();\n focusableElementsInRowCountRef.current = focusableElementsInRowCountRef.current + 1;\n return;\n }\n\n if (event.shiftKey || event.key === 'ArrowLeft') {\n if (!isFirstRow && focusableElementsInRowCountRef.current !== 0) {\n // there are no previous elements to focus, go up a row or go outside the table\n // but only if there are actually any focusable elements in the row\n event.preventDefault();\n tableMeta.rowActive.setRowActiveIndex(tableMeta.rowActive.rowActiveIndex - 1);\n focusableElementsInRowCountRef.current = 0;\n requestAnimationFrame(() => focusManager.focusLast());\n }\n } else {\n if (!isLastRow && focusableElementsInRowCountRef.current !== 0) {\n // there are no next elements to focus, go down a row or go outside the table\n // but only if there are actually any focusable elements in the row\n event.preventDefault();\n tableMeta.rowActive.setRowActiveIndex(tableMeta.rowActive.rowActiveIndex + 1);\n focusableElementsInRowCountRef.current = 0;\n requestAnimationFrame(() => focusManager.focusFirst());\n }\n }\n }\n }\n };\n\n return <tbody {...attributes} onKeyDown={handleKeyDown} ref={ref} />;\n}\n"],"names":["Body","props","enableArrowKeyFocusing","length","table","attributes","ref","React","useRef","focusManager","useAugmentedFocusManager","tableMeta","options","meta","focusableElementsInRowCountRef","handleKeyDown","event","isDefaultPrevented","isPropagationStopped","rowActive","rowActiveIndex","undefined","isFirstRow","isLastRow","key","setHoverStatePaused","focusedElement","shiftKey","focusPrevious","focusNext","preventDefault","current","setRowActiveIndex","requestAnimationFrame","focusLast","focusFirst","onKeyDown"],"mappings":";;;SAUgBA,IAAIA,CAAkBC,KAAuB;EACzD,MAAM;IAAEC,sBAAsB,GAAG,KAAK;IAAEC,MAAM;IAAEC,KAAK;IAAE,GAAGC;GAAY,GAAGJ,KAAK;EAC9E,MAAMK,GAAG,GAAGC,cAAK,CAACC,MAAM,CAA0B,IAAI,CAAC;EACvD,MAAMC,YAAY,GAAGC,wBAAwB,EAAE;EAC/C,MAAMC,SAAS,GAAGP,KAAK,CAACQ,OAAO,CAACC,IAA6B;;EAG7D,MAAMC,8BAA8B,GAAGP,cAAK,CAACC,MAAM,CAAC,CAAC,CAAC;EAEtD,MAAMO,aAAa,GAAIC,KAA0B;IAC7C,IAAIA,KAAK,CAACC,kBAAkB,EAAE,IAAID,KAAK,CAACE,oBAAoB,EAAE,EAAE;MAC5D;;IAGJ,IAAIP,SAAS,CAACQ,SAAS,CAACC,cAAc,KAAKC,SAAS,EAAE;MAClD,MAAMC,UAAU,GAAGX,SAAS,CAACQ,SAAS,CAACC,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CAACiB,OAAO,GAAG,CAAC;YAC1CE,qBAAqB,CAAC,MAAMxB,YAAY,CAAC0B,UAAU,EAAE,CAAC;;;;;GAKzE;EAED,oBAAO5B,wDAAWF,UAAU;IAAE+B,SAAS,EAAErB,aAAa;IAAET,GAAG,EAAEA;KAAO;AACxE;;;;"}
1
+ {"version":3,"file":"Body.js","sources":["../../../../../../../../../src/components/Report/components/Body/Body.tsx"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable, TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport { useAugmentedFocusManager } from './util';\n\ntype BodyProps<TType = unknown> = React.HTMLAttributes<HTMLTableSectionElement> & {\n enableArrowKeyFocusing?: boolean;\n table: ReactTable<TType>;\n};\n\nexport function Body<TType = unknown>(props: BodyProps<TType>) {\n const { enableArrowKeyFocusing = false, table, ...attributes } = props;\n const ref = React.useRef<HTMLTableSectionElement>(null);\n const focusManager = useAugmentedFocusManager();\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n\n // some rows won't have anything focusable in, and we don't want tab to move between rows in that case\n const focusableElementsInRowCountRef = React.useRef(0);\n\n const handleKeyDown = (event: React.KeyboardEvent) => {\n if (event.isDefaultPrevented() || event.isPropagationStopped()) {\n return;\n }\n\n if (tableMeta.rowActive.rowActiveIndex !== undefined) {\n const isFirstRow = tableMeta.rowActive.rowActiveIndex === 0;\n const isLastRow = tableMeta.rowActive.rowActiveIndex === tableMeta.length - 1;\n\n if (event.key === 'Tab' || (enableArrowKeyFocusing && (event.key === 'ArrowLeft' || event.key === 'ArrowRight'))) {\n tableMeta.rowActive.setHoverStatePaused(true);\n\n const focusedElement =\n event.shiftKey || event.key === 'ArrowLeft' ? focusManager.focusPrevious() : focusManager.focusNext();\n\n if (focusedElement) {\n // override default behaviour, since we're handling focus internally now\n event.preventDefault();\n focusableElementsInRowCountRef.current = focusableElementsInRowCountRef.current + 1;\n return;\n }\n\n if (event.shiftKey || event.key === 'ArrowLeft') {\n if (!isFirstRow && focusableElementsInRowCountRef.current !== 0) {\n // there are no previous elements to focus, go up a row or go outside the table\n // but only if there are actually any focusable elements in the row\n event.preventDefault();\n tableMeta.rowActive.setRowActiveIndex(tableMeta.rowActive.rowActiveIndex - 1);\n focusableElementsInRowCountRef.current = 0;\n requestAnimationFrame(() => focusManager.focusLast());\n }\n } else {\n if (!isLastRow && focusableElementsInRowCountRef.current !== 0) {\n // there are no next elements to focus, go down a row or go outside the table\n // but only if there are actually any focusable elements in the row\n event.preventDefault();\n tableMeta.rowActive.setRowActiveIndex(tableMeta.rowActive.rowActiveIndex + 1);\n focusableElementsInRowCountRef.current = 0;\n requestAnimationFrame(() => focusManager.focusFirst());\n }\n }\n }\n }\n };\n\n return <tbody {...attributes} onKeyDown={handleKeyDown} ref={ref} />;\n}\n"],"names":["Body","props","enableArrowKeyFocusing","table","attributes","ref","React","useRef","focusManager","useAugmentedFocusManager","tableMeta","options","meta","focusableElementsInRowCountRef","handleKeyDown","event","isDefaultPrevented","isPropagationStopped","rowActive","rowActiveIndex","undefined","isFirstRow","isLastRow","length","key","setHoverStatePaused","focusedElement","shiftKey","focusPrevious","focusNext","preventDefault","current","setRowActiveIndex","requestAnimationFrame","focusLast","focusFirst","onKeyDown"],"mappings":";;;SASgBA,IAAIA,CAAkBC,KAAuB;EACzD,MAAM;IAAEC,sBAAsB,GAAG,KAAK;IAAEC,KAAK;IAAE,GAAGC;GAAY,GAAGH,KAAK;EACtE,MAAMI,GAAG,GAAGC,cAAK,CAACC,MAAM,CAA0B,IAAI,CAAC;EACvD,MAAMC,YAAY,GAAGC,wBAAwB,EAAE;EAC/C,MAAMC,SAAS,GAAGP,KAAK,CAACQ,OAAO,CAACC,IAA6B;;EAG7D,MAAMC,8BAA8B,GAAGP,cAAK,CAACC,MAAM,CAAC,CAAC,CAAC;EAEtD,MAAMO,aAAa,GAAIC,KAA0B;IAC7C,IAAIA,KAAK,CAACC,kBAAkB,EAAE,IAAID,KAAK,CAACE,oBAAoB,EAAE,EAAE;MAC5D;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AACe,cAAc,EAAE;YACtBpB,SAAS,CAACQ,SAAS,CAACc,iBAAiB,CAACtB,SAAS,CAACQ,SAAS,CAACC,cAAc,GAAG,CAAC,CAAC;YAC7EN,8BAA8B,CAACkB,OAAO,GAAG,CAAC;YAC1CE,qBAAqB,CAAC,MAAMzB,YAAY,CAAC2B,UAAU,EAAE,CAAC;;;;;GAKzE;EAED,oBAAO7B,wDAAWF,UAAU;IAAEgC,SAAS,EAAEtB,aAAa;IAAET,GAAG,EAAEA;KAAO;AACxE;;;;"}
@@ -0,0 +1,18 @@
1
+ import React__default from 'react';
2
+
3
+ function EmptyStateBody(props) {
4
+ const {
5
+ emptyState: Placeholder = null,
6
+ ...attributes
7
+ } = props;
8
+ return /*#__PURE__*/React__default.createElement("tbody", Object.assign({}, attributes, {
9
+ className: "!auto-rows-fr"
10
+ }), /*#__PURE__*/React__default.createElement("tr", {
11
+ className: "!auto-rows-fr"
12
+ }, /*#__PURE__*/React__default.createElement("td", {
13
+ className: "col-span-full !border-0 !p-0 hover:!bg-white"
14
+ }, Placeholder ? /*#__PURE__*/React__default.createElement(Placeholder, null) : null)));
15
+ }
16
+
17
+ export { EmptyStateBody };
18
+ //# sourceMappingURL=EmptyStateBody.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EmptyStateBody.js","sources":["../../../../../../../../../src/components/Report/components/Body/EmptyStateBody.tsx"],"sourcesContent":["import React from 'react';\nimport { ReportEmptyStateRenderer } from '../../types';\n\ntype EmptyStateProps = React.HTMLAttributes<HTMLTableSectionElement> & {\n emptyState?: ReportEmptyStateRenderer;\n};\n\nexport function EmptyStateBody(props: EmptyStateProps) {\n const { emptyState: Placeholder = null, ...attributes } = props;\n\n return (\n <tbody {...attributes} className=\"!auto-rows-fr\">\n <tr className=\"!auto-rows-fr\">\n <td className=\"col-span-full !border-0 !p-0 hover:!bg-white\">{Placeholder ? <Placeholder /> : null}</td>\n </tr>\n </tbody>\n );\n}\n"],"names":["EmptyStateBody","props","emptyState","Placeholder","attributes","React","className"],"mappings":";;SAOgBA,cAAcA,CAACC,KAAsB;EACjD,MAAM;IAAEC,UAAU,EAAEC,WAAW,GAAG,IAAI;IAAE,GAAGC;GAAY,GAAGH,KAAK;EAE/D,oBACII,wDAAWD,UAAU;IAAEE,SAAS,EAAC;mBAC7BD;IAAIC,SAAS,EAAC;kBACVD;IAAIC,SAAS,EAAC;KAAgDH,WAAW,gBAAGE,6BAACF,WAAW,OAAG,GAAG,IAAI,CAAM,CACvG,CACD;AAEhB;;;;"}
@@ -1,5 +1,6 @@
1
1
  import React__default from 'react';
2
2
  import { isInternalColumn, isCellHighlighted } from '../../../../primitives/Table/useTable/util/columns.js';
3
+ import { RowContext } from '../Row/RowContext.js';
3
4
 
4
5
  function getCellAttributes(cell, isHighlighted) {
5
6
  const columnMeta = cell.column.columnDef.meta;
@@ -18,7 +19,10 @@ function getCellAttributes(cell, isHighlighted) {
18
19
  }
19
20
  return attributes;
20
21
  }
21
- function useSearchHighlighting(cell, index, ref) {
22
+ function useSearchHighlighting(cell, cellIndex, ref) {
23
+ const {
24
+ rowIndex
25
+ } = React__default.useContext(RowContext);
22
26
  const context = cell.getContext();
23
27
  const tableMeta = context.table.options.meta;
24
28
  const columnMeta = cell.column.columnDef.meta;
@@ -34,7 +38,7 @@ function useSearchHighlighting(cell, index, ref) {
34
38
  return undefined;
35
39
  }
36
40
  const [rowActiveIndex, currentColumnIndex] = tableMeta.search.highlightedColumnIndexes[tableMeta.search.currentHighlightColumnIndex];
37
- if (rowActiveIndex === cell.row.index && currentColumnIndex === index) {
41
+ if (rowActiveIndex === rowIndex && currentColumnIndex === cellIndex) {
38
42
  return 'current';
39
43
  }
40
44
  return true;
@@ -1 +1 @@
1
- {"version":3,"file":"util.js","sources":["../../../../../../../../../src/components/Report/components/Cell/util.ts"],"sourcesContent":["import React from 'react';\nimport { Cell as ReactTableCell, ColumnMeta as ReactTableColumnMeta, TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport { isCellHighlighted, isInternalColumn } from '../../../../primitives/Table/useTable/util/columns';\n\nexport type DisplayCellProps<TType = unknown> = {\n index: number;\n cell: ReactTableCell<TType, unknown>;\n};\n\nexport function getCellAttributes<TType = unknown>(\n cell: ReactTableCell<TType, unknown>,\n isHighlighted: true | 'current' | undefined\n) {\n const columnMeta = cell.column.columnDef.meta as ReactTableColumnMeta<TType, unknown>;\n\n const isPinned = cell.column.getIsPinned();\n const attributes = {\n 'data-cell-align': columnMeta?.align,\n 'data-cell-highlighted': isHighlighted,\n 'data-cell-id': cell.column.id,\n 'data-cell-pinned': isPinned ? true : undefined,\n 'data-cell-truncate': columnMeta.enableTruncate ? true : undefined,\n className: typeof columnMeta.className === 'function' ? columnMeta.className(cell.row.original) : columnMeta.className,\n style: {},\n };\n\n if (isPinned) {\n attributes.style[isPinned] = `${cell.column.getStart(isPinned)}px`;\n }\n\n return attributes;\n}\n\nexport function useSearchHighlighting<TType = unknown>(\n cell: ReactTableCell<TType, unknown>,\n index: number,\n ref: React.RefObject<HTMLTableCellElement>\n) {\n const context = cell.getContext();\n const tableMeta = context.table.options.meta as ReactTableMeta<TType>;\n const columnMeta = cell.column.columnDef.meta as ReactTableColumnMeta<TType, unknown>;\n\n const isHighlighted: 'current' | boolean | undefined = React.useMemo(() => {\n if (\n !cell.column.columnDef.enableGlobalFilter ||\n isInternalColumn(cell.column.id) ||\n cell.getIsAggregated() ||\n cell.getIsPlaceholder()\n ) {\n return undefined;\n }\n\n let isHighlighted = false;\n\n if (context.table.getState().globalFilter) {\n isHighlighted = isCellHighlighted(context.table.getState().globalFilter, cell.getValue(), columnMeta.dataType);\n }\n\n if (!isHighlighted || tableMeta.search.currentHighlightColumnIndex === undefined) {\n return undefined;\n }\n\n const [rowActiveIndex, currentColumnIndex] =\n tableMeta.search.highlightedColumnIndexes[tableMeta.search.currentHighlightColumnIndex];\n\n if (rowActiveIndex === cell.row.index && currentColumnIndex === index) {\n return 'current';\n }\n\n return true;\n }, [\n cell.getValue(),\n context.table.getState().globalFilter,\n tableMeta.search.highlightedColumnIndexes.length,\n tableMeta.search.currentHighlightColumnIndex,\n ]);\n\n React.useEffect(() => {\n if (ref.current && isHighlighted === 'current') {\n ref.current.scrollIntoView({ block: 'nearest', inline: 'nearest' });\n\n setTimeout(() => {\n if (ref.current) {\n const tableEl = ref.current.closest('table[data-taco=\"report\"]');\n\n setTimeout(() => {\n const pinnedColumns = tableEl?.querySelectorAll('thead tr:last-child th[data-cell-pinned=\"left\"]');\n\n if (pinnedColumns?.length) {\n const lastFrozenRect = pinnedColumns.item(pinnedColumns.length - 1)?.getBoundingClientRect();\n\n if (lastFrozenRect && cell.column.getStart() < lastFrozenRect.right) {\n tableEl?.scrollTo(cell.column.getStart() - lastFrozenRect.right, tableEl.scrollTop);\n }\n }\n }, 1);\n }\n }, 1);\n }\n }, [isHighlighted]);\n\n return isHighlighted;\n}\n\nexport function getCurrentRowCellElement(index: number, tableEl: HTMLElement) {\n const cellSelector = `[data-current=\"true\"] [data-column-index=\"${index}\"`;\n return tableEl.querySelector(cellSelector);\n}\n\nexport function scrollColumnIntoView(columnIndex: number, frozenColumnIndex: number, column: HTMLElement, tableEl: HTMLElement) {\n if (frozenColumnIndex !== undefined && columnIndex > frozenColumnIndex) {\n const lastFrozenColumnElement = getCurrentRowCellElement(frozenColumnIndex, tableEl);\n const highlightRef = column?.getBoundingClientRect();\n const lastFrozenRect = lastFrozenColumnElement?.getBoundingClientRect();\n\n // offset the width of frozen columns so that the column being scrolled to is not hidden behind them\n if (highlightRef && lastFrozenRect && highlightRef.left < lastFrozenRect.left + lastFrozenRect.width) {\n const pinnedColumnsWidth = lastFrozenRect.left + lastFrozenRect.width;\n tableEl?.scrollTo(highlightRef.left - pinnedColumnsWidth, tableEl.scrollTop);\n }\n } else {\n column.scrollIntoView({ block: 'nearest', inline: 'nearest' });\n }\n}\n"],"names":["getCellAttributes","cell","isHighlighted","columnMeta","column","columnDef","meta","isPinned","getIsPinned","attributes","align","id","undefined","enableTruncate","className","row","original","style","getStart","useSearchHighlighting","index","ref","context","getContext","tableMeta","table","options","React","useMemo","enableGlobalFilter","isInternalColumn","getIsAggregated","getIsPlaceholder","getState","globalFilter","isCellHighlighted","getValue","dataType","search","currentHighlightColumnIndex","rowActiveIndex","currentColumnIndex","highlightedColumnIndexes","length","useEffect","current","scrollIntoView","block","inline","setTimeout","tableEl","closest","pinnedColumns","querySelectorAll","_pinnedColumns$item","lastFrozenRect","item","getBoundingClientRect","right","scrollTo","scrollTop"],"mappings":";;;SASgBA,iBAAiBA,CAC7BC,IAAoC,EACpCC,aAA2C;EAE3C,MAAMC,UAAU,GAAGF,IAAI,CAACG,MAAM,CAACC,SAAS,CAACC,IAA4C;EAErF,MAAMC,QAAQ,GAAGN,IAAI,CAACG,MAAM,CAACI,WAAW,EAAE;EAC1C,MAAMC,UAAU,GAAG;IACf,iBAAiB,EAAEN,UAAU,aAAVA,UAAU,uBAAVA,UAAU,CAAEO,KAAK;IACpC,uBAAuB,EAAER,aAAa;IACtC,cAAc,EAAED,IAAI,CAACG,MAAM,CAACO,EAAE;IAC9B,kBAAkB,EAAEJ,QAAQ,GAAG,IAAI,GAAGK,SAAS;IAC/C,oBAAoB,EAAET,UAAU,CAACU,cAAc,GAAG,IAAI,GAAGD,SAAS;IAClEE,SAAS,EAAE,OAAOX,UAAU,CAACW,SAAS,KAAK,UAAU,GAAGX,UAAU,CAACW,SAAS,CAACb,IAAI,CAACc,GAAG,CAACC,QAAQ,CAAC,GAAGb,UAAU,CAACW,SAAS;IACtHG,KAAK,EAAE;GACV;EAED,IAAIV,QAAQ,EAAE;IACVE,UAAU,CAACQ,KAAK,CAACV,QAAQ,CAAC,MAAMN,IAAI,CAACG,MAAM,CAACc,QAAQ,CAACX,QAAQ,KAAK;;EAGtE,OAAOE,UAAU;AACrB;SAEgBU,qBAAqBA,CACjClB,IAAoC,EACpCmB,KAAa,EACbC,GAA0C;EAE1C,MAAMC,OAAO,GAAGrB,IAAI,CAACsB,UAAU,EAAE;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,MAAM,CAACC,2BAA2B,CAC/C,CAAC;EAEFZ,cAAK,CAACiB,SAAS,CAAC;IACZ,IAAIvB,GAAG,CAACwB,OAAO,IAAI3C,aAAa,KAAK,SAAS,EAAE;MAC5CmB,GAAG,CAACwB,OAAO,CAACC,cAAc,CAAC;QAAEC,KAAK,EAAE,SAAS;QAAEC,MAAM,EAAE;OAAW,CAAC;MAEnEC,UAAU,CAAC;QACP,IAAI5B,GAAG,CAACwB,OAAO,EAAE;UACb,MAAMK,OAAO,GAAG7B,GAAG,CAACwB,OAAO,CAACM,OAAO,CAAC,2BAA2B,CAAC;UAEhEF,UAAU,CAAC;YACP,MAAMG,aAAa,GAAGF,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEG,gBAAgB,CAAC,iDAAiD,CAAC;YAElG,IAAID,aAAa,aAAbA,aAAa,eAAbA,aAAa,CAAET,MAAM,EAAE;cAAA,IAAAW,mBAAA;cACvB,MAAMC,cAAc,IAAAD,mBAAA,GAAGF,aAAa,CAACI,IAAI,CAACJ,aAAa,CAACT,MAAM,GAAG,CAAC,CAAC,cAAAW,mBAAA,uBAA5CA,mBAAA,CAA8CG,qBAAqB,EAAE;cAE5F,IAAIF,cAAc,IAAItD,IAAI,CAACG,MAAM,CAACc,QAAQ,EAAE,GAAGqC,cAAc,CAACG,KAAK,EAAE;gBACjER,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAES,QAAQ,CAAC1D,IAAI,CAACG,MAAM,CAACc,QAAQ,EAAE,GAAGqC,cAAc,CAACG,KAAK,EAAER,OAAO,CAACU,SAAS,CAAC;;;WAG9F,EAAE,CAAC,CAAC;;OAEZ,EAAE,CAAC,CAAC;;GAEZ,EAAE,CAAC1D,aAAa,CAAC,CAAC;EAEnB,OAAOA,aAAa;AACxB;;;;"}
1
+ {"version":3,"file":"util.js","sources":["../../../../../../../../../src/components/Report/components/Cell/util.ts"],"sourcesContent":["import React from 'react';\nimport { Cell as ReactTableCell, ColumnMeta as ReactTableColumnMeta, TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport { isCellHighlighted, isInternalColumn } from '../../../../primitives/Table/useTable/util/columns';\nimport { RowContext } from '../Row/RowContext';\n\nexport type DisplayCellProps<TType = unknown> = {\n index: number;\n cell: ReactTableCell<TType, unknown>;\n};\n\nexport function getCellAttributes<TType = unknown>(\n cell: ReactTableCell<TType, unknown>,\n isHighlighted: true | 'current' | undefined\n) {\n const columnMeta = cell.column.columnDef.meta as ReactTableColumnMeta<TType, unknown>;\n\n const isPinned = cell.column.getIsPinned();\n const attributes = {\n 'data-cell-align': columnMeta?.align,\n 'data-cell-highlighted': isHighlighted,\n 'data-cell-id': cell.column.id,\n 'data-cell-pinned': isPinned ? true : undefined,\n 'data-cell-truncate': columnMeta.enableTruncate ? true : undefined,\n className: typeof columnMeta.className === 'function' ? columnMeta.className(cell.row.original) : columnMeta.className,\n style: {},\n };\n\n if (isPinned) {\n attributes.style[isPinned] = `${cell.column.getStart(isPinned)}px`;\n }\n\n return attributes;\n}\n\nexport function useSearchHighlighting<TType = unknown>(\n cell: ReactTableCell<TType, unknown>,\n cellIndex: number,\n ref: React.RefObject<HTMLTableCellElement>\n) {\n const { rowIndex } = React.useContext(RowContext);\n const context = cell.getContext();\n const tableMeta = context.table.options.meta as ReactTableMeta<TType>;\n const columnMeta = cell.column.columnDef.meta as ReactTableColumnMeta<TType, unknown>;\n\n const isHighlighted: 'current' | boolean | undefined = React.useMemo(() => {\n if (\n !cell.column.columnDef.enableGlobalFilter ||\n isInternalColumn(cell.column.id) ||\n cell.getIsAggregated() ||\n cell.getIsPlaceholder()\n ) {\n return undefined;\n }\n\n let isHighlighted = false;\n\n if (context.table.getState().globalFilter) {\n isHighlighted = isCellHighlighted(context.table.getState().globalFilter, cell.getValue(), columnMeta.dataType);\n }\n\n if (!isHighlighted || tableMeta.search.currentHighlightColumnIndex === undefined) {\n return undefined;\n }\n\n const [rowActiveIndex, currentColumnIndex] =\n tableMeta.search.highlightedColumnIndexes[tableMeta.search.currentHighlightColumnIndex];\n\n if (rowActiveIndex === rowIndex && currentColumnIndex === cellIndex) {\n return 'current';\n }\n\n return true;\n }, [\n cell.getValue(),\n context.table.getState().globalFilter,\n tableMeta.search.highlightedColumnIndexes.length,\n tableMeta.search.currentHighlightColumnIndex,\n ]);\n\n React.useEffect(() => {\n if (ref.current && isHighlighted === 'current') {\n ref.current.scrollIntoView({ block: 'nearest', inline: 'nearest' });\n\n setTimeout(() => {\n if (ref.current) {\n const tableEl = ref.current.closest('table[data-taco=\"report\"]');\n\n setTimeout(() => {\n const pinnedColumns = tableEl?.querySelectorAll('thead tr:last-child th[data-cell-pinned=\"left\"]');\n\n if (pinnedColumns?.length) {\n const lastFrozenRect = pinnedColumns.item(pinnedColumns.length - 1)?.getBoundingClientRect();\n\n if (lastFrozenRect && cell.column.getStart() < lastFrozenRect.right) {\n tableEl?.scrollTo(cell.column.getStart() - lastFrozenRect.right, tableEl.scrollTop);\n }\n }\n }, 1);\n }\n }, 1);\n }\n }, [isHighlighted]);\n\n return isHighlighted;\n}\n\nexport function getCurrentRowCellElement(index: number, tableEl: HTMLElement) {\n const cellSelector = `[data-current=\"true\"] [data-column-index=\"${index}\"`;\n return tableEl.querySelector(cellSelector);\n}\n\nexport function scrollColumnIntoView(columnIndex: number, frozenColumnIndex: number, column: HTMLElement, tableEl: HTMLElement) {\n if (frozenColumnIndex !== undefined && columnIndex > frozenColumnIndex) {\n const lastFrozenColumnElement = getCurrentRowCellElement(frozenColumnIndex, tableEl);\n const highlightRef = column?.getBoundingClientRect();\n const lastFrozenRect = lastFrozenColumnElement?.getBoundingClientRect();\n\n // offset the width of frozen columns so that the column being scrolled to is not hidden behind them\n if (highlightRef && lastFrozenRect && highlightRef.left < lastFrozenRect.left + lastFrozenRect.width) {\n const pinnedColumnsWidth = lastFrozenRect.left + lastFrozenRect.width;\n tableEl?.scrollTo(highlightRef.left - pinnedColumnsWidth, tableEl.scrollTop);\n }\n } else {\n column.scrollIntoView({ block: 'nearest', inline: 'nearest' });\n }\n}\n"],"names":["getCellAttributes","cell","isHighlighted","columnMeta","column","columnDef","meta","isPinned","getIsPinned","attributes","align","id","undefined","enableTruncate","className","row","original","style","getStart","useSearchHighlighting","cellIndex","ref","rowIndex","React","useContext","RowContext","context","getContext","tableMeta","table","options","useMemo","enableGlobalFilter","isInternalColumn","getIsAggregated","getIsPlaceholder","getState","globalFilter","isCellHighlighted","getValue","dataType","search","currentHighlightColumnIndex","rowActiveIndex","currentColumnIndex","highlightedColumnIndexes","length","useEffect","current","scrollIntoView","block","inline","setTimeout","tableEl","closest","pinnedColumns","querySelectorAll","_pinnedColumns$item","lastFrozenRect","item","getBoundingClientRect","right","scrollTo","scrollTop"],"mappings":";;;;SAUgBA,iBAAiBA,CAC7BC,IAAoC,EACpCC,aAA2C;EAE3C,MAAMC,UAAU,GAAGF,IAAI,CAACG,MAAM,CAACC,SAAS,CAACC,IAA4C;EAErF,MAAMC,QAAQ,GAAGN,IAAI,CAACG,MAAM,CAACI,WAAW,EAAE;EAC1C,MAAMC,UAAU,GAAG;IACf,iBAAiB,EAAEN,UAAU,aAAVA,UAAU,uBAAVA,UAAU,CAAEO,KAAK;IACpC,uBAAuB,EAAER,aAAa;IACtC,cAAc,EAAED,IAAI,CAACG,MAAM,CAACO,EAAE;IAC9B,kBAAkB,EAAEJ,QAAQ,GAAG,IAAI,GAAGK,SAAS;IAC/C,oBAAoB,EAAET,UAAU,CAACU,cAAc,GAAG,IAAI,GAAGD,SAAS;IAClEE,SAAS,EAAE,OAAOX,UAAU,CAACW,SAAS,KAAK,UAAU,GAAGX,UAAU,CAACW,SAAS,CAACb,IAAI,CAACc,GAAG,CAACC,QAAQ,CAAC,GAAGb,UAAU,CAACW,SAAS;IACtHG,KAAK,EAAE;GACV;EAED,IAAIV,QAAQ,EAAE;IACVE,UAAU,CAACQ,KAAK,CAACV,QAAQ,CAAC,MAAMN,IAAI,CAACG,MAAM,CAACc,QAAQ,CAACX,QAAQ,KAAK;;EAG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Z,EAAE,CAAC7D,aAAa,CAAC,CAAC;EAEnB,OAAOA,aAAa;AACxB;;;;"}
@@ -1,5 +1,6 @@
1
1
  import React__default from 'react';
2
2
  import { flexRender } from '@tanstack/react-table';
3
+ import { Summary } from './Summary.js';
3
4
 
4
5
  function Footer(header) {
5
6
  return /*#__PURE__*/React__default.createElement(MemoedFooter, {
@@ -21,13 +22,24 @@ const MemoedFooter = /*#__PURE__*/React__default.memo(function MemoedFooter(prop
21
22
  // pinned columns should be offset from either the left or right
22
23
  style[isPinned] = `${footer.column.getStart(isPinned) - 1}px`;
23
24
  }
25
+ let content;
26
+ let align;
27
+ if (footer.index === 0) {
28
+ align = 'left';
29
+ content = /*#__PURE__*/React__default.createElement(Summary, {
30
+ table: footer.getContext().table
31
+ });
32
+ } else {
33
+ align = columnMeta.align;
34
+ content = footer.isPlaceholder ? null : flexRender(footer.column.columnDef.footer, footer.getContext());
35
+ }
24
36
  return /*#__PURE__*/React__default.createElement("td", {
25
37
  key: footer.id,
26
- "data-cell-align": columnMeta.align,
38
+ "data-cell-align": align,
27
39
  "data-cell-id": footer.id,
28
40
  "data-cell-pinned": isPinned ? isPinned : undefined,
29
41
  style: style
30
- }, footer.isPlaceholder ? null : flexRender(footer.column.columnDef.footer, footer.getContext()));
42
+ }, content);
31
43
  });
32
44
 
33
45
  export { Footer };
@@ -1 +1 @@
1
- {"version":3,"file":"Footer.js","sources":["../../../../../../../../../src/components/Report/components/Footer/Footer.tsx"],"sourcesContent":["import React from 'react';\nimport { Header as ReactTableHeader, ColumnMeta as ReactTableColumnMeta, flexRender } from '@tanstack/react-table';\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 return (\n <td\n key={footer.id}\n data-cell-align={columnMeta.align}\n data-cell-id={footer.id}\n data-cell-pinned={isPinned ? isPinned : undefined}\n style={style}>\n {footer.isPlaceholder ? null : flexRender(footer.column.columnDef.footer, footer.getContext())}\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","align","undefined","isPlaceholder","flexRender","getContext"],"mappings":";;;SAGgBA,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,oBACIf;IACIE,GAAG,EAAEE,MAAM,CAACD,EAAE;uBACGI,UAAU,CAACe,KAAK;oBACnBlB,MAAM,CAACD,EAAE;wBACLY,QAAQ,GAAGA,QAAQ,GAAGQ,SAAS;IACjDH,KAAK,EAAEA;KACNhB,MAAM,CAACoB,aAAa,GAAG,IAAI,GAAGC,UAAU,CAACrB,MAAM,CAACI,MAAM,CAACC,SAAS,CAACL,MAAM,EAAEA,MAAM,CAACsB,UAAU,EAAE,CAAC,CAC7F;AAEb,CAAC,CAAsE;;;;"}
1
+ {"version":3,"file":"Footer.js","sources":["../../../../../../../../../src/components/Report/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;;;;"}
@@ -4,13 +4,13 @@ import { useLocalization } from '../../../Provider/Localization.js';
4
4
  function Summary(props) {
5
5
  var _table$getState$colum;
6
6
  const {
7
- length,
8
7
  table
9
8
  } = props;
10
9
  const {
11
10
  locale,
12
11
  texts
13
12
  } = useLocalization();
13
+ const length = table.options.meta.length;
14
14
  const currentLength = table.getRowModel().rows.length;
15
15
  let label;
16
16
  let count;
@@ -30,7 +30,7 @@ function Summary(props) {
30
30
  count = /*#__PURE__*/React__default.createElement("strong", null, new Intl.NumberFormat(locale).format(length));
31
31
  }
32
32
  return /*#__PURE__*/React__default.createElement("div", {
33
- className: "border-grey-300 sticky z-20 -mt-[2.63rem] ml-px flex h-10 w-fit items-center whitespace-nowrap rounded-bl border-t-2 bg-white px-4 !pr-3",
33
+ className: "sticky left-0 z-20 flex h-full w-fit items-center whitespace-nowrap bg-white pr-1 shadow-[12px_0px_6px_white]",
34
34
  "data-taco": "table2-footer-summary"
35
35
  }, label, "\u00A0", count);
36
36
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Summary.js","sources":["../../../../../../../../../src/components/Report/components/Footer/Summary.tsx"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable } from '@tanstack/react-table';\nimport { useLocalization } from '../../../Provider/Localization';\n\nexport type FooterSummaryProps<TType = unknown> = {\n length: number;\n table: ReactTable<TType>;\n};\n\nexport function Summary<TType = unknown>(props: FooterSummaryProps<TType>) {\n const { length, table } = props;\n const { locale, texts } = useLocalization();\n const currentLength = table.getRowModel().rows.length;\n\n let label;\n let count;\n\n // row selection\n const rowsSelectedLength = table.getIsAllRowsSelected() ? length : table.getSelectedRowModel().rows.length;\n\n if (rowsSelectedLength > 0) {\n label = texts.table3.footer.summary.selected;\n count = (\n <>\n <strong>{new Intl.NumberFormat(locale).format(rowsSelectedLength)}</strong>&nbsp;\n {texts.table3.footer.summary.count}&nbsp;\n <strong>{new Intl.NumberFormat(locale).format(length)}</strong>\n </>\n );\n } else if (\n table.getState().columnFilters?.length || // filtered data\n (!!table.getState().globalFilter && table.options.enableGlobalFilter) // search with hide enabled\n ) {\n label = texts.table3.footer.summary.records;\n count = (\n <>\n <strong>{currentLength}</strong>&nbsp;\n {texts.table3.footer.summary.count}&nbsp;\n <strong>{new Intl.NumberFormat(locale).format(length)}</strong>\n </>\n );\n } else {\n label = texts.table3.footer.summary.records;\n count = <strong>{new Intl.NumberFormat(locale).format(length)}</strong>;\n }\n\n return (\n <div\n className=\"border-grey-300 sticky z-20 -mt-[2.63rem] ml-px flex h-10 w-fit items-center whitespace-nowrap rounded-bl border-t-2 bg-white px-4 !pr-3\"\n data-taco=\"table2-footer-summary\">\n {label}&nbsp;{count}\n </div>\n );\n}\n"],"names":["Summary","props","length","table","locale","texts","useLocalization","currentLength","getRowModel","rows","label","count","rowsSelectedLength","getIsAllRowsSelected","getSelectedRowModel","table3","footer","summary","selected","React","Intl","NumberFormat","format","_table$getState$colum","getState","columnFilters","globalFilter","options","enableGlobalFilter","records","className"],"mappings":";;;SASgBA,OAAOA,CAAkBC,KAAgC;;EACrE,MAAM;IAAEC,MAAM;IAAEC;GAAO,GAAGF,KAAK;EAC/B,MAAM;IAAEG,MAAM;IAAEC;GAAO,GAAGC,eAAe,EAAE;EAC3C,MAAMC,aAAa,GAAGJ,KAAK,CAACK,WAAW,EAAE,CAACC,IAAI,CAACP,MAAM;EAErD,IAAIQ,KAAK;EACT,IAAIC,KAAK;;EAGT,MAAMC,kBAAkB,GAAGT,KAAK,CAACU,oBAAoB,EAAE,GAAGX,MAAM,GAAGC,KAAK,CAACW,mBAAmB,EAAE,CAACL,IAAI,CAACP,MAAM;EAE1G,IAAIU,kBAAkB,GAAG,CAAC,EAAE;IACxBF,KAAK,GAAGL,KAAK,CAACU,MAAM,CAACC,MAAM,CAACC,OAAO,CAACC,QAAQ;IAC5CP,KAAK,gBACDQ,yEACIA,6CAAS,IAAIC,IAAI,CAACC,YAAY,CAACjB,MAAM,CAAC,CAACkB,MAAM,CAACV,kBAAkB,CAAC,CAAU,YAC1EP,KAAK,CAACU,MAAM,CAACC,MAAM,CAACC,OAAO,CAACN,KAAK,yBAClCQ,6CAAS,IAAIC,IAAI,CAACC,YAAY,CAACjB,MAAM,CAAC,CAACkB,MAAM,CAACpB,MAAM,CAAC,CAAU,CAEtE;GACJ,MAAM,IACH,CAAAqB,qBAAA,GAAApB,KAAK,CAACqB,QAAQ,EAAE,CAACC,aAAa,cAAAF,qBAAA,eAA9BA,qBAAA,CAAgCrB,MAAM;;EACrC,CAAC,CAACC,KAAK,CAACqB,QAAQ,EAAE,CAACE,YAAY,IAAIvB,KAAK,CAACwB,OAAO,CAACC,kBAAmB;IACvE;IACElB,KAAK,GAAGL,KAAK,CAACU,MAAM,CAACC,MAAM,CAACC,OAAO,CAACY,OAAO;IAC3ClB,KAAK,gBACDQ,yEACIA,6CAASZ,aAAa,CAAU,YAC/BF,KAAK,CAACU,MAAM,CAACC,MAAM,CAACC,OAAO,CAACN,KAAK,yBAClCQ,6CAAS,IAAIC,IAAI,CAACC,YAAY,CAACjB,MAAM,CAAC,CAACkB,MAAM,CAACpB,MAAM,CAAC,CAAU,CAEtE;GACJ,MAAM;IACHQ,KAAK,GAAGL,KAAK,CAACU,MAAM,CAACC,MAAM,CAACC,OAAO,CAACY,OAAO;IAC3ClB,KAAK,gBAAGQ,6CAAS,IAAIC,IAAI,CAACC,YAAY,CAACjB,MAAM,CAAC,CAACkB,MAAM,CAACpB,MAAM,CAAC,CAAU;;EAG3E,oBACIiB;IACIW,SAAS,EAAC,0IAA0I;iBAC1I;KACTpB,KAAK,YAAQC,KAAK,CACjB;AAEd;;;;"}
1
+ {"version":3,"file":"Summary.js","sources":["../../../../../../../../../src/components/Report/components/Footer/Summary.tsx"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable, TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport { useLocalization } from '../../../Provider/Localization';\n\nexport type FooterSummaryProps<TType = unknown> = {\n table: ReactTable<TType>;\n};\n\nexport function Summary<TType = unknown>(props: FooterSummaryProps<TType>) {\n const { table } = props;\n const { locale, texts } = useLocalization();\n const length = (table.options.meta as ReactTableMeta<TType>).length;\n const currentLength = table.getRowModel().rows.length;\n\n let label;\n let count;\n\n // row selection\n const rowsSelectedLength = table.getIsAllRowsSelected() ? length : table.getSelectedRowModel().rows.length;\n\n if (rowsSelectedLength > 0) {\n label = texts.table3.footer.summary.selected;\n count = (\n <>\n <strong>{new Intl.NumberFormat(locale).format(rowsSelectedLength)}</strong>&nbsp;\n {texts.table3.footer.summary.count}&nbsp;\n <strong>{new Intl.NumberFormat(locale).format(length)}</strong>\n </>\n );\n } else if (\n table.getState().columnFilters?.length || // filtered data\n (!!table.getState().globalFilter && table.options.enableGlobalFilter) // search with hide enabled\n ) {\n label = texts.table3.footer.summary.records;\n count = (\n <>\n <strong>{currentLength}</strong>&nbsp;\n {texts.table3.footer.summary.count}&nbsp;\n <strong>{new Intl.NumberFormat(locale).format(length)}</strong>\n </>\n );\n } else {\n label = texts.table3.footer.summary.records;\n count = <strong>{new Intl.NumberFormat(locale).format(length)}</strong>;\n }\n\n return (\n <div\n className=\"sticky left-0 z-20 flex h-full w-fit items-center whitespace-nowrap bg-white pr-1 shadow-[12px_0px_6px_white]\"\n data-taco=\"table2-footer-summary\">\n {label}&nbsp;{count}\n </div>\n );\n}\n"],"names":["Summary","props","table","locale","texts","useLocalization","length","options","meta","currentLength","getRowModel","rows","label","count","rowsSelectedLength","getIsAllRowsSelected","getSelectedRowModel","table3","footer","summary","selected","React","Intl","NumberFormat","format","_table$getState$colum","getState","columnFilters","globalFilter","enableGlobalFilter","records","className"],"mappings":";;;SAQgBA,OAAOA,CAAkBC,KAAgC;;EACrE,MAAM;IAAEC;GAAO,GAAGD,KAAK;EACvB,MAAM;IAAEE,MAAM;IAAEC;GAAO,GAAGC,eAAe,EAAE;EAC3C,MAAMC,MAAM,GAAIJ,KAAK,CAACK,OAAO,CAACC,IAA8B,CAACF,MAAM;EACnE,MAAMG,aAAa,GAAGP,KAAK,CAACQ,WAAW,EAAE,CAACC,IAAI,CAACL,MAAM;EAErD,IAAIM,KAAK;EACT,IAAIC,KAAK;;EAGT,MAAMC,kBAAkB,GAAGZ,KAAK,CAACa,oBAAoB,EAAE,GAAGT,MAAM,GAAGJ,KAAK,CAACc,mBAAmB,EAAE,CAACL,IAAI,CAACL,MAAM;EAE1G,IAAIQ,kBAAkB,GAAG,CAAC,EAAE;IACxBF,KAAK,GAAGR,KAAK,CAACa,MAAM,CAACC,MAAM,CAACC,OAAO,CAACC,QAAQ;IAC5CP,KAAK,gBACDQ,yEACIA,6CAAS,IAAIC,IAAI,CAACC,YAAY,CAACpB,MAAM,CAAC,CAACqB,MAAM,CAACV,kBAAkB,CAAC,CAAU,YAC1EV,KAAK,CAACa,MAAM,CAACC,MAAM,CAACC,OAAO,CAACN,KAAK,yBAClCQ,6CAAS,IAAIC,IAAI,CAACC,YAAY,CAACpB,MAAM,CAAC,CAACqB,MAAM,CAAClB,MAAM,CAAC,CAAU,CAEtE;GACJ,MAAM,IACH,CAAAmB,qBAAA,GAAAvB,KAAK,CAACwB,QAAQ,EAAE,CAACC,aAAa,cAAAF,qBAAA,eAA9BA,qBAAA,CAAgCnB,MAAM;;EACrC,CAAC,CAACJ,KAAK,CAACwB,QAAQ,EAAE,CAACE,YAAY,IAAI1B,KAAK,CAACK,OAAO,CAACsB,kBAAmB;IACvE;IACEjB,KAAK,GAAGR,KAAK,CAACa,MAAM,CAACC,MAAM,CAACC,OAAO,CAACW,OAAO;IAC3CjB,KAAK,gBACDQ,yEACIA,6CAASZ,aAAa,CAAU,YAC/BL,KAAK,CAACa,MAAM,CAACC,MAAM,CAACC,OAAO,CAACN,KAAK,yBAClCQ,6CAAS,IAAIC,IAAI,CAACC,YAAY,CAACpB,MAAM,CAAC,CAACqB,MAAM,CAAClB,MAAM,CAAC,CAAU,CAEtE;GACJ,MAAM;IACHM,KAAK,GAAGR,KAAK,CAACa,MAAM,CAACC,MAAM,CAACC,OAAO,CAACW,OAAO;IAC3CjB,KAAK,gBAAGQ,6CAAS,IAAIC,IAAI,CAACC,YAAY,CAACpB,MAAM,CAAC,CAACqB,MAAM,CAAClB,MAAM,CAAC,CAAU;;EAG3E,oBACIe;IACIU,SAAS,EAAC,+GAA+G;iBAC/G;KACTnB,KAAK,YAAQC,KAAK,CACjB;AAEd;;;;"}
@@ -5,6 +5,8 @@ import { useLocalization } from '../../../Provider/Localization.js';
5
5
  import { Checkbox } from '../../../Checkbox/Checkbox.js';
6
6
  import { Shortcut } from '../../../Shortcut/Shortcut.js';
7
7
  import { getRadioClassnames } from '../../../RadioGroup/util.js';
8
+ import { TableServerLoadAllState } from '../../../../primitives/Table/types.js';
9
+ import { RowContext } from '../Row/RowContext.js';
8
10
 
9
11
  function Header(context) {
10
12
  const {
@@ -43,6 +45,7 @@ function Header(context) {
43
45
  key: String(`${isAllRowsSelected}_${isSomeRowsSelected}`),
44
46
  checked: isAllRowsSelected,
45
47
  indeterminate: isSomeRowsSelected,
48
+ loading: tableMeta.server.loadAllStatus === TableServerLoadAllState.Loading,
46
49
  onChange: handleChange
47
50
  }));
48
51
  }
@@ -62,6 +65,9 @@ function Cell(context) {
62
65
  row,
63
66
  table
64
67
  } = context;
68
+ const {
69
+ rowIndex
70
+ } = React__default.useContext(RowContext);
65
71
  const tableMeta = table.options.meta;
66
72
  if (table.options.enableGrouping && (_table$getState$group = table.getState().grouping) !== null && _table$getState$group !== void 0 && _table$getState$group.length && !row.getIsGrouped()) {
67
73
  return null;
@@ -69,18 +75,48 @@ function Cell(context) {
69
75
  const isSelected = row.getIsGrouped() ? row.getIsAllSubRowsSelected() : row.getIsSelected();
70
76
  const title = isSelected ? texts.table3.columns.select.deselect : texts.table3.columns.select.select;
71
77
  if (table.options.enableMultiRowSelection) {
72
- const handleClick = event => {
73
- event.stopPropagation();
74
- if (row.getIsGrouped()) {
75
- row.subRows.forEach(row => row.toggleSelected());
76
- } else if (event.shiftKey) {
77
- var _tableMeta$rowSelecti;
78
- const [fromIndex, toIndex] = toggleBetween((_tableMeta$rowSelecti = tableMeta.rowSelection.lastSelectedRowIndex.current) !== null && _tableMeta$rowSelecti !== void 0 ? _tableMeta$rowSelecti : 0, row.index);
79
- table.getRowModel().rows.slice(fromIndex, toIndex + 1).forEach(row => row.toggleSelected(true));
80
- } else {
81
- row.toggleSelected();
78
+ const handleClick = function (event) {
79
+ try {
80
+ function _temp7() {
81
+ tableMeta.rowSelection.lastSelectedRowIndex.current = row.index;
82
+ }
83
+ event.stopPropagation();
84
+ const _temp6 = function () {
85
+ if (row.getIsGrouped()) {
86
+ row.subRows.forEach(row => row.toggleSelected());
87
+ } else {
88
+ const _temp5 = function () {
89
+ if (event.shiftKey) {
90
+ var _tableMeta$rowSelecti;
91
+ function _temp4() {
92
+ table.setRowSelection(currentRowSelection => ({
93
+ ...currentRowSelection,
94
+ ...selectedRows.reduce((state, row) => ({
95
+ ...state,
96
+ [row.id]: true
97
+ }), {})
98
+ }));
99
+ }
100
+ const [fromIndex, toIndex] = toggleBetween((_tableMeta$rowSelecti = tableMeta.rowSelection.lastSelectedRowIndex.current) !== null && _tableMeta$rowSelecti !== void 0 ? _tableMeta$rowSelecti : 0, rowIndex);
101
+ const selectedRows = table.getRowModel().rows.slice(fromIndex, toIndex + 1);
102
+ const _temp3 = function () {
103
+ if (tableMeta.server.loadAllIfNeeded && selectedRows.some(row => row.original === undefined)) {
104
+ // don't pass the search query because we need all data - not filtered data
105
+ return Promise.resolve(tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters, undefined)).then(function () {});
106
+ }
107
+ }();
108
+ return _temp3 && _temp3.then ? _temp3.then(_temp4) : _temp4(_temp3);
109
+ } else {
110
+ row.toggleSelected();
111
+ }
112
+ }();
113
+ if (_temp5 && _temp5.then) return _temp5.then(function () {});
114
+ }
115
+ }();
116
+ return Promise.resolve(_temp6 && _temp6.then ? _temp6.then(_temp7) : _temp7(_temp6));
117
+ } catch (e) {
118
+ return Promise.reject(e);
82
119
  }
83
- tableMeta.rowSelection.lastSelectedRowIndex.current = row.index;
84
120
  };
85
121
  return /*#__PURE__*/React__default.createElement(Tooltip, {
86
122
  title: /*#__PURE__*/React__default.createElement(React__default.Fragment, null, title, /*#__PURE__*/React__default.createElement(Shortcut, {
@@ -1 +1 @@
1
- {"version":3,"file":"Selection.js","sources":["../../../../../../../../../src/components/Report/components/Internal/Selection.tsx"],"sourcesContent":["import React from 'react';\nimport {\n HeaderContext as ReactTableHeaderContext,\n CellContext as ReactTableCellContext,\n TableMeta as ReactTableMeta,\n} from '@tanstack/react-table';\nimport cn from 'clsx';\nimport { useLocalization } from '../../../Provider/Localization';\nimport { Tooltip } from '../../../Tooltip/Tooltip';\nimport { Checkbox } from '../../../Checkbox/Checkbox';\nimport { Shortcut } from '../../../Shortcut/Shortcut';\nimport { getRadioClassnames } from '../../../RadioGroup/util';\n\nexport function Header<TType = unknown>(context: ReactTableHeaderContext<TType, unknown>) {\n const { texts } = useLocalization();\n const { table } = context;\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n\n if (table.options.enableMultiRowSelection) {\n const isAllRowsSelected = table.getIsAllRowsSelected();\n const isSomeRowsSelected = table.getIsSomeRowsSelected();\n const title = isAllRowsSelected ? texts.table3.columns.select.deselectAll : texts.table3.columns.select.selectAll;\n\n const handleChange = async (checked: boolean) => {\n // load all data if that is possible\n if (tableMeta.server.loadAllIfNeeded) {\n // don't pass the search query because we need all data - not filtered data\n await tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters, undefined);\n }\n\n table.toggleAllRowsSelected(checked);\n };\n\n return (\n <Tooltip title={title}>\n <Checkbox\n aria-label={title}\n className=\"hover:border-blue !-mt-px\"\n key={String(`${isAllRowsSelected}_${isSomeRowsSelected}`)}\n checked={isAllRowsSelected}\n indeterminate={isSomeRowsSelected}\n onChange={handleChange}\n />\n </Tooltip>\n );\n }\n\n return null;\n}\n\nconst toggleBetween = (fromRowIndex: number, toRowIndex: number): [number, number] => {\n const fromIndex = toRowIndex < fromRowIndex ? toRowIndex : fromRowIndex;\n const toIndex = toRowIndex > fromRowIndex ? toRowIndex : fromRowIndex;\n\n return [fromIndex, toIndex];\n};\n\nexport function Cell<TType = unknown>(context: ReactTableCellContext<TType, unknown>) {\n const { texts } = useLocalization();\n const { row, table } = context;\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n\n if (table.options.enableGrouping && table.getState().grouping?.length && !row.getIsGrouped()) {\n return null;\n }\n\n const isSelected = row.getIsGrouped() ? row.getIsAllSubRowsSelected() : row.getIsSelected();\n const title = isSelected ? texts.table3.columns.select.deselect : texts.table3.columns.select.select;\n\n if (table.options.enableMultiRowSelection) {\n const handleClick = (event: React.MouseEvent): void => {\n event.stopPropagation();\n\n if (row.getIsGrouped()) {\n row.subRows.forEach(row => row.toggleSelected());\n } else if (event.shiftKey) {\n const [fromIndex, toIndex] = toggleBetween(tableMeta.rowSelection.lastSelectedRowIndex.current ?? 0, row.index);\n\n table\n .getRowModel()\n .rows.slice(fromIndex, toIndex + 1)\n .forEach(row => row.toggleSelected(true));\n } else {\n row.toggleSelected();\n }\n\n tableMeta.rowSelection.lastSelectedRowIndex.current = row.index;\n };\n\n return (\n <Tooltip\n title={\n <>\n {title}\n <Shortcut className=\"ml-2\" keys=\"Space\" />\n </>\n }>\n <Checkbox\n aria-label={title}\n className=\"!mt-0\"\n checked={isSelected}\n onClick={handleClick}\n // this is necessary to remove console spam from eslint\n onChange={() => false}\n />\n </Tooltip>\n );\n } else {\n const className = cn('!mt-0', getRadioClassnames());\n\n const handleClick = (event: React.MouseEvent): void => {\n event.stopPropagation();\n row.toggleSelected();\n tableMeta.rowSelection.lastSelectedRowIndex.current = row.index;\n };\n\n return (\n <button className={className} aria-checked={isSelected} onClick={handleClick} role=\"radio\" type=\"button\">\n {isSelected ? <span className=\"h-2 w-2 rounded-full bg-white\" /> : null}\n </button>\n );\n }\n}\n"],"names":["Header","context","texts","useLocalization","table","tableMeta","options","meta","enableMultiRowSelection","isAllRowsSelected","getIsAllRowsSelected","isSomeRowsSelected","getIsSomeRowsSelected","title","table3","columns","select","deselectAll","selectAll","handleChange","checked","toggleAllRowsSelected","_temp","server","loadAllIfNeeded","Promise","resolve","getState","sorting","columnFilters","undefined","then","_temp2","e","reject","React","Tooltip","Checkbox","className","key","String","indeterminate","onChange","toggleBetween","fromRowIndex","toRowIndex","fromIndex","toIndex","Cell","row","enableGrouping","_table$getState$group","grouping","length","getIsGrouped","isSelected","getIsAllSubRowsSelected","getIsSelected","deselect","handleClick","event","stopPropagation","subRows","forEach","toggleSelected","shiftKey","_tableMeta$rowSelecti","rowSelection","lastSelectedRowIndex","current","index","getRowModel","rows","slice","Shortcut","keys","onClick","cn","getRadioClassnames","role","type"],"mappings":";;;;;;;;SAagBA,MAAMA,CAAkBC,OAAgD;EACpF,MAAM;IAAEC;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAM;IAAEC;GAAO,GAAGH,OAAO;EACzB,MAAMI,SAAS,GAAGD,KAAK,CAACE,OAAO,CAACC,IAA6B;EAE7D,IAAIH,KAAK,CAACE,OAAO,CAACE,uBAAuB,EAAE;IACvC,MAAMC,iBAAiB,GAAGL,KAAK,CAACM,oBAAoB,EAAE;IACtD,MAAMC,kBAAkB,GAAGP,KAAK,CAACQ,qBAAqB,EAAE;IACxD,MAAMC,KAAK,GAAGJ,iBAAiB,GAAGP,KAAK,CAACY,MAAM,CAACC,OAAO,CAACC,MAAM,CAACC,WAAW,GAAGf,KAAK,CAACY,MAAM,CAACC,OAAO,CAACC,MAAM,CAACE,SAAS;IAEjH,MAAMC,YAAY,aAAUC,OAAgB;MAAA;;UAOxChB,KAAK,CAACiB,qBAAqB,CAACD,OAAO,CAAC;;QAAC,MAAAE,KAAA;UAAA,IALjCjB,SAAS,CAACkB,MAAM,CAACC,eAAe;;YAChC,OAAAC,OAAA,CAAAC,OAAA,CACMrB,SAAS,CAACkB,MAAM,CAACC,eAAe,CAACpB,KAAK,CAACuB,QAAQ,EAAE,CAACC,OAAO,EAAExB,KAAK,CAACuB,QAAQ,EAAE,CAACE,aAAa,EAAEC,SAAS,CAAC,EAAAC,IAAA;;;;QAH/G,OAAAN,OAAA,CAAAC,OAAA,CAAAJ,KAAA,IAAAA,KAAA,CAAAS,IAAA,GAAAT,KAAA,CAAAS,IAAA,CAAAC,MAAA,IAAAA,MAAA,CAAAV,KAAA;OAOH,QAAAW,CAAA;QAAA,OAAAR,OAAA,CAAAS,MAAA,CAAAD,CAAA;;;IAED,oBACIE,6BAACC,OAAO;MAACvB,KAAK,EAAEA;oBACZsB,6BAACE,QAAQ;oBACOxB,KAAK;MACjByB,SAAS,EAAC,2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D,SAAS,CAAC8D,YAAY,CAACC,oBAAoB,CAACC,OAAO,GAAGpB,GAAG,CAACqB,KAAK;KAClE;IAED,oBACInC;MAAQG,SAAS,EAAEA,SAAS;sBAAgBiB,UAAU;MAAEqB,OAAO,EAAEjB,WAAW;MAAEoB,IAAI,EAAC,OAAO;MAACC,IAAI,EAAC;OAC3FzB,UAAU,gBAAGpB;MAAMG,SAAS,EAAC;MAAkC,GAAG,IAAI,CAClE;;AAGrB;;;;"}
1
+ {"version":3,"file":"Selection.js","sources":["../../../../../../../../../src/components/Report/components/Internal/Selection.tsx"],"sourcesContent":["import React from 'react';\nimport {\n HeaderContext as ReactTableHeaderContext,\n CellContext as ReactTableCellContext,\n TableMeta as ReactTableMeta,\n RowSelectionState,\n} from '@tanstack/react-table';\nimport cn from 'clsx';\nimport { useLocalization } from '../../../Provider/Localization';\nimport { Tooltip } from '../../../Tooltip/Tooltip';\nimport { Checkbox } from '../../../Checkbox/Checkbox';\nimport { Shortcut } from '../../../Shortcut/Shortcut';\nimport { getRadioClassnames } from '../../../RadioGroup/util';\nimport { TableServerLoadAllState } from '../../../../primitives/Table/types';\nimport { RowContext } from '../Row/RowContext';\n\nexport function Header<TType = unknown>(context: ReactTableHeaderContext<TType, unknown>) {\n const { texts } = useLocalization();\n const { table } = context;\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n\n if (table.options.enableMultiRowSelection) {\n const isAllRowsSelected = table.getIsAllRowsSelected();\n const isSomeRowsSelected = table.getIsSomeRowsSelected();\n const title = isAllRowsSelected ? texts.table3.columns.select.deselectAll : texts.table3.columns.select.selectAll;\n\n const handleChange = async (checked: boolean) => {\n // load all data if that is possible\n if (tableMeta.server.loadAllIfNeeded) {\n // don't pass the search query because we need all data - not filtered data\n await tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters, undefined);\n }\n\n table.toggleAllRowsSelected(checked);\n };\n\n return (\n <Tooltip title={title}>\n <Checkbox\n aria-label={title}\n className=\"hover:border-blue !-mt-px\"\n key={String(`${isAllRowsSelected}_${isSomeRowsSelected}`)}\n checked={isAllRowsSelected}\n indeterminate={isSomeRowsSelected}\n loading={tableMeta.server.loadAllStatus === TableServerLoadAllState.Loading}\n onChange={handleChange}\n />\n </Tooltip>\n );\n }\n\n return null;\n}\n\nconst toggleBetween = (fromRowIndex: number, toRowIndex: number): [number, number] => {\n const fromIndex = toRowIndex < fromRowIndex ? toRowIndex : fromRowIndex;\n const toIndex = toRowIndex > fromRowIndex ? toRowIndex : fromRowIndex;\n\n return [fromIndex, toIndex];\n};\n\nexport function Cell<TType = unknown>(context: ReactTableCellContext<TType, unknown>) {\n const { texts } = useLocalization();\n const { row, table } = context;\n const { rowIndex } = React.useContext(RowContext);\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n\n if (table.options.enableGrouping && table.getState().grouping?.length && !row.getIsGrouped()) {\n return null;\n }\n\n const isSelected = row.getIsGrouped() ? row.getIsAllSubRowsSelected() : row.getIsSelected();\n const title = isSelected ? texts.table3.columns.select.deselect : texts.table3.columns.select.select;\n\n if (table.options.enableMultiRowSelection) {\n const handleClick = async (event: React.MouseEvent) => {\n event.stopPropagation();\n\n if (row.getIsGrouped()) {\n row.subRows.forEach(row => row.toggleSelected());\n } else if (event.shiftKey) {\n const [fromIndex, toIndex] = toggleBetween(tableMeta.rowSelection.lastSelectedRowIndex.current ?? 0, rowIndex);\n const selectedRows = table.getRowModel().rows.slice(fromIndex, toIndex + 1);\n\n if (tableMeta.server.loadAllIfNeeded && selectedRows.some(row => row.original === undefined)) {\n // don't pass the search query because we need all data - not filtered data\n await tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters, undefined);\n }\n\n table.setRowSelection((currentRowSelection: RowSelectionState) => ({\n ...currentRowSelection,\n ...selectedRows.reduce((state, row) => ({ ...state, [row.id]: true }), {}),\n }));\n } else {\n row.toggleSelected();\n }\n\n tableMeta.rowSelection.lastSelectedRowIndex.current = row.index;\n };\n\n return (\n <Tooltip\n title={\n <>\n {title}\n <Shortcut className=\"ml-2\" keys=\"Space\" />\n </>\n }>\n <Checkbox\n aria-label={title}\n className=\"!mt-0\"\n checked={isSelected}\n onClick={handleClick}\n // this is necessary to remove console spam from eslint\n onChange={() => false}\n />\n </Tooltip>\n );\n } else {\n const className = cn('!mt-0', getRadioClassnames());\n\n const handleClick = (event: React.MouseEvent): void => {\n event.stopPropagation();\n row.toggleSelected();\n tableMeta.rowSelection.lastSelectedRowIndex.current = row.index;\n };\n\n return (\n <button className={className} aria-checked={isSelected} onClick={handleClick} role=\"radio\" type=\"button\">\n {isSelected ? <span className=\"h-2 w-2 rounded-full bg-white\" /> : null}\n </button>\n );\n }\n}\n"],"names":["Header","context","texts","useLocalization","table","tableMeta","options","meta","enableMultiRowSelection","isAllRowsSelected","getIsAllRowsSelected","isSomeRowsSelected","getIsSomeRowsSelected","title","table3","columns","select","deselectAll","selectAll","handleChange","checked","toggleAllRowsSelected","_temp","server","loadAllIfNeeded","Promise","resolve","getState","sorting","columnFilters","undefined","then","_temp2","e","reject","React","Tooltip","Checkbox","className","key","String","indeterminate","loading","loadAllStatus","TableServerLoadAllState","Loading","onChange","toggleBetween","fromRowIndex","toRowIndex","fromIndex","toIndex","Cell","row","rowIndex","useContext","RowContext","enableGrouping","_table$getState$group","grouping","length","getIsGrouped","isSelected","getIsAllSubRowsSelected","getIsSelected","deselect","handleClick","event","rowSelection","lastSelectedRowIndex","current","index","stopPropagation","_temp6","subRows","forEach","toggleSelected","_temp5","shiftKey","_tableMeta$rowSelecti","_temp4","setRowSelection","currentRowSelection","selectedRows","reduce","state","id","getRowModel","rows","slice","_temp3","some","original","_temp7","Shortcut","keys","onClick","cn","getRadioClassnames","role","type"],"mappings":";;;;;;;;;;SAgBgBA,MAAMA,CAAkBC,OAAgD;EACpF,MAAM;IAAEC;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAM;IAAEC;GAAO,GAAGH,OAAO;EACzB,MAAMI,SAAS,GAAGD,KAAK,CAACE,O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@ -7,8 +7,14 @@ import { isInternalColumn } from '../../../../../../primitives/Table/useTable/ut
7
7
  import { TableFilterComparator } from '../../../../../../primitives/Table/types.js';
8
8
  import { sortByHeader } from './util.js';
9
9
  import { Filter } from './components/Filter.js';
10
- import { Placeholder } from './components/Placeholder.js';
11
10
 
11
+ const placeholderFilter = {
12
+ id: '',
13
+ value: {
14
+ comparator: TableFilterComparator.Contains,
15
+ value: undefined
16
+ }
17
+ };
12
18
  function ManageFiltersPopover(props) {
13
19
  const {
14
20
  length,
@@ -22,52 +28,40 @@ function ManageFiltersPopover(props) {
22
28
  const allColumns = table.getAllLeafColumns().filter(column => !isInternalColumn(column.id)).sort(sortByHeader);
23
29
  const appliedFilters = table.getState().columnFilters;
24
30
  // state, since we "apply" filters - our filter values have a special shape, so we force to our type
25
- const [filters, setFilters] = React__default.useState(table.getState().columnFilters);
26
- const [placeholderCount, setPlaceholderCount] = React__default.useState(1);
31
+ const [filters, setFilters] = React__default.useState(appliedFilters.length ? appliedFilters : [placeholderFilter]);
27
32
  // filters might reset from the outside
28
33
  React__default.useEffect(() => {
29
34
  if (appliedFilters.length === 0) {
30
- setFilters([]);
31
- setPlaceholderCount(1);
35
+ setFilters([placeholderFilter]);
32
36
  }
33
37
  }, [appliedFilters]);
34
38
  // filters
35
- const handleChangeFilter = (currentId, filter) => {
39
+ const handleChangeFilter = (position, filter) => {
36
40
  setFilters(currentFilters => {
37
- const nextFilters = [...currentFilters];
38
- nextFilters[nextFilters.findIndex(f => f.id === currentId)] = filter;
39
- return nextFilters;
41
+ return currentFilters.map((current, index) => {
42
+ if (index === position) {
43
+ return filter;
44
+ }
45
+ return current;
46
+ });
40
47
  });
41
48
  };
42
- const handleRemoveFilter = columnId => {
43
- if (filters.length === 1 && placeholderCount === 0) {
44
- setPlaceholderCount(count => count + 1);
49
+ const handleRemoveFilter = position => {
50
+ if (filters.length === 1) {
51
+ setFilters([placeholderFilter]);
52
+ return;
45
53
  }
46
- setFilters(currentFilters => currentFilters.filter(f => f.id !== columnId));
47
- };
48
- // placeholders
49
- const handleCreateFilterFromPlaceholder = columnId => {
50
- setFilters(currentFilters => [...currentFilters, {
51
- id: columnId,
52
- value: {
53
- comparator: TableFilterComparator.Contains,
54
- value: undefined
55
- }
56
- }]);
57
- handleRemovePlaceholder();
54
+ setFilters(currentFilters => currentFilters.filter((_, index) => index !== position));
58
55
  };
59
- const handleCreatePlaceholder = () => {
60
- setPlaceholderCount(count => count + 1);
61
- };
62
- const handleRemovePlaceholder = () => {
63
- setPlaceholderCount(count => count - 1);
56
+ const handleCreate = () => {
57
+ setFilters(filters.concat(placeholderFilter));
64
58
  };
65
59
  //
66
60
  const handleApply = () => {
67
61
  table.setColumnFilters(() => {
68
62
  const newFilters = filters.filter(f => {
69
63
  var _allColumns$find, _allColumns$find$colu;
70
- if (f.id === null) {
64
+ if (f.id === null || f.id === '') {
71
65
  return false;
72
66
  }
73
67
  const controlRenderer = (_allColumns$find = allColumns.find(c => c.id === f.id)) === null || _allColumns$find === void 0 ? void 0 : (_allColumns$find$colu = _allColumns$find.columnDef.meta) === null || _allColumns$find$colu === void 0 ? void 0 : _allColumns$find$colu.control;
@@ -81,12 +75,10 @@ function ManageFiltersPopover(props) {
81
75
  };
82
76
  const handleClear = () => {
83
77
  table.resetColumnFilters();
84
- setFilters([]);
85
- setPlaceholderCount(1);
78
+ setFilters([placeholderFilter]);
86
79
  };
87
80
  const handleClose = () => {
88
- setFilters(appliedFilters);
89
- setPlaceholderCount(appliedFilters.length ? 0 : 1);
81
+ setFilters(appliedFilters.length === 0 ? [placeholderFilter] : appliedFilters);
90
82
  };
91
83
  return /*#__PURE__*/React__default.createElement(Popover, Object.assign({}, popoverProps, {
92
84
  onChange: handleClose
@@ -109,19 +101,12 @@ function ManageFiltersPopover(props) {
109
101
  filters: filters,
110
102
  position: index,
111
103
  onChange: handleChangeFilter,
112
- onRemove: handleRemoveFilter
113
- }))), [...Array(placeholderCount)].map((_, index) => ( /*#__PURE__*/React__default.createElement(Placeholder, {
114
- key: `placeholder_${index}`,
115
- allColumns: allColumns,
116
- filters: filters,
117
- position: filters.length + index,
118
- onCreate: handleCreateFilterFromPlaceholder,
119
- onRemove: placeholderCount > 1 || filters.length > 0 ? handleRemovePlaceholder : undefined
104
+ onRemove: filters.length > 0 && filters.some(f => f.id) || filters.length > 1 ? handleRemoveFilter : undefined
120
105
  }))), /*#__PURE__*/React__default.createElement("div", {
121
106
  className: "justify-start"
122
107
  }, /*#__PURE__*/React__default.createElement(Button, {
123
108
  appearance: "discrete",
124
- onClick: handleCreatePlaceholder
109
+ onClick: handleCreate
125
110
  }, "+ ", texts.table3.filters.buttons.addFilter))), /*#__PURE__*/React__default.createElement(Group, {
126
111
  className: "ml-auto"
127
112
  }, /*#__PURE__*/React__default.createElement(Popover.Close, null, /*#__PURE__*/React__default.createElement(Button, null, "Cancel")), /*#__PURE__*/React__default.createElement(Button, {