@pibit.ai/cure-design-system 0.3.28 → 0.3.33
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/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +54 -50
- package/dist/patterns/table/TableWrapper.d.ts +1 -1
- package/dist/patterns/table/TableWrapper.d.ts.map +1 -1
- package/dist/patterns/table/TableWrapper.js +881 -656
- package/dist/patterns/table/cellRangeSelection.d.ts +83 -0
- package/dist/patterns/table/cellRangeSelection.d.ts.map +1 -0
- package/dist/patterns/table/cellRangeSelection.js +162 -0
- package/dist/patterns/table/cellRangeSelection.test.d.ts +2 -0
- package/dist/patterns/table/cellRangeSelection.test.d.ts.map +1 -0
- package/dist/patterns/table/index.d.ts +2 -1
- package/dist/patterns/table/index.d.ts.map +1 -1
- package/dist/patterns/table/rowReorderDrag.d.ts +14 -1
- package/dist/patterns/table/rowReorderDrag.d.ts.map +1 -1
- package/dist/patterns/table/rowReorderDrag.js +106 -75
- package/dist/patterns/table/rowReorderDrag.test.d.ts +2 -0
- package/dist/patterns/table/rowReorderDrag.test.d.ts.map +1 -0
- package/dist/patterns/table/table.js +2 -2
- package/dist/patterns/table/types.d.ts +29 -0
- package/dist/patterns/table/types.d.ts.map +1 -1
- package/dist/styles/components.css +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/** Re-export the shared drag threshold so cell-range and row-reorder stay aligned. */
|
|
2
|
+
export declare const CELL_RANGE_DRAG_THRESHOLD_PX = 5;
|
|
3
|
+
export type TableCellCoord = {
|
|
4
|
+
rowId: string;
|
|
5
|
+
columnKey: string;
|
|
6
|
+
sourceIndex: number | null;
|
|
7
|
+
};
|
|
8
|
+
/** Controlled rectangular cell selection (Excel-style). One rectangle only. */
|
|
9
|
+
export type TableCellSelection = {
|
|
10
|
+
/** Where the range started (drag / Shift origin). */
|
|
11
|
+
anchor: TableCellCoord;
|
|
12
|
+
/** Active end of the range (keyboard focus / drag tip). */
|
|
13
|
+
focus: TableCellCoord;
|
|
14
|
+
};
|
|
15
|
+
/** Normalized rectangle in display order for copy/paste. */
|
|
16
|
+
export type TableCellRangeRect = {
|
|
17
|
+
rowIds: string[];
|
|
18
|
+
columnKeys: string[];
|
|
19
|
+
sourceIndices: Array<number | null>;
|
|
20
|
+
/** Top-left of the rectangle (min row/col in display order). */
|
|
21
|
+
start: TableCellCoord;
|
|
22
|
+
/** Bottom-right of the rectangle. */
|
|
23
|
+
end: TableCellCoord;
|
|
24
|
+
};
|
|
25
|
+
export type CellRangeEdgeFlags = {
|
|
26
|
+
top: boolean;
|
|
27
|
+
bottom: boolean;
|
|
28
|
+
left: boolean;
|
|
29
|
+
right: boolean;
|
|
30
|
+
};
|
|
31
|
+
export type CellRangeVisualState = {
|
|
32
|
+
inRange: boolean;
|
|
33
|
+
isAnchor: boolean;
|
|
34
|
+
isFocus: boolean;
|
|
35
|
+
/** True when the selection is a single cell (anchor === focus). */
|
|
36
|
+
isSingle: boolean;
|
|
37
|
+
edges: CellRangeEdgeFlags;
|
|
38
|
+
};
|
|
39
|
+
/** Inclusive min/max indices for the selection against the current grid axes. */
|
|
40
|
+
export declare function getSelectionIndexBounds(selection: TableCellSelection, rowIds: readonly string[], columnKeys: readonly string[]): {
|
|
41
|
+
rowMin: number;
|
|
42
|
+
rowMax: number;
|
|
43
|
+
colMin: number;
|
|
44
|
+
colMax: number;
|
|
45
|
+
} | null;
|
|
46
|
+
export declare function isSingleCellSelection(selection: TableCellSelection): boolean;
|
|
47
|
+
export declare function buildCellRangeRect(selection: TableCellSelection, rowIds: readonly string[], columnKeys: readonly string[]): TableCellRangeRect | null;
|
|
48
|
+
export declare function getCellRangeVisualState(selection: TableCellSelection | null | undefined, rowId: string, columnKey: string, rowIds: readonly string[], columnKeys: readonly string[]): CellRangeVisualState;
|
|
49
|
+
/** Inset box-shadow sides forming a continuous 2px brand border around the range. */
|
|
50
|
+
export declare function cellRangeEdgeBoxShadow(edges: CellRangeEdgeFlags): string | undefined;
|
|
51
|
+
/**
|
|
52
|
+
* Auto-scroll deltas for drag interactions (cell range or shared with future features).
|
|
53
|
+
* Same edge intensity model as row reorder, plus horizontal axis.
|
|
54
|
+
*/
|
|
55
|
+
export declare function getDragScrollDeltas(scrollContainer: HTMLElement, clientX: number, clientY: number, edgePx?: number, maxSpeedPx?: number): {
|
|
56
|
+
dx: number;
|
|
57
|
+
dy: number;
|
|
58
|
+
};
|
|
59
|
+
export declare function resolveCellCoordFromElement(cell: HTMLElement): TableCellCoord | null;
|
|
60
|
+
/**
|
|
61
|
+
* First selectable data cell of the row a keystroke came from.
|
|
62
|
+
*
|
|
63
|
+
* Row chrome (selection checkbox, row actions, delete button) is marked `data-grid-no-range`, so a
|
|
64
|
+
* keystroke that starts there resolves to no cell at all. Anchoring on the row's first data cell
|
|
65
|
+
* keeps the leading column inside the range instead of starting one column in.
|
|
66
|
+
*/
|
|
67
|
+
export declare function resolveRowAnchorCoordFromTarget(target: EventTarget | null, container: HTMLElement | null): TableCellCoord | null;
|
|
68
|
+
/** Find the grid cell under the pointer (for drag updates while scrolling). */
|
|
69
|
+
export declare function hitTestGridCell(container: HTMLElement, clientX: number, clientY: number): HTMLElement | null;
|
|
70
|
+
export declare function canStartCellRangeFromTarget(target: EventTarget | null, container: HTMLElement | null): HTMLElement | null;
|
|
71
|
+
export declare function selectionFromSingleCell(cell: TableCellCoord): TableCellSelection;
|
|
72
|
+
/**
|
|
73
|
+
* Selection after a keyboard move from `current` towards `neighbor` (`null` at a grid edge).
|
|
74
|
+
*
|
|
75
|
+
* `extend` is Shift+Arrow. Starting a range with nothing selected yet anchors on `current`, not on
|
|
76
|
+
* `neighbor` — anchoring on the neighbor would drop the column the user started from and shift the
|
|
77
|
+
* whole range one column across.
|
|
78
|
+
*
|
|
79
|
+
* Returns `selection` unchanged when the move is a no-op, and `null` when there is nothing to
|
|
80
|
+
* select (plain arrow at a grid edge).
|
|
81
|
+
*/
|
|
82
|
+
export declare function nextKeyboardCellSelection(current: TableCellCoord, neighbor: TableCellCoord | null, selection: TableCellSelection | null | undefined, extend: boolean): TableCellSelection | null;
|
|
83
|
+
//# sourceMappingURL=cellRangeSelection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cellRangeSelection.d.ts","sourceRoot":"","sources":["../../../src/patterns/table/cellRangeSelection.ts"],"names":[],"mappings":"AAOA,sFAAsF;AACtF,eAAO,MAAM,4BAA4B,IAAwB,CAAC;AAElE,MAAM,MAAM,cAAc,GAAG;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B,CAAC;AAEF,+EAA+E;AAC/E,MAAM,MAAM,kBAAkB,GAAG;IAC/B,qDAAqD;IACrD,MAAM,EAAE,cAAc,CAAC;IACvB,2DAA2D;IAC3D,KAAK,EAAE,cAAc,CAAC;CACvB,CAAC;AAEF,4DAA4D;AAC5D,MAAM,MAAM,kBAAkB,GAAG;IAC/B,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,aAAa,EAAE,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IACpC,gEAAgE;IAChE,KAAK,EAAE,cAAc,CAAC;IACtB,qCAAqC;IACrC,GAAG,EAAE,cAAc,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,GAAG,EAAE,OAAO,CAAC;IACb,MAAM,EAAE,OAAO,CAAC;IAChB,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;IACjB,mEAAmE;IACnE,QAAQ,EAAE,O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M,EAAE,WAAW,GAAG,IAAI,EAC1B,SAAS,EAAE,WAAW,GAAG,IAAI,GAC5B,cAAc,GAAG,IAAI,CAQvB;AAED,+EAA+E;AAC/E,wBAAgB,eAAe,CAC7B,SAAS,EAAE,WAAW,EACtB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,GACd,WAAW,GAAG,IAAI,CAQpB;AAED,wBAAgB,2BAA2B,CACzC,MAAM,EAAE,WAAW,GAAG,IAAI,EAC1B,SAAS,EAAE,WAAW,GAAG,IAAI,GAC5B,WAAW,GAAG,IAAI,CAcpB;AAED,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,cAAc,GAAG,kBAAkB,CAEhF;AAED;;;;;;;;;GASG;AACH,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,cAAc,EACvB,QAAQ,EAAE,cAAc,GAAG,IAAI,EAC/B,SAAS,EAAE,kBAAkB,GAAG,IAAI,GAAG,SAAS,EAChD,MAAM,EAAE,OAAO,GACd,kBAAkB,GAAG,IAAI,CAM3B"}
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { ROW_REORDER_ATTR as p, ROW_DRAG_THRESHOLD_PX as b, ROW_DRAG_SCROLL_EDGE_PX as E, ROW_DRAG_SCROLL_MAX_PX as _ } from "./rowReorderDrag.js";
|
|
2
|
+
const y = b;
|
|
3
|
+
function M(n, t) {
|
|
4
|
+
return n.indexOf(t);
|
|
5
|
+
}
|
|
6
|
+
function x(n, t, o) {
|
|
7
|
+
const r = M(t, n.anchor.rowId), l = M(t, n.focus.rowId), i = M(o, n.anchor.columnKey), e = M(o, n.focus.columnKey);
|
|
8
|
+
return r < 0 || l < 0 || i < 0 || e < 0 ? null : {
|
|
9
|
+
rowMin: Math.min(r, l),
|
|
10
|
+
rowMax: Math.max(r, l),
|
|
11
|
+
colMin: Math.min(i, e),
|
|
12
|
+
colMax: Math.max(i, e)
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
function w(n) {
|
|
16
|
+
return n.anchor.rowId === n.focus.rowId && n.anchor.columnKey === n.focus.columnKey;
|
|
17
|
+
}
|
|
18
|
+
function A(n, t, o) {
|
|
19
|
+
const r = x(n, t, o);
|
|
20
|
+
if (!r) return null;
|
|
21
|
+
const { rowMin: l, rowMax: i, colMin: e, colMax: u } = r, s = t.slice(l, i + 1), a = o.slice(e, u + 1), f = s.map((c) => c === n.anchor.rowId ? n.anchor.sourceIndex : c === n.focus.rowId ? n.focus.sourceIndex : null), h = {
|
|
22
|
+
rowId: s[0],
|
|
23
|
+
columnKey: a[0],
|
|
24
|
+
sourceIndex: f[0] ?? null
|
|
25
|
+
}, m = {
|
|
26
|
+
rowId: s[s.length - 1],
|
|
27
|
+
columnKey: a[a.length - 1],
|
|
28
|
+
sourceIndex: f[f.length - 1] ?? null
|
|
29
|
+
};
|
|
30
|
+
return {
|
|
31
|
+
rowIds: s,
|
|
32
|
+
columnKeys: a,
|
|
33
|
+
sourceIndices: f,
|
|
34
|
+
start: h,
|
|
35
|
+
end: m
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
function L(n, t, o, r, l) {
|
|
39
|
+
const i = {
|
|
40
|
+
top: !1,
|
|
41
|
+
bottom: !1,
|
|
42
|
+
left: !1,
|
|
43
|
+
right: !1
|
|
44
|
+
};
|
|
45
|
+
if (!n)
|
|
46
|
+
return {
|
|
47
|
+
inRange: !1,
|
|
48
|
+
isAnchor: !1,
|
|
49
|
+
isFocus: !1,
|
|
50
|
+
isSingle: !1,
|
|
51
|
+
edges: i
|
|
52
|
+
};
|
|
53
|
+
const e = x(n, r, l), u = M(r, t), s = M(l, o);
|
|
54
|
+
if (!e || u < 0 || s < 0)
|
|
55
|
+
return {
|
|
56
|
+
inRange: !1,
|
|
57
|
+
isAnchor: !1,
|
|
58
|
+
isFocus: !1,
|
|
59
|
+
isSingle: w(n),
|
|
60
|
+
edges: i
|
|
61
|
+
};
|
|
62
|
+
const a = u >= e.rowMin && u <= e.rowMax && s >= e.colMin && s <= e.colMax, f = n.anchor.rowId === t && n.anchor.columnKey === o, h = n.focus.rowId === t && n.focus.columnKey === o, m = w(n);
|
|
63
|
+
return {
|
|
64
|
+
inRange: a,
|
|
65
|
+
isAnchor: f,
|
|
66
|
+
isFocus: h,
|
|
67
|
+
isSingle: m,
|
|
68
|
+
edges: a ? {
|
|
69
|
+
top: u === e.rowMin,
|
|
70
|
+
bottom: u === e.rowMax,
|
|
71
|
+
left: s === e.colMin,
|
|
72
|
+
right: s === e.colMax
|
|
73
|
+
} : i
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
function T(n) {
|
|
77
|
+
const t = "var(--color-border-brand, var(--color-brand-500, #7f56d9))", o = [];
|
|
78
|
+
return n.top && o.push(`inset 0 2px 0 0 ${t}`), n.bottom && o.push(`inset 0 -2px 0 0 ${t}`), n.left && o.push(`inset 2px 0 0 0 ${t}`), n.right && o.push(`inset -2px 0 0 0 ${t}`), o.length > 0 ? o.join(", ") : void 0;
|
|
79
|
+
}
|
|
80
|
+
function H(n, t, o, r = E, l = _) {
|
|
81
|
+
const {
|
|
82
|
+
scrollTop: i,
|
|
83
|
+
scrollLeft: e,
|
|
84
|
+
scrollHeight: u,
|
|
85
|
+
scrollWidth: s,
|
|
86
|
+
clientHeight: a,
|
|
87
|
+
clientWidth: f
|
|
88
|
+
} = n, h = u - a, m = s - f, c = n.getBoundingClientRect();
|
|
89
|
+
let R = 0;
|
|
90
|
+
if (h > 0) {
|
|
91
|
+
if (o < c.top + r) {
|
|
92
|
+
const d = o < c.top ? 1 : (c.top + r - o) / r;
|
|
93
|
+
R = -Math.ceil(l * Math.min(1, Math.max(0, d))), i <= 0 && (R = 0);
|
|
94
|
+
} else if (o > c.bottom - r) {
|
|
95
|
+
const d = o > c.bottom ? 1 : (o - (c.bottom - r)) / r;
|
|
96
|
+
R = Math.ceil(l * Math.min(1, Math.max(0, d))), i >= h && (R = 0);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
let g = 0;
|
|
100
|
+
if (m > 0) {
|
|
101
|
+
if (t < c.left + r) {
|
|
102
|
+
const d = t < c.left ? 1 : (c.left + r - t) / r;
|
|
103
|
+
g = -Math.ceil(l * Math.min(1, Math.max(0, d))), e <= 0 && (g = 0);
|
|
104
|
+
} else if (t > c.right - r) {
|
|
105
|
+
const d = t > c.right ? 1 : (t - (c.right - r)) / r;
|
|
106
|
+
g = Math.ceil(l * Math.min(1, Math.max(0, d))), e >= m && (g = 0);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
return { dx: g, dy: R };
|
|
110
|
+
}
|
|
111
|
+
function C(n) {
|
|
112
|
+
const t = n.getAttribute("data-grid-row-id"), o = n.getAttribute("data-grid-col-key");
|
|
113
|
+
if (!t || !o) return null;
|
|
114
|
+
const r = n.getAttribute("data-grid-source-index"), l = r != null && r !== "" ? Number(r) : NaN;
|
|
115
|
+
return {
|
|
116
|
+
rowId: t,
|
|
117
|
+
columnKey: o,
|
|
118
|
+
sourceIndex: Number.isNaN(l) ? null : l
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
function O(n, t) {
|
|
122
|
+
if (!(n instanceof HTMLElement) || !t || !t.contains(n)) return null;
|
|
123
|
+
const o = n.closest(`[${p}]`);
|
|
124
|
+
if (!(o instanceof HTMLElement) || !t.contains(o)) return null;
|
|
125
|
+
const r = o.querySelector("[data-grid-cell]");
|
|
126
|
+
return !r || r.closest("[data-grid-no-range]") ? null : C(r);
|
|
127
|
+
}
|
|
128
|
+
function D(n, t, o) {
|
|
129
|
+
const r = document.elementFromPoint(t, o);
|
|
130
|
+
if (!(r instanceof Element)) return null;
|
|
131
|
+
const l = r.closest("[data-grid-cell]");
|
|
132
|
+
return !(l instanceof HTMLElement) || !n.contains(l) || l.closest("[data-grid-no-range]") ? null : l;
|
|
133
|
+
}
|
|
134
|
+
function F(n, t) {
|
|
135
|
+
if (!(n instanceof HTMLElement) || !t || !t.contains(n) || n.closest("[data-grid-no-range]") || n.closest(
|
|
136
|
+
'input, textarea, select, [contenteditable]:not([contenteditable="false"]), [role="textbox"]'
|
|
137
|
+
))
|
|
138
|
+
return null;
|
|
139
|
+
const o = n.closest("[data-grid-cell]");
|
|
140
|
+
return !(o instanceof HTMLElement) || !t.contains(o) ? null : o;
|
|
141
|
+
}
|
|
142
|
+
function I(n) {
|
|
143
|
+
return { anchor: n, focus: n };
|
|
144
|
+
}
|
|
145
|
+
function N(n, t, o, r) {
|
|
146
|
+
return r ? o ? t ? { anchor: o.anchor, focus: t } : o : { anchor: n, focus: t ?? n } : t ? I(t) : null;
|
|
147
|
+
}
|
|
148
|
+
export {
|
|
149
|
+
y as CELL_RANGE_DRAG_THRESHOLD_PX,
|
|
150
|
+
A as buildCellRangeRect,
|
|
151
|
+
F as canStartCellRangeFromTarget,
|
|
152
|
+
T as cellRangeEdgeBoxShadow,
|
|
153
|
+
L as getCellRangeVisualState,
|
|
154
|
+
H as getDragScrollDeltas,
|
|
155
|
+
x as getSelectionIndexBounds,
|
|
156
|
+
D as hitTestGridCell,
|
|
157
|
+
w as isSingleCellSelection,
|
|
158
|
+
N as nextKeyboardCellSelection,
|
|
159
|
+
C as resolveCellCoordFromElement,
|
|
160
|
+
O as resolveRowAnchorCoordFromTarget,
|
|
161
|
+
I as selectionFromSingleCell
|
|
162
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cellRangeSelection.test.d.ts","sourceRoot":"","sources":["../../../src/patterns/table/cellRangeSelection.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { Table, TableCard, TableCell, TableRowActionsDropdown } from './table';
|
|
2
2
|
export { TableWrapper, type TableWrapperProps } from './TableWrapper';
|
|
3
|
-
export type { TableWrapperPaginationConfig, TableWrapperToolbarConfig, BulkActionContext, TableWrapperEditChrome, TableWrapperSelectedKeys, TableWrapperSelectionChange, ColumnConfig, } from './types';
|
|
3
|
+
export type { TableWrapperPaginationConfig, TableWrapperToolbarConfig, BulkActionContext, TableWrapperEditChrome, TableWrapperSelectedKeys, TableWrapperSelectionChange, ColumnConfig, TableCellCoord, TableCellRangeRect, TableCellSelection, } from './types';
|
|
4
|
+
export { buildCellRangeRect, getCellRangeVisualState, getDragScrollDeltas, isSingleCellSelection, selectionFromSingleCell, } from './cellRangeSelection';
|
|
4
5
|
export { TablePagination, type TablePaginationConfig, type TablePaginationProps } from './TablePagination';
|
|
5
6
|
export { PaginationCardDefault } from './pagination-card';
|
|
6
7
|
export { Pagination } from './pagination-base';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/patterns/table/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAC/E,OAAO,EAAE,YAAY,EAAE,KAAK,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACtE,YAAY,EACV,4BAA4B,EAC5B,yBAAyB,EACzB,iBAAiB,EACjB,sBAAsB,EACtB,wBAAwB,EACxB,2BAA2B,EAC3B,YAAY,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/patterns/table/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAC/E,OAAO,EAAE,YAAY,EAAE,KAAK,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACtE,YAAY,EACV,4BAA4B,EAC5B,yBAAyB,EACzB,iBAAiB,EACjB,sBAAsB,EACtB,wBAAwB,EACxB,2BAA2B,EAC3B,YAAY,EACZ,cAAc,EACd,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,kBAAkB,EAClB,uBAAuB,EACvB,mBAAmB,EACnB,qBAAqB,EACrB,uBAAuB,GACxB,MAAM,sBAAsB,CAAC;AAC9B,O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AClB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,qBAAqB,EACrB,gBAAgB,EAChB,qBAAqB,EACrB,WAAW,EACX,kCAAkC,EAClC,0BAA0B,EAC1B,0BAA0B,EAC1B,6BAA6B,EAC7B,uBAAuB,EACvB,KAAK,yBAAyB,EAC9B,KAAK,qBAAqB,EAC1B,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,GACvB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,yBAAyB,EACzB,KAAK,6BAA6B,EAClC,KAAK,4BAA4B,GAClC,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,sBAAsB,EACtB,wBAAwB,GACzB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,0BAA0B,EAC1B,qBAAqB,EACrB,KAAK,+BAA+B,GACrC,MAAM,0BAA0B,CAAC"}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import { FC } from 'react';
|
|
1
|
+
import { CSSProperties, FC } from 'react';
|
|
2
2
|
export declare const ROW_REORDER_ATTR = "data-row-reorder-id";
|
|
3
3
|
export declare const ROW_SOURCE_INDEX_ATTR = "data-source-index";
|
|
4
4
|
export declare const ROW_DRAG_THRESHOLD_PX = 5;
|
|
5
|
+
/** Edge zone (px) inside the scrollport that triggers auto-scroll while dragging. */
|
|
6
|
+
export declare const ROW_DRAG_SCROLL_EDGE_PX = 40;
|
|
7
|
+
/** Max scroll speed (px per animation frame) at the edge / outside the scrollport. */
|
|
8
|
+
export declare const ROW_DRAG_SCROLL_MAX_PX = 18;
|
|
5
9
|
export type RowDragPreviewMetrics = {
|
|
6
10
|
left: number;
|
|
7
11
|
top: number;
|
|
@@ -30,6 +34,8 @@ export type RowDragSession = {
|
|
|
30
34
|
/** Live clone of the source `<tr>` for the floating preview. */
|
|
31
35
|
rowClone: HTMLTableRowElement;
|
|
32
36
|
};
|
|
37
|
+
/** Ghost styling for the source row — inline so consumers don't need Tailwind to scan these utilities. */
|
|
38
|
+
export declare const ROW_DRAG_SOURCE_STYLE: CSSProperties;
|
|
33
39
|
export declare function measureRowPreview(rowEl: HTMLTableRowElement): RowDragPreviewMetrics;
|
|
34
40
|
export declare function cloneRowForPreview(rowEl: HTMLTableRowElement): HTMLTableRowElement;
|
|
35
41
|
type DropTargetResult = {
|
|
@@ -43,6 +49,13 @@ type DropTargetResult = {
|
|
|
43
49
|
* (index after moving the dragged row out of its original position).
|
|
44
50
|
*/
|
|
45
51
|
export declare function computeDropTarget(container: HTMLElement, clientY: number, fromSourceIndex: number, draggedRowId: string): DropTargetResult | null;
|
|
52
|
+
/**
|
|
53
|
+
* Scroll delta for auto-scroll while dragging. Speeds up toward the edge and
|
|
54
|
+
* stays at max speed when the pointer is outside the scrollport (above/below).
|
|
55
|
+
*/
|
|
56
|
+
export declare function getRowDragScrollDelta(scrollContainer: HTMLElement, clientY: number, edgePx?: number, maxSpeedPx?: number): number;
|
|
57
|
+
/** Hide the drop line when its Y falls outside the visible scrollport. */
|
|
58
|
+
export declare function clipDropLineToScrollport(dropLineY: number, scrollContainer: HTMLElement): number | null;
|
|
46
59
|
type FloatingRowPreviewProps = {
|
|
47
60
|
session: RowDragSession;
|
|
48
61
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rowReorderDrag.d.ts","sourceRoot":"","sources":["../../../src/patterns/table/rowReorderDrag.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA2B,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"rowReorderDrag.d.ts","sourceRoot":"","sources":["../../../src/patterns/table/rowReorderDrag.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA2B,KAAK,aAAa,EAAE,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAI7E,eAAO,MAAM,gBAAgB,wBAAwB,CAAC;AACtD,eAAO,MAAM,qBAAqB,sBAAsB,CAAC;AACzD,eAAO,MAAM,qBAAqB,IAAI,CAAC;AAEvC,qFAAqF;AACrF,eA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E,MAAM,CAAC;CACvB,CAAC;AAEF;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,SAAS,EAAE,WAAW,EACtB,OAAO,EAAE,MAAM,EACf,eAAe,EAAE,MAAM,EACvB,YAAY,EAAE,MAAM,GACnB,gBAAgB,GAAG,IAAI,CA8DzB;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,eAAe,EAAE,WAAW,EAC5B,OAAO,EAAE,MAAM,EACf,MAAM,SAA0B,EAChC,UAAU,SAAyB,GAClC,MAAM,CAqBR;AAED,0EAA0E;AAC1E,wBAAgB,wBAAwB,CACtC,SAAS,EAAE,MAAM,EACjB,eAAe,EAAE,WAAW,GAC3B,MAAM,GAAG,IAAI,CAIf;AAED,KAAK,uBAAuB,GAAG;IAC7B,OAAO,EAAE,cAAc,CAAC;CACzB,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,EAAE,CAAC,uBAAuB,CAoD1D,CAAC;AAEF,KAAK,sBAAsB,GAAG;IAC5B,CAAC,EAAE,MAAM,CAAC;IACV,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,EAAE,CAAC,sBAAsB,CActD,CAAC"}
|
|
@@ -1,120 +1,151 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useRef as
|
|
1
|
+
import { jsx as x } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as _, useLayoutEffect as E } from "react";
|
|
3
3
|
import { createPortal as A } from "react-dom";
|
|
4
|
-
import { cx as
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
import { cx as L } from "../../utils/cn.js";
|
|
5
|
+
const R = "data-row-reorder-id", C = "data-source-index", W = 5, D = 40, O = 18, B = {
|
|
6
|
+
opacity: 0.4,
|
|
7
|
+
filter: "blur(1.5px)",
|
|
8
|
+
pointerEvents: "none"
|
|
9
|
+
};
|
|
10
|
+
function M(r) {
|
|
11
|
+
const e = r.getBoundingClientRect(), t = r.closest("table"), d = Array.from(r.children).map(
|
|
8
12
|
(i) => i.getBoundingClientRect().width
|
|
9
13
|
);
|
|
10
14
|
return {
|
|
11
|
-
left:
|
|
12
|
-
top:
|
|
13
|
-
width:
|
|
14
|
-
height:
|
|
15
|
-
cellWidths:
|
|
16
|
-
tableClassName: (
|
|
15
|
+
left: e.left,
|
|
16
|
+
top: e.top,
|
|
17
|
+
width: e.width,
|
|
18
|
+
height: e.height,
|
|
19
|
+
cellWidths: d,
|
|
20
|
+
tableClassName: (t == null ? void 0 : t.className) ?? ""
|
|
17
21
|
};
|
|
18
22
|
}
|
|
19
|
-
function
|
|
20
|
-
const
|
|
21
|
-
return
|
|
22
|
-
|
|
23
|
-
}),
|
|
23
|
+
function X(r) {
|
|
24
|
+
const e = r.cloneNode(!0);
|
|
25
|
+
return e.removeAttribute(R), e.removeAttribute(C), e.removeAttribute("id"), e.querySelectorAll("[id]").forEach((t) => t.removeAttribute("id")), e.querySelectorAll("button, input, a, [tabindex]").forEach((t) => {
|
|
26
|
+
t.setAttribute("tabindex", "-1"), (t instanceof HTMLButtonElement || t instanceof HTMLInputElement) && (t.disabled = !0);
|
|
27
|
+
}), e;
|
|
24
28
|
}
|
|
25
|
-
function
|
|
26
|
-
var
|
|
29
|
+
function H(r, e, t, d) {
|
|
30
|
+
var y, w;
|
|
27
31
|
const i = Array.from(
|
|
28
|
-
|
|
32
|
+
r.querySelectorAll(`tr[${R}]`)
|
|
29
33
|
);
|
|
30
34
|
if (i.length === 0) return null;
|
|
31
|
-
const
|
|
32
|
-
const g =
|
|
35
|
+
const u = (y = i[0]) == null ? void 0 : y.closest("table"), s = u == null ? void 0 : u.getBoundingClientRect(), f = (s == null ? void 0 : s.left) ?? i[0].getBoundingClientRect().left, c = (s == null ? void 0 : s.width) ?? i[0].getBoundingClientRect().width, o = i.map((n) => {
|
|
36
|
+
const g = n.getBoundingClientRect(), v = Number(n.getAttribute(C));
|
|
33
37
|
return {
|
|
34
|
-
rowId:
|
|
35
|
-
sourceIndex: Number.isFinite(
|
|
38
|
+
rowId: n.getAttribute(R) ?? "",
|
|
39
|
+
sourceIndex: Number.isFinite(v) ? v : 0,
|
|
36
40
|
top: g.top,
|
|
37
41
|
bottom: g.bottom,
|
|
38
42
|
mid: (g.top + g.bottom) / 2
|
|
39
43
|
};
|
|
40
44
|
});
|
|
41
|
-
let
|
|
42
|
-
for (let
|
|
43
|
-
if (
|
|
44
|
-
|
|
45
|
+
let l = o.length, p = ((w = o[o.length - 1]) == null ? void 0 : w.bottom) ?? 0;
|
|
46
|
+
for (let n = 0; n < o.length; n++)
|
|
47
|
+
if (e < o[n].mid) {
|
|
48
|
+
l = n, p = o[n].top;
|
|
45
49
|
break;
|
|
46
50
|
}
|
|
47
|
-
const
|
|
48
|
-
(
|
|
51
|
+
const b = o.findIndex(
|
|
52
|
+
(n) => n.rowId === d || n.sourceIndex === t
|
|
49
53
|
);
|
|
50
|
-
if (
|
|
51
|
-
let
|
|
52
|
-
|
|
53
|
-
const
|
|
54
|
-
return
|
|
55
|
-
toSourceIndex:
|
|
56
|
-
dropLineY:
|
|
57
|
-
dropLineLeft:
|
|
58
|
-
dropLineWidth:
|
|
54
|
+
if (b < 0) return null;
|
|
55
|
+
let h = l;
|
|
56
|
+
b < l && (h = l - 1);
|
|
57
|
+
const a = o.map((n) => n.sourceIndex), [m] = a.splice(b, 1);
|
|
58
|
+
return a.splice(h, 0, m), h = a.indexOf(m), {
|
|
59
|
+
toSourceIndex: h,
|
|
60
|
+
dropLineY: p,
|
|
61
|
+
dropLineLeft: f,
|
|
62
|
+
dropLineWidth: c
|
|
59
63
|
};
|
|
60
64
|
}
|
|
61
|
-
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
65
|
+
function $(r, e, t = D, d = O) {
|
|
66
|
+
const { scrollTop: i, scrollHeight: u, clientHeight: s } = r, f = u - s;
|
|
67
|
+
if (f <= 0) return 0;
|
|
68
|
+
const c = r.getBoundingClientRect();
|
|
69
|
+
let o = 0;
|
|
70
|
+
if (e < c.top + t) {
|
|
71
|
+
const l = e < c.top ? 1 : (c.top + t - e) / t;
|
|
72
|
+
o = -Math.ceil(d * Math.min(1, Math.max(0, l)));
|
|
73
|
+
} else if (e > c.bottom - t) {
|
|
74
|
+
const l = e > c.bottom ? 1 : (e - (c.bottom - t)) / t;
|
|
75
|
+
o = Math.ceil(d * Math.min(1, Math.max(0, l)));
|
|
76
|
+
}
|
|
77
|
+
return o < 0 && i <= 0 || o > 0 && i >= f ? 0 : o;
|
|
78
|
+
}
|
|
79
|
+
function G(r, e) {
|
|
80
|
+
const t = e.getBoundingClientRect();
|
|
81
|
+
return r < t.top || r > t.bottom ? null : r;
|
|
82
|
+
}
|
|
83
|
+
const k = ({ session: r }) => {
|
|
84
|
+
const e = _(null), { preview: t, startX: d, startY: i, currentX: u, currentY: s, rowClone: f } = r;
|
|
85
|
+
return E(() => {
|
|
86
|
+
const c = e.current;
|
|
87
|
+
if (!c) return;
|
|
88
|
+
c.replaceChildren();
|
|
67
89
|
const o = document.createElement("table");
|
|
68
|
-
o.className =
|
|
69
|
-
const
|
|
70
|
-
Array.from(
|
|
71
|
-
const
|
|
72
|
-
if (
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
}),
|
|
76
|
-
}, [
|
|
77
|
-
/* @__PURE__ */
|
|
90
|
+
o.className = t.tableClassName, o.style.width = `${t.width}px`, o.style.height = `${t.height}px`, o.style.tableLayout = "fixed", o.style.borderCollapse = "collapse", o.style.background = "var(--color-bg-primary, #fff)";
|
|
91
|
+
const l = document.createElement("tbody"), p = f.cloneNode(!0);
|
|
92
|
+
Array.from(p.children).forEach((b, h) => {
|
|
93
|
+
const a = t.cellWidths[h];
|
|
94
|
+
if (a == null) return;
|
|
95
|
+
const m = b;
|
|
96
|
+
m.style.width = `${a}px`, m.style.minWidth = `${a}px`, m.style.maxWidth = `${a}px`, m.style.background = "var(--color-bg-primary, #fff)";
|
|
97
|
+
}), l.appendChild(p), o.appendChild(l), c.appendChild(o);
|
|
98
|
+
}, [t, f]), A(
|
|
99
|
+
/* @__PURE__ */ x(
|
|
78
100
|
"div",
|
|
79
101
|
{
|
|
80
|
-
ref:
|
|
102
|
+
ref: e,
|
|
81
103
|
"aria-hidden": !0,
|
|
82
|
-
className:
|
|
83
|
-
"pointer-events-none fixed z-[10000] overflow-hidden rounded-md
|
|
104
|
+
className: L(
|
|
105
|
+
"pointer-events-none fixed z-[10000] overflow-hidden rounded-md bg-primary shadow-lg",
|
|
84
106
|
"cursor-grabbing"
|
|
85
107
|
),
|
|
86
108
|
style: {
|
|
87
|
-
left:
|
|
88
|
-
top:
|
|
89
|
-
width:
|
|
90
|
-
height:
|
|
109
|
+
left: t.left + (u - d),
|
|
110
|
+
top: t.top + (s - i),
|
|
111
|
+
width: t.width,
|
|
112
|
+
height: t.height,
|
|
113
|
+
// Inline border so npm consumers don't depend on Tailwind scanning `border-brand`.
|
|
114
|
+
border: "1px solid var(--color-border-brand, var(--color-brand-500, #7f56d9))"
|
|
91
115
|
}
|
|
92
116
|
}
|
|
93
117
|
),
|
|
94
118
|
document.body
|
|
95
119
|
);
|
|
96
|
-
},
|
|
97
|
-
/* @__PURE__ */
|
|
120
|
+
}, q = ({ y: r, left: e, width: t }) => A(
|
|
121
|
+
/* @__PURE__ */ x(
|
|
98
122
|
"div",
|
|
99
123
|
{
|
|
100
124
|
"aria-hidden": !0,
|
|
101
|
-
className: "pointer-events-none fixed z-[10000] h-0.5
|
|
125
|
+
className: "pointer-events-none fixed z-[10000] h-0.5",
|
|
102
126
|
style: {
|
|
103
|
-
top:
|
|
104
|
-
left:
|
|
105
|
-
width:
|
|
127
|
+
top: r - 1,
|
|
128
|
+
left: e,
|
|
129
|
+
width: t,
|
|
130
|
+
// Inline color — same reliability reason as the floating preview border.
|
|
131
|
+
backgroundColor: "var(--color-border-brand, var(--color-brand-500, #7f56d9))"
|
|
106
132
|
}
|
|
107
133
|
}
|
|
108
134
|
),
|
|
109
135
|
document.body
|
|
110
136
|
);
|
|
111
137
|
export {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
138
|
+
q as DropIndicatorLine,
|
|
139
|
+
k as FloatingRowPreview,
|
|
140
|
+
D as ROW_DRAG_SCROLL_EDGE_PX,
|
|
141
|
+
O as ROW_DRAG_SCROLL_MAX_PX,
|
|
142
|
+
B as ROW_DRAG_SOURCE_STYLE,
|
|
143
|
+
W as ROW_DRAG_THRESHOLD_PX,
|
|
144
|
+
R as ROW_REORDER_ATTR,
|
|
116
145
|
C as ROW_SOURCE_INDEX_ATTR,
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
146
|
+
G as clipDropLineToScrollport,
|
|
147
|
+
X as cloneRowForPreview,
|
|
148
|
+
H as computeDropTarget,
|
|
149
|
+
$ as getRowDragScrollDelta,
|
|
150
|
+
M as measureRowPreview
|
|
120
151
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rowReorderDrag.test.d.ts","sourceRoot":"","sources":["../../../src/patterns/table/rowReorderDrag.test.ts"],"names":[],"mappings":""}
|
|
@@ -200,7 +200,7 @@ const $ = ({
|
|
|
200
200
|
const S = o ? {
|
|
201
201
|
position: "sticky",
|
|
202
202
|
[o]: t,
|
|
203
|
-
zIndex:
|
|
203
|
+
zIndex: 20
|
|
204
204
|
} : {};
|
|
205
205
|
return { ...typeof p.style == "function" ? p.style(m) : p.style || {}, ...S };
|
|
206
206
|
},
|
|
@@ -334,7 +334,7 @@ const U = ({ className: s, children: i, sticky: n, stickyOffset: a = 0, ...o })
|
|
|
334
334
|
const p = n ? {
|
|
335
335
|
position: "sticky",
|
|
336
336
|
[n]: a,
|
|
337
|
-
zIndex:
|
|
337
|
+
zIndex: 10,
|
|
338
338
|
backgroundColor: "white",
|
|
339
339
|
boxShadow: n === "right" ? "inset 2px 0 0px 0px var(--color-border-tertiary)" : "inset -2px 0 0px 0px var(--color-border-tertiary)"
|
|
340
340
|
} : {};
|
|
@@ -3,6 +3,8 @@ import { TablePaginationConfig } from './TablePagination';
|
|
|
3
3
|
import { UndoRedoToolConfig } from './toolbar/TableToolbar';
|
|
4
4
|
import { LegacyFilterToolConfig, LegacySortToolConfig } from './toolbar/legacyToolbarTypes';
|
|
5
5
|
import { AlignToolConfig, GroupByToolConfig, HideFieldsToolConfig, RowHeightToolConfig, SearchToolConfig, SummaryToolConfig, CellAlignment, ColumnMenuAction, ColumnMenuCapabilities, RowActionsConfig, RowGroup, SummaryFooterRowProps } from './toolbar';
|
|
6
|
+
import { TableCellRangeRect, TableCellSelection } from './cellRangeSelection';
|
|
7
|
+
export type { TableCellCoord, TableCellRangeRect, TableCellSelection } from './cellRangeSelection';
|
|
6
8
|
/** Value type used for alignment defaults and aggregation eligibility. */
|
|
7
9
|
export type TableColumnValueType = "string" | "number" | "currency" | "date" | "percentage" | "decimal_percentage" | "array" | "link";
|
|
8
10
|
/**
|
|
@@ -142,5 +144,32 @@ export type TableWrapperProps = {
|
|
|
142
144
|
sourceIndex: number | null;
|
|
143
145
|
}) => void;
|
|
144
146
|
renderColumnHeaderMenuExtraItems?: (column: TableColumnMenuSchema) => ReactNode;
|
|
147
|
+
/**
|
|
148
|
+
* Controlled Excel-style rectangular cell selection. Opt-in: pass both
|
|
149
|
+
* `cellSelection` and `onCellSelectionChange` (typically only in edit mode).
|
|
150
|
+
* When set, enables drag / Shift+click / Shift+arrow range selection and
|
|
151
|
+
* Cmd/Ctrl+C·V hooks via `onCopyCells` / `onPasteCells`.
|
|
152
|
+
*/
|
|
153
|
+
cellSelection?: TableCellSelection | null;
|
|
154
|
+
onCellSelectionChange?: (selection: TableCellSelection | null) => void;
|
|
155
|
+
/** Fired on copy when a cell range is selected (not while editing a cell). */
|
|
156
|
+
onCopyCells?: (payload: {
|
|
157
|
+
selection: TableCellSelection;
|
|
158
|
+
rect: TableCellRangeRect;
|
|
159
|
+
event: ClipboardEvent;
|
|
160
|
+
}) => void;
|
|
161
|
+
/** Fired on paste when a cell range is selected (not while editing a cell). */
|
|
162
|
+
onPasteCells?: (payload: {
|
|
163
|
+
selection: TableCellSelection;
|
|
164
|
+
rect: TableCellRangeRect;
|
|
165
|
+
text: string;
|
|
166
|
+
event: ClipboardEvent;
|
|
167
|
+
}) => void;
|
|
168
|
+
/** Fired on Delete/Backspace when a cell range is selected (not while editing a cell). */
|
|
169
|
+
onClearCells?: (payload: {
|
|
170
|
+
selection: TableCellSelection;
|
|
171
|
+
rect: TableCellRangeRect;
|
|
172
|
+
event: KeyboardEvent;
|
|
173
|
+
}) => void;
|
|
145
174
|
};
|
|
146
175
|
//# sourceMappingURL=types.d.ts.map
|