@zengrid/core 1.0.1
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 +55 -0
- package/dist/README.md +55 -0
- package/dist/index.cjs.default.js +1 -0
- package/dist/index.cjs.js +9882 -0
- package/dist/index.cjs.mjs +2 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.esm.js +9847 -0
- package/dist/package.json +49 -0
- package/dist/src/a11y/aria-manager.d.ts +171 -0
- package/dist/src/a11y/aria-manager.d.ts.map +1 -0
- package/dist/src/a11y/focus-manager.d.ts +124 -0
- package/dist/src/a11y/focus-manager.d.ts.map +1 -0
- package/dist/src/a11y/index.d.ts +8 -0
- package/dist/src/a11y/index.d.ts.map +1 -0
- package/dist/src/data/data-accessor/array-accessor.d.ts +38 -0
- package/dist/src/data/data-accessor/array-accessor.d.ts.map +1 -0
- package/dist/src/data/data-accessor/column-store-accessor.d.ts +41 -0
- package/dist/src/data/data-accessor/column-store-accessor.d.ts.map +1 -0
- package/dist/src/data/data-accessor/data-accessor.interface.d.ts +41 -0
- package/dist/src/data/data-accessor/data-accessor.interface.d.ts.map +1 -0
- package/dist/src/data/data-accessor/index.d.ts +9 -0
- package/dist/src/data/data-accessor/index.d.ts.map +1 -0
- package/dist/src/data/data-accessor/sparse-matrix-accessor.d.ts +39 -0
- package/dist/src/data/data-accessor/sparse-matrix-accessor.d.ts.map +1 -0
- package/dist/src/data/data-manager.d.ts +161 -0
- package/dist/src/data/data-manager.d.ts.map +1 -0
- package/dist/src/data/data-source.interface.d.ts +82 -0
- package/dist/src/data/data-source.interface.d.ts.map +1 -0
- package/dist/src/data/grid-data-model.d.ts +102 -0
- package/dist/src/data/grid-data-model.d.ts.map +1 -0
- package/dist/src/data/index-map/index-map.d.ts +30 -0
- package/dist/src/data/index-map/index-map.d.ts.map +1 -0
- package/dist/src/data/index-map/index-map.interface.d.ts +49 -0
- package/dist/src/data/index-map/index-map.interface.d.ts.map +1 -0
- package/dist/src/data/index-map/index.d.ts +7 -0
- package/dist/src/data/index-map/index.d.ts.map +1 -0
- package/dist/src/data/index.d.ts +9 -0
- package/dist/src/data/index.d.ts.map +1 -0
- package/dist/src/editing/cell-editor.interface.d.ts +87 -0
- package/dist/src/editing/cell-editor.interface.d.ts.map +1 -0
- package/dist/src/editing/date-editor.d.ts +67 -0
- package/dist/src/editing/date-editor.d.ts.map +1 -0
- package/dist/src/editing/editor-manager.d.ts +141 -0
- package/dist/src/editing/editor-manager.d.ts.map +1 -0
- package/dist/src/editing/index.d.ts +15 -0
- package/dist/src/editing/index.d.ts.map +1 -0
- package/dist/src/editing/number-editor.d.ts +68 -0
- package/dist/src/editing/number-editor.d.ts.map +1 -0
- package/dist/src/editing/select-editor.d.ts +53 -0
- package/dist/src/editing/select-editor.d.ts.map +1 -0
- package/dist/src/editing/text-editor.d.ts +69 -0
- package/dist/src/editing/text-editor.d.ts.map +1 -0
- package/dist/src/events/event-emitter.d.ts +90 -0
- package/dist/src/events/event-emitter.d.ts.map +1 -0
- package/dist/src/events/grid-events.d.ts +277 -0
- package/dist/src/events/grid-events.d.ts.map +1 -0
- package/dist/src/events/index.d.ts +6 -0
- package/dist/src/events/index.d.ts.map +1 -0
- package/dist/src/features/autofill/autofill-manager.d.ts +103 -0
- package/dist/src/features/autofill/autofill-manager.d.ts.map +1 -0
- package/dist/src/features/autofill/index.d.ts +6 -0
- package/dist/src/features/autofill/index.d.ts.map +1 -0
- package/dist/src/features/column-resize/auto-fit-calculator.d.ts +52 -0
- package/dist/src/features/column-resize/auto-fit-calculator.d.ts.map +1 -0
- package/dist/src/features/column-resize/column-resize-manager.d.ts +114 -0
- package/dist/src/features/column-resize/column-resize-manager.d.ts.map +1 -0
- package/dist/src/features/column-resize/column-resize-manager.interface.d.ts +167 -0
- package/dist/src/features/column-resize/column-resize-manager.interface.d.ts.map +1 -0
- package/dist/src/features/column-resize/column-resize.styles.css +30 -0
- package/dist/src/features/column-resize/index.d.ts +15 -0
- package/dist/src/features/column-resize/index.d.ts.map +1 -0
- package/dist/src/features/column-resize/resize-constraint-manager.d.ts +52 -0
- package/dist/src/features/column-resize/resize-constraint-manager.d.ts.map +1 -0
- package/dist/src/features/column-resize/resize-handle-renderer.d.ts +41 -0
- package/dist/src/features/column-resize/resize-handle-renderer.d.ts.map +1 -0
- package/dist/src/features/column-resize/resize-preview.d.ts +32 -0
- package/dist/src/features/column-resize/resize-preview.d.ts.map +1 -0
- package/dist/src/features/column-resize/resize-state-manager.d.ts +75 -0
- package/dist/src/features/column-resize/resize-state-manager.d.ts.map +1 -0
- package/dist/src/features/column-resize/resize-strategies.d.ts +26 -0
- package/dist/src/features/column-resize/resize-strategies.d.ts.map +1 -0
- package/dist/src/features/column-resize/resize-test-helper.d.ts +71 -0
- package/dist/src/features/column-resize/resize-test-helper.d.ts.map +1 -0
- package/dist/src/features/column-resize/resize-zone-detector.d.ts +32 -0
- package/dist/src/features/column-resize/resize-zone-detector.d.ts.map +1 -0
- package/dist/src/features/copy-paste/clipboard-manager.d.ts +116 -0
- package/dist/src/features/copy-paste/clipboard-manager.d.ts.map +1 -0
- package/dist/src/features/copy-paste/index.d.ts +6 -0
- package/dist/src/features/copy-paste/index.d.ts.map +1 -0
- package/dist/src/features/filtering/adapters/adapter.interface.d.ts +100 -0
- package/dist/src/features/filtering/adapters/adapter.interface.d.ts.map +1 -0
- package/dist/src/features/filtering/adapters/graphql-adapter.d.ts +124 -0
- package/dist/src/features/filtering/adapters/graphql-adapter.d.ts.map +1 -0
- package/dist/src/features/filtering/adapters/index.d.ts +11 -0
- package/dist/src/features/filtering/adapters/index.d.ts.map +1 -0
- package/dist/src/features/filtering/adapters/rest-adapter.d.ts +108 -0
- package/dist/src/features/filtering/adapters/rest-adapter.d.ts.map +1 -0
- package/dist/src/features/filtering/adapters/sql-adapter.d.ts +123 -0
- package/dist/src/features/filtering/adapters/sql-adapter.d.ts.map +1 -0
- package/dist/src/features/filtering/adapters/types.d.ts +201 -0
- package/dist/src/features/filtering/adapters/types.d.ts.map +1 -0
- package/dist/src/features/filtering/column-filter.d.ts +117 -0
- package/dist/src/features/filtering/column-filter.d.ts.map +1 -0
- package/dist/src/features/filtering/filter-autocomplete.d.ts +78 -0
- package/dist/src/features/filtering/filter-autocomplete.d.ts.map +1 -0
- package/dist/src/features/filtering/filter-cache.d.ts +113 -0
- package/dist/src/features/filtering/filter-cache.d.ts.map +1 -0
- package/dist/src/features/filtering/filter-compiler.d.ts +66 -0
- package/dist/src/features/filtering/filter-compiler.d.ts.map +1 -0
- package/dist/src/features/filtering/filter-export-manager.d.ts +131 -0
- package/dist/src/features/filtering/filter-export-manager.d.ts.map +1 -0
- package/dist/src/features/filtering/filter-index-manager.d.ts +126 -0
- package/dist/src/features/filtering/filter-index-manager.d.ts.map +1 -0
- package/dist/src/features/filtering/filter-manager.d.ts +408 -0
- package/dist/src/features/filtering/filter-manager.d.ts.map +1 -0
- package/dist/src/features/filtering/filter-optimizer.d.ts +101 -0
- package/dist/src/features/filtering/filter-optimizer.d.ts.map +1 -0
- package/dist/src/features/filtering/filter-query-parser.d.ts +69 -0
- package/dist/src/features/filtering/filter-query-parser.d.ts.map +1 -0
- package/dist/src/features/filtering/index.d.ts +20 -0
- package/dist/src/features/filtering/index.d.ts.map +1 -0
- package/dist/src/features/filtering/range-filter-optimizer.d.ts +138 -0
- package/dist/src/features/filtering/range-filter-optimizer.d.ts.map +1 -0
- package/dist/src/features/filtering/substring-filter.d.ts +90 -0
- package/dist/src/features/filtering/substring-filter.d.ts.map +1 -0
- package/dist/src/features/filtering/types.d.ts +204 -0
- package/dist/src/features/filtering/types.d.ts.map +1 -0
- package/dist/src/features/formulas/formula-calculator.d.ts +151 -0
- package/dist/src/features/formulas/formula-calculator.d.ts.map +1 -0
- package/dist/src/features/formulas/index.d.ts +6 -0
- package/dist/src/features/formulas/index.d.ts.map +1 -0
- package/dist/src/features/hit-testing/index.d.ts +7 -0
- package/dist/src/features/hit-testing/index.d.ts.map +1 -0
- package/dist/src/features/hit-testing/spatial-hit-tester.d.ts +137 -0
- package/dist/src/features/hit-testing/spatial-hit-tester.d.ts.map +1 -0
- package/dist/src/features/loading/index.d.ts +5 -0
- package/dist/src/features/loading/index.d.ts.map +1 -0
- package/dist/src/features/loading/loading-indicator.d.ts +79 -0
- package/dist/src/features/loading/loading-indicator.d.ts.map +1 -0
- package/dist/src/features/loading/loading.styles.css +413 -0
- package/dist/src/features/pagination/index.d.ts +5 -0
- package/dist/src/features/pagination/index.d.ts.map +1 -0
- package/dist/src/features/pagination/pagination.styles.css +288 -0
- package/dist/src/features/pagination/paginator.d.ts +89 -0
- package/dist/src/features/pagination/paginator.d.ts.map +1 -0
- package/dist/src/features/selection/index.d.ts +7 -0
- package/dist/src/features/selection/index.d.ts.map +1 -0
- package/dist/src/features/selection/selection-manager.d.ts +167 -0
- package/dist/src/features/selection/selection-manager.d.ts.map +1 -0
- package/dist/src/features/sorting/index.d.ts +13 -0
- package/dist/src/features/sorting/index.d.ts.map +1 -0
- package/dist/src/features/sorting/row-sorter.interface.d.ts +63 -0
- package/dist/src/features/sorting/row-sorter.interface.d.ts.map +1 -0
- package/dist/src/features/sorting/single-column-sorter.d.ts +75 -0
- package/dist/src/features/sorting/single-column-sorter.d.ts.map +1 -0
- package/dist/src/features/sorting/sort-manager.d.ts +132 -0
- package/dist/src/features/sorting/sort-manager.d.ts.map +1 -0
- package/dist/src/features/undo-redo/index.d.ts +8 -0
- package/dist/src/features/undo-redo/index.d.ts.map +1 -0
- package/dist/src/features/undo-redo/undo-redo-manager.d.ts +215 -0
- package/dist/src/features/undo-redo/undo-redo-manager.d.ts.map +1 -0
- package/dist/src/grid.d.ts +412 -0
- package/dist/src/grid.d.ts.map +1 -0
- package/dist/src/i18n/index.d.ts +8 -0
- package/dist/src/i18n/index.d.ts.map +1 -0
- package/dist/src/i18n/locale-manager.d.ts +123 -0
- package/dist/src/i18n/locale-manager.d.ts.map +1 -0
- package/dist/src/i18n/rtl-support.d.ts +120 -0
- package/dist/src/i18n/rtl-support.d.ts.map +1 -0
- package/dist/src/index.d.ts +38 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/keyboard/index.d.ts +6 -0
- package/dist/src/keyboard/index.d.ts.map +1 -0
- package/dist/src/keyboard/keyboard-navigator.d.ts +171 -0
- package/dist/src/keyboard/keyboard-navigator.d.ts.map +1 -0
- package/dist/src/rendering/cache/index.d.ts +3 -0
- package/dist/src/rendering/cache/index.d.ts.map +1 -0
- package/dist/src/rendering/cache/renderer-cache.d.ts +100 -0
- package/dist/src/rendering/cache/renderer-cache.d.ts.map +1 -0
- package/dist/src/rendering/cache/renderer-cache.interface.d.ts +89 -0
- package/dist/src/rendering/cache/renderer-cache.interface.d.ts.map +1 -0
- package/dist/src/rendering/cell-pool/cell-pool.d.ts +36 -0
- package/dist/src/rendering/cell-pool/cell-pool.d.ts.map +1 -0
- package/dist/src/rendering/cell-pool/cell-pool.interface.d.ts +76 -0
- package/dist/src/rendering/cell-pool/cell-pool.interface.d.ts.map +1 -0
- package/dist/src/rendering/cell-pool/index.d.ts +6 -0
- package/dist/src/rendering/cell-pool/index.d.ts.map +1 -0
- package/dist/src/rendering/cell-positioner/cell-positioner.d.ts +46 -0
- package/dist/src/rendering/cell-positioner/cell-positioner.d.ts.map +1 -0
- package/dist/src/rendering/cell-positioner/cell-positioner.interface.d.ts +86 -0
- package/dist/src/rendering/cell-positioner/cell-positioner.interface.d.ts.map +1 -0
- package/dist/src/rendering/cell-positioner/index.d.ts +6 -0
- package/dist/src/rendering/cell-positioner/index.d.ts.map +1 -0
- package/dist/src/rendering/height-provider/height-provider.interface.d.ts +62 -0
- package/dist/src/rendering/height-provider/height-provider.interface.d.ts.map +1 -0
- package/dist/src/rendering/height-provider/index.d.ts +7 -0
- package/dist/src/rendering/height-provider/index.d.ts.map +1 -0
- package/dist/src/rendering/height-provider/uniform-height-provider.d.ts +31 -0
- package/dist/src/rendering/height-provider/uniform-height-provider.d.ts.map +1 -0
- package/dist/src/rendering/height-provider/variable-height-provider.d.ts +33 -0
- package/dist/src/rendering/height-provider/variable-height-provider.d.ts.map +1 -0
- package/dist/src/rendering/renderers/advanced-cell-renderer.d.ts +105 -0
- package/dist/src/rendering/renderers/advanced-cell-renderer.d.ts.map +1 -0
- package/dist/src/rendering/renderers/image-renderer.d.ts +60 -0
- package/dist/src/rendering/renderers/image-renderer.d.ts.map +1 -0
- package/dist/src/rendering/renderers/index.d.ts +13 -0
- package/dist/src/rendering/renderers/index.d.ts.map +1 -0
- package/dist/src/rendering/renderers/number-renderer.d.ts +71 -0
- package/dist/src/rendering/renderers/number-renderer.d.ts.map +1 -0
- package/dist/src/rendering/renderers/renderer-registry.d.ts +55 -0
- package/dist/src/rendering/renderers/renderer-registry.d.ts.map +1 -0
- package/dist/src/rendering/renderers/renderer.interface.d.ts +79 -0
- package/dist/src/rendering/renderers/renderer.interface.d.ts.map +1 -0
- package/dist/src/rendering/renderers/text-renderer.d.ts +20 -0
- package/dist/src/rendering/renderers/text-renderer.d.ts.map +1 -0
- package/dist/src/rendering/spatial-hit-tester.d.ts +108 -0
- package/dist/src/rendering/spatial-hit-tester.d.ts.map +1 -0
- package/dist/src/rendering/virtual-scroller/index.d.ts +6 -0
- package/dist/src/rendering/virtual-scroller/index.d.ts.map +1 -0
- package/dist/src/rendering/virtual-scroller/virtual-scroller.d.ts +56 -0
- package/dist/src/rendering/virtual-scroller/virtual-scroller.d.ts.map +1 -0
- package/dist/src/rendering/virtual-scroller/virtual-scroller.interface.d.ts +170 -0
- package/dist/src/rendering/virtual-scroller/virtual-scroller.interface.d.ts.map +1 -0
- package/dist/src/rendering/width-provider/index.d.ts +7 -0
- package/dist/src/rendering/width-provider/index.d.ts.map +1 -0
- package/dist/src/rendering/width-provider/uniform-width-provider.d.ts +31 -0
- package/dist/src/rendering/width-provider/uniform-width-provider.d.ts.map +1 -0
- package/dist/src/rendering/width-provider/variable-width-provider.d.ts +33 -0
- package/dist/src/rendering/width-provider/variable-width-provider.d.ts.map +1 -0
- package/dist/src/rendering/width-provider/width-provider.interface.d.ts +62 -0
- package/dist/src/rendering/width-provider/width-provider.interface.d.ts.map +1 -0
- package/dist/src/selection/hit-tester.d.ts +168 -0
- package/dist/src/selection/hit-tester.d.ts.map +1 -0
- package/dist/src/selection/hit-tester.interface.d.ts +108 -0
- package/dist/src/selection/hit-tester.interface.d.ts.map +1 -0
- package/dist/src/selection/index.d.ts +9 -0
- package/dist/src/selection/index.d.ts.map +1 -0
- package/dist/src/selection/range-utils.d.ts +219 -0
- package/dist/src/selection/range-utils.d.ts.map +1 -0
- package/dist/src/selection/range-utils.interface.d.ts +51 -0
- package/dist/src/selection/range-utils.interface.d.ts.map +1 -0
- package/dist/src/styles/grid.css +356 -0
- package/dist/src/styles.css +273 -0
- package/dist/src/touch/index.d.ts +6 -0
- package/dist/src/touch/index.d.ts.map +1 -0
- package/dist/src/touch/touch-handler.d.ts +167 -0
- package/dist/src/touch/touch-handler.d.ts.map +1 -0
- package/dist/src/types/index.d.ts +133 -0
- package/dist/src/types/index.d.ts.map +1 -0
- package/dist/src/types.d.ts +559 -0
- package/dist/src/types.d.ts.map +1 -0
- package/package.json +47 -0
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Filter Export Format Types
|
|
3
|
+
*
|
|
4
|
+
* Defines output formats for different backend integrations:
|
|
5
|
+
* - REST: Query string parameters
|
|
6
|
+
* - GraphQL: Where clause objects
|
|
7
|
+
* - SQL: Parameterized WHERE clauses
|
|
8
|
+
*/
|
|
9
|
+
import type { FieldFilterGroup, FieldFilterState } from '../types';
|
|
10
|
+
/**
|
|
11
|
+
* REST filter export format
|
|
12
|
+
*
|
|
13
|
+
* Provides filter data in multiple REST-friendly formats
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* // Brackets style
|
|
18
|
+
* {
|
|
19
|
+
* queryString: "filter[age][gt]=18&filter[status][eq]=active",
|
|
20
|
+
* params: {
|
|
21
|
+
* 'filter[age][gt]': '18',
|
|
22
|
+
* 'filter[status][eq]': 'active'
|
|
23
|
+
* },
|
|
24
|
+
* body: { logic: 'AND', conditions: [...] }
|
|
25
|
+
* }
|
|
26
|
+
*
|
|
27
|
+
* // Flat style
|
|
28
|
+
* {
|
|
29
|
+
* queryString: "age_gt=18&status_eq=active",
|
|
30
|
+
* params: {
|
|
31
|
+
* 'age_gt': '18',
|
|
32
|
+
* 'status_eq': 'active'
|
|
33
|
+
* },
|
|
34
|
+
* body: { logic: 'AND', conditions: [...] }
|
|
35
|
+
* }
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
export interface RESTFilterExport {
|
|
39
|
+
/**
|
|
40
|
+
* URL-encoded query string (ready to append to URL)
|
|
41
|
+
* @example "?filter[age][gt]=18&filter[status][eq]=active"
|
|
42
|
+
*/
|
|
43
|
+
queryString: string;
|
|
44
|
+
/**
|
|
45
|
+
* Individual query parameters as key-value pairs
|
|
46
|
+
* Useful for custom query string builders
|
|
47
|
+
*/
|
|
48
|
+
params: Record<string, string>;
|
|
49
|
+
/**
|
|
50
|
+
* JSON body format (for POST requests)
|
|
51
|
+
* The original field-based filter group
|
|
52
|
+
*/
|
|
53
|
+
body: FieldFilterGroup;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* GraphQL filter export format
|
|
57
|
+
*
|
|
58
|
+
* Generates where clauses compatible with different GraphQL schemas
|
|
59
|
+
*
|
|
60
|
+
* @example Prisma
|
|
61
|
+
* ```typescript
|
|
62
|
+
* {
|
|
63
|
+
* where: {
|
|
64
|
+
* age: { gt: 18 },
|
|
65
|
+
* status: { equals: "active" }
|
|
66
|
+
* },
|
|
67
|
+
* variables: {
|
|
68
|
+
* age_gt: 18,
|
|
69
|
+
* status: "active"
|
|
70
|
+
* },
|
|
71
|
+
* variablesTypeDef: "$age_gt: Int, $status: String"
|
|
72
|
+
* }
|
|
73
|
+
* ```
|
|
74
|
+
*
|
|
75
|
+
* @example Hasura
|
|
76
|
+
* ```typescript
|
|
77
|
+
* {
|
|
78
|
+
* where: {
|
|
79
|
+
* age: { _gt: 18 },
|
|
80
|
+
* status: { _eq: "active" }
|
|
81
|
+
* },
|
|
82
|
+
* variables: {
|
|
83
|
+
* age: 18,
|
|
84
|
+
* status: "active"
|
|
85
|
+
* },
|
|
86
|
+
* variablesTypeDef: "$age: Int, $status: String"
|
|
87
|
+
* }
|
|
88
|
+
* ```
|
|
89
|
+
*/
|
|
90
|
+
export interface GraphQLFilterExport {
|
|
91
|
+
/**
|
|
92
|
+
* GraphQL where clause object
|
|
93
|
+
* Format depends on the GraphQL schema (Prisma, Hasura, etc.)
|
|
94
|
+
*/
|
|
95
|
+
where: Record<string, any>;
|
|
96
|
+
/**
|
|
97
|
+
* GraphQL query variables
|
|
98
|
+
* Use these with parameterized queries
|
|
99
|
+
*/
|
|
100
|
+
variables: Record<string, any>;
|
|
101
|
+
/**
|
|
102
|
+
* Variables type definition for GraphQL query
|
|
103
|
+
* @example "$age: Int, $status: String"
|
|
104
|
+
*/
|
|
105
|
+
variablesTypeDef: string;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* SQL filter export format
|
|
109
|
+
*
|
|
110
|
+
* Generates parameterized SQL WHERE clauses
|
|
111
|
+
*
|
|
112
|
+
* @example Positional parameters
|
|
113
|
+
* ```typescript
|
|
114
|
+
* {
|
|
115
|
+
* whereClause: "age > ? AND status = ?",
|
|
116
|
+
* positionalParams: [18, "active"],
|
|
117
|
+
* namedParams: { age: 18, status: "active" },
|
|
118
|
+
* namedSql: "age > :age AND status = :status"
|
|
119
|
+
* }
|
|
120
|
+
* ```
|
|
121
|
+
*
|
|
122
|
+
* @example Dollar-style (PostgreSQL)
|
|
123
|
+
* ```typescript
|
|
124
|
+
* {
|
|
125
|
+
* whereClause: "age > $1 AND status = $2",
|
|
126
|
+
* positionalParams: [18, "active"],
|
|
127
|
+
* namedParams: { age: 18, status: "active" },
|
|
128
|
+
* namedSql: "age > :age AND status = :status"
|
|
129
|
+
* }
|
|
130
|
+
* ```
|
|
131
|
+
*/
|
|
132
|
+
export interface SQLFilterExport {
|
|
133
|
+
/**
|
|
134
|
+
* WHERE clause with positional placeholders
|
|
135
|
+
* Does NOT include the "WHERE" keyword
|
|
136
|
+
* @example "age > ? AND status = ?"
|
|
137
|
+
*/
|
|
138
|
+
whereClause: string;
|
|
139
|
+
/**
|
|
140
|
+
* Positional parameters array
|
|
141
|
+
* Use with ? placeholders
|
|
142
|
+
* @example [18, "active"]
|
|
143
|
+
*/
|
|
144
|
+
positionalParams: any[];
|
|
145
|
+
/**
|
|
146
|
+
* Named parameters object
|
|
147
|
+
* Use with :name placeholders
|
|
148
|
+
* @example { age: 18, status: "active" }
|
|
149
|
+
*/
|
|
150
|
+
namedParams: Record<string, any>;
|
|
151
|
+
/**
|
|
152
|
+
* WHERE clause with named placeholders
|
|
153
|
+
* Does NOT include the "WHERE" keyword
|
|
154
|
+
* @example "age > :age AND status = :status"
|
|
155
|
+
*/
|
|
156
|
+
namedSql: string;
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Combined filter export result
|
|
160
|
+
*
|
|
161
|
+
* Contains all export formats for maximum flexibility
|
|
162
|
+
*
|
|
163
|
+
* @example
|
|
164
|
+
* ```typescript
|
|
165
|
+
* const exports = filterManager.getFilterExport();
|
|
166
|
+
*
|
|
167
|
+
* // Use REST
|
|
168
|
+
* fetch(`/api/users?${exports.rest.queryString}`);
|
|
169
|
+
*
|
|
170
|
+
* // Use GraphQL
|
|
171
|
+
* graphqlClient.query({
|
|
172
|
+
* query: GET_USERS,
|
|
173
|
+
* variables: { where: exports.graphql.where }
|
|
174
|
+
* });
|
|
175
|
+
*
|
|
176
|
+
* // Use SQL
|
|
177
|
+
* db.query(
|
|
178
|
+
* `SELECT * FROM users WHERE ${exports.sql.whereClause}`,
|
|
179
|
+
* exports.sql.positionalParams
|
|
180
|
+
* );
|
|
181
|
+
* ```
|
|
182
|
+
*/
|
|
183
|
+
export interface FilterExportResult {
|
|
184
|
+
/**
|
|
185
|
+
* REST export (query strings, params, body)
|
|
186
|
+
*/
|
|
187
|
+
rest: RESTFilterExport;
|
|
188
|
+
/**
|
|
189
|
+
* GraphQL export (where clause, variables)
|
|
190
|
+
*/
|
|
191
|
+
graphql: GraphQLFilterExport;
|
|
192
|
+
/**
|
|
193
|
+
* SQL export (WHERE clause, params)
|
|
194
|
+
*/
|
|
195
|
+
sql: SQLFilterExport;
|
|
196
|
+
/**
|
|
197
|
+
* Original field-based filter state
|
|
198
|
+
*/
|
|
199
|
+
state: FieldFilterState;
|
|
200
|
+
}
|
|
201
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../../packages/core/src/features/filtering/adapters/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAEnE;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;OAGG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;;OAGG;IACH,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAE/B;;;OAGG;IACH,IAAI,EAAE,gBAAgB,CAAC;CACxB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAE3B;;;OAGG;IACH,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAE/B;;;OAGG;IACH,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,WAAW,eAAe;IAC9B;;;;OAIG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;;;OAIG;IACH,gBAAgB,EAAE,GAAG,EAAE,CAAC;IAExB;;;;OAIG;IACH,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAEjC;;;;OAIG;IACH,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,IAAI,EAAE,gBAAgB,CAAC;IAEvB;;OAEG;IACH,OAAO,EAAE,mBAAmB,CAAC;IAE7B;;OAEG;IACH,GAAG,EAAE,eAAe,CAAC;IAErB;;OAEG;IACH,KAAK,EAAE,gBAAgB,CAAC;CACzB"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import type { FilterModel, FilterCondition } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Column filter options
|
|
4
|
+
*/
|
|
5
|
+
export interface ColumnFilterOptions {
|
|
6
|
+
/**
|
|
7
|
+
* Column index
|
|
8
|
+
*/
|
|
9
|
+
column: number;
|
|
10
|
+
/**
|
|
11
|
+
* Initial filter conditions
|
|
12
|
+
*/
|
|
13
|
+
conditions?: FilterCondition[];
|
|
14
|
+
/**
|
|
15
|
+
* Logic operator for multiple conditions
|
|
16
|
+
* @default 'AND'
|
|
17
|
+
*/
|
|
18
|
+
logic?: 'AND' | 'OR';
|
|
19
|
+
/**
|
|
20
|
+
* Callback when filter changes
|
|
21
|
+
*/
|
|
22
|
+
onChange?: (model: FilterModel) => void;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* ColumnFilter - Manages filtering for a single column
|
|
26
|
+
*
|
|
27
|
+
* Handles filter state and predicate compilation for one column.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```typescript
|
|
31
|
+
* const filter = new ColumnFilter({
|
|
32
|
+
* column: 0,
|
|
33
|
+
* conditions: [
|
|
34
|
+
* { operator: 'greaterThan', value: 100 },
|
|
35
|
+
* ],
|
|
36
|
+
* });
|
|
37
|
+
*
|
|
38
|
+
* filter.test(150); // true
|
|
39
|
+
* filter.test(50); // false
|
|
40
|
+
*
|
|
41
|
+
* // Add condition
|
|
42
|
+
* filter.addCondition({ operator: 'lessThan', value: 1000 });
|
|
43
|
+
*
|
|
44
|
+
* // Clear filter
|
|
45
|
+
* filter.clear();
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
export declare class ColumnFilter {
|
|
49
|
+
private column;
|
|
50
|
+
private conditions;
|
|
51
|
+
private logic;
|
|
52
|
+
private onChange?;
|
|
53
|
+
private compiler;
|
|
54
|
+
private predicate;
|
|
55
|
+
constructor(options: ColumnFilterOptions);
|
|
56
|
+
/**
|
|
57
|
+
* Test a value against the filter
|
|
58
|
+
* @param value - Value to test
|
|
59
|
+
* @returns True if value passes filter
|
|
60
|
+
*/
|
|
61
|
+
test(value: any): boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Add a filter condition
|
|
64
|
+
* @param condition - Filter condition to add
|
|
65
|
+
*/
|
|
66
|
+
addCondition(condition: FilterCondition): void;
|
|
67
|
+
/**
|
|
68
|
+
* Remove a condition by index
|
|
69
|
+
* @param index - Index of condition to remove
|
|
70
|
+
*/
|
|
71
|
+
removeCondition(index: number): void;
|
|
72
|
+
/**
|
|
73
|
+
* Update a condition
|
|
74
|
+
* @param index - Index of condition to update
|
|
75
|
+
* @param condition - New condition
|
|
76
|
+
*/
|
|
77
|
+
updateCondition(index: number, condition: FilterCondition): void;
|
|
78
|
+
/**
|
|
79
|
+
* Set all conditions at once
|
|
80
|
+
* @param conditions - Array of conditions
|
|
81
|
+
*/
|
|
82
|
+
setConditions(conditions: FilterCondition[]): void;
|
|
83
|
+
/**
|
|
84
|
+
* Get current conditions
|
|
85
|
+
*/
|
|
86
|
+
getConditions(): FilterCondition[];
|
|
87
|
+
/**
|
|
88
|
+
* Set logic operator
|
|
89
|
+
* @param logic - 'AND' or 'OR'
|
|
90
|
+
*/
|
|
91
|
+
setLogic(logic: 'AND' | 'OR'): void;
|
|
92
|
+
/**
|
|
93
|
+
* Get logic operator
|
|
94
|
+
*/
|
|
95
|
+
getLogic(): 'AND' | 'OR';
|
|
96
|
+
/**
|
|
97
|
+
* Clear all conditions
|
|
98
|
+
*/
|
|
99
|
+
clear(): void;
|
|
100
|
+
/**
|
|
101
|
+
* Check if filter is active
|
|
102
|
+
*/
|
|
103
|
+
isActive(): boolean;
|
|
104
|
+
/**
|
|
105
|
+
* Get filter model
|
|
106
|
+
*/
|
|
107
|
+
getModel(): FilterModel;
|
|
108
|
+
/**
|
|
109
|
+
* Recompile predicate
|
|
110
|
+
*/
|
|
111
|
+
private recompile;
|
|
112
|
+
/**
|
|
113
|
+
* Notify change callback
|
|
114
|
+
*/
|
|
115
|
+
private notifyChange;
|
|
116
|
+
}
|
|
117
|
+
//# sourceMappingURL=column-filter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"column-filter.d.ts","sourceRoot":"","sources":["../../../../../../packages/core/src/features/filtering/column-filter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAGhE;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,UAAU,CAAC,EAAE,eAAe,EAAE,CAAC;IAE/B;;;OAGG;IACH,KAAK,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC;IAErB;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAAC;CACzC;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,UAAU,CAAyB;IAC3C,OAAO,CAAC,KAAK,CAAe;IAC5B,OAAO,CAAC,QAAQ,CAAC,CAA+B;IAChD,OAAO,CAAC,QAAQ,CAAiB;IACjC,OAAO,CAAC,SAAS,CAAgC;gBAErC,OAAO,EAAE,mBAAmB;IAYxC;;;;OAIG;IACH,IAAI,CAAC,KAAK,EAAE,GAAG,GAAG,OAAO;IAKzB;;;OAGG;IACH,YAAY,CAAC,SAAS,EAAE,eAAe,GAAG,IAAI;IAM9C;;;OAGG;IACH,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAQpC;;;;OAIG;IACH,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,eAAe,GAAG,IAAI;IAQhE;;;OAGG;IACH,aAAa,CAAC,UAAU,EAAE,eAAe,EAAE,GAAG,IAAI;IAMlD;;OAEG;IACH,aAAa,IAAI,eAAe,EAAE;IAIlC;;;OAGG;IACH,QAAQ,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,GAAG,IAAI;IAMnC;;OAEG;IACH,QAAQ,IAAI,KAAK,GAAG,IAAI;IAIxB;;OAEG;IACH,KAAK,IAAI,IAAI;IAMb;;OAEG;IACH,QAAQ,IAAI,OAAO;IAInB;;OAEG;IACH,QAAQ,IAAI,WAAW;IAQvB;;OAEG;IACH,OAAO,CAAC,SAAS;IAUjB;;OAEG;IACH,OAAO,CAAC,YAAY;CAKrB"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Filter Autocomplete using Trie
|
|
3
|
+
*
|
|
4
|
+
* Provides fast autocomplete suggestions for column filters.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* FilterAutocomplete - Column filter autocomplete using Trie
|
|
8
|
+
*
|
|
9
|
+
* Indexes unique column values for fast prefix-based autocomplete.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* const autocomplete = new FilterAutocomplete();
|
|
14
|
+
*
|
|
15
|
+
* // Index column 0 with product names
|
|
16
|
+
* autocomplete.indexColumn(0, [
|
|
17
|
+
* 'Apple iPhone 14',
|
|
18
|
+
* 'Apple MacBook Pro',
|
|
19
|
+
* 'Samsung Galaxy S23'
|
|
20
|
+
* ]);
|
|
21
|
+
*
|
|
22
|
+
* // Get suggestions as user types
|
|
23
|
+
* const suggestions = autocomplete.getSuggestions(0, 'app');
|
|
24
|
+
* // ['apple iphone 14', 'apple macbook pro']
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export declare class FilterAutocomplete {
|
|
28
|
+
private columnTries;
|
|
29
|
+
/**
|
|
30
|
+
* Index all unique values in a column for autocomplete
|
|
31
|
+
*
|
|
32
|
+
* @param col - Column index
|
|
33
|
+
* @param values - All values in the column
|
|
34
|
+
*/
|
|
35
|
+
indexColumn(col: number, values: any[]): void;
|
|
36
|
+
/**
|
|
37
|
+
* Get autocomplete suggestions as user types
|
|
38
|
+
*
|
|
39
|
+
* @param col - Column index
|
|
40
|
+
* @param prefix - User's input prefix
|
|
41
|
+
* @param maxResults - Maximum number of suggestions
|
|
42
|
+
* @returns Array of suggestions
|
|
43
|
+
*/
|
|
44
|
+
getSuggestions(col: number, prefix: string, maxResults?: number): string[];
|
|
45
|
+
/**
|
|
46
|
+
* Check if value exists in column (for validation)
|
|
47
|
+
*
|
|
48
|
+
* @param col - Column index
|
|
49
|
+
* @param value - Value to check
|
|
50
|
+
* @returns true if value exists
|
|
51
|
+
*/
|
|
52
|
+
hasValue(col: number, value: string): boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Get all unique values in a column
|
|
55
|
+
*
|
|
56
|
+
* @param col - Column index
|
|
57
|
+
* @returns Array of all unique values
|
|
58
|
+
*/
|
|
59
|
+
getAllValues(col: number): string[];
|
|
60
|
+
/**
|
|
61
|
+
* Clear column index
|
|
62
|
+
*
|
|
63
|
+
* @param col - Column index
|
|
64
|
+
*/
|
|
65
|
+
clearColumn(col: number): void;
|
|
66
|
+
/**
|
|
67
|
+
* Clear all column indexes
|
|
68
|
+
*/
|
|
69
|
+
clearAll(): void;
|
|
70
|
+
/**
|
|
71
|
+
* Get statistics about indexed columns
|
|
72
|
+
*/
|
|
73
|
+
getStats(): {
|
|
74
|
+
col: number;
|
|
75
|
+
uniqueValues: number;
|
|
76
|
+
}[];
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=filter-autocomplete.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filter-autocomplete.d.ts","sourceRoot":"","sources":["../../../../../../packages/core/src/features/filtering/filter-autocomplete.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,WAAW,CAAgC;IAEnD;;;;;OAKG;IACH,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,IAAI;IAe7C;;;;;;;OAOG;IACH,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,GAAE,MAAW,GAAG,MAAM,EAAE;IAO9E;;;;;;OAMG;IACH,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO;IAK7C;;;;;OAKG;IACH,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE;IAKnC;;;;OAIG;IACH,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAI9B;;OAEG;IACH,QAAQ,IAAI,IAAI;IAIhB;;OAEG;IACH,QAAQ,IAAI;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAA;KAAE,EAAE;CAYpD"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Filter Cache using LRU Cache
|
|
3
|
+
*
|
|
4
|
+
* Caches filter results to avoid expensive re-scanning.
|
|
5
|
+
* Automatically invalidates when filter state changes.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Cached filter result
|
|
9
|
+
*/
|
|
10
|
+
interface FilterCacheEntry {
|
|
11
|
+
/** Visible row indices */
|
|
12
|
+
visibleRows: number[];
|
|
13
|
+
/** Statistics */
|
|
14
|
+
stats: {
|
|
15
|
+
totalRows: number;
|
|
16
|
+
visibleRows: number;
|
|
17
|
+
hiddenRows: number;
|
|
18
|
+
};
|
|
19
|
+
/** Timestamp */
|
|
20
|
+
timestamp: number;
|
|
21
|
+
/** Hit count for analytics */
|
|
22
|
+
hitCount: number;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* FilterCache - LRU cache for filter results
|
|
26
|
+
*
|
|
27
|
+
* Caches the results of expensive filter operations. Automatically
|
|
28
|
+
* invalidates when filter state or data changes.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```typescript
|
|
32
|
+
* const cache = new FilterCache({ capacity: 100 });
|
|
33
|
+
*
|
|
34
|
+
* // Check cache before expensive scan
|
|
35
|
+
* const cached = cache.get(filterState, rowCount, dataVersion);
|
|
36
|
+
* if (cached) {
|
|
37
|
+
* return cached.visibleRows; // Cache hit!
|
|
38
|
+
* }
|
|
39
|
+
*
|
|
40
|
+
* // Cache miss - do expensive scan
|
|
41
|
+
* const visibleRows = expensiveScan();
|
|
42
|
+
* cache.set(filterState, rowCount, dataVersion, visibleRows);
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
export declare class FilterCache {
|
|
46
|
+
private cache;
|
|
47
|
+
private hitCount;
|
|
48
|
+
private missCount;
|
|
49
|
+
private enabled;
|
|
50
|
+
private capacity;
|
|
51
|
+
constructor(options?: {
|
|
52
|
+
capacity?: number;
|
|
53
|
+
enabled?: boolean;
|
|
54
|
+
});
|
|
55
|
+
/**
|
|
56
|
+
* Get cached filter result
|
|
57
|
+
*
|
|
58
|
+
* @param filterHash - Hash of filter state
|
|
59
|
+
* @param rowCount - Total row count
|
|
60
|
+
* @param dataVersion - Data version/timestamp
|
|
61
|
+
* @returns Cached entry or null
|
|
62
|
+
*/
|
|
63
|
+
get(filterHash: string, rowCount: number, dataVersion: number): FilterCacheEntry | null;
|
|
64
|
+
/**
|
|
65
|
+
* Set filter result in cache
|
|
66
|
+
*
|
|
67
|
+
* @param filterHash - Hash of filter state
|
|
68
|
+
* @param rowCount - Total row count
|
|
69
|
+
* @param dataVersion - Data version/timestamp
|
|
70
|
+
* @param visibleRows - Filtered row indices
|
|
71
|
+
*/
|
|
72
|
+
set(filterHash: string, rowCount: number, dataVersion: number, visibleRows: number[]): void;
|
|
73
|
+
/**
|
|
74
|
+
* Invalidate all cache entries
|
|
75
|
+
*/
|
|
76
|
+
invalidate(): void;
|
|
77
|
+
/**
|
|
78
|
+
* Invalidate cache entries for specific data version
|
|
79
|
+
*
|
|
80
|
+
* @param dataVersion - Data version to invalidate
|
|
81
|
+
*/
|
|
82
|
+
invalidateVersion(_dataVersion: number): void;
|
|
83
|
+
/**
|
|
84
|
+
* Enable or disable caching
|
|
85
|
+
*
|
|
86
|
+
* @param enabled - Whether to enable caching
|
|
87
|
+
*/
|
|
88
|
+
setEnabled(enabled: boolean): void;
|
|
89
|
+
/**
|
|
90
|
+
* Get cache statistics
|
|
91
|
+
*/
|
|
92
|
+
getStats(): {
|
|
93
|
+
hitCount: number;
|
|
94
|
+
missCount: number;
|
|
95
|
+
hitRate: number;
|
|
96
|
+
size: number;
|
|
97
|
+
capacity: number;
|
|
98
|
+
};
|
|
99
|
+
/**
|
|
100
|
+
* Reset statistics
|
|
101
|
+
*/
|
|
102
|
+
resetStats(): void;
|
|
103
|
+
/**
|
|
104
|
+
* Clear cache and reset statistics
|
|
105
|
+
*/
|
|
106
|
+
clear(): void;
|
|
107
|
+
/**
|
|
108
|
+
* Generate cache key from components
|
|
109
|
+
*/
|
|
110
|
+
private getCacheKey;
|
|
111
|
+
}
|
|
112
|
+
export {};
|
|
113
|
+
//# sourceMappingURL=filter-cache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filter-cache.d.ts","sourceRoot":"","sources":["../../../../../../packages/core/src/features/filtering/filter-cache.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAkBH;;GAEG;AACH,UAAU,gBAAgB;IACxB,0BAA0B;IAC1B,WAAW,EAAE,MAAM,EAAE,CAAC;IAEtB,iBAAiB;IACjB,KAAK,EAAE;QACL,SAAS,EAAE,MAAM,CAAC;QAClB,WAAW,EAAE,MAAM,CAAC;QACpB,UAAU,EAAE,MAAM,CAAC;KACpB,CAAC;IAEF,gBAAgB;IAChB,SAAS,EAAE,MAAM,CAAC;IAElB,8BAA8B;IAC9B,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,WAAW;IACtB,OAAO,CAAC,KAAK,CAAqC;IAClD,OAAO,CAAC,QAAQ,CAAK;IACrB,OAAO,CAAC,SAAS,CAAK;IACtB,OAAO,CAAC,OAAO,CAAQ;IACvB,OAAO,CAAC,QAAQ,CAAS;gBAEb,OAAO,GAAE;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,OAAO,CAAA;KAAO;IAQlE;;;;;;;OAOG;IACH,GAAG,CACD,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,GAClB,gBAAgB,GAAG,IAAI;IAgB1B;;;;;;;OAOG;IACH,GAAG,CACD,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,EAAE,GACpB,IAAI;IAmBP;;OAEG;IACH,UAAU,IAAI,IAAI;IAIlB;;;;OAIG;IACH,iBAAiB,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI;IAM7C;;;;OAIG;IACH,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;IAOlC;;OAEG;IACH,QAAQ,IAAI;QACV,QAAQ,EAAE,MAAM,CAAC;QACjB,SAAS,EAAE,MAAM,CAAC;QAClB,OAAO,EAAE,MAAM,CAAC;QAChB,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,EAAE,MAAM,CAAC;KAClB;IAWD;;OAEG;IACH,UAAU,IAAI,IAAI;IAKlB;;OAEG;IACH,KAAK,IAAI,IAAI;IAOb;;OAEG;IACH,OAAO,CAAC,WAAW;CAGpB"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { FilterCondition } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Compiled filter predicate
|
|
4
|
+
*/
|
|
5
|
+
export type FilterPredicate<T = any> = (value: T) => boolean;
|
|
6
|
+
/**
|
|
7
|
+
* FilterCompiler - Compiles filter conditions to optimized predicates
|
|
8
|
+
*
|
|
9
|
+
* Converts declarative filter conditions into efficient predicate functions.
|
|
10
|
+
* Supports caching for performance.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* const compiler = new FilterCompiler();
|
|
15
|
+
*
|
|
16
|
+
* // Compile single condition
|
|
17
|
+
* const predicate = compiler.compile({
|
|
18
|
+
* operator: 'contains',
|
|
19
|
+
* value: 'search',
|
|
20
|
+
* });
|
|
21
|
+
*
|
|
22
|
+
* predicate('test search string'); // true
|
|
23
|
+
* predicate('no match'); // false
|
|
24
|
+
*
|
|
25
|
+
* // Compile multiple conditions (AND)
|
|
26
|
+
* const multiPredicate = compiler.compileMultiple(
|
|
27
|
+
* [
|
|
28
|
+
* { operator: 'greaterThan', value: 10 },
|
|
29
|
+
* { operator: 'lessThan', value: 100 },
|
|
30
|
+
* ],
|
|
31
|
+
* 'AND'
|
|
32
|
+
* );
|
|
33
|
+
*
|
|
34
|
+
* multiPredicate(50); // true
|
|
35
|
+
* multiPredicate(5); // false
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
export declare class FilterCompiler {
|
|
39
|
+
private cache;
|
|
40
|
+
/**
|
|
41
|
+
* Compile a filter condition to a predicate function
|
|
42
|
+
* @param condition - Filter condition
|
|
43
|
+
* @returns Compiled predicate function
|
|
44
|
+
*/
|
|
45
|
+
compile<T = any>(condition: FilterCondition): FilterPredicate<T>;
|
|
46
|
+
/**
|
|
47
|
+
* Compile multiple conditions with logic operator
|
|
48
|
+
* @param conditions - Array of filter conditions
|
|
49
|
+
* @param logic - Logic operator ('AND' or 'OR')
|
|
50
|
+
* @returns Combined predicate function
|
|
51
|
+
*/
|
|
52
|
+
compileMultiple<T = any>(conditions: FilterCondition[], logic?: 'AND' | 'OR'): FilterPredicate<T>;
|
|
53
|
+
/**
|
|
54
|
+
* Clear cache
|
|
55
|
+
*/
|
|
56
|
+
clearCache(): void;
|
|
57
|
+
/**
|
|
58
|
+
* Compile a single predicate
|
|
59
|
+
*/
|
|
60
|
+
private compilePredicate;
|
|
61
|
+
/**
|
|
62
|
+
* Generate cache key for condition
|
|
63
|
+
*/
|
|
64
|
+
private getCacheKey;
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=filter-compiler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filter-compiler.d.ts","sourceRoot":"","sources":["../../../../../../packages/core/src/features/filtering/filter-compiler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD;;GAEG;AACH,MAAM,MAAM,eAAe,CAAC,CAAC,GAAG,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC,KAAK,OAAO,CAAC;AAE7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,KAAK,CAA2C;IAExD;;;;OAIG;IACH,OAAO,CAAC,CAAC,GAAG,GAAG,EAAE,SAAS,EAAE,eAAe,GAAG,eAAe,CAAC,CAAC,CAAC;IAiBhE;;;;;OAKG;IACH,eAAe,CAAC,CAAC,GAAG,GAAG,EACrB,UAAU,EAAE,eAAe,EAAE,EAC7B,KAAK,GAAE,KAAK,GAAG,IAAY,GAC1B,eAAe,CAAC,CAAC,CAAC;IAUrB;;OAEG;IACH,UAAU,IAAI,IAAI;IAIlB;;OAEG;IACH,OAAO,CAAC,gBAAgB;IA4HxB;;OAEG;IACH,OAAO,CAAC,WAAW;CAGpB"}
|