@wallarm-org/design-system 2.4.1-rc-fix-code-snippet-fullscreen-in-dialog.1 → 2.6.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/dist/components/Table/StickyGroupParent.js +11 -4
- package/dist/components/Table/TableBody/TableRowOverlay.js +46 -30
- package/dist/components/Table/TableContext/TableProvider.js +318 -304
- package/dist/components/Table/TableContext/types.d.ts +3 -0
- package/dist/components/Table/TableRow.d.ts +12 -1
- package/dist/components/Table/TableRow.js +264 -177
- package/dist/components/Table/lib/createDragHandleColumn.js +5 -24
- package/dist/components/Table/lib/createExpandColumn.d.ts +6 -2
- package/dist/components/Table/lib/createExpandColumn.js +2 -2
- package/dist/components/Table/lib/useRowDnd.d.ts +2 -0
- package/dist/components/Table/lib/useRowDnd.js +46 -41
- package/dist/components/Table/types.d.ts +46 -0
- package/dist/metadata/components.json +38 -3
- package/package.json +1 -1
|
@@ -2,18 +2,19 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { useEffect, useRef } from "react";
|
|
3
3
|
import { cn } from "../../utils/cn.js";
|
|
4
4
|
import { useStickyGroupParent } from "./hooks/index.js";
|
|
5
|
-
import { TABLE_DRAG_HANDLE_COLUMN_ID, TABLE_EXPAND_COLUMN_ID, TABLE_SELECT_COLUMN_ID, useTableValue, withTableState } from "./lib/index.js";
|
|
5
|
+
import { TABLE_DRAG_HANDLE_COLUMN_ID, TABLE_EXPAND_COLUMN_ID, TABLE_SELECT_COLUMN_ID, useRenderEveryTime, useTableValue, withTableState } from "./lib/index.js";
|
|
6
6
|
import { Td, Tr } from "./primitives/index.js";
|
|
7
7
|
import { TableBodyCell } from "./TableBody/TableBodyCell.js";
|
|
8
8
|
import { TableColGroup } from "./TableColGroup.js";
|
|
9
9
|
import { useTableContext } from "./TableContext/index.js";
|
|
10
|
+
import { TableFullWidthCell } from "./TableRow.js";
|
|
10
11
|
const SYSTEM_COLUMN_IDS = new Set([
|
|
11
12
|
TABLE_EXPAND_COLUMN_ID,
|
|
12
13
|
TABLE_SELECT_COLUMN_ID,
|
|
13
14
|
TABLE_DRAG_HANDLE_COLUMN_ID
|
|
14
15
|
]);
|
|
15
16
|
const StickyGroupParent = ({ tableWidth, headerHeight })=>{
|
|
16
|
-
const { table, containerRef, tbodyRef, virtualizerRef, virtualized } = useTableContext();
|
|
17
|
+
const { table, containerRef, tbodyRef, virtualizerRef, virtualized, renderFullWidthGroupRow } = useTableContext();
|
|
17
18
|
const useWindowScroll = 'window' === virtualized;
|
|
18
19
|
const { stickyRow, pushUpOffset } = useStickyGroupParent({
|
|
19
20
|
table,
|
|
@@ -64,6 +65,8 @@ const StickyGroupParent = ({ tableWidth, headerHeight })=>{
|
|
|
64
65
|
const dataCells = cells?.filter((c)=>!SYSTEM_COLUMN_IDS.has(c.column.id));
|
|
65
66
|
const firstDataCell = dataCells?.[0];
|
|
66
67
|
const isSelected = useTableValue(()=>stickyRow?.getIsAllSubRowsSelected());
|
|
68
|
+
const fullWidthContent = useRenderEveryTime(()=>stickyRow ? renderFullWidthGroupRow?.(stickyRow) : void 0);
|
|
69
|
+
const isFullWidth = void 0 !== fullWidthContent;
|
|
67
70
|
return /*#__PURE__*/ jsx("div", {
|
|
68
71
|
className: "sticky z-[21] h-0 overflow-visible pointer-events-none",
|
|
69
72
|
style: {
|
|
@@ -98,12 +101,16 @@ const StickyGroupParent = ({ tableWidth, headerHeight })=>{
|
|
|
98
101
|
cell: cell,
|
|
99
102
|
disablePinnedShadow: true
|
|
100
103
|
}, cell.id)),
|
|
101
|
-
|
|
104
|
+
isFullWidth && /*#__PURE__*/ jsx(TableFullWidthCell, {
|
|
105
|
+
colSpan: dataCells.length,
|
|
106
|
+
children: fullWidthContent
|
|
107
|
+
}),
|
|
108
|
+
!isFullWidth && firstDataCell && /*#__PURE__*/ jsx(TableBodyCell, {
|
|
102
109
|
cell: firstDataCell,
|
|
103
110
|
className: "border-r-0",
|
|
104
111
|
disablePinnedShadow: true
|
|
105
112
|
}),
|
|
106
|
-
withTableState(table.state, ()=>dataCells.slice(1).map((cell)=>/*#__PURE__*/ jsx(Td, {
|
|
113
|
+
withTableState(table.state, ()=>(isFullWidth ? [] : dataCells).slice(1).map((cell)=>/*#__PURE__*/ jsx(Td, {
|
|
107
114
|
className: cn('border-b border-border-primary-light bg-bg-surface-2 overlay', 'group-hover/row:overlay-states-primary-hover group-data-[selected]/row:overlay-states-primary-active', 'group-data-[preview-active]/row:overlay-states-primary-hover group-has-[[data-state=open]]/row:overlay-states-primary-hover'),
|
|
108
115
|
style: {
|
|
109
116
|
width: cell.column.getSize()
|
|
@@ -1,17 +1,25 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { c as compiler_runtime_c } from "react/compiler-runtime";
|
|
3
3
|
import { flexRender } from "@tanstack/react-table";
|
|
4
4
|
import { cn } from "../../../utils/cn.js";
|
|
5
|
-
import { getAlignClass, withTableState } from "../lib/index.js";
|
|
5
|
+
import { getAlignClass, useRenderEveryTime, withTableState } from "../lib/index.js";
|
|
6
6
|
import { Td, Tr } from "../primitives/index.js";
|
|
7
7
|
import { useTableContext } from "../TableContext/index.js";
|
|
8
8
|
const TableRowOverlayInner = (t0)=>{
|
|
9
|
-
const $ = compiler_runtime_c(
|
|
9
|
+
const $ = compiler_runtime_c(10);
|
|
10
10
|
const { row } = t0;
|
|
11
|
-
const { table } = useTableContext();
|
|
11
|
+
const { table, renderFullWidthRow } = useTableContext();
|
|
12
12
|
let t1;
|
|
13
|
-
if ($[0] !==
|
|
14
|
-
t1 = ()=>
|
|
13
|
+
if ($[0] !== renderFullWidthRow || $[1] !== row) {
|
|
14
|
+
t1 = ()=>renderFullWidthRow?.(row);
|
|
15
|
+
$[0] = renderFullWidthRow;
|
|
16
|
+
$[1] = row;
|
|
17
|
+
$[2] = t1;
|
|
18
|
+
} else t1 = $[2];
|
|
19
|
+
const fullWidthContent = useRenderEveryTime(t1);
|
|
20
|
+
let t2;
|
|
21
|
+
if ($[3] !== fullWidthContent || $[4] !== row || $[5] !== table) {
|
|
22
|
+
t2 = ()=>{
|
|
15
23
|
const visibleColumns = table.getVisibleLeafColumns();
|
|
16
24
|
return /*#__PURE__*/ jsx("table", {
|
|
17
25
|
className: "w-full table-fixed border-collapse",
|
|
@@ -20,36 +28,44 @@ const TableRowOverlayInner = (t0)=>{
|
|
|
20
28
|
cursor: "grabbing"
|
|
21
29
|
},
|
|
22
30
|
children: /*#__PURE__*/ jsx("tbody", {
|
|
23
|
-
children: /*#__PURE__*/
|
|
31
|
+
children: /*#__PURE__*/ jsxs(Tr, {
|
|
24
32
|
className: "pointer-events-none shadow-lg opacity-90 bg-bg-primary",
|
|
25
|
-
children:
|
|
26
|
-
|
|
27
|
-
const meta = cell.column.columnDef.meta;
|
|
28
|
-
return /*#__PURE__*/ jsx(Td, {
|
|
33
|
+
children: [
|
|
34
|
+
void 0 !== fullWidthContent && /*#__PURE__*/ jsx(Td, {
|
|
29
35
|
pinned: false,
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
36
|
+
colSpan: row.getVisibleCells().length,
|
|
37
|
+
children: fullWidthContent
|
|
38
|
+
}),
|
|
39
|
+
(void 0 === fullWidthContent ? row.getVisibleCells() : []).map((cell)=>{
|
|
40
|
+
const column = visibleColumns.find((c)=>c.id === cell.column.id);
|
|
41
|
+
const meta = cell.column.columnDef.meta;
|
|
42
|
+
return /*#__PURE__*/ jsx(Td, {
|
|
43
|
+
pinned: false,
|
|
44
|
+
className: cn(getAlignClass(meta), meta?.cellClassName),
|
|
45
|
+
style: {
|
|
46
|
+
width: column?.getSize()
|
|
47
|
+
},
|
|
48
|
+
children: flexRender(cell.column.columnDef.cell, cell.getContext())
|
|
49
|
+
}, cell.id);
|
|
50
|
+
})
|
|
51
|
+
]
|
|
37
52
|
})
|
|
38
53
|
})
|
|
39
54
|
});
|
|
40
55
|
};
|
|
41
|
-
$[
|
|
42
|
-
$[
|
|
43
|
-
$[
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
$[
|
|
50
|
-
$[
|
|
51
|
-
|
|
52
|
-
|
|
56
|
+
$[3] = fullWidthContent;
|
|
57
|
+
$[4] = row;
|
|
58
|
+
$[5] = table;
|
|
59
|
+
$[6] = t2;
|
|
60
|
+
} else t2 = $[6];
|
|
61
|
+
let t3;
|
|
62
|
+
if ($[7] !== t2 || $[8] !== table.state) {
|
|
63
|
+
t3 = withTableState(table.state, t2);
|
|
64
|
+
$[7] = t2;
|
|
65
|
+
$[8] = table.state;
|
|
66
|
+
$[9] = t3;
|
|
67
|
+
} else t3 = $[9];
|
|
68
|
+
return t3;
|
|
53
69
|
};
|
|
54
70
|
const TableRowOverlay = TableRowOverlayInner;
|
|
55
71
|
TableRowOverlay.displayName = "TableRowOverlay";
|