@alaarab/ogrid-react-fluent 2.1.3 → 2.1.4
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 +1278 -0
- package/dist/esm/index.js +1166 -11
- package/dist/types/OGrid/OGrid.d.ts +1 -1
- package/dist/types/index.d.ts +40 -1
- package/package.json +4 -4
- package/dist/esm/ColumnChooser/ColumnChooser.js +0 -34
- package/dist/esm/ColumnChooser/ColumnChooser.module.css +0 -50
- package/dist/esm/ColumnHeaderFilter/ColumnHeaderFilter.js +0 -30
- package/dist/esm/ColumnHeaderFilter/ColumnHeaderFilter.module.css +0 -412
- package/dist/esm/ColumnHeaderFilter/MultiSelectFilterPopover.js +0 -17
- package/dist/esm/ColumnHeaderFilter/PeopleFilterPopover.js +0 -18
- package/dist/esm/ColumnHeaderFilter/TextFilterPopover.js +0 -11
- package/dist/esm/ColumnHeaderFilter/index.js +0 -1
- package/dist/esm/ColumnHeaderMenu/ColumnHeaderMenu.js +0 -12
- package/dist/esm/ColumnHeaderMenu/ColumnHeaderMenu.module.css +0 -46
- package/dist/esm/ColumnHeaderMenu/index.js +0 -1
- package/dist/esm/DataGridTable/DataGridTable.js +0 -116
- package/dist/esm/DataGridTable/DataGridTable.module.css +0 -845
- package/dist/esm/DataGridTable/DropIndicator.js +0 -6
- package/dist/esm/DataGridTable/EmptyState.js +0 -14
- package/dist/esm/DataGridTable/GridContextMenu.js +0 -13
- package/dist/esm/DataGridTable/InlineCellEditor.js +0 -6
- package/dist/esm/DataGridTable/LoadingOverlay.js +0 -12
- package/dist/esm/DataGridTable/StatusBar.js +0 -12
- package/dist/esm/OGrid/OGrid.js +0 -9
- package/dist/esm/OGrid/index.js +0 -1
- package/dist/esm/PaginationControls/PaginationControls.js +0 -26
- package/dist/esm/PaginationControls/PaginationControls.module.css +0 -74
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export type { IOGridProps } from '@alaarab/ogrid-react';
|
|
2
|
-
export declare const OGrid: import("react").ForwardRefExoticComponent<import("@alaarab/ogrid-react").IOGridProps<unknown> & import("react").RefAttributes<import("@alaarab/ogrid-
|
|
2
|
+
export declare const OGrid: import("react").ForwardRefExoticComponent<import("@alaarab/ogrid-react").IOGridProps<unknown> & import("react").RefAttributes<import("@alaarab/ogrid-core").IOGridApi<unknown>>>;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -4,4 +4,43 @@ export { ColumnChooser, type IColumnChooserProps } from './ColumnChooser/ColumnC
|
|
|
4
4
|
export { ColumnHeaderFilter, type IColumnHeaderFilterProps } from './ColumnHeaderFilter/ColumnHeaderFilter';
|
|
5
5
|
export { ColumnHeaderMenu, type ColumnHeaderMenuProps } from './ColumnHeaderMenu/ColumnHeaderMenu';
|
|
6
6
|
export { PaginationControls, type IPaginationControlsProps } from './PaginationControls/PaginationControls';
|
|
7
|
-
export
|
|
7
|
+
export { CHECKBOX_COLUMN_WIDTH, ROW_NUMBER_COLUMN_WIDTH, DEFAULT_MIN_COLUMN_WIDTH, CELL_PADDING, GRID_BORDER_RADIUS, } from '@alaarab/ogrid-react';
|
|
8
|
+
export type { ColumnFilterType, IColumnFilterDef, IColumnMeta, IColumnDef, IColumnGroupDef, IColumnDefinition, ICellValueChangedEvent, ICellEditorProps, CellEditorParams, IValueParserParams, UserLike, UserLikeInput, FilterValue, IFilters, IFetchParams, IPageResult, IDataSource, IGridColumnState, IOGridApi, IOGridDataGridProps, RowSelectionMode, RowId, IRowSelectionChangeEvent, StatusBarPanel, IStatusBarProps, IActiveCell, ISelectionRange, HeaderCell, HeaderRow, SideBarPanelId, ISideBarDef, IDateFilterValue, IVirtualScrollConfig, IColumnReorderConfig, } from '@alaarab/ogrid-react';
|
|
9
|
+
export { toUserLike, isInSelectionRange, normalizeSelectionRange } from '@alaarab/ogrid-react';
|
|
10
|
+
export { useFilterOptions, useOGrid, useActiveCell, useCellEditing, useContextMenu, useCellSelection, useClipboard, useRowSelection, useKeyboardNavigation, useUndoRedo, useDebounce, useFillHandle, useDataGridState, useColumnHeaderFilterState, useTextFilterState, useMultiSelectFilterState, usePeopleFilterState, useDateFilterState, useColumnChooserState, useInlineCellEditorState, useColumnResize, useRichSelectState, useSelectState, useSideBarState, useTableLayout, useColumnReorder, useVirtualScroll, useListVirtualizer, useLatestRef, usePaginationControls, useDataGridTableOrchestration, useColumnMeta, } from '@alaarab/ogrid-react';
|
|
11
|
+
export type { UseFilterOptionsResult, UseOGridResult, UseOGridPagination, UseOGridColumnChooser, UseOGridLayout, UseOGridFilters, ColumnChooserPlacement, UseActiveCellResult, UseCellEditingResult, EditingCell, UseContextMenuResult, ContextMenuPosition, UseCellSelectionResult, UseCellSelectionParams, UseClipboardResult, UseClipboardParams, UseRowSelectionResult, UseRowSelectionParams, UseKeyboardNavigationResult, UseKeyboardNavigationParams, UseUndoRedoResult, UseUndoRedoParams, UseFillHandleResult, UseFillHandleParams, UseDataGridStateParams, UseDataGridStateResult, DataGridLayoutState, DataGridRowSelectionState, DataGridEditingState, DataGridCellInteractionState, DataGridContextMenuState, DataGridViewModelState, DataGridPinningState, UseColumnHeaderFilterStateParams, UseColumnHeaderFilterStateResult, UseTextFilterStateParams, UseTextFilterStateResult, UseMultiSelectFilterStateParams, UseMultiSelectFilterStateResult, UsePeopleFilterStateParams, UsePeopleFilterStateResult, UseDateFilterStateParams, UseDateFilterStateResult, UseColumnChooserStateParams, UseColumnChooserStateResult, UseInlineCellEditorStateParams, UseInlineCellEditorStateResult, InlineCellEditorType, UseColumnResizeParams, UseColumnResizeResult, UseRichSelectStateParams, UseRichSelectStateResult, UseSelectStateParams, UseSelectStateResult, UseSideBarStateParams, UseSideBarStateResult, UseTableLayoutParams, UseTableLayoutResult, UseColumnReorderParams, UseColumnReorderResult, UseVirtualScrollParams, UseVirtualScrollResult, UsePaginationControlsProps, UsePaginationControlsResult, UseDataGridTableOrchestrationParams, UseDataGridTableOrchestrationResult, UseColumnMetaParams, ColumnMetaResult, } from '@alaarab/ogrid-react';
|
|
12
|
+
export { GRID_ROOT_STYLE, CURSOR_CELL_STYLE, POPOVER_ANCHOR_STYLE, PREVENT_DEFAULT, NOOP, STOP_PROPAGATION, } from '@alaarab/ogrid-react';
|
|
13
|
+
export { OGridLayout } from '@alaarab/ogrid-react';
|
|
14
|
+
export type { OGridLayoutProps } from '@alaarab/ogrid-react';
|
|
15
|
+
export { StatusBar } from '@alaarab/ogrid-react';
|
|
16
|
+
export type { StatusBarProps, StatusBarClassNames } from '@alaarab/ogrid-react';
|
|
17
|
+
export { BaseInlineCellEditor, editorWrapperStyle, editorInputStyle, richSelectWrapperStyle, richSelectDropdownStyle, richSelectOptionStyle, richSelectOptionHighlightedStyle, richSelectNoMatchesStyle, selectEditorStyle, selectDisplayStyle, selectChevronStyle, } from '@alaarab/ogrid-react';
|
|
18
|
+
export type { BaseInlineCellEditorProps } from '@alaarab/ogrid-react';
|
|
19
|
+
export { GridContextMenu } from '@alaarab/ogrid-react';
|
|
20
|
+
export type { GridContextMenuProps, GridContextMenuClassNames } from '@alaarab/ogrid-react';
|
|
21
|
+
export { MarchingAntsOverlay } from '@alaarab/ogrid-react';
|
|
22
|
+
export type { MarchingAntsOverlayProps } from '@alaarab/ogrid-react';
|
|
23
|
+
export { SideBar } from '@alaarab/ogrid-react';
|
|
24
|
+
export type { SideBarProps, SideBarFilterColumn } from '@alaarab/ogrid-react';
|
|
25
|
+
export { BaseColumnHeaderMenu } from '@alaarab/ogrid-react';
|
|
26
|
+
export type { BaseColumnHeaderMenuProps, ColumnHeaderMenuClassNames } from '@alaarab/ogrid-react';
|
|
27
|
+
export { createOGrid } from '@alaarab/ogrid-react';
|
|
28
|
+
export type { CreateOGridComponents, GridRowProps, InlineCellEditorProps } from '@alaarab/ogrid-react';
|
|
29
|
+
export { CellErrorBoundary } from '@alaarab/ogrid-react';
|
|
30
|
+
export type { CellErrorBoundaryProps } from '@alaarab/ogrid-react';
|
|
31
|
+
export { EmptyState } from '@alaarab/ogrid-react';
|
|
32
|
+
export type { EmptyStateProps } from '@alaarab/ogrid-react';
|
|
33
|
+
export { BaseEmptyState } from '@alaarab/ogrid-react';
|
|
34
|
+
export type { BaseEmptyStateProps, BaseEmptyStateClassNames } from '@alaarab/ogrid-react';
|
|
35
|
+
export { BaseLoadingOverlay } from '@alaarab/ogrid-react';
|
|
36
|
+
export type { BaseLoadingOverlayProps, BaseLoadingOverlayClassNames } from '@alaarab/ogrid-react';
|
|
37
|
+
export { BaseDropIndicator } from '@alaarab/ogrid-react';
|
|
38
|
+
export type { BaseDropIndicatorProps } from '@alaarab/ogrid-react';
|
|
39
|
+
export { DateFilterContent, getColumnHeaderFilterStateParams, getDateFilterContentProps, } from '@alaarab/ogrid-react';
|
|
40
|
+
export type { IColumnHeaderFilterProps as IColumnHeaderFilterBaseProps, DateFilterContentProps, DateFilterClassNames, } from '@alaarab/ogrid-react';
|
|
41
|
+
export { escapeCsvValue, buildCsvHeader, buildCsvRows, exportToCsv, triggerCsvDownload, getCellValue, flattenColumns, buildHeaderRows, getFilterField, mergeFilter, deriveFilterOptionsFromData, getMultiSelectFilterFields, getStatusBarParts, getDataGridStatusBarConfig, GRID_CONTEXT_MENU_ITEMS, COLUMN_HEADER_MENU_ITEMS, getContextMenuHandlers, getColumnHeaderMenuItems, formatShortcut, getPaginationViewModel, PAGE_SIZE_OPTIONS, MAX_PAGE_BUTTONS, getHeaderFilterConfig, getCellRenderDescriptor, isRowInRange, resolveCellDisplayContent, resolveCellStyle, buildInlineEditorProps, buildPopoverEditorProps, getCellInteractionProps, parseValue, numberParser, currencyParser, dateParser, emailParser, booleanParser, computeAggregations, processClientSideData, areGridRowPropsEqual, findCtrlArrowTarget, computeTabNavigation, rangesEqual, clampSelectionToBounds, computeAutoScrollSpeed, formatCellValueForTsv, formatSelectionAsTsv, parseTsvClipboard, UndoRedoStack, } from '@alaarab/ogrid-react';
|
|
42
|
+
export type { CsvColumn, StatusBarPart, StatusBarPartsInput, GridContextMenuItem, GridContextMenuHandlerProps, PaginationViewModel, HeaderFilterConfigInput, HeaderFilterConfig, CellRenderDescriptorInput, CellRenderDescriptor, CellRenderMode, CellInteractionHandlers, ParseValueResult, AggregationResult, GridRowComparatorProps, IColumnHeaderMenuItem, ColumnHeaderMenuInput, ColumnHeaderMenuHandlers, } from '@alaarab/ogrid-react';
|
|
43
|
+
export { renderFilterContent } from '@alaarab/ogrid-react';
|
|
44
|
+
export type { FilterContentRenderers, MultiSelectRendererProps, TextRendererProps, PeopleRendererProps, DateRendererProps, } from '@alaarab/ogrid-react';
|
|
45
|
+
export type { IColumnChooserProps as IColumnChooserBaseProps } from '@alaarab/ogrid-react';
|
|
46
|
+
export type { IPaginationControlsProps as IPaginationControlsBaseProps } from '@alaarab/ogrid-react';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alaarab/ogrid-react-fluent",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.4",
|
|
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",
|
|
@@ -9,12 +9,12 @@
|
|
|
9
9
|
".": {
|
|
10
10
|
"types": "./dist/types/index.d.ts",
|
|
11
11
|
"import": "./dist/esm/index.js",
|
|
12
|
-
"
|
|
12
|
+
"default": "./dist/esm/index.js"
|
|
13
13
|
},
|
|
14
14
|
"./styles/*": "./dist/esm/*"
|
|
15
15
|
},
|
|
16
16
|
"scripts": {
|
|
17
|
-
"build": "rimraf dist && tsc -p tsconfig.build.json
|
|
17
|
+
"build": "rimraf dist && tsup && tsc -p tsconfig.build.json",
|
|
18
18
|
"test": "jest",
|
|
19
19
|
"storybook": "storybook dev -p 6006 --no-open",
|
|
20
20
|
"build-storybook": "storybook build"
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"node": ">=18"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@alaarab/ogrid-react": "2.1.
|
|
44
|
+
"@alaarab/ogrid-react": "2.1.4"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
47
|
"@fluentui/react-components": "^9.0.0",
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useRef, useEffect } from 'react';
|
|
3
|
-
import { Button, Checkbox, } from '@fluentui/react-components';
|
|
4
|
-
import { TableSettingsRegular, ChevronDownRegular, ChevronUpRegular } from '@fluentui/react-icons';
|
|
5
|
-
import { useColumnChooserState } from '@alaarab/ogrid-react';
|
|
6
|
-
import styles from './ColumnChooser.module.css';
|
|
7
|
-
export const ColumnChooser = (props) => {
|
|
8
|
-
const { columns, visibleColumns, onVisibilityChange, onSetVisibleColumns, className } = props;
|
|
9
|
-
const buttonRef = useRef(null);
|
|
10
|
-
const dropdownRef = useRef(null);
|
|
11
|
-
const { open, handleToggle, handleClose, handleCheckboxChange: setColumnVisible, handleSelectAll, handleClearAll, visibleCount, totalCount, } = useColumnChooserState({ columns, visibleColumns, onVisibilityChange, onSetVisibleColumns });
|
|
12
|
-
useEffect(() => {
|
|
13
|
-
if (!open)
|
|
14
|
-
return;
|
|
15
|
-
const handleClickOutside = (event) => {
|
|
16
|
-
const target = event.target;
|
|
17
|
-
if (dropdownRef.current && !dropdownRef.current.contains(target) &&
|
|
18
|
-
buttonRef.current && !buttonRef.current.contains(target)) {
|
|
19
|
-
handleClose();
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
const timeoutId = setTimeout(() => {
|
|
23
|
-
document.addEventListener('mousedown', handleClickOutside);
|
|
24
|
-
}, 0);
|
|
25
|
-
return () => {
|
|
26
|
-
clearTimeout(timeoutId);
|
|
27
|
-
document.removeEventListener('mousedown', handleClickOutside);
|
|
28
|
-
};
|
|
29
|
-
}, [open, handleClose]);
|
|
30
|
-
const handleCheckboxChange = (columnKey) => (_ev, data) => {
|
|
31
|
-
setColumnVisible(columnKey)(data.checked === true);
|
|
32
|
-
};
|
|
33
|
-
return (_jsxs("div", { className: `${styles.container} ${className || ''}`, children: [_jsxs(Button, { ref: buttonRef, appearance: "outline", icon: _jsx(TableSettingsRegular, {}), onClick: handleToggle, "aria-expanded": open, "aria-haspopup": "listbox", children: ["Column Visibility (", visibleCount, " of ", totalCount, ")", open ? _jsx(ChevronUpRegular, {}) : _jsx(ChevronDownRegular, {})] }), open && (_jsxs("div", { ref: dropdownRef, className: styles.dropdown, children: [_jsxs("div", { className: styles.header, children: ["Select Columns (", visibleCount, " of ", totalCount, ")"] }), _jsx("div", { className: styles.optionsList, children: columns.map((column) => (_jsx("div", { className: styles.optionItem, children: _jsx(Checkbox, { label: column.name, checked: visibleColumns.has(column.columnId), onChange: handleCheckboxChange(column.columnId), disabled: column.required === true }) }, column.columnId))) }), _jsxs("div", { className: styles.actions, children: [_jsx(Button, { appearance: "subtle", size: "small", onClick: handleClearAll, children: "Clear All" }), _jsx(Button, { appearance: "primary", size: "small", onClick: handleSelectAll, children: "Select All" })] })] }))] }));
|
|
34
|
-
};
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
.container {
|
|
2
|
-
position: relative;
|
|
3
|
-
display: inline-flex;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
.dropdown {
|
|
7
|
-
position: absolute;
|
|
8
|
-
top: calc(100% + 4px);
|
|
9
|
-
right: 0;
|
|
10
|
-
z-index: 10000;
|
|
11
|
-
min-width: 220px;
|
|
12
|
-
display: flex;
|
|
13
|
-
flex-direction: column;
|
|
14
|
-
background: var(--colorNeutralBackground1, #fff);
|
|
15
|
-
border: 1px solid var(--colorNeutralStroke2, #edebe9);
|
|
16
|
-
border-radius: 6px;
|
|
17
|
-
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
|
|
18
|
-
padding: 0;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
.header {
|
|
22
|
-
padding: 8px 12px;
|
|
23
|
-
border-bottom: 1px solid var(--colorNeutralStroke2, #edebe9);
|
|
24
|
-
font-weight: 600;
|
|
25
|
-
font-size: 13px;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
.optionsList {
|
|
29
|
-
max-height: 320px;
|
|
30
|
-
overflow-y: auto;
|
|
31
|
-
padding: 0;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
.optionItem {
|
|
35
|
-
padding: 4px 12px;
|
|
36
|
-
display: flex;
|
|
37
|
-
align-items: center;
|
|
38
|
-
min-height: 32px;
|
|
39
|
-
}
|
|
40
|
-
.optionItem:hover {
|
|
41
|
-
background: var(--colorNeutralBackground1Hover, #f5f5f5);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
.actions {
|
|
45
|
-
display: flex;
|
|
46
|
-
justify-content: flex-end;
|
|
47
|
-
gap: 8px;
|
|
48
|
-
padding: 8px 12px;
|
|
49
|
-
border-top: 1px solid var(--colorNeutralStroke2, #edebe9);
|
|
50
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import { Popover, PopoverSurface } from '@fluentui/react-components';
|
|
4
|
-
import { FilterRegular } from '@fluentui/react-icons';
|
|
5
|
-
import { useColumnHeaderFilterState, getColumnHeaderFilterStateParams, DateFilterContent, renderFilterContent, } from '@alaarab/ogrid-react';
|
|
6
|
-
import { TextFilterPopover } from './TextFilterPopover';
|
|
7
|
-
import { MultiSelectFilterPopover } from './MultiSelectFilterPopover';
|
|
8
|
-
import { PeopleFilterPopover } from './PeopleFilterPopover';
|
|
9
|
-
import styles from './ColumnHeaderFilter.module.css';
|
|
10
|
-
export const ColumnHeaderFilter = React.memo((props) => {
|
|
11
|
-
const { columnName, filterType, options, isLoadingOptions = false, selectedUser, } = props;
|
|
12
|
-
const state = useColumnHeaderFilterState(getColumnHeaderFilterStateParams(props));
|
|
13
|
-
const { headerRef, popoverRef, isFilterOpen, setFilterOpen, hasActiveFilter, handlers, } = state;
|
|
14
|
-
const { handlePopoverClick, handleInputFocus, handleInputMouseDown, handleInputClick, handleInputKeyDown, } = handlers;
|
|
15
|
-
const filterBtnRef = React.useRef(null);
|
|
16
|
-
// Fluent-specific renderers that pass additional event propagation handlers
|
|
17
|
-
const fluentRenderers = React.useMemo(() => ({
|
|
18
|
-
renderMultiSelect: (p) => (_jsx(MultiSelectFilterPopover, { searchText: p.searchText, onSearchChange: p.onSearchChange, options: p.options, filteredOptions: p.filteredOptions, selected: p.selected, onOptionToggle: p.onOptionToggle, onSelectAll: p.onSelectAll, onClearSelection: p.onClearSelection, onApply: p.onApply, isLoading: p.isLoading, onPopoverClick: handlePopoverClick, onInputFocus: handleInputFocus, onInputMouseDown: handleInputMouseDown, onInputClick: handleInputClick, onInputKeyDown: handleInputKeyDown })),
|
|
19
|
-
renderText: (p) => (_jsx(TextFilterPopover, { value: p.value, onValueChange: p.onValueChange, onApply: p.onApply, onClear: p.onClear, onPopoverClick: handlePopoverClick, onInputFocus: handleInputFocus, onInputMouseDown: handleInputMouseDown, onInputClick: handleInputClick, onInputKeyDown: handleInputKeyDown })),
|
|
20
|
-
renderPeople: (p) => (_jsx(PeopleFilterPopover, { selectedUser: p.selectedUser, searchText: p.searchText, onSearchChange: p.onSearchChange, suggestions: p.suggestions, isLoading: p.isLoading, onUserSelect: p.onUserSelect, onClearUser: p.onClearUser, onPopoverClick: handlePopoverClick, inputRef: p.inputRef })),
|
|
21
|
-
renderDate: (p) => (_jsx("div", { onClick: handlePopoverClick, children: _jsx(DateFilterContent, { tempDateFrom: p.tempDateFrom, setTempDateFrom: p.setTempDateFrom, tempDateTo: p.tempDateTo, setTempDateTo: p.setTempDateTo, onApply: p.onApply, onClear: p.onClear, classNames: {
|
|
22
|
-
popoverActions: styles.popoverActions,
|
|
23
|
-
clearButton: styles.clearButton,
|
|
24
|
-
applyButton: styles.applyButton,
|
|
25
|
-
} }) })),
|
|
26
|
-
}), [handlePopoverClick, handleInputFocus, handleInputMouseDown, handleInputClick, handleInputKeyDown]);
|
|
27
|
-
return (_jsxs("div", { className: styles.columnHeader, ref: headerRef, children: [_jsx("div", { className: styles.headerContent, children: _jsx("span", { className: styles.columnName, title: columnName, "data-header-label": true, children: columnName }) }), _jsx("div", { className: styles.headerActions, children: filterType !== 'none' && (_jsxs(_Fragment, { children: [_jsxs("button", { ref: filterBtnRef, type: "button", className: `${styles.filterIcon} ${hasActiveFilter ? styles.filterActive : ''} ${isFilterOpen ? styles.filterOpen : ''}`, onClick: handlers.handleFilterIconClick, "aria-label": `Filter ${columnName}`, title: `Filter ${columnName}`, children: [_jsx(FilterRegular, {}), hasActiveFilter && _jsx("span", { className: styles.filterBadge })] }), _jsx(Popover, { open: isFilterOpen, onOpenChange: (_, data) => { if (!data.open)
|
|
28
|
-
setFilterOpen(false); }, positioning: { target: filterBtnRef.current ?? undefined, position: 'below', align: 'start', offset: 4 }, trapFocus: false, children: _jsxs(PopoverSurface, { ref: popoverRef, className: styles.filterPopover, onClick: handlers.handlePopoverClick, style: { padding: 0 }, children: [_jsxs("div", { className: styles.popoverHeader, children: ["Filter: ", columnName] }), renderFilterContent(filterType, state, options ?? [], isLoadingOptions, selectedUser, fluentRenderers)] }) })] })) })] }));
|
|
29
|
-
});
|
|
30
|
-
ColumnHeaderFilter.displayName = 'ColumnHeaderFilter';
|
|
@@ -1,412 +0,0 @@
|
|
|
1
|
-
.columnHeader {
|
|
2
|
-
display: flex;
|
|
3
|
-
align-items: center;
|
|
4
|
-
gap: 4px;
|
|
5
|
-
width: 100%;
|
|
6
|
-
max-width: 100%;
|
|
7
|
-
min-width: 0;
|
|
8
|
-
position: relative;
|
|
9
|
-
box-sizing: border-box;
|
|
10
|
-
overflow: hidden;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
/* Keep header actions always visible, but do not let them participate in layout.
|
|
14
|
-
Otherwise, wide header cells make the sort/filter icons look "stranded" far to the right.
|
|
15
|
-
|
|
16
|
-
NOTE: Fluent's column resize hit-target lives at the far right edge of the header cell.
|
|
17
|
-
We leave a 16px safety zone for it.
|
|
18
|
-
*/
|
|
19
|
-
:root {
|
|
20
|
-
--dt-header-resize-zone: 16px;
|
|
21
|
-
--dt-header-action-button: 24px;
|
|
22
|
-
--dt-header-action-gap: 2px;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
.headerContent {
|
|
26
|
-
display: flex;
|
|
27
|
-
align-items: center;
|
|
28
|
-
gap: 4px;
|
|
29
|
-
flex: 1;
|
|
30
|
-
min-width: 0;
|
|
31
|
-
width: 100%;
|
|
32
|
-
max-width: 100%;
|
|
33
|
-
padding: 2px 0;
|
|
34
|
-
box-sizing: border-box;
|
|
35
|
-
overflow: hidden;
|
|
36
|
-
/* Reserve room for 2 buttons + gap + resize zone so text never overlaps actions. */
|
|
37
|
-
/* padding-right removed: use normal flex layout so actions never overflow */
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
.columnName {
|
|
41
|
-
display: block;
|
|
42
|
-
min-width: 0;
|
|
43
|
-
max-width: 100%;
|
|
44
|
-
overflow: hidden;
|
|
45
|
-
text-overflow: ellipsis;
|
|
46
|
-
white-space: nowrap;
|
|
47
|
-
font-weight: 600;
|
|
48
|
-
font-size: 14px;
|
|
49
|
-
color: var(--colorNeutralForeground1, #242424);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
.headerActions {
|
|
53
|
-
display: flex;
|
|
54
|
-
align-items: center;
|
|
55
|
-
gap: var(--dt-header-action-gap);
|
|
56
|
-
/* Keep actions in normal flow so they never overflow the header cell. */
|
|
57
|
-
margin-left: auto;
|
|
58
|
-
flex-shrink: 0;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
.filterIcon {
|
|
62
|
-
display: flex;
|
|
63
|
-
align-items: center;
|
|
64
|
-
justify-content: center;
|
|
65
|
-
width: 24px;
|
|
66
|
-
height: 24px;
|
|
67
|
-
padding: 4px;
|
|
68
|
-
margin-left: 2px;
|
|
69
|
-
border: none;
|
|
70
|
-
border-radius: var(--borderRadiusSmall, 4px);
|
|
71
|
-
background-color: transparent;
|
|
72
|
-
color: var(--colorNeutralForeground2, #616161);
|
|
73
|
-
cursor: pointer;
|
|
74
|
-
flex-shrink: 0;
|
|
75
|
-
position: relative;
|
|
76
|
-
transition: all 0.15s ease;
|
|
77
|
-
}
|
|
78
|
-
.filterIcon svg {
|
|
79
|
-
font-size: 14px;
|
|
80
|
-
}
|
|
81
|
-
.filterIcon:hover {
|
|
82
|
-
background-color: var(--colorSubtleBackgroundHover, #f5f5f5);
|
|
83
|
-
color: var(--colorNeutralForeground2Hover, #424242);
|
|
84
|
-
}
|
|
85
|
-
.filterIcon.filterActive {
|
|
86
|
-
background-color: var(--colorSubtleBackgroundSelected, #e0e0e0);
|
|
87
|
-
color: var(--colorNeutralForeground2, #616161);
|
|
88
|
-
}
|
|
89
|
-
.filterIcon.filterActive:hover {
|
|
90
|
-
background-color: var(--colorSubtleBackgroundHover, #f5f5f5);
|
|
91
|
-
}
|
|
92
|
-
.filterIcon.filterOpen {
|
|
93
|
-
background-color: var(--colorSubtleBackgroundPressed, #ebebeb);
|
|
94
|
-
color: var(--colorNeutralForeground2, #616161);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
.filterBadge {
|
|
98
|
-
position: absolute;
|
|
99
|
-
top: 2px;
|
|
100
|
-
right: 2px;
|
|
101
|
-
width: 6px;
|
|
102
|
-
height: 6px;
|
|
103
|
-
background-color: var(--colorBrandBackground, #0f6cbd);
|
|
104
|
-
border-radius: 50%;
|
|
105
|
-
border: 1px solid var(--colorNeutralBackground1, #ffffff);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
.filterPopover {
|
|
109
|
-
min-width: 280px;
|
|
110
|
-
max-width: 320px;
|
|
111
|
-
overflow: hidden;
|
|
112
|
-
padding: 0;
|
|
113
|
-
background-color: var(--colorNeutralBackground1, #ffffff);
|
|
114
|
-
border: 1px solid var(--colorNeutralStroke1, #d1d1d1);
|
|
115
|
-
border-radius: var(--borderRadiusMedium, 4px);
|
|
116
|
-
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.14);
|
|
117
|
-
font-family: var(--fontFamilyBase, "Segoe UI", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif);
|
|
118
|
-
font-size: 14px;
|
|
119
|
-
color: var(--colorNeutralForeground1, #242424);
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
.popoverHeader {
|
|
123
|
-
padding: 10px 14px;
|
|
124
|
-
font-size: 12px;
|
|
125
|
-
font-weight: 600;
|
|
126
|
-
color: var(--colorNeutralForeground2, #616161);
|
|
127
|
-
border-bottom: 1px solid var(--colorNeutralStroke2, #e0e0e0);
|
|
128
|
-
background-color: var(--colorNeutralBackground2, #fafafa);
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
.popoverSearch {
|
|
132
|
-
padding: 10px 12px;
|
|
133
|
-
border-bottom: 1px solid var(--colorNeutralStroke2, #e0e0e0);
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
.nativeInputWrapper {
|
|
137
|
-
display: flex;
|
|
138
|
-
align-items: center;
|
|
139
|
-
gap: 8px;
|
|
140
|
-
width: 100%;
|
|
141
|
-
border: 1px solid var(--colorNeutralStroke1, #d1d1d1);
|
|
142
|
-
border-radius: var(--borderRadiusMedium, 4px);
|
|
143
|
-
background-color: var(--colorNeutralBackground1, #ffffff);
|
|
144
|
-
padding: 6px 12px;
|
|
145
|
-
min-height: 36px;
|
|
146
|
-
box-sizing: border-box;
|
|
147
|
-
}
|
|
148
|
-
.nativeInputWrapper:focus-within {
|
|
149
|
-
border-color: var(--colorBrandStroke1, #0f6cbd);
|
|
150
|
-
outline: none;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
.nativeInputIcon {
|
|
154
|
-
color: var(--colorNeutralForeground3, #616161);
|
|
155
|
-
font-size: 16px;
|
|
156
|
-
flex-shrink: 0;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
.nativeInput {
|
|
160
|
-
flex: 1;
|
|
161
|
-
min-width: 0;
|
|
162
|
-
border: none;
|
|
163
|
-
outline: none;
|
|
164
|
-
padding: 0;
|
|
165
|
-
font-size: 14px;
|
|
166
|
-
font-family: inherit;
|
|
167
|
-
background: transparent;
|
|
168
|
-
color: var(--colorNeutralForeground1, #242424);
|
|
169
|
-
}
|
|
170
|
-
.nativeInput::placeholder {
|
|
171
|
-
color: var(--colorNeutralForeground4, #707070);
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
.resultCount {
|
|
175
|
-
margin-top: 6px;
|
|
176
|
-
font-size: 11px;
|
|
177
|
-
color: var(--colorNeutralForeground2, #616161);
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
.selectAllRow {
|
|
181
|
-
display: flex;
|
|
182
|
-
gap: 8px;
|
|
183
|
-
padding: 6px 12px;
|
|
184
|
-
border-bottom: 1px solid var(--colorNeutralStroke2, #e0e0e0);
|
|
185
|
-
background-color: var(--colorNeutralBackground2, #fafafa);
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
.selectAllButton {
|
|
189
|
-
background: none;
|
|
190
|
-
border: none;
|
|
191
|
-
color: var(--colorBrandForeground1, #0f6cbd);
|
|
192
|
-
font-size: 12px;
|
|
193
|
-
font-weight: 500;
|
|
194
|
-
cursor: pointer;
|
|
195
|
-
padding: 4px 8px;
|
|
196
|
-
border-radius: var(--borderRadiusSmall, 4px);
|
|
197
|
-
transition: background-color 0.15s ease;
|
|
198
|
-
}
|
|
199
|
-
.selectAllButton:hover {
|
|
200
|
-
background-color: var(--colorBrandBackground2, #ebf3fc);
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
.popoverOptions {
|
|
204
|
-
overflow-y: auto;
|
|
205
|
-
max-height: 250px;
|
|
206
|
-
padding: 6px 0;
|
|
207
|
-
}
|
|
208
|
-
.popoverOptions::-webkit-scrollbar {
|
|
209
|
-
width: 6px;
|
|
210
|
-
}
|
|
211
|
-
.popoverOptions::-webkit-scrollbar-track {
|
|
212
|
-
background: var(--colorNeutralBackground3, #f5f5f5);
|
|
213
|
-
}
|
|
214
|
-
.popoverOptions::-webkit-scrollbar-thumb {
|
|
215
|
-
background: var(--colorNeutralStroke1, #d1d1d1);
|
|
216
|
-
border-radius: 3px;
|
|
217
|
-
}
|
|
218
|
-
.popoverOptions::-webkit-scrollbar-thumb:hover {
|
|
219
|
-
background: var(--colorNeutralForeground2, #616161);
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
.popoverOption {
|
|
223
|
-
padding: 4px 12px;
|
|
224
|
-
transition: background-color 0.1s ease;
|
|
225
|
-
cursor: pointer;
|
|
226
|
-
}
|
|
227
|
-
.popoverOption:hover {
|
|
228
|
-
background-color: var(--colorNeutralBackground1Hover, #f5f5f5);
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
.nativeCheckbox {
|
|
232
|
-
width: 16px;
|
|
233
|
-
height: 16px;
|
|
234
|
-
margin: 0;
|
|
235
|
-
cursor: pointer;
|
|
236
|
-
accent-color: var(--colorBrandBackground, #0f6cbd);
|
|
237
|
-
flex-shrink: 0;
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
.checkboxLabel {
|
|
241
|
-
margin-left: 8px;
|
|
242
|
-
font-size: 14px;
|
|
243
|
-
color: var(--colorNeutralForeground1, #242424);
|
|
244
|
-
overflow: hidden;
|
|
245
|
-
text-overflow: ellipsis;
|
|
246
|
-
white-space: nowrap;
|
|
247
|
-
min-width: 0;
|
|
248
|
-
cursor: pointer;
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
.personOption {
|
|
252
|
-
padding: 8px 12px;
|
|
253
|
-
cursor: pointer;
|
|
254
|
-
transition: background-color 0.1s ease;
|
|
255
|
-
}
|
|
256
|
-
.personOption:hover {
|
|
257
|
-
background-color: var(--colorNeutralBackground1Hover, #f5f5f5);
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
.loadingContainer {
|
|
261
|
-
display: flex;
|
|
262
|
-
align-items: center;
|
|
263
|
-
justify-content: center;
|
|
264
|
-
gap: 8px;
|
|
265
|
-
padding: 20px;
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
.filterSpinner {
|
|
269
|
-
width: 20px;
|
|
270
|
-
height: 20px;
|
|
271
|
-
border: 2px solid var(--colorNeutralStroke1, #d1d1d1);
|
|
272
|
-
border-top-color: var(--colorBrandBackground, #0f6cbd);
|
|
273
|
-
border-radius: 50%;
|
|
274
|
-
animation: ogrid-filter-spin 0.8s linear infinite;
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
@keyframes ogrid-filter-spin {
|
|
278
|
-
to {
|
|
279
|
-
transform: rotate(360deg);
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
.noResults {
|
|
283
|
-
padding: 16px;
|
|
284
|
-
text-align: center;
|
|
285
|
-
font-size: 12px;
|
|
286
|
-
color: var(--colorNeutralForeground2, #616161);
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
.selectedUserSection {
|
|
290
|
-
padding: 10px 12px;
|
|
291
|
-
border-bottom: 1px solid var(--colorNeutralStroke2, #e0e0e0);
|
|
292
|
-
background-color: var(--colorSubtleBackgroundSelected, #e0e0e0);
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
.selectedUserLabel {
|
|
296
|
-
font-size: 11px;
|
|
297
|
-
color: var(--colorNeutralForeground2, #616161);
|
|
298
|
-
margin-bottom: 6px;
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
.selectedUser {
|
|
302
|
-
display: flex;
|
|
303
|
-
align-items: center;
|
|
304
|
-
justify-content: space-between;
|
|
305
|
-
gap: 8px;
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
.userInfo {
|
|
309
|
-
display: flex;
|
|
310
|
-
align-items: center;
|
|
311
|
-
gap: 8px;
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
.avatar {
|
|
315
|
-
width: 32px;
|
|
316
|
-
height: 32px;
|
|
317
|
-
border-radius: 50%;
|
|
318
|
-
background-color: var(--colorBrandBackground, #0f6cbd);
|
|
319
|
-
display: flex;
|
|
320
|
-
align-items: center;
|
|
321
|
-
justify-content: center;
|
|
322
|
-
flex-shrink: 0;
|
|
323
|
-
overflow: hidden;
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
.avatarImg {
|
|
327
|
-
width: 100%;
|
|
328
|
-
height: 100%;
|
|
329
|
-
object-fit: cover;
|
|
330
|
-
border-radius: 50%;
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
.avatarInitials {
|
|
334
|
-
color: var(--colorNeutralForegroundOnBrand, #ffffff);
|
|
335
|
-
font-size: 12px;
|
|
336
|
-
font-weight: 600;
|
|
337
|
-
line-height: 1;
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
.userText {
|
|
341
|
-
display: flex;
|
|
342
|
-
flex-direction: column;
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
.userSecondary {
|
|
346
|
-
font-size: 12px;
|
|
347
|
-
color: var(--colorNeutralForeground2, #616161);
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
.removeUserButton {
|
|
351
|
-
display: flex;
|
|
352
|
-
align-items: center;
|
|
353
|
-
justify-content: center;
|
|
354
|
-
width: 24px;
|
|
355
|
-
height: 24px;
|
|
356
|
-
padding: 0;
|
|
357
|
-
border: none;
|
|
358
|
-
border-radius: 50%;
|
|
359
|
-
background-color: transparent;
|
|
360
|
-
color: var(--colorNeutralForeground2, #616161);
|
|
361
|
-
cursor: pointer;
|
|
362
|
-
transition: all 0.15s ease;
|
|
363
|
-
}
|
|
364
|
-
.removeUserButton:hover {
|
|
365
|
-
background-color: var(--colorNeutralBackground1Hover, #f5f5f5);
|
|
366
|
-
color: var(--colorPaletteRedForeground1, #c4314b);
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
.popoverActions {
|
|
370
|
-
display: flex;
|
|
371
|
-
justify-content: flex-end;
|
|
372
|
-
gap: 8px;
|
|
373
|
-
padding: 10px 12px;
|
|
374
|
-
border-top: 1px solid var(--colorNeutralStroke2, #e0e0e0);
|
|
375
|
-
background-color: var(--colorNeutralBackground2, #fafafa);
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
.clearButton {
|
|
379
|
-
padding: 6px 12px;
|
|
380
|
-
border: 1px solid var(--colorNeutralStroke1, #d1d1d1);
|
|
381
|
-
border-radius: var(--borderRadiusMedium, 4px);
|
|
382
|
-
background-color: var(--colorNeutralBackground1, #ffffff);
|
|
383
|
-
color: var(--colorNeutralForeground1, #242424);
|
|
384
|
-
font-size: 12px;
|
|
385
|
-
font-weight: 500;
|
|
386
|
-
cursor: pointer;
|
|
387
|
-
transition: all 0.15s ease;
|
|
388
|
-
}
|
|
389
|
-
.clearButton:hover:not(:disabled) {
|
|
390
|
-
background-color: var(--colorNeutralBackground1Hover, #f5f5f5);
|
|
391
|
-
border-color: var(--colorNeutralStroke1Hover, #c7c7c7);
|
|
392
|
-
}
|
|
393
|
-
.clearButton:disabled {
|
|
394
|
-
opacity: 0.5;
|
|
395
|
-
cursor: not-allowed;
|
|
396
|
-
}
|
|
397
|
-
|
|
398
|
-
.applyButton {
|
|
399
|
-
padding: 6px 12px;
|
|
400
|
-
border: 1px solid var(--colorBrandBackground, #0f6cbd);
|
|
401
|
-
border-radius: var(--borderRadiusMedium, 4px);
|
|
402
|
-
background-color: var(--colorBrandBackground, #0f6cbd);
|
|
403
|
-
color: var(--colorNeutralForegroundOnBrand, #ffffff);
|
|
404
|
-
font-size: 12px;
|
|
405
|
-
font-weight: 600;
|
|
406
|
-
cursor: pointer;
|
|
407
|
-
transition: all 0.15s ease;
|
|
408
|
-
}
|
|
409
|
-
.applyButton:hover {
|
|
410
|
-
background-color: var(--colorBrandBackgroundHover, #115ea3);
|
|
411
|
-
border-color: var(--colorBrandBackgroundHover, #115ea3);
|
|
412
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { SearchRegular } from '@fluentui/react-icons';
|
|
3
|
-
import { useListVirtualizer } from '@alaarab/ogrid-react';
|
|
4
|
-
import styles from './ColumnHeaderFilter.module.css';
|
|
5
|
-
const ITEM_HEIGHT = 40;
|
|
6
|
-
export const MultiSelectFilterPopover = ({ searchText, onSearchChange, options, filteredOptions, selected, onOptionToggle, onSelectAll, onClearSelection, onApply, isLoading, onPopoverClick, onInputFocus, onInputMouseDown, onInputClick, onInputKeyDown, }) => {
|
|
7
|
-
const virt = useListVirtualizer({ count: filteredOptions.length, itemHeight: ITEM_HEIGHT });
|
|
8
|
-
return (_jsxs(_Fragment, { children: [_jsxs("div", { className: styles.popoverSearch, onClick: onPopoverClick, children: [_jsxs("div", { className: styles.nativeInputWrapper, children: [_jsx(SearchRegular, { className: styles.nativeInputIcon }), _jsx("input", { type: "text", placeholder: "Search...", value: searchText, onChange: (e) => onSearchChange(e.target.value), onFocus: onInputFocus, onMouseDown: onInputMouseDown, onClick: onInputClick, onKeyDown: onInputKeyDown, autoComplete: "off", className: styles.nativeInput })] }), _jsxs("div", { className: styles.resultCount, children: [filteredOptions.length, " of ", options.length, " options"] })] }), _jsxs("div", { className: styles.selectAllRow, onClick: onPopoverClick, children: [_jsxs("button", { type: "button", className: styles.selectAllButton, onClick: onSelectAll, children: ["Select All (", filteredOptions.length, ")"] }), _jsx("button", { type: "button", className: styles.selectAllButton, onClick: onClearSelection, children: "Clear" })] }), _jsx("div", { ref: virt.containerRef, onScroll: virt.onScroll, className: styles.popoverOptions, onClick: onPopoverClick, children: isLoading ? (_jsxs("div", { className: styles.loadingContainer, children: [_jsx("div", { className: styles.filterSpinner }), _jsx("span", { style: { fontSize: 12, color: 'var(--colorNeutralForeground2, #616161)' }, children: "Loading..." })] })) : filteredOptions.length === 0 ? (_jsx("div", { className: styles.noResults, children: "No options found" })) : (_jsx("div", { style: { height: virt.totalHeight, position: 'relative' }, children: virt.visibleItems.map(({ index, offsetTop }) => {
|
|
9
|
-
const option = filteredOptions[index];
|
|
10
|
-
const isChecked = selected.has(option);
|
|
11
|
-
return (_jsxs("label", { className: styles.popoverOption, style: { position: 'absolute', top: offsetTop, width: '100%', height: ITEM_HEIGHT, boxSizing: 'border-box', display: 'flex', alignItems: 'center' }, children: [_jsx("input", { type: "checkbox", checked: isChecked, onChange: (ev) => {
|
|
12
|
-
ev.stopPropagation();
|
|
13
|
-
onOptionToggle(option, ev.target.checked);
|
|
14
|
-
}, className: styles.nativeCheckbox }), _jsx("span", { className: styles.checkboxLabel, children: option })] }, option));
|
|
15
|
-
}) })) }), _jsxs("div", { className: styles.popoverActions, onClick: onPopoverClick, children: [_jsx("button", { type: "button", className: styles.clearButton, onClick: onClearSelection, children: "Clear" }), _jsx("button", { type: "button", className: styles.applyButton, onClick: onApply, children: "Apply" })] })] }));
|
|
16
|
-
};
|
|
17
|
-
MultiSelectFilterPopover.displayName = 'MultiSelectFilterPopover';
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { SearchRegular, FilterRegular } from '@fluentui/react-icons';
|
|
3
|
-
import styles from './ColumnHeaderFilter.module.css';
|
|
4
|
-
function getInitials(name) {
|
|
5
|
-
const parts = name.trim().split(/\s+/);
|
|
6
|
-
if (parts.length >= 2)
|
|
7
|
-
return (parts[0][0] + parts[parts.length - 1][0]).toUpperCase();
|
|
8
|
-
return (parts[0]?.[0] ?? '').toUpperCase();
|
|
9
|
-
}
|
|
10
|
-
export const PeopleFilterPopover = ({ selectedUser, searchText, onSearchChange, suggestions, isLoading, onUserSelect, onClearUser, onPopoverClick, inputRef, }) => (_jsxs(_Fragment, { children: [selectedUser && (_jsxs("div", { className: styles.selectedUserSection, onClick: onPopoverClick, children: [_jsx("div", { className: styles.selectedUserLabel, children: "Currently filtered by:" }), _jsxs("div", { className: styles.selectedUser, children: [_jsxs("div", { className: styles.userInfo, children: [_jsx("div", { className: styles.avatar, children: selectedUser.photo
|
|
11
|
-
? _jsx("img", { src: selectedUser.photo, alt: "", className: styles.avatarImg })
|
|
12
|
-
: _jsx("span", { className: styles.avatarInitials, children: getInitials(selectedUser.displayName) }) }), _jsxs("div", { className: styles.userText, children: [_jsx("div", { children: selectedUser.displayName }), _jsx("div", { className: styles.userSecondary, children: selectedUser.email })] })] }), _jsx("button", { type: "button", className: styles.removeUserButton, onClick: onClearUser, "aria-label": "Remove filter", children: _jsx(FilterRegular, {}) })] })] })), _jsx("div", { className: styles.popoverSearch, onClick: onPopoverClick, children: _jsxs("div", { className: styles.nativeInputWrapper, children: [_jsx(SearchRegular, { className: styles.nativeInputIcon }), _jsx("input", { ref: inputRef, type: "text", placeholder: "Search for a person...", value: searchText, onChange: (e) => onSearchChange(e.target.value), onFocus: (e) => e.stopPropagation(), onMouseDown: (e) => e.stopPropagation(), onClick: (e) => e.stopPropagation(), onKeyDown: (e) => e.stopPropagation(), autoComplete: "off", className: styles.nativeInput })] }) }), _jsx("div", { className: styles.popoverOptions, onClick: onPopoverClick, children: isLoading && searchText.trim() ? (_jsxs("div", { className: styles.loadingContainer, children: [_jsx("div", { className: styles.filterSpinner }), _jsx("span", { style: { fontSize: 12, color: 'var(--colorNeutralForeground2, #616161)' }, children: "Searching..." })] })) : suggestions.length === 0 && searchText.trim() ? (_jsx("div", { className: styles.noResults, children: "No results found" })) : searchText.trim() ? (suggestions.map((user) => (_jsx("div", { className: styles.personOption, onClick: (e) => {
|
|
13
|
-
e.stopPropagation();
|
|
14
|
-
onUserSelect(user);
|
|
15
|
-
}, children: _jsxs("div", { className: styles.userInfo, children: [_jsx("div", { className: styles.avatar, children: user.photo
|
|
16
|
-
? _jsx("img", { src: user.photo, alt: "", className: styles.avatarImg })
|
|
17
|
-
: _jsx("span", { className: styles.avatarInitials, children: getInitials(user.displayName) }) }), _jsxs("div", { className: styles.userText, children: [_jsx("div", { children: user.displayName }), _jsx("div", { className: styles.userSecondary, children: user.email })] })] }) }, user.id ?? user.email ?? user.displayName)))) : (_jsx("div", { className: styles.noResults, children: "Type to search..." })) }), selectedUser && (_jsx("div", { className: styles.popoverActions, onClick: onPopoverClick, children: _jsx("button", { type: "button", className: styles.clearButton, onClick: onClearUser, children: "Clear Filter" }) }))] }));
|
|
18
|
-
PeopleFilterPopover.displayName = 'PeopleFilterPopover';
|