tp-react-elements 1.3.6 → 1.3.8
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/_virtual/index.esm4.js +2 -2
- package/dist/_virtual/index.esm5.js +2 -2
- package/dist/_virtual/index.esm6.js +2 -2
- package/dist/_virtual/index.esm7.js +2 -2
- package/dist/components/Form/FormRender.esm.js +3 -3
- package/dist/components/FormComponents/index.esm.js +4 -4
- package/dist/components/PaginatedGrid/DynamicFilterBar.esm.js +2 -2
- package/dist/components/PaginatedGrid/GenericPaginatedGrid.d.ts +7 -1
- package/dist/components/PaginatedGrid/GenericPaginatedGrid.esm.js +55 -4
- package/dist/node_modules/react-date-range/dist/components/Calendar/index.esm.js +1 -1
- package/dist/node_modules/react-date-range/dist/components/DateRange/index.esm.js +1 -1
- package/dist/node_modules/react-date-range/dist/components/DateRangePicker/index.esm.js +1 -1
- package/dist/node_modules/react-date-range/dist/components/DefinedRange/index.esm.js +1 -1
- package/package.json +1 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var
|
|
1
|
+
var Calendar = {};
|
|
2
2
|
|
|
3
|
-
export {
|
|
3
|
+
export { Calendar as __exports };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var
|
|
1
|
+
var DefinedRange = {};
|
|
2
2
|
|
|
3
|
-
export {
|
|
3
|
+
export { DefinedRange as __exports };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var
|
|
1
|
+
var DateRangePicker = {};
|
|
2
2
|
|
|
3
|
-
export {
|
|
3
|
+
export { DateRangePicker as __exports };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var
|
|
1
|
+
var DateRange = {};
|
|
2
2
|
|
|
3
|
-
export {
|
|
3
|
+
export { DateRange as __exports };
|
|
@@ -5,9 +5,6 @@ import FormCheckBoxGroup from '../FormComponents/FormCheckBoxGroup/FormCheckBoxG
|
|
|
5
5
|
import FormNumberField from '../FormComponents/FormNumberField/FormNumberField.esm.js';
|
|
6
6
|
import FormNumberFieldDecimal from '../FormComponents/FormNumberField/FormNumberFieldDecimal.esm.js';
|
|
7
7
|
import FormRadioGroup from '../FormComponents/FormRadioGroup/FormRadioGroup.esm.js';
|
|
8
|
-
import FormTextAreaField from '../FormComponents/FormTextAreaField/FormTextAreaField.esm.js';
|
|
9
|
-
import FormTextField from '../FormComponents/FormTextField/FormTextField.esm.js';
|
|
10
|
-
import PasswordField from '../FormComponents/PasswordField/PasswordField.esm.js';
|
|
11
8
|
import SingleSelect from '../FormComponents/Select/SingleSelect.esm.js';
|
|
12
9
|
import MultiSelectAutocomplete from '../FormComponents/Select/MultiSelectAutocomplete.esm.js';
|
|
13
10
|
import SingleSelectNonAutoComplete from '../FormComponents/Select/SingleSelectNonAutoComplete.esm.js';
|
|
@@ -18,6 +15,9 @@ import DateRangePickerComponent from '../DateRangePicker/DateRangePicker.esm.js'
|
|
|
18
15
|
import RichTextEditorWrapper from '../FormComponents/RichTextEditor/RichTextEditorWrapper.esm.js';
|
|
19
16
|
import SingleSelectSearchApi from '../FormComponents/Select/SingleSelectSearchApi.esm.js';
|
|
20
17
|
import DatetimepickerWrapper from '../FormComponents/DatePicker/DatetimepickerWrapper.esm.js';
|
|
18
|
+
import FormTextAreaField from '../FormComponents/FormTextAreaField/FormTextAreaField.esm.js';
|
|
19
|
+
import PasswordField from '../FormComponents/PasswordField/PasswordField.esm.js';
|
|
20
|
+
import FormTextField from '../FormComponents/FormTextField/FormTextField.esm.js';
|
|
21
21
|
|
|
22
22
|
// Lazy-loaded heavy components
|
|
23
23
|
// const RichTextEditorWrapper = lazy(() =>
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
export { default as FormNumberField } from './FormNumberField/FormNumberField.esm.js';
|
|
2
2
|
export { default as FormNumberFieldDecimal } from './FormNumberField/FormNumberFieldDecimal.esm.js';
|
|
3
|
-
export { default as FormTextAreaField } from './FormTextAreaField/FormTextAreaField.esm.js';
|
|
4
|
-
export { default as FormTextField } from './FormTextField/FormTextField.esm.js';
|
|
5
|
-
export { default as PasswordField } from './PasswordField/PasswordField.esm.js';
|
|
6
3
|
export { default as FormCheckBox } from './FormCheckBox/FormCheckBox.esm.js';
|
|
7
4
|
export { default as SingleSelect } from './Select/SingleSelect.esm.js';
|
|
8
5
|
export { default as SingleSelectNonAutoComplete } from './Select/SingleSelectNonAutoComplete.esm.js';
|
|
@@ -15,7 +12,6 @@ export { default as FormRadioGroup } from './FormRadioGroup/FormRadioGroup.esm.j
|
|
|
15
12
|
export { default as DatepickerWrapperV2 } from './DatePicker/DatepickerWrapperV2.esm.js';
|
|
16
13
|
export { default as Monthpickerrender } from './DatePicker/Monthpickerrender.esm.js';
|
|
17
14
|
export { default as YearPickerField } from './YearPickerField/YearPickerField.esm.js';
|
|
18
|
-
export { default as TimePicker } from './TimePicker/TimePicker.esm.js';
|
|
19
15
|
export { default as FormRenderFileUpload } from './FileUpload/FormRenderFileUpload.esm.js';
|
|
20
16
|
export { default as FormRenderMultiFileUpload } from './FileUpload/FormRenderMultiFileUpload.esm.js';
|
|
21
17
|
import 'react/jsx-runtime';
|
|
@@ -34,6 +30,10 @@ import '@mui/icons-material/PictureAsPdf';
|
|
|
34
30
|
import '@mui/icons-material/TableChart';
|
|
35
31
|
import '@mui/icons-material/Description';
|
|
36
32
|
export { default as FormErrorField } from './FormErrorField/FormErrorField.esm.js';
|
|
33
|
+
export { default as FormTextAreaField } from './FormTextAreaField/FormTextAreaField.esm.js';
|
|
34
|
+
export { default as FormTextField } from './FormTextField/FormTextField.esm.js';
|
|
37
35
|
export { default as HelperText } from './HelperText/HelperText.esm.js';
|
|
36
|
+
export { default as PasswordField } from './PasswordField/PasswordField.esm.js';
|
|
38
37
|
export { default as RichTextEditor } from './RichTextEditor/RichTextEditor.esm.js';
|
|
39
38
|
export { default as RichTextEditorWrapper } from './RichTextEditor/RichTextEditorWrapper.esm.js';
|
|
39
|
+
export { default as TimePicker } from './TimePicker/TimePicker.esm.js';
|
|
@@ -266,14 +266,14 @@ const ManageFiltersButton = ({ serverFilterDefs, visibleIds, availableColumns, o
|
|
|
266
266
|
borderColor: 'divider', color: 'text.secondary',
|
|
267
267
|
px: 1.5, minHeight: 30,
|
|
268
268
|
'&:hover': { borderColor: 'primary.main', color: 'primary.main' },
|
|
269
|
-
}, children: "Manage Filters" }) }), jsxs(Popover, { open: Boolean(anchor), anchorEl: anchor, onClose: () => setAnchor(null), anchorOrigin: { vertical: 'bottom', horizontal: 'left' }, PaperProps: { sx: { mt: 0.75, borderRadius: 2, boxShadow: 6, width: 280
|
|
269
|
+
}, children: "Manage Filters" }) }), jsxs(Popover, { open: Boolean(anchor), anchorEl: anchor, onClose: () => setAnchor(null), anchorOrigin: { vertical: 'bottom', horizontal: 'left' }, PaperProps: { sx: { mt: 0.75, borderRadius: 2, boxShadow: 6, width: 280 } }, children: [atLimit && (jsx(Box, { sx: {
|
|
270
270
|
px: 2, py: 0.75,
|
|
271
271
|
bgcolor: 'rgba(25,118,210,0.07)',
|
|
272
272
|
borderBottom: '1px solid rgba(25,118,210,0.2)',
|
|
273
273
|
display: 'flex',
|
|
274
274
|
alignItems: 'center',
|
|
275
275
|
gap: 0.75,
|
|
276
|
-
}, children: jsxs(Typography, { sx: { fontSize: 11, color: 'primary.main', fontWeight: 600, lineHeight: 1.4 }, children: [visibleIds.length, "/", maxVisible, " filters active \u2014 remove one to add another"] }) })), jsxs(Box, { sx: {
|
|
276
|
+
}, children: jsxs(Typography, { sx: { fontSize: 11, color: 'primary.main', fontWeight: 600, lineHeight: 1.4 }, children: [visibleIds.length, "/", maxVisible, " filters active \u2014 remove one to add another"] }) })), jsxs(Box, { sx: { py: 1 }, children: [serverFilterDefs.length > 0 && (jsxs(Fragment, { children: [jsx(Typography, { variant: "caption", fontWeight: 700, color: "text.disabled", sx: { px: 2, pb: 0.5, display: 'block', textTransform: 'uppercase', letterSpacing: 0.5 }, children: "Server Filters" }), jsx(List, { dense: true, disablePadding: true, children: serverFilterDefs.map((def) => {
|
|
277
277
|
const selected = visibleIds.includes(def.id);
|
|
278
278
|
const blocked = atLimit && !selected; // at cap and not yet shown → disabled
|
|
279
279
|
const pill = TYPE_PILL[def.type];
|
|
@@ -33,7 +33,13 @@ export interface GenericPaginatedGridProps<TData extends object> {
|
|
|
33
33
|
batchSize?: number;
|
|
34
34
|
/** CSV file name prefix. Default: "export". */
|
|
35
35
|
exportFilename?: string;
|
|
36
|
-
/**
|
|
36
|
+
/**
|
|
37
|
+
* Height of the entire grid component.
|
|
38
|
+
* When omitted (default) the grid auto-sizes to fill the remaining viewport
|
|
39
|
+
* height from its top position — the page never needs to scroll.
|
|
40
|
+
* Pass an explicit CSS value only when you need to override
|
|
41
|
+
* (e.g. "600px", "calc(100vh - 300px)").
|
|
42
|
+
*/
|
|
37
43
|
tableHeight?: string;
|
|
38
44
|
/** Choices shown in the "Rows per page" footer dropdown. Default: [1 000, 5 000, 10 000]. */
|
|
39
45
|
pageSizeOptions?: number[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
-
import { useState, useMemo } from 'react';
|
|
2
|
+
import { useState, useRef, useLayoutEffect, useMemo } from 'react';
|
|
3
3
|
import { useMaterialReactTable, MaterialReactTable } from 'material-react-table';
|
|
4
4
|
import { useQuery, keepPreviousData } from '@tanstack/react-query';
|
|
5
5
|
import { Box, Tooltip, IconButton, Button, GlobalStyles, Typography, Select, MenuItem, CircularProgress } from '@mui/material';
|
|
@@ -43,7 +43,7 @@ const PaginationFooter = ({ pageIndex, pageSize, totalRecords, isFetching, isLoa
|
|
|
43
43
|
}, children: pageIndex + 1 }), jsx(Tooltip, { title: "Next page", children: jsx("span", { children: jsx(IconButton, { size: "small", onClick: onNext, disabled: !canNext, children: jsx(ChevronRightIcon, { sx: { fontSize: 20 } }) }) }) }), jsx(Tooltip, { title: "Last page", children: jsx("span", { children: jsx(IconButton, { size: "small", onClick: onLast, disabled: !canNext, children: jsx(LastPageIcon, { sx: { fontSize: 20 } }) }) }) })] })] }));
|
|
44
44
|
};
|
|
45
45
|
// ─── GenericPaginatedGrid ─────────────────────────────────────────────────────
|
|
46
|
-
function GenericPaginatedGrid({ columns, fetchPage, queryKey, serverFilterDefs, defaultFilters, defaultVisibleFilterIds, batchSize = 10000, exportFilename = 'export', tableHeight
|
|
46
|
+
function GenericPaginatedGrid({ columns, fetchPage, queryKey, serverFilterDefs, defaultFilters, defaultVisibleFilterIds, batchSize = 10000, exportFilename = 'export', tableHeight, pageSizeOptions = [1000, 5000, 10000], headerBgColor, maxVisibleFilters = 4, }) {
|
|
47
47
|
const defaultVisible = defaultVisibleFilterIds
|
|
48
48
|
?? (serverFilterDefs.length > 0 ? [serverFilterDefs[0].id] : []);
|
|
49
49
|
// ── State ──────────────────────────────────────────────────────────────────
|
|
@@ -57,6 +57,35 @@ function GenericPaginatedGrid({ columns, fetchPage, queryKey, serverFilterDefs,
|
|
|
57
57
|
const [columnFilters, setColumnFilters] = useState([]);
|
|
58
58
|
const [globalFilter, setGlobalFilter] = useState('');
|
|
59
59
|
const [columnPinning, setColumnPinning] = useState({});
|
|
60
|
+
// ── Viewport-fill: measure this component's top offset and derive height ──────
|
|
61
|
+
//
|
|
62
|
+
// When tableHeight is not provided, we measure how far the wrapper sits from
|
|
63
|
+
// the top of the viewport and set height = 100vh − topOffset − 8px (tiny
|
|
64
|
+
// bottom margin). A ResizeObserver on <html> keeps the value in sync if the
|
|
65
|
+
// layout shifts (sidebar collapses, font loads, etc.).
|
|
66
|
+
//
|
|
67
|
+
// The MRT Paper + TableContainer flex chain distributes that height between
|
|
68
|
+
// the toolbar, sticky column headers, scrollable rows, and pagination footer —
|
|
69
|
+
// so the grid fills the window exactly and the page never needs to scroll.
|
|
70
|
+
const containerRef = useRef(null);
|
|
71
|
+
const [autoHeight, setAutoHeight] = useState('');
|
|
72
|
+
useLayoutEffect(() => {
|
|
73
|
+
if (tableHeight)
|
|
74
|
+
return; // explicit prop — skip auto calculation
|
|
75
|
+
const el = containerRef.current;
|
|
76
|
+
if (!el)
|
|
77
|
+
return;
|
|
78
|
+
const update = () => {
|
|
79
|
+
const top = el.getBoundingClientRect().top;
|
|
80
|
+
setAutoHeight(`calc(100vh - ${Math.ceil(top) + 8}px)`);
|
|
81
|
+
};
|
|
82
|
+
update();
|
|
83
|
+
const ro = new ResizeObserver(update);
|
|
84
|
+
ro.observe(document.documentElement);
|
|
85
|
+
return () => ro.disconnect();
|
|
86
|
+
}, [tableHeight]);
|
|
87
|
+
// Resolved height: explicit prop › auto-calculated › safe fallback
|
|
88
|
+
const resolvedHeight = tableHeight || autoHeight || '60vh';
|
|
60
89
|
// ── Data fetching ──────────────────────────────────────────────────────────
|
|
61
90
|
const { data, isLoading, isError, isFetching, refetch } = useQuery({
|
|
62
91
|
queryKey: [...queryKey, filterValues, pagination.pageIndex],
|
|
@@ -196,7 +225,24 @@ function GenericPaginatedGrid({ columns, fetchPage, queryKey, serverFilterDefs,
|
|
|
196
225
|
enableHiding: true,
|
|
197
226
|
enableStickyHeader: true,
|
|
198
227
|
enableRowVirtualization: true,
|
|
199
|
-
|
|
228
|
+
// The container fills whatever height is left after the top toolbar and
|
|
229
|
+
// pagination footer. min-height: 0 is required so the flex child can
|
|
230
|
+
// shrink below its natural content height and scroll its rows instead.
|
|
231
|
+
muiTableContainerProps: {
|
|
232
|
+
sx: {
|
|
233
|
+
flex: '1 1 0',
|
|
234
|
+
minHeight: 0,
|
|
235
|
+
},
|
|
236
|
+
},
|
|
237
|
+
// Paper fills the wrapper Box height and acts as the flex column host for
|
|
238
|
+
// toolbar → table-container → pagination.
|
|
239
|
+
muiTablePaperProps: {
|
|
240
|
+
sx: {
|
|
241
|
+
height: '100%',
|
|
242
|
+
display: 'flex',
|
|
243
|
+
flexDirection: 'column',
|
|
244
|
+
},
|
|
245
|
+
},
|
|
200
246
|
muiTopToolbarProps: {
|
|
201
247
|
sx: {
|
|
202
248
|
alignItems: 'center',
|
|
@@ -266,7 +312,12 @@ function GenericPaginatedGrid({ columns, fetchPage, queryKey, serverFilterDefs,
|
|
|
266
312
|
}, children: "Clear All" }))] })),
|
|
267
313
|
renderBottomToolbar: ({ table: t }) => (jsx(PaginationFooter, { pageIndex: t.getState().pagination.pageIndex, pageSize: t.getState().pagination.pageSize, totalRecords: totalRecords, isFetching: isFetching, isLoading: isLoading, canPrev: t.getCanPreviousPage() && !isFetching, canNext: t.getCanNextPage() && !isFetching, onFirst: () => t.firstPage(), onPrev: () => t.previousPage(), onNext: () => t.nextPage(), onLast: () => t.lastPage(), onPageSizeChange: (s) => t.setPageSize(s), pageSizeOptions: pageSizeOptions })),
|
|
268
314
|
});
|
|
269
|
-
return (jsxs(Box, { className: "tp-gpg-root", sx: {
|
|
315
|
+
return (jsxs(Box, { ref: containerRef, className: "tp-gpg-root", sx: {
|
|
316
|
+
position: 'relative',
|
|
317
|
+
height: resolvedHeight,
|
|
318
|
+
display: 'flex',
|
|
319
|
+
flexDirection: 'column',
|
|
320
|
+
}, children: [jsx(GlobalStyles, { styles: {
|
|
270
321
|
'button[aria-label="Pin to right"]': { display: 'none' },
|
|
271
322
|
'.tp-gpg-root .MuiTableSortLabel-icon': { display: 'none !important' },
|
|
272
323
|
'.tp-gpg-root button[aria-label="Move"]': { display: 'none !important' },
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __exports as Calendar } from '../../../../../_virtual/index.
|
|
1
|
+
import { __exports as Calendar } from '../../../../../_virtual/index.esm4.js';
|
|
2
2
|
import React__default from 'react';
|
|
3
3
|
import { __require as requirePropTypes } from '../../../../prop-types/index.esm.js';
|
|
4
4
|
import { __require as requireDayCell } from '../DayCell/index.esm.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __exports as DateRange } from '../../../../../_virtual/index.
|
|
1
|
+
import { __exports as DateRange } from '../../../../../_virtual/index.esm7.js';
|
|
2
2
|
import React__default from 'react';
|
|
3
3
|
import { __require as requirePropTypes } from '../../../../prop-types/index.esm.js';
|
|
4
4
|
import { __require as requireCalendar } from '../Calendar/index.esm.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __exports as DateRangePicker } from '../../../../../_virtual/index.
|
|
1
|
+
import { __exports as DateRangePicker } from '../../../../../_virtual/index.esm6.js';
|
|
2
2
|
import React__default from 'react';
|
|
3
3
|
import { __require as requirePropTypes } from '../../../../prop-types/index.esm.js';
|
|
4
4
|
import { __require as requireDateRange } from '../DateRange/index.esm.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __exports as DefinedRange } from '../../../../../_virtual/index.
|
|
1
|
+
import { __exports as DefinedRange } from '../../../../../_virtual/index.esm5.js';
|
|
2
2
|
import React__default from 'react';
|
|
3
3
|
import { __require as requirePropTypes } from '../../../../prop-types/index.esm.js';
|
|
4
4
|
import { __require as requireStyles } from '../../styles.esm.js';
|