@alaarab/ogrid-react-fluent 2.3.0 → 2.4.1
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 +1 -6
- package/dist/esm/index.js +139 -123
- package/package.json +2 -2
package/dist/esm/index.css
CHANGED
|
@@ -1075,20 +1075,15 @@
|
|
|
1075
1075
|
text-align: center;
|
|
1076
1076
|
}
|
|
1077
1077
|
.ogrid-fluent__DataGridTable-module__dataTable .ogrid-fluent__DataGridTable-module__rowNumberHeaderCellWrapper {
|
|
1078
|
-
width: 50px;
|
|
1079
|
-
min-width: 50px;
|
|
1080
|
-
max-width: 50px;
|
|
1081
1078
|
padding: 4px 8px;
|
|
1082
1079
|
text-align: center;
|
|
1083
1080
|
background: var(--ogrid-header-bg, #f5f5f5);
|
|
1084
1081
|
font-weight: 600;
|
|
1085
1082
|
color: var(--colorNeutralForeground3, #666);
|
|
1086
1083
|
border-right: 1px solid var(--ogrid-border, rgba(0, 0, 0, 0.12));
|
|
1084
|
+
position: relative;
|
|
1087
1085
|
}
|
|
1088
1086
|
.ogrid-fluent__DataGridTable-module__dataTable .ogrid-fluent__DataGridTable-module__rowNumberCellWrapper {
|
|
1089
|
-
width: 50px;
|
|
1090
|
-
min-width: 50px;
|
|
1091
|
-
max-width: 50px;
|
|
1092
1087
|
padding: 4px 8px;
|
|
1093
1088
|
text-align: center;
|
|
1094
1089
|
background: var(--colorNeutralBackground3, #f5f5f5);
|
package/dist/esm/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import './index.css';
|
|
2
|
-
import { useColumnHeaderFilterState, getColumnHeaderFilterStateParams, DateFilterContent, renderFilterContent, areGridRowPropsEqual,
|
|
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, ROW_NUMBER_COLUMN_ID, ROW_NUMBER_COLUMN_WIDTH, 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,
|
|
8
|
-
import { FilterRegular,
|
|
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
|
|
@@ -557,7 +557,8 @@ function GridRowInner(props) {
|
|
|
557
557
|
rowNumberOffset,
|
|
558
558
|
leftSpacerWidth,
|
|
559
559
|
rightSpacerWidth,
|
|
560
|
-
globalColIndexMap
|
|
560
|
+
globalColIndexMap,
|
|
561
|
+
rowNumWidth
|
|
561
562
|
} = props;
|
|
562
563
|
return /* @__PURE__ */ jsxs(
|
|
563
564
|
TableRow,
|
|
@@ -586,7 +587,7 @@ function GridRowInner(props) {
|
|
|
586
587
|
)
|
|
587
588
|
}
|
|
588
589
|
) }),
|
|
589
|
-
hasRowNumbersCol && /* @__PURE__ */ jsx(TableCell, { className: DataGridTable_module_default.rowNumberCellWrapper, children: /* @__PURE__ */ jsx("div", { className: DataGridTable_module_default.rowNumberCellInner, children: rowNumberOffset + rowIndex + 1 }) }),
|
|
590
|
+
hasRowNumbersCol && /* @__PURE__ */ jsx(TableCell, { className: DataGridTable_module_default.rowNumberCellWrapper, style: rowNumWidth ? { width: rowNumWidth, minWidth: rowNumWidth, maxWidth: rowNumWidth } : void 0, children: /* @__PURE__ */ jsx("div", { className: DataGridTable_module_default.rowNumberCellInner, children: rowNumberOffset + rowIndex + 1 }) }),
|
|
590
591
|
leftSpacerWidth != null && leftSpacerWidth > 0 && /* @__PURE__ */ jsx("td", { style: { ...SPACER_TD_STYLE, width: leftSpacerWidth, minWidth: leftSpacerWidth }, "aria-hidden": true }),
|
|
591
592
|
visibleCols.map((col, colIdx) => {
|
|
592
593
|
const globalIdx = globalColIndexMap ? globalColIndexMap[colIdx] : colIdx;
|
|
@@ -630,7 +631,8 @@ function FluentTableBody(props) {
|
|
|
630
631
|
copyRange,
|
|
631
632
|
isDragging,
|
|
632
633
|
editingCell,
|
|
633
|
-
pinnedColumns
|
|
634
|
+
pinnedColumns,
|
|
635
|
+
rowNumWidth
|
|
634
636
|
} = props;
|
|
635
637
|
const partition = React2.useMemo(() => {
|
|
636
638
|
if (!columnRange) return null;
|
|
@@ -680,7 +682,8 @@ function FluentTableBody(props) {
|
|
|
680
682
|
editingRowId: editingCell?.rowId ?? null,
|
|
681
683
|
leftSpacerWidth,
|
|
682
684
|
rightSpacerWidth,
|
|
683
|
-
globalColIndexMap
|
|
685
|
+
globalColIndexMap,
|
|
686
|
+
rowNumWidth
|
|
684
687
|
},
|
|
685
688
|
rowIdStr
|
|
686
689
|
);
|
|
@@ -822,9 +825,14 @@ function DataGridTableInner(props) {
|
|
|
822
825
|
)
|
|
823
826
|
] });
|
|
824
827
|
} else {
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
+
let displayNode;
|
|
829
|
+
if (descriptor.columnType === "boolean") {
|
|
830
|
+
displayNode = /* @__PURE__ */ jsx("input", { type: "checkbox", checked: !!descriptor.displayValue, disabled: true, style: { margin: 0, pointerEvents: "none" }, "aria-label": descriptor.displayValue ? "True" : "False" });
|
|
831
|
+
} else {
|
|
832
|
+
const displayContent = resolveCellDisplayContent(col, item, descriptor.displayValue);
|
|
833
|
+
const cellStyle = resolveCellStyle(col, item, descriptor.displayValue);
|
|
834
|
+
displayNode = cellStyle ? /* @__PURE__ */ jsx("span", { style: cellStyle, children: displayContent }) : displayContent;
|
|
835
|
+
}
|
|
828
836
|
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}` : ""}`;
|
|
829
837
|
const interactionProps = getCellInteractionProps(descriptor, col.columnId, interactionHandlers);
|
|
830
838
|
content = /* @__PURE__ */ jsxs(
|
|
@@ -834,7 +842,7 @@ function DataGridTableInner(props) {
|
|
|
834
842
|
...interactionProps,
|
|
835
843
|
style: descriptor.canEditAny ? CURSOR_CELL_STYLE : void 0,
|
|
836
844
|
children: [
|
|
837
|
-
|
|
845
|
+
displayNode,
|
|
838
846
|
descriptor.canEditAny && descriptor.isSelectionEndCell && /* @__PURE__ */ jsx(
|
|
839
847
|
"div",
|
|
840
848
|
{
|
|
@@ -912,7 +920,27 @@ function DataGridTableInner(props) {
|
|
|
912
920
|
}
|
|
913
921
|
) }) }, "__selection__"),
|
|
914
922
|
rowIdx === 0 && rowIdx < headerRows.length - 1 && hasCheckboxCol && /* @__PURE__ */ jsx("th", { rowSpan: headerRows.length - 1 }, "__selection_placeholder__"),
|
|
915
|
-
rowIdx === headerRows.length - 1 && hasRowNumbersCol &&
|
|
923
|
+
rowIdx === headerRows.length - 1 && hasRowNumbersCol && (() => {
|
|
924
|
+
const rowNumW = columnSizingOverrides?.[ROW_NUMBER_COLUMN_ID]?.widthPx ?? ROW_NUMBER_COLUMN_WIDTH;
|
|
925
|
+
return /* @__PURE__ */ jsxs(TableHeaderCell, { className: DataGridTable_module_default.rowNumberHeaderCellWrapper, style: { width: rowNumW, minWidth: rowNumW, maxWidth: rowNumW }, children: [
|
|
926
|
+
/* @__PURE__ */ jsx("div", { className: DataGridTable_module_default.rowNumberHeaderCellInner, children: "#" }),
|
|
927
|
+
/* @__PURE__ */ jsx(
|
|
928
|
+
"div",
|
|
929
|
+
{
|
|
930
|
+
className: DataGridTable_module_default.resizeHandle,
|
|
931
|
+
role: "separator",
|
|
932
|
+
"aria-orientation": "vertical",
|
|
933
|
+
"aria-label": "Resize row number column",
|
|
934
|
+
onMouseDown: (e) => {
|
|
935
|
+
setActiveCell(null);
|
|
936
|
+
interaction.setSelectionRange(null);
|
|
937
|
+
wrapperRef.current?.focus({ preventScroll: true });
|
|
938
|
+
handleResizeStart(e, { columnId: ROW_NUMBER_COLUMN_ID, name: "#" });
|
|
939
|
+
}
|
|
940
|
+
}
|
|
941
|
+
)
|
|
942
|
+
] }, "__row_number__");
|
|
943
|
+
})(),
|
|
916
944
|
rowIdx === 0 && rowIdx < headerRows.length - 1 && hasRowNumbersCol && /* @__PURE__ */ jsx("th", { rowSpan: headerRows.length - 1 }, "__row_number_placeholder__"),
|
|
917
945
|
row.map((cell, cellIdx) => {
|
|
918
946
|
if (cell.isGroup) {
|
|
@@ -943,7 +971,11 @@ function DataGridTableInner(props) {
|
|
|
943
971
|
className: DataGridTable_module_default.headerMenuTrigger,
|
|
944
972
|
onClick: (e) => {
|
|
945
973
|
e.stopPropagation();
|
|
946
|
-
headerMenu.
|
|
974
|
+
if (headerMenu.isOpen && headerMenu.openForColumn === col.columnId) {
|
|
975
|
+
headerMenu.close();
|
|
976
|
+
} else {
|
|
977
|
+
headerMenu.open(col.columnId, e.currentTarget);
|
|
978
|
+
}
|
|
947
979
|
},
|
|
948
980
|
"aria-label": "Column options",
|
|
949
981
|
title: "Column options",
|
|
@@ -1000,7 +1032,8 @@ function DataGridTableInner(props) {
|
|
|
1000
1032
|
copyRange,
|
|
1001
1033
|
isDragging,
|
|
1002
1034
|
editingCell,
|
|
1003
|
-
pinnedColumns: pinning.pinnedColumns
|
|
1035
|
+
pinnedColumns: pinning.pinnedColumns,
|
|
1036
|
+
rowNumWidth: hasRowNumbersCol ? columnSizingOverrides?.[ROW_NUMBER_COLUMN_ID]?.widthPx ?? ROW_NUMBER_COLUMN_WIDTH : void 0
|
|
1004
1037
|
}
|
|
1005
1038
|
)
|
|
1006
1039
|
] }),
|
|
@@ -1020,6 +1053,14 @@ function DataGridTableInner(props) {
|
|
|
1020
1053
|
isDragging
|
|
1021
1054
|
}
|
|
1022
1055
|
),
|
|
1056
|
+
props.formulaReferences && props.formulaReferences.length > 0 && /* @__PURE__ */ jsx(
|
|
1057
|
+
FormulaRefOverlay,
|
|
1058
|
+
{
|
|
1059
|
+
containerRef: tableContainerRef,
|
|
1060
|
+
references: props.formulaReferences,
|
|
1061
|
+
colOffset
|
|
1062
|
+
}
|
|
1063
|
+
),
|
|
1023
1064
|
showEmptyInGrid && emptyState && /* @__PURE__ */ jsx(EmptyState, { emptyState })
|
|
1024
1065
|
] }) }) }),
|
|
1025
1066
|
menuPosition && createPortal(
|
|
@@ -1042,28 +1083,7 @@ function DataGridTableInner(props) {
|
|
|
1042
1083
|
),
|
|
1043
1084
|
wrapperRef.current?.closest(".fui-FluentProvider") ?? document.body
|
|
1044
1085
|
),
|
|
1045
|
-
/* @__PURE__ */ jsx(
|
|
1046
|
-
ColumnHeaderMenu,
|
|
1047
|
-
{
|
|
1048
|
-
isOpen: headerMenu.isOpen,
|
|
1049
|
-
anchorElement: headerMenu.anchorElement,
|
|
1050
|
-
onClose: headerMenu.close,
|
|
1051
|
-
onPinLeft: headerMenu.handlePinLeft,
|
|
1052
|
-
onPinRight: headerMenu.handlePinRight,
|
|
1053
|
-
onUnpin: headerMenu.handleUnpin,
|
|
1054
|
-
onSortAsc: headerMenu.handleSortAsc,
|
|
1055
|
-
onSortDesc: headerMenu.handleSortDesc,
|
|
1056
|
-
onClearSort: headerMenu.handleClearSort,
|
|
1057
|
-
onAutosizeThis: headerMenu.handleAutosizeThis,
|
|
1058
|
-
onAutosizeAll: headerMenu.handleAutosizeAll,
|
|
1059
|
-
canPinLeft: headerMenu.canPinLeft,
|
|
1060
|
-
canPinRight: headerMenu.canPinRight,
|
|
1061
|
-
canUnpin: headerMenu.canUnpin,
|
|
1062
|
-
currentSort: headerMenu.currentSort,
|
|
1063
|
-
isSortable: headerMenu.isSortable,
|
|
1064
|
-
isResizable: headerMenu.isResizable
|
|
1065
|
-
}
|
|
1066
|
-
)
|
|
1086
|
+
/* @__PURE__ */ jsx(ColumnHeaderMenu, { ...getColumnHeaderMenuProps(headerMenu) })
|
|
1067
1087
|
]
|
|
1068
1088
|
}
|
|
1069
1089
|
),
|
|
@@ -1092,6 +1112,25 @@ var ColumnChooser_module_default = {
|
|
|
1092
1112
|
"optionItem": "ogrid-fluent__ColumnChooser-module__optionItem",
|
|
1093
1113
|
"actions": "ogrid-fluent__ColumnChooser-module__actions"
|
|
1094
1114
|
};
|
|
1115
|
+
var CheckboxItem = ({ columnId, columnName, checked, disabled, onChange }) => /* @__PURE__ */ jsx(
|
|
1116
|
+
Checkbox,
|
|
1117
|
+
{
|
|
1118
|
+
id: `col-${columnId}`,
|
|
1119
|
+
label: columnName,
|
|
1120
|
+
checked,
|
|
1121
|
+
onChange: (_ev, data) => onChange(data.checked === true),
|
|
1122
|
+
disabled
|
|
1123
|
+
}
|
|
1124
|
+
);
|
|
1125
|
+
var Actions = ({ onClearAll, onSelectAll }) => /* @__PURE__ */ jsxs("div", { className: ColumnChooser_module_default.actions, children: [
|
|
1126
|
+
/* @__PURE__ */ jsx(Button, { appearance: "subtle", size: "small", onClick: onClearAll, children: "Clear All" }),
|
|
1127
|
+
/* @__PURE__ */ jsx(Button, { appearance: "primary", size: "small", onClick: onSelectAll, children: "Select All" })
|
|
1128
|
+
] });
|
|
1129
|
+
var CLASS_NAMES = {
|
|
1130
|
+
header: ColumnChooser_module_default.header,
|
|
1131
|
+
optionsList: ColumnChooser_module_default.optionsList,
|
|
1132
|
+
optionItem: ColumnChooser_module_default.optionItem
|
|
1133
|
+
};
|
|
1095
1134
|
var ColumnChooser = (props) => {
|
|
1096
1135
|
const { columns, visibleColumns, onVisibilityChange, onSetVisibleColumns, className } = props;
|
|
1097
1136
|
const buttonRef = useRef(null);
|
|
@@ -1122,9 +1161,7 @@ var ColumnChooser = (props) => {
|
|
|
1122
1161
|
document.removeEventListener("mousedown", handleClickOutside);
|
|
1123
1162
|
};
|
|
1124
1163
|
}, [open, handleClose]);
|
|
1125
|
-
const handleCheckboxChange = (columnKey) => (
|
|
1126
|
-
setColumnVisible(columnKey)(data.checked === true);
|
|
1127
|
-
};
|
|
1164
|
+
const handleCheckboxChange = (columnKey) => (checked) => setColumnVisible(columnKey)(checked);
|
|
1128
1165
|
return /* @__PURE__ */ jsxs("div", { className: `${ColumnChooser_module_default.container} ${className || ""}`, children: [
|
|
1129
1166
|
/* @__PURE__ */ jsxs(
|
|
1130
1167
|
Button,
|
|
@@ -1145,28 +1182,21 @@ var ColumnChooser = (props) => {
|
|
|
1145
1182
|
]
|
|
1146
1183
|
}
|
|
1147
1184
|
),
|
|
1148
|
-
open && /* @__PURE__ */
|
|
1149
|
-
|
|
1150
|
-
|
|
1185
|
+
open && /* @__PURE__ */ jsx("div", { ref: dropdownRef, className: ColumnChooser_module_default.dropdown, children: /* @__PURE__ */ jsx(
|
|
1186
|
+
ColumnChooserContent,
|
|
1187
|
+
{
|
|
1188
|
+
columns,
|
|
1189
|
+
visibleColumns,
|
|
1151
1190
|
visibleCount,
|
|
1152
|
-
" of ",
|
|
1153
1191
|
totalCount,
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
disabled: column.required === true
|
|
1163
|
-
}
|
|
1164
|
-
) }, column.columnId)) }),
|
|
1165
|
-
/* @__PURE__ */ jsxs("div", { className: ColumnChooser_module_default.actions, children: [
|
|
1166
|
-
/* @__PURE__ */ jsx(Button, { appearance: "subtle", size: "small", onClick: handleClearAll, children: "Clear All" }),
|
|
1167
|
-
/* @__PURE__ */ jsx(Button, { appearance: "primary", size: "small", onClick: handleSelectAll, children: "Select All" })
|
|
1168
|
-
] })
|
|
1169
|
-
] })
|
|
1192
|
+
handleSelectAll,
|
|
1193
|
+
handleClearAll,
|
|
1194
|
+
handleCheckboxChange,
|
|
1195
|
+
CheckboxItem,
|
|
1196
|
+
classNames: CLASS_NAMES,
|
|
1197
|
+
Actions
|
|
1198
|
+
}
|
|
1199
|
+
) })
|
|
1170
1200
|
] });
|
|
1171
1201
|
};
|
|
1172
1202
|
|
|
@@ -1183,71 +1213,57 @@ var PaginationControls_module_default = {
|
|
|
1183
1213
|
"pageSizeLabel": "ogrid-fluent__PaginationControls-module__pageSizeLabel",
|
|
1184
1214
|
"pageSizeSelect": "ogrid-fluent__PaginationControls-module__pageSizeSelect"
|
|
1185
1215
|
};
|
|
1186
|
-
var
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1216
|
+
var FLUENT_NAV_ICONS = {
|
|
1217
|
+
first: /* @__PURE__ */ jsx(ChevronDoubleLeftRegular, {}),
|
|
1218
|
+
prev: /* @__PURE__ */ jsx(ChevronLeftRegular, {}),
|
|
1219
|
+
next: /* @__PURE__ */ jsx(ChevronRightRegular, {}),
|
|
1220
|
+
last: /* @__PURE__ */ jsx(ChevronDoubleRightRegular, {})
|
|
1221
|
+
};
|
|
1222
|
+
var NavButton = ({ variant, onClick, disabled, "aria-label": ariaLabel, className }) => /* @__PURE__ */ jsx(
|
|
1223
|
+
Button,
|
|
1224
|
+
{
|
|
1225
|
+
appearance: "outline",
|
|
1226
|
+
shape: "circular",
|
|
1227
|
+
size: "small",
|
|
1228
|
+
icon: FLUENT_NAV_ICONS[variant],
|
|
1229
|
+
onClick,
|
|
1230
|
+
disabled,
|
|
1231
|
+
"aria-label": ariaLabel,
|
|
1232
|
+
className
|
|
1202
1233
|
}
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
)),
|
|
1237
|
-
showEndEllipsis && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1238
|
-
/* @__PURE__ */ jsx("span", { className: PaginationControls_module_default.ellipsis, "aria-hidden": true, children: "\u2026" }),
|
|
1239
|
-
/* @__PURE__ */ jsx(Button, { appearance: "outline", size: "small", shape: "rounded", onClick: () => onPageChange(totalPages), "aria-label": `Page ${totalPages}`, className: PaginationControls_module_default.pageBtn, children: totalPages })
|
|
1240
|
-
] })
|
|
1241
|
-
] }),
|
|
1242
|
-
/* @__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 }),
|
|
1243
|
-
/* @__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 })
|
|
1244
|
-
] }),
|
|
1245
|
-
/* @__PURE__ */ jsxs("div", { className: PaginationControls_module_default.pageSizeSelector, children: [
|
|
1246
|
-
/* @__PURE__ */ jsx("span", { className: PaginationControls_module_default.pageSizeLabel, children: "Rows" }),
|
|
1247
|
-
/* @__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)) })
|
|
1248
|
-
] })
|
|
1249
|
-
] });
|
|
1250
|
-
});
|
|
1234
|
+
);
|
|
1235
|
+
var PageButton = ({ onClick, active, "aria-label": ariaLabel, "aria-current": ariaCurrent, children, className }) => /* @__PURE__ */ jsx(
|
|
1236
|
+
Button,
|
|
1237
|
+
{
|
|
1238
|
+
appearance: active ? "primary" : "outline",
|
|
1239
|
+
size: "small",
|
|
1240
|
+
shape: "rounded",
|
|
1241
|
+
onClick,
|
|
1242
|
+
"aria-label": ariaLabel,
|
|
1243
|
+
"aria-current": ariaCurrent,
|
|
1244
|
+
className,
|
|
1245
|
+
children
|
|
1246
|
+
}
|
|
1247
|
+
);
|
|
1248
|
+
var PageSizeSelect = ({ value, options, onChange, "aria-label": ariaLabel, className }) => {
|
|
1249
|
+
const handleChange = (_e, data) => onChange(Number(data.value));
|
|
1250
|
+
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)) });
|
|
1251
|
+
};
|
|
1252
|
+
var SLOTS = { NavButton, PageButton, PageSizeSelect };
|
|
1253
|
+
var CLASS_NAMES2 = {
|
|
1254
|
+
pagination: PaginationControls_module_default.pagination,
|
|
1255
|
+
paginationInfo: PaginationControls_module_default.paginationInfo,
|
|
1256
|
+
paginationControls: PaginationControls_module_default.paginationControls,
|
|
1257
|
+
pageNumbers: PaginationControls_module_default.pageNumbers,
|
|
1258
|
+
ellipsis: PaginationControls_module_default.ellipsis,
|
|
1259
|
+
navBtn: PaginationControls_module_default.navBtn,
|
|
1260
|
+
pageBtn: PaginationControls_module_default.pageBtn,
|
|
1261
|
+
pageSizeSelector: PaginationControls_module_default.pageSizeSelector,
|
|
1262
|
+
pageSizeLabel: PaginationControls_module_default.pageSizeLabel,
|
|
1263
|
+
pageSizeSelect: PaginationControls_module_default.pageSizeSelect
|
|
1264
|
+
};
|
|
1265
|
+
var PaginationControls = React2.memo((props) => /* @__PURE__ */ jsx(PaginationControlsBase, { ...props, slots: SLOTS, classNames: CLASS_NAMES2 }));
|
|
1266
|
+
PaginationControls.displayName = "PaginationControls";
|
|
1251
1267
|
|
|
1252
1268
|
// src/OGrid/OGrid.tsx
|
|
1253
1269
|
var OGrid = createOGrid({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alaarab/ogrid-react-fluent",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.1",
|
|
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.
|
|
44
|
+
"@alaarab/ogrid-react": "2.4.1"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
47
|
"@fluentui/react-components": "^9.0.0",
|