ag-grid-url-sync 0.2.1 → 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/LICENSE +7 -0
- package/README.md +138 -96
- package/dist/core/grid-integration.d.ts +5 -0
- package/dist/core/grid-integration.js +208 -23
- package/dist/core/grid-integration.js.map +1 -1
- package/dist/core/types.d.ts +204 -71
- package/dist/core/types.js +232 -52
- package/dist/core/types.js.map +1 -1
- package/dist/core/url-generator.js +96 -12
- package/dist/core/url-generator.js.map +1 -1
- package/dist/core/url-parser.js +223 -15
- package/dist/core/url-parser.js.map +1 -1
- package/dist/core/validation.d.ts +64 -2
- package/dist/core/validation.js +173 -2
- 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 +5 -5
package/dist/core/validation.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { InvalidFilterError } from './types.js';
|
|
1
|
+
import { InvalidFilterError, InvalidDateError } from './types.js';
|
|
2
2
|
/**
|
|
3
3
|
* Default configuration values
|
|
4
4
|
*/
|
|
@@ -7,7 +7,7 @@ export const DEFAULT_CONFIG = {
|
|
|
7
7
|
maxValueLength: 200
|
|
8
8
|
};
|
|
9
9
|
/**
|
|
10
|
-
* Validates a filter value against configuration constraints
|
|
10
|
+
* Validates a text filter value against configuration constraints
|
|
11
11
|
*
|
|
12
12
|
* @param value - The filter value to validate
|
|
13
13
|
* @param config - Internal configuration with validation rules
|
|
@@ -25,4 +25,175 @@ export function validateFilterValue(value, config, operation) {
|
|
|
25
25
|
}
|
|
26
26
|
return value;
|
|
27
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* Validates a number filter value
|
|
30
|
+
*
|
|
31
|
+
* @param value - The number value to validate
|
|
32
|
+
* @returns Validation result
|
|
33
|
+
*/
|
|
34
|
+
export function validateNumberFilter(value) {
|
|
35
|
+
// Basic number validation
|
|
36
|
+
if (!Number.isFinite(value)) {
|
|
37
|
+
return { valid: false, error: 'Filter value must be a finite number' };
|
|
38
|
+
}
|
|
39
|
+
// Range validation for precision
|
|
40
|
+
if (Math.abs(value) > Number.MAX_SAFE_INTEGER) {
|
|
41
|
+
return { valid: false, error: 'Number value exceeds safe integer range' };
|
|
42
|
+
}
|
|
43
|
+
return { valid: true };
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Validates a number range filter
|
|
47
|
+
*
|
|
48
|
+
* @param min - The minimum value
|
|
49
|
+
* @param max - The maximum value
|
|
50
|
+
* @returns Validation result
|
|
51
|
+
*/
|
|
52
|
+
export function validateNumberRange(min, max) {
|
|
53
|
+
const minResult = validateNumberFilter(min);
|
|
54
|
+
if (!minResult.valid)
|
|
55
|
+
return minResult;
|
|
56
|
+
const maxResult = validateNumberFilter(max);
|
|
57
|
+
if (!maxResult.valid)
|
|
58
|
+
return maxResult;
|
|
59
|
+
if (min > max) {
|
|
60
|
+
return {
|
|
61
|
+
valid: false,
|
|
62
|
+
error: 'Range minimum must be less than or equal to maximum'
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
return { valid: true };
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Validates a parsed number from string input
|
|
69
|
+
*
|
|
70
|
+
* @param value - String representation of number
|
|
71
|
+
* @returns Parsed number or throws InvalidFilterError
|
|
72
|
+
*/
|
|
73
|
+
export function validateAndParseNumber(value) {
|
|
74
|
+
const trimmedValue = value?.trim();
|
|
75
|
+
if (!trimmedValue) {
|
|
76
|
+
throw new InvalidFilterError('Number filter value cannot be empty');
|
|
77
|
+
}
|
|
78
|
+
// Use a regex to validate proper number format before parsing
|
|
79
|
+
// This prevents parseFloat from accepting partial numbers like "42abc" -> 42
|
|
80
|
+
const numberRegex = /^[+-]?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/;
|
|
81
|
+
if (!numberRegex.test(trimmedValue)) {
|
|
82
|
+
throw new InvalidFilterError(`Invalid number format: ${value}`);
|
|
83
|
+
}
|
|
84
|
+
const numValue = parseFloat(trimmedValue);
|
|
85
|
+
if (isNaN(numValue)) {
|
|
86
|
+
throw new InvalidFilterError(`Invalid number format: ${value}`);
|
|
87
|
+
}
|
|
88
|
+
const validation = validateNumberFilter(numValue);
|
|
89
|
+
if (!validation.valid) {
|
|
90
|
+
throw new InvalidFilterError(validation.error || 'Invalid number value');
|
|
91
|
+
}
|
|
92
|
+
return numValue;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Validates and parses a date string in ISO format (YYYY-MM-DD)
|
|
96
|
+
*
|
|
97
|
+
* @param value - String representation of date in ISO format
|
|
98
|
+
* @returns Validated ISO date string
|
|
99
|
+
* @throws InvalidDateError if date format is invalid or date doesn't exist
|
|
100
|
+
*/
|
|
101
|
+
export function validateAndParseDate(value) {
|
|
102
|
+
const trimmedValue = value?.trim();
|
|
103
|
+
if (!trimmedValue) {
|
|
104
|
+
throw new InvalidDateError('Date filter value cannot be empty');
|
|
105
|
+
}
|
|
106
|
+
// Validate ISO date format (YYYY-MM-DD)
|
|
107
|
+
const isoDateRegex = /^\d{4}-\d{2}-\d{2}$/;
|
|
108
|
+
if (!isoDateRegex.test(trimmedValue)) {
|
|
109
|
+
throw new InvalidDateError(`Invalid date format '${value}'. Expected ISO format YYYY-MM-DD (e.g., 2024-01-15)`);
|
|
110
|
+
}
|
|
111
|
+
// Validate that it's a real date by parsing
|
|
112
|
+
const date = new Date(trimmedValue + 'T00:00:00.000Z'); // Force UTC to avoid timezone issues
|
|
113
|
+
if (isNaN(date.getTime())) {
|
|
114
|
+
throw new InvalidDateError(`Invalid date '${value}'. Date does not exist in the calendar`);
|
|
115
|
+
}
|
|
116
|
+
// Additional validation: ensure the parsed date matches the input
|
|
117
|
+
// This catches edge cases like February 30th that might parse differently
|
|
118
|
+
const [year, month, day] = trimmedValue.split('-').map(Number);
|
|
119
|
+
if (date.getUTCFullYear() !== year ||
|
|
120
|
+
date.getUTCMonth() + 1 !== month ||
|
|
121
|
+
date.getUTCDate() !== day) {
|
|
122
|
+
throw new InvalidDateError(`Invalid date '${value}'. Date components don't match calendar date`);
|
|
123
|
+
}
|
|
124
|
+
return trimmedValue;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Validates a date filter value
|
|
128
|
+
*
|
|
129
|
+
* @param value - The date value to validate
|
|
130
|
+
* @param operation - The date filter operation
|
|
131
|
+
* @returns Validation result
|
|
132
|
+
*/
|
|
133
|
+
export function validateDateFilter(value, operation) {
|
|
134
|
+
// Blank operations don't require date validation
|
|
135
|
+
if (operation === 'blank' || operation === 'notBlank') {
|
|
136
|
+
return { valid: true };
|
|
137
|
+
}
|
|
138
|
+
try {
|
|
139
|
+
validateAndParseDate(value);
|
|
140
|
+
return { valid: true };
|
|
141
|
+
}
|
|
142
|
+
catch (error) {
|
|
143
|
+
return {
|
|
144
|
+
valid: false,
|
|
145
|
+
error: error instanceof Error ? error.message : 'Invalid date'
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Validates a date range filter
|
|
151
|
+
*
|
|
152
|
+
* @param startDate - The start date (ISO format)
|
|
153
|
+
* @param endDate - The end date (ISO format)
|
|
154
|
+
* @returns Validation result
|
|
155
|
+
*/
|
|
156
|
+
export function validateDateRange(startDate, endDate) {
|
|
157
|
+
try {
|
|
158
|
+
const validStartDate = validateAndParseDate(startDate);
|
|
159
|
+
const validEndDate = validateAndParseDate(endDate);
|
|
160
|
+
// Check that start date <= end date
|
|
161
|
+
if (validStartDate > validEndDate) {
|
|
162
|
+
return {
|
|
163
|
+
valid: false,
|
|
164
|
+
error: `Date range invalid: start date '${startDate}' must be before or equal to end date '${endDate}'`
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
return { valid: true };
|
|
168
|
+
}
|
|
169
|
+
catch (error) {
|
|
170
|
+
return {
|
|
171
|
+
valid: false,
|
|
172
|
+
error: error instanceof Error ? error.message : 'Invalid date range'
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Validates a date range from comma-separated string input
|
|
178
|
+
*
|
|
179
|
+
* @param rangeValue - Comma-separated date range (e.g., "2024-01-01,2024-12-31")
|
|
180
|
+
* @returns Tuple of [startDate, endDate] or throws InvalidDateError
|
|
181
|
+
*/
|
|
182
|
+
export function validateAndParseDateRange(rangeValue) {
|
|
183
|
+
const trimmedValue = rangeValue?.trim();
|
|
184
|
+
if (!trimmedValue) {
|
|
185
|
+
throw new InvalidDateError('Date range value cannot be empty');
|
|
186
|
+
}
|
|
187
|
+
const rangeParts = trimmedValue.split(',');
|
|
188
|
+
if (rangeParts.length !== 2) {
|
|
189
|
+
throw new InvalidDateError('Date range must contain exactly two dates separated by comma (e.g., "2024-01-01,2024-12-31")');
|
|
190
|
+
}
|
|
191
|
+
const startDate = validateAndParseDate(rangeParts[0]?.trim() ?? '');
|
|
192
|
+
const endDate = validateAndParseDate(rangeParts[1]?.trim() ?? '');
|
|
193
|
+
const rangeValidation = validateDateRange(startDate, endDate);
|
|
194
|
+
if (!rangeValidation.valid) {
|
|
195
|
+
throw new InvalidDateError(rangeValidation.error ?? 'Invalid date range');
|
|
196
|
+
}
|
|
197
|
+
return [startDate, endDate];
|
|
198
|
+
}
|
|
28
199
|
//# sourceMappingURL=validation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation.js","sourceRoot":"","sources":["../../src/core/validation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"validation.js","sourceRoot":"","sources":["../../src/core/validation.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAEjE;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,WAAW,EAAE,IAAI;IACjB,cAAc,EAAE,GAAG;CACX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M,OAAO,GAAG,oBAAoB,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAA;IAEjE,MAAM,eAAe,GAAG,iBAAiB,CAAC,SAAS,EAAE,OAAO,CAAC,CAAA;IAC7D,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE,CAAC;QAC3B,MAAM,IAAI,gBAAgB,CAAC,eAAe,CAAC,KAAK,IAAI,oBAAoB,CAAC,CAAA;IAC3E,CAAC;IAED,OAAO,CAAC,SAAS,EAAE,OAAO,CAAC,CAAA;AAC7B,CAAC"}
|
package/dist/react/types.d.ts
CHANGED
|
@@ -13,6 +13,11 @@ export interface UseAGGridUrlSyncOptions extends AGGridUrlSyncConfig {
|
|
|
13
13
|
* Default: true
|
|
14
14
|
*/
|
|
15
15
|
enabledWhenReady?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Optional error handler for hook-level errors (initialization, URL operations, etc.)
|
|
18
|
+
* This supplements the core onParseError callback for comprehensive error handling
|
|
19
|
+
*/
|
|
20
|
+
onError?: (error: Error, context: string) => void;
|
|
16
21
|
}
|
|
17
22
|
/**
|
|
18
23
|
* Return type for the useAGGridUrlSync hook
|
|
@@ -10,7 +10,7 @@ import { DEFAULT_CONFIG } from '../core/validation.js';
|
|
|
10
10
|
* @returns Hook API for URL synchronization
|
|
11
11
|
*/
|
|
12
12
|
export function useAGGridUrlSync(gridApi, options = {}) {
|
|
13
|
-
const { autoApplyOnMount = false, enabledWhenReady = true, ...coreOptions } = options;
|
|
13
|
+
const { autoApplyOnMount = false, enabledWhenReady = true, onError, ...coreOptions } = options;
|
|
14
14
|
// Internal state
|
|
15
15
|
const [isReady, setIsReady] = useState(false);
|
|
16
16
|
const [currentUrl, setCurrentUrl] = useState('');
|
|
@@ -19,6 +19,16 @@ export function useAGGridUrlSync(gridApi, options = {}) {
|
|
|
19
19
|
const urlSyncRef = useRef(null);
|
|
20
20
|
const autoAppliedRef = useRef(false);
|
|
21
21
|
const lastGridApiRef = useRef(null);
|
|
22
|
+
// Helper function to handle errors consistently
|
|
23
|
+
const handleError = useCallback((error, context) => {
|
|
24
|
+
const errorObj = error instanceof Error ? error : new Error(String(error));
|
|
25
|
+
if (onError) {
|
|
26
|
+
onError(errorObj, context);
|
|
27
|
+
}
|
|
28
|
+
else if (process.env.NODE_ENV === 'development') {
|
|
29
|
+
console.error(`AG Grid URL Sync Error [${context}]:`, errorObj);
|
|
30
|
+
}
|
|
31
|
+
}, [onError]);
|
|
22
32
|
// Initialize or update URL sync instance when grid API changes
|
|
23
33
|
useEffect(() => {
|
|
24
34
|
if (gridApi && enabledWhenReady) {
|
|
@@ -36,7 +46,7 @@ export function useAGGridUrlSync(gridApi, options = {}) {
|
|
|
36
46
|
lastGridApiRef.current = gridApi;
|
|
37
47
|
}
|
|
38
48
|
catch (error) {
|
|
39
|
-
|
|
49
|
+
handleError(error, 'initialization');
|
|
40
50
|
setIsReady(false);
|
|
41
51
|
}
|
|
42
52
|
}
|
|
@@ -51,7 +61,7 @@ export function useAGGridUrlSync(gridApi, options = {}) {
|
|
|
51
61
|
setIsReady(false);
|
|
52
62
|
lastGridApiRef.current = null;
|
|
53
63
|
}
|
|
54
|
-
}, [gridApi, enabledWhenReady, coreOptions]);
|
|
64
|
+
}, [gridApi, enabledWhenReady, coreOptions, handleError]);
|
|
55
65
|
// Auto-apply URL filters on mount if enabled
|
|
56
66
|
useEffect(() => {
|
|
57
67
|
if (isReady &&
|
|
@@ -63,11 +73,11 @@ export function useAGGridUrlSync(gridApi, options = {}) {
|
|
|
63
73
|
autoAppliedRef.current = true;
|
|
64
74
|
}
|
|
65
75
|
catch (error) {
|
|
66
|
-
|
|
76
|
+
handleError(error, 'auto-apply-filters');
|
|
67
77
|
coreOptions.onParseError?.(error);
|
|
68
78
|
}
|
|
69
79
|
}
|
|
70
|
-
}, [isReady, autoApplyOnMount, coreOptions]);
|
|
80
|
+
}, [isReady, autoApplyOnMount, coreOptions, handleError]);
|
|
71
81
|
// Update current URL and filter state on filter changes
|
|
72
82
|
useEffect(() => {
|
|
73
83
|
if (!isReady || !urlSyncRef.current || !gridApi) {
|
|
@@ -82,10 +92,10 @@ export function useAGGridUrlSync(gridApi, options = {}) {
|
|
|
82
92
|
// Check if there are active filters by comparing query params
|
|
83
93
|
const queryParams = urlSyncRef.current.getQueryParams();
|
|
84
94
|
const searchParams = new URLSearchParams(queryParams);
|
|
85
|
-
setHasFilters([...searchParams.entries()].length > 0);
|
|
95
|
+
setHasFilters([...searchParams.entries()].length > 0);
|
|
86
96
|
}
|
|
87
97
|
catch (error) {
|
|
88
|
-
|
|
98
|
+
handleError(error, 'update-state');
|
|
89
99
|
}
|
|
90
100
|
};
|
|
91
101
|
// Attach event listener for filter changes
|
|
@@ -97,7 +107,7 @@ export function useAGGridUrlSync(gridApi, options = {}) {
|
|
|
97
107
|
return () => {
|
|
98
108
|
gridApi.removeEventListener('filterChanged', onFilterChanged);
|
|
99
109
|
};
|
|
100
|
-
}, [isReady, gridApi]);
|
|
110
|
+
}, [isReady, gridApi, handleError]);
|
|
101
111
|
// Cleanup on unmount
|
|
102
112
|
useEffect(() => {
|
|
103
113
|
return () => {
|
|
@@ -110,16 +120,16 @@ export function useAGGridUrlSync(gridApi, options = {}) {
|
|
|
110
120
|
// Memoized API methods
|
|
111
121
|
const shareUrl = useCallback((baseUrl) => {
|
|
112
122
|
if (!urlSyncRef.current) {
|
|
113
|
-
return (baseUrl
|
|
123
|
+
return (baseUrl ?? (typeof window !== 'undefined' ? window.location.href : ''));
|
|
114
124
|
}
|
|
115
125
|
try {
|
|
116
126
|
return urlSyncRef.current.generateUrl(baseUrl);
|
|
117
127
|
}
|
|
118
128
|
catch (error) {
|
|
119
|
-
|
|
120
|
-
return (baseUrl
|
|
129
|
+
handleError(error, 'generate-share-url');
|
|
130
|
+
return (baseUrl ?? (typeof window !== 'undefined' ? window.location.href : ''));
|
|
121
131
|
}
|
|
122
|
-
}, []);
|
|
132
|
+
}, [handleError]);
|
|
123
133
|
const getQueryParams = useCallback(() => {
|
|
124
134
|
if (!urlSyncRef.current) {
|
|
125
135
|
return '';
|
|
@@ -128,39 +138,42 @@ export function useAGGridUrlSync(gridApi, options = {}) {
|
|
|
128
138
|
return urlSyncRef.current.getQueryParams();
|
|
129
139
|
}
|
|
130
140
|
catch (error) {
|
|
131
|
-
|
|
141
|
+
handleError(error, 'get-query-params');
|
|
132
142
|
return '';
|
|
133
143
|
}
|
|
134
|
-
}, []);
|
|
144
|
+
}, [handleError]);
|
|
135
145
|
const applyUrlFilters = useCallback((url) => {
|
|
136
146
|
if (!urlSyncRef.current) {
|
|
137
|
-
|
|
147
|
+
const warningMessage = 'applyUrlFilters called while the hook is not ready.';
|
|
148
|
+
console.warn(warningMessage);
|
|
149
|
+
coreOptions.onParseError?.(new Error(warningMessage));
|
|
138
150
|
return;
|
|
139
151
|
}
|
|
140
152
|
try {
|
|
141
153
|
urlSyncRef.current.applyFromUrl(url);
|
|
142
154
|
}
|
|
143
155
|
catch (error) {
|
|
144
|
-
|
|
156
|
+
handleError(error, 'apply-url-filters');
|
|
145
157
|
coreOptions.onParseError?.(error);
|
|
146
158
|
}
|
|
147
|
-
}, [coreOptions]);
|
|
159
|
+
}, [coreOptions, handleError]);
|
|
148
160
|
const clearFilters = useCallback(() => {
|
|
149
161
|
if (!urlSyncRef.current) {
|
|
150
|
-
|
|
162
|
+
const warningMessage = 'clearFilters called while the hook is not ready.';
|
|
163
|
+
console.warn(warningMessage);
|
|
164
|
+
coreOptions.onParseError?.(new Error(warningMessage));
|
|
151
165
|
return;
|
|
152
166
|
}
|
|
153
167
|
try {
|
|
154
168
|
urlSyncRef.current.clearFilters();
|
|
155
169
|
}
|
|
156
170
|
catch (error) {
|
|
157
|
-
|
|
171
|
+
handleError(error, 'clear-filters');
|
|
158
172
|
}
|
|
159
|
-
}, []);
|
|
173
|
+
}, [handleError, coreOptions]);
|
|
160
174
|
const parseUrlFilters = useCallback((url) => {
|
|
161
175
|
if (!gridApi) {
|
|
162
|
-
|
|
163
|
-
return {};
|
|
176
|
+
return {}; // Silently return empty state if grid API not available
|
|
164
177
|
}
|
|
165
178
|
try {
|
|
166
179
|
const config = {
|
|
@@ -172,23 +185,25 @@ export function useAGGridUrlSync(gridApi, options = {}) {
|
|
|
172
185
|
return parseFilters(url, config);
|
|
173
186
|
}
|
|
174
187
|
catch (error) {
|
|
175
|
-
|
|
188
|
+
handleError(error, 'parse-url-filters');
|
|
176
189
|
coreOptions.onParseError?.(error);
|
|
177
190
|
return {};
|
|
178
191
|
}
|
|
179
|
-
}, [coreOptions, gridApi]);
|
|
192
|
+
}, [coreOptions, gridApi, handleError]);
|
|
180
193
|
const applyFilters = useCallback((filters) => {
|
|
181
194
|
if (!urlSyncRef.current) {
|
|
182
|
-
|
|
195
|
+
const warningMessage = 'applyFilters called while the hook is not ready.';
|
|
196
|
+
console.warn(warningMessage);
|
|
197
|
+
coreOptions.onParseError?.(new Error(warningMessage));
|
|
183
198
|
return;
|
|
184
199
|
}
|
|
185
200
|
try {
|
|
186
201
|
urlSyncRef.current.applyFilters(filters);
|
|
187
202
|
}
|
|
188
203
|
catch (error) {
|
|
189
|
-
|
|
204
|
+
handleError(error, 'apply-filters');
|
|
190
205
|
}
|
|
191
|
-
}, []);
|
|
206
|
+
}, [handleError, coreOptions]);
|
|
192
207
|
// Return the hook API
|
|
193
208
|
return useMemo(() => ({
|
|
194
209
|
shareUrl,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-ag-grid-url-sync.js","sourceRoot":"","sources":["../../src/react/use-ag-grid-url-sync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAEzE,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAA;AAC3D,OAAO,EAAE,eAAe,IAAI,YAAY,EAAE,MAAM,uBAAuB,CAAA;AACvE,OAAO,EAA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CAAC,WAAW,EAAE,OAAO,EAAE,WAAW,CAAC,CACpC,CAAA;IAED,MAAM,YAAY,GAAG,WAAW,CAC9B,CAAC,OAAoB,EAAQ,EAAE;QAC7B,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC;YACxB,MAAM,cAAc,GAClB,kDAAkD,CAAA;YACpD,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC,CAAA;YAC5B,WAAW,CAAC,YAAY,EAAE,CAAC,IAAI,KAAK,CAAC,cAAc,CAAC,CAAC,CAAA;YACrD,OAAM;QACR,CAAC;QACD,IAAI,CAAC;YACH,UAAU,CAAC,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC,CAAA;QAC1C,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,WAAW,CAAC,KAAK,EAAE,eAAe,CAAC,CAAA;QACrC,CAAC;IACH,CAAC,EACD,CAAC,WAAW,EAAE,WAAW,CAAC,CAC3B,CAAA;IAED,sBAAsB;IACtB,OAAO,OAAO,CACZ,GAAG,EAAE,CAAC,CAAC;QACL,QAAQ;QACR,cAAc;QACd,eAAe;QACf,YAAY;QACZ,OAAO;QACP,UAAU;QACV,UAAU;QACV,eAAe;QACf,YAAY;KACb,CAAC,EACF;QACE,QAAQ;QACR,cAAc;QACd,eAAe;QACf,YAAY;QACZ,OAAO;QACP,UAAU;QACV,UAAU;QACV,eAAe;QACf,YAAY;KACb,CACF,CAAA;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ag-grid-url-sync",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"description": "AG Grid URL Sync - Synchronize AG Grid text filters with URL parameters",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
"react"
|
|
99
99
|
],
|
|
100
100
|
"author": "NearForm",
|
|
101
|
-
"license": "
|
|
101
|
+
"license": "MIT",
|
|
102
102
|
"bugs": {
|
|
103
103
|
"url": "https://github.com/nearform/ag-grid-url-state-sync/issues"
|
|
104
104
|
},
|
|
@@ -111,11 +111,11 @@
|
|
|
111
111
|
"@commitlint/cli": "^19.8.1",
|
|
112
112
|
"@commitlint/config-conventional": "^19.8.1",
|
|
113
113
|
"@eslint/js": "^9.29.0",
|
|
114
|
-
"@testing-library/react": "^
|
|
114
|
+
"@testing-library/react": "^16.3.0",
|
|
115
115
|
"@types/jsdom": "^21.1.7",
|
|
116
116
|
"@types/react": "^18.0.0",
|
|
117
117
|
"@vitest/coverage-v8": "^3.2.4",
|
|
118
|
-
"ag-grid-community": "^
|
|
118
|
+
"ag-grid-community": "^34.0.0",
|
|
119
119
|
"bundlesize": "^0.18.2",
|
|
120
120
|
"eslint": "^9.29.0",
|
|
121
121
|
"eslint-config-prettier": "^10.1.5",
|
|
@@ -165,7 +165,7 @@
|
|
|
165
165
|
},
|
|
166
166
|
{
|
|
167
167
|
"path": "./dist/core/grid-integration.js",
|
|
168
|
-
"maxSize": "
|
|
168
|
+
"maxSize": "3KB"
|
|
169
169
|
},
|
|
170
170
|
{
|
|
171
171
|
"path": "./dist/react/index.js",
|