@rivet-health/design-system 40.9.0 → 40.9.1
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/esm2020/lib/table/table/clipboard.mjs +182 -0
- package/esm2020/lib/table/table/table/table.component.mjs +35 -2
- package/fesm2015/rivet-health-design-system.mjs +217 -2
- package/fesm2015/rivet-health-design-system.mjs.map +1 -1
- package/fesm2020/rivet-health-design-system.mjs +215 -2
- package/fesm2020/rivet-health-design-system.mjs.map +1 -1
- package/lib/table/table/clipboard.d.ts +38 -0
- package/lib/table/table/table/table.component.d.ts +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Clipboard serialization for `riv-table`.
|
|
3
|
+
*
|
|
4
|
+
* Rows that have a link render as `<a class="row-link">` rather than `<tr>`, and
|
|
5
|
+
* the browser's clipboard serializer does not treat those as table rows — the
|
|
6
|
+
* copied content pastes into a spreadsheet as one lateral run instead of a grid.
|
|
7
|
+
* These helpers rebuild the rendered grid so that copied content pastes as rows
|
|
8
|
+
* and columns.
|
|
9
|
+
*/
|
|
10
|
+
export declare namespace RivTableClipboard {
|
|
11
|
+
type Payload = {
|
|
12
|
+
/** Tab-delimited rows, one line per row. */
|
|
13
|
+
text: string;
|
|
14
|
+
/** Equivalent table markup, for targets that prefer rich content. */
|
|
15
|
+
html: string;
|
|
16
|
+
};
|
|
17
|
+
/** Predicate for whether a node falls within the user's selection. */
|
|
18
|
+
type SelectionTest = (node: Node) => boolean;
|
|
19
|
+
/** Whether the copy came from a control that serializes its own value. */
|
|
20
|
+
function isEditable(target: EventTarget | null): boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Whether `host` is the first element of its kind that the selection touches.
|
|
23
|
+
* A selection can span several tables; deferring to the first keeps instances
|
|
24
|
+
* from overwriting each other's clipboard data.
|
|
25
|
+
*/
|
|
26
|
+
function ownsSelection(host: Element, isSelected: SelectionTest): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Serializes the selected region of `tables` (one per row group), or null when
|
|
29
|
+
* the selection covers at most one cell — those are left to the browser so
|
|
30
|
+
* that copying part of a cell's text keeps working.
|
|
31
|
+
*
|
|
32
|
+
* `endpoints` are where the selection starts and ends, which narrow the copied
|
|
33
|
+
* columns to that span. A selection is a linear range in reading order, so
|
|
34
|
+
* dragging down one column touches every column in between; the endpoints are
|
|
35
|
+
* what distinguish "this column" from "these rows".
|
|
36
|
+
*/
|
|
37
|
+
function extract(tables: readonly HTMLTableElement[], isSelected: SelectionTest, endpoints?: readonly (Node | null | undefined)[]): Payload | null;
|
|
38
|
+
}
|
|
@@ -61,6 +61,7 @@ export declare class TableComponent<R extends RivTable.Row, C extends RivTable.C
|
|
|
61
61
|
private shift;
|
|
62
62
|
keyDown(event: KeyboardEvent): void;
|
|
63
63
|
keyUp(event: KeyboardEvent): void;
|
|
64
|
+
onCopy(event: ClipboardEvent): void;
|
|
64
65
|
selectionChange(rowId: R['id'], selected: boolean): void;
|
|
65
66
|
handleClick(event: MouseEvent, column: RivTable.FullColumn<C>): void;
|
|
66
67
|
isExternalRowLink(rowLink: RivTable.RowLink): rowLink is RivTable.ExternalRowLink;
|