tp-react-elements 1.3.3 → 1.3.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/_virtual/index.esm10.js +2 -2
- package/dist/_virtual/index.esm12.js +2 -2
- package/dist/_virtual/index.esm13.js +2 -2
- package/dist/_virtual/index.esm4.js +2 -2
- package/dist/_virtual/index.esm6.js +2 -2
- package/dist/_virtual/index.esm7.js +2 -2
- package/dist/_virtual/index.esm9.js +2 -2
- package/dist/components/Form/FormRender.esm.js +8 -8
- package/dist/components/FormComponents/index.esm.js +12 -26
- package/dist/components/PaginatedGrid/DynamicFilterBar.d.ts +3 -3
- package/dist/components/PaginatedGrid/DynamicFilterBar.esm.js +12 -6
- package/dist/components/PaginatedGrid/GenericPaginatedGrid.d.ts +10 -3
- package/dist/components/PaginatedGrid/GenericPaginatedGrid.esm.js +34 -8
- package/dist/components/PaginatedGrid/columns.d.ts +2 -21
- package/dist/components/PaginatedGrid/types.d.ts +61 -0
- package/dist/node_modules/prop-types/index.esm.js +1 -1
- package/dist/node_modules/react-date-range/dist/accessibility/index.esm.js +1 -1
- 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/DateRangePicker/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/Month/index.esm.js +1 -1
- package/package.json +1 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var
|
|
1
|
+
var accessibility = {};
|
|
2
2
|
|
|
3
|
-
export {
|
|
3
|
+
export { accessibility as __exports };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var
|
|
1
|
+
var Month = {};
|
|
2
2
|
|
|
3
|
-
export {
|
|
3
|
+
export { Month as __exports };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var
|
|
1
|
+
var DateInput = {};
|
|
2
2
|
|
|
3
|
-
export {
|
|
3
|
+
export { DateInput 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 Calendar = {};
|
|
2
2
|
|
|
3
|
-
export {
|
|
3
|
+
export { Calendar as __exports };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var
|
|
1
|
+
var propTypes = {exports: {}};
|
|
2
2
|
|
|
3
|
-
export {
|
|
3
|
+
export { propTypes as __module };
|
|
@@ -1,13 +1,5 @@
|
|
|
1
1
|
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import React__default, { lazy, Suspense } from 'react';
|
|
3
|
-
import FormCheckBox from '../FormComponents/FormCheckBox/FormCheckBox.esm.js';
|
|
4
|
-
import FormCheckBoxGroup from '../FormComponents/FormCheckBoxGroup/FormCheckBoxGroup.esm.js';
|
|
5
|
-
import FormNumberField from '../FormComponents/FormNumberField/FormNumberField.esm.js';
|
|
6
|
-
import FormNumberFieldDecimal from '../FormComponents/FormNumberField/FormNumberFieldDecimal.esm.js';
|
|
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
3
|
import SingleSelect from '../FormComponents/Select/SingleSelect.esm.js';
|
|
12
4
|
import MultiSelectAutocomplete from '../FormComponents/Select/MultiSelectAutocomplete.esm.js';
|
|
13
5
|
import SingleSelectNonAutoComplete from '../FormComponents/Select/SingleSelectNonAutoComplete.esm.js';
|
|
@@ -18,6 +10,14 @@ import DateRangePickerComponent from '../DateRangePicker/DateRangePicker.esm.js'
|
|
|
18
10
|
import RichTextEditorWrapper from '../FormComponents/RichTextEditor/RichTextEditorWrapper.esm.js';
|
|
19
11
|
import SingleSelectSearchApi from '../FormComponents/Select/SingleSelectSearchApi.esm.js';
|
|
20
12
|
import DatetimepickerWrapper from '../FormComponents/DatePicker/DatetimepickerWrapper.esm.js';
|
|
13
|
+
import FormTextAreaField from '../FormComponents/FormTextAreaField/FormTextAreaField.esm.js';
|
|
14
|
+
import FormCheckBox from '../FormComponents/FormCheckBox/FormCheckBox.esm.js';
|
|
15
|
+
import FormRadioGroup from '../FormComponents/FormRadioGroup/FormRadioGroup.esm.js';
|
|
16
|
+
import FormCheckBoxGroup from '../FormComponents/FormCheckBoxGroup/FormCheckBoxGroup.esm.js';
|
|
17
|
+
import FormNumberFieldDecimal from '../FormComponents/FormNumberField/FormNumberFieldDecimal.esm.js';
|
|
18
|
+
import FormNumberField from '../FormComponents/FormNumberField/FormNumberField.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,39 +1,25 @@
|
|
|
1
|
-
export { default as FormNumberField } from './FormNumberField/FormNumberField.esm.js';
|
|
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
|
-
export { default as FormCheckBox } from './FormCheckBox/FormCheckBox.esm.js';
|
|
7
1
|
export { default as SingleSelect } from './Select/SingleSelect.esm.js';
|
|
8
2
|
export { default as SingleSelectNonAutoComplete } from './Select/SingleSelectNonAutoComplete.esm.js';
|
|
9
3
|
export { default as SingleSelectSearchApi } from './Select/SingleSelectSearchApi.esm.js';
|
|
10
4
|
export { default as MultiSelectV1 } from './Select/MultiSelectv1.esm.js';
|
|
11
5
|
export { default as MultiSelectTable } from './Select/MultiSelectTable.esm.js';
|
|
12
6
|
export { default as SearchableSelect } from './Select/SearchableSelect.esm.js';
|
|
7
|
+
export { default as DatepickerWrapperV2 } from './DatePicker/DatepickerWrapperV2.esm.js';
|
|
8
|
+
export { default as FormBottomField } from './FormBottomField/FormBottomField.esm.js';
|
|
9
|
+
export { default as FormCheckBox } from './FormCheckBox/FormCheckBox.esm.js';
|
|
13
10
|
export { default as FormCheckBoxGroup } from './FormCheckBoxGroup/FormCheckBoxGroup.esm.js';
|
|
11
|
+
export { default as FormErrorField } from './FormErrorField/FormErrorField.esm.js';
|
|
12
|
+
export { default as FormNumberField } from './FormNumberField/FormNumberField.esm.js';
|
|
13
|
+
export { default as FormNumberFieldDecimal } from './FormNumberField/FormNumberFieldDecimal.esm.js';
|
|
14
14
|
export { default as FormRadioGroup } from './FormRadioGroup/FormRadioGroup.esm.js';
|
|
15
|
-
export { default as DatepickerWrapperV2 } from './DatePicker/DatepickerWrapperV2.esm.js';
|
|
16
|
-
export { default as Monthpickerrender } from './DatePicker/Monthpickerrender.esm.js';
|
|
17
|
-
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
|
-
|
|
22
|
-
|
|
23
|
-
import 'react';
|
|
24
|
-
import 'react-hook-form';
|
|
25
|
-
import 'dayjs';
|
|
26
|
-
export { default as FormBottomField } from './FormBottomField/FormBottomField.esm.js';
|
|
27
|
-
import '@mui/icons-material/Visibility';
|
|
28
|
-
import '@mui/icons-material/Close';
|
|
29
|
-
import '@mui/icons-material/NavigateBefore';
|
|
30
|
-
import '@mui/icons-material/NavigateNext';
|
|
31
|
-
import '@mui/icons-material/Delete';
|
|
32
|
-
import '@mui/icons-material/UploadFile';
|
|
33
|
-
import '@mui/icons-material/PictureAsPdf';
|
|
34
|
-
import '@mui/icons-material/TableChart';
|
|
35
|
-
import '@mui/icons-material/Description';
|
|
36
|
-
export { default as FormErrorField } from './FormErrorField/FormErrorField.esm.js';
|
|
17
|
+
export { default as FormTextAreaField } from './FormTextAreaField/FormTextAreaField.esm.js';
|
|
18
|
+
export { default as FormTextField } from './FormTextField/FormTextField.esm.js';
|
|
37
19
|
export { default as HelperText } from './HelperText/HelperText.esm.js';
|
|
20
|
+
export { default as Monthpickerrender } from './DatePicker/Monthpickerrender.esm.js';
|
|
21
|
+
export { default as PasswordField } from './PasswordField/PasswordField.esm.js';
|
|
38
22
|
export { default as RichTextEditor } from './RichTextEditor/RichTextEditor.esm.js';
|
|
39
23
|
export { default as RichTextEditorWrapper } from './RichTextEditor/RichTextEditorWrapper.esm.js';
|
|
24
|
+
export { default as TimePicker } from './TimePicker/TimePicker.esm.js';
|
|
25
|
+
export { default as YearPickerField } from './YearPickerField/YearPickerField.esm.js';
|
|
@@ -61,11 +61,11 @@ interface AvailableColumn {
|
|
|
61
61
|
label: string;
|
|
62
62
|
/**
|
|
63
63
|
* Filter chip variant used in the "Column Filters" section of Manage Filters.
|
|
64
|
-
*
|
|
64
|
+
* Sourced from the `filterType` prop on the column's `TPColumnDef`.
|
|
65
65
|
* Defaults to `'text'` when omitted.
|
|
66
66
|
*/
|
|
67
|
-
filterType?: 'text' | 'date' | '
|
|
68
|
-
/** Options for
|
|
67
|
+
filterType?: 'text' | 'date' | 'select' | 'searchable-select' | 'number';
|
|
68
|
+
/** Options for `'select'` / `'searchable-select'` chip variants. */
|
|
69
69
|
filterOptions?: {
|
|
70
70
|
label: string;
|
|
71
71
|
value: string;
|
|
@@ -22,6 +22,7 @@ import SearchIcon from '@mui/icons-material/Search';
|
|
|
22
22
|
// that DatepickerWrapperV2 passes to onChangeFn
|
|
23
23
|
dayjs.extend(customParseFormat);
|
|
24
24
|
// ─── Type pill metadata ───────────────────────────────────────────────────────
|
|
25
|
+
// Server-side filter pills (used in SERVER FILTERS section of Manage Filters)
|
|
25
26
|
const TYPE_PILL = {
|
|
26
27
|
dateRange: { label: 'Range', color: '#1565c0', bg: '#e3f2fd' },
|
|
27
28
|
date: { label: 'Date', color: '#00695c', bg: '#e0f2f1' },
|
|
@@ -29,6 +30,14 @@ const TYPE_PILL = {
|
|
|
29
30
|
dropdown: { label: 'Select', color: '#6a1b9a', bg: '#f3e5f5' },
|
|
30
31
|
searchableDropdown: { label: 'Search', color: '#bf360c', bg: '#fbe9e7' },
|
|
31
32
|
};
|
|
33
|
+
// Column filter type pills (used in COLUMN FILTERS section of Manage Filters)
|
|
34
|
+
const COLUMN_TYPE_PILL = {
|
|
35
|
+
text: { label: 'Text', color: '#2e7d32', bg: '#e8f5e9' },
|
|
36
|
+
date: { label: 'Date', color: '#00695c', bg: '#e0f2f1' },
|
|
37
|
+
select: { label: 'Select', color: '#bf360c', bg: '#fbe9e7' },
|
|
38
|
+
'searchable-select': { label: 'Search', color: '#bf360c', bg: '#fbe9e7' },
|
|
39
|
+
number: { label: 'Number', color: '#e65100', bg: '#fff3e0' },
|
|
40
|
+
};
|
|
32
41
|
// ─── Chip shared style ────────────────────────────────────────────────────────
|
|
33
42
|
const chipSx = (active) => ({
|
|
34
43
|
borderRadius: 5,
|
|
@@ -244,11 +253,8 @@ const ManageFiltersButton = ({ serverFilterDefs, visibleIds, availableColumns, o
|
|
|
244
253
|
}) })] })), availableColumns.length > 0 && (jsxs(Fragment, { children: [jsx(Divider, { sx: { my: 1 } }), jsx(Typography, { variant: "caption", fontWeight: 700, color: "text.disabled", sx: { px: 2, pb: 0.5, display: 'block', textTransform: 'uppercase', letterSpacing: 0.5 }, children: "Column Filters" }), jsx(List, { dense: true, disablePadding: true, sx: { maxHeight: 260, overflowY: 'auto' }, children: availableColumns.map((col) => {
|
|
245
254
|
const selected = visibleIds.includes(col.id);
|
|
246
255
|
// Pick the type pill based on the column's declared filter type
|
|
247
|
-
const pill = col.filterType
|
|
248
|
-
|
|
249
|
-
: col.filterType === 'searchableDropdown'
|
|
250
|
-
? TYPE_PILL.searchableDropdown
|
|
251
|
-
: TYPE_PILL.text;
|
|
256
|
+
const pill = COLUMN_TYPE_PILL[col.filterType ?? 'text'] ??
|
|
257
|
+
COLUMN_TYPE_PILL.text;
|
|
252
258
|
return (jsxs(ListItemButton, { onClick: () => onToggle(col.id), sx: { px: 2, py: 0.4 }, children: [jsx(Box, { component: "span", sx: {
|
|
253
259
|
mr: 1.25, flexShrink: 0,
|
|
254
260
|
fontSize: 10, fontWeight: 700,
|
|
@@ -313,7 +319,7 @@ const DynamicFilterBar = ({ serverFilterDefs, visibleFilterIds, onToggleFilter,
|
|
|
313
319
|
if (col.filterType === 'date') {
|
|
314
320
|
return (jsx(DatePickerChip, { label: col.label, value: getColValue(id), onApply: (v) => applyColFilter(id, v), onRemove: () => removeFilter(id) }, id));
|
|
315
321
|
}
|
|
316
|
-
if (col.filterType === '
|
|
322
|
+
if (col.filterType === 'select' || col.filterType === 'searchable-select') {
|
|
317
323
|
return (jsx(SearchableSelectChip, { label: col.label, value: getColValue(id), options: col.filterOptions ?? [], onApply: (v) => applyColFilter(id, v), onRemove: () => removeFilter(id) }, id));
|
|
318
324
|
}
|
|
319
325
|
// Default: free-text input
|
|
@@ -1,14 +1,21 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { TPColumnDef } from './types';
|
|
2
2
|
import { type ServerFilterDef } from './DynamicFilterBar';
|
|
3
3
|
export type { ServerFilterDef };
|
|
4
|
+
export type { TPColumnDef } from './types';
|
|
4
5
|
/** Shape that fetchPage must return. */
|
|
5
6
|
export interface PagedResult<TData> {
|
|
6
7
|
data: TData[];
|
|
7
8
|
totalRecords: number;
|
|
8
9
|
}
|
|
9
10
|
export interface GenericPaginatedGridProps<TData extends object> {
|
|
10
|
-
/**
|
|
11
|
-
|
|
11
|
+
/**
|
|
12
|
+
* Column definitions. Use `TPColumnDef<TData>` (a superset of `MRT_ColumnDef`)
|
|
13
|
+
* to get top-level `filterType` and `options` support with no `meta` boilerplate.
|
|
14
|
+
*
|
|
15
|
+
* The grid automatically injects the right `filterFn` for each `filterType`,
|
|
16
|
+
* and wires up the correct chip in Manage Filters → Column Filters.
|
|
17
|
+
*/
|
|
18
|
+
columns: TPColumnDef<TData>[];
|
|
12
19
|
/**
|
|
13
20
|
* Async function called on every page/filter change.
|
|
14
21
|
* Receives the current flat filter map and the 0-based page index.
|
|
@@ -66,6 +66,34 @@ function GenericPaginatedGrid({ columns, fetchPage, queryKey, serverFilterDefs,
|
|
|
66
66
|
});
|
|
67
67
|
const rows = data?.data ?? [];
|
|
68
68
|
const totalRecords = data?.totalRecords ?? 0;
|
|
69
|
+
// ── Strip custom props + auto-inject filterFn before passing to MRT ──────────
|
|
70
|
+
//
|
|
71
|
+
// `TPColumnDef` extends `MRT_ColumnDef` with `filterType` and `options`.
|
|
72
|
+
// MRT doesn't know these props, so we strip them here. We also inject the
|
|
73
|
+
// appropriate `filterFn` automatically so callers never have to write one.
|
|
74
|
+
const processedColumns = useMemo(() => {
|
|
75
|
+
return columns.map((col) => {
|
|
76
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
77
|
+
const { filterType, options, ...mrtCol } = col;
|
|
78
|
+
// Auto-inject filterFn only when the user hasn't already supplied one.
|
|
79
|
+
if (!mrtCol.filterFn && filterType) {
|
|
80
|
+
if (filterType === 'date') {
|
|
81
|
+
// ISO date strings: "2026-05-05T00:00:00" → startsWith "2026-05-05"
|
|
82
|
+
mrtCol.filterFn = (row, columnId, filterValue) => filterValue
|
|
83
|
+
? (row.getValue(columnId) ?? '').startsWith(filterValue)
|
|
84
|
+
: true;
|
|
85
|
+
}
|
|
86
|
+
else if (filterType === 'select' || filterType === 'searchable-select') {
|
|
87
|
+
// Exact-value match (avoids substring false positives)
|
|
88
|
+
mrtCol.filterFn = (row, columnId, filterValue) => filterValue
|
|
89
|
+
? row.getValue(columnId) === filterValue
|
|
90
|
+
: true;
|
|
91
|
+
}
|
|
92
|
+
// 'text' and 'number' use MRT's built-in client-side filtering
|
|
93
|
+
}
|
|
94
|
+
return mrtCol;
|
|
95
|
+
});
|
|
96
|
+
}, [columns]);
|
|
69
97
|
// ── Derive column list for filter chip picker ──────────────────────────────
|
|
70
98
|
//
|
|
71
99
|
// A column is excluded from the "Column Filters" section of Manage Filters
|
|
@@ -73,7 +101,7 @@ function GenericPaginatedGrid({ columns, fetchPage, queryKey, serverFilterDefs,
|
|
|
73
101
|
// 1. It has no accessorKey (computed / display columns).
|
|
74
102
|
// 2. Its accessorKey is already handled by a server-side 'date' filter def.
|
|
75
103
|
// 3. Its MRT `enableColumnFilter` prop is explicitly set to `false` —
|
|
76
|
-
// this
|
|
104
|
+
// use this for numeric/computed columns that don't need a filter chip.
|
|
77
105
|
const availableColumns = useMemo(() => {
|
|
78
106
|
const serverManagedColKeys = new Set(serverFilterDefs
|
|
79
107
|
.filter((d) => d.type === 'date')
|
|
@@ -82,16 +110,14 @@ function GenericPaginatedGrid({ columns, fetchPage, queryKey, serverFilterDefs,
|
|
|
82
110
|
.filter((c) => 'accessorKey' in c &&
|
|
83
111
|
c.accessorKey &&
|
|
84
112
|
!serverManagedColKeys.has(c.accessorKey) &&
|
|
85
|
-
// Honour the standard MRT opt-out flag: columns with
|
|
86
|
-
// enableColumnFilter: false should not appear in Manage Filters.
|
|
87
113
|
c.enableColumnFilter !== false)
|
|
88
114
|
.map((c) => ({
|
|
89
115
|
id: c.accessorKey,
|
|
90
116
|
label: c.header,
|
|
91
|
-
//
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
filterOptions: c.
|
|
117
|
+
// Pass filterType directly from TPColumnDef (no meta unwrapping needed)
|
|
118
|
+
filterType: c.filterType,
|
|
119
|
+
// Map TPColumnDef.options → AvailableColumn.filterOptions
|
|
120
|
+
filterOptions: c.options,
|
|
95
121
|
}));
|
|
96
122
|
}, [columns, serverFilterDefs]);
|
|
97
123
|
// ── Handlers ───────────────────────────────────────────────────────────────
|
|
@@ -127,7 +153,7 @@ function GenericPaginatedGrid({ columns, fetchPage, queryKey, serverFilterDefs,
|
|
|
127
153
|
columnFilters.some((f) => f.value);
|
|
128
154
|
// ── Table instance ─────────────────────────────────────────────────────────
|
|
129
155
|
const table = useMaterialReactTable({
|
|
130
|
-
columns,
|
|
156
|
+
columns: processedColumns,
|
|
131
157
|
data: rows,
|
|
132
158
|
manualPagination: true,
|
|
133
159
|
rowCount: totalRecords,
|
|
@@ -1,22 +1,3 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { TPColumnDef } from './types';
|
|
2
2
|
import type { InvoiceDetail } from './types';
|
|
3
|
-
|
|
4
|
-
declare module '@tanstack/table-core' {
|
|
5
|
-
interface ColumnMeta<TData extends RowData, TValue> {
|
|
6
|
-
/**
|
|
7
|
-
* Which chip variant to render in the "Column Filters" section of
|
|
8
|
-
* Manage Filters. Defaults to `'text'` when omitted.
|
|
9
|
-
*
|
|
10
|
-
* 'text' → TextFilterChip (free-text input)
|
|
11
|
-
* 'date' → DatePickerChip (MUI X calendar)
|
|
12
|
-
* 'searchableDropdown' → SearchableSelectChip (search + options list)
|
|
13
|
-
*/
|
|
14
|
-
filterType?: 'text' | 'date' | 'searchableDropdown';
|
|
15
|
-
/** Option pairs for the `'searchableDropdown'` filter chip. */
|
|
16
|
-
filterOptions?: {
|
|
17
|
-
label: string;
|
|
18
|
-
value: string;
|
|
19
|
-
}[];
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
export declare const invoiceColumns: MRT_ColumnDef<InvoiceDetail>[];
|
|
3
|
+
export declare const invoiceColumns: TPColumnDef<InvoiceDetail>[];
|
|
@@ -1,3 +1,64 @@
|
|
|
1
|
+
import type { MRT_ColumnDef } from 'material-react-table';
|
|
2
|
+
/**
|
|
3
|
+
* Filter chip variant shown in Manage Filters → Column Filters.
|
|
4
|
+
*
|
|
5
|
+
* | Value | Chip rendered |
|
|
6
|
+
* |---------------------|---------------------------|
|
|
7
|
+
* | `'text'` | Free-text input (default) |
|
|
8
|
+
* | `'date'` | Calendar date picker |
|
|
9
|
+
* | `'select'` | Searchable option list |
|
|
10
|
+
* | `'searchable-select'` | Searchable option list |
|
|
11
|
+
* | `'number'` | Numeric input |
|
|
12
|
+
*
|
|
13
|
+
* Set `enableColumnFilter: false` to hide the column from Manage Filters
|
|
14
|
+
* entirely (e.g. for computed or numeric columns that don't need filtering).
|
|
15
|
+
*/
|
|
16
|
+
export type ColumnFilterType = 'text' | 'date' | 'select' | 'searchable-select' | 'number';
|
|
17
|
+
/**
|
|
18
|
+
* Drop-in replacement for `MRT_ColumnDef` that adds top-level
|
|
19
|
+
* `filterType` and `options` so you never have to write `meta` blocks
|
|
20
|
+
* or custom `filterFn` — the grid handles both automatically.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```ts
|
|
24
|
+
* import type { TPColumnDef } from './types';
|
|
25
|
+
*
|
|
26
|
+
* const columns: TPColumnDef<MyRow>[] = [
|
|
27
|
+
* // Date picker chip
|
|
28
|
+
* { accessorKey: 'invoiceDate', header: 'Invoice Date', filterType: 'date' },
|
|
29
|
+
*
|
|
30
|
+
* // Searchable option list chip
|
|
31
|
+
* {
|
|
32
|
+
* accessorKey: 'status',
|
|
33
|
+
* header: 'Status',
|
|
34
|
+
* filterType: 'searchable-select',
|
|
35
|
+
* options: [
|
|
36
|
+
* { label: 'Active', value: 'A' },
|
|
37
|
+
* { label: 'Inactive', value: 'I' },
|
|
38
|
+
* ],
|
|
39
|
+
* },
|
|
40
|
+
*
|
|
41
|
+
* // Hidden from Manage Filters (numeric column)
|
|
42
|
+
* { accessorKey: 'qty', header: 'Qty', enableColumnFilter: false },
|
|
43
|
+
* ];
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
export type TPColumnDef<TData extends object = object> = MRT_ColumnDef<TData> & {
|
|
47
|
+
/**
|
|
48
|
+
* Which filter chip to show in Manage Filters → Column Filters.
|
|
49
|
+
* Omit (or set to `'text'`) for a plain text-input chip.
|
|
50
|
+
*/
|
|
51
|
+
filterType?: ColumnFilterType;
|
|
52
|
+
/**
|
|
53
|
+
* Option pairs for `'select'` and `'searchable-select'` filter types.
|
|
54
|
+
* Each entry needs `label` (display text) and `value` (filter value sent).
|
|
55
|
+
*/
|
|
56
|
+
options?: {
|
|
57
|
+
label: string;
|
|
58
|
+
value: string | number;
|
|
59
|
+
disable?: boolean;
|
|
60
|
+
}[];
|
|
61
|
+
};
|
|
1
62
|
export interface InvoiceDetail {
|
|
2
63
|
Data_from: string;
|
|
3
64
|
FINYEAR: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __module as propTypes } from '../../_virtual/index.
|
|
1
|
+
import { __module as propTypes } from '../../_virtual/index.esm9.js';
|
|
2
2
|
import { __require as requireReactIs } from './node_modules/react-is/index.esm.js';
|
|
3
3
|
import { __require as requireFactoryWithTypeCheckers } from './factoryWithTypeCheckers.esm.js';
|
|
4
4
|
import { __require as requireFactoryWithThrowingShims } from './factoryWithThrowingShims.esm.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __exports as accessibility } from '../../../../_virtual/index.
|
|
1
|
+
import { __exports as accessibility } from '../../../../_virtual/index.esm10.js';
|
|
2
2
|
import { __require as requirePropTypes } from '../../../prop-types/index.esm.js';
|
|
3
3
|
|
|
4
4
|
var hasRequiredAccessibility;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __exports as Calendar } from '../../../../../_virtual/index.
|
|
1
|
+
import { __exports as Calendar } 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 requireDayCell } from '../DayCell/index.esm.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __exports as DateInput } from '../../../../../_virtual/index.
|
|
1
|
+
import { __exports as DateInput } from '../../../../../_virtual/index.esm13.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 requireClassnames } from '../../../../classnames/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.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 requireStyles } from '../../styles.esm.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __exports as Month } from '../../../../../_virtual/index.
|
|
1
|
+
import { __exports as Month } from '../../../../../_virtual/index.esm12.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';
|