@alaarab/ogrid-react-material 2.3.0 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/index.js +141 -304
- package/package.json +2 -2
package/dist/esm/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as React4 from 'react';
|
|
2
2
|
import { useMemo, useCallback, useState, useRef, useEffect } from 'react';
|
|
3
|
-
import { Box, Tooltip, Typography, IconButton, Popover,
|
|
4
|
-
import { useColumnHeaderFilterState, getColumnHeaderFilterStateParams, renderFilterContent, areGridRowPropsEqual,
|
|
3
|
+
import { Box, Tooltip, Typography, IconButton, Popover, useTheme, TextField, InputAdornment, Button, CircularProgress, FormControlLabel, Checkbox, Avatar, Table, TableHead, TableRow, TableCell, Select, MenuItem, Menu, Divider } from '@mui/material';
|
|
4
|
+
import { createBaseFilterRenderers, useColumnHeaderFilterState, getColumnHeaderFilterStateParams, renderFilterContent, areGridRowPropsEqual, PaginationControlsBase, createOGrid, useListVirtualizer, CHECKBOX_COLUMN_WIDTH, STOP_PROPAGATION, ROW_NUMBER_COLUMN_WIDTH, useDataGridTableOrchestration, useColumnMeta, getCellRenderDescriptor, buildInlineEditorProps, buildPopoverEditorProps, resolveCellDisplayContent, resolveCellStyle, getCellInteractionProps, CellErrorBoundary, PREVENT_DEFAULT, indexToColumnLetter, getHeaderFilterConfig, MarchingAntsOverlay, FormulaRefOverlay, NOOP, getColumnHeaderMenuProps, useColumnChooserState, ColumnChooserContent, BaseInlineCellEditor, partitionColumnsForVirtualization, getContextMenuHandlers, GRID_CONTEXT_MENU_ITEMS, formatShortcut, getColumnHeaderMenuItems, getStatusBarParts } from '@alaarab/ogrid-react';
|
|
5
5
|
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';
|
|
6
6
|
import { createPortal } from 'react-dom';
|
|
7
|
-
import { FilterList,
|
|
7
|
+
import { FilterList, Search, Clear, ExpandLess, ExpandMore, ViewColumn, LastPage, ChevronRight, ChevronLeft, FirstPage } from '@mui/icons-material';
|
|
8
8
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
9
9
|
|
|
10
10
|
// src/OGrid/OGrid.tsx
|
|
@@ -228,56 +228,9 @@ var PeopleFilterPopover = ({
|
|
|
228
228
|
selectedUser && /* @__PURE__ */ jsx(Box, { sx: { p: 1.5, pt: 1, borderTop: 1, borderColor: "divider" }, children: /* @__PURE__ */ jsx(Button, { size: "small", fullWidth: true, onClick: onClearUser, children: "Clear Filter" }) })
|
|
229
229
|
] });
|
|
230
230
|
PeopleFilterPopover.displayName = "PeopleFilterPopover";
|
|
231
|
-
var materialRenderers =
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
{
|
|
235
|
-
searchText: p.searchText,
|
|
236
|
-
onSearchChange: p.onSearchChange,
|
|
237
|
-
options: p.options,
|
|
238
|
-
filteredOptions: p.filteredOptions,
|
|
239
|
-
selected: p.selected,
|
|
240
|
-
onOptionToggle: p.onOptionToggle,
|
|
241
|
-
onSelectAll: p.onSelectAll,
|
|
242
|
-
onClearSelection: p.onClearSelection,
|
|
243
|
-
onApply: p.onApply,
|
|
244
|
-
isLoading: p.isLoading
|
|
245
|
-
}
|
|
246
|
-
),
|
|
247
|
-
renderText: (p) => /* @__PURE__ */ jsx(
|
|
248
|
-
TextFilterPopover,
|
|
249
|
-
{
|
|
250
|
-
value: p.value,
|
|
251
|
-
onValueChange: p.onValueChange,
|
|
252
|
-
onApply: p.onApply,
|
|
253
|
-
onClear: p.onClear
|
|
254
|
-
}
|
|
255
|
-
),
|
|
256
|
-
renderPeople: (p) => /* @__PURE__ */ jsx(
|
|
257
|
-
PeopleFilterPopover,
|
|
258
|
-
{
|
|
259
|
-
selectedUser: p.selectedUser,
|
|
260
|
-
searchText: p.searchText,
|
|
261
|
-
onSearchChange: p.onSearchChange,
|
|
262
|
-
suggestions: p.suggestions,
|
|
263
|
-
isLoading: p.isLoading,
|
|
264
|
-
onUserSelect: p.onUserSelect,
|
|
265
|
-
onClearUser: p.onClearUser,
|
|
266
|
-
inputRef: p.inputRef
|
|
267
|
-
}
|
|
268
|
-
),
|
|
269
|
-
renderDate: (p) => /* @__PURE__ */ jsx(
|
|
270
|
-
DateFilterContent,
|
|
271
|
-
{
|
|
272
|
-
tempDateFrom: p.tempDateFrom,
|
|
273
|
-
setTempDateFrom: p.setTempDateFrom,
|
|
274
|
-
tempDateTo: p.tempDateTo,
|
|
275
|
-
setTempDateTo: p.setTempDateTo,
|
|
276
|
-
onApply: p.onApply,
|
|
277
|
-
onClear: p.onClear
|
|
278
|
-
}
|
|
279
|
-
)
|
|
280
|
-
};
|
|
231
|
+
var materialRenderers = createBaseFilterRenderers(
|
|
232
|
+
{ MultiSelectFilterPopover, TextFilterPopover, PeopleFilterPopover }
|
|
233
|
+
);
|
|
281
234
|
var ColumnHeaderFilter = React4.memo((props) => {
|
|
282
235
|
const {
|
|
283
236
|
columnName,
|
|
@@ -1351,6 +1304,14 @@ function DataGridTableInner(props) {
|
|
|
1351
1304
|
isDragging
|
|
1352
1305
|
}
|
|
1353
1306
|
),
|
|
1307
|
+
props.formulaReferences && props.formulaReferences.length > 0 && /* @__PURE__ */ jsx(
|
|
1308
|
+
FormulaRefOverlay,
|
|
1309
|
+
{
|
|
1310
|
+
containerRef: tableContainerRef,
|
|
1311
|
+
references: props.formulaReferences,
|
|
1312
|
+
colOffset
|
|
1313
|
+
}
|
|
1314
|
+
),
|
|
1354
1315
|
showEmptyInGrid && emptyState && /* @__PURE__ */ jsx(EmptyState, { emptyState })
|
|
1355
1316
|
] }) }) }),
|
|
1356
1317
|
menuPosition && createPortal(
|
|
@@ -1373,28 +1334,7 @@ function DataGridTableInner(props) {
|
|
|
1373
1334
|
),
|
|
1374
1335
|
document.body
|
|
1375
1336
|
),
|
|
1376
|
-
/* @__PURE__ */ jsx(
|
|
1377
|
-
ColumnHeaderMenu,
|
|
1378
|
-
{
|
|
1379
|
-
isOpen: headerMenu.isOpen,
|
|
1380
|
-
anchorElement: headerMenu.anchorElement,
|
|
1381
|
-
onClose: headerMenu.close,
|
|
1382
|
-
onPinLeft: headerMenu.handlePinLeft,
|
|
1383
|
-
onPinRight: headerMenu.handlePinRight,
|
|
1384
|
-
onUnpin: headerMenu.handleUnpin,
|
|
1385
|
-
onSortAsc: headerMenu.handleSortAsc,
|
|
1386
|
-
onSortDesc: headerMenu.handleSortDesc,
|
|
1387
|
-
onClearSort: headerMenu.handleClearSort,
|
|
1388
|
-
onAutosizeThis: headerMenu.handleAutosizeThis,
|
|
1389
|
-
onAutosizeAll: headerMenu.handleAutosizeAll,
|
|
1390
|
-
canPinLeft: headerMenu.canPinLeft,
|
|
1391
|
-
canPinRight: headerMenu.canPinRight,
|
|
1392
|
-
canUnpin: headerMenu.canUnpin,
|
|
1393
|
-
currentSort: headerMenu.currentSort,
|
|
1394
|
-
isSortable: headerMenu.isSortable,
|
|
1395
|
-
isResizable: headerMenu.isResizable
|
|
1396
|
-
}
|
|
1397
|
-
)
|
|
1337
|
+
/* @__PURE__ */ jsx(ColumnHeaderMenu, { ...getColumnHeaderMenuProps(headerMenu) })
|
|
1398
1338
|
]
|
|
1399
1339
|
}
|
|
1400
1340
|
),
|
|
@@ -1413,6 +1353,53 @@ function DataGridTableInner(props) {
|
|
|
1413
1353
|
] });
|
|
1414
1354
|
}
|
|
1415
1355
|
var DataGridTable = React4.memo(DataGridTableInner);
|
|
1356
|
+
var CheckboxItem = ({ columnId: _columnId, columnName, checked, disabled, onChange }) => /* @__PURE__ */ jsx(
|
|
1357
|
+
FormControlLabel,
|
|
1358
|
+
{
|
|
1359
|
+
control: /* @__PURE__ */ jsx(
|
|
1360
|
+
Checkbox,
|
|
1361
|
+
{
|
|
1362
|
+
size: "small",
|
|
1363
|
+
checked,
|
|
1364
|
+
onChange: (ev) => {
|
|
1365
|
+
ev.stopPropagation();
|
|
1366
|
+
onChange(ev.target.checked);
|
|
1367
|
+
},
|
|
1368
|
+
disabled
|
|
1369
|
+
}
|
|
1370
|
+
),
|
|
1371
|
+
label: /* @__PURE__ */ jsx(Typography, { variant: "body2", children: columnName }),
|
|
1372
|
+
sx: { m: 0 }
|
|
1373
|
+
}
|
|
1374
|
+
);
|
|
1375
|
+
var Header = ({ visibleCount, totalCount }) => /* @__PURE__ */ jsx(Box, { sx: { px: 1.5, py: 1, borderBottom: 1, borderColor: "divider", bgcolor: "action.hover" }, children: /* @__PURE__ */ jsxs(Typography, { variant: "subtitle2", fontWeight: 600, children: [
|
|
1376
|
+
"Select Columns (",
|
|
1377
|
+
visibleCount,
|
|
1378
|
+
" of ",
|
|
1379
|
+
totalCount,
|
|
1380
|
+
")"
|
|
1381
|
+
] }) });
|
|
1382
|
+
var OptionsListContainer = ({ children }) => /* @__PURE__ */ jsx(Box, { sx: { maxHeight: 320, overflowY: "auto", py: 0.5 }, children });
|
|
1383
|
+
var OptionItemContainer = ({ children }) => /* @__PURE__ */ jsx(Box, { sx: { px: 1.5, minHeight: 32, display: "flex", alignItems: "center" }, children });
|
|
1384
|
+
var Actions = ({ onClearAll, onSelectAll }) => /* @__PURE__ */ jsxs(
|
|
1385
|
+
Box,
|
|
1386
|
+
{
|
|
1387
|
+
sx: {
|
|
1388
|
+
display: "flex",
|
|
1389
|
+
justifyContent: "flex-end",
|
|
1390
|
+
gap: 1,
|
|
1391
|
+
px: 1.5,
|
|
1392
|
+
py: 1,
|
|
1393
|
+
borderTop: 1,
|
|
1394
|
+
borderColor: "divider",
|
|
1395
|
+
bgcolor: "action.hover"
|
|
1396
|
+
},
|
|
1397
|
+
children: [
|
|
1398
|
+
/* @__PURE__ */ jsx(Button, { size: "small", onClick: onClearAll, sx: { textTransform: "none" }, children: "Clear All" }),
|
|
1399
|
+
/* @__PURE__ */ jsx(Button, { size: "small", variant: "contained", onClick: onSelectAll, sx: { textTransform: "none" }, children: "Select All" })
|
|
1400
|
+
]
|
|
1401
|
+
}
|
|
1402
|
+
);
|
|
1416
1403
|
var ColumnChooser = (props) => {
|
|
1417
1404
|
const { columns, visibleColumns, onVisibilityChange, onSetVisibleColumns, className } = props;
|
|
1418
1405
|
const [anchorEl, setAnchorEl] = useState(null);
|
|
@@ -1440,10 +1427,7 @@ var ColumnChooser = (props) => {
|
|
|
1440
1427
|
handleClose();
|
|
1441
1428
|
setAnchorEl(null);
|
|
1442
1429
|
};
|
|
1443
|
-
const handleCheckboxChange = (columnKey) => (
|
|
1444
|
-
ev.stopPropagation();
|
|
1445
|
-
setColumnVisible(columnKey)(ev.target.checked);
|
|
1446
|
-
};
|
|
1430
|
+
const handleCheckboxChange = (columnKey) => (checked) => setColumnVisible(columnKey)(checked);
|
|
1447
1431
|
return /* @__PURE__ */ jsxs(Box, { className, sx: { display: "inline-flex" }, children: [
|
|
1448
1432
|
/* @__PURE__ */ jsxs(
|
|
1449
1433
|
Button,
|
|
@@ -1471,7 +1455,7 @@ var ColumnChooser = (props) => {
|
|
|
1471
1455
|
]
|
|
1472
1456
|
}
|
|
1473
1457
|
),
|
|
1474
|
-
/* @__PURE__ */
|
|
1458
|
+
/* @__PURE__ */ jsx(
|
|
1475
1459
|
Popover,
|
|
1476
1460
|
{
|
|
1477
1461
|
open: isOpen,
|
|
@@ -1479,236 +1463,89 @@ var ColumnChooser = (props) => {
|
|
|
1479
1463
|
onClose: handlePopoverClose,
|
|
1480
1464
|
anchorOrigin: { vertical: "bottom", horizontal: "right" },
|
|
1481
1465
|
transformOrigin: { vertical: "top", horizontal: "right" },
|
|
1482
|
-
slotProps: {
|
|
1483
|
-
|
|
1484
|
-
|
|
1466
|
+
slotProps: { paper: { sx: { mt: 0.5, minWidth: 220 } } },
|
|
1467
|
+
children: /* @__PURE__ */ jsx(
|
|
1468
|
+
ColumnChooserContent,
|
|
1469
|
+
{
|
|
1470
|
+
columns,
|
|
1471
|
+
visibleColumns,
|
|
1472
|
+
visibleCount,
|
|
1473
|
+
totalCount,
|
|
1474
|
+
handleSelectAll,
|
|
1475
|
+
handleClearAll,
|
|
1476
|
+
handleCheckboxChange,
|
|
1477
|
+
CheckboxItem,
|
|
1478
|
+
Header,
|
|
1479
|
+
OptionsListContainer,
|
|
1480
|
+
OptionItemContainer,
|
|
1481
|
+
Actions
|
|
1485
1482
|
}
|
|
1486
|
-
|
|
1487
|
-
children: [
|
|
1488
|
-
/* @__PURE__ */ jsx(
|
|
1489
|
-
Box,
|
|
1490
|
-
{
|
|
1491
|
-
sx: {
|
|
1492
|
-
px: 1.5,
|
|
1493
|
-
py: 1,
|
|
1494
|
-
borderBottom: 1,
|
|
1495
|
-
borderColor: "divider",
|
|
1496
|
-
bgcolor: "action.hover"
|
|
1497
|
-
},
|
|
1498
|
-
children: /* @__PURE__ */ jsxs(Typography, { variant: "subtitle2", fontWeight: 600, children: [
|
|
1499
|
-
"Select Columns (",
|
|
1500
|
-
visibleCount,
|
|
1501
|
-
" of ",
|
|
1502
|
-
totalCount,
|
|
1503
|
-
")"
|
|
1504
|
-
] })
|
|
1505
|
-
}
|
|
1506
|
-
),
|
|
1507
|
-
/* @__PURE__ */ jsx(Box, { sx: { maxHeight: 320, overflowY: "auto", py: 0.5 }, children: columns.map((column) => /* @__PURE__ */ jsx(Box, { sx: { px: 1.5, minHeight: 32, display: "flex", alignItems: "center" }, children: /* @__PURE__ */ jsx(
|
|
1508
|
-
FormControlLabel,
|
|
1509
|
-
{
|
|
1510
|
-
control: /* @__PURE__ */ jsx(
|
|
1511
|
-
Checkbox,
|
|
1512
|
-
{
|
|
1513
|
-
size: "small",
|
|
1514
|
-
checked: visibleColumns.has(column.columnId),
|
|
1515
|
-
onChange: handleCheckboxChange(column.columnId),
|
|
1516
|
-
disabled: column.required === true
|
|
1517
|
-
}
|
|
1518
|
-
),
|
|
1519
|
-
label: /* @__PURE__ */ jsx(Typography, { variant: "body2", children: column.name }),
|
|
1520
|
-
sx: { m: 0 }
|
|
1521
|
-
}
|
|
1522
|
-
) }, column.columnId)) }),
|
|
1523
|
-
/* @__PURE__ */ jsxs(
|
|
1524
|
-
Box,
|
|
1525
|
-
{
|
|
1526
|
-
sx: {
|
|
1527
|
-
display: "flex",
|
|
1528
|
-
justifyContent: "flex-end",
|
|
1529
|
-
gap: 1,
|
|
1530
|
-
px: 1.5,
|
|
1531
|
-
py: 1,
|
|
1532
|
-
borderTop: 1,
|
|
1533
|
-
borderColor: "divider",
|
|
1534
|
-
bgcolor: "action.hover"
|
|
1535
|
-
},
|
|
1536
|
-
children: [
|
|
1537
|
-
/* @__PURE__ */ jsx(Button, { size: "small", onClick: handleClearAll, sx: { textTransform: "none" }, children: "Clear All" }),
|
|
1538
|
-
/* @__PURE__ */ jsx(
|
|
1539
|
-
Button,
|
|
1540
|
-
{
|
|
1541
|
-
size: "small",
|
|
1542
|
-
variant: "contained",
|
|
1543
|
-
onClick: handleSelectAll,
|
|
1544
|
-
sx: { textTransform: "none" },
|
|
1545
|
-
children: "Select All"
|
|
1546
|
-
}
|
|
1547
|
-
)
|
|
1548
|
-
]
|
|
1549
|
-
}
|
|
1550
|
-
)
|
|
1551
|
-
]
|
|
1483
|
+
)
|
|
1552
1484
|
}
|
|
1553
1485
|
)
|
|
1554
1486
|
] });
|
|
1555
1487
|
};
|
|
1556
|
-
var
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
pageSizeOptions,
|
|
1574
|
-
entityLabelPlural
|
|
1575
|
-
});
|
|
1576
|
-
const handlePageSizeChangeEvent = (event) => {
|
|
1577
|
-
handlePageSizeChange(Number(event.target.value));
|
|
1578
|
-
};
|
|
1579
|
-
if (!vm) {
|
|
1580
|
-
return null;
|
|
1488
|
+
var MUI_NAV_ICONS = {
|
|
1489
|
+
first: /* @__PURE__ */ jsx(FirstPage, { fontSize: "small" }),
|
|
1490
|
+
prev: /* @__PURE__ */ jsx(ChevronLeft, { fontSize: "small" }),
|
|
1491
|
+
next: /* @__PURE__ */ jsx(ChevronRight, { fontSize: "small" }),
|
|
1492
|
+
last: /* @__PURE__ */ jsx(LastPage, { fontSize: "small" })
|
|
1493
|
+
};
|
|
1494
|
+
var NavButton = ({ variant, onClick, disabled, "aria-label": ariaLabel }) => /* @__PURE__ */ jsx(IconButton, { size: "small", onClick, disabled, "aria-label": ariaLabel, children: MUI_NAV_ICONS[variant] });
|
|
1495
|
+
var PageButton = ({ onClick, active, "aria-label": ariaLabel, "aria-current": ariaCurrent, children }) => /* @__PURE__ */ jsx(
|
|
1496
|
+
Button,
|
|
1497
|
+
{
|
|
1498
|
+
variant: active ? "contained" : "outlined",
|
|
1499
|
+
size: "small",
|
|
1500
|
+
onClick,
|
|
1501
|
+
"aria-label": ariaLabel,
|
|
1502
|
+
"aria-current": ariaCurrent,
|
|
1503
|
+
sx: { minWidth: 32, px: 0.5 },
|
|
1504
|
+
children
|
|
1581
1505
|
}
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
size: "small",
|
|
1626
|
-
onClick: () => onPageChange(currentPage - 1),
|
|
1627
|
-
disabled: currentPage === 1,
|
|
1628
|
-
"aria-label": "Previous page",
|
|
1629
|
-
children: /* @__PURE__ */ jsx(ChevronLeft, { fontSize: "small" })
|
|
1630
|
-
}
|
|
1631
|
-
),
|
|
1632
|
-
showStartEllipsis && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1633
|
-
/* @__PURE__ */ jsx(
|
|
1634
|
-
Button,
|
|
1635
|
-
{
|
|
1636
|
-
variant: "outlined",
|
|
1637
|
-
size: "small",
|
|
1638
|
-
onClick: () => onPageChange(1),
|
|
1639
|
-
"aria-label": "Page 1",
|
|
1640
|
-
sx: { minWidth: 32, px: 0.5 },
|
|
1641
|
-
children: "1"
|
|
1642
|
-
}
|
|
1643
|
-
),
|
|
1644
|
-
/* @__PURE__ */ jsx(Typography, { variant: "body2", color: "text.secondary", sx: { mx: 0.5 }, "aria-hidden": true, children: "\u2026" })
|
|
1645
|
-
] }),
|
|
1646
|
-
pageNumbers.map((pageNum) => /* @__PURE__ */ jsx(
|
|
1647
|
-
Button,
|
|
1648
|
-
{
|
|
1649
|
-
variant: currentPage === pageNum ? "contained" : "outlined",
|
|
1650
|
-
size: "small",
|
|
1651
|
-
onClick: () => onPageChange(pageNum),
|
|
1652
|
-
"aria-label": `Page ${pageNum}`,
|
|
1653
|
-
"aria-current": currentPage === pageNum ? "page" : void 0,
|
|
1654
|
-
sx: { minWidth: 32, px: 0.5 },
|
|
1655
|
-
children: pageNum
|
|
1656
|
-
},
|
|
1657
|
-
pageNum
|
|
1658
|
-
)),
|
|
1659
|
-
showEndEllipsis && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1660
|
-
/* @__PURE__ */ jsx(Typography, { variant: "body2", color: "text.secondary", sx: { mx: 0.5 }, "aria-hidden": true, children: "\u2026" }),
|
|
1661
|
-
/* @__PURE__ */ jsx(
|
|
1662
|
-
Button,
|
|
1663
|
-
{
|
|
1664
|
-
variant: "outlined",
|
|
1665
|
-
size: "small",
|
|
1666
|
-
onClick: () => onPageChange(totalPages),
|
|
1667
|
-
"aria-label": `Page ${totalPages}`,
|
|
1668
|
-
sx: { minWidth: 32, px: 0.5 },
|
|
1669
|
-
children: totalPages
|
|
1670
|
-
}
|
|
1671
|
-
)
|
|
1672
|
-
] }),
|
|
1673
|
-
/* @__PURE__ */ jsx(
|
|
1674
|
-
IconButton,
|
|
1675
|
-
{
|
|
1676
|
-
size: "small",
|
|
1677
|
-
onClick: () => onPageChange(currentPage + 1),
|
|
1678
|
-
disabled: currentPage >= totalPages,
|
|
1679
|
-
"aria-label": "Next page",
|
|
1680
|
-
children: /* @__PURE__ */ jsx(ChevronRight, { fontSize: "small" })
|
|
1681
|
-
}
|
|
1682
|
-
),
|
|
1683
|
-
/* @__PURE__ */ jsx(
|
|
1684
|
-
IconButton,
|
|
1685
|
-
{
|
|
1686
|
-
size: "small",
|
|
1687
|
-
onClick: () => onPageChange(totalPages),
|
|
1688
|
-
disabled: currentPage >= totalPages,
|
|
1689
|
-
"aria-label": "Last page",
|
|
1690
|
-
children: /* @__PURE__ */ jsx(LastPage, { fontSize: "small" })
|
|
1691
|
-
}
|
|
1692
|
-
)
|
|
1693
|
-
] }),
|
|
1694
|
-
/* @__PURE__ */ jsxs(Box, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: [
|
|
1695
|
-
/* @__PURE__ */ jsx(Typography, { variant: "body2", color: "text.secondary", children: "Rows" }),
|
|
1696
|
-
/* @__PURE__ */ jsx(
|
|
1697
|
-
Select,
|
|
1698
|
-
{
|
|
1699
|
-
value: pageSize,
|
|
1700
|
-
onChange: handlePageSizeChangeEvent,
|
|
1701
|
-
size: "small",
|
|
1702
|
-
"aria-label": "Rows per page",
|
|
1703
|
-
sx: { minWidth: 70 },
|
|
1704
|
-
children: vm.pageSizeOptions.map((n) => /* @__PURE__ */ jsx(MenuItem, { value: n, children: n }, n))
|
|
1705
|
-
}
|
|
1706
|
-
)
|
|
1707
|
-
] })
|
|
1708
|
-
]
|
|
1709
|
-
}
|
|
1710
|
-
);
|
|
1711
|
-
});
|
|
1506
|
+
);
|
|
1507
|
+
var PageSizeSelect = ({ value, options, onChange, "aria-label": ariaLabel }) => {
|
|
1508
|
+
const handleChange = (event) => onChange(Number(event.target.value));
|
|
1509
|
+
return /* @__PURE__ */ jsx(Select, { value, onChange: handleChange, size: "small", "aria-label": ariaLabel, sx: { minWidth: 70 }, children: options.map((n) => /* @__PURE__ */ jsx(MenuItem, { value: n, children: n }, n)) });
|
|
1510
|
+
};
|
|
1511
|
+
var OuterContainer = ({ children, className, role, "aria-label": ariaLabel }) => /* @__PURE__ */ jsx(
|
|
1512
|
+
Box,
|
|
1513
|
+
{
|
|
1514
|
+
className,
|
|
1515
|
+
role,
|
|
1516
|
+
"aria-label": ariaLabel,
|
|
1517
|
+
sx: {
|
|
1518
|
+
display: "flex",
|
|
1519
|
+
alignItems: "center",
|
|
1520
|
+
justifyContent: "space-between",
|
|
1521
|
+
flexWrap: "wrap",
|
|
1522
|
+
gap: 2,
|
|
1523
|
+
px: 1.5,
|
|
1524
|
+
width: "100%",
|
|
1525
|
+
minWidth: 0,
|
|
1526
|
+
boxSizing: "border-box"
|
|
1527
|
+
},
|
|
1528
|
+
children
|
|
1529
|
+
}
|
|
1530
|
+
);
|
|
1531
|
+
var InfoText = ({ children }) => /* @__PURE__ */ jsx(Typography, { variant: "body2", color: "text.secondary", children });
|
|
1532
|
+
var NavButtonsContainer = ({ children }) => /* @__PURE__ */ jsx(Box, { sx: { display: "flex", alignItems: "center", gap: 0.5 }, children });
|
|
1533
|
+
var PageSizeContainer = ({ children }) => /* @__PURE__ */ jsx(Box, { sx: { display: "flex", alignItems: "center", gap: 1 }, children });
|
|
1534
|
+
var PageSizeLabel = () => /* @__PURE__ */ jsx(Typography, { variant: "body2", color: "text.secondary", children: "Rows" });
|
|
1535
|
+
var Ellipsis = () => /* @__PURE__ */ jsx(Typography, { variant: "body2", color: "text.secondary", sx: { mx: 0.5 }, "aria-hidden": true, children: "\u2026" });
|
|
1536
|
+
var SLOTS = {
|
|
1537
|
+
NavButton,
|
|
1538
|
+
PageButton,
|
|
1539
|
+
PageSizeSelect,
|
|
1540
|
+
OuterContainer,
|
|
1541
|
+
InfoText,
|
|
1542
|
+
NavButtonsContainer,
|
|
1543
|
+
PageSizeContainer,
|
|
1544
|
+
PageSizeLabel,
|
|
1545
|
+
Ellipsis
|
|
1546
|
+
};
|
|
1547
|
+
var PaginationControls = React4.memo((props) => /* @__PURE__ */ jsx(PaginationControlsBase, { ...props, slots: SLOTS }));
|
|
1548
|
+
PaginationControls.displayName = "PaginationControls";
|
|
1712
1549
|
var MuiThemeContainer = React4.forwardRef(
|
|
1713
1550
|
function MuiThemeContainer2(props, ref) {
|
|
1714
1551
|
const theme = useTheme();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alaarab/ogrid-react-material",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.0",
|
|
4
4
|
"description": "OGrid React Material implementation – MUI Table–based data grid with sorting, filtering, pagination, column chooser, spreadsheet selection, and CSV export.",
|
|
5
5
|
"main": "dist/esm/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"node": ">=18"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@alaarab/ogrid-react": "2.
|
|
42
|
+
"@alaarab/ogrid-react": "2.4.0"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
45
|
"@emotion/react": "^11.0.0",
|