@rio-cloud/rio-uikit 2.3.0-beta.2 → 2.3.0-beta.3
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/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/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 +189 -157
- package/components/map/components/Map.js.map +1 -1
- package/components/map/components/MapContext.d.ts +1 -0
- package/components/map/components/MapContext.js +8 -7
- package/components/map/components/MapContext.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 +135 -0
- package/components/map/utils/mapTypes.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.js +208 -205
- package/components/table/Table.js.map +1 -1
- package/components/table/Table.types.d.ts +13 -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.js +11 -11
- package/components/table/TableExpandedRow.js.map +1 -1
- package/components/table/TableHeader.d.ts +17 -0
- package/components/table/TableHeader.js +89 -76
- 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 +6 -0
- package/components/table/TableRow.js +49 -48
- package/components/table/TableRow.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/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/useTableLayout.d.ts +2 -1
- package/components/table/layout/useTableLayout.js +37 -30
- package/components/table/layout/useTableLayout.js.map +1 -1
- 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/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/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/package.json +1 -1
- 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 +1 -1
- package/version.js.map +1 -1
|
@@ -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,IAA0Bz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
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 *\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"],"mappings":";;;;;;;;;;AAgFA,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,KACAF,GAAY,WACZV,EAAoB;AAAA,IAChBU,EAAW;AAAA,IACXR,EAAc,uBAAuB,IAAIc,GAAc,aAAavB,KAAa,EAAE,KAAK;AAAA,MACpF,KAAKuB,GAAc,aAAavB,KAAa,OAAOwB,CAAe;AAAA,MACnE,OAAOD,GAAc,SAAS;AAAA,MAC9B,MAAMA,GA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8B,EAAgB1C,CAAO;AAAA,MACrC,SAASI,IAAkB+B,IAAwB;AAAA,MACnD,WAAW/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;"}
|
|
@@ -10,23 +10,23 @@ import { useOptionalTableSection as G, useTableBodyContext as J, extractTableHtm
|
|
|
10
10
|
import { useOptionalTableRenderContext as Y } from "./context/TableRenderContext.js";
|
|
11
11
|
import { getInteractiveRowProps as Z } from "./shared/getInteractiveRowProps.js";
|
|
12
12
|
const u = 0.18, $ = (C) => {
|
|
13
|
-
const { isSelected: b, isTableView: m, onToggleSelection:
|
|
13
|
+
const { isSelected: b, isTableView: m, onToggleSelection: R, cardCellClassName: x } = C;
|
|
14
14
|
return /* @__PURE__ */ s(
|
|
15
15
|
"div",
|
|
16
16
|
{
|
|
17
|
-
className: A("table-cell table-selection-cell", !m &&
|
|
17
|
+
className: A("table-cell table-selection-cell", !m && x),
|
|
18
18
|
role: "cell",
|
|
19
19
|
"aria-colindex": 1,
|
|
20
|
-
style: m ? { gridColumn: "1 / span 1" } : void 0,
|
|
20
|
+
style: m ? { gridColumn: "1 / span 1", gridRow: "1 / span 1" } : void 0,
|
|
21
21
|
onClick: (a) => a.stopPropagation(),
|
|
22
22
|
onKeyDown: (a) => a.stopPropagation(),
|
|
23
|
-
children: /* @__PURE__ */ s("div", { className: "table-selection-control", children: /* @__PURE__ */ s(L, { checked: b, onChange:
|
|
23
|
+
children: /* @__PURE__ */ s("div", { className: "table-selection-control", children: /* @__PURE__ */ s(L, { checked: b, onChange: R }) })
|
|
24
24
|
}
|
|
25
25
|
);
|
|
26
26
|
}, me = (C) => {
|
|
27
|
-
const { children: b, className: m, noHover:
|
|
27
|
+
const { children: b, className: m, noHover: R, parentKey: x, ...a } = C, e = z(), l = Y(), o = q(), P = G(), g = J(), w = F(0);
|
|
28
28
|
w.current = 0;
|
|
29
|
-
const [S,
|
|
29
|
+
const [S, y] = H(!0), f = j(), D = U(
|
|
30
30
|
() => f ? {
|
|
31
31
|
initial: { opacity: 0 },
|
|
32
32
|
animate: {
|
|
@@ -54,9 +54,9 @@ const u = 0.18, $ = (C) => {
|
|
|
54
54
|
},
|
|
55
55
|
[f]
|
|
56
56
|
);
|
|
57
|
-
if (!l || !e || !o || l.columns.length === 0 || P !== "body" || !
|
|
57
|
+
if (!l || !e || !o || l.columns.length === 0 || P !== "body" || !g)
|
|
58
58
|
return null;
|
|
59
|
-
const c = a, n =
|
|
59
|
+
const c = a, n = g.nextRowIndex(), t = W(c, n, e.rowKey), k = typeof e.rowAnimationProps == "function" ? e.rowAnimationProps(c, n) : e.rowAnimationProps, i = Z({
|
|
60
60
|
isClickable: o.isClickable,
|
|
61
61
|
onRowClick: (r, d) => {
|
|
62
62
|
o.onRowClick?.(r, d), o.onActiveRowChange?.(
|
|
@@ -80,7 +80,7 @@ const u = 0.18, $ = (C) => {
|
|
|
80
80
|
o.activeRowId === t && "table-row-active",
|
|
81
81
|
h && "table-row-selected",
|
|
82
82
|
i.isClickableClassName,
|
|
83
|
-
|
|
83
|
+
R && "table-row-no-hover",
|
|
84
84
|
!e.isTableView && e.cardClasses.rowClassName,
|
|
85
85
|
m,
|
|
86
86
|
X(e.rowClassName, c, n)
|
|
@@ -113,8 +113,8 @@ const u = 0.18, $ = (C) => {
|
|
|
113
113
|
onKeyDown: i.onKeyDown,
|
|
114
114
|
role: "row",
|
|
115
115
|
tabIndex: i.tabIndex,
|
|
116
|
-
onAnimationStart: () =>
|
|
117
|
-
onAnimationComplete: () =>
|
|
116
|
+
onAnimationStart: () => y(!0),
|
|
117
|
+
onAnimationComplete: () => y(!1),
|
|
118
118
|
...p,
|
|
119
119
|
style: {
|
|
120
120
|
...p?.style ?? {},
|
|
@@ -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' } : 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,iBAAiB;AAAA,MACpD,SAAS,CAAAK,MAASA,EAAM,gBAAA;AAAA,MACxB,WAAW,CAA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,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 { 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,GACVC,IAAcC,EAAA,GAEdC,IAAeC,EAAO,CAAC;AAC7B,EAAAD,EAAa,UAAU;AAEvB,QAAM,CAACE,GAAaC,CAAc,IAAIC,EAAS,EAAI,GAC7CC,IAAqBC,EAAA,GAErBC,IAAYC;AAAA,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BAAkB,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;"}
|
|
@@ -5,6 +5,23 @@ export type TableHeaderProps<RowType extends TableRowData> = TableHtmlAttributes
|
|
|
5
5
|
* Additional class names for the header grid wrapper.
|
|
6
6
|
*/
|
|
7
7
|
className?: string;
|
|
8
|
+
/**
|
|
9
|
+
* Keeps the table header sticky while the page scrolls.
|
|
10
|
+
*
|
|
11
|
+
* This applies in `TABLE` view only.
|
|
12
|
+
*
|
|
13
|
+
* @default false
|
|
14
|
+
*/
|
|
15
|
+
sticky?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Keeps the sticky header pinned to the top edge of an explicit scroll container.
|
|
18
|
+
*
|
|
19
|
+
* Use this when the table sits inside a wrapper with an overflow class like `overflow-y-scroll`.
|
|
20
|
+
* When omitted, sticky headers compensate the default `ApplicationLayout` body padding.
|
|
21
|
+
*
|
|
22
|
+
* @default false
|
|
23
|
+
*/
|
|
24
|
+
stickyInContainer?: boolean;
|
|
8
25
|
/**
|
|
9
26
|
* Table header content.
|
|
10
27
|
*/
|
|
@@ -1,95 +1,108 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useSensors as
|
|
3
|
-
import { restrictToHorizontalAxis as
|
|
4
|
-
import { SortableContext as
|
|
5
|
-
import { useRef as
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import { resolveColumnCollisionDetection as
|
|
10
|
-
import { useOptionalTableInteractionContext as
|
|
11
|
-
import { useOptionalTableLayoutContext as
|
|
12
|
-
import { useOptionalTableRenderConfigContext as
|
|
13
|
-
import { TableSectionContext as
|
|
14
|
-
import { useOptionalTableRenderContext as
|
|
15
|
-
const
|
|
16
|
-
const { children: s, className:
|
|
17
|
-
if (!l || !
|
|
1
|
+
import { jsxs as v, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { useSensors as k, useSensor as E, PointerSensor as N, DndContext as j, DragOverlay as z } from "@dnd-kit/core";
|
|
3
|
+
import { restrictToHorizontalAxis as L } from "@dnd-kit/modifiers";
|
|
4
|
+
import { SortableContext as W, horizontalListSortingStrategy as V } from "@dnd-kit/sortable";
|
|
5
|
+
import { useRef as _, useState as f } from "react";
|
|
6
|
+
import p from "../../utils/classNames.js";
|
|
7
|
+
import $ from "./render/header/TableHeaderDragOverlay.js";
|
|
8
|
+
import q from "./render/header/TableHeaderSelectionCell.js";
|
|
9
|
+
import { resolveColumnCollisionDetection as B } from "./render/header/resolveColumnCollisionDetection.js";
|
|
10
|
+
import { useOptionalTableInteractionContext as F } from "./context/TableInteractionContext.js";
|
|
11
|
+
import { useOptionalTableLayoutContext as G } from "./context/TableLayoutContext.js";
|
|
12
|
+
import { useOptionalTableRenderConfigContext as J } from "./context/TableRenderConfigContext.js";
|
|
13
|
+
import { TableSectionContext as x, TableHeaderContext as S } from "./context/TableStructureContext.js";
|
|
14
|
+
import { useOptionalTableRenderContext as M } from "./context/TableRenderContext.js";
|
|
15
|
+
const de = (w) => {
|
|
16
|
+
const { children: s, className: b, sticky: d = !1, stickyInContainer: D = !1, ...y } = w, l = M(), c = J(), t = F(), n = G();
|
|
17
|
+
if (!l || !c || !t || !n)
|
|
18
18
|
return null;
|
|
19
|
-
const
|
|
19
|
+
const R = k(E(N, { activationConstraint: { distance: 6 } })), r = _(0);
|
|
20
20
|
r.current = 0;
|
|
21
|
-
const [
|
|
21
|
+
const [m, u] = f(void 0), [H, g] = f(void 0), T = !!n.onColumnDragEnd && (n.draggableColumnKeys?.length ?? 0) > 1, i = l.header, a = i?.rowCount ?? 1, A = i ?? {
|
|
22
22
|
rowCount: a,
|
|
23
23
|
totalColumnCount: l.columns.length,
|
|
24
24
|
columns: []
|
|
25
|
-
},
|
|
26
|
-
|
|
27
|
-
},
|
|
28
|
-
|
|
29
|
-
},
|
|
30
|
-
|
|
31
|
-
},
|
|
32
|
-
|
|
33
|
-
},
|
|
34
|
-
|
|
25
|
+
}, I = m ? i?.columns.find((e) => (e.columnKey ?? String(e.key)) === m) : void 0, C = () => {
|
|
26
|
+
u(void 0), g(void 0);
|
|
27
|
+
}, K = (e) => {
|
|
28
|
+
u(String(e.active.id)), g(e.active.rect.current.initial?.width ?? void 0);
|
|
29
|
+
}, O = (e) => {
|
|
30
|
+
C();
|
|
31
|
+
}, P = (e) => {
|
|
32
|
+
C(), n.onColumnDragEnd?.(e);
|
|
33
|
+
}, h = T && n.draggableColumnKeys ? /* @__PURE__ */ v(
|
|
34
|
+
j,
|
|
35
35
|
{
|
|
36
|
-
sensors:
|
|
37
|
-
collisionDetection:
|
|
38
|
-
modifiers: [
|
|
39
|
-
onDragStart:
|
|
40
|
-
onDragCancel:
|
|
41
|
-
onDragEnd:
|
|
36
|
+
sensors: R,
|
|
37
|
+
collisionDetection: B,
|
|
38
|
+
modifiers: [L],
|
|
39
|
+
onDragStart: K,
|
|
40
|
+
onDragCancel: O,
|
|
41
|
+
onDragEnd: P,
|
|
42
42
|
children: [
|
|
43
|
-
/* @__PURE__ */ o(
|
|
44
|
-
/* @__PURE__ */ o(
|
|
45
|
-
|
|
43
|
+
/* @__PURE__ */ o(W, { items: n.draggableColumnKeys, strategy: V, children: s }),
|
|
44
|
+
/* @__PURE__ */ o(z, { adjustScale: !1, dropAnimation: null, children: /* @__PURE__ */ o(
|
|
45
|
+
$,
|
|
46
46
|
{
|
|
47
|
-
column:
|
|
48
|
-
header:
|
|
47
|
+
column: I,
|
|
48
|
+
header: A,
|
|
49
49
|
showSelectionColumn: t.showSelectionColumn,
|
|
50
|
-
width:
|
|
50
|
+
width: H
|
|
51
51
|
}
|
|
52
52
|
) })
|
|
53
53
|
]
|
|
54
54
|
}
|
|
55
55
|
) : s;
|
|
56
|
-
return
|
|
57
|
-
|
|
56
|
+
return c.isTableView ? /* @__PURE__ */ o(
|
|
57
|
+
"div",
|
|
58
58
|
{
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
59
|
+
...y,
|
|
60
|
+
className: p(
|
|
61
|
+
"table-head",
|
|
62
|
+
d && "table-head-sticky",
|
|
63
|
+
d && D && "table-head-sticky-in-container"
|
|
64
|
+
),
|
|
65
|
+
role: "rowgroup",
|
|
66
|
+
ref: n.tableHeadRowRef,
|
|
67
|
+
children: /* @__PURE__ */ o(x.Provider, { value: "header", children: /* @__PURE__ */ o(
|
|
68
|
+
S.Provider,
|
|
67
69
|
{
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
70
|
+
value: {
|
|
71
|
+
nextHeaderRowIndex: () => {
|
|
72
|
+
const e = r.current;
|
|
73
|
+
return r.current += 1, e;
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
children: /* @__PURE__ */ v(
|
|
77
|
+
"div",
|
|
78
|
+
{
|
|
79
|
+
className: p(
|
|
80
|
+
"table-head-grid",
|
|
81
|
+
t.selectionHeaderContent && "table-head-grid-custom-selection",
|
|
82
|
+
b
|
|
83
|
+
),
|
|
84
|
+
role: a === 1 ? "row" : "presentation",
|
|
85
|
+
style: { gridTemplateRows: `repeat(${a}, auto)` },
|
|
86
|
+
children: [
|
|
87
|
+
t.showSelectionColumn && /* @__PURE__ */ o(
|
|
88
|
+
q,
|
|
89
|
+
{
|
|
90
|
+
isAllSelected: t.isAllRowsSelected,
|
|
91
|
+
isSomeRowsSelected: t.isSomeRowsSelected,
|
|
92
|
+
onToggleAllSelection: t.onToggleAllSelection,
|
|
93
|
+
rowCount: a,
|
|
94
|
+
selectionHeaderContent: t.selectionHeaderContent
|
|
95
|
+
}
|
|
96
|
+
),
|
|
97
|
+
h
|
|
98
|
+
]
|
|
99
|
+
}
|
|
100
|
+
)
|
|
88
101
|
}
|
|
89
|
-
)
|
|
102
|
+
) })
|
|
90
103
|
}
|
|
91
|
-
)
|
|
92
|
-
|
|
104
|
+
) : /* @__PURE__ */ o(x.Provider, { value: "header", children: /* @__PURE__ */ o(
|
|
105
|
+
S.Provider,
|
|
93
106
|
{
|
|
94
107
|
value: {
|
|
95
108
|
nextHeaderRowIndex: () => {
|
|
@@ -97,11 +110,11 @@ const ie = (x) => {
|
|
|
97
110
|
return r.current += 1, e;
|
|
98
111
|
}
|
|
99
112
|
},
|
|
100
|
-
children:
|
|
113
|
+
children: h
|
|
101
114
|
}
|
|
102
115
|
) });
|
|
103
116
|
};
|
|
104
117
|
export {
|
|
105
|
-
|
|
118
|
+
de as default
|
|
106
119
|
};
|
|
107
120
|
//# sourceMappingURL=TableHeader.js.map
|