@rio-cloud/rio-uikit 2.3.0-beta.2 → 2.3.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/Marker.js +9 -5
- package/Table.js +10 -9
- package/TableNext.js +10 -9
- package/TableRowActionsDropdown.d.ts +2 -0
- package/TableRowActionsDropdown.js +5 -0
- package/TableRowActionsDropdown.js.map +1 -0
- package/components/analyticsAnalysisOverlay/AnalyticsAnalysisBanner.d.ts +38 -3
- package/components/analyticsAnalysisOverlay/AnalyticsAnalysisBanner.js +104 -109
- package/components/analyticsAnalysisOverlay/AnalyticsAnalysisBanner.js.map +1 -1
- package/components/analyticsAnalysisOverlay/AnalyticsAnalysisOverlay.d.ts +24 -5
- package/components/analyticsAnalysisOverlay/AnalyticsAnalysisOverlay.js +60 -56
- package/components/analyticsAnalysisOverlay/AnalyticsAnalysisOverlay.js.map +1 -1
- package/components/datepicker/DayPicker.js +72 -70
- package/components/datepicker/DayPicker.js.map +1 -1
- package/components/datepicker/DayPickerDropdown.d.ts +1 -0
- package/components/datepicker/DayPickerDropdown.js +61 -48
- package/components/datepicker/DayPickerDropdown.js.map +1 -1
- package/components/datepicker/useStackedDayPickerCalendars.js +26 -26
- package/components/datepicker/useStackedDayPickerCalendars.js.map +1 -1
- package/components/dropdown/ButtonDropdown.d.ts +4 -0
- package/components/dropdown/ButtonDropdown.js +82 -80
- package/components/dropdown/ButtonDropdown.js.map +1 -1
- package/components/listMenu/ListMenu.d.ts +8 -0
- package/components/listMenu/ListMenu.js +74 -66
- package/components/listMenu/ListMenu.js.map +1 -1
- package/components/map/components/Map.js +207 -156
- package/components/map/components/Map.js.map +1 -1
- package/components/map/components/MapContext.d.ts +3 -0
- package/components/map/components/MapContext.js +9 -6
- package/components/map/components/MapContext.js.map +1 -1
- package/components/map/components/features/MapZoom.js +19 -19
- package/components/map/components/features/MapZoom.js.map +1 -1
- package/components/map/components/features/Route.d.ts +65 -1
- package/components/map/components/features/Route.js +184 -98
- package/components/map/components/features/Route.js.map +1 -1
- package/components/map/components/features/basics/Marker.d.ts +21 -1
- package/components/map/components/features/basics/Marker.js +99 -40
- package/components/map/components/features/basics/Marker.js.map +1 -1
- package/components/map/components/features/basics/Polygon.d.ts +24 -1
- package/components/map/components/features/basics/Polygon.js +72 -19
- package/components/map/components/features/basics/Polygon.js.map +1 -1
- package/components/map/components/features/basics/Polyline.d.ts +29 -0
- package/components/map/components/features/basics/Polyline.js +69 -39
- package/components/map/components/features/basics/Polyline.js.map +1 -1
- package/components/map/components/features/layers/MarkerLayer.js +8 -8
- package/components/map/components/features/layers/MarkerLayer.js.map +1 -1
- package/components/map/components/features/layers/clustering/SimpleClusterLayer.js +13 -6
- package/components/map/components/features/layers/clustering/SimpleClusterLayer.js.map +1 -1
- package/components/map/utils/clustering.d.ts +1 -1
- package/components/map/utils/clustering.js +30 -30
- package/components/map/utils/clustering.js.map +1 -1
- package/components/map/utils/mapTypes.d.ts +141 -0
- package/components/map/utils/mapTypes.js.map +1 -1
- package/components/map/utils/mapUtils.d.ts +2 -0
- package/components/map/utils/mapUtils.js +4 -0
- package/components/map/utils/mapUtils.js.map +1 -1
- package/components/mapMarker/ClusterMapMarker.d.ts +2 -0
- package/components/mapMarker/ClusterMapMarker.js.map +1 -1
- package/components/mapMarker/SingleMapMarker.d.ts +2 -0
- package/components/mapMarker/SingleMapMarker.js.map +1 -1
- package/components/selects/ClearButton.js +9 -7
- package/components/selects/ClearButton.js.map +1 -1
- package/components/table/Table.d.ts +3 -1
- package/components/table/Table.js +239 -216
- package/components/table/Table.js.map +1 -1
- package/components/table/Table.types.d.ts +62 -4
- package/components/table/TableColumn.d.ts +8 -1
- package/components/table/TableColumn.js +66 -64
- package/components/table/TableColumn.js.map +1 -1
- package/components/table/TableExpandedRow.d.ts +4 -0
- package/components/table/TableExpandedRow.js +70 -67
- package/components/table/TableExpandedRow.js.map +1 -1
- package/components/table/TableGroupRow.d.ts +3 -1
- package/components/table/TableGroupRow.js +15 -14
- package/components/table/TableGroupRow.js.map +1 -1
- package/components/table/TableHeader.d.ts +9 -0
- package/components/table/TableHeader.js +110 -81
- package/components/table/TableHeader.js.map +1 -1
- package/components/table/TableHeaderColumn.d.ts +11 -1
- package/components/table/TableHeaderColumn.js +63 -58
- package/components/table/TableHeaderColumn.js.map +1 -1
- package/components/table/TableRow.d.ts +12 -0
- package/components/table/TableRow.js +78 -74
- package/components/table/TableRow.js.map +1 -1
- package/components/table/TableRowActionsDropdown.d.ts +11 -0
- package/components/table/TableRowActionsDropdown.js +22 -0
- package/components/table/TableRowActionsDropdown.js.map +1 -0
- package/components/table/TableStickyRowButton.d.ts +25 -0
- package/components/table/TableStickyRowButton.js +32 -0
- package/components/table/TableStickyRowButton.js.map +1 -0
- package/components/table/TableToolbar.d.ts +24 -3
- package/components/table/TableToolbar.js +78 -37
- package/components/table/TableToolbar.js.map +1 -1
- package/components/table/TableViewToggles.js +5 -5
- package/components/table/TableViewToggles.js.map +1 -1
- package/components/table/context/TableInteractionContext.d.ts +3 -0
- package/components/table/context/TableInteractionContext.js.map +1 -1
- package/components/table/context/TableLayoutContext.d.ts +1 -0
- package/components/table/context/TableLayoutContext.js.map +1 -1
- package/components/table/context/TableRenderContext.d.ts +1 -0
- package/components/table/context/TableRenderContext.js.map +1 -1
- package/components/table/layout/useHorizontalSectionSync.d.ts +2 -1
- package/components/table/layout/useHorizontalSectionSync.js +32 -31
- package/components/table/layout/useHorizontalSectionSync.js.map +1 -1
- package/components/table/layout/useMeasuredColumnMaxWidths.js +52 -54
- package/components/table/layout/useMeasuredColumnMaxWidths.js.map +1 -1
- package/components/table/layout/useTableLayout.d.ts +6 -2
- package/components/table/layout/useTableLayout.js +61 -48
- package/components/table/layout/useTableLayout.js.map +1 -1
- package/components/table/layout/useTableVirtualization.js +51 -56
- package/components/table/layout/useTableVirtualization.js.map +1 -1
- package/components/table/model/resolveResponsiveViewType.d.ts +2 -0
- package/components/table/model/resolveResponsiveViewType.js +27 -0
- package/components/table/model/resolveResponsiveViewType.js.map +1 -0
- package/components/table/render/header/TableDraggableHeaderCell.js +38 -36
- package/components/table/render/header/TableDraggableHeaderCell.js.map +1 -1
- package/components/table/render/header/TableHeader.types.d.ts +2 -0
- package/components/table/render/header/TableHeaderCellContent.js +16 -16
- package/components/table/render/header/TableHeaderCellContent.js.map +1 -1
- package/components/table/render/header/TableHeaderSelectionCell.d.ts +1 -0
- package/components/table/render/header/TableHeaderSelectionCell.js +13 -12
- package/components/table/render/header/TableHeaderSelectionCell.js.map +1 -1
- package/components/table/render/header/TableStaticHeaderCell.js +31 -29
- package/components/table/render/header/TableStaticHeaderCell.js.map +1 -1
- package/components/table/render/header/resolveHeaderCellClassName.d.ts +1 -0
- package/components/table/render/header/resolveHeaderCellClassName.js +10 -9
- package/components/table/render/header/resolveHeaderCellClassName.js.map +1 -1
- package/components/table/runtime/useResolvedRenderColumns.d.ts +4 -4
- package/components/table/runtime/useResolvedRenderColumns.js +13 -13
- package/components/table/runtime/useResolvedRenderColumns.js.map +1 -1
- package/components/table/runtime/useResolvedRenderHeader.d.ts +1 -1
- package/components/table/runtime/useResolvedRenderHeader.js.map +1 -1
- package/components/table/runtime/useResponsiveResolvedViewType.d.ts +23 -0
- package/components/table/runtime/useResponsiveResolvedViewType.js +22 -0
- package/components/table/runtime/useResponsiveResolvedViewType.js.map +1 -0
- package/components/table/selection/useInternalTableSelectionState.d.ts +2 -0
- package/components/table/selection/useInternalTableSelectionState.js +27 -17
- package/components/table/selection/useInternalTableSelectionState.js.map +1 -1
- package/components/table/selection/useTableSelection.d.ts +5 -1
- package/components/table/selection/useTableSelection.js +37 -26
- package/components/table/selection/useTableSelection.js.map +1 -1
- package/components/table/shared/parsePixelSize.d.ts +2 -0
- package/components/table/shared/parsePixelSize.js +13 -0
- package/components/table/shared/parsePixelSize.js.map +1 -0
- package/hooks/useDraggableElement.d.ts +27 -5
- package/hooks/useDraggableElement.js +100 -23
- package/hooks/useDraggableElement.js.map +1 -1
- package/hooks/usePopperDropdown.d.ts +1 -0
- package/hooks/usePopperDropdown.js +15 -12
- package/hooks/usePopperDropdown.js.map +1 -1
- package/hooks/useResizeObserver.d.ts +25 -6
- package/hooks/useResizeObserver.js +20 -18
- package/hooks/useResizeObserver.js.map +1 -1
- package/package.json +10 -10
- package/utils/analytics/createAnalyticsOverlayTooltip.js.map +1 -1
- package/utils/init/initConfig.js +5 -5
- package/utils/init/initConfig.js.map +1 -1
- package/version.d.ts +1 -1
- package/version.js +2 -2
- package/version.js.map +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useMemo as l } from "react";
|
|
2
|
-
import { useDraggableColumns as
|
|
3
|
-
import { useResizableColumns as
|
|
2
|
+
import { useDraggableColumns as A } from "../layout/useDraggableColumns.js";
|
|
3
|
+
import { useResizableColumns as L } from "../layout/useResizableColumns.js";
|
|
4
4
|
const B = (m) => {
|
|
5
5
|
const { columnOrder: g, onColumnOrderChange: C, onColumnResize: y, renderHeaderColumns: t, viewType: d } = m, i = l(
|
|
6
6
|
() => t.flatMap(
|
|
@@ -28,18 +28,18 @@ const B = (m) => {
|
|
|
28
28
|
sortable: e.sortable
|
|
29
29
|
})),
|
|
30
30
|
[i]
|
|
31
|
-
), o = d === "TABLE" && n.filter((e) => e.draggable === !0).length > 1, { draggableColumnKeys: R, handleColumnDragEnd: p, orderedColumns: b } =
|
|
31
|
+
), o = d === "TABLE" && n.filter((e) => e.draggable === !0).length > 1, { draggableColumnKeys: R, handleColumnDragEnd: p, orderedColumns: b } = A({
|
|
32
32
|
columns: n,
|
|
33
33
|
columnOrder: g,
|
|
34
34
|
enabled: o,
|
|
35
35
|
onColumnOrderChange: C
|
|
36
36
|
}), h = d === "TABLE" && b.some((e) => e.resizeable === !0), {
|
|
37
37
|
handleColumnResizeReset: K,
|
|
38
|
-
handleColumnResizeStart:
|
|
39
|
-
lastResizableColumnKey:
|
|
40
|
-
resettableColumnKeys:
|
|
38
|
+
handleColumnResizeStart: M,
|
|
39
|
+
lastResizableColumnKey: W,
|
|
40
|
+
resettableColumnKeys: f,
|
|
41
41
|
resizedColumns: r
|
|
42
|
-
} =
|
|
42
|
+
} = L({
|
|
43
43
|
columns: b,
|
|
44
44
|
enabled: h,
|
|
45
45
|
onColumnResize: y
|
|
@@ -87,21 +87,21 @@ const B = (m) => {
|
|
|
87
87
|
])
|
|
88
88
|
),
|
|
89
89
|
[s]
|
|
90
|
-
),
|
|
90
|
+
), x = l(
|
|
91
91
|
() => new Map(s.map((e, a) => [e.columnKey, a])),
|
|
92
92
|
[s]
|
|
93
93
|
);
|
|
94
94
|
return {
|
|
95
95
|
columnDefinitionsByKey: w,
|
|
96
|
-
columnIndexByKey:
|
|
96
|
+
columnIndexByKey: x,
|
|
97
97
|
draggableColumnKeys: R,
|
|
98
98
|
draggableColumnsEnabled: o,
|
|
99
99
|
handleColumnDragEnd: p,
|
|
100
100
|
handleColumnResizeReset: K,
|
|
101
|
-
handleColumnResizeStart:
|
|
102
|
-
lastResizableColumnKey:
|
|
103
|
-
resettableColumnKeys:
|
|
104
|
-
|
|
101
|
+
handleColumnResizeStart: M,
|
|
102
|
+
lastResizableColumnKey: W,
|
|
103
|
+
resettableColumnKeys: f,
|
|
104
|
+
renderDataColumns: i,
|
|
105
105
|
resizeColumnsEnabled: h,
|
|
106
106
|
resolvedRenderColumns: s,
|
|
107
107
|
resizedColumns: r
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useResolvedRenderColumns.js","sources":["../../../../src/components/table/runtime/useResolvedRenderColumns.ts"],"sourcesContent":["import { useMemo } from 'react';\n\nimport type { RenderHeaderColumn } from '../context/TableRenderContext';\nimport { useDraggableColumns } from '../layout/useDraggableColumns';\nimport { useResizableColumns } from '../layout/useResizableColumns';\nimport type { TableColumnDefinition, TableProps, TableRowData } from '../Table.types';\n\ntype UseResolvedRenderColumnsProps<RowType extends TableRowData> = {\n columnOrder: TableProps<RowType>['columnOrder'];\n onColumnOrderChange: TableProps<RowType>['onColumnOrderChange'];\n onColumnResize: TableProps<RowType>['onColumnResize'];\n renderHeaderColumns: RenderHeaderColumn<RowType>[];\n viewType: TableProps<RowType>['viewType'];\n};\n\nexport type UseResolvedRenderColumnsReturn<RowType extends TableRowData> = {\n columnDefinitionsByKey: Map<string, TableColumnDefinition<RowType>>;\n columnIndexByKey: Map<string, number>;\n draggableColumnKeys?: string[];\n draggableColumnsEnabled: boolean;\n handleColumnDragEnd: ReturnType<typeof useDraggableColumns>['handleColumnDragEnd'];\n handleColumnResizeReset: ReturnType<typeof useResizableColumns<RowType>>['handleColumnResizeReset'];\n handleColumnResizeStart: ReturnType<typeof useResizableColumns<RowType>>['handleColumnResizeStart'];\n lastResizableColumnKey?: string;\n resettableColumnKeys: Set<string>;\n renderLeafColumns: RenderHeaderColumn<RowType>[];\n resizeColumnsEnabled: boolean;\n resolvedRenderColumns: RenderHeaderColumn<RowType>[];\n resizedColumns: ReturnType<typeof useResizableColumns<RowType>>['resizedColumns'];\n};\n\n/**\n * Resolves the leaf-level table columns that drive layout and column behavior.\n *\n * Header registration can contain grouped header cells, multi-row headers, and\n * other metadata that is useful for rendering, but drag, resize, sticky layout,\n * and body/footer cell placement ultimately need a flat list of leaf columns.\n *\n * This hook therefore:\n * - narrows registered header cells down to leaf columns with a stable `columnKey`\n * - applies column reordering\n * - applies resized widths\n * - exposes a normalized column map for body/footer cell lookup\n *\n * `Table` uses this as the canonical column model for the rest of the render pass.\n */\nconst useResolvedRenderColumns = <RowType extends TableRowData>(\n props: UseResolvedRenderColumnsProps<RowType>\n): UseResolvedRenderColumnsReturn<RowType> => {\n const { columnOrder, onColumnOrderChange, onColumnResize, renderHeaderColumns, viewType } = props;\n\n // Only leaf header cells represent actual data columns. Group headers span\n // other columns and are part of the header layout, but not the column model\n // used by body/footer cells or drag/resize behavior.\n const renderLeafColumns = useMemo(\n () =>\n renderHeaderColumns.flatMap(column =>\n column.columnKey && column.colSpan === 1\n ? [\n {\n ...column,\n columnKey: column.columnKey,\n },\n ]\n : []\n ),\n [renderHeaderColumns]\n );\n\n const baseRenderColumnDefinitions = useMemo(\n () =>\n renderLeafColumns.map(column => ({\n key: column.columnKey,\n label: column.columnKey,\n mobileLabel: column.mobileLabel,\n width: column.width,\n minResizeWidth: column.minResizeWidth,\n maxResizeWidth: column.maxResizeWidth,\n draggable: column.draggable,\n resizeable: column.resizeable,\n horizontalAlign: column.horizontalAlign,\n headerClassName: column.headerClassName,\n hideOnMobile: column.hideOnMobile,\n sortable: column.sortable,\n })),\n [renderLeafColumns]\n );\n\n const draggableColumnsEnabled =\n viewType === 'TABLE' && baseRenderColumnDefinitions.filter(column => column.draggable === true).length > 1;\n const { draggableColumnKeys, handleColumnDragEnd, orderedColumns } = useDraggableColumns({\n columns: baseRenderColumnDefinitions,\n columnOrder,\n enabled: draggableColumnsEnabled,\n onColumnOrderChange,\n });\n\n const resizeColumnsEnabled = viewType === 'TABLE' && orderedColumns.some(column => column.resizeable === true);\n const {\n handleColumnResizeReset,\n handleColumnResizeStart,\n lastResizableColumnKey,\n resettableColumnKeys,\n resizedColumns,\n } = useResizableColumns({\n columns: orderedColumns,\n enabled: resizeColumnsEnabled,\n onColumnResize,\n });\n\n // Merge reordered/resized column behavior back into the registered leaf\n // columns so the rest of the table can render from one normalized shape.\n const resolvedRenderColumns = useMemo(() => {\n const renderColumnsByKey = new Map(renderLeafColumns.map(column => [column.columnKey, column] as const));\n\n return resizedColumns.flatMap(column => {\n const renderColumn = renderColumnsByKey.get(column.key);\n\n return renderColumn\n ? [\n {\n ...renderColumn,\n width: column.width,\n minResizeWidth: column.minResizeWidth,\n maxResizeWidth: column.maxResizeWidth,\n draggable: column.draggable,\n resizeable: column.resizeable,\n horizontalAlign: column.horizontalAlign,\n headerClassName: column.headerClassName,\n hideOnMobile: column.hideOnMobile,\n sortable: column.sortable,\n },\n ]\n : [];\n });\n }, [renderLeafColumns, resizedColumns]);\n\n // Body and footer cells resolve their column metadata by `columnKey`, so keep\n // an efficient lookup map next to the ordered column array.\n const columnDefinitionsByKey = useMemo(\n () =>\n new Map<string, TableColumnDefinition<RowType>>(\n resolvedRenderColumns.map(column => [\n column.columnKey,\n {\n key: column.columnKey,\n label: column.label,\n mobileLabel: column.mobileLabel,\n icon: column.icon,\n filter: column.filter,\n hideLabel: column.hideLabel,\n width: column.width,\n minResizeWidth: column.minResizeWidth,\n maxResizeWidth: column.maxResizeWidth,\n draggable: column.draggable,\n resizeable: column.resizeable,\n horizontalAlign: column.horizontalAlign,\n className: undefined,\n headerClassName: column.headerClassName,\n hideOnMobile: column.hideOnMobile,\n sortable: column.sortable,\n },\n ])\n ),\n [resolvedRenderColumns]\n );\n const columnIndexByKey = useMemo(\n () => new Map(resolvedRenderColumns.map((column, index) => [column.columnKey, index] as const)),\n [resolvedRenderColumns]\n );\n\n return {\n columnDefinitionsByKey,\n columnIndexByKey,\n draggableColumnKeys,\n draggableColumnsEnabled,\n handleColumnDragEnd,\n handleColumnResizeReset,\n handleColumnResizeStart,\n lastResizableColumnKey,\n resettableColumnKeys,\n renderLeafColumns,\n resizeColumnsEnabled,\n resolvedRenderColumns,\n resizedColumns,\n };\n};\n\nexport default useResolvedRenderColumns;\n"],"names":["useResolvedRenderColumns","props","columnOrder","onColumnOrderChange","onColumnResize","renderHeaderColumns","viewType","renderLeafColumns","useMemo","column","baseRenderColumnDefinitions","draggableColumnsEnabled","draggableColumnKeys","handleColumnDragEnd","orderedColumns","useDraggableColumns","resizeColumnsEnabled","handleColumnResizeReset","handleColumnResizeStart","lastResizableColumnKey","resettableColumnKeys","resizedColumns","useResizableColumns","resolvedRenderColumns","renderColumnsByKey","renderColumn","columnDefinitionsByKey","columnIndexByKey","index"],"mappings":";;;AA8CA,MAAMA,IAA2B,CAC7BC,MAC0C;AAC1C,QAAM,EAAE,aAAAC,GAAa,qBAAAC,GAAqB,gBAAAC,GAAgB,qBAAAC,GAAqB,UAAAC,MAAaL,GAKtFM,IAAoBC;AAAA,IACtB,MACIH,EAAoB;AAAA,MAAQ,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qB;AAAA,EAAA;AAG1B,SAAO;AAAA,IACH,wBAAAG;AAAA,IACA,kBAAAC;AAAA,IACA,qBAAAf;AAAA,IACA,yBAAAD;AAAA,IACA,qBAAAE;AAAA,IACA,yBAAAI;AAAA,IACA,yBAAAC;AAAA,IACA,wBAAAC;AAAA,IACA,sBAAAC;AAAA,IACA,mBAAAb;AAAA,IACA,sBAAAS;AAAA,IACA,uBAAAO;AAAA,IACA,gBAAAF;AAAA,EAAA;AAER;"}
|
|
1
|
+
{"version":3,"file":"useResolvedRenderColumns.js","sources":["../../../../src/components/table/runtime/useResolvedRenderColumns.ts"],"sourcesContent":["import { useMemo } from 'react';\n\nimport type { RenderHeaderColumn } from '../context/TableRenderContext';\nimport { useDraggableColumns } from '../layout/useDraggableColumns';\nimport { useResizableColumns } from '../layout/useResizableColumns';\nimport type { TableColumnDefinition, TableProps, TableRowData } from '../Table.types';\n\ntype UseResolvedRenderColumnsProps<RowType extends TableRowData> = {\n columnOrder: TableProps<RowType>['columnOrder'];\n onColumnOrderChange: TableProps<RowType>['onColumnOrderChange'];\n onColumnResize: TableProps<RowType>['onColumnResize'];\n renderHeaderColumns: RenderHeaderColumn<RowType>[];\n viewType: TableProps<RowType>['viewType'];\n};\n\nexport type UseResolvedRenderColumnsReturn<RowType extends TableRowData> = {\n columnDefinitionsByKey: Map<string, TableColumnDefinition<RowType>>;\n columnIndexByKey: Map<string, number>;\n draggableColumnKeys?: string[];\n draggableColumnsEnabled: boolean;\n handleColumnDragEnd: ReturnType<typeof useDraggableColumns>['handleColumnDragEnd'];\n handleColumnResizeReset: ReturnType<typeof useResizableColumns<RowType>>['handleColumnResizeReset'];\n handleColumnResizeStart: ReturnType<typeof useResizableColumns<RowType>>['handleColumnResizeStart'];\n lastResizableColumnKey?: string;\n resettableColumnKeys: Set<string>;\n renderDataColumns: RenderHeaderColumn<RowType>[];\n resizeColumnsEnabled: boolean;\n resolvedRenderColumns: RenderHeaderColumn<RowType>[];\n resizedColumns: ReturnType<typeof useResizableColumns<RowType>>['resizedColumns'];\n};\n\n/**\n * Resolves the actual data columns that drive layout and column behavior.\n *\n * Header registration can contain grouped header cells, multi-row headers, and\n * other metadata that is useful for rendering, but drag, resize, sticky layout,\n * and body/footer cell placement ultimately need a flat list of actual data columns.\n *\n * This hook therefore:\n * - narrows registered header cells down to single-column data headers with a stable `columnKey`\n * - applies column reordering\n * - applies resized widths\n * - exposes a normalized column map for body/footer cell lookup\n *\n * `Table` uses this as the canonical column model for the rest of the render pass.\n */\nconst useResolvedRenderColumns = <RowType extends TableRowData>(\n props: UseResolvedRenderColumnsProps<RowType>\n): UseResolvedRenderColumnsReturn<RowType> => {\n const { columnOrder, onColumnOrderChange, onColumnResize, renderHeaderColumns, viewType } = props;\n\n // Only single-column header cells represent actual data columns. Group headers span\n // other columns and are part of the header layout, but not the column model\n // used by body/footer cells or drag/resize behavior.\n const renderDataColumns = useMemo(\n () =>\n renderHeaderColumns.flatMap(column =>\n column.columnKey && column.colSpan === 1\n ? [\n {\n ...column,\n columnKey: column.columnKey,\n },\n ]\n : []\n ),\n [renderHeaderColumns]\n );\n\n const baseRenderColumnDefinitions = useMemo(\n () =>\n renderDataColumns.map(column => ({\n key: column.columnKey,\n label: column.columnKey,\n mobileLabel: column.mobileLabel,\n width: column.width,\n minResizeWidth: column.minResizeWidth,\n maxResizeWidth: column.maxResizeWidth,\n draggable: column.draggable,\n resizeable: column.resizeable,\n horizontalAlign: column.horizontalAlign,\n headerClassName: column.headerClassName,\n hideOnMobile: column.hideOnMobile,\n sortable: column.sortable,\n })),\n [renderDataColumns]\n );\n\n const draggableColumnsEnabled =\n viewType === 'TABLE' && baseRenderColumnDefinitions.filter(column => column.draggable === true).length > 1;\n const { draggableColumnKeys, handleColumnDragEnd, orderedColumns } = useDraggableColumns({\n columns: baseRenderColumnDefinitions,\n columnOrder,\n enabled: draggableColumnsEnabled,\n onColumnOrderChange,\n });\n\n const resizeColumnsEnabled = viewType === 'TABLE' && orderedColumns.some(column => column.resizeable === true);\n const {\n handleColumnResizeReset,\n handleColumnResizeStart,\n lastResizableColumnKey,\n resettableColumnKeys,\n resizedColumns,\n } = useResizableColumns({\n columns: orderedColumns,\n enabled: resizeColumnsEnabled,\n onColumnResize,\n });\n\n // Merge reordered/resized column behavior back into the registered data\n // columns so the rest of the table can render from one normalized shape.\n const resolvedRenderColumns = useMemo(() => {\n const renderColumnsByKey = new Map(renderDataColumns.map(column => [column.columnKey, column] as const));\n\n return resizedColumns.flatMap(column => {\n const renderColumn = renderColumnsByKey.get(column.key);\n\n return renderColumn\n ? [\n {\n ...renderColumn,\n width: column.width,\n minResizeWidth: column.minResizeWidth,\n maxResizeWidth: column.maxResizeWidth,\n draggable: column.draggable,\n resizeable: column.resizeable,\n horizontalAlign: column.horizontalAlign,\n headerClassName: column.headerClassName,\n hideOnMobile: column.hideOnMobile,\n sortable: column.sortable,\n },\n ]\n : [];\n });\n }, [renderDataColumns, resizedColumns]);\n\n // Body and footer cells resolve their column metadata by `columnKey`, so keep\n // an efficient lookup map next to the ordered column array.\n const columnDefinitionsByKey = useMemo(\n () =>\n new Map<string, TableColumnDefinition<RowType>>(\n resolvedRenderColumns.map(column => [\n column.columnKey,\n {\n key: column.columnKey,\n label: column.label,\n mobileLabel: column.mobileLabel,\n icon: column.icon,\n filter: column.filter,\n hideLabel: column.hideLabel,\n width: column.width,\n minResizeWidth: column.minResizeWidth,\n maxResizeWidth: column.maxResizeWidth,\n draggable: column.draggable,\n resizeable: column.resizeable,\n horizontalAlign: column.horizontalAlign,\n className: undefined,\n headerClassName: column.headerClassName,\n hideOnMobile: column.hideOnMobile,\n sortable: column.sortable,\n },\n ])\n ),\n [resolvedRenderColumns]\n );\n const columnIndexByKey = useMemo(\n () => new Map(resolvedRenderColumns.map((column, index) => [column.columnKey, index] as const)),\n [resolvedRenderColumns]\n );\n\n return {\n columnDefinitionsByKey,\n columnIndexByKey,\n draggableColumnKeys,\n draggableColumnsEnabled,\n handleColumnDragEnd,\n handleColumnResizeReset,\n handleColumnResizeStart,\n lastResizableColumnKey,\n resettableColumnKeys,\n renderDataColumns,\n resizeColumnsEnabled,\n resolvedRenderColumns,\n resizedColumns,\n };\n};\n\nexport default useResolvedRenderColumns;\n"],"names":["useResolvedRenderColumns","props","columnOrder","onColumnOrderChange","onColumnResize","renderHeaderColumns","viewType","renderDataColumns","useMemo","column","baseRenderColumnDefinitions","draggableColumnsEnabled","draggableColumnKeys","handleColumnDragEnd","orderedColumns","useDraggableColumns","resizeColumnsEnabled","handleColumnResizeReset","handleColumnResizeStart","lastResizableColumnKey","resettableColumnKeys","resizedColumns","useResizableColumns","resolvedRenderColumns","renderColumnsByKey","renderColumn","columnDefinitionsByKey","columnIndexByKey","index"],"mappings":";;;AA8CA,MAAMA,IAA2B,CAC7BC,MAC0C;AAC1C,QAAM,EAAE,aAAAC,GAAa,qBAAAC,GAAqB,gBAAAC,GAAgB,qBAAAC,GAAqB,UAAAC,MAAaL,GAKtFM,IAAoBC;AAAA,IACtB,MACIH,EAAoB;AAAA,MAAQ,CAAAI,MACxBA,EAAO,aAAaA,EAAO,YAAY,IACjC;AAAA,QACI;AAAA,UACI,GAAGA;AAAA,UACH,WAAWA,EAAO;AAAA,QAAA;AAAA,MACtB,IAEJ,CAAA;AAAA,IAAC;AAAA,IAEf,CAACJ,CAAmB;AAAA,EAAA,GAGlBK,IAA8BF;AAAA,IAChC,MACID,EAAkB,IAAI,CAAAE,OAAW;AAAA,MAC7B,KAAKA,EAAO;AAAA,MACZ,OAAOA,EAAO;AAAA,MACd,aAAaA,EAAO;AAAA,MACpB,OAAOA,EAAO;AAAA,MACd,gBAAgBA,EAAO;AAAA,MACvB,gBAAgBA,EAAO;AAAA,MACvB,WAAWA,EAAO;AAAA,MAClB,YAAYA,EAAO;AAAA,MACnB,iBAAiBA,EAAO;AAAA,MACxB,iBAAiBA,EAAO;AAAA,MACxB,cAAcA,EAAO;AAAA,MACrB,UAAUA,EAAO;AAAA,IAAA,EACnB;AAAA,IACN,CAAC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A,EAAO;AAAA,QACP;AAAA,UACI,KAAKA,EAAO;AAAA,UACZ,OAAOA,EAAO;AAAA,UACd,aAAaA,EAAO;AAAA,UACpB,MAAMA,EAAO;AAAA,UACb,QAAQA,EAAO;AAAA,UACf,WAAWA,EAAO;AAAA,UAClB,OAAOA,EAAO;AAAA,UACd,gBAAgBA,EAAO;AAAA,UACvB,gBAAgBA,EAAO;AAAA,UACvB,WAAWA,EAAO;AAAA,UAClB,YAAYA,EAAO;AAAA,UACnB,iBAAiBA,EAAO;AAAA,UACxB,WAAW;AAAA,UACX,iBAAiBA,EAAO;AAAA,UACxB,cAAcA,EAAO;AAAA,UACrB,UAAUA,EAAO;AAAA,QAAA;AAAA,MACrB,CACH;AAAA,IAAA;AAAA,IAET,CAACc,CAAqB;AAAA,EAAA,GAEpBI,IAAmBnB;AAAA,IACrB,MAAM,IAAI,IAAIe,EAAsB,IAAI,CAACd,GAAQmB,MAAU,CAACnB,EAAO,WAAWmB,CAAK,CAAU,CAAC;AAAA,IAC9F,CAACL,CAAqB;AAAA,EAAA;AAG1B,SAAO;AAAA,IACH,wBAAAG;AAAA,IACA,kBAAAC;AAAA,IACA,qBAAAf;AAAA,IACA,yBAAAD;AAAA,IACA,qBAAAE;AAAA,IACA,yBAAAI;AAAA,IACA,yBAAAC;AAAA,IACA,wBAAAC;AAAA,IACA,sBAAAC;AAAA,IACA,mBAAAb;AAAA,IACA,sBAAAS;AAAA,IACA,uBAAAO;AAAA,IACA,gBAAAF;AAAA,EAAA;AAER;"}
|
|
@@ -9,7 +9,7 @@ type UseResolvedRenderHeaderProps<RowType extends TableRowData> = {
|
|
|
9
9
|
};
|
|
10
10
|
/**
|
|
11
11
|
* Builds the normalized header layout from registered header cells and the
|
|
12
|
-
* already-resolved
|
|
12
|
+
* already-resolved data columns.
|
|
13
13
|
*
|
|
14
14
|
* `useResolvedRenderColumns(...)` decides which columns actually exist after
|
|
15
15
|
* reorder/resize behavior. This hook takes that flat column model plus the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useResolvedRenderHeader.js","sources":["../../../../src/components/table/runtime/useResolvedRenderHeader.ts"],"sourcesContent":["import { useMemo } from 'react';\n\nimport type { RenderHeaderColumn } from '../context/TableRenderContext';\nimport type { TableViewHeader } from '../model/tableView.types';\nimport type { TableColumnDefinition, TableRowData, TableSortDirection } from '../Table.types';\n\ntype UseResolvedRenderHeaderProps<RowType extends TableRowData> = {\n renderHeaderColumns: RenderHeaderColumn<RowType>[];\n resolvedRenderColumns: RenderHeaderColumn<RowType>[];\n sortBy?: string | string[];\n sortDirection?: TableSortDirection;\n};\n\n/**\n * Builds the normalized header layout from registered header cells and the\n * already-resolved
|
|
1
|
+
{"version":3,"file":"useResolvedRenderHeader.js","sources":["../../../../src/components/table/runtime/useResolvedRenderHeader.ts"],"sourcesContent":["import { useMemo } from 'react';\n\nimport type { RenderHeaderColumn } from '../context/TableRenderContext';\nimport type { TableViewHeader } from '../model/tableView.types';\nimport type { TableColumnDefinition, TableRowData, TableSortDirection } from '../Table.types';\n\ntype UseResolvedRenderHeaderProps<RowType extends TableRowData> = {\n renderHeaderColumns: RenderHeaderColumn<RowType>[];\n resolvedRenderColumns: RenderHeaderColumn<RowType>[];\n sortBy?: string | string[];\n sortDirection?: TableSortDirection;\n};\n\n/**\n * Builds the normalized header layout from registered header cells and the\n * already-resolved data columns.\n *\n * `useResolvedRenderColumns(...)` decides which columns actually exist after\n * reorder/resize behavior. This hook takes that flat column model plus the\n * registered header cells and computes the final header grid:\n * - row count\n * - column start positions\n * - row/column spans\n * - sortable state for the active sort key\n * - `source` metadata for downstream header/cell consumers\n *\n * The result is a stable header view model that `TableHeader` can render\n * without repeating placement logic.\n */\nconst useResolvedRenderHeader = <RowType extends TableRowData>(\n props: UseResolvedRenderHeaderProps<RowType>\n): TableViewHeader<RowType> | undefined => {\n const { renderHeaderColumns, resolvedRenderColumns, sortBy, sortDirection } = props;\n\n return useMemo<TableViewHeader<RowType> | undefined>(() => {\n if (renderHeaderColumns.length === 0 || resolvedRenderColumns.length === 0) {\n return;\n }\n\n const sortedColumnKeys = new Set(Array.isArray(sortBy) ? sortBy : sortBy ? [sortBy] : []);\n const rowCount = Math.max(...renderHeaderColumns.map(column => column.row + column.rowSpan - 1), 1);\n const occupied = Array.from({ length: rowCount }, () => Array(resolvedRenderColumns.length).fill(false));\n const resolvedRenderColumnsByKey = new Map(\n resolvedRenderColumns.map(column => [column.columnKey, column] as const)\n );\n const columnStartByKey = new Map(\n resolvedRenderColumns.map((column, index) => [column.columnKey, index + 1] as const)\n );\n\n // Group headers without a direct `columnKey` still need a column start.\n // Find the next free slot by walking the occupied grid from left to right.\n const findColumnStart = (rowStart: number, colSpan: number) => {\n for (let candidate = 1; candidate <= resolvedRenderColumns.length - colSpan + 1; candidate += 1) {\n const hasFreeSlot = occupied[rowStart - 1]\n ?.slice(candidate - 1, candidate - 1 + colSpan)\n .every(isUsed => !isUsed);\n\n if (hasFreeSlot) {\n return candidate;\n }\n }\n\n return 1;\n };\n\n const columns = renderHeaderColumns.map(column => {\n const resolvedRenderColumn = column.columnKey\n ? resolvedRenderColumnsByKey.get(column.columnKey)\n : undefined;\n const sourceColumnDefinition: TableColumnDefinition<RowType> | undefined = resolvedRenderColumn?.columnKey\n ? {\n key: resolvedRenderColumn.columnKey,\n label: resolvedRenderColumn.label,\n width: resolvedRenderColumn.width,\n mobileLabel: resolvedRenderColumn.mobileLabel,\n horizontalAlign: resolvedRenderColumn.horizontalAlign,\n headerClassName: resolvedRenderColumn.headerClassName,\n hideOnMobile: resolvedRenderColumn.hideOnMobile,\n sortable: resolvedRenderColumn.sortable,\n draggable: resolvedRenderColumn.draggable,\n resizeable: resolvedRenderColumn.resizeable,\n minResizeWidth: resolvedRenderColumn.minResizeWidth,\n maxResizeWidth: resolvedRenderColumn.maxResizeWidth,\n }\n : undefined;\n const columnStart = resolvedRenderColumn\n ? (columnStartByKey.get(resolvedRenderColumn.columnKey) ?? 1)\n : findColumnStart(column.row, column.colSpan);\n\n // Mark the occupied grid so following grouped header cells can find\n // the next free placement slot in multi-row header layouts.\n for (let rowIndex = column.row - 1; rowIndex < column.row - 1 + column.rowSpan; rowIndex += 1) {\n for (\n let columnIndex = columnStart - 1;\n columnIndex < columnStart - 1 + column.colSpan;\n columnIndex += 1\n ) {\n if (occupied[rowIndex]?.[columnIndex] !== undefined) {\n occupied[rowIndex][columnIndex] = true;\n }\n }\n }\n\n return {\n key: column.id,\n columnKey: column.columnKey,\n label: column.label,\n icon: column.icon,\n filter: column.filter,\n hideLabel: column.hideLabel,\n horizontalAlign: resolvedRenderColumn?.horizontalAlign ?? column.horizontalAlign,\n verticalAlign: resolvedRenderColumn?.verticalAlign ?? column.verticalAlign,\n className: undefined,\n headerClassName: resolvedRenderColumn?.headerClassName ?? column.headerClassName,\n hideOnMobile: resolvedRenderColumn?.hideOnMobile ?? column.hideOnMobile,\n draggable: resolvedRenderColumn?.draggable ?? column.draggable,\n resizeable: resolvedRenderColumn?.resizeable ?? column.resizeable,\n sortable: resolvedRenderColumn?.sortable ?? column.sortable,\n sortDirection: column.columnKey && sortedColumnKeys.has(column.columnKey) ? sortDirection : undefined,\n rowStart: column.row,\n rowSpan: column.rowSpan,\n columnStart,\n colSpan: column.colSpan,\n source: sourceColumnDefinition,\n };\n });\n\n return {\n rowCount,\n totalColumnCount: resolvedRenderColumns.length,\n columns,\n };\n }, [renderHeaderColumns, resolvedRenderColumns, sortBy, sortDirection]);\n};\n\nexport default useResolvedRenderHeader;\n"],"names":["useResolvedRenderHeader","props","renderHeaderColumns","resolvedRenderColumns","sortBy","sortDirection","useMemo","sortedColumnKeys","rowCount","column","occupied","resolvedRenderColumnsByKey","columnStartByKey","index","findColumnStart","rowStart","colSpan","candidate","isUsed","columns","resolvedRenderColumn","sourceColumnDefinition","columnStart","rowIndex","columnIndex"],"mappings":";AA6BA,MAAMA,IAA0B,CAC5BC,MACuC;AACvC,QAAM,EAAE,qBAAAC,GAAqB,uBAAAC,GAAuB,QA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AsB;AAAA,MACxC,SAAAgB;AAAA,IAAA;AAAA,EAER,GAAG,CAACjB,GAAqBC,GAAuBC,GAAQC,CAAa,CAAC;AAC1E;"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { TableResponsiveBreakpoint, TableViewType } from '../Table.types';
|
|
2
|
+
type UseResponsiveResolvedViewTypeProps = {
|
|
3
|
+
onViewTypeChange?: (viewType: TableViewType) => void;
|
|
4
|
+
responsiveBreakpoint?: TableResponsiveBreakpoint;
|
|
5
|
+
viewType: TableViewType;
|
|
6
|
+
wrapperTableWidth?: string | number;
|
|
7
|
+
wrapperWidth?: number;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Resolves the effective table view when responsive breakpoints and manual view changes are both active.
|
|
11
|
+
*
|
|
12
|
+
* With `responsiveBreakpoint`, the table derives a responsive view bucket from the current rendered width:
|
|
13
|
+
* `TABLE`, `MULTI_CARDS`, or `SINGLE_CARD`.
|
|
14
|
+
*
|
|
15
|
+
* Manual view changes are intentionally sticky within the current responsive bucket. Example:
|
|
16
|
+
* when the width currently resolves to `MULTI_CARDS`, the user can still switch to `TABLE` manually.
|
|
17
|
+
* That manual choice stays active until resizing crosses into a different responsive bucket, at which point
|
|
18
|
+
* the hook clears the override and resolves the view from the current breakpoints again.
|
|
19
|
+
*
|
|
20
|
+
* Without `responsiveBreakpoint`, the hook simply returns the requested `viewType`.
|
|
21
|
+
*/
|
|
22
|
+
declare const useResponsiveResolvedViewType: (props: UseResponsiveResolvedViewTypeProps) => TableViewType;
|
|
23
|
+
export default useResponsiveResolvedViewType;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { useRef as v, useEffect as c } from "react";
|
|
2
|
+
import { resolveResponsiveViewType as w } from "../model/resolveResponsiveViewType.js";
|
|
3
|
+
import y from "../shared/parsePixelSize.js";
|
|
4
|
+
const h = (u) => {
|
|
5
|
+
const { onViewTypeChange: n, responsiveBreakpoint: p, viewType: r, wrapperTableWidth: a, wrapperWidth: d } = u, t = v(r), i = v(
|
|
6
|
+
void 0
|
|
7
|
+
), e = p !== void 0, f = e ? y(a) ?? d : void 0, T = e && r !== t.current, o = e ? w("TABLE", f, p) : r;
|
|
8
|
+
e ? T && (i.current = {
|
|
9
|
+
responsiveViewType: o,
|
|
10
|
+
viewType: r
|
|
11
|
+
}) : i.current = void 0, e && i.current?.responsiveViewType !== o && (i.current = void 0);
|
|
12
|
+
const s = e ? i.current?.viewType ?? o : r;
|
|
13
|
+
return c(() => {
|
|
14
|
+
e && n?.(s);
|
|
15
|
+
}, [e, n, s]), c(() => {
|
|
16
|
+
t.current = r;
|
|
17
|
+
}, [r]), s;
|
|
18
|
+
};
|
|
19
|
+
export {
|
|
20
|
+
h as default
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=useResponsiveResolvedViewType.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useResponsiveResolvedViewType.js","sources":["../../../../src/components/table/runtime/useResponsiveResolvedViewType.ts"],"sourcesContent":["import { useEffect, useRef } from 'react';\n\nimport { resolveResponsiveViewType } from '../model/resolveResponsiveViewType';\nimport parsePixelSize from '../shared/parsePixelSize';\nimport type { TableResponsiveBreakpoint, TableViewType } from '../Table.types';\n\ntype UseResponsiveResolvedViewTypeProps = {\n onViewTypeChange?: (viewType: TableViewType) => void;\n responsiveBreakpoint?: TableResponsiveBreakpoint;\n viewType: TableViewType;\n wrapperTableWidth?: string | number;\n wrapperWidth?: number;\n};\n\n/**\n * Resolves the effective table view when responsive breakpoints and manual view changes are both active.\n *\n * With `responsiveBreakpoint`, the table derives a responsive view bucket from the current rendered width:\n * `TABLE`, `MULTI_CARDS`, or `SINGLE_CARD`.\n *\n * Manual view changes are intentionally sticky within the current responsive bucket. Example:\n * when the width currently resolves to `MULTI_CARDS`, the user can still switch to `TABLE` manually.\n * That manual choice stays active until resizing crosses into a different responsive bucket, at which point\n * the hook clears the override and resolves the view from the current breakpoints again.\n *\n * Without `responsiveBreakpoint`, the hook simply returns the requested `viewType`.\n */\nconst useResponsiveResolvedViewType = (props: UseResponsiveResolvedViewTypeProps): TableViewType => {\n const { onViewTypeChange, responsiveBreakpoint, viewType, wrapperTableWidth, wrapperWidth } = props;\n\n const previousPropViewTypeRef = useRef<TableViewType>(viewType);\n const manualOverrideRef = useRef<{ responsiveViewType: TableViewType; viewType: TableViewType } | undefined>(\n undefined\n );\n\n const hasResponsiveBreakpoint = responsiveBreakpoint !== undefined;\n const responsiveTableWidth = hasResponsiveBreakpoint\n ? (parsePixelSize(wrapperTableWidth) ?? wrapperWidth)\n : undefined;\n const hasRequestedViewTypeChange = hasResponsiveBreakpoint && viewType !== previousPropViewTypeRef.current;\n\n const responsiveViewType = hasResponsiveBreakpoint\n ? resolveResponsiveViewType('TABLE', responsiveTableWidth, responsiveBreakpoint)\n : viewType;\n\n if (!hasResponsiveBreakpoint) {\n manualOverrideRef.current = undefined;\n } else if (hasRequestedViewTypeChange) {\n manualOverrideRef.current = {\n responsiveViewType,\n viewType,\n };\n }\n\n if (hasResponsiveBreakpoint && manualOverrideRef.current?.responsiveViewType !== responsiveViewType) {\n manualOverrideRef.current = undefined;\n }\n\n const resolvedViewType = hasResponsiveBreakpoint\n ? (manualOverrideRef.current?.viewType ?? responsiveViewType)\n : viewType;\n\n useEffect(() => {\n if (!hasResponsiveBreakpoint) {\n return;\n }\n\n onViewTypeChange?.(resolvedViewType);\n }, [hasResponsiveBreakpoint, onViewTypeChange, resolvedViewType]);\n\n useEffect(() => {\n previousPropViewTypeRef.current = viewType;\n }, [viewType]);\n\n return resolvedViewType;\n};\n\nexport default useResponsiveResolvedViewType;\n"],"names":["useResponsiveResolvedViewType","props","onViewTypeChange","responsiveBreakpoint","viewType","wrapperTableWidth","wrapperWidth","previousPropViewTypeRef","useRef","manualOverrideRef","hasResponsiveBreakpoint","responsiveTableWidth","parsePixelSize","hasRequestedViewTypeChange","responsiveViewType","resolveResponsiveViewType","resolvedViewType","useEffect"],"mappings":";;;AA2BA,MAAMA,IAAgC,CAACC,MAA6D;AAChG,QAAM,EAAE,kBAAAC,GAAkB,sBAAAC,GAAsB,UAAAC,GAAU,mBAAAC,GAAmB,cAAAC,MAAiBL,GAExFM,IAA0BC,EAAsBJ,CAAQ,GACxDK,IAAoBD;AAAA,IACtB;AAAA,EAAA,GAGEE,IAA0BP,MAAyB,QACnDQ,IAAuBD,IACtBE,EAAeP,CAAiB,KAAKC,IACtC,QACAO,IAA6BH,KAA2BN,MAAaG,EAAwB,SAE7FO,IAAqBJ,IACrBK,EAA0B,SAASJ,GAAsBR,CAAoB,IAC7EC;AAEN,EAAKM,IAEMG,MACPJ,EAAkB,UAAU;AAAA,IACxB,oBAAAK;AAAA,IACA,UAAAV;AAAA,EAAA,KAJJK,EAAkB,UAAU,QAQ5BC,KAA2BD,EAAkB,SAAS,uBAAuBK,MAC7EL,EAAkB,UAAU;AAGhC,QAAMO,IAAmBN,IAClBD,EAAkB,SAAS,YAAYK,IACxCV;AAEN,SAAAa,EAAU,MAAM;AACZ,IAAKP,KAILR,IAAmBc,CAAgB;AAAA,EACvC,GAAG,CAACN,GAAyBR,GAAkBc,CAAgB,CAAC,GAEhEC,EAAU,MAAM;AACZ,IAAAV,EAAwB,UAAUH;AAAA,EACtC,GAAG,CAACA,CAAQ,CAAC,GAENY;AACX;"}
|
|
@@ -8,8 +8,10 @@ type UseInternalTableSelectionStateOptions<RowType extends TableRowData> = {
|
|
|
8
8
|
type UseInternalTableSelectionStateReturn = {
|
|
9
9
|
currentSelectedRowIds: TableRowId[];
|
|
10
10
|
selectedRowIdSet: Set<TableRowId>;
|
|
11
|
+
selectableRowIdSet: Set<TableRowId>;
|
|
11
12
|
isAllRowsSelected: boolean;
|
|
12
13
|
isSomeRowsSelected: boolean;
|
|
14
|
+
hasSelectableRows: boolean;
|
|
13
15
|
handleToggleAllSelection: () => void;
|
|
14
16
|
handleToggleRowSelection: (rowId: TableRowId) => void;
|
|
15
17
|
};
|
|
@@ -1,28 +1,38 @@
|
|
|
1
|
-
import { useMemo as
|
|
2
|
-
const
|
|
3
|
-
const { bodyRows:
|
|
4
|
-
() =>
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { useMemo as s } from "react";
|
|
2
|
+
const k = (b) => {
|
|
3
|
+
const { bodyRows: n, selectedRowIds: w, onSelectionChange: o } = b, d = s(
|
|
4
|
+
() => n.filter(
|
|
5
|
+
(e) => (e.kind === "data" || e.kind === "expanded") && !e.disabled && e.selectable !== !1
|
|
6
|
+
).map((e) => e.rowId),
|
|
7
|
+
[n]
|
|
8
|
+
), a = s(() => new Set(d), [d]), t = s(
|
|
9
|
+
() => n.filter((e) => e.kind === "data" && !e.disabled && e.selectable !== !1).map((e) => e.rowId),
|
|
10
|
+
[n]
|
|
11
|
+
), l = w ?? [], S = s(() => new Set(l), [l]), i = s(
|
|
12
|
+
() => l.filter((e) => t.includes(e)),
|
|
13
|
+
[l, t]
|
|
14
|
+
), R = s(
|
|
15
|
+
() => new Set(i),
|
|
16
|
+
[i]
|
|
17
|
+
), c = t.length > 0 && t.every((e) => R.has(e)), g = R.size > 0 && !c, h = t.length > 0;
|
|
10
18
|
return {
|
|
11
|
-
currentSelectedRowIds:
|
|
12
|
-
selectedRowIdSet:
|
|
13
|
-
|
|
14
|
-
|
|
19
|
+
currentSelectedRowIds: l,
|
|
20
|
+
selectedRowIdSet: S,
|
|
21
|
+
selectableRowIdSet: a,
|
|
22
|
+
isAllRowsSelected: c,
|
|
23
|
+
isSomeRowsSelected: g,
|
|
24
|
+
hasSelectableRows: h,
|
|
15
25
|
handleToggleAllSelection: () => {
|
|
16
|
-
|
|
26
|
+
o?.(c ? [] : t);
|
|
17
27
|
},
|
|
18
28
|
handleToggleRowSelection: (e) => {
|
|
19
|
-
|
|
20
|
-
|
|
29
|
+
!o || !a.has(e) || o(
|
|
30
|
+
S.has(e) ? l.filter((r) => r !== e) : [...l, e]
|
|
21
31
|
);
|
|
22
32
|
}
|
|
23
33
|
};
|
|
24
34
|
};
|
|
25
35
|
export {
|
|
26
|
-
|
|
36
|
+
k as default
|
|
27
37
|
};
|
|
28
38
|
//# sourceMappingURL=useInternalTableSelectionState.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useInternalTableSelectionState.js","sources":["../../../../src/components/table/selection/useInternalTableSelectionState.ts"],"sourcesContent":["import { useMemo } from 'react';\n\nimport type { RenderBodyRow } from '../context/TableRenderContext';\nimport type { TableRowData, TableRowId } from '../Table.types';\n\ntype UseInternalTableSelectionStateOptions<RowType extends TableRowData> = {\n bodyRows: RenderBodyRow<RowType>[];\n selectedRowIds?: TableRowId[];\n onSelectionChange?: (rowIds: TableRowId[]) => void;\n};\n\ntype UseInternalTableSelectionStateReturn = {\n currentSelectedRowIds: TableRowId[];\n selectedRowIdSet: Set<TableRowId>;\n isAllRowsSelected: boolean;\n isSomeRowsSelected: boolean;\n handleToggleAllSelection: () => void;\n handleToggleRowSelection: (rowId: TableRowId) => void;\n};\n\nconst useInternalTableSelectionState = <RowType extends TableRowData>(\n props: UseInternalTableSelectionStateOptions<RowType>\n): UseInternalTableSelectionStateReturn => {\n const { bodyRows, selectedRowIds, onSelectionChange } = props;\n\n const selectableRowIds = useMemo(\n ()
|
|
1
|
+
{"version":3,"file":"useInternalTableSelectionState.js","sources":["../../../../src/components/table/selection/useInternalTableSelectionState.ts"],"sourcesContent":["import { useMemo } from 'react';\n\nimport type { RenderBodyRow } from '../context/TableRenderContext';\nimport type { TableRowData, TableRowId } from '../Table.types';\n\ntype UseInternalTableSelectionStateOptions<RowType extends TableRowData> = {\n bodyRows: RenderBodyRow<RowType>[];\n selectedRowIds?: TableRowId[];\n onSelectionChange?: (rowIds: TableRowId[]) => void;\n};\n\ntype UseInternalTableSelectionStateReturn = {\n currentSelectedRowIds: TableRowId[];\n selectedRowIdSet: Set<TableRowId>;\n selectableRowIdSet: Set<TableRowId>;\n isAllRowsSelected: boolean;\n isSomeRowsSelected: boolean;\n hasSelectableRows: boolean;\n handleToggleAllSelection: () => void;\n handleToggleRowSelection: (rowId: TableRowId) => void;\n};\n\nconst useInternalTableSelectionState = <RowType extends TableRowData>(\n props: UseInternalTableSelectionStateOptions<RowType>\n): UseInternalTableSelectionStateReturn => {\n const { bodyRows, selectedRowIds, onSelectionChange } = props;\n\n const selectableRowIds = useMemo(\n () =>\n bodyRows\n .filter(\n row => (row.kind === 'data' || row.kind === 'expanded') && !row.disabled && row.selectable !== false\n )\n .map(row => row.rowId),\n [bodyRows]\n );\n const selectableRowIdSet = useMemo(() => new Set(selectableRowIds), [selectableRowIds]);\n const bulkSelectableRowIds = useMemo(\n () =>\n bodyRows\n .filter(row => row.kind === 'data' && !row.disabled && row.selectable !== false)\n .map(row => row.rowId),\n [bodyRows]\n );\n const currentSelectedRowIds = selectedRowIds ?? [];\n const currentSelectedRowIdSet = useMemo(() => new Set(currentSelectedRowIds), [currentSelectedRowIds]);\n const selectedBulkSelectableRowIds = useMemo(\n () => currentSelectedRowIds.filter(rowId => bulkSelectableRowIds.includes(rowId)),\n [currentSelectedRowIds, bulkSelectableRowIds]\n );\n const selectedBulkSelectableRowIdSet = useMemo(\n () => new Set(selectedBulkSelectableRowIds),\n [selectedBulkSelectableRowIds]\n );\n\n const isAllRowsSelected =\n bulkSelectableRowIds.length > 0 &&\n bulkSelectableRowIds.every(rowId => selectedBulkSelectableRowIdSet.has(rowId));\n const isSomeRowsSelected = selectedBulkSelectableRowIdSet.size > 0 && !isAllRowsSelected;\n const hasSelectableRows = bulkSelectableRowIds.length > 0;\n\n const handleToggleAllSelection = () => {\n onSelectionChange?.(isAllRowsSelected ? [] : bulkSelectableRowIds);\n };\n\n const handleToggleRowSelection = (rowId: TableRowId) => {\n if (!onSelectionChange || !selectableRowIdSet.has(rowId)) {\n return;\n }\n\n onSelectionChange(\n currentSelectedRowIdSet.has(rowId)\n ? currentSelectedRowIds.filter(selectedRowId => selectedRowId !== rowId)\n : [...currentSelectedRowIds, rowId]\n );\n };\n\n return {\n currentSelectedRowIds,\n selectedRowIdSet: currentSelectedRowIdSet,\n selectableRowIdSet,\n isAllRowsSelected,\n isSomeRowsSelected,\n hasSelectableRows,\n handleToggleAllSelection,\n handleToggleRowSelection,\n };\n};\n\nexport default useInternalTableSelectionState;\n"],"names":["useInternalTableSelectionState","props","bodyRows","selectedRowIds","onSelectionChange","selectableRowIds","useMemo","row","selectableRowIdSet","bulkSelectableRowIds","currentSelectedRowIds","currentSelectedRowIdSet","selectedBulkSelectableRowIds","rowId","selectedBulkSelectableRowIdSet","isAllRowsSelected","isSomeRowsSelected","hasSelectableRows","selectedRowId"],"mappings":";AAsBA,MAAMA,IAAiC,CACnCC,MACuC;AACvC,QAAM,EAAE,UAAAC,GAAU,gBAAAC,GAAgB,mBAAAC,EAAA,IAAsBH,GAElDI,IAAmBC;AAAA,IACrB,MACIJ,EACK;AAAA,MACG,CAAAK,OAAQA,EAAI,SAAS,UAAUA,EAAI,SAAS,eAAe,CAACA,EAAI,YAAYA,EAAI,eAAe;AAAA,IAAA,EAElG,IAAI,CAAAA,MAAOA,EAAI,KAAK;AAAA,IAC7B,CAACL,CAAQ;AAAA,EAAA,GAEPM,IAAqBF,EAAQ,MAAM,IAAI,IAAID,CAAgB,GAAG,CAACA,CAAgB,CAAC,GAChFI,IAAuBH;AAAA,IACzB,MACIJ,EACK,OAAO,CAAAK,MAAOA,EAAI,SAAS,UAAU,CAACA,EAAI,YAAYA,EAAI,eAAe,EAAK,EAC9E,IAAI,CAAAA,MAAOA,EAAI,KAAK;AAAA,IAC7B,CAACL,CAAQ;AAAA,EAAA,GAEPQ,IAAwBP,KAAkB,CAAA,GAC1CQ,IAA0BL,EAAQ,MAAM,IAAI,IAAII,CAAqB,GAAG,CAACA,CAAqB,CAAC,GAC/FE,IAA+BN;AAAA,IACjC,MAAMI,EAAsB,OAAO,OAASD,EAAqB,SAASI,CAAK,CAAC;AAAA,IAChF,CAACH,GAAuBD,CAAoB;AAAA,EAAA,GAE1CK,IAAiCR;AAAA,IACnC,MAAM,IAAI,IAAIM,CAA4B;AAAA,IAC1C,CAACA,CAA4B;AAAA,EAAA,GAG3BG,IACFN,EAAqB,SAAS,KAC9BA,EAAqB,MAAM,CAAAI,MAASC,EAA+B,IAAID,CAAK,CAAC,GAC3EG,IAAqBF,EAA+B,OAAO,KAAK,CAACC,GACjEE,IAAoBR,EAAqB,SAAS;AAkBxD,SAAO;AAAA,IACH,uBAAAC;AAAA,IACA,kBAAkBC;AAAA,IAClB,oBAAAH;AAAA,IACA,mBAAAO;AAAA,IACA,oBAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,0BAvB6B,MAAM;AACnC,MAAAb,IAAoBW,IAAoB,CAAA,IAAKN,CAAoB;AAAA,IACrE;AAAA,IAsBI,0BApB6B,CAACI,MAAsB;AACpD,MAAI,CAACT,KAAqB,CAACI,EAAmB,IAAIK,CAAK,KAIvDT;AAAA,QACIO,EAAwB,IAAIE,CAAK,IAC3BH,EAAsB,OAAO,CAAAQ,MAAiBA,MAAkBL,CAAK,IACrE,CAAC,GAAGH,GAAuBG,CAAK;AAAA,MAAA;AAAA,IAE9C;AAAA,EAUI;AAER;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TableRowData, TableRowId } from '../Table.types';
|
|
1
|
+
import { TableRowData, TableRowId, TableRowSelectable } from '../Table.types';
|
|
2
2
|
/**
|
|
3
3
|
* Configuration for `useTableSelection`.
|
|
4
4
|
*/
|
|
@@ -17,6 +17,10 @@ export type UseTableSelectionOptions<RowType extends TableRowData> = {
|
|
|
17
17
|
* Optional initially active row id.
|
|
18
18
|
*/
|
|
19
19
|
initialActiveRowId?: TableRowId;
|
|
20
|
+
/**
|
|
21
|
+
* Optional predicate to exclude rows from selection.
|
|
22
|
+
*/
|
|
23
|
+
isRowSelectable?: TableRowSelectable<RowType>;
|
|
20
24
|
/**
|
|
21
25
|
* Optional initially selected row ids.
|
|
22
26
|
*/
|
|
@@ -1,35 +1,46 @@
|
|
|
1
|
-
import { useMemo as
|
|
2
|
-
import { resolveRowKey as
|
|
3
|
-
const
|
|
4
|
-
const { rows:
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
(e)
|
|
1
|
+
import { useMemo as r, useState as d, useEffect as x } from "react";
|
|
2
|
+
import { resolveRowKey as m } from "../model/resolveRowMeta.js";
|
|
3
|
+
const j = (u) => {
|
|
4
|
+
const { rows: o, rowKey: a, initialActiveRowId: w, initialSelectedRowIds: R = [], isRowSelectable: f } = u, h = r(() => o.map((e, t) => m(e, t, a)), [o, a]), S = r(() => new Set(h), [h]), n = r(
|
|
5
|
+
() => o.flatMap((e, t) => {
|
|
6
|
+
const l = m(e, t, a);
|
|
7
|
+
return f?.(e, t) === !1 ? [] : [l];
|
|
8
|
+
}),
|
|
9
|
+
[f, a, o]
|
|
10
|
+
), i = r(() => new Set(n), [n]), [y, g] = d(w), [s, c] = d(R);
|
|
11
|
+
x(() => {
|
|
12
|
+
c((e) => {
|
|
13
|
+
const t = e.filter(
|
|
14
|
+
(l) => S.has(l) && i.has(l)
|
|
15
|
+
);
|
|
16
|
+
return t.length === e.length && t.every((l, M) => l === e[M]) ? e : t;
|
|
17
|
+
}), g(
|
|
18
|
+
(e) => e !== void 0 && S.has(e) ? e : void 0
|
|
8
19
|
);
|
|
9
|
-
}, [
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
(t) => t.includes(e) ? t.filter((
|
|
20
|
+
}, [S, i]);
|
|
21
|
+
const b = (e) => {
|
|
22
|
+
i.has(e) && c(
|
|
23
|
+
(t) => t.includes(e) ? t.filter((l) => l !== e) : [...t, e]
|
|
13
24
|
);
|
|
14
|
-
},
|
|
15
|
-
|
|
16
|
-
},
|
|
17
|
-
|
|
25
|
+
}, A = (e = !n.every((t) => s.includes(t))) => {
|
|
26
|
+
c(e ? n : []);
|
|
27
|
+
}, K = () => {
|
|
28
|
+
c([]);
|
|
18
29
|
};
|
|
19
30
|
return {
|
|
20
|
-
activeRowId:
|
|
21
|
-
selectedRowIds:
|
|
22
|
-
hasSelection:
|
|
23
|
-
isAllSelected:
|
|
24
|
-
isRowSelected: (e) =>
|
|
25
|
-
setActiveRowId:
|
|
26
|
-
setSelectedRowIds:
|
|
27
|
-
toggleRowSelection:
|
|
28
|
-
toggleAllSelection:
|
|
29
|
-
clearSelection:
|
|
31
|
+
activeRowId: y,
|
|
32
|
+
selectedRowIds: s,
|
|
33
|
+
hasSelection: s.length > 0,
|
|
34
|
+
isAllSelected: n.length > 0 && n.every((e) => s.includes(e)),
|
|
35
|
+
isRowSelected: (e) => i.has(e) && s.includes(e),
|
|
36
|
+
setActiveRowId: g,
|
|
37
|
+
setSelectedRowIds: c,
|
|
38
|
+
toggleRowSelection: b,
|
|
39
|
+
toggleAllSelection: A,
|
|
40
|
+
clearSelection: K
|
|
30
41
|
};
|
|
31
42
|
};
|
|
32
43
|
export {
|
|
33
|
-
|
|
44
|
+
j as default
|
|
34
45
|
};
|
|
35
46
|
//# sourceMappingURL=useTableSelection.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTableSelection.js","sources":["../../../../src/components/table/selection/useTableSelection.ts"],"sourcesContent":["import { useEffect, useMemo, useState } from 'react';\n\nimport { resolveRowKey } from '../model/resolveRowMeta';\nimport type { TableRowData, TableRowId } from '../Table.types';\n\n/**\n * Configuration for `useTableSelection`.\n */\nexport type UseTableSelectionOptions<RowType extends TableRowData> = {\n /**\n * Data rows that participate in active-row and selection state.\n */\n rows: RowType[];\n\n /**\n * Optional key accessor used to derive stable row ids.\n *\n * If omitted, the row index is used as a fallback.\n */\n rowKey?: keyof RowType | ((row: RowType, rowIndex: number) => TableRowId);\n\n /**\n * Optional initially active row id.\n */\n initialActiveRowId?: TableRowId;\n\n /**\n * Optional initially selected row ids.\n */\n initialSelectedRowIds?: TableRowId[];\n};\n\n/**\n * Selection and active-row state returned by `useTableSelection`.\n */\nexport type UseTableSelectionReturn = {\n /**\n * Currently active row id.\n */\n activeRowId?: TableRowId;\n\n /**\n * Currently selected row ids.\n */\n selectedRowIds: TableRowId[];\n\n /**\n * Whether at least one row is currently selected.\n */\n hasSelection: boolean;\n\n /**\n * Whether all current rows are selected.\n */\n isAllSelected: boolean;\n\n /**\n * Checks whether a given row id is currently selected.\n */\n isRowSelected: (rowId: TableRowId) => boolean;\n\n /**\n * Sets the current active row id.\n */\n setActiveRowId: (rowId: TableRowId | undefined) => void;\n\n /**\n * Replaces the current selection with the provided row ids.\n */\n setSelectedRowIds: (rowIds: TableRowId[]) => void;\n\n /**\n * Toggles selection state for a single row id.\n */\n toggleRowSelection: (rowId: TableRowId) => void;\n\n /**\n * Selects or deselects all current rows.\n *\n * If `shouldSelect` is omitted, the hook toggles based on the current\n * all-selected state.\n */\n toggleAllSelection: (shouldSelect?: boolean) => void;\n\n /**\n * Clears the current selection.\n */\n clearSelection: () => void;\n};\n\n/**\n * Small helper hook for controlled table demos and simple table integrations\n * that need active-row state plus checkbox selection state.\n *\n * The hook derives stable row ids from `rows` and `rowKey`, keeps the active\n * row and selection in sync when rows change, and provides convenience helpers\n * for single-row and all-row toggling.\n */\nconst useTableSelection = <RowType extends TableRowData>(\n props: UseTableSelectionOptions<RowType>\n): UseTableSelectionReturn => {\n const { rows, rowKey, initialActiveRowId, initialSelectedRowIds = [] } = props;\n\n const rowIds = useMemo(() => rows.map((row, rowIndex) => resolveRowKey(row, rowIndex, rowKey)), [rows, rowKey]);\n const rowIdSet = useMemo(() => new Set(rowIds), [rowIds]);\n\n const [activeRowId, setActiveRowId] = useState<TableRowId | undefined>(initialActiveRowId);\n const [selectedRowIds, setSelectedRowIds] = useState<TableRowId[]>(initialSelectedRowIds);\n\n useEffect(() => {\n setSelectedRowIds(previousSelectedRowIds => previousSelectedRowIds.filter(rowId => rowIdSet.has(rowId)));\n setActiveRowId(previousActiveRowId =>\n previousActiveRowId !== undefined && rowIdSet.has(previousActiveRowId) ? previousActiveRowId : undefined\n );\n }, [rowIdSet]);\n\n const toggleRowSelection = (rowId: TableRowId) => {\n setSelectedRowIds(previousSelectedRowIds =>\n previousSelectedRowIds.includes(rowId)\n ? previousSelectedRowIds.filter(selectedRowId => selectedRowId !== rowId)\n : [...previousSelectedRowIds, rowId]\n );\n };\n\n const toggleAllSelection = (shouldSelect = !
|
|
1
|
+
{"version":3,"file":"useTableSelection.js","sources":["../../../../src/components/table/selection/useTableSelection.ts"],"sourcesContent":["import { useEffect, useMemo, useState } from 'react';\n\nimport { resolveRowKey } from '../model/resolveRowMeta';\nimport type { TableRowData, TableRowId, TableRowSelectable } from '../Table.types';\n\n/**\n * Configuration for `useTableSelection`.\n */\nexport type UseTableSelectionOptions<RowType extends TableRowData> = {\n /**\n * Data rows that participate in active-row and selection state.\n */\n rows: RowType[];\n\n /**\n * Optional key accessor used to derive stable row ids.\n *\n * If omitted, the row index is used as a fallback.\n */\n rowKey?: keyof RowType | ((row: RowType, rowIndex: number) => TableRowId);\n\n /**\n * Optional initially active row id.\n */\n initialActiveRowId?: TableRowId;\n\n /**\n * Optional predicate to exclude rows from selection.\n */\n isRowSelectable?: TableRowSelectable<RowType>;\n\n /**\n * Optional initially selected row ids.\n */\n initialSelectedRowIds?: TableRowId[];\n};\n\n/**\n * Selection and active-row state returned by `useTableSelection`.\n */\nexport type UseTableSelectionReturn = {\n /**\n * Currently active row id.\n */\n activeRowId?: TableRowId;\n\n /**\n * Currently selected row ids.\n */\n selectedRowIds: TableRowId[];\n\n /**\n * Whether at least one row is currently selected.\n */\n hasSelection: boolean;\n\n /**\n * Whether all current rows are selected.\n */\n isAllSelected: boolean;\n\n /**\n * Checks whether a given row id is currently selected.\n */\n isRowSelected: (rowId: TableRowId) => boolean;\n\n /**\n * Sets the current active row id.\n */\n setActiveRowId: (rowId: TableRowId | undefined) => void;\n\n /**\n * Replaces the current selection with the provided row ids.\n */\n setSelectedRowIds: (rowIds: TableRowId[]) => void;\n\n /**\n * Toggles selection state for a single row id.\n */\n toggleRowSelection: (rowId: TableRowId) => void;\n\n /**\n * Selects or deselects all current rows.\n *\n * If `shouldSelect` is omitted, the hook toggles based on the current\n * all-selected state.\n */\n toggleAllSelection: (shouldSelect?: boolean) => void;\n\n /**\n * Clears the current selection.\n */\n clearSelection: () => void;\n};\n\n/**\n * Small helper hook for controlled table demos and simple table integrations\n * that need active-row state plus checkbox selection state.\n *\n * The hook derives stable row ids from `rows` and `rowKey`, keeps the active\n * row and selection in sync when rows change, and provides convenience helpers\n * for single-row and all-row toggling.\n */\nconst useTableSelection = <RowType extends TableRowData>(\n props: UseTableSelectionOptions<RowType>\n): UseTableSelectionReturn => {\n const { rows, rowKey, initialActiveRowId, initialSelectedRowIds = [], isRowSelectable } = props;\n\n const rowIds = useMemo(() => rows.map((row, rowIndex) => resolveRowKey(row, rowIndex, rowKey)), [rows, rowKey]);\n const rowIdSet = useMemo(() => new Set(rowIds), [rowIds]);\n const selectableRowIds = useMemo(\n () =>\n rows.flatMap((row, rowIndex) => {\n const rowId = resolveRowKey(row, rowIndex, rowKey);\n return isRowSelectable?.(row, rowIndex) === false ? [] : [rowId];\n }),\n [isRowSelectable, rowKey, rows]\n );\n const selectableRowIdSet = useMemo(() => new Set(selectableRowIds), [selectableRowIds]);\n\n const [activeRowId, setActiveRowId] = useState<TableRowId | undefined>(initialActiveRowId);\n const [selectedRowIds, setSelectedRowIds] = useState<TableRowId[]>(initialSelectedRowIds);\n\n useEffect(() => {\n setSelectedRowIds(previousSelectedRowIds => {\n const nextSelectedRowIds = previousSelectedRowIds.filter(\n rowId => rowIdSet.has(rowId) && selectableRowIdSet.has(rowId)\n );\n\n return nextSelectedRowIds.length === previousSelectedRowIds.length &&\n nextSelectedRowIds.every((rowId, index) => rowId === previousSelectedRowIds[index])\n ? previousSelectedRowIds\n : nextSelectedRowIds;\n });\n setActiveRowId(previousActiveRowId =>\n previousActiveRowId !== undefined && rowIdSet.has(previousActiveRowId) ? previousActiveRowId : undefined\n );\n }, [rowIdSet, selectableRowIdSet]);\n\n const toggleRowSelection = (rowId: TableRowId) => {\n if (!selectableRowIdSet.has(rowId)) {\n return;\n }\n\n setSelectedRowIds(previousSelectedRowIds =>\n previousSelectedRowIds.includes(rowId)\n ? previousSelectedRowIds.filter(selectedRowId => selectedRowId !== rowId)\n : [...previousSelectedRowIds, rowId]\n );\n };\n\n const toggleAllSelection = (shouldSelect = !selectableRowIds.every(rowId => selectedRowIds.includes(rowId))) => {\n setSelectedRowIds(shouldSelect ? selectableRowIds : []);\n };\n\n const clearSelection = () => {\n setSelectedRowIds([]);\n };\n\n return {\n activeRowId,\n selectedRowIds,\n hasSelection: selectedRowIds.length > 0,\n isAllSelected: selectableRowIds.length > 0 && selectableRowIds.every(rowId => selectedRowIds.includes(rowId)),\n isRowSelected: rowId => selectableRowIdSet.has(rowId) && selectedRowIds.includes(rowId),\n setActiveRowId,\n setSelectedRowIds,\n toggleRowSelection,\n toggleAllSelection,\n clearSelection,\n };\n};\n\nexport default useTableSelection;\n"],"names":["useTableSelection","props","rows","rowKey","initialActiveRowId","initialSelectedRowIds","isRowSelectable","rowIds","useMemo","row","rowIndex","resolveRowKey","rowIdSet","selectableRowIds","rowId","selectableRowIdSet","activeRowId","setActiveRowId","useState","selectedRowIds","setSelectedRowIds","useEffect","previousSelectedRowIds","nextSelectedRowIds","index","previousActiveRowId","toggleRowSelection","selectedRowId","toggleAllSelection","shouldSelect","clearSelection"],"mappings":";;AAuGA,MAAMA,IAAoB,CACtBC,MAC0B;AAC1B,QAAM,EAAE,MAAAC,GAAM,QAAAC,GAAQ,oBAAAC,GAAoB,uBAAAC,IAAwB,CAAA,GAAI,iBAAAC,MAAoBL,GAEpFM,IAASC,EAAQ,MAAMN,EAAK,IAAI,CAACO,GAAKC,MAAaC,EAAcF,GAAKC,GAAUP,CAAM,CAAC,GAAG,CAACD,GAAMC,CAAM,CAAC,GACxGS,IAAWJ,EAAQ,MAAM,IAAI,IAAID,CAAM,GAAG,CAACA,CAAM,CAAC,GAClDM,IAAmBL;AAAA,IACrB,MACIN,EA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MAAM;AACzB,IAAAV,EAAkB,CAAA,CAAE;AAAA,EACxB;AAEA,SAAO;AAAA,IACH,aAAAJ;AAAA,IACA,gBAAAG;AAAA,IACA,cAAcA,EAAe,SAAS;AAAA,IACtC,eAAeN,EAAiB,SAAS,KAAKA,EAAiB,MAAM,CAAAC,MAASK,EAAe,SAASL,CAAK,CAAC;AAAA,IAC5G,eAAe,OAASC,EAAmB,IAAID,CAAK,KAAKK,EAAe,SAASL,CAAK;AAAA,IACtF,gBAAAG;AAAA,IACA,mBAAAG;AAAA,IACA,oBAAAM;AAAA,IACA,oBAAAE;AAAA,IACA,gBAAAE;AAAA,EAAA;AAER;"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const e = (r) => {
|
|
2
|
+
if (typeof r == "number")
|
|
3
|
+
return Number.isFinite(r) ? r : void 0;
|
|
4
|
+
if (!r)
|
|
5
|
+
return;
|
|
6
|
+
const t = r.trim().match(/^(-?\d+(?:\.\d+)?)px$/);
|
|
7
|
+
if (t)
|
|
8
|
+
return Number(t[1]);
|
|
9
|
+
};
|
|
10
|
+
export {
|
|
11
|
+
e as default
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=parsePixelSize.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parsePixelSize.js","sources":["../../../../src/components/table/shared/parsePixelSize.ts"],"sourcesContent":["const parsePixelSize = (value?: string | number): number | undefined => {\n if (typeof value === 'number') {\n return Number.isFinite(value) ? value : undefined;\n }\n\n if (!value) {\n return;\n }\n\n const match = value.trim().match(/^(-?\\d+(?:\\.\\d+)?)px$/);\n\n if (!match) {\n return;\n }\n\n return Number(match[1]);\n};\n\nexport default parsePixelSize;\n"],"names":["parsePixelSize","value","match"],"mappings":"AAAA,MAAMA,IAAiB,CAACC,MAAgD;AACpE,MAAI,OAAOA,KAAU;AACjB,WAAO,OAAO,SAASA,CAAK,IAAIA,IAAQ;AAG5C,MAAI,CAACA;AACD;AAGJ,QAAMC,IAAQD,EAAM,KAAA,EAAO,MAAM,uBAAuB;AAExD,MAAKC;AAIL,WAAO,OAAOA,EAAM,CAAC,CAAC;AAC1B;"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { MutableRefObject, PointerEvent as ReactPointerEvent } from 'react';
|
|
1
|
+
import { MutableRefObject, PointerEvent as ReactPointerEvent, ReactNode, RefObject } from 'react';
|
|
2
2
|
export type DraggablePosition = {
|
|
3
3
|
/**
|
|
4
|
-
* Top offset in pixels relative to the
|
|
4
|
+
* Top offset in pixels relative to the active positioning context.
|
|
5
5
|
*/
|
|
6
6
|
top: number;
|
|
7
7
|
/**
|
|
8
|
-
* Left offset in pixels relative to the
|
|
8
|
+
* Left offset in pixels relative to the active positioning context.
|
|
9
9
|
*/
|
|
10
10
|
left: number;
|
|
11
11
|
/**
|
|
@@ -29,7 +29,29 @@ export type UseDraggableResult<T extends HTMLElement> = {
|
|
|
29
29
|
/**
|
|
30
30
|
* Pointer down handler for the dedicated drag handle element.
|
|
31
31
|
*/
|
|
32
|
-
|
|
32
|
+
onDragHandleDown: (event: ReactPointerEvent<HTMLElement>) => void;
|
|
33
|
+
/**
|
|
34
|
+
* Renders the provided element through the shared portal root in viewport mode.
|
|
35
|
+
* An optional custom target can be passed for specialized overlay hosts.
|
|
36
|
+
* In container mode, the element is returned unchanged and this helper is usually not needed.
|
|
37
|
+
*/
|
|
38
|
+
renderElement: (element: ReactNode, target?: HTMLElement | null) => ReactNode;
|
|
39
|
+
};
|
|
40
|
+
export type UseDraggableElementOptions = {
|
|
41
|
+
/**
|
|
42
|
+
* Defines whether drag coordinates are resolved against the viewport or a collision container.
|
|
43
|
+
* Viewport mode also enables portal rendering via `renderElement`.
|
|
44
|
+
*/
|
|
45
|
+
positioning?: 'viewport' | 'container';
|
|
46
|
+
/**
|
|
47
|
+
* Optional initial position for the draggable element.
|
|
48
|
+
* Use `center` to center the element inside the active positioning context on mount.
|
|
49
|
+
*/
|
|
50
|
+
initialPosition?: 'center' | Pick<DraggablePosition, 'top' | 'left'>;
|
|
51
|
+
/**
|
|
52
|
+
* Optional container whose visible client rect is used as the drag boundary in container mode.
|
|
53
|
+
*/
|
|
54
|
+
collisionContainerRef?: RefObject<HTMLElement | null>;
|
|
33
55
|
};
|
|
34
|
-
declare const useDraggableElement: <T extends HTMLElement = HTMLDivElement>() => UseDraggableResult<T>;
|
|
56
|
+
declare const useDraggableElement: <T extends HTMLElement = HTMLDivElement>(options?: UseDraggableElementOptions) => UseDraggableResult<T>;
|
|
35
57
|
export default useDraggableElement;
|