@servicetitan/anvil2 2.9.0 → 2.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -0
- package/dist/{AiMark-DR-w6Nbm.js → AiMark-DhgDh95y.js} +2 -2
- package/dist/{AiMark-DR-w6Nbm.js.map → AiMark-DhgDh95y.js.map} +1 -1
- package/dist/AiMark.js +1 -1
- package/dist/{Alert-Dj61Bq8h.js → Alert-DffLPz0l.js} +2 -2
- package/dist/{Alert-Dj61Bq8h.js.map → Alert-DffLPz0l.js.map} +1 -1
- package/dist/Alert.js +1 -1
- package/dist/{Breadcrumbs-ojgYVZwe.js → Breadcrumbs-CkPZHJGM.js} +2 -2
- package/dist/{Breadcrumbs-ojgYVZwe.js.map → Breadcrumbs-CkPZHJGM.js.map} +1 -1
- package/dist/Breadcrumbs.js +1 -1
- package/dist/{Calendar-Dxl9QnfP.js → Calendar-0DG2so95.js} +2 -2
- package/dist/{Calendar-Dxl9QnfP.js.map → Calendar-0DG2so95.js.map} +1 -1
- package/dist/{Calendar-Cka4unyi.js → Calendar-CaWPwtb3.js} +2 -2
- package/dist/{Calendar-Cka4unyi.js.map → Calendar-CaWPwtb3.js.map} +1 -1
- package/dist/Calendar.js +2 -2
- package/dist/{Checkbox-B-XTVPbX.js → Checkbox-B1I1OfZU.js} +3 -3
- package/dist/{Checkbox-B-XTVPbX.js.map → Checkbox-B1I1OfZU.js.map} +1 -1
- package/dist/{Checkbox-Cw1-KFvq.js → Checkbox-CTR7JfWk.js} +2 -2
- package/dist/{Checkbox-Cw1-KFvq.js.map → Checkbox-CTR7JfWk.js.map} +1 -1
- package/dist/Checkbox.js +1 -1
- package/dist/{Chip-Ce0WGKAc.js → Chip-lIWu8uXb.js} +2 -2
- package/dist/{Chip-Ce0WGKAc.js.map → Chip-lIWu8uXb.js.map} +1 -1
- package/dist/Chip.js +1 -1
- package/dist/{Combobox-CNQUROyr.js → Combobox-Dt3AnO9Z.js} +4 -4
- package/dist/{Combobox-CNQUROyr.js.map → Combobox-Dt3AnO9Z.js.map} +1 -1
- package/dist/Combobox.js +1 -1
- package/dist/{DataTable-BCV_mtSy.js → DataTable-bMoIuYBK.js} +397 -440
- package/dist/DataTable-bMoIuYBK.js.map +1 -0
- package/dist/DataTable.css +121 -80
- package/dist/{DateFieldRange-D2hnF50O.js → DateFieldRange-B_D6v-F7.js} +4 -4
- package/dist/{DateFieldRange-D2hnF50O.js.map → DateFieldRange-B_D6v-F7.js.map} +1 -1
- package/dist/DateFieldRange.js +1 -1
- package/dist/{DateFieldSingle-BuaB7RDr.js → DateFieldSingle-D_Ve0E6q.js} +4 -4
- package/dist/{DateFieldSingle-BuaB7RDr.js.map → DateFieldSingle-D_Ve0E6q.js.map} +1 -1
- package/dist/DateFieldSingle.js +1 -1
- package/dist/{DateFieldYearless-DLeMEutt.js → DateFieldYearless-Bg7OLIsT.js} +4 -4
- package/dist/{DateFieldYearless-DLeMEutt.js.map → DateFieldYearless-Bg7OLIsT.js.map} +1 -1
- package/dist/DateFieldYearless.js +1 -1
- package/dist/{DateFieldYearlessRange-BfPuYKKC.js → DateFieldYearlessRange-C40uUmLK.js} +3 -3
- package/dist/{DateFieldYearlessRange-BfPuYKKC.js.map → DateFieldYearlessRange-C40uUmLK.js.map} +1 -1
- package/dist/DateFieldYearlessRange.js +1 -1
- package/dist/{DaysOfTheWeek-BW1T8sTU.js → DaysOfTheWeek-2a8Ukq59.js} +2 -2
- package/dist/{DaysOfTheWeek-BW1T8sTU.js.map → DaysOfTheWeek-2a8Ukq59.js.map} +1 -1
- package/dist/DaysOfTheWeek.js +1 -1
- package/dist/{Dialog-Cewu2pd_.js → Dialog-zxpNOCDS.js} +4 -4
- package/dist/{Dialog-Cewu2pd_.js.map → Dialog-zxpNOCDS.js.map} +1 -1
- package/dist/Dialog.js +1 -1
- package/dist/{Drawer-Cb5asXWf.js → Drawer-DkCcE434.js} +4 -4
- package/dist/{Drawer-Cb5asXWf.js.map → Drawer-DkCcE434.js.map} +1 -1
- package/dist/Drawer.js +1 -1
- package/dist/DrillDown.js +1 -1
- package/dist/{EditCard-DlJE3LXN.js → EditCard-BKHmnbKP.js} +2 -2
- package/dist/{EditCard-DlJE3LXN.js.map → EditCard-BKHmnbKP.js.map} +1 -1
- package/dist/EditCard.js +1 -1
- package/dist/{FieldLabel-HO2VP-4B.js → FieldLabel-M5v4-PAV.js} +2 -2
- package/dist/{FieldLabel-HO2VP-4B.js.map → FieldLabel-M5v4-PAV.js.map} +1 -1
- package/dist/FieldLabel.js +1 -1
- package/dist/{InputMask-CLLTehFI.js → InputMask-PVCfJodz.js} +3 -3
- package/dist/{InputMask-CLLTehFI.js.map → InputMask-PVCfJodz.js.map} +1 -1
- package/dist/InputMask.js +1 -1
- package/dist/{ListView-CPi-qG2w.js → ListView-DT32FdKH.js} +2 -2
- package/dist/{ListView-CPi-qG2w.js.map → ListView-DT32FdKH.js.map} +1 -1
- package/dist/ListView.js +1 -1
- package/dist/{Listbox-Bp4hqIpH.js → Listbox-BR0HTJaM.js} +2 -2
- package/dist/{Listbox-Bp4hqIpH.js.map → Listbox-BR0HTJaM.js.map} +1 -1
- package/dist/Listbox.js +1 -1
- package/dist/MultiSelectField.js +1 -1
- package/dist/{MultiSelectFieldSync-ChZCW4M9.js → MultiSelectFieldSync-fV2O5J0N.js} +5 -5
- package/dist/{MultiSelectFieldSync-ChZCW4M9.js.map → MultiSelectFieldSync-fV2O5J0N.js.map} +1 -1
- package/dist/MultiSelectMenu.js +1 -1
- package/dist/{MultiSelectMenuSync-7C1wW4oO.js → MultiSelectMenuSync-BViWKlX1.js} +3 -3
- package/dist/{MultiSelectMenuSync-7C1wW4oO.js.map → MultiSelectMenuSync-BViWKlX1.js.map} +1 -1
- package/dist/{NumberField-CZSTHBeO.js → NumberField-BxWTjbmF.js} +3 -3
- package/dist/{NumberField-CZSTHBeO.js.map → NumberField-BxWTjbmF.js.map} +1 -1
- package/dist/NumberField.js +1 -1
- package/dist/{Page-BHdvTlfE.js → Page-DFjOwTzH.js} +8 -8
- package/dist/{Page-BHdvTlfE.js.map → Page-DFjOwTzH.js.map} +1 -1
- package/dist/Page.js +1 -1
- package/dist/{Pagination-DecGSuW4.js → Pagination-B9pdkp_V.js} +4 -4
- package/dist/{Pagination-DecGSuW4.js.map → Pagination-B9pdkp_V.js.map} +1 -1
- package/dist/Pagination.css +7 -6
- package/dist/Pagination.js +1 -1
- package/dist/{Popover-BbqTZw-1.js → Popover-CfG1IJP6.js} +2 -2
- package/dist/{Popover-BbqTZw-1.js.map → Popover-CfG1IJP6.js.map} +1 -1
- package/dist/Popover.js +1 -1
- package/dist/{ProgressBar-CZcxkdX6.js → ProgressBar-CFKKuXeN.js} +2 -2
- package/dist/{ProgressBar-CZcxkdX6.js.map → ProgressBar-CFKKuXeN.js.map} +1 -1
- package/dist/ProgressBar.js +1 -1
- package/dist/{Radio-BFr8AdHc.js → Radio-CeVjHOXe.js} +2 -2
- package/dist/{Radio-BFr8AdHc.js.map → Radio-CeVjHOXe.js.map} +1 -1
- package/dist/{Radio-DJZVMCv0.js → Radio-Dda5sh2r.js} +3 -3
- package/dist/{Radio-DJZVMCv0.js.map → Radio-Dda5sh2r.js.map} +1 -1
- package/dist/Radio.js +1 -1
- package/dist/{SelectCard-DVcWJRbX.js → SelectCard-COJn0wT6.js} +3 -3
- package/dist/{SelectCard-DVcWJRbX.js.map → SelectCard-COJn0wT6.js.map} +1 -1
- package/dist/SelectCard.js +1 -1
- package/dist/SelectField.js +1 -1
- package/dist/{SelectFieldLabel-kEBS8L4l.js → SelectFieldLabel-ChEvk0uS.js} +2 -2
- package/dist/{SelectFieldLabel-kEBS8L4l.js.map → SelectFieldLabel-ChEvk0uS.js.map} +1 -1
- package/dist/{SelectFieldSync-o1Cp9UYC.js → SelectFieldSync-CDIRIYv2.js} +4 -4
- package/dist/{SelectFieldSync-o1Cp9UYC.js.map → SelectFieldSync-CDIRIYv2.js.map} +1 -1
- package/dist/SelectMenu.js +1 -1
- package/dist/{SelectMenuSync-DXrwecFt.js → SelectMenuSync-DkQrikHz.js} +3 -3
- package/dist/{SelectMenuSync-DXrwecFt.js.map → SelectMenuSync-DkQrikHz.js.map} +1 -1
- package/dist/{SelectOptions-Dy2OWqxn.js → SelectOptions-BN1tCi7P.js} +2 -2
- package/dist/{SelectOptions-Dy2OWqxn.js.map → SelectOptions-BN1tCi7P.js.map} +1 -1
- package/dist/{SelectTrigger-DhKYzEAr.js → SelectTrigger-LZUtpAFW.js} +2 -2
- package/dist/{SelectTrigger-DhKYzEAr.js.map → SelectTrigger-LZUtpAFW.js.map} +1 -1
- package/dist/SelectTrigger.js +1 -1
- package/dist/{SelectTriggerBase-Ni8WqeUx.js → SelectTriggerBase-qeFownmF.js} +3 -3
- package/dist/{SelectTriggerBase-Ni8WqeUx.js.map → SelectTriggerBase-qeFownmF.js.map} +1 -1
- package/dist/{Switch-C84MBChG.js → Switch-3u7oAQQV.js} +2 -2
- package/dist/{Switch-C84MBChG.js.map → Switch-3u7oAQQV.js.map} +1 -1
- package/dist/Switch.js +1 -1
- package/dist/Table.js +1 -1
- package/dist/{Text-WiS8UZkY.js → Text-DQ78JchQ.js} +2 -2
- package/dist/{Text-WiS8UZkY.js.map → Text-DQ78JchQ.js.map} +1 -1
- package/dist/Text.js +1 -1
- package/dist/{TextField-OznkTx4e.js → TextField-Bu5kAe9_.js} +2 -2
- package/dist/{TextField-OznkTx4e.js.map → TextField-Bu5kAe9_.js.map} +1 -1
- package/dist/{TextField-Bul_uln5.js → TextField-DHk1k3cf.js} +3 -3
- package/dist/{TextField-Bul_uln5.js.map → TextField-DHk1k3cf.js.map} +1 -1
- package/dist/TextField.js +1 -1
- package/dist/{Textarea-CCYLsJ1x.js → Textarea-CYv02rxW.js} +3 -3
- package/dist/{Textarea-CCYLsJ1x.js.map → Textarea-CYv02rxW.js.map} +1 -1
- package/dist/Textarea.js +1 -1
- package/dist/{TimeField-BPvPbD8H.js → TimeField-BYtP64Qx.js} +4 -4
- package/dist/{TimeField-BPvPbD8H.js.map → TimeField-BYtP64Qx.js.map} +1 -1
- package/dist/TimeField.js +1 -1
- package/dist/Toast.js +2 -2
- package/dist/{Toaster-DYJm06Vb.js → Toaster-BRjGoIQu.js} +3 -3
- package/dist/{Toaster-DYJm06Vb.js.map → Toaster-BRjGoIQu.js.map} +1 -1
- package/dist/{Toaster-CIaIvwH6.js → Toaster-DO83u5o3.js} +2 -2
- package/dist/{Toaster-CIaIvwH6.js.map → Toaster-DO83u5o3.js.map} +1 -1
- package/dist/{Toolbar-ByyI7SqG.js → Toolbar-Dsaufi65.js} +12 -12
- package/dist/{Toolbar-ByyI7SqG.js.map → Toolbar-Dsaufi65.js.map} +1 -1
- package/dist/Toolbar.js +1 -1
- package/dist/{YearlessDateInputWithPicker-C_twiQW5.js → YearlessDateInputWithPicker-CChqr1gR.js} +2 -2
- package/dist/{YearlessDateInputWithPicker-C_twiQW5.js.map → YearlessDateInputWithPicker-CChqr1gR.js.map} +1 -1
- package/dist/assets/icons/st/unsorted.svg +1 -0
- package/dist/assets/icons/st.ts +1 -0
- package/dist/beta/components/Table/DataTable/DataTable.d.ts +22 -0
- package/dist/beta/components/Table/DataTable/internal/DataTableBody.d.ts +19 -4
- package/dist/beta/components/Table/DataTable/internal/DataTableBodyRow.d.ts +18 -1
- package/dist/beta/components/Table/DataTable/internal/DataTableHeader.d.ts +4 -2
- package/dist/beta/components/Table/DataTable/internal/cells/DataTableBodyCell.d.ts +0 -2
- package/dist/beta/components/Table/DataTable/internal/cells/DataTableBodyImmutableCell.d.ts +0 -5
- package/dist/beta/components/Table/DataTable/internal/cells/DataTableBodyMutableCell.d.ts +0 -5
- package/dist/beta/components/Table/DataTable/internal/cells/useCellFocusListener.d.ts +10 -0
- package/dist/beta/components/Table/DataTable/internal/context/focus/DTFocusProvider.d.ts +4 -1
- package/dist/beta/components/Table/DataTable/internal/editable-cells/DataTableEditableMultiselectAsyncCell.d.ts +0 -1
- package/dist/beta/components/Table/DataTable/internal/editable-cells/DataTableEditableMultiselectCell.d.ts +0 -1
- package/dist/beta/components/Table/DataTable/internal/editable-cells/types.d.ts +0 -4
- package/dist/beta/components/Table/DataTable/internal/editable-cells/useEditableMenuCell.d.ts +3 -6
- package/dist/beta/components/Table/DataTable/internal/useDataTableVirtualizer.d.ts +29 -0
- package/dist/beta/components/Table/DataTable/internal/util/shallowSortingEqual.d.ts +2 -0
- package/dist/beta/components/Table/DataTable/stories/DataTable.story-data.d.ts +1 -0
- package/dist/beta/components/Table/createColumnHelper.d.ts +19 -2
- package/dist/beta/components/Table/types.d.ts +23 -2
- package/dist/beta.js +9 -9
- package/dist/index.js +36 -36
- package/dist/{stripInlineMarkdown-Cg1qlNwL.js → stripInlineMarkdown-V3M_UxQ8.js} +2 -2
- package/dist/{stripInlineMarkdown-Cg1qlNwL.js.map → stripInlineMarkdown-V3M_UxQ8.js.map} +1 -1
- package/dist/{syncFilterUtils-UR5Vgqkh.js → syncFilterUtils-DtOBvzdr.js} +4 -4
- package/dist/{syncFilterUtils-UR5Vgqkh.js.map → syncFilterUtils-DtOBvzdr.js.map} +1 -1
- package/dist/token.js +1 -5
- package/dist/token.js.map +1 -1
- package/dist/{useDrilldown-D6VZNSCX.js → useDrilldown-CK9KzXvI.js} +3 -3
- package/dist/{useDrilldown-D6VZNSCX.js.map → useDrilldown-CK9KzXvI.js.map} +1 -1
- package/dist/{useInitialFocus-BUxEDMEG.js → useInitialFocus-BIvXK1Rp.js} +2 -2
- package/dist/{useInitialFocus-BUxEDMEG.js.map → useInitialFocus-BIvXK1Rp.js.map} +1 -1
- package/dist/{usePopoverTransitionStates-CDXCdyKa.js → usePopoverTransitionStates-B1opfxxn.js} +1 -2
- package/dist/{usePopoverTransitionStates-CDXCdyKa.js.map → usePopoverTransitionStates-B1opfxxn.js.map} +1 -1
- package/dist/{useToggleSelection-BBdrIVWs.js → useToggleSelection-BMXohj4f.js} +2 -2
- package/dist/{useToggleSelection-BBdrIVWs.js.map → useToggleSelection-BMXohj4f.js.map} +1 -1
- package/package.json +2 -2
- package/dist/DataTable-BCV_mtSy.js.map +0 -1
- package/dist/beta/components/Table/DataTable/internal/cells/CellFocusContext.d.ts +0 -16
- package/dist/beta/components/Table/DataTable/internal/context/hover/DTHoverContext.d.ts +0 -31
- package/dist/beta/components/Table/DataTable/internal/context/hover/DTHoverProvider.d.ts +0 -3
- package/dist/beta/components/Table/DataTable/internal/context/hover/useDTHoverDispatchContext.d.ts +0 -1
- package/dist/beta/components/Table/DataTable/internal/context/hover/useDTHoverStateContext.d.ts +0 -4
- package/dist/beta/components/Table/internal/getColSpanWidth.d.ts +0 -7
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
|
-
import { C as Chip } from './Chip-
|
|
2
|
+
import { C as Chip } from './Chip-lIWu8uXb.js';
|
|
3
3
|
import { F as Flex } from './Flex-WyyZm1bf.js';
|
|
4
4
|
import * as React from 'react';
|
|
5
|
-
import { useRef, useState, useLayoutEffect, createContext, useContext, useCallback, forwardRef, useMemo, useImperativeHandle, useEffect, useId, Fragment as Fragment$1, isValidElement
|
|
5
|
+
import { useRef, useState, useLayoutEffect, createContext, useContext, useCallback, forwardRef, useMemo, useImperativeHandle, useEffect, useId, memo as memo$1, Fragment as Fragment$1, isValidElement } from 'react';
|
|
6
6
|
import { c as cx } from './index-De1g9FRV.js';
|
|
7
7
|
import { D as DateTime } from './luxon-wpz4A-OQ.js';
|
|
8
|
-
import { C as Checkbox } from './Checkbox-
|
|
8
|
+
import { C as Checkbox } from './Checkbox-CTR7JfWk.js';
|
|
9
9
|
import { B as Button } from './Button-BdrrhBTI.js';
|
|
10
10
|
import { S as SvgChevronRight } from './chevron_right-BdpsxX7x.js';
|
|
11
11
|
import { S as SvgEdit } from './edit-DQOiktcu.js';
|
|
@@ -13,16 +13,17 @@ import { I as Icon } from './Icon-DuIlne4x.js';
|
|
|
13
13
|
import { S as SrOnly } from './SrOnly-eUpYGpAT.js';
|
|
14
14
|
import { u as useNumberField } from './useNumberField-eMyk7MB8.js';
|
|
15
15
|
import { u as useMergeRefs, m as mergeRefs } from './useMergeRefs-Dfmtq9cI.js';
|
|
16
|
-
import { a as SelectMenuSync, S as SelectMenu } from './SelectMenuSync-
|
|
17
|
-
import { a as MultiSelectMenuSync, M as MultiSelectMenu } from './MultiSelectMenuSync-
|
|
18
|
-
import { F as FieldLabel } from './FieldLabel-
|
|
16
|
+
import { a as SelectMenuSync, S as SelectMenu } from './SelectMenuSync-DkQrikHz.js';
|
|
17
|
+
import { a as MultiSelectMenuSync, M as MultiSelectMenu } from './MultiSelectMenuSync-BViWKlX1.js';
|
|
18
|
+
import { F as FieldLabel } from './FieldLabel-M5v4-PAV.js';
|
|
19
19
|
import { S as SvgError } from './error-DR_wWdYY.js';
|
|
20
20
|
import { S as SvgWarning } from './warning-c4Wj1rI4.js';
|
|
21
21
|
import { T as Tooltip } from './Tooltip-C1PBRnJv.js';
|
|
22
22
|
import { flushSync } from 'react-dom';
|
|
23
23
|
import { u as useLayoutPropsUtil } from './useLayoutPropsUtil-DMDdfIah.js';
|
|
24
|
-
import { P as Pagination } from './Pagination-
|
|
24
|
+
import { P as Pagination } from './Pagination-B9pdkp_V.js';
|
|
25
25
|
import { T as ThemeProviderContext } from './ThemeProviderContext-l52GohYT.js';
|
|
26
|
+
import { u as useVirtualizer } from './index-DXeGMe23.js';
|
|
26
27
|
import { S as Spinner } from './Spinner-BqmcE2pb.js';
|
|
27
28
|
import { u as useOptionallyControlledState } from './useOptionallyControlledState-DbDuos5L.js';
|
|
28
29
|
import { u as usePrefersColorScheme } from './usePrefersColorScheme-_hT7dK7_.js';
|
|
@@ -1192,7 +1193,7 @@ const createRow = (table, id, original, rowIndex, depth, subRows, parentId) => {
|
|
|
1192
1193
|
var _row$getValue;
|
|
1193
1194
|
return (_row$getValue = row.getValue(columnId)) != null ? _row$getValue : table.options.renderFallbackValue;
|
|
1194
1195
|
},
|
|
1195
|
-
subRows:
|
|
1196
|
+
subRows: [],
|
|
1196
1197
|
getLeafRows: () => flattenBy(row.subRows, d => d.subRows),
|
|
1197
1198
|
getParentRow: () => row.parentId ? table.getRow(row.parentId, true) : undefined,
|
|
1198
1199
|
getParentRows: () => {
|
|
@@ -3657,146 +3658,6 @@ function expandRows(rowModel) {
|
|
|
3657
3658
|
};
|
|
3658
3659
|
}
|
|
3659
3660
|
|
|
3660
|
-
function getGroupedRowModel() {
|
|
3661
|
-
return table => memo(() => [table.getState().grouping, table.getPreGroupedRowModel()], (grouping, rowModel) => {
|
|
3662
|
-
if (!rowModel.rows.length || !grouping.length) {
|
|
3663
|
-
rowModel.rows.forEach(row => {
|
|
3664
|
-
row.depth = 0;
|
|
3665
|
-
row.parentId = undefined;
|
|
3666
|
-
});
|
|
3667
|
-
return rowModel;
|
|
3668
|
-
}
|
|
3669
|
-
|
|
3670
|
-
// Filter the grouping list down to columns that exist
|
|
3671
|
-
const existingGrouping = grouping.filter(columnId => table.getColumn(columnId));
|
|
3672
|
-
const groupedFlatRows = [];
|
|
3673
|
-
const groupedRowsById = {};
|
|
3674
|
-
// const onlyGroupedFlatRows: Row[] = [];
|
|
3675
|
-
// const onlyGroupedRowsById: Record<RowId, Row> = {};
|
|
3676
|
-
// const nonGroupedFlatRows: Row[] = [];
|
|
3677
|
-
// const nonGroupedRowsById: Record<RowId, Row> = {};
|
|
3678
|
-
|
|
3679
|
-
// Recursively group the data
|
|
3680
|
-
const groupUpRecursively = function (rows, depth, parentId) {
|
|
3681
|
-
if (depth === void 0) {
|
|
3682
|
-
depth = 0;
|
|
3683
|
-
}
|
|
3684
|
-
// Grouping depth has been been met
|
|
3685
|
-
// Stop grouping and simply rewrite thd depth and row relationships
|
|
3686
|
-
if (depth >= existingGrouping.length) {
|
|
3687
|
-
return rows.map(row => {
|
|
3688
|
-
row.depth = depth;
|
|
3689
|
-
groupedFlatRows.push(row);
|
|
3690
|
-
groupedRowsById[row.id] = row;
|
|
3691
|
-
if (row.subRows) {
|
|
3692
|
-
row.subRows = groupUpRecursively(row.subRows, depth + 1, row.id);
|
|
3693
|
-
}
|
|
3694
|
-
return row;
|
|
3695
|
-
});
|
|
3696
|
-
}
|
|
3697
|
-
const columnId = existingGrouping[depth];
|
|
3698
|
-
|
|
3699
|
-
// Group the rows together for this level
|
|
3700
|
-
const rowGroupsMap = groupBy(rows, columnId);
|
|
3701
|
-
|
|
3702
|
-
// Perform aggregations for each group
|
|
3703
|
-
const aggregatedGroupedRows = Array.from(rowGroupsMap.entries()).map((_ref, index) => {
|
|
3704
|
-
let [groupingValue, groupedRows] = _ref;
|
|
3705
|
-
let id = `${columnId}:${groupingValue}`;
|
|
3706
|
-
id = parentId ? `${parentId}>${id}` : id;
|
|
3707
|
-
|
|
3708
|
-
// First, Recurse to group sub rows before aggregation
|
|
3709
|
-
const subRows = groupUpRecursively(groupedRows, depth + 1, id);
|
|
3710
|
-
subRows.forEach(subRow => {
|
|
3711
|
-
subRow.parentId = id;
|
|
3712
|
-
});
|
|
3713
|
-
|
|
3714
|
-
// Flatten the leaf rows of the rows in this group
|
|
3715
|
-
const leafRows = depth ? flattenBy(groupedRows, row => row.subRows) : groupedRows;
|
|
3716
|
-
const row = createRow(table, id, leafRows[0].original, index, depth, undefined, parentId);
|
|
3717
|
-
Object.assign(row, {
|
|
3718
|
-
groupingColumnId: columnId,
|
|
3719
|
-
groupingValue,
|
|
3720
|
-
subRows,
|
|
3721
|
-
leafRows,
|
|
3722
|
-
getValue: columnId => {
|
|
3723
|
-
// Don't aggregate columns that are in the grouping
|
|
3724
|
-
if (existingGrouping.includes(columnId)) {
|
|
3725
|
-
if (row._valuesCache.hasOwnProperty(columnId)) {
|
|
3726
|
-
return row._valuesCache[columnId];
|
|
3727
|
-
}
|
|
3728
|
-
if (groupedRows[0]) {
|
|
3729
|
-
var _groupedRows$0$getVal;
|
|
3730
|
-
row._valuesCache[columnId] = (_groupedRows$0$getVal = groupedRows[0].getValue(columnId)) != null ? _groupedRows$0$getVal : undefined;
|
|
3731
|
-
}
|
|
3732
|
-
return row._valuesCache[columnId];
|
|
3733
|
-
}
|
|
3734
|
-
if (row._groupingValuesCache.hasOwnProperty(columnId)) {
|
|
3735
|
-
return row._groupingValuesCache[columnId];
|
|
3736
|
-
}
|
|
3737
|
-
|
|
3738
|
-
// Aggregate the values
|
|
3739
|
-
const column = table.getColumn(columnId);
|
|
3740
|
-
const aggregateFn = column == null ? void 0 : column.getAggregationFn();
|
|
3741
|
-
if (aggregateFn) {
|
|
3742
|
-
row._groupingValuesCache[columnId] = aggregateFn(columnId, leafRows, groupedRows);
|
|
3743
|
-
return row._groupingValuesCache[columnId];
|
|
3744
|
-
}
|
|
3745
|
-
}
|
|
3746
|
-
});
|
|
3747
|
-
subRows.forEach(subRow => {
|
|
3748
|
-
groupedFlatRows.push(subRow);
|
|
3749
|
-
groupedRowsById[subRow.id] = subRow;
|
|
3750
|
-
// if (subRow.getIsGrouped?.()) {
|
|
3751
|
-
// onlyGroupedFlatRows.push(subRow);
|
|
3752
|
-
// onlyGroupedRowsById[subRow.id] = subRow;
|
|
3753
|
-
// } else {
|
|
3754
|
-
// nonGroupedFlatRows.push(subRow);
|
|
3755
|
-
// nonGroupedRowsById[subRow.id] = subRow;
|
|
3756
|
-
// }
|
|
3757
|
-
});
|
|
3758
|
-
return row;
|
|
3759
|
-
});
|
|
3760
|
-
return aggregatedGroupedRows;
|
|
3761
|
-
};
|
|
3762
|
-
const groupedRows = groupUpRecursively(rowModel.rows, 0);
|
|
3763
|
-
groupedRows.forEach(subRow => {
|
|
3764
|
-
groupedFlatRows.push(subRow);
|
|
3765
|
-
groupedRowsById[subRow.id] = subRow;
|
|
3766
|
-
// if (subRow.getIsGrouped?.()) {
|
|
3767
|
-
// onlyGroupedFlatRows.push(subRow);
|
|
3768
|
-
// onlyGroupedRowsById[subRow.id] = subRow;
|
|
3769
|
-
// } else {
|
|
3770
|
-
// nonGroupedFlatRows.push(subRow);
|
|
3771
|
-
// nonGroupedRowsById[subRow.id] = subRow;
|
|
3772
|
-
// }
|
|
3773
|
-
});
|
|
3774
|
-
return {
|
|
3775
|
-
rows: groupedRows,
|
|
3776
|
-
flatRows: groupedFlatRows,
|
|
3777
|
-
rowsById: groupedRowsById
|
|
3778
|
-
};
|
|
3779
|
-
}, getMemoOptions(table.options, 'debugTable', 'getGroupedRowModel', () => {
|
|
3780
|
-
table._queue(() => {
|
|
3781
|
-
table._autoResetExpanded();
|
|
3782
|
-
table._autoResetPageIndex();
|
|
3783
|
-
});
|
|
3784
|
-
}));
|
|
3785
|
-
}
|
|
3786
|
-
function groupBy(rows, columnId) {
|
|
3787
|
-
const groupMap = new Map();
|
|
3788
|
-
return rows.reduce((map, row) => {
|
|
3789
|
-
const resKey = `${row.getGroupingValue(columnId)}`;
|
|
3790
|
-
const previous = map.get(resKey);
|
|
3791
|
-
if (!previous) {
|
|
3792
|
-
map.set(resKey, [row]);
|
|
3793
|
-
} else {
|
|
3794
|
-
previous.push(row);
|
|
3795
|
-
}
|
|
3796
|
-
return map;
|
|
3797
|
-
}, groupMap);
|
|
3798
|
-
}
|
|
3799
|
-
|
|
3800
3661
|
function getPaginationRowModel(opts) {
|
|
3801
3662
|
return table => memo(() => [table.getState().pagination, table.getPrePaginationRowModel(), table.options.paginateExpandedRows ? undefined : table.getState().expanded], (pagination, rowModel) => {
|
|
3802
3663
|
if (!rowModel.rows.length) {
|
|
@@ -4059,8 +3920,8 @@ function useDTFocusDispatchContext() {
|
|
|
4059
3920
|
}
|
|
4060
3921
|
|
|
4061
3922
|
const styles$c = {
|
|
4062
|
-
"table-base": "_table-
|
|
4063
|
-
"data-table-base": "_data-table-
|
|
3923
|
+
"table-base": "_table-base_1ihr3_2",
|
|
3924
|
+
"data-table-base": "_data-table-base_1ihr3_15"
|
|
4064
3925
|
};
|
|
4065
3926
|
|
|
4066
3927
|
const SimpleTableBase = ({
|
|
@@ -4088,7 +3949,7 @@ const DataTableBase = ({
|
|
|
4088
3949
|
...rest
|
|
4089
3950
|
}) => {
|
|
4090
3951
|
const tableBaseClassNames = cx(className, styles$c["data-table-base"]);
|
|
4091
|
-
const { focusTableGenerally, blur } = useDTFocusDispatchContext();
|
|
3952
|
+
const { focusTableGenerally, blur, moveFocusToCell } = useDTFocusDispatchContext();
|
|
4092
3953
|
const handleBlur = (event) => {
|
|
4093
3954
|
if (!event.currentTarget.contains(event.relatedTarget)) {
|
|
4094
3955
|
blur();
|
|
@@ -4097,6 +3958,16 @@ const DataTableBase = ({
|
|
|
4097
3958
|
const handleFocus = (event) => {
|
|
4098
3959
|
if (event.target === event.currentTarget) {
|
|
4099
3960
|
focusTableGenerally();
|
|
3961
|
+
return;
|
|
3962
|
+
}
|
|
3963
|
+
const targetEl = event.target;
|
|
3964
|
+
const cellEl = targetEl.closest("[data-cell-pos]");
|
|
3965
|
+
const cellPosAttr = cellEl?.getAttribute("data-cell-pos");
|
|
3966
|
+
if (cellPosAttr) {
|
|
3967
|
+
const [rowIndex, columnIndex] = cellPosAttr.split(",").map(Number);
|
|
3968
|
+
if (!Number.isNaN(rowIndex) && !Number.isNaN(columnIndex)) {
|
|
3969
|
+
moveFocusToCell({ rowIndex, columnIndex });
|
|
3970
|
+
}
|
|
4100
3971
|
}
|
|
4101
3972
|
};
|
|
4102
3973
|
return /* @__PURE__ */ jsx(
|
|
@@ -4200,19 +4071,19 @@ const TableBodyCell = forwardRef(({ type, children, className, isExpandCell, isS
|
|
|
4200
4071
|
TableBodyCell.displayName = "TableBodyCell";
|
|
4201
4072
|
|
|
4202
4073
|
const styles$9 = {
|
|
4203
|
-
"data-table-body-cell": "_data-table-body-
|
|
4204
|
-
"data-table-body-cell-input": "_data-table-body-cell-
|
|
4205
|
-
"table-body-cell": "_table-body-
|
|
4206
|
-
"table-header-cell": "_table-header-
|
|
4207
|
-
"table-footer-cell": "_table-footer-
|
|
4208
|
-
"data-table-
|
|
4209
|
-
"data-table-
|
|
4210
|
-
"data-table-
|
|
4211
|
-
"data-table-
|
|
4212
|
-
"data-table-body-cell-error": "_data-table-body-cell-
|
|
4213
|
-
"data-table-body-cell-warning": "_data-table-body-cell-
|
|
4214
|
-
"cell-error-icon": "_cell-error-
|
|
4215
|
-
"cell-warning-icon": "_cell-warning-
|
|
4074
|
+
"data-table-body-cell": "_data-table-body-cell_ab20z_2",
|
|
4075
|
+
"data-table-body-cell-input": "_data-table-body-cell-input_ab20z_3",
|
|
4076
|
+
"table-body-cell": "_table-body-cell_ab20z_18",
|
|
4077
|
+
"table-header-cell": "_table-header-cell_ab20z_19",
|
|
4078
|
+
"table-footer-cell": "_table-footer-cell_ab20z_20",
|
|
4079
|
+
"data-table-cell-content": "_data-table-cell-content_ab20z_30",
|
|
4080
|
+
"data-table-body-cell-editing": "_data-table-body-cell-editing_ab20z_51",
|
|
4081
|
+
"data-table-header-cell": "_data-table-header-cell_ab20z_52",
|
|
4082
|
+
"data-table-footer-cell": "_data-table-footer-cell_ab20z_55",
|
|
4083
|
+
"data-table-body-cell-error": "_data-table-body-cell-error_ab20z_104",
|
|
4084
|
+
"data-table-body-cell-warning": "_data-table-body-cell-warning_ab20z_121",
|
|
4085
|
+
"cell-error-icon": "_cell-error-icon_ab20z_130",
|
|
4086
|
+
"cell-warning-icon": "_cell-warning-icon_ab20z_131"
|
|
4216
4087
|
};
|
|
4217
4088
|
|
|
4218
4089
|
function formatCellPositionString(cellPosition) {
|
|
@@ -4259,37 +4130,33 @@ const getCommonPinningStyles = (column) => {
|
|
|
4259
4130
|
zIndex: isPinned ? 1 : 0
|
|
4260
4131
|
};
|
|
4261
4132
|
};
|
|
4133
|
+
const EMPTY_PINNING_STYLES = Object.freeze({
|
|
4134
|
+
left: void 0,
|
|
4135
|
+
right: void 0,
|
|
4136
|
+
position: "relative",
|
|
4137
|
+
zIndex: 0
|
|
4138
|
+
});
|
|
4262
4139
|
const useCommonPinningStyles = (column) => {
|
|
4140
|
+
const isPinned = column.getIsPinned();
|
|
4263
4141
|
const left = column.getStart("left");
|
|
4264
4142
|
const right = column.getAfter("right");
|
|
4265
|
-
|
|
4266
|
-
|
|
4267
|
-
|
|
4143
|
+
return useMemo(() => {
|
|
4144
|
+
if (!isPinned) return EMPTY_PINNING_STYLES;
|
|
4145
|
+
return {
|
|
4268
4146
|
left: isPinned === "left" ? `${left}px` : void 0,
|
|
4269
4147
|
right: isPinned === "right" ? `${right}px` : void 0,
|
|
4270
|
-
position:
|
|
4271
|
-
zIndex:
|
|
4272
|
-
}
|
|
4273
|
-
|
|
4274
|
-
);
|
|
4148
|
+
position: "sticky",
|
|
4149
|
+
zIndex: 1
|
|
4150
|
+
};
|
|
4151
|
+
}, [left, right, isPinned]);
|
|
4275
4152
|
};
|
|
4276
4153
|
|
|
4277
4154
|
const INTERNAL_ROW_ACTION_PRIMARY_COLUMN_ID = "a2-table-internal-row-action-primary";
|
|
4278
4155
|
const INTERNAL_ROW_ACTION_SECONDARY_COLUMN_ID = "a2-table-internal-row-action-secondary";
|
|
4279
4156
|
|
|
4280
|
-
const CellFocusContext = createContext(
|
|
4281
|
-
null
|
|
4282
|
-
);
|
|
4283
|
-
function useCellFocusContext() {
|
|
4284
|
-
return useContext(CellFocusContext);
|
|
4285
|
-
}
|
|
4286
|
-
|
|
4287
4157
|
function DataTableBodyImmutableCell(props) {
|
|
4288
|
-
const { cell, cellPosition, children,
|
|
4158
|
+
const { cell, cellPosition, children, ...rest } = props;
|
|
4289
4159
|
const cellRef = useRef(null);
|
|
4290
|
-
const [tabIndex, setTabIndex] = useState(-1);
|
|
4291
|
-
const [isFocused, setIsFocused] = useState(false);
|
|
4292
|
-
const { moveFocusToCell } = useDTFocusDispatchContext();
|
|
4293
4160
|
const column = cell.column;
|
|
4294
4161
|
const rowCanExpand = cell.row.getCanExpand();
|
|
4295
4162
|
const rowIsExpanded = cell.row.getIsExpanded();
|
|
@@ -4304,7 +4171,6 @@ function DataTableBodyImmutableCell(props) {
|
|
|
4304
4171
|
const cellError = meta?.errors?.[column.id];
|
|
4305
4172
|
const cellWarning = meta?.warnings?.[column.id];
|
|
4306
4173
|
const classes = cx(styles$9["data-table-body-cell"], rest.className, {
|
|
4307
|
-
[styles$9["data-table-body-cell-hovered"]]: isHovered,
|
|
4308
4174
|
[styles$9["data-table-body-cell-error"]]: !!cellError,
|
|
4309
4175
|
[styles$9["data-table-body-cell-warning"]]: !cellError && !!cellWarning,
|
|
4310
4176
|
[styles$f["table-cell-internal-expand"]]: isExpandCell,
|
|
@@ -4376,19 +4242,6 @@ function DataTableBodyImmutableCell(props) {
|
|
|
4376
4242
|
toggleRowExpanded
|
|
4377
4243
|
]
|
|
4378
4244
|
);
|
|
4379
|
-
const handleFocus = useCallback(() => {
|
|
4380
|
-
setTabIndex(0);
|
|
4381
|
-
setIsFocused(true);
|
|
4382
|
-
moveFocusToCell(cellPosition);
|
|
4383
|
-
}, [moveFocusToCell, cellPosition]);
|
|
4384
|
-
const handleBlur = useCallback(() => {
|
|
4385
|
-
setTabIndex(-1);
|
|
4386
|
-
setIsFocused(false);
|
|
4387
|
-
}, []);
|
|
4388
|
-
const cellFocusContextValue = useMemo(
|
|
4389
|
-
() => ({ isCellFocused: isFocused }),
|
|
4390
|
-
[isFocused]
|
|
4391
|
-
);
|
|
4392
4245
|
return /* @__PURE__ */ jsx(
|
|
4393
4246
|
TableBodyCell,
|
|
4394
4247
|
{
|
|
@@ -4396,13 +4249,11 @@ function DataTableBodyImmutableCell(props) {
|
|
|
4396
4249
|
...rest,
|
|
4397
4250
|
className: classes,
|
|
4398
4251
|
ref: cellRef,
|
|
4399
|
-
tabIndex,
|
|
4400
|
-
onFocus: handleFocus,
|
|
4401
|
-
onBlur: handleBlur,
|
|
4252
|
+
tabIndex: -1,
|
|
4402
4253
|
style: commonPinningStyles,
|
|
4403
4254
|
onKeyDown: handleKeyDown,
|
|
4404
4255
|
"data-cell-pos": formatCellPositionString(cellPosition),
|
|
4405
|
-
children
|
|
4256
|
+
children
|
|
4406
4257
|
}
|
|
4407
4258
|
);
|
|
4408
4259
|
}
|
|
@@ -4531,10 +4382,6 @@ function DataTableEditableTextCellInner(props, ref) {
|
|
|
4531
4382
|
},
|
|
4532
4383
|
[beginEditing, cellPosition, moveFocusToCell]
|
|
4533
4384
|
);
|
|
4534
|
-
const cellFocusContextValue = useMemo(
|
|
4535
|
-
() => ({ isCellFocused: tabIndex === 0 && !isEditing }),
|
|
4536
|
-
[tabIndex, isEditing]
|
|
4537
|
-
);
|
|
4538
4385
|
useEffect(() => {
|
|
4539
4386
|
if (isEditing) {
|
|
4540
4387
|
inputRef.current?.focus();
|
|
@@ -4570,7 +4417,7 @@ function DataTableEditableTextCellInner(props, ref) {
|
|
|
4570
4417
|
onBlur: handleInputBlur,
|
|
4571
4418
|
onKeyDown: handleInputKeyDown
|
|
4572
4419
|
}
|
|
4573
|
-
) }) : /* @__PURE__ */ jsxs(
|
|
4420
|
+
) }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4574
4421
|
children,
|
|
4575
4422
|
!isEditing && /* @__PURE__ */ jsx(DataTableEditableCellEditIcon, {})
|
|
4576
4423
|
] }),
|
|
@@ -4729,10 +4576,6 @@ function DataTableEditableNumberCellInner(props, ref) {
|
|
|
4729
4576
|
},
|
|
4730
4577
|
[beginEditing, cellPosition, moveFocusToCell]
|
|
4731
4578
|
);
|
|
4732
|
-
const cellFocusContextValue = useMemo(
|
|
4733
|
-
() => ({ isCellFocused: tabIndex === 0 && !isEditing }),
|
|
4734
|
-
[tabIndex, isEditing]
|
|
4735
|
-
);
|
|
4736
4579
|
useEffect(() => {
|
|
4737
4580
|
if (isEditing) {
|
|
4738
4581
|
localInputRef.current?.focus();
|
|
@@ -4768,7 +4611,7 @@ function DataTableEditableNumberCellInner(props, ref) {
|
|
|
4768
4611
|
onBlur: handleInputBlur,
|
|
4769
4612
|
onKeyDown: handleInputKeyDown
|
|
4770
4613
|
}
|
|
4771
|
-
) }) : /* @__PURE__ */ jsxs(
|
|
4614
|
+
) }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4772
4615
|
children,
|
|
4773
4616
|
!isEditing && /* @__PURE__ */ jsx(DataTableEditableCellEditIcon, {})
|
|
4774
4617
|
] }),
|
|
@@ -4846,10 +4689,6 @@ function useEditableMenuCell({
|
|
|
4846
4689
|
},
|
|
4847
4690
|
[]
|
|
4848
4691
|
);
|
|
4849
|
-
const cellFocusContextValue = useMemo(
|
|
4850
|
-
() => ({ isCellFocused: tabIndex === 0 }),
|
|
4851
|
-
[tabIndex]
|
|
4852
|
-
);
|
|
4853
4692
|
return {
|
|
4854
4693
|
tabIndex,
|
|
4855
4694
|
cellRef,
|
|
@@ -4859,8 +4698,7 @@ function useEditableMenuCell({
|
|
|
4859
4698
|
handleImplicitClose,
|
|
4860
4699
|
handleCellMouseDown,
|
|
4861
4700
|
handleCellBlur,
|
|
4862
|
-
handleCellFocus
|
|
4863
|
-
cellFocusContextValue
|
|
4701
|
+
handleCellFocus
|
|
4864
4702
|
};
|
|
4865
4703
|
}
|
|
4866
4704
|
|
|
@@ -4897,8 +4735,7 @@ function DataTableEditableSelectCellInner(props, ref) {
|
|
|
4897
4735
|
handleImplicitClose,
|
|
4898
4736
|
handleCellMouseDown,
|
|
4899
4737
|
handleCellBlur,
|
|
4900
|
-
handleCellFocus
|
|
4901
|
-
cellFocusContextValue
|
|
4738
|
+
handleCellFocus
|
|
4902
4739
|
} = useEditableMenuCell({ cellPosition, onCellKeyDown, ref });
|
|
4903
4740
|
const selectedOption = useMemo(() => {
|
|
4904
4741
|
if (cellValue === void 0 || cellValue === null) return null;
|
|
@@ -4944,10 +4781,8 @@ function DataTableEditableSelectCellInner(props, ref) {
|
|
|
4944
4781
|
"data-state": dataState,
|
|
4945
4782
|
onKeyDown: (e) => handleCellKeyDown(e, menuKeyDown, isOpen),
|
|
4946
4783
|
children: [
|
|
4947
|
-
|
|
4948
|
-
|
|
4949
|
-
!isOpen && /* @__PURE__ */ jsx(DataTableEditableCellEditIcon, {})
|
|
4950
|
-
] }),
|
|
4784
|
+
children,
|
|
4785
|
+
!isOpen && /* @__PURE__ */ jsx(DataTableEditableCellEditIcon, {}),
|
|
4951
4786
|
/* @__PURE__ */ jsx(SrOnly, { children: isOpen ? "Press Enter or Space to select a cell value. Press Escape or F2 to cancel." : "Press Enter or F2 to edit cell value." })
|
|
4952
4787
|
]
|
|
4953
4788
|
}
|
|
@@ -5041,8 +4876,7 @@ function DataTableEditableSelectAsyncCellInner(props, ref) {
|
|
|
5041
4876
|
handleImplicitClose,
|
|
5042
4877
|
handleCellMouseDown,
|
|
5043
4878
|
handleCellBlur,
|
|
5044
|
-
handleCellFocus
|
|
5045
|
-
cellFocusContextValue
|
|
4879
|
+
handleCellFocus
|
|
5046
4880
|
} = useEditableMenuCell({ cellPosition, onCellKeyDown, ref });
|
|
5047
4881
|
const selectedOption = useMemo(() => {
|
|
5048
4882
|
if (cellValue === void 0 || cellValue === null) return null;
|
|
@@ -5093,10 +4927,8 @@ function DataTableEditableSelectAsyncCellInner(props, ref) {
|
|
|
5093
4927
|
"data-state": dataState,
|
|
5094
4928
|
onKeyDown: (e) => handleCellKeyDown(e, menuKeyDown, isOpen),
|
|
5095
4929
|
children: [
|
|
5096
|
-
|
|
5097
|
-
|
|
5098
|
-
!isOpen && /* @__PURE__ */ jsx(DataTableEditableCellEditIcon, {})
|
|
5099
|
-
] }),
|
|
4930
|
+
children,
|
|
4931
|
+
!isOpen && /* @__PURE__ */ jsx(DataTableEditableCellEditIcon, {}),
|
|
5100
4932
|
/* @__PURE__ */ jsx(SrOnly, { children: isOpen ? "Press Enter or Space to select a cell value. Press Escape or F2 to cancel." : "Press Enter or F2 to edit cell value." })
|
|
5101
4933
|
]
|
|
5102
4934
|
}
|
|
@@ -5159,8 +4991,7 @@ function DataTableEditableMultiselectCellInner(props, ref) {
|
|
|
5159
4991
|
handleImplicitClose,
|
|
5160
4992
|
handleCellMouseDown,
|
|
5161
4993
|
handleCellBlur,
|
|
5162
|
-
handleCellFocus
|
|
5163
|
-
cellFocusContextValue
|
|
4994
|
+
handleCellFocus
|
|
5164
4995
|
} = useEditableMenuCell({ cellPosition, onCellKeyDown, ref });
|
|
5165
4996
|
const selectedOptions = useMemo(() => {
|
|
5166
4997
|
if (!Array.isArray(cellValue)) return [];
|
|
@@ -5207,10 +5038,8 @@ function DataTableEditableMultiselectCellInner(props, ref) {
|
|
|
5207
5038
|
"data-state": dataState,
|
|
5208
5039
|
onKeyDown: (e) => handleCellKeyDown(e, menuKeyDown, isOpen),
|
|
5209
5040
|
children: [
|
|
5210
|
-
|
|
5211
|
-
|
|
5212
|
-
!isOpen && /* @__PURE__ */ jsx(DataTableEditableCellEditIcon, {})
|
|
5213
|
-
] }),
|
|
5041
|
+
children,
|
|
5042
|
+
!isOpen && /* @__PURE__ */ jsx(DataTableEditableCellEditIcon, {}),
|
|
5214
5043
|
/* @__PURE__ */ jsx(SrOnly, { children: isOpen ? "Press Enter or Space to select cell values. Press Escape or F2 to close." : "Press Enter or F2 to edit cell value." })
|
|
5215
5044
|
]
|
|
5216
5045
|
}
|
|
@@ -5305,8 +5134,7 @@ function DataTableEditableMultiselectAsyncCellInner(props, ref) {
|
|
|
5305
5134
|
handleImplicitClose,
|
|
5306
5135
|
handleCellMouseDown,
|
|
5307
5136
|
handleCellBlur,
|
|
5308
|
-
handleCellFocus
|
|
5309
|
-
cellFocusContextValue
|
|
5137
|
+
handleCellFocus
|
|
5310
5138
|
} = useEditableMenuCell({ cellPosition, onCellKeyDown, ref });
|
|
5311
5139
|
const selectedOptions = useMemo(() => {
|
|
5312
5140
|
if (!Array.isArray(cellValue)) return [];
|
|
@@ -5356,10 +5184,8 @@ function DataTableEditableMultiselectAsyncCellInner(props, ref) {
|
|
|
5356
5184
|
"data-state": dataState,
|
|
5357
5185
|
onKeyDown: (e) => handleCellKeyDown(e, menuKeyDown, isOpen),
|
|
5358
5186
|
children: [
|
|
5359
|
-
|
|
5360
|
-
|
|
5361
|
-
!isOpen && /* @__PURE__ */ jsx(DataTableEditableCellEditIcon, {})
|
|
5362
|
-
] }),
|
|
5187
|
+
children,
|
|
5188
|
+
!isOpen && /* @__PURE__ */ jsx(DataTableEditableCellEditIcon, {}),
|
|
5363
5189
|
/* @__PURE__ */ jsx(SrOnly, { children: isOpen ? "Press Enter or Space to select cell values. Press Escape or F2 to close." : "Press Enter or F2 to edit cell value." })
|
|
5364
5190
|
]
|
|
5365
5191
|
}
|
|
@@ -5450,8 +5276,7 @@ function DataTableEditableBooleanCellInner(props, ref) {
|
|
|
5450
5276
|
handleImplicitClose,
|
|
5451
5277
|
handleCellMouseDown,
|
|
5452
5278
|
handleCellBlur,
|
|
5453
|
-
handleCellFocus
|
|
5454
|
-
cellFocusContextValue
|
|
5279
|
+
handleCellFocus
|
|
5455
5280
|
} = useEditableMenuCell({ cellPosition, onCellKeyDown, ref });
|
|
5456
5281
|
const selectedOption = useMemo(() => {
|
|
5457
5282
|
if (cellValue === void 0) return null;
|
|
@@ -5496,10 +5321,8 @@ function DataTableEditableBooleanCellInner(props, ref) {
|
|
|
5496
5321
|
"data-state": dataState,
|
|
5497
5322
|
onKeyDown: (e) => handleCellKeyDown(e, menuKeyDown, isOpen),
|
|
5498
5323
|
children: [
|
|
5499
|
-
|
|
5500
|
-
|
|
5501
|
-
!isOpen && /* @__PURE__ */ jsx(DataTableEditableCellEditIcon, {})
|
|
5502
|
-
] }),
|
|
5324
|
+
children,
|
|
5325
|
+
!isOpen && /* @__PURE__ */ jsx(DataTableEditableCellEditIcon, {}),
|
|
5503
5326
|
/* @__PURE__ */ jsx(SrOnly, { children: isOpen ? "Press Enter or Space to select a cell value. Press Escape or F2 to cancel." : "Press Enter or F2 to edit cell value." })
|
|
5504
5327
|
]
|
|
5505
5328
|
}
|
|
@@ -5529,7 +5352,7 @@ const DataTableEditableBooleanCell = Object.assign(
|
|
|
5529
5352
|
);
|
|
5530
5353
|
|
|
5531
5354
|
function DataTableBodyMutableCell(props) {
|
|
5532
|
-
const { cell, cellPosition, children,
|
|
5355
|
+
const { cell, cellPosition, children, ...rest } = props;
|
|
5533
5356
|
const editableCellRef = useRef(null);
|
|
5534
5357
|
const column = cell.column;
|
|
5535
5358
|
const rowCanExpand = cell.row.getCanExpand();
|
|
@@ -5539,7 +5362,6 @@ function DataTableBodyMutableCell(props) {
|
|
|
5539
5362
|
const cellError = meta?.errors?.[column.id];
|
|
5540
5363
|
const cellWarning = meta?.warnings?.[column.id];
|
|
5541
5364
|
const classes = cx(styles$9["data-table-body-cell"], rest.className, {
|
|
5542
|
-
[styles$9["data-table-body-cell-hovered"]]: isHovered,
|
|
5543
5365
|
[styles$9["data-table-body-cell-error"]]: !!cellError,
|
|
5544
5366
|
[styles$9["data-table-body-cell-warning"]]: !cellError && !!cellWarning
|
|
5545
5367
|
});
|
|
@@ -5632,14 +5454,13 @@ function DataTableBodyMutableCell(props) {
|
|
|
5632
5454
|
onKeyDown: handleKeyDown,
|
|
5633
5455
|
style: commonPinningStyles
|
|
5634
5456
|
},
|
|
5635
|
-
isHovered,
|
|
5636
5457
|
children
|
|
5637
5458
|
}
|
|
5638
5459
|
);
|
|
5639
5460
|
}
|
|
5640
5461
|
|
|
5641
5462
|
function DataTableBodyCell(props) {
|
|
5642
|
-
const { cell, cellPosition, children,
|
|
5463
|
+
const { cell, cellPosition, children, ...rest } = props;
|
|
5643
5464
|
const column = cell.column;
|
|
5644
5465
|
const editMode = column.columnDef.meta?.editMode;
|
|
5645
5466
|
const Component = editMode ? DataTableBodyMutableCell : DataTableBodyImmutableCell;
|
|
@@ -5650,51 +5471,34 @@ function DataTableBodyCell(props) {
|
|
|
5650
5471
|
cellPosition,
|
|
5651
5472
|
...rest,
|
|
5652
5473
|
"data-cell-pos": formatCellPositionString(cellPosition),
|
|
5653
|
-
isHovered,
|
|
5654
5474
|
children
|
|
5655
5475
|
}
|
|
5656
5476
|
);
|
|
5657
5477
|
}
|
|
5658
5478
|
|
|
5659
5479
|
const styles$8 = {
|
|
5660
|
-
"data-table-body-row": "_data-table-body-
|
|
5661
|
-
"data-table-body-sub-component-row": "_data-table-body-sub-component-
|
|
5662
|
-
"data-table-body-sub-component-container": "_data-table-body-sub-component-
|
|
5663
|
-
"data-table-body-sub-component-content": "_data-table-body-sub-component-
|
|
5664
|
-
"data-table-body-
|
|
5480
|
+
"data-table-body-row": "_data-table-body-row_1lv2u_2",
|
|
5481
|
+
"data-table-body-sub-component-row": "_data-table-body-sub-component-row_1lv2u_22",
|
|
5482
|
+
"data-table-body-sub-component-container": "_data-table-body-sub-component-container_1lv2u_26",
|
|
5483
|
+
"data-table-body-sub-component-content": "_data-table-body-sub-component-content_1lv2u_31",
|
|
5484
|
+
"data-table-body-virtualized": "_data-table-body-virtualized_1lv2u_35",
|
|
5485
|
+
"data-table-body-row-virtualized": "_data-table-body-row-virtualized_1lv2u_40",
|
|
5486
|
+
"data-table-body-cell-group": "_data-table-body-cell-group_1lv2u_50"
|
|
5665
5487
|
};
|
|
5666
5488
|
|
|
5667
|
-
|
|
5668
|
-
hoveredColumnId: null,
|
|
5669
|
-
resizingColumnId: null
|
|
5670
|
-
});
|
|
5671
|
-
const DTHoverDispatchContext = createContext(() => {
|
|
5672
|
-
});
|
|
5673
|
-
|
|
5674
|
-
function useDTHoverStateContext() {
|
|
5675
|
-
const state = useContext(DTHoverStateContext);
|
|
5676
|
-
return {
|
|
5677
|
-
getIsHovered: (columnId) => {
|
|
5678
|
-
return state.hoveredColumnId === columnId && !state.resizingColumnId;
|
|
5679
|
-
},
|
|
5680
|
-
hoveredColumnId: state.hoveredColumnId
|
|
5681
|
-
};
|
|
5682
|
-
}
|
|
5683
|
-
|
|
5684
|
-
function DataTableBodyRow({
|
|
5489
|
+
function DataTableBodyRowInner({
|
|
5685
5490
|
columnOrder,
|
|
5686
5491
|
row,
|
|
5687
5492
|
rowIndex,
|
|
5688
|
-
tableHasSubRows
|
|
5493
|
+
tableHasSubRows,
|
|
5494
|
+
isExpanded,
|
|
5495
|
+
canExpand,
|
|
5496
|
+
depth,
|
|
5497
|
+
parentRowCanExpand
|
|
5689
5498
|
}) {
|
|
5690
5499
|
const visibleCells = row.getVisibleCells();
|
|
5691
|
-
const canExpand = row.getCanExpand();
|
|
5692
|
-
const isExpanded = row.getIsExpanded();
|
|
5693
|
-
const depth = row.depth;
|
|
5694
5500
|
const id = row.id;
|
|
5695
5501
|
const original = row.original;
|
|
5696
|
-
const parentRowCanExpand = row.getParentRow()?.getCanExpand() ?? false;
|
|
5697
|
-
const { hoveredColumnId } = useDTHoverStateContext();
|
|
5698
5502
|
const { focusSubComponent, blurSubComponent } = useDTFocusDispatchContext();
|
|
5699
5503
|
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
5700
5504
|
/* @__PURE__ */ jsx(
|
|
@@ -5718,7 +5522,7 @@ function DataTableBodyRow({
|
|
|
5718
5522
|
cellPosition: { rowIndex, columnIndex },
|
|
5719
5523
|
"aria-colindex": columnIndex + 1,
|
|
5720
5524
|
className: cellClasses,
|
|
5721
|
-
|
|
5525
|
+
"data-anv-column-id": cell.column.id,
|
|
5722
5526
|
children: flexRender(cell.column.columnDef.cell, cell.getContext())
|
|
5723
5527
|
},
|
|
5724
5528
|
cell.id
|
|
@@ -5743,6 +5547,17 @@ function DataTableBodyRow({
|
|
|
5743
5547
|
)
|
|
5744
5548
|
] }, row.id);
|
|
5745
5549
|
}
|
|
5550
|
+
function areRowPropsEqual(prev, next) {
|
|
5551
|
+
const getRowVersion = next.getRowVersion;
|
|
5552
|
+
if (!getRowVersion) {
|
|
5553
|
+
return false;
|
|
5554
|
+
}
|
|
5555
|
+
return prev.row.id === next.row.id && getRowVersion(prev.row.original) === getRowVersion(next.row.original) && prev.rowIndex === next.rowIndex && prev.isExpanded === next.isExpanded && prev.canExpand === next.canExpand && prev.depth === next.depth && prev.parentRowCanExpand === next.parentRowCanExpand && prev.tableHasSubRows === next.tableHasSubRows && prev.columnOrder === next.columnOrder && prev.isSelected === next.isSelected && prev.isSomeSelected === next.isSomeSelected;
|
|
5556
|
+
}
|
|
5557
|
+
const DataTableBodyRow = memo$1(
|
|
5558
|
+
DataTableBodyRowInner,
|
|
5559
|
+
areRowPropsEqual
|
|
5560
|
+
);
|
|
5746
5561
|
|
|
5747
5562
|
const useColumnOrder = ({ table }) => {
|
|
5748
5563
|
const getColumnIndexes = useCallback((column) => {
|
|
@@ -5771,25 +5586,104 @@ const useColumnOrder = ({ table }) => {
|
|
|
5771
5586
|
};
|
|
5772
5587
|
};
|
|
5773
5588
|
|
|
5774
|
-
|
|
5589
|
+
function NonVirtualizedContent({
|
|
5775
5590
|
table,
|
|
5776
|
-
hasSubRows
|
|
5777
|
-
|
|
5591
|
+
hasSubRows,
|
|
5592
|
+
getRowVersion
|
|
5593
|
+
}) {
|
|
5778
5594
|
const { columnOrder } = useColumnOrder({ table });
|
|
5779
|
-
|
|
5595
|
+
const headerCount = table.getHeaderGroups().length;
|
|
5596
|
+
return /* @__PURE__ */ jsx(Fragment, { children: table.getRowModel().rows.map((row, rowIndex) => /* @__PURE__ */ jsx(
|
|
5780
5597
|
DataTableBodyRow,
|
|
5781
5598
|
{
|
|
5782
5599
|
columnOrder,
|
|
5783
5600
|
row,
|
|
5784
|
-
rowIndex: rowIndex +
|
|
5785
|
-
tableHasSubRows: hasSubRows
|
|
5601
|
+
rowIndex: rowIndex + headerCount,
|
|
5602
|
+
tableHasSubRows: hasSubRows,
|
|
5603
|
+
isExpanded: row.getIsExpanded(),
|
|
5604
|
+
canExpand: row.getCanExpand(),
|
|
5605
|
+
depth: row.depth,
|
|
5606
|
+
parentRowCanExpand: row.getParentRow()?.getCanExpand() ?? false,
|
|
5607
|
+
isSelected: row.getIsSelected(),
|
|
5608
|
+
isSomeSelected: row.getIsSomeSelected(),
|
|
5609
|
+
getRowVersion
|
|
5786
5610
|
},
|
|
5787
5611
|
row.id
|
|
5788
|
-
));
|
|
5789
|
-
}
|
|
5612
|
+
)) });
|
|
5613
|
+
}
|
|
5614
|
+
function VirtualizedContent({
|
|
5615
|
+
table,
|
|
5616
|
+
hasSubRows,
|
|
5617
|
+
virtualizer,
|
|
5618
|
+
getRowVersion
|
|
5619
|
+
}) {
|
|
5620
|
+
const { columnOrder } = useColumnOrder({ table });
|
|
5621
|
+
const headerCount = table.getHeaderGroups().length;
|
|
5622
|
+
const rows = table.getRowModel().rows;
|
|
5623
|
+
const virtualItems = virtualizer.getVirtualItems();
|
|
5624
|
+
const totalSize = virtualizer.getTotalSize();
|
|
5625
|
+
const measureRef = useMemo(
|
|
5626
|
+
() => (el) => {
|
|
5627
|
+
if (el) virtualizer.measureElement(el);
|
|
5628
|
+
},
|
|
5629
|
+
[virtualizer]
|
|
5630
|
+
);
|
|
5631
|
+
return /* @__PURE__ */ jsx(
|
|
5632
|
+
"div",
|
|
5633
|
+
{
|
|
5634
|
+
className: styles$8["data-table-body-virtualized"],
|
|
5635
|
+
"data-virtualized-body": "true",
|
|
5636
|
+
style: { height: `${totalSize}px` },
|
|
5637
|
+
children: virtualItems.map((virtualRow) => {
|
|
5638
|
+
const row = rows[virtualRow.index];
|
|
5639
|
+
return /* @__PURE__ */ jsx(
|
|
5640
|
+
"div",
|
|
5641
|
+
{
|
|
5642
|
+
ref: measureRef,
|
|
5643
|
+
"data-index": virtualRow.index,
|
|
5644
|
+
className: styles$8["data-table-body-row-virtualized"],
|
|
5645
|
+
style: { transform: `translateY(${virtualRow.start}px)` },
|
|
5646
|
+
children: /* @__PURE__ */ jsx(
|
|
5647
|
+
DataTableBodyRow,
|
|
5648
|
+
{
|
|
5649
|
+
columnOrder,
|
|
5650
|
+
row,
|
|
5651
|
+
rowIndex: virtualRow.index + headerCount,
|
|
5652
|
+
tableHasSubRows: hasSubRows,
|
|
5653
|
+
isExpanded: row.getIsExpanded(),
|
|
5654
|
+
canExpand: row.getCanExpand(),
|
|
5655
|
+
depth: row.depth,
|
|
5656
|
+
parentRowCanExpand: row.getParentRow()?.getCanExpand() ?? false,
|
|
5657
|
+
isSelected: row.getIsSelected(),
|
|
5658
|
+
isSomeSelected: row.getIsSomeSelected(),
|
|
5659
|
+
getRowVersion
|
|
5660
|
+
}
|
|
5661
|
+
)
|
|
5662
|
+
},
|
|
5663
|
+
row.id
|
|
5664
|
+
);
|
|
5665
|
+
})
|
|
5666
|
+
}
|
|
5667
|
+
);
|
|
5668
|
+
}
|
|
5790
5669
|
function DataTableBody(props) {
|
|
5791
|
-
const { table, hasSubRows, ...rest } = props;
|
|
5792
|
-
return /* @__PURE__ */ jsx(TableBody, { type: "data-table", ...rest, children: /* @__PURE__ */ jsx(
|
|
5670
|
+
const { table, hasSubRows, virtualizer, getRowVersion, ...rest } = props;
|
|
5671
|
+
return /* @__PURE__ */ jsx(TableBody, { type: "data-table", ...rest, children: virtualizer ? /* @__PURE__ */ jsx(
|
|
5672
|
+
VirtualizedContent,
|
|
5673
|
+
{
|
|
5674
|
+
table,
|
|
5675
|
+
hasSubRows,
|
|
5676
|
+
virtualizer,
|
|
5677
|
+
getRowVersion
|
|
5678
|
+
}
|
|
5679
|
+
) : /* @__PURE__ */ jsx(
|
|
5680
|
+
NonVirtualizedContent,
|
|
5681
|
+
{
|
|
5682
|
+
table,
|
|
5683
|
+
hasSubRows,
|
|
5684
|
+
getRowVersion
|
|
5685
|
+
}
|
|
5686
|
+
) });
|
|
5793
5687
|
}
|
|
5794
5688
|
|
|
5795
5689
|
const styles$7 = {
|
|
@@ -5829,16 +5723,7 @@ TableFooterCell.displayName = "TableFooterCell";
|
|
|
5829
5723
|
|
|
5830
5724
|
function DataTableFooterCell(props) {
|
|
5831
5725
|
const { cellPosition, children, className, ...rest } = props;
|
|
5832
|
-
const [tabIndex, setTabIndex] = useState(-1);
|
|
5833
5726
|
const footerCellRef = useRef(null);
|
|
5834
|
-
const { moveFocusToCell } = useDTFocusDispatchContext();
|
|
5835
|
-
const handleFocus = useCallback(() => {
|
|
5836
|
-
moveFocusToCell(cellPosition);
|
|
5837
|
-
setTabIndex(0);
|
|
5838
|
-
}, [moveFocusToCell, cellPosition, setTabIndex]);
|
|
5839
|
-
const handleBlur = useCallback(() => {
|
|
5840
|
-
setTabIndex(-1);
|
|
5841
|
-
}, [setTabIndex]);
|
|
5842
5727
|
const { jumpFocus, moveFocus } = useDTFocusDispatchContext();
|
|
5843
5728
|
const handleKeyDown = useCallback(
|
|
5844
5729
|
(event) => {
|
|
@@ -5879,9 +5764,7 @@ function DataTableFooterCell(props) {
|
|
|
5879
5764
|
type: "data-table",
|
|
5880
5765
|
...rest,
|
|
5881
5766
|
ref: footerCellRef,
|
|
5882
|
-
tabIndex,
|
|
5883
|
-
onFocus: handleFocus,
|
|
5884
|
-
onBlur: handleBlur,
|
|
5767
|
+
tabIndex: -1,
|
|
5885
5768
|
onKeyDown: handleKeyDown,
|
|
5886
5769
|
className: cx(styles$9["data-table-footer-cell"], className),
|
|
5887
5770
|
"data-cell-pos": formatCellPositionString(cellPosition),
|
|
@@ -6036,6 +5919,27 @@ function DataTableFooter({
|
|
|
6036
5919
|
) : /* @__PURE__ */ jsx(DefaultTableFooterRows, { table, columns }) });
|
|
6037
5920
|
}
|
|
6038
5921
|
|
|
5922
|
+
function useCellFocusListener(elementRef) {
|
|
5923
|
+
const [isFocused, setIsFocused] = useState(false);
|
|
5924
|
+
useEffect(() => {
|
|
5925
|
+
const el = elementRef.current;
|
|
5926
|
+
if (!el) return;
|
|
5927
|
+
const cell = el.closest('[data-anv="table-body-cell"]');
|
|
5928
|
+
if (!cell) return;
|
|
5929
|
+
const onFocusIn = () => setIsFocused(true);
|
|
5930
|
+
const onFocusOut = (e) => {
|
|
5931
|
+
if (!cell.contains(e.relatedTarget)) setIsFocused(false);
|
|
5932
|
+
};
|
|
5933
|
+
cell.addEventListener("focusin", onFocusIn);
|
|
5934
|
+
cell.addEventListener("focusout", onFocusOut);
|
|
5935
|
+
return () => {
|
|
5936
|
+
cell.removeEventListener("focusin", onFocusIn);
|
|
5937
|
+
cell.removeEventListener("focusout", onFocusOut);
|
|
5938
|
+
};
|
|
5939
|
+
}, [elementRef]);
|
|
5940
|
+
return isFocused;
|
|
5941
|
+
}
|
|
5942
|
+
|
|
6039
5943
|
const variantConfig = {
|
|
6040
5944
|
error: {
|
|
6041
5945
|
icon: SvgError,
|
|
@@ -6050,7 +5954,8 @@ const variantConfig = {
|
|
|
6050
5954
|
};
|
|
6051
5955
|
function CellStatus({ status, variant }) {
|
|
6052
5956
|
const message = typeof status === "string" ? status : void 0;
|
|
6053
|
-
const
|
|
5957
|
+
const ref = useRef(null);
|
|
5958
|
+
const isCellFocused = useCellFocusListener(ref);
|
|
6054
5959
|
const [isHovered, setIsHovered] = useState(false);
|
|
6055
5960
|
const config = variantConfig[variant];
|
|
6056
5961
|
const icon = /* @__PURE__ */ jsx(
|
|
@@ -6062,13 +5967,14 @@ function CellStatus({ status, variant }) {
|
|
|
6062
5967
|
}
|
|
6063
5968
|
);
|
|
6064
5969
|
if (!message) {
|
|
6065
|
-
return icon;
|
|
5970
|
+
return /* @__PURE__ */ jsx("span", { ref, children: icon });
|
|
6066
5971
|
}
|
|
6067
|
-
const isTooltipOpen =
|
|
5972
|
+
const isTooltipOpen = isCellFocused || isHovered;
|
|
6068
5973
|
return /* @__PURE__ */ jsxs(Tooltip, { open: isTooltipOpen, children: [
|
|
6069
5974
|
/* @__PURE__ */ jsx(
|
|
6070
5975
|
Tooltip.Trigger,
|
|
6071
5976
|
{
|
|
5977
|
+
ref,
|
|
6072
5978
|
onMouseEnter: () => setIsHovered(true),
|
|
6073
5979
|
onMouseLeave: () => setIsHovered(false),
|
|
6074
5980
|
children: icon
|
|
@@ -6078,6 +5984,7 @@ function CellStatus({ status, variant }) {
|
|
|
6078
5984
|
] });
|
|
6079
5985
|
}
|
|
6080
5986
|
|
|
5987
|
+
const sharedColumnHelper = createColumnHelper();
|
|
6081
5988
|
function resolveHeaderAlign(align, isGroup = false) {
|
|
6082
5989
|
if (isGroup) {
|
|
6083
5990
|
return "start";
|
|
@@ -6168,10 +6075,9 @@ function getTanStackColumnDef({
|
|
|
6168
6075
|
columnDef,
|
|
6169
6076
|
emptyCellContent
|
|
6170
6077
|
}) {
|
|
6171
|
-
const columnHelper = createColumnHelper();
|
|
6172
6078
|
const normalizedHeader = normalizeColumnHeader(columnDef);
|
|
6173
6079
|
if (columnDef.columns && columnDef.columns.length > 0) {
|
|
6174
|
-
return
|
|
6080
|
+
return sharedColumnHelper.group({
|
|
6175
6081
|
id: columnDef.id,
|
|
6176
6082
|
header: () => renderColumnHeader(normalizedHeader, {
|
|
6177
6083
|
align: columnDef.align,
|
|
@@ -6213,7 +6119,7 @@ function getTanStackColumnDef({
|
|
|
6213
6119
|
...columnDef,
|
|
6214
6120
|
headerLabel: normalizedHeader.label
|
|
6215
6121
|
};
|
|
6216
|
-
return
|
|
6122
|
+
return sharedColumnHelper.accessor((row) => row[columnDef.id], {
|
|
6217
6123
|
id: columnDef.id,
|
|
6218
6124
|
cell: (info) => {
|
|
6219
6125
|
const rawCellValue = info.row.original[columnDef.id];
|
|
@@ -6233,16 +6139,10 @@ function getTanStackColumnDef({
|
|
|
6233
6139
|
const cellError = meta?.errors?.[columnDef.id];
|
|
6234
6140
|
const cellWarning = meta?.warnings?.[columnDef.id];
|
|
6235
6141
|
return /* @__PURE__ */ jsxs(
|
|
6236
|
-
|
|
6142
|
+
"div",
|
|
6237
6143
|
{
|
|
6238
|
-
|
|
6239
|
-
|
|
6240
|
-
wrap: "wrap",
|
|
6241
|
-
gap: "1",
|
|
6242
|
-
style: {
|
|
6243
|
-
width: "100%",
|
|
6244
|
-
textAlign: resolvedAlign
|
|
6245
|
-
},
|
|
6144
|
+
className: styles$9["data-table-cell-content"],
|
|
6145
|
+
"data-align": resolvedAlign ?? "start",
|
|
6246
6146
|
children: [
|
|
6247
6147
|
cellError ? /* @__PURE__ */ jsx(CellStatus, { status: cellError, variant: "error" }) : cellWarning ? /* @__PURE__ */ jsx(CellStatus, { status: cellWarning, variant: "warning" }) : null,
|
|
6248
6148
|
cellContent ?? resolvedEmptyContent
|
|
@@ -6256,6 +6156,10 @@ function getTanStackColumnDef({
|
|
|
6256
6156
|
footer: columnDef.footerContent ? () => columnDef.footerContent : void 0,
|
|
6257
6157
|
minSize: columnDef.minWidth,
|
|
6258
6158
|
maxSize: columnDef.maxWidth,
|
|
6159
|
+
// TanStack's `size` is the column's starting width — we use `defaultWidth`
|
|
6160
|
+
// when provided and fall back to `minWidth` so the auto-sizing basis
|
|
6161
|
+
// matches the manual-resize floor by default.
|
|
6162
|
+
size: columnDef.defaultWidth ?? columnDef.minWidth,
|
|
6259
6163
|
enableResizing: columnDef.resizable,
|
|
6260
6164
|
enableSorting: !!columnDef.sortable,
|
|
6261
6165
|
meta: {
|
|
@@ -6281,12 +6185,20 @@ function getTanStackColumnDef({
|
|
|
6281
6185
|
});
|
|
6282
6186
|
}
|
|
6283
6187
|
|
|
6188
|
+
function shallowSortingEqual(a, b) {
|
|
6189
|
+
if (a.length !== b.length) return false;
|
|
6190
|
+
for (let i = 0; i < a.length; i++) {
|
|
6191
|
+
if (a[i].id !== b[i].id || a[i].desc !== b[i].desc) return false;
|
|
6192
|
+
}
|
|
6193
|
+
return true;
|
|
6194
|
+
}
|
|
6195
|
+
|
|
6284
6196
|
const SvgArrowUpward = (props) => /* @__PURE__ */ React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", viewBox: "0 0 24 24", ...props }, /* @__PURE__ */ React.createElement("path", { d: "M13 19V7.83l4.88 4.88c.39.39 1.03.39 1.42 0a.996.996 0 0 0 0-1.41l-6.59-6.59a.996.996 0 0 0-1.41 0l-6.6 6.58a.996.996 0 1 0 1.41 1.41L11 7.83V19c0 .55.45 1 1 1s1-.45 1-1z" }));
|
|
6285
6197
|
|
|
6286
6198
|
const SvgArrowDownward = (props) => /* @__PURE__ */ React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", viewBox: "0 0 24 24", ...props }, /* @__PURE__ */ React.createElement("path", { d: "M11 5v11.17l-4.88-4.88c-.39-.39-1.03-.39-1.42 0a.996.996 0 0 0 0 1.41l6.59 6.59c.39.39 1.02.39 1.41 0l6.59-6.59a.996.996 0 1 0-1.41-1.41L13 16.17V5c0-.55-.45-1-1-1s-1 .45-1 1z" }));
|
|
6287
6199
|
|
|
6288
6200
|
const styles$5 = {
|
|
6289
|
-
"table-header": "_table-
|
|
6201
|
+
"table-header": "_table-header_nz2nu_2"
|
|
6290
6202
|
};
|
|
6291
6203
|
|
|
6292
6204
|
function TableHeader({ type, children, ...rest }) {
|
|
@@ -6369,15 +6281,6 @@ function DataTableHeaderCellInner(props, forwardedRef) {
|
|
|
6369
6281
|
},
|
|
6370
6282
|
[forwardedRef]
|
|
6371
6283
|
);
|
|
6372
|
-
const { moveFocusToCell } = useDTFocusDispatchContext();
|
|
6373
|
-
const [tabIndex, setTabIndex] = useState(-1);
|
|
6374
|
-
const handleFocus = useCallback(() => {
|
|
6375
|
-
moveFocusToCell(cellPosition);
|
|
6376
|
-
setTabIndex(0);
|
|
6377
|
-
}, [moveFocusToCell, cellPosition, setTabIndex]);
|
|
6378
|
-
const handleBlur = useCallback(() => {
|
|
6379
|
-
setTabIndex(-1);
|
|
6380
|
-
}, [setTabIndex]);
|
|
6381
6284
|
const { jumpFocus, moveFocus } = useDTFocusDispatchContext();
|
|
6382
6285
|
const columnId = header.column.id;
|
|
6383
6286
|
const isExpandCell = columnId === INTERNAL_ROW_ACTION_PRIMARY_COLUMN_ID;
|
|
@@ -6470,10 +6373,8 @@ function DataTableHeaderCellInner(props, forwardedRef) {
|
|
|
6470
6373
|
type: "data-table",
|
|
6471
6374
|
...rest,
|
|
6472
6375
|
ref: setRefs,
|
|
6473
|
-
tabIndex,
|
|
6474
|
-
onFocus: handleFocus,
|
|
6376
|
+
tabIndex: -1,
|
|
6475
6377
|
onClick: handleClick,
|
|
6476
|
-
onBlur: handleBlur,
|
|
6477
6378
|
onKeyDown: handleKeyDown,
|
|
6478
6379
|
className: cx(styles$9["data-table-header-cell"], className),
|
|
6479
6380
|
"data-cell-pos": formatCellPositionString(cellPosition),
|
|
@@ -6528,13 +6429,9 @@ function ResizeHandle({
|
|
|
6528
6429
|
}
|
|
6529
6430
|
|
|
6530
6431
|
const styles$3 = {
|
|
6531
|
-
"data-table-header-row": "_data-table-header-
|
|
6432
|
+
"data-table-header-row": "_data-table-header-row_w353z_17"
|
|
6532
6433
|
};
|
|
6533
6434
|
|
|
6534
|
-
function useDTHoverDispatchContext() {
|
|
6535
|
-
return useContext(DTHoverDispatchContext);
|
|
6536
|
-
}
|
|
6537
|
-
|
|
6538
6435
|
function getHeaderContentAlign(align) {
|
|
6539
6436
|
if (align === "center") {
|
|
6540
6437
|
return "center";
|
|
@@ -6544,25 +6441,36 @@ function getHeaderContentAlign(align) {
|
|
|
6544
6441
|
}
|
|
6545
6442
|
return "flex-start";
|
|
6546
6443
|
}
|
|
6547
|
-
function DataTableHeader({
|
|
6548
|
-
|
|
6444
|
+
function DataTableHeader({
|
|
6445
|
+
table,
|
|
6446
|
+
tableRef
|
|
6447
|
+
}) {
|
|
6448
|
+
const getTableBase = useCallback(
|
|
6449
|
+
() => tableRef.current?.querySelector(
|
|
6450
|
+
'[data-anv="data-table-base"]'
|
|
6451
|
+
) ?? null,
|
|
6452
|
+
[tableRef]
|
|
6453
|
+
);
|
|
6549
6454
|
const handleHoverColumn = useCallback(
|
|
6550
6455
|
(columnId) => {
|
|
6551
|
-
|
|
6552
|
-
|
|
6553
|
-
|
|
6554
|
-
});
|
|
6456
|
+
const base = getTableBase();
|
|
6457
|
+
if (!base) return;
|
|
6458
|
+
base.setAttribute("data-anv-hover-col", columnId);
|
|
6459
|
+
base.querySelectorAll(`[data-anv-column-id="${CSS.escape(columnId)}"]`).forEach((el) => el.setAttribute("data-anv-is-hovered-col", "true"));
|
|
6555
6460
|
},
|
|
6556
|
-
[
|
|
6461
|
+
[getTableBase]
|
|
6557
6462
|
);
|
|
6558
6463
|
const handleHoverColumnLeave = useCallback(
|
|
6559
6464
|
(columnId) => {
|
|
6560
|
-
|
|
6561
|
-
|
|
6562
|
-
|
|
6563
|
-
|
|
6465
|
+
const base = getTableBase();
|
|
6466
|
+
if (!base) return;
|
|
6467
|
+
if (base.getAttribute("data-anv-hover-col") !== columnId) return;
|
|
6468
|
+
base.removeAttribute("data-anv-hover-col");
|
|
6469
|
+
base.querySelectorAll(
|
|
6470
|
+
`[data-anv-column-id="${CSS.escape(columnId)}"][data-anv-is-hovered-col="true"]`
|
|
6471
|
+
).forEach((el) => el.removeAttribute("data-anv-is-hovered-col"));
|
|
6564
6472
|
},
|
|
6565
|
-
[
|
|
6473
|
+
[getTableBase]
|
|
6566
6474
|
);
|
|
6567
6475
|
const cellRefs = useRef(/* @__PURE__ */ new Map());
|
|
6568
6476
|
const createResizeStartHandler = useCallback(
|
|
@@ -6580,15 +6488,6 @@ function DataTableHeader({ table }) {
|
|
|
6580
6488
|
},
|
|
6581
6489
|
[table]
|
|
6582
6490
|
);
|
|
6583
|
-
const handleResizeEnd = useCallback(
|
|
6584
|
-
(columnId) => {
|
|
6585
|
-
dispatch({
|
|
6586
|
-
type: "RESIZE_END",
|
|
6587
|
-
payload: { columnId }
|
|
6588
|
-
});
|
|
6589
|
-
},
|
|
6590
|
-
[dispatch]
|
|
6591
|
-
);
|
|
6592
6491
|
const { columnOrder } = useColumnOrder({ table });
|
|
6593
6492
|
return /* @__PURE__ */ jsx(TableHeader, { type: "data-table", children: table.getHeaderGroups().map((headerGroup, index) => /* @__PURE__ */ jsx(
|
|
6594
6493
|
"div",
|
|
@@ -6620,6 +6519,7 @@ function DataTableHeader({ table }) {
|
|
|
6620
6519
|
}
|
|
6621
6520
|
},
|
|
6622
6521
|
className: getCommonPinningClasses(header.column),
|
|
6522
|
+
"data-anv-column-id": header.column.id,
|
|
6623
6523
|
style: {
|
|
6624
6524
|
gridColumn,
|
|
6625
6525
|
...getCommonPinningStyles(header.column)
|
|
@@ -6686,8 +6586,7 @@ function DataTableHeader({ table }) {
|
|
|
6686
6586
|
header,
|
|
6687
6587
|
onResizeStart: createResizeStartHandler(
|
|
6688
6588
|
header.column.id
|
|
6689
|
-
)
|
|
6690
|
-
onResizeEnd: () => handleResizeEnd(header.column.id)
|
|
6589
|
+
)
|
|
6691
6590
|
}
|
|
6692
6591
|
)
|
|
6693
6592
|
]
|
|
@@ -6703,8 +6602,8 @@ function DataTableHeader({ table }) {
|
|
|
6703
6602
|
}
|
|
6704
6603
|
|
|
6705
6604
|
const styles$2 = {
|
|
6706
|
-
"table-container": "_table-
|
|
6707
|
-
"table-scroll-container": "_table-scroll-
|
|
6605
|
+
"table-container": "_table-container_vqc6w_2",
|
|
6606
|
+
"table-scroll-container": "_table-scroll-container_vqc6w_57"
|
|
6708
6607
|
};
|
|
6709
6608
|
|
|
6710
6609
|
const TableContainer = forwardRef(
|
|
@@ -6857,49 +6756,6 @@ function usePageDataCache(config) {
|
|
|
6857
6756
|
return { getOrLoad, clearCache };
|
|
6858
6757
|
}
|
|
6859
6758
|
|
|
6860
|
-
function DTHoverProvider({ children }) {
|
|
6861
|
-
const [state, dispatch] = useReducer(reducer$1, initialState$1);
|
|
6862
|
-
return /* @__PURE__ */ jsx(DTHoverStateContext.Provider, { value: state, children: /* @__PURE__ */ jsx(DTHoverDispatchContext.Provider, { value: dispatch, children }) });
|
|
6863
|
-
}
|
|
6864
|
-
function reducer$1(state, action) {
|
|
6865
|
-
switch (action.type) {
|
|
6866
|
-
case "HOVER_START": {
|
|
6867
|
-
return {
|
|
6868
|
-
...state,
|
|
6869
|
-
hoveredColumnId: action.payload.columnId
|
|
6870
|
-
};
|
|
6871
|
-
}
|
|
6872
|
-
case "HOVER_END": {
|
|
6873
|
-
if (state.hoveredColumnId !== action.payload.columnId) {
|
|
6874
|
-
return state;
|
|
6875
|
-
}
|
|
6876
|
-
return {
|
|
6877
|
-
...state,
|
|
6878
|
-
hoveredColumnId: null
|
|
6879
|
-
};
|
|
6880
|
-
}
|
|
6881
|
-
case "RESIZE_START": {
|
|
6882
|
-
return {
|
|
6883
|
-
...state,
|
|
6884
|
-
resizingColumnId: action.payload.columnId
|
|
6885
|
-
};
|
|
6886
|
-
}
|
|
6887
|
-
case "RESIZE_END": {
|
|
6888
|
-
return {
|
|
6889
|
-
...state,
|
|
6890
|
-
resizingColumnId: null
|
|
6891
|
-
};
|
|
6892
|
-
}
|
|
6893
|
-
default: {
|
|
6894
|
-
throw new Error("Unknown action");
|
|
6895
|
-
}
|
|
6896
|
-
}
|
|
6897
|
-
}
|
|
6898
|
-
const initialState$1 = {
|
|
6899
|
-
hoveredColumnId: null,
|
|
6900
|
-
resizingColumnId: null
|
|
6901
|
-
};
|
|
6902
|
-
|
|
6903
6759
|
function scrollCellIntoView(element, stickyDimensions) {
|
|
6904
6760
|
const isBodyCell = element.getAttribute("data-anv") === "table-body-cell";
|
|
6905
6761
|
const scrollContainer = element.closest(
|
|
@@ -7085,9 +6941,32 @@ function DTFocusProvider({
|
|
|
7085
6941
|
columnCount,
|
|
7086
6942
|
tableRef,
|
|
7087
6943
|
leftPinnedWidth,
|
|
7088
|
-
rightPinnedWidth
|
|
6944
|
+
rightPinnedWidth,
|
|
6945
|
+
virtualizer,
|
|
6946
|
+
headerRowCount
|
|
7089
6947
|
}) {
|
|
7090
6948
|
const stateRef = useRef(initialState);
|
|
6949
|
+
const lastTabbablePosRef = useRef(null);
|
|
6950
|
+
const syncRovingTabindex = useCallback(() => {
|
|
6951
|
+
const restorePoint = stateRef.current.focusRestorePoint;
|
|
6952
|
+
const prev = lastTabbablePosRef.current;
|
|
6953
|
+
const nextEl = tableRef.current?.querySelector(
|
|
6954
|
+
`[data-cell-pos="${formatCellPositionString(restorePoint)}"]`
|
|
6955
|
+
);
|
|
6956
|
+
const restorePointUnchanged = prev && prev.rowIndex === restorePoint.rowIndex && prev.columnIndex === restorePoint.columnIndex;
|
|
6957
|
+
if (restorePointUnchanged && nextEl?.tabIndex === 0) {
|
|
6958
|
+
return;
|
|
6959
|
+
}
|
|
6960
|
+
const prevEl = prev && !restorePointUnchanged ? tableRef.current?.querySelector(
|
|
6961
|
+
`[data-cell-pos="${formatCellPositionString(prev)}"]`
|
|
6962
|
+
) : null;
|
|
6963
|
+
if (prevEl) prevEl.tabIndex = -1;
|
|
6964
|
+
if (nextEl) nextEl.tabIndex = 0;
|
|
6965
|
+
lastTabbablePosRef.current = restorePoint;
|
|
6966
|
+
}, [tableRef]);
|
|
6967
|
+
useLayoutEffect(() => {
|
|
6968
|
+
syncRovingTabindex();
|
|
6969
|
+
}, [syncRovingTabindex, rowCount, columnCount]);
|
|
7091
6970
|
const dispatch = useCallback(
|
|
7092
6971
|
(action) => {
|
|
7093
6972
|
const newState = reducer(stateRef.current, action, rowCount, columnCount);
|
|
@@ -7102,26 +6981,55 @@ function DTFocusProvider({
|
|
|
7102
6981
|
}
|
|
7103
6982
|
}
|
|
7104
6983
|
stateRef.current = newState;
|
|
6984
|
+
syncRovingTabindex();
|
|
7105
6985
|
if (!newState.focusedCell || shouldSkipFocusUpdate) {
|
|
7106
6986
|
return;
|
|
7107
6987
|
}
|
|
7108
|
-
const
|
|
7109
|
-
|
|
7110
|
-
|
|
7111
|
-
|
|
7112
|
-
|
|
7113
|
-
|
|
7114
|
-
|
|
7115
|
-
|
|
7116
|
-
|
|
7117
|
-
|
|
7118
|
-
|
|
7119
|
-
|
|
7120
|
-
|
|
7121
|
-
|
|
6988
|
+
const focusTargetCell = () => {
|
|
6989
|
+
if (!newState.focusedCell) return;
|
|
6990
|
+
if (!areCellPositionsEqual(
|
|
6991
|
+
newState.focusedCell,
|
|
6992
|
+
stateRef.current.focusedCell
|
|
6993
|
+
)) {
|
|
6994
|
+
return;
|
|
6995
|
+
}
|
|
6996
|
+
const element = tableRef.current?.querySelector(
|
|
6997
|
+
`[data-cell-pos="${formatCellPositionString(newState.focusedCell)}"]`
|
|
6998
|
+
);
|
|
6999
|
+
if (element) {
|
|
7000
|
+
element.focus();
|
|
7001
|
+
scrollCellIntoView(element, {
|
|
7002
|
+
leftWidth: leftPinnedWidth,
|
|
7003
|
+
rightWidth: rightPinnedWidth
|
|
7004
|
+
});
|
|
7005
|
+
} else {
|
|
7006
|
+
dispatch({
|
|
7007
|
+
type: "FOCUS_CELL_MANUALLY",
|
|
7008
|
+
payload: { cellPosition: { rowIndex: 0, columnIndex: 0 } }
|
|
7009
|
+
});
|
|
7010
|
+
}
|
|
7011
|
+
};
|
|
7012
|
+
if (virtualizer && newState.focusedCell) {
|
|
7013
|
+
const virtualRowIndex = newState.focusedCell.rowIndex - headerRowCount;
|
|
7014
|
+
const bodyRowCount = virtualizer.options.count;
|
|
7015
|
+
if (virtualRowIndex >= 0 && virtualRowIndex < bodyRowCount) {
|
|
7016
|
+
virtualizer.scrollToIndex(virtualRowIndex, { align: "auto" });
|
|
7017
|
+
requestAnimationFrame(focusTargetCell);
|
|
7018
|
+
return;
|
|
7019
|
+
}
|
|
7122
7020
|
}
|
|
7021
|
+
focusTargetCell();
|
|
7123
7022
|
},
|
|
7124
|
-
[
|
|
7023
|
+
[
|
|
7024
|
+
rowCount,
|
|
7025
|
+
columnCount,
|
|
7026
|
+
tableRef,
|
|
7027
|
+
leftPinnedWidth,
|
|
7028
|
+
rightPinnedWidth,
|
|
7029
|
+
syncRovingTabindex,
|
|
7030
|
+
virtualizer,
|
|
7031
|
+
headerRowCount
|
|
7032
|
+
]
|
|
7125
7033
|
);
|
|
7126
7034
|
const state = useMemo(
|
|
7127
7035
|
() => ({ getFocusedCell: () => stateRef.current.focusedCell }),
|
|
@@ -7130,6 +7038,38 @@ function DTFocusProvider({
|
|
|
7130
7038
|
return /* @__PURE__ */ jsx(DTFocusStateContext.Provider, { value: state, children: /* @__PURE__ */ jsx(DTFocusDispatchContext.Provider, { value: dispatch, children }) });
|
|
7131
7039
|
}
|
|
7132
7040
|
|
|
7041
|
+
const VIRTUALIZATION_THRESHOLD = 101;
|
|
7042
|
+
const DEFAULT_ESTIMATED_ROW_HEIGHT = 35;
|
|
7043
|
+
function useDataTableVirtualizer({
|
|
7044
|
+
rowCount,
|
|
7045
|
+
scrollRef,
|
|
7046
|
+
disabled
|
|
7047
|
+
}) {
|
|
7048
|
+
const shouldVirtualize = !disabled && rowCount >= VIRTUALIZATION_THRESHOLD;
|
|
7049
|
+
const virtualizer = useVirtualizer({
|
|
7050
|
+
count: shouldVirtualize ? rowCount : 0,
|
|
7051
|
+
// `scrollRef` points at the outer TableContainer div, which does not
|
|
7052
|
+
// itself scroll — the nested [data-anv="table-scroll-container"] child
|
|
7053
|
+
// owns `overflow-y: auto`. Descend to that child so the virtualizer
|
|
7054
|
+
// tracks the right element. Fall back to `scrollRef.current` for
|
|
7055
|
+
// containers that one day collapse the scroll wrapper.
|
|
7056
|
+
getScrollElement: () => {
|
|
7057
|
+
const outer = scrollRef.current;
|
|
7058
|
+
if (!outer) return null;
|
|
7059
|
+
return outer.querySelector(
|
|
7060
|
+
'[data-anv="table-scroll-container"]'
|
|
7061
|
+
) ?? outer;
|
|
7062
|
+
},
|
|
7063
|
+
estimateSize: () => DEFAULT_ESTIMATED_ROW_HEIGHT,
|
|
7064
|
+
overscan: 5,
|
|
7065
|
+
measureElement: typeof window !== "undefined" && typeof navigator !== "undefined" && navigator.userAgent.indexOf("jsdom") === -1 ? (el) => el?.getBoundingClientRect().height ?? DEFAULT_ESTIMATED_ROW_HEIGHT : void 0
|
|
7066
|
+
});
|
|
7067
|
+
return useMemo(
|
|
7068
|
+
() => shouldVirtualize ? virtualizer : void 0,
|
|
7069
|
+
[shouldVirtualize, virtualizer]
|
|
7070
|
+
);
|
|
7071
|
+
}
|
|
7072
|
+
|
|
7133
7073
|
const EMPTY_DATA = [];
|
|
7134
7074
|
function DataTableInner(props, ref) {
|
|
7135
7075
|
const { layoutStyles, componentProps } = useLayoutPropsUtil(props);
|
|
@@ -7152,6 +7092,8 @@ function DataTableInner(props, ref) {
|
|
|
7152
7092
|
sortedColumn,
|
|
7153
7093
|
emptyState,
|
|
7154
7094
|
emptyCellContent,
|
|
7095
|
+
disableVirtualization,
|
|
7096
|
+
getRowVersion,
|
|
7155
7097
|
className,
|
|
7156
7098
|
style,
|
|
7157
7099
|
...rest
|
|
@@ -7240,11 +7182,13 @@ function DataTableInner(props, ref) {
|
|
|
7240
7182
|
isLoading
|
|
7241
7183
|
} = useAsyncData(dataSource);
|
|
7242
7184
|
const totalItemCount = paginationObject?.totalRowCount ?? resolvedData?.length ?? 0;
|
|
7243
|
-
const hasSubRows =
|
|
7244
|
-
(row) => row?.subRows?.length ?? 0 > 0
|
|
7185
|
+
const hasSubRows = useMemo(
|
|
7186
|
+
() => !!resolvedData?.some((row) => (row?.subRows?.length ?? 0) > 0),
|
|
7187
|
+
[resolvedData]
|
|
7245
7188
|
);
|
|
7246
|
-
const hasSubComponent =
|
|
7247
|
-
(row) => row?.subComponent != null
|
|
7189
|
+
const hasSubComponent = useMemo(
|
|
7190
|
+
() => !!resolvedData?.some((row) => row?.subComponent != null),
|
|
7191
|
+
[resolvedData]
|
|
7248
7192
|
);
|
|
7249
7193
|
const isExpandable = hasSubRows || hasSubComponent;
|
|
7250
7194
|
const [expanded, setExpanded] = useOptionallyControlledState({
|
|
@@ -7428,9 +7372,9 @@ function DataTableInner(props, ref) {
|
|
|
7428
7372
|
columns,
|
|
7429
7373
|
getCoreRowModel: getCoreRowModel(),
|
|
7430
7374
|
getSortedRowModel: getSortedRowModel(),
|
|
7431
|
-
getPaginationRowModel: getPaginationRowModel(),
|
|
7432
|
-
getExpandedRowModel: getExpandedRowModel(),
|
|
7433
|
-
|
|
7375
|
+
...isPaginated && { getPaginationRowModel: getPaginationRowModel() },
|
|
7376
|
+
...isExpandable && { getExpandedRowModel: getExpandedRowModel() },
|
|
7377
|
+
// Grouping row model is retained for future use; cheap to exclude now.
|
|
7434
7378
|
getRowId: (row) => row.id.toString(),
|
|
7435
7379
|
getSubRows: (row) => row.subRows ?? void 0,
|
|
7436
7380
|
getRowCanExpand: (row) => {
|
|
@@ -7463,8 +7407,7 @@ function DataTableInner(props, ref) {
|
|
|
7463
7407
|
},
|
|
7464
7408
|
onSortingChange: (updaterOrValue) => {
|
|
7465
7409
|
const newSorting = typeof updaterOrValue === "function" ? updaterOrValue(sorting) : updaterOrValue;
|
|
7466
|
-
|
|
7467
|
-
if (!sortingChanged) {
|
|
7410
|
+
if (shallowSortingEqual(newSorting, sorting ?? [])) {
|
|
7468
7411
|
return;
|
|
7469
7412
|
}
|
|
7470
7413
|
setSorting(newSorting);
|
|
@@ -7473,6 +7416,11 @@ function DataTableInner(props, ref) {
|
|
|
7473
7416
|
}
|
|
7474
7417
|
}
|
|
7475
7418
|
});
|
|
7419
|
+
const rowVirtualizer = useDataTableVirtualizer({
|
|
7420
|
+
rowCount: table.getRowModel().rows.length,
|
|
7421
|
+
scrollRef: tableRef,
|
|
7422
|
+
disabled: disableVirtualization
|
|
7423
|
+
});
|
|
7476
7424
|
const headers = table.getFlatHeaders();
|
|
7477
7425
|
const headerRowCount = table.getHeaderGroups().length;
|
|
7478
7426
|
const bodyRowCount = table.getRowModel().rows.length;
|
|
@@ -7529,15 +7477,14 @@ function DataTableInner(props, ref) {
|
|
|
7529
7477
|
if (hasBeenResized) {
|
|
7530
7478
|
return `${currentSize}px`;
|
|
7531
7479
|
}
|
|
7532
|
-
|
|
7480
|
+
if (header.column.getIsPinned()) {
|
|
7481
|
+
return `${currentSize}px`;
|
|
7482
|
+
}
|
|
7533
7483
|
const maxSize = header.column.columnDef.maxSize;
|
|
7534
|
-
return `minmax(${
|
|
7484
|
+
return `minmax(${currentSize}px, ${maxSize ? `${maxSize}px` : "1fr"})`;
|
|
7535
7485
|
}).join(" ");
|
|
7536
7486
|
vars["--a2-grid-template-columns"] = gridColumns;
|
|
7537
7487
|
vars["--a2-table-width"] = allHaveMaxWidth ? "max-content" : "100%";
|
|
7538
|
-
for (const header of headers) {
|
|
7539
|
-
vars[`--a2-table-col-${header.column.getIndex()}-size`] = header.column.getSize();
|
|
7540
|
-
}
|
|
7541
7488
|
return vars;
|
|
7542
7489
|
}, [headers, columnSizing]);
|
|
7543
7490
|
const columnCount = useMemo(() => {
|
|
@@ -7551,7 +7498,9 @@ function DataTableInner(props, ref) {
|
|
|
7551
7498
|
tableRef,
|
|
7552
7499
|
leftPinnedWidth: table.getLeftTotalSize(),
|
|
7553
7500
|
rightPinnedWidth: table.getRightTotalSize(),
|
|
7554
|
-
|
|
7501
|
+
virtualizer: rowVirtualizer,
|
|
7502
|
+
headerRowCount,
|
|
7503
|
+
children: /* @__PURE__ */ jsxs(
|
|
7555
7504
|
TableContainer,
|
|
7556
7505
|
{
|
|
7557
7506
|
...rest,
|
|
@@ -7573,8 +7522,16 @@ function DataTableInner(props, ref) {
|
|
|
7573
7522
|
colCount: columnCount,
|
|
7574
7523
|
hasSubRows,
|
|
7575
7524
|
children: [
|
|
7576
|
-
/* @__PURE__ */ jsx(DataTableHeader, { table }),
|
|
7577
|
-
/* @__PURE__ */ jsx(
|
|
7525
|
+
/* @__PURE__ */ jsx(DataTableHeader, { table, tableRef }),
|
|
7526
|
+
/* @__PURE__ */ jsx(
|
|
7527
|
+
DataTableBody,
|
|
7528
|
+
{
|
|
7529
|
+
table,
|
|
7530
|
+
hasSubRows,
|
|
7531
|
+
virtualizer: rowVirtualizer,
|
|
7532
|
+
getRowVersion
|
|
7533
|
+
}
|
|
7534
|
+
),
|
|
7578
7535
|
isEmpty && emptyState && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
7579
7536
|
/* @__PURE__ */ jsx(SrOnly, { children: "No data to display." }),
|
|
7580
7537
|
/* @__PURE__ */ jsx("div", { className: styles["empty-state-container"], children: /* @__PURE__ */ jsxs(
|
|
@@ -7651,11 +7608,11 @@ function DataTableInner(props, ref) {
|
|
|
7651
7608
|
)
|
|
7652
7609
|
]
|
|
7653
7610
|
}
|
|
7654
|
-
)
|
|
7611
|
+
)
|
|
7655
7612
|
}
|
|
7656
7613
|
);
|
|
7657
7614
|
}
|
|
7658
7615
|
const DataTable = forwardRef(DataTableInner);
|
|
7659
7616
|
|
|
7660
7617
|
export { COLUMN_TYPE_DEFAULTS as C, DataTable as D, chipsFormatter as a, booleanFormatter as b, createColumnHelper$1 as c, currencyFormatter as d, dateFormatter as e, dateTimeFormatter as f, getColumnTypeDefaults as g, htmlFormatter as h, dateFormatPresets as i, timeFormatter as j, markdownFormatter as m, numberFormatter as n, percentFormatter as p, resolveColumnTypeConfig as r, timeFormatPresets as t, yearlessDateFormatter as y };
|
|
7661
|
-
//# sourceMappingURL=DataTable-
|
|
7618
|
+
//# sourceMappingURL=DataTable-bMoIuYBK.js.map
|