occulite-ui 0.0.0-stage → 0.2.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/LICENSE +21 -0
- package/README.md +290 -2
- package/THIRD_PARTY_NOTICES.md +36 -0
- package/dist/clipboard.d.ts +26 -0
- package/dist/clipboard.js +70 -0
- package/dist/components/ContextMenu.svelte +158 -0
- package/dist/components/ContextMenu.svelte.d.ts +14 -0
- package/dist/components/DataTable.svelte +1990 -0
- package/dist/components/DataTable.svelte.d.ts +154 -0
- package/dist/components/Dialog.svelte +420 -0
- package/dist/components/Dialog.svelte.d.ts +55 -0
- package/dist/components/GithubLink.svelte +74 -0
- package/dist/components/GithubLink.svelte.d.ts +16 -0
- package/dist/components/Header.svelte +196 -0
- package/dist/components/Header.svelte.d.ts +42 -0
- package/dist/components/Icon.svelte +51 -0
- package/dist/components/Icon.svelte.d.ts +12 -0
- package/dist/components/LanguageSwitch.svelte +63 -0
- package/dist/components/LanguageSwitch.svelte.d.ts +17 -0
- package/dist/components/Loader.svelte +65 -0
- package/dist/components/Loader.svelte.d.ts +9 -0
- package/dist/components/MultiSelect.svelte +467 -0
- package/dist/components/MultiSelect.svelte.d.ts +28 -0
- package/dist/components/Notices.svelte +146 -0
- package/dist/components/Notices.svelte.d.ts +16 -0
- package/dist/components/PrimaryToolbarButton.svelte +189 -0
- package/dist/components/PrimaryToolbarButton.svelte.d.ts +34 -0
- package/dist/components/Tabs.svelte +118 -0
- package/dist/components/Tabs.svelte.d.ts +16 -0
- package/dist/components/ThemeSwitch.svelte +46 -0
- package/dist/components/ThemeSwitch.svelte.d.ts +11 -0
- package/dist/components/Toolbar.svelte +57 -0
- package/dist/components/Toolbar.svelte.d.ts +11 -0
- package/dist/components/ToolbarButton.svelte +126 -0
- package/dist/components/ToolbarButton.svelte.d.ts +22 -0
- package/dist/components/Tooltip.svelte +106 -0
- package/dist/components/Tooltip.svelte.d.ts +31 -0
- package/dist/components/TooltipBubble.svelte +65 -0
- package/dist/components/TooltipBubble.svelte.d.ts +18 -0
- package/dist/components/contextMenu.d.ts +19 -0
- package/dist/components/contextMenu.js +6 -0
- package/dist/components/dialogGeometry.d.ts +91 -0
- package/dist/components/dialogGeometry.js +140 -0
- package/dist/components/index.d.ts +22 -0
- package/dist/components/index.js +22 -0
- package/dist/components/multiSelect.d.ts +27 -0
- package/dist/components/multiSelect.js +26 -0
- package/dist/components/navigation.d.ts +34 -0
- package/dist/components/navigation.js +19 -0
- package/dist/components/tooltip.d.ts +29 -0
- package/dist/components/tooltip.js +27 -0
- package/dist/css/app.css +3 -0
- package/dist/css/base.css +84 -0
- package/dist/css/tokens.css +170 -0
- package/dist/dialog/index.d.ts +6 -0
- package/dist/dialog/index.js +6 -0
- package/dist/embedding/ShellEmbedding.svelte.d.ts +27 -0
- package/dist/embedding/ShellEmbedding.svelte.js +79 -0
- package/dist/embedding/constants.d.ts +23 -0
- package/dist/embedding/constants.js +54 -0
- package/dist/embedding/index.d.ts +2 -0
- package/dist/embedding/index.js +2 -0
- package/dist/externalLink.d.ts +15 -0
- package/dist/externalLink.js +20 -0
- package/dist/format.d.ts +6 -0
- package/dist/format.js +16 -0
- package/dist/i18n/i18n.svelte.d.ts +112 -0
- package/dist/i18n/i18n.svelte.js +211 -0
- package/dist/i18n/index.d.ts +3 -0
- package/dist/i18n/index.js +3 -0
- package/dist/i18n/messages.d.ts +9 -0
- package/dist/i18n/messages.js +58 -0
- package/dist/i18n/translator.d.ts +65 -0
- package/dist/i18n/translator.js +99 -0
- package/dist/icons/index.d.ts +17 -0
- package/dist/icons/index.js +11 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +16 -0
- package/dist/notices/NoticesStore.svelte.d.ts +64 -0
- package/dist/notices/NoticesStore.svelte.js +127 -0
- package/dist/notices/index.d.ts +1 -0
- package/dist/notices/index.js +1 -0
- package/dist/storage.d.ts +11 -0
- package/dist/storage.js +27 -0
- package/dist/table/LocalColumnWidths.svelte.d.ts +32 -0
- package/dist/table/LocalColumnWidths.svelte.js +91 -0
- package/dist/table/columnMeasure.d.ts +24 -0
- package/dist/table/columnMeasure.js +82 -0
- package/dist/table/columnWidths.d.ts +60 -0
- package/dist/table/columnWidths.js +86 -0
- package/dist/table/dataTableContext.d.ts +26 -0
- package/dist/table/dataTableContext.js +16 -0
- package/dist/table/index.d.ts +6 -0
- package/dist/table/index.js +6 -0
- package/dist/table/metrics.d.ts +10 -0
- package/dist/table/metrics.js +10 -0
- package/dist/table/tableModel.d.ts +306 -0
- package/dist/table/tableModel.js +437 -0
- package/dist/theme/choices.d.ts +8 -0
- package/dist/theme/choices.js +6 -0
- package/dist/theme/index.d.ts +2 -0
- package/dist/theme/index.js +2 -0
- package/dist/theme/theme.svelte.d.ts +60 -0
- package/dist/theme/theme.svelte.js +108 -0
- package/package.json +137 -4
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The row height of every table, as a number as well as a token.
|
|
3
|
+
*
|
|
4
|
+
* `tokens.css` declares `--hmm-row-height`, and everything CSS can do reads it from there. The
|
|
5
|
+
* table virtualiser cannot: it computes a scroll offset from the row height, so the value is
|
|
6
|
+
* mirrored here and `metrics.test.ts` fails when the two drift. An app that sets the token to
|
|
7
|
+
* another height (a denser 26 px, say) passes the same number to `DataTable`'s `rowHeight`.
|
|
8
|
+
*/
|
|
9
|
+
/** `--hmm-row-height`. One row of every table; the virtualiser needs it to be uniform. */
|
|
10
|
+
export declare const ROW_HEIGHT = 30;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The row height of every table, as a number as well as a token.
|
|
3
|
+
*
|
|
4
|
+
* `tokens.css` declares `--hmm-row-height`, and everything CSS can do reads it from there. The
|
|
5
|
+
* table virtualiser cannot: it computes a scroll offset from the row height, so the value is
|
|
6
|
+
* mirrored here and `metrics.test.ts` fails when the two drift. An app that sets the token to
|
|
7
|
+
* another height (a denser 26 px, say) passes the same number to `DataTable`'s `rowHeight`.
|
|
8
|
+
*/
|
|
9
|
+
/** `--hmm-row-height`. One row of every table; the virtualiser needs it to be uniform. */
|
|
10
|
+
export const ROW_HEIGHT = 30;
|
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The pure part of the data table: what a column is, how a cell value is read, and how rows are
|
|
3
|
+
* filtered, sorted and flattened into what the virtualiser draws. It has no DOM in it, so all of
|
|
4
|
+
* this is tested directly rather than through a rendered grid.
|
|
5
|
+
*/
|
|
6
|
+
export type CellValue = string | number | boolean | undefined;
|
|
7
|
+
export interface DataTableColumn<T> {
|
|
8
|
+
/** Identifies the column; also the property read from the row when `value` is absent. */
|
|
9
|
+
readonly key: string;
|
|
10
|
+
readonly label: string;
|
|
11
|
+
/**
|
|
12
|
+
* The column's share of the width, in pixels at the size the grid was designed for. It is a
|
|
13
|
+
* *weight*, not a pixel width (see {@link tableLayout}); a column without one shares whatever
|
|
14
|
+
* is left. Use {@link fixed} for the ones that must keep their pixels.
|
|
15
|
+
*/
|
|
16
|
+
readonly width?: number;
|
|
17
|
+
/**
|
|
18
|
+
* Never proportional: an icon, a badge or a count that has no more to say when it is wider.
|
|
19
|
+
* Requires {@link width}.
|
|
20
|
+
*/
|
|
21
|
+
readonly fixed?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* The narrowest a proportional column is drawn, in pixels, when its content needs more than the
|
|
24
|
+
* grid's minimum track - three marks and a button. Below it the grid scrolls sideways.
|
|
25
|
+
* A width the user dragged still wins.
|
|
26
|
+
*/
|
|
27
|
+
readonly minWidth?: number;
|
|
28
|
+
/**
|
|
29
|
+
* The user cannot make the column narrower than {@link minWidth} either - a drag, the
|
|
30
|
+
* arrow keys, a fit and a stored width all stop there. For a cell of buttons: one squeezed below
|
|
31
|
+
* its size lands under the next cell, where a click never arrives, and a tooltip of it
|
|
32
|
+
* cannot be clicked. A column of text or marks leaves it out and is cut off, with its tooltip.
|
|
33
|
+
* Requires {@link minWidth}.
|
|
34
|
+
*/
|
|
35
|
+
readonly keepMinWidth?: boolean;
|
|
36
|
+
readonly align?: 'left' | 'center' | 'right';
|
|
37
|
+
/** Sortable by default. */
|
|
38
|
+
readonly sortable?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Empty cells stay last when the column is sorted descending too. By default the direction
|
|
41
|
+
* reverses the whole order, so a descending sort puts the empty cells on top - right for a
|
|
42
|
+
* name column, where the nameless devices then stand out, wrong for a value most rows have,
|
|
43
|
+
* such as a battery life: the rows without one would hide the longest.
|
|
44
|
+
*/
|
|
45
|
+
readonly emptyLast?: boolean;
|
|
46
|
+
/** Part of the filter by default. */
|
|
47
|
+
readonly filterable?: boolean;
|
|
48
|
+
/** Not drawn - the 2.x grid hid SUBTYPE for BidCos and the name columns on request. */
|
|
49
|
+
readonly hidden?: boolean;
|
|
50
|
+
/** Draw in the address font. */
|
|
51
|
+
readonly mono?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* A small copy button at the end of every cell of the column, which puts the column's
|
|
54
|
+
* full value on the clipboard - never the cut-off text the cell draws. What it copies names its
|
|
55
|
+
* label: "Copy name" or "Copy address". Only on a real row with a value.
|
|
56
|
+
*/
|
|
57
|
+
readonly copy?: 'name' | 'address';
|
|
58
|
+
/**
|
|
59
|
+
* What a double click on a cell of this column does instead of activating the row -
|
|
60
|
+
* the Rooms and Functions cells open their assignment dialog. Only on a real row, and never
|
|
61
|
+
* from a control inside the cell; the rename of the name column comes first.
|
|
62
|
+
*/
|
|
63
|
+
readonly onactivate?: (row: T) => void;
|
|
64
|
+
/** Reads the value; defaults to `row[key]`. */
|
|
65
|
+
readonly value?: (row: T) => CellValue;
|
|
66
|
+
/**
|
|
67
|
+
* What the column is sorted by, where that is not what it shows: a time stamp for a cell that
|
|
68
|
+
* shows a formatted date, a rank for a state. The filters keep reading {@link value} - the
|
|
69
|
+
* text the user sees. Defaults to {@link value}.
|
|
70
|
+
*/
|
|
71
|
+
readonly sortValue?: (row: T) => CellValue;
|
|
72
|
+
/**
|
|
73
|
+
* The column's field in the filter row is a list of these choices instead of a text field, and
|
|
74
|
+
* a row matches the chosen one when its {@link filterValue} (or its text) **is** that value -
|
|
75
|
+
* for a column with a handful of values: a type, a state. The first entry of the list the table
|
|
76
|
+
* draws is its own "all", which filters nothing.
|
|
77
|
+
*/
|
|
78
|
+
readonly filterOptions?: readonly FilterOption[];
|
|
79
|
+
/**
|
|
80
|
+
* What the column's own filter compares, where that is not the text the cell shows - the
|
|
81
|
+
* language-independent id behind a translated label, so a filter kept in an address works in
|
|
82
|
+
* every language. The table's search over all columns keeps reading {@link value}. Defaults to
|
|
83
|
+
* {@link value}.
|
|
84
|
+
*/
|
|
85
|
+
readonly filterValue?: (row: T) => CellValue;
|
|
86
|
+
}
|
|
87
|
+
/** One choice of a column's filter list ({@link DataTableColumn.filterOptions}). */
|
|
88
|
+
export interface FilterOption {
|
|
89
|
+
readonly value: string;
|
|
90
|
+
readonly label: string;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* The collation the tables sort text with when none is named: German, which sorts the umlauts
|
|
94
|
+
* with their base letters (ä with a) and is the same order for English text. Named rather than
|
|
95
|
+
* left to the browser, so a table has one order on every machine.
|
|
96
|
+
*/
|
|
97
|
+
export declare const DEFAULT_COLLATION = "de";
|
|
98
|
+
export type SortDirection = 'asc' | 'desc';
|
|
99
|
+
export interface SortState {
|
|
100
|
+
readonly key: string;
|
|
101
|
+
readonly direction: SortDirection;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* One line of the rendered grid: a top-level row, one of its sub-rows, or the label row of a
|
|
105
|
+
* sub-grid.
|
|
106
|
+
*
|
|
107
|
+
* 2.x drew the channels of a device in a jqGrid *subgrid* - its own table with its own headers
|
|
108
|
+
* inside the expanded device row. Reproducing that as a nested grid would cost the virtualiser, so
|
|
109
|
+
* the label row is a line of the same flat list, marked `kind: 'header'`, and the renderer draws
|
|
110
|
+
* the sub-column labels instead of cell values for it.
|
|
111
|
+
*/
|
|
112
|
+
export interface FlatRow<T> {
|
|
113
|
+
readonly id: string;
|
|
114
|
+
readonly row: T;
|
|
115
|
+
/** 0 for a device, 1 for one of its channels. */
|
|
116
|
+
readonly depth: number;
|
|
117
|
+
readonly hasChildren: boolean;
|
|
118
|
+
readonly expanded: boolean;
|
|
119
|
+
/** The id of the top-level row this belongs to. */
|
|
120
|
+
readonly rootId: string;
|
|
121
|
+
/** `header` is the sub-grid's label row; everything else is a real row. */
|
|
122
|
+
readonly kind: 'row' | 'header';
|
|
123
|
+
/**
|
|
124
|
+
* Unique per rendered line, which `id` is not: the RSSI sub-grid lists a device's peers, and a
|
|
125
|
+
* peer can be a device that has its own top-level row. Selection still works on `id`; this is
|
|
126
|
+
* only what the keyed `{#each}` uses.
|
|
127
|
+
*/
|
|
128
|
+
readonly key: string;
|
|
129
|
+
}
|
|
130
|
+
export declare function cellValue<T>(row: T, column: DataTableColumn<T>): CellValue;
|
|
131
|
+
export declare function cellText<T>(row: T, column: DataTableColumn<T>): string;
|
|
132
|
+
export declare function isSortable<T>(column: DataTableColumn<T>): boolean;
|
|
133
|
+
export declare function isFilterable<T>(column: DataTableColumn<T>): boolean;
|
|
134
|
+
/** Case-insensitive "contains", which is the `cn` default search of the 2.x filter toolbar. */
|
|
135
|
+
export declare function matchesText(haystack: string, needle: string): boolean;
|
|
136
|
+
/** The text a column's own filter compares: its {@link DataTableColumn.filterValue}, or the cell's text. */
|
|
137
|
+
export declare function filterText<T>(row: T, column: DataTableColumn<T>): string;
|
|
138
|
+
/** What a column is sorted by: its {@link DataTableColumn.sortValue}, or the cell's value. */
|
|
139
|
+
export declare function sortValue<T>(row: T, column: DataTableColumn<T>): CellValue;
|
|
140
|
+
/**
|
|
141
|
+
* Does a row pass a column's own filter? A text field is "contains"; a list of choices
|
|
142
|
+
* ({@link DataTableColumn.filterOptions}) is "is".
|
|
143
|
+
*/
|
|
144
|
+
export declare function matchesColumnFilter<T>(row: T, column: DataTableColumn<T>, needle: string): boolean;
|
|
145
|
+
/** Does a row match the search over all columns and every per-column filter? */
|
|
146
|
+
export declare function matchesFilters<T>(row: T, columns: readonly DataTableColumn<T>[], globalFilter: string, columnFilters: Readonly<Record<string, string>>): boolean;
|
|
147
|
+
/**
|
|
148
|
+
* The words of a search over all columns. A row matches when every one of them is somewhere in its
|
|
149
|
+
* filterable columns - "regen markise" finds the program named "Markise" that the rain triggers,
|
|
150
|
+
* and a single word is the plain "contains" it always was.
|
|
151
|
+
*/
|
|
152
|
+
export declare function searchWords(needle: string): string[];
|
|
153
|
+
/**
|
|
154
|
+
* Compares two cell values. Numbers compare numerically, everything else compares as text with
|
|
155
|
+
* `localeCompare`, and an empty cell always sorts last - the 2.x grid put the nameless devices at
|
|
156
|
+
* the end, not at the top.
|
|
157
|
+
*/
|
|
158
|
+
export declare function compareCells(a: CellValue, b: CellValue, collator?: Intl.Collator): number;
|
|
159
|
+
/**
|
|
160
|
+
* The collator of a locale the way every table compares text: digits as numbers ("Kanal 2" before
|
|
161
|
+
* "Kanal 10"), case and accents only where nothing else tells two texts apart. One per locale,
|
|
162
|
+
* kept: a sort calls it for every pair.
|
|
163
|
+
*/
|
|
164
|
+
export declare function tableCollator(locale?: string): Intl.Collator;
|
|
165
|
+
export interface BuildRowsOptions<T> {
|
|
166
|
+
readonly rows: readonly T[];
|
|
167
|
+
readonly columns: readonly DataTableColumn<T>[];
|
|
168
|
+
readonly getId: (row: T) => string;
|
|
169
|
+
readonly children?: ((row: T) => readonly T[]) | undefined;
|
|
170
|
+
readonly expanded: ReadonlySet<string>;
|
|
171
|
+
readonly globalFilter?: string;
|
|
172
|
+
readonly columnFilters?: Readonly<Record<string, string>>;
|
|
173
|
+
readonly sort?: SortState | undefined;
|
|
174
|
+
/** The locale text is sorted in; {@link DEFAULT_COLLATION} when none is named. */
|
|
175
|
+
readonly locale?: string | undefined;
|
|
176
|
+
/**
|
|
177
|
+
* The columns the sub-rows have of their own. Without them a channel is drawn with the device
|
|
178
|
+
* columns (the plain behaviour); with them the filter also reads a channel through its own
|
|
179
|
+
* columns, so filtering for a channel TYPE finds the device whose channel matches.
|
|
180
|
+
*/
|
|
181
|
+
readonly subColumns?: readonly DataTableColumn<T>[] | undefined;
|
|
182
|
+
/** Put a label row above each expanded row's children, the way the 2.x subgrid had one. */
|
|
183
|
+
readonly subHeader?: boolean;
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Filters, sorts and flattens. A parent survives the filter when it matches itself or when one of
|
|
187
|
+
* its children does, so filtering for a channel type still shows the device it belongs to.
|
|
188
|
+
*/
|
|
189
|
+
export declare function buildRows<T>(options: BuildRowsOptions<T>): FlatRow<T>[];
|
|
190
|
+
export interface Window {
|
|
191
|
+
readonly start: number;
|
|
192
|
+
readonly end: number;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* The slice of rows to draw for a scroll position. `overscan` rows above and below keep the fast
|
|
196
|
+
* scroll from showing gaps.
|
|
197
|
+
*/
|
|
198
|
+
export declare function visibleWindow(total: number, scrollTop: number, viewportHeight: number, rowHeight: number, overscan?: number): Window;
|
|
199
|
+
/** One column track of the grid: the merged width of everything that is drawn in that column. */
|
|
200
|
+
export interface TableTrack {
|
|
201
|
+
readonly key: string;
|
|
202
|
+
readonly width: number | undefined;
|
|
203
|
+
readonly fixed: boolean;
|
|
204
|
+
/** The column's own minimum, where its content needs more than {@link MIN_TRACK_PX}. */
|
|
205
|
+
readonly minWidth?: number | undefined;
|
|
206
|
+
/** A user width below {@link minWidth} is drawn at {@link minWidth}. */
|
|
207
|
+
readonly keepMinWidth?: boolean | undefined;
|
|
208
|
+
}
|
|
209
|
+
/** Where each column of a depth sits, and the template every row of the table uses. */
|
|
210
|
+
export interface TableLayout {
|
|
211
|
+
/**
|
|
212
|
+
* The `grid-template-columns` of the head, the filter row and **every** row, at any depth - as
|
|
213
|
+
* designed, before a user dragged any column ({@link sizedTemplate} adds those widths).
|
|
214
|
+
*/
|
|
215
|
+
readonly template: string;
|
|
216
|
+
/** 1-based grid track of a column, by key. Shared keys share a track. */
|
|
217
|
+
readonly track: Readonly<Record<string, number>>;
|
|
218
|
+
/** The tracks in order, without the expander. */
|
|
219
|
+
readonly tracks: readonly TableTrack[];
|
|
220
|
+
readonly expander: boolean;
|
|
221
|
+
/**
|
|
222
|
+
* The keys of the tracks only the sub-grid has - the channel's DIRECTION, a peer's dBm pair
|
|
223
|
+
*. Their widths belong to the sub-grid and are kept apart from the table's own; a
|
|
224
|
+
* key both depths share is the parent's column, sized from the head.
|
|
225
|
+
*/
|
|
226
|
+
readonly subKeys: readonly string[];
|
|
227
|
+
}
|
|
228
|
+
/** The template with the user's widths in it, and the width below which the grid scrolls sideways. */
|
|
229
|
+
export interface SizedTemplate {
|
|
230
|
+
readonly template: string;
|
|
231
|
+
readonly minWidth: number;
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* The layout's template with the widths a user gave some of its columns.
|
|
235
|
+
*
|
|
236
|
+
* Fixed columns ignore a width - they keep their pixels. `minWidth` is what every row, the head and
|
|
237
|
+
* the filter row are drawn at least as wide as: when the pixels add up to more than the window, the
|
|
238
|
+
* body scrolls sideways, and a row whose box stopped at the window's edge would leave its hover and
|
|
239
|
+
* selection background behind while its cells scroll on.
|
|
240
|
+
*/
|
|
241
|
+
export declare function sizedTemplate(layout: Pick<TableLayout, 'tracks' | 'expander'>, widths?: Readonly<Record<string, number>>): SizedTemplate;
|
|
242
|
+
/**
|
|
243
|
+
* The one grid the whole table is drawn on - the device rows, the channel sub-grid and the head.
|
|
244
|
+
*
|
|
245
|
+
* The sub-grid used to get a template of its own, so a channel's Name started where the
|
|
246
|
+
* device's icon did and no column of the sub-grid stood under the column it belongs to. After
|
|
247
|
+
* the first look: "table columns are not regularly sized when the channel sub-grid is expanded".
|
|
248
|
+
*
|
|
249
|
+
* Columns are therefore merged **by key** into one track list: a key both depths know shares one
|
|
250
|
+
* track and keeps the parent's width, so expanding a device can never move a device column; a key
|
|
251
|
+
* only the sub-grid has gets a track of its own, inserted after the track its predecessor sits in,
|
|
252
|
+
* so the sub-grid keeps its reading order. A depth that has nothing for a track leaves it empty -
|
|
253
|
+
* which is why every cell is placed explicitly rather than by auto-flow.
|
|
254
|
+
*/
|
|
255
|
+
export declare function tableLayout<T>(columns: readonly DataTableColumn<T>[], subColumns: readonly DataTableColumn<T>[] | undefined, expander: boolean): TableLayout;
|
|
256
|
+
/**
|
|
257
|
+
* The widths the one template is drawn with: the table's own for the columns of its
|
|
258
|
+
* rows, the sub-grid's for the columns only the sub-grid has. Each side is kept under its own table
|
|
259
|
+
* id, so an entry for a column the other side owns - a stale or hand-edited one - is left out
|
|
260
|
+
* rather than sizing that column from the wrong place.
|
|
261
|
+
*/
|
|
262
|
+
export declare function layoutWidths(layout: Pick<TableLayout, 'subKeys'>, parentWidths: Readonly<Record<string, number>>, subWidths: Readonly<Record<string, number>>): Record<string, number>;
|
|
263
|
+
/**
|
|
264
|
+
* A header cell over several columns, drawn in a row of its own above the column labels - what
|
|
265
|
+
* jqGrid's `setGroupHeaders` did for the 2.x Funk grid, where every BidCos interface got its serial
|
|
266
|
+
* (and its description in small print) over its `<- dBm` / `-> dBm` / set columns.
|
|
267
|
+
*/
|
|
268
|
+
export interface DataTableColumnGroup {
|
|
269
|
+
readonly key: string;
|
|
270
|
+
readonly label: string;
|
|
271
|
+
/** A second, smaller line under the label. */
|
|
272
|
+
readonly sublabel?: string | undefined;
|
|
273
|
+
/** The keys of the columns it spans. Hidden columns do not count; a group with none left is not drawn. */
|
|
274
|
+
readonly columns: readonly string[];
|
|
275
|
+
}
|
|
276
|
+
/** Where a group header sits on the grid: 1-based track of its first column, exclusive end. */
|
|
277
|
+
export interface GroupSpan {
|
|
278
|
+
readonly key: string;
|
|
279
|
+
readonly label: string;
|
|
280
|
+
readonly sublabel?: string | undefined;
|
|
281
|
+
readonly start: number;
|
|
282
|
+
readonly end: number;
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* The spans of the group headers, on the same tracks the layout gives the columns. A group spans
|
|
286
|
+
* from its leftmost visible column to its rightmost one; a group whose columns are all hidden or
|
|
287
|
+
* unknown is dropped.
|
|
288
|
+
*/
|
|
289
|
+
export declare function groupSpans<T>(groups: readonly DataTableColumnGroup[], columns: readonly DataTableColumn<T>[], layout: TableLayout): GroupSpan[];
|
|
290
|
+
/** Is any filter - the outside needle or a column field - narrowing the rows? */
|
|
291
|
+
export declare function hasActiveFilter(globalFilter: string, columnFilters: Readonly<Record<string, string>>): boolean;
|
|
292
|
+
/** The `grid-template-columns` for a set of columns, plus the leading expander when there is one. */
|
|
293
|
+
export declare function gridTemplate<T>(columns: readonly DataTableColumn<T>[], expander: boolean): string;
|
|
294
|
+
/**
|
|
295
|
+
* The ids a shift-click selects: everything between the anchor and the clicked row, in the order
|
|
296
|
+
* the grid currently shows them.
|
|
297
|
+
*/
|
|
298
|
+
export declare function rangeIds<T>(rows: readonly FlatRow<T>[], anchorId: string, targetId: string): string[];
|
|
299
|
+
/** Click, ctrl/meta-click and shift-click, as every grid in 2.7 behaved. */
|
|
300
|
+
export declare function nextSelection<T>(rows: readonly FlatRow<T>[], selected: readonly string[], anchorId: string | undefined, targetId: string, modifiers: {
|
|
301
|
+
readonly ctrl?: boolean;
|
|
302
|
+
readonly shift?: boolean;
|
|
303
|
+
}): {
|
|
304
|
+
selected: string[];
|
|
305
|
+
anchorId: string;
|
|
306
|
+
};
|