@economic/taco 2.21.2 → 2.22.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/components/Report/Report.d.ts +21 -0
- package/dist/components/Report/components/Cell/Cell.d.ts +0 -1
- package/dist/components/Report/components/Cell/DisplayCell.d.ts +1 -1
- package/dist/components/Report/components/Cell/util.d.ts +1 -1
- package/dist/components/Report/components/Row/DisplayRow.d.ts +2 -9
- package/dist/components/Report/components/Toolbar/components/Filters/components/Placeholder.d.ts +5 -5
- package/dist/components/Report/listeners/useTableRowActiveListener.d.ts +3 -0
- package/dist/components/Report/styles/util.d.ts +2 -2
- package/dist/components/Report/types.d.ts +1 -3
- package/dist/components/Report/useReport.d.ts +2 -7
- package/dist/components/Table3/types.d.ts +1 -1
- package/dist/esm/index.css +501 -9
- package/dist/esm/packages/taco/src/components/Card/Card.js +1 -1
- package/dist/esm/packages/taco/src/components/Card/Card.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Group/Group.js +1 -1
- package/dist/esm/packages/taco/src/components/Group/Group.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Input/Input.js +37 -7
- package/dist/esm/packages/taco/src/components/Input/Input.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Input/util.js +3 -1
- package/dist/esm/packages/taco/src/components/Input/util.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Report/Report.js +70 -0
- package/dist/esm/packages/taco/src/components/Report/Report.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Report/components/Body/Body.js +61 -0
- package/dist/esm/packages/taco/src/components/Report/components/Body/Body.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Report/components/Body/util.js +22 -0
- package/dist/esm/packages/taco/src/components/Report/components/Body/util.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Report/components/Cell/Cell.js +32 -0
- package/dist/esm/packages/taco/src/components/Report/components/Cell/Cell.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Report/components/Cell/DisplayCell.js +23 -0
- package/dist/esm/packages/taco/src/components/Report/components/Cell/DisplayCell.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Report/components/Cell/GroupedCell.js +58 -0
- package/dist/esm/packages/taco/src/components/Report/components/Cell/GroupedCell.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Report/components/Cell/util.js +69 -0
- package/dist/esm/packages/taco/src/components/Report/components/Cell/util.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Report/components/Footer/Footer.js +34 -0
- package/dist/esm/packages/taco/src/components/Report/components/Footer/Footer.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Report/components/Footer/Summary.js +39 -0
- package/dist/esm/packages/taco/src/components/Report/components/Footer/Summary.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Report/components/Header/Header.js +194 -0
- package/dist/esm/packages/taco/src/components/Report/components/Header/Header.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Report/components/Header/components/Goto.js +28 -0
- package/dist/esm/packages/taco/src/components/Report/components/Header/components/Goto.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Report/components/Header/components/Menu.js +150 -0
- package/dist/esm/packages/taco/src/components/Report/components/Header/components/Menu.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Report/components/Header/components/Resizer.js +60 -0
- package/dist/esm/packages/taco/src/components/Report/components/Header/components/Resizer.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Report/components/Header/components/SortIndicator.js +41 -0
- package/dist/esm/packages/taco/src/components/Report/components/Header/components/SortIndicator.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Report/components/Header/util.js +24 -0
- package/dist/esm/packages/taco/src/components/Report/components/Header/util.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Report/components/Internal/Actions.js +90 -0
- package/dist/esm/packages/taco/src/components/Report/components/Internal/Actions.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Report/components/Internal/Expansion.js +59 -0
- package/dist/esm/packages/taco/src/components/Report/components/Internal/Expansion.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Report/components/Internal/Selection.js +118 -0
- package/dist/esm/packages/taco/src/components/Report/components/Internal/Selection.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Report/components/Row/DisplayRow.js +102 -0
- package/dist/esm/packages/taco/src/components/Report/components/Row/DisplayRow.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Report/components/Row/Row.js +24 -0
- package/dist/esm/packages/taco/src/components/Report/components/Row/Row.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Report/components/Row/RowContext.js +10 -0
- package/dist/esm/packages/taco/src/components/Report/components/Row/RowContext.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Report/components/Row/SkeletonRow.js +62 -0
- package/dist/esm/packages/taco/src/components/Report/components/Row/SkeletonRow.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Report/components/Toolbar/Toolbar.js +63 -0
- package/dist/esm/packages/taco/src/components/Report/components/Toolbar/Toolbar.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/Filters.js +50 -0
- package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/Filters.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/ManageFiltersPopover.js +136 -0
- package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/ManageFiltersPopover.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/components/Filter.js +95 -0
- package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/components/Filter.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/components/FilterColumn.js +49 -0
- package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/components/FilterColumn.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/components/FilterComparator.js +110 -0
- package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/components/FilterComparator.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/components/FilterValue.js +118 -0
- package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/components/FilterValue.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/components/Placeholder.js +41 -0
- package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/components/Placeholder.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/util.js +7 -0
- package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/util.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Print/Print.js +123 -0
- package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Print/Print.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Print/PrintDialog.js +88 -0
- package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Print/PrintDialog.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Search/Search.js +95 -0
- package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Search/Search.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Settings/HideOrOrderPopover.js +105 -0
- package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Settings/HideOrOrderPopover.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Settings/Settings.js +103 -0
- package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Settings/Settings.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Report/listeners/useTableRowActiveListener.js +24 -0
- package/dist/esm/packages/taco/src/components/Report/listeners/useTableRowActiveListener.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Report/styles/useColumnPinningStylesheet.js +44 -0
- package/dist/esm/packages/taco/src/components/Report/styles/useColumnPinningStylesheet.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Report/styles/useCssGridStylesheet.js +54 -0
- package/dist/esm/packages/taco/src/components/Report/styles/useCssGridStylesheet.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Report/styles/useStylesheet.js +20 -0
- package/dist/esm/packages/taco/src/components/Report/styles/useStylesheet.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Report/styles/util.js +61 -0
- package/dist/esm/packages/taco/src/components/Report/styles/util.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Report/useReport.js +51 -0
- package/dist/esm/packages/taco/src/components/Report/useReport.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Report/util/rows.js +10 -0
- package/dist/esm/packages/taco/src/components/Report/util/rows.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Report/util/useTableGlobalShortcuts.js +39 -0
- package/dist/esm/packages/taco/src/components/Report/util/useTableGlobalShortcuts.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Report/util/useTableRenderer.js +162 -0
- package/dist/esm/packages/taco/src/components/Report/util/useTableRenderer.js.map +1 -0
- package/dist/esm/packages/taco/src/components/ScrollArea/ScrollArea.js +2 -1
- package/dist/esm/packages/taco/src/components/ScrollArea/ScrollArea.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select2/Select2.js +2 -2
- package/dist/esm/packages/taco/src/components/Select2/components/Create.js +1 -1
- package/dist/esm/packages/taco/src/components/Select2/components/Edit.js +1 -1
- package/dist/esm/packages/taco/src/components/Select2/components/Option.js +1 -1
- package/dist/esm/packages/taco/src/components/Select2/components/Trigger.js +6 -7
- package/dist/esm/packages/taco/src/components/Select2/components/Trigger.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table/hooks/plugins/useRowActions.js +1 -1
- package/dist/esm/packages/taco/src/components/Table3/Table3.js +7 -2
- package/dist/esm/packages/taco/src/components/Table3/Table3.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/alert/ErrorAlert.js +6 -6
- package/dist/esm/packages/taco/src/components/Table3/components/alert/ErrorAlert.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/Cell.js +7 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/Cell.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/DisplayCell.js +2 -0
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/DisplayCell.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingCell.js +6 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingCell.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingControl.js +1 -0
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingControl.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/controls/TextareaControl.js +3 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/controls/TextareaControl.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/footer/Summary.js +1 -0
- package/dist/esm/packages/taco/src/components/Table3/components/columns/footer/Summary.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Menu.js +9 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Menu.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Actions.js +1 -0
- package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Actions.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/rows/Row.js +2 -0
- package/dist/esm/packages/taco/src/components/Table3/components/rows/Row.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/ColumnSettings.js +3 -3
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/Filters.js +4 -8
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/Filters.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/FilterComparator.js +1 -0
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/FilterComparator.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintButton.js +19 -14
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintButton.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintIFrame.js +6 -5
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintIFrame.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Search.js +18 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Search.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/useColumnFreezing.js +8 -14
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/useColumnFreezing.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/useEditing.js +1 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/useSettings.js +1 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useSettingsStateListener.js +5 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useSettingsStateListener.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/useTable.js +15 -15
- package/dist/esm/packages/taco/src/components/Table3/hooks/useTable.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/useTablePreset.js +20 -0
- package/dist/esm/packages/taco/src/components/Table3/hooks/useTablePreset.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/types.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/util/columns.js +2 -0
- package/dist/esm/packages/taco/src/components/Table3/util/columns.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Textarea/Textarea.js +1 -1
- package/dist/esm/packages/taco/src/components/Textarea/Textarea.js.map +1 -1
- package/dist/esm/packages/taco/src/hooks/useBoundaryOverflowDetection.js +1 -1
- package/dist/esm/packages/taco/src/index.js +7 -6
- package/dist/esm/packages/taco/src/index.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Button.js +2 -1
- package/dist/esm/packages/taco/src/primitives/Button.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/types.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableColumnFreezing.js +21 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableColumnFreezing.js.map +1 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableFooter.js +8 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableFooter.js.map +1 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTablePrinting.js +16 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTablePrinting.js.map +1 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRef.js +17 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRef.js.map +1 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowActions.js +11 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowActions.js.map +1 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowExpansion.js +9 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowExpansion.js.map +1 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowGroups.js +9 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowGroups.js.map +1 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableSearch.js +38 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableSearch.js.map +1 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableSettings.js +28 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableSettings.js.map +1 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableRowHeightListener.js +14 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableRowHeightListener.js.map +1 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableSearchListener.js +15 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableSearchListener.js.map +1 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableSettingsListener.js +26 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableSettingsListener.js.map +1 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTable/useTable.js +117 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTable/useTable.js.map +1 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTable/util/columns.js +30 -3
- package/dist/esm/packages/taco/src/primitives/Table/useTable/util/columns.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTable/util/filtering.js +131 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTable/util/filtering.js.map +1 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTable/util/presets.js +131 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTable/util/presets.js.map +1 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTable/util/search.js +43 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTable/util/search.js.map +1 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTable/util/settings.js +22 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTable/util/settings.js.map +1 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTable/util/setup.js +270 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTable/util/setup.js.map +1 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTable/util/sorting.js +18 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTable/util/sorting.js.map +1 -0
- package/dist/esm/packages/taco/src/utils/dom.js +5 -1
- package/dist/esm/packages/taco/src/utils/dom.js.map +1 -1
- package/dist/esm/packages/taco/src/utils/keyboard.js +3 -5
- package/dist/esm/packages/taco/src/utils/keyboard.js.map +1 -1
- package/dist/index.css +501 -9
- package/dist/index.d.ts +1 -0
- package/dist/primitives/Table/types.d.ts +2 -2
- package/dist/primitives/Table/useTable/features/useTablePrinting.d.ts +1 -1
- package/dist/primitives/Table/useTable/util/settings.d.ts +1 -1
- package/dist/primitives/Table/useTable/util/sorting.d.ts +1 -1
- package/dist/taco.cjs.development.js +6380 -2731
- package/dist/taco.cjs.development.js.map +1 -1
- package/dist/taco.cjs.production.min.js +1 -1
- package/dist/taco.cjs.production.min.js.map +1 -1
- package/dist/utils/dom.d.ts +1 -0
- package/dist/utils/keyboard.d.ts +0 -1
- package/package.json +2 -2
- package/types.json +4682 -4776
- package/dist/components/Report/features/useReportExport.d.ts +0 -3
package/dist/esm/packages/taco/src/components/Report/components/Header/components/SortIndicator.js
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
import React__default from 'react';
|
2
|
+
import { Icon } from '../../../../Icon/Icon.js';
|
3
|
+
|
4
|
+
const indicators = {
|
5
|
+
asc: /*#__PURE__*/React__default.createElement(Icon, {
|
6
|
+
name: "chevron-up-solid",
|
7
|
+
className: "pointer-events-none -my-0.5"
|
8
|
+
}),
|
9
|
+
desc: /*#__PURE__*/React__default.createElement(Icon, {
|
10
|
+
name: "chevron-down-solid",
|
11
|
+
className: "pointer-events-none -my-0.5"
|
12
|
+
})
|
13
|
+
};
|
14
|
+
function SortIndicator(props) {
|
15
|
+
var _indicators$props$dir;
|
16
|
+
return (_indicators$props$dir = indicators[props.direction]) !== null && _indicators$props$dir !== void 0 ? _indicators$props$dir : null;
|
17
|
+
}
|
18
|
+
const ariaSort = {
|
19
|
+
asc: 'ascending',
|
20
|
+
desc: 'descending'
|
21
|
+
};
|
22
|
+
function getSortAttributes(canSort, toggleSorting, sortDirection) {
|
23
|
+
var _ariaSort$sortDirecti;
|
24
|
+
if (!canSort) {
|
25
|
+
return {};
|
26
|
+
}
|
27
|
+
const handleClick = event => {
|
28
|
+
if (event.isDefaultPrevented() || !event.currentTarget.contains(event.target)) {
|
29
|
+
return;
|
30
|
+
}
|
31
|
+
event.preventDefault();
|
32
|
+
toggleSorting === null || toggleSorting === void 0 ? void 0 : toggleSorting(event);
|
33
|
+
};
|
34
|
+
return {
|
35
|
+
'aria-sort': (_ariaSort$sortDirecti = ariaSort[sortDirection]) !== null && _ariaSort$sortDirecti !== void 0 ? _ariaSort$sortDirecti : 'none',
|
36
|
+
onClick: handleClick
|
37
|
+
};
|
38
|
+
}
|
39
|
+
|
40
|
+
export { SortIndicator, getSortAttributes };
|
41
|
+
//# sourceMappingURL=SortIndicator.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"SortIndicator.js","sources":["../../../../../../../../../../src/components/Report/components/Header/components/SortIndicator.tsx"],"sourcesContent":["import React from 'react';\nimport { TableColumnSortDirection } from '../../../../../primitives/Table/types';\nimport { Icon } from '../../../../Icon/Icon';\n\ntype SortIndicatorProps = {\n direction: false | TableColumnSortDirection;\n};\n\nconst indicators = {\n asc: <Icon name=\"chevron-up-solid\" className=\"pointer-events-none -my-0.5\" />,\n desc: <Icon name=\"chevron-down-solid\" className=\"pointer-events-none -my-0.5\" />,\n};\n\nexport function SortIndicator(props: SortIndicatorProps) {\n return indicators[props.direction as string] ?? null;\n}\n\nconst ariaSort = {\n asc: 'ascending',\n desc: 'descending',\n};\n\nexport const getAriaSort = direction => ariaSort[direction] ?? 'none';\n\nexport function getSortAttributes(\n canSort: boolean,\n toggleSorting?: (event: unknown) => void,\n sortDirection?: false | TableColumnSortDirection\n) {\n if (!canSort) {\n return {};\n }\n\n const handleClick = (event: React.MouseEvent) => {\n if (event.isDefaultPrevented() || !event.currentTarget.contains(event.target as any)) {\n return;\n }\n\n event.preventDefault();\n toggleSorting?.(event);\n };\n\n return {\n 'aria-sort': ariaSort[sortDirection as any] ?? 'none',\n onClick: handleClick,\n };\n}\n"],"names":["indicators","asc","React","Icon","name","className","desc","SortIndicator","props","_indicators$props$dir","direction","ariaSort","getSortAttributes","canSort","toggleSorting","sortDirection","handleClick","event","isDefaultPrevented","currentTarget","contains","target","preventDefault","_ariaSort$sortDirecti","onClick"],"mappings":";;;AAQA,MAAMA,UAAU,GAAG;EACfC,GAAG,eAAEC,6BAACC,IAAI;IAACC,IAAI,EAAC,kBAAkB;IAACC,SAAS,EAAC;IAAgC;EAC7EC,IAAI,eAAEJ,6BAACC,IAAI;IAACC,IAAI,EAAC,oBAAoB;IAACC,SAAS,EAAC;;CACnD;SAEeE,aAAaA,CAACC,KAAyB;;EACnD,QAAAC,qBAAA,GAAOT,UAAU,CAACQ,KAAK,CAACE,SAAmB,CAAC,cAAAD,qBAAA,cAAAA,qBAAA,GAAI,IAAI;AACxD;AAEA,MAAME,QAAQ,GAAG;EACbV,GAAG,EAAE,WAAW;EAChBK,IAAI,EAAE;CACT;SAIeM,iBAAiBA,CAC7BC,OAAgB,EAChBC,aAAwC,EACxCC,aAAgD;;EAEhD,IAAI,CAACF,OAAO,EAAE;IACV,OAAO,EAAE;;EAGb,MAAMG,WAAW,GAAIC,KAAuB;IACxC,IAAIA,KAAK,CAACC,kBAAkB,EAAE,IAAI,CAACD,KAAK,CAACE,aAAa,CAACC,QAAQ,CAACH,KAAK,CAACI,MAAa,CAAC,EAAE;MAClF;;IAGJJ,KAAK,CAACK,cAAc,EAAE;IACtBR,aAAa,aAAbA,aAAa,uBAAbA,aAAa,CAAGG,KAAK,CAAC;GACzB;EAED,OAAO;IACH,WAAW,GAAAM,qBAAA,GAAEZ,QAAQ,CAACI,aAAoB,CAAC,cAAAQ,qBAAA,cAAAA,qBAAA,GAAI,MAAM;IACrDC,OAAO,EAAER;GACZ;AACL;;;;"}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
import React__default from 'react';
|
2
|
+
import { isInternalColumn } from '../../../../primitives/Table/useTable/util/columns.js';
|
3
|
+
|
4
|
+
function useSetInitialColumnSizing(id, defaultWidth, width, element, canMeasureSize, setColumnSizing) {
|
5
|
+
React__default.useEffect(() => {
|
6
|
+
// columns that aren't set to grow must set a pixel width...
|
7
|
+
// otherwise when scrolling through the table, the column widths adjust based on the content
|
8
|
+
// of the column, this is because to the virtualisation mounting new rows and unmounting old ones
|
9
|
+
if (canMeasureSize && element && !Number.isInteger(width) && !isInternalColumn(id) && defaultWidth !== 'grow') {
|
10
|
+
setColumnSizing(sizes => ({
|
11
|
+
...sizes,
|
12
|
+
[id]: element.getBoundingClientRect().width
|
13
|
+
}));
|
14
|
+
}
|
15
|
+
}, [element, canMeasureSize, width]);
|
16
|
+
}
|
17
|
+
function getIsPinned(header) {
|
18
|
+
var _header$subHeaders, _header$subHeaders$fi;
|
19
|
+
// TODO: Is there a native function that does this check for groups?
|
20
|
+
return (_header$subHeaders = header.subHeaders) !== null && _header$subHeaders !== void 0 && _header$subHeaders.length ? (_header$subHeaders$fi = header.subHeaders.find(x => x.column.getIsPinned())) === null || _header$subHeaders$fi === void 0 ? void 0 : _header$subHeaders$fi.column.getIsPinned() : header.column.getIsPinned();
|
21
|
+
}
|
22
|
+
|
23
|
+
export { getIsPinned, useSetInitialColumnSizing };
|
24
|
+
//# sourceMappingURL=util.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"util.js","sources":["../../../../../../../../../src/components/Report/components/Header/util.ts"],"sourcesContent":["import React from 'react';\nimport { Header as ReactTableHeader, ColumnPinningPosition as ReactTableColumnPinningPosition } from '@tanstack/react-table';\nimport { TableColumnWidth } from '../../../../primitives/Table/types';\nimport { isInternalColumn } from '../../../../primitives/Table/useTable/util/columns';\n\nexport function useSetInitialColumnSizing(\n id: string,\n defaultWidth: TableColumnWidth | undefined,\n width: TableColumnWidth | undefined,\n element: HTMLTableCellElement | null,\n canMeasureSize: boolean,\n setColumnSizing: any\n) {\n React.useEffect(() => {\n // columns that aren't set to grow must set a pixel width...\n // otherwise when scrolling through the table, the column widths adjust based on the content\n // of the column, this is because to the virtualisation mounting new rows and unmounting old ones\n if (canMeasureSize && element && !Number.isInteger(width) && !isInternalColumn(id) && defaultWidth !== 'grow') {\n setColumnSizing(sizes => ({\n ...sizes,\n [id]: element.getBoundingClientRect().width,\n }));\n }\n }, [element, canMeasureSize, width]);\n}\n\nexport function getIsPinned<TType = unknown>(\n header: ReactTableHeader<TType, unknown>\n): ReactTableColumnPinningPosition | undefined {\n // TODO: Is there a native function that does this check for groups?\n return header.subHeaders?.length\n ? header.subHeaders.find(x => x.column.getIsPinned())?.column.getIsPinned()\n : header.column.getIsPinned();\n}\n"],"names":["useSetInitialColumnSizing","id","defaultWidth","width","element","canMeasureSize","setColumnSizing","React","useEffect","Number","isInteger","isInternalColumn","sizes","getBoundingClientRect","getIsPinned","header","_header$subHeaders","subHeaders","length","_header$subHeaders$fi","find","x","column"],"mappings":";;;SAKgBA,yBAAyBA,CACrCC,EAAU,EACVC,YAA0C,EAC1CC,KAAmC,EACnCC,OAAoC,EACpCC,cAAuB,EACvBC,eAAoB;EAEpBC,cAAK,CAACC,SAAS,CAAC;;;;IAIZ,IAAIH,cAAc,IAAID,OAAO,IAAI,CAACK,MAAM,CAACC,SAAS,CAACP,KAAK,CAAC,IAAI,CAACQ,gBAAgB,CAACV,EAAE,CAAC,IAAIC,YAAY,KAAK,MAAM,EAAE;MAC3GI,eAAe,CAACM,KAAK,KAAK;QACtB,GAAGA,KAAK;QACR,CAACX,EAAE,GAAGG,OAAO,CAACS,qBAAqB,EAAE,CAACV;OACzC,CAAC,CAAC;;GAEV,EAAE,CAACC,OAAO,EAAEC,cAAc,EAAEF,KAAK,CAAC,CAAC;AACxC;SAEgBW,WAAWA,CACvBC,MAAwC;;;EAGxC,OAAO,CAAAC,kBAAA,GAAAD,MAAM,CAACE,UAAU,cAAAD,kBAAA,eAAjBA,kBAAA,CAAmBE,MAAM,IAAAC,qBAAA,GAC1BJ,MAAM,CAACE,UAAU,CAACG,IAAI,CAACC,CAAC,IAAIA,CAAC,CAACC,MAAM,CAACR,WAAW,EAAE,CAAC,cAAAK,qBAAA,uBAAnDA,qBAAA,CAAqDG,MAAM,CAACR,WAAW,EAAE,GACzEC,MAAM,CAACO,MAAM,CAACR,WAAW,EAAE;AACrC;;;;"}
|
@@ -0,0 +1,90 @@
|
|
1
|
+
import React__default from 'react';
|
2
|
+
import cn from 'clsx';
|
3
|
+
import { IconButton } from '../../../IconButton/IconButton.js';
|
4
|
+
import { useLocalization } from '../../../Provider/Localization.js';
|
5
|
+
import { Shortcut } from '../../../Shortcut/Shortcut.js';
|
6
|
+
import { Menu } from '../../../Menu/Menu.js';
|
7
|
+
import { FontSizes } from '../../../../types.js';
|
8
|
+
import { RowContext } from '../Row/RowContext.js';
|
9
|
+
|
10
|
+
function Header() {
|
11
|
+
return null;
|
12
|
+
}
|
13
|
+
function Actions(props) {
|
14
|
+
const {
|
15
|
+
actions,
|
16
|
+
actionsLength,
|
17
|
+
data,
|
18
|
+
fontSize,
|
19
|
+
isActiveRow
|
20
|
+
} = props;
|
21
|
+
const {
|
22
|
+
texts
|
23
|
+
} = useLocalization();
|
24
|
+
const visibleActions = actions.map(action => action(data)).filter(action => !!action);
|
25
|
+
const actionsOnRow = visibleActions.length === actionsLength ? visibleActions : visibleActions.slice(0, actionsLength - 1);
|
26
|
+
const actionsInMenu = visibleActions.slice(visibleActions.length === actionsLength ? actionsLength : actionsLength - 1);
|
27
|
+
const className = cn('-mb-2 flex justify-end text-right bg-[inherit] shadow-[-6px_0px_6px_var(--table-row-actions-shadow)] print:hidden', {
|
28
|
+
// Adjust negative margin on row actions cell to ensure that the cell aligns vertically.
|
29
|
+
'-mt-2': fontSize === FontSizes.small,
|
30
|
+
'-mt-1.5': fontSize !== FontSizes.small
|
31
|
+
});
|
32
|
+
return /*#__PURE__*/React__default.createElement("span", {
|
33
|
+
className: className
|
34
|
+
}, actionsOnRow.map((button, index) => {
|
35
|
+
var _ref, _button$props$tooltip;
|
36
|
+
const tooltip = String((_ref = (_button$props$tooltip = button.props.tooltip) !== null && _button$props$tooltip !== void 0 ? _button$props$tooltip : button.props['aria-label']) !== null && _ref !== void 0 ? _ref : '');
|
37
|
+
return /*#__PURE__*/React__default.cloneElement(button, {
|
38
|
+
appearance: 'transparent',
|
39
|
+
key: index,
|
40
|
+
tabIndex: isActiveRow ? 0 : -1,
|
41
|
+
tooltip: button.props.shortcut ? ( /*#__PURE__*/React__default.createElement(React__default.Fragment, null, tooltip, /*#__PURE__*/React__default.createElement(Shortcut, {
|
42
|
+
className: "ml-2",
|
43
|
+
keys: button.props.shortcut
|
44
|
+
}))) : tooltip
|
45
|
+
});
|
46
|
+
}), actionsInMenu.length ? ( /*#__PURE__*/React__default.createElement(IconButton, {
|
47
|
+
appearance: "transparent",
|
48
|
+
"aria-label": texts.table3.columns.actions.tooltip,
|
49
|
+
icon: "more",
|
50
|
+
tabIndex: isActiveRow ? 0 : -1,
|
51
|
+
menu: menuProps => ( /*#__PURE__*/React__default.createElement(Menu, Object.assign({}, menuProps), /*#__PURE__*/React__default.createElement(Menu.Content, null, actionsInMenu.map((action, i) => ( /*#__PURE__*/React__default.createElement(Menu.Item, Object.assign({
|
52
|
+
key: i
|
53
|
+
}, action.props, {
|
54
|
+
shortcut: action.props.shortcut
|
55
|
+
}), action.props['aria-label']))))))
|
56
|
+
})) : null);
|
57
|
+
}
|
58
|
+
const Cell = /*#__PURE__*/React__default.memo(function MemoedCell(context) {
|
59
|
+
const {
|
60
|
+
row,
|
61
|
+
table
|
62
|
+
} = context;
|
63
|
+
const {
|
64
|
+
rowIndex
|
65
|
+
} = React__default.useContext(RowContext);
|
66
|
+
const tableMeta = table.options.meta;
|
67
|
+
const actions = tableMeta.rowActions.rowActions;
|
68
|
+
const actionsLength = tableMeta.rowActions.rowActionsLength;
|
69
|
+
const isActiveRow = tableMeta.rowActive.rowActiveIndex === rowIndex;
|
70
|
+
const isResizingColumn = !!table.getState().columnSizingInfo.isResizingColumn;
|
71
|
+
const isHoverStatePaused = tableMeta.rowActive.isHoverStatePaused;
|
72
|
+
const {
|
73
|
+
isHovered
|
74
|
+
} = React__default.useContext(RowContext);
|
75
|
+
// We don't want to show actions in edit mode, since we have editing actions,
|
76
|
+
// which is shown in edit mode instead.
|
77
|
+
if (actions !== null && actions !== void 0 && actions.length && (isActiveRow || isHovered && !isHoverStatePaused && !isResizingColumn)) {
|
78
|
+
return /*#__PURE__*/React__default.createElement(Actions, {
|
79
|
+
actions: actions,
|
80
|
+
actionsLength: actionsLength,
|
81
|
+
data: row.original,
|
82
|
+
fontSize: tableMeta.fontSize.size,
|
83
|
+
isActiveRow: isActiveRow
|
84
|
+
});
|
85
|
+
}
|
86
|
+
return null;
|
87
|
+
});
|
88
|
+
|
89
|
+
export { Actions, Cell, Header };
|
90
|
+
//# sourceMappingURL=Actions.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Actions.js","sources":["../../../../../../../../../src/components/Report/components/Internal/Actions.tsx"],"sourcesContent":["import React from 'react';\nimport { CellContext as ReactTableCellContext, TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport cn from 'clsx';\nimport { useLocalization } from '../../../Provider/Localization';\nimport { IconButton } from '../../../IconButton/IconButton';\nimport { Menu } from '../../../Menu/Menu';\nimport { Shortcut } from '../../../Shortcut/Shortcut';\nimport { RowContext } from '../Row/RowContext';\nimport { TableFontSize, TableRowActionRenderer } from '../../../../primitives/Table/types';\nimport { FontSizes } from '../../../../types';\n\nexport function Header() {\n return null;\n}\n\nexport type ActionsProps<TType = unknown> = {\n actions: TableRowActionRenderer<TType>[];\n actionsLength: number;\n data: any;\n fontSize: TableFontSize;\n isActiveRow: boolean;\n};\nexport function Actions<TType = unknown>(props: ActionsProps<TType>) {\n const { actions, actionsLength, data, fontSize, isActiveRow } = props;\n const { texts } = useLocalization();\n const visibleActions = actions.map(action => action(data)).filter(action => !!action) as JSX.Element[];\n\n const actionsOnRow = visibleActions.length === actionsLength ? visibleActions : visibleActions.slice(0, actionsLength - 1);\n const actionsInMenu = visibleActions.slice(visibleActions.length === actionsLength ? actionsLength : actionsLength - 1);\n\n const className = cn(\n '-mb-2 flex justify-end text-right bg-[inherit] shadow-[-6px_0px_6px_var(--table-row-actions-shadow)] print:hidden',\n {\n // Adjust negative margin on row actions cell to ensure that the cell aligns vertically.\n '-mt-2': fontSize === FontSizes.small,\n '-mt-1.5': fontSize !== FontSizes.small,\n }\n );\n\n return (\n <span className={className}>\n {actionsOnRow.map((button, index) => {\n const tooltip = String(button.props.tooltip ?? button.props['aria-label'] ?? '');\n\n return React.cloneElement(button, {\n appearance: 'transparent',\n key: index,\n tabIndex: isActiveRow ? 0 : -1,\n tooltip: button.props.shortcut ? (\n <>\n {tooltip}\n <Shortcut className=\"ml-2\" keys={button.props.shortcut} />\n </>\n ) : (\n tooltip\n ),\n });\n })}\n {actionsInMenu.length ? (\n <IconButton\n appearance=\"transparent\"\n aria-label={texts.table3.columns.actions.tooltip}\n icon=\"more\"\n tabIndex={isActiveRow ? 0 : -1}\n menu={menuProps => (\n <Menu {...menuProps}>\n <Menu.Content>\n {actionsInMenu.map((action, i) => (\n <Menu.Item key={i} {...action.props} shortcut={action.props.shortcut}>\n {action.props['aria-label']}\n </Menu.Item>\n ))}\n </Menu.Content>\n </Menu>\n )}\n />\n ) : null}\n </span>\n );\n}\n\nexport const Cell = React.memo(function MemoedCell<TType = unknown>(context: ReactTableCellContext<TType, unknown>) {\n const { row, table } = context;\n const { rowIndex } = React.useContext(RowContext);\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n\n const actions = tableMeta.rowActions.rowActions;\n const actionsLength = tableMeta.rowActions.rowActionsLength;\n\n const isActiveRow = tableMeta.rowActive.rowActiveIndex === rowIndex;\n const isResizingColumn = !!table.getState().columnSizingInfo.isResizingColumn;\n const isHoverStatePaused = tableMeta.rowActive.isHoverStatePaused;\n const { isHovered } = React.useContext(RowContext);\n\n // We don't want to show actions in edit mode, since we have editing actions,\n // which is shown in edit mode instead.\n if (actions?.length && (isActiveRow || (isHovered && !isHoverStatePaused && !isResizingColumn))) {\n return (\n <Actions\n actions={actions}\n actionsLength={actionsLength}\n data={row.original}\n fontSize={tableMeta.fontSize.size}\n isActiveRow={isActiveRow}\n />\n );\n }\n\n return null;\n}) as <TType = unknown>(context: ReactTableCellContext<TType, unknown>) => JSX.Element;\n"],"names":["Header","Actions","props","actions","actionsLength","data","fontSize","isActiveRow","texts","useLocalization","visibleActions","map","action","filter","actionsOnRow","length","slice","actionsInMenu","className","cn","FontSizes","small","React","button","index","tooltip","String","_ref","_button$props$tooltip","cloneElement","appearance","key","tabIndex","shortcut","Shortcut","keys","IconButton","table3","columns","icon","menu","menuProps","Menu","Content","i","Item","Cell","memo","MemoedCell","context","row","table","rowIndex","useContext","RowContext","tableMeta","options","meta","rowActions","rowActionsLength","rowActive","rowActiveIndex","isResizingColumn","getState","columnSizingInfo","isHoverStatePaused","isHovered","original","size"],"mappings":";;;;;;;;;SAWgBA,MAAMA;EAClB,OAAO,IAAI;AACf;SASgBC,OAAOA,CAAkBC,KAA0B;EAC/D,MAAM;IAAEC,OAAO;IAAEC,aAAa;IAAEC,IAAI;IAAEC,QAAQ;IAAEC;GAAa,GAAGL,KAAK;EACrE,MAAM;IAAEM;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAMC,cAAc,GAAGP,OAAO,CAACQ,GAAG,CAACC,MAAM,IAAIA,MAAM,CAACP,IAAI,CAAC,CAAC,CAACQ,MAAM,CAACD,MAAM,IAAI,CAAC,CAACA,MAAM,CAAkB;EAEtG,MAAME,YAAY,GAAGJ,cAAc,CAACK,MAAM,KAAKX,aAAa,GAAGM,cAAc,GAAGA,cAAc,CAACM,KAAK,CAAC,CAAC,EAAEZ,aAAa,GAAG,CAAC,CAAC;EAC1H,MAAMa,aAAa,GAAGP,cAAc,CAACM,KAAK,CAACN,cAAc,CAACK,MAAM,KAAKX,aAAa,GAAGA,aAAa,GAAGA,aAAa,GAAG,CAAC,CAAC;EAEvH,MAAMc,SAAS,GAAGC,EAAE,CAChB,mHAAmH,EACnH;;IAEI,OAAO,EAAEb,QAAQ,KAAKc,SAAS,CAACC,KAAK;IACrC,SAAS,EAAEf,QAAQ,KAAKc,SAAS,CAACC;GACrC,CACJ;EAED,oBACIC;IAAMJ,SAAS,EAAEA;KACZJ,YAAY,CAACH,GAAG,CAAC,CAACY,MAAM,EAAEC,KAAK;;IAC5B,MAAMC,OAAO,GAAGC,MA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AASC,UAAUA,CAAkBC,OAA8C;EAC9G,MAAM;IAAEC,GAAG;IAAEC;GAAO,GAAGF,OAAO;EAC9B,MAAM;IAAEG;GAAU,GAAG9B,cAAK,CAAC+B,UAAU,CAACC,UAAU,CAAC;EACjD,MAAMC,SAAS,GAAGJ,KAAK,CAACK,OAAO,CAACC,IAA6B;EAE7D,MAAMtD,OAAO,GAAGoD,SAAS,CAACG,UAAU,CAACA,UAAU;EAC/C,MAAMtD,aAAa,GAAGmD,SAAS,CAACG,UAAU,CAACC,gBAAgB;EAE3D,MAAMpD,WAAW,GAAGgD,SAAS,CAACK,SAAS,CAACC,cAAc,KAAKT,QAAQ;EACnE,MAAMU,gBAAgB,GAAG,CAAC,CAACX,KAAK,CAACY,QAAQ,EAAE,CAACC,gBAAgB,CAACF,gBAAgB;EAC7E,MAAMG,kBAAkB,GAAGV,SAAS,CAACK,SAAS,CAACK,kBAAkB;EACjE,MAAM;IAAEC;GAAW,GAAG5C,cAAK,CAAC+B,UAAU,CAACC,UAAU,CAAC;;;EAIlD,IAAInD,OAAO,aAAPA,OAAO,eAAPA,OAAO,CAAEY,MAAM,KAAKR,WAAW,IAAK2D,SAAS,IAAI,CAACD,kBAAkB,IAAI,CAACH,gBAAiB,CAAC,EAAE;IAC7F,oBACIxC,6BAACrB,OAAO;MACJE,OAAO,EAAEA,OAAO;MAChBC,aAAa,EAAEA,aAAa;MAC5BC,IAAI,EAAE6C,GAAG,CAACiB,QAAQ;MAClB7D,QAAQ,EAAEiD,SAAS,CAACjD,QAAQ,CAAC8D,IAAI;MACjC7D,WAAW,EAAEA;MACf;;EAIV,OAAO,IAAI;AACf,CAAC;;;;"}
|
@@ -0,0 +1,59 @@
|
|
1
|
+
import React__default from 'react';
|
2
|
+
import { Tooltip } from '../../../Tooltip/Tooltip.js';
|
3
|
+
import { IconButton } from '../../../IconButton/IconButton.js';
|
4
|
+
import { useLocalization } from '../../../Provider/Localization.js';
|
5
|
+
|
6
|
+
function Header(context) {
|
7
|
+
const {
|
8
|
+
texts
|
9
|
+
} = useLocalization();
|
10
|
+
const {
|
11
|
+
table
|
12
|
+
} = context;
|
13
|
+
const isSomeRowsExpanded = table.getIsSomeRowsExpanded();
|
14
|
+
const handleClick = event => {
|
15
|
+
event.stopPropagation();
|
16
|
+
table.toggleAllRowsExpanded(!isSomeRowsExpanded);
|
17
|
+
};
|
18
|
+
const title = isSomeRowsExpanded ? texts.table3.columns.expansion.collapseAll : texts.table3.columns.expansion.expandAll;
|
19
|
+
return /*#__PURE__*/React__default.createElement(Tooltip, {
|
20
|
+
title: title
|
21
|
+
}, /*#__PURE__*/React__default.createElement(IconButton, {
|
22
|
+
appearance: "transparent",
|
23
|
+
icon: isSomeRowsExpanded ? 'chevron-down-double' : 'chevron-right-double',
|
24
|
+
onClick: handleClick,
|
25
|
+
tabIndex: -1,
|
26
|
+
title: title
|
27
|
+
}));
|
28
|
+
}
|
29
|
+
function Cell(context) {
|
30
|
+
var _tableMeta$rowExpansi, _tableMeta$rowExpansi2;
|
31
|
+
const {
|
32
|
+
texts
|
33
|
+
} = useLocalization();
|
34
|
+
const tableMeta = context.table.options.meta;
|
35
|
+
const hasExpandedRow = (_tableMeta$rowExpansi = (_tableMeta$rowExpansi2 = tableMeta.rowExpansion).rowExpansionRenderer) === null || _tableMeta$rowExpansi === void 0 ? void 0 : _tableMeta$rowExpansi.call(_tableMeta$rowExpansi2, context.row.original);
|
36
|
+
if (hasExpandedRow) {
|
37
|
+
const isActiveRow = tableMeta.rowActive.rowActiveIndex === context.row.index;
|
38
|
+
const isExpanded = context.row.getIsExpanded();
|
39
|
+
const handleClick = event => {
|
40
|
+
event.stopPropagation();
|
41
|
+
context.row.toggleExpanded();
|
42
|
+
};
|
43
|
+
const title = isExpanded ? texts.table3.columns.expansion.collapse : texts.table3.columns.expansion.expand;
|
44
|
+
const tabIndex = isActiveRow ? 0 : -1;
|
45
|
+
return /*#__PURE__*/React__default.createElement(Tooltip, {
|
46
|
+
title: title
|
47
|
+
}, /*#__PURE__*/React__default.createElement(IconButton, {
|
48
|
+
appearance: "discrete",
|
49
|
+
icon: isExpanded ? 'chevron-down' : 'chevron-right',
|
50
|
+
onClick: handleClick,
|
51
|
+
tabIndex: tabIndex,
|
52
|
+
title: title
|
53
|
+
}));
|
54
|
+
}
|
55
|
+
return null;
|
56
|
+
}
|
57
|
+
|
58
|
+
export { Cell, Header };
|
59
|
+
//# sourceMappingURL=Expansion.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Expansion.js","sources":["../../../../../../../../../src/components/Report/components/Internal/Expansion.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 { useLocalization } from '../../../Provider/Localization';\nimport { Tooltip } from '../../../Tooltip/Tooltip';\nimport { IconButton } from '../../../IconButton/IconButton';\n\nexport function Header<TType = unknown>(context: ReactTableHeaderContext<TType, unknown>) {\n const { texts } = useLocalization();\n const { table } = context;\n\n const isSomeRowsExpanded = table.getIsSomeRowsExpanded();\n\n const handleClick = event => {\n event.stopPropagation();\n table.toggleAllRowsExpanded(!isSomeRowsExpanded);\n };\n\n const title = isSomeRowsExpanded ? texts.table3.columns.expansion.collapseAll : texts.table3.columns.expansion.expandAll;\n\n return (\n <Tooltip title={title}>\n <IconButton\n appearance=\"transparent\"\n icon={isSomeRowsExpanded ? 'chevron-down-double' : 'chevron-right-double'}\n onClick={handleClick}\n tabIndex={-1}\n title={title}\n />\n </Tooltip>\n );\n}\n\nexport function Cell<TType = unknown>(context: ReactTableCellContext<TType, unknown>) {\n const { texts } = useLocalization();\n const tableMeta = context.table.options.meta as ReactTableMeta<TType>;\n\n const hasExpandedRow = tableMeta.rowExpansion.rowExpansionRenderer?.(context.row.original);\n\n if (hasExpandedRow) {\n const isActiveRow = tableMeta.rowActive.rowActiveIndex === context.row.index;\n const isExpanded = context.row.getIsExpanded();\n\n const handleClick = event => {\n event.stopPropagation();\n context.row.toggleExpanded();\n };\n\n const title = isExpanded ? texts.table3.columns.expansion.collapse : texts.table3.columns.expansion.expand;\n const tabIndex = isActiveRow ? 0 : -1;\n\n return (\n <Tooltip title={title}>\n <IconButton\n appearance=\"discrete\"\n icon={isExpanded ? 'chevron-down' : 'chevron-right'}\n onClick={handleClick}\n tabIndex={tabIndex}\n title={title}\n />\n </Tooltip>\n );\n }\n\n return null;\n}\n"],"names":["Header","context","texts","useLocalization","table","isSomeRowsExpanded","getIsSomeRowsExpanded","handleClick","event","stopPropagation","toggleAllRowsExpanded","title","table3","columns","expansion","collapseAll","expandAll","React","Tooltip","IconButton","appearance","icon","onClick","tabIndex","Cell","tableMeta","options","meta","hasExpandedRow","_tableMeta$rowExpansi","_tableMeta$rowExpansi2","rowExpansion","rowExpansionRenderer","call","row","original","isActiveRow","rowActive","rowActiveIndex","index","isExpanded","getIsExpanded","toggleExpanded","collapse","expand"],"mappings":";;;;;SAUgBA,MAAMA,CAAkBC,OAAgD;EACpF,MAAM;IAAEC;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAM;IAAEC;GAAO,GAAGH,OAAO;EAEzB,MAAMI,kBAAkB,GAAGD,KAAK,CAACE,qBAAqB,EAAE;EAExD,MAAMC,WAAW,GAAGC,KAAK;IACrBA,KAAK,CAACC,eAAe,EAAE;IACvBL,KAAK,CAACM,qBAAqB,CAAC,CAACL,kBAAkB,CAAC;GACnD;EAED,MAAMM,KAAK,GAAGN,kBAAkB,GAAGH,KAAK,CAACU,MAAM,CAACC,OAAO,CAACC,SAAS,CAACC,WAAW,GAAGb,KAAK,CAACU,MAAM,CAACC,OAAO,CAACC,SAAS,CAACE,SAAS;EAExH,oBACIC,6BAACC,OAAO;IAACP,KAAK,EAAEA;kBACZM,6BAACE,UAAU;IACPC,UAAU,EAAC,aAAa;IACxBC,IAAI,EAAEhB,kBAAkB,GAAG,qBAAqB,GAAG,sBAAsB;IACzEiB,OAAO,EAAEf,WAAW;I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0,0 +1,118 @@
|
|
1
|
+
import React__default from 'react';
|
2
|
+
import cn from 'clsx';
|
3
|
+
import { Tooltip } from '../../../Tooltip/Tooltip.js';
|
4
|
+
import { useLocalization } from '../../../Provider/Localization.js';
|
5
|
+
import { Checkbox } from '../../../Checkbox/Checkbox.js';
|
6
|
+
import { Shortcut } from '../../../Shortcut/Shortcut.js';
|
7
|
+
import { getRadioClassnames } from '../../../RadioGroup/util.js';
|
8
|
+
|
9
|
+
function Header(context) {
|
10
|
+
const {
|
11
|
+
texts
|
12
|
+
} = useLocalization();
|
13
|
+
const {
|
14
|
+
table
|
15
|
+
} = context;
|
16
|
+
const tableMeta = table.options.meta;
|
17
|
+
if (table.options.enableMultiRowSelection) {
|
18
|
+
const isAllRowsSelected = table.getIsAllRowsSelected();
|
19
|
+
const isSomeRowsSelected = table.getIsSomeRowsSelected();
|
20
|
+
const title = isAllRowsSelected ? texts.table3.columns.select.deselectAll : texts.table3.columns.select.selectAll;
|
21
|
+
const handleChange = function (checked) {
|
22
|
+
try {
|
23
|
+
function _temp2() {
|
24
|
+
table.toggleAllRowsSelected(checked);
|
25
|
+
}
|
26
|
+
const _temp = function () {
|
27
|
+
if (tableMeta.server.loadAllIfNeeded) {
|
28
|
+
// don't pass the search query because we need all data - not filtered data
|
29
|
+
return Promise.resolve(tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters, undefined)).then(function () {});
|
30
|
+
}
|
31
|
+
}();
|
32
|
+
// load all data if that is possible
|
33
|
+
return Promise.resolve(_temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp));
|
34
|
+
} catch (e) {
|
35
|
+
return Promise.reject(e);
|
36
|
+
}
|
37
|
+
};
|
38
|
+
return /*#__PURE__*/React__default.createElement(Tooltip, {
|
39
|
+
title: title
|
40
|
+
}, /*#__PURE__*/React__default.createElement(Checkbox, {
|
41
|
+
"aria-label": title,
|
42
|
+
className: "hover:border-blue !-mt-px",
|
43
|
+
key: String(`${isAllRowsSelected}_${isSomeRowsSelected}`),
|
44
|
+
checked: isAllRowsSelected,
|
45
|
+
indeterminate: isSomeRowsSelected,
|
46
|
+
onChange: handleChange
|
47
|
+
}));
|
48
|
+
}
|
49
|
+
return null;
|
50
|
+
}
|
51
|
+
const toggleBetween = (fromRowIndex, toRowIndex) => {
|
52
|
+
const fromIndex = toRowIndex < fromRowIndex ? toRowIndex : fromRowIndex;
|
53
|
+
const toIndex = toRowIndex > fromRowIndex ? toRowIndex : fromRowIndex;
|
54
|
+
return [fromIndex, toIndex];
|
55
|
+
};
|
56
|
+
function Cell(context) {
|
57
|
+
var _table$getState$group;
|
58
|
+
const {
|
59
|
+
texts
|
60
|
+
} = useLocalization();
|
61
|
+
const {
|
62
|
+
row,
|
63
|
+
table
|
64
|
+
} = context;
|
65
|
+
const tableMeta = table.options.meta;
|
66
|
+
if (table.options.enableGrouping && (_table$getState$group = table.getState().grouping) !== null && _table$getState$group !== void 0 && _table$getState$group.length && !row.getIsGrouped()) {
|
67
|
+
return null;
|
68
|
+
}
|
69
|
+
const isSelected = row.getIsGrouped() ? row.getIsAllSubRowsSelected() : row.getIsSelected();
|
70
|
+
const title = isSelected ? texts.table3.columns.select.deselect : texts.table3.columns.select.select;
|
71
|
+
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();
|
82
|
+
}
|
83
|
+
tableMeta.rowSelection.lastSelectedRowIndex.current = row.index;
|
84
|
+
};
|
85
|
+
return /*#__PURE__*/React__default.createElement(Tooltip, {
|
86
|
+
title: /*#__PURE__*/React__default.createElement(React__default.Fragment, null, title, /*#__PURE__*/React__default.createElement(Shortcut, {
|
87
|
+
className: "ml-2",
|
88
|
+
keys: "Space"
|
89
|
+
}))
|
90
|
+
}, /*#__PURE__*/React__default.createElement(Checkbox, {
|
91
|
+
"aria-label": title,
|
92
|
+
className: "!mt-0",
|
93
|
+
checked: isSelected,
|
94
|
+
onClick: handleClick,
|
95
|
+
// this is necessary to remove console spam from eslint
|
96
|
+
onChange: () => false
|
97
|
+
}));
|
98
|
+
} else {
|
99
|
+
const className = cn('!mt-0', getRadioClassnames());
|
100
|
+
const handleClick = event => {
|
101
|
+
event.stopPropagation();
|
102
|
+
row.toggleSelected();
|
103
|
+
tableMeta.rowSelection.lastSelectedRowIndex.current = row.index;
|
104
|
+
};
|
105
|
+
return /*#__PURE__*/React__default.createElement("button", {
|
106
|
+
className: className,
|
107
|
+
"aria-checked": isSelected,
|
108
|
+
onClick: handleClick,
|
109
|
+
role: "radio",
|
110
|
+
type: "button"
|
111
|
+
}, isSelected ? /*#__PURE__*/React__default.createElement("span", {
|
112
|
+
className: "h-2 w-2 rounded-full bg-white"
|
113
|
+
}) : null);
|
114
|
+
}
|
115
|
+
}
|
116
|
+
|
117
|
+
export { Cell, Header };
|
118
|
+
//# sourceMappingURL=Selection.js.map
|
@@ -0,0 +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,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C;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;;;;"}
|
@@ -0,0 +1,102 @@
|
|
1
|
+
import React__default from 'react';
|
2
|
+
import cn from 'clsx';
|
3
|
+
import { RowContext } from './RowContext.js';
|
4
|
+
import { Cell } from '../Cell/Cell.js';
|
5
|
+
|
6
|
+
const DisplayRow = /*#__PURE__*/React__default.memo(function DisplayRow(props) {
|
7
|
+
const {
|
8
|
+
index,
|
9
|
+
measureRow,
|
10
|
+
row,
|
11
|
+
table
|
12
|
+
} = props;
|
13
|
+
const {
|
14
|
+
setIsHovered
|
15
|
+
} = React__default.useContext(RowContext);
|
16
|
+
const tableMeta = table.options.meta;
|
17
|
+
const attributes = {
|
18
|
+
'data-row-id': row.id,
|
19
|
+
'data-row-index': index,
|
20
|
+
onMouseEnter: React__default.useCallback(() => setIsHovered(true), []),
|
21
|
+
onMouseLeave: React__default.useCallback(() => setIsHovered(false), []),
|
22
|
+
tabIndex: -1
|
23
|
+
};
|
24
|
+
const handleClick = React__default.useCallback(event => {
|
25
|
+
var _event$currentTarget;
|
26
|
+
const clickedElement = event.target;
|
27
|
+
if (!((_event$currentTarget = event.currentTarget) !== null && _event$currentTarget !== void 0 && _event$currentTarget.contains(event.target)) || clickableElements.includes(clickedElement.tagName.toLowerCase()) || clickedElement.closest(clickableElements.map(tag => `tr ${tag}`).join(','))) {
|
28
|
+
return;
|
29
|
+
}
|
30
|
+
tableMeta.rowClick.handleClick(event, row.original);
|
31
|
+
}, [row.original]);
|
32
|
+
const handleClickCapture = React__default.useCallback(() => {
|
33
|
+
// do this in the next frame, otherwise it remounts the row and prevents row actions on hover from being clickable
|
34
|
+
requestAnimationFrame(() => tableMeta.rowActive.setRowActiveIndex(index));
|
35
|
+
}, []);
|
36
|
+
// row active
|
37
|
+
if (tableMeta.rowActive.isEnabled) {
|
38
|
+
attributes['data-row-active'] = tableMeta.rowActive.rowActiveIndex === index ? true : undefined;
|
39
|
+
// we use capture because it let's us picks up clicks on components inside the row, e.g. checkboxes
|
40
|
+
attributes.onClickCapture = handleClickCapture;
|
41
|
+
}
|
42
|
+
// row click
|
43
|
+
if (tableMeta.rowClick.isEnabled) {
|
44
|
+
attributes.onClick = handleClick;
|
45
|
+
}
|
46
|
+
// row grouping
|
47
|
+
if (table.options.enableGrouping) {
|
48
|
+
attributes['data-row-group'] = row.getIsGrouped() ? true : undefined;
|
49
|
+
}
|
50
|
+
// row selection
|
51
|
+
if (table.options.enableRowSelection) {
|
52
|
+
attributes['data-row-selected'] = row.getIsSelected() || row.getIsAllSubRowsSelected() ? true : undefined;
|
53
|
+
}
|
54
|
+
let expandedRow;
|
55
|
+
if (tableMeta.rowExpansion.isEnabled && row.getIsExpanded()) {
|
56
|
+
var _tableMeta$rowExpansi, _tableMeta$rowExpansi2, _tableMeta$rowExpansi3;
|
57
|
+
attributes['data-row-expanded'] = true;
|
58
|
+
expandedRow = (_tableMeta$rowExpansi = (_tableMeta$rowExpansi2 = tableMeta.rowExpansion).rowExpansionRenderer) === null || _tableMeta$rowExpansi === void 0 ? void 0 : (_tableMeta$rowExpansi3 = _tableMeta$rowExpansi.call(_tableMeta$rowExpansi2, row.original)) === null || _tableMeta$rowExpansi3 === void 0 ? void 0 : _tableMeta$rowExpansi3();
|
59
|
+
}
|
60
|
+
const rowMeta = row.original._meta;
|
61
|
+
if (rowMeta) {
|
62
|
+
if (rowMeta.layout) {
|
63
|
+
attributes['data-row-meta-layout'] = rowMeta.layout;
|
64
|
+
}
|
65
|
+
}
|
66
|
+
const ref = React__default.useRef(null);
|
67
|
+
const expansionRef = React__default.useRef(null);
|
68
|
+
const isExpanded = !!attributes['data-row-expanded'];
|
69
|
+
useSetVirtualisedRowHeight(measureRow, ref.current, expansionRef.current, isExpanded);
|
70
|
+
const className = cn('group/row', {
|
71
|
+
'hover:cursor-pointer': typeof attributes.onClick === 'function'
|
72
|
+
});
|
73
|
+
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("tr", Object.assign({}, attributes, {
|
74
|
+
className: className,
|
75
|
+
ref: ref
|
76
|
+
}), row.getVisibleCells().map((cell, cellIndex) => ( /*#__PURE__*/React__default.createElement(Cell, {
|
77
|
+
key: cell.id,
|
78
|
+
cell: cell,
|
79
|
+
index: cellIndex
|
80
|
+
})))), expandedRow ? ( /*#__PURE__*/React__default.createElement("tr", {
|
81
|
+
"data-row-parent-id": row.id,
|
82
|
+
ref: expansionRef
|
83
|
+
}, /*#__PURE__*/React__default.createElement("td", {
|
84
|
+
className: "col-span-full"
|
85
|
+
}, expandedRow))) : null);
|
86
|
+
});
|
87
|
+
const clickableElements = ['input', 'button', 'a', 'select', 'option', 'label', 'textarea'];
|
88
|
+
function useSetVirtualisedRowHeight(measureRow, rowEl, expansionEl, isExpanded) {
|
89
|
+
React__default.useEffect(() => {
|
90
|
+
if (rowEl) {
|
91
|
+
const height = rowEl.getBoundingClientRect().height;
|
92
|
+
if (isExpanded && expansionEl) {
|
93
|
+
measureRow(height, expansionEl.getBoundingClientRect().height);
|
94
|
+
} else {
|
95
|
+
measureRow(height);
|
96
|
+
}
|
97
|
+
}
|
98
|
+
}, [isExpanded, rowEl, expansionEl]);
|
99
|
+
}
|
100
|
+
|
101
|
+
export { DisplayRow };
|
102
|
+
//# sourceMappingURL=DisplayRow.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"DisplayRow.js","sources":["../../../../../../../../../src/components/Report/components/Row/DisplayRow.tsx"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable, Row as ReactTableRow, TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport cn from 'clsx';\nimport { RowContext } from './RowContext';\nimport { Cell } from '../Cell/Cell';\nimport { ReportRowWithMetaData } from '../../types';\n\nexport type DisplayRowProps<TType = unknown> = {\n index: number;\n measureRow: (size: number, expansionHeight?: number) => void;\n row: ReactTableRow<TType>;\n table: ReactTable<TType>;\n};\n\nexport const DisplayRow = React.memo(function DisplayRow<TType = unknown>(props: DisplayRowProps<TType>) {\n const { index, measureRow, row, table } = props;\n const { setIsHovered } = React.useContext(RowContext);\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n\n const attributes: any = {\n 'data-row-id': row.id,\n 'data-row-index': index,\n onMouseEnter: React.useCallback(() => setIsHovered(true), []),\n onMouseLeave: React.useCallback(() => setIsHovered(false), []),\n tabIndex: -1,\n };\n\n const handleClick = React.useCallback(\n (event: React.MouseEvent<HTMLTableRowElement>) => {\n const clickedElement = event.target as HTMLElement;\n\n if (\n !event.currentTarget?.contains(event.target as HTMLElement) ||\n clickableElements.includes(clickedElement.tagName.toLowerCase()) ||\n clickedElement.closest(clickableElements.map(tag => `tr ${tag}`).join(','))\n ) {\n return;\n }\n\n tableMeta.rowClick.handleClick(event, row.original);\n },\n [row.original]\n );\n const handleClickCapture = React.useCallback(() => {\n // do this in the next frame, otherwise it remounts the row and prevents row actions on hover from being clickable\n requestAnimationFrame(() => tableMeta.rowActive.setRowActiveIndex(index));\n }, []);\n\n // row active\n if (tableMeta.rowActive.isEnabled) {\n attributes['data-row-active'] = tableMeta.rowActive.rowActiveIndex === index ? true : undefined;\n // we use capture because it let's us picks up clicks on components inside the row, e.g. checkboxes\n attributes.onClickCapture = handleClickCapture;\n }\n\n // row click\n if (tableMeta.rowClick.isEnabled) {\n attributes.onClick = handleClick;\n }\n\n // row grouping\n if (table.options.enableGrouping) {\n attributes['data-row-group'] = row.getIsGrouped() ? true : undefined;\n }\n\n // row selection\n if (table.options.enableRowSelection) {\n attributes['data-row-selected'] = row.getIsSelected() || row.getIsAllSubRowsSelected() ? true : undefined;\n }\n\n let expandedRow;\n\n if (tableMeta.rowExpansion.isEnabled && row.getIsExpanded()) {\n attributes['data-row-expanded'] = true;\n expandedRow = tableMeta.rowExpansion.rowExpansionRenderer?.(row.original)?.();\n }\n\n const rowMeta = (row.original as ReportRowWithMetaData<TType>)._meta;\n\n if (rowMeta) {\n if (rowMeta.layout) {\n attributes['data-row-meta-layout'] = rowMeta.layout;\n }\n }\n\n const ref = React.useRef<HTMLTableRowElement>(null);\n const expansionRef = React.useRef<HTMLTableRowElement>(null);\n const isExpanded = !!attributes['data-row-expanded'];\n\n useSetVirtualisedRowHeight(measureRow, ref.current, expansionRef.current, isExpanded);\n\n const className = cn('group/row', {\n 'hover:cursor-pointer': typeof attributes.onClick === 'function',\n });\n\n return (\n <>\n <tr {...attributes} className={className} ref={ref}>\n {row.getVisibleCells().map((cell, cellIndex) => (\n <Cell key={cell.id} cell={cell} index={cellIndex} />\n ))}\n </tr>\n {expandedRow ? (\n <tr data-row-parent-id={row.id} ref={expansionRef}>\n <td className=\"col-span-full\">{expandedRow}</td>\n </tr>\n ) : null}\n </>\n );\n}) as <TType = unknown>(props: DisplayRowProps<TType>) => JSX.Element;\n\nconst clickableElements = ['input', 'button', 'a', 'select', 'option', 'label', 'textarea'];\n\nfunction useSetVirtualisedRowHeight(\n measureRow: (size: number, expansionHeight?: number) => void,\n rowEl: HTMLTableRowElement | null,\n expansionEl: HTMLTableRowElement | null,\n isExpanded: boolean\n) {\n React.useEffect(() => {\n if (rowEl) {\n const height = rowEl.getBoundingClientRect().height;\n\n if (isExpanded && expansionEl) {\n measureRow(height, expansionEl.getBoundingClientRect().height);\n } else {\n measureRow(height);\n }\n }\n }, [isExpanded, rowEl, expansionEl]);\n}\n"],"names":["DisplayRow","React","memo","props","index","measureRow","row","table","setIsHovered","useContext","RowContext","tableMeta","options","meta","attributes","id","onMouseEnter","useCallback","onMouseLeave","tabIndex","handleClick","event","clickedElement","target","_event$currentTarget","currentTarget","contains","clickableElements","includes","tagName","toLowerCase","closest","map","tag","join","rowClick","original","handleClickCapture","requestAnimationFrame","rowActive","setRowActiveIndex","isEnabled","rowActiveIndex","undefined","onClickCapture","onClick","enableGrouping","getIsGrouped","enableRowSelection","getIsSelected","getIsAllSubRowsSelected","expandedRow","rowExpansion","getIsExpanded","_tableMeta$rowExpansi","_tableMeta$rowExpansi2","_tableMeta$rowExpansi3","rowExpansionRenderer","call","rowMeta","_meta","layout","ref","useRef","expansionRef","isExpanded","useSetVirtualisedRowHeight","current","className","cn","getVisibleCells","cell","cellIndex","Cell","key","rowEl","expansionEl","useEffect","height","getBoundingClientRect"],"mappings":";;;;;MAcaA,UAAU,gBAAGC,cAAK,CAACC,IAAI,CAAC,SAASF,UAAUA,CAAkBG,KAA6B;EACnG,MAAM;IAAEC,KAAK;IAAEC,UAAU;IAAEC,GAAG;IAAEC;GAAO,GAAGJ,KAAK;EAC/C,MAAM;IAAEK;GAAc,GAAGP,cAAK,CAACQ,UAAU,CAACC,UAAU,CAAC;EACrD,MAAMC,SAAS,GAAGJ,KAAK,CAACK,OAAO,CAACC,IAA6B;EAE7D,MAAMC,UAAU,GAAQ;IACpB,aAAa,EAAER,GAAG,CAACS,EAAE;IACrB,gBAAgB,EAAEX,KAAK;IACvBY,YAAY,EAAEf,cAAK,CAACgB,WAAW,CAAC,MAAMT,YAAY,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC;IAC7DU,YAAY,EAAEjB,cAAK,CAACgB,WAAW,CAAC,MAAMT,YAAY,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC;IAC9DW,QAAQ,EAAE,CAAC;GACd;EAED,MAAMC,WAAW,GAAGnB,cAAK,CAACgB,WAAW,CAChCI,KAA4C;;IACzC,MAAMC,cAAc,GAAGD,KAAK,CAACE,MAAqB;IAElD,IACI,GAAAC,oBAAA,GAACH,KAAK,CAACI,aAAa,cAAAD,oBAAA,eAAnBA,oBAAA,CAAqBE,QAAQ,CAACL,KAAK,CAACE,MAAqB,CAAC,KAC3DI,iBAAiB,CAACC,QAAQ,CAACN,cAAc,CAACO,OAAO,CAACC,WAAW,EAAE,CAAC,IAChER,cAAc,CAACS,OAAO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AwBK,GAAG,CAACS,EAAE;IAAE+C,GAAG,EAAEE;kBACjC/D;IAAImE,SAAS,EAAC;KAAiBjB,WAAW,CAAM,CAC/C,IACL,IAAI,CACT;AAEX,CAAC;AAED,MAAMxB,iBAAiB,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,CAAC;AAE3F,SAASuC,0BAA0BA,CAC/B7D,UAA4D,EAC5DsE,KAAiC,EACjCC,WAAuC,EACvCX,UAAmB;EAEnBhE,cAAK,CAAC4E,SAAS,CAAC;IACZ,IAAIF,KAAK,EAAE;MACP,MAAMG,MAAM,GAAGH,KAAK,CAACI,qBAAqB,EAAE,CAACD,MAAM;MAEnD,IAAIb,UAAU,IAAIW,WAAW,EAAE;QAC3BvE,UAAU,CAACyE,MAAM,EAAEF,WAAW,CAACG,qBAAqB,EAAE,CAACD,MAAM,CAAC;OACjE,MAAM;QACHzE,UAAU,CAACyE,MAAM,CAAC;;;GAG7B,EAAE,CAACb,UAAU,EAAEU,KAAK,EAAEC,WAAW,CAAC,CAAC;AACxC;;;;"}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
import React__default from 'react';
|
2
|
+
import { RowContext } from './RowContext.js';
|
3
|
+
import { SkeletonRow } from './SkeletonRow.js';
|
4
|
+
import { DisplayRow } from './DisplayRow.js';
|
5
|
+
|
6
|
+
/* anonymous functions will break the memoisation on each render, wrap handlers in callbacks */
|
7
|
+
function Row(props) {
|
8
|
+
// context - it must be here for cells to read it, since they render alongside the row
|
9
|
+
const [isHovered, setIsHovered] = React__default.useState(false);
|
10
|
+
const contextValue = React__default.useMemo(() => ({
|
11
|
+
isHovered,
|
12
|
+
setIsHovered,
|
13
|
+
rowIndex: props.index
|
14
|
+
}), [isHovered]);
|
15
|
+
if (props.row.original === undefined) {
|
16
|
+
return /*#__PURE__*/React__default.createElement(SkeletonRow, Object.assign({}, props));
|
17
|
+
}
|
18
|
+
return /*#__PURE__*/React__default.createElement(RowContext.Provider, {
|
19
|
+
value: contextValue
|
20
|
+
}, /*#__PURE__*/React__default.createElement(DisplayRow, Object.assign({}, props)));
|
21
|
+
}
|
22
|
+
|
23
|
+
export { Row };
|
24
|
+
//# sourceMappingURL=Row.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Row.js","sources":["../../../../../../../../../src/components/Report/components/Row/Row.tsx"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable, Row as ReactTableRow } from '@tanstack/react-table';\nimport { SkeletonRow } from './SkeletonRow';\nimport { DisplayRow } from './DisplayRow';\nimport { RowContext } from './RowContext';\n\nexport type RowProps<TType = unknown> = React.HTMLAttributes<HTMLTableRowElement> & {\n index: number;\n measureRow: (size: number, expansionHeight?: number) => void;\n row: ReactTableRow<TType>;\n table: ReactTable<TType>;\n};\n\n/* anonymous functions will break the memoisation on each render, wrap handlers in callbacks */\nexport function Row<TType = unknown>(props: RowProps<TType>) {\n // context - it must be here for cells to read it, since they render alongside the row\n const [isHovered, setIsHovered] = React.useState(false);\n const contextValue = React.useMemo(() => ({ isHovered, setIsHovered, rowIndex: props.index }), [isHovered]);\n\n if (props.row.original === undefined) {\n return <SkeletonRow {...props} />;\n }\n\n return (\n <RowContext.Provider value={contextValue}>\n <DisplayRow<TType> {...props} />\n </RowContext.Provider>\n );\n}\n"],"names":["Row","props","isHovered","setIsHovered","React","useState","contextValue","useMemo","rowIndex","index","row","original","undefined","SkeletonRow","RowContext","Provider","value","DisplayRow"],"mappings":";;;;;AAaA;SACgBA,GAAGA,CAAkBC,KAAsB;;EAEvD,MAAM,CAACC,SAAS,EAAEC,YAAY,CAAC,GAAGC,cAAK,CAACC,QAAQ,CAAC,KAAK,CAAC;EACvD,MAAMC,YAAY,GAAGF,cAAK,CAACG,OAAO,CAAC,OAAO;IAAEL,SAAS;IAAEC,YAAY;IAAEK,QAAQ,EAAEP,KAAK,CAACQ;GAAO,CAAC,EAAE,CAACP,SAAS,CAAC,CAAC;EAE3G,IAAID,KAAK,CAACS,GAAG,CAACC,QAAQ,KAAKC,SAAS,EAAE;IAClC,oBAAOR,6BAACS,WAAW,oBAAKZ,KAAK,EAAI;;EAGrC,oBACIG,6BAACU,UAAU,CAACC,QAAQ;IAACC,KAAK,EAAEV;kBACxBF,6BAACa,UAAU,oBAAYhB,KAAK,EAAI,CACd;AAE9B;;;;"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"RowContext.js","sources":["../../../../../../../../../src/components/Report/components/Row/RowContext.tsx"],"sourcesContent":["import React from 'react';\n\ntype RowContextValue = {\n isHovered: boolean;\n setIsHovered: (value: boolean) => void;\n rowIndex: number;\n};\n\nexport const RowContext = React.createContext<RowContextValue>({\n isHovered: false,\n setIsHovered: () => undefined,\n rowIndex: -1,\n});\n"],"names":["RowContext","React","createContext","isHovered","setIsHovered","undefined","rowIndex"],"mappings":";;MAQaA,UAAU,gBAAGC,cAAK,CAACC,aAAa,CAAkB;EAC3DC,SAAS,EAAE,KAAK;EAChBC,YAAY,EAAEA,MAAMC,SAAS;EAC7BC,QAAQ,EAAE,CAAC;CACd;;;;"}
|