ag-grid-url-sync 0.2.2 → 0.2.3
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/README.md +45 -22
- package/dist/core/grid-integration.d.ts +1 -1
- package/dist/core/grid-integration.js +101 -6
- package/dist/core/grid-integration.js.map +1 -1
- package/dist/core/types.d.ts +174 -36
- package/dist/core/types.js +179 -37
- package/dist/core/types.js.map +1 -1
- package/dist/core/url-generator.js +53 -15
- package/dist/core/url-generator.js.map +1 -1
- package/dist/core/url-parser.js +164 -35
- package/dist/core/url-parser.js.map +1 -1
- package/dist/core/validation.d.ts +38 -5
- package/dist/core/validation.js +115 -3
- package/dist/core/validation.js.map +1 -1
- package/dist/react/types.d.ts +5 -0
- package/dist/react/use-ag-grid-url-sync.js +42 -27
- package/dist/react/use-ag-grid-url-sync.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -8,6 +8,7 @@ A lightweight TypeScript library for synchronizing AG Grid text and number filte
|
|
|
8
8
|
|
|
9
9
|
- 🔍 **Complete text filter support** - All 8 AG Grid text operations (contains, equals, not contains, not equal, starts with, ends with, blank, not blank)
|
|
10
10
|
- 🔢 **Complete number filter support** - All 9 AG Grid number operations (equals, not equal, greater than, greater than or equal, less than, less than or equal, in range, blank, not blank)
|
|
11
|
+
- 🔢 **Complete date filter support** - All 9 AG Grid date operations (equals, not equal, before, before or equal, after, after or equal, in range, blank, not blank) with strict ISO date validation (YYYY-MM-DD)
|
|
11
12
|
- 🔗 Manual URL generation for sharing filter states
|
|
12
13
|
- ↔️ Bidirectional sync between grid and URL
|
|
13
14
|
- 🛠️ Framework agnostic - works with any AG Grid setup
|
|
@@ -22,7 +23,7 @@ A lightweight TypeScript library for synchronizing AG Grid text and number filte
|
|
|
22
23
|
|
|
23
24
|
## Supported Filter Types
|
|
24
25
|
|
|
25
|
-
Supports **all AG Grid text and
|
|
26
|
+
Supports **all AG Grid text, number, and date filter operations** (26 total) with clean, human-readable URL parameters:
|
|
26
27
|
|
|
27
28
|
### Text Filters (8 operations)
|
|
28
29
|
|
|
@@ -51,7 +52,21 @@ Supports **all AG Grid text and number filter operations** (17 total) with clean
|
|
|
51
52
|
| **Number** | Blank | `f_column_blank=true` | `f_bonus_blank=true` | Field is empty/null |
|
|
52
53
|
| **Number** | Not Blank | `f_column_notBlank=true` | `f_salary_notBlank=true` | Field has any numeric value |
|
|
53
54
|
|
|
54
|
-
|
|
55
|
+
### Date Filters (9 operations)
|
|
56
|
+
|
|
57
|
+
| Filter Type | Operation | URL Format | Example | Description |
|
|
58
|
+
| ----------- | --------------- | ------------------------------ | ------------------------------------------ | ----------------------------------------- |
|
|
59
|
+
| **Date** | Equals | `f_column_eq=YYYY-MM-DD` | `f_created_eq=2024-01-15` | Date equals value exactly |
|
|
60
|
+
| **Date** | Not Equal | `f_column_neq=YYYY-MM-DD` | `f_deadline_neq=2024-12-31` | Date does not equal value |
|
|
61
|
+
| **Date** | Before | `f_column_before=YYYY-MM-DD` | `f_deadline_before=2024-12-31` | Date is before value |
|
|
62
|
+
| **Date** | Before or Equal | `f_column_beforeEq=YYYY-MM-DD` | `f_archived_beforeEq=2024-12-31` | Date is before or equal to value |
|
|
63
|
+
| **Date** | After | `f_column_after=YYYY-MM-DD` | `f_created_after=2024-01-01` | Date is after value |
|
|
64
|
+
| **Date** | After or Equal | `f_column_afterEq=YYYY-MM-DD` | `f_updated_afterEq=2024-06-01` | Date is after or equal to value |
|
|
65
|
+
| **Date** | In Range | `f_column_daterange=start,end` | `f_period_daterange=2024-01-01,2024-12-31` | Date is between start and end (inclusive) |
|
|
66
|
+
| **Date** | Blank | `f_column_blank=true` | `f_deadline_blank=true` | Date field is empty/null |
|
|
67
|
+
| **Date** | Not Blank | `f_column_notBlank=true` | `f_created_notBlank=true` | Date field has any value |
|
|
68
|
+
|
|
69
|
+
> **🗓️ Date Format Note**: Date filters require strict ISO format (`YYYY-MM-DD`). All date values are validated for real calendar dates, including leap years and month boundaries. Invalid or non-ISO dates will be rejected.
|
|
55
70
|
|
|
56
71
|
### Filter Detection
|
|
57
72
|
|
|
@@ -61,9 +76,9 @@ The library automatically works with:
|
|
|
61
76
|
- **Number columns** configured with `filter: 'agNumberColumnFilter'`
|
|
62
77
|
- **Auto-detection** based on `cellDataType: 'number'` configuration
|
|
63
78
|
- Columns with `filter: true` (AG Grid's default text filter)
|
|
64
|
-
- Any column where users apply text or
|
|
65
|
-
- All AG Grid text and
|
|
66
|
-
- **Mixed filter types** - combine text and
|
|
79
|
+
- Any column where users apply text, number, or date-based filters
|
|
80
|
+
- All AG Grid text, number, and date filter operations through the filter menu
|
|
81
|
+
- **Mixed filter types** - combine text, number, and date filters in the same URL
|
|
67
82
|
|
|
68
83
|
### URL Examples
|
|
69
84
|
|
|
@@ -79,34 +94,40 @@ https://app.com/data?f_name_contains=john
|
|
|
79
94
|
https://app.com/data?f_salary_gt=75000
|
|
80
95
|
```
|
|
81
96
|
|
|
82
|
-
**
|
|
97
|
+
**Simple date filter:**
|
|
98
|
+
|
|
99
|
+
```
|
|
100
|
+
https://app.com/data?f_created_eq=2024-01-15
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
**Date range filter:**
|
|
83
104
|
|
|
84
105
|
```
|
|
85
|
-
https://app.com/data?
|
|
106
|
+
https://app.com/data?f_period_daterange=2024-01-01,2024-12-31
|
|
86
107
|
```
|
|
87
108
|
|
|
88
|
-
**
|
|
109
|
+
**Date before/after filter:**
|
|
89
110
|
|
|
90
111
|
```
|
|
91
|
-
https://app.com/data?
|
|
112
|
+
https://app.com/data?f_deadline_before=2024-12-31&f_created_after=2024-01-01
|
|
92
113
|
```
|
|
93
114
|
|
|
94
|
-
**
|
|
115
|
+
**Mixed text, number, and date filters:**
|
|
95
116
|
|
|
96
117
|
```
|
|
97
|
-
https://app.com/data?f_name_contains=john&
|
|
118
|
+
https://app.com/data?f_name_contains=john&f_department_eq=Engineering&f_salary_gte=80000&f_age_range=25,45&f_created_after=2024-01-01
|
|
98
119
|
```
|
|
99
120
|
|
|
100
|
-
**All
|
|
121
|
+
**All date operations:**
|
|
101
122
|
|
|
102
123
|
```
|
|
103
|
-
https://app.com/data?
|
|
124
|
+
https://app.com/data?f_created_eq=2024-01-15&f_deadline_neq=2024-12-31&f_start_after=2024-01-01&f_end_before=2024-12-31&f_updated_afterEq=2024-06-01&f_archived_beforeEq=2024-12-31&f_period_daterange=2024-01-01,2024-12-31&f_optional_blank=true&f_required_notBlank=true
|
|
104
125
|
```
|
|
105
126
|
|
|
106
|
-
**Blank operations (
|
|
127
|
+
**Blank operations (text, number, and date):**
|
|
107
128
|
|
|
108
129
|
```
|
|
109
|
-
https://app.com/data?f_comments_blank=true&f_bonus_blank=true&f_name_notBlank=true&f_salary_notBlank=true
|
|
130
|
+
https://app.com/data?f_comments_blank=true&f_bonus_blank=true&f_name_notBlank=true&f_salary_notBlank=true&f_deadline_blank=true&f_created_notBlank=true
|
|
110
131
|
```
|
|
111
132
|
|
|
112
133
|
## Installation
|
|
@@ -471,6 +492,7 @@ Parameter structure:
|
|
|
471
492
|
- Format: `f_{columnName}_{operation}={value}`
|
|
472
493
|
- **Text Operations**: `contains`, `eq`, `neq`, `startsWith`, `endsWith`, `notContains`, `blank`, `notBlank`
|
|
473
494
|
- **Number Operations**: `eq`, `neq`, `gt`, `gte`, `lt`, `lte`, `range`, `blank`, `notBlank`
|
|
495
|
+
- **Date Operations**: `eq`, `neq`, `before`, `beforeEq`, `after`, `afterEq`, `daterange`, `blank`, `notBlank`
|
|
474
496
|
- **Range Format**: `f_column_range=min,max` (comma-separated values)
|
|
475
497
|
- Standard URL encoding for special characters
|
|
476
498
|
- Supports column names with underscores (e.g., `user_id`, `salary_base`, `created_date`)
|
|
@@ -584,22 +606,23 @@ Comprehensive demonstration showcasing all features:
|
|
|
584
606
|
|
|
585
607
|
- **Complete text filter support** - All 8 AG Grid text operations (contains, equals, not contains, not equal, starts with, ends with, blank, not blank)
|
|
586
608
|
- **Complete number filter support** - All 9 AG Grid number operations (equals, not equal, greater than, greater than or equal, less than, less than or equal, in range, blank, not blank)
|
|
587
|
-
- **
|
|
609
|
+
- **Complete date filter support** - All 9 AG Grid date operations (equals, not equal, before, before or equal, after, after or equal, in range, blank, not blank)
|
|
610
|
+
- **Mixed filter scenarios** - Text, number, and date filters working together (Sales team + salary filters, Engineering + experience, Executive view with high salaries)
|
|
588
611
|
- **Number operation demos** - Dedicated buttons for salary ranges, age filtering, experience thresholds, and blank number fields
|
|
589
612
|
- **URL sharing workflow** - Copy to clipboard, email, and Slack integration
|
|
590
613
|
- **Performance monitoring** - Real-time benchmarks and stress testing with mixed filter types
|
|
591
|
-
- **Error handling** - Malformed URL and invalid filter testing for both text and
|
|
614
|
+
- **Error handling** - Malformed URL and invalid filter testing for both text, number, and date
|
|
592
615
|
- **Complete API showcase** - Generate URLs, apply filters, clear filters with comprehensive examples
|
|
593
616
|
|
|
594
617
|
### ⚛️ [React Integration](./examples/react-basic/basic-grid.tsx)
|
|
595
618
|
|
|
596
619
|
Clean React component showing the `useAGGridUrlSync` hook:
|
|
597
620
|
|
|
598
|
-
- React hook integration with AG Grid for text and
|
|
621
|
+
- React hook integration with AG Grid for text, number, and date filters
|
|
599
622
|
- Automatic filter state management for mixed filter types
|
|
600
623
|
- Share button with clipboard functionality
|
|
601
624
|
- Filter status indicators and controls
|
|
602
|
-
- Auto-apply filters on component mount with
|
|
625
|
+
- Auto-apply filters on component mount with all filter types
|
|
603
626
|
- Enhanced employee data with salary, age, and experience columns
|
|
604
627
|
- Full TypeScript support with comprehensive type coverage
|
|
605
628
|
|
|
@@ -609,9 +632,9 @@ Common data and column definitions used across examples:
|
|
|
609
632
|
|
|
610
633
|
- Enhanced employee data with salary, age, and experience number fields
|
|
611
634
|
- Project data with budget and numeric fields for comprehensive testing
|
|
612
|
-
- Column definitions with complete text and
|
|
613
|
-
- All 8 text filter operations and 9
|
|
614
|
-
- Realistic data ranges for demonstrating number filters (salaries $58K-$95K, ages 26-42, experience 3-15 years)
|
|
635
|
+
- Column definitions with complete text, number, and date filter support
|
|
636
|
+
- All 8 text filter operations, 9 number filter operations, and 9 date filter operations enabled
|
|
637
|
+
- Realistic data ranges for demonstrating number and date filters (salaries $58K-$95K, ages 26-42, experience 3-15 years)
|
|
615
638
|
- Includes null values for demonstrating blank/notBlank operations
|
|
616
639
|
|
|
617
640
|
All examples work out-of-the-box and demonstrate the complete functionality. The HTML demo can be opened directly in your browser, while the React example shows clean integration patterns.
|
|
@@ -3,7 +3,7 @@ import type { GridApi } from 'ag-grid-community';
|
|
|
3
3
|
/**
|
|
4
4
|
* Detects the expected filter type for a column based on AG Grid configuration
|
|
5
5
|
*/
|
|
6
|
-
export declare function detectColumnFilterType(gridApi: GridApi, columnId: string): 'text' | 'number' |
|
|
6
|
+
export declare function detectColumnFilterType(gridApi: GridApi, columnId: string): 'text' | 'number' | 'date';
|
|
7
7
|
/**
|
|
8
8
|
* Gets the current filter model from AG Grid
|
|
9
9
|
*/
|
|
@@ -1,4 +1,15 @@
|
|
|
1
|
-
import { AG_GRID_OPERATION_NAMES, REVERSE_AG_GRID_OPERATION_NAMES, TEXT_FILTER_OPERATIONS, NUMBER_FILTER_OPERATIONS } from './types.js';
|
|
1
|
+
import { AG_GRID_OPERATION_NAMES, REVERSE_AG_GRID_OPERATION_NAMES, TEXT_FILTER_OPERATIONS, NUMBER_FILTER_OPERATIONS, DATE_FILTER_OPERATIONS } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Converts a date string to ISO format (YYYY-MM-DD)
|
|
4
|
+
* Handles both date strings and undefined values
|
|
5
|
+
* Returns an empty string if the input is undefined or invalid
|
|
6
|
+
*/
|
|
7
|
+
function toIsoDateString(val) {
|
|
8
|
+
if (!val)
|
|
9
|
+
return '';
|
|
10
|
+
const match = val.match(/^(\d{4}-\d{2}-\d{2})/);
|
|
11
|
+
return match?.[1] ? match[1] : val || '';
|
|
12
|
+
}
|
|
2
13
|
/**
|
|
3
14
|
* Type predicate to check if an operation is a valid text filter operation
|
|
4
15
|
*/
|
|
@@ -11,6 +22,12 @@ function isTextFilterOperation(operation) {
|
|
|
11
22
|
function isNumberFilterOperation(operation) {
|
|
12
23
|
return NUMBER_FILTER_OPERATIONS.includes(operation);
|
|
13
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* Type predicate to check if an operation is a valid date filter operation
|
|
27
|
+
*/
|
|
28
|
+
function isDateFilterOperation(operation) {
|
|
29
|
+
return DATE_FILTER_OPERATIONS.includes(operation);
|
|
30
|
+
}
|
|
14
31
|
/**
|
|
15
32
|
* Detects the expected filter type for a column based on AG Grid configuration
|
|
16
33
|
*/
|
|
@@ -18,14 +35,18 @@ export function detectColumnFilterType(gridApi, columnId) {
|
|
|
18
35
|
try {
|
|
19
36
|
const column = gridApi.getColumn(columnId);
|
|
20
37
|
if (!column)
|
|
21
|
-
return
|
|
38
|
+
return 'text'; // Default to text for unknown columns
|
|
22
39
|
const colDef = column.getColDef();
|
|
23
40
|
// 1. Explicit filter configuration takes priority
|
|
41
|
+
if (colDef.filter === 'agDateColumnFilter')
|
|
42
|
+
return 'date';
|
|
24
43
|
if (colDef.filter === 'agNumberColumnFilter')
|
|
25
44
|
return 'number';
|
|
26
45
|
if (colDef.filter === 'agTextColumnFilter')
|
|
27
46
|
return 'text';
|
|
28
47
|
// 2. Cell data type configuration
|
|
48
|
+
if (colDef.cellDataType === 'date')
|
|
49
|
+
return 'date';
|
|
29
50
|
if (colDef.cellDataType === 'number')
|
|
30
51
|
return 'number';
|
|
31
52
|
if (colDef.cellDataType === 'text')
|
|
@@ -50,8 +71,8 @@ export function getFilterModel(config) {
|
|
|
50
71
|
for (const [column, filter] of Object.entries(model)) {
|
|
51
72
|
if (!filter || typeof filter !== 'object')
|
|
52
73
|
continue;
|
|
53
|
-
const { filterType, type, filter: value, filterTo } = filter;
|
|
54
|
-
// Handle
|
|
74
|
+
const { filterType, type, filter: value, filterTo, dateFrom, dateTo } = filter;
|
|
75
|
+
// Handle text filters
|
|
55
76
|
if (filterType === 'text') {
|
|
56
77
|
// Map AG Grid operations back to our internal operations using centralized mapping
|
|
57
78
|
const internalOperation = REVERSE_AG_GRID_OPERATION_NAMES[type];
|
|
@@ -60,10 +81,11 @@ export function getFilterModel(config) {
|
|
|
60
81
|
filterState[column] = {
|
|
61
82
|
filterType: 'text',
|
|
62
83
|
type: internalOperation, // Now properly typed as TextFilterOperation
|
|
63
|
-
filter: value || ''
|
|
84
|
+
filter: String(value || '')
|
|
64
85
|
};
|
|
65
86
|
}
|
|
66
87
|
}
|
|
88
|
+
// Handle number filters
|
|
67
89
|
else if (filterType === 'number') {
|
|
68
90
|
// Map AG Grid number operations back to our internal operations
|
|
69
91
|
const internalOperation = REVERSE_AG_GRID_OPERATION_NAMES[type];
|
|
@@ -82,6 +104,39 @@ export function getFilterModel(config) {
|
|
|
82
104
|
filterState[column] = numberFilter;
|
|
83
105
|
}
|
|
84
106
|
}
|
|
107
|
+
// Handle date filters
|
|
108
|
+
else if (filterType === 'date') {
|
|
109
|
+
// Map AG Grid date operations back to our internal operations
|
|
110
|
+
const internalOperation = REVERSE_AG_GRID_OPERATION_NAMES[type];
|
|
111
|
+
// For date operations, we need to handle the special case where AG Grid uses
|
|
112
|
+
// generic operation names but we have date-specific internal names
|
|
113
|
+
let mappedOperation = internalOperation;
|
|
114
|
+
// Map AG Grid generic date operations to our date-specific operations
|
|
115
|
+
const AG_GRID_TO_DATE_OPERATION_MAP = {
|
|
116
|
+
lessThan: 'dateBefore',
|
|
117
|
+
lessThanOrEqual: 'dateBeforeOrEqual',
|
|
118
|
+
greaterThan: 'dateAfter',
|
|
119
|
+
greaterThanOrEqual: 'dateAfterOrEqual',
|
|
120
|
+
inRange: 'dateRange'
|
|
121
|
+
};
|
|
122
|
+
mappedOperation = type
|
|
123
|
+
? AG_GRID_TO_DATE_OPERATION_MAP[type] || internalOperation
|
|
124
|
+
: internalOperation;
|
|
125
|
+
// Use type predicate to validate and narrow the type
|
|
126
|
+
if (mappedOperation && isDateFilterOperation(mappedOperation)) {
|
|
127
|
+
const dateFilter = {
|
|
128
|
+
filterType: 'date',
|
|
129
|
+
type: mappedOperation,
|
|
130
|
+
filter: toIsoDateString(dateFrom || String(value || ''))
|
|
131
|
+
};
|
|
132
|
+
// Handle date range operations (AG Grid uses dateFrom/dateTo)
|
|
133
|
+
if (mappedOperation === 'dateRange' && dateTo) {
|
|
134
|
+
;
|
|
135
|
+
dateFilter.filterTo = toIsoDateString(dateTo);
|
|
136
|
+
}
|
|
137
|
+
filterState[column] = dateFilter;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
85
140
|
}
|
|
86
141
|
return filterState;
|
|
87
142
|
}
|
|
@@ -96,6 +151,41 @@ export function getFilterModel(config) {
|
|
|
96
151
|
* Converts internal filter to AG Grid filter format
|
|
97
152
|
*/
|
|
98
153
|
function convertToAGGridFilter(filter) {
|
|
154
|
+
if (filter.filterType === 'date') {
|
|
155
|
+
// Handle date range operations
|
|
156
|
+
if (filter.type === 'dateRange') {
|
|
157
|
+
return {
|
|
158
|
+
filterType: 'date',
|
|
159
|
+
type: 'inRange', // AG Grid uses 'inRange' for date ranges
|
|
160
|
+
dateFrom: filter.filter,
|
|
161
|
+
dateTo: filter.filterTo || null
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
// Handle blank operations for dates
|
|
165
|
+
if (filter.type === 'blank' || filter.type === 'notBlank') {
|
|
166
|
+
return {
|
|
167
|
+
filterType: 'date',
|
|
168
|
+
type: filter.type,
|
|
169
|
+
dateFrom: null,
|
|
170
|
+
dateTo: null
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
// Map date-specific operations to AG Grid generic operations
|
|
174
|
+
const dateOperationMapping = {
|
|
175
|
+
dateBefore: 'lessThan',
|
|
176
|
+
dateBeforeOrEqual: 'lessThanOrEqual',
|
|
177
|
+
dateAfter: 'greaterThan',
|
|
178
|
+
dateAfterOrEqual: 'greaterThanOrEqual'
|
|
179
|
+
};
|
|
180
|
+
const agOperation = dateOperationMapping[filter.type] ||
|
|
181
|
+
AG_GRID_OPERATION_NAMES[filter.type];
|
|
182
|
+
return {
|
|
183
|
+
filterType: 'date',
|
|
184
|
+
type: agOperation,
|
|
185
|
+
dateFrom: filter.filter,
|
|
186
|
+
dateTo: null
|
|
187
|
+
};
|
|
188
|
+
}
|
|
99
189
|
if (filter.filterType === 'number') {
|
|
100
190
|
const agGridOperation = AG_GRID_OPERATION_NAMES[filter.type];
|
|
101
191
|
if (filter.type === 'inRange') {
|
|
@@ -135,8 +225,12 @@ export function applyFilterModel(filterState, config) {
|
|
|
135
225
|
// Detect expected filter type for this column
|
|
136
226
|
const expectedType = detectColumnFilterType(config.gridApi, column);
|
|
137
227
|
// Validate filter type compatibility
|
|
228
|
+
if (filter.filterType === 'date' && expectedType !== 'date') {
|
|
229
|
+
console.warn(`Column '${column}' expects a ${expectedType} filter but received a date filter. This may indicate a configuration mismatch in the column definition or filter application.`);
|
|
230
|
+
continue;
|
|
231
|
+
}
|
|
138
232
|
if (filter.filterType === 'number' && expectedType !== 'number') {
|
|
139
|
-
console.warn(`Column '${column}' expects a
|
|
233
|
+
console.warn(`Column '${column}' expects a ${expectedType} filter but received a number filter. This may indicate a configuration mismatch in the column definition or filter application.`);
|
|
140
234
|
continue;
|
|
141
235
|
}
|
|
142
236
|
// Convert to AG Grid filter model
|
|
@@ -145,6 +239,7 @@ export function applyFilterModel(filterState, config) {
|
|
|
145
239
|
model[column] = agGridFilter;
|
|
146
240
|
}
|
|
147
241
|
}
|
|
242
|
+
// Apply the filter model to AG Grid
|
|
148
243
|
config.gridApi.setFilterModel(model);
|
|
149
244
|
}
|
|
150
245
|
catch (error) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grid-integration.js","sourceRoot":"","sources":["../../src/core/grid-integration.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"grid-integration.js","sourceRoot":"","sources":["../../src/core/grid-integration.ts"],"names":[],"mappings":"AAYA,OAAO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CAAC,YAAY,EAAE,CAAC;YACxB,MAAM,CAAC,YAAY,CAAC,KAAc,CAAC,CAAA;QACrC,CAAC;IACH,CAAC;AACH,CAAC"}
|
package/dist/core/types.d.ts
CHANGED
|
@@ -1,33 +1,73 @@
|
|
|
1
|
-
import type { GridApi as AGGridApi, TextFilterModel, NumberFilterModel } from 'ag-grid-community';
|
|
1
|
+
import type { GridApi as AGGridApi, TextFilterModel, NumberFilterModel, DateFilterModel } from 'ag-grid-community';
|
|
2
2
|
/**
|
|
3
3
|
* Configuration options for AG Grid URL Sync
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```typescript
|
|
7
|
+
* const config: AGGridUrlSyncConfig = {
|
|
8
|
+
* paramPrefix: 'filter_',
|
|
9
|
+
* maxValueLength: 500,
|
|
10
|
+
* onParseError: (error) => console.warn('Filter parse error:', error)
|
|
11
|
+
* }
|
|
12
|
+
* ```
|
|
4
13
|
*/
|
|
5
14
|
export interface AGGridUrlSyncConfig {
|
|
6
15
|
/**
|
|
7
|
-
* Prefix for URL parameters
|
|
16
|
+
* Prefix for URL parameters
|
|
17
|
+
* @default 'f_'
|
|
18
|
+
* @example 'filter_' results in URLs like '?filter_name_contains=john'
|
|
8
19
|
*/
|
|
9
20
|
paramPrefix?: string;
|
|
10
21
|
/**
|
|
11
|
-
* Maximum length for filter values
|
|
22
|
+
* Maximum length for filter values to prevent URL length issues
|
|
23
|
+
* @default 200
|
|
12
24
|
*/
|
|
13
25
|
maxValueLength?: number;
|
|
14
26
|
/**
|
|
15
|
-
* Optional error handler for parsing errors
|
|
27
|
+
* Optional error handler for parsing errors.
|
|
28
|
+
* Allows graceful error handling without breaking the application.
|
|
16
29
|
*/
|
|
17
30
|
onParseError?: (error: Error) => void;
|
|
18
31
|
}
|
|
19
32
|
/**
|
|
20
|
-
*
|
|
33
|
+
* Internal configuration with all required fields and runtime dependencies
|
|
21
34
|
*/
|
|
22
|
-
export
|
|
35
|
+
export interface InternalConfig extends Required<AGGridUrlSyncConfig> {
|
|
36
|
+
/** AG Grid API instance for filter operations */
|
|
37
|
+
gridApi: AGGridApi;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Text-only filter operations for string-based filtering
|
|
41
|
+
*/
|
|
42
|
+
export declare const TEXT_ONLY_OPERATIONS: readonly ["contains", "notContains", "startsWith", "endsWith"];
|
|
43
|
+
/**
|
|
44
|
+
* Number-only filter operations for numeric comparisons
|
|
45
|
+
*/
|
|
46
|
+
export declare const NUMBER_ONLY_OPERATIONS: readonly ["lessThan", "lessThanOrEqual", "greaterThan", "greaterThanOrEqual", "inRange"];
|
|
47
|
+
/**
|
|
48
|
+
* Date-specific filter operations for temporal comparisons
|
|
49
|
+
*/
|
|
50
|
+
export declare const DATE_ONLY_OPERATIONS: readonly ["dateBefore", "dateBeforeOrEqual", "dateAfter", "dateAfterOrEqual", "dateRange"];
|
|
23
51
|
/**
|
|
24
|
-
*
|
|
52
|
+
* Operations shared across multiple filter types
|
|
25
53
|
*/
|
|
26
|
-
export declare const
|
|
54
|
+
export declare const SHARED_OPERATIONS: readonly ["eq", "notEqual", "blank", "notBlank"];
|
|
27
55
|
/**
|
|
28
|
-
*
|
|
56
|
+
* All supported filter operations across text, number, and date filters
|
|
29
57
|
*/
|
|
30
|
-
export
|
|
58
|
+
export type FilterOperation = (typeof TEXT_ONLY_OPERATIONS)[number] | (typeof NUMBER_ONLY_OPERATIONS)[number] | (typeof DATE_ONLY_OPERATIONS)[number] | (typeof SHARED_OPERATIONS)[number];
|
|
59
|
+
/**
|
|
60
|
+
* Complete list of valid text filter operations
|
|
61
|
+
*/
|
|
62
|
+
export declare const TEXT_FILTER_OPERATIONS: readonly ["contains", "notContains", "startsWith", "endsWith", "eq", "notEqual", "blank", "notBlank"];
|
|
63
|
+
/**
|
|
64
|
+
* Complete list of valid number filter operations
|
|
65
|
+
*/
|
|
66
|
+
export declare const NUMBER_FILTER_OPERATIONS: readonly ["lessThan", "lessThanOrEqual", "greaterThan", "greaterThanOrEqual", "inRange", "eq", "notEqual", "blank", "notBlank"];
|
|
67
|
+
/**
|
|
68
|
+
* Valid date filter operations as const array
|
|
69
|
+
*/
|
|
70
|
+
export declare const DATE_FILTER_OPERATIONS: readonly ["dateBefore", "dateBeforeOrEqual", "dateAfter", "dateAfterOrEqual", "dateRange", "eq", "notEqual", "blank", "notBlank"];
|
|
31
71
|
/**
|
|
32
72
|
* Text-specific filter operations
|
|
33
73
|
*/
|
|
@@ -37,71 +77,169 @@ export type TextFilterOperation = (typeof TEXT_FILTER_OPERATIONS)[number];
|
|
|
37
77
|
*/
|
|
38
78
|
export type NumberFilterOperation = (typeof NUMBER_FILTER_OPERATIONS)[number];
|
|
39
79
|
/**
|
|
40
|
-
*
|
|
80
|
+
* Date-specific filter operations
|
|
81
|
+
*/
|
|
82
|
+
export type DateFilterOperation = (typeof DATE_FILTER_OPERATIONS)[number];
|
|
83
|
+
/**
|
|
84
|
+
* Range operations that require two values (from/to)
|
|
41
85
|
*/
|
|
42
|
-
|
|
43
|
-
|
|
86
|
+
export type RangeOperation = 'inRange' | 'dateRange';
|
|
87
|
+
/**
|
|
88
|
+
* Operations that don't require a filter value
|
|
89
|
+
*/
|
|
90
|
+
export type BlankOperation = 'blank' | 'notBlank';
|
|
91
|
+
/**
|
|
92
|
+
* Supported filter types
|
|
93
|
+
*/
|
|
94
|
+
export type FilterType = 'text' | 'number' | 'date';
|
|
95
|
+
/**
|
|
96
|
+
* Base interface for all column filters with common properties
|
|
97
|
+
*/
|
|
98
|
+
interface BaseColumnFilter<T extends FilterOperation = FilterOperation> {
|
|
99
|
+
/** The filter operation type */
|
|
100
|
+
type: T;
|
|
44
101
|
}
|
|
45
102
|
/**
|
|
46
|
-
* Text filter configuration
|
|
103
|
+
* Text filter configuration for string-based filtering
|
|
47
104
|
*/
|
|
48
|
-
export interface TextColumnFilter extends BaseColumnFilter {
|
|
105
|
+
export interface TextColumnFilter extends BaseColumnFilter<TextFilterOperation> {
|
|
49
106
|
filterType: 'text';
|
|
50
|
-
|
|
107
|
+
/** The text value to filter by */
|
|
51
108
|
filter: string;
|
|
52
109
|
}
|
|
53
110
|
/**
|
|
54
|
-
* Number filter configuration
|
|
111
|
+
* Number filter configuration for numeric filtering
|
|
55
112
|
*/
|
|
56
|
-
export interface NumberColumnFilter extends BaseColumnFilter {
|
|
113
|
+
export interface NumberColumnFilter extends BaseColumnFilter<NumberFilterOperation> {
|
|
57
114
|
filterType: 'number';
|
|
58
|
-
|
|
115
|
+
/** The numeric value to filter by */
|
|
59
116
|
filter: number;
|
|
117
|
+
/** Optional second value for range operations */
|
|
60
118
|
filterTo?: number;
|
|
61
119
|
}
|
|
62
120
|
/**
|
|
63
|
-
*
|
|
121
|
+
* Date filter configuration for temporal filtering.
|
|
122
|
+
* Uses ISO date format (YYYY-MM-DD) for consistency and parseability.
|
|
64
123
|
*/
|
|
65
|
-
export
|
|
124
|
+
export interface DateColumnFilter extends BaseColumnFilter<DateFilterOperation> {
|
|
125
|
+
filterType: 'date';
|
|
126
|
+
/** ISO date string (YYYY-MM-DD) */
|
|
127
|
+
filter: string;
|
|
128
|
+
/** Optional end date for range operations (ISO format) */
|
|
129
|
+
filterTo?: string;
|
|
130
|
+
}
|
|
66
131
|
/**
|
|
67
|
-
*
|
|
132
|
+
* Union type for all possible column filters
|
|
133
|
+
*/
|
|
134
|
+
export type ColumnFilter = TextColumnFilter | NumberColumnFilter | DateColumnFilter;
|
|
135
|
+
/**
|
|
136
|
+
* Complete filter state mapping column IDs to their filters
|
|
68
137
|
*/
|
|
69
138
|
export interface FilterState {
|
|
70
139
|
[columnId: string]: ColumnFilter;
|
|
71
140
|
}
|
|
72
141
|
/**
|
|
73
|
-
*
|
|
142
|
+
* Type guard to check if an operation is text-specific
|
|
74
143
|
*/
|
|
75
|
-
export
|
|
76
|
-
|
|
77
|
-
|
|
144
|
+
export declare function isTextFilterOperation(op: FilterOperation): op is TextFilterOperation;
|
|
145
|
+
/**
|
|
146
|
+
* Type guard to check if an operation is number-specific
|
|
147
|
+
*/
|
|
148
|
+
export declare function isNumberFilterOperation(op: FilterOperation): op is NumberFilterOperation;
|
|
149
|
+
/**
|
|
150
|
+
* Type guard to check if an operation is date-specific
|
|
151
|
+
*/
|
|
152
|
+
export declare function isDateFilterOperation(op: FilterOperation): op is DateFilterOperation;
|
|
78
153
|
/**
|
|
79
|
-
*
|
|
154
|
+
* Type guard to check if an operation requires a range (two values)
|
|
155
|
+
*/
|
|
156
|
+
export declare function isRangeOperation(op: FilterOperation): op is RangeOperation;
|
|
157
|
+
/**
|
|
158
|
+
* Type guard to check if an operation is a blank operation
|
|
159
|
+
*/
|
|
160
|
+
export declare function isBlankOperation(op: FilterOperation): op is BlankOperation;
|
|
161
|
+
/**
|
|
162
|
+
* Type guard to check if a filter is a text filter
|
|
163
|
+
*/
|
|
164
|
+
export declare function isTextFilter(filter: ColumnFilter): filter is TextColumnFilter;
|
|
165
|
+
/**
|
|
166
|
+
* Type guard to check if a filter is a number filter
|
|
167
|
+
*/
|
|
168
|
+
export declare function isNumberFilter(filter: ColumnFilter): filter is NumberColumnFilter;
|
|
169
|
+
/**
|
|
170
|
+
* Type guard to check if a filter is a date filter
|
|
171
|
+
*/
|
|
172
|
+
export declare function isDateFilter(filter: ColumnFilter): filter is DateColumnFilter;
|
|
173
|
+
/**
|
|
174
|
+
* Base error class for all URL sync operations
|
|
80
175
|
*/
|
|
81
176
|
export declare class URLSyncError extends Error {
|
|
82
|
-
|
|
177
|
+
readonly cause?: Error | undefined;
|
|
178
|
+
constructor(message: string, cause?: Error | undefined);
|
|
83
179
|
}
|
|
180
|
+
/**
|
|
181
|
+
* Error thrown when filter validation fails
|
|
182
|
+
*/
|
|
84
183
|
export declare class InvalidFilterError extends URLSyncError {
|
|
85
|
-
constructor(message: string);
|
|
184
|
+
constructor(message: string, cause?: Error);
|
|
86
185
|
}
|
|
186
|
+
/**
|
|
187
|
+
* Error thrown when URL parsing fails
|
|
188
|
+
*/
|
|
87
189
|
export declare class InvalidURLError extends URLSyncError {
|
|
88
|
-
constructor(message: string);
|
|
190
|
+
constructor(message: string, cause?: Error);
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Error thrown when date validation fails
|
|
194
|
+
*/
|
|
195
|
+
export declare class InvalidDateError extends InvalidFilterError {
|
|
196
|
+
constructor(message: string, cause?: Error);
|
|
89
197
|
}
|
|
90
|
-
|
|
198
|
+
/**
|
|
199
|
+
* Parsed filter parameter information for internal processing
|
|
200
|
+
*/
|
|
201
|
+
export interface ParsedFilterParam {
|
|
91
202
|
columnName: string;
|
|
92
203
|
operation: FilterOperation;
|
|
93
|
-
filterType:
|
|
204
|
+
filterType: FilterType | 'auto';
|
|
94
205
|
value: string | number;
|
|
95
|
-
filterTo?: number;
|
|
206
|
+
filterTo?: number | string;
|
|
96
207
|
action: 'apply' | 'remove';
|
|
97
|
-
}
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Re-export GridApi for convenience
|
|
211
|
+
*/
|
|
98
212
|
export type GridApi = AGGridApi;
|
|
99
213
|
/**
|
|
100
214
|
* Union type for AG Grid filters using official AG Grid types
|
|
101
215
|
*/
|
|
102
|
-
export type AGGridFilter = TextFilterModel | NumberFilterModel;
|
|
216
|
+
export type AGGridFilter = TextFilterModel | NumberFilterModel | DateFilterModel;
|
|
217
|
+
/**
|
|
218
|
+
* Raw AG Grid filter object structure from getFilterModel()
|
|
219
|
+
* Used for type-safe destructuring of filter objects
|
|
220
|
+
*/
|
|
221
|
+
export interface RawAGGridFilter {
|
|
222
|
+
filterType?: string;
|
|
223
|
+
type?: string;
|
|
224
|
+
filter?: string | number;
|
|
225
|
+
filterTo?: string | number;
|
|
226
|
+
dateFrom?: string;
|
|
227
|
+
dateTo?: string;
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Maps URL operation names to internal operation types
|
|
231
|
+
*/
|
|
103
232
|
export declare const OPERATION_MAP: Record<string, FilterOperation>;
|
|
233
|
+
/**
|
|
234
|
+
* Maps internal operation types to URL operation names
|
|
235
|
+
*/
|
|
104
236
|
export declare const INTERNAL_TO_URL_OPERATION_MAP: Record<FilterOperation, string>;
|
|
105
|
-
|
|
237
|
+
/**
|
|
238
|
+
* Maps internal operation types to AG Grid operation names
|
|
239
|
+
*/
|
|
240
|
+
export declare const AG_GRID_OPERATION_NAMES: Record<string, string>;
|
|
241
|
+
/**
|
|
242
|
+
* Maps AG Grid operation names to internal operation types
|
|
243
|
+
*/
|
|
106
244
|
export declare const REVERSE_AG_GRID_OPERATION_NAMES: Record<string, FilterOperation>;
|
|
107
245
|
export {};
|