@entifix/react-controls 0.20.3 → 0.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/i18n/catalog/en.d.ts.map +1 -1
- package/dist/i18n/catalog/en.js +7 -0
- package/dist/i18n/catalog/en.js.map +1 -1
- package/dist/i18n/catalog/es.d.ts +7 -0
- package/dist/i18n/catalog/es.d.ts.map +1 -1
- package/dist/i18n/catalog/es.js +7 -0
- package/dist/i18n/catalog/es.js.map +1 -1
- package/dist/i18n/catalog/index.d.ts +14 -0
- package/dist/i18n/catalog/index.d.ts.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/primitives.d.ts +2 -0
- package/dist/primitives.d.ts.map +1 -1
- package/dist/primitives.js +2 -0
- package/dist/primitives.js.map +1 -1
- package/dist/ui/atoms/cell-value/cell-value.d.ts +6 -0
- package/dist/ui/atoms/cell-value/cell-value.d.ts.map +1 -1
- package/dist/ui/atoms/cell-value/cell-value.js +108 -14
- package/dist/ui/atoms/cell-value/cell-value.js.map +1 -1
- package/dist/ui/atoms/cell-value/index.d.ts +1 -0
- package/dist/ui/atoms/cell-value/index.d.ts.map +1 -1
- package/dist/ui/atoms/cell-value/index.js +1 -0
- package/dist/ui/atoms/cell-value/index.js.map +1 -1
- package/dist/ui/atoms/cell-value/use-record-label.d.ts +16 -0
- package/dist/ui/atoms/cell-value/use-record-label.d.ts.map +1 -0
- package/dist/ui/atoms/cell-value/use-record-label.js +55 -0
- package/dist/ui/atoms/cell-value/use-record-label.js.map +1 -0
- package/dist/ui/atoms/media-image/index.d.ts +2 -0
- package/dist/ui/atoms/media-image/index.d.ts.map +1 -0
- package/dist/ui/atoms/media-image/index.js +3 -0
- package/dist/ui/atoms/media-image/index.js.map +1 -0
- package/dist/ui/atoms/media-image/media-image.d.ts +46 -0
- package/dist/ui/atoms/media-image/media-image.d.ts.map +1 -0
- package/dist/ui/atoms/media-image/media-image.js +57 -0
- package/dist/ui/atoms/media-image/media-image.js.map +1 -0
- package/dist/ui/atoms/status-tag/status-tag.d.ts +6 -2
- package/dist/ui/atoms/status-tag/status-tag.d.ts.map +1 -1
- package/dist/ui/atoms/status-tag/status-tag.js.map +1 -1
- package/dist/ui/atoms/table/table.d.ts +4 -2
- package/dist/ui/atoms/table/table.d.ts.map +1 -1
- package/dist/ui/atoms/table/table.js +3 -1
- package/dist/ui/atoms/table/table.js.map +1 -1
- package/dist/ui/molecules/media-gallery/media-gallery.d.ts +30 -3
- package/dist/ui/molecules/media-gallery/media-gallery.d.ts.map +1 -1
- package/dist/ui/molecules/media-gallery/media-gallery.js +26 -6
- package/dist/ui/molecules/media-gallery/media-gallery.js.map +1 -1
- package/dist/ui/molecules/summary-tile/index.d.ts +2 -0
- package/dist/ui/molecules/summary-tile/index.d.ts.map +1 -0
- package/dist/ui/molecules/summary-tile/index.js +3 -0
- package/dist/ui/molecules/summary-tile/index.js.map +1 -0
- package/dist/ui/molecules/summary-tile/summary-tile.d.ts +57 -0
- package/dist/ui/molecules/summary-tile/summary-tile.d.ts.map +1 -0
- package/dist/ui/molecules/summary-tile/summary-tile.js +114 -0
- package/dist/ui/molecules/summary-tile/summary-tile.js.map +1 -0
- package/dist/ui/organisms/entity-form/entity-form.d.ts +1 -1
- package/dist/ui/organisms/entity-form/entity-form.d.ts.map +1 -1
- package/dist/ui/organisms/entity-form/entity-form.js +7 -6
- package/dist/ui/organisms/entity-form/entity-form.js.map +1 -1
- package/dist/ui/organisms/entity-form/entity-form.types.d.ts +0 -8
- package/dist/ui/organisms/entity-form/entity-form.types.d.ts.map +1 -1
- package/dist/ui/organisms/entity-form/entity-form.types.js.map +1 -1
- package/dist/ui/organisms/entity-table/card-roles.d.ts +10 -0
- package/dist/ui/organisms/entity-table/card-roles.d.ts.map +1 -0
- package/dist/ui/organisms/entity-table/card-roles.js +14 -0
- package/dist/ui/organisms/entity-table/card-roles.js.map +1 -0
- package/dist/ui/organisms/entity-table/entity-table-slots.d.ts +2 -0
- package/dist/ui/organisms/entity-table/entity-table-slots.d.ts.map +1 -1
- package/dist/ui/organisms/entity-table/entity-table-slots.js.map +1 -1
- package/dist/ui/organisms/entity-table/entity-table.d.ts.map +1 -1
- package/dist/ui/organisms/entity-table/entity-table.js +217 -173
- package/dist/ui/organisms/entity-table/entity-table.js.map +1 -1
- package/dist/ui/organisms/entity-table/pivot.d.ts +32 -5
- package/dist/ui/organisms/entity-table/pivot.d.ts.map +1 -1
- package/dist/ui/organisms/entity-table/pivot.js +42 -9
- package/dist/ui/organisms/entity-table/pivot.js.map +1 -1
- package/dist/ui/organisms/entity-table/use-entity-table-columns.d.ts.map +1 -1
- package/dist/ui/organisms/entity-table/use-entity-table-columns.js +6 -3
- package/dist/ui/organisms/entity-table/use-entity-table-columns.js.map +1 -1
- package/dist/ui/utils/reference-labels.d.ts +59 -0
- package/dist/ui/utils/reference-labels.d.ts.map +1 -0
- package/dist/ui/utils/reference-labels.js +49 -0
- package/dist/ui/utils/reference-labels.js.map +1 -0
- package/package.json +5 -5
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
-
import { emptySelection, extractMetaEntity, hierarchyOf, isSelected, queryPropertyFor, selectionSize, toggleSelected } from '@entifix/core';
|
|
3
|
+
import { canNameRecord, emptySelection, extractMetaEntity, hierarchyOf, isSelected, queryPropertyFor, recordLabel, selectionSize, toggleSelected } from '@entifix/core';
|
|
4
4
|
import { Fragment, useId, useMemo, useRef, useState } from 'react';
|
|
5
5
|
import { useEntityNoun, useLocale, useT, useTranslateKey } from '../../../i18n/index.js';
|
|
6
6
|
import { availableUseCases, renderAnchor, useCasesForSurface } from '../../actions/index.js';
|
|
7
7
|
import { useVerbInvoker } from '../../actions/use-verb-invoker.js';
|
|
8
8
|
import { Button, button } from '../../atoms/button/index.js';
|
|
9
|
-
import { CellValue } from '../../atoms/cell-value/index.js';
|
|
9
|
+
import { CellValue, useRecordLabel } from '../../atoms/cell-value/index.js';
|
|
10
10
|
import { Checkbox } from '../../atoms/field/index.js';
|
|
11
11
|
import { Skeleton } from '../../atoms/skeleton/index.js';
|
|
12
12
|
import { Table, TableBody, TableCell, TableHead, TableHeaderCell, TableMessageRow, TableRow } from '../../atoms/table/index.js';
|
|
@@ -24,10 +24,11 @@ import { RegionState } from '../../molecules/region-state/index.js';
|
|
|
24
24
|
import { SortBuilder } from '../../molecules/sort-builder/index.js';
|
|
25
25
|
import { TableToolbar } from '../../molecules/table-toolbar/index.js';
|
|
26
26
|
import { useFocusOnLoss } from '../../utils/use-focus-on-arrival.js';
|
|
27
|
+
import { cardRoles } from './card-roles.js';
|
|
27
28
|
import { readEntityTableSlots } from './entity-table-slots.js';
|
|
28
29
|
import { shownTreeRows, TreeCell, treeRows } from './entity-table-tree.js';
|
|
29
30
|
import { nextHeaderSorting, sortKeys } from './header-sort.js';
|
|
30
|
-
import { ACTIONS_WIDTH, pivotClasses,
|
|
31
|
+
import { ACTIONS_WIDTH, columnWidth, pivotClasses, pivotWidths, SELECTION_WIDTH } from './pivot.js';
|
|
31
32
|
import { useEntityTableColumns } from './use-entity-table-columns.js';
|
|
32
33
|
import { useResultAnnouncement } from './use-result-announcement.js';
|
|
33
34
|
/**
|
|
@@ -40,7 +41,7 @@ import { useResultAnnouncement } from './use-result-announcement.js';
|
|
|
40
41
|
*/ const SKELETON_ROW_CAP = 5;
|
|
41
42
|
/** How many members a card shows as meta when none declares a `card` role. */ const UNDECLARED_META_CAP = 3;
|
|
42
43
|
export function EntityTable({ entityConstructor, isLoading, skeleton = true, error, items, totalItems, currentPage, pageSize, onPageChange, onPageSizeChange, hrefFor, newHref, renderLink = renderAnchor, onSelect, preferencesKey, showControls = true, pivotBreakpoint, filtering, sorting, onFilteringChange, onSortingChange, facets, selection, onSelectionChange, metadata, isMetadataLoading = false, onBulkUseCase, onUseCase, onRetry, bulkOutcomes, onBulkDismiss, onBulkRetry, isBulkRunning = false, children }) {
|
|
43
|
-
var _ref, _ref1;
|
|
44
|
+
var _ref, _ref1, _visibleColumns_find, _ref2;
|
|
44
45
|
const t = useT();
|
|
45
46
|
// A descriptor's label is a runtime catalog key — the typed gate cannot see
|
|
46
47
|
// it, which is why a host's catalog check is what catches a typo.
|
|
@@ -94,12 +95,30 @@ export function EntityTable({ entityConstructor, isLoading, skeleton = true, err
|
|
|
94
95
|
* table's own box picks one — at the width its visible columns need. A
|
|
95
96
|
* viewport breakpoint was wrong inside a split view, a drawer or a wizard
|
|
96
97
|
* step, and a JS measurement would guess during SSR and correct after mount.
|
|
97
|
-
*/
|
|
98
|
+
*/ /**
|
|
99
|
+
* The column every row reads as — the entity's `labelMember`, else its
|
|
100
|
+
* declared card title, else the first that can name a record — held in view
|
|
101
|
+
* at the inline start while a grid wider than its container scrolls.
|
|
102
|
+
*/ const stickyTitle = (_ref1 = (_visibleColumns_find = visibleColumns.find((column)=>column.name === metaEntity.labelMember)) != null ? _visibleColumns_find : visibleColumns.find((column)=>column.card === 'title')) != null ? _ref1 : visibleColumns.find(canNameRecord);
|
|
103
|
+
const widths = pivotWidths({
|
|
104
|
+
columns: visibleColumns,
|
|
105
|
+
title: stickyTitle,
|
|
106
|
+
roleOf: cardRoles(visibleColumns),
|
|
107
|
+
extra: (selectable ? SELECTION_WIDTH : 0) + (hasRowAction ? ACTIONS_WIDTH : 0),
|
|
108
|
+
breakpoint: pivotBreakpoint
|
|
109
|
+
});
|
|
110
|
+
const pivot = pivotClasses(widths.essential);
|
|
111
|
+
/**
|
|
112
|
+
* The sticky title's cells: opaque, so the columns scrolling under it never
|
|
113
|
+
* show through — a header cell on the header's surface, a row's on the
|
|
114
|
+
* row's, following its hover.
|
|
115
|
+
*/ const stickyClass = (column, part)=>column !== stickyTitle ? undefined : part === 'header' ? 'sticky start-0 z-2 bg-surface' : 'sticky start-0 z-1 bg-surface-elevated group-hover/row:bg-surface';
|
|
98
116
|
/**
|
|
99
117
|
* The first load has nothing to show and is held with a skeleton; a refetch
|
|
100
118
|
* already has rows, so it keeps them and only marks the region busy. Splitting
|
|
101
119
|
* the two is what stops every pagination click flashing grey.
|
|
102
120
|
*/ const isFirstLoad = isLoading && items.length === 0;
|
|
121
|
+
/** Loaded, nothing came back, and nothing failed: there are no rows to lay out. */ const settledEmpty = items.length === 0 && !isLoading && error === undefined;
|
|
103
122
|
/** `true`/omitted → the built-in default; a node → that node; `false` → none. */ const customSkeleton = typeof skeleton === 'boolean' ? undefined : skeleton;
|
|
104
123
|
const showSkeleton = isFirstLoad && skeleton !== false;
|
|
105
124
|
const skeletonRows = Array.from({
|
|
@@ -110,23 +129,28 @@ export function EntityTable({ entityConstructor, isLoading, skeleton = true, err
|
|
|
110
129
|
* dimming them through opacity took the text under the contrast a reader
|
|
111
130
|
* needs, on every page change.
|
|
112
131
|
*/ const busy = isLoading || undefined;
|
|
113
|
-
|
|
114
|
-
|
|
132
|
+
const nameOf = useRecordLabel();
|
|
133
|
+
/**
|
|
134
|
+
* The column a row reads *as*: the member `recordLabel()` names it by, when
|
|
135
|
+
* the reader has not hidden that column; else one declared `card: 'title'`;
|
|
136
|
+
* else the first visible one it filled in that is not a key — an id, a
|
|
137
|
+
* reference or a link names a row no better than its position does.
|
|
138
|
+
*/ const declaredTitle = visibleColumns.find((column)=>column.card === 'title');
|
|
139
|
+
const linkColumn = (item)=>{
|
|
140
|
+
var _ref;
|
|
141
|
+
const label = recordLabel(entityConstructor, item);
|
|
142
|
+
const named = label.kind === 'fallback' ? undefined : visibleColumns.find((column)=>column.name === label.member.name);
|
|
143
|
+
return (_ref = named != null ? named : declaredTitle) != null ? _ref : visibleColumns.find((column)=>{
|
|
115
144
|
const value = item[column.name];
|
|
116
|
-
return value != null && String(value) !== '';
|
|
145
|
+
return canNameRecord(column) && value != null && String(value) !== '';
|
|
117
146
|
});
|
|
118
|
-
|
|
119
|
-
const linkColumn = (item)=>declaredTitle != null ? declaredTitle : titleColumn(item);
|
|
147
|
+
};
|
|
120
148
|
/**
|
|
121
149
|
* What a record's card shows, by each member's declared `card` role or the
|
|
122
150
|
* default: an id is hidden, the first enum is the badge, and up to
|
|
123
151
|
* {@link UNDECLARED_META_CAP} more members are meta — a card is a summary,
|
|
124
152
|
* and the grid holds the rest.
|
|
125
|
-
*/ const
|
|
126
|
-
const roleOf = (column)=>{
|
|
127
|
-
var _column_card;
|
|
128
|
-
return (_column_card = column.card) != null ? _column_card : column.type === 'id' ? 'hidden' : column === firstEnum ? 'badge' : 'meta';
|
|
129
|
-
};
|
|
153
|
+
*/ const roleOf = cardRoles(visibleColumns);
|
|
130
154
|
const cardParts = (item)=>{
|
|
131
155
|
const title = linkColumn(item);
|
|
132
156
|
const rest = visibleColumns.filter((column)=>column !== title);
|
|
@@ -233,26 +257,11 @@ export function EntityTable({ entityConstructor, isLoading, skeleton = true, err
|
|
|
233
257
|
setSelection(next);
|
|
234
258
|
};
|
|
235
259
|
/**
|
|
236
|
-
* How a row names itself to a screen reader
|
|
237
|
-
*
|
|
238
|
-
*
|
|
239
|
-
*
|
|
240
|
-
|
|
241
|
-
*/ const rowLabel = (item)=>{
|
|
242
|
-
// The first non-identifier column **that this row actually filled in**.
|
|
243
|
-
//
|
|
244
|
-
// An id names a row the way "row 3" does: it repeats what the user can
|
|
245
|
-
// already see. But skipping only the id is not enough — measured against
|
|
246
|
-
// the seeded catalog, where `code` is the first non-id column and is empty
|
|
247
|
-
// on every brand, so the label fell straight through to the id and never
|
|
248
|
-
// reached `name`. A column that is blank on this row names it no better
|
|
249
|
-
// than its position does, so the search continues past it.
|
|
250
|
-
//
|
|
251
|
-
// The id remains the last resort, because a row with nothing rendered
|
|
252
|
-
// still has to announce itself.
|
|
253
|
-
const named = titleColumn(item);
|
|
254
|
-
return named ? String(item[named.name]) : String(item.id);
|
|
255
|
-
};
|
|
260
|
+
* How a row names itself — to a screen reader on its checkbox, in a confirm
|
|
261
|
+
* dialog, a bulk result, a tree toggle: what the reader reads the row *as*
|
|
262
|
+
* ("Seleccionar Acme", never "Seleccionar fila 3" and never a whole id),
|
|
263
|
+
* through the one derivation every surface shares.
|
|
264
|
+
*/ const rowLabel = (item)=>nameOf(entityConstructor, item);
|
|
256
265
|
const selectionCell = (item, index, // Passed in rather than closed over: this is only ever called under
|
|
257
266
|
// `selectable`, which already proves the selection exists, and reading the
|
|
258
267
|
// optional prop here would add a fallback arm that nothing can reach.
|
|
@@ -369,7 +378,7 @@ export function EntityTable({ entityConstructor, isLoading, skeleton = true, err
|
|
|
369
378
|
const locale = useLocale();
|
|
370
379
|
const panelId = useId();
|
|
371
380
|
const keys = sortKeys(sorting, columns);
|
|
372
|
-
const activeFilters = (
|
|
381
|
+
const activeFilters = (_ref2 = filtering == null ? void 0 : filtering.values.length) != null ? _ref2 : 0;
|
|
373
382
|
const results = t('table.results', {
|
|
374
383
|
count: totalItems
|
|
375
384
|
});
|
|
@@ -402,11 +411,13 @@ export function EntityTable({ entityConstructor, isLoading, skeleton = true, err
|
|
|
402
411
|
var _keys_position;
|
|
403
412
|
const label = (_column_header = column.header) != null ? _column_header : column.label;
|
|
404
413
|
if (!column.sortable || onSortingChange === undefined) return /*#__PURE__*/ _jsx(TableHeaderCell, {
|
|
414
|
+
className: stickyClass(column, 'header'),
|
|
405
415
|
children: label
|
|
406
416
|
}, column.name);
|
|
407
417
|
const position = keys.findIndex((key)=>key.member === column.name);
|
|
408
418
|
const type = (_keys_position = keys[position]) == null ? void 0 : _keys_position.type;
|
|
409
419
|
return /*#__PURE__*/ _jsx(TableHeaderCell, {
|
|
420
|
+
className: stickyClass(column, 'header'),
|
|
410
421
|
"aria-sort": position === 0 ? type === 'asc' ? 'ascending' : 'descending' : undefined,
|
|
411
422
|
children: /*#__PURE__*/ _jsxs("button", {
|
|
412
423
|
type: "button",
|
|
@@ -432,6 +443,7 @@ export function EntityTable({ entityConstructor, isLoading, skeleton = true, err
|
|
|
432
443
|
};
|
|
433
444
|
/** A panel toggle: its state said by `aria-expanded`, and its count shown. */ const panelToggle = (which, count)=>/*#__PURE__*/ _jsxs(Button, {
|
|
434
445
|
type: "button",
|
|
446
|
+
id: `${panelId}-${which}`,
|
|
435
447
|
variant: panel === which ? 'primary' : 'secondary',
|
|
436
448
|
size: "sm",
|
|
437
449
|
"aria-expanded": panel === which,
|
|
@@ -535,12 +547,19 @@ export function EntityTable({ entityConstructor, isLoading, skeleton = true, err
|
|
|
535
547
|
hasStaleData: items.length > 0,
|
|
536
548
|
isEmpty: items.length === 0,
|
|
537
549
|
isFiltered: activeFilters > 0,
|
|
538
|
-
onClearFilters: onFilteringChange === undefined ? undefined : ()=>
|
|
550
|
+
onClearFilters: onFilteringChange === undefined ? undefined : ()=>{
|
|
551
|
+
var // The button goes with the empty state it sits in, so focus
|
|
552
|
+
// moves first to the control that filters — still there, and
|
|
553
|
+
// where a reader would go next — never to `<body>`.
|
|
554
|
+
_document_getElementById;
|
|
555
|
+
(_document_getElementById = document.getElementById(`${panelId}-filters`)) == null ? void 0 : _document_getElementById.focus();
|
|
556
|
+
onFilteringChange({
|
|
539
557
|
// Only offered under a filter, so there is one to keep the
|
|
540
558
|
// logic of.
|
|
541
559
|
operator: filtering.operator,
|
|
542
560
|
values: []
|
|
543
|
-
})
|
|
561
|
+
});
|
|
562
|
+
},
|
|
544
563
|
emptyAction: mayCreate ? renderLink({
|
|
545
564
|
href: newHref,
|
|
546
565
|
className: button({
|
|
@@ -552,152 +571,177 @@ export function EntityTable({ entityConstructor, isLoading, skeleton = true, err
|
|
|
552
571
|
}
|
|
553
572
|
}) : undefined
|
|
554
573
|
}),
|
|
555
|
-
/*#__PURE__*/
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
visibleColumns.map(headerCell),
|
|
575
|
-
hasRowAction && /*#__PURE__*/ _jsx(TableHeaderCell, {
|
|
576
|
-
children: t('table.actions')
|
|
577
|
-
})
|
|
578
|
-
]
|
|
579
|
-
})
|
|
580
|
-
}),
|
|
581
|
-
/*#__PURE__*/ _jsxs(TableBody, {
|
|
574
|
+
!settledEmpty && /*#__PURE__*/ _jsxs(_Fragment, {
|
|
575
|
+
children: [
|
|
576
|
+
/*#__PURE__*/ _jsx("div", {
|
|
577
|
+
className: pivot.grid,
|
|
578
|
+
"aria-busy": busy,
|
|
579
|
+
children: /*#__PURE__*/ _jsxs(Table, {
|
|
580
|
+
caption: caption,
|
|
581
|
+
containerClassName: "max-h-(--table-max-block) scroll-pt-12",
|
|
582
|
+
// Never narrower than its columns side by side: between the
|
|
583
|
+
// essential width and that, the grid scrolls rather than crushing
|
|
584
|
+
// every column into an unreadable sliver.
|
|
585
|
+
style: {
|
|
586
|
+
minWidth: `${widths.full}rem`
|
|
587
|
+
},
|
|
588
|
+
// A focused cell scrolled sideways is never left under the
|
|
589
|
+
// sticky title column (WCAG 2.4.11).
|
|
590
|
+
containerStyle: stickyTitle === undefined ? undefined : {
|
|
591
|
+
scrollPaddingInlineStart: `${columnWidth(stickyTitle)}rem`
|
|
592
|
+
},
|
|
582
593
|
children: [
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
children: customSkeleton
|
|
586
|
-
}) : skeletonRows.map((row)=>/*#__PURE__*/ _jsxs(TableRow, {
|
|
594
|
+
/*#__PURE__*/ _jsx(TableHead, {
|
|
595
|
+
children: slots.header ? slots.header.render(visibleColumns) : /*#__PURE__*/ _jsxs("tr", {
|
|
587
596
|
children: [
|
|
588
|
-
selectable && /*#__PURE__*/ _jsx(
|
|
589
|
-
children: /*#__PURE__*/ _jsx(
|
|
590
|
-
|
|
591
|
-
|
|
597
|
+
selectable && /*#__PURE__*/ _jsx(TableHeaderCell, {
|
|
598
|
+
children: /*#__PURE__*/ _jsx(Checkbox, {
|
|
599
|
+
"aria-label": t('table.selectAllOnPage'),
|
|
600
|
+
checked: allOnPageSelected,
|
|
601
|
+
indeterminate: someOnPageSelected,
|
|
602
|
+
disabled: isBulkRunning || items.length === 0,
|
|
603
|
+
onChange: (event)=>toggleAllOnPage(event.currentTarget.checked, selectionState)
|
|
592
604
|
})
|
|
593
605
|
}),
|
|
594
|
-
visibleColumns.map(
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
className: "w-full"
|
|
598
|
-
})
|
|
599
|
-
}, column.name)),
|
|
600
|
-
hasRowAction && /*#__PURE__*/ _jsx(TableCell, {
|
|
601
|
-
children: /*#__PURE__*/ _jsx(Skeleton, {
|
|
602
|
-
shape: "line",
|
|
603
|
-
className: "w-16"
|
|
604
|
-
})
|
|
605
|
-
})
|
|
606
|
-
]
|
|
607
|
-
}, row))),
|
|
608
|
-
shown.map(({ item, depth, hasChildren }, index)=>{
|
|
609
|
-
var _item_id, _item_id1;
|
|
610
|
-
return slots.row ? // A Fragment carries the key without wrapping the custom row in
|
|
611
|
-
// an element `<tbody>` would reject.
|
|
612
|
-
/*#__PURE__*/ _jsx(Fragment, {
|
|
613
|
-
children: slots.row.render(item, visibleColumns)
|
|
614
|
-
}, String((_item_id = item.id) != null ? _item_id : index)) : /*#__PURE__*/ _jsxs(TableRow, {
|
|
615
|
-
"data-record-id": `${rowScope}${String(item.id)}`,
|
|
616
|
-
children: [
|
|
617
|
-
selectionState && /*#__PURE__*/ _jsx(TableCell, {
|
|
618
|
-
children: selectionCell(item, index, selectionState)
|
|
619
|
-
}),
|
|
620
|
-
visibleColumns.map((column, columnIndex)=>/*#__PURE__*/ _jsx(TableCell, {
|
|
621
|
-
children: treeKeys !== undefined && columnIndex === 0 ? /*#__PURE__*/ _jsx(TreeCell, {
|
|
622
|
-
depth: depth,
|
|
623
|
-
hasChildren: hasChildren,
|
|
624
|
-
expanded: !collapsed.has(treeKeys.idOf(item)),
|
|
625
|
-
label: t(collapsed.has(treeKeys.idOf(item)) ? 'table.expandRow' : 'table.collapseRow', {
|
|
626
|
-
record: rowLabel(item)
|
|
627
|
-
}),
|
|
628
|
-
onToggle: ()=>toggleCollapsed(treeKeys.idOf(item)),
|
|
629
|
-
children: renderCell(column, item)
|
|
630
|
-
}) : renderCell(column, item)
|
|
631
|
-
}, column.name)),
|
|
632
|
-
hasRowAction && /*#__PURE__*/ _jsx(TableCell, {
|
|
633
|
-
children: recordAction(item)
|
|
606
|
+
visibleColumns.map(headerCell),
|
|
607
|
+
hasRowAction && /*#__PURE__*/ _jsx(TableHeaderCell, {
|
|
608
|
+
children: t('table.actions')
|
|
634
609
|
})
|
|
635
610
|
]
|
|
636
|
-
}
|
|
611
|
+
})
|
|
612
|
+
}),
|
|
613
|
+
/*#__PURE__*/ _jsxs(TableBody, {
|
|
614
|
+
children: [
|
|
615
|
+
showSkeleton && (customSkeleton ? /*#__PURE__*/ _jsx(TableMessageRow, {
|
|
616
|
+
colSpan: columnCount,
|
|
617
|
+
children: customSkeleton
|
|
618
|
+
}) : skeletonRows.map((row)=>/*#__PURE__*/ _jsxs(TableRow, {
|
|
619
|
+
children: [
|
|
620
|
+
selectable && /*#__PURE__*/ _jsx(TableCell, {
|
|
621
|
+
children: /*#__PURE__*/ _jsx(Skeleton, {
|
|
622
|
+
shape: "line",
|
|
623
|
+
className: "w-4"
|
|
624
|
+
})
|
|
625
|
+
}),
|
|
626
|
+
visibleColumns.map((column)=>/*#__PURE__*/ _jsx(TableCell, {
|
|
627
|
+
children: /*#__PURE__*/ _jsx(Skeleton, {
|
|
628
|
+
shape: "line",
|
|
629
|
+
className: "w-full"
|
|
630
|
+
})
|
|
631
|
+
}, column.name)),
|
|
632
|
+
hasRowAction && /*#__PURE__*/ _jsx(TableCell, {
|
|
633
|
+
children: /*#__PURE__*/ _jsx(Skeleton, {
|
|
634
|
+
shape: "line",
|
|
635
|
+
className: "w-16"
|
|
636
|
+
})
|
|
637
|
+
})
|
|
638
|
+
]
|
|
639
|
+
}, row))),
|
|
640
|
+
shown.map(({ item, depth, hasChildren }, index)=>{
|
|
641
|
+
var _item_id, _item_id1;
|
|
642
|
+
return slots.row ? // A Fragment carries the key without wrapping the custom row in
|
|
643
|
+
// an element `<tbody>` would reject.
|
|
644
|
+
/*#__PURE__*/ _jsx(Fragment, {
|
|
645
|
+
children: slots.row.render(item, visibleColumns)
|
|
646
|
+
}, String((_item_id = item.id) != null ? _item_id : index)) : /*#__PURE__*/ _jsxs(TableRow, {
|
|
647
|
+
"data-record-id": `${rowScope}${String(item.id)}`,
|
|
648
|
+
className: "group/row",
|
|
649
|
+
children: [
|
|
650
|
+
selectionState && /*#__PURE__*/ _jsx(TableCell, {
|
|
651
|
+
children: selectionCell(item, index, selectionState)
|
|
652
|
+
}),
|
|
653
|
+
visibleColumns.map((column, columnIndex)=>/*#__PURE__*/ _jsx(TableCell, {
|
|
654
|
+
className: stickyClass(column, 'body'),
|
|
655
|
+
children: treeKeys !== undefined && columnIndex === 0 ? /*#__PURE__*/ _jsx(TreeCell, {
|
|
656
|
+
depth: depth,
|
|
657
|
+
hasChildren: hasChildren,
|
|
658
|
+
expanded: !collapsed.has(treeKeys.idOf(item)),
|
|
659
|
+
label: t(collapsed.has(treeKeys.idOf(item)) ? 'table.expandRow' : 'table.collapseRow', {
|
|
660
|
+
record: rowLabel(item)
|
|
661
|
+
}),
|
|
662
|
+
onToggle: ()=>toggleCollapsed(treeKeys.idOf(item)),
|
|
663
|
+
children: renderCell(column, item)
|
|
664
|
+
}) : renderCell(column, item)
|
|
665
|
+
}, column.name)),
|
|
666
|
+
hasRowAction && /*#__PURE__*/ _jsx(TableCell, {
|
|
667
|
+
children: recordAction(item)
|
|
668
|
+
})
|
|
669
|
+
]
|
|
670
|
+
}, String((_item_id1 = item.id) != null ? _item_id1 : index));
|
|
671
|
+
})
|
|
672
|
+
]
|
|
637
673
|
})
|
|
638
674
|
]
|
|
639
675
|
})
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
children: /*#__PURE__*/ _jsx(EntityRecordCard, {
|
|
652
|
-
title: /*#__PURE__*/ _jsx(Skeleton, {
|
|
653
|
-
shape: "line",
|
|
654
|
-
className: "w-32"
|
|
655
|
-
}),
|
|
656
|
-
meta: visibleColumns.slice(1).map((column)=>({
|
|
657
|
-
key: column.name,
|
|
658
|
-
label: column.label,
|
|
659
|
-
value: /*#__PURE__*/ _jsx(Skeleton, {
|
|
676
|
+
}),
|
|
677
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
678
|
+
className: pivot.cards,
|
|
679
|
+
"aria-busy": busy,
|
|
680
|
+
children: [
|
|
681
|
+
showSkeleton && (customSkeleton != null ? customSkeleton : /*#__PURE__*/ _jsx("ul", {
|
|
682
|
+
role: "list",
|
|
683
|
+
className: "m-0 p-0 flex list-none flex-col gap-2xs",
|
|
684
|
+
children: skeletonRows.map((row)=>/*#__PURE__*/ _jsx("li", {
|
|
685
|
+
children: /*#__PURE__*/ _jsx(EntityRecordCard, {
|
|
686
|
+
title: /*#__PURE__*/ _jsx(Skeleton, {
|
|
660
687
|
shape: "line",
|
|
661
|
-
className: "w-
|
|
662
|
-
})
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
"
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
688
|
+
className: "w-32"
|
|
689
|
+
}),
|
|
690
|
+
meta: visibleColumns.slice(1).map((column)=>({
|
|
691
|
+
key: column.name,
|
|
692
|
+
label: column.label,
|
|
693
|
+
value: /*#__PURE__*/ _jsx(Skeleton, {
|
|
694
|
+
shape: "line",
|
|
695
|
+
className: "w-24"
|
|
696
|
+
})
|
|
697
|
+
}))
|
|
698
|
+
})
|
|
699
|
+
}, row))
|
|
700
|
+
})),
|
|
701
|
+
shown.length > 0 && /*#__PURE__*/ _jsx("ul", {
|
|
702
|
+
role: "list",
|
|
703
|
+
className: "m-0 p-0 flex list-none flex-col gap-2xs",
|
|
704
|
+
children: shown.map(({ item, depth }, index)=>{
|
|
705
|
+
var _item_id;
|
|
706
|
+
const parts = cardParts(item);
|
|
707
|
+
return /*#__PURE__*/ _jsx("li", {
|
|
708
|
+
"data-record-id": `${rowScope}${String(item.id)}`,
|
|
709
|
+
// A tree's card says how deep it sits, as its row does.
|
|
710
|
+
"aria-level": treeKeys === undefined ? undefined : depth + 1,
|
|
711
|
+
style: treeKeys === undefined ? undefined : {
|
|
712
|
+
marginInlineStart: `${depth * 1.5}rem`
|
|
713
|
+
},
|
|
714
|
+
children: /*#__PURE__*/ _jsx(EntityRecordCard, {
|
|
715
|
+
// The same renderers as the grid, so the two layouts agree.
|
|
716
|
+
title: parts.title === undefined ? hrefFor === undefined || onSelect !== undefined ? rowLabel(item) : renderLink({
|
|
717
|
+
href: hrefFor(item.id),
|
|
718
|
+
className: linkClassName,
|
|
719
|
+
children: rowLabel(item),
|
|
720
|
+
intent: {
|
|
721
|
+
kind: 'open',
|
|
722
|
+
id: item.id
|
|
723
|
+
}
|
|
724
|
+
}) : renderCell(parts.title, item),
|
|
725
|
+
subtitle: parts.subtitle === undefined ? undefined : renderCell(parts.subtitle, item),
|
|
726
|
+
badges: parts.badges.map((column)=>({
|
|
727
|
+
key: column.name,
|
|
728
|
+
value: renderCell(column, item)
|
|
729
|
+
})),
|
|
730
|
+
meta: parts.meta.map((column)=>{
|
|
731
|
+
var _column_header;
|
|
732
|
+
return {
|
|
733
|
+
key: column.name,
|
|
734
|
+
label: (_column_header = column.header) != null ? _column_header : column.label,
|
|
735
|
+
value: renderCell(column, item)
|
|
736
|
+
};
|
|
737
|
+
}),
|
|
738
|
+
leading: selectionState ? selectionCell(item, index, selectionState) : undefined,
|
|
739
|
+
actions: recordAction(item)
|
|
740
|
+
})
|
|
741
|
+
}, String((_item_id = item.id) != null ? _item_id : index));
|
|
698
742
|
})
|
|
699
|
-
}
|
|
700
|
-
|
|
743
|
+
})
|
|
744
|
+
]
|
|
701
745
|
})
|
|
702
746
|
]
|
|
703
747
|
}),
|