tp-react-elements 1.3.0 → 1.3.2
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.esm12.js +2 -2
- package/dist/_virtual/index.esm13.js +2 -2
- package/dist/_virtual/index.esm14.js +2 -2
- package/dist/_virtual/index.esm5.js +2 -2
- package/dist/_virtual/index.esm7.js +2 -2
- package/dist/components/DatePicker/index.d.ts +0 -1
- package/dist/components/DatePicker/index.esm.js +0 -1
- package/dist/components/FormComponents/DatePicker/Monthpickerrender.esm.js +12 -2
- package/dist/components/FormComponents/FormTextAreaField/FormTextAreaField.esm.js +2 -2
- package/dist/components/FormComponents/PasswordField/PasswordField.esm.js +40 -40
- package/dist/components/FormComponents/index.d.ts +1 -1
- package/dist/components/FormComponents/index.esm.js +0 -1
- package/dist/components/PaginatedGrid/DynamicFilterBar.d.ts +59 -0
- package/dist/components/PaginatedGrid/DynamicFilterBar.esm.js +269 -0
- package/dist/components/PaginatedGrid/GenericPaginatedGrid.d.ts +40 -0
- package/dist/components/PaginatedGrid/GenericPaginatedGrid.esm.js +222 -0
- package/dist/components/PaginatedGrid/InvoiceGrid.d.ts +2 -0
- package/dist/components/PaginatedGrid/columns.d.ts +3 -0
- package/dist/components/PaginatedGrid/helpers.d.ts +3 -0
- package/dist/components/PaginatedGrid/index.d.ts +4 -0
- package/dist/components/PaginatedGrid/index.esm.js +2 -0
- package/dist/components/PaginatedGrid/invoiceApi.d.ts +2 -0
- package/dist/components/PaginatedGrid/types.d.ts +48 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.esm.js +1 -0
- package/dist/node_modules/@tanstack/query-core/build/modern/environmentManager.esm.js +22 -0
- package/dist/node_modules/@tanstack/query-core/build/modern/focusManager.esm.js +65 -0
- package/dist/node_modules/@tanstack/query-core/build/modern/notifyManager.esm.js +83 -0
- package/dist/node_modules/@tanstack/query-core/build/modern/onlineManager.esm.js +55 -0
- package/dist/node_modules/@tanstack/query-core/build/modern/query.esm.js +16 -0
- package/dist/node_modules/@tanstack/query-core/build/modern/queryObserver.esm.js +463 -0
- package/dist/node_modules/@tanstack/query-core/build/modern/retryer.esm.js +8 -0
- package/dist/node_modules/@tanstack/query-core/build/modern/subscribable.esm.js +24 -0
- package/dist/node_modules/@tanstack/query-core/build/modern/thenable.esm.js +34 -0
- package/dist/node_modules/@tanstack/query-core/build/modern/timeoutManager.esm.js +66 -0
- package/dist/node_modules/@tanstack/query-core/build/modern/utils.esm.js +115 -0
- package/dist/node_modules/@tanstack/react-query/build/modern/IsRestoringProvider.esm.js +7 -0
- package/dist/node_modules/@tanstack/react-query/build/modern/QueryClientProvider.esm.js +15 -0
- package/dist/node_modules/@tanstack/react-query/build/modern/QueryErrorResetBoundary.esm.js +21 -0
- package/dist/node_modules/@tanstack/react-query/build/modern/errorBoundaryUtils.esm.js +27 -0
- package/dist/node_modules/@tanstack/react-query/build/modern/suspense.esm.js +22 -0
- package/dist/node_modules/@tanstack/react-query/build/modern/useBaseQuery.esm.js +94 -0
- package/dist/node_modules/@tanstack/react-query/build/modern/useQuery.esm.js +8 -0
- package/dist/node_modules/react-date-range/dist/components/Calendar/index.esm.js +1 -1
- package/dist/node_modules/react-date-range/dist/components/DateInput/index.esm.js +1 -1
- package/dist/node_modules/react-date-range/dist/components/DefinedRange/index.esm.js +1 -1
- package/dist/node_modules/react-date-range/dist/components/InputRangeField/index.esm.js +1 -1
- package/dist/node_modules/react-date-range/dist/components/Month/index.esm.js +1 -1
- package/package.json +2 -1
- package/dist/components/FormComponents/DatePicker/MonthPicker.d.ts +0 -2
- package/dist/components/FormComponents/DatePicker/MonthPicker.esm.js +0 -59
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import { useState, useMemo } from 'react';
|
|
3
|
+
import { useMaterialReactTable, MaterialReactTable } from 'material-react-table';
|
|
4
|
+
import { keepPreviousData } from '../../node_modules/@tanstack/query-core/build/modern/utils.esm.js';
|
|
5
|
+
import { useQuery } from '../../node_modules/@tanstack/react-query/build/modern/useQuery.esm.js';
|
|
6
|
+
import { Box, Tooltip, IconButton, Button, GlobalStyles, Typography, Select, MenuItem, CircularProgress } from '@mui/material';
|
|
7
|
+
import RefreshIcon from '@mui/icons-material/Refresh';
|
|
8
|
+
import FileDownloadIcon from '@mui/icons-material/FileDownload';
|
|
9
|
+
import FirstPageIcon from '@mui/icons-material/FirstPage';
|
|
10
|
+
import LastPageIcon from '@mui/icons-material/LastPage';
|
|
11
|
+
import ChevronLeftIcon from '@mui/icons-material/ChevronLeft';
|
|
12
|
+
import ChevronRightIcon from '@mui/icons-material/ChevronRight';
|
|
13
|
+
import DynamicFilterBar from './DynamicFilterBar.esm.js';
|
|
14
|
+
|
|
15
|
+
// ─── Internal: overlay loader ─────────────────────────────────────────────────
|
|
16
|
+
const OverlayLoader = ({ message }) => (jsxs(Box, { sx: {
|
|
17
|
+
position: 'absolute', inset: 0,
|
|
18
|
+
display: 'flex', flexDirection: 'column',
|
|
19
|
+
alignItems: 'center', justifyContent: 'center',
|
|
20
|
+
bgcolor: 'rgba(255,255,255,0.80)', backdropFilter: 'blur(2px)',
|
|
21
|
+
zIndex: 10, gap: 1.5,
|
|
22
|
+
}, children: [jsx(CircularProgress, { size: 50, thickness: 4 }), jsx(Typography, { variant: "body2", color: "text.secondary", fontWeight: 500, children: message })] }));
|
|
23
|
+
const PaginationFooter = ({ pageIndex, pageSize, totalRecords, isFetching, isLoading, canPrev, canNext, onFirst, onPrev, onNext, onLast, onPageSizeChange, pageSizeOptions, }) => {
|
|
24
|
+
const startRow = totalRecords === 0 ? 0 : pageIndex * pageSize + 1;
|
|
25
|
+
const endRow = Math.min((pageIndex + 1) * pageSize, totalRecords);
|
|
26
|
+
return (jsxs(Box, { sx: {
|
|
27
|
+
display: 'flex', alignItems: 'center', justifyContent: 'flex-end',
|
|
28
|
+
gap: { xs: 1.5, md: 3 }, px: 2, py: 0.75,
|
|
29
|
+
borderTop: '1px solid', borderColor: 'divider',
|
|
30
|
+
bgcolor: 'background.paper', flexWrap: 'wrap', minHeight: 48,
|
|
31
|
+
}, children: [jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 1 }, children: [jsx(Typography, { variant: "body2", color: "text.secondary", noWrap: true, children: "Rows per page:" }), jsx(Select, { value: pageSize, onChange: (e) => onPageSizeChange(Number(e.target.value)), size: "small", variant: "outlined", sx: {
|
|
32
|
+
height: 28, fontSize: 13, minWidth: 80,
|
|
33
|
+
'.MuiSelect-select': { py: '3px !important' },
|
|
34
|
+
'.MuiOutlinedInput-notchedOutline': { borderColor: 'divider' },
|
|
35
|
+
}, children: pageSizeOptions.map((opt) => (jsx(MenuItem, { value: opt, sx: { fontSize: 13 }, children: opt.toLocaleString() }, opt))) })] }), jsx(Typography, { variant: "body2", color: "text.secondary", noWrap: true, children: isLoading || (isFetching && totalRecords === 0)
|
|
36
|
+
? 'Loading…'
|
|
37
|
+
: totalRecords === 0
|
|
38
|
+
? 'No records'
|
|
39
|
+
: `${startRow.toLocaleString()}–${endRow.toLocaleString()} of ${totalRecords.toLocaleString()}` }), jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 0.25 }, children: [jsx(Tooltip, { title: "First page", children: jsx("span", { children: jsx(IconButton, { size: "small", onClick: onFirst, disabled: !canPrev, children: jsx(FirstPageIcon, { sx: { fontSize: 20 } }) }) }) }), jsx(Tooltip, { title: "Previous page", children: jsx("span", { children: jsx(IconButton, { size: "small", onClick: onPrev, disabled: !canPrev, children: jsx(ChevronLeftIcon, { sx: { fontSize: 20 } }) }) }) }), jsx(Typography, { variant: "body2", fontWeight: 600, sx: {
|
|
40
|
+
mx: 0.5, minWidth: 28, height: 28,
|
|
41
|
+
display: 'flex', alignItems: 'center', justifyContent: 'center',
|
|
42
|
+
borderRadius: 1, border: '1px solid', borderColor: 'primary.main',
|
|
43
|
+
color: 'primary.main', bgcolor: 'rgba(25,118,210,0.07)', fontSize: 13,
|
|
44
|
+
}, 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 } }) }) }) })] })] }));
|
|
45
|
+
};
|
|
46
|
+
// ─── GenericPaginatedGrid ─────────────────────────────────────────────────────
|
|
47
|
+
function GenericPaginatedGrid({ columns, fetchPage, queryKey, serverFilterDefs, defaultFilters, defaultVisibleFilterIds, batchSize = 10000, exportFilename = 'export', tableHeight = '60vh', pageSizeOptions = [1000, 5000, 10000], headerBgColor, }) {
|
|
48
|
+
const defaultVisible = defaultVisibleFilterIds
|
|
49
|
+
?? (serverFilterDefs.length > 0 ? [serverFilterDefs[0].id] : []);
|
|
50
|
+
// ── State ──────────────────────────────────────────────────────────────────
|
|
51
|
+
const [filterValues, setFilterValues] = useState(defaultFilters);
|
|
52
|
+
const [visibleFilterIds, setVisibleFilterIds] = useState(defaultVisible);
|
|
53
|
+
const [pagination, setPagination] = useState({
|
|
54
|
+
pageIndex: 0,
|
|
55
|
+
pageSize: batchSize,
|
|
56
|
+
});
|
|
57
|
+
const [sorting, setSorting] = useState([]);
|
|
58
|
+
const [columnFilters, setColumnFilters] = useState([]);
|
|
59
|
+
const [globalFilter, setGlobalFilter] = useState('');
|
|
60
|
+
const [columnPinning, setColumnPinning] = useState({});
|
|
61
|
+
// ── Data fetching ──────────────────────────────────────────────────────────
|
|
62
|
+
const { data, isLoading, isError, isFetching, refetch } = useQuery({
|
|
63
|
+
queryKey: [...queryKey, filterValues, pagination.pageIndex],
|
|
64
|
+
queryFn: () => fetchPage(filterValues, pagination.pageIndex),
|
|
65
|
+
placeholderData: keepPreviousData,
|
|
66
|
+
staleTime: 30000,
|
|
67
|
+
});
|
|
68
|
+
const rows = data?.data ?? [];
|
|
69
|
+
const totalRecords = data?.totalRecords ?? 0;
|
|
70
|
+
// ── Derive column list for filter chip picker ──────────────────────────────
|
|
71
|
+
const availableColumns = useMemo(() => {
|
|
72
|
+
const serverManagedColKeys = new Set(serverFilterDefs
|
|
73
|
+
.filter((d) => d.type === 'date')
|
|
74
|
+
.map((d) => d.columnKey));
|
|
75
|
+
return columns
|
|
76
|
+
.filter((c) => 'accessorKey' in c && c.accessorKey && !serverManagedColKeys.has(c.accessorKey))
|
|
77
|
+
.map((c) => ({ id: c.accessorKey, label: c.header }));
|
|
78
|
+
}, [columns, serverFilterDefs]);
|
|
79
|
+
// ── Handlers ───────────────────────────────────────────────────────────────
|
|
80
|
+
const handleFilterValuesChange = (newValues) => {
|
|
81
|
+
setFilterValues(newValues);
|
|
82
|
+
setPagination((p) => ({ ...p, pageIndex: 0 }));
|
|
83
|
+
};
|
|
84
|
+
const handleToggleFilter = (id) => setVisibleFilterIds((prev) => prev.includes(id) ? prev.filter((v) => v !== id) : [...prev, id]);
|
|
85
|
+
const handleClearAll = () => {
|
|
86
|
+
setFilterValues(defaultFilters);
|
|
87
|
+
setColumnFilters([]);
|
|
88
|
+
setVisibleFilterIds(defaultVisible);
|
|
89
|
+
setPagination((p) => ({ ...p, pageIndex: 0 }));
|
|
90
|
+
};
|
|
91
|
+
const handleExport = () => {
|
|
92
|
+
const headers = columns.map((c) => c.header).join(',');
|
|
93
|
+
const csvRows = rows.map((row) => columns
|
|
94
|
+
.map((c) => {
|
|
95
|
+
const key = c.accessorKey ?? '';
|
|
96
|
+
const val = row[key] ?? '';
|
|
97
|
+
return `"${String(val).replace(/"/g, '""')}"`;
|
|
98
|
+
})
|
|
99
|
+
.join(','));
|
|
100
|
+
const blob = new Blob([[headers, ...csvRows].join('\n')], { type: 'text/csv' });
|
|
101
|
+
const url = URL.createObjectURL(blob);
|
|
102
|
+
const a = document.createElement('a');
|
|
103
|
+
a.href = url;
|
|
104
|
+
a.download = `${exportFilename}-page${pagination.pageIndex + 1}.csv`;
|
|
105
|
+
a.click();
|
|
106
|
+
URL.revokeObjectURL(url);
|
|
107
|
+
};
|
|
108
|
+
const hasAnyValue = Object.values(filterValues).some(Boolean) ||
|
|
109
|
+
columnFilters.some((f) => f.value);
|
|
110
|
+
// ── Table instance ─────────────────────────────────────────────────────────
|
|
111
|
+
const table = useMaterialReactTable({
|
|
112
|
+
columns,
|
|
113
|
+
data: rows,
|
|
114
|
+
manualPagination: true,
|
|
115
|
+
rowCount: totalRecords,
|
|
116
|
+
manualSorting: false,
|
|
117
|
+
manualFiltering: false,
|
|
118
|
+
state: {
|
|
119
|
+
pagination,
|
|
120
|
+
sorting,
|
|
121
|
+
columnFilters,
|
|
122
|
+
globalFilter,
|
|
123
|
+
columnPinning,
|
|
124
|
+
showAlertBanner: isError,
|
|
125
|
+
showProgressBars: false,
|
|
126
|
+
},
|
|
127
|
+
onPaginationChange: setPagination,
|
|
128
|
+
onSortingChange: setSorting,
|
|
129
|
+
onColumnFiltersChange: setColumnFilters,
|
|
130
|
+
onGlobalFilterChange: setGlobalFilter,
|
|
131
|
+
onColumnPinningChange: (updater) => {
|
|
132
|
+
setColumnPinning((prev) => {
|
|
133
|
+
const next = typeof updater === 'function' ? updater(prev) : updater;
|
|
134
|
+
return { ...next, right: [] };
|
|
135
|
+
});
|
|
136
|
+
},
|
|
137
|
+
enableColumnResizing: true,
|
|
138
|
+
enableColumnOrdering: true,
|
|
139
|
+
enableColumnActions: false,
|
|
140
|
+
enableColumnPinning: true,
|
|
141
|
+
columnResizeMode: 'onChange',
|
|
142
|
+
enableFilters: false,
|
|
143
|
+
enableGlobalFilter: true,
|
|
144
|
+
enableDensityToggle: true,
|
|
145
|
+
enableFullScreenToggle: true,
|
|
146
|
+
enableHiding: true,
|
|
147
|
+
enableStickyHeader: true,
|
|
148
|
+
enableRowVirtualization: true,
|
|
149
|
+
muiTableContainerProps: { sx: { maxHeight: tableHeight } },
|
|
150
|
+
muiTopToolbarProps: {
|
|
151
|
+
sx: {
|
|
152
|
+
alignItems: 'center',
|
|
153
|
+
flexWrap: 'nowrap',
|
|
154
|
+
},
|
|
155
|
+
},
|
|
156
|
+
muiTableHeadCellProps: ({ column }) => {
|
|
157
|
+
const colProps = column.columnDef.muiTableHeadCellProps;
|
|
158
|
+
const align = colProps && typeof colProps !== 'function'
|
|
159
|
+
? colProps.align
|
|
160
|
+
: undefined;
|
|
161
|
+
const justifyContent = align === 'right' ? 'flex-start'
|
|
162
|
+
: align === 'center' ? 'center'
|
|
163
|
+
: 'flex-end';
|
|
164
|
+
return {
|
|
165
|
+
align: (align ?? 'left'),
|
|
166
|
+
sx: {
|
|
167
|
+
...(headerBgColor ? { backgroundColor: headerBgColor } : {}),
|
|
168
|
+
verticalAlign: 'bottom',
|
|
169
|
+
whiteSpace: 'normal',
|
|
170
|
+
borderRight: '1px solid rgba(224,224,224,1)',
|
|
171
|
+
borderBottom: '2px solid rgba(0,0,0,0.15)',
|
|
172
|
+
'& button[aria-label="Move"]': { display: 'none' },
|
|
173
|
+
'& .MuiTableSortLabel-icon': { display: 'none' },
|
|
174
|
+
'& .Mui-TableHeadCell-ResizeHandle-Wrapper': {
|
|
175
|
+
height: '100%',
|
|
176
|
+
top: 0,
|
|
177
|
+
},
|
|
178
|
+
'& .Mui-TableHeadCell-ResizeHandle-Divider': {
|
|
179
|
+
borderRight: 'none',
|
|
180
|
+
},
|
|
181
|
+
'& .Mui-TableHeadCell-Content': {
|
|
182
|
+
alignItems: 'flex-end',
|
|
183
|
+
justifyContent,
|
|
184
|
+
},
|
|
185
|
+
'& .Mui-TableHeadCell-Content-Labels': {
|
|
186
|
+
flexWrap: 'wrap',
|
|
187
|
+
whiteSpace: 'normal',
|
|
188
|
+
overflowWrap: 'normal',
|
|
189
|
+
lineHeight: 1.3,
|
|
190
|
+
justifyContent,
|
|
191
|
+
},
|
|
192
|
+
'& .Mui-TableHeadCell-Content-Wrapper': {
|
|
193
|
+
whiteSpace: 'normal',
|
|
194
|
+
overflow: 'visible',
|
|
195
|
+
},
|
|
196
|
+
},
|
|
197
|
+
};
|
|
198
|
+
},
|
|
199
|
+
muiTableBodyCellProps: {
|
|
200
|
+
sx: {
|
|
201
|
+
whiteSpace: 'nowrap',
|
|
202
|
+
borderRight: '1px solid rgba(224,224,224,1)',
|
|
203
|
+
},
|
|
204
|
+
},
|
|
205
|
+
muiToolbarAlertBannerProps: isError
|
|
206
|
+
? { color: 'error', children: 'Failed to load data. Please try again.' }
|
|
207
|
+
: undefined,
|
|
208
|
+
renderTopToolbarCustomActions: () => (jsxs(Box, { sx: { display: 'flex', alignItems: 'center', flex: 1, minWidth: 0, pr: 1, gap: 0.5 }, children: [jsxs(Box, { sx: { display: 'flex', alignItems: 'center', flexShrink: 0, gap: 0.25 }, children: [jsx(Tooltip, { title: "Refresh current batch", children: jsx("span", { children: jsx(IconButton, { size: "small", onClick: () => refetch(), disabled: isFetching, children: jsx(RefreshIcon, { fontSize: "small" }) }) }) }), jsx(Tooltip, { title: "Export batch as CSV", children: jsx("span", { children: jsx(IconButton, { size: "small", onClick: handleExport, disabled: rows.length === 0 || isFetching, children: jsx(FileDownloadIcon, { fontSize: "small" }) }) }) })] }), jsx(Box, { sx: { flex: 1, minWidth: 0 }, children: jsx(DynamicFilterBar, { serverFilterDefs: serverFilterDefs, visibleFilterIds: visibleFilterIds, onToggleFilter: handleToggleFilter, filterValues: filterValues, onFilterValuesChange: handleFilterValuesChange, columnFilters: columnFilters, onColumnFilterChange: setColumnFilters, availableColumns: availableColumns }) }), hasAnyValue && (jsx(Button, { size: "small", onClick: handleClearAll, sx: {
|
|
209
|
+
flexShrink: 0,
|
|
210
|
+
textTransform: 'none',
|
|
211
|
+
fontSize: 12,
|
|
212
|
+
color: 'error.main',
|
|
213
|
+
minWidth: 'auto',
|
|
214
|
+
px: 1,
|
|
215
|
+
'&:hover': { bgcolor: 'rgba(211,47,47,0.06)' },
|
|
216
|
+
}, children: "Clear All" }))] })),
|
|
217
|
+
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 })),
|
|
218
|
+
});
|
|
219
|
+
return (jsxs(Box, { sx: { position: 'relative' }, children: [jsx(GlobalStyles, { styles: { 'button[aria-label="Pin to right"]': { display: 'none' } } }), isLoading && jsx(OverlayLoader, { message: "Loading data\u2026" }), !isLoading && isFetching && jsx(OverlayLoader, { message: "Updating data\u2026" }), jsx(MaterialReactTable, { table: table })] }));
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
export { GenericPaginatedGrid as default };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { default as GenericPaginatedGrid } from './GenericPaginatedGrid';
|
|
2
|
+
export type { GenericPaginatedGridProps, PagedResult } from './GenericPaginatedGrid';
|
|
3
|
+
export { default as DynamicFilterBar } from './DynamicFilterBar';
|
|
4
|
+
export type { ServerFilterDef } from './DynamicFilterBar';
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export interface InvoiceDetail {
|
|
2
|
+
Data_from: string;
|
|
3
|
+
FINYEAR: string;
|
|
4
|
+
Div_Code: string;
|
|
5
|
+
Depo_Code: string;
|
|
6
|
+
Customer: string;
|
|
7
|
+
category: string;
|
|
8
|
+
Dist_Chan: string;
|
|
9
|
+
InvoiceNo: number;
|
|
10
|
+
BillItem: string;
|
|
11
|
+
InvoiceDate: string;
|
|
12
|
+
Prod_ID: number;
|
|
13
|
+
Batch: string;
|
|
14
|
+
Allocated_Qty: number;
|
|
15
|
+
free_qty: number;
|
|
16
|
+
Nettrate: number;
|
|
17
|
+
fld_ed_diff: number;
|
|
18
|
+
disc_val: number;
|
|
19
|
+
Net_val: number;
|
|
20
|
+
Nett_ed_value: number;
|
|
21
|
+
Tax_amt_value: number;
|
|
22
|
+
Act_Division: string;
|
|
23
|
+
MRP: number;
|
|
24
|
+
Inv_time: string;
|
|
25
|
+
status: string;
|
|
26
|
+
createdate: string;
|
|
27
|
+
RetType: string;
|
|
28
|
+
Mkt_nett: number;
|
|
29
|
+
changeddate: string;
|
|
30
|
+
SHIP_TO_PARTY: string;
|
|
31
|
+
}
|
|
32
|
+
export interface InvoiceRequest {
|
|
33
|
+
FromDate: string;
|
|
34
|
+
ToDate: string;
|
|
35
|
+
Division: string;
|
|
36
|
+
Customer: string;
|
|
37
|
+
DC: string;
|
|
38
|
+
ProductCode: string;
|
|
39
|
+
PageNumber: number;
|
|
40
|
+
}
|
|
41
|
+
export interface InvoiceApiResponse {
|
|
42
|
+
PageNumber: number;
|
|
43
|
+
PageSize: number;
|
|
44
|
+
TotalRecords: number;
|
|
45
|
+
TotalPages: number;
|
|
46
|
+
HasNextPage: boolean;
|
|
47
|
+
Data: InvoiceDetail[];
|
|
48
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export { default as DeleteField } from './components/DeleteComponent/DeleteField
|
|
|
5
5
|
export { default as SessionTimeoutField } from './components/SessionTimeOut/SessionTimeOut';
|
|
6
6
|
export { default as useFormValidatingContext } from './components/Form/FormConstants';
|
|
7
7
|
export { default as MultiSelectFieldComponent } from './components/SelectField/MultiSelectFieldComponent';
|
|
8
|
+
export { default as GenericPaginatedGrid } from './components/PaginatedGrid/GenericPaginatedGrid';
|
|
8
9
|
export { TPElementsProvider } from './auth/authContext';
|
|
9
10
|
export { calculateTotalArrayValueTotal, checkIsDateIsBefore, findMenuHierarchy, getDesiredDate, getFormattedDate, getInitials, getUsernameFromEmail, handleDownloadReactTableDataExcel, lightenColor, } from './utils';
|
|
10
11
|
export * as Utils from './utils';
|
package/dist/index.esm.js
CHANGED
|
@@ -5,6 +5,7 @@ export { default as DeleteField } from './components/DeleteComponent/DeleteField
|
|
|
5
5
|
export { default as SessionTimeoutField } from './components/SessionTimeOut/SessionTimeOut.esm.js';
|
|
6
6
|
export { default as useFormValidatingContext } from './components/Form/FormConstants.esm.js';
|
|
7
7
|
export { default as MultiSelectFieldComponent } from './components/SelectField/MultiSelectFieldComponent.esm.js';
|
|
8
|
+
export { default as GenericPaginatedGrid } from './components/PaginatedGrid/GenericPaginatedGrid.esm.js';
|
|
8
9
|
export { TPElementsProvider } from './auth/authContext.esm.js';
|
|
9
10
|
import * as index$1 from './utils/index.esm.js';
|
|
10
11
|
export { index$1 as Utils };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { isServer } from './utils.esm.js';
|
|
2
|
+
|
|
3
|
+
// src/environmentManager.ts
|
|
4
|
+
var environmentManager = /* @__PURE__ */ (() => {
|
|
5
|
+
let isServerFn = () => isServer;
|
|
6
|
+
return {
|
|
7
|
+
/**
|
|
8
|
+
* Returns whether the current runtime should be treated as a server environment.
|
|
9
|
+
*/
|
|
10
|
+
isServer() {
|
|
11
|
+
return isServerFn();
|
|
12
|
+
},
|
|
13
|
+
/**
|
|
14
|
+
* Overrides the server check globally.
|
|
15
|
+
*/
|
|
16
|
+
setIsServer(isServerValue) {
|
|
17
|
+
isServerFn = isServerValue;
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
})();
|
|
21
|
+
|
|
22
|
+
export { environmentManager };
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { Subscribable } from './subscribable.esm.js';
|
|
2
|
+
|
|
3
|
+
// src/focusManager.ts
|
|
4
|
+
var FocusManager = class extends Subscribable {
|
|
5
|
+
#focused;
|
|
6
|
+
#cleanup;
|
|
7
|
+
#setup;
|
|
8
|
+
constructor() {
|
|
9
|
+
super();
|
|
10
|
+
this.#setup = (onFocus) => {
|
|
11
|
+
if (typeof window !== "undefined" && window.addEventListener) {
|
|
12
|
+
const listener = () => onFocus();
|
|
13
|
+
window.addEventListener("visibilitychange", listener, false);
|
|
14
|
+
return () => {
|
|
15
|
+
window.removeEventListener("visibilitychange", listener);
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
return;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
onSubscribe() {
|
|
22
|
+
if (!this.#cleanup) {
|
|
23
|
+
this.setEventListener(this.#setup);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
onUnsubscribe() {
|
|
27
|
+
if (!this.hasListeners()) {
|
|
28
|
+
this.#cleanup?.();
|
|
29
|
+
this.#cleanup = void 0;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
setEventListener(setup) {
|
|
33
|
+
this.#setup = setup;
|
|
34
|
+
this.#cleanup?.();
|
|
35
|
+
this.#cleanup = setup((focused) => {
|
|
36
|
+
if (typeof focused === "boolean") {
|
|
37
|
+
this.setFocused(focused);
|
|
38
|
+
} else {
|
|
39
|
+
this.onFocus();
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
setFocused(focused) {
|
|
44
|
+
const changed = this.#focused !== focused;
|
|
45
|
+
if (changed) {
|
|
46
|
+
this.#focused = focused;
|
|
47
|
+
this.onFocus();
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
onFocus() {
|
|
51
|
+
const isFocused = this.isFocused();
|
|
52
|
+
this.listeners.forEach((listener) => {
|
|
53
|
+
listener(isFocused);
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
isFocused() {
|
|
57
|
+
if (typeof this.#focused === "boolean") {
|
|
58
|
+
return this.#focused;
|
|
59
|
+
}
|
|
60
|
+
return globalThis.document?.visibilityState !== "hidden";
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
var focusManager = new FocusManager();
|
|
64
|
+
|
|
65
|
+
export { FocusManager, focusManager };
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { systemSetTimeoutZero } from './timeoutManager.esm.js';
|
|
2
|
+
|
|
3
|
+
// src/notifyManager.ts
|
|
4
|
+
var defaultScheduler = systemSetTimeoutZero;
|
|
5
|
+
function createNotifyManager() {
|
|
6
|
+
let queue = [];
|
|
7
|
+
let transactions = 0;
|
|
8
|
+
let notifyFn = (callback) => {
|
|
9
|
+
callback();
|
|
10
|
+
};
|
|
11
|
+
let batchNotifyFn = (callback) => {
|
|
12
|
+
callback();
|
|
13
|
+
};
|
|
14
|
+
let scheduleFn = defaultScheduler;
|
|
15
|
+
const schedule = (callback) => {
|
|
16
|
+
if (transactions) {
|
|
17
|
+
queue.push(callback);
|
|
18
|
+
} else {
|
|
19
|
+
scheduleFn(() => {
|
|
20
|
+
notifyFn(callback);
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
const flush = () => {
|
|
25
|
+
const originalQueue = queue;
|
|
26
|
+
queue = [];
|
|
27
|
+
if (originalQueue.length) {
|
|
28
|
+
scheduleFn(() => {
|
|
29
|
+
batchNotifyFn(() => {
|
|
30
|
+
originalQueue.forEach((callback) => {
|
|
31
|
+
notifyFn(callback);
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
return {
|
|
38
|
+
batch: (callback) => {
|
|
39
|
+
let result;
|
|
40
|
+
transactions++;
|
|
41
|
+
try {
|
|
42
|
+
result = callback();
|
|
43
|
+
} finally {
|
|
44
|
+
transactions--;
|
|
45
|
+
if (!transactions) {
|
|
46
|
+
flush();
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return result;
|
|
50
|
+
},
|
|
51
|
+
/**
|
|
52
|
+
* All calls to the wrapped function will be batched.
|
|
53
|
+
*/
|
|
54
|
+
batchCalls: (callback) => {
|
|
55
|
+
return (...args) => {
|
|
56
|
+
schedule(() => {
|
|
57
|
+
callback(...args);
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
},
|
|
61
|
+
schedule,
|
|
62
|
+
/**
|
|
63
|
+
* Use this method to set a custom notify function.
|
|
64
|
+
* This can be used to for example wrap notifications with `React.act` while running tests.
|
|
65
|
+
*/
|
|
66
|
+
setNotifyFunction: (fn) => {
|
|
67
|
+
notifyFn = fn;
|
|
68
|
+
},
|
|
69
|
+
/**
|
|
70
|
+
* Use this method to set a custom function to batch notifications together into a single tick.
|
|
71
|
+
* By default React Query will use the batch function provided by ReactDOM or React Native.
|
|
72
|
+
*/
|
|
73
|
+
setBatchNotifyFunction: (fn) => {
|
|
74
|
+
batchNotifyFn = fn;
|
|
75
|
+
},
|
|
76
|
+
setScheduler: (fn) => {
|
|
77
|
+
scheduleFn = fn;
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
var notifyManager = createNotifyManager();
|
|
82
|
+
|
|
83
|
+
export { createNotifyManager, defaultScheduler, notifyManager };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Subscribable } from './subscribable.esm.js';
|
|
2
|
+
|
|
3
|
+
// src/onlineManager.ts
|
|
4
|
+
var OnlineManager = class extends Subscribable {
|
|
5
|
+
#online = true;
|
|
6
|
+
#cleanup;
|
|
7
|
+
#setup;
|
|
8
|
+
constructor() {
|
|
9
|
+
super();
|
|
10
|
+
this.#setup = (onOnline) => {
|
|
11
|
+
if (typeof window !== "undefined" && window.addEventListener) {
|
|
12
|
+
const onlineListener = () => onOnline(true);
|
|
13
|
+
const offlineListener = () => onOnline(false);
|
|
14
|
+
window.addEventListener("online", onlineListener, false);
|
|
15
|
+
window.addEventListener("offline", offlineListener, false);
|
|
16
|
+
return () => {
|
|
17
|
+
window.removeEventListener("online", onlineListener);
|
|
18
|
+
window.removeEventListener("offline", offlineListener);
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
return;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
onSubscribe() {
|
|
25
|
+
if (!this.#cleanup) {
|
|
26
|
+
this.setEventListener(this.#setup);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
onUnsubscribe() {
|
|
30
|
+
if (!this.hasListeners()) {
|
|
31
|
+
this.#cleanup?.();
|
|
32
|
+
this.#cleanup = void 0;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
setEventListener(setup) {
|
|
36
|
+
this.#setup = setup;
|
|
37
|
+
this.#cleanup?.();
|
|
38
|
+
this.#cleanup = setup(this.setOnline.bind(this));
|
|
39
|
+
}
|
|
40
|
+
setOnline(online) {
|
|
41
|
+
const changed = this.#online !== online;
|
|
42
|
+
if (changed) {
|
|
43
|
+
this.#online = online;
|
|
44
|
+
this.listeners.forEach((listener) => {
|
|
45
|
+
listener(online);
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
isOnline() {
|
|
50
|
+
return this.#online;
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
var onlineManager = new OnlineManager();
|
|
54
|
+
|
|
55
|
+
export { OnlineManager, onlineManager };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { canFetch } from './retryer.esm.js';
|
|
2
|
+
|
|
3
|
+
// src/query.ts
|
|
4
|
+
function fetchState(data, options) {
|
|
5
|
+
return {
|
|
6
|
+
fetchFailureCount: 0,
|
|
7
|
+
fetchFailureReason: null,
|
|
8
|
+
fetchStatus: canFetch(options.networkMode) ? "fetching" : "paused",
|
|
9
|
+
...data === void 0 && {
|
|
10
|
+
error: null,
|
|
11
|
+
status: "pending"
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export { fetchState };
|