@alaarab/ogrid-react-fluent 2.2.0 → 2.4.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.
@@ -601,7 +601,7 @@
601
601
  .ogrid-fluent__DataGridTable-module__dataTable:not([data-virtual-scroll]) tbody tr {
602
602
  content-visibility: auto;
603
603
  }
604
- .ogrid-fluent__DataGridTable-module__activeCellContent {
604
+ .ogrid-fluent__DataGridTable-module__tableWrapper .ogrid-fluent__DataGridTable-module__activeCellContent.ogrid-fluent__DataGridTable-module__activeCellContent {
605
605
  outline: 2px solid var(--ogrid-selection-color, #217346);
606
606
  outline-offset: -1px;
607
607
  z-index: var(--ogrid-z-active-cell, 2);
@@ -609,7 +609,7 @@
609
609
  overflow: visible;
610
610
  background: var(--ogrid-active-cell-bg, rgba(0, 0, 0, 0.02));
611
611
  }
612
- .ogrid-fluent__DataGridTable-module__editingCellContent {
612
+ .ogrid-fluent__DataGridTable-module__tableWrapper .ogrid-fluent__DataGridTable-module__editingCellContent.ogrid-fluent__DataGridTable-module__editingCellContent {
613
613
  width: 100%;
614
614
  height: 100%;
615
615
  display: flex;
@@ -632,10 +632,14 @@
632
632
  .ogrid-fluent__DataGridTable-module__tableWrapper [data-drag-anchor] {
633
633
  background: var(--ogrid-bg, #fff);
634
634
  }
635
- .ogrid-fluent__DataGridTable-module__activeCellContent[data-drag-anchor],
636
- .ogrid-fluent__DataGridTable-module__activeCellContent[data-drag-range] {
635
+ .ogrid-fluent__DataGridTable-module__tableWrapper .ogrid-fluent__DataGridTable-module__activeCellContent.ogrid-fluent__DataGridTable-module__activeCellContent[data-drag-anchor],
636
+ .ogrid-fluent__DataGridTable-module__tableWrapper .ogrid-fluent__DataGridTable-module__activeCellContent.ogrid-fluent__DataGridTable-module__activeCellContent[data-drag-range] {
637
637
  outline: none;
638
638
  }
639
+ .ogrid-fluent__DataGridTable-module__tableWrapper .ogrid-fluent__DataGridTable-module__activeCellContent.ogrid-fluent__DataGridTable-module__activeCellContent.ogrid-fluent__DataGridTable-module__inRange {
640
+ outline: none;
641
+ background: var(--ogrid-bg, #fff);
642
+ }
639
643
  .ogrid-fluent__DataGridTable-module__tableWrapper .ogrid-fluent__DataGridTable-module__cellCut {
640
644
  background: var(--ogrid-hover-bg, rgba(0, 0, 0, 0.04));
641
645
  opacity: 0.7;
@@ -668,6 +672,20 @@
668
672
  width: 100%;
669
673
  font-variant-numeric: tabular-nums;
670
674
  }
675
+ .ogrid-fluent__DataGridTable-module__columnLetterRow {
676
+ background: var(--ogrid-column-letter-bg, var(--ogrid-header-bg));
677
+ }
678
+ .ogrid-fluent__DataGridTable-module__columnLetterCell {
679
+ text-align: center;
680
+ font-size: 11px;
681
+ font-weight: 500;
682
+ color: var(--ogrid-fg-muted, rgba(0, 0, 0, 0.5));
683
+ padding: 2px 4px;
684
+ background: var(--ogrid-column-letter-bg, var(--ogrid-header-bg));
685
+ border-bottom: 1px solid var(--ogrid-border, rgba(0, 0, 0, 0.12));
686
+ user-select: none;
687
+ font-variant-numeric: tabular-nums;
688
+ }
671
689
  .ogrid-fluent__DataGridTable-module__statusBar {
672
690
  display: flex;
673
691
  align-items: center;
@@ -873,6 +891,7 @@
873
891
  --ogrid-shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.08);
874
892
  --ogrid-pinned-shadow: rgba(0, 0, 0, 0.1);
875
893
  --ogrid-loading-overlay: rgba(255, 255, 255, 0.7);
894
+ --ogrid-formula-error-color: #d32f2f;
876
895
  --ogrid-selection: #217346;
877
896
  --ogrid-bg-range: rgba(33, 115, 70, 0.12);
878
897
  --ogrid-bg-selected: #e6f0fb;
@@ -907,6 +926,7 @@
907
926
  --ogrid-shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.25);
908
927
  --ogrid-pinned-shadow: rgba(0, 0, 0, 0.3);
909
928
  --ogrid-loading-overlay: rgba(0, 0, 0, 0.7);
929
+ --ogrid-formula-error-color: #ef5350;
910
930
  --ogrid-selection: #2ea043;
911
931
  --ogrid-bg-range: rgba(46, 160, 67, 0.15);
912
932
  --ogrid-bg-selected: #1a3a5c;
@@ -941,6 +961,7 @@
941
961
  --ogrid-shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.25);
942
962
  --ogrid-pinned-shadow: rgba(0, 0, 0, 0.3);
943
963
  --ogrid-loading-overlay: rgba(0, 0, 0, 0.7);
964
+ --ogrid-formula-error-color: #ef5350;
944
965
  --ogrid-selection: #2ea043;
945
966
  --ogrid-bg-range: rgba(46, 160, 67, 0.15);
946
967
  --ogrid-bg-selected: #1a3a5c;
package/dist/esm/index.js CHANGED
@@ -1,11 +1,11 @@
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, partitionColumnsForVirtualization, BaseDropIndicator, BaseEmptyState, GridContextMenu as GridContextMenu$1, BaseColumnHeaderMenu, StatusBar as StatusBar$1, BaseLoadingOverlay } from '@alaarab/ogrid-react';
2
+ import { useColumnHeaderFilterState, getColumnHeaderFilterStateParams, DateFilterContent, renderFilterContent, areGridRowPropsEqual, PaginationControlsBase, createOGrid, useListVirtualizer, STOP_PROPAGATION, useDataGridTableOrchestration, useColumnMeta, getCellRenderDescriptor, buildInlineEditorProps, buildPopoverEditorProps, POPOVER_ANCHOR_STYLE, resolveCellDisplayContent, resolveCellStyle, getCellInteractionProps, CURSOR_CELL_STYLE, CellErrorBoundary, GRID_ROOT_STYLE, PREVENT_DEFAULT, indexToColumnLetter, getHeaderFilterConfig, MarchingAntsOverlay, FormulaRefOverlay, NOOP, getColumnHeaderMenuProps, useColumnChooserState, ColumnChooserContent, 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
4
  import * as React2 from 'react';
5
5
  import { useCallback, useRef, useEffect } from 'react';
6
6
  import { createPortal } from 'react-dom';
7
- import { Popover, PopoverSurface, Button, Select, TableRow, TableCell, Checkbox, Table, TableHeader, TableHeaderCell, TableBody } from '@fluentui/react-components';
8
- import { FilterRegular, ChevronDoubleLeftRegular, ChevronLeftRegular, ChevronRightRegular, ChevronDoubleRightRegular, SearchRegular, ChevronUpRegular, ChevronDownRegular, TableSettingsRegular } from '@fluentui/react-icons';
7
+ import { Popover, PopoverSurface, TableRow, TableCell, Checkbox, Table, TableHeader, TableHeaderCell, Select, Button, TableBody } from '@fluentui/react-components';
8
+ import { FilterRegular, SearchRegular, ChevronUpRegular, ChevronDownRegular, TableSettingsRegular, ChevronDoubleRightRegular, ChevronRightRegular, ChevronLeftRegular, ChevronDoubleLeftRegular } from '@fluentui/react-icons';
9
9
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
10
10
 
11
11
  // src/ColumnHeaderFilter/ColumnHeaderFilter.module.scss
@@ -456,12 +456,15 @@ var DataGridTable_module_default = {
456
456
  "activeCellContent": "ogrid-fluent__DataGridTable-module__activeCellContent",
457
457
  "editingCellContent": "ogrid-fluent__DataGridTable-module__editingCellContent",
458
458
  "cellInRange": "ogrid-fluent__DataGridTable-module__cellInRange",
459
+ "inRange": "ogrid-fluent__DataGridTable-module__inRange",
459
460
  "cellCut": "ogrid-fluent__DataGridTable-module__cellCut",
460
461
  "fillHandle": "ogrid-fluent__DataGridTable-module__fillHandle",
461
462
  "selectionHeaderCellInner": "ogrid-fluent__DataGridTable-module__selectionHeaderCellInner",
462
463
  "selectionCellInner": "ogrid-fluent__DataGridTable-module__selectionCellInner",
463
464
  "rowNumberHeaderCellInner": "ogrid-fluent__DataGridTable-module__rowNumberHeaderCellInner",
464
465
  "rowNumberCellInner": "ogrid-fluent__DataGridTable-module__rowNumberCellInner",
466
+ "columnLetterRow": "ogrid-fluent__DataGridTable-module__columnLetterRow",
467
+ "columnLetterCell": "ogrid-fluent__DataGridTable-module__columnLetterCell",
465
468
  "statusBar": "ogrid-fluent__DataGridTable-module__statusBar",
466
469
  "statusBarItem": "ogrid-fluent__DataGridTable-module__statusBarItem",
467
470
  "statusBarLabel": "ogrid-fluent__DataGridTable-module__statusBarLabel",
@@ -725,6 +728,7 @@ function DataGridTableInner(props) {
725
728
  headerRows,
726
729
  allowOverflowX,
727
730
  fitToContent,
731
+ showColumnLetters,
728
732
  editCallbacks,
729
733
  interactionHandlers,
730
734
  cellDescriptorInputRef,
@@ -819,9 +823,9 @@ function DataGridTableInner(props) {
819
823
  ] });
820
824
  } else {
821
825
  const displayContent = resolveCellDisplayContent(col, item, descriptor.displayValue);
822
- const cellStyle = resolveCellStyle(col, item);
826
+ const cellStyle = resolveCellStyle(col, item, descriptor.displayValue);
823
827
  const styledContent = cellStyle ? /* @__PURE__ */ jsx("span", { style: cellStyle, children: displayContent }) : displayContent;
824
- const cellClassNames = `${DataGridTable_module_default.cellContent}${descriptor.isActive ? ` ${DataGridTable_module_default.activeCellContent}` : ""}${descriptor.isInRange && !descriptor.isActive ? ` ${DataGridTable_module_default.cellInRange}` : ""}${descriptor.isInCutRange ? ` ${DataGridTable_module_default.cellCut}` : ""}${descriptor.isInCopyRange ? ` ${DataGridTable_module_default.cellCopied}` : ""}`;
828
+ const cellClassNames = `${DataGridTable_module_default.cellContent}${descriptor.isActive ? ` ${DataGridTable_module_default.activeCellContent}` : ""}${descriptor.isActive && descriptor.isInRange ? ` ${DataGridTable_module_default.inRange}` : ""}${descriptor.isInRange && !descriptor.isActive ? ` ${DataGridTable_module_default.cellInRange}` : ""}${descriptor.isInCutRange ? ` ${DataGridTable_module_default.cellCut}` : ""}${descriptor.isInCopyRange ? ` ${DataGridTable_module_default.cellCopied}` : ""}`;
825
829
  const interactionProps = getCellInteractionProps(descriptor, col.columnId, interactionHandlers);
826
830
  content = /* @__PURE__ */ jsxs(
827
831
  "div",
@@ -880,81 +884,96 @@ function DataGridTableInner(props) {
880
884
  children: [
881
885
  /* @__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: [
882
886
  /* @__PURE__ */ jsxs(Table, { role: "grid", className: DataGridTable_module_default.dataTable, "data-virtual-scroll": virtualScrollEnabled ? "" : void 0, children: [
883
- /* @__PURE__ */ jsx(
887
+ /* @__PURE__ */ jsxs(
884
888
  TableHeader,
885
889
  {
886
890
  className: o.stickyHeader ? DataGridTable_module_default.stickyHeader : void 0,
887
- children: headerRows.map((row, rowIdx) => /* @__PURE__ */ jsxs(TableRow, { children: [
888
- rowIdx === headerRows.length - 1 && hasCheckboxCol && /* @__PURE__ */ jsx(TableHeaderCell, { className: DataGridTable_module_default.selectionHeaderCellWrapper, children: /* @__PURE__ */ jsx("div", { className: DataGridTable_module_default.selectionHeaderCellInner, children: /* @__PURE__ */ jsx(
889
- Checkbox,
890
- {
891
- checked: allSelected ? true : someSelected ? "mixed" : false,
892
- onChange: (_, data) => handleSelectAll(!!data.checked),
893
- "aria-label": "Select all rows"
894
- }
895
- ) }) }, "__selection__"),
896
- rowIdx === 0 && rowIdx < headerRows.length - 1 && hasCheckboxCol && /* @__PURE__ */ jsx("th", { rowSpan: headerRows.length - 1 }, "__selection_placeholder__"),
897
- rowIdx === headerRows.length - 1 && hasRowNumbersCol && /* @__PURE__ */ jsx(TableHeaderCell, { className: DataGridTable_module_default.rowNumberHeaderCellWrapper, children: /* @__PURE__ */ jsx("div", { className: DataGridTable_module_default.rowNumberHeaderCellInner, children: "#" }) }, "__row_number__"),
898
- rowIdx === 0 && rowIdx < headerRows.length - 1 && hasRowNumbersCol && /* @__PURE__ */ jsx("th", { rowSpan: headerRows.length - 1 }, "__row_number_placeholder__"),
899
- row.map((cell, cellIdx) => {
900
- if (cell.isGroup) {
901
- return /* @__PURE__ */ jsx("th", { colSpan: cell.colSpan, className: DataGridTable_module_default.groupHeaderCell, scope: "colgroup", children: cell.label }, cellIdx);
902
- }
903
- if (!cell.columnDef) return null;
904
- const col = cell.columnDef;
905
- const isSorted = props.sortBy === col.columnId;
906
- const ariaSort = isSorted ? props.sortDirection === "asc" ? "ascending" : "descending" : void 0;
907
- return /* @__PURE__ */ jsxs(
908
- TableHeaderCell,
891
+ children: [
892
+ showColumnLetters && /* @__PURE__ */ jsxs(TableRow, { children: [
893
+ hasCheckboxCol && /* @__PURE__ */ jsx("th", { className: DataGridTable_module_default.columnLetterCell }),
894
+ hasRowNumbersCol && /* @__PURE__ */ jsx("th", { className: DataGridTable_module_default.columnLetterCell }),
895
+ visibleCols.map((col, colIdx) => /* @__PURE__ */ jsx(
896
+ "th",
909
897
  {
910
- scope: "col",
911
- "data-column-id": col.columnId,
912
- className: columnMeta.hdrClasses[col.columnId] || void 0,
913
- style: {
914
- ...columnMeta.hdrStyles[col.columnId],
915
- ...columnReorder ? { cursor: isReorderDragging ? "grabbing" : "grab" } : void 0
916
- },
917
- "aria-sort": ariaSort,
918
- onMouseDown: columnReorder ? (e) => handleHeaderMouseDown(col.columnId, e) : void 0,
919
- children: [
920
- /* @__PURE__ */ jsxs("div", { className: DataGridTable_module_default.headerCellContent, children: [
921
- /* @__PURE__ */ jsx(ColumnHeaderFilter, { ...getHeaderFilterConfig(col, headerFilterInput) }),
898
+ className: `${DataGridTable_module_default.columnLetterCell}${columnMeta.hdrClasses[col.columnId] ? ` ${columnMeta.hdrClasses[col.columnId]}` : ""}`,
899
+ style: columnMeta.hdrStyles[col.columnId],
900
+ children: indexToColumnLetter(colIdx)
901
+ },
902
+ col.columnId
903
+ ))
904
+ ] }),
905
+ headerRows.map((row, rowIdx) => /* @__PURE__ */ jsxs(TableRow, { children: [
906
+ rowIdx === headerRows.length - 1 && hasCheckboxCol && /* @__PURE__ */ jsx(TableHeaderCell, { className: DataGridTable_module_default.selectionHeaderCellWrapper, children: /* @__PURE__ */ jsx("div", { className: DataGridTable_module_default.selectionHeaderCellInner, children: /* @__PURE__ */ jsx(
907
+ Checkbox,
908
+ {
909
+ checked: allSelected ? true : someSelected ? "mixed" : false,
910
+ onChange: (_, data) => handleSelectAll(!!data.checked),
911
+ "aria-label": "Select all rows"
912
+ }
913
+ ) }) }, "__selection__"),
914
+ rowIdx === 0 && rowIdx < headerRows.length - 1 && hasCheckboxCol && /* @__PURE__ */ jsx("th", { rowSpan: headerRows.length - 1 }, "__selection_placeholder__"),
915
+ rowIdx === headerRows.length - 1 && hasRowNumbersCol && /* @__PURE__ */ jsx(TableHeaderCell, { className: DataGridTable_module_default.rowNumberHeaderCellWrapper, children: /* @__PURE__ */ jsx("div", { className: DataGridTable_module_default.rowNumberHeaderCellInner, children: "#" }) }, "__row_number__"),
916
+ rowIdx === 0 && rowIdx < headerRows.length - 1 && hasRowNumbersCol && /* @__PURE__ */ jsx("th", { rowSpan: headerRows.length - 1 }, "__row_number_placeholder__"),
917
+ row.map((cell, cellIdx) => {
918
+ if (cell.isGroup) {
919
+ return /* @__PURE__ */ jsx("th", { colSpan: cell.colSpan, className: DataGridTable_module_default.groupHeaderCell, scope: "colgroup", children: cell.label }, cellIdx);
920
+ }
921
+ if (!cell.columnDef) return null;
922
+ const col = cell.columnDef;
923
+ const isSorted = props.sortBy === col.columnId;
924
+ const ariaSort = isSorted ? props.sortDirection === "asc" ? "ascending" : "descending" : void 0;
925
+ return /* @__PURE__ */ jsxs(
926
+ TableHeaderCell,
927
+ {
928
+ scope: "col",
929
+ "data-column-id": col.columnId,
930
+ className: columnMeta.hdrClasses[col.columnId] || void 0,
931
+ style: {
932
+ ...columnMeta.hdrStyles[col.columnId],
933
+ ...columnReorder ? { cursor: isReorderDragging ? "grabbing" : "grab" } : void 0
934
+ },
935
+ "aria-sort": ariaSort,
936
+ onMouseDown: columnReorder ? (e) => handleHeaderMouseDown(col.columnId, e) : void 0,
937
+ children: [
938
+ /* @__PURE__ */ jsxs("div", { className: DataGridTable_module_default.headerCellContent, children: [
939
+ /* @__PURE__ */ jsx(ColumnHeaderFilter, { ...getHeaderFilterConfig(col, headerFilterInput) }),
940
+ /* @__PURE__ */ jsx(
941
+ "button",
942
+ {
943
+ className: DataGridTable_module_default.headerMenuTrigger,
944
+ onClick: (e) => {
945
+ e.stopPropagation();
946
+ headerMenu.open(col.columnId, e.currentTarget);
947
+ },
948
+ "aria-label": "Column options",
949
+ title: "Column options",
950
+ children: "\u22EE"
951
+ }
952
+ )
953
+ ] }),
922
954
  /* @__PURE__ */ jsx(
923
- "button",
955
+ "div",
924
956
  {
925
- className: DataGridTable_module_default.headerMenuTrigger,
926
- onClick: (e) => {
927
- e.stopPropagation();
928
- headerMenu.open(col.columnId, e.currentTarget);
957
+ className: DataGridTable_module_default.resizeHandle,
958
+ role: "separator",
959
+ "aria-orientation": "vertical",
960
+ onMouseDown: (e) => {
961
+ setActiveCell(null);
962
+ interaction.setSelectionRange(null);
963
+ wrapperRef.current?.focus({ preventScroll: true });
964
+ handleResizeStart(e, col);
929
965
  },
930
- "aria-label": "Column options",
931
- title: "Column options",
932
- children: "\u22EE"
966
+ onDoubleClick: (e) => handleResizeDoubleClick(e, col),
967
+ "aria-label": `Resize ${col.name}`
933
968
  }
934
969
  )
935
- ] }),
936
- /* @__PURE__ */ jsx(
937
- "div",
938
- {
939
- className: DataGridTable_module_default.resizeHandle,
940
- role: "separator",
941
- "aria-orientation": "vertical",
942
- onMouseDown: (e) => {
943
- setActiveCell(null);
944
- interaction.setSelectionRange(null);
945
- wrapperRef.current?.focus({ preventScroll: true });
946
- handleResizeStart(e, col);
947
- },
948
- onDoubleClick: (e) => handleResizeDoubleClick(e, col),
949
- "aria-label": `Resize ${col.name}`
950
- }
951
- )
952
- ]
953
- },
954
- col.columnId
955
- );
956
- })
957
- ] }, rowIdx))
970
+ ]
971
+ },
972
+ col.columnId
973
+ );
974
+ })
975
+ ] }, rowIdx))
976
+ ]
958
977
  }
959
978
  ),
960
979
  !showEmptyInGrid && /* @__PURE__ */ jsx(
@@ -1001,6 +1020,14 @@ function DataGridTableInner(props) {
1001
1020
  isDragging
1002
1021
  }
1003
1022
  ),
1023
+ props.formulaReferences && props.formulaReferences.length > 0 && /* @__PURE__ */ jsx(
1024
+ FormulaRefOverlay,
1025
+ {
1026
+ containerRef: tableContainerRef,
1027
+ references: props.formulaReferences,
1028
+ colOffset
1029
+ }
1030
+ ),
1004
1031
  showEmptyInGrid && emptyState && /* @__PURE__ */ jsx(EmptyState, { emptyState })
1005
1032
  ] }) }) }),
1006
1033
  menuPosition && createPortal(
@@ -1023,28 +1050,7 @@ function DataGridTableInner(props) {
1023
1050
  ),
1024
1051
  wrapperRef.current?.closest(".fui-FluentProvider") ?? document.body
1025
1052
  ),
1026
- /* @__PURE__ */ jsx(
1027
- ColumnHeaderMenu,
1028
- {
1029
- isOpen: headerMenu.isOpen,
1030
- anchorElement: headerMenu.anchorElement,
1031
- onClose: headerMenu.close,
1032
- onPinLeft: headerMenu.handlePinLeft,
1033
- onPinRight: headerMenu.handlePinRight,
1034
- onUnpin: headerMenu.handleUnpin,
1035
- onSortAsc: headerMenu.handleSortAsc,
1036
- onSortDesc: headerMenu.handleSortDesc,
1037
- onClearSort: headerMenu.handleClearSort,
1038
- onAutosizeThis: headerMenu.handleAutosizeThis,
1039
- onAutosizeAll: headerMenu.handleAutosizeAll,
1040
- canPinLeft: headerMenu.canPinLeft,
1041
- canPinRight: headerMenu.canPinRight,
1042
- canUnpin: headerMenu.canUnpin,
1043
- currentSort: headerMenu.currentSort,
1044
- isSortable: headerMenu.isSortable,
1045
- isResizable: headerMenu.isResizable
1046
- }
1047
- )
1053
+ /* @__PURE__ */ jsx(ColumnHeaderMenu, { ...getColumnHeaderMenuProps(headerMenu) })
1048
1054
  ]
1049
1055
  }
1050
1056
  ),
@@ -1073,6 +1079,25 @@ var ColumnChooser_module_default = {
1073
1079
  "optionItem": "ogrid-fluent__ColumnChooser-module__optionItem",
1074
1080
  "actions": "ogrid-fluent__ColumnChooser-module__actions"
1075
1081
  };
1082
+ var CheckboxItem = ({ columnId, columnName, checked, disabled, onChange }) => /* @__PURE__ */ jsx(
1083
+ Checkbox,
1084
+ {
1085
+ id: `col-${columnId}`,
1086
+ label: columnName,
1087
+ checked,
1088
+ onChange: (_ev, data) => onChange(data.checked === true),
1089
+ disabled
1090
+ }
1091
+ );
1092
+ var Actions = ({ onClearAll, onSelectAll }) => /* @__PURE__ */ jsxs("div", { className: ColumnChooser_module_default.actions, children: [
1093
+ /* @__PURE__ */ jsx(Button, { appearance: "subtle", size: "small", onClick: onClearAll, children: "Clear All" }),
1094
+ /* @__PURE__ */ jsx(Button, { appearance: "primary", size: "small", onClick: onSelectAll, children: "Select All" })
1095
+ ] });
1096
+ var CLASS_NAMES = {
1097
+ header: ColumnChooser_module_default.header,
1098
+ optionsList: ColumnChooser_module_default.optionsList,
1099
+ optionItem: ColumnChooser_module_default.optionItem
1100
+ };
1076
1101
  var ColumnChooser = (props) => {
1077
1102
  const { columns, visibleColumns, onVisibilityChange, onSetVisibleColumns, className } = props;
1078
1103
  const buttonRef = useRef(null);
@@ -1103,9 +1128,7 @@ var ColumnChooser = (props) => {
1103
1128
  document.removeEventListener("mousedown", handleClickOutside);
1104
1129
  };
1105
1130
  }, [open, handleClose]);
1106
- const handleCheckboxChange = (columnKey) => (_ev, data) => {
1107
- setColumnVisible(columnKey)(data.checked === true);
1108
- };
1131
+ const handleCheckboxChange = (columnKey) => (checked) => setColumnVisible(columnKey)(checked);
1109
1132
  return /* @__PURE__ */ jsxs("div", { className: `${ColumnChooser_module_default.container} ${className || ""}`, children: [
1110
1133
  /* @__PURE__ */ jsxs(
1111
1134
  Button,
@@ -1126,28 +1149,21 @@ var ColumnChooser = (props) => {
1126
1149
  ]
1127
1150
  }
1128
1151
  ),
1129
- open && /* @__PURE__ */ jsxs("div", { ref: dropdownRef, className: ColumnChooser_module_default.dropdown, children: [
1130
- /* @__PURE__ */ jsxs("div", { className: ColumnChooser_module_default.header, children: [
1131
- "Select Columns (",
1152
+ open && /* @__PURE__ */ jsx("div", { ref: dropdownRef, className: ColumnChooser_module_default.dropdown, children: /* @__PURE__ */ jsx(
1153
+ ColumnChooserContent,
1154
+ {
1155
+ columns,
1156
+ visibleColumns,
1132
1157
  visibleCount,
1133
- " of ",
1134
1158
  totalCount,
1135
- ")"
1136
- ] }),
1137
- /* @__PURE__ */ jsx("div", { className: ColumnChooser_module_default.optionsList, children: columns.map((column) => /* @__PURE__ */ jsx("div", { className: ColumnChooser_module_default.optionItem, children: /* @__PURE__ */ jsx(
1138
- Checkbox,
1139
- {
1140
- label: column.name,
1141
- checked: visibleColumns.has(column.columnId),
1142
- onChange: handleCheckboxChange(column.columnId),
1143
- disabled: column.required === true
1144
- }
1145
- ) }, column.columnId)) }),
1146
- /* @__PURE__ */ jsxs("div", { className: ColumnChooser_module_default.actions, children: [
1147
- /* @__PURE__ */ jsx(Button, { appearance: "subtle", size: "small", onClick: handleClearAll, children: "Clear All" }),
1148
- /* @__PURE__ */ jsx(Button, { appearance: "primary", size: "small", onClick: handleSelectAll, children: "Select All" })
1149
- ] })
1150
- ] })
1159
+ handleSelectAll,
1160
+ handleClearAll,
1161
+ handleCheckboxChange,
1162
+ CheckboxItem,
1163
+ classNames: CLASS_NAMES,
1164
+ Actions
1165
+ }
1166
+ ) })
1151
1167
  ] });
1152
1168
  };
1153
1169
 
@@ -1164,71 +1180,57 @@ var PaginationControls_module_default = {
1164
1180
  "pageSizeLabel": "ogrid-fluent__PaginationControls-module__pageSizeLabel",
1165
1181
  "pageSizeSelect": "ogrid-fluent__PaginationControls-module__pageSizeSelect"
1166
1182
  };
1167
- var PaginationControls = React2.memo((props) => {
1168
- const { currentPage, pageSize, totalCount, onPageChange, onPageSizeChange, pageSizeOptions, entityLabelPlural, className } = props;
1169
- const { labelPlural, vm, handlePageSizeChange } = usePaginationControls({
1170
- currentPage,
1171
- pageSize,
1172
- totalCount,
1173
- onPageChange,
1174
- onPageSizeChange,
1175
- pageSizeOptions,
1176
- entityLabelPlural
1177
- });
1178
- const handlePageSizeChangeEvent = (_e, data) => {
1179
- handlePageSizeChange(Number(data.value));
1180
- };
1181
- if (!vm) {
1182
- return null;
1183
+ var FLUENT_NAV_ICONS = {
1184
+ first: /* @__PURE__ */ jsx(ChevronDoubleLeftRegular, {}),
1185
+ prev: /* @__PURE__ */ jsx(ChevronLeftRegular, {}),
1186
+ next: /* @__PURE__ */ jsx(ChevronRightRegular, {}),
1187
+ last: /* @__PURE__ */ jsx(ChevronDoubleRightRegular, {})
1188
+ };
1189
+ var NavButton = ({ variant, onClick, disabled, "aria-label": ariaLabel, className }) => /* @__PURE__ */ jsx(
1190
+ Button,
1191
+ {
1192
+ appearance: "outline",
1193
+ shape: "circular",
1194
+ size: "small",
1195
+ icon: FLUENT_NAV_ICONS[variant],
1196
+ onClick,
1197
+ disabled,
1198
+ "aria-label": ariaLabel,
1199
+ className
1183
1200
  }
1184
- const { pageNumbers, showStartEllipsis, showEndEllipsis, totalPages, startItem, endItem } = vm;
1185
- return /* @__PURE__ */ jsxs("div", { className: `${PaginationControls_module_default.pagination} ${className || ""}`, role: "navigation", "aria-label": "Pagination", children: [
1186
- /* @__PURE__ */ jsxs("div", { className: PaginationControls_module_default.paginationInfo, children: [
1187
- "Showing ",
1188
- startItem,
1189
- " to ",
1190
- endItem,
1191
- " of ",
1192
- totalCount.toLocaleString(),
1193
- " ",
1194
- labelPlural
1195
- ] }),
1196
- /* @__PURE__ */ jsxs("div", { className: PaginationControls_module_default.paginationControls, children: [
1197
- /* @__PURE__ */ jsx(Button, { appearance: "outline", shape: "circular", size: "small", icon: /* @__PURE__ */ jsx(ChevronDoubleLeftRegular, {}), onClick: () => onPageChange(1), disabled: currentPage === 1, "aria-label": "First page", className: PaginationControls_module_default.navBtn }),
1198
- /* @__PURE__ */ jsx(Button, { appearance: "outline", shape: "circular", size: "small", icon: /* @__PURE__ */ jsx(ChevronLeftRegular, {}), onClick: () => onPageChange(currentPage - 1), disabled: currentPage === 1, "aria-label": "Previous page", className: PaginationControls_module_default.navBtn }),
1199
- /* @__PURE__ */ jsxs("div", { className: PaginationControls_module_default.pageNumbers, children: [
1200
- showStartEllipsis && /* @__PURE__ */ jsxs(Fragment, { children: [
1201
- /* @__PURE__ */ jsx(Button, { appearance: "outline", size: "small", shape: "rounded", onClick: () => onPageChange(1), "aria-label": "Page 1", className: PaginationControls_module_default.pageBtn, children: "1" }),
1202
- /* @__PURE__ */ jsx("span", { className: PaginationControls_module_default.ellipsis, "aria-hidden": true, children: "\u2026" })
1203
- ] }),
1204
- pageNumbers.map((pageNum) => /* @__PURE__ */ jsx(
1205
- Button,
1206
- {
1207
- appearance: currentPage === pageNum ? "primary" : "outline",
1208
- size: "small",
1209
- shape: "rounded",
1210
- onClick: () => onPageChange(pageNum),
1211
- "aria-label": `Page ${pageNum}`,
1212
- "aria-current": currentPage === pageNum ? "page" : void 0,
1213
- className: PaginationControls_module_default.pageBtn,
1214
- children: pageNum
1215
- },
1216
- pageNum
1217
- )),
1218
- showEndEllipsis && /* @__PURE__ */ jsxs(Fragment, { children: [
1219
- /* @__PURE__ */ jsx("span", { className: PaginationControls_module_default.ellipsis, "aria-hidden": true, children: "\u2026" }),
1220
- /* @__PURE__ */ jsx(Button, { appearance: "outline", size: "small", shape: "rounded", onClick: () => onPageChange(totalPages), "aria-label": `Page ${totalPages}`, className: PaginationControls_module_default.pageBtn, children: totalPages })
1221
- ] })
1222
- ] }),
1223
- /* @__PURE__ */ jsx(Button, { appearance: "outline", shape: "circular", size: "small", icon: /* @__PURE__ */ jsx(ChevronRightRegular, {}), onClick: () => onPageChange(currentPage + 1), disabled: currentPage >= totalPages, "aria-label": "Next page", className: PaginationControls_module_default.navBtn }),
1224
- /* @__PURE__ */ jsx(Button, { appearance: "outline", shape: "circular", size: "small", icon: /* @__PURE__ */ jsx(ChevronDoubleRightRegular, {}), onClick: () => onPageChange(totalPages), disabled: currentPage >= totalPages, "aria-label": "Last page", className: PaginationControls_module_default.navBtn })
1225
- ] }),
1226
- /* @__PURE__ */ jsxs("div", { className: PaginationControls_module_default.pageSizeSelector, children: [
1227
- /* @__PURE__ */ jsx("span", { className: PaginationControls_module_default.pageSizeLabel, children: "Rows" }),
1228
- /* @__PURE__ */ jsx(Select, { value: String(pageSize), onChange: handlePageSizeChangeEvent, size: "small", appearance: "outline", "aria-label": "Rows per page", className: PaginationControls_module_default.pageSizeSelect, children: vm.pageSizeOptions.map((n) => /* @__PURE__ */ jsx("option", { value: n, children: n }, n)) })
1229
- ] })
1230
- ] });
1231
- });
1201
+ );
1202
+ var PageButton = ({ onClick, active, "aria-label": ariaLabel, "aria-current": ariaCurrent, children, className }) => /* @__PURE__ */ jsx(
1203
+ Button,
1204
+ {
1205
+ appearance: active ? "primary" : "outline",
1206
+ size: "small",
1207
+ shape: "rounded",
1208
+ onClick,
1209
+ "aria-label": ariaLabel,
1210
+ "aria-current": ariaCurrent,
1211
+ className,
1212
+ children
1213
+ }
1214
+ );
1215
+ var PageSizeSelect = ({ value, options, onChange, "aria-label": ariaLabel, className }) => {
1216
+ const handleChange = (_e, data) => onChange(Number(data.value));
1217
+ return /* @__PURE__ */ jsx(Select, { value: String(value), onChange: handleChange, size: "small", appearance: "outline", "aria-label": ariaLabel, className, children: options.map((n) => /* @__PURE__ */ jsx("option", { value: n, children: n }, n)) });
1218
+ };
1219
+ var SLOTS = { NavButton, PageButton, PageSizeSelect };
1220
+ var CLASS_NAMES2 = {
1221
+ pagination: PaginationControls_module_default.pagination,
1222
+ paginationInfo: PaginationControls_module_default.paginationInfo,
1223
+ paginationControls: PaginationControls_module_default.paginationControls,
1224
+ pageNumbers: PaginationControls_module_default.pageNumbers,
1225
+ ellipsis: PaginationControls_module_default.ellipsis,
1226
+ navBtn: PaginationControls_module_default.navBtn,
1227
+ pageBtn: PaginationControls_module_default.pageBtn,
1228
+ pageSizeSelector: PaginationControls_module_default.pageSizeSelector,
1229
+ pageSizeLabel: PaginationControls_module_default.pageSizeLabel,
1230
+ pageSizeSelect: PaginationControls_module_default.pageSizeSelect
1231
+ };
1232
+ var PaginationControls = React2.memo((props) => /* @__PURE__ */ jsx(PaginationControlsBase, { ...props, slots: SLOTS, classNames: CLASS_NAMES2 }));
1233
+ PaginationControls.displayName = "PaginationControls";
1232
1234
 
1233
1235
  // src/OGrid/OGrid.tsx
1234
1236
  var OGrid = createOGrid({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alaarab/ogrid-react-fluent",
3
- "version": "2.2.0",
3
+ "version": "2.4.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.2.0"
44
+ "@alaarab/ogrid-react": "2.4.0"
45
45
  },
46
46
  "peerDependencies": {
47
47
  "@fluentui/react-components": "^9.0.0",