@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":"ManageFiltersPopover.js","sources":["../../../../../../../../../../../src/components/Report/components/Toolbar/components/Filters/ManageFiltersPopover.tsx"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable } from '@tanstack/react-table';\nimport { Popover } from '../../../../../Popover/Popover';\nimport { useLocalization } from '../../../../../Provider/Localization';\nimport { Button } from '../../../../../Button/Button';\nimport { Group } from '../../../../../Group/Group';\nimport { sortByHeader } from './util';\nimport { isInternalColumn } from '../../../../../../primitives/Table/useTable/util/columns';\nimport { TableFilter, TableFilterComparator, TableFilterValue } from '../../../../../../primitives/Table/types';\nimport { Filter } from './components/Filter';\nimport { Placeholder } from './components/Placeholder';\n\nexport type ManageFiltersPopoverProps<TType = unknown> = {\n length: number;\n table: ReactTable<TType>;\n};\n\nexport function ManageFiltersPopover<TType = unknown>(props: ManageFiltersPopoverProps<TType>) {\n const { length, table, ...popoverProps } = props;\n const { locale, texts } = useLocalization();\n\n const allColumns = table\n .getAllLeafColumns()\n .filter(column => !isInternalColumn(column.id))\n .sort(sortByHeader);\n\n const appliedFilters = table.getState().columnFilters as TableFilter[];\n\n // state, since we \"apply\" filters - our filter values have a special shape, so we force to our type\n const [filters, setFilters] = React.useState<TableFilter[]>(table.getState().columnFilters as TableFilter[]);\n const [placeholderCount, setPlaceholderCount] = React.useState(1);\n\n // filters might reset from the outside\n React.useEffect(() => {\n if (appliedFilters.length === 0) {\n setFilters([]);\n setPlaceholderCount(1);\n }\n }, [appliedFilters]);\n\n // filters\n const handleChangeFilter = (currentId: string | null, filter: { id: string; value: TableFilterValue }) => {\n setFilters(currentFilters => {\n const nextFilters = [...currentFilters];\n nextFilters[nextFilters.findIndex(f => f.id === currentId)] = filter;\n return nextFilters;\n });\n };\n\n const handleRemoveFilter = (columnId: string | null) => {\n if (filters.length === 1 && placeholderCount === 0) {\n setPlaceholderCount(count => count + 1);\n }\n\n setFilters(currentFilters => currentFilters.filter(f => f.id !== columnId));\n };\n\n // placeholders\n const handleCreateFilterFromPlaceholder = (columnId: string) => {\n setFilters(currentFilters => [\n ...currentFilters,\n {\n id: columnId,\n value: {\n comparator: TableFilterComparator.Contains,\n value: undefined,\n },\n },\n ]);\n handleRemovePlaceholder();\n };\n\n const handleCreatePlaceholder = () => {\n setPlaceholderCount(count => count + 1);\n };\n\n const handleRemovePlaceholder = () => {\n setPlaceholderCount(count => count - 1);\n };\n\n //\n const handleApply = () => {\n table.setColumnFilters(() => {\n const newFilters = filters.filter(f => {\n if (f.id === null) {\n return false;\n }\n\n const controlRenderer = allColumns.find(c => c.id === f.id)?.columnDef.meta?.control;\n\n if (\n f.value.comparator === TableFilterComparator.IsEmpty ||\n f.value.comparator === TableFilterComparator.IsNotEmpty ||\n controlRenderer === 'switch'\n ) {\n return true;\n }\n\n return !!f.value.value;\n });\n\n return newFilters;\n });\n };\n\n const handleClear = () => {\n table.resetColumnFilters();\n setFilters([]);\n setPlaceholderCount(1);\n };\n\n const handleClose = () => {\n setFilters(appliedFilters);\n setPlaceholderCount(appliedFilters.length ? 0 : 1);\n };\n\n return (\n <Popover {...popoverProps} onChange={handleClose}>\n <Popover.Content>\n <div className=\"flex w-[40rem] flex-col gap-4\">\n <div className=\"flex h-8\">\n <div className=\"flex w-full items-center gap-2\">\n <h4 className=\"mb-0 inline-flex\">{texts.table3.filters.button}</h4>\n <p className=\"text-grey-700 mb-0 mr-auto mt-px inline-flex\">\n {texts.table3.filters.total\n .replace(\n '[CURRENT]',\n new Intl.NumberFormat(locale).format(table.getFilteredRowModel().rows.length)\n )\n .replace('[TOTAL]', new Intl.NumberFormat(locale).format(length))}\n </p>\n </div>\n </div>\n <div className=\"flex flex-col gap-2\">\n {filters.map((filter, index) => (\n <Filter\n key={`filter_${index}`}\n allColumns={allColumns}\n filter={filter}\n filters={filters}\n position={index}\n onChange={handleChangeFilter}\n onRemove={handleRemoveFilter}\n />\n ))}\n {[...Array(placeholderCount)].map((_, index) => (\n <Placeholder\n key={`placeholder_${index}`}\n allColumns={allColumns}\n filters={filters}\n position={filters.length + index}\n onCreate={handleCreateFilterFromPlaceholder as any}\n onRemove={placeholderCount > 1 || filters.length > 0 ? handleRemovePlaceholder : undefined}\n />\n ))}\n <div className=\"justify-start\">\n <Button appearance=\"discrete\" onClick={handleCreatePlaceholder}>\n + {texts.table3.filters.buttons.addFilter}\n </Button>\n </div>\n </div>\n <Group className=\"ml-auto\">\n <Popover.Close>\n <Button>Cancel</Button>\n </Popover.Close>\n <Button onClick={handleClear}>Clear</Button>\n <Button appearance=\"primary\" onClick={handleApply}>\n Apply\n </Button>\n </Group>\n </div>\n </Popover.Content>\n </Popover>\n );\n}\n"],"names":["ManageFiltersPopover","props","length","table","popoverProps","locale","texts","useLocalization","allColumns","getAllLeafColumns","filter","column","isInternalColumn","id","sort","sortByHeader","appliedFilters","getState","columnFilters","filters","setFilters","React","useState","placeholderCount","setPlaceholderCount","useEffect","handleChangeFilter","currentId","currentFilters","nextFilters","findIndex","f","handleRemoveFilter","columnId","count","handleCreateFilterFromPlaceholder","value","comparator","TableFilterComparator","Contains","undefined","handleRemovePlaceholder","handleCreatePlaceholder","handleApply","setColumnFilters","newFilters","controlRenderer","_allColumns$find","find","c","_allColumns$find$colu","columnDef","meta","control","IsEmpty","IsNotEmpty","handleClear","resetColumnFilters","handleClose","Popover","onChange","Content","className","table3","button","total","replace","Intl","NumberFormat","format","getFilteredRowModel","rows","map","index","Filter","key","position","onRemove","Array","_","Placeholder","onCreate","Button","appearance","onClick","buttons","addFilter","Group","Close"],"mappings":";;;;;;;;;;;SAiBgBA,oBAAoBA,CAAkBC,KAAuC;EACzF,MAAM;IAAEC,MAAM;IAAEC,KAAK;IAAE,GAAGC;GAAc,GAAGH,KAAK;EAChD,MAAM;IAAEI,MAAM;IAAEC;GAAO,GAAGC,eAAe,EAAE;EAE3C,MAAMC,UAAU,GAAGL,KAAK,CACnBM,iBAAiB,EAAE,CACnBC,MAAM,CAACC,MAAM,IAAI,CAACC,gBAAgB,CAACD,MAAM,CAACE,E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;IAC3BjE,UAAU,EAAEA,UAAU;IACtBW,OAAO,EAAEA,OAAO;IAChByD,QAAQ,EAAEzD,OAAO,CAACjB,MAAM,GAAGuE,KAAK;IAChCQ,QAAQ,EAAE9C,iCAAwC;IAClD0C,QAAQ,EAAEtD,gBAAgB,GAAG,CAAC,IAAIJ,OAAO,CAACjB,MAAM,GAAG,CAAC,GAAGuC,uBAAuB,GAAGD;IACnF,CACL,CAAC,eACFnB;IAAKyC,SAAS,EAAC;kBACXzC,6BAAC6D,MAAM;IAACC,UAAU,EAAC,UAAU;IAACC,OAAO,EAAE1C;WAChCpC,KAAK,CAACyD,MAAM,CAAC5C,OAAO,CAACkE,OAAO,CAACC,SAAS,CACpC,CACP,CACJ,eACNjE,6BAACkE,KAAK;IAACzB,SAAS,EAAC;kBACbzC,6BAACsC,OAAO,CAAC6B,KAAK,qBACVnE,6BAAC6D,MAAM,iBAAgB,CACX,eAChB7D,6BAAC6D,MAAM;IAACE,OAAO,EAAE5B;aAA2B,eAC5CnC,6BAAC6D,MAAM;IAACC,UAAU,EAAC,SAAS;IAACC,OAAO,EAAEzC;aAE7B,CACL,CACN,CACQ,CACZ;AAElB;;;;"}
1
+ {"version":3,"file":"ManageFiltersPopover.js","sources":["../../../../../../../../../../../src/components/Report/components/Toolbar/components/Filters/ManageFiltersPopover.tsx"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable } from '@tanstack/react-table';\nimport { Popover } from '../../../../../Popover/Popover';\nimport { useLocalization } from '../../../../../Provider/Localization';\nimport { Button } from '../../../../../Button/Button';\nimport { Group } from '../../../../../Group/Group';\nimport { sortByHeader } from './util';\nimport { isInternalColumn } from '../../../../../../primitives/Table/useTable/util/columns';\nimport { TableFilter, TableFilterComparator, TableFilterValue } from '../../../../../../primitives/Table/types';\nimport { Filter } from './components/Filter';\n\nexport type ManageFiltersPopoverProps<TType = unknown> = {\n length: number;\n table: ReactTable<TType>;\n};\n\nconst placeholderFilter: TableFilter = { id: '', value: { comparator: TableFilterComparator.Contains, value: undefined } };\n\nexport function ManageFiltersPopover<TType = unknown>(props: ManageFiltersPopoverProps<TType>) {\n const { length, table, ...popoverProps } = props;\n const { locale, texts } = useLocalization();\n\n const allColumns = table\n .getAllLeafColumns()\n .filter(column => !isInternalColumn(column.id))\n .sort(sortByHeader);\n\n const appliedFilters = table.getState().columnFilters as TableFilter[];\n\n // state, since we \"apply\" filters - our filter values have a special shape, so we force to our type\n const [filters, setFilters] = React.useState<TableFilter[]>(appliedFilters.length ? appliedFilters : [placeholderFilter]);\n\n // filters might reset from the outside\n React.useEffect(() => {\n if (appliedFilters.length === 0) {\n setFilters([placeholderFilter]);\n }\n }, [appliedFilters]);\n\n // filters\n const handleChangeFilter = (position: number, filter: { id: string; value: TableFilterValue }) => {\n setFilters(currentFilters => {\n return currentFilters.map((current, index) => {\n if (index === position) {\n return filter;\n }\n return current;\n });\n });\n };\n\n const handleRemoveFilter = position => {\n if (filters.length === 1) {\n setFilters([placeholderFilter]);\n return;\n }\n\n setFilters(currentFilters => currentFilters.filter((_, index) => index !== position));\n };\n\n const handleCreate = () => {\n setFilters(filters.concat(placeholderFilter));\n };\n\n //\n const handleApply = () => {\n table.setColumnFilters(() => {\n const newFilters = filters.filter(f => {\n if (f.id === null || f.id === '') {\n return false;\n }\n\n const controlRenderer = allColumns.find(c => c.id === f.id)?.columnDef.meta?.control;\n\n if (\n f.value.comparator === TableFilterComparator.IsEmpty ||\n f.value.comparator === TableFilterComparator.IsNotEmpty ||\n controlRenderer === 'switch'\n ) {\n return true;\n }\n\n return !!f.value.value;\n });\n\n return newFilters;\n });\n };\n\n const handleClear = () => {\n table.resetColumnFilters();\n setFilters([placeholderFilter]);\n };\n\n const handleClose = () => {\n setFilters(appliedFilters.length === 0 ? [placeholderFilter] : appliedFilters);\n };\n\n return (\n <Popover {...popoverProps} onChange={handleClose}>\n <Popover.Content>\n <div className=\"flex w-[40rem] flex-col gap-4\">\n <div className=\"flex h-8\">\n <div className=\"flex w-full items-center gap-2\">\n <h4 className=\"mb-0 inline-flex\">{texts.table3.filters.button}</h4>\n <p className=\"text-grey-700 mb-0 mr-auto mt-px inline-flex\">\n {texts.table3.filters.total\n .replace(\n '[CURRENT]',\n new Intl.NumberFormat(locale).format(table.getFilteredRowModel().rows.length)\n )\n .replace('[TOTAL]', new Intl.NumberFormat(locale).format(length))}\n </p>\n </div>\n </div>\n <div className=\"flex flex-col gap-2\">\n {filters.map((filter, index) => (\n <Filter\n key={`filter_${index}`}\n allColumns={allColumns}\n filter={filter}\n filters={filters}\n position={index}\n onChange={handleChangeFilter}\n onRemove={\n (filters.length > 0 && filters.some(f => f.id)) || filters.length > 1\n ? handleRemoveFilter\n : undefined\n }\n />\n ))}\n <div className=\"justify-start\">\n <Button appearance=\"discrete\" onClick={handleCreate}>\n + {texts.table3.filters.buttons.addFilter}\n </Button>\n </div>\n </div>\n <Group className=\"ml-auto\">\n <Popover.Close>\n <Button>Cancel</Button>\n </Popover.Close>\n <Button onClick={handleClear}>Clear</Button>\n <Button appearance=\"primary\" onClick={handleApply}>\n Apply\n </Button>\n </Group>\n </div>\n </Popover.Content>\n </Popover>\n );\n}\n"],"names":["placeholderFilter","id","value","comparator","TableFilterComparator","Contains","undefined","ManageFiltersPopover","props","length","table","popoverProps","locale","texts","useLocalization","allColumns","getAllLeafColumns","filter","column","isInternalColumn","sort","sortByHeader","appliedFilters","getState","columnFilters","filters","setFilters","React","useState","useEffect","handleChangeFilter","position","currentFilters","map","current","index","handleRemoveFilter","_","handleCreate","concat","handleApply","setColumnFilters","newFilters","f","controlRenderer","_allColumns$find","find","c","_allColumns$find$colu","columnDef","meta","control","IsEmpty","IsNotEmpty","handleClear","resetColumnFilters","handleClose","Popover","onChange","Content","className","table3","button","total","replace","Intl","NumberFormat","format","getFilteredRowModel","rows","Filter","key","onRemove","some","Button","appearance","onClick","buttons","addFilter","Group","Close"],"mappings":";;;;;;;;;;AAgBA,MAAMA,iBAAiB,GAAgB;EAAEC,EAAE,EAAE,EAAE;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C,UAAU,EAAC,UAAU;IAACC,OAAO,EAAEtC;WAChCzB,KAAK,CAACgD,MAAM,CAACpC,OAAO,CAACoD,OAAO,CAACC,SAAS,CACpC,CACP,CACJ,eACNnD,6BAACoD,KAAK;IAACnB,SAAS,EAAC;kBACbjC,6BAAC8B,OAAO,CAACuB,KAAK,qBACVrD,6BAAC+C,MAAM,iBAAgB,CACX,eAChB/C,6BAAC+C,MAAM;IAACE,OAAO,EAAEtB;aAA2B,eAC5C3B,6BAAC+C,MAAM;IAACC,UAAU,EAAC,SAAS;IAACC,OAAO,EAAEpC;aAE7B,CACL,CACN,CACQ,CACZ;AAElB;;;;"}
@@ -19,6 +19,7 @@ function Filter(props) {
19
19
  texts
20
20
  } = useLocalization();
21
21
  const column = allColumns.find(c => c.id === filter.id);
22
+ const ref = React__default.useRef(null);
22
23
  const {
23
24
  id,
24
25
  value: {
@@ -37,7 +38,7 @@ function Filter(props) {
37
38
  comparator: TableFilterComparator.Contains,
38
39
  value: undefined
39
40
  };
40
- handleChange(id, {
41
+ handleChange(position, {
41
42
  id: columnId,
42
43
  value
43
44
  });
@@ -47,7 +48,7 @@ function Filter(props) {
47
48
  if (comparator === TableFilterComparator.IsEmpty || comparator === TableFilterComparator.IsNotEmpty) {
48
49
  nextValue = undefined;
49
50
  }
50
- handleChange(id, {
51
+ handleChange(position, {
51
52
  id,
52
53
  value: {
53
54
  comparator,
@@ -56,7 +57,7 @@ function Filter(props) {
56
57
  });
57
58
  };
58
59
  const handleChangeValue = value => {
59
- handleChange(id, {
60
+ handleChange(position, {
60
61
  id,
61
62
  value: {
62
63
  ...filter.value,
@@ -64,7 +65,12 @@ function Filter(props) {
64
65
  }
65
66
  });
66
67
  };
67
- const handleRemove = () => onRemove(id);
68
+ const handleRemove = () => onRemove === null || onRemove === void 0 ? void 0 : onRemove(position);
69
+ React__default.useEffect(() => {
70
+ if (ref.current && !id) {
71
+ ref.current.focus(); // after adding a new filter placeholder, we want to focus it right way.
72
+ }
73
+ }, [id]);
68
74
  return /*#__PURE__*/React__default.createElement("div", {
69
75
  className: "flex items-start gap-2"
70
76
  }, /*#__PURE__*/React__default.createElement("div", {
@@ -73,7 +79,8 @@ function Filter(props) {
73
79
  allColumns: allColumns,
74
80
  filters: filters,
75
81
  onChange: handleChangeColumn,
76
- value: id
82
+ value: id,
83
+ ref: ref
77
84
  }), /*#__PURE__*/React__default.createElement(FilterComparator, {
78
85
  column: column,
79
86
  onChange: handleChangeComparator,
@@ -83,12 +90,12 @@ function Filter(props) {
83
90
  comparator: comparator,
84
91
  onChange: handleChangeValue,
85
92
  value: value
86
- }), /*#__PURE__*/React__default.createElement(IconButton, {
93
+ }), onRemove ? /*#__PURE__*/React__default.createElement(IconButton, {
87
94
  appearance: "discrete",
88
95
  className: "ml-auto",
89
96
  icon: "close",
90
97
  onClick: handleRemove
91
- }));
98
+ }) : null);
92
99
  }
93
100
 
94
101
  export { Filter };
@@ -1 +1 @@
1
- {"version":3,"file":"Filter.js","sources":["../../../../../../../../../../../../src/components/Report/components/Toolbar/components/Filters/components/Filter.tsx"],"sourcesContent":["import React from 'react';\nimport { Column as ReactTableColumn } from '@tanstack/react-table';\nimport { IconButton } from '../../../../../../IconButton/IconButton';\nimport { useLocalization } from '../../../../../../Provider/Localization';\nimport { FilterColumn } from './FilterColumn';\nimport { FilterComparator } from './FilterComparator';\nimport { FilterValue } from './FilterValue';\nimport { TableFilter, TableFilterComparator } from '../../../../../../../primitives/Table/types';\n\nexport type FilterProps<TType = unknown> = {\n allColumns: ReactTableColumn<TType, unknown>[];\n filter: TableFilter;\n filters: TableFilter[];\n position: number;\n onChange: (id: string, value: TableFilter) => void;\n onRemove: (columnId: string) => void;\n};\n\nexport function Filter<TType = unknown>(props: FilterProps<TType>) {\n const { allColumns, filter, filters, onChange: handleChange, onRemove, position } = props;\n const { texts } = useLocalization();\n const column = allColumns.find(c => c.id === filter.id);\n\n const {\n id,\n value: { comparator, value },\n } = filter;\n\n const handleChangeColumn = (columnId: string) => {\n const previousColumn = allColumns.find(column => column.id === id);\n const nextColumn = allColumns.find(column => column.id === columnId);\n // UX requirement: if old column data type is the same as next column data type,\n // then we applying the same filter value for the next column,\n // but when data types are different, we're reseting comparator ans value for the next column\n const value =\n previousColumn?.columnDef.meta?.dataType === nextColumn?.columnDef.meta?.dataType\n ? filter.value\n : {\n comparator: TableFilterComparator.Contains,\n value: undefined,\n };\n\n handleChange(id, { id: columnId, value });\n };\n\n const handleChangeComparator = (comparator: TableFilterComparator) => {\n let nextValue = filter.value.value;\n\n if (comparator === TableFilterComparator.IsEmpty || comparator === TableFilterComparator.IsNotEmpty) {\n nextValue = undefined;\n }\n handleChange(id, { id, value: { comparator, value: nextValue } });\n };\n\n const handleChangeValue = (value: any) => {\n handleChange(id, { id, value: { ...filter.value, value } });\n };\n\n const handleRemove = () => onRemove(id);\n\n return (\n <div className=\"flex items-start gap-2\">\n <div className=\"flex min-h-[theme(spacing.8)] w-14 flex-shrink-0 items-center justify-end pr-2 text-right\">\n {position > 0 ? texts.table3.filters.conditions.and : texts.table3.filters.conditions.where}\n </div>\n <FilterColumn allColumns={allColumns} filters={filters} onChange={handleChangeColumn as any} value={id} />\n <FilterComparator column={column} onChange={handleChangeComparator as any} value={comparator} />\n <FilterValue column={column} comparator={comparator} onChange={handleChangeValue} value={value} />\n <IconButton appearance=\"discrete\" className=\"ml-auto\" icon=\"close\" onClick={handleRemove} />\n </div>\n );\n}\n"],"names":["Filter","props","allColumns","filter","filters","onChange","handleChange","onRemove","position","texts","useLocalization","column","find","c","id","value","comparator","handleChangeColumn","columnId","previousColumn","nextColumn","_previousColumn$colum","columnDef","meta","dataType","_nextColumn$columnDef","TableFilterComparator","Contains","undefined","handleChangeComparator","nextValue","IsEmpty","IsNotEmpty","handleChangeValue","handleRemove","React","className","table3","conditions","and","where","FilterColumn","FilterComparator","FilterValue","IconButton","appearance","icon","onClick"],"mappings":";;;;;;;;SAkBgBA,MAAMA,CAAkBC,KAAyB;EAC7D,MAAM;IAAEC,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CAACM,UAAU,EAAE;MACjGF,SAAS,GAAGF,SAAS;;IAEzBtB,YAAY,CAACQ,EAAE,EAAE;MAAEA,EAAE;MAAEC,KAAK,EAAE;QAAEC,UAAU;QAAED,KAAK,EAAEe;;KAAa,CAAC;GACpE;EAED,MAAMG,iBAAiB,GAAIlB,KAAU;IACjCT,YAAY,CAACQ,EAAE,EAAE;MAAEA,EAAE;MAAEC,KAAK,EAAE;QAAE,GAAGZ,MAAM,CAACY,KAAK;QAAEA;;KAAS,CAAC;GAC9D;EAED,MAAMmB,YAAY,GAAGA,MAAM3B,QAAQ,CAACO,EAAE,CAAC;EAEvC,oBACIqB;IAAKC,SAAS,EAAC;kBACXD;IAAKC,SAAS,EAAC;KACV5B,QAAQ,GAAG,CAAC,GAAGC,KAAK,CAAC4B,MAAM,CAACjC,OAAO,CAACkC,UAAU,CAACC,GAAG,GAAG9B,KAAK,CAAC4B,MAAM,CAACjC,OAAO,CAACkC,UAAU,CAACE,KAAK,CACzF,eACNL,6BAACM,YAAY;IAACvC,UAAU,EAAEA,UAAU;IAAEE,OAAO,EAAEA,OAAO;IAAEC,QAAQ,EAAEY,kBAAyB;IAAEF,KAAK,EAAED;IAAM,eAC1GqB,6BAACO,gBAAgB;IAAC/B,MAAM,EAAEA,MAAM;IAAEN,QAAQ,EAAEwB,sBAA6B;IAAEd,KAAK,EAAEC;IAAc,eAChGmB,6BAACQ,WAAW;IAAChC,MAAM,EAAEA,MAAM;IAAEK,UAAU,EAAEA,UAAU;IAAEX,QAAQ,EAAE4B,iBAAiB;IAAElB,KAAK,EAAEA;IAAS,eAClGoB,6BAACS,UAAU;IAACC,UAAU,EAAC,UAAU;IAACT,SAAS,EAAC,SAAS;IAACU,IAAI,EAAC,OAAO;IAACC,OAAO,EAAEb;IAAgB,CAC1F;AAEd;;;;"}
1
+ {"version":3,"file":"Filter.js","sources":["../../../../../../../../../../../../src/components/Report/components/Toolbar/components/Filters/components/Filter.tsx"],"sourcesContent":["import React from 'react';\nimport { Column as ReactTableColumn } from '@tanstack/react-table';\nimport { IconButton } from '../../../../../../IconButton/IconButton';\nimport { useLocalization } from '../../../../../../Provider/Localization';\nimport { FilterColumn } from './FilterColumn';\nimport { FilterComparator } from './FilterComparator';\nimport { FilterValue } from './FilterValue';\nimport { TableFilter, TableFilterComparator } from '../../../../../../../primitives/Table/types';\n\nexport type FilterProps<TType = unknown> = {\n allColumns: ReactTableColumn<TType, unknown>[];\n filter: TableFilter;\n filters: TableFilter[];\n position: number;\n onChange: (position: number, value: TableFilter) => void;\n onRemove?: (position: number) => void;\n};\n\nexport function Filter<TType = unknown>(props: FilterProps<TType>) {\n const { allColumns, filter, filters, onChange: handleChange, onRemove, position } = props;\n const { texts } = useLocalization();\n const column = allColumns.find(c => c.id === filter.id);\n const ref = React.useRef<HTMLButtonElement>(null);\n\n const {\n id,\n value: { comparator, value },\n } = filter;\n\n const handleChangeColumn = (columnId: string) => {\n const previousColumn = allColumns.find(column => column.id === id);\n const nextColumn = allColumns.find(column => column.id === columnId);\n // UX requirement: if old column data type is the same as next column data type,\n // then we applying the same filter value for the next column,\n // but when data types are different, we're reseting comparator ans value for the next column\n const value =\n previousColumn?.columnDef.meta?.dataType === nextColumn?.columnDef.meta?.dataType\n ? filter.value\n : {\n comparator: TableFilterComparator.Contains,\n value: undefined,\n };\n\n handleChange(position, { id: columnId, value });\n };\n\n const handleChangeComparator = (comparator: TableFilterComparator) => {\n let nextValue = filter.value.value;\n\n if (comparator === TableFilterComparator.IsEmpty || comparator === TableFilterComparator.IsNotEmpty) {\n nextValue = undefined;\n }\n handleChange(position, { id, value: { comparator, value: nextValue } });\n };\n\n const handleChangeValue = (value: any) => {\n handleChange(position, { id, value: { ...filter.value, value } });\n };\n\n const handleRemove = () => onRemove?.(position);\n\n React.useEffect(() => {\n if (ref.current && !id) {\n ref.current.focus(); // after adding a new filter placeholder, we want to focus it right way.\n }\n }, [id]);\n\n return (\n <div className=\"flex items-start gap-2\">\n <div className=\"flex min-h-[theme(spacing.8)] w-14 flex-shrink-0 items-center justify-end pr-2 text-right\">\n {position > 0 ? texts.table3.filters.conditions.and : texts.table3.filters.conditions.where}\n </div>\n <FilterColumn\n allColumns={allColumns as any}\n filters={filters}\n onChange={handleChangeColumn as any}\n value={id}\n ref={ref}\n />\n <FilterComparator column={column} onChange={handleChangeComparator as any} value={comparator} />\n <FilterValue column={column} comparator={comparator} onChange={handleChangeValue} value={value} />\n {onRemove ? <IconButton appearance=\"discrete\" className=\"ml-auto\" icon=\"close\" onClick={handleRemove} /> : null}\n </div>\n );\n}\n"],"names":["Filter","props","allColumns","filter","filters","onChange","handleChange","onRemove","position","texts","useLocalization","column","find","c","id","ref","React","useRef","value","comparator","handleChangeColumn","columnId","previousColumn","nextColumn","_previousColumn$colum","columnDef","meta","dataType","_nextColumn$columnDef","TableFilterComparator","Contains","undefined","handleChangeComparator","nextValue","IsEmpty","IsNotEmpty","handleChangeValue","handleRemove","useEffect","current","focus","className","table3","conditions","and","where","FilterColumn","FilterComparator","FilterValue","IconButton","appearance","icon","onClick"],"mappings":";;;;;;;;SAkBgBA,MAAMA,CAAkBC,KAAyB;EAC7D,MAAM;IAAEC,UAAU;IAAEC,MAAM;IAAEC,OAAO;IAAEC,QAAQ,EAAEC,YAAY;IAAEC,QAAQ;IAAEC;GAAU,GAAGP,KAAK;EACzF,MAAM;IAAEQ;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAMC,MAAM,GAAGT,UAAU,CAACU,IAAI,CAACC,CAAC,IAAIA,CAAC,CAACC,EAAE,KAAKX,MAAM,CAACW,EAAE,CAAC;EACvD,MAAMC,GAAG,GAAGC,cAAK,CAACC,MAAM,CAAoB,IAAI,CAAC;EAEjD,MAAM;IACFH,EAAE;IACFI,KAAK,EAAE;MAAEC,UAAU;MAAED;;GACxB,GAAGf,MAAM;EAEV,MAAMiB,kBAAkB,GAAIC,QAAgB;;IACxC,MAAMC,cAAc,GAAGpB,UAAU,CAACU,IAAI,CAACD,MAAM,IAAIA,MAA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ACZ,IAAIvB,GAAG,CAACwB,OAAO,IAAI,CAACzB,EAAE,EAAE;MACpBC,GAAG,CAACwB,OAAO,CAACC,KAAK,EAAE,CAAC;;GAE3B,EAAE,CAAC1B,EAAE,CAAC,CAAC;EAER,oBACIE;IAAKyB,SAAS,EAAC;kBACXzB;IAAKyB,SAAS,EAAC;KACVjC,QAAQ,GAAG,CAAC,GAAGC,KAAK,CAACiC,MAAM,CAACtC,OAAO,CAACuC,UAAU,CAACC,GAAG,GAAGnC,KAAK,CAACiC,MAAM,CAACtC,OAAO,CAACuC,UAAU,CAACE,KAAK,CACzF,eACN7B,6BAAC8B,YAAY;IACT5C,UAAU,EAAEA,UAAiB;IAC7BE,OAAO,EAAEA,OAAO;IAChBC,QAAQ,EAAEe,kBAAyB;IACnCF,KAAK,EAAEJ,EAAE;IACTC,GAAG,EAAEA;IACP,eACFC,6BAAC+B,gBAAgB;IAACpC,MAAM,EAAEA,MAAM;IAAEN,QAAQ,EAAE2B,sBAA6B;IAAEd,KAAK,EAAEC;IAAc,eAChGH,6BAACgC,WAAW;IAACrC,MAAM,EAAEA,MAAM;IAAEQ,UAAU,EAAEA,UAAU;IAAEd,QAAQ,EAAE+B,iBAAiB;IAAElB,KAAK,EAAEA;IAAS,EACjGX,QAAQ,gBAAGS,6BAACiC,UAAU;IAACC,UAAU,EAAC,UAAU;IAACT,SAAS,EAAC,SAAS;IAACU,IAAI,EAAC,OAAO;IAACC,OAAO,EAAEf;IAAgB,GAAG,IAAI,CAC7G;AAEd;;;;"}
@@ -5,7 +5,7 @@ import { useLocalization } from '../../../../../../Provider/Localization.js';
5
5
  import { Field } from '../../../../../../Field/Field.js';
6
6
  import { Select2 } from '../../../../../../Select2/Select2.js';
7
7
 
8
- function FilterColumn(props) {
8
+ const FilterColumn = /*#__PURE__*/React__default.forwardRef((props, ref) => {
9
9
  const {
10
10
  allColumns,
11
11
  filters,
@@ -25,7 +25,8 @@ function FilterColumn(props) {
25
25
  warning: warning,
26
26
  className: "min-h-[theme(spacing.8)]"
27
27
  }, /*#__PURE__*/React__default.createElement(Select2, Object.assign({}, attributes, {
28
- className: "!w-32 flex-shrink-0",
28
+ ref: ref,
29
+ className: "focus:yt-focus !w-32 flex-shrink-0 ",
29
30
  emptyValue: null,
30
31
  onChange: handleChange,
31
32
  value: value
@@ -43,7 +44,7 @@ function FilterColumn(props) {
43
44
  disabled: column.id !== value && (!column.getCanFilter() || !!filters.find(f => f.id === column.id))
44
45
  }, ((_column$columnDef$met = column.columnDef.meta) === null || _column$columnDef$met === void 0 ? void 0 : _column$columnDef$met.header) + (column.parent ? ` (${(_column$parent = column.parent) === null || _column$parent === void 0 ? void 0 : (_column$parent$column = _column$parent.columnDef.meta) === null || _column$parent$column === void 0 ? void 0 : _column$parent$column.header})` : ''));
45
46
  }))));
46
- }
47
+ });
47
48
 
48
49
  export { FilterColumn };
49
50
  //# sourceMappingURL=FilterColumn.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"FilterColumn.js","sources":["../../../../../../../../../../../../src/components/Report/components/Toolbar/components/Filters/components/FilterColumn.tsx"],"sourcesContent":["import React from 'react';\nimport { Column as ReactTableColumn } from '@tanstack/react-table';\nimport { Select2, Select2Props } from '../../../../../../Select2/Select2';\nimport { Icon } from '../../../../../../Icon/Icon';\nimport { Tooltip } from '../../../../../../Tooltip/Tooltip';\nimport { useLocalization } from '../../../../../../Provider/Localization';\nimport { Field } from '../../../../../../Field/Field';\nimport { TableFilter } from '../../../../../../../primitives/Table/types';\n\nexport type FilterColumnProps<TType = unknown> = Omit<Select2Props, 'children'> & {\n allColumns: ReactTableColumn<TType, unknown>[];\n filters: TableFilter[];\n};\n\nexport function FilterColumn<TType = unknown>(props: FilterColumnProps<TType>) {\n const { allColumns, filters, onChange: handleChange, value = null, ...attributes } = props;\n const { texts } = useLocalization();\n const selectedColumn = allColumns.find(column => column.id === value);\n const warning = selectedColumn && !selectedColumn.getIsVisible();\n\n return (\n <div className=\"flex flex-col\">\n <Field\n message={warning ? texts.table3.filters.hiddenColumn : undefined}\n warning={warning}\n className=\"min-h-[theme(spacing.8)]\">\n <Select2 {...attributes} className=\"!w-32 flex-shrink-0\" emptyValue={null} onChange={handleChange} value={value}>\n {allColumns.map(column => (\n <Select2.Option\n key={column.id}\n value={column.id}\n postfix={\n !column.getIsVisible() || column.getIsGrouped() ? (\n <Tooltip\n title={\n column.getIsGrouped()\n ? texts.table3.filters.hiddenGroupedColumn\n : texts.table3.filters.hiddenColumn\n }>\n <Icon name=\"eye-off\" className=\"text-grey-500 !h-5 !w-5\" />\n </Tooltip>\n ) : undefined\n }\n disabled={column.id !== value && (!column.getCanFilter() || !!filters.find(f => f.id === column.id))}>\n {(column.columnDef.meta?.header as string) +\n (column.parent ? ` (${column.parent?.columnDef.meta?.header})` : '')}\n </Select2.Option>\n ))}\n </Select2>\n </Field>\n </div>\n );\n}\n"],"names":["FilterColumn","props","allColumns","filters","onChange","handleChange","value","attributes","texts","useLocalization","selectedColumn","find","column","id","warning","getIsVisible","React","className","Field","message","table3","hiddenColumn","undefined","Select2","emptyValue","map","_column$columnDef$met","_column$parent","_column$parent$column","Option","key","postfix","getIsGrouped","Tooltip","title","hiddenGroupedColumn","Icon","name","disabled","getCanFilter","f","columnDef","meta","header","parent"],"mappings":";;;;;;;SAcgBA,YAAYA,CAAkBC,KAA+B;EACzE,MAAM;IAAEC,UAAU;IAAEC,OAAO;IAAEC,QAAQ,EAAEC,YAAY;IAAEC,KAAK,GAAG,IAAI;IAAE,GAAGC;GAAY,GAAGN,KAAK;EAC1F,MAAM;IAAEO;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAMC,cAAc,GAAGR,UAAU,CAACS,IAAI,CAACC,MAAM,IAAIA,MAAM,CAACC,EAAE,KAAKP,KAAK,CAAC;EACrE,MAAMQ,OAAO,GAAGJ,cAAc,IAAI,CAACA,cAAc,CAACK,YAAY,EAAE;EAEhE,oBACIC;IAAKC,SAAS,EAAC;kBACXD,6BAACE,KAAK;IACFC,OAAO,EA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S,CAACC,IAAI,cAAAd,qBAAA,uBAA7BA,qBAAA,CAA+Be,SAAS,GAAG,EAAE,CAAC,CAC3D;GACpB,CAAC,CACI,CACN,CACN;AAEd;;;;"}
1
+ {"version":3,"file":"FilterColumn.js","sources":["../../../../../../../../../../../../src/components/Report/components/Toolbar/components/Filters/components/FilterColumn.tsx"],"sourcesContent":["import React from 'react';\nimport { Column as ReactTableColumn } from '@tanstack/react-table';\nimport { Select2, Select2Props } from '../../../../../../Select2/Select2';\nimport { Icon } from '../../../../../../Icon/Icon';\nimport { Tooltip } from '../../../../../../Tooltip/Tooltip';\nimport { useLocalization } from '../../../../../../Provider/Localization';\nimport { Field } from '../../../../../../Field/Field';\nimport { TableFilter } from '../../../../../../../primitives/Table/types';\n\nexport type FilterColumnProps<TType = unknown> = Omit<Select2Props, 'children'> & {\n allColumns: ReactTableColumn<TType, unknown>[];\n filters: TableFilter[];\n};\n\nexport const FilterColumn = React.forwardRef<HTMLButtonElement, FilterColumnProps>((props, ref) => {\n const { allColumns, filters, onChange: handleChange, value = null, ...attributes } = props;\n const { texts } = useLocalization();\n const selectedColumn = allColumns.find(column => column.id === value);\n const warning = selectedColumn && !selectedColumn.getIsVisible();\n\n return (\n <div className=\"flex flex-col\">\n <Field\n message={warning ? texts.table3.filters.hiddenColumn : undefined}\n warning={warning}\n className=\"min-h-[theme(spacing.8)]\">\n <Select2\n {...attributes}\n ref={ref}\n className=\"focus:yt-focus !w-32 flex-shrink-0 \"\n emptyValue={null}\n onChange={handleChange}\n value={value}>\n {allColumns.map(column => (\n <Select2.Option\n key={column.id}\n value={column.id}\n postfix={\n !column.getIsVisible() || column.getIsGrouped() ? (\n <Tooltip\n title={\n column.getIsGrouped()\n ? texts.table3.filters.hiddenGroupedColumn\n : texts.table3.filters.hiddenColumn\n }>\n <Icon name=\"eye-off\" className=\"text-grey-500 !h-5 !w-5\" />\n </Tooltip>\n ) : undefined\n }\n disabled={column.id !== value && (!column.getCanFilter() || !!filters.find(f => f.id === column.id))}>\n {(column.columnDef.meta?.header as string) +\n (column.parent ? ` (${column.parent?.columnDef.meta?.header})` : '')}\n </Select2.Option>\n ))}\n </Select2>\n </Field>\n </div>\n );\n});\n"],"names":["FilterColumn","React","forwardRef","props","ref","allColumns","filters","onChange","handleChange","value","attributes","texts","useLocalization","selectedColumn","find","column","id","warning","getIsVisible","className","Field","message","table3","hiddenColumn","undefined","Select2","emptyValue","map","_column$columnDef$met","_column$parent","_column$parent$column","Option","key","postfix","getIsGrouped","Tooltip","title","hiddenGroupedColumn","Icon","name","disabled","getCanFilter","f","columnDef","meta","header","parent"],"mappings":";;;;;;;MAcaA,YAAY,gBAAGC,cAAK,CAACC,UAAU,CAAuC,CAACC,KAAK,EAAEC,GAAG;EAC1F,MAAM;IAAEC,UAAU;IAAEC,OAAO;IAAEC,QAAQ,EAAEC,YAAY;IAAEC,KAAK,GAAG,IAAI;IAAE,GAAGC;GAAY,GAAGP,KAAK;EAC1F,MAAM;IAAEQ;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAMC,cAAc,GAAGR,UAAU,CAACS,IAAI,CAACC,MAAM,IAAIA,MAAM,CAACC,EAAE,KAAKP,KAAK,CAAC;EACrE,MAAMQ,OAAO,GAAGJ,cAAc,IAAI,CAACA,cAAc,CAACK,YAAY,EAAE;EAEhE,oBACIjB;IAAKkB,SAAS,EAAC;kBACXlB,6BAACmB,KAAK;IACFC,OAAO,EAAEJ,OAAO,GAAGN,KAAK,CAACW,MAAM,CAAChB,OAAO,CAACiB,YAAY,GAAGC,SAAS;IAChEP,OAAO,EAAEA,OAAO;IAChBE,SAAS,EAAC;kBACVlB,6BAACwB,OAAO,oBACAf,UAAU;IACdN,GAAG,EAAEA,GAAG;IACRe,SAAS,EAAC,qCAAqC;IAC/CO,UAAU,EAAE,IAAI;IAChBnB,QAAQ,EAAEC,YAAY;IACtBC,KAAK,EAAEA;MACNJ,UAAU,CAACsB,GAAG,CAACZ,MAAM;IAAA,IAAAa,qBAAA,EAAAC,cAAA,EAAAC,qBAAA;IAAA,oBAClB7B,6BAACwB,OAAO,CAACM,MAAM;MACXC,GAAG,EAAEjB,MAAM,CAACC,EAAE;MACdP,KAAK,EAAEM,MAAM,CAACC,EAAE;MAChBiB,OAAO,EACH,CAAClB,MAAM,CAACG,YAAY,EAAE,IAAIH,MAAM,CAACmB,YAAY,EAAE,kBAC3CjC,6BAACkC,OAAO;QACJC,KAAK,EACDrB,MAAM,CAACmB,YAAY,EAAE,GACfvB,KAAK,CAACW,MAAM,CAAChB,OAAO,CAAC+B,mBAAmB,GACxC1B,KAAK,CAACW,MAAM,CAAChB,OAAO,CAACiB;sBAE/BtB,6BAACqC,IAAI;QAACC,IAAI,EAAC,SAAS;QAACpB,SAAS,EAAC;QAA4B,CACrD,IACVK,SAAS;MAEjBgB,QAAQ,EAAEzB,MAAM,CAACC,EAAE,KAAKP,KAAK,KAAK,CAACM,MAAM,CAAC0B,YAAY,EAAE,IAAI,CAAC,CAACnC,OAAO,CAACQ,IAAI,CAAC4B,CAAC,IAAIA,CAAC,CAAC1B,EAAE,KAAKD,MAAM,CAACC,EAAE,CAAC;OACjG,EAAAY,qBAAA,GAAAb,MAAM,CAAC4B,SAAS,CAACC,IAAI,cAAAhB,qBAAA,uBAArBA,qBAAA,CAAuBiB,MAAiB,KACrC9B,MAAM,CAAC+B,MAAM,0BAAQ/B,MAAM,CAAC+B,MAAM,cAAAjB,cAAA,wBAAAC,qBAAA,GAAbD,cAAA,CAAec,SAAS,CAACC,IAAI,cAAAd,qBAAA,uBAA7BA,qBAAA,CAA+Be,SAAS,GAAG,EAAE,CAAC,CAC3D;GACpB,CAAC,CACI,CACN,CACN;AAEd,CAAC;;;;"}
@@ -19,6 +19,12 @@ function Print(props) {
19
19
  const lastScrollTopRef = React__default.useRef();
20
20
  const toast = useToast();
21
21
  const tableMeta = table.options.meta;
22
+ const {
23
+ allRows,
24
+ orientation,
25
+ size,
26
+ splitGroups
27
+ } = tableMeta.printing.settings;
22
28
  const togglePrinting = React__default.useCallback(enabled => {
23
29
  tableMeta.printing.setIsPrinting(enabled);
24
30
  if (tableRef.current) {
@@ -76,10 +82,6 @@ function Print(props) {
76
82
  return Promise.reject(e);
77
83
  }
78
84
  };
79
- const [orientation, setOrientation] = React__default.useState('portrait');
80
- const [size, setSize] = React__default.useState('A4');
81
- const [allRows, setAllRows] = React__default.useState(true);
82
- const [splitGroups, setSplitGroups] = React__default.useState(true);
83
85
  const printStyle = [`@page { size: ${size} ${orientation}; }`];
84
86
  if (!allRows) {
85
87
  printStyle.push(`table[data-taco='report']#${tableId} tr:not([data-row-selected="true"]) { display: none; }`);
@@ -105,13 +107,13 @@ function Print(props) {
105
107
  table: table,
106
108
  onAccept: print,
107
109
  orientation: orientation,
108
- setOrientation: setOrientation,
110
+ setOrientation: value => tableMeta.printing.setSetting('orientation', value),
109
111
  size: size,
110
- setSize: setSize,
112
+ setSize: value => tableMeta.printing.setSetting('size', value),
111
113
  allRows: allRows,
112
- setAllRows: setAllRows,
114
+ setAllRows: value => tableMeta.printing.setSetting('allRows', value),
113
115
  splitGroups: splitGroups,
114
- setSplitGroups: setSplitGroups
116
+ setSplitGroups: value => tableMeta.printing.setSetting('splitGroups', value)
115
117
  }))),
116
118
  ref: ref,
117
119
  shortcut: shortcut,
@@ -1 +1 @@
1
- {"version":3,"file":"Print.js","sources":["../../../../../../../../../../../src/components/Report/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 '../../../../../IconButton/IconButton';\nimport { useLocalization } from '../../../../../Provider/Localization';\nimport { useToast } from '../../../../../Toast/Toaster';\nimport { TableRef } from '../../../../../../primitives/Table/types';\nimport { PrintDialog } from './PrintDialog';\nimport { Select2Value } from '../../../../../Select2/types';\nimport { RadioGroupItemValue } from '../../../../../RadioGroup/RadioGroup';\nimport { Shortcut } from '../../../../../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\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.table3.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.table3.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 [orientation, setOrientation] = React.useState<Select2Value>('portrait');\n const [size, setSize] = React.useState<Select2Value>('A4');\n const [allRows, setAllRows] = React.useState<RadioGroupItemValue>(true);\n const [splitGroups, setSplitGroups] = React.useState<boolean>(true);\n\n const printStyle = [`@page { size: ${size} ${orientation}; }`];\n\n if (!allRows) {\n printStyle.push(`table[data-taco='report']#${tableId} tr:not([data-row-selected=\"true\"]) { display: none; }`);\n }\n\n if (splitGroups) {\n printStyle.push(`table[data-taco='report']#${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.table3.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.table3.print.tooltip}\n dialog={dialogProps => (\n <PrintDialog\n {...dialogProps}\n table={table}\n onAccept={print}\n orientation={orientation}\n setOrientation={setOrientation}\n size={size}\n setSize={setSize}\n allRows={allRows}\n setAllRows={setAllRows}\n splitGroups={splitGroups}\n setSplitGroups={setSplitGroups}\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","togglePrinting","useCallback","enabled","printing","setIsPrinting","current","scrollTop","undefined","useEffect","afterPrint","window","addEventListener","removeEventListener","print","toastRef","close","setTimeout","requestAnimationFrame","document","execCommand","loading","table3","_temp2","server","isEnabled","loadAllIfNeeded","_temp","_catch","Promise","resolve","getState","sorting","columnFilters","then","error","errorMessage","console","_temp3","e","reject","orientation","setOrientation","useState","size","setSize","allRows","setAllRows","splitGroups","setSplitGroups","printStyle","push","shortcut","key","shift","tooltip","Shortcut","className","keys","media","join","IconButton","icon","dialog","dialogProps","PrintDialog","onAccept"],"mappings":";;;;;;;;SAiBgBA,KAAKA,CAAkBC,KAAwB;EAC3D,MAAM;IAAEC,KAAK;IAAEC,OAAO;IAAEC;GAAU,GAAGH,KAAK;EAC1C,MAAM;IAAEI;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAMC,GAAG,GAAG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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 '../../../../../IconButton/IconButton';\nimport { useLocalization } from '../../../../../Provider/Localization';\nimport { useToast } from '../../../../../Toast/Toaster';\nimport { TableRef } from '../../../../../../primitives/Table/types';\nimport { PrintDialog } from './PrintDialog';\nimport { Shortcut } from '../../../../../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.table3.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.table3.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='report']#${tableId} tr:not([data-row-selected=\"true\"]) { display: none; }`);\n }\n\n if (splitGroups) {\n printStyle.push(`table[data-taco='report']#${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.table3.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.table3.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","table3","_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,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,gBAAgB,CAACgB,OAAO;QACrDhB,gBAAgB,CAACgB,OAAO,GAAGE,SAAS;;;GAG/C,EACD,CAACxB,QAAQ,CAACsB,OAAO,CAAC,CACrB;EAEDlB,cAAK,CAACqB,SAAS,CAAC;IACZ,MAAMC,UAAU,GAAGA;MACfR,cAAc,CAAC,KAAK,CAAC;KACxB;IAEDS,MAAM,CAACC,gBAAgB,CAAC,YAAY,EAAEF,UAAU,CAAC;IAEjD,OAAO;MAC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AAQ,CAAC4D,UAAU,CAAC,SAAS,EAAED,KAAK,CAAC;MACpE5D,WAAW,EAAEA,WAAW;MACxBgE,cAAc,EAAEJ,KAAK,IAAIlE,SAAS,CAACO,QAAQ,CAAC4D,UAAU,CAAC,aAAa,EAAED,KAAK;OAC7E,CACL;IACDxE,GAAG,EAAEA,GAAG;IACRwD,QAAQ,EAAEA,QAAQ;IAClBG,OAAO,EAAEA;IACX,CACH;AAEX;;;;"}
@@ -1,5 +1,5 @@
1
1
  import React__default from 'react';
2
- import { isElementInsideOrTriggeredFromContainer, isEventTriggeredOnInteractiveElement } from '../../../utils/dom.js';
2
+ import { isElementInsideOrTriggeredFromContainer, isElementInteractive } from '../../../utils/dom.js';
3
3
 
4
4
  function useTableRowActiveListener(table, tableRef) {
5
5
  const tableMeta = table.options.meta;
@@ -10,7 +10,7 @@ function useTableRowActiveListener(table, tableRef) {
10
10
  const activeRow = (_tableRef$current$que = (_tableRef$current = tableRef.current) === null || _tableRef$current === void 0 ? void 0 : _tableRef$current.querySelector('tbody tr[data-row-active="true"]')) !== null && _tableRef$current$que !== void 0 ? _tableRef$current$que : null;
11
11
  // if the focused element, or it's parent if it's portalled, aren't in the row, then focus the row
12
12
  // this ensures the next tab press starts at the row
13
- if (!isElementInsideOrTriggeredFromContainer(document.activeElement, activeRow) && !isEventTriggeredOnInteractiveElement(document.activeElement)) {
13
+ if (!isElementInsideOrTriggeredFromContainer(document.activeElement, activeRow) && !isElementInteractive(document.activeElement)) {
14
14
  var _activeRow$focus;
15
15
  activeRow === null || activeRow === void 0 ? void 0 : (_activeRow$focus = activeRow.focus) === null || _activeRow$focus === void 0 ? void 0 : _activeRow$focus.call(activeRow, {
16
16
  preventScroll: true
@@ -1 +1 @@
1
- {"version":3,"file":"useTableRowActiveListener.js","sources":["../../../../../../../../src/components/Report/listeners/useTableRowActiveListener.ts"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable, TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport { isElementInsideOrTriggeredFromContainer, isEventTriggeredOnInteractiveElement } from '../../../utils/dom';\n\nexport function useTableRowActiveListener<TType = unknown>(\n table: ReactTable<TType>,\n tableRef: React.RefObject<HTMLTableElement>\n) {\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n\n // move focus to the row when active row changes, this makes sure we start within the row when tabbing\n React.useEffect(() => {\n if (tableMeta.rowActive.rowActiveIndex !== undefined) {\n const activeRow = tableRef.current?.querySelector('tbody tr[data-row-active=\"true\"]') ?? null;\n\n // if the focused element, or it's parent if it's portalled, aren't in the row, then focus the row\n // this ensures the next tab press starts at the row\n if (\n !isElementInsideOrTriggeredFromContainer(document.activeElement, activeRow) &&\n !isEventTriggeredOnInteractiveElement(document.activeElement)\n ) {\n (activeRow as HTMLElement)?.focus?.({ preventScroll: true });\n }\n }\n }, [tableMeta.rowActive.rowActiveIndex]);\n}\n"],"names":["useTableRowActiveListener","table","tableRef","tableMeta","options","meta","React","useEffect","rowActive","rowActiveIndex","undefined","_tableRef$current$que","_tableRef$current","activeRow","current","querySelector","isElementInsideOrTriggeredFromContainer","document","activeElement","isEventTriggeredOnInteractiveElement","_activeRow$focus","focus","call","preventScroll"],"mappings":";;;SAIgBA,yBAAyBA,CACrCC,KAAwB,EACxBC,QAA2C;EAE3C,MAAMC,SAAS,GAAGF,KAAK,CAACG,OAAO,CAACC,IAA6B;;EAG7DC,cAAK,CAACC,SAAS,CAAC;IACZ,IAAIJ,SAAS,CAACK,SAAS,CAACC,cAAc,KAAKC,SAAS,EAAE;MAAA,IAAAC,qBAAA,EAAAC,iBAAA;MAClD,MAAMC,SAAS,IAAAF,qBAAA,IAAAC,iBAAA,GAAGV,QAAQ,CAACY,OAAO,cAAAF,iBAAA,uBAAhBA,iBAAA,CAAkBG,aAAa,CAAC,kCAAkC,CAAC,cAAAJ,qBAAA,cAAAA,qBAAA,GAAI,IAAI;;;MAI7F,IACI,CAACK,uCAAuC,CAACC,QAAQ,CAACC,aAAa,EAAEL,SAAS,CAAC,IAC3E,CAACM,oCAAoC,CAACF,QAAQ,CAACC,aAAa,CAAC,EAC/D;QAAA,IAAAE,gBAAA;QACGP,SAAyB,aAAzBA,SAAyB,wBAAAO,gBAAA,GAAzBP,SAAyB,CAAEQ,KAAK,cAAAD,gBAAA,uBAAhCA,gBAAA,CAAAE,IAAA,CAAAT,SAAyB,EAAU;UAAEU,aAAa,EAAE;SAAM,CAAC;;;GAGvE,EAAE,CAACpB,SAAS,CAACK,SAAS,CAACC,cAAc,CAAC,CAAC;AAC5C;;;;"}
1
+ {"version":3,"file":"useTableRowActiveListener.js","sources":["../../../../../../../../src/components/Report/listeners/useTableRowActiveListener.ts"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable, TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport { isElementInsideOrTriggeredFromContainer, isElementInteractive } from '../../../utils/dom';\n\nexport function useTableRowActiveListener<TType = unknown>(\n table: ReactTable<TType>,\n tableRef: React.RefObject<HTMLTableElement>\n) {\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n\n // move focus to the row when active row changes, this makes sure we start within the row when tabbing\n React.useEffect(() => {\n if (tableMeta.rowActive.rowActiveIndex !== undefined) {\n const activeRow = tableRef.current?.querySelector('tbody tr[data-row-active=\"true\"]') ?? null;\n\n // if the focused element, or it's parent if it's portalled, aren't in the row, then focus the row\n // this ensures the next tab press starts at the row\n if (\n !isElementInsideOrTriggeredFromContainer(document.activeElement, activeRow) &&\n !isElementInteractive(document.activeElement)\n ) {\n (activeRow as HTMLElement)?.focus?.({ preventScroll: true });\n }\n }\n }, [tableMeta.rowActive.rowActiveIndex]);\n}\n"],"names":["useTableRowActiveListener","table","tableRef","tableMeta","options","meta","React","useEffect","rowActive","rowActiveIndex","undefined","_tableRef$current$que","_tableRef$current","activeRow","current","querySelector","isElementInsideOrTriggeredFromContainer","document","activeElement","isElementInteractive","_activeRow$focus","focus","call","preventScroll"],"mappings":";;;SAIgBA,yBAAyBA,CACrCC,KAAwB,EACxBC,QAA2C;EAE3C,MAAMC,SAAS,GAAGF,KAAK,CAACG,OAAO,CAACC,IAA6B;;EAG7DC,cAAK,CAACC,SAAS,CAAC;IACZ,IAAIJ,SAAS,CAACK,SAAS,CAACC,cAAc,KAAKC,SAAS,EAAE;MAAA,IAAAC,qBAAA,EAAAC,iBAAA;MAClD,MAAMC,SAAS,IAAAF,qBAAA,IAAAC,iBAAA,GAAGV,QAAQ,CAACY,OAAO,cAAAF,iBAAA,uBAAhBA,iBAAA,CAAkBG,aAAa,CAAC,kCAAkC,CAAC,cAAAJ,qBAAA,cAAAA,qBAAA,GAAI,IAAI;;;MAI7F,IACI,CAACK,uCAAuC,CAACC,QAAQ,CAACC,aAAa,EAAEL,SAAS,CAAC,IAC3E,CAACM,oBAAoB,CAACF,QAAQ,CAACC,aAAa,CAAC,EAC/C;QAAA,IAAAE,gBAAA;QACGP,SAAyB,aAAzBA,SAAyB,wBAAAO,gBAAA,GAAzBP,SAAyB,CAAEQ,KAAK,cAAAD,gBAAA,uBAAhCA,gBAAA,CAAAE,IAAA,CAAAT,SAAyB,EAAU;UAAEU,aAAa,EAAE;SAAM,CAAC;;;GAGvE,EAAE,CAACpB,SAAS,CAACK,SAAS,CAACC,cAAc,CAAC,CAAC;AAC5C;;;;"}
@@ -6,7 +6,8 @@ function useCssGridStylesheet(tableId, table, fontSize) {
6
6
  const allVisibleColumns = table.getVisibleLeafColumns();
7
7
  const columnSizing = table.getState().columnSizing;
8
8
  const globalMinSize = getCellMinWidth(fontSize);
9
- const gridTemplateRows = 'min-content 1fr min-content'; // header body footer;
9
+ // header body ?footer
10
+ const gridTemplateRows = table.getRowModel().rows.length ? 'min-content 1fr min-content' : 'min-content 1fr';
10
11
  return React__default.useMemo(() => {
11
12
  let printGridTemplateColumns = '';
12
13
  const printHiddenColumns = [];
@@ -24,12 +25,15 @@ function useCssGridStylesheet(tableId, table, fontSize) {
24
25
  size = `minmax(${minWidth}px, auto)`;
25
26
  } else if (width !== undefined) {
26
27
  const isLastColumn = index === allVisibleColumns.length - 1;
27
- if (isLastColumn) {
28
- size = `minmax(${minSize}px, auto)`;
29
- } else if (width === 'grow' || Number.isNaN(width)) {
28
+ if (width === 'grow' || Number.isNaN(width) && !isLastColumn) {
30
29
  size = `minmax(${minSize}px, 1fr)`;
31
30
  } else {
32
- size = `${width < minSize ? minSize : width}px`;
31
+ const minWidth = width < minSize ? minSize : width;
32
+ if (isLastColumn) {
33
+ size = `minmax(${minWidth}px, auto)`;
34
+ } else {
35
+ size = `${minWidth}px`;
36
+ }
33
37
  }
34
38
  } else {
35
39
  size = `minmax(${minSize}px, auto)`;
@@ -46,7 +50,7 @@ function useCssGridStylesheet(tableId, table, fontSize) {
46
50
  // we have to be specific so that nested tables don't inherit the same css
47
51
  const hiddenColumns = printHiddenColumns.map(id => `table[data-taco='report']#${tableId} > thead > tr > th[data-cell-id='${id}']\n,table[data-taco='report']#${tableId} > tbody > tr > td[data-cell-id='${id}']\n`).join(',');
48
52
  return `table[data-taco='report']#${tableId} { grid-template-columns: ${gridTemplateColumns}; grid-template-rows: ${gridTemplateRows}; }
49
- @media print { table[data-taco='report']#${tableId} { grid-template-columns: ${printGridTemplateColumns}; } ${hiddenColumns} { display: none; } }`;
53
+ @media print { table[data-taco='report']#${tableId} { grid-template-columns: ${printGridTemplateColumns}; } ${hiddenColumns ? `${hiddenColumns} { display: none; }` : ''} }`;
50
54
  }, [allVisibleColumns, columnSizing, globalMinSize, tableMeta.rowActions.rowActionsLength]);
51
55
  }
52
56
 
@@ -1 +1 @@
1
- {"version":3,"file":"useCssGridStylesheet.js","sources":["../../../../../../../../src/components/Report/styles/useCssGridStylesheet.ts"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable, TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport { TableFontSize } from '../../../primitives/Table/types';\nimport { getCellMinWidth } from '../../../primitives/Table/useTable/util/columns';\n\nexport function useCssGridStylesheet<TType = unknown>(\n tableId: string,\n table: ReactTable<TType>,\n fontSize: TableFontSize\n): string {\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n const allVisibleColumns = table.getVisibleLeafColumns();\n const columnSizing = table.getState().columnSizing;\n const globalMinSize = getCellMinWidth(fontSize);\n\n const gridTemplateRows = 'min-content 1fr min-content'; // header body footer;\n\n return React.useMemo(() => {\n let printGridTemplateColumns = '';\n const printHiddenColumns: string[] = [];\n\n const gridTemplateColumns = allVisibleColumns.reduce((accum, column, index) => {\n if (table.options.enableGrouping && column.getIsGrouped()) {\n return accum;\n }\n\n const minSize = column.columnDef.minSize ?? globalMinSize;\n const width = columnSizing[column.id] as number | 'grow';\n\n let size;\n let printSize;\n\n if (column.id === '__actions') {\n const minWidth = tableMeta.rowActions.rowActionsLength * 32 + 8; /* button margins l+r */\n size = `minmax(${minWidth}px, auto)`;\n } else if (width !== undefined) {\n const isLastColumn = index === allVisibleColumns.length - 1;\n\n if (isLastColumn) {\n size = `minmax(${minSize}px, auto)`;\n } else if (width === 'grow' || Number.isNaN(width)) {\n size = `minmax(${minSize}px, 1fr)`;\n } else {\n size = `${width < minSize ? minSize : width}px`;\n }\n } else {\n size = `minmax(${minSize}px, auto)`;\n }\n\n if (column.columnDef.meta?.enablePrinting === false) {\n printSize = '';\n printHiddenColumns.push(column.id);\n } else {\n printSize = 'auto';\n }\n\n printGridTemplateColumns = `${printGridTemplateColumns} ${printSize}`.trim();\n\n return `${accum} ${size}`.trim();\n }, '');\n\n // we have to be specific so that nested tables don't inherit the same css\n const hiddenColumns = printHiddenColumns\n .map(\n id =>\n `table[data-taco='report']#${tableId} > thead > tr > th[data-cell-id='${id}']\\n,table[data-taco='report']#${tableId} > tbody > tr > td[data-cell-id='${id}']\\n`\n )\n .join(',');\n\n return `table[data-taco='report']#${tableId} { grid-template-columns: ${gridTemplateColumns}; grid-template-rows: ${gridTemplateRows}; }\n@media print { table[data-taco='report']#${tableId} { grid-template-columns: ${printGridTemplateColumns}; } ${hiddenColumns} { display: none; } }`;\n }, [allVisibleColumns, columnSizing, globalMinSize, tableMeta.rowActions.rowActionsLength]);\n}\n"],"names":["useCssGridStylesheet","tableId","table","fontSize","tableMeta","options","meta","allVisibleColumns","getVisibleLeafColumns","columnSizing","getState","globalMinSize","getCellMinWidth","gridTemplateRows","React","useMemo","printGridTemplateColumns","printHiddenColumns","gridTemplateColumns","reduce","accum","column","index","enableGrouping","getIsGrouped","minSize","_column$columnDef$min","columnDef","width","id","size","printSize","minWidth","rowActions","rowActionsLength","undefined","isLastColumn","length","Number","isNaN","_column$columnDef$met","enablePrinting","push","trim","hiddenColumns","map","join"],"mappings":";;;SAKgBA,oBAAoBA,CAChCC,OAAe,EACfC,KAAwB,EACxBC,QAAuB;EAEvB,MAAMC,SAAS,GAAGF,KAAK,CAACG,OAAO,CAACC,IAA6B;EAC7D,MAAMC,iBAAiB,GAAGL,KAAK,CAACM,qBAAqB,EAAE;EACvD,MAAMC,YAAY,GAAGP,KAAK,CAACQ,QAAQ,EAAE,CAACD,YAAY;EAClD,MAAME,aAAa,GAAGC,eAAe,CAACT,QAAQ,CAAC;EAE/C,MAAMU,gBAAgB,GAAG,6BAA6B,CAAC;EAEvD,OAAOC,cAAK,CAACC,OAAO,CAAC;IACjB,IAAIC,wBAAwB,GAAG,EAAE;IACjC,MAAMC,kBAAkB,GAAa,EAAE;IAEvC,MAAMC,mBAAmB,GAAGX,iBAAiB,CAACY,MAAM,CAAC,CAACC,KAAK,EAAEC,MAAM,EAAEC,KAAK;;MACtE,IAAIpB,KAAK,CAACG,OAAO,CAACkB,cAAc,IAAIF,MAAM,CAACG,YAAY,EAAE,EAAE;QACvD,OAAOJ,KAAK;;MAGhB,MAAMK,OAAO,IAAAC,qBAAA,GAAGL,MAAM,CAACM,SAAS,CAACF,OAAO,cAAAC,qBAAA,cAAAA,qBAAA,GAAIf,aAAa;MACzD,MAAMiB,KAAK,GAAGnB,YAAY,CAACY,MAAM,CAACQ,EAAE,CAAoB;MAExD,IAAIC,IAAI;MACR,IAAIC,SAAS;MAEb,I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AAEE,aAAa,EAAEP,SAAS,CAAC6B,UAAU,CAACC,gBAAgB,CAAC,CAAC;AAC/F;;;;"}
1
+ {"version":3,"file":"useCssGridStylesheet.js","sources":["../../../../../../../../src/components/Report/styles/useCssGridStylesheet.ts"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable, TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport { TableFontSize } from '../../../primitives/Table/types';\nimport { getCellMinWidth } from '../../../primitives/Table/useTable/util/columns';\n\nexport function useCssGridStylesheet<TType = unknown>(\n tableId: string,\n table: ReactTable<TType>,\n fontSize: TableFontSize\n): string {\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n const allVisibleColumns = table.getVisibleLeafColumns();\n const columnSizing = table.getState().columnSizing;\n const globalMinSize = getCellMinWidth(fontSize);\n\n // header body ?footer\n const gridTemplateRows = table.getRowModel().rows.length ? 'min-content 1fr min-content' : 'min-content 1fr';\n\n return React.useMemo(() => {\n let printGridTemplateColumns = '';\n const printHiddenColumns: string[] = [];\n\n const gridTemplateColumns = allVisibleColumns.reduce((accum, column, index) => {\n if (table.options.enableGrouping && column.getIsGrouped()) {\n return accum;\n }\n\n const minSize = column.columnDef.minSize ?? globalMinSize;\n const width = columnSizing[column.id] as number | 'grow';\n\n let size;\n let printSize;\n\n if (column.id === '__actions') {\n const minWidth = tableMeta.rowActions.rowActionsLength * 32 + 8; /* button margins l+r */\n size = `minmax(${minWidth}px, auto)`;\n } else if (width !== undefined) {\n const isLastColumn = index === allVisibleColumns.length - 1;\n\n if (width === 'grow' || (Number.isNaN(width) && !isLastColumn)) {\n size = `minmax(${minSize}px, 1fr)`;\n } else {\n const minWidth = width < minSize ? minSize : width;\n\n if (isLastColumn) {\n size = `minmax(${minWidth}px, auto)`;\n } else {\n size = `${minWidth}px`;\n }\n }\n } else {\n size = `minmax(${minSize}px, auto)`;\n }\n\n if (column.columnDef.meta?.enablePrinting === false) {\n printSize = '';\n printHiddenColumns.push(column.id);\n } else {\n printSize = 'auto';\n }\n\n printGridTemplateColumns = `${printGridTemplateColumns} ${printSize}`.trim();\n\n return `${accum} ${size}`.trim();\n }, '');\n\n // we have to be specific so that nested tables don't inherit the same css\n const hiddenColumns = printHiddenColumns\n .map(\n id =>\n `table[data-taco='report']#${tableId} > thead > tr > th[data-cell-id='${id}']\\n,table[data-taco='report']#${tableId} > tbody > tr > td[data-cell-id='${id}']\\n`\n )\n .join(',');\n\n return `table[data-taco='report']#${tableId} { grid-template-columns: ${gridTemplateColumns}; grid-template-rows: ${gridTemplateRows}; }\n@media print { table[data-taco='report']#${tableId} { grid-template-columns: ${printGridTemplateColumns}; } ${\n hiddenColumns ? `${hiddenColumns} { display: none; }` : ''\n } }`;\n }, [allVisibleColumns, columnSizing, globalMinSize, tableMeta.rowActions.rowActionsLength]);\n}\n"],"names":["useCssGridStylesheet","tableId","table","fontSize","tableMeta","options","meta","allVisibleColumns","getVisibleLeafColumns","columnSizing","getState","globalMinSize","getCellMinWidth","gridTemplateRows","getRowModel","rows","length","React","useMemo","printGridTemplateColumns","printHiddenColumns","gridTemplateColumns","reduce","accum","column","index","enableGrouping","getIsGrouped","minSize","_column$columnDef$min","columnDef","width","id","size","printSize","minWidth","rowActions","rowActionsLength","undefined","isLastColumn","Number","isNaN","_column$columnDef$met","enablePrinting","push","trim","hiddenColumns","map","join"],"mappings":";;;SAKgBA,oBAAoBA,CAChCC,OAAe,EACfC,KAAwB,EACxBC,QAAuB;EAEvB,MAAMC,SAAS,GAAGF,KAAK,CAACG,OAAO,CAACC,IAA6B;EAC7D,MAAMC,iBAAiB,GAAGL,KAAK,CAACM,qBAAqB,EAAE;EACvD,MAAMC,YAAY,GAAGP,KAAK,CAACQ,QAAQ,EAAE,CAACD,YAAY;EAClD,MAAME,aAAa,GAAGC,eAAe,CAACT,QAAQ,CAAC;;EAG/C,MAAMU,gBAAgB,GAAGX,KAAK,CAACY,WAAW,EAAE,CAACC,IAAI,CAACC,MAAM,GAAG,6BAA6B,GAAG,iBAAiB;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B,IAAI,cAAAoC,qBAAA,uBAArBA,qBAAA,CAAuBC,cAAc,MAAK,KAAK,EAAE;QACjDT,SAAS,GAAG,EAAE;QACdd,kBAAkB,CAACwB,IAAI,CAACpB,MAAM,CAACQ,EAAE,CAAC;OACrC,MAAM;QACHE,SAAS,GAAG,MAAM;;MAGtBf,wBAAwB,MAAMA,4BAA4Be,WAAW,CAACW,IAAI,EAAE;MAE5E,UAAUtB,SAASU,MAAM,CAACY,IAAI,EAAE;KACnC,EAAE,EAAE,CAAC;;IAGN,MAAMC,aAAa,GAAG1B,kBAAkB,CACnC2B,GAAG,CACAf,EAAE,iCAC+B/B,2CAA2C+B,oCAAoC/B,2CAA2C+B,QAAQ,CACtK,CACAgB,IAAI,CAAC,GAAG,CAAC;IAEd,oCAAoC/C,oCAAoCoB,4CAA4CR;2CACjFZ,oCAAoCkB,+BACnE2B,aAAa,MAAMA,kCAAkC,GAAG,MACxD;GACP,EAAE,CAACvC,iBAAiB,EAAEE,YAAY,EAAEE,aAAa,EAAEP,SAAS,CAACgC,UAAU,CAACC,gBAAgB,CAAC,CAAC;AAC/F;;;;"}
@@ -1,20 +1,13 @@
1
1
  import React__default from 'react';
2
+ import { isElementInsideOverlay, isSiblingElementInsideSameParentOverlay, isElementInteractive, isElementInsideOrTriggeredFromContainer } from '../../../utils/dom.js';
2
3
 
3
4
  function useTableGlobalShortcuts(table, tableRef, scrollToIndex) {
4
5
  const tableMeta = table.options.meta;
5
6
  const rows = table.getRowModel().rows;
6
7
  React__default.useEffect(() => {
7
8
  const handleKeyDown = event => {
8
- const target = event.target;
9
- const dialog = target.closest('[role="dialog"]');
10
- //const eventOriginatedFromCombobox = !!target.closest('[role="combobox"]');
11
- // Don't trigger global shortcuts on the table if event originated from a combobox or if table is
12
- // outside the dialog
13
- if (
14
- //eventOriginatedFromCombobox ||
15
- dialog && !(dialog !== null && dialog !== void 0 && dialog.contains(tableRef.current))
16
- // || tableMeta.shortcutsState.isPaused
17
- ) {
9
+ const trigger = event.target;
10
+ if (isElementInsideOverlay(trigger) && !isSiblingElementInsideSameParentOverlay(trigger, tableRef.current) || isElementInteractive(trigger) && !isElementInsideOrTriggeredFromContainer(trigger, tableRef.current)) {
18
11
  return;
19
12
  }
20
13
  tableMeta.rowActive.handleKeyDown(event, rows.length, scrollToIndex, tableRef);
@@ -1 +1 @@
1
- {"version":3,"file":"useTableGlobalShortcuts.js","sources":["../../../../../../../../src/components/Report/util/useTableGlobalShortcuts.ts"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable, TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport { TableRef } from '../../../primitives/Table/types';\n\nexport function useTableGlobalShortcuts<TType = unknown>(\n table: ReactTable<TType>,\n tableRef: React.RefObject<TableRef>,\n scrollToIndex: (index: number) => void\n) {\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n const rows = table.getRowModel().rows;\n\n React.useEffect(\n () => {\n const handleKeyDown = (event: KeyboardEvent) => {\n const target = event.target as HTMLElement;\n const dialog = target.closest('[role=\"dialog\"]');\n //const eventOriginatedFromCombobox = !!target.closest('[role=\"combobox\"]');\n\n // Don't trigger global shortcuts on the table if event originated from a combobox or if table is\n // outside the dialog\n if (\n //eventOriginatedFromCombobox ||\n dialog &&\n !dialog?.contains(tableRef.current)\n // || tableMeta.shortcutsState.isPaused\n ) {\n return;\n }\n\n tableMeta.rowActive.handleKeyDown(event, rows.length, scrollToIndex, tableRef);\n tableMeta.rowSelection.handleKeyDown(event, table);\n\n if (tableMeta.rowActive.rowActiveIndex !== undefined) {\n tableMeta.rowClick.handleKeyDown(event, rows[tableMeta.rowActive.rowActiveIndex]?.original);\n }\n };\n\n document.addEventListener('keydown', handleKeyDown);\n\n return () => {\n document.removeEventListener('keydown', handleKeyDown);\n };\n },\n // See https://github.com/e-conomic/taco/blob/dev/packages/taco/src/components/Table3/strategies/virtualised.tsx#L143\n // scrollToIndex function changes when row count changes, so it is important to update handlers with new\n // scrollToIndex function.\n [tableRef.current, tableMeta.rowActive.rowActiveIndex, scrollToIndex]\n );\n}\n"],"names":["useTableGlobalShortcuts","table","tableRef","scrollToIndex","tableMeta","options","meta","rows","getRowModel","React","useEffect","handleKeyDown","event","target","dialog","closest","contains","current","rowActive","length","rowSelection","rowActiveIndex","undefined","_rows$tableMeta$rowAc","rowClick","original","document","addEventListener","removeEventListener"],"mappings":";;SAIgBA,uBAAuBA,CACnCC,KAAwB,EACxBC,QAAmC,EACnCC,aAAsC;EAEtC,MAAMC,SAAS,GAAGH,KAAK,CAACI,OAAO,CAACC,IAA6B;EAC7D,MAAMC,IAAI,GAAGN,KAAK,CAACO,WAAW,EAAE,CAACD,IAAI;EAErCE,cAAK,CAACC,SAAS,CACX;IACI,MAAMC,aAAa,GAAIC,KAAoB;MACvC,MAAMC,MAAM,GAAGD,KAAK,CAACC,MAAqB;MAC1C,MAAMC,MAAM,GAAGD,MAAM,CAACE,OAAO,CAAC,iBAAiB,CAAC;;;;MAKhD;;MAEID,MAAM,IACN,EAACA,MAAM,aAANA,MAAM,eAANA,MAAM,CAAEE,QAAQ,CAACd,QAAQ,CAACe,OAAO,CAAC;;QAErC;QACE;;MAGJb,SAAS,CAACc,SAAS,CAACP,aAAa,CAACC,KAAK,EAAEL,IAAI,CAACY,MAAM,EAAEhB,aAAa,EAAED,QAAQ,CAAC;MAC9EE,SAAS,CAACgB,YAAY,CAACT,aAAa,CAACC,KAAK,EAAEX,KAAK,CAAC;MAElD,IAAIG,SAAS,CAACc,SAAS,CAACG,cAAc,KAAKC,SAAS,EAAE;QAAA,IAAAC,qBAAA;QAClDnB,SAAS,CAACoB,QAAQ,CAACb,aAAa,CAACC,KAAK,GAAAW,qBAAA,GAAEhB,IAAI,CAACH,SAAS,CAACc,SAAS,CAACG,cAAc,CAAC,cAAAE,qBAAA,uBAAxCA,qBAAA,CAA0CE,QAAQ,CAAC;;KAElG;IAEDC,QAAQ,CAACC,gBAAgB,CAAC,SAAS,EAAEhB,aAAa,CAAC;IAEnD,OAAO;MACHe,QAAQ,CAACE,mBAAmB,CAAC,SAAS,EAAEjB,aAAa,CAAC;KACzD;GACJ;;;;EAID,CAACT,QAAQ,CAACe,OAAO,EAAEb,SAAS,CAACc,SAAS,CAACG,cAAc,EAAElB,aAAa,CAAC,CACxE;AACL;;;;"}
1
+ {"version":3,"file":"useTableGlobalShortcuts.js","sources":["../../../../../../../../src/components/Report/util/useTableGlobalShortcuts.ts"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable, TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport { TableRef } from '../../../primitives/Table/types';\nimport {\n isElementInsideOrTriggeredFromContainer,\n isElementInsideOverlay,\n isElementInteractive,\n isSiblingElementInsideSameParentOverlay,\n} from '../../../utils/dom';\n\nexport function useTableGlobalShortcuts<TType = unknown>(\n table: ReactTable<TType>,\n tableRef: React.RefObject<TableRef>,\n scrollToIndex: (index: number) => void\n) {\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n const rows = table.getRowModel().rows;\n\n React.useEffect(\n () => {\n const handleKeyDown = (event: KeyboardEvent) => {\n const trigger = event.target as HTMLElement;\n\n if (\n (isElementInsideOverlay(trigger) && !isSiblingElementInsideSameParentOverlay(trigger, tableRef.current)) ||\n (isElementInteractive(trigger) && !isElementInsideOrTriggeredFromContainer(trigger, tableRef.current))\n ) {\n return;\n }\n\n tableMeta.rowActive.handleKeyDown(event, rows.length, scrollToIndex, tableRef);\n tableMeta.rowSelection.handleKeyDown(event, table);\n\n if (tableMeta.rowActive.rowActiveIndex !== undefined) {\n tableMeta.rowClick.handleKeyDown(event, rows[tableMeta.rowActive.rowActiveIndex]?.original);\n }\n };\n\n document.addEventListener('keydown', handleKeyDown);\n\n return () => {\n document.removeEventListener('keydown', handleKeyDown);\n };\n },\n // See https://github.com/e-conomic/taco/blob/dev/packages/taco/src/components/Table3/strategies/virtualised.tsx#L143\n // scrollToIndex function changes when row count changes, so it is important to update handlers with new\n // scrollToIndex function.\n [tableRef.current, tableMeta.rowActive.rowActiveIndex, scrollToIndex]\n );\n}\n"],"names":["useTableGlobalShortcuts","table","tableRef","scrollToIndex","tableMeta","options","meta","rows","getRowModel","React","useEffect","handleKeyDown","event","trigger","target","isElementInsideOverlay","isSiblingElementInsideSameParentOverlay","current","isElementInteractive","isElementInsideOrTriggeredFromContainer","rowActive","length","rowSelection","rowActiveIndex","undefined","_rows$tableMeta$rowAc","rowClick","original","document","addEventListener","removeEventListener"],"mappings":";;;SAUgBA,uBAAuBA,CACnCC,KAAwB,EACxBC,QAAmC,EACnCC,aAAsC;EAEtC,MAAMC,SAAS,GAAGH,KAAK,CAACI,OAAO,CAACC,IAA6B;EAC7D,MAAMC,IAAI,GAAGN,KAAK,CAACO,WAAW,EAAE,CAACD,IAAI;EAErCE,cAAK,CAACC,SAAS,CACX;IACI,MAAMC,aAAa,GAAIC,KAAoB;MACvC,MAAMC,OAAO,GAAGD,KAAK,CAACE,MAAqB;MAE3C,IACKC,sBAAsB,CAACF,OAAO,CAAC,IAAI,CAACG,uCAAuC,CAACH,OAAO,EAAEX,QAAQ,CAACe,OAAO,CAAC,IACtGC,oBAAoB,CAACL,OAAO,CAAC,IAAI,CAACM,uCAAuC,CAACN,OAAO,EAAEX,QAAQ,CAACe,OAAO,CAAE,EACxG;QACE;;MAGJb,SAAS,CAACgB,SAAS,CAACT,aAAa,CAACC,KAAK,EAAEL,IAAI,CAACc,MAAM,EAAElB,aAAa,EAAED,QAAQ,CAAC;MAC9EE,SAAS,CAACkB,YAAY,CAACX,aAAa,CAACC,KAAK,EAAEX,KAAK,CAAC;MAElD,IAAIG,SAAS,CAACgB,SAAS,CAACG,cAAc,KAAKC,SAAS,EAAE;QAAA,IAAAC,qBAAA;QAClDrB,SAAS,CAACsB,QAAQ,CAACf,aAAa,CAACC,KAAK,GAAAa,qBAAA,GAAElB,IAAI,CAACH,SAAS,CAACgB,SAAS,CAACG,cAAc,CAAC,cAAAE,qBAAA,uBAAxCA,qBAAA,CAA0CE,QAAQ,CAAC;;KAElG;IAEDC,QAAQ,CAACC,gBAAgB,CAAC,SAAS,EAAElB,aAAa,CAAC;IAEnD,OAAO;MACHiB,QAAQ,CAACE,mBAAmB,CAAC,SAAS,EAAEnB,aAAa,CAAC;KACzD;GACJ;;;;EAID,CAACT,QAAQ,CAACe,OAAO,EAAEb,SAAS,CAACgB,SAAS,CAACG,cAAc,EAAEpB,aAAa,CAAC,CACxE;AACL;;;;"}
@@ -5,8 +5,8 @@ import { useMergedRef } from '../../hooks/useMergedRef.js';
5
5
  import { useGlobalKeyDown } from '../../hooks/useGlobalKeyDown.js';
6
6
  import { IconButton } from '../IconButton/IconButton.js';
7
7
  import { useLocalization } from '../Provider/Localization.js';
8
- import { Input } from '../Input/Input.js';
9
8
  import { Spinner } from '../Spinner/Spinner.js';
9
+ import { Input } from '../Input/Input.js';
10
10
  import { Shortcut } from '../Shortcut/Shortcut.js';
11
11
 
12
12
  const SearchInput2 = /*#__PURE__*/React__default.forwardRef(function SearchInput2(props, ref) {
@@ -79,6 +79,7 @@ const SearchInput2 = /*#__PURE__*/React__default.forwardRef(function SearchInput
79
79
  }
80
80
  if (event.key === 'Escape') {
81
81
  handleClear();
82
+ event.stopPropagation();
82
83
  return;
83
84
  }
84
85
  };