advanced-filter-system 1.5.1 → 1.5.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/README.md +64 -47
- package/dist/afs.legacy.js +1 -1
- package/dist/afs.legacy.js.map +1 -1
- package/dist/afs.modern.js +1 -1
- package/dist/afs.modern.js.map +1 -1
- package/package.json +8 -2
- package/src/types/core.d.ts +65 -0
- package/src/types/date-filter.ts +18 -0
- package/src/types/features.d.ts +148 -0
- package/src/types/filter.ts +17 -0
- package/src/types/index.d.ts +442 -0
- package/src/types/input-range-filter.ts +19 -0
- package/src/types/pagination.ts +37 -0
- package/src/types/range-filter.ts +8 -0
- package/src/types/search.ts +5 -0
- package/src/types/sort.ts +9 -0
- package/src/types/url-manager.ts +11 -0
- package/src/types/utils.d.ts +128 -0
|
@@ -0,0 +1,442 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Advanced Filter System (AFS) - TypeScript Definitions
|
|
3
|
+
* @version 1.5.2
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
// Core Types
|
|
7
|
+
export interface AFSEventData {
|
|
8
|
+
[key: string]: any;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export type EventCallback = (data?: AFSEventData) => void;
|
|
12
|
+
|
|
13
|
+
export type FilterMode = 'OR' | 'AND';
|
|
14
|
+
export type FilterCategoryMode = 'mixed' | 'OR' | 'AND';
|
|
15
|
+
export type SortDirection = 'asc' | 'desc';
|
|
16
|
+
export type AnimationType = 'fade' | 'slide' | 'scale' | 'flip' | 'rotate' | 'zoom' | 'bounce' | 'blur' | 'slideUp' | 'slideDown' | 'slideLeft' | 'slideRight' | 'zoomIn' | 'zoomOut' | 'fadeIn' | 'fadeOut';
|
|
17
|
+
export type DateFormat = 'YYYY-MM-DD' | 'DD/MM/YYYY' | 'MM/DD/YYYY' | 'DD-MM-YYYY' | 'MM-DD-YYYY';
|
|
18
|
+
export type LogLevel = 'debug' | 'info' | 'warn' | 'error';
|
|
19
|
+
|
|
20
|
+
// Filter Type Logic Configuration
|
|
21
|
+
export interface FilterTypeConfig {
|
|
22
|
+
mode: FilterMode;
|
|
23
|
+
multi: boolean;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export type FilterTypeLogic = {
|
|
27
|
+
[filterType: string]: FilterMode | FilterTypeConfig;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
// Counter Configuration
|
|
31
|
+
export interface CounterOptions {
|
|
32
|
+
template?: string;
|
|
33
|
+
showFiltered?: boolean;
|
|
34
|
+
filteredTemplate?: string;
|
|
35
|
+
noResultsTemplate?: string;
|
|
36
|
+
formatter?: (num: number) => string;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Animation Configuration
|
|
40
|
+
export interface AnimationOptions {
|
|
41
|
+
type?: AnimationType;
|
|
42
|
+
duration?: number;
|
|
43
|
+
easing?: string;
|
|
44
|
+
inClass?: string;
|
|
45
|
+
outClass?: string;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Pagination Configuration
|
|
49
|
+
export interface PaginationOptions {
|
|
50
|
+
enabled?: boolean;
|
|
51
|
+
itemsPerPage?: number;
|
|
52
|
+
container?: string;
|
|
53
|
+
pageButtonClass?: string;
|
|
54
|
+
activePageClass?: string;
|
|
55
|
+
containerClass?: string;
|
|
56
|
+
scrollToTop?: boolean;
|
|
57
|
+
scrollOffset?: number;
|
|
58
|
+
scrollBehavior?: 'smooth' | 'auto';
|
|
59
|
+
showPrevNext?: boolean;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// Style Configuration
|
|
63
|
+
export interface StyleOptions {
|
|
64
|
+
colors?: {
|
|
65
|
+
primary?: string;
|
|
66
|
+
background?: string;
|
|
67
|
+
text?: string;
|
|
68
|
+
textHover?: string;
|
|
69
|
+
};
|
|
70
|
+
slider?: {
|
|
71
|
+
ui?: {
|
|
72
|
+
showHistogram?: boolean;
|
|
73
|
+
bins?: number;
|
|
74
|
+
track?: {
|
|
75
|
+
radius?: string;
|
|
76
|
+
background?: string;
|
|
77
|
+
};
|
|
78
|
+
selected?: {
|
|
79
|
+
background?: string;
|
|
80
|
+
};
|
|
81
|
+
thumb?: {
|
|
82
|
+
radius?: string;
|
|
83
|
+
size?: string;
|
|
84
|
+
background?: string;
|
|
85
|
+
};
|
|
86
|
+
histogram?: {
|
|
87
|
+
background?: string;
|
|
88
|
+
bar?: {
|
|
89
|
+
background?: string;
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
pagination?: {
|
|
95
|
+
ui?: {
|
|
96
|
+
button?: {
|
|
97
|
+
background?: string;
|
|
98
|
+
border?: string;
|
|
99
|
+
borderRadius?: string;
|
|
100
|
+
padding?: string;
|
|
101
|
+
color?: string;
|
|
102
|
+
active?: {
|
|
103
|
+
background?: string;
|
|
104
|
+
color?: string;
|
|
105
|
+
};
|
|
106
|
+
hover?: {
|
|
107
|
+
background?: string;
|
|
108
|
+
color?: string;
|
|
109
|
+
};
|
|
110
|
+
};
|
|
111
|
+
};
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// Range Slider Configuration
|
|
116
|
+
export interface RangeSliderOptions {
|
|
117
|
+
key: string;
|
|
118
|
+
type: 'number' | 'date';
|
|
119
|
+
container: string;
|
|
120
|
+
min?: number;
|
|
121
|
+
max?: number;
|
|
122
|
+
step?: number;
|
|
123
|
+
defaultMin?: number;
|
|
124
|
+
defaultMax?: number;
|
|
125
|
+
ui?: {
|
|
126
|
+
showHistogram?: boolean;
|
|
127
|
+
bins?: number;
|
|
128
|
+
showValues?: boolean;
|
|
129
|
+
showLabels?: boolean;
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// Date Filter Configuration
|
|
134
|
+
export interface DateFilterOptions {
|
|
135
|
+
key: string;
|
|
136
|
+
container: string;
|
|
137
|
+
minDate?: Date;
|
|
138
|
+
maxDate?: Date;
|
|
139
|
+
format?: DateFormat;
|
|
140
|
+
defaultStart?: Date;
|
|
141
|
+
defaultEnd?: Date;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// Main AFS Options Interface
|
|
145
|
+
export interface AFSOptions {
|
|
146
|
+
// Required selectors
|
|
147
|
+
containerSelector: string;
|
|
148
|
+
itemSelector: string;
|
|
149
|
+
|
|
150
|
+
// Optional selectors
|
|
151
|
+
filterButtonSelector?: string;
|
|
152
|
+
filterDropdownSelector?: string;
|
|
153
|
+
searchInputSelector?: string;
|
|
154
|
+
counterSelector?: string;
|
|
155
|
+
sortButtonSelector?: string;
|
|
156
|
+
|
|
157
|
+
// CSS Classes
|
|
158
|
+
activeClass?: string;
|
|
159
|
+
hiddenClass?: string;
|
|
160
|
+
activeSortClass?: string;
|
|
161
|
+
transitionClass?: string;
|
|
162
|
+
|
|
163
|
+
// Filter Configuration
|
|
164
|
+
filterMode?: FilterMode;
|
|
165
|
+
groupMode?: FilterMode;
|
|
166
|
+
filterCategoryMode?: FilterCategoryMode;
|
|
167
|
+
filterTypeLogic?: FilterTypeLogic;
|
|
168
|
+
|
|
169
|
+
// Search Configuration
|
|
170
|
+
searchKeys?: string[];
|
|
171
|
+
debounceTime?: number;
|
|
172
|
+
|
|
173
|
+
// State Management
|
|
174
|
+
preserveState?: boolean;
|
|
175
|
+
stateExpiry?: number;
|
|
176
|
+
observeDOM?: boolean;
|
|
177
|
+
urlStateKey?: string;
|
|
178
|
+
|
|
179
|
+
// UI Configuration
|
|
180
|
+
counter?: CounterOptions;
|
|
181
|
+
pagination?: PaginationOptions;
|
|
182
|
+
animation?: AnimationOptions;
|
|
183
|
+
styles?: StyleOptions;
|
|
184
|
+
|
|
185
|
+
// System Configuration
|
|
186
|
+
responsive?: boolean;
|
|
187
|
+
debug?: boolean;
|
|
188
|
+
logLevel?: LogLevel;
|
|
189
|
+
dateFormat?: DateFormat;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
// Event Data Interfaces
|
|
193
|
+
export interface FiltersAppliedData {
|
|
194
|
+
activeFilters: Set<string>;
|
|
195
|
+
visibleItems: number;
|
|
196
|
+
total: number;
|
|
197
|
+
filterCount: number;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
export interface SearchData {
|
|
201
|
+
query: string;
|
|
202
|
+
matches: HTMLElement[];
|
|
203
|
+
total: number;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
export interface SortData {
|
|
207
|
+
key: string;
|
|
208
|
+
direction: SortDirection;
|
|
209
|
+
itemCount: number;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
export interface PageChangedData {
|
|
213
|
+
currentPage: number;
|
|
214
|
+
totalPages: number;
|
|
215
|
+
itemsPerPage: number;
|
|
216
|
+
visibleItems: number;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
export interface CounterUpdatedData {
|
|
220
|
+
total: number;
|
|
221
|
+
visible: number;
|
|
222
|
+
filtered: number;
|
|
223
|
+
formattedTotal: string;
|
|
224
|
+
formattedVisible: string;
|
|
225
|
+
formattedFiltered: string;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
// Sort Criteria
|
|
229
|
+
export interface SortCriteria {
|
|
230
|
+
key: string;
|
|
231
|
+
direction: SortDirection;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
// State Interfaces
|
|
235
|
+
export interface AFSState {
|
|
236
|
+
filters?: string[];
|
|
237
|
+
search?: string;
|
|
238
|
+
sort?: SortCriteria;
|
|
239
|
+
pagination?: {
|
|
240
|
+
currentPage: number;
|
|
241
|
+
itemsPerPage: number;
|
|
242
|
+
};
|
|
243
|
+
timestamp?: number;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
export interface PageInfo {
|
|
247
|
+
currentPage: number;
|
|
248
|
+
totalPages: number;
|
|
249
|
+
itemsPerPage: number;
|
|
250
|
+
totalItems: number;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
// Feature Classes
|
|
254
|
+
export declare class EventEmitter {
|
|
255
|
+
on(event: string, callback: EventCallback): void;
|
|
256
|
+
off(event: string, callback?: EventCallback): void;
|
|
257
|
+
emit(event: string, data?: AFSEventData): void;
|
|
258
|
+
once(event: string, callback: EventCallback): void;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
export declare class Filter {
|
|
262
|
+
constructor(afs: AFS);
|
|
263
|
+
addFilter(filter: string): void;
|
|
264
|
+
removeFilter(filter: string): void;
|
|
265
|
+
toggleFilter(filter: string): void;
|
|
266
|
+
toggleFilterExclusive(filter: string): void;
|
|
267
|
+
clearAllFilters(): void;
|
|
268
|
+
clearFilterCategory(category: string): void;
|
|
269
|
+
getActiveFilters(): Set<string>;
|
|
270
|
+
setFilterTypeLogic(type: string, logic: FilterMode | FilterTypeConfig): void;
|
|
271
|
+
applyFilters(): void;
|
|
272
|
+
destroy(): void;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
export declare class Search {
|
|
276
|
+
constructor(afs: AFS);
|
|
277
|
+
search(query: string): void;
|
|
278
|
+
clearSearch(): void;
|
|
279
|
+
setValue(value: string): void;
|
|
280
|
+
getValue(): string;
|
|
281
|
+
getMatches(): HTMLElement[];
|
|
282
|
+
destroy(): void;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
export declare class Sort {
|
|
286
|
+
constructor(afs: AFS);
|
|
287
|
+
sort(key: string, direction?: SortDirection): void;
|
|
288
|
+
sortMultiple(criteria: SortCriteria[]): void;
|
|
289
|
+
sortWithComparator(key: string, comparator: (a: any, b: any) => number): void;
|
|
290
|
+
shuffle(): void;
|
|
291
|
+
reset(): void;
|
|
292
|
+
getCurrentSort(): SortCriteria | null;
|
|
293
|
+
destroy(): void;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
export declare class Pagination {
|
|
297
|
+
constructor(afs: AFS);
|
|
298
|
+
goToPage(page: number): void;
|
|
299
|
+
nextPage(): void;
|
|
300
|
+
previousPage(): void;
|
|
301
|
+
setPaginationMode(enabled: boolean): void;
|
|
302
|
+
getPageInfo(): PageInfo;
|
|
303
|
+
update(): void;
|
|
304
|
+
destroy(): void;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
export declare class RangeFilter {
|
|
308
|
+
constructor(afs: AFS);
|
|
309
|
+
addRangeSlider(options: RangeSliderOptions): void;
|
|
310
|
+
removeRangeSlider(key: string): void;
|
|
311
|
+
getRangeValue(key: string): { min: number; max: number } | null;
|
|
312
|
+
setRangeValue(key: string, min: number, max: number): void;
|
|
313
|
+
destroy(): void;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
export declare class DateFilter {
|
|
317
|
+
constructor(afs: AFS);
|
|
318
|
+
addDateRange(options: DateFilterOptions): void;
|
|
319
|
+
removeDateRange(key: string): void;
|
|
320
|
+
getDateRange(key: string): { start: Date; end: Date } | null;
|
|
321
|
+
setDateRange(key: string, start: Date, end: Date): void;
|
|
322
|
+
destroy(): void;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
export declare class URLManager {
|
|
326
|
+
constructor(afs: AFS);
|
|
327
|
+
initialize(): void;
|
|
328
|
+
updateURL(): void;
|
|
329
|
+
loadFromURL(): void;
|
|
330
|
+
clearURL(): void;
|
|
331
|
+
getURLParams(): URLSearchParams;
|
|
332
|
+
hasParams(): boolean;
|
|
333
|
+
getParam(param: string): string | null;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
// Main AFS Class
|
|
337
|
+
export declare class AFS extends EventEmitter {
|
|
338
|
+
// Properties
|
|
339
|
+
readonly VERSION: string;
|
|
340
|
+
readonly options: any;
|
|
341
|
+
readonly logger: any;
|
|
342
|
+
readonly state: any;
|
|
343
|
+
readonly styleManager: any;
|
|
344
|
+
readonly container: HTMLElement;
|
|
345
|
+
readonly items: NodeListOf<HTMLElement>;
|
|
346
|
+
|
|
347
|
+
// Features
|
|
348
|
+
readonly filter: Filter;
|
|
349
|
+
readonly search: Search;
|
|
350
|
+
readonly sort: Sort;
|
|
351
|
+
readonly pagination: Pagination;
|
|
352
|
+
readonly rangeFilter: RangeFilter;
|
|
353
|
+
readonly dateFilter: DateFilter;
|
|
354
|
+
readonly urlManager: URLManager;
|
|
355
|
+
readonly inputRangeFilter: any;
|
|
356
|
+
|
|
357
|
+
constructor(options?: AFSOptions);
|
|
358
|
+
|
|
359
|
+
// Item Management
|
|
360
|
+
showItem(item: HTMLElement): void;
|
|
361
|
+
hideItem(item: HTMLElement): void;
|
|
362
|
+
addItems(items: HTMLElement | HTMLElement[]): void;
|
|
363
|
+
removeItems(items: HTMLElement | HTMLElement[]): void;
|
|
364
|
+
|
|
365
|
+
// State Management
|
|
366
|
+
saveState(): void;
|
|
367
|
+
restoreState(): void;
|
|
368
|
+
getState(): AFSState;
|
|
369
|
+
setState(state: AFSState): void;
|
|
370
|
+
|
|
371
|
+
// Updates
|
|
372
|
+
updateCounter(): void;
|
|
373
|
+
updateOptions(options: Partial<AFSOptions>): void;
|
|
374
|
+
refresh(): void;
|
|
375
|
+
|
|
376
|
+
// Utilities
|
|
377
|
+
getVersion(): string;
|
|
378
|
+
isFeatureSupported(feature: string): boolean;
|
|
379
|
+
destroy(): void;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
// Events Map
|
|
383
|
+
export interface AFSEventMap {
|
|
384
|
+
// Core events
|
|
385
|
+
initialized: { itemCount: number; options: AFSOptions };
|
|
386
|
+
destroyed: void;
|
|
387
|
+
refreshed: { itemCount: number };
|
|
388
|
+
counterUpdated: CounterUpdatedData;
|
|
389
|
+
resize: void;
|
|
390
|
+
hidden: void;
|
|
391
|
+
visible: void;
|
|
392
|
+
|
|
393
|
+
// Filter events
|
|
394
|
+
filtersApplied: FiltersAppliedData;
|
|
395
|
+
filtersCleared: { clearedCount: number };
|
|
396
|
+
filterAdded: { filter: string; activeFilters: Set<string> };
|
|
397
|
+
filterRemoved: { filter: string; activeFilters: Set<string> };
|
|
398
|
+
filterToggled: { filter: string; isActive: boolean };
|
|
399
|
+
|
|
400
|
+
// Search events
|
|
401
|
+
search: SearchData;
|
|
402
|
+
searchCleared: void;
|
|
403
|
+
|
|
404
|
+
// Sort events
|
|
405
|
+
sort: SortData;
|
|
406
|
+
sortMultiple: { criteria: SortCriteria[]; itemCount: number };
|
|
407
|
+
sortCustom: { key: string; comparatorName?: string };
|
|
408
|
+
sortShuffled: { itemCount: number };
|
|
409
|
+
sortCleared: { buttonCount: number };
|
|
410
|
+
|
|
411
|
+
// Pagination events
|
|
412
|
+
pageChanged: PageChangedData;
|
|
413
|
+
paginationToggled: { enabled: boolean };
|
|
414
|
+
|
|
415
|
+
// URL events
|
|
416
|
+
urlStateLoaded: { params: Record<string, string> };
|
|
417
|
+
|
|
418
|
+
// Range filter events
|
|
419
|
+
rangeChanged: { key: string; min: number; max: number };
|
|
420
|
+
|
|
421
|
+
// Date filter events
|
|
422
|
+
dateRangeChanged: { key: string; start: Date; end: Date };
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
// Global exports
|
|
426
|
+
export const VERSION: string;
|
|
427
|
+
export default AFS;
|
|
428
|
+
|
|
429
|
+
// Type guards and utilities
|
|
430
|
+
export function isAFSInstance(obj: any): obj is AFS;
|
|
431
|
+
export function createAFS(options?: AFSOptions): AFS;
|
|
432
|
+
|
|
433
|
+
// Plugin system (for future extensions)
|
|
434
|
+
export interface AFSPlugin {
|
|
435
|
+
name: string;
|
|
436
|
+
version: string;
|
|
437
|
+
install(afs: AFS): void;
|
|
438
|
+
uninstall?(afs: AFS): void;
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
export declare function registerPlugin(plugin: AFSPlugin): void;
|
|
442
|
+
export declare function unregisterPlugin(pluginName: string): void;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface InputRangeOptions {
|
|
2
|
+
key: string;
|
|
3
|
+
container: HTMLElement;
|
|
4
|
+
min?: number;
|
|
5
|
+
max?: number;
|
|
6
|
+
step?: number;
|
|
7
|
+
label?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface RangeValues {
|
|
11
|
+
min: number;
|
|
12
|
+
max: number;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface InputRangeEvent {
|
|
16
|
+
key: string;
|
|
17
|
+
min: number;
|
|
18
|
+
max: number;
|
|
19
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export interface PaginationOptions {
|
|
2
|
+
enabled: boolean;
|
|
3
|
+
itemsPerPage: number;
|
|
4
|
+
maxButtons?: number;
|
|
5
|
+
showPrevNext?: boolean;
|
|
6
|
+
showFirstLast?: boolean;
|
|
7
|
+
scrollToTop?: boolean;
|
|
8
|
+
scrollOffset?: number;
|
|
9
|
+
containerClass?: string;
|
|
10
|
+
pageButtonClass?: string;
|
|
11
|
+
activePageClass?: string;
|
|
12
|
+
template?: PaginationTemplate;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface PaginationTemplate {
|
|
16
|
+
prev?: string;
|
|
17
|
+
next?: string;
|
|
18
|
+
first?: string;
|
|
19
|
+
last?: string;
|
|
20
|
+
ellipsis?: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface PageInfo {
|
|
24
|
+
currentPage: number;
|
|
25
|
+
itemsPerPage: number;
|
|
26
|
+
totalPages: number;
|
|
27
|
+
totalItems: number;
|
|
28
|
+
startIndex: number;
|
|
29
|
+
endIndex: number;
|
|
30
|
+
hasNextPage: boolean;
|
|
31
|
+
hasPrevPage: boolean;
|
|
32
|
+
}
|
|
33
|
+
export interface PaginationEvent {
|
|
34
|
+
currentPage: number;
|
|
35
|
+
totalPages: number;
|
|
36
|
+
itemsPerPage: number;
|
|
37
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { SortState } from "./sort";
|
|
2
|
+
import type { DateRange } from "./date-filter";
|
|
3
|
+
|
|
4
|
+
export interface URLState {
|
|
5
|
+
filters: string[];
|
|
6
|
+
ranges: Map<string, Range>;
|
|
7
|
+
dateRanges: Map<string, DateRange>;
|
|
8
|
+
search: string;
|
|
9
|
+
sort: SortState;
|
|
10
|
+
page: number;
|
|
11
|
+
}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility Types for Advanced Filter System
|
|
3
|
+
* @fileoverview TypeScript definitions for utility functions
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
// Utility Functions
|
|
7
|
+
export declare function debounce<T extends (...args: any[]) => any>(
|
|
8
|
+
func: T,
|
|
9
|
+
delay: number
|
|
10
|
+
): (...args: Parameters<T>) => void;
|
|
11
|
+
|
|
12
|
+
export declare function throttle<T extends (...args: any[]) => any>(
|
|
13
|
+
func: T,
|
|
14
|
+
delay: number
|
|
15
|
+
): (...args: Parameters<T>) => void;
|
|
16
|
+
|
|
17
|
+
export declare function normalizeText(text: string): string;
|
|
18
|
+
|
|
19
|
+
export declare function getDataAttribute(
|
|
20
|
+
element: HTMLElement,
|
|
21
|
+
key: string
|
|
22
|
+
): string | null;
|
|
23
|
+
|
|
24
|
+
export declare function setDataAttribute(
|
|
25
|
+
element: HTMLElement,
|
|
26
|
+
key: string,
|
|
27
|
+
value: string
|
|
28
|
+
): void;
|
|
29
|
+
|
|
30
|
+
export declare function parseDate(
|
|
31
|
+
dateString: string,
|
|
32
|
+
format?: string
|
|
33
|
+
): Date | null;
|
|
34
|
+
|
|
35
|
+
export declare function formatDate(
|
|
36
|
+
date: Date,
|
|
37
|
+
format?: string
|
|
38
|
+
): string;
|
|
39
|
+
|
|
40
|
+
export declare function parseNumber(
|
|
41
|
+
value: string | number
|
|
42
|
+
): number | null;
|
|
43
|
+
|
|
44
|
+
export declare function escapeRegExp(string: string): string;
|
|
45
|
+
|
|
46
|
+
export declare function createElementFromHTML(html: string): HTMLElement;
|
|
47
|
+
|
|
48
|
+
export declare function getElementPosition(element: HTMLElement): {
|
|
49
|
+
top: number;
|
|
50
|
+
left: number;
|
|
51
|
+
width: number;
|
|
52
|
+
height: number;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export declare function isElementVisible(element: HTMLElement): boolean;
|
|
56
|
+
|
|
57
|
+
export declare function scrollToElement(
|
|
58
|
+
element: HTMLElement,
|
|
59
|
+
options?: {
|
|
60
|
+
behavior?: 'smooth' | 'auto';
|
|
61
|
+
offset?: number;
|
|
62
|
+
}
|
|
63
|
+
): void;
|
|
64
|
+
|
|
65
|
+
export declare function deepClone<T>(obj: T): T;
|
|
66
|
+
|
|
67
|
+
export declare function deepMerge<T extends object>(
|
|
68
|
+
target: T,
|
|
69
|
+
source: Partial<T>
|
|
70
|
+
): T;
|
|
71
|
+
|
|
72
|
+
export declare function generateId(prefix?: string): string;
|
|
73
|
+
|
|
74
|
+
export declare function removeElement(element: HTMLElement): void;
|
|
75
|
+
|
|
76
|
+
export declare function addClass(
|
|
77
|
+
element: HTMLElement,
|
|
78
|
+
className: string
|
|
79
|
+
): void;
|
|
80
|
+
|
|
81
|
+
export declare function removeClass(
|
|
82
|
+
element: HTMLElement,
|
|
83
|
+
className: string
|
|
84
|
+
): void;
|
|
85
|
+
|
|
86
|
+
export declare function toggleClass(
|
|
87
|
+
element: HTMLElement,
|
|
88
|
+
className: string,
|
|
89
|
+
force?: boolean
|
|
90
|
+
): void;
|
|
91
|
+
|
|
92
|
+
export declare function hasClass(
|
|
93
|
+
element: HTMLElement,
|
|
94
|
+
className: string
|
|
95
|
+
): boolean;
|
|
96
|
+
|
|
97
|
+
// Type Guards
|
|
98
|
+
export declare function isString(value: any): value is string;
|
|
99
|
+
export declare function isNumber(value: any): value is number;
|
|
100
|
+
export declare function isBoolean(value: any): value is boolean;
|
|
101
|
+
export declare function isFunction(value: any): value is Function;
|
|
102
|
+
export declare function isObject(value: any): value is object;
|
|
103
|
+
export declare function isArray(value: any): value is Array<any>;
|
|
104
|
+
export declare function isDate(value: any): value is Date;
|
|
105
|
+
export declare function isHTMLElement(value: any): value is HTMLElement;
|
|
106
|
+
export declare function isNodeList(value: any): value is NodeList;
|
|
107
|
+
|
|
108
|
+
// Constants
|
|
109
|
+
export declare const DEFAULT_DEBOUNCE_TIME: number;
|
|
110
|
+
export declare const DEFAULT_ANIMATION_DURATION: number;
|
|
111
|
+
export declare const DEFAULT_DATE_FORMAT: string;
|
|
112
|
+
export declare const CSS_CLASS_PREFIX: string;
|
|
113
|
+
|
|
114
|
+
// Error Classes
|
|
115
|
+
export declare class AFSError extends Error {
|
|
116
|
+
constructor(message: string, code?: string);
|
|
117
|
+
readonly code?: string;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export declare class ValidationError extends AFSError {
|
|
121
|
+
constructor(message: string, field?: string);
|
|
122
|
+
readonly field?: string;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export declare class ConfigurationError extends AFSError {
|
|
126
|
+
constructor(message: string, option?: string);
|
|
127
|
+
readonly option?: string;
|
|
128
|
+
}
|