@alaarab/ogrid-react-fluent 2.1.15 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -589,10 +589,18 @@
589
589
  white-space: nowrap;
590
590
  user-select: none;
591
591
  outline: none;
592
+ contain: content;
592
593
  }
593
594
  .ogrid-fluent__DataGridTable-module__cellContent:focus-visible {
594
595
  outline: none;
595
596
  }
597
+ .ogrid-fluent__DataGridTable-module__pinnedColLeft .ogrid-fluent__DataGridTable-module__cellContent,
598
+ .ogrid-fluent__DataGridTable-module__pinnedColRight .ogrid-fluent__DataGridTable-module__cellContent {
599
+ contain: none;
600
+ }
601
+ .ogrid-fluent__DataGridTable-module__dataTable:not([data-virtual-scroll]) tbody tr {
602
+ content-visibility: auto;
603
+ }
596
604
  .ogrid-fluent__DataGridTable-module__activeCellContent {
597
605
  outline: 2px solid var(--ogrid-selection-color, #217346);
598
606
  outline-offset: -1px;
package/dist/esm/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import './index.css';
2
- import { useColumnHeaderFilterState, getColumnHeaderFilterStateParams, DateFilterContent, renderFilterContent, areGridRowPropsEqual, usePaginationControls, createOGrid, useListVirtualizer, STOP_PROPAGATION, useDataGridTableOrchestration, useColumnMeta, getCellRenderDescriptor, buildInlineEditorProps, buildPopoverEditorProps, POPOVER_ANCHOR_STYLE, resolveCellDisplayContent, resolveCellStyle, getCellInteractionProps, CURSOR_CELL_STYLE, CellErrorBoundary, GRID_ROOT_STYLE, PREVENT_DEFAULT, getHeaderFilterConfig, MarchingAntsOverlay, NOOP, useColumnChooserState, BaseInlineCellEditor, BaseDropIndicator, BaseEmptyState, GridContextMenu as GridContextMenu$1, BaseColumnHeaderMenu, StatusBar as StatusBar$1, BaseLoadingOverlay } from '@alaarab/ogrid-react';
2
+ import { useColumnHeaderFilterState, getColumnHeaderFilterStateParams, DateFilterContent, renderFilterContent, areGridRowPropsEqual, usePaginationControls, createOGrid, useListVirtualizer, STOP_PROPAGATION, useDataGridTableOrchestration, useColumnMeta, getCellRenderDescriptor, buildInlineEditorProps, buildPopoverEditorProps, POPOVER_ANCHOR_STYLE, resolveCellDisplayContent, resolveCellStyle, getCellInteractionProps, CURSOR_CELL_STYLE, CellErrorBoundary, GRID_ROOT_STYLE, PREVENT_DEFAULT, getHeaderFilterConfig, MarchingAntsOverlay, NOOP, useColumnChooserState, BaseInlineCellEditor, partitionColumnsForVirtualization, BaseDropIndicator, BaseEmptyState, GridContextMenu as GridContextMenu$1, BaseColumnHeaderMenu, StatusBar as StatusBar$1, BaseLoadingOverlay } from '@alaarab/ogrid-react';
3
3
  export { BaseColumnHeaderMenu, BaseDropIndicator, BaseEmptyState, BaseInlineCellEditor, BaseLoadingOverlay, CELL_PADDING, CHECKBOX_COLUMN_WIDTH, COLUMN_HEADER_MENU_ITEMS, CURSOR_CELL_STYLE, CellErrorBoundary, DEFAULT_MIN_COLUMN_WIDTH, DateFilterContent, EmptyState, GRID_BORDER_RADIUS, GRID_CONTEXT_MENU_ITEMS, GRID_ROOT_STYLE, GridContextMenu, MAX_PAGE_BUTTONS, MarchingAntsOverlay, NOOP, OGridLayout, PAGE_SIZE_OPTIONS, POPOVER_ANCHOR_STYLE, PREVENT_DEFAULT, ROW_NUMBER_COLUMN_WIDTH, STOP_PROPAGATION, SideBar, StatusBar, UndoRedoStack, areGridRowPropsEqual, booleanParser, buildCsvHeader, buildCsvRows, buildHeaderRows, buildInlineEditorProps, buildPopoverEditorProps, clampSelectionToBounds, computeAggregations, computeAutoScrollSpeed, computeTabNavigation, createOGrid, currencyParser, dateParser, deriveFilterOptionsFromData, editorInputStyle, editorWrapperStyle, emailParser, escapeCsvValue, exportToCsv, findCtrlArrowTarget, flattenColumns, formatCellValueForTsv, formatSelectionAsTsv, formatShortcut, getCellInteractionProps, getCellRenderDescriptor, getCellValue, getColumnHeaderFilterStateParams, getColumnHeaderMenuItems, getContextMenuHandlers, getDataGridStatusBarConfig, getDateFilterContentProps, getFilterField, getHeaderFilterConfig, getMultiSelectFilterFields, getPaginationViewModel, getStatusBarParts, isInSelectionRange, isRowInRange, mergeFilter, normalizeSelectionRange, numberParser, parseTsvClipboard, parseValue, processClientSideData, rangesEqual, renderFilterContent, resolveCellDisplayContent, resolveCellStyle, richSelectDropdownStyle, richSelectNoMatchesStyle, richSelectOptionHighlightedStyle, richSelectOptionStyle, richSelectWrapperStyle, selectChevronStyle, selectDisplayStyle, selectEditorStyle, toUserLike, triggerCsvDownload, useActiveCell, useCellEditing, useCellSelection, useClipboard, useColumnChooserState, useColumnHeaderFilterState, useColumnMeta, useColumnReorder, useColumnResize, useContextMenu, useDataGridState, useDataGridTableOrchestration, useDateFilterState, useDebounce, useFillHandle, useFilterOptions, useInlineCellEditorState, useKeyboardNavigation, useLatestRef, useListVirtualizer, useMultiSelectFilterState, useOGrid, usePaginationControls, usePeopleFilterState, useRichSelectState, useRowSelection, useSelectState, useSideBarState, useTableLayout, useTextFilterState, useUndoRedo, useVirtualScroll } from '@alaarab/ogrid-react';
4
- import * as React from 'react';
4
+ import * as React2 from 'react';
5
5
  import { useCallback, useRef, useEffect } from 'react';
6
6
  import { createPortal } from 'react-dom';
7
7
  import { Popover, PopoverSurface, Button, Select, TableRow, TableCell, Checkbox, Table, TableHeader, TableHeaderCell, TableBody } from '@fluentui/react-components';
@@ -262,7 +262,7 @@ var PeopleFilterPopover = ({
262
262
  selectedUser && /* @__PURE__ */ jsx("div", { className: ColumnHeaderFilter_module_default.popoverActions, onClick: onPopoverClick, children: /* @__PURE__ */ jsx("button", { type: "button", className: ColumnHeaderFilter_module_default.clearButton, onClick: onClearUser, children: "Clear Filter" }) })
263
263
  ] });
264
264
  PeopleFilterPopover.displayName = "PeopleFilterPopover";
265
- var ColumnHeaderFilter = React.memo((props) => {
265
+ var ColumnHeaderFilter = React2.memo((props) => {
266
266
  const {
267
267
  columnName,
268
268
  filterType,
@@ -286,8 +286,8 @@ var ColumnHeaderFilter = React.memo((props) => {
286
286
  handleInputClick,
287
287
  handleInputKeyDown
288
288
  } = handlers;
289
- const filterBtnRef = React.useRef(null);
290
- const fluentRenderers = React.useMemo(() => ({
289
+ const filterBtnRef = React2.useRef(null);
290
+ const fluentRenderers = React2.useMemo(() => ({
291
291
  renderMultiSelect: (p) => /* @__PURE__ */ jsx(
292
292
  MultiSelectFilterPopover,
293
293
  {
@@ -536,6 +536,7 @@ function LoadingOverlay({ message }) {
536
536
  function DropIndicator({ dropIndicatorX, wrapperLeft }) {
537
537
  return /* @__PURE__ */ jsx(BaseDropIndicator, { dropIndicatorX, wrapperLeft, className: DataGridTable_module_default.dropIndicator });
538
538
  }
539
+ var SPACER_TD_STYLE = { padding: 0, border: "none" };
539
540
  function GridRowInner(props) {
540
541
  const {
541
542
  item,
@@ -550,7 +551,10 @@ function GridRowInner(props) {
550
551
  lastMouseShiftRef,
551
552
  hasCheckboxCol,
552
553
  hasRowNumbersCol,
553
- rowNumberOffset
554
+ rowNumberOffset,
555
+ leftSpacerWidth,
556
+ rightSpacerWidth,
557
+ globalColIndexMap
554
558
  } = props;
555
559
  return /* @__PURE__ */ jsxs(
556
560
  TableRow,
@@ -580,21 +584,112 @@ function GridRowInner(props) {
580
584
  }
581
585
  ) }),
582
586
  hasRowNumbersCol && /* @__PURE__ */ jsx(TableCell, { className: DataGridTable_module_default.rowNumberCellWrapper, children: /* @__PURE__ */ jsx("div", { className: DataGridTable_module_default.rowNumberCellInner, children: rowNumberOffset + rowIndex + 1 }) }),
583
- visibleCols.map((col, colIdx) => /* @__PURE__ */ jsx(
584
- TableCell,
585
- {
586
- "data-column-id": col.columnId,
587
- className: columnMeta.cellClasses[col.columnId] || void 0,
588
- style: columnMeta.cellStyles[col.columnId],
589
- children: renderCellContent(item, col, rowIndex, colIdx)
590
- },
591
- col.columnId
592
- ))
587
+ leftSpacerWidth != null && leftSpacerWidth > 0 && /* @__PURE__ */ jsx("td", { style: { ...SPACER_TD_STYLE, width: leftSpacerWidth, minWidth: leftSpacerWidth }, "aria-hidden": true }),
588
+ visibleCols.map((col, colIdx) => {
589
+ const globalIdx = globalColIndexMap ? globalColIndexMap[colIdx] : colIdx;
590
+ return /* @__PURE__ */ jsx(
591
+ TableCell,
592
+ {
593
+ "data-column-id": col.columnId,
594
+ className: columnMeta.cellClasses[col.columnId] || void 0,
595
+ style: columnMeta.cellStyles[col.columnId],
596
+ children: renderCellContent(item, col, rowIndex, globalIdx)
597
+ },
598
+ col.columnId
599
+ );
600
+ }),
601
+ rightSpacerWidth != null && rightSpacerWidth > 0 && /* @__PURE__ */ jsx("td", { style: { ...SPACER_TD_STYLE, width: rightSpacerWidth, minWidth: rightSpacerWidth }, "aria-hidden": true })
593
602
  ]
594
603
  }
595
604
  );
596
605
  }
597
- var GridRow = React.memo(GridRowInner, areGridRowPropsEqual);
606
+ var GridRow = React2.memo(GridRowInner, areGridRowPropsEqual);
607
+ function FluentTableBody(props) {
608
+ const {
609
+ virtualScrollEnabled,
610
+ visibleRange,
611
+ columnRange,
612
+ items,
613
+ getRowId,
614
+ selectedRowIds,
615
+ visibleCols,
616
+ columnMeta,
617
+ renderCellContent,
618
+ handleSingleRowClick,
619
+ handleRowCheckboxChange,
620
+ lastMouseShiftRef,
621
+ hasCheckboxCol,
622
+ hasRowNumbersCol,
623
+ rowNumberOffset,
624
+ selectionRange,
625
+ activeCell,
626
+ cutRange,
627
+ copyRange,
628
+ isDragging,
629
+ editingCell,
630
+ pinnedColumns
631
+ } = props;
632
+ const partition = React2.useMemo(() => {
633
+ if (!columnRange) return null;
634
+ const p = partitionColumnsForVirtualization(
635
+ visibleCols,
636
+ columnRange,
637
+ pinnedColumns
638
+ );
639
+ return p;
640
+ }, [visibleCols, columnRange, pinnedColumns]);
641
+ const { rowCols, globalColIndexMap, leftSpacerWidth, rightSpacerWidth } = React2.useMemo(() => {
642
+ if (!partition) {
643
+ return { rowCols: visibleCols, globalColIndexMap: void 0, leftSpacerWidth: void 0, rightSpacerWidth: void 0 };
644
+ }
645
+ const combined = [...partition.pinnedLeft, ...partition.virtualizedUnpinned, ...partition.pinnedRight];
646
+ const idxMap = combined.map((col) => visibleCols.indexOf(col));
647
+ return {
648
+ rowCols: combined,
649
+ globalColIndexMap: idxMap,
650
+ leftSpacerWidth: partition.leftSpacerWidth,
651
+ rightSpacerWidth: partition.rightSpacerWidth
652
+ };
653
+ }, [partition, visibleCols]);
654
+ const renderRow = (item, rowIndex) => {
655
+ const rowIdStr = getRowId(item);
656
+ return /* @__PURE__ */ jsx(
657
+ GridRow,
658
+ {
659
+ item,
660
+ rowIndex,
661
+ rowId: rowIdStr,
662
+ isSelected: selectedRowIds.has(rowIdStr),
663
+ visibleCols: rowCols,
664
+ columnMeta,
665
+ renderCellContent,
666
+ handleSingleRowClick,
667
+ handleRowCheckboxChange,
668
+ lastMouseShiftRef,
669
+ hasCheckboxCol,
670
+ hasRowNumbersCol,
671
+ rowNumberOffset,
672
+ selectionRange,
673
+ activeCell,
674
+ cutRange,
675
+ copyRange,
676
+ isDragging,
677
+ editingRowId: editingCell?.rowId ?? null,
678
+ leftSpacerWidth,
679
+ rightSpacerWidth,
680
+ globalColIndexMap
681
+ },
682
+ rowIdStr
683
+ );
684
+ };
685
+ return /* @__PURE__ */ jsxs(TableBody, { children: [
686
+ virtualScrollEnabled && visibleRange.offsetTop > 0 && /* @__PURE__ */ jsx("tr", { style: { height: visibleRange.offsetTop }, "aria-hidden": true }),
687
+ virtualScrollEnabled ? items.slice(visibleRange.startIndex, visibleRange.endIndex + 1).map(
688
+ (item, i) => renderRow(item, visibleRange.startIndex + i)
689
+ ) : items.map((item, rowIndex) => renderRow(item, rowIndex)),
690
+ virtualScrollEnabled && visibleRange.offsetBottom > 0 && /* @__PURE__ */ jsx("tr", { style: { height: visibleRange.offsetBottom }, "aria-hidden": true })
691
+ ] });
692
+ }
598
693
  function DataGridTableInner(props) {
599
694
  const o = useDataGridTableOrchestration({ props });
600
695
  const {
@@ -611,6 +706,8 @@ function DataGridTableInner(props) {
611
706
  handleHeaderMouseDown,
612
707
  virtualScrollEnabled,
613
708
  visibleRange,
709
+ columnRange,
710
+ onHorizontalScroll,
614
711
  items,
615
712
  getRowId,
616
713
  emptyState,
@@ -759,6 +856,7 @@ function DataGridTableInner(props) {
759
856
  onMouseDown: (e) => {
760
857
  lastMouseShiftRef.current = e.shiftKey;
761
858
  },
859
+ onScroll: onHorizontalScroll ? (e) => onHorizontalScroll(e.target.scrollLeft) : void 0,
762
860
  className: `${DataGridTable_module_default.tableWrapper} ${rowSelection !== "none" ? DataGridTable_module_default.selectableGrid : ""} ${DataGridTable_module_default[`density-${density}`] || ""}`,
763
861
  role: "region",
764
862
  "aria-label": ariaLabel ?? (ariaLabelledBy ? void 0 : "Data grid"),
@@ -781,7 +879,7 @@ function DataGridTableInner(props) {
781
879
  },
782
880
  children: [
783
881
  /* @__PURE__ */ jsx("div", { className: DataGridTable_module_default.tableScrollContent, children: /* @__PURE__ */ jsx("div", { className: isLoading && items.length > 0 ? DataGridTable_module_default.loadingDimmed : void 0, children: /* @__PURE__ */ jsxs("div", { className: DataGridTable_module_default.tableWidthAnchor, ref: tableContainerRef, children: [
784
- /* @__PURE__ */ jsxs(Table, { role: "grid", className: DataGridTable_module_default.dataTable, children: [
882
+ /* @__PURE__ */ jsxs(Table, { role: "grid", className: DataGridTable_module_default.dataTable, "data-virtual-scroll": virtualScrollEnabled ? "" : void 0, children: [
785
883
  /* @__PURE__ */ jsx(
786
884
  TableHeader,
787
885
  {
@@ -859,66 +957,33 @@ function DataGridTableInner(props) {
859
957
  ] }, rowIdx))
860
958
  }
861
959
  ),
862
- !showEmptyInGrid && /* @__PURE__ */ jsxs(TableBody, { children: [
863
- virtualScrollEnabled && visibleRange.offsetTop > 0 && /* @__PURE__ */ jsx("tr", { style: { height: visibleRange.offsetTop }, "aria-hidden": true }),
864
- virtualScrollEnabled ? items.slice(visibleRange.startIndex, visibleRange.endIndex + 1).map((item, i) => {
865
- const rowIndex = visibleRange.startIndex + i;
866
- const rowIdStr = getRowId(item);
867
- return /* @__PURE__ */ jsx(
868
- GridRow,
869
- {
870
- item,
871
- rowIndex,
872
- rowId: rowIdStr,
873
- isSelected: selectedRowIds.has(rowIdStr),
874
- visibleCols,
875
- columnMeta,
876
- renderCellContent,
877
- handleSingleRowClick,
878
- handleRowCheckboxChange,
879
- lastMouseShiftRef,
880
- hasCheckboxCol,
881
- hasRowNumbersCol,
882
- rowNumberOffset,
883
- selectionRange,
884
- activeCell: interaction.activeCell,
885
- cutRange,
886
- copyRange,
887
- isDragging,
888
- editingRowId: editingCell?.rowId ?? null
889
- },
890
- rowIdStr
891
- );
892
- }) : items.map((item, rowIndex) => {
893
- const rowIdStr = getRowId(item);
894
- return /* @__PURE__ */ jsx(
895
- GridRow,
896
- {
897
- item,
898
- rowIndex,
899
- rowId: rowIdStr,
900
- isSelected: selectedRowIds.has(rowIdStr),
901
- visibleCols,
902
- columnMeta,
903
- renderCellContent,
904
- handleSingleRowClick,
905
- handleRowCheckboxChange,
906
- lastMouseShiftRef,
907
- hasCheckboxCol,
908
- hasRowNumbersCol,
909
- rowNumberOffset,
910
- selectionRange,
911
- activeCell: interaction.activeCell,
912
- cutRange,
913
- copyRange,
914
- isDragging,
915
- editingRowId: editingCell?.rowId ?? null
916
- },
917
- rowIdStr
918
- );
919
- }),
920
- virtualScrollEnabled && visibleRange.offsetBottom > 0 && /* @__PURE__ */ jsx("tr", { style: { height: visibleRange.offsetBottom }, "aria-hidden": true })
921
- ] })
960
+ !showEmptyInGrid && /* @__PURE__ */ jsx(
961
+ FluentTableBody,
962
+ {
963
+ virtualScrollEnabled,
964
+ visibleRange,
965
+ columnRange,
966
+ items,
967
+ getRowId,
968
+ selectedRowIds,
969
+ visibleCols,
970
+ columnMeta,
971
+ renderCellContent,
972
+ handleSingleRowClick,
973
+ handleRowCheckboxChange,
974
+ lastMouseShiftRef,
975
+ hasCheckboxCol,
976
+ hasRowNumbersCol,
977
+ rowNumberOffset,
978
+ selectionRange,
979
+ activeCell: interaction.activeCell,
980
+ cutRange,
981
+ copyRange,
982
+ isDragging,
983
+ editingCell,
984
+ pinnedColumns: pinning.pinnedColumns
985
+ }
986
+ )
922
987
  ] }),
923
988
  isReorderDragging && dropIndicatorX != null && /* @__PURE__ */ jsx(DropIndicator, { dropIndicatorX, wrapperLeft: wrapperRef.current?.getBoundingClientRect().left ?? 0 }),
924
989
  /* @__PURE__ */ jsx(
@@ -997,7 +1062,7 @@ function DataGridTableInner(props) {
997
1062
  isLoading && /* @__PURE__ */ jsx(LoadingOverlay, { message: loadingMessage })
998
1063
  ] });
999
1064
  }
1000
- var DataGridTable = React.memo(DataGridTableInner);
1065
+ var DataGridTable = React2.memo(DataGridTableInner);
1001
1066
 
1002
1067
  // src/ColumnChooser/ColumnChooser.module.scss
1003
1068
  var ColumnChooser_module_default = {
@@ -1099,7 +1164,7 @@ var PaginationControls_module_default = {
1099
1164
  "pageSizeLabel": "ogrid-fluent__PaginationControls-module__pageSizeLabel",
1100
1165
  "pageSizeSelect": "ogrid-fluent__PaginationControls-module__pageSizeSelect"
1101
1166
  };
1102
- var PaginationControls = React.memo((props) => {
1167
+ var PaginationControls = React2.memo((props) => {
1103
1168
  const { currentPage, pageSize, totalCount, onPageChange, onPageSizeChange, pageSizeOptions, entityLabelPlural, className } = props;
1104
1169
  const { labelPlural, vm, handlePageSizeChange } = usePaginationControls({
1105
1170
  currentPage,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alaarab/ogrid-react-fluent",
3
- "version": "2.1.15",
3
+ "version": "2.2.0",
4
4
  "description": "OGrid React Fluent implementation – DataGrid-powered data table with sorting, filtering, pagination, column chooser, and CSV export.",
5
5
  "main": "dist/esm/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -41,7 +41,7 @@
41
41
  "node": ">=18"
42
42
  },
43
43
  "dependencies": {
44
- "@alaarab/ogrid-react": "2.1.15"
44
+ "@alaarab/ogrid-react": "2.2.0"
45
45
  },
46
46
  "peerDependencies": {
47
47
  "@fluentui/react-components": "^9.0.0",