@undevy-org/tablewright 0.1.0
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/LICENSE +21 -0
- package/README.md +262 -0
- package/dist/es/components/dashboard/ReportSummaryCard.js +67 -0
- package/dist/es/components/data-table/AppliedStateChips.js +113 -0
- package/dist/es/components/data-table/ColumnFilterPopover.js +548 -0
- package/dist/es/components/data-table/ColumnHeaderMenu.js +144 -0
- package/dist/es/components/data-table/CompoundFilterPopover.js +508 -0
- package/dist/es/components/data-table/CopyButton.js +35 -0
- package/dist/es/components/data-table/CopyableText.js +26 -0
- package/dist/es/components/data-table/DataTableShell.js +145 -0
- package/dist/es/components/data-table/DrawerActionGroup.js +59 -0
- package/dist/es/components/data-table/DrawerEntityCard.js +21 -0
- package/dist/es/components/data-table/DrawerField.js +10 -0
- package/dist/es/components/data-table/DrawerFlagItem.js +20 -0
- package/dist/es/components/data-table/DrawerSection.js +26 -0
- package/dist/es/components/data-table/DrawerShell.js +141 -0
- package/dist/es/components/data-table/DrawerSummaryCard.js +11 -0
- package/dist/es/components/data-table/EmptyState.js +14 -0
- package/dist/es/components/data-table/ExpiryTimestampCell.js +43 -0
- package/dist/es/components/data-table/FilterChip.js +47 -0
- package/dist/es/components/data-table/FilterFormPanel.js +357 -0
- package/dist/es/components/data-table/FilterFormToggle.js +77 -0
- package/dist/es/components/data-table/FilterPopoverFooter.js +19 -0
- package/dist/es/components/data-table/FilterToolbar.js +131 -0
- package/dist/es/components/data-table/FlatColumnToggle.js +46 -0
- package/dist/es/components/data-table/GapIndicator.js +29 -0
- package/dist/es/components/data-table/GroupedColumnToggle.js +112 -0
- package/dist/es/components/data-table/RowActionsMenu.js +74 -0
- package/dist/es/components/data-table/RowControlCell.js +104 -0
- package/dist/es/components/data-table/SortableHeader.js +102 -0
- package/dist/es/components/data-table/TableFooter.js +132 -0
- package/dist/es/components/data-table/TableLayout.js +14 -0
- package/dist/es/components/data-table/TimestampCell.js +16 -0
- package/dist/es/components/data-table/TwoPanelMenu.js +64 -0
- package/dist/es/components/data-table/ViewChip.js +25 -0
- package/dist/es/components/data-table/cells/AmountCell.js +127 -0
- package/dist/es/components/data-table/cells/ConfirmedAmountCell.js +115 -0
- package/dist/es/components/data-table/cells/CurrencyAmountCell.js +26 -0
- package/dist/es/components/data-table/cells/DualLineCell.js +59 -0
- package/dist/es/components/data-table/cells/EnumBadgeCell.js +9 -0
- package/dist/es/components/data-table/cells/MonoIdCell.js +31 -0
- package/dist/es/components/data-table/hooks/use-column-resize.js +39 -0
- package/dist/es/components/data-table/hooks/use-row-drag.js +40 -0
- package/dist/es/components/data-table/hooks/use-table-pagination.js +14 -0
- package/dist/es/components/data-table/hooks/use-table-sort.js +35 -0
- package/dist/es/components/data-table/managed-filters.js +34 -0
- package/dist/es/components/data-table/sticky-utils.js +25 -0
- package/dist/es/components/layout/AppShell.js +113 -0
- package/dist/es/components/layout/Sidebar.js +128 -0
- package/dist/es/components/layout/SidebarAccountMenu.js +129 -0
- package/dist/es/components/layout/SidebarUser.js +38 -0
- package/dist/es/components/layout/TopBar.js +25 -0
- package/dist/es/components/layout/app-shell-context.js +9 -0
- package/dist/es/components/ui/badge.js +31 -0
- package/dist/es/components/ui/button-footer.js +25 -0
- package/dist/es/components/ui/button.js +44 -0
- package/dist/es/components/ui/checkbox.js +24 -0
- package/dist/es/components/ui/combobox.js +179 -0
- package/dist/es/components/ui/dialog.js +80 -0
- package/dist/es/components/ui/dropdown-menu.js +66 -0
- package/dist/es/components/ui/input.js +24 -0
- package/dist/es/components/ui/popover.js +33 -0
- package/dist/es/components/ui/segmented-control.js +60 -0
- package/dist/es/components/ui/select.js +66 -0
- package/dist/es/components/ui/tabs.js +41 -0
- package/dist/es/components/ui/theme-switch.js +47 -0
- package/dist/es/constants/drawer.js +4 -0
- package/dist/es/context/drawer-expand-context.js +10 -0
- package/dist/es/context/portal-container-context.js +10 -0
- package/dist/es/hooks/table-orchestration-store.js +165 -0
- package/dist/es/hooks/use-scroll-activity.js +33 -0
- package/dist/es/hooks/useRowDragOverride.js +18 -0
- package/dist/es/hooks/useTableOrchestration.js +452 -0
- package/dist/es/index.js +199 -0
- package/dist/es/lib/column-gaps.js +23 -0
- package/dist/es/lib/filter-stats.js +67 -0
- package/dist/es/lib/format-enum.js +6 -0
- package/dist/es/lib/format-timestamp.js +37 -0
- package/dist/es/lib/style-scope.js +4 -0
- package/dist/es/lib/utils.js +8 -0
- package/dist/fonts.css +5 -0
- package/dist/preflight.css +502 -0
- package/dist/styles.css +1731 -0
- package/dist/tablewright.cjs +5473 -0
- package/dist/tablewright.css +1579 -0
- package/dist/tokens.css +150 -0
- package/dist/types/components/dashboard/ReportSummaryCard.d.ts +15 -0
- package/dist/types/components/data-table/AppliedStateChips.d.ts +28 -0
- package/dist/types/components/data-table/ColumnFilterPopover.d.ts +14 -0
- package/dist/types/components/data-table/ColumnHeaderMenu.d.ts +27 -0
- package/dist/types/components/data-table/CompoundFilterPopover.d.ts +14 -0
- package/dist/types/components/data-table/CopyButton.d.ts +8 -0
- package/dist/types/components/data-table/CopyableText.d.ts +10 -0
- package/dist/types/components/data-table/DataTableShell.d.ts +30 -0
- package/dist/types/components/data-table/DrawerActionGroup.d.ts +8 -0
- package/dist/types/components/data-table/DrawerEntityCard.d.ts +13 -0
- package/dist/types/components/data-table/DrawerField.d.ts +7 -0
- package/dist/types/components/data-table/DrawerFlagItem.d.ts +10 -0
- package/dist/types/components/data-table/DrawerSection.d.ts +8 -0
- package/dist/types/components/data-table/DrawerShell.d.ts +33 -0
- package/dist/types/components/data-table/DrawerSummaryCard.d.ts +7 -0
- package/dist/types/components/data-table/EmptyState.d.ts +6 -0
- package/dist/types/components/data-table/ExpiryTimestampCell.d.ts +6 -0
- package/dist/types/components/data-table/FilterChip.d.ts +8 -0
- package/dist/types/components/data-table/FilterFormPanel.d.ts +34 -0
- package/dist/types/components/data-table/FilterFormToggle.d.ts +18 -0
- package/dist/types/components/data-table/FilterPopoverFooter.d.ts +9 -0
- package/dist/types/components/data-table/FilterToolbar.d.ts +29 -0
- package/dist/types/components/data-table/FlatColumnToggle.d.ts +10 -0
- package/dist/types/components/data-table/GapIndicator.d.ts +11 -0
- package/dist/types/components/data-table/GroupedColumnToggle.d.ts +12 -0
- package/dist/types/components/data-table/RowActionsMenu.d.ts +10 -0
- package/dist/types/components/data-table/RowControlCell.d.ts +16 -0
- package/dist/types/components/data-table/SortableHeader.d.ts +16 -0
- package/dist/types/components/data-table/TableFooter.d.ts +31 -0
- package/dist/types/components/data-table/TableLayout.d.ts +12 -0
- package/dist/types/components/data-table/TimestampCell.d.ts +3 -0
- package/dist/types/components/data-table/TwoPanelMenu.d.ts +22 -0
- package/dist/types/components/data-table/ViewChip.d.ts +6 -0
- package/dist/types/components/data-table/cells/AmountCell.d.ts +11 -0
- package/dist/types/components/data-table/cells/ConfirmedAmountCell.d.ts +10 -0
- package/dist/types/components/data-table/cells/CurrencyAmountCell.d.ts +8 -0
- package/dist/types/components/data-table/cells/DualLineCell.d.ts +44 -0
- package/dist/types/components/data-table/cells/EnumBadgeCell.d.ts +9 -0
- package/dist/types/components/data-table/cells/MonoIdCell.d.ts +19 -0
- package/dist/types/components/data-table/filter-types.d.ts +79 -0
- package/dist/types/components/data-table/hooks/use-column-resize.d.ts +7 -0
- package/dist/types/components/data-table/hooks/use-row-drag.d.ts +14 -0
- package/dist/types/components/data-table/hooks/use-table-pagination.d.ts +10 -0
- package/dist/types/components/data-table/hooks/use-table-sort.d.ts +6 -0
- package/dist/types/components/data-table/managed-filters.d.ts +18 -0
- package/dist/types/components/data-table/sticky-utils.d.ts +4 -0
- package/dist/types/components/data-table/types.d.ts +35 -0
- package/dist/types/components/layout/AppShell.d.ts +23 -0
- package/dist/types/components/layout/Sidebar.d.ts +16 -0
- package/dist/types/components/layout/SidebarAccountMenu.d.ts +20 -0
- package/dist/types/components/layout/SidebarUser.d.ts +8 -0
- package/dist/types/components/layout/TopBar.d.ts +7 -0
- package/dist/types/components/layout/app-shell-context.d.ts +8 -0
- package/dist/types/components/layout/index.d.ts +10 -0
- package/dist/types/components/layout/types.d.ts +11 -0
- package/dist/types/components/ui/badge.d.ts +9 -0
- package/dist/types/components/ui/button-footer.d.ts +7 -0
- package/dist/types/components/ui/button.d.ts +11 -0
- package/dist/types/components/ui/checkbox.d.ts +4 -0
- package/dist/types/components/ui/combobox.d.ts +92 -0
- package/dist/types/components/ui/dialog.d.ts +15 -0
- package/dist/types/components/ui/dropdown-menu.d.ts +10 -0
- package/dist/types/components/ui/input.d.ts +6 -0
- package/dist/types/components/ui/popover.d.ts +7 -0
- package/dist/types/components/ui/segmented-control.d.ts +17 -0
- package/dist/types/components/ui/select.d.ts +8 -0
- package/dist/types/components/ui/tabs.d.ts +10 -0
- package/dist/types/components/ui/theme-switch.d.ts +12 -0
- package/dist/types/constants/drawer.d.ts +1 -0
- package/dist/types/context/drawer-expand-context.d.ts +7 -0
- package/dist/types/context/portal-container-context.d.ts +14 -0
- package/dist/types/hooks/table-orchestration-store.d.ts +75 -0
- package/dist/types/hooks/use-scroll-activity.d.ts +1 -0
- package/dist/types/hooks/useDemoTheme.d.ts +8 -0
- package/dist/types/hooks/useRowDragOverride.d.ts +6 -0
- package/dist/types/hooks/useTableOrchestration.d.ts +115 -0
- package/dist/types/index.d.ts +107 -0
- package/dist/types/lib/column-gaps.d.ts +3 -0
- package/dist/types/lib/filter-stats.d.ts +2 -0
- package/dist/types/lib/format-enum.d.ts +1 -0
- package/dist/types/lib/format-timestamp.d.ts +4 -0
- package/dist/types/lib/style-scope.d.ts +19 -0
- package/dist/types/lib/utils.d.ts +2 -0
- package/package.json +114 -0
|
@@ -0,0 +1,452 @@
|
|
|
1
|
+
import { useState, useEffect, useMemo, useRef, useCallback } from "react";
|
|
2
|
+
import { useStore } from "zustand";
|
|
3
|
+
import { useColumnResize } from "../components/data-table/hooks/use-column-resize.js";
|
|
4
|
+
import { getVisiblePageNumbers } from "../components/data-table/hooks/use-table-pagination.js";
|
|
5
|
+
import { computeColumnGaps } from "../lib/column-gaps.js";
|
|
6
|
+
import { computeColumnStats } from "../lib/filter-stats.js";
|
|
7
|
+
import { createTableOrchestrationStore, defaultValueForFilter } from "./table-orchestration-store.js";
|
|
8
|
+
const EMPTY_ID_SET = /* @__PURE__ */ new Set();
|
|
9
|
+
function useTableOrchestration(config) {
|
|
10
|
+
const {
|
|
11
|
+
rows,
|
|
12
|
+
filterConfigs,
|
|
13
|
+
columnMeta,
|
|
14
|
+
toggleableColumnIds,
|
|
15
|
+
rowsPerPageOptions,
|
|
16
|
+
viewPresets,
|
|
17
|
+
defaultViewKey,
|
|
18
|
+
columnGroups,
|
|
19
|
+
initialColumnVisibility,
|
|
20
|
+
initialColumnWidths,
|
|
21
|
+
columnPriorities,
|
|
22
|
+
wideBreakpoint = 1280,
|
|
23
|
+
compactBreakpoint = 768
|
|
24
|
+
} = config;
|
|
25
|
+
const { getRowId, filterRow, getSortValue, getSearchText } = config;
|
|
26
|
+
const [store] = useState(
|
|
27
|
+
() => createTableOrchestrationStore({
|
|
28
|
+
defaultViewKey,
|
|
29
|
+
initialColumnVisibility,
|
|
30
|
+
initialRowsPerPage: rowsPerPageOptions[0]
|
|
31
|
+
})
|
|
32
|
+
);
|
|
33
|
+
const searchInput = useStore(store, (s) => s.searchInput);
|
|
34
|
+
const searchQuery = useStore(store, (s) => s.searchQuery);
|
|
35
|
+
const columnFilters = useStore(store, (s) => s.columnFilters);
|
|
36
|
+
const newestFilterColumnId = useStore(store, (s) => s.newestFilterColumnId);
|
|
37
|
+
const requestOpenFilterId = useStore(store, (s) => s.requestOpenFilterId);
|
|
38
|
+
const currentSort = useStore(store, (s) => s.currentSort);
|
|
39
|
+
const columnVisibility = useStore(store, (s) => s.columnVisibility);
|
|
40
|
+
const page = useStore(store, (s) => s.page);
|
|
41
|
+
const rowsPerPage = useStore(store, (s) => s.rowsPerPage);
|
|
42
|
+
const density = useStore(store, (s) => s.density);
|
|
43
|
+
const isRefreshing = useStore(store, (s) => s.isRefreshing);
|
|
44
|
+
const selectedIds = useStore(store, (s) => s.selectedIds);
|
|
45
|
+
const activeView = useStore(store, (s) => s.activeView);
|
|
46
|
+
const columnsMenuOpen = useStore(store, (s) => s.columnsMenuOpen);
|
|
47
|
+
const selectedRowId = useStore(store, (s) => s.selectedRowId);
|
|
48
|
+
const hasPriorities = Boolean(columnPriorities && Object.keys(columnPriorities).length > 0);
|
|
49
|
+
const [isWide, setIsWide] = useState(true);
|
|
50
|
+
const [isCompact, setIsCompact] = useState(false);
|
|
51
|
+
useEffect(() => {
|
|
52
|
+
if (!hasPriorities || typeof window === "undefined") return;
|
|
53
|
+
const mql = window.matchMedia(`(min-width: ${wideBreakpoint}px)`);
|
|
54
|
+
const onChange = (e) => setIsWide(e.matches);
|
|
55
|
+
setIsWide(mql.matches);
|
|
56
|
+
mql.addEventListener("change", onChange);
|
|
57
|
+
return () => mql.removeEventListener("change", onChange);
|
|
58
|
+
}, [hasPriorities, wideBreakpoint]);
|
|
59
|
+
useEffect(() => {
|
|
60
|
+
if (typeof window === "undefined") return;
|
|
61
|
+
const mql = window.matchMedia(`(max-width: ${compactBreakpoint - 1}px)`);
|
|
62
|
+
const onChange = (e) => setIsCompact(e.matches);
|
|
63
|
+
setIsCompact(mql.matches);
|
|
64
|
+
mql.addEventListener("change", onChange);
|
|
65
|
+
return () => mql.removeEventListener("change", onChange);
|
|
66
|
+
}, [compactBreakpoint]);
|
|
67
|
+
const responsiveHiddenColumnIds = useMemo(() => {
|
|
68
|
+
if (isWide || !columnPriorities) return EMPTY_ID_SET;
|
|
69
|
+
const hidden = /* @__PURE__ */ new Set();
|
|
70
|
+
for (const [id, priority] of Object.entries(columnPriorities)) {
|
|
71
|
+
if (priority === 3) hidden.add(id);
|
|
72
|
+
}
|
|
73
|
+
return hidden;
|
|
74
|
+
}, [isWide, columnPriorities]);
|
|
75
|
+
const selectedIdsRef = useRef(selectedIds);
|
|
76
|
+
const headerCheckStateRef = useRef(false);
|
|
77
|
+
const sortState = useMemo(() => {
|
|
78
|
+
if (!currentSort) return {};
|
|
79
|
+
return { [currentSort.columnId]: currentSort.direction };
|
|
80
|
+
}, [currentSort]);
|
|
81
|
+
const { widths, onPointerDown, setWidths } = useColumnResize(columnMeta, initialColumnWidths);
|
|
82
|
+
const activePreset = useMemo(() => {
|
|
83
|
+
if (activeView === "custom") {
|
|
84
|
+
return {
|
|
85
|
+
key: "custom",
|
|
86
|
+
label: "Custom",
|
|
87
|
+
filters: [],
|
|
88
|
+
sort: null,
|
|
89
|
+
columnVisibility: {}
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
return viewPresets.find((v) => v.key === activeView) ?? viewPresets[0];
|
|
93
|
+
}, [activeView, viewPresets]);
|
|
94
|
+
const allColumnFilterStats = useMemo(() => {
|
|
95
|
+
const result = {};
|
|
96
|
+
for (const [columnId, cfg] of Object.entries(filterConfigs)) {
|
|
97
|
+
if (cfg.type === "compound" && cfg.subFilters) {
|
|
98
|
+
for (const sub of cfg.subFilters) {
|
|
99
|
+
const s = computeColumnStats(rows, sub.field, {
|
|
100
|
+
type: sub.type,
|
|
101
|
+
label: sub.label,
|
|
102
|
+
options: sub.options
|
|
103
|
+
});
|
|
104
|
+
if (s) result[`${columnId}:${sub.key}`] = s;
|
|
105
|
+
}
|
|
106
|
+
} else {
|
|
107
|
+
const s = computeColumnStats(rows, cfg.fieldName ?? columnId, cfg);
|
|
108
|
+
if (s) result[columnId] = s;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
return result;
|
|
112
|
+
}, [rows, filterConfigs]);
|
|
113
|
+
const filteredRows = useMemo(() => {
|
|
114
|
+
const search = searchQuery.trim().toLowerCase();
|
|
115
|
+
const filtered = rows.filter((row) => {
|
|
116
|
+
if (activePreset.customFilter && !activePreset.customFilter(row)) return false;
|
|
117
|
+
if (search.length > 0 && !getSearchText(row).includes(search)) return false;
|
|
118
|
+
return columnFilters.every((filter) => filterRow(row, filter));
|
|
119
|
+
});
|
|
120
|
+
if (!currentSort) return filtered;
|
|
121
|
+
const { columnId, direction } = currentSort;
|
|
122
|
+
return [...filtered].sort((a, b) => {
|
|
123
|
+
const aVal = getSortValue(a, columnId);
|
|
124
|
+
const bVal = getSortValue(b, columnId);
|
|
125
|
+
if (aVal < bVal) return direction === "asc" ? -1 : 1;
|
|
126
|
+
if (aVal > bVal) return direction === "asc" ? 1 : -1;
|
|
127
|
+
return 0;
|
|
128
|
+
});
|
|
129
|
+
}, [
|
|
130
|
+
rows,
|
|
131
|
+
searchQuery,
|
|
132
|
+
columnFilters,
|
|
133
|
+
currentSort,
|
|
134
|
+
activePreset,
|
|
135
|
+
getSearchText,
|
|
136
|
+
filterRow,
|
|
137
|
+
getSortValue
|
|
138
|
+
]);
|
|
139
|
+
const filteredColumnFilterStats = useMemo(() => {
|
|
140
|
+
if (columnFilters.length === 0 && searchQuery.trim().length === 0) return null;
|
|
141
|
+
const result = {};
|
|
142
|
+
for (const [columnId, cfg] of Object.entries(filterConfigs)) {
|
|
143
|
+
if (cfg.type === "compound" && cfg.subFilters) {
|
|
144
|
+
for (const sub of cfg.subFilters) {
|
|
145
|
+
const s = computeColumnStats(filteredRows, sub.field, {
|
|
146
|
+
type: sub.type,
|
|
147
|
+
label: sub.label,
|
|
148
|
+
options: sub.options
|
|
149
|
+
});
|
|
150
|
+
if (s) result[`${columnId}:${sub.key}`] = s;
|
|
151
|
+
}
|
|
152
|
+
} else {
|
|
153
|
+
const s = computeColumnStats(filteredRows, columnId, cfg);
|
|
154
|
+
if (s) result[columnId] = s;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
return result;
|
|
158
|
+
}, [filteredRows, filterConfigs, columnFilters, searchQuery]);
|
|
159
|
+
const columnFilterStats = useMemo(() => {
|
|
160
|
+
const result = {};
|
|
161
|
+
for (const [columnId, cfg] of Object.entries(filterConfigs)) {
|
|
162
|
+
if (cfg.type === "compound" && cfg.subFilters) {
|
|
163
|
+
for (const sub of cfg.subFilters) {
|
|
164
|
+
const key = `${columnId}:${sub.key}`;
|
|
165
|
+
const all = allColumnFilterStats[key];
|
|
166
|
+
if (!all) continue;
|
|
167
|
+
result[key] = { all, filtered: filteredColumnFilterStats?.[key] ?? null };
|
|
168
|
+
}
|
|
169
|
+
} else {
|
|
170
|
+
const all = allColumnFilterStats[columnId];
|
|
171
|
+
if (!all) continue;
|
|
172
|
+
result[columnId] = { all, filtered: filteredColumnFilterStats?.[columnId] ?? null };
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
return result;
|
|
176
|
+
}, [allColumnFilterStats, filteredColumnFilterStats, filterConfigs]);
|
|
177
|
+
const totalPages = Math.max(1, Math.ceil(filteredRows.length / rowsPerPage));
|
|
178
|
+
const safePage = Math.min(page, totalPages);
|
|
179
|
+
const pageNumbers = useMemo(
|
|
180
|
+
() => getVisiblePageNumbers(safePage, totalPages),
|
|
181
|
+
[safePage, totalPages]
|
|
182
|
+
);
|
|
183
|
+
const paginatedRows = useMemo(() => {
|
|
184
|
+
const start = (safePage - 1) * rowsPerPage;
|
|
185
|
+
return filteredRows.slice(start, start + rowsPerPage);
|
|
186
|
+
}, [filteredRows, rowsPerPage, safePage]);
|
|
187
|
+
const pageIds = useMemo(() => new Set(paginatedRows.map(getRowId)), [paginatedRows, getRowId]);
|
|
188
|
+
const selectedOnPage = useMemo(
|
|
189
|
+
() => [...selectedIds].filter((id) => pageIds.has(id)).length,
|
|
190
|
+
[selectedIds, pageIds]
|
|
191
|
+
);
|
|
192
|
+
const allOnPageSelected = pageIds.size > 0 && selectedOnPage === pageIds.size;
|
|
193
|
+
const headerCheckState = allOnPageSelected ? true : selectedOnPage > 0 ? "indeterminate" : false;
|
|
194
|
+
const columnGaps = useMemo(
|
|
195
|
+
() => columnGroups ? computeColumnGaps(toggleableColumnIds, columnVisibility) : [],
|
|
196
|
+
[columnGroups, toggleableColumnIds, columnVisibility]
|
|
197
|
+
);
|
|
198
|
+
const extendedColumnMeta = useMemo(() => {
|
|
199
|
+
if (columnGaps.length === 0) return columnMeta;
|
|
200
|
+
const meta = { ...columnMeta };
|
|
201
|
+
for (const gap of columnGaps) {
|
|
202
|
+
meta[`__gap_after_${gap.afterColumnId ?? "start"}`] = { minW: 32 };
|
|
203
|
+
}
|
|
204
|
+
return meta;
|
|
205
|
+
}, [columnGaps, columnMeta]);
|
|
206
|
+
const extendedWidths = useMemo(() => {
|
|
207
|
+
if (columnGaps.length === 0) return widths;
|
|
208
|
+
const merged = { ...widths };
|
|
209
|
+
for (const gap of columnGaps) {
|
|
210
|
+
merged[`__gap_after_${gap.afterColumnId ?? "start"}`] = 32;
|
|
211
|
+
}
|
|
212
|
+
return merged;
|
|
213
|
+
}, [widths, columnGaps]);
|
|
214
|
+
const hiddenColumnsCount = useMemo(() => {
|
|
215
|
+
return toggleableColumnIds.filter((id) => columnVisibility[id] === false).length;
|
|
216
|
+
}, [toggleableColumnIds, columnVisibility]);
|
|
217
|
+
const activeCustomFilterChip = activePreset.customFilterChip ?? null;
|
|
218
|
+
selectedIdsRef.current = selectedIds;
|
|
219
|
+
headerCheckStateRef.current = headerCheckState;
|
|
220
|
+
if (page !== safePage) {
|
|
221
|
+
store.getState().setPage(safePage);
|
|
222
|
+
}
|
|
223
|
+
if (selectedRowId && !filteredRows.some((row) => getRowId(row) === selectedRowId)) {
|
|
224
|
+
store.getState().setSelectedRowId(null);
|
|
225
|
+
}
|
|
226
|
+
const filteredIdSet = useMemo(
|
|
227
|
+
() => new Set(filteredRows.map(getRowId)),
|
|
228
|
+
[filteredRows, getRowId]
|
|
229
|
+
);
|
|
230
|
+
const prunedSelectedIds = useMemo(() => {
|
|
231
|
+
const pruned = new Set([...selectedIds].filter((id) => filteredIdSet.has(id)));
|
|
232
|
+
return pruned.size === selectedIds.size ? selectedIds : pruned;
|
|
233
|
+
}, [selectedIds, filteredIdSet]);
|
|
234
|
+
if (prunedSelectedIds !== selectedIds) {
|
|
235
|
+
store.getState().setSelectedIds(prunedSelectedIds);
|
|
236
|
+
}
|
|
237
|
+
const handleSearchSubmit = useCallback(
|
|
238
|
+
(e) => {
|
|
239
|
+
e.preventDefault();
|
|
240
|
+
store.getState().submitSearch();
|
|
241
|
+
},
|
|
242
|
+
[store]
|
|
243
|
+
);
|
|
244
|
+
const handleHeaderSort = useCallback(
|
|
245
|
+
(columnId, direction) => {
|
|
246
|
+
store.getState().toggleSort(columnId, direction);
|
|
247
|
+
},
|
|
248
|
+
[store]
|
|
249
|
+
);
|
|
250
|
+
const handleViewChange = useCallback(
|
|
251
|
+
(key) => {
|
|
252
|
+
if (key === "custom") return;
|
|
253
|
+
const preset = viewPresets.find((v) => v.key === key);
|
|
254
|
+
if (!preset) return;
|
|
255
|
+
store.getState().applyPreset({
|
|
256
|
+
key,
|
|
257
|
+
filters: preset.filters,
|
|
258
|
+
sort: preset.sort,
|
|
259
|
+
columnVisibility: preset.columnVisibility
|
|
260
|
+
});
|
|
261
|
+
},
|
|
262
|
+
[viewPresets, store]
|
|
263
|
+
);
|
|
264
|
+
const handleAddColumnFilter = useCallback(
|
|
265
|
+
(columnId) => {
|
|
266
|
+
const cfg = filterConfigs[columnId];
|
|
267
|
+
if (!cfg) return;
|
|
268
|
+
store.getState().addColumnFilter(columnId, defaultValueForFilter(cfg));
|
|
269
|
+
},
|
|
270
|
+
[filterConfigs, store]
|
|
271
|
+
);
|
|
272
|
+
const handleOpenExistingFilter = useCallback(
|
|
273
|
+
(columnId) => store.getState().setRequestOpenFilterId(columnId),
|
|
274
|
+
[store]
|
|
275
|
+
);
|
|
276
|
+
const handleRequestOpenHandled = useCallback(
|
|
277
|
+
() => store.getState().setRequestOpenFilterId(null),
|
|
278
|
+
[store]
|
|
279
|
+
);
|
|
280
|
+
const handleRemoveColumnFilter = useCallback(
|
|
281
|
+
(columnId) => store.getState().removeColumnFilter(columnId),
|
|
282
|
+
[store]
|
|
283
|
+
);
|
|
284
|
+
const handleChangeColumnFilter = useCallback(
|
|
285
|
+
(columnId, value) => store.getState().changeColumnFilter(columnId, value),
|
|
286
|
+
[store]
|
|
287
|
+
);
|
|
288
|
+
const handleSetColumnFilter = useCallback(
|
|
289
|
+
(columnId, value) => store.getState().setColumnFilter(columnId, value),
|
|
290
|
+
[store]
|
|
291
|
+
);
|
|
292
|
+
const handleHeaderFilterClick = useCallback(
|
|
293
|
+
(columnId) => {
|
|
294
|
+
const state = store.getState();
|
|
295
|
+
const isActive = state.columnFilters.some((f) => f.columnId === columnId);
|
|
296
|
+
if (!isActive) {
|
|
297
|
+
const cfg = filterConfigs[columnId];
|
|
298
|
+
if (cfg) state.addColumnFilter(columnId, defaultValueForFilter(cfg));
|
|
299
|
+
}
|
|
300
|
+
state.setRequestOpenFilterId(columnId);
|
|
301
|
+
},
|
|
302
|
+
[filterConfigs, store]
|
|
303
|
+
);
|
|
304
|
+
const handleHideColumn = useCallback(
|
|
305
|
+
(columnId) => store.getState().hideColumn(columnId),
|
|
306
|
+
[store]
|
|
307
|
+
);
|
|
308
|
+
const handleResetColumns = useCallback(() => {
|
|
309
|
+
store.getState().resetColumns();
|
|
310
|
+
setWidths(() => {
|
|
311
|
+
const w = {};
|
|
312
|
+
for (const [id, m] of Object.entries(columnMeta)) w[id] = m.minW;
|
|
313
|
+
return w;
|
|
314
|
+
});
|
|
315
|
+
}, [store, setWidths, columnMeta]);
|
|
316
|
+
const handleRemoveSort = useCallback(() => store.getState().removeSort(), [store]);
|
|
317
|
+
const handleRemoveCustomFilter = useCallback(() => {
|
|
318
|
+
store.getState().goCustom();
|
|
319
|
+
store.getState().setPage(1);
|
|
320
|
+
}, [store]);
|
|
321
|
+
const handleClearAll = useCallback(
|
|
322
|
+
() => store.getState().clearAll(defaultViewKey),
|
|
323
|
+
[defaultViewKey, store]
|
|
324
|
+
);
|
|
325
|
+
const handleRefresh = useCallback(() => store.getState().startRefresh(), [store]);
|
|
326
|
+
const handleToggleRowSelection = useCallback(
|
|
327
|
+
(id) => store.getState().toggleRowSelection(id),
|
|
328
|
+
[store]
|
|
329
|
+
);
|
|
330
|
+
const handleToggleHeaderCheck = useCallback(() => {
|
|
331
|
+
const ids = paginatedRows.map(getRowId);
|
|
332
|
+
store.getState().toggleHeaderCheck(ids, allOnPageSelected);
|
|
333
|
+
}, [paginatedRows, allOnPageSelected, getRowId, store]);
|
|
334
|
+
const handleExpandRow = useCallback(
|
|
335
|
+
(row, e) => {
|
|
336
|
+
e.stopPropagation();
|
|
337
|
+
const id = getRowId(row);
|
|
338
|
+
store.getState().toggleSelectedRowId(id);
|
|
339
|
+
},
|
|
340
|
+
[getRowId, store]
|
|
341
|
+
);
|
|
342
|
+
const handleExpandGap = useCallback(
|
|
343
|
+
(hiddenIds) => store.getState().showColumns(hiddenIds),
|
|
344
|
+
[store]
|
|
345
|
+
);
|
|
346
|
+
const handlePageChange = useCallback((p) => store.getState().setPage(p), [store]);
|
|
347
|
+
const handleRowsPerPageChange = useCallback(
|
|
348
|
+
(value) => store.getState().setRowsPerPage(value),
|
|
349
|
+
[store]
|
|
350
|
+
);
|
|
351
|
+
const setSearchInput = useCallback((v) => store.getState().setSearchInput(v), [store]);
|
|
352
|
+
const setColumnVisibility = useCallback(
|
|
353
|
+
(next) => store.getState().setColumnVisibility(next),
|
|
354
|
+
[store]
|
|
355
|
+
);
|
|
356
|
+
const setDensity = useCallback(
|
|
357
|
+
(v) => store.getState().setDensity(v),
|
|
358
|
+
[store]
|
|
359
|
+
);
|
|
360
|
+
const setSelectedIds = useCallback(
|
|
361
|
+
(next) => store.getState().setSelectedIds(next),
|
|
362
|
+
[store]
|
|
363
|
+
);
|
|
364
|
+
const setColumnsMenuOpen = useCallback(
|
|
365
|
+
(v) => store.getState().setColumnsMenuOpen(v),
|
|
366
|
+
[store]
|
|
367
|
+
);
|
|
368
|
+
const setSelectedRowId = useCallback(
|
|
369
|
+
(v) => store.getState().setSelectedRowId(v),
|
|
370
|
+
[store]
|
|
371
|
+
);
|
|
372
|
+
const getSelectedIds = useCallback(() => selectedIdsRef.current, []);
|
|
373
|
+
const getHeaderCheckState = useCallback(() => headerCheckStateRef.current, []);
|
|
374
|
+
return {
|
|
375
|
+
// State
|
|
376
|
+
searchInput,
|
|
377
|
+
setSearchInput,
|
|
378
|
+
searchQuery,
|
|
379
|
+
columnFilters,
|
|
380
|
+
newestFilterColumnId,
|
|
381
|
+
requestOpenFilterId,
|
|
382
|
+
currentSort,
|
|
383
|
+
columnVisibility,
|
|
384
|
+
setColumnVisibility,
|
|
385
|
+
page,
|
|
386
|
+
rowsPerPage,
|
|
387
|
+
density,
|
|
388
|
+
setDensity,
|
|
389
|
+
isRefreshing,
|
|
390
|
+
selectedIds,
|
|
391
|
+
setSelectedIds,
|
|
392
|
+
activeView,
|
|
393
|
+
columnsMenuOpen,
|
|
394
|
+
setColumnsMenuOpen,
|
|
395
|
+
selectedRowId,
|
|
396
|
+
setSelectedRowId,
|
|
397
|
+
// Derived
|
|
398
|
+
sortState,
|
|
399
|
+
activePreset,
|
|
400
|
+
filteredRows,
|
|
401
|
+
paginatedRows,
|
|
402
|
+
totalPages,
|
|
403
|
+
safePage,
|
|
404
|
+
pageNumbers,
|
|
405
|
+
columnFilterStats,
|
|
406
|
+
columnGaps,
|
|
407
|
+
extendedColumnMeta,
|
|
408
|
+
extendedWidths,
|
|
409
|
+
activeCustomFilterChip,
|
|
410
|
+
hiddenColumnsCount,
|
|
411
|
+
responsiveHiddenColumnIds,
|
|
412
|
+
isCompact,
|
|
413
|
+
// Selection
|
|
414
|
+
pageIds,
|
|
415
|
+
allOnPageSelected,
|
|
416
|
+
headerCheckState,
|
|
417
|
+
// Ref-stable getters
|
|
418
|
+
getSelectedIds,
|
|
419
|
+
getHeaderCheckState,
|
|
420
|
+
// Callbacks
|
|
421
|
+
handleSearchSubmit,
|
|
422
|
+
handleHeaderSort,
|
|
423
|
+
handleViewChange,
|
|
424
|
+
handleAddColumnFilter,
|
|
425
|
+
handleOpenExistingFilter,
|
|
426
|
+
handleRequestOpenHandled,
|
|
427
|
+
handleRemoveColumnFilter,
|
|
428
|
+
handleChangeColumnFilter,
|
|
429
|
+
handleSetColumnFilter,
|
|
430
|
+
handleHeaderFilterClick,
|
|
431
|
+
handleHideColumn,
|
|
432
|
+
handleResetColumns,
|
|
433
|
+
handleRemoveSort,
|
|
434
|
+
handleRemoveCustomFilter,
|
|
435
|
+
handleClearAll,
|
|
436
|
+
handleRefresh,
|
|
437
|
+
handleToggleRowSelection,
|
|
438
|
+
handleToggleHeaderCheck,
|
|
439
|
+
handleExpandRow,
|
|
440
|
+
handleExpandGap,
|
|
441
|
+
handlePageChange,
|
|
442
|
+
handleRowsPerPageChange,
|
|
443
|
+
// Column resize
|
|
444
|
+
widths,
|
|
445
|
+
onPointerDown,
|
|
446
|
+
// Escape hatch
|
|
447
|
+
store
|
|
448
|
+
};
|
|
449
|
+
}
|
|
450
|
+
export {
|
|
451
|
+
useTableOrchestration
|
|
452
|
+
};
|
package/dist/es/index.js
ADDED
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import { Badge, badgeVariants } from "./components/ui/badge.js";
|
|
2
|
+
import { Button, buttonVariants } from "./components/ui/button.js";
|
|
3
|
+
import { Checkbox } from "./components/ui/checkbox.js";
|
|
4
|
+
import { Dialog, DialogClose, DialogContent, DialogDescription, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger } from "./components/ui/dialog.js";
|
|
5
|
+
import { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuPortal, DropdownMenuTrigger } from "./components/ui/dropdown-menu.js";
|
|
6
|
+
import { Input } from "./components/ui/input.js";
|
|
7
|
+
import { Popover, PopoverAnchor, PopoverContent, PopoverTrigger } from "./components/ui/popover.js";
|
|
8
|
+
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "./components/ui/select.js";
|
|
9
|
+
import { Tabs, TabsContent, TabsList, TabsTrigger } from "./components/ui/tabs.js";
|
|
10
|
+
import { Combobox, Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList } from "./components/ui/combobox.js";
|
|
11
|
+
import { ButtonFooter } from "./components/ui/button-footer.js";
|
|
12
|
+
import { ThemeSwitch } from "./components/ui/theme-switch.js";
|
|
13
|
+
import { SegmentedControl } from "./components/ui/segmented-control.js";
|
|
14
|
+
import { CopyButton } from "./components/data-table/CopyButton.js";
|
|
15
|
+
import { CopyableText } from "./components/data-table/CopyableText.js";
|
|
16
|
+
import { DataTableShell } from "./components/data-table/DataTableShell.js";
|
|
17
|
+
import { DrawerActionGroup } from "./components/data-table/DrawerActionGroup.js";
|
|
18
|
+
import { DrawerEntityCard } from "./components/data-table/DrawerEntityCard.js";
|
|
19
|
+
import { DrawerField } from "./components/data-table/DrawerField.js";
|
|
20
|
+
import { DrawerFlagGrid, DrawerFlagItem } from "./components/data-table/DrawerFlagItem.js";
|
|
21
|
+
import { DrawerSection } from "./components/data-table/DrawerSection.js";
|
|
22
|
+
import { DrawerShell } from "./components/data-table/DrawerShell.js";
|
|
23
|
+
import { DrawerSummaryCard } from "./components/data-table/DrawerSummaryCard.js";
|
|
24
|
+
import { useDrawerExpanded } from "./context/drawer-expand-context.js";
|
|
25
|
+
import { DRAWER_SIZE } from "./constants/drawer.js";
|
|
26
|
+
import { EmptyState } from "./components/data-table/EmptyState.js";
|
|
27
|
+
import { FilterChip } from "./components/data-table/FilterChip.js";
|
|
28
|
+
import { ViewChip } from "./components/data-table/ViewChip.js";
|
|
29
|
+
import { FilterPopoverFooter } from "./components/data-table/FilterPopoverFooter.js";
|
|
30
|
+
import * as FilterToolbar from "./components/data-table/FilterToolbar.js";
|
|
31
|
+
import { RowActionsMenu } from "./components/data-table/RowActionsMenu.js";
|
|
32
|
+
import { RowControlCell, RowControlHeader } from "./components/data-table/RowControlCell.js";
|
|
33
|
+
import { SortableHeader } from "./components/data-table/SortableHeader.js";
|
|
34
|
+
import { TableFooter } from "./components/data-table/TableFooter.js";
|
|
35
|
+
import { TableLayout } from "./components/data-table/TableLayout.js";
|
|
36
|
+
import { useColumnResize } from "./components/data-table/hooks/use-column-resize.js";
|
|
37
|
+
import { getVisiblePageNumbers } from "./components/data-table/hooks/use-table-pagination.js";
|
|
38
|
+
import { useRowDrag } from "./components/data-table/hooks/use-row-drag.js";
|
|
39
|
+
import { useTableSort } from "./components/data-table/hooks/use-table-sort.js";
|
|
40
|
+
import { AppShell } from "./components/layout/AppShell.js";
|
|
41
|
+
import { Sidebar } from "./components/layout/Sidebar.js";
|
|
42
|
+
import { TopBar } from "./components/layout/TopBar.js";
|
|
43
|
+
import { SidebarUser } from "./components/layout/SidebarUser.js";
|
|
44
|
+
import { SidebarAccountMenu } from "./components/layout/SidebarAccountMenu.js";
|
|
45
|
+
import { useAppShell } from "./components/layout/app-shell-context.js";
|
|
46
|
+
import { ReportSummaryCard } from "./components/dashboard/ReportSummaryCard.js";
|
|
47
|
+
import { useScrollActivity } from "./hooks/use-scroll-activity.js";
|
|
48
|
+
import { cn } from "./lib/utils.js";
|
|
49
|
+
import { STYLE_SCOPE } from "./lib/style-scope.js";
|
|
50
|
+
import { PortalContainerContext, usePortalContainer } from "./context/portal-container-context.js";
|
|
51
|
+
import { GAP_CELL_ATTR, GAP_HEADER_ATTR, GapCell, GapIndicator } from "./components/data-table/GapIndicator.js";
|
|
52
|
+
import { TimestampCell } from "./components/data-table/TimestampCell.js";
|
|
53
|
+
import { ExpiryTimestampCell } from "./components/data-table/ExpiryTimestampCell.js";
|
|
54
|
+
import { ColumnHeaderMenu } from "./components/data-table/ColumnHeaderMenu.js";
|
|
55
|
+
import { TwoPanelMenuBase } from "./components/data-table/TwoPanelMenu.js";
|
|
56
|
+
import { FlatColumnToggle } from "./components/data-table/FlatColumnToggle.js";
|
|
57
|
+
import { GroupedColumnToggle } from "./components/data-table/GroupedColumnToggle.js";
|
|
58
|
+
import { ColumnFilterPopover } from "./components/data-table/ColumnFilterPopover.js";
|
|
59
|
+
import { CompoundFilterPopover } from "./components/data-table/CompoundFilterPopover.js";
|
|
60
|
+
import { AppliedStateChips } from "./components/data-table/AppliedStateChips.js";
|
|
61
|
+
import { FilterFormPanel } from "./components/data-table/FilterFormPanel.js";
|
|
62
|
+
import { FilterFormToggle, useFilterFormOpen } from "./components/data-table/FilterFormToggle.js";
|
|
63
|
+
import { applyManagedChanges, clearManagedFilters, hasActiveManagedFilters } from "./components/data-table/managed-filters.js";
|
|
64
|
+
import { useTableOrchestration } from "./hooks/useTableOrchestration.js";
|
|
65
|
+
import { createTableOrchestrationStore, defaultValueForFilter } from "./hooks/table-orchestration-store.js";
|
|
66
|
+
import { useRowDragOverride } from "./hooks/useRowDragOverride.js";
|
|
67
|
+
import { computeColumnGaps } from "./lib/column-gaps.js";
|
|
68
|
+
import { computeColumnStats } from "./lib/filter-stats.js";
|
|
69
|
+
import { formatEnumLabel } from "./lib/format-enum.js";
|
|
70
|
+
import { displayTimeZone, formatDateParts, formatLiveTimestamp, parsePossibleTimestamp } from "./lib/format-timestamp.js";
|
|
71
|
+
import { MonoIdCell } from "./components/data-table/cells/MonoIdCell.js";
|
|
72
|
+
import { CurrencyAmountCell } from "./components/data-table/cells/CurrencyAmountCell.js";
|
|
73
|
+
import { DualLineCell } from "./components/data-table/cells/DualLineCell.js";
|
|
74
|
+
import { AmountCell } from "./components/data-table/cells/AmountCell.js";
|
|
75
|
+
import { ConfirmedAmountCell } from "./components/data-table/cells/ConfirmedAmountCell.js";
|
|
76
|
+
import { EnumBadgeCell } from "./components/data-table/cells/EnumBadgeCell.js";
|
|
77
|
+
export {
|
|
78
|
+
AmountCell,
|
|
79
|
+
AppShell,
|
|
80
|
+
AppliedStateChips,
|
|
81
|
+
Badge,
|
|
82
|
+
Button,
|
|
83
|
+
ButtonFooter,
|
|
84
|
+
Checkbox,
|
|
85
|
+
ColumnFilterPopover,
|
|
86
|
+
ColumnHeaderMenu,
|
|
87
|
+
Combobox,
|
|
88
|
+
Command,
|
|
89
|
+
CommandEmpty,
|
|
90
|
+
CommandGroup,
|
|
91
|
+
CommandInput,
|
|
92
|
+
CommandItem,
|
|
93
|
+
CommandList,
|
|
94
|
+
CompoundFilterPopover,
|
|
95
|
+
ConfirmedAmountCell,
|
|
96
|
+
CopyButton,
|
|
97
|
+
CopyableText,
|
|
98
|
+
CurrencyAmountCell,
|
|
99
|
+
DRAWER_SIZE,
|
|
100
|
+
DataTableShell,
|
|
101
|
+
Dialog,
|
|
102
|
+
DialogClose,
|
|
103
|
+
DialogContent,
|
|
104
|
+
DialogDescription,
|
|
105
|
+
DialogHeader,
|
|
106
|
+
DialogOverlay,
|
|
107
|
+
DialogPortal,
|
|
108
|
+
DialogTitle,
|
|
109
|
+
DialogTrigger,
|
|
110
|
+
DrawerActionGroup,
|
|
111
|
+
DrawerEntityCard,
|
|
112
|
+
DrawerField,
|
|
113
|
+
DrawerFlagGrid,
|
|
114
|
+
DrawerFlagItem,
|
|
115
|
+
DrawerSection,
|
|
116
|
+
DrawerShell,
|
|
117
|
+
DrawerSummaryCard,
|
|
118
|
+
DropdownMenu,
|
|
119
|
+
DropdownMenuCheckboxItem,
|
|
120
|
+
DropdownMenuContent,
|
|
121
|
+
DropdownMenuGroup,
|
|
122
|
+
DropdownMenuItem,
|
|
123
|
+
DropdownMenuPortal,
|
|
124
|
+
DropdownMenuTrigger,
|
|
125
|
+
DualLineCell,
|
|
126
|
+
EmptyState,
|
|
127
|
+
EnumBadgeCell,
|
|
128
|
+
ExpiryTimestampCell,
|
|
129
|
+
FilterChip,
|
|
130
|
+
FilterFormPanel,
|
|
131
|
+
FilterFormToggle,
|
|
132
|
+
FilterPopoverFooter,
|
|
133
|
+
FilterToolbar,
|
|
134
|
+
FlatColumnToggle,
|
|
135
|
+
GAP_CELL_ATTR,
|
|
136
|
+
GAP_HEADER_ATTR,
|
|
137
|
+
GapCell,
|
|
138
|
+
GapIndicator,
|
|
139
|
+
GroupedColumnToggle,
|
|
140
|
+
Input,
|
|
141
|
+
MonoIdCell,
|
|
142
|
+
Popover,
|
|
143
|
+
PopoverAnchor,
|
|
144
|
+
PopoverContent,
|
|
145
|
+
PopoverTrigger,
|
|
146
|
+
PortalContainerContext,
|
|
147
|
+
ReportSummaryCard,
|
|
148
|
+
RowActionsMenu,
|
|
149
|
+
RowControlCell,
|
|
150
|
+
RowControlHeader,
|
|
151
|
+
STYLE_SCOPE,
|
|
152
|
+
SegmentedControl,
|
|
153
|
+
Select,
|
|
154
|
+
SelectContent,
|
|
155
|
+
SelectItem,
|
|
156
|
+
SelectTrigger,
|
|
157
|
+
SelectValue,
|
|
158
|
+
Sidebar,
|
|
159
|
+
SidebarAccountMenu,
|
|
160
|
+
SidebarUser,
|
|
161
|
+
SortableHeader,
|
|
162
|
+
TableFooter,
|
|
163
|
+
TableLayout,
|
|
164
|
+
Tabs,
|
|
165
|
+
TabsContent,
|
|
166
|
+
TabsList,
|
|
167
|
+
TabsTrigger,
|
|
168
|
+
ThemeSwitch,
|
|
169
|
+
TimestampCell,
|
|
170
|
+
TopBar,
|
|
171
|
+
TwoPanelMenuBase,
|
|
172
|
+
ViewChip,
|
|
173
|
+
applyManagedChanges,
|
|
174
|
+
badgeVariants,
|
|
175
|
+
buttonVariants,
|
|
176
|
+
clearManagedFilters,
|
|
177
|
+
cn,
|
|
178
|
+
computeColumnGaps,
|
|
179
|
+
computeColumnStats,
|
|
180
|
+
createTableOrchestrationStore,
|
|
181
|
+
defaultValueForFilter,
|
|
182
|
+
displayTimeZone,
|
|
183
|
+
formatDateParts,
|
|
184
|
+
formatEnumLabel,
|
|
185
|
+
formatLiveTimestamp,
|
|
186
|
+
getVisiblePageNumbers,
|
|
187
|
+
hasActiveManagedFilters,
|
|
188
|
+
parsePossibleTimestamp,
|
|
189
|
+
useAppShell,
|
|
190
|
+
useColumnResize,
|
|
191
|
+
useDrawerExpanded,
|
|
192
|
+
useFilterFormOpen,
|
|
193
|
+
usePortalContainer,
|
|
194
|
+
useRowDrag,
|
|
195
|
+
useRowDragOverride,
|
|
196
|
+
useScrollActivity,
|
|
197
|
+
useTableOrchestration,
|
|
198
|
+
useTableSort
|
|
199
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
function computeColumnGaps(orderedColumnIds, columnVisibility) {
|
|
2
|
+
const gaps = [];
|
|
3
|
+
let lastVisibleId = null;
|
|
4
|
+
let pendingHidden = [];
|
|
5
|
+
for (const columnId of orderedColumnIds) {
|
|
6
|
+
if (columnVisibility[columnId] === false) {
|
|
7
|
+
pendingHidden.push(columnId);
|
|
8
|
+
} else {
|
|
9
|
+
if (pendingHidden.length > 0) {
|
|
10
|
+
gaps.push({ afterColumnId: lastVisibleId, hiddenIds: pendingHidden });
|
|
11
|
+
pendingHidden = [];
|
|
12
|
+
}
|
|
13
|
+
lastVisibleId = columnId;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
if (pendingHidden.length > 0) {
|
|
17
|
+
gaps.push({ afterColumnId: lastVisibleId, hiddenIds: pendingHidden });
|
|
18
|
+
}
|
|
19
|
+
return gaps;
|
|
20
|
+
}
|
|
21
|
+
export {
|
|
22
|
+
computeColumnGaps
|
|
23
|
+
};
|