@galaxy-io/dls 2.8.1 → 2.10.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/README.md +2 -2
- package/dist/beacons/Beacon.d.ts +1 -1
- package/dist/beacons/Beacon.js +12 -28
- package/dist/brand/GalaxyAlchemyWordmark.d.ts +4 -1
- package/dist/brand/GalaxyAlchemyWordmark.js +7 -1
- package/dist/brand/GalaxyFilamentWordmark.d.ts +5 -2
- package/dist/brand/GalaxyFilamentWordmark.js +9 -2
- package/dist/brand/GalaxyLogomark.js +3 -0
- package/dist/brand/PoweredBy.d.ts +27 -0
- package/dist/brand/PoweredBy.js +96 -0
- package/dist/brand/internal/svg/GalaxyAlchemyWordmarkSvg.d.ts +1 -1
- package/dist/brand/internal/svg/GalaxyAlchemyWordmarkSvg.js +34 -8
- package/dist/brand/internal/svg/GalaxyFilamentWordmarkSvg.d.ts +1 -1
- package/dist/brand/internal/svg/GalaxyFilamentWordmarkSvg.js +2 -2
- package/dist/charts/Heatmap.js +25 -9
- package/dist/charts/Sparkline.d.ts +1 -1
- package/dist/charts/Sparkline.js +10 -26
- package/dist/charts/chartFormat.d.ts +1 -1
- package/dist/charts/chartFormat.js +2 -2
- package/dist/charts/heatmapGeometry.d.ts +14 -0
- package/dist/charts/heatmapGeometry.js +17 -1
- package/dist/chips/Chip.d.ts +2 -2
- package/dist/chips/Chip.js +15 -31
- package/dist/drawer/Drawer.d.ts +2 -2
- package/dist/drawer/Drawer.js +1 -1
- package/dist/editor/CodeEditor.d.ts +1 -1
- package/dist/editor/CodeEditor.js +2 -1
- package/dist/feedback/Alert.d.ts +36 -9
- package/dist/feedback/Alert.js +26 -8
- package/dist/feedback/ProgressBar.d.ts +4 -1
- package/dist/feedback/ProgressBar.js +17 -30
- package/dist/feedback/ProgressCircle.d.ts +1 -1
- package/dist/feedback/ProgressCircle.js +14 -30
- package/dist/hooks/useEndReached.d.ts +40 -0
- package/dist/hooks/useEndReached.js +69 -0
- package/dist/icons/Icon.d.ts +36 -8
- package/dist/icons/Icon.js +14 -7
- package/dist/inputs/CronInput.js +114 -78
- package/dist/inputs/DateInput.d.ts +1 -1
- package/dist/inputs/DateInput.js +10 -10
- package/dist/inputs/MultiSelectInput.d.ts +3 -1
- package/dist/inputs/MultiSelectInput.js +8 -3
- package/dist/inputs/SelectInput.d.ts +8 -1
- package/dist/inputs/SelectInput.js +52 -25
- package/dist/inputs/internal/selectAll.d.ts +11 -0
- package/dist/inputs/internal/selectAll.js +28 -0
- package/dist/json/JsonViewer.js +7 -6
- package/dist/layout/AppFrame.d.ts +20 -0
- package/dist/layout/AppFrame.js +71 -0
- package/dist/layout/EmptyLayout.d.ts +53 -0
- package/dist/layout/EmptyLayout.js +59 -0
- package/dist/layout/ErrorLayout.d.ts +42 -0
- package/dist/layout/ErrorLayout.js +60 -0
- package/dist/layout/PageLayout.d.ts +26 -0
- package/dist/layout/PageLayout.js +116 -0
- package/dist/layout/PendingLayout.d.ts +30 -0
- package/dist/layout/PendingLayout.js +57 -0
- package/dist/layout/internal/errorState.d.ts +14 -0
- package/dist/layout/internal/errorState.js +49 -0
- package/dist/layout/internal/region.d.ts +10 -0
- package/dist/layout/internal/region.js +24 -0
- package/dist/lists/DescriptionList.js +1 -0
- package/dist/menu/Menu.d.ts +2 -2
- package/dist/menu/Menu.js +6 -13
- package/dist/modal/Modal.d.ts +2 -2
- package/dist/modal/Modal.js +1 -1
- package/dist/navigation/CommandPalette.js +4 -11
- package/dist/navigation/SidebarNav.d.ts +5 -0
- package/dist/navigation/SidebarNav.js +41 -22
- package/dist/navigation/Topbar.js +4 -0
- package/dist/shapes/Circle.d.ts +1 -1
- package/dist/shapes/Circle.js +10 -26
- package/dist/shapes/Square.d.ts +1 -1
- package/dist/shapes/Square.js +10 -26
- package/dist/styles/internal/roleColor.d.ts +3 -0
- package/dist/styles/internal/roleColor.js +42 -0
- package/dist/styles/mixins.js +1 -1
- package/dist/styles.css +1 -1
- package/dist/table/InfiniteSpreadsheet.js +6 -6
- package/dist/table/InfiniteTable.d.ts +57 -18
- package/dist/table/InfiniteTable.js +5 -3
- package/dist/table/TableCore.d.ts +11 -2
- package/dist/table/TableCore.js +108 -87
- package/dist/table/VirtualizedInfiniteTable.d.ts +58 -19
- package/dist/table/VirtualizedInfiniteTable.js +9 -6
- package/dist/table/useInfiniteScrollSentinel.d.ts +13 -13
- package/dist/table/useInfiniteScrollSentinel.js +7 -51
- package/dist/table/useTableColumnLayout.d.ts +8 -2
- package/dist/table/useTableColumnLayout.js +36 -13
- package/dist/theme/tokens/dark.js +1 -1
- package/dist/theme/tokens/light.js +4 -3
- package/dist/theme/tokens/types.d.ts +7 -7
- package/dist/timeline/Timeline.d.ts +1 -1
- package/dist/timeline/Timeline.js +6 -24
- package/dist/tokens.css +1 -1
- package/dist/utils/format.d.ts +35 -10
- package/dist/utils/format.js +60 -12
- package/dist/utils/search.d.ts +15 -0
- package/dist/utils/search.js +24 -0
- package/dist/vite/index.d.ts +16 -2
- package/dist/vite/index.js +28 -19
- package/dist/vite/internal/themeBoot.d.ts +25 -0
- package/dist/vite/internal/themeBoot.js +44 -0
- package/dist/vite/internal/wywOptions.d.ts +46 -0
- package/dist/vite/internal/wywOptions.js +44 -0
- package/package.json +34 -1
package/dist/table/TableCore.js
CHANGED
|
@@ -8,13 +8,14 @@ import { t } from "../theme/tokens/t.js";
|
|
|
8
8
|
import Icon, { IconVariant } from "../icons/Icon.js";
|
|
9
9
|
import Rotate from "../transform/Rotate.js";
|
|
10
10
|
import Button, { ButtonSize, ButtonVariant } from "../buttons/Button.js";
|
|
11
|
-
import EmptyState, { EmptyStateSize
|
|
11
|
+
import EmptyState, { EmptyStateSize } from "../feedback/EmptyState.js";
|
|
12
12
|
import { useElementClientSize } from "../hooks/useElementClientSize.js";
|
|
13
|
-
import { formatNumber } from "../utils/format.js";
|
|
13
|
+
import { formatDate, formatNumber } from "../utils/format.js";
|
|
14
14
|
import ResizeHandle from "../layout/ResizeHandle.js";
|
|
15
|
+
import { useEndReached } from "../hooks/useEndReached.js";
|
|
15
16
|
import CheckboxInput, { CheckboxInputSize } from "../inputs/CheckboxInput.js";
|
|
17
|
+
import { ErrorStateContent } from "../layout/internal/errorState.js";
|
|
16
18
|
import Menu, { MenuCheckboxItem, MenuGroup, MenuItem, MenuSeparator, MenuSize } from "../menu/Menu.js";
|
|
17
|
-
import { useInfiniteScrollSentinel } from "./useInfiniteScrollSentinel.js";
|
|
18
19
|
/* empty css */
|
|
19
20
|
import { styled } from "@linaria/react";
|
|
20
21
|
import { memo, useCallback, useEffect, useRef, useState } from "react";
|
|
@@ -130,66 +131,72 @@ var Head = /*#__PURE__*/ styled("thead")({
|
|
|
130
131
|
class: "gx-TableCore-Head-hij68rq",
|
|
131
132
|
propsAsIs: false
|
|
132
133
|
});
|
|
134
|
+
/**
|
|
135
|
+
* `hasHeader` false: the header row stays in the DOM, out of view and out of flow, so screen
|
|
136
|
+
* readers keep the column names. It holds plain labels only (no sort, resize or menu buttons), so
|
|
137
|
+
* nothing in it takes focus. Declared after `Head` so the hiding wins over its sticky position.
|
|
138
|
+
*/
|
|
139
|
+
var HIDDEN_HEAD_CSS = "gx-TableCore-HIDDEN_HEAD_CSS-h1seyvh2";
|
|
133
140
|
var Body = /*#__PURE__*/ styled("tbody")({
|
|
134
141
|
name: "Body",
|
|
135
|
-
class: "gx-TableCore-Body-
|
|
142
|
+
class: "gx-TableCore-Body-bf09csv",
|
|
136
143
|
propsAsIs: false
|
|
137
144
|
});
|
|
138
145
|
/** Skeleton, empty, error and end-error rows; grows to fill a bounded scrollport. */
|
|
139
146
|
var StatusBody = /*#__PURE__*/ styled("tbody")({
|
|
140
147
|
name: "StatusBody",
|
|
141
|
-
class: "gx-TableCore-StatusBody-
|
|
148
|
+
class: "gx-TableCore-StatusBody-s1loheb3",
|
|
142
149
|
propsAsIs: false
|
|
143
150
|
});
|
|
144
151
|
var Foot = /*#__PURE__*/ styled("tfoot")({
|
|
145
152
|
name: "Foot",
|
|
146
|
-
class: "gx-TableCore-Foot-
|
|
153
|
+
class: "gx-TableCore-Foot-f1650vjz",
|
|
147
154
|
propsAsIs: false
|
|
148
155
|
});
|
|
149
156
|
var HeaderRow = /*#__PURE__*/ styled("tr")({
|
|
150
157
|
name: "HeaderRow",
|
|
151
|
-
class: "gx-TableCore-HeaderRow-
|
|
158
|
+
class: "gx-TableCore-HeaderRow-h3prmx7",
|
|
152
159
|
propsAsIs: false
|
|
153
160
|
});
|
|
154
161
|
var FooterRow = /*#__PURE__*/ styled("tr")({
|
|
155
162
|
name: "FooterRow",
|
|
156
|
-
class: "gx-TableCore-FooterRow-
|
|
163
|
+
class: "gx-TableCore-FooterRow-f18zsjxh",
|
|
157
164
|
propsAsIs: false
|
|
158
165
|
});
|
|
159
166
|
/** @internal A body row. States are classes (`ROW_*_CSS`). */
|
|
160
167
|
var TableRow = /*#__PURE__*/ styled("tr")({
|
|
161
168
|
name: "TableRow",
|
|
162
|
-
class: "gx-TableCore-TableRow-
|
|
169
|
+
class: "gx-TableCore-TableRow-t1f7xxie",
|
|
163
170
|
propsAsIs: false
|
|
164
171
|
});
|
|
165
172
|
/** @internal A body or footer cell. */
|
|
166
173
|
var TableCell = /*#__PURE__*/ styled("td")({
|
|
167
174
|
name: "TableCell",
|
|
168
|
-
class: "gx-TableCore-TableCell-
|
|
175
|
+
class: "gx-TableCore-TableCell-t1n0v2ch",
|
|
169
176
|
propsAsIs: false
|
|
170
177
|
});
|
|
171
178
|
/** A header cell: not clipped, so the resize handle can straddle the column edge. */
|
|
172
179
|
var HeaderCell = /*#__PURE__*/ styled("th")({
|
|
173
180
|
name: "HeaderCell",
|
|
174
|
-
class: "gx-TableCore-HeaderCell-
|
|
181
|
+
class: "gx-TableCore-HeaderCell-h1nswbdd",
|
|
175
182
|
propsAsIs: false
|
|
176
183
|
});
|
|
177
184
|
/** The press target of a sortable or movable column: label and sort icon. */
|
|
178
185
|
var HeaderButton = /*#__PURE__*/ styled("button")({
|
|
179
186
|
name: "HeaderButton",
|
|
180
|
-
class: "gx-TableCore-HeaderButton-
|
|
187
|
+
class: "gx-TableCore-HeaderButton-hc3y207",
|
|
181
188
|
propsAsIs: false
|
|
182
189
|
});
|
|
183
190
|
/** The label of a column that cannot be pressed. */
|
|
184
191
|
var HeaderLabel = /*#__PURE__*/ styled("span")({
|
|
185
192
|
name: "HeaderLabel",
|
|
186
|
-
class: "gx-TableCore-HeaderLabel-
|
|
193
|
+
class: "gx-TableCore-HeaderLabel-h1po1i5a",
|
|
187
194
|
propsAsIs: false
|
|
188
195
|
});
|
|
189
196
|
/** Marks the gap a dragged column would land in. */
|
|
190
197
|
var DropIndicator = /*#__PURE__*/ styled("span")({
|
|
191
198
|
name: "DropIndicator",
|
|
192
|
-
class: "gx-TableCore-DropIndicator-
|
|
199
|
+
class: "gx-TableCore-DropIndicator-dcxvgum",
|
|
193
200
|
propsAsIs: false
|
|
194
201
|
});
|
|
195
202
|
/**
|
|
@@ -200,102 +207,113 @@ var DropIndicator = /*#__PURE__*/ styled("span")({
|
|
|
200
207
|
*/
|
|
201
208
|
var Sentinel = /*#__PURE__*/ styled("div")({
|
|
202
209
|
name: "Sentinel",
|
|
203
|
-
class: "gx-TableCore-Sentinel-
|
|
210
|
+
class: "gx-TableCore-Sentinel-s7ul01a",
|
|
204
211
|
propsAsIs: false
|
|
205
212
|
});
|
|
206
213
|
/** The visible width of an empty or error body, pinned while the table scrolls sideways. */
|
|
207
214
|
var StatusViewport = /*#__PURE__*/ styled("div")({
|
|
208
215
|
name: "StatusViewport",
|
|
209
|
-
class: "gx-TableCore-StatusViewport-
|
|
216
|
+
class: "gx-TableCore-StatusViewport-s1qemn2d",
|
|
210
217
|
propsAsIs: false
|
|
211
218
|
});
|
|
212
219
|
/** The end error row's content: icon and message, sticky like the status viewport. */
|
|
213
220
|
var EndErrorViewport = /*#__PURE__*/ styled("div")({
|
|
214
221
|
name: "EndErrorViewport",
|
|
215
|
-
class: "gx-TableCore-EndErrorViewport-
|
|
222
|
+
class: "gx-TableCore-EndErrorViewport-ejip7oh",
|
|
216
223
|
propsAsIs: false
|
|
217
224
|
});
|
|
218
225
|
var StatusRowElement = /*#__PURE__*/ styled("tr")({
|
|
219
226
|
name: "StatusRowElement",
|
|
220
|
-
class: "gx-TableCore-StatusRowElement-
|
|
227
|
+
class: "gx-TableCore-StatusRowElement-s1cfdxs6",
|
|
221
228
|
propsAsIs: false
|
|
222
229
|
});
|
|
223
230
|
var StatusCell = /*#__PURE__*/ styled("td")({
|
|
224
231
|
name: "StatusCell",
|
|
225
|
-
class: "gx-TableCore-StatusCell-
|
|
232
|
+
class: "gx-TableCore-StatusCell-slttqlf",
|
|
226
233
|
propsAsIs: false
|
|
227
234
|
});
|
|
228
235
|
var EndErrorRow = /*#__PURE__*/ styled("tr")({
|
|
229
236
|
name: "EndErrorRow",
|
|
230
|
-
class: "gx-TableCore-EndErrorRow-
|
|
237
|
+
class: "gx-TableCore-EndErrorRow-e60f67l",
|
|
231
238
|
propsAsIs: false
|
|
232
239
|
});
|
|
233
240
|
var ExpandedRowElement = /*#__PURE__*/ styled("tr")({
|
|
234
241
|
name: "ExpandedRowElement",
|
|
235
|
-
class: "gx-TableCore-ExpandedRowElement-
|
|
242
|
+
class: "gx-TableCore-ExpandedRowElement-e1xg4fvx",
|
|
236
243
|
propsAsIs: false
|
|
237
244
|
});
|
|
238
245
|
var ExpandedCell = /*#__PURE__*/ styled("td")({
|
|
239
246
|
name: "ExpandedCell",
|
|
240
|
-
class: "gx-TableCore-ExpandedCell-
|
|
247
|
+
class: "gx-TableCore-ExpandedCell-e13bd0ox",
|
|
241
248
|
propsAsIs: false
|
|
242
249
|
});
|
|
243
250
|
/** Pinned to the visible width while the table scrolls sideways; the gutter lines up with the expand column. */
|
|
244
251
|
var ExpandedViewport = /*#__PURE__*/ styled("div")({
|
|
245
252
|
name: "ExpandedViewport",
|
|
246
|
-
class: "gx-TableCore-ExpandedViewport-
|
|
253
|
+
class: "gx-TableCore-ExpandedViewport-enk7ldu",
|
|
247
254
|
propsAsIs: false
|
|
248
255
|
});
|
|
249
256
|
var ExpandedGutter = /*#__PURE__*/ styled("div")({
|
|
250
257
|
name: "ExpandedGutter",
|
|
251
|
-
class: "gx-TableCore-ExpandedGutter-
|
|
258
|
+
class: "gx-TableCore-ExpandedGutter-e1yoeixn",
|
|
252
259
|
propsAsIs: false
|
|
253
260
|
});
|
|
254
261
|
var ExpandedBody = /*#__PURE__*/ styled("div")({
|
|
255
262
|
name: "ExpandedBody",
|
|
256
|
-
class: "gx-TableCore-ExpandedBody-
|
|
263
|
+
class: "gx-TableCore-ExpandedBody-e18ghmlo",
|
|
257
264
|
propsAsIs: false
|
|
258
265
|
});
|
|
259
266
|
/**
|
|
260
267
|
* The parent paints nothing: the table paints the surface found further up (`--gx-table-surface`,
|
|
261
268
|
* set by `useTableSurface`) so its sticky parts stay opaque.
|
|
262
269
|
*/
|
|
263
|
-
var SURFACE_ANCESTOR_CSS = "gx-TableCore-SURFACE_ANCESTOR_CSS-
|
|
264
|
-
/**
|
|
265
|
-
|
|
270
|
+
var SURFACE_ANCESTOR_CSS = "gx-TableCore-SURFACE_ANCESTOR_CSS-s1g01kh5";
|
|
271
|
+
/**
|
|
272
|
+
* @internal Select, expand and row-actions columns: a square of the row height, content centered.
|
|
273
|
+
* At an end of the row it also holds the table's inset (`--gx-table-cell-edge`, `TABLE_INSET_CSS`).
|
|
274
|
+
*/
|
|
275
|
+
var SYNTHETIC_CELL_CSS = "gx-TableCore-SYNTHETIC_CELL_CSS-s1qwxx34";
|
|
266
276
|
/** @internal Alignment of a column's header and cells. */
|
|
267
277
|
var COLUMN_ALIGN_TO_CSS_MAP = {
|
|
268
|
-
left: "gx-TableCore-left-
|
|
269
|
-
center: "gx-TableCore-center-
|
|
270
|
-
right: "gx-TableCore-right-
|
|
278
|
+
left: "gx-TableCore-left-l152j0h",
|
|
279
|
+
center: "gx-TableCore-center-c1y0un5j",
|
|
280
|
+
right: "gx-TableCore-right-r1dzycrm"
|
|
271
281
|
};
|
|
272
282
|
/** @internal Sticky to an edge while the table scrolls sideways. */
|
|
273
283
|
var PIN_TO_CSS_MAP = {
|
|
274
|
-
[Side.LEFT]: "gx-TableCore-Side_LEFT-
|
|
275
|
-
[Side.RIGHT]: "gx-TableCore-Side_RIGHT-
|
|
284
|
+
[Side.LEFT]: "gx-TableCore-Side_LEFT-s6wh2p6",
|
|
285
|
+
[Side.RIGHT]: "gx-TableCore-Side_RIGHT-s1imw0tm"
|
|
276
286
|
};
|
|
277
287
|
/** @internal The edge hairline of the last left-pinned / first right-pinned data column. */
|
|
278
288
|
var PIN_TO_EDGE_CSS_MAP = {
|
|
279
|
-
[Side.LEFT]: "gx-TableCore-Side_LEFT-
|
|
280
|
-
[Side.RIGHT]: "gx-TableCore-Side_RIGHT-
|
|
289
|
+
[Side.LEFT]: "gx-TableCore-Side_LEFT-s1swk4bm",
|
|
290
|
+
[Side.RIGHT]: "gx-TableCore-Side_RIGHT-s14t0x1z"
|
|
281
291
|
};
|
|
282
292
|
/** Pinned header cells stack above pinned body cells and the sticky header. */
|
|
283
|
-
var PINNED_HEADER_CSS = "gx-TableCore-PINNED_HEADER_CSS-
|
|
293
|
+
var PINNED_HEADER_CSS = "gx-TableCore-PINNED_HEADER_CSS-p1nurjwh";
|
|
284
294
|
/** The row does something: pointer and a hover fill. */
|
|
285
|
-
var ROW_INTERACTIVE_CSS = "gx-TableCore-ROW_INTERACTIVE_CSS-
|
|
295
|
+
var ROW_INTERACTIVE_CSS = "gx-TableCore-ROW_INTERACTIVE_CSS-r1g7lrfg";
|
|
286
296
|
/** A selected row: `background.selected`. Declared after the interactive state so it holds on hover. */
|
|
287
|
-
var ROW_SELECTED_CSS = "gx-TableCore-ROW_SELECTED_CSS-
|
|
297
|
+
var ROW_SELECTED_CSS = "gx-TableCore-ROW_SELECTED_CSS-r10dstoh";
|
|
288
298
|
/** The current row (`activeRowId`): a fill and the `text.primary` bar of active navigation. */
|
|
289
|
-
var ROW_ACTIVE_CSS = "gx-TableCore-ROW_ACTIVE_CSS-
|
|
299
|
+
var ROW_ACTIVE_CSS = "gx-TableCore-ROW_ACTIVE_CSS-rpsswqs";
|
|
290
300
|
/** @internal The last row, or a row whose panel is open: no bottom hairline. */
|
|
291
|
-
var ROW_NO_BORDER_CSS = "gx-TableCore-ROW_NO_BORDER_CSS-
|
|
301
|
+
var ROW_NO_BORDER_CSS = "gx-TableCore-ROW_NO_BORDER_CSS-rwbqwrq";
|
|
292
302
|
/**
|
|
293
303
|
* The rows end above the bottom of the scroll box (a full-height table with a few rows): the last
|
|
294
304
|
* row keeps its hairline, so the list reads as finished instead of floating in empty space. Set by
|
|
295
305
|
* `useRowsEndAboveBottom`; it outranks `ROW_NO_BORDER_CSS` and the panel rule by specificity, and
|
|
296
306
|
* sits inside each row's fixed height, so nothing moves when it toggles.
|
|
297
307
|
*/
|
|
298
|
-
var ROWS_END_ABOVE_BOTTOM_CSS = "gx-TableCore-ROWS_END_ABOVE_BOTTOM_CSS-
|
|
308
|
+
var ROWS_END_ABOVE_BOTTOM_CSS = "gx-TableCore-ROWS_END_ABOVE_BOTTOM_CSS-r1jxalmm";
|
|
309
|
+
/**
|
|
310
|
+
* `inset`: the first and last cell of every header, body and footer row pad their outer side by
|
|
311
|
+
* `--gx-table-inset` and are that much wider (data columns through `useTableColumnLayout`,
|
|
312
|
+
* synthetic ones through `--gx-table-cell-edge`). The rows keep the full width, so hairlines, hover
|
|
313
|
+
* and selected fills and the active bar still run edge to edge, and a pinned edge column keeps its
|
|
314
|
+
* inset while the table scrolls sideways.
|
|
315
|
+
*/
|
|
316
|
+
var TABLE_INSET_CSS = "gx-TableCore-TABLE_INSET_CSS-t1fx3qlj";
|
|
299
317
|
/**
|
|
300
318
|
* Whether the table's rows end above the bottom of its scroll box. The last row drops its hairline
|
|
301
319
|
* only when it lands on the box's bottom edge, where the container's frame (or a scrolled table's
|
|
@@ -335,27 +353,25 @@ function useRowsEndAboveBottom(scrollRef, tableRef, isEnabled, bodyKey) {
|
|
|
335
353
|
return isAbove;
|
|
336
354
|
}
|
|
337
355
|
/** The last expanded panel: no bottom hairline. */
|
|
338
|
-
var EXPANDED_LAST_CSS = "gx-TableCore-EXPANDED_LAST_CSS-
|
|
356
|
+
var EXPANDED_LAST_CSS = "gx-TableCore-EXPANDED_LAST_CSS-e2nd1ne";
|
|
339
357
|
/** The dragged header while reordering. 0.5 is a state, not a color token. */
|
|
340
|
-
var HEADER_DRAGGING_CSS = "gx-TableCore-HEADER_DRAGGING_CSS-
|
|
358
|
+
var HEADER_DRAGGING_CSS = "gx-TableCore-HEADER_DRAGGING_CSS-harqcf0";
|
|
341
359
|
/** The label wrapper grows when a trailing control (column actions) follows it. */
|
|
342
|
-
var LABEL_GROW_CSS = "gx-TableCore-LABEL_GROW_CSS-
|
|
343
|
-
var DROP_START_CSS = "gx-TableCore-DROP_START_CSS-
|
|
344
|
-
var DROP_END_CSS = "gx-TableCore-DROP_END_CSS-
|
|
360
|
+
var LABEL_GROW_CSS = "gx-TableCore-LABEL_GROW_CSS-l132cb1v";
|
|
361
|
+
var DROP_START_CSS = "gx-TableCore-DROP_START_CSS-d1vn45v6";
|
|
362
|
+
var DROP_END_CSS = "gx-TableCore-DROP_END_CSS-d14za3v2";
|
|
345
363
|
/** Shows on hover, while dragged and on keyboard focus; straddles the column edge. */
|
|
346
|
-
var COLUMN_RESIZE_HANDLE_CSS = "gx-TableCore-COLUMN_RESIZE_HANDLE_CSS-
|
|
364
|
+
var COLUMN_RESIZE_HANDLE_CSS = "gx-TableCore-COLUMN_RESIZE_HANDLE_CSS-c1w0t3ir";
|
|
347
365
|
/** Hovering a header cell reveals its resize handle. */
|
|
348
|
-
var HEADER_HOVER_CSS = "gx-TableCore-HEADER_HOVER_CSS-
|
|
366
|
+
var HEADER_HOVER_CSS = "gx-TableCore-HEADER_HOVER_CSS-hb9km4t";
|
|
349
367
|
/** The expand caret button: a square of its rung. */
|
|
350
|
-
var EXPAND_BUTTON_CSS = "gx-TableCore-EXPAND_BUTTON_CSS-
|
|
368
|
+
var EXPAND_BUTTON_CSS = "gx-TableCore-EXPAND_BUTTON_CSS-e1emgwoo";
|
|
351
369
|
/** @internal A virtual body: as tall as every row, which are positioned inside it. */
|
|
352
|
-
var VIRTUAL_BODY_CSS = "gx-TableCore-VIRTUAL_BODY_CSS-
|
|
370
|
+
var VIRTUAL_BODY_CSS = "gx-TableCore-VIRTUAL_BODY_CSS-vw38cm1";
|
|
353
371
|
/** @internal A virtual row, placed at `--gx-table-row-start`. */
|
|
354
|
-
var VIRTUAL_ROW_CSS = "gx-TableCore-VIRTUAL_ROW_CSS-
|
|
372
|
+
var VIRTUAL_ROW_CSS = "gx-TableCore-VIRTUAL_ROW_CSS-v1n5u17i";
|
|
355
373
|
/** @internal Default cells and footer strings: shrink to truncate. */
|
|
356
|
-
var CELL_TEXT_CSS = "gx-TableCore-CELL_TEXT_CSS-
|
|
357
|
-
/** "Oct 3, 2026": the DateInput default. */
|
|
358
|
-
var DATE_FORMAT_OPTIONS = { dateStyle: "medium" };
|
|
374
|
+
var CELL_TEXT_CSS = "gx-TableCore-CELL_TEXT_CSS-cngkatk";
|
|
359
375
|
/** @internal The default cell renderer: one truncating line of formatted text. */
|
|
360
376
|
function TableCellText({ value, textSize }) {
|
|
361
377
|
if (value === null || value === void 0 || value === "") return /* @__PURE__ */ jsx(Text, {
|
|
@@ -366,10 +382,9 @@ function TableCellText({ value, textSize }) {
|
|
|
366
382
|
});
|
|
367
383
|
const isNumeric = typeof value === "number" || typeof value === "bigint";
|
|
368
384
|
let text;
|
|
369
|
-
if (typeof value === "number") text = formatNumber(value);
|
|
370
|
-
else if (typeof value === "bigint") text = value.toLocaleString();
|
|
385
|
+
if (typeof value === "number" || typeof value === "bigint") text = formatNumber(value);
|
|
371
386
|
else if (typeof value === "boolean") text = value ? "Yes" : "No";
|
|
372
|
-
else if (value instanceof Date) text =
|
|
387
|
+
else if (value instanceof Date) text = formatDate(value);
|
|
373
388
|
else text = String(value);
|
|
374
389
|
return /* @__PURE__ */ jsx(Text, {
|
|
375
390
|
as: "span",
|
|
@@ -532,7 +547,7 @@ var TableBodyRow = memo(function TableBodyRow({ row, rowIndex, rowId, columns, m
|
|
|
532
547
|
...isExpanded === void 0 ? {} : { "aria-expanded": isExpanded },
|
|
533
548
|
...isActive ? { "aria-current": true } : {},
|
|
534
549
|
...ariaRowIndex === void 0 ? {} : { "aria-rowindex": ariaRowIndex },
|
|
535
|
-
className: cx(isClickable && ROW_INTERACTIVE_CSS, isSelected === true && ROW_SELECTED_CSS, isActive && ROW_ACTIVE_CSS, isBorderless && "gx-TableCore-ROW_NO_BORDER_CSS-
|
|
550
|
+
className: cx(isClickable && ROW_INTERACTIVE_CSS, isSelected === true && ROW_SELECTED_CSS, isActive && ROW_ACTIVE_CSS, isBorderless && "gx-TableCore-ROW_NO_BORDER_CSS-rwbqwrq", className),
|
|
536
551
|
style,
|
|
537
552
|
onClick: handleClick,
|
|
538
553
|
onKeyDown: handleKeyDown,
|
|
@@ -541,7 +556,7 @@ var TableBodyRow = memo(function TableBodyRow({ row, rowIndex, rowId, columns, m
|
|
|
541
556
|
isSelectable && /* @__PURE__ */ jsx(TableCell, {
|
|
542
557
|
role: cellRole,
|
|
543
558
|
...nextColIndex(),
|
|
544
|
-
className: cx("gx-TableCore-SYNTHETIC_CELL_CSS-
|
|
559
|
+
className: cx("gx-TableCore-SYNTHETIC_CELL_CSS-s1qwxx34", PIN_TO_CSS_MAP[Side.LEFT]),
|
|
545
560
|
style: syntheticOffset(0, metrics),
|
|
546
561
|
onClickCapture: (event) => {
|
|
547
562
|
shiftRef.current = event.shiftKey;
|
|
@@ -561,7 +576,7 @@ var TableBodyRow = memo(function TableBodyRow({ row, rowIndex, rowId, columns, m
|
|
|
561
576
|
hasExpandColumn && /* @__PURE__ */ jsx(TableCell, {
|
|
562
577
|
role: cellRole,
|
|
563
578
|
...nextColIndex(),
|
|
564
|
-
className: cx("gx-TableCore-SYNTHETIC_CELL_CSS-
|
|
579
|
+
className: cx("gx-TableCore-SYNTHETIC_CELL_CSS-s1qwxx34", PIN_TO_CSS_MAP[Side.LEFT]),
|
|
565
580
|
style: syntheticOffset(isSelectable ? 1 : 0, metrics),
|
|
566
581
|
onClick: (event) => event.stopPropagation(),
|
|
567
582
|
children: isExpanded !== void 0 && /* @__PURE__ */ jsx(Button, {
|
|
@@ -607,7 +622,7 @@ var TableBodyRow = memo(function TableBodyRow({ row, rowIndex, rowId, columns, m
|
|
|
607
622
|
hasTrailingColumn && /* @__PURE__ */ jsx(TableCell, {
|
|
608
623
|
role: cellRole,
|
|
609
624
|
...nextColIndex(),
|
|
610
|
-
className: cx("gx-TableCore-SYNTHETIC_CELL_CSS-
|
|
625
|
+
className: cx("gx-TableCore-SYNTHETIC_CELL_CSS-s1qwxx34", PIN_TO_CSS_MAP[Side.RIGHT]),
|
|
611
626
|
style: syntheticOffset(0, metrics),
|
|
612
627
|
children: actions !== null && actions !== void 0 && /* @__PURE__ */ jsx(Menu, {
|
|
613
628
|
isOpen: isActionsOpen,
|
|
@@ -627,9 +642,9 @@ var TableBodyRow = memo(function TableBodyRow({ row, rowIndex, rowId, columns, m
|
|
|
627
642
|
]
|
|
628
643
|
});
|
|
629
644
|
});
|
|
630
|
-
/** The pinned offset of the k-th synthetic column from its edge. */
|
|
645
|
+
/** The pinned offset of the k-th synthetic column from its edge (past the inset of the edge cell before it). */
|
|
631
646
|
function syntheticOffset(index, metrics) {
|
|
632
|
-
return { "--gx-table-cell-offset":
|
|
647
|
+
return { "--gx-table-cell-offset": index === 0 ? "0px" : `calc(${index * metrics.rowHeightPx}px + var(--gx-table-inset, 0px))` };
|
|
633
648
|
}
|
|
634
649
|
/** @internal A placeholder row: a text skeleton in each data cell, synthetic cells empty. */
|
|
635
650
|
function TableSkeletonRow({ columns, metrics, leadingCount, hasTrailingColumn, isBorderless, ariaRowIndex, pending, className, style }) {
|
|
@@ -645,7 +660,7 @@ function TableSkeletonRow({ columns, metrics, leadingCount, hasTrailingColumn, i
|
|
|
645
660
|
onFocus: pending.onFocus
|
|
646
661
|
},
|
|
647
662
|
...ariaRowIndex === void 0 ? {} : { "aria-rowindex": ariaRowIndex },
|
|
648
|
-
className: cx(isBorderless && "gx-TableCore-ROW_NO_BORDER_CSS-
|
|
663
|
+
className: cx(isBorderless && "gx-TableCore-ROW_NO_BORDER_CSS-rwbqwrq", className),
|
|
649
664
|
style,
|
|
650
665
|
children: [
|
|
651
666
|
Array.from({ length: leadingCount }, (_, index) => /* @__PURE__ */ jsx(TableCell, {
|
|
@@ -664,7 +679,7 @@ function TableSkeletonRow({ columns, metrics, leadingCount, hasTrailingColumn, i
|
|
|
664
679
|
}, column.id)),
|
|
665
680
|
hasTrailingColumn && /* @__PURE__ */ jsx(TableCell, {
|
|
666
681
|
role: "cell",
|
|
667
|
-
className: cx("gx-TableCore-SYNTHETIC_CELL_CSS-
|
|
682
|
+
className: cx("gx-TableCore-SYNTHETIC_CELL_CSS-s1qwxx34", PIN_TO_CSS_MAP[Side.RIGHT]),
|
|
668
683
|
style: syntheticOffset(0, metrics)
|
|
669
684
|
})
|
|
670
685
|
]
|
|
@@ -672,7 +687,7 @@ function TableSkeletonRow({ columns, metrics, leadingCount, hasTrailingColumn, i
|
|
|
672
687
|
}
|
|
673
688
|
/** @internal An expanded row's panel, under its row, as wide as the visible area. */
|
|
674
689
|
function TableExpandedRow({ panelId, colSpan, gutterPx, isLast, children }) {
|
|
675
|
-
const variables = { "--gx-table-expanded-gutter":
|
|
690
|
+
const variables = { "--gx-table-expanded-gutter": `calc(${gutterPx}px + var(--gx-table-inset, 0px))` };
|
|
676
691
|
return /* @__PURE__ */ jsx(ExpandedRowElement, {
|
|
677
692
|
role: "row",
|
|
678
693
|
className: cx(isLast && EXPANDED_LAST_CSS),
|
|
@@ -780,7 +795,7 @@ function useTableSurface(rootRef) {
|
|
|
780
795
|
return surface;
|
|
781
796
|
}
|
|
782
797
|
/** Root → scroll container → table (header, body, status, footer) → sentinel → live region. */
|
|
783
|
-
function TableFrame({ metrics, columnLayout, leadingHeaders, trailingHeader, hasTrailingColumn, sort, onSortPress, canCustomizeColumns, rowCount, isLoading, error, emptyState, onEndReached, role, ariaLabel, tableAria, isMultiselectable, ariaRowCount, rootRef, scrollRef, rootProps, className, style, bodyClassName, bodyStyle, announcement, trailingClassName, children }) {
|
|
798
|
+
function TableFrame({ metrics, hasHeader = true, columnLayout, leadingHeaders, trailingHeader, hasTrailingColumn, sort, onSortPress, canCustomizeColumns, rowCount, isLoading, error, emptyState, onEndReached, role, ariaLabel, tableAria, isMultiselectable, ariaRowCount, rootRef, scrollRef, rootProps, className, style, bodyClassName, bodyStyle, announcement, trailingClassName, children }) {
|
|
784
799
|
const { visibleColumns } = columnLayout;
|
|
785
800
|
const ownRootRef = useRef(null);
|
|
786
801
|
const mergedRootRef = useMergeRefs([ownRootRef, rootRef]);
|
|
@@ -792,11 +807,11 @@ function TableFrame({ metrics, columnLayout, leadingHeaders, trailingHeader, has
|
|
|
792
807
|
const tableRef = useRef(null);
|
|
793
808
|
const hasFooterRow = columnLayout.visibleColumns.some(({ column }) => column.footer !== void 0 && column.footer !== null);
|
|
794
809
|
const doRowsEndAboveBottom = useRowsEndAboveBottom(scrollRef, tableRef, !hasFooterRow && (rowCount > 0 || isLoading), `${rowCount}:${isLoading}:${error ?? ""}`);
|
|
795
|
-
const sentinelRef =
|
|
810
|
+
const sentinelRef = useEndReached({
|
|
796
811
|
scrollRef,
|
|
797
812
|
onEndReached,
|
|
798
813
|
isEnabled: !isLoading && error === void 0,
|
|
799
|
-
rowCount,
|
|
814
|
+
itemCount: rowCount,
|
|
800
815
|
marginPx: 500
|
|
801
816
|
});
|
|
802
817
|
const [message, setMessage] = useState("");
|
|
@@ -925,6 +940,7 @@ function TableFrame({ metrics, columnLayout, leadingHeaders, trailingHeader, has
|
|
|
925
940
|
const variables = { ...columnLayout.variables };
|
|
926
941
|
if (viewportWidth !== void 0) variables["--gx-table-viewport-width"] = `${viewportWidth}px`;
|
|
927
942
|
if (hasFooter) variables["--gx-table-footer-height"] = "var(--gx-table-header-height)";
|
|
943
|
+
if (!hasHeader) variables["--gx-table-header-scroll-padding"] = "0px";
|
|
928
944
|
if (surface !== null) variables["--gx-table-surface"] = surface;
|
|
929
945
|
let status = null;
|
|
930
946
|
if (rowCount === 0 && isLoading) status = Array.from({ length: 5 }, (_, index) => /* @__PURE__ */ jsx(TableSkeletonRow, {
|
|
@@ -939,15 +955,10 @@ function TableFrame({ metrics, columnLayout, leadingHeaders, trailingHeader, has
|
|
|
939
955
|
children: /* @__PURE__ */ jsx(StatusCell, {
|
|
940
956
|
role: "cell",
|
|
941
957
|
colSpan: colCount,
|
|
942
|
-
children: /* @__PURE__ */ jsx(StatusViewport, { children: error !== void 0 ? /* @__PURE__ */ jsx(
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
header: "Couldn't load data",
|
|
947
|
-
description: error,
|
|
948
|
-
size: metrics.emptyStateSize,
|
|
949
|
-
variant: EmptyStateVariant.ERROR
|
|
950
|
-
})
|
|
958
|
+
children: /* @__PURE__ */ jsx(StatusViewport, { children: error !== void 0 ? /* @__PURE__ */ jsx(ErrorStateContent, {
|
|
959
|
+
size: metrics.emptyStateSize,
|
|
960
|
+
header: "Couldn't load data",
|
|
961
|
+
description: error
|
|
951
962
|
}) : emptyState ?? /* @__PURE__ */ jsx(EmptyState, {
|
|
952
963
|
header: "No results",
|
|
953
964
|
size: metrics.emptyStateSize,
|
|
@@ -986,10 +997,18 @@ function TableFrame({ metrics, columnLayout, leadingHeaders, trailingHeader, has
|
|
|
986
997
|
headerColIndex += 1;
|
|
987
998
|
return hasColIndex ? headerColIndex : void 0;
|
|
988
999
|
};
|
|
1000
|
+
const hiddenHeaderCells = hasHeader ? null : Array.from({ length: colCount }, (_, index) => {
|
|
1001
|
+
const column = visibleColumns[index - leadingCount]?.column;
|
|
1002
|
+
return /* @__PURE__ */ jsx(HeaderCell, {
|
|
1003
|
+
role: "columnheader",
|
|
1004
|
+
...hasColIndex ? { "aria-colindex": index + 1 } : {},
|
|
1005
|
+
children: column?.header
|
|
1006
|
+
}, column?.id ?? `synthetic-${index}`);
|
|
1007
|
+
});
|
|
989
1008
|
return /* @__PURE__ */ jsxs(Root, {
|
|
990
1009
|
...rootProps,
|
|
991
1010
|
ref: mergedRootRef,
|
|
992
|
-
className: cx(metrics.css, surface !== null && SURFACE_ANCESTOR_CSS, className),
|
|
1011
|
+
className: cx(metrics.css, surface !== null && SURFACE_ANCESTOR_CSS, columnLayout.variables["--gx-table-inset"] !== void 0 && TABLE_INSET_CSS, className),
|
|
993
1012
|
style: {
|
|
994
1013
|
...variables,
|
|
995
1014
|
...style
|
|
@@ -1011,21 +1030,23 @@ function TableFrame({ metrics, columnLayout, leadingHeaders, trailingHeader, has
|
|
|
1011
1030
|
children: [
|
|
1012
1031
|
/* @__PURE__ */ jsx(Head, {
|
|
1013
1032
|
role: "rowgroup",
|
|
1033
|
+
className: cx(!hasHeader && HIDDEN_HEAD_CSS),
|
|
1014
1034
|
children: /* @__PURE__ */ jsxs(HeaderRow, {
|
|
1015
1035
|
role: "row",
|
|
1016
1036
|
...hasColIndex ? { "aria-rowindex": 1 } : {},
|
|
1017
1037
|
children: [
|
|
1018
|
-
|
|
1038
|
+
!hasHeader && hiddenHeaderCells,
|
|
1039
|
+
hasHeader && leadingHeaders.map((content, index) => {
|
|
1019
1040
|
const colIndex = nextHeaderColIndex();
|
|
1020
1041
|
return /* @__PURE__ */ jsx(HeaderCell, {
|
|
1021
1042
|
role: "columnheader",
|
|
1022
1043
|
...colIndex === void 0 ? {} : { "aria-colindex": colIndex },
|
|
1023
|
-
className: cx(SYNTHETIC_CELL_CSS, PIN_TO_CSS_MAP[Side.LEFT], PINNED_HEADER_CSS),
|
|
1044
|
+
className: cx("gx-TableCore-SYNTHETIC_CELL_CSS-s1qwxx34", PIN_TO_CSS_MAP[Side.LEFT], PINNED_HEADER_CSS),
|
|
1024
1045
|
style: syntheticOffset(index, metrics),
|
|
1025
1046
|
children: content
|
|
1026
1047
|
}, `leading-${index}`);
|
|
1027
1048
|
}),
|
|
1028
|
-
visibleColumns.map((resolved) => {
|
|
1049
|
+
hasHeader && visibleColumns.map((resolved) => {
|
|
1029
1050
|
const { column } = resolved;
|
|
1030
1051
|
const isSorted = sort?.columnId === column.id;
|
|
1031
1052
|
return /* @__PURE__ */ jsx(TableHeaderCell, {
|
|
@@ -1049,12 +1070,12 @@ function TableFrame({ metrics, columnLayout, leadingHeaders, trailingHeader, has
|
|
|
1049
1070
|
registerButton
|
|
1050
1071
|
}, column.id);
|
|
1051
1072
|
}),
|
|
1052
|
-
hasTrailingColumn && (() => {
|
|
1073
|
+
hasHeader && hasTrailingColumn && (() => {
|
|
1053
1074
|
const colIndex = nextHeaderColIndex();
|
|
1054
1075
|
return /* @__PURE__ */ jsx(HeaderCell, {
|
|
1055
1076
|
role: "columnheader",
|
|
1056
1077
|
...colIndex === void 0 ? {} : { "aria-colindex": colIndex },
|
|
1057
|
-
className: cx("gx-TableCore-SYNTHETIC_CELL_CSS-
|
|
1078
|
+
className: cx("gx-TableCore-SYNTHETIC_CELL_CSS-s1qwxx34", PIN_TO_CSS_MAP[Side.RIGHT], PINNED_HEADER_CSS, trailingClassName),
|
|
1058
1079
|
style: syntheticOffset(0, metrics),
|
|
1059
1080
|
children: trailingHeader
|
|
1060
1081
|
});
|
|
@@ -1081,7 +1102,7 @@ function TableFrame({ metrics, columnLayout, leadingHeaders, trailingHeader, has
|
|
|
1081
1102
|
Array.from({ length: leadingCount }, (_, index) => /* @__PURE__ */ jsx(TableCell, {
|
|
1082
1103
|
role: "cell",
|
|
1083
1104
|
...hasColIndex ? { "aria-colindex": index + 1 } : {},
|
|
1084
|
-
className: cx("gx-TableCore-SYNTHETIC_CELL_CSS-
|
|
1105
|
+
className: cx("gx-TableCore-SYNTHETIC_CELL_CSS-s1qwxx34", PIN_TO_CSS_MAP[Side.LEFT]),
|
|
1085
1106
|
style: syntheticOffset(index, metrics)
|
|
1086
1107
|
}, `leading-${index}`)),
|
|
1087
1108
|
visibleColumns.map(({ column, pin, isPinEdge, cellStyle, position }) => /* @__PURE__ */ jsx(TableCell, {
|
|
@@ -1094,14 +1115,14 @@ function TableFrame({ metrics, columnLayout, leadingHeaders, trailingHeader, has
|
|
|
1094
1115
|
size: metrics.textSize,
|
|
1095
1116
|
weight: TextWeight.MEDIUM,
|
|
1096
1117
|
lineClamp: 1,
|
|
1097
|
-
className: "gx-TableCore-CELL_TEXT_CSS-
|
|
1118
|
+
className: "gx-TableCore-CELL_TEXT_CSS-cngkatk",
|
|
1098
1119
|
children: column.footer
|
|
1099
1120
|
}) : column.footer
|
|
1100
1121
|
}, column.id)),
|
|
1101
1122
|
hasTrailingColumn && /* @__PURE__ */ jsx(TableCell, {
|
|
1102
1123
|
role: "cell",
|
|
1103
1124
|
...hasColIndex ? { "aria-colindex": colCount } : {},
|
|
1104
|
-
className: cx("gx-TableCore-SYNTHETIC_CELL_CSS-
|
|
1125
|
+
className: cx("gx-TableCore-SYNTHETIC_CELL_CSS-s1qwxx34", PIN_TO_CSS_MAP[Side.RIGHT], trailingClassName),
|
|
1105
1126
|
style: syntheticOffset(0, metrics)
|
|
1106
1127
|
})
|
|
1107
1128
|
]
|
|
@@ -7,11 +7,12 @@
|
|
|
7
7
|
* no client-side sorting (the app re-queries when `sort` changes).
|
|
8
8
|
*
|
|
9
9
|
* Built on the shared table core (`TableCore`, `useTableColumnLayout`,
|
|
10
|
-
* `useTableKeyboardNavigation`, `
|
|
10
|
+
* `useTableKeyboardNavigation`, `useEndReached`) plus `useTableVirtualizer`
|
|
11
11
|
* (`@tanstack/react-virtual`, an optional peer). It imports nothing from `InfiniteTable`, so it
|
|
12
12
|
* never needs `@tanstack/react-table`.
|
|
13
13
|
*/
|
|
14
14
|
import { type AriaAttributes, type CSSProperties, type KeyboardEvent, type MouseEvent, type ReactElement, type ReactNode, type RefAttributes } from "react";
|
|
15
|
+
import type { Space } from "../theme/enums.js";
|
|
15
16
|
import type { TableColumn, TableColumnLayout, TableSort } from "./types.js";
|
|
16
17
|
/** Row rung of the table (canonical subset; the 1.x TableDensity members). Same rows as InfiniteTableSize. */
|
|
17
18
|
export declare enum VirtualizedInfiniteTableSize {
|
|
@@ -22,7 +23,8 @@ export declare enum VirtualizedInfiniteTableSize {
|
|
|
22
23
|
/** 52px rows, body_lg text. */
|
|
23
24
|
LARGE = "LARGE"
|
|
24
25
|
}
|
|
25
|
-
|
|
26
|
+
/** Every VirtualizedInfiniteTable prop except the header and what lives in it (`hasHeader`, sorting, resize, customize). */
|
|
27
|
+
interface VirtualizedInfiniteTableBaseProps<TData> extends AriaAttributes {
|
|
26
28
|
/** The columns in their default order. Same column type as InfiniteTable (`@galaxy-io/dls/table/types`). */
|
|
27
29
|
columns: TableColumn<TData>[];
|
|
28
30
|
/** Number of rows the table can show, loaded or not. Grow it as pages arrive. */
|
|
@@ -59,15 +61,6 @@ export interface VirtualizedInfiniteTableProps<TData> extends AriaAttributes {
|
|
|
59
61
|
activeRowId?: string | null;
|
|
60
62
|
/** Menu rows (`MenuItem`, `MenuSeparator`, …) for a loaded row's actions menu, opened from a trailing "…" button. Return `null` for a row with no actions. */
|
|
61
63
|
rowActions?: (row: TData, rowIndex: number) => ReactNode;
|
|
62
|
-
/** Controlled sorted column, shown in the header. The table never reorders rows itself: the app re-queries with the new sort. */
|
|
63
|
-
sort?: TableSort | null;
|
|
64
|
-
/**
|
|
65
|
-
* Initial sort while uncontrolled.
|
|
66
|
-
* @default null
|
|
67
|
-
*/
|
|
68
|
-
defaultSort?: TableSort | null;
|
|
69
|
-
/** Called with the next sort when a sortable header is pressed. Reset the data (and scroll) when it changes. */
|
|
70
|
-
onSortChange?: (sort: TableSort | null) => void;
|
|
71
64
|
/** Controlled column arrangement: order, hidden column ids and widths. Persist it to keep a user's layout. */
|
|
72
65
|
columnLayout?: TableColumnLayout;
|
|
73
66
|
/**
|
|
@@ -78,15 +71,11 @@ export interface VirtualizedInfiniteTableProps<TData> extends AriaAttributes {
|
|
|
78
71
|
/** Called with the full new arrangement when the user resizes, moves, hides, shows or resets columns. Fires on every resize step; debounce before saving. */
|
|
79
72
|
onColumnLayoutChange?: (columnLayout: TableColumnLayout) => void;
|
|
80
73
|
/**
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
|
|
84
|
-
canResizeColumns?: boolean;
|
|
85
|
-
/**
|
|
86
|
-
* Lets the user reorder columns (drag a header, or Alt+ArrowLeft / Alt+ArrowRight on it) and show or hide them from a Columns menu at the end of the header. Columns opt out of hiding with `canHide: false`.
|
|
87
|
-
* @default false
|
|
74
|
+
* Space between the ends of each row and its first and last cell, on top of the cells' own padding; rows, hairlines and row fills still run the full width.
|
|
75
|
+
* For a table flush with a panel's edges whose content should sit on the page's padding line (a `SMALL` table takes `4`: 12px cell padding plus 4 is the island's 16), instead of a padded wrapper, which would cut the hairlines short.
|
|
76
|
+
* @default 0
|
|
88
77
|
*/
|
|
89
|
-
|
|
78
|
+
inset?: Space;
|
|
90
79
|
/** Accessible name of the table. Use `aria-labelledby` instead when a visible heading names it. */
|
|
91
80
|
ariaLabel?: string;
|
|
92
81
|
/** DOM id on the root `<div>`. */
|
|
@@ -98,6 +87,56 @@ export interface VirtualizedInfiniteTableProps<TData> extends AriaAttributes {
|
|
|
98
87
|
/** Inline style on the root `<div>`; only for setting CSS custom properties. */
|
|
99
88
|
style?: CSSProperties;
|
|
100
89
|
}
|
|
90
|
+
/** A table with its header row (the default): sorting, resizing and customizing live in it. */
|
|
91
|
+
interface VirtualizedInfiniteTableWithHeaderProps {
|
|
92
|
+
/**
|
|
93
|
+
* Shows the header row. Without it the row stays in the DOM, visually hidden, so screen readers keep the column names; sorting, resizing and customizing go with it (a type error to pass them). For a compact list whose columns explain themselves.
|
|
94
|
+
* @default true
|
|
95
|
+
*/
|
|
96
|
+
hasHeader?: true;
|
|
97
|
+
/** Controlled sorted column, shown in the header. The table never reorders rows itself: the app re-queries with the new sort. */
|
|
98
|
+
sort?: TableSort | null;
|
|
99
|
+
/**
|
|
100
|
+
* Initial sort while uncontrolled.
|
|
101
|
+
* @default null
|
|
102
|
+
*/
|
|
103
|
+
defaultSort?: TableSort | null;
|
|
104
|
+
/** Called with the next sort when a sortable header is pressed. Reset the data (and scroll) when it changes. */
|
|
105
|
+
onSortChange?: (sort: TableSort | null) => void;
|
|
106
|
+
/**
|
|
107
|
+
* Adds a drag handle at the end of each header cell (arrow keys too). Columns opt out with `canResize: false`.
|
|
108
|
+
* @default false
|
|
109
|
+
*/
|
|
110
|
+
canResizeColumns?: boolean;
|
|
111
|
+
/**
|
|
112
|
+
* Lets the user reorder columns (drag a header, or Alt+ArrowLeft / Alt+ArrowRight on it) and show or hide them from a Columns menu at the end of the header. Columns opt out of hiding with `canHide: false`.
|
|
113
|
+
* @default false
|
|
114
|
+
*/
|
|
115
|
+
canCustomizeColumns?: boolean;
|
|
116
|
+
}
|
|
117
|
+
/** A table without a visible header row: nothing that lives in the header can be passed. */
|
|
118
|
+
interface VirtualizedInfiniteTableHeaderlessProps {
|
|
119
|
+
/**
|
|
120
|
+
* Shows the header row. Without it the row stays in the DOM, visually hidden, so screen readers keep the column names; sorting, resizing and customizing go with it (a type error to pass them). For a compact list whose columns explain themselves.
|
|
121
|
+
* @default true
|
|
122
|
+
*/
|
|
123
|
+
hasHeader: false;
|
|
124
|
+
/** Controlled sorted column. Not without a header. */
|
|
125
|
+
sort?: undefined;
|
|
126
|
+
/** Initial sort while uncontrolled. Not without a header. */
|
|
127
|
+
defaultSort?: undefined;
|
|
128
|
+
/** Called with the next sort. Not without a header. */
|
|
129
|
+
onSortChange?: undefined;
|
|
130
|
+
/** Resize handles live in the header. Not without one. */
|
|
131
|
+
canResizeColumns?: false;
|
|
132
|
+
/** Reordering and the Columns menu live in the header. Not without one. */
|
|
133
|
+
canCustomizeColumns?: false;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* VirtualizedInfiniteTable props. `hasHeader: false` with `sort`, `defaultSort`, `onSortChange`,
|
|
137
|
+
* `canResizeColumns` or `canCustomizeColumns` is a type error (the Widget `isCollapsible` precedent).
|
|
138
|
+
*/
|
|
139
|
+
export type VirtualizedInfiniteTableProps<TData> = VirtualizedInfiniteTableBaseProps<TData> & (VirtualizedInfiniteTableWithHeaderProps | VirtualizedInfiniteTableHeaderlessProps);
|
|
101
140
|
/**
|
|
102
141
|
* The public, generic call signature (`TData` inferred from `getRowData` and `columns`). Never
|
|
103
142
|
* called: it only types the default export. An arrow function rather than a type literal, so
|