@rio-cloud/rio-uikit 2.3.0-beta.3 → 2.4.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/MapPreviousViewportButton.d.ts +2 -0
- package/MapPreviousViewportButton.js +5 -0
- package/MapPreviousViewportButton.js.map +1 -0
- package/Table.js +16 -14
- package/TableNext.js +16 -14
- package/TableRowActionsDropdown.d.ts +2 -0
- package/TableRowActionsDropdown.js +5 -0
- package/TableRowActionsDropdown.js.map +1 -0
- 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/map/components/Map.js +219 -182
- package/components/map/components/Map.js.map +1 -1
- package/components/map/components/MapContext.d.ts +4 -0
- package/components/map/components/MapContext.js +11 -7
- package/components/map/components/MapContext.js.map +1 -1
- package/components/map/components/MapPosition.d.ts +1 -1
- package/components/map/components/MapPosition.js +20 -13
- package/components/map/components/MapPosition.js.map +1 -1
- package/components/map/components/features/MapZoom.d.ts +0 -1
- package/components/map/components/features/MapZoom.js +12 -20
- package/components/map/components/features/MapZoom.js.map +1 -1
- package/components/map/components/features/settings/MapSettingsTile.d.ts +27 -0
- package/components/map/components/features/settings/MapSettingsTile.js +17 -17
- package/components/map/components/features/settings/MapSettingsTile.js.map +1 -1
- package/components/map/components/features/settings/buttons/MapPreviousViewportButton.d.ts +10 -0
- package/components/map/components/features/settings/buttons/MapPreviousViewportButton.js +23 -0
- package/components/map/components/features/settings/buttons/MapPreviousViewportButton.js.map +1 -0
- package/components/map/hooks/useMapViewportHistory.d.ts +19 -0
- package/components/map/hooks/useMapViewportHistory.js +116 -0
- package/components/map/hooks/useMapViewportHistory.js.map +1 -0
- package/components/map/icons/MapIcon.d.ts +1 -0
- package/components/map/icons/MapIcon.js +46 -37
- package/components/map/icons/MapIcon.js.map +1 -1
- package/components/map/utils/mapTypes.d.ts +12 -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/selects/Multiselect.d.ts +6 -0
- package/components/selects/Multiselect.js +85 -83
- package/components/selects/Multiselect.js.map +1 -1
- package/components/selects/Select.d.ts +6 -0
- package/components/selects/Select.js +79 -71
- package/components/selects/Select.js.map +1 -1
- package/components/table/Table.d.ts +5 -1
- package/components/table/Table.js +234 -210
- package/components/table/Table.js.map +1 -1
- package/components/table/Table.types.d.ts +55 -0
- package/components/table/TableExpandAllGroupsButton.d.ts +25 -0
- package/components/table/TableExpandAllGroupsButton.js +27 -0
- package/components/table/TableExpandAllGroupsButton.js.map +1 -0
- package/components/table/TableExpandedRow.d.ts +4 -0
- package/components/table/TableExpandedRow.js +101 -84
- package/components/table/TableExpandedRow.js.map +1 -1
- package/components/table/TableExpanderButton.js +11 -11
- package/components/table/TableExpanderButton.js.map +1 -1
- package/components/table/TableGroupRow.d.ts +16 -2
- package/components/table/TableGroupRow.js +57 -22
- package/components/table/TableGroupRow.js.map +1 -1
- package/components/table/TableHeader.d.ts +1 -9
- package/components/table/TableHeader.js +82 -65
- package/components/table/TableHeader.js.map +1 -1
- package/components/table/TableRow.d.ts +7 -1
- package/components/table/TableRow.js +89 -72
- 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/TableRenderConfigContext.d.ts +2 -1
- package/components/table/context/TableRenderConfigContext.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/useMeasuredColumnMaxWidths.js +52 -54
- package/components/table/layout/useMeasuredColumnMaxWidths.js.map +1 -1
- package/components/table/layout/useTableLayout.d.ts +4 -1
- package/components/table/layout/useTableLayout.js +54 -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/TableHeaderCellContent.js +4 -4
- package/components/table/render/header/TableHeaderCellContent.js.map +1 -1
- package/components/table/render/header/TableHeaderSelectionCell.d.ts +3 -0
- package/components/table/render/header/TableHeaderSelectionCell.js +25 -14
- package/components/table/render/header/TableHeaderSelectionCell.js.map +1 -1
- package/components/table/runtime/useRenderDraftState.js +1 -0
- package/components/table/runtime/useRenderDraftState.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 +29 -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/useResizeObserver.d.ts +25 -6
- package/hooks/useResizeObserver.js +20 -18
- package/hooks/useResizeObserver.js.map +1 -1
- package/package.json +10 -10
- 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
|
*
|
|
@@ -170,6 +181,7 @@ export type TableColumn<RowType extends TableRowData> = TableColumnDefinition<Ro
|
|
|
170
181
|
export type TableRowClassName<RowType extends TableRowData> = string | ((row: RowType, rowIndex: number) => string);
|
|
171
182
|
export type TableCellClassName<RowType extends TableRowData> = (row: RowType, column: TableColumnDefinition<RowType>, rowIndex: number, columnIndex: number) => string;
|
|
172
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;
|
|
173
185
|
export type TableProps<RowType extends TableRowData> = Omit<HTMLAttributes<HTMLDivElement>, 'draggable' | 'onClick'> & {
|
|
174
186
|
/**
|
|
175
187
|
* Row key accessor for resolving a stable unique row id.
|
|
@@ -192,6 +204,24 @@ export type TableProps<RowType extends TableRowData> = Omit<HTMLAttributes<HTMLD
|
|
|
192
204
|
* Card width configuration for `MULTI_CARDS` view.
|
|
193
205
|
*/
|
|
194
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;
|
|
195
225
|
/**
|
|
196
226
|
* Compact row/cell spacing like old `table-condensed`.
|
|
197
227
|
*
|
|
@@ -255,6 +285,17 @@ export type TableProps<RowType extends TableRowData> = Omit<HTMLAttributes<HTMLD
|
|
|
255
285
|
* @default '1px'
|
|
256
286
|
*/
|
|
257
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;
|
|
258
299
|
/**
|
|
259
300
|
* Sticky column behavior in `TABLE` view.
|
|
260
301
|
*
|
|
@@ -324,6 +365,14 @@ export type TableProps<RowType extends TableRowData> = Omit<HTMLAttributes<HTMLD
|
|
|
324
365
|
* Called when checkbox selection changes.
|
|
325
366
|
*/
|
|
326
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;
|
|
327
376
|
/**
|
|
328
377
|
* Currently selected row keys for multi-selection use cases.
|
|
329
378
|
*/
|
|
@@ -333,6 +382,12 @@ export type TableProps<RowType extends TableRowData> = Omit<HTMLAttributes<HTMLD
|
|
|
333
382
|
* If omitted, the header renders the default select-all checkbox.
|
|
334
383
|
*/
|
|
335
384
|
selectionHeaderContent?: ReactNode;
|
|
385
|
+
/**
|
|
386
|
+
* Vertical alignment for selection checkboxes in the header and body rows.
|
|
387
|
+
*
|
|
388
|
+
* @default 'middle'
|
|
389
|
+
*/
|
|
390
|
+
selectionCheckboxVerticalAlignment?: TableVerticalAlign;
|
|
336
391
|
/**
|
|
337
392
|
* Controlled column order for drag-reordering.
|
|
338
393
|
*
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { MouseEventHandler } from 'react';
|
|
2
|
+
export type TableExpandAllGroupsButtonProps = {
|
|
3
|
+
/**
|
|
4
|
+
* Controls whether all related groups are currently expanded.
|
|
5
|
+
*
|
|
6
|
+
* @default false
|
|
7
|
+
*/
|
|
8
|
+
expanded?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Disables the expand all groups button.
|
|
11
|
+
*
|
|
12
|
+
* @default false
|
|
13
|
+
*/
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Callback triggered when the expand all groups button is clicked.
|
|
17
|
+
*/
|
|
18
|
+
onClick?: MouseEventHandler<HTMLButtonElement>;
|
|
19
|
+
/**
|
|
20
|
+
* Optional additional class names for the button element.
|
|
21
|
+
*/
|
|
22
|
+
className?: string;
|
|
23
|
+
};
|
|
24
|
+
declare const TableExpandAllGroupsButton: (props: TableExpandAllGroupsButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
export default TableExpandAllGroupsButton;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import r from "../button/Button.js";
|
|
3
|
+
import p from "../../utils/classNames.js";
|
|
4
|
+
const u = (a) => {
|
|
5
|
+
const { expanded: l = !1, disabled: s = !1, onClick: o, className: t, ...n } = a;
|
|
6
|
+
return /* @__PURE__ */ e(
|
|
7
|
+
r,
|
|
8
|
+
{
|
|
9
|
+
...n,
|
|
10
|
+
bsStyle: "muted",
|
|
11
|
+
bsSize: "sm",
|
|
12
|
+
iconOnly: !0,
|
|
13
|
+
disabled: s,
|
|
14
|
+
className: p(
|
|
15
|
+
"table-expand-all-groups-button",
|
|
16
|
+
l && "table-expand-all-groups-button-expanded",
|
|
17
|
+
t
|
|
18
|
+
),
|
|
19
|
+
onClick: o,
|
|
20
|
+
children: /* @__PURE__ */ e("span", { className: "rioglyph rioglyph-angle-double-down text-size-16" })
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
};
|
|
24
|
+
export {
|
|
25
|
+
u as default
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=TableExpandAllGroupsButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TableExpandAllGroupsButton.js","sources":["../../../src/components/table/TableExpandAllGroupsButton.tsx"],"sourcesContent":["import type { MouseEventHandler } from 'react';\n\nimport Button from '../button/Button';\nimport classNames from '../../utils/classNames';\n\nexport type TableExpandAllGroupsButtonProps = {\n /**\n * Controls whether all related groups are currently expanded.\n *\n * @default false\n */\n expanded?: boolean;\n\n /**\n * Disables the expand all groups button.\n *\n * @default false\n */\n disabled?: boolean;\n\n /**\n * Callback triggered when the expand all groups button is clicked.\n */\n onClick?: MouseEventHandler<HTMLButtonElement>;\n\n /**\n * Optional additional class names for the button element.\n */\n className?: string;\n};\n\nconst TableExpandAllGroupsButton = (props: TableExpandAllGroupsButtonProps) => {\n const { expanded = false, disabled = false, onClick, className, ...remainingProps } = props;\n\n return (\n <Button\n {...remainingProps}\n bsStyle='muted'\n bsSize='sm'\n iconOnly\n disabled={disabled}\n className={classNames(\n 'table-expand-all-groups-button',\n expanded && 'table-expand-all-groups-button-expanded',\n className\n )}\n onClick={onClick}\n >\n <span className='rioglyph rioglyph-angle-double-down text-size-16' />\n </Button>\n );\n};\n\nexport default TableExpandAllGroupsButton;\n"],"names":["TableExpandAllGroupsButton","props","expanded","disabled","onClick","className","remainingProps","jsx","Button","classNames"],"mappings":";;;AA+BA,MAAMA,IAA6B,CAACC,MAA2C;AAC3E,QAAM,EAAE,UAAAC,IAAW,IAAO,UAAAC,IAAW,IAAO,SAAAC,GAAS,WAAAC,GAAW,GAAGC,EAAA,IAAmBL;AAEtF,SACI,gBAAAM;AAAA,IAACC;AAAA,IAAA;AAAA,MACI,GAAGF;AAAA,MACJ,SAAQ;AAAA,MACR,QAAO;AAAA,MACP,UAAQ;AAAA,MACR,UAAAH;AAAA,MACA,WAAWM;AAAA,QACP;AAAA,QACAP,KAAY;AAAA,QACZG;AAAA,MAAA;AAAA,MAEJ,SAAAD;AAAA,MAEA,UAAA,gBAAAG,EAAC,QAAA,EAAK,WAAU,mDAAA,CAAmD;AAAA,IAAA;AAAA,EAAA;AAG/E;"}
|
|
@@ -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,54 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useReducedMotion as
|
|
3
|
-
import { useRef as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import { resolveRowKey as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
import { jsx as r, 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 k from "../../utils/classNames.js";
|
|
6
|
+
import { resolveRowKey as q, resolveRowClassName as z } from "./model/resolveRowMeta.js";
|
|
7
|
+
import { getVerticalAlignClassName as G } from "./shared/getAlignClassName.js";
|
|
8
|
+
import { useOptionalTableInteractionContext as J } from "./context/TableInteractionContext.js";
|
|
9
|
+
import { useOptionalTableRenderConfigContext as Q } from "./context/TableRenderConfigContext.js";
|
|
10
|
+
import { useOptionalTableSection as Y, useTableBodyContext as Z, extractTableHtmlAttributes as I, TableRowContext as $ } from "./context/TableStructureContext.js";
|
|
11
|
+
import { useOptionalTableRenderContext as ee } from "./context/TableRenderContext.js";
|
|
12
|
+
import { getInteractiveRowProps as oe } from "./shared/getInteractiveRowProps.js";
|
|
13
|
+
const C = 0.18, te = (b) => {
|
|
14
|
+
const {
|
|
15
|
+
isSelected: p,
|
|
16
|
+
isSelectable: u,
|
|
17
|
+
hideSelectionControl: x,
|
|
18
|
+
isTableView: g,
|
|
19
|
+
onToggleSelection: h,
|
|
20
|
+
cardCellClassName: l,
|
|
21
|
+
selectionCheckboxVerticalAlignment: e
|
|
22
|
+
} = b;
|
|
23
|
+
return /* @__PURE__ */ r(
|
|
15
24
|
"div",
|
|
16
25
|
{
|
|
17
|
-
className:
|
|
26
|
+
className: k(
|
|
27
|
+
"table-cell table-selection-cell",
|
|
28
|
+
G(e),
|
|
29
|
+
!g && l
|
|
30
|
+
),
|
|
18
31
|
role: "cell",
|
|
19
32
|
"aria-colindex": 1,
|
|
20
|
-
style:
|
|
21
|
-
onClick: (
|
|
22
|
-
onKeyDown: (
|
|
23
|
-
children: /* @__PURE__ */
|
|
33
|
+
style: g ? { gridColumn: "1 / span 1", gridRow: "1 / span 1" } : void 0,
|
|
34
|
+
onClick: (n) => n.stopPropagation(),
|
|
35
|
+
onKeyDown: (n) => n.stopPropagation(),
|
|
36
|
+
children: !x && /* @__PURE__ */ r("div", { className: "table-selection-control", children: /* @__PURE__ */ r(X, { checked: p, disabled: !u, onChange: h }) })
|
|
24
37
|
}
|
|
25
38
|
);
|
|
26
|
-
},
|
|
27
|
-
const { children:
|
|
28
|
-
|
|
29
|
-
const [
|
|
30
|
-
() =>
|
|
39
|
+
}, pe = (b) => {
|
|
40
|
+
const { children: p, className: u, noHover: x, parentKey: g, selectable: h, ...l } = b, e = Q(), n = ee(), o = J(), P = Y(), y = Z(), m = U(0);
|
|
41
|
+
m.current = 0;
|
|
42
|
+
const [D, f] = L(!0), v = B(), O = W(
|
|
43
|
+
() => v ? {
|
|
31
44
|
initial: { opacity: 0 },
|
|
32
45
|
animate: {
|
|
33
46
|
opacity: 1,
|
|
34
|
-
transition: { duration:
|
|
47
|
+
transition: { duration: C, ease: "easeInOut" }
|
|
35
48
|
},
|
|
36
49
|
exit: {
|
|
37
50
|
opacity: 0,
|
|
38
|
-
transition: { duration:
|
|
51
|
+
transition: { duration: C, ease: "easeInOut" }
|
|
39
52
|
}
|
|
40
53
|
} : {
|
|
41
54
|
initial: { opacity: 0, height: 0, y: -8 },
|
|
@@ -43,108 +56,112 @@ const u = 0.18, $ = (C) => {
|
|
|
43
56
|
opacity: 1,
|
|
44
57
|
height: "auto",
|
|
45
58
|
y: 0,
|
|
46
|
-
transition: { duration:
|
|
59
|
+
transition: { duration: C, ease: "easeOut" }
|
|
47
60
|
},
|
|
48
61
|
exit: {
|
|
49
62
|
opacity: 0,
|
|
50
63
|
height: 0,
|
|
51
64
|
y: -8,
|
|
52
|
-
transition: { duration:
|
|
65
|
+
transition: { duration: C, ease: "easeInOut" }
|
|
53
66
|
}
|
|
54
67
|
},
|
|
55
|
-
[
|
|
68
|
+
[v]
|
|
56
69
|
);
|
|
57
|
-
if (!
|
|
70
|
+
if (!n || !e || !o || n.columns.length === 0 || P !== "body" || !y)
|
|
58
71
|
return null;
|
|
59
|
-
const c =
|
|
72
|
+
const c = l, i = y.nextRowIndex(), t = q(c, i, e.rowKey), K = typeof e.rowAnimationProps == "function" ? e.rowAnimationProps(c, i) : e.rowAnimationProps, a = oe({
|
|
60
73
|
isClickable: o.isClickable,
|
|
61
|
-
onRowClick: (
|
|
62
|
-
o.onRowClick?.(
|
|
74
|
+
onRowClick: (s, d) => {
|
|
75
|
+
o.onRowClick?.(s, d), o.onActiveRowChange?.(
|
|
63
76
|
o.activeRowId === t ? void 0 : t,
|
|
64
|
-
|
|
77
|
+
s,
|
|
65
78
|
d
|
|
66
79
|
);
|
|
67
80
|
},
|
|
68
81
|
row: c,
|
|
69
|
-
rowIndex:
|
|
82
|
+
rowIndex: i
|
|
70
83
|
});
|
|
71
|
-
let
|
|
72
|
-
e.expandedRowAnimation !== !1 && (
|
|
73
|
-
...
|
|
74
|
-
...
|
|
84
|
+
let w;
|
|
85
|
+
e.expandedRowAnimation !== !1 && (w = {
|
|
86
|
+
...O,
|
|
87
|
+
...K
|
|
75
88
|
});
|
|
76
|
-
const
|
|
89
|
+
const R = o.selectableRowIdSet.has(t), A = R && o.selectedRowIdSet.has(t), S = k(
|
|
77
90
|
"table-row",
|
|
78
91
|
"table-row-expanded-data",
|
|
79
92
|
!e.isTableView && "divider-y-1 divider-color-lighter divider-style-solid",
|
|
80
93
|
o.activeRowId === t && "table-row-active",
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
94
|
+
A && "table-row-selected",
|
|
95
|
+
a.isClickableClassName,
|
|
96
|
+
x && "table-row-no-hover",
|
|
84
97
|
!e.isTableView && e.cardClasses.rowClassName,
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
),
|
|
88
|
-
|
|
98
|
+
u,
|
|
99
|
+
z(e.rowClassName, c, i)
|
|
100
|
+
), V = o.showSelectionColumn && /* @__PURE__ */ r(
|
|
101
|
+
te,
|
|
89
102
|
{
|
|
90
|
-
isSelected:
|
|
103
|
+
isSelected: A,
|
|
104
|
+
isSelectable: R,
|
|
105
|
+
hideSelectionControl: !R && o.hideSelectionCheckboxesForExcludedRows,
|
|
91
106
|
isTableView: e.isTableView,
|
|
92
107
|
onToggleSelection: () => o.onToggleRowSelection?.(t),
|
|
93
|
-
cardCellClassName: e.cardClasses.cellClassName
|
|
108
|
+
cardCellClassName: e.cardClasses.cellClassName,
|
|
109
|
+
selectionCheckboxVerticalAlignment: e.selectionCheckboxVerticalAlignment
|
|
94
110
|
}
|
|
95
|
-
), T = /* @__PURE__ */
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
] }),
|
|
99
|
-
...I(
|
|
100
|
-
className:
|
|
101
|
-
"data-index":
|
|
111
|
+
), T = /* @__PURE__ */ M(j, { children: [
|
|
112
|
+
V,
|
|
113
|
+
p
|
|
114
|
+
] }), E = {
|
|
115
|
+
...I(l),
|
|
116
|
+
className: S,
|
|
117
|
+
"data-index": i,
|
|
102
118
|
"data-row-id": String(t),
|
|
103
|
-
onClick:
|
|
104
|
-
onKeyDown:
|
|
119
|
+
onClick: a.onClick,
|
|
120
|
+
onKeyDown: a.onKeyDown,
|
|
105
121
|
role: "row",
|
|
106
|
-
tabIndex:
|
|
107
|
-
},
|
|
108
|
-
...I(
|
|
109
|
-
className:
|
|
110
|
-
"data-index":
|
|
122
|
+
tabIndex: a.tabIndex
|
|
123
|
+
}, _ = {
|
|
124
|
+
...I(l),
|
|
125
|
+
className: S,
|
|
126
|
+
"data-index": i,
|
|
111
127
|
"data-row-id": String(t),
|
|
112
|
-
onClick:
|
|
113
|
-
onKeyDown:
|
|
128
|
+
onClick: a.onClick,
|
|
129
|
+
onKeyDown: a.onKeyDown,
|
|
114
130
|
role: "row",
|
|
115
|
-
tabIndex:
|
|
116
|
-
onAnimationStart: () =>
|
|
117
|
-
onAnimationComplete: () =>
|
|
118
|
-
...
|
|
131
|
+
tabIndex: a.tabIndex,
|
|
132
|
+
onAnimationStart: () => f(!0),
|
|
133
|
+
onAnimationComplete: () => f(!1),
|
|
134
|
+
...w,
|
|
119
135
|
style: {
|
|
120
|
-
...
|
|
121
|
-
overflow:
|
|
136
|
+
...w?.style ?? {},
|
|
137
|
+
overflow: D ? "hidden" : "visible"
|
|
122
138
|
}
|
|
123
|
-
}, N = /* @__PURE__ */
|
|
124
|
-
|
|
139
|
+
}, N = /* @__PURE__ */ r(
|
|
140
|
+
$.Provider,
|
|
125
141
|
{
|
|
126
142
|
value: {
|
|
127
|
-
nextColumnIndex: (
|
|
128
|
-
if (
|
|
129
|
-
return
|
|
130
|
-
const
|
|
131
|
-
return
|
|
143
|
+
nextColumnIndex: (s, d = 1) => {
|
|
144
|
+
if (s !== void 0 && s >= 0)
|
|
145
|
+
return m.current = s + d, s;
|
|
146
|
+
const F = m.current;
|
|
147
|
+
return m.current += d, F;
|
|
132
148
|
},
|
|
133
|
-
rowIndex:
|
|
149
|
+
rowIndex: i,
|
|
134
150
|
rowId: t,
|
|
135
151
|
rowData: c
|
|
136
152
|
},
|
|
137
|
-
children:
|
|
153
|
+
children: w ? /* @__PURE__ */ r(H.div, { ..._, children: T }) : /* @__PURE__ */ r("div", { ...E, children: T })
|
|
138
154
|
}
|
|
139
155
|
);
|
|
140
|
-
return
|
|
156
|
+
return n.renderDraft.hasExpandableRows = !0, n.renderDraft.bodyRows.push({
|
|
141
157
|
rowId: t,
|
|
142
|
-
rowIndex:
|
|
158
|
+
rowIndex: i,
|
|
143
159
|
kind: "expanded",
|
|
160
|
+
selectable: h !== !1,
|
|
144
161
|
render: () => N
|
|
145
|
-
}),
|
|
162
|
+
}), n.isRegisteringBodyRows ? null : N;
|
|
146
163
|
};
|
|
147
164
|
export {
|
|
148
|
-
|
|
165
|
+
pe as default
|
|
149
166
|
};
|
|
150
167
|
//# sourceMappingURL=TableExpandedRow.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableExpandedRow.js","sources":["../../../src/components/table/TableExpandedRow.tsx"],"sourcesContent":["import { motion, type HTMLMotionProps, useReducedMotion, type MotionProps } from 'motion/react';\nimport { useMemo, useRef, useState, type ReactNode } from 'react';\n\nimport Checkbox from '../checkbox/Checkbox';\nimport classNames from '../../utils/classNames';\nimport type { TableHtmlAttributes, TableRowData } from './Table.types';\nimport { resolveRowClassName, resolveRowKey } from './model/resolveRowMeta';\nimport { useOptionalTableInteractionContext } from './context/TableInteractionContext';\nimport { useOptionalTableRenderConfigContext } from './context/TableRenderConfigContext';\nimport {\n extractTableHtmlAttributes,\n TableRowContext,\n useTableBodyContext,\n useOptionalTableSection,\n} from './context/TableStructureContext';\nimport { useOptionalTableRenderContext } from './context/TableRenderContext';\nimport { getInteractiveRowProps } from './shared/getInteractiveRowProps';\n\nconst DEFAULT_EXPANDED_ROW_DURATION = 0.18;\n\nexport type TableExpandedRowProps<RowType extends TableRowData> = TableHtmlAttributes &\n Partial<RowType> & {\n /**\n * Parent row key used to associate this expanded row with its parent.\n */\n parentKey: string | number;\n\n /**\n * Optional class names only for this expanded row.\n */\n className?: string;\n\n /**\n * Disable table hover styling for this row.\n */\n noHover?: boolean;\n\n /**\n * Table row content.\n */\n children?: ReactNode;\n };\n\ntype TableExpandedRowSelectionCellProps = {\n isSelected: boolean;\n isTableView: boolean;\n onToggleSelection?: () => void;\n cardCellClassName?: string;\n};\n\nconst TableExpandedRowSelectionCell = (props: TableExpandedRowSelectionCellProps) => {\n const { isSelected, isTableView, onToggleSelection, cardCellClassName } = props;\n return (\n <div\n className={classNames('table-cell table-selection-cell', !isTableView && cardCellClassName)}\n role='cell'\n aria-colindex={1}\n style={isTableView ? { gridColumn: '1 / span 1', gridRow: '1 / span 1' } : undefined}\n onClick={event => event.stopPropagation()}\n onKeyDown={event => event.stopPropagation()}\n >\n <div className='table-selection-control'>\n <Checkbox checked={isSelected} onChange={onToggleSelection} />\n </div>\n </div>\n );\n};\n\nconst TableExpandedRow = <RowType extends TableRowData = TableRowData>(props: TableExpandedRowProps<RowType>) => {\n const { children, className, noHover, parentKey: _parentKey, ...remainingProps } = props;\n\n const renderConfigContext = useOptionalTableRenderConfigContext<RowType>();\n const renderContext = useOptionalTableRenderContext<RowType>();\n const interactionContext = useOptionalTableInteractionContext<RowType>();\n const section = useOptionalTableSection();\n const bodyContext = useTableBodyContext();\n\n const cellIndexRef = useRef(0);\n cellIndexRef.current = 0;\n\n const [isAnimating, setIsAnimating] = useState(true);\n const shouldReduceMotion = useReducedMotion();\n\n const animation = useMemo(\n () =>\n shouldReduceMotion\n ? {\n initial: { opacity: 0 },\n animate: {\n opacity: 1,\n transition: { duration: DEFAULT_EXPANDED_ROW_DURATION, ease: 'easeInOut' as const },\n },\n exit: {\n opacity: 0,\n transition: { duration: DEFAULT_EXPANDED_ROW_DURATION, ease: 'easeInOut' as const },\n },\n }\n : {\n initial: { opacity: 0, height: 0, y: -8 },\n animate: {\n opacity: 1,\n height: 'auto',\n y: 0,\n transition: { duration: DEFAULT_EXPANDED_ROW_DURATION, ease: 'easeOut' as const },\n },\n exit: {\n opacity: 0,\n height: 0,\n y: -8,\n transition: { duration: DEFAULT_EXPANDED_ROW_DURATION, ease: 'easeInOut' as const },\n },\n },\n [shouldReduceMotion]\n );\n\n if (\n !renderContext ||\n !renderConfigContext ||\n !interactionContext ||\n renderContext.columns.length === 0 ||\n section !== 'body' ||\n !bodyContext\n ) {\n return null;\n }\n\n const rowData = remainingProps as unknown as RowType;\n const rowIndex = bodyContext.nextRowIndex();\n const rowId = resolveRowKey(rowData, rowIndex, renderConfigContext.rowKey);\n\n const resolvedRowAnimationProps =\n typeof renderConfigContext.rowAnimationProps === 'function'\n ? renderConfigContext.rowAnimationProps(rowData, rowIndex)\n : renderConfigContext.rowAnimationProps;\n\n const interactiveRowProps = getInteractiveRowProps({\n isClickable: interactionContext.isClickable,\n onRowClick: (clickedRow, clickedRowIndex) => {\n interactionContext.onRowClick?.(clickedRow, clickedRowIndex);\n interactionContext.onActiveRowChange?.(\n interactionContext.activeRowId === rowId ? undefined : rowId,\n clickedRow,\n clickedRowIndex\n );\n },\n row: rowData,\n rowIndex,\n });\n\n let mergedRowAnimationProps: MotionProps | undefined;\n\n if (renderConfigContext.expandedRowAnimation !== false) {\n mergedRowAnimationProps = {\n ...animation,\n ...resolvedRowAnimationProps,\n };\n }\n\n const isSelected = interactionContext.selectedRowIdSet.has(rowId);\n\n const rowClassNames = classNames(\n 'table-row',\n 'table-row-expanded-data',\n !renderConfigContext.isTableView && 'divider-y-1 divider-color-lighter divider-style-solid',\n interactionContext.activeRowId === rowId && 'table-row-active',\n isSelected && 'table-row-selected',\n interactiveRowProps.isClickableClassName,\n noHover && 'table-row-no-hover',\n !renderConfigContext.isTableView && renderConfigContext.cardClasses.rowClassName,\n className,\n resolveRowClassName(renderConfigContext.rowClassName, rowData, rowIndex)\n );\n\n const selectionCell = interactionContext.showSelectionColumn && (\n <TableExpandedRowSelectionCell\n isSelected={isSelected}\n isTableView={renderConfigContext.isTableView}\n onToggleSelection={() => interactionContext.onToggleRowSelection?.(rowId)}\n cardCellClassName={renderConfigContext.cardClasses.cellClassName}\n />\n );\n\n const rowContent = (\n <>\n {selectionCell}\n {children}\n </>\n );\n\n const staticRowProps = {\n ...extractTableHtmlAttributes(remainingProps),\n className: rowClassNames,\n 'data-index': rowIndex,\n 'data-row-id': String(rowId),\n onClick: interactiveRowProps.onClick,\n onKeyDown: interactiveRowProps.onKeyDown,\n role: 'row' as const,\n tabIndex: interactiveRowProps.tabIndex,\n };\n\n const animatedRowProps = {\n ...(extractTableHtmlAttributes(remainingProps) as Omit<\n HTMLMotionProps<'div'>,\n 'children' | 'className' | 'data-row-id' | 'onClick' | 'onKeyDown' | 'role' | 'style' | 'tabIndex'\n >),\n className: rowClassNames,\n 'data-index': rowIndex,\n 'data-row-id': String(rowId),\n onClick: interactiveRowProps.onClick,\n onKeyDown: interactiveRowProps.onKeyDown,\n role: 'row' as const,\n tabIndex: interactiveRowProps.tabIndex,\n onAnimationStart: () => setIsAnimating(true),\n onAnimationComplete: () => setIsAnimating(false),\n ...mergedRowAnimationProps,\n style: {\n ...(mergedRowAnimationProps?.style ?? {}),\n overflow: isAnimating ? 'hidden' : 'visible',\n },\n };\n\n const rowNode = (\n <TableRowContext.Provider\n value={{\n nextColumnIndex: (explicitColumnIndex, span = 1) => {\n if (explicitColumnIndex !== undefined && explicitColumnIndex >= 0) {\n cellIndexRef.current = explicitColumnIndex + span;\n return explicitColumnIndex;\n }\n\n const nextIndex = cellIndexRef.current;\n cellIndexRef.current += span;\n return nextIndex;\n },\n rowIndex,\n rowId,\n rowData,\n }}\n >\n {mergedRowAnimationProps ? (\n <motion.div {...animatedRowProps}>{rowContent}</motion.div>\n ) : (\n <div {...staticRowProps}>{rowContent}</div>\n )}\n </TableRowContext.Provider>\n );\n\n renderContext.renderDraft.hasExpandableRows = true;\n renderContext.renderDraft.bodyRows.push({\n rowId,\n rowIndex,\n kind: 'expanded',\n render: () => rowNode,\n });\n\n return renderContext.isRegisteringBodyRows ? null : rowNode;\n};\n\nexport default TableExpandedRow;\n"],"names":["DEFAULT_EXPANDED_ROW_DURATION","TableExpandedRowSelectionCell","props","isSelected","isTableView","onToggleSelection","cardCellClassName","jsx","classNames","event","Checkbox","TableExpandedRow","children","className","noHover","_parentKey","remainingProps","renderConfigContext","useOptionalTableRenderConfigContext","renderContext","useOptionalTableRenderContext","interactionContext","useOptionalTableInteractionContext","section","useOptionalTableSection","bodyContext","useTableBodyContext","cellIndexRef","useRef","isAnimating","setIsAnimating","useState","shouldReduceMotion","useReducedMotion","animation","useMemo","rowData","rowIndex","rowId","resolveRowKey","resolvedRowAnimationProps","interactiveRowProps","getInteractiveRowProps","clickedRow","clickedRowIndex","mergedRowAnimationProps","rowClassNames","resolveRowClassName","selectionCell","rowContent","jsxs","Fragment","staticRowProps","extractTableHtmlAttributes","animatedRowProps","rowNode","TableRowContext","explicitColumnIndex","span","nextIndex","motion"],"mappings":";;;;;;;;;;;AAkBA,MAAMA,IAAgC,MAgChCC,IAAgC,CAACC,MAA8C;AACjF,QAAM,EAAE,YAAAC,GAAY,aAAAC,GAAa,mBAAAC,GAAmB,mBAAAC,MAAsBJ;AAC1E,SACI,gBAAAK;AAAA,IAAC;AAAA,IAAA;AAAA,MACG,WAAWC,EAAW,mCAAmC,CAACJ,KAAeE,CAAiB;AAAA,MAC1F,MAAK;AAAA,MACL,iBAAe;AAAA,MACf,OAAOF,IAAc,EAAE,YAAY,cAAc,SAAS,iBAAiB;AAAA,MAC3E,SAAS,CAAAK,MAASA,EAAM,gBAAA;AAAA,MACxB,WAAW,CAAAA,MAASA,EAAM,gBAAA;AAAA,MAE1B,UAAA,gBAAAF,EAAC,OAAA,EAAI,WAAU,2BACX,UAAA,gBAAAA,EAACG,KAAS,SAASP,GAAY,UAAUE,EAAA,CAAmB,EAAA,CAChE;AAAA,IAAA;AAAA,EAAA;AAGZ,GAEMM,KAAmB,CAA8CT,MAA0C;AAC7G,QAAM,EAAE,UAAAU,GAAU,WAAAC,GAAW,SAAAC,GAAS,WAAWC,GAAY,GAAGC,MAAmBd,GAE7Ee,IAAsBC,EAAA,GACtBC,IAAgBC,EAAA,GAChBC,IAAqBC,EAAA,GACrBC,IAAUC,EAAA,GACV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B;AAAA,IACX,cAAcT;AAAA,IACd,eAAe,OAAOC,CAAK;AAAA,IAC3B,SAASG,EAAoB;AAAA,IAC7B,WAAWA,EAAoB;AAAA,IAC/B,MAAM;AAAA,IACN,UAAUA,EAAoB;AAAA,IAC9B,kBAAkB,MAAMX,EAAe,EAAI;AAAA,IAC3C,qBAAqB,MAAMA,EAAe,EAAK;AAAA,IAC/C,GAAGe;AAAA,IACH,OAAO;AAAA,MACH,GAAIA,GAAyB,SAAS,CAAA;AAAA,MACtC,UAAUhB,IAAc,WAAW;AAAA,IAAA;AAAA,EACvC,GAGE0B,IACF,gBAAAhD;AAAA,IAACiD,EAAgB;AAAA,IAAhB;AAAA,MACG,OAAO;AAAA,QACH,iBAAiB,CAACC,GAAqBC,IAAO,MAAM;AAChD,cAAID,MAAwB,UAAaA,KAAuB;AAC5D,mBAAA9B,EAAa,UAAU8B,IAAsBC,GACtCD;AAGX,gBAAME,IAAYhC,EAAa;AAC/B,iBAAAA,EAAa,WAAW+B,GACjBC;AAAA,QACX;AAAA,QACA,UAAAtB;AAAA,QACA,OAAAC;AAAA,QACA,SAAAF;AAAA,MAAA;AAAA,MAGH,UAAAS,IACG,gBAAAtC,EAACqD,EAAO,KAAP,EAAY,GAAGN,GAAmB,UAAAL,EAAA,CAAW,IAE9C,gBAAA1C,EAAC,OAAA,EAAK,GAAG6C,GAAiB,UAAAH,EAAA,CAAW;AAAA,IAAA;AAAA,EAAA;AAKjD,SAAA9B,EAAc,YAAY,oBAAoB,IAC9CA,EAAc,YAAY,SAAS,KAAK;AAAA,IACpC,OAAAmB;AAAA,IACA,UAAAD;AAAA,IACA,MAAM;AAAA,IACN,QAAQ,MAAMkB;AAAA,EAAA,CACjB,GAEMpC,EAAc,wBAAwB,OAAOoC;AACxD;"}
|
|
1
|
+
{"version":3,"file":"TableExpandedRow.js","sources":["../../../src/components/table/TableExpandedRow.tsx"],"sourcesContent":["import { motion, type HTMLMotionProps, useReducedMotion, type MotionProps } from 'motion/react';\nimport { useMemo, useRef, useState, type ReactNode } from 'react';\n\nimport Checkbox from '../checkbox/Checkbox';\nimport classNames from '../../utils/classNames';\nimport type { TableHtmlAttributes, TableRowData } from './Table.types';\nimport { resolveRowClassName, resolveRowKey } from './model/resolveRowMeta';\nimport { getVerticalAlignClassName } from './shared/getAlignClassName';\nimport { useOptionalTableInteractionContext } from './context/TableInteractionContext';\nimport { useOptionalTableRenderConfigContext } from './context/TableRenderConfigContext';\nimport {\n extractTableHtmlAttributes,\n TableRowContext,\n useTableBodyContext,\n useOptionalTableSection,\n} from './context/TableStructureContext';\nimport { useOptionalTableRenderContext } from './context/TableRenderContext';\nimport { getInteractiveRowProps } from './shared/getInteractiveRowProps';\nimport type { TableVerticalAlign } from './Table.types';\n\nconst DEFAULT_EXPANDED_ROW_DURATION = 0.18;\n\nexport type TableExpandedRowProps<RowType extends TableRowData> = TableHtmlAttributes &\n Partial<RowType> & {\n /**\n * Parent row key used to associate this expanded row with its parent.\n */\n parentKey: string | number;\n\n /**\n * Optional class names only for this expanded row.\n */\n className?: string;\n\n /**\n * Excludes this row from table selection while keeping the row interactive.\n */\n selectable?: boolean;\n\n /**\n * Disable table hover styling for this row.\n */\n noHover?: boolean;\n\n /**\n * Table row content.\n */\n children?: ReactNode;\n };\n\ntype TableExpandedRowSelectionCellProps = {\n isSelected: boolean;\n isSelectable: boolean;\n hideSelectionControl?: boolean;\n isTableView: boolean;\n onToggleSelection?: () => void;\n cardCellClassName?: string;\n selectionCheckboxVerticalAlignment?: TableVerticalAlign;\n};\n\nconst TableExpandedRowSelectionCell = (props: TableExpandedRowSelectionCellProps) => {\n const {\n isSelected,\n isSelectable,\n hideSelectionControl,\n isTableView,\n onToggleSelection,\n cardCellClassName,\n selectionCheckboxVerticalAlignment,\n } = props;\n return (\n <div\n className={classNames(\n 'table-cell table-selection-cell',\n getVerticalAlignClassName(selectionCheckboxVerticalAlignment),\n !isTableView && cardCellClassName\n )}\n role='cell'\n aria-colindex={1}\n style={isTableView ? { gridColumn: '1 / span 1', gridRow: '1 / span 1' } : undefined}\n onClick={event => event.stopPropagation()}\n onKeyDown={event => event.stopPropagation()}\n >\n {!hideSelectionControl && (\n <div className='table-selection-control'>\n <Checkbox checked={isSelected} disabled={!isSelectable} onChange={onToggleSelection} />\n </div>\n )}\n </div>\n );\n};\n\nconst TableExpandedRow = <RowType extends TableRowData = TableRowData>(props: TableExpandedRowProps<RowType>) => {\n const { children, className, noHover, parentKey: _parentKey, selectable, ...remainingProps } = props;\n\n const renderConfigContext = useOptionalTableRenderConfigContext<RowType>();\n const renderContext = useOptionalTableRenderContext<RowType>();\n const interactionContext = useOptionalTableInteractionContext<RowType>();\n const section = useOptionalTableSection();\n const bodyContext = useTableBodyContext();\n\n const cellIndexRef = useRef(0);\n cellIndexRef.current = 0;\n\n const [isAnimating, setIsAnimating] = useState(true);\n const shouldReduceMotion = useReducedMotion();\n\n const animation = useMemo(\n () =>\n shouldReduceMotion\n ? {\n initial: { opacity: 0 },\n animate: {\n opacity: 1,\n transition: { duration: DEFAULT_EXPANDED_ROW_DURATION, ease: 'easeInOut' as const },\n },\n exit: {\n opacity: 0,\n transition: { duration: DEFAULT_EXPANDED_ROW_DURATION, ease: 'easeInOut' as const },\n },\n }\n : {\n initial: { opacity: 0, height: 0, y: -8 },\n animate: {\n opacity: 1,\n height: 'auto',\n y: 0,\n transition: { duration: DEFAULT_EXPANDED_ROW_DURATION, ease: 'easeOut' as const },\n },\n exit: {\n opacity: 0,\n height: 0,\n y: -8,\n transition: { duration: DEFAULT_EXPANDED_ROW_DURATION, ease: 'easeInOut' as const },\n },\n },\n [shouldReduceMotion]\n );\n\n if (\n !renderContext ||\n !renderConfigContext ||\n !interactionContext ||\n renderContext.columns.length === 0 ||\n section !== 'body' ||\n !bodyContext\n ) {\n return null;\n }\n\n const rowData = remainingProps as unknown as RowType;\n const rowIndex = bodyContext.nextRowIndex();\n const rowId = resolveRowKey(rowData, rowIndex, renderConfigContext.rowKey);\n\n const resolvedRowAnimationProps =\n typeof renderConfigContext.rowAnimationProps === 'function'\n ? renderConfigContext.rowAnimationProps(rowData, rowIndex)\n : renderConfigContext.rowAnimationProps;\n\n const interactiveRowProps = getInteractiveRowProps({\n isClickable: interactionContext.isClickable,\n onRowClick: (clickedRow, clickedRowIndex) => {\n interactionContext.onRowClick?.(clickedRow, clickedRowIndex);\n interactionContext.onActiveRowChange?.(\n interactionContext.activeRowId === rowId ? undefined : rowId,\n clickedRow,\n clickedRowIndex\n );\n },\n row: rowData,\n rowIndex,\n });\n\n let mergedRowAnimationProps: MotionProps | undefined;\n\n if (renderConfigContext.expandedRowAnimation !== false) {\n mergedRowAnimationProps = {\n ...animation,\n ...resolvedRowAnimationProps,\n };\n }\n\n const isSelectable = interactionContext.selectableRowIdSet.has(rowId);\n const isSelected = isSelectable && interactionContext.selectedRowIdSet.has(rowId);\n\n const rowClassNames = classNames(\n 'table-row',\n 'table-row-expanded-data',\n !renderConfigContext.isTableView && 'divider-y-1 divider-color-lighter divider-style-solid',\n interactionContext.activeRowId === rowId && 'table-row-active',\n isSelected && 'table-row-selected',\n interactiveRowProps.isClickableClassName,\n noHover && 'table-row-no-hover',\n !renderConfigContext.isTableView && renderConfigContext.cardClasses.rowClassName,\n className,\n resolveRowClassName(renderConfigContext.rowClassName, rowData, rowIndex)\n );\n\n const selectionCell = interactionContext.showSelectionColumn && (\n <TableExpandedRowSelectionCell\n isSelected={isSelected}\n isSelectable={isSelectable}\n hideSelectionControl={!isSelectable && interactionContext.hideSelectionCheckboxesForExcludedRows}\n isTableView={renderConfigContext.isTableView}\n onToggleSelection={() => interactionContext.onToggleRowSelection?.(rowId)}\n cardCellClassName={renderConfigContext.cardClasses.cellClassName}\n selectionCheckboxVerticalAlignment={renderConfigContext.selectionCheckboxVerticalAlignment}\n />\n );\n\n const rowContent = (\n <>\n {selectionCell}\n {children}\n </>\n );\n\n const staticRowProps = {\n ...extractTableHtmlAttributes(remainingProps),\n className: rowClassNames,\n 'data-index': rowIndex,\n 'data-row-id': String(rowId),\n onClick: interactiveRowProps.onClick,\n onKeyDown: interactiveRowProps.onKeyDown,\n role: 'row' as const,\n tabIndex: interactiveRowProps.tabIndex,\n };\n\n const animatedRowProps = {\n ...(extractTableHtmlAttributes(remainingProps) as Omit<\n HTMLMotionProps<'div'>,\n 'children' | 'className' | 'data-row-id' | 'onClick' | 'onKeyDown' | 'role' | 'style' | 'tabIndex'\n >),\n className: rowClassNames,\n 'data-index': rowIndex,\n 'data-row-id': String(rowId),\n onClick: interactiveRowProps.onClick,\n onKeyDown: interactiveRowProps.onKeyDown,\n role: 'row' as const,\n tabIndex: interactiveRowProps.tabIndex,\n onAnimationStart: () => setIsAnimating(true),\n onAnimationComplete: () => setIsAnimating(false),\n ...mergedRowAnimationProps,\n style: {\n ...(mergedRowAnimationProps?.style ?? {}),\n overflow: isAnimating ? 'hidden' : 'visible',\n },\n };\n\n const rowNode = (\n <TableRowContext.Provider\n value={{\n nextColumnIndex: (explicitColumnIndex, span = 1) => {\n if (explicitColumnIndex !== undefined && explicitColumnIndex >= 0) {\n cellIndexRef.current = explicitColumnIndex + span;\n return explicitColumnIndex;\n }\n\n const nextIndex = cellIndexRef.current;\n cellIndexRef.current += span;\n return nextIndex;\n },\n rowIndex,\n rowId,\n rowData,\n }}\n >\n {mergedRowAnimationProps ? (\n <motion.div {...animatedRowProps}>{rowContent}</motion.div>\n ) : (\n <div {...staticRowProps}>{rowContent}</div>\n )}\n </TableRowContext.Provider>\n );\n\n renderContext.renderDraft.hasExpandableRows = true;\n renderContext.renderDraft.bodyRows.push({\n rowId,\n rowIndex,\n kind: 'expanded',\n selectable: selectable !== false,\n render: () => rowNode,\n });\n\n return renderContext.isRegisteringBodyRows ? null : rowNode;\n};\n\nexport default TableExpandedRow;\n"],"names":["DEFAULT_EXPANDED_ROW_DURATION","TableExpandedRowSelectionCell","props","isSelected","isSelectable","hideSelectionControl","isTableView","onToggleSelection","cardCellClassName","selectionCheckboxVerticalAlignment","jsx","classNames","getVerticalAlignClassName","event","Checkbox","TableExpandedRow","children","className","noHover","_parentKey","selectable","remainingProps","renderConfigContext","useOptionalTableRenderConfigContext","renderContext","useOptionalTableRenderContext","interactionContext","useOptionalTableInteractionContext","section","useOptionalTableSection","bodyContext","useTableBodyContext","cellIndexRef","useRef","isAnimating","setIsAnimating","useState","shouldReduceMotion","useReducedMotion","animation","useMemo","rowData","rowIndex","rowId","resolveRowKey","resolvedRowAnimationProps","interactiveRowProps","getInteractiveRowProps","clickedRow","clickedRowIndex","mergedRowAnimationProps","rowClassNames","resolveRowClassName","selectionCell","rowContent","jsxs","Fragment","staticRowProps","extractTableHtmlAttributes","animatedRowProps","rowNode","TableRowContext","explicitColumnIndex","span","nextIndex","motion"],"mappings":";;;;;;;;;;;;AAoBA,MAAMA,IAAgC,MAwChCC,KAAgC,CAACC,MAA8C;AACjF,QAAM;AAAA,IACF,YAAAC;AAAA,IACA,cAAAC;AAAA,IACA,sBAAAC;AAAA,IACA,aAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,oCAAAC;AAAA,EAAA,IACAP;AACJ,SACI,gBAAAQ;AAAA,IAAC;AAAA,IAAA;AAAA,MACG,WAAWC;AAAA,QACP;AAAA,QACAC,EAA0BH,CAAkC;AAAA,QAC5D,CAACH,KAAeE;AAAA,MAAA;AAAA,MAEpB,MAAK;AAAA,MACL,iBAAe;AAAA,MACf,OAAOF,IAAc,EAAE,YAAY,cAAc,SAAS,iBAAiB;AAAA,MAC3E,SAAS,CAAAO,MAASA,EAAM,gBAAA;AAAA,MACxB,WAAW,CAAAA,MAASA,EAAM,gBAAA;AAAA,MAEzB,UAAA,CAACR,KACE,gBAAAK,EAAC,OAAA,EAAI,WAAU,2BACX,UAAA,gBAAAA,EAACI,GAAA,EAAS,SAASX,GAAY,UAAU,CAACC,GAAc,UAAUG,GAAmB,EAAA,CACzF;AAAA,IAAA;AAAA,EAAA;AAIhB,GAEMQ,KAAmB,CAA8Cb,MAA0C;AAC7G,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A;AAKjD,SAAA9B,EAAc,YAAY,oBAAoB,IAC9CA,EAAc,YAAY,SAAS,KAAK;AAAA,IACpC,OAAAmB;AAAA,IACA,UAAAD;AAAA,IACA,MAAM;AAAA,IACN,YAAYtB,MAAe;AAAA,IAC3B,QAAQ,MAAMwC;AAAA,EAAA,CACjB,GAEMpC,EAAc,wBAAwB,OAAOoC;AACxD;"}
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import { jsx as l } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { useOptionalTableRenderContext as
|
|
5
|
-
const
|
|
6
|
-
const { expanded:
|
|
2
|
+
import d from "../button/Button.js";
|
|
3
|
+
import i from "../../utils/classNames.js";
|
|
4
|
+
import { useOptionalTableRenderContext as m } from "./context/TableRenderContext.js";
|
|
5
|
+
const u = (t) => {
|
|
6
|
+
const { expanded: n = !1, disabled: a = !1, onClick: o, className: r, ...s } = t, e = m();
|
|
7
7
|
return e && (e.renderDraft.hasExpandableRows = !0), /* @__PURE__ */ l(
|
|
8
|
-
|
|
8
|
+
d,
|
|
9
9
|
{
|
|
10
10
|
...s,
|
|
11
11
|
bsStyle: "muted",
|
|
12
12
|
bsSize: "xs",
|
|
13
13
|
iconOnly: !0,
|
|
14
|
-
disabled:
|
|
15
|
-
iconName:
|
|
16
|
-
className:
|
|
17
|
-
onClick:
|
|
14
|
+
disabled: a,
|
|
15
|
+
iconName: "rioglyph-chevron-down",
|
|
16
|
+
className: i("table-expander-button", n && "table-expander-button-expanded", r),
|
|
17
|
+
onClick: o
|
|
18
18
|
}
|
|
19
19
|
);
|
|
20
20
|
};
|
|
21
21
|
export {
|
|
22
|
-
|
|
22
|
+
u as default
|
|
23
23
|
};
|
|
24
24
|
//# sourceMappingURL=TableExpanderButton.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableExpanderButton.js","sources":["../../../src/components/table/TableExpanderButton.tsx"],"sourcesContent":["import type { MouseEventHandler } from 'react';\n\nimport Button from '../button/Button';\nimport classNames from '../../utils/classNames';\nimport { useOptionalTableRenderContext } from './context/TableRenderContext';\n\nexport type TableExpanderButtonProps = {\n /**\n * Controls whether the related row is currently expanded.\n *\n * @default false\n */\n expanded?: boolean;\n\n /**\n * Disables the expander button.\n *\n * @default false\n */\n disabled?: boolean;\n\n /**\n * Callback triggered when the expander button is clicked.\n */\n onClick?: MouseEventHandler<HTMLButtonElement>;\n\n /**\n * Optional additional class names for the button element.\n */\n className?: string;\n};\n\nconst TableExpanderButton = (props: TableExpanderButtonProps) => {\n const { expanded = false, disabled = false, onClick, className, ...remainingProps } = props;\n\n const renderContext = useOptionalTableRenderContext();\n\n if (renderContext) {\n renderContext.renderDraft.hasExpandableRows = true;\n }\n\n return (\n <Button\n {...remainingProps}\n bsStyle='muted'\n bsSize='xs'\n iconOnly\n disabled={disabled}\n iconName=
|
|
1
|
+
{"version":3,"file":"TableExpanderButton.js","sources":["../../../src/components/table/TableExpanderButton.tsx"],"sourcesContent":["import type { MouseEventHandler } from 'react';\n\nimport Button from '../button/Button';\nimport classNames from '../../utils/classNames';\nimport { useOptionalTableRenderContext } from './context/TableRenderContext';\n\nexport type TableExpanderButtonProps = {\n /**\n * Controls whether the related row is currently expanded.\n *\n * @default false\n */\n expanded?: boolean;\n\n /**\n * Disables the expander button.\n *\n * @default false\n */\n disabled?: boolean;\n\n /**\n * Callback triggered when the expander button is clicked.\n */\n onClick?: MouseEventHandler<HTMLButtonElement>;\n\n /**\n * Optional additional class names for the button element.\n */\n className?: string;\n};\n\nconst TableExpanderButton = (props: TableExpanderButtonProps) => {\n const { expanded = false, disabled = false, onClick, className, ...remainingProps } = props;\n\n const renderContext = useOptionalTableRenderContext();\n\n if (renderContext) {\n renderContext.renderDraft.hasExpandableRows = true;\n }\n\n return (\n <Button\n {...remainingProps}\n bsStyle='muted'\n bsSize='xs'\n iconOnly\n disabled={disabled}\n iconName='rioglyph-chevron-down'\n className={classNames('table-expander-button', expanded && 'table-expander-button-expanded', className)}\n onClick={onClick}\n />\n );\n};\n\nexport default TableExpanderButton;\n"],"names":["TableExpanderButton","props","expanded","disabled","onClick","className","remainingProps","renderContext","useOptionalTableRenderContext","jsx","Button","classNames"],"mappings":";;;;AAgCA,MAAMA,IAAsB,CAACC,MAAoC;AAC7D,QAAM,EAAE,UAAAC,IAAW,IAAO,UAAAC,IAAW,IAAO,SAAAC,GAAS,WAAAC,GAAW,GAAGC,EAAA,IAAmBL,GAEhFM,IAAgBC,EAAA;AAEtB,SAAID,MACAA,EAAc,YAAY,oBAAoB,KAI9C,gBAAAE;AAAA,IAACC;AAAA,IAAA;AAAA,MACI,GAAGJ;AAAA,MACJ,SAAQ;AAAA,MACR,QAAO;AAAA,MACP,UAAQ;AAAA,MACR,UAAAH;AAAA,MACA,UAAS;AAAA,MACT,WAAWQ,EAAW,yBAAyBT,KAAY,kCAAkCG,CAAS;AAAA,MACtG,SAAAD;AAAA,IAAA;AAAA,EAAA;AAGZ;"}
|
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import { TableHtmlAttributes } from './Table.types';
|
|
2
|
+
import { TableHtmlAttributes, TableRowId } from './Table.types';
|
|
3
3
|
export type TableGroupRowProps = TableHtmlAttributes & {
|
|
4
|
+
/**
|
|
5
|
+
* Stable row key for selectable group rows.
|
|
6
|
+
*/
|
|
7
|
+
id?: TableRowId;
|
|
4
8
|
/**
|
|
5
9
|
* The content of the full-width group row.
|
|
6
10
|
*/
|
|
7
11
|
children?: ReactNode;
|
|
8
12
|
/**
|
|
9
|
-
* Keeps the group row sticky at the top of
|
|
13
|
+
* Keeps the group row sticky at the top of the current table scroll context.
|
|
14
|
+
* When a sticky `TableHeader` is present, the row stacks below the measured header height.
|
|
15
|
+
* `TableBody maxHeight` continues to pin the row inside the internal body scroller.
|
|
10
16
|
*
|
|
11
17
|
* @default false
|
|
12
18
|
*/
|
|
@@ -15,6 +21,14 @@ export type TableGroupRowProps = TableHtmlAttributes & {
|
|
|
15
21
|
* Optional class names only for this group row.
|
|
16
22
|
*/
|
|
17
23
|
className?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Includes this group row in table selection.
|
|
26
|
+
*
|
|
27
|
+
* Group rows are not selectable by default so existing grouped tables keep their current full-width layout.
|
|
28
|
+
*
|
|
29
|
+
* @default false
|
|
30
|
+
*/
|
|
31
|
+
selectable?: boolean;
|
|
18
32
|
/**
|
|
19
33
|
* Disable table hover styling for this row.
|
|
20
34
|
*/
|