@alaarab/ogrid-react-fluent 2.1.2 → 2.1.4
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/esm/index.css +1278 -0
- package/dist/esm/index.js +1166 -11
- package/dist/types/OGrid/OGrid.d.ts +1 -1
- package/dist/types/index.d.ts +40 -1
- package/package.json +4 -4
- package/dist/esm/ColumnChooser/ColumnChooser.js +0 -34
- package/dist/esm/ColumnChooser/ColumnChooser.module.css +0 -50
- package/dist/esm/ColumnHeaderFilter/ColumnHeaderFilter.js +0 -30
- package/dist/esm/ColumnHeaderFilter/ColumnHeaderFilter.module.css +0 -412
- package/dist/esm/ColumnHeaderFilter/MultiSelectFilterPopover.js +0 -17
- package/dist/esm/ColumnHeaderFilter/PeopleFilterPopover.js +0 -18
- package/dist/esm/ColumnHeaderFilter/TextFilterPopover.js +0 -11
- package/dist/esm/ColumnHeaderFilter/index.js +0 -1
- package/dist/esm/ColumnHeaderMenu/ColumnHeaderMenu.js +0 -12
- package/dist/esm/ColumnHeaderMenu/ColumnHeaderMenu.module.css +0 -46
- package/dist/esm/ColumnHeaderMenu/index.js +0 -1
- package/dist/esm/DataGridTable/DataGridTable.js +0 -116
- package/dist/esm/DataGridTable/DataGridTable.module.css +0 -845
- package/dist/esm/DataGridTable/DropIndicator.js +0 -6
- package/dist/esm/DataGridTable/EmptyState.js +0 -14
- package/dist/esm/DataGridTable/GridContextMenu.js +0 -13
- package/dist/esm/DataGridTable/InlineCellEditor.js +0 -6
- package/dist/esm/DataGridTable/LoadingOverlay.js +0 -12
- package/dist/esm/DataGridTable/StatusBar.js +0 -12
- package/dist/esm/OGrid/OGrid.js +0 -9
- package/dist/esm/OGrid/index.js +0 -1
- package/dist/esm/PaginationControls/PaginationControls.js +0 -26
- package/dist/esm/PaginationControls/PaginationControls.module.css +0 -74
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { SearchRegular } from '@fluentui/react-icons';
|
|
3
|
-
import styles from './ColumnHeaderFilter.module.css';
|
|
4
|
-
export const TextFilterPopover = ({ value, onValueChange, onApply, onClear, onPopoverClick, onInputFocus, onInputMouseDown, onInputClick, onInputKeyDown, }) => (_jsxs(_Fragment, { children: [_jsx("div", { className: styles.popoverSearch, onClick: onPopoverClick, children: _jsxs("div", { className: styles.nativeInputWrapper, children: [_jsx(SearchRegular, { className: styles.nativeInputIcon }), _jsx("input", { type: "text", placeholder: "Enter search term...", value: value, onChange: (e) => onValueChange(e.target.value), onKeyDown: (e) => {
|
|
5
|
-
onInputKeyDown(e);
|
|
6
|
-
if (e.key === 'Enter') {
|
|
7
|
-
e.preventDefault();
|
|
8
|
-
onApply();
|
|
9
|
-
}
|
|
10
|
-
}, onFocus: onInputFocus, onMouseDown: onInputMouseDown, onClick: onInputClick, autoComplete: "off", className: styles.nativeInput })] }) }), _jsxs("div", { className: styles.popoverActions, onClick: onPopoverClick, children: [_jsx("button", { type: "button", className: styles.clearButton, onClick: onClear, disabled: !value, children: "Clear" }), _jsx("button", { type: "button", className: styles.applyButton, onClick: onApply, children: "Apply" })] })] }));
|
|
11
|
-
TextFilterPopover.displayName = 'TextFilterPopover';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { ColumnHeaderFilter } from './ColumnHeaderFilter';
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { BaseColumnHeaderMenu } from '@alaarab/ogrid-react';
|
|
3
|
-
import styles from './ColumnHeaderMenu.module.css';
|
|
4
|
-
/** Portal into the closest FluentProvider so --ogrid-* bridged variables are available */
|
|
5
|
-
const getFluentPortalTarget = (anchorElement) => anchorElement.closest('.fui-FluentProvider') ?? document.body;
|
|
6
|
-
/**
|
|
7
|
-
* Column header dropdown menu for pin/sort/autosize actions.
|
|
8
|
-
* Thin wrapper over BaseColumnHeaderMenu — portals into FluentProvider.
|
|
9
|
-
*/
|
|
10
|
-
export function ColumnHeaderMenu(props) {
|
|
11
|
-
return (_jsx(BaseColumnHeaderMenu, { ...props, classNames: styles, getPortalTarget: getFluentPortalTarget }));
|
|
12
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
.content {
|
|
2
|
-
min-width: 140px;
|
|
3
|
-
background: var(--ogrid-bg, #ffffff);
|
|
4
|
-
border: 1px solid var(--ogrid-border, rgba(0, 0, 0, 0.12));
|
|
5
|
-
border-radius: 6px;
|
|
6
|
-
padding: 4px;
|
|
7
|
-
box-shadow: 0px 10px 38px -10px rgba(22, 23, 24, 0.35), 0px 10px 20px -15px rgba(22, 23, 24, 0.2);
|
|
8
|
-
z-index: 1000;
|
|
9
|
-
animation-duration: 400ms;
|
|
10
|
-
animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
|
|
11
|
-
will-change: transform, opacity;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
.item {
|
|
15
|
-
font-size: 13px;
|
|
16
|
-
line-height: 1;
|
|
17
|
-
color: var(--ogrid-fg, rgba(0, 0, 0, 0.87));
|
|
18
|
-
border-radius: 4px;
|
|
19
|
-
border: none;
|
|
20
|
-
background: transparent;
|
|
21
|
-
display: flex;
|
|
22
|
-
align-items: center;
|
|
23
|
-
height: 28px;
|
|
24
|
-
padding: 0 8px;
|
|
25
|
-
position: relative;
|
|
26
|
-
user-select: none;
|
|
27
|
-
outline: none;
|
|
28
|
-
cursor: pointer;
|
|
29
|
-
width: 100%;
|
|
30
|
-
text-align: left;
|
|
31
|
-
}
|
|
32
|
-
.item:disabled {
|
|
33
|
-
color: var(--ogrid-fg-muted, rgba(0, 0, 0, 0.5));
|
|
34
|
-
pointer-events: none;
|
|
35
|
-
cursor: not-allowed;
|
|
36
|
-
}
|
|
37
|
-
.item:hover:not(:disabled) {
|
|
38
|
-
background-color: var(--ogrid-hover-bg, rgba(0, 0, 0, 0.04));
|
|
39
|
-
color: var(--ogrid-fg, rgba(0, 0, 0, 0.87));
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
.separator {
|
|
43
|
-
height: 1px;
|
|
44
|
-
background-color: var(--ogrid-border, rgba(0, 0, 0, 0.12));
|
|
45
|
-
margin: 4px 0;
|
|
46
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { ColumnHeaderMenu } from './ColumnHeaderMenu';
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import { useCallback } from 'react';
|
|
4
|
-
import { createPortal } from 'react-dom';
|
|
5
|
-
import { Table, TableHeader, TableRow, TableHeaderCell, TableBody, TableCell, Checkbox, Popover, PopoverSurface, } from '@fluentui/react-components';
|
|
6
|
-
import { ColumnHeaderFilter } from '../ColumnHeaderFilter';
|
|
7
|
-
import { ColumnHeaderMenu } from '../ColumnHeaderMenu';
|
|
8
|
-
import { InlineCellEditor } from './InlineCellEditor';
|
|
9
|
-
import { StatusBar } from './StatusBar';
|
|
10
|
-
import { GridContextMenu } from './GridContextMenu';
|
|
11
|
-
import { EmptyState } from './EmptyState';
|
|
12
|
-
import { LoadingOverlay } from './LoadingOverlay';
|
|
13
|
-
import { DropIndicator } from './DropIndicator';
|
|
14
|
-
import { useDataGridTableOrchestration, useColumnMeta, getHeaderFilterConfig, getCellRenderDescriptor, MarchingAntsOverlay, resolveCellDisplayContent, resolveCellStyle, buildInlineEditorProps, buildPopoverEditorProps, getCellInteractionProps, areGridRowPropsEqual, CellErrorBoundary, GRID_ROOT_STYLE, CURSOR_CELL_STYLE, POPOVER_ANCHOR_STYLE, PREVENT_DEFAULT, NOOP, STOP_PROPAGATION, } from '@alaarab/ogrid-react';
|
|
15
|
-
import styles from './DataGridTable.module.css';
|
|
16
|
-
// --- Memoized row component (skips re-render for rows unaffected by selection changes) ---
|
|
17
|
-
function GridRowInner(props) {
|
|
18
|
-
const { item, rowIndex, rowId, isSelected, visibleCols, columnMeta, renderCellContent, handleSingleRowClick, handleRowCheckboxChange, lastMouseShiftRef, hasCheckboxCol, hasRowNumbersCol, rowNumberOffset, } = props;
|
|
19
|
-
return (_jsxs(TableRow, { className: isSelected ? styles.selectedRow : undefined, "data-row-id": rowId, onClick: handleSingleRowClick, children: [hasCheckboxCol && (_jsx(TableCell, { className: styles.selectionCellWrapper, children: _jsx("div", { className: styles.selectionCellInner, "data-row-index": rowIndex, "data-col-index": 0, onClick: STOP_PROPAGATION, children: _jsx(Checkbox, { checked: isSelected, onChange: (e, data) => {
|
|
20
|
-
handleRowCheckboxChange(rowId, !!data.checked, rowIndex, lastMouseShiftRef.current);
|
|
21
|
-
}, "aria-label": `Select row ${rowIndex + 1}` }) }) })), hasRowNumbersCol && (_jsx(TableCell, { className: styles.rowNumberCellWrapper, children: _jsx("div", { className: styles.rowNumberCellInner, children: rowNumberOffset + rowIndex + 1 }) })), visibleCols.map((col, colIdx) => (_jsx(TableCell, { "data-column-id": col.columnId, className: columnMeta.cellClasses[col.columnId] || undefined, style: columnMeta.cellStyles[col.columnId], children: renderCellContent(item, col, rowIndex, colIdx) }, col.columnId)))] }));
|
|
22
|
-
}
|
|
23
|
-
const GridRow = React.memo(GridRowInner, areGridRowPropsEqual);
|
|
24
|
-
function DataGridTableInner(props) {
|
|
25
|
-
const o = useDataGridTableOrchestration({ props });
|
|
26
|
-
const { wrapperRef, tableContainerRef, lastMouseShiftRef, interaction, pinning, handleResizeStart, getColumnWidth, isReorderDragging, dropIndicatorX, handleHeaderMouseDown, virtualScrollEnabled, visibleRange, items, getRowId, emptyState, rowSelection, isLoading, loadingMessage, ariaLabel, ariaLabelledBy, visibleColumns, columnOrder, columnReorder, density, rowHeight, rowNumberOffset, headerRows, allowOverflowX, fitToContent, editCallbacks, interactionHandlers, cellDescriptorInputRef, pendingEditorValueRef, popoverAnchorElRef, handleSingleRowClick, handlePasteVoid, visibleCols, totalColCount, hasCheckboxCol, hasRowNumbersCol, colOffset, containerWidth, minTableWidth, columnSizingOverrides, measuredColumnWidths, selectedRowIds, handleRowCheckboxChange, handleSelectAll, allSelected, someSelected, editingCell, setPopoverAnchorEl, cancelPopoverEdit, setActiveCell, selectionRange, hasCellSelection, handleGridKeyDown, handleFillHandleMouseDown, handleCopy, handleCut, cutRange, copyRange, canUndo, canRedo, onUndo, onRedo, isDragging, menuPosition, closeContextMenu, headerFilterInput, statusBarConfig, showEmptyInGrid, onCellError, headerMenu, } = o;
|
|
27
|
-
// Pre-compute column styles and classNames via shared hook (avoids per-cell object creation).
|
|
28
|
-
// addStickyPosition=true: Fluent UI's TableCell injects atomic `position: relative` via CSS-in-JS,
|
|
29
|
-
// overriding the shared `.pinnedColLeft { position: sticky }` class. Inline style wins over atomic CSS.
|
|
30
|
-
const columnMeta = useColumnMeta({
|
|
31
|
-
visibleCols,
|
|
32
|
-
getColumnWidth,
|
|
33
|
-
columnSizingOverrides,
|
|
34
|
-
measuredColumnWidths,
|
|
35
|
-
pinnedColumns: pinning.pinnedColumns,
|
|
36
|
-
leftOffsets: pinning.leftOffsets,
|
|
37
|
-
rightOffsets: pinning.rightOffsets,
|
|
38
|
-
pinnedColLeftClass: styles.pinnedColLeft,
|
|
39
|
-
pinnedColRightClass: styles.pinnedColRight,
|
|
40
|
-
addStickyPosition: true,
|
|
41
|
-
});
|
|
42
|
-
// renderCellContent reads volatile state from refs -- keeps function identity stable so
|
|
43
|
-
// GridRow's React.memo comparator can skip rows whose selection state hasn't changed.
|
|
44
|
-
const renderCellContent = useCallback((item, col, rowIndex, colIdx) => {
|
|
45
|
-
const descriptor = getCellRenderDescriptor(item, col, rowIndex, colIdx, cellDescriptorInputRef.current);
|
|
46
|
-
const rowId = getRowId(item);
|
|
47
|
-
let content;
|
|
48
|
-
if (descriptor.mode === 'editing-inline') {
|
|
49
|
-
content = (_jsx("div", { className: styles.editingCellContent, children: _jsx(InlineCellEditor, { ...buildInlineEditorProps(item, col, descriptor, editCallbacks) }) }));
|
|
50
|
-
}
|
|
51
|
-
else if (descriptor.mode === 'editing-popover' && typeof col.cellEditor === 'function') {
|
|
52
|
-
const editorProps = buildPopoverEditorProps(item, col, descriptor, pendingEditorValueRef.current, editCallbacks);
|
|
53
|
-
const CustomEditor = col.cellEditor;
|
|
54
|
-
content = (_jsxs(_Fragment, { children: [_jsx("div", { ref: (el) => { if (el)
|
|
55
|
-
setPopoverAnchorEl(el); }, style: POPOVER_ANCHOR_STYLE, "aria-hidden": true }), _jsx(Popover, { open: !!popoverAnchorElRef.current, onOpenChange: (_, data) => { if (!data.open)
|
|
56
|
-
cancelPopoverEdit(); }, positioning: { target: popoverAnchorElRef.current ?? undefined }, children: _jsx(PopoverSurface, { children: _jsx(CustomEditor, { ...editorProps }) }) })] }));
|
|
57
|
-
}
|
|
58
|
-
else {
|
|
59
|
-
const displayContent = resolveCellDisplayContent(col, item, descriptor.displayValue);
|
|
60
|
-
const cellStyle = resolveCellStyle(col, item);
|
|
61
|
-
const styledContent = cellStyle ? _jsx("span", { style: cellStyle, children: displayContent }) : displayContent;
|
|
62
|
-
const cellClassNames = `${styles.cellContent}${descriptor.isActive && !descriptor.isInRange ? ` ${styles.activeCellContent}` : ''}${descriptor.isInRange ? ` ${styles.cellInRange}` : ''}${descriptor.isInCutRange ? ` ${styles.cellCut}` : ''}${descriptor.isInCopyRange ? ` ${styles.cellCopied}` : ''}`;
|
|
63
|
-
const interactionProps = getCellInteractionProps(descriptor, col.columnId, interactionHandlers);
|
|
64
|
-
content = (_jsxs("div", { className: cellClassNames, ...interactionProps, style: descriptor.canEditAny ? CURSOR_CELL_STYLE : undefined, children: [styledContent, descriptor.canEditAny && descriptor.isSelectionEndCell && (_jsx("div", { className: styles.fillHandle, onMouseDown: handleFillHandleMouseDown, "aria-label": "Fill handle" }))] }));
|
|
65
|
-
}
|
|
66
|
-
return (_jsx(CellErrorBoundary, { onError: onCellError, children: content }, `${rowId}-${col.columnId}`));
|
|
67
|
-
}, [editCallbacks, interactionHandlers, handleFillHandleMouseDown, setPopoverAnchorEl, cancelPopoverEdit, getRowId, onCellError, cellDescriptorInputRef, pendingEditorValueRef, popoverAnchorElRef]);
|
|
68
|
-
return (_jsxs("div", { style: GRID_ROOT_STYLE, children: [_jsxs("div", { ref: wrapperRef, tabIndex: 0, onMouseDown: (e) => { lastMouseShiftRef.current = e.shiftKey; }, className: `${styles.tableWrapper} ${rowSelection !== 'none' ? styles.selectableGrid : ''} ${styles[`density-${density}`] || ''}`, role: "region", "aria-label": ariaLabel ?? (ariaLabelledBy ? undefined : 'Data grid'), "aria-labelledby": ariaLabelledBy, "data-empty": showEmptyInGrid ? 'true' : undefined, "data-loading": isLoading && items.length === 0 ? 'true' : undefined, "data-column-count": totalColCount, "data-overflow-x": allowOverflowX ? 'true' : 'false', "data-container-width": containerWidth, "data-min-table-width": Math.round(minTableWidth), "data-has-selection": rowSelection !== 'none' ? 'true' : undefined, onContextMenu: PREVENT_DEFAULT, onKeyDown: handleGridKeyDown, style: {
|
|
69
|
-
['--data-table-column-count']: totalColCount,
|
|
70
|
-
['--data-table-width']: showEmptyInGrid ? '100%' : allowOverflowX ? 'fit-content' : fitToContent ? 'fit-content' : '100%',
|
|
71
|
-
['--data-table-min-width']: showEmptyInGrid ? '100%' : allowOverflowX ? 'max-content' : fitToContent ? 'max-content' : '100%',
|
|
72
|
-
['--data-table-total-min-width']: `${minTableWidth}px`,
|
|
73
|
-
...(rowHeight ? { ['--ogrid-row-height']: `${rowHeight}px` } : {}),
|
|
74
|
-
}, children: [_jsx("div", { className: styles.tableScrollContent, children: _jsx("div", { className: isLoading && items.length > 0 ? styles.loadingDimmed : undefined, children: _jsxs("div", { className: styles.tableWidthAnchor, ref: tableContainerRef, children: [_jsxs(Table, { role: "grid", className: styles.dataTable, children: [_jsx(TableHeader, { className: o.stickyHeader ? styles.stickyHeader : undefined, children: headerRows.map((row, rowIdx) => (_jsxs(TableRow, { children: [rowIdx === headerRows.length - 1 && hasCheckboxCol && (_jsx(TableHeaderCell, { className: styles.selectionHeaderCellWrapper, children: _jsx("div", { className: styles.selectionHeaderCellInner, children: _jsx(Checkbox, { checked: allSelected ? true : someSelected ? 'mixed' : false, onChange: (_, data) => handleSelectAll(!!data.checked), "aria-label": "Select all rows" }) }) }, "__selection__")), rowIdx === 0 && rowIdx < headerRows.length - 1 && hasCheckboxCol && (_jsx("th", { rowSpan: headerRows.length - 1 }, "__selection_placeholder__")), rowIdx === headerRows.length - 1 && hasRowNumbersCol && (_jsx(TableHeaderCell, { className: styles.rowNumberHeaderCellWrapper, children: _jsx("div", { className: styles.rowNumberHeaderCellInner, children: "#" }) }, "__row_number__")), rowIdx === 0 && rowIdx < headerRows.length - 1 && hasRowNumbersCol && (_jsx("th", { rowSpan: headerRows.length - 1 }, "__row_number_placeholder__")), row.map((cell, cellIdx) => {
|
|
75
|
-
if (cell.isGroup) {
|
|
76
|
-
return (_jsx("th", { colSpan: cell.colSpan, className: styles.groupHeaderCell, scope: "colgroup", children: cell.label }, cellIdx));
|
|
77
|
-
}
|
|
78
|
-
// Leaf cell
|
|
79
|
-
if (!cell.columnDef)
|
|
80
|
-
return null;
|
|
81
|
-
const col = cell.columnDef;
|
|
82
|
-
// Determine aria-sort value for sorted columns
|
|
83
|
-
const isSorted = props.sortBy === col.columnId;
|
|
84
|
-
const ariaSort = isSorted
|
|
85
|
-
? (props.sortDirection === 'asc' ? 'ascending' : 'descending')
|
|
86
|
-
: undefined;
|
|
87
|
-
return (_jsxs(TableHeaderCell, { "data-column-id": col.columnId,
|
|
88
|
-
// rowSpan not supported by TableHeaderCell, use native th for grouped headers
|
|
89
|
-
className: columnMeta.hdrClasses[col.columnId] || undefined, style: {
|
|
90
|
-
...columnMeta.hdrStyles[col.columnId],
|
|
91
|
-
...(columnReorder ? { cursor: isReorderDragging ? 'grabbing' : 'grab' } : undefined),
|
|
92
|
-
}, "aria-sort": ariaSort, onMouseDown: columnReorder ? (e) => handleHeaderMouseDown(col.columnId, e) : undefined, children: [_jsxs("div", { className: styles.headerCellContent, children: [_jsx(ColumnHeaderFilter, { ...getHeaderFilterConfig(col, headerFilterInput) }), _jsx("button", { className: styles.headerMenuTrigger, onClick: (e) => {
|
|
93
|
-
e.stopPropagation();
|
|
94
|
-
headerMenu.open(col.columnId, e.currentTarget);
|
|
95
|
-
}, "aria-label": "Column options", title: "Column options", children: "\u22EE" })] }), _jsx("div", { className: styles.resizeHandle, onMouseDown: (e) => {
|
|
96
|
-
// Clear cell selection/focus before resize so green outlines
|
|
97
|
-
// and blue :focus-visible rings don't persist during drag.
|
|
98
|
-
setActiveCell(null);
|
|
99
|
-
interaction.setSelectionRange(null);
|
|
100
|
-
// Move DOM focus to wrapper so no cell keeps :focus-visible
|
|
101
|
-
wrapperRef.current?.focus({ preventScroll: true });
|
|
102
|
-
handleResizeStart(e, col);
|
|
103
|
-
}, "aria-label": `Resize ${col.name}` })] }, col.columnId));
|
|
104
|
-
})] }, rowIdx))) }), !showEmptyInGrid && (_jsxs(TableBody, { children: [virtualScrollEnabled && visibleRange.offsetTop > 0 && (_jsx("tr", { style: { height: visibleRange.offsetTop }, "aria-hidden": true })), (virtualScrollEnabled
|
|
105
|
-
? items.slice(visibleRange.startIndex, visibleRange.endIndex + 1).map((item, i) => {
|
|
106
|
-
const rowIndex = visibleRange.startIndex + i;
|
|
107
|
-
const rowIdStr = getRowId(item);
|
|
108
|
-
return (_jsx(GridRow, { item: item, rowIndex: rowIndex, rowId: rowIdStr, isSelected: selectedRowIds.has(rowIdStr), visibleCols: visibleCols, columnMeta: columnMeta, renderCellContent: renderCellContent, handleSingleRowClick: handleSingleRowClick, handleRowCheckboxChange: handleRowCheckboxChange, lastMouseShiftRef: lastMouseShiftRef, hasCheckboxCol: hasCheckboxCol, hasRowNumbersCol: hasRowNumbersCol, rowNumberOffset: rowNumberOffset, selectionRange: selectionRange, activeCell: interaction.activeCell, cutRange: cutRange, copyRange: copyRange, isDragging: isDragging, editingRowId: editingCell?.rowId ?? null }, rowIdStr));
|
|
109
|
-
})
|
|
110
|
-
: items.map((item, rowIndex) => {
|
|
111
|
-
const rowIdStr = getRowId(item);
|
|
112
|
-
return (_jsx(GridRow, { item: item, rowIndex: rowIndex, rowId: rowIdStr, isSelected: selectedRowIds.has(rowIdStr), visibleCols: visibleCols, columnMeta: columnMeta, renderCellContent: renderCellContent, handleSingleRowClick: handleSingleRowClick, handleRowCheckboxChange: handleRowCheckboxChange, lastMouseShiftRef: lastMouseShiftRef, hasCheckboxCol: hasCheckboxCol, hasRowNumbersCol: hasRowNumbersCol, rowNumberOffset: rowNumberOffset, selectionRange: selectionRange, activeCell: interaction.activeCell, cutRange: cutRange, copyRange: copyRange, isDragging: isDragging, editingRowId: editingCell?.rowId ?? null }, rowIdStr));
|
|
113
|
-
})), virtualScrollEnabled && visibleRange.offsetBottom > 0 && (_jsx("tr", { style: { height: visibleRange.offsetBottom }, "aria-hidden": true }))] }))] }), isReorderDragging && dropIndicatorX != null && (_jsx(DropIndicator, { dropIndicatorX: dropIndicatorX, wrapperLeft: wrapperRef.current?.getBoundingClientRect().left ?? 0 })), _jsx(MarchingAntsOverlay, { containerRef: tableContainerRef, selectionRange: selectionRange, copyRange: copyRange, cutRange: cutRange, colOffset: colOffset, items: items, visibleColumns: visibleColumns, columnSizingOverrides: columnSizingOverrides, columnOrder: columnOrder }), showEmptyInGrid && emptyState && (_jsx(EmptyState, { emptyState: emptyState }))] }) }) }), menuPosition &&
|
|
114
|
-
createPortal(_jsx(GridContextMenu, { x: menuPosition.x, y: menuPosition.y, hasSelection: hasCellSelection, canUndo: canUndo, canRedo: canRedo, onUndo: onUndo ?? NOOP, onRedo: onRedo ?? NOOP, onCopy: handleCopy, onCut: handleCut, onPaste: handlePasteVoid, onSelectAll: o.interaction.handleSelectAllCells, onClose: closeContextMenu }), wrapperRef.current?.closest('.fui-FluentProvider') ?? document.body), _jsx(ColumnHeaderMenu, { isOpen: headerMenu.isOpen, anchorElement: headerMenu.anchorElement, onClose: headerMenu.close, onPinLeft: headerMenu.handlePinLeft, onPinRight: headerMenu.handlePinRight, onUnpin: headerMenu.handleUnpin, onSortAsc: headerMenu.handleSortAsc, onSortDesc: headerMenu.handleSortDesc, onClearSort: headerMenu.handleClearSort, onAutosizeThis: headerMenu.handleAutosizeThis, onAutosizeAll: headerMenu.handleAutosizeAll, canPinLeft: headerMenu.canPinLeft, canPinRight: headerMenu.canPinRight, canUnpin: headerMenu.canUnpin, currentSort: headerMenu.currentSort, isSortable: headerMenu.isSortable, isResizable: headerMenu.isResizable })] }), statusBarConfig && (_jsx(StatusBar, { totalCount: statusBarConfig.totalCount, filteredCount: statusBarConfig.filteredCount, selectedCount: statusBarConfig.selectedCount ?? selectedRowIds.size, selectedCellCount: selectionRange ? (Math.abs(selectionRange.endRow - selectionRange.startRow) + 1) * (Math.abs(selectionRange.endCol - selectionRange.startCol) + 1) : undefined, aggregation: statusBarConfig.aggregation, suppressRowCount: statusBarConfig.suppressRowCount })), isLoading && (_jsx(LoadingOverlay, { message: loadingMessage }))] }));
|
|
115
|
-
}
|
|
116
|
-
export const DataGridTable = React.memo(DataGridTableInner);
|