@alaarab/ogrid-react-fluent 2.1.3 → 2.1.5

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.
Files changed (28) hide show
  1. package/dist/esm/index.css +1278 -0
  2. package/dist/esm/index.js +1166 -11
  3. package/dist/types/OGrid/OGrid.d.ts +1 -1
  4. package/dist/types/index.d.ts +40 -1
  5. package/package.json +4 -4
  6. package/dist/esm/ColumnChooser/ColumnChooser.js +0 -34
  7. package/dist/esm/ColumnChooser/ColumnChooser.module.css +0 -50
  8. package/dist/esm/ColumnHeaderFilter/ColumnHeaderFilter.js +0 -30
  9. package/dist/esm/ColumnHeaderFilter/ColumnHeaderFilter.module.css +0 -412
  10. package/dist/esm/ColumnHeaderFilter/MultiSelectFilterPopover.js +0 -17
  11. package/dist/esm/ColumnHeaderFilter/PeopleFilterPopover.js +0 -18
  12. package/dist/esm/ColumnHeaderFilter/TextFilterPopover.js +0 -11
  13. package/dist/esm/ColumnHeaderFilter/index.js +0 -1
  14. package/dist/esm/ColumnHeaderMenu/ColumnHeaderMenu.js +0 -12
  15. package/dist/esm/ColumnHeaderMenu/ColumnHeaderMenu.module.css +0 -46
  16. package/dist/esm/ColumnHeaderMenu/index.js +0 -1
  17. package/dist/esm/DataGridTable/DataGridTable.js +0 -116
  18. package/dist/esm/DataGridTable/DataGridTable.module.css +0 -845
  19. package/dist/esm/DataGridTable/DropIndicator.js +0 -6
  20. package/dist/esm/DataGridTable/EmptyState.js +0 -14
  21. package/dist/esm/DataGridTable/GridContextMenu.js +0 -13
  22. package/dist/esm/DataGridTable/InlineCellEditor.js +0 -6
  23. package/dist/esm/DataGridTable/LoadingOverlay.js +0 -12
  24. package/dist/esm/DataGridTable/StatusBar.js +0 -12
  25. package/dist/esm/OGrid/OGrid.js +0 -9
  26. package/dist/esm/OGrid/index.js +0 -1
  27. package/dist/esm/PaginationControls/PaginationControls.js +0 -26
  28. package/dist/esm/PaginationControls/PaginationControls.module.css +0 -74
package/dist/esm/index.js CHANGED
@@ -1,11 +1,1166 @@
1
- // Components
2
- export { OGrid } from './OGrid';
3
- export { DataGridTable } from './DataGridTable/DataGridTable';
4
- export { ColumnChooser } from './ColumnChooser/ColumnChooser';
5
- export { ColumnHeaderFilter } from './ColumnHeaderFilter/ColumnHeaderFilter';
6
- export { ColumnHeaderMenu } from './ColumnHeaderMenu/ColumnHeaderMenu';
7
- export { PaginationControls } from './PaginationControls/PaginationControls';
8
- // Re-export all from base package for consumer convenience.
9
- // Note: This prevents tree-shaking of unused utilities.
10
- // Consider explicit named exports in a future major version.
11
- export * from '@alaarab/ogrid-react';
1
+ 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
+ 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';
3
+ import * as React from 'react';
4
+ import { useCallback, useRef, useEffect } from 'react';
5
+ import { createPortal } from 'react-dom';
6
+ import { Popover, PopoverSurface, Button, Select, TableRow, TableCell, Checkbox, Table, TableHeader, TableHeaderCell, TableBody } from '@fluentui/react-components';
7
+ import { FilterRegular, ChevronDoubleLeftRegular, ChevronLeftRegular, ChevronRightRegular, ChevronDoubleRightRegular, SearchRegular, ChevronUpRegular, ChevronDownRegular, TableSettingsRegular } from '@fluentui/react-icons';
8
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
9
+
10
+ // src/OGrid/OGrid.tsx
11
+
12
+ // src/ColumnHeaderFilter/ColumnHeaderFilter.module.scss
13
+ var ColumnHeaderFilter_module_default = {
14
+ columnHeader: "ColumnHeaderFilter_module_columnHeader",
15
+ headerContent: "ColumnHeaderFilter_module_headerContent",
16
+ columnName: "ColumnHeaderFilter_module_columnName",
17
+ headerActions: "ColumnHeaderFilter_module_headerActions",
18
+ filterIcon: "ColumnHeaderFilter_module_filterIcon",
19
+ filterActive: "ColumnHeaderFilter_module_filterActive",
20
+ filterOpen: "ColumnHeaderFilter_module_filterOpen",
21
+ filterBadge: "ColumnHeaderFilter_module_filterBadge",
22
+ filterPopover: "ColumnHeaderFilter_module_filterPopover",
23
+ popoverHeader: "ColumnHeaderFilter_module_popoverHeader",
24
+ popoverSearch: "ColumnHeaderFilter_module_popoverSearch",
25
+ nativeInputWrapper: "ColumnHeaderFilter_module_nativeInputWrapper",
26
+ nativeInputIcon: "ColumnHeaderFilter_module_nativeInputIcon",
27
+ nativeInput: "ColumnHeaderFilter_module_nativeInput",
28
+ resultCount: "ColumnHeaderFilter_module_resultCount",
29
+ selectAllRow: "ColumnHeaderFilter_module_selectAllRow",
30
+ selectAllButton: "ColumnHeaderFilter_module_selectAllButton",
31
+ popoverOptions: "ColumnHeaderFilter_module_popoverOptions",
32
+ popoverOption: "ColumnHeaderFilter_module_popoverOption",
33
+ nativeCheckbox: "ColumnHeaderFilter_module_nativeCheckbox",
34
+ checkboxLabel: "ColumnHeaderFilter_module_checkboxLabel",
35
+ personOption: "ColumnHeaderFilter_module_personOption",
36
+ loadingContainer: "ColumnHeaderFilter_module_loadingContainer",
37
+ filterSpinner: "ColumnHeaderFilter_module_filterSpinner",
38
+ noResults: "ColumnHeaderFilter_module_noResults",
39
+ selectedUserSection: "ColumnHeaderFilter_module_selectedUserSection",
40
+ selectedUserLabel: "ColumnHeaderFilter_module_selectedUserLabel",
41
+ selectedUser: "ColumnHeaderFilter_module_selectedUser",
42
+ userInfo: "ColumnHeaderFilter_module_userInfo",
43
+ avatar: "ColumnHeaderFilter_module_avatar",
44
+ avatarImg: "ColumnHeaderFilter_module_avatarImg",
45
+ avatarInitials: "ColumnHeaderFilter_module_avatarInitials",
46
+ userText: "ColumnHeaderFilter_module_userText",
47
+ userSecondary: "ColumnHeaderFilter_module_userSecondary",
48
+ removeUserButton: "ColumnHeaderFilter_module_removeUserButton",
49
+ popoverActions: "ColumnHeaderFilter_module_popoverActions",
50
+ clearButton: "ColumnHeaderFilter_module_clearButton",
51
+ applyButton: "ColumnHeaderFilter_module_applyButton"
52
+ };
53
+ var TextFilterPopover = ({
54
+ value,
55
+ onValueChange,
56
+ onApply,
57
+ onClear,
58
+ onPopoverClick,
59
+ onInputFocus,
60
+ onInputMouseDown,
61
+ onInputClick,
62
+ onInputKeyDown
63
+ }) => /* @__PURE__ */ jsxs(Fragment, { children: [
64
+ /* @__PURE__ */ jsx("div", { className: ColumnHeaderFilter_module_default.popoverSearch, onClick: onPopoverClick, children: /* @__PURE__ */ jsxs("div", { className: ColumnHeaderFilter_module_default.nativeInputWrapper, children: [
65
+ /* @__PURE__ */ jsx(SearchRegular, { className: ColumnHeaderFilter_module_default.nativeInputIcon }),
66
+ /* @__PURE__ */ jsx(
67
+ "input",
68
+ {
69
+ type: "text",
70
+ placeholder: "Enter search term...",
71
+ value,
72
+ onChange: (e) => onValueChange(e.target.value),
73
+ onKeyDown: (e) => {
74
+ onInputKeyDown(e);
75
+ if (e.key === "Enter") {
76
+ e.preventDefault();
77
+ onApply();
78
+ }
79
+ },
80
+ onFocus: onInputFocus,
81
+ onMouseDown: onInputMouseDown,
82
+ onClick: onInputClick,
83
+ autoComplete: "off",
84
+ className: ColumnHeaderFilter_module_default.nativeInput
85
+ }
86
+ )
87
+ ] }) }),
88
+ /* @__PURE__ */ jsxs("div", { className: ColumnHeaderFilter_module_default.popoverActions, onClick: onPopoverClick, children: [
89
+ /* @__PURE__ */ jsx("button", { type: "button", className: ColumnHeaderFilter_module_default.clearButton, onClick: onClear, disabled: !value, children: "Clear" }),
90
+ /* @__PURE__ */ jsx("button", { type: "button", className: ColumnHeaderFilter_module_default.applyButton, onClick: onApply, children: "Apply" })
91
+ ] })
92
+ ] });
93
+ TextFilterPopover.displayName = "TextFilterPopover";
94
+ var ITEM_HEIGHT = 40;
95
+ var MultiSelectFilterPopover = ({
96
+ searchText,
97
+ onSearchChange,
98
+ options,
99
+ filteredOptions,
100
+ selected,
101
+ onOptionToggle,
102
+ onSelectAll,
103
+ onClearSelection,
104
+ onApply,
105
+ isLoading,
106
+ onPopoverClick,
107
+ onInputFocus,
108
+ onInputMouseDown,
109
+ onInputClick,
110
+ onInputKeyDown
111
+ }) => {
112
+ const virt = useListVirtualizer({ count: filteredOptions.length, itemHeight: ITEM_HEIGHT });
113
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
114
+ /* @__PURE__ */ jsxs("div", { className: ColumnHeaderFilter_module_default.popoverSearch, onClick: onPopoverClick, children: [
115
+ /* @__PURE__ */ jsxs("div", { className: ColumnHeaderFilter_module_default.nativeInputWrapper, children: [
116
+ /* @__PURE__ */ jsx(SearchRegular, { className: ColumnHeaderFilter_module_default.nativeInputIcon }),
117
+ /* @__PURE__ */ jsx(
118
+ "input",
119
+ {
120
+ type: "text",
121
+ placeholder: "Search...",
122
+ value: searchText,
123
+ onChange: (e) => onSearchChange(e.target.value),
124
+ onFocus: onInputFocus,
125
+ onMouseDown: onInputMouseDown,
126
+ onClick: onInputClick,
127
+ onKeyDown: onInputKeyDown,
128
+ autoComplete: "off",
129
+ className: ColumnHeaderFilter_module_default.nativeInput
130
+ }
131
+ )
132
+ ] }),
133
+ /* @__PURE__ */ jsxs("div", { className: ColumnHeaderFilter_module_default.resultCount, children: [
134
+ filteredOptions.length,
135
+ " of ",
136
+ options.length,
137
+ " options"
138
+ ] })
139
+ ] }),
140
+ /* @__PURE__ */ jsxs("div", { className: ColumnHeaderFilter_module_default.selectAllRow, onClick: onPopoverClick, children: [
141
+ /* @__PURE__ */ jsxs("button", { type: "button", className: ColumnHeaderFilter_module_default.selectAllButton, onClick: onSelectAll, children: [
142
+ "Select All (",
143
+ filteredOptions.length,
144
+ ")"
145
+ ] }),
146
+ /* @__PURE__ */ jsx("button", { type: "button", className: ColumnHeaderFilter_module_default.selectAllButton, onClick: onClearSelection, children: "Clear" })
147
+ ] }),
148
+ /* @__PURE__ */ jsx(
149
+ "div",
150
+ {
151
+ ref: virt.containerRef,
152
+ onScroll: virt.onScroll,
153
+ className: ColumnHeaderFilter_module_default.popoverOptions,
154
+ onClick: onPopoverClick,
155
+ children: isLoading ? /* @__PURE__ */ jsxs("div", { className: ColumnHeaderFilter_module_default.loadingContainer, children: [
156
+ /* @__PURE__ */ jsx("div", { className: ColumnHeaderFilter_module_default.filterSpinner }),
157
+ /* @__PURE__ */ jsx("span", { style: { fontSize: 12, color: "var(--colorNeutralForeground2, #616161)" }, children: "Loading..." })
158
+ ] }) : filteredOptions.length === 0 ? /* @__PURE__ */ jsx("div", { className: ColumnHeaderFilter_module_default.noResults, children: "No options found" }) : /* @__PURE__ */ jsx("div", { style: { height: virt.totalHeight, position: "relative" }, children: virt.visibleItems.map(({ index, offsetTop }) => {
159
+ const option = filteredOptions[index];
160
+ const isChecked = selected.has(option);
161
+ return /* @__PURE__ */ jsxs(
162
+ "label",
163
+ {
164
+ className: ColumnHeaderFilter_module_default.popoverOption,
165
+ style: { position: "absolute", top: offsetTop, width: "100%", height: ITEM_HEIGHT, boxSizing: "border-box", display: "flex", alignItems: "center" },
166
+ children: [
167
+ /* @__PURE__ */ jsx(
168
+ "input",
169
+ {
170
+ type: "checkbox",
171
+ checked: isChecked,
172
+ onChange: (ev) => {
173
+ ev.stopPropagation();
174
+ onOptionToggle(option, ev.target.checked);
175
+ },
176
+ className: ColumnHeaderFilter_module_default.nativeCheckbox
177
+ }
178
+ ),
179
+ /* @__PURE__ */ jsx("span", { className: ColumnHeaderFilter_module_default.checkboxLabel, children: option })
180
+ ]
181
+ },
182
+ option
183
+ );
184
+ }) })
185
+ }
186
+ ),
187
+ /* @__PURE__ */ jsxs("div", { className: ColumnHeaderFilter_module_default.popoverActions, onClick: onPopoverClick, children: [
188
+ /* @__PURE__ */ jsx("button", { type: "button", className: ColumnHeaderFilter_module_default.clearButton, onClick: onClearSelection, children: "Clear" }),
189
+ /* @__PURE__ */ jsx("button", { type: "button", className: ColumnHeaderFilter_module_default.applyButton, onClick: onApply, children: "Apply" })
190
+ ] })
191
+ ] });
192
+ };
193
+ MultiSelectFilterPopover.displayName = "MultiSelectFilterPopover";
194
+ function getInitials(name) {
195
+ const parts = name.trim().split(/\s+/);
196
+ if (parts.length >= 2) return (parts[0][0] + parts[parts.length - 1][0]).toUpperCase();
197
+ return (parts[0]?.[0] ?? "").toUpperCase();
198
+ }
199
+ var PeopleFilterPopover = ({
200
+ selectedUser,
201
+ searchText,
202
+ onSearchChange,
203
+ suggestions,
204
+ isLoading,
205
+ onUserSelect,
206
+ onClearUser,
207
+ onPopoverClick,
208
+ inputRef
209
+ }) => /* @__PURE__ */ jsxs(Fragment, { children: [
210
+ selectedUser && /* @__PURE__ */ jsxs("div", { className: ColumnHeaderFilter_module_default.selectedUserSection, onClick: onPopoverClick, children: [
211
+ /* @__PURE__ */ jsx("div", { className: ColumnHeaderFilter_module_default.selectedUserLabel, children: "Currently filtered by:" }),
212
+ /* @__PURE__ */ jsxs("div", { className: ColumnHeaderFilter_module_default.selectedUser, children: [
213
+ /* @__PURE__ */ jsxs("div", { className: ColumnHeaderFilter_module_default.userInfo, children: [
214
+ /* @__PURE__ */ jsx("div", { className: ColumnHeaderFilter_module_default.avatar, children: selectedUser.photo ? /* @__PURE__ */ jsx("img", { src: selectedUser.photo, alt: "", className: ColumnHeaderFilter_module_default.avatarImg }) : /* @__PURE__ */ jsx("span", { className: ColumnHeaderFilter_module_default.avatarInitials, children: getInitials(selectedUser.displayName) }) }),
215
+ /* @__PURE__ */ jsxs("div", { className: ColumnHeaderFilter_module_default.userText, children: [
216
+ /* @__PURE__ */ jsx("div", { children: selectedUser.displayName }),
217
+ /* @__PURE__ */ jsx("div", { className: ColumnHeaderFilter_module_default.userSecondary, children: selectedUser.email })
218
+ ] })
219
+ ] }),
220
+ /* @__PURE__ */ jsx("button", { type: "button", className: ColumnHeaderFilter_module_default.removeUserButton, onClick: onClearUser, "aria-label": "Remove filter", children: /* @__PURE__ */ jsx(FilterRegular, {}) })
221
+ ] })
222
+ ] }),
223
+ /* @__PURE__ */ jsx("div", { className: ColumnHeaderFilter_module_default.popoverSearch, onClick: onPopoverClick, children: /* @__PURE__ */ jsxs("div", { className: ColumnHeaderFilter_module_default.nativeInputWrapper, children: [
224
+ /* @__PURE__ */ jsx(SearchRegular, { className: ColumnHeaderFilter_module_default.nativeInputIcon }),
225
+ /* @__PURE__ */ jsx(
226
+ "input",
227
+ {
228
+ ref: inputRef,
229
+ type: "text",
230
+ placeholder: "Search for a person...",
231
+ value: searchText,
232
+ onChange: (e) => onSearchChange(e.target.value),
233
+ onFocus: (e) => e.stopPropagation(),
234
+ onMouseDown: (e) => e.stopPropagation(),
235
+ onClick: (e) => e.stopPropagation(),
236
+ onKeyDown: (e) => e.stopPropagation(),
237
+ autoComplete: "off",
238
+ className: ColumnHeaderFilter_module_default.nativeInput
239
+ }
240
+ )
241
+ ] }) }),
242
+ /* @__PURE__ */ jsx("div", { className: ColumnHeaderFilter_module_default.popoverOptions, onClick: onPopoverClick, children: isLoading && searchText.trim() ? /* @__PURE__ */ jsxs("div", { className: ColumnHeaderFilter_module_default.loadingContainer, children: [
243
+ /* @__PURE__ */ jsx("div", { className: ColumnHeaderFilter_module_default.filterSpinner }),
244
+ /* @__PURE__ */ jsx("span", { style: { fontSize: 12, color: "var(--colorNeutralForeground2, #616161)" }, children: "Searching..." })
245
+ ] }) : suggestions.length === 0 && searchText.trim() ? /* @__PURE__ */ jsx("div", { className: ColumnHeaderFilter_module_default.noResults, children: "No results found" }) : searchText.trim() ? suggestions.map((user) => /* @__PURE__ */ jsx(
246
+ "div",
247
+ {
248
+ className: ColumnHeaderFilter_module_default.personOption,
249
+ onClick: (e) => {
250
+ e.stopPropagation();
251
+ onUserSelect(user);
252
+ },
253
+ children: /* @__PURE__ */ jsxs("div", { className: ColumnHeaderFilter_module_default.userInfo, children: [
254
+ /* @__PURE__ */ jsx("div", { className: ColumnHeaderFilter_module_default.avatar, children: user.photo ? /* @__PURE__ */ jsx("img", { src: user.photo, alt: "", className: ColumnHeaderFilter_module_default.avatarImg }) : /* @__PURE__ */ jsx("span", { className: ColumnHeaderFilter_module_default.avatarInitials, children: getInitials(user.displayName) }) }),
255
+ /* @__PURE__ */ jsxs("div", { className: ColumnHeaderFilter_module_default.userText, children: [
256
+ /* @__PURE__ */ jsx("div", { children: user.displayName }),
257
+ /* @__PURE__ */ jsx("div", { className: ColumnHeaderFilter_module_default.userSecondary, children: user.email })
258
+ ] })
259
+ ] })
260
+ },
261
+ user.id ?? user.email ?? user.displayName
262
+ )) : /* @__PURE__ */ jsx("div", { className: ColumnHeaderFilter_module_default.noResults, children: "Type to search..." }) }),
263
+ 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" }) })
264
+ ] });
265
+ PeopleFilterPopover.displayName = "PeopleFilterPopover";
266
+ var ColumnHeaderFilter = React.memo((props) => {
267
+ const {
268
+ columnName,
269
+ filterType,
270
+ options,
271
+ isLoadingOptions = false,
272
+ selectedUser
273
+ } = props;
274
+ const state = useColumnHeaderFilterState(getColumnHeaderFilterStateParams(props));
275
+ const {
276
+ headerRef,
277
+ popoverRef,
278
+ isFilterOpen,
279
+ setFilterOpen,
280
+ hasActiveFilter,
281
+ handlers
282
+ } = state;
283
+ const {
284
+ handlePopoverClick,
285
+ handleInputFocus,
286
+ handleInputMouseDown,
287
+ handleInputClick,
288
+ handleInputKeyDown
289
+ } = handlers;
290
+ const filterBtnRef = React.useRef(null);
291
+ const fluentRenderers = React.useMemo(() => ({
292
+ renderMultiSelect: (p) => /* @__PURE__ */ jsx(
293
+ MultiSelectFilterPopover,
294
+ {
295
+ searchText: p.searchText,
296
+ onSearchChange: p.onSearchChange,
297
+ options: p.options,
298
+ filteredOptions: p.filteredOptions,
299
+ selected: p.selected,
300
+ onOptionToggle: p.onOptionToggle,
301
+ onSelectAll: p.onSelectAll,
302
+ onClearSelection: p.onClearSelection,
303
+ onApply: p.onApply,
304
+ isLoading: p.isLoading,
305
+ onPopoverClick: handlePopoverClick,
306
+ onInputFocus: handleInputFocus,
307
+ onInputMouseDown: handleInputMouseDown,
308
+ onInputClick: handleInputClick,
309
+ onInputKeyDown: handleInputKeyDown
310
+ }
311
+ ),
312
+ renderText: (p) => /* @__PURE__ */ jsx(
313
+ TextFilterPopover,
314
+ {
315
+ value: p.value,
316
+ onValueChange: p.onValueChange,
317
+ onApply: p.onApply,
318
+ onClear: p.onClear,
319
+ onPopoverClick: handlePopoverClick,
320
+ onInputFocus: handleInputFocus,
321
+ onInputMouseDown: handleInputMouseDown,
322
+ onInputClick: handleInputClick,
323
+ onInputKeyDown: handleInputKeyDown
324
+ }
325
+ ),
326
+ renderPeople: (p) => /* @__PURE__ */ jsx(
327
+ PeopleFilterPopover,
328
+ {
329
+ selectedUser: p.selectedUser,
330
+ searchText: p.searchText,
331
+ onSearchChange: p.onSearchChange,
332
+ suggestions: p.suggestions,
333
+ isLoading: p.isLoading,
334
+ onUserSelect: p.onUserSelect,
335
+ onClearUser: p.onClearUser,
336
+ onPopoverClick: handlePopoverClick,
337
+ inputRef: p.inputRef
338
+ }
339
+ ),
340
+ renderDate: (p) => /* @__PURE__ */ jsx("div", { onClick: handlePopoverClick, children: /* @__PURE__ */ jsx(
341
+ DateFilterContent,
342
+ {
343
+ tempDateFrom: p.tempDateFrom,
344
+ setTempDateFrom: p.setTempDateFrom,
345
+ tempDateTo: p.tempDateTo,
346
+ setTempDateTo: p.setTempDateTo,
347
+ onApply: p.onApply,
348
+ onClear: p.onClear,
349
+ classNames: {
350
+ popoverActions: ColumnHeaderFilter_module_default.popoverActions,
351
+ clearButton: ColumnHeaderFilter_module_default.clearButton,
352
+ applyButton: ColumnHeaderFilter_module_default.applyButton
353
+ }
354
+ }
355
+ ) })
356
+ }), [handlePopoverClick, handleInputFocus, handleInputMouseDown, handleInputClick, handleInputKeyDown]);
357
+ return /* @__PURE__ */ jsxs("div", { className: ColumnHeaderFilter_module_default.columnHeader, ref: headerRef, children: [
358
+ /* @__PURE__ */ jsx("div", { className: ColumnHeaderFilter_module_default.headerContent, children: /* @__PURE__ */ jsx("span", { className: ColumnHeaderFilter_module_default.columnName, title: columnName, "data-header-label": true, children: columnName }) }),
359
+ /* @__PURE__ */ jsx("div", { className: ColumnHeaderFilter_module_default.headerActions, children: filterType !== "none" && /* @__PURE__ */ jsxs(Fragment, { children: [
360
+ /* @__PURE__ */ jsxs(
361
+ "button",
362
+ {
363
+ ref: filterBtnRef,
364
+ type: "button",
365
+ className: `${ColumnHeaderFilter_module_default.filterIcon} ${hasActiveFilter ? ColumnHeaderFilter_module_default.filterActive : ""} ${isFilterOpen ? ColumnHeaderFilter_module_default.filterOpen : ""}`,
366
+ onClick: handlers.handleFilterIconClick,
367
+ "aria-label": `Filter ${columnName}`,
368
+ title: `Filter ${columnName}`,
369
+ children: [
370
+ /* @__PURE__ */ jsx(FilterRegular, {}),
371
+ hasActiveFilter && /* @__PURE__ */ jsx("span", { className: ColumnHeaderFilter_module_default.filterBadge })
372
+ ]
373
+ }
374
+ ),
375
+ /* @__PURE__ */ jsx(
376
+ Popover,
377
+ {
378
+ open: isFilterOpen,
379
+ onOpenChange: (_, data) => {
380
+ if (!data.open) setFilterOpen(false);
381
+ },
382
+ positioning: { target: filterBtnRef.current ?? void 0, position: "below", align: "start", offset: 4 },
383
+ trapFocus: false,
384
+ children: /* @__PURE__ */ jsxs(
385
+ PopoverSurface,
386
+ {
387
+ ref: popoverRef,
388
+ className: ColumnHeaderFilter_module_default.filterPopover,
389
+ onClick: handlers.handlePopoverClick,
390
+ style: { padding: 0 },
391
+ children: [
392
+ /* @__PURE__ */ jsxs("div", { className: ColumnHeaderFilter_module_default.popoverHeader, children: [
393
+ "Filter: ",
394
+ columnName
395
+ ] }),
396
+ renderFilterContent(filterType, state, options ?? [], isLoadingOptions, selectedUser, fluentRenderers)
397
+ ]
398
+ }
399
+ )
400
+ }
401
+ )
402
+ ] }) })
403
+ ] });
404
+ });
405
+ ColumnHeaderFilter.displayName = "ColumnHeaderFilter";
406
+
407
+ // src/ColumnHeaderMenu/ColumnHeaderMenu.module.scss
408
+ var ColumnHeaderMenu_module_default = {
409
+ content: "ColumnHeaderMenu_module_content",
410
+ item: "ColumnHeaderMenu_module_item",
411
+ separator: "ColumnHeaderMenu_module_separator"
412
+ };
413
+ var getFluentPortalTarget = (anchorElement) => anchorElement.closest(".fui-FluentProvider") ?? document.body;
414
+ function ColumnHeaderMenu(props) {
415
+ return /* @__PURE__ */ jsx(
416
+ BaseColumnHeaderMenu,
417
+ {
418
+ ...props,
419
+ classNames: ColumnHeaderMenu_module_default,
420
+ getPortalTarget: getFluentPortalTarget
421
+ }
422
+ );
423
+ }
424
+ function InlineCellEditor(props) {
425
+ return /* @__PURE__ */ jsx(
426
+ BaseInlineCellEditor,
427
+ {
428
+ ...props,
429
+ renderCheckbox: (checked, onCommit, onCancel) => /* @__PURE__ */ jsx(
430
+ Checkbox,
431
+ {
432
+ checked,
433
+ onChange: (_, data) => onCommit(!!data.checked),
434
+ onKeyDown: (e) => e.key === "Escape" && (e.preventDefault(), onCancel())
435
+ }
436
+ )
437
+ }
438
+ );
439
+ }
440
+
441
+ // src/DataGridTable/DataGridTable.module.scss
442
+ var DataGridTable_module_default = {
443
+ tableScrollContent: "DataGridTable_module_tableScrollContent",
444
+ tableWidthAnchor: "DataGridTable_module_tableWidthAnchor",
445
+ tableWrapper: "DataGridTable_module_tableWrapper",
446
+ dataTable: "DataGridTable_module_dataTable",
447
+ groupHeaderCell: "DataGridTable_module_groupHeaderCell",
448
+ headerCellContent: "DataGridTable_module_headerCellContent",
449
+ headerMenuTrigger: "DataGridTable_module_headerMenuTrigger",
450
+ dropIndicator: "DataGridTable_module_dropIndicator",
451
+ resizeHandle: "DataGridTable_module_resizeHandle",
452
+ pinnedColLeft: "DataGridTable_module_pinnedColLeft",
453
+ pinnedColRight: "DataGridTable_module_pinnedColRight",
454
+ cellContent: "DataGridTable_module_cellContent",
455
+ activeCellContent: "DataGridTable_module_activeCellContent",
456
+ editingCellContent: "DataGridTable_module_editingCellContent",
457
+ cellInRange: "DataGridTable_module_cellInRange",
458
+ cellCut: "DataGridTable_module_cellCut",
459
+ fillHandle: "DataGridTable_module_fillHandle",
460
+ selectionHeaderCellInner: "DataGridTable_module_selectionHeaderCellInner",
461
+ selectionCellInner: "DataGridTable_module_selectionCellInner",
462
+ rowNumberHeaderCellInner: "DataGridTable_module_rowNumberHeaderCellInner",
463
+ rowNumberCellInner: "DataGridTable_module_rowNumberCellInner",
464
+ statusBar: "DataGridTable_module_statusBar",
465
+ statusBarItem: "DataGridTable_module_statusBarItem",
466
+ statusBarLabel: "DataGridTable_module_statusBarLabel",
467
+ statusBarValue: "DataGridTable_module_statusBarValue",
468
+ contextMenu: "DataGridTable_module_contextMenu",
469
+ contextMenuItem: "DataGridTable_module_contextMenuItem",
470
+ contextMenuItemLabel: "DataGridTable_module_contextMenuItemLabel",
471
+ contextMenuItemShortcut: "DataGridTable_module_contextMenuItemShortcut",
472
+ contextMenuDivider: "DataGridTable_module_contextMenuDivider",
473
+ loadingOverlay: "DataGridTable_module_loadingOverlay",
474
+ loadingOverlayContent: "DataGridTable_module_loadingOverlayContent",
475
+ loadingOverlayText: "DataGridTable_module_loadingOverlayText",
476
+ loadingDimmed: "DataGridTable_module_loadingDimmed",
477
+ emptyStateInGrid: "DataGridTable_module_emptyStateInGrid",
478
+ emptyStateInGridTitle: "DataGridTable_module_emptyStateInGridTitle",
479
+ emptyStateInGridMessage: "DataGridTable_module_emptyStateInGridMessage",
480
+ emptyStateInGridLink: "DataGridTable_module_emptyStateInGridLink",
481
+ spinner: "DataGridTable_module_spinner",
482
+ "ogrid-spin": "DataGridTable_module_ogrid-spin",
483
+ leafHeaderCellSpan: "DataGridTable_module_leafHeaderCellSpan",
484
+ selectionHeaderCellWrapper: "DataGridTable_module_selectionHeaderCellWrapper",
485
+ selectionCellWrapper: "DataGridTable_module_selectionCellWrapper",
486
+ rowNumberHeaderCellWrapper: "DataGridTable_module_rowNumberHeaderCellWrapper",
487
+ rowNumberCellWrapper: "DataGridTable_module_rowNumberCellWrapper",
488
+ selectedRow: "DataGridTable_module_selectedRow",
489
+ selectableGrid: "DataGridTable_module_selectableGrid",
490
+ stickyHeader: "DataGridTable_module_stickyHeader",
491
+ emptyStateInGridMessageSticky: "DataGridTable_module_emptyStateInGridMessageSticky",
492
+ emptyStateInGridIcon: "DataGridTable_module_emptyStateInGridIcon",
493
+ "density-compact": "DataGridTable_module_density-compact",
494
+ "density-comfortable": "DataGridTable_module_density-comfortable"
495
+ };
496
+ var statusBarClassNames = {
497
+ statusBar: DataGridTable_module_default.statusBar,
498
+ statusBarItem: DataGridTable_module_default.statusBarItem,
499
+ statusBarLabel: DataGridTable_module_default.statusBarLabel,
500
+ statusBarValue: DataGridTable_module_default.statusBarValue
501
+ };
502
+ function StatusBar(props) {
503
+ return /* @__PURE__ */ jsx(StatusBar$1, { ...props, classNames: statusBarClassNames });
504
+ }
505
+ var classNames = {
506
+ contextMenu: DataGridTable_module_default.contextMenu,
507
+ contextMenuItem: DataGridTable_module_default.contextMenuItem,
508
+ contextMenuItemLabel: DataGridTable_module_default.contextMenuItemLabel,
509
+ contextMenuItemShortcut: DataGridTable_module_default.contextMenuItemShortcut,
510
+ contextMenuDivider: DataGridTable_module_default.contextMenuDivider
511
+ };
512
+ function GridContextMenu(props) {
513
+ return /* @__PURE__ */ jsx(GridContextMenu$1, { ...props, classNames });
514
+ }
515
+ var classNames2 = {
516
+ emptyStateInGrid: DataGridTable_module_default.emptyStateInGrid,
517
+ emptyStateInGridInner: DataGridTable_module_default.emptyStateInGridMessageSticky,
518
+ emptyStateInGridIcon: DataGridTable_module_default.emptyStateInGridIcon,
519
+ emptyStateInGridTitle: DataGridTable_module_default.emptyStateInGridTitle,
520
+ emptyStateInGridMessage: DataGridTable_module_default.emptyStateInGridMessage,
521
+ emptyStateInGridLink: DataGridTable_module_default.emptyStateInGridLink
522
+ };
523
+ function EmptyState({ emptyState }) {
524
+ return /* @__PURE__ */ jsx(BaseEmptyState, { emptyState, classNames: classNames2, icon: "\u{1F4CB}" });
525
+ }
526
+ var classNames3 = {
527
+ loadingOverlay: DataGridTable_module_default.loadingOverlay,
528
+ loadingOverlayContent: DataGridTable_module_default.loadingOverlayContent,
529
+ spinner: DataGridTable_module_default.spinner,
530
+ loadingOverlayText: DataGridTable_module_default.loadingOverlayText
531
+ };
532
+ function LoadingOverlay({ message }) {
533
+ return /* @__PURE__ */ jsx(BaseLoadingOverlay, { message, classNames: classNames3 });
534
+ }
535
+ function DropIndicator({ dropIndicatorX, wrapperLeft }) {
536
+ return /* @__PURE__ */ jsx(BaseDropIndicator, { dropIndicatorX, wrapperLeft, className: DataGridTable_module_default.dropIndicator });
537
+ }
538
+ function GridRowInner(props) {
539
+ const {
540
+ item,
541
+ rowIndex,
542
+ rowId,
543
+ isSelected,
544
+ visibleCols,
545
+ columnMeta,
546
+ renderCellContent,
547
+ handleSingleRowClick,
548
+ handleRowCheckboxChange,
549
+ lastMouseShiftRef,
550
+ hasCheckboxCol,
551
+ hasRowNumbersCol,
552
+ rowNumberOffset
553
+ } = props;
554
+ return /* @__PURE__ */ jsxs(
555
+ TableRow,
556
+ {
557
+ className: isSelected ? DataGridTable_module_default.selectedRow : void 0,
558
+ "data-row-id": rowId,
559
+ onClick: handleSingleRowClick,
560
+ children: [
561
+ hasCheckboxCol && /* @__PURE__ */ jsx(TableCell, { className: DataGridTable_module_default.selectionCellWrapper, children: /* @__PURE__ */ jsx(
562
+ "div",
563
+ {
564
+ className: DataGridTable_module_default.selectionCellInner,
565
+ "data-row-index": rowIndex,
566
+ "data-col-index": 0,
567
+ onClick: STOP_PROPAGATION,
568
+ children: /* @__PURE__ */ jsx(
569
+ Checkbox,
570
+ {
571
+ checked: isSelected,
572
+ onChange: (e, data) => {
573
+ handleRowCheckboxChange(rowId, !!data.checked, rowIndex, lastMouseShiftRef.current);
574
+ },
575
+ "aria-label": `Select row ${rowIndex + 1}`
576
+ }
577
+ )
578
+ }
579
+ ) }),
580
+ hasRowNumbersCol && /* @__PURE__ */ jsx(TableCell, { className: DataGridTable_module_default.rowNumberCellWrapper, children: /* @__PURE__ */ jsx("div", { className: DataGridTable_module_default.rowNumberCellInner, children: rowNumberOffset + rowIndex + 1 }) }),
581
+ visibleCols.map((col, colIdx) => /* @__PURE__ */ jsx(
582
+ TableCell,
583
+ {
584
+ "data-column-id": col.columnId,
585
+ className: columnMeta.cellClasses[col.columnId] || void 0,
586
+ style: columnMeta.cellStyles[col.columnId],
587
+ children: renderCellContent(item, col, rowIndex, colIdx)
588
+ },
589
+ col.columnId
590
+ ))
591
+ ]
592
+ }
593
+ );
594
+ }
595
+ var GridRow = React.memo(GridRowInner, areGridRowPropsEqual);
596
+ function DataGridTableInner(props) {
597
+ const o = useDataGridTableOrchestration({ props });
598
+ const {
599
+ wrapperRef,
600
+ tableContainerRef,
601
+ lastMouseShiftRef,
602
+ interaction,
603
+ pinning,
604
+ handleResizeStart,
605
+ getColumnWidth,
606
+ isReorderDragging,
607
+ dropIndicatorX,
608
+ handleHeaderMouseDown,
609
+ virtualScrollEnabled,
610
+ visibleRange,
611
+ items,
612
+ getRowId,
613
+ emptyState,
614
+ rowSelection,
615
+ isLoading,
616
+ loadingMessage,
617
+ ariaLabel,
618
+ ariaLabelledBy,
619
+ visibleColumns,
620
+ columnOrder,
621
+ columnReorder,
622
+ density,
623
+ rowHeight,
624
+ rowNumberOffset,
625
+ headerRows,
626
+ allowOverflowX,
627
+ fitToContent,
628
+ editCallbacks,
629
+ interactionHandlers,
630
+ cellDescriptorInputRef,
631
+ pendingEditorValueRef,
632
+ popoverAnchorElRef,
633
+ handleSingleRowClick,
634
+ handlePasteVoid,
635
+ visibleCols,
636
+ totalColCount,
637
+ hasCheckboxCol,
638
+ hasRowNumbersCol,
639
+ colOffset,
640
+ containerWidth,
641
+ minTableWidth,
642
+ columnSizingOverrides,
643
+ measuredColumnWidths,
644
+ selectedRowIds,
645
+ handleRowCheckboxChange,
646
+ handleSelectAll,
647
+ allSelected,
648
+ someSelected,
649
+ editingCell,
650
+ setPopoverAnchorEl,
651
+ cancelPopoverEdit,
652
+ setActiveCell,
653
+ selectionRange,
654
+ hasCellSelection,
655
+ handleGridKeyDown,
656
+ handleFillHandleMouseDown,
657
+ handleCopy,
658
+ handleCut,
659
+ cutRange,
660
+ copyRange,
661
+ canUndo,
662
+ canRedo,
663
+ onUndo,
664
+ onRedo,
665
+ isDragging,
666
+ menuPosition,
667
+ closeContextMenu,
668
+ headerFilterInput,
669
+ statusBarConfig,
670
+ showEmptyInGrid,
671
+ onCellError,
672
+ headerMenu
673
+ } = o;
674
+ const columnMeta = useColumnMeta({
675
+ visibleCols,
676
+ getColumnWidth,
677
+ columnSizingOverrides,
678
+ measuredColumnWidths,
679
+ pinnedColumns: pinning.pinnedColumns,
680
+ leftOffsets: pinning.leftOffsets,
681
+ rightOffsets: pinning.rightOffsets,
682
+ pinnedColLeftClass: DataGridTable_module_default.pinnedColLeft,
683
+ pinnedColRightClass: DataGridTable_module_default.pinnedColRight,
684
+ addStickyPosition: true
685
+ });
686
+ const renderCellContent = useCallback(
687
+ (item, col, rowIndex, colIdx) => {
688
+ const descriptor = getCellRenderDescriptor(item, col, rowIndex, colIdx, cellDescriptorInputRef.current);
689
+ const rowId = getRowId(item);
690
+ let content;
691
+ if (descriptor.mode === "editing-inline") {
692
+ content = /* @__PURE__ */ jsx("div", { className: DataGridTable_module_default.editingCellContent, children: /* @__PURE__ */ jsx(InlineCellEditor, { ...buildInlineEditorProps(item, col, descriptor, editCallbacks) }) });
693
+ } else if (descriptor.mode === "editing-popover" && typeof col.cellEditor === "function") {
694
+ const editorProps = buildPopoverEditorProps(item, col, descriptor, pendingEditorValueRef.current, editCallbacks);
695
+ const CustomEditor = col.cellEditor;
696
+ content = /* @__PURE__ */ jsxs(Fragment, { children: [
697
+ /* @__PURE__ */ jsx(
698
+ "div",
699
+ {
700
+ ref: (el) => {
701
+ if (el) setPopoverAnchorEl(el);
702
+ },
703
+ style: POPOVER_ANCHOR_STYLE,
704
+ "aria-hidden": true
705
+ }
706
+ ),
707
+ /* @__PURE__ */ jsx(
708
+ Popover,
709
+ {
710
+ open: !!popoverAnchorElRef.current,
711
+ onOpenChange: (_, data) => {
712
+ if (!data.open) cancelPopoverEdit();
713
+ },
714
+ positioning: { target: popoverAnchorElRef.current ?? void 0 },
715
+ children: /* @__PURE__ */ jsx(PopoverSurface, { children: /* @__PURE__ */ jsx(CustomEditor, { ...editorProps }) })
716
+ }
717
+ )
718
+ ] });
719
+ } else {
720
+ const displayContent = resolveCellDisplayContent(col, item, descriptor.displayValue);
721
+ const cellStyle = resolveCellStyle(col, item);
722
+ const styledContent = cellStyle ? /* @__PURE__ */ jsx("span", { style: cellStyle, children: displayContent }) : displayContent;
723
+ const cellClassNames = `${DataGridTable_module_default.cellContent}${descriptor.isActive && !descriptor.isInRange ? ` ${DataGridTable_module_default.activeCellContent}` : ""}${descriptor.isInRange ? ` ${DataGridTable_module_default.cellInRange}` : ""}${descriptor.isInCutRange ? ` ${DataGridTable_module_default.cellCut}` : ""}${descriptor.isInCopyRange ? ` ${DataGridTable_module_default.cellCopied}` : ""}`;
724
+ const interactionProps = getCellInteractionProps(descriptor, col.columnId, interactionHandlers);
725
+ content = /* @__PURE__ */ jsxs(
726
+ "div",
727
+ {
728
+ className: cellClassNames,
729
+ ...interactionProps,
730
+ style: descriptor.canEditAny ? CURSOR_CELL_STYLE : void 0,
731
+ children: [
732
+ styledContent,
733
+ descriptor.canEditAny && descriptor.isSelectionEndCell && /* @__PURE__ */ jsx(
734
+ "div",
735
+ {
736
+ className: DataGridTable_module_default.fillHandle,
737
+ onMouseDown: handleFillHandleMouseDown,
738
+ "aria-label": "Fill handle"
739
+ }
740
+ )
741
+ ]
742
+ }
743
+ );
744
+ }
745
+ return /* @__PURE__ */ jsx(CellErrorBoundary, { onError: onCellError, children: content }, `${rowId}-${col.columnId}`);
746
+ },
747
+ [editCallbacks, interactionHandlers, handleFillHandleMouseDown, setPopoverAnchorEl, cancelPopoverEdit, getRowId, onCellError, cellDescriptorInputRef, pendingEditorValueRef, popoverAnchorElRef]
748
+ );
749
+ return /* @__PURE__ */ jsxs("div", { style: GRID_ROOT_STYLE, children: [
750
+ /* @__PURE__ */ jsxs(
751
+ "div",
752
+ {
753
+ ref: wrapperRef,
754
+ tabIndex: 0,
755
+ onMouseDown: (e) => {
756
+ lastMouseShiftRef.current = e.shiftKey;
757
+ },
758
+ className: `${DataGridTable_module_default.tableWrapper} ${rowSelection !== "none" ? DataGridTable_module_default.selectableGrid : ""} ${DataGridTable_module_default[`density-${density}`] || ""}`,
759
+ role: "region",
760
+ "aria-label": ariaLabel ?? (ariaLabelledBy ? void 0 : "Data grid"),
761
+ "aria-labelledby": ariaLabelledBy,
762
+ "data-empty": showEmptyInGrid ? "true" : void 0,
763
+ "data-loading": isLoading && items.length === 0 ? "true" : void 0,
764
+ "data-column-count": totalColCount,
765
+ "data-overflow-x": allowOverflowX ? "true" : "false",
766
+ "data-container-width": containerWidth,
767
+ "data-min-table-width": Math.round(minTableWidth),
768
+ "data-has-selection": rowSelection !== "none" ? "true" : void 0,
769
+ onContextMenu: PREVENT_DEFAULT,
770
+ onKeyDown: handleGridKeyDown,
771
+ style: {
772
+ ["--data-table-column-count"]: totalColCount,
773
+ ["--data-table-width"]: showEmptyInGrid ? "100%" : allowOverflowX ? "fit-content" : fitToContent ? "fit-content" : "100%",
774
+ ["--data-table-min-width"]: showEmptyInGrid ? "100%" : allowOverflowX ? "max-content" : fitToContent ? "max-content" : "100%",
775
+ ["--data-table-total-min-width"]: `${minTableWidth}px`,
776
+ ...rowHeight ? { ["--ogrid-row-height"]: `${rowHeight}px` } : {}
777
+ },
778
+ children: [
779
+ /* @__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: [
780
+ /* @__PURE__ */ jsxs(Table, { role: "grid", className: DataGridTable_module_default.dataTable, children: [
781
+ /* @__PURE__ */ jsx(
782
+ TableHeader,
783
+ {
784
+ className: o.stickyHeader ? DataGridTable_module_default.stickyHeader : void 0,
785
+ children: headerRows.map((row, rowIdx) => /* @__PURE__ */ jsxs(TableRow, { children: [
786
+ 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(
787
+ Checkbox,
788
+ {
789
+ checked: allSelected ? true : someSelected ? "mixed" : false,
790
+ onChange: (_, data) => handleSelectAll(!!data.checked),
791
+ "aria-label": "Select all rows"
792
+ }
793
+ ) }) }, "__selection__"),
794
+ rowIdx === 0 && rowIdx < headerRows.length - 1 && hasCheckboxCol && /* @__PURE__ */ jsx("th", { rowSpan: headerRows.length - 1 }, "__selection_placeholder__"),
795
+ 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__"),
796
+ rowIdx === 0 && rowIdx < headerRows.length - 1 && hasRowNumbersCol && /* @__PURE__ */ jsx("th", { rowSpan: headerRows.length - 1 }, "__row_number_placeholder__"),
797
+ row.map((cell, cellIdx) => {
798
+ if (cell.isGroup) {
799
+ return /* @__PURE__ */ jsx("th", { colSpan: cell.colSpan, className: DataGridTable_module_default.groupHeaderCell, scope: "colgroup", children: cell.label }, cellIdx);
800
+ }
801
+ if (!cell.columnDef) return null;
802
+ const col = cell.columnDef;
803
+ const isSorted = props.sortBy === col.columnId;
804
+ const ariaSort = isSorted ? props.sortDirection === "asc" ? "ascending" : "descending" : void 0;
805
+ return /* @__PURE__ */ jsxs(
806
+ TableHeaderCell,
807
+ {
808
+ "data-column-id": col.columnId,
809
+ className: columnMeta.hdrClasses[col.columnId] || void 0,
810
+ style: {
811
+ ...columnMeta.hdrStyles[col.columnId],
812
+ ...columnReorder ? { cursor: isReorderDragging ? "grabbing" : "grab" } : void 0
813
+ },
814
+ "aria-sort": ariaSort,
815
+ onMouseDown: columnReorder ? (e) => handleHeaderMouseDown(col.columnId, e) : void 0,
816
+ children: [
817
+ /* @__PURE__ */ jsxs("div", { className: DataGridTable_module_default.headerCellContent, children: [
818
+ /* @__PURE__ */ jsx(ColumnHeaderFilter, { ...getHeaderFilterConfig(col, headerFilterInput) }),
819
+ /* @__PURE__ */ jsx(
820
+ "button",
821
+ {
822
+ className: DataGridTable_module_default.headerMenuTrigger,
823
+ onClick: (e) => {
824
+ e.stopPropagation();
825
+ headerMenu.open(col.columnId, e.currentTarget);
826
+ },
827
+ "aria-label": "Column options",
828
+ title: "Column options",
829
+ children: "\u22EE"
830
+ }
831
+ )
832
+ ] }),
833
+ /* @__PURE__ */ jsx(
834
+ "div",
835
+ {
836
+ className: DataGridTable_module_default.resizeHandle,
837
+ onMouseDown: (e) => {
838
+ setActiveCell(null);
839
+ interaction.setSelectionRange(null);
840
+ wrapperRef.current?.focus({ preventScroll: true });
841
+ handleResizeStart(e, col);
842
+ },
843
+ "aria-label": `Resize ${col.name}`
844
+ }
845
+ )
846
+ ]
847
+ },
848
+ col.columnId
849
+ );
850
+ })
851
+ ] }, rowIdx))
852
+ }
853
+ ),
854
+ !showEmptyInGrid && /* @__PURE__ */ jsxs(TableBody, { children: [
855
+ virtualScrollEnabled && visibleRange.offsetTop > 0 && /* @__PURE__ */ jsx("tr", { style: { height: visibleRange.offsetTop }, "aria-hidden": true }),
856
+ virtualScrollEnabled ? items.slice(visibleRange.startIndex, visibleRange.endIndex + 1).map((item, i) => {
857
+ const rowIndex = visibleRange.startIndex + i;
858
+ const rowIdStr = getRowId(item);
859
+ return /* @__PURE__ */ jsx(
860
+ GridRow,
861
+ {
862
+ item,
863
+ rowIndex,
864
+ rowId: rowIdStr,
865
+ isSelected: selectedRowIds.has(rowIdStr),
866
+ visibleCols,
867
+ columnMeta,
868
+ renderCellContent,
869
+ handleSingleRowClick,
870
+ handleRowCheckboxChange,
871
+ lastMouseShiftRef,
872
+ hasCheckboxCol,
873
+ hasRowNumbersCol,
874
+ rowNumberOffset,
875
+ selectionRange,
876
+ activeCell: interaction.activeCell,
877
+ cutRange,
878
+ copyRange,
879
+ isDragging,
880
+ editingRowId: editingCell?.rowId ?? null
881
+ },
882
+ rowIdStr
883
+ );
884
+ }) : items.map((item, rowIndex) => {
885
+ const rowIdStr = getRowId(item);
886
+ return /* @__PURE__ */ jsx(
887
+ GridRow,
888
+ {
889
+ item,
890
+ rowIndex,
891
+ rowId: rowIdStr,
892
+ isSelected: selectedRowIds.has(rowIdStr),
893
+ visibleCols,
894
+ columnMeta,
895
+ renderCellContent,
896
+ handleSingleRowClick,
897
+ handleRowCheckboxChange,
898
+ lastMouseShiftRef,
899
+ hasCheckboxCol,
900
+ hasRowNumbersCol,
901
+ rowNumberOffset,
902
+ selectionRange,
903
+ activeCell: interaction.activeCell,
904
+ cutRange,
905
+ copyRange,
906
+ isDragging,
907
+ editingRowId: editingCell?.rowId ?? null
908
+ },
909
+ rowIdStr
910
+ );
911
+ }),
912
+ virtualScrollEnabled && visibleRange.offsetBottom > 0 && /* @__PURE__ */ jsx("tr", { style: { height: visibleRange.offsetBottom }, "aria-hidden": true })
913
+ ] })
914
+ ] }),
915
+ isReorderDragging && dropIndicatorX != null && /* @__PURE__ */ jsx(DropIndicator, { dropIndicatorX, wrapperLeft: wrapperRef.current?.getBoundingClientRect().left ?? 0 }),
916
+ /* @__PURE__ */ jsx(
917
+ MarchingAntsOverlay,
918
+ {
919
+ containerRef: tableContainerRef,
920
+ selectionRange,
921
+ copyRange,
922
+ cutRange,
923
+ colOffset,
924
+ items,
925
+ visibleColumns,
926
+ columnSizingOverrides,
927
+ columnOrder
928
+ }
929
+ ),
930
+ showEmptyInGrid && emptyState && /* @__PURE__ */ jsx(EmptyState, { emptyState })
931
+ ] }) }) }),
932
+ menuPosition && createPortal(
933
+ /* @__PURE__ */ jsx(
934
+ GridContextMenu,
935
+ {
936
+ x: menuPosition.x,
937
+ y: menuPosition.y,
938
+ hasSelection: hasCellSelection,
939
+ canUndo,
940
+ canRedo,
941
+ onUndo: onUndo ?? NOOP,
942
+ onRedo: onRedo ?? NOOP,
943
+ onCopy: handleCopy,
944
+ onCut: handleCut,
945
+ onPaste: handlePasteVoid,
946
+ onSelectAll: o.interaction.handleSelectAllCells,
947
+ onClose: closeContextMenu
948
+ }
949
+ ),
950
+ wrapperRef.current?.closest(".fui-FluentProvider") ?? document.body
951
+ ),
952
+ /* @__PURE__ */ jsx(
953
+ ColumnHeaderMenu,
954
+ {
955
+ isOpen: headerMenu.isOpen,
956
+ anchorElement: headerMenu.anchorElement,
957
+ onClose: headerMenu.close,
958
+ onPinLeft: headerMenu.handlePinLeft,
959
+ onPinRight: headerMenu.handlePinRight,
960
+ onUnpin: headerMenu.handleUnpin,
961
+ onSortAsc: headerMenu.handleSortAsc,
962
+ onSortDesc: headerMenu.handleSortDesc,
963
+ onClearSort: headerMenu.handleClearSort,
964
+ onAutosizeThis: headerMenu.handleAutosizeThis,
965
+ onAutosizeAll: headerMenu.handleAutosizeAll,
966
+ canPinLeft: headerMenu.canPinLeft,
967
+ canPinRight: headerMenu.canPinRight,
968
+ canUnpin: headerMenu.canUnpin,
969
+ currentSort: headerMenu.currentSort,
970
+ isSortable: headerMenu.isSortable,
971
+ isResizable: headerMenu.isResizable
972
+ }
973
+ )
974
+ ]
975
+ }
976
+ ),
977
+ statusBarConfig && /* @__PURE__ */ jsx(
978
+ StatusBar,
979
+ {
980
+ totalCount: statusBarConfig.totalCount,
981
+ filteredCount: statusBarConfig.filteredCount,
982
+ selectedCount: statusBarConfig.selectedCount ?? selectedRowIds.size,
983
+ selectedCellCount: selectionRange ? (Math.abs(selectionRange.endRow - selectionRange.startRow) + 1) * (Math.abs(selectionRange.endCol - selectionRange.startCol) + 1) : void 0,
984
+ aggregation: statusBarConfig.aggregation,
985
+ suppressRowCount: statusBarConfig.suppressRowCount
986
+ }
987
+ ),
988
+ isLoading && /* @__PURE__ */ jsx(LoadingOverlay, { message: loadingMessage })
989
+ ] });
990
+ }
991
+ var DataGridTable = React.memo(DataGridTableInner);
992
+
993
+ // src/ColumnChooser/ColumnChooser.module.scss
994
+ var ColumnChooser_module_default = {
995
+ container: "ColumnChooser_module_container",
996
+ dropdown: "ColumnChooser_module_dropdown",
997
+ header: "ColumnChooser_module_header",
998
+ optionsList: "ColumnChooser_module_optionsList",
999
+ optionItem: "ColumnChooser_module_optionItem",
1000
+ actions: "ColumnChooser_module_actions"
1001
+ };
1002
+ var ColumnChooser = (props) => {
1003
+ const { columns, visibleColumns, onVisibilityChange, onSetVisibleColumns, className } = props;
1004
+ const buttonRef = useRef(null);
1005
+ const dropdownRef = useRef(null);
1006
+ const {
1007
+ open,
1008
+ handleToggle,
1009
+ handleClose,
1010
+ handleCheckboxChange: setColumnVisible,
1011
+ handleSelectAll,
1012
+ handleClearAll,
1013
+ visibleCount,
1014
+ totalCount
1015
+ } = useColumnChooserState({ columns, visibleColumns, onVisibilityChange, onSetVisibleColumns });
1016
+ useEffect(() => {
1017
+ if (!open) return;
1018
+ const handleClickOutside = (event) => {
1019
+ const target = event.target;
1020
+ if (dropdownRef.current && !dropdownRef.current.contains(target) && buttonRef.current && !buttonRef.current.contains(target)) {
1021
+ handleClose();
1022
+ }
1023
+ };
1024
+ const timeoutId = setTimeout(() => {
1025
+ document.addEventListener("mousedown", handleClickOutside);
1026
+ }, 0);
1027
+ return () => {
1028
+ clearTimeout(timeoutId);
1029
+ document.removeEventListener("mousedown", handleClickOutside);
1030
+ };
1031
+ }, [open, handleClose]);
1032
+ const handleCheckboxChange = (columnKey) => (_ev, data) => {
1033
+ setColumnVisible(columnKey)(data.checked === true);
1034
+ };
1035
+ return /* @__PURE__ */ jsxs("div", { className: `${ColumnChooser_module_default.container} ${className || ""}`, children: [
1036
+ /* @__PURE__ */ jsxs(
1037
+ Button,
1038
+ {
1039
+ ref: buttonRef,
1040
+ appearance: "outline",
1041
+ icon: /* @__PURE__ */ jsx(TableSettingsRegular, {}),
1042
+ onClick: handleToggle,
1043
+ "aria-expanded": open,
1044
+ "aria-haspopup": "listbox",
1045
+ children: [
1046
+ "Column Visibility (",
1047
+ visibleCount,
1048
+ " of ",
1049
+ totalCount,
1050
+ ")",
1051
+ open ? /* @__PURE__ */ jsx(ChevronUpRegular, {}) : /* @__PURE__ */ jsx(ChevronDownRegular, {})
1052
+ ]
1053
+ }
1054
+ ),
1055
+ open && /* @__PURE__ */ jsxs("div", { ref: dropdownRef, className: ColumnChooser_module_default.dropdown, children: [
1056
+ /* @__PURE__ */ jsxs("div", { className: ColumnChooser_module_default.header, children: [
1057
+ "Select Columns (",
1058
+ visibleCount,
1059
+ " of ",
1060
+ totalCount,
1061
+ ")"
1062
+ ] }),
1063
+ /* @__PURE__ */ jsx("div", { className: ColumnChooser_module_default.optionsList, children: columns.map((column) => /* @__PURE__ */ jsx("div", { className: ColumnChooser_module_default.optionItem, children: /* @__PURE__ */ jsx(
1064
+ Checkbox,
1065
+ {
1066
+ label: column.name,
1067
+ checked: visibleColumns.has(column.columnId),
1068
+ onChange: handleCheckboxChange(column.columnId),
1069
+ disabled: column.required === true
1070
+ }
1071
+ ) }, column.columnId)) }),
1072
+ /* @__PURE__ */ jsxs("div", { className: ColumnChooser_module_default.actions, children: [
1073
+ /* @__PURE__ */ jsx(Button, { appearance: "subtle", size: "small", onClick: handleClearAll, children: "Clear All" }),
1074
+ /* @__PURE__ */ jsx(Button, { appearance: "primary", size: "small", onClick: handleSelectAll, children: "Select All" })
1075
+ ] })
1076
+ ] })
1077
+ ] });
1078
+ };
1079
+
1080
+ // src/PaginationControls/PaginationControls.module.scss
1081
+ var PaginationControls_module_default = {
1082
+ pagination: "PaginationControls_module_pagination",
1083
+ paginationInfo: "PaginationControls_module_paginationInfo",
1084
+ paginationControls: "PaginationControls_module_paginationControls",
1085
+ navBtn: "PaginationControls_module_navBtn",
1086
+ pageNumbers: "PaginationControls_module_pageNumbers",
1087
+ pageBtn: "PaginationControls_module_pageBtn",
1088
+ ellipsis: "PaginationControls_module_ellipsis",
1089
+ pageSizeSelector: "PaginationControls_module_pageSizeSelector",
1090
+ pageSizeLabel: "PaginationControls_module_pageSizeLabel",
1091
+ pageSizeSelect: "PaginationControls_module_pageSizeSelect"
1092
+ };
1093
+ var PaginationControls = React.memo((props) => {
1094
+ const { currentPage, pageSize, totalCount, onPageChange, onPageSizeChange, pageSizeOptions, entityLabelPlural, className } = props;
1095
+ const { labelPlural, vm, handlePageSizeChange } = usePaginationControls({
1096
+ currentPage,
1097
+ pageSize,
1098
+ totalCount,
1099
+ onPageChange,
1100
+ onPageSizeChange,
1101
+ pageSizeOptions,
1102
+ entityLabelPlural
1103
+ });
1104
+ const handlePageSizeChangeEvent = (_e, data) => {
1105
+ handlePageSizeChange(Number(data.value));
1106
+ };
1107
+ if (!vm) {
1108
+ return null;
1109
+ }
1110
+ const { pageNumbers, showStartEllipsis, showEndEllipsis, totalPages, startItem, endItem } = vm;
1111
+ return /* @__PURE__ */ jsxs("div", { className: `${PaginationControls_module_default.pagination} ${className || ""}`, role: "navigation", "aria-label": "Pagination", children: [
1112
+ /* @__PURE__ */ jsxs("div", { className: PaginationControls_module_default.paginationInfo, children: [
1113
+ "Showing ",
1114
+ startItem,
1115
+ " to ",
1116
+ endItem,
1117
+ " of ",
1118
+ totalCount.toLocaleString(),
1119
+ " ",
1120
+ labelPlural
1121
+ ] }),
1122
+ /* @__PURE__ */ jsxs("div", { className: PaginationControls_module_default.paginationControls, children: [
1123
+ /* @__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 }),
1124
+ /* @__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 }),
1125
+ /* @__PURE__ */ jsxs("div", { className: PaginationControls_module_default.pageNumbers, children: [
1126
+ showStartEllipsis && /* @__PURE__ */ jsxs(Fragment, { children: [
1127
+ /* @__PURE__ */ jsx(Button, { appearance: "outline", size: "small", shape: "rounded", onClick: () => onPageChange(1), "aria-label": "Page 1", className: PaginationControls_module_default.pageBtn, children: "1" }),
1128
+ /* @__PURE__ */ jsx("span", { className: PaginationControls_module_default.ellipsis, "aria-hidden": true, children: "\u2026" })
1129
+ ] }),
1130
+ pageNumbers.map((pageNum) => /* @__PURE__ */ jsx(
1131
+ Button,
1132
+ {
1133
+ appearance: currentPage === pageNum ? "primary" : "outline",
1134
+ size: "small",
1135
+ shape: "rounded",
1136
+ onClick: () => onPageChange(pageNum),
1137
+ "aria-label": `Page ${pageNum}`,
1138
+ "aria-current": currentPage === pageNum ? "page" : void 0,
1139
+ className: PaginationControls_module_default.pageBtn,
1140
+ children: pageNum
1141
+ },
1142
+ pageNum
1143
+ )),
1144
+ showEndEllipsis && /* @__PURE__ */ jsxs(Fragment, { children: [
1145
+ /* @__PURE__ */ jsx("span", { className: PaginationControls_module_default.ellipsis, "aria-hidden": true, children: "\u2026" }),
1146
+ /* @__PURE__ */ jsx(Button, { appearance: "outline", size: "small", shape: "rounded", onClick: () => onPageChange(totalPages), "aria-label": `Page ${totalPages}`, className: PaginationControls_module_default.pageBtn, children: totalPages })
1147
+ ] })
1148
+ ] }),
1149
+ /* @__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 }),
1150
+ /* @__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 })
1151
+ ] }),
1152
+ /* @__PURE__ */ jsxs("div", { className: PaginationControls_module_default.pageSizeSelector, children: [
1153
+ /* @__PURE__ */ jsx("span", { className: PaginationControls_module_default.pageSizeLabel, children: "Rows" }),
1154
+ /* @__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)) })
1155
+ ] })
1156
+ ] });
1157
+ });
1158
+
1159
+ // src/OGrid/OGrid.tsx
1160
+ var OGrid = createOGrid({
1161
+ DataGridTable,
1162
+ ColumnChooser,
1163
+ PaginationControls
1164
+ });
1165
+
1166
+ export { ColumnChooser, ColumnHeaderFilter, ColumnHeaderMenu, DataGridTable, OGrid, PaginationControls };