@alaarab/ogrid-react-fluent 2.3.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.
- package/dist/esm/index.js +95 -112
- package/package.json +2 -2
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, 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
|
|
@@ -1020,6 +1020,14 @@ function DataGridTableInner(props) {
|
|
|
1020
1020
|
isDragging
|
|
1021
1021
|
}
|
|
1022
1022
|
),
|
|
1023
|
+
props.formulaReferences && props.formulaReferences.length > 0 && /* @__PURE__ */ jsx(
|
|
1024
|
+
FormulaRefOverlay,
|
|
1025
|
+
{
|
|
1026
|
+
containerRef: tableContainerRef,
|
|
1027
|
+
references: props.formulaReferences,
|
|
1028
|
+
colOffset
|
|
1029
|
+
}
|
|
1030
|
+
),
|
|
1023
1031
|
showEmptyInGrid && emptyState && /* @__PURE__ */ jsx(EmptyState, { emptyState })
|
|
1024
1032
|
] }) }) }),
|
|
1025
1033
|
menuPosition && createPortal(
|
|
@@ -1042,28 +1050,7 @@ function DataGridTableInner(props) {
|
|
|
1042
1050
|
),
|
|
1043
1051
|
wrapperRef.current?.closest(".fui-FluentProvider") ?? document.body
|
|
1044
1052
|
),
|
|
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
|
-
)
|
|
1053
|
+
/* @__PURE__ */ jsx(ColumnHeaderMenu, { ...getColumnHeaderMenuProps(headerMenu) })
|
|
1067
1054
|
]
|
|
1068
1055
|
}
|
|
1069
1056
|
),
|
|
@@ -1092,6 +1079,25 @@ var ColumnChooser_module_default = {
|
|
|
1092
1079
|
"optionItem": "ogrid-fluent__ColumnChooser-module__optionItem",
|
|
1093
1080
|
"actions": "ogrid-fluent__ColumnChooser-module__actions"
|
|
1094
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
|
+
};
|
|
1095
1101
|
var ColumnChooser = (props) => {
|
|
1096
1102
|
const { columns, visibleColumns, onVisibilityChange, onSetVisibleColumns, className } = props;
|
|
1097
1103
|
const buttonRef = useRef(null);
|
|
@@ -1122,9 +1128,7 @@ var ColumnChooser = (props) => {
|
|
|
1122
1128
|
document.removeEventListener("mousedown", handleClickOutside);
|
|
1123
1129
|
};
|
|
1124
1130
|
}, [open, handleClose]);
|
|
1125
|
-
const handleCheckboxChange = (columnKey) => (
|
|
1126
|
-
setColumnVisible(columnKey)(data.checked === true);
|
|
1127
|
-
};
|
|
1131
|
+
const handleCheckboxChange = (columnKey) => (checked) => setColumnVisible(columnKey)(checked);
|
|
1128
1132
|
return /* @__PURE__ */ jsxs("div", { className: `${ColumnChooser_module_default.container} ${className || ""}`, children: [
|
|
1129
1133
|
/* @__PURE__ */ jsxs(
|
|
1130
1134
|
Button,
|
|
@@ -1145,28 +1149,21 @@ var ColumnChooser = (props) => {
|
|
|
1145
1149
|
]
|
|
1146
1150
|
}
|
|
1147
1151
|
),
|
|
1148
|
-
open && /* @__PURE__ */
|
|
1149
|
-
|
|
1150
|
-
|
|
1152
|
+
open && /* @__PURE__ */ jsx("div", { ref: dropdownRef, className: ColumnChooser_module_default.dropdown, children: /* @__PURE__ */ jsx(
|
|
1153
|
+
ColumnChooserContent,
|
|
1154
|
+
{
|
|
1155
|
+
columns,
|
|
1156
|
+
visibleColumns,
|
|
1151
1157
|
visibleCount,
|
|
1152
|
-
" of ",
|
|
1153
1158
|
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
|
-
] })
|
|
1159
|
+
handleSelectAll,
|
|
1160
|
+
handleClearAll,
|
|
1161
|
+
handleCheckboxChange,
|
|
1162
|
+
CheckboxItem,
|
|
1163
|
+
classNames: CLASS_NAMES,
|
|
1164
|
+
Actions
|
|
1165
|
+
}
|
|
1166
|
+
) })
|
|
1170
1167
|
] });
|
|
1171
1168
|
};
|
|
1172
1169
|
|
|
@@ -1183,71 +1180,57 @@ var PaginationControls_module_default = {
|
|
|
1183
1180
|
"pageSizeLabel": "ogrid-fluent__PaginationControls-module__pageSizeLabel",
|
|
1184
1181
|
"pageSizeSelect": "ogrid-fluent__PaginationControls-module__pageSizeSelect"
|
|
1185
1182
|
};
|
|
1186
|
-
var
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
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
|
|
1202
1200
|
}
|
|
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
|
-
});
|
|
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";
|
|
1251
1234
|
|
|
1252
1235
|
// src/OGrid/OGrid.tsx
|
|
1253
1236
|
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.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.
|
|
44
|
+
"@alaarab/ogrid-react": "2.4.0"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
47
|
"@fluentui/react-components": "^9.0.0",
|