@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
|
@@ -7,6 +7,7 @@ export type TableViewType = 'TABLE' | 'SINGLE_CARD' | 'MULTI_CARDS';
|
|
|
7
7
|
export type TableSortDirection = 'asc' | 'desc';
|
|
8
8
|
export type TableRowId = string | number;
|
|
9
9
|
export type TableRowData = Record<string, unknown>;
|
|
10
|
+
export type TableStickyReference = 'applicationLayout' | 'container';
|
|
10
11
|
export type TableCardsStyleSettings = {
|
|
11
12
|
/**
|
|
12
13
|
* Minimum card width for `MULTI_CARDS` view.
|
|
@@ -33,6 +34,16 @@ export type TableCardsStyleSettings = {
|
|
|
33
34
|
*/
|
|
34
35
|
contentClassName?: string;
|
|
35
36
|
};
|
|
37
|
+
export type TableResponsiveBreakpoint = {
|
|
38
|
+
/**
|
|
39
|
+
* Switch to `MULTI_CARDS` below this rendered table width.
|
|
40
|
+
*/
|
|
41
|
+
cards?: number | string;
|
|
42
|
+
/**
|
|
43
|
+
* Switch to `SINGLE_CARD` below this rendered table width.
|
|
44
|
+
*/
|
|
45
|
+
list?: number | string;
|
|
46
|
+
};
|
|
36
47
|
/**
|
|
37
48
|
* High-level animation settings for expanded table rows.
|
|
38
49
|
*
|
|
@@ -55,7 +66,16 @@ export type TableStickyColumns = {
|
|
|
55
66
|
*/
|
|
56
67
|
left?: 1;
|
|
57
68
|
/**
|
|
58
|
-
*
|
|
69
|
+
* Number of currently rightmost visible data columns to keep sticky in `TABLE` view.
|
|
70
|
+
*
|
|
71
|
+
* This is position-based and follows column reordering.
|
|
72
|
+
* Selection columns and group rows are ignored.
|
|
73
|
+
*
|
|
74
|
+
* The public API currently supports `1`.
|
|
75
|
+
*/
|
|
76
|
+
right?: 1;
|
|
77
|
+
/**
|
|
78
|
+
* Aligns footer cells with the sticky column behavior.
|
|
59
79
|
*
|
|
60
80
|
* By default, the footer stays independent so it can still span the selection column
|
|
61
81
|
* or the full table width for summary and batch-action use cases.
|
|
@@ -161,6 +181,7 @@ export type TableColumn<RowType extends TableRowData> = TableColumnDefinition<Ro
|
|
|
161
181
|
export type TableRowClassName<RowType extends TableRowData> = string | ((row: RowType, rowIndex: number) => string);
|
|
162
182
|
export type TableCellClassName<RowType extends TableRowData> = (row: RowType, column: TableColumnDefinition<RowType>, rowIndex: number, columnIndex: number) => string;
|
|
163
183
|
export type TableRowAnimationProps<RowType extends TableRowData> = MotionProps | ((row: RowType, rowIndex: number) => MotionProps);
|
|
184
|
+
export type TableRowSelectable<RowType extends TableRowData> = (row: RowType, rowIndex: number) => boolean;
|
|
164
185
|
export type TableProps<RowType extends TableRowData> = Omit<HTMLAttributes<HTMLDivElement>, 'draggable' | 'onClick'> & {
|
|
165
186
|
/**
|
|
166
187
|
* Row key accessor for resolving a stable unique row id.
|
|
@@ -183,6 +204,24 @@ export type TableProps<RowType extends TableRowData> = Omit<HTMLAttributes<HTMLD
|
|
|
183
204
|
* Card width configuration for `MULTI_CARDS` view.
|
|
184
205
|
*/
|
|
185
206
|
cardsStyle?: TableCardsStyleSettings;
|
|
207
|
+
/**
|
|
208
|
+
* Automatically switches `TABLE` view when the rendered table width changes.
|
|
209
|
+
*
|
|
210
|
+
* Use `cards` to switch to `MULTI_CARDS` and `list` to switch to `SINGLE_CARD`.
|
|
211
|
+
* The object may contain either key or both.
|
|
212
|
+
*
|
|
213
|
+
* Accepts pixel numbers or CSS length values such as `720`, `'720px'`, or `'50vw'`.
|
|
214
|
+
*/
|
|
215
|
+
responsiveBreakpoint?: TableResponsiveBreakpoint;
|
|
216
|
+
/**
|
|
217
|
+
* Called whenever the effective rendered view changes after applying responsive breakpoint logic.
|
|
218
|
+
*
|
|
219
|
+
* This can differ from `viewType` when `responsiveBreakpoint` forces an automatic switch.
|
|
220
|
+
* In controlled setups, you can use this callback to keep the external `viewType` state in sync.
|
|
221
|
+
*
|
|
222
|
+
* Only used when `responsiveBreakpoint` is provided.
|
|
223
|
+
*/
|
|
224
|
+
onViewTypeChange?: (viewType: TableViewType) => void;
|
|
186
225
|
/**
|
|
187
226
|
* Compact row/cell spacing like old `table-condensed`.
|
|
188
227
|
*
|
|
@@ -246,16 +285,27 @@ export type TableProps<RowType extends TableRowData> = Omit<HTMLAttributes<HTMLD
|
|
|
246
285
|
* @default '1px'
|
|
247
286
|
*/
|
|
248
287
|
rowSeparatorWidth?: number | string;
|
|
288
|
+
/**
|
|
289
|
+
* Controls which scroll context sticky headers and sticky rows align to in `TABLE` view.
|
|
290
|
+
*
|
|
291
|
+
* Use `applicationLayout` when the page scroll happens in the default app body.
|
|
292
|
+
* Use `container` when the table sits inside its own explicit overflow container.
|
|
293
|
+
*
|
|
294
|
+
* Sticky rows inside `TableBody maxHeight` continue to pin within that internal body scroller.
|
|
295
|
+
*
|
|
296
|
+
* @default 'applicationLayout'
|
|
297
|
+
*/
|
|
298
|
+
stickyReference?: TableStickyReference;
|
|
249
299
|
/**
|
|
250
300
|
* Sticky column behavior in `TABLE` view.
|
|
251
301
|
*
|
|
252
|
-
* `left`
|
|
302
|
+
* `left` and `right` are position-based and follow column reordering.
|
|
253
303
|
* Selection columns and group rows are ignored.
|
|
254
304
|
*
|
|
255
|
-
* The public API currently supports `left: 1`.
|
|
305
|
+
* The public API currently supports `left: 1` and `right: 1`.
|
|
256
306
|
*
|
|
257
307
|
* @example
|
|
258
|
-
* stickyColumns={{ left: 1, footer: true }}
|
|
308
|
+
* stickyColumns={{ left: 1, right: 1, footer: true }}
|
|
259
309
|
*/
|
|
260
310
|
stickyColumns?: TableStickyColumns;
|
|
261
311
|
/**
|
|
@@ -315,6 +365,14 @@ export type TableProps<RowType extends TableRowData> = Omit<HTMLAttributes<HTMLD
|
|
|
315
365
|
* Called when checkbox selection changes.
|
|
316
366
|
*/
|
|
317
367
|
onSelectionChange?: (rowIds: TableRowId[]) => void;
|
|
368
|
+
/**
|
|
369
|
+
* Hides selection checkboxes for rows marked with `selectable={false}`.
|
|
370
|
+
*
|
|
371
|
+
* Those rows stay interactive for hover, click handling, and active-row state.
|
|
372
|
+
*
|
|
373
|
+
* @default false
|
|
374
|
+
*/
|
|
375
|
+
hideSelectionCheckboxesForExcludedRows?: boolean;
|
|
318
376
|
/**
|
|
319
377
|
* Currently selected row keys for multi-selection use cases.
|
|
320
378
|
*/
|
|
@@ -11,7 +11,14 @@ export type TableColumnProps = TableHtmlAttributes & {
|
|
|
11
11
|
children?: ReactNode;
|
|
12
12
|
/**
|
|
13
13
|
* Optional explicit column key.
|
|
14
|
-
*
|
|
14
|
+
*
|
|
15
|
+
* In `TableBody`, this should usually match the `columnKey` of the corresponding
|
|
16
|
+
* `TableHeaderColumn` for the same data column. If omitted, the cell is matched by its position inside
|
|
17
|
+
* the current row.
|
|
18
|
+
*
|
|
19
|
+
* Position-based matching is mainly useful for simple rows that mirror the header
|
|
20
|
+
* order exactly. For spanned cells, reordered columns, or more complex row layouts,
|
|
21
|
+
* prefer an explicit `columnKey`.
|
|
15
22
|
*/
|
|
16
23
|
columnKey?: string;
|
|
17
24
|
/**
|
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import { getVerticalAlignClassName as
|
|
4
|
-
import
|
|
5
|
-
import { resolveAriaSpan as
|
|
6
|
-
import { useOptionalTableInteractionContext as
|
|
7
|
-
import { useOptionalTableLayoutContext as
|
|
8
|
-
import { useOptionalTableRenderConfigContext as
|
|
9
|
-
import { useOptionalTableSection as
|
|
10
|
-
import { useOptionalTableRenderContext as
|
|
11
|
-
const
|
|
1
|
+
import { jsx as b, jsxs as j } from "react/jsx-runtime";
|
|
2
|
+
import c from "../../utils/classNames.js";
|
|
3
|
+
import { getVerticalAlignClassName as I, getHorizontalAlignClassName as L } from "./shared/getAlignClassName.js";
|
|
4
|
+
import T from "./shared/getCellContentOverflowClassName.js";
|
|
5
|
+
import { resolveAriaSpan as H, resolveAriaColIndex as D } from "./shared/resolveTableAria.js";
|
|
6
|
+
import { useOptionalTableInteractionContext as P } from "./context/TableInteractionContext.js";
|
|
7
|
+
import { useOptionalTableLayoutContext as $ } from "./context/TableLayoutContext.js";
|
|
8
|
+
import { useOptionalTableRenderConfigContext as q } from "./context/TableRenderConfigContext.js";
|
|
9
|
+
import { useOptionalTableSection as E, useTableRowContext as G } from "./context/TableStructureContext.js";
|
|
10
|
+
import { useOptionalTableRenderContext as J } from "./context/TableRenderContext.js";
|
|
11
|
+
const ne = (F) => {
|
|
12
12
|
const {
|
|
13
|
-
children:
|
|
13
|
+
children: f,
|
|
14
14
|
className: g,
|
|
15
|
-
colSpan:
|
|
16
|
-
columnKey:
|
|
17
|
-
horizontalAlign:
|
|
18
|
-
overflow:
|
|
19
|
-
preventRowClick:
|
|
20
|
-
value:
|
|
21
|
-
verticalAlign:
|
|
22
|
-
...
|
|
23
|
-
} =
|
|
24
|
-
if (!
|
|
15
|
+
colSpan: h = 1,
|
|
16
|
+
columnKey: t,
|
|
17
|
+
horizontalAlign: M,
|
|
18
|
+
overflow: y = "hidden",
|
|
19
|
+
preventRowClick: m = !1,
|
|
20
|
+
value: p,
|
|
21
|
+
verticalAlign: W,
|
|
22
|
+
...x
|
|
23
|
+
} = F, n = q(), o = J(), d = P(), i = $(), v = E(), a = G(), s = v === "body", r = v === "footer";
|
|
24
|
+
if (!o || !n || !d || !i || o.columns.length === 0 || !s && !r || s && !a)
|
|
25
25
|
return null;
|
|
26
|
-
const N =
|
|
27
|
-
if (
|
|
26
|
+
const N = t !== void 0 ? o.columnIndexByKey.get(t) : void 0, u = a?.nextColumnIndex(N, h) ?? N ?? -1;
|
|
27
|
+
if (u < 0)
|
|
28
28
|
return null;
|
|
29
|
-
const e =
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
key: e?.columnKey ??
|
|
29
|
+
const e = o.columns[u], l = u + 1, B = l + (d.showSelectionColumn ? 1 : 0), w = M ?? e?.horizontalAlign, k = W ?? e?.verticalAlign, S = s && a?.rowData && n.cellClassName?.(
|
|
30
|
+
a.rowData,
|
|
31
|
+
o.columnDefinitionsByKey.get(e?.columnKey ?? t ?? "") ?? {
|
|
32
|
+
key: e?.columnKey ?? t ?? String(l),
|
|
33
33
|
label: e?.label ?? "",
|
|
34
34
|
icon: e?.icon,
|
|
35
35
|
filter: e?.filter,
|
|
@@ -45,64 +45,66 @@ const oe = (T) => {
|
|
|
45
45
|
hideOnMobile: e?.hideOnMobile,
|
|
46
46
|
sortable: e?.sortable
|
|
47
47
|
},
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
),
|
|
51
|
-
|
|
48
|
+
a.rowIndex,
|
|
49
|
+
u
|
|
50
|
+
), z = i.stickyLeftColumnCount ?? 0, A = i.stickyRightColumnCount ?? 0, R = z > 0 && l <= z, O = A > 0 && l > o.columns.length - A, K = e?.mobileLabel ?? (typeof e?.label == "string" ? e.label : ""), C = (V) => {
|
|
51
|
+
V.stopPropagation();
|
|
52
52
|
};
|
|
53
|
-
return
|
|
53
|
+
return r && (o.renderDraft.hasFooterCells = !0), n.isTableView ? /* @__PURE__ */ b(
|
|
54
54
|
"div",
|
|
55
55
|
{
|
|
56
|
-
...
|
|
57
|
-
className:
|
|
56
|
+
...x,
|
|
57
|
+
className: c(
|
|
58
58
|
"table-cell",
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
59
|
+
r && "table-footer-cell",
|
|
60
|
+
s && R && "table-cell-sticky-left-column",
|
|
61
|
+
s && O && "table-cell-sticky-right-column",
|
|
62
|
+
r && i.stickyFooter && R && "table-footer-cell-sticky-left-column",
|
|
63
|
+
r && i.stickyFooter && O && "table-footer-cell-sticky-right-column",
|
|
64
|
+
L(w),
|
|
65
|
+
I(k),
|
|
64
66
|
e?.hideOnMobile && "table-hide-mobile",
|
|
65
|
-
|
|
67
|
+
S,
|
|
66
68
|
g
|
|
67
69
|
),
|
|
68
|
-
"data-column": e?.columnKey ??
|
|
70
|
+
"data-column": e?.columnKey ?? t ?? l,
|
|
69
71
|
role: "cell",
|
|
70
|
-
"aria-colindex":
|
|
71
|
-
"aria-colspan":
|
|
72
|
-
onClick:
|
|
73
|
-
onKeyDown:
|
|
74
|
-
style: { gridColumn: `${
|
|
75
|
-
children: /* @__PURE__ */
|
|
72
|
+
"aria-colindex": D(l, d.showSelectionColumn),
|
|
73
|
+
"aria-colspan": H(h),
|
|
74
|
+
onClick: m ? C : void 0,
|
|
75
|
+
onKeyDown: m ? C : void 0,
|
|
76
|
+
style: { gridColumn: `${B} / span ${h}`, gridRow: "1 / span 1" },
|
|
77
|
+
children: /* @__PURE__ */ b("div", { className: c("table-cell-content", T(y)), children: p ?? f ?? "" })
|
|
76
78
|
}
|
|
77
|
-
) : /* @__PURE__ */
|
|
79
|
+
) : /* @__PURE__ */ j(
|
|
78
80
|
"div",
|
|
79
81
|
{
|
|
80
|
-
...
|
|
81
|
-
className:
|
|
82
|
+
...x,
|
|
83
|
+
className: c(
|
|
82
84
|
"table-cell",
|
|
83
85
|
n.cardClasses.cellClassName,
|
|
84
|
-
|
|
85
|
-
|
|
86
|
+
L(w),
|
|
87
|
+
I(k),
|
|
86
88
|
e?.hideOnMobile && "table-hide-mobile",
|
|
87
|
-
|
|
89
|
+
S,
|
|
88
90
|
g
|
|
89
91
|
),
|
|
90
|
-
"data-column": e?.columnKey ??
|
|
92
|
+
"data-column": e?.columnKey ?? t ?? l,
|
|
91
93
|
role: "cell",
|
|
92
|
-
"aria-colindex":
|
|
93
|
-
onClick:
|
|
94
|
-
onKeyDown:
|
|
94
|
+
"aria-colindex": D(l, d.showSelectionColumn),
|
|
95
|
+
onClick: m ? C : void 0,
|
|
96
|
+
onKeyDown: m ? C : void 0,
|
|
95
97
|
children: [
|
|
96
|
-
|
|
97
|
-
/* @__PURE__ */
|
|
98
|
+
K && /* @__PURE__ */ b("div", { className: c("table-cell-label", n.cardClasses.labelClassName), children: K }),
|
|
99
|
+
/* @__PURE__ */ b(
|
|
98
100
|
"div",
|
|
99
101
|
{
|
|
100
|
-
className:
|
|
102
|
+
className: c(
|
|
101
103
|
"table-cell-content",
|
|
102
104
|
n.cardClasses.contentClassName,
|
|
103
|
-
|
|
105
|
+
T(y)
|
|
104
106
|
),
|
|
105
|
-
children:
|
|
107
|
+
children: p ?? f ?? ""
|
|
106
108
|
}
|
|
107
109
|
)
|
|
108
110
|
]
|
|
@@ -110,6 +112,6 @@ const oe = (T) => {
|
|
|
110
112
|
);
|
|
111
113
|
};
|
|
112
114
|
export {
|
|
113
|
-
|
|
115
|
+
ne as default
|
|
114
116
|
};
|
|
115
117
|
//# sourceMappingURL=TableColumn.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableColumn.js","sources":["../../../src/components/table/TableColumn.tsx"],"sourcesContent":["import type { KeyboardEvent, MouseEvent, ReactNode } from 'react';\n\nimport classNames from '../../utils/classNames';\nimport { getHorizontalAlignClassName, getVerticalAlignClassName } from './shared/getAlignClassName';\nimport getCellContentOverflowClassName from './shared/getCellContentOverflowClassName';\nimport { resolveAriaColIndex, resolveAriaSpan } from './shared/resolveTableAria';\nimport type { TableCellOverflow, TableHorizontalAlign, TableHtmlAttributes, TableVerticalAlign } from './Table.types';\nimport { useOptionalTableInteractionContext } from './context/TableInteractionContext';\nimport { useOptionalTableLayoutContext } from './context/TableLayoutContext';\nimport { useOptionalTableRenderConfigContext } from './context/TableRenderConfigContext';\nimport { useOptionalTableSection, useTableRowContext } from './context/TableStructureContext';\nimport { useOptionalTableRenderContext } from './context/TableRenderContext';\n\nexport type TableColumnProps = TableHtmlAttributes & {\n /**\n * `TableColumn` may be rendered directly inside `TableFooter`.\n *\n * In `TableBody`, columns must be rendered inside a row component such as\n * `TableRow` or `TableExpandedRow`. Direct `TableColumn` children of\n * `TableBody` are ignored.\n */\n children?: ReactNode;\n\n /**\n * Optional explicit column key.\n * If omitted, the cell is matched by its position inside `<TableRow>`.\n */\n columnKey?: string;\n\n /**\n * Optional explicit value.\n */\n value?: ReactNode;\n\n /**\n * Additional classes for this cell only.\n */\n className?: string;\n\n /**\n * Horizontal alignment override for this cell.\n */\n horizontalAlign?: TableHorizontalAlign;\n\n /**\n * Vertical alignment override for this cell.\n */\n verticalAlign?: TableVerticalAlign;\n\n /**\n * Overflow behavior for the cell content wrapper.\n *\n * @default 'hidden'\n */\n overflow?: TableCellOverflow;\n\n /**\n * Number of columns this cell should span.\n *\n * Currently used by header and footer-style declarative table sections.\n */\n colSpan?: number;\n\n /**\n * Prevents clicks and keyboard interactions inside this cell from triggering the parent row click handler.\n *\n * Useful for interactive cell content such as dropdowns, inputs, or buttons.\n *\n * @default false\n */\n preventRowClick?: boolean;\n};\n\nconst TableColumn = (props: TableColumnProps) => {\n const {\n children,\n className,\n colSpan = 1,\n columnKey,\n horizontalAlign,\n overflow = 'hidden',\n preventRowClick = false,\n value,\n verticalAlign,\n ...remainingProps\n } = props;\n\n const renderConfigContext = useOptionalTableRenderConfigContext();\n const renderContext = useOptionalTableRenderContext();\n const interactionContext = useOptionalTableInteractionContext();\n const layoutContext = useOptionalTableLayoutContext();\n const section = useOptionalTableSection();\n const rowContext = useTableRowContext();\n\n const isBodySection = section === 'body';\n const isFooterSection = section === 'footer';\n\n if (\n !renderContext ||\n !renderConfigContext ||\n !interactionContext ||\n !layoutContext ||\n renderContext.columns.length === 0 ||\n (!isBodySection && !isFooterSection)\n ) {\n return null;\n }\n\n if (isBodySection && !rowContext) {\n return null;\n }\n\n const explicitColumnIndex = columnKey !== undefined ? renderContext.columnIndexByKey.get(columnKey) : undefined;\n const columnIndex = rowContext?.nextColumnIndex(explicitColumnIndex, colSpan) ?? explicitColumnIndex ?? -1;\n\n if (columnIndex < 0) {\n return null;\n }\n\n const renderColumn = renderContext.columns[columnIndex];\n const baseColumnStart = columnIndex + 1;\n const resolvedColumnStart = baseColumnStart + (interactionContext.showSelectionColumn ? 1 : 0);\n const resolvedHorizontalAlign = horizontalAlign ?? renderColumn?.horizontalAlign;\n const resolvedVerticalAlign = verticalAlign ?? renderColumn?.verticalAlign;\n\n const resolvedCellClassName =\n isBodySection &&\n rowContext?.rowData &&\n renderConfigContext.cellClassName?.(\n rowContext.rowData,\n renderContext.columnDefinitionsByKey.get(renderColumn?.columnKey ?? columnKey ?? '') ?? {\n key: renderColumn?.columnKey ?? columnKey ?? String(baseColumnStart),\n label: renderColumn?.label ?? '',\n icon: renderColumn?.icon,\n filter: renderColumn?.filter,\n hideLabel: renderColumn?.hideLabel,\n width: renderColumn?.width,\n minResizeWidth: renderColumn?.minResizeWidth,\n maxResizeWidth: renderColumn?.maxResizeWidth,\n draggable: renderColumn?.draggable,\n resizeable: renderColumn?.resizeable,\n horizontalAlign: renderColumn?.horizontalAlign,\n className: undefined,\n headerClassName: renderColumn?.headerClassName,\n hideOnMobile: renderColumn?.hideOnMobile,\n sortable: renderColumn?.sortable,\n },\n rowContext.rowIndex,\n columnIndex\n );\n\n const stickyLeftColumns = layoutContext.stickyLeftColumnCount ?? 0;\n const isStickyLeftColumn = stickyLeftColumns > 0 && baseColumnStart <= stickyLeftColumns;\n\n const mobileLabel =\n renderColumn?.mobileLabel ?? (typeof renderColumn?.label === 'string' ? renderColumn.label : '');\n\n const handleCellInteraction = (event: KeyboardEvent<HTMLDivElement> | MouseEvent<HTMLDivElement>) => {\n event.stopPropagation();\n };\n\n if (isFooterSection) {\n renderContext.renderDraft.hasFooterCells = true;\n }\n\n if (renderConfigContext.isTableView) {\n return (\n <div\n {...remainingProps}\n className={classNames(\n 'table-cell',\n isFooterSection && 'table-footer-cell',\n isBodySection && isStickyLeftColumn && 'table-cell-sticky-left-column',\n isFooterSection &&\n layoutContext.stickyFooter &&\n isStickyLeftColumn &&\n 'table-footer-cell-sticky-left-column',\n getHorizontalAlignClassName(resolvedHorizontalAlign),\n getVerticalAlignClassName(resolvedVerticalAlign),\n renderColumn?.hideOnMobile && 'table-hide-mobile',\n resolvedCellClassName,\n className\n )}\n data-column={renderColumn?.columnKey ?? columnKey ?? baseColumnStart}\n role='cell'\n aria-colindex={resolveAriaColIndex(baseColumnStart, interactionContext.showSelectionColumn)}\n aria-colspan={resolveAriaSpan(colSpan)}\n onClick={preventRowClick ? handleCellInteraction : undefined}\n onKeyDown={preventRowClick ? handleCellInteraction : undefined}\n style={{ gridColumn: `${resolvedColumnStart} / span ${colSpan}` }}\n >\n <div className={classNames('table-cell-content', getCellContentOverflowClassName(overflow))}>\n {value ?? children ?? ''}\n </div>\n </div>\n );\n }\n\n return (\n <div\n {...remainingProps}\n className={classNames(\n 'table-cell',\n renderConfigContext.cardClasses.cellClassName,\n getHorizontalAlignClassName(resolvedHorizontalAlign),\n getVerticalAlignClassName(resolvedVerticalAlign),\n renderColumn?.hideOnMobile && 'table-hide-mobile',\n resolvedCellClassName,\n className\n )}\n data-column={renderColumn?.columnKey ?? columnKey ?? baseColumnStart}\n role='cell'\n aria-colindex={resolveAriaColIndex(baseColumnStart, interactionContext.showSelectionColumn)}\n onClick={preventRowClick ? handleCellInteraction : undefined}\n onKeyDown={preventRowClick ? handleCellInteraction : undefined}\n >\n {mobileLabel && (\n <div className={classNames('table-cell-label', renderConfigContext.cardClasses.labelClassName)}>\n {mobileLabel}\n </div>\n )}\n <div\n className={classNames(\n 'table-cell-content',\n renderConfigContext.cardClasses.contentClassName,\n getCellContentOverflowClassName(overflow)\n )}\n >\n {value ?? children ?? ''}\n </div>\n </div>\n );\n};\n\nexport default TableColumn;\n"],"names":["TableColumn","props","children","className","colSpan","columnKey","horizontalAlign","overflow","preventRowClick","value","verticalAlign","remainingProps","renderConfigContext","useOptionalTableRenderConfigContext","renderContext","useOptionalTableRenderContext","interactionContext","useOptionalTableInteractionContext","layoutContext","useOptionalTableLayoutContext","section","useOptionalTableSection","rowContext","useTableRowContext","isBodySection","isFooterSection","explicitColumnIndex","columnIndex","renderColumn","baseColumnStart","resolvedColumnStart","resolvedHorizontalAlign","resolvedVerticalAlign","resolvedCellClassName","stickyLeftColumns","isStickyLeftColumn","mobileLabel","handleCellInteraction","event","jsx","classNames","getHorizontalAlignClassName","getVerticalAlignClassName","resolveAriaColIndex","resolveAriaSpan","getCellContentOverflowClassName","jsxs"],"mappings":";;;;;;;;;;AAyEA,MAAMA,KAAc,CAACC,MAA4B;AAC7C,QAAM;AAAA,IACF,UAAAC;AAAA,IACA,WAAAC;AAAA,IACA,SAAAC,IAAU;AAAA,IACV,WAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,UAAAC,IAAW;AAAA,IACX,iBAAAC,IAAkB;AAAA,IAClB,OAAAC;AAAA,IACA,eAAAC;AAAA,IACA,GAAGC;AAAA,EAAA,IACHV,GAEEW,IAAsBC,EAAA,GACtBC,IAAgBC,EAAA,GAChBC,IAAqBC,EAAA,GACrBC,IAAgBC,EAAA,GAChBC,IAAUC,EAAA,GACVC,IAAaC,EAAA,GAEbC,IAAgBJ,MAAY,QAC5BK,IAAkBL,MAAY;AAapC,MAVI,CAACN,KACD,CAACF,KACD,CAACI,KACD,CAACE,KACDJ,EAAc,QAAQ,WAAW,KAChC,CAACU,KAAiB,CAACC,KAKpBD,KAAiB,CAACF;AAClB,WAAO;AAGX,QAAMI,IAAsBrB,MAAc,SAAYS,EAAc,iBAAiB,IAAIT,CAAS,IAAI,QAChGsB,IAAcL,GAAY,gBAAgBI,GAAqBtB,CAAO,KAAKsB,KAAuB;AAExG,MAAIC,IAAc;AACd,WAAO;AAGX,QAAMC,IAAed,EAAc,QAAQa,CAAW,GAChDE,IAAkBF,IAAc,GAChCG,IAAsBD,KAAmBb,EAAmB,sBAAsB,IAAI,IACtFe,IAA0BzB,KAAmBsB,GAAc,iBAC3DI,IAAwBtB,KAAiBkB,GAAc,eAEvDK,IACFT,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":["import type { KeyboardEvent, MouseEvent, ReactNode } from 'react';\n\nimport classNames from '../../utils/classNames';\nimport { getHorizontalAlignClassName, getVerticalAlignClassName } from './shared/getAlignClassName';\nimport getCellContentOverflowClassName from './shared/getCellContentOverflowClassName';\nimport { resolveAriaColIndex, resolveAriaSpan } from './shared/resolveTableAria';\nimport type { TableCellOverflow, TableHorizontalAlign, TableHtmlAttributes, TableVerticalAlign } from './Table.types';\nimport { useOptionalTableInteractionContext } from './context/TableInteractionContext';\nimport { useOptionalTableLayoutContext } from './context/TableLayoutContext';\nimport { useOptionalTableRenderConfigContext } from './context/TableRenderConfigContext';\nimport { useOptionalTableSection, useTableRowContext } from './context/TableStructureContext';\nimport { useOptionalTableRenderContext } from './context/TableRenderContext';\n\nexport type TableColumnProps = TableHtmlAttributes & {\n /**\n * `TableColumn` may be rendered directly inside `TableFooter`.\n *\n * In `TableBody`, columns must be rendered inside a row component such as\n * `TableRow` or `TableExpandedRow`. Direct `TableColumn` children of\n * `TableBody` are ignored.\n */\n children?: ReactNode;\n\n /**\n * Optional explicit column key.\n *\n * In `TableBody`, this should usually match the `columnKey` of the corresponding\n * `TableHeaderColumn` for the same data column. If omitted, the cell is matched by its position inside\n * the current row.\n *\n * Position-based matching is mainly useful for simple rows that mirror the header\n * order exactly. For spanned cells, reordered columns, or more complex row layouts,\n * prefer an explicit `columnKey`.\n */\n columnKey?: string;\n\n /**\n * Optional explicit value.\n */\n value?: ReactNode;\n\n /**\n * Additional classes for this cell only.\n */\n className?: string;\n\n /**\n * Horizontal alignment override for this cell.\n */\n horizontalAlign?: TableHorizontalAlign;\n\n /**\n * Vertical alignment override for this cell.\n */\n verticalAlign?: TableVerticalAlign;\n\n /**\n * Overflow behavior for the cell content wrapper.\n *\n * @default 'hidden'\n */\n overflow?: TableCellOverflow;\n\n /**\n * Number of columns this cell should span.\n *\n * Currently used by header and footer-style declarative table sections.\n */\n colSpan?: number;\n\n /**\n * Prevents clicks and keyboard interactions inside this cell from triggering the parent row click handler.\n *\n * Useful for interactive cell content such as dropdowns, inputs, or buttons.\n *\n * @default false\n */\n preventRowClick?: boolean;\n};\n\nconst TableColumn = (props: TableColumnProps) => {\n const {\n children,\n className,\n colSpan = 1,\n columnKey,\n horizontalAlign,\n overflow = 'hidden',\n preventRowClick = false,\n value,\n verticalAlign,\n ...remainingProps\n } = props;\n\n const renderConfigContext = useOptionalTableRenderConfigContext();\n const renderContext = useOptionalTableRenderContext();\n const interactionContext = useOptionalTableInteractionContext();\n const layoutContext = useOptionalTableLayoutContext();\n const section = useOptionalTableSection();\n const rowContext = useTableRowContext();\n\n const isBodySection = section === 'body';\n const isFooterSection = section === 'footer';\n\n if (\n !renderContext ||\n !renderConfigContext ||\n !interactionContext ||\n !layoutContext ||\n renderContext.columns.length === 0 ||\n (!isBodySection && !isFooterSection)\n ) {\n return null;\n }\n\n if (isBodySection && !rowContext) {\n return null;\n }\n\n const explicitColumnIndex = columnKey !== undefined ? renderContext.columnIndexByKey.get(columnKey) : undefined;\n const columnIndex = rowContext?.nextColumnIndex(explicitColumnIndex, colSpan) ?? explicitColumnIndex ?? -1;\n\n if (columnIndex < 0) {\n return null;\n }\n\n const renderColumn = renderContext.columns[columnIndex];\n const baseColumnStart = columnIndex + 1;\n const resolvedColumnStart = baseColumnStart + (interactionContext.showSelectionColumn ? 1 : 0);\n const resolvedHorizontalAlign = horizontalAlign ?? renderColumn?.horizontalAlign;\n const resolvedVerticalAlign = verticalAlign ?? renderColumn?.verticalAlign;\n\n const resolvedCellClassName =\n isBodySection &&\n rowContext?.rowData &&\n renderConfigContext.cellClassName?.(\n rowContext.rowData,\n renderContext.columnDefinitionsByKey.get(renderColumn?.columnKey ?? columnKey ?? '') ?? {\n key: renderColumn?.columnKey ?? columnKey ?? String(baseColumnStart),\n label: renderColumn?.label ?? '',\n icon: renderColumn?.icon,\n filter: renderColumn?.filter,\n hideLabel: renderColumn?.hideLabel,\n width: renderColumn?.width,\n minResizeWidth: renderColumn?.minResizeWidth,\n maxResizeWidth: renderColumn?.maxResizeWidth,\n draggable: renderColumn?.draggable,\n resizeable: renderColumn?.resizeable,\n horizontalAlign: renderColumn?.horizontalAlign,\n className: undefined,\n headerClassName: renderColumn?.headerClassName,\n hideOnMobile: renderColumn?.hideOnMobile,\n sortable: renderColumn?.sortable,\n },\n rowContext.rowIndex,\n columnIndex\n );\n\n const stickyLeftColumns = layoutContext.stickyLeftColumnCount ?? 0;\n const stickyRightColumns = layoutContext.stickyRightColumnCount ?? 0;\n const isStickyLeftColumn = stickyLeftColumns > 0 && baseColumnStart <= stickyLeftColumns;\n const isStickyRightColumn =\n stickyRightColumns > 0 && baseColumnStart > renderContext.columns.length - stickyRightColumns;\n\n const mobileLabel =\n renderColumn?.mobileLabel ?? (typeof renderColumn?.label === 'string' ? renderColumn.label : '');\n\n const handleCellInteraction = (event: KeyboardEvent<HTMLDivElement> | MouseEvent<HTMLDivElement>) => {\n event.stopPropagation();\n };\n\n if (isFooterSection) {\n renderContext.renderDraft.hasFooterCells = true;\n }\n\n if (renderConfigContext.isTableView) {\n return (\n <div\n {...remainingProps}\n className={classNames(\n 'table-cell',\n isFooterSection && 'table-footer-cell',\n isBodySection && isStickyLeftColumn && 'table-cell-sticky-left-column',\n isBodySection && isStickyRightColumn && 'table-cell-sticky-right-column',\n isFooterSection &&\n layoutContext.stickyFooter &&\n isStickyLeftColumn &&\n 'table-footer-cell-sticky-left-column',\n isFooterSection &&\n layoutContext.stickyFooter &&\n isStickyRightColumn &&\n 'table-footer-cell-sticky-right-column',\n getHorizontalAlignClassName(resolvedHorizontalAlign),\n getVerticalAlignClassName(resolvedVerticalAlign),\n renderColumn?.hideOnMobile && 'table-hide-mobile',\n resolvedCellClassName,\n className\n )}\n data-column={renderColumn?.columnKey ?? columnKey ?? baseColumnStart}\n role='cell'\n aria-colindex={resolveAriaColIndex(baseColumnStart, interactionContext.showSelectionColumn)}\n aria-colspan={resolveAriaSpan(colSpan)}\n onClick={preventRowClick ? handleCellInteraction : undefined}\n onKeyDown={preventRowClick ? handleCellInteraction : undefined}\n style={{ gridColumn: `${resolvedColumnStart} / span ${colSpan}`, gridRow: '1 / span 1' }}\n >\n <div className={classNames('table-cell-content', getCellContentOverflowClassName(overflow))}>\n {value ?? children ?? ''}\n </div>\n </div>\n );\n }\n\n return (\n <div\n {...remainingProps}\n className={classNames(\n 'table-cell',\n renderConfigContext.cardClasses.cellClassName,\n getHorizontalAlignClassName(resolvedHorizontalAlign),\n getVerticalAlignClassName(resolvedVerticalAlign),\n renderColumn?.hideOnMobile && 'table-hide-mobile',\n resolvedCellClassName,\n className\n )}\n data-column={renderColumn?.columnKey ?? columnKey ?? baseColumnStart}\n role='cell'\n aria-colindex={resolveAriaColIndex(baseColumnStart, interactionContext.showSelectionColumn)}\n onClick={preventRowClick ? handleCellInteraction : undefined}\n onKeyDown={preventRowClick ? handleCellInteraction : undefined}\n >\n {mobileLabel && (\n <div className={classNames('table-cell-label', renderConfigContext.cardClasses.labelClassName)}>\n {mobileLabel}\n </div>\n )}\n <div\n className={classNames(\n 'table-cell-content',\n renderConfigContext.cardClasses.contentClassName,\n getCellContentOverflowClassName(overflow)\n )}\n >\n {value ?? children ?? ''}\n </div>\n </div>\n );\n};\n\nexport default TableColumn;\n"],"names":["TableColumn","props","children","className","colSpan","columnKey","horizontalAlign","overflow","preventRowClick","value","verticalAlign","remainingProps","renderConfigContext","useOptionalTableRenderConfigContext","renderContext","useOptionalTableRenderContext","interactionContext","useOptionalTableInteractionContext","layoutContext","useOptionalTableLayoutContext","section","useOptionalTableSection","rowContext","useTableRowContext","isBodySection","isFooterSection","explicitColumnIndex","columnIndex","renderColumn","baseColumnStart","resolvedColumnStart","resolvedHorizontalAlign","resolvedVerticalAlign","resolvedCellClassName","stickyLeftColumns","stickyRightColumns","isStickyLeftColumn","isStickyRightColumn","mobileLabel","handleCellInteraction","event","jsx","classNames","getHorizontalAlignClassName","getVerticalAlignClassName","resolveAriaColIndex","resolveAriaSpan","getCellContentOverflowClassName","jsxs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AAW/B,IAAkB+B,IAAwB;AAAA,MACrD,OAAO,EAAE,YAAY,GAAGT,CAAmB,WAAW1B,CAAO,IAAI,SAAS,aAAA;AAAA,MAE1E,UAAA,gBAAAqC,EAAC,OAAA,EAAI,WAAWC,EAAW,sBAAsBK,EAAgCxC,CAAQ,CAAC,GACrF,UAAAE,KAASP,KAAY,GAAA,CAC1B;AAAA,IAAA;AAAA,EAAA,IAMR,gBAAA8C;AAAA,IAAC;AAAA,IAAA;AAAA,MACI,GAAGrC;AAAA,MACJ,WAAW+B;AAAA,QACP;AAAA,QACA9B,EAAoB,YAAY;AAAA,QAChC+B,EAA4BZ,CAAuB;AAAA,QACnDa,EAA0BZ,CAAqB;AAAA,QAC/CJ,GAAc,gBAAgB;AAAA,QAC9BK;AAAA,QACA9B;AAAA,MAAA;AAAA,MAEJ,eAAayB,GAAc,aAAavB,KAAawB;AAAA,MACrD,MAAK;AAAA,MACL,iBAAegB,EAAoBhB,GAAiBb,EAAmB,mBAAmB;AAAA,MAC1F,SAASR,IAAkB+B,IAAwB;AAAA,MACnD,WAAW/B,IAAkB+B,IAAwB;AAAA,MAEpD,UAAA;AAAA,QAAAD,KACG,gBAAAG,EAAC,SAAI,WAAWC,EAAW,oBAAoB9B,EAAoB,YAAY,cAAc,GACxF,UAAA0B,EAAA,CACL;AAAA,QAEJ,gBAAAG;AAAA,UAAC;AAAA,UAAA;AAAA,YACG,WAAWC;AAAA,cACP;AAAA,cACA9B,EAAoB,YAAY;AAAA,cAChCmC,EAAgCxC,CAAQ;AAAA,YAAA;AAAA,YAG3C,eAASL,KAAY;AAAA,UAAA;AAAA,QAAA;AAAA,MAC1B;AAAA,IAAA;AAAA,EAAA;AAGZ;"}
|
|
@@ -9,6 +9,10 @@ export type TableExpandedRowProps<RowType extends TableRowData> = TableHtmlAttri
|
|
|
9
9
|
* Optional class names only for this expanded row.
|
|
10
10
|
*/
|
|
11
11
|
className?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Excludes this row from table selection while keeping the row interactive.
|
|
14
|
+
*/
|
|
15
|
+
selectable?: boolean;
|
|
12
16
|
/**
|
|
13
17
|
* Disable table hover styling for this row.
|
|
14
18
|
*/
|
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
import { jsx as s, jsxs as
|
|
2
|
-
import { useReducedMotion as
|
|
3
|
-
import { useRef as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import { resolveRowKey as
|
|
7
|
-
import { useOptionalTableInteractionContext as
|
|
8
|
-
import { useOptionalTableRenderConfigContext as
|
|
9
|
-
import { useOptionalTableSection as
|
|
10
|
-
import { useOptionalTableRenderContext as
|
|
11
|
-
import { getInteractiveRowProps as
|
|
12
|
-
const
|
|
13
|
-
const { isSelected:
|
|
1
|
+
import { jsx as s, jsxs as M, Fragment as j } from "react/jsx-runtime";
|
|
2
|
+
import { useReducedMotion as B, motion as H } from "motion/react";
|
|
3
|
+
import { useRef as U, useState as L, useMemo as W } from "react";
|
|
4
|
+
import X from "../checkbox/Checkbox.js";
|
|
5
|
+
import P from "../../utils/classNames.js";
|
|
6
|
+
import { resolveRowKey as q, resolveRowClassName as z } from "./model/resolveRowMeta.js";
|
|
7
|
+
import { useOptionalTableInteractionContext as G } from "./context/TableInteractionContext.js";
|
|
8
|
+
import { useOptionalTableRenderConfigContext as J } from "./context/TableRenderConfigContext.js";
|
|
9
|
+
import { useOptionalTableSection as Q, useTableBodyContext as Y, extractTableHtmlAttributes as A, TableRowContext as Z } from "./context/TableStructureContext.js";
|
|
10
|
+
import { useOptionalTableRenderContext as $ } from "./context/TableRenderContext.js";
|
|
11
|
+
import { getInteractiveRowProps as ee } from "./shared/getInteractiveRowProps.js";
|
|
12
|
+
const p = 0.18, oe = (b) => {
|
|
13
|
+
const { isSelected: C, isSelectable: u, hideSelectionControl: R, isTableView: x, onToggleSelection: h, cardCellClassName: r } = b;
|
|
14
14
|
return /* @__PURE__ */ s(
|
|
15
15
|
"div",
|
|
16
16
|
{
|
|
17
|
-
className:
|
|
17
|
+
className: P("table-cell table-selection-cell", !x && r),
|
|
18
18
|
role: "cell",
|
|
19
19
|
"aria-colindex": 1,
|
|
20
|
-
style:
|
|
21
|
-
onClick: (
|
|
22
|
-
onKeyDown: (
|
|
23
|
-
children: /* @__PURE__ */ s("div", { className: "table-selection-control", children: /* @__PURE__ */ s(
|
|
20
|
+
style: x ? { gridColumn: "1 / span 1", gridRow: "1 / span 1" } : void 0,
|
|
21
|
+
onClick: (e) => e.stopPropagation(),
|
|
22
|
+
onKeyDown: (e) => e.stopPropagation(),
|
|
23
|
+
children: !R && /* @__PURE__ */ s("div", { className: "table-selection-control", children: /* @__PURE__ */ s(X, { checked: C, disabled: !u, onChange: h }) })
|
|
24
24
|
}
|
|
25
25
|
);
|
|
26
|
-
},
|
|
27
|
-
const { children:
|
|
28
|
-
|
|
29
|
-
const [
|
|
30
|
-
() =>
|
|
26
|
+
}, pe = (b) => {
|
|
27
|
+
const { children: C, className: u, noHover: R, parentKey: x, selectable: h, ...r } = b, e = J(), l = $(), o = G(), k = Q(), y = Y(), m = U(0);
|
|
28
|
+
m.current = 0;
|
|
29
|
+
const [D, f] = L(!0), v = B(), O = W(
|
|
30
|
+
() => v ? {
|
|
31
31
|
initial: { opacity: 0 },
|
|
32
32
|
animate: {
|
|
33
33
|
opacity: 1,
|
|
34
|
-
transition: { duration:
|
|
34
|
+
transition: { duration: p, ease: "easeInOut" }
|
|
35
35
|
},
|
|
36
36
|
exit: {
|
|
37
37
|
opacity: 0,
|
|
38
|
-
transition: { duration:
|
|
38
|
+
transition: { duration: p, ease: "easeInOut" }
|
|
39
39
|
}
|
|
40
40
|
} : {
|
|
41
41
|
initial: { opacity: 0, height: 0, y: -8 },
|
|
@@ -43,108 +43,111 @@ const u = 0.18, $ = (C) => {
|
|
|
43
43
|
opacity: 1,
|
|
44
44
|
height: "auto",
|
|
45
45
|
y: 0,
|
|
46
|
-
transition: { duration:
|
|
46
|
+
transition: { duration: p, ease: "easeOut" }
|
|
47
47
|
},
|
|
48
48
|
exit: {
|
|
49
49
|
opacity: 0,
|
|
50
50
|
height: 0,
|
|
51
51
|
y: -8,
|
|
52
|
-
transition: { duration:
|
|
52
|
+
transition: { duration: p, ease: "easeInOut" }
|
|
53
53
|
}
|
|
54
54
|
},
|
|
55
|
-
[
|
|
55
|
+
[v]
|
|
56
56
|
);
|
|
57
|
-
if (!l || !e || !o || l.columns.length === 0 ||
|
|
57
|
+
if (!l || !e || !o || l.columns.length === 0 || k !== "body" || !y)
|
|
58
58
|
return null;
|
|
59
|
-
const c =
|
|
59
|
+
const c = r, n = y.nextRowIndex(), t = q(c, n, e.rowKey), K = typeof e.rowAnimationProps == "function" ? e.rowAnimationProps(c, n) : e.rowAnimationProps, i = ee({
|
|
60
60
|
isClickable: o.isClickable,
|
|
61
|
-
onRowClick: (
|
|
62
|
-
o.onRowClick?.(
|
|
61
|
+
onRowClick: (a, d) => {
|
|
62
|
+
o.onRowClick?.(a, d), o.onActiveRowChange?.(
|
|
63
63
|
o.activeRowId === t ? void 0 : t,
|
|
64
|
-
|
|
64
|
+
a,
|
|
65
65
|
d
|
|
66
66
|
);
|
|
67
67
|
},
|
|
68
68
|
row: c,
|
|
69
69
|
rowIndex: n
|
|
70
70
|
});
|
|
71
|
-
let
|
|
72
|
-
e.expandedRowAnimation !== !1 && (
|
|
73
|
-
...
|
|
74
|
-
...
|
|
71
|
+
let w;
|
|
72
|
+
e.expandedRowAnimation !== !1 && (w = {
|
|
73
|
+
...O,
|
|
74
|
+
...K
|
|
75
75
|
});
|
|
76
|
-
const
|
|
76
|
+
const g = o.selectableRowIdSet.has(t), S = g && o.selectedRowIdSet.has(t), T = P(
|
|
77
77
|
"table-row",
|
|
78
78
|
"table-row-expanded-data",
|
|
79
79
|
!e.isTableView && "divider-y-1 divider-color-lighter divider-style-solid",
|
|
80
80
|
o.activeRowId === t && "table-row-active",
|
|
81
|
-
|
|
81
|
+
S && "table-row-selected",
|
|
82
82
|
i.isClickableClassName,
|
|
83
|
-
|
|
83
|
+
R && "table-row-no-hover",
|
|
84
84
|
!e.isTableView && e.cardClasses.rowClassName,
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
),
|
|
88
|
-
|
|
85
|
+
u,
|
|
86
|
+
z(e.rowClassName, c, n)
|
|
87
|
+
), E = o.showSelectionColumn && /* @__PURE__ */ s(
|
|
88
|
+
oe,
|
|
89
89
|
{
|
|
90
|
-
isSelected:
|
|
90
|
+
isSelected: S,
|
|
91
|
+
isSelectable: g,
|
|
92
|
+
hideSelectionControl: !g && o.hideSelectionCheckboxesForExcludedRows,
|
|
91
93
|
isTableView: e.isTableView,
|
|
92
94
|
onToggleSelection: () => o.onToggleRowSelection?.(t),
|
|
93
95
|
cardCellClassName: e.cardClasses.cellClassName
|
|
94
96
|
}
|
|
95
|
-
),
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
] }),
|
|
99
|
-
...
|
|
100
|
-
className:
|
|
97
|
+
), I = /* @__PURE__ */ M(j, { children: [
|
|
98
|
+
E,
|
|
99
|
+
C
|
|
100
|
+
] }), V = {
|
|
101
|
+
...A(r),
|
|
102
|
+
className: T,
|
|
101
103
|
"data-index": n,
|
|
102
104
|
"data-row-id": String(t),
|
|
103
105
|
onClick: i.onClick,
|
|
104
106
|
onKeyDown: i.onKeyDown,
|
|
105
107
|
role: "row",
|
|
106
108
|
tabIndex: i.tabIndex
|
|
107
|
-
},
|
|
108
|
-
...
|
|
109
|
-
className:
|
|
109
|
+
}, _ = {
|
|
110
|
+
...A(r),
|
|
111
|
+
className: T,
|
|
110
112
|
"data-index": n,
|
|
111
113
|
"data-row-id": String(t),
|
|
112
114
|
onClick: i.onClick,
|
|
113
115
|
onKeyDown: i.onKeyDown,
|
|
114
116
|
role: "row",
|
|
115
117
|
tabIndex: i.tabIndex,
|
|
116
|
-
onAnimationStart: () =>
|
|
117
|
-
onAnimationComplete: () =>
|
|
118
|
-
...
|
|
118
|
+
onAnimationStart: () => f(!0),
|
|
119
|
+
onAnimationComplete: () => f(!1),
|
|
120
|
+
...w,
|
|
119
121
|
style: {
|
|
120
|
-
...
|
|
121
|
-
overflow:
|
|
122
|
+
...w?.style ?? {},
|
|
123
|
+
overflow: D ? "hidden" : "visible"
|
|
122
124
|
}
|
|
123
125
|
}, N = /* @__PURE__ */ s(
|
|
124
|
-
|
|
126
|
+
Z.Provider,
|
|
125
127
|
{
|
|
126
128
|
value: {
|
|
127
|
-
nextColumnIndex: (
|
|
128
|
-
if (
|
|
129
|
-
return
|
|
130
|
-
const
|
|
131
|
-
return
|
|
129
|
+
nextColumnIndex: (a, d = 1) => {
|
|
130
|
+
if (a !== void 0 && a >= 0)
|
|
131
|
+
return m.current = a + d, a;
|
|
132
|
+
const F = m.current;
|
|
133
|
+
return m.current += d, F;
|
|
132
134
|
},
|
|
133
135
|
rowIndex: n,
|
|
134
136
|
rowId: t,
|
|
135
137
|
rowData: c
|
|
136
138
|
},
|
|
137
|
-
children:
|
|
139
|
+
children: w ? /* @__PURE__ */ s(H.div, { ..._, children: I }) : /* @__PURE__ */ s("div", { ...V, children: I })
|
|
138
140
|
}
|
|
139
141
|
);
|
|
140
142
|
return l.renderDraft.hasExpandableRows = !0, l.renderDraft.bodyRows.push({
|
|
141
143
|
rowId: t,
|
|
142
144
|
rowIndex: n,
|
|
143
145
|
kind: "expanded",
|
|
146
|
+
selectable: h !== !1,
|
|
144
147
|
render: () => N
|
|
145
148
|
}), l.isRegisteringBodyRows ? null : N;
|
|
146
149
|
};
|
|
147
150
|
export {
|
|
148
|
-
|
|
151
|
+
pe as default
|
|
149
152
|
};
|
|
150
153
|
//# sourceMappingURL=TableExpandedRow.js.map
|