@shefing/quickfilter 1.0.12 → 1.0.15

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 ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md CHANGED
@@ -4,9 +4,6 @@
4
4
 
5
5
  Transform your PayloadCMS admin experience with instant, intuitive filters that appear right where you need them. Say goodbye to clunky filter forms and hello to seamless data exploration!
6
6
 
7
- ![QuickFilter Demo](./screenshots/quickfilter-demo.gif)
8
- _See QuickFilter in action - filtering happens instantly as you click!_
9
-
10
7
  ## ✨ Features
11
8
 
12
9
  | Feature | Description | Icon |
@@ -17,49 +14,50 @@ _See QuickFilter in action - filtering happens instantly as you click!_
17
14
  | **🌍 Internationalization** | Full i18n support with RTL language compatibility | ![i18n](https://img.shields.io/badge/Languages-6-purple) |
18
15
  | **💾 Persistent State** | Filters persist in localStorage and URL parameters | ![Persistent](https://img.shields.io/badge/State-Persistent-yellow) |
19
16
  | **📅 Smart Date Filtering** | Predefined ranges + custom date picker | ![Dates](https://img.shields.io/badge/Dates-Smart-red) |
20
- | **♿ Accessibility** | Full keyboard navigation and screen reader support | ![A11y](https://img.shields.io/badge/A11y-Compliant-green) |
21
17
 
22
18
  ### 🎥 See It In Action
23
19
 
24
- <details>
25
- <summary>📸 Click to view screenshots</summary>
26
-
27
- #### Collapsed State
28
-
29
- ![Collapsed Filter](./screenshots/collapsed-state.png)
30
- _Clean, minimal button that shows active filter count_
31
-
32
- #### Expanded State
33
-
34
- ![Expanded Filters](./screenshots/expanded-state.png)
35
- _All your filters laid out beautifully in customizable rows_
36
-
37
- #### Date Filter Options
20
+ [Video placeholder]
38
21
 
39
- ![Date Filter](./screenshots/date-filter.png)
40
- _Smart date presets + custom range picker_
22
+ ---
41
23
 
42
- #### Multi-Select in Action
24
+ ### 📋 Requirements
43
25
 
44
- ![Multi Select](./screenshots/multi-select.png)
45
- _Powerful multi-select with search for large datasets_
26
+ - ✅ PayloadCMS 3.0+
27
+ - React 18+
28
+ - ✅ TypeScript (recommended)
29
+ - ✅ Tailwind CSS (for styling)
46
30
 
47
- </details>
31
+ > 🚨 **Important**: Make sure your project has Tailwind CSS configured, as the plugin uses Tailwind classes for styling.
32
+ > Add the following path to your tailwind.config.js under the content array:
48
33
 
49
- ### 🎬 Video Demos
34
+ ```ts
35
+ // tailwind.config.js
50
36
 
51
- > 💡 **Pro Tip**: Record a quick screen capture showing the filters in action and save as `quickfilter-demo.mp4` in the screenshots folder!
37
+ module.exports = {
38
+ content: [
39
+ './src/**/*.{js,ts,jsx,tsx}', // your app paths
40
+ './node_modules/@shefing/quickfilter/**/*.{js,ts,jsx,tsx}', // ✅ required for QuickFilter
41
+ ],
42
+ // ...rest of your config
43
+ // Here we scope the Tailwind not to intefere with the Admin UI
44
+ plugins: [
45
+ scopedPreflightStyles({
46
+ isolationStrategy: isolateInsideOfContainer(['.useTw']),
47
+ }),
48
+ ],
49
+ };
50
+ ```
52
51
 
53
- ## 🛠️ Installation
52
+ ---
54
53
 
55
- ### Quick Start (2 minutes!)
54
+ ### Quick Start (2 minutes!)
56
55
 
57
56
  <details>
58
- <summary>📦 Step 1: Copy Plugin Files</summary>
57
+ <summary>📦 Step 1: Install the Package</summary>
59
58
 
60
59
  ```bash
61
- # Copy the entire quickfilter directory to your plugins folder
62
- cp -r quickfilter/ your-project/src/plugins/
60
+ pnpm add @shefing/quickfilter
63
61
  ```
64
62
 
65
63
  </details>
@@ -67,47 +65,45 @@ cp -r quickfilter/ your-project/src/plugins/
67
65
  <details>
68
66
  <summary>⚙️ Step 2: Configure PayloadCMS</summary>
69
67
 
70
- ```typescript
71
- import { CollectionQuickFilterPlugin } from './src/plugins/quickfilter/CollectionQuickFilterPlugin';
68
+ ```ts
69
+ // payload.config.ts
70
+
71
+ import { CollectionQuickFilterPlugin } from '@shefing/quickfilter';
72
72
 
73
73
  export default buildConfig({
74
- plugins: [
75
- CollectionQuickFilterPlugin({
76
- disabled: false, // 🎛️ Optional: disable the plugin
77
- }),
78
- ],
79
- // ... rest of your config
74
+ plugins: [CollectionQuickFilterPlugin({})],
80
75
  });
81
76
  ```
82
77
 
83
78
  </details>
84
79
 
85
80
  <details>
86
- <summary>🎯 Step 3: Add Filters to Collections</summary>
81
+ <summary>⚙️ Step 3: Configure Collections</summary>
87
82
 
88
83
  ```typescript
89
- // Add this to any collection where you want quick filters
90
- custom: {
91
- filterList: [
92
- ['status', 'role'], // 🔥 That's it! Filters are ready
93
- ];
94
- }
84
+ export const Users: CollectionConfig = {
85
+ slug: 'users',
86
+ custom: {
87
+ filterList: [
88
+ ['status', 'role'], // First row with two filters
89
+ ['createdAt'], // Second row with one filter
90
+ [
91
+ { name: 'department', width: '300px' }, // Custom width
92
+ 'isActive',
93
+ ],
94
+ ],
95
+ },
96
+ // ... rest of your collection config
97
+ };
95
98
  ```
96
99
 
97
100
  </details>
98
101
 
99
- ### 📋 Requirements
100
-
101
- - ✅ PayloadCMS 2.0+
102
- - ✅ React 18+
103
- - ✅ TypeScript (recommended)
104
- - ✅ Tailwind CSS (for styling)
102
+ ---
105
103
 
106
- > 🚨 **Important**: Make sure your project has Tailwind CSS configured, as the plugin uses Tailwind classes for styling.
107
104
 
108
- ## ⚙️ Configuration
109
105
 
110
- ### 🎯 Basic Setup
106
+ ## ⚙️ Collections Configuration
111
107
 
112
108
  Transform any collection into a filtering powerhouse! Just add a `filterList` to your collection's `custom` property:
113
109
 
@@ -294,34 +290,6 @@ The magic happens right above your collection table! Here's what your users will
294
290
 
295
291
  ### 🎯 Filter Types in Detail
296
292
 
297
- <details>
298
- <summary>📅 <strong>Date Filter</strong> - Time travel made easy!</summary>
299
-
300
- **🚀 Predefined Magic:**
301
-
302
- ```typescript
303
- 🕐 Past Options:
304
- ├── Yesterday
305
- ├── Last Week
306
- ├── Last Month
307
- └── All Past
308
-
309
- 🔮 Future Options:
310
- ├── Today
311
- ├── Next Week
312
- ├── Next Month
313
- └── All Future
314
- ```
315
-
316
- **🎯 Custom Range Power:**
317
-
318
- - 📅 **From/To picker**: Select any date range
319
- - 🌍 **Localized**: Dates display in user's format
320
- - ⚡ **Smart defaults**: Common ranges are just one click away
321
-
322
- ![Date Filter Demo](./screenshots/date-filter-demo.gif)
323
-
324
- </details>
325
293
 
326
294
  <details>
327
295
  <summary>📋 <strong>Select Filter</strong> - Intelligence that adapts</summary>
@@ -343,14 +311,6 @@ The magic happens right above your collection table! Here's what your users will
343
311
  └─────────────────────────┘
344
312
  ```
345
313
 
346
- **💪 Multi-select Support:**
347
-
348
- ```typescript
349
- {
350
- selectedValues: ['published', 'draft'],
351
- type: 'some' // Shows items matching ANY selected value
352
- }
353
- ```
354
314
 
355
315
  ![Select Filter Types](./screenshots/select-intelligence.png)
356
316
 
@@ -378,20 +338,6 @@ Perfect for boolean fields like:
378
338
 
379
339
  ## 🆚 Why Choose QuickFilter Over Regular PayloadCMS Filters?
380
340
 
381
- <details>
382
- <summary>🎯 <strong>Side-by-Side Comparison</strong></summary>
383
-
384
- | Feature | 🔥 QuickFilter | 😐 Regular Filters |
385
- | ------------------- | --------------------------------- | ------------------------------ |
386
- | **Speed** | ⚡ Instant filtering | 🐌 Page reload required |
387
- | **UX** | 🎨 Beautiful, intuitive UI | 📝 Complex form interface |
388
- | **Persistence** | 💾 Remembers your filters | 🔄 Resets on refresh |
389
- | **Visual Feedback** | 👀 Clear active filter indicators | ❓ Hard to see what's filtered |
390
- | **Mobile** | 📱 Fully responsive | 📱 Limited mobile support |
391
- | **Accessibility** | ♿ Full keyboard + screen reader | ⚠️ Basic accessibility |
392
-
393
- </details>
394
-
395
341
  ### 🚀 **1. User Experience Revolution**
396
342
 
397
343
  <details>
@@ -404,42 +350,11 @@ Perfect for boolean fields like:
404
350
  | **💾 Memory** | Filters persist across sessions | Start over every time |
405
351
  | **🎯 Simplicity** | Click and filter | Navigate to filter page, fill form, submit |
406
352
 
407
- ![UX Comparison](./screenshots/ux-comparison.png)
408
353
 
409
354
  </details>
410
355
 
411
356
  ### ⚡ **2. Performance That Scales**
412
357
 
413
- <details>
414
- <summary>Technical performance benefits</summary>
415
-
416
- ```typescript
417
- // 🔥 QuickFilter generates optimized queries
418
- {
419
- and: [
420
- { status: { in: ['published', 'draft'] } },
421
- { createdAt: { greater_than_equal: '2024-01-01' } },
422
- ];
423
- }
424
-
425
- // 😐 vs manual filter complexity
426
- // Users struggle with query syntax
427
- // Multiple server round-trips
428
- // No client-side optimization
429
- ```
430
-
431
- **📊 Performance Metrics:**
432
-
433
- - 🚀 **90% faster** filter application
434
- - 💾 **50% fewer** server requests
435
- - 🧠 **Zero learning curve** for end users
436
-
437
- </details>
438
-
439
- ### ♿ **3. Accessibility First**
440
-
441
- <details>
442
- <summary>Built for everyone</summary>
443
358
 
444
359
  **🎯 What we support:**
445
360
 
@@ -449,77 +364,9 @@ Perfect for boolean fields like:
449
364
  - 🎨 **High contrast**: Works with accessibility themes
450
365
  - 📱 **Touch friendly**: Perfect for mobile and tablet users
451
366
 
452
- **🏆 Compliance:**
453
-
454
- - ✅ WCAG 2.1 AA compliant
455
- - ✅ Section 508 compliant
456
- - ✅ Keyboard-only navigation
457
- - ✅ Screen reader tested
458
-
459
- </details>
460
-
461
- ### 👨‍💻 **4. Developer Experience**
462
-
463
- <details>
464
- <summary>Built by developers, for developers</summary>
465
-
466
- **🔥 What you'll love:**
467
-
468
- ```typescript
469
- // ✨ Simple configuration
470
- custom: {
471
- filterList: [
472
- ['status', 'role'], // That's it!
473
- ];
474
- }
475
-
476
- // 🚀 vs complex filter setup
477
- // No custom components needed
478
- // No backend modifications
479
- // Full TypeScript support
480
- // Zero learning curve
481
- ```
482
-
483
- **🛠️ Developer Benefits:**
484
-
485
- - 📝 **5-minute setup**: Copy, paste, configure
486
- - 🔧 **Zero maintenance**: Works with existing fields
487
- - 🎯 **Type safe**: Full TypeScript integration
488
- - 🔌 **Extensible**: Easy to add custom filter types
489
-
490
367
  </details>
491
368
 
492
- ### 🌟 **5. Advanced Features**
493
-
494
- <details>
495
- <summary>Features that make the difference</summary>
496
-
497
- **🌍 Multi-language Support:**
498
-
499
- ```typescript
500
- // Built-in translations for 6 languages
501
- 'en' | 'ar' | 'fr' | 'es' | 'zh' | 'he';
502
- // RTL support for Arabic and Hebrew
503
- ```
504
-
505
- **🎨 Custom Layouts:**
506
-
507
- ```typescript
508
- // Flexible row-based arrangement
509
- filterList: [
510
- ['status', 'role', 'department'], // 3 in a row
511
- [{ name: 'tags', width: '400px' }], // Custom width
512
- ['isActive', 'isVerified'], // Side by side
513
- ];
514
- ```
515
-
516
- **🔗 URL Integration:**
517
369
 
518
- - 📋 **Bookmarkable**: Share filtered views via URL
519
- - 🔄 **Browser history**: Back/forward button support
520
- - 🔗 **Deep linking**: Direct links to filtered data
521
-
522
- </details>
523
370
 
524
371
  ## 🌍 Internationalization
525
372
 
@@ -540,6 +387,7 @@ The plugin speaks your users' language! Full translations included for:
540
387
 
541
388
  <details>
542
389
  <summary>🌐 <strong>Extend language support</strong></summary>
390
+ PRs are welcomed
543
391
 
544
392
  ```typescript
545
393
  // In labels.ts, add your language
@@ -564,30 +412,8 @@ export const PLUGIN_LABELS = {
564
412
  };
565
413
  ```
566
414
 
567
- **🎯 Pro Tips:**
568
-
569
- - 🔄 **Auto-detection**: Plugin automatically uses user's browser language
570
- - 🛡️ **Fallback**: Falls back to English if translation missing
571
- - 🎨 **RTL Support**: Add `rtlLanguages` array for right-to-left languages
572
-
573
415
  </details>
574
416
 
575
- ### 🎨 RTL Language Demo
576
-
577
- <details>
578
- <summary>📸 See RTL support in action</summary>
579
-
580
- ![RTL Support](./screenshots/rtl-demo.png)
581
- _Arabic and Hebrew interfaces with proper right-to-left layout_
582
-
583
- **✨ RTL Features:**
584
-
585
- - 🔄 **Auto-detection**: Automatically switches to RTL layout
586
- - 🎯 **Proper alignment**: Text, buttons, and dropdowns align correctly
587
- - 📱 **Mobile optimized**: RTL works perfectly on mobile devices
588
- - 🎨 **Icon positioning**: Icons flip to match reading direction
589
-
590
- </details>
591
417
 
592
418
  ## 🔧 Advanced Configuration
593
419
 
@@ -649,215 +475,7 @@ CollectionQuickFilterPlugin({
649
475
 
650
476
  </details>
651
477
 
652
- ### 🎨 Custom Styling
653
-
654
- <details>
655
- <summary>🎨 <strong>Make it match your brand</strong></summary>
656
-
657
- ```css
658
- /* Override default styles in your CSS */
659
- .filter-container {
660
- --filter-bg: #f8f9fa;
661
- --filter-border: #e9ecef;
662
- --filter-text: #495057;
663
- --filter-active: #007bff;
664
- }
665
-
666
- /* Custom button styles */
667
- .filter-container .useTw button {
668
- border-radius: 8px;
669
- font-weight: 500;
670
- }
671
-
672
- /* Active filter highlighting */
673
- .filter-container .fill-current {
674
- color: var(--filter-active);
675
- }
676
- ```
677
-
678
- **🎨 Customization Options:**
679
-
680
- - 🎨 **Colors**: Match your admin theme
681
- - 📐 **Spacing**: Adjust padding and margins
682
- - 🔤 **Typography**: Custom fonts and sizes
683
- - 🎯 **Animations**: Add hover effects
684
-
685
- </details>
686
-
687
- ## 🔧 Troubleshooting
688
-
689
- ### 🚨 Common Issues & Quick Fixes
690
-
691
- <details>
692
- <summary>🔍 <strong>Filters not appearing</strong></summary>
693
-
694
- **❌ Problem:** QuickFilter button doesn't show up
695
-
696
- **✅ Solutions:**
697
-
698
- ```typescript
699
- // ✅ Make sure filterList is in custom property
700
- export const MyCollection = {
701
- slug: 'my-collection',
702
- custom: {
703
- filterList: [['status']], // ← Must be here!
704
- },
705
- };
706
-
707
- // ❌ Wrong - this won't work
708
- export const MyCollection = {
709
- slug: 'my-collection',
710
- filterList: [['status']], // ← Wrong location
711
- };
712
- ```
713
-
714
- **🔍 Debug checklist:**
715
-
716
- - ✅ Plugin is imported and added to config
717
- - ✅ `filterList` is in `custom` property
718
- - ✅ Field names match your collection fields
719
- - ✅ Collection has the fields you're trying to filter
720
-
721
- </details>
722
-
723
- <details>
724
- <summary>📅 <strong>Date filters not working</strong></summary>
725
-
726
- **❌ Problem:** Date filter shows but doesn't filter results
727
-
728
- **✅ Solutions:**
729
-
730
- ```typescript
731
- // ✅ Correct date field configuration
732
- {
733
- name: 'createdAt',
734
- type: 'date' // ← Must be exactly 'date'
735
- }
736
-
737
- // ❌ These won't work with date filters
738
- {
739
- name: 'createdAt',
740
- type: 'text' // ← Wrong type
741
- }
742
- ```
743
-
744
- **🎯 Pro tip:** Use browser dev tools to check the generated query in Network tab
745
-
746
- </details>
747
-
748
- <details>
749
- <summary>📋 <strong>Select options missing</strong></summary>
750
478
 
751
- **❌ Problem:** Select filter is empty or shows no options
752
-
753
- **✅ Solutions:**
754
-
755
- ```typescript
756
- // ✅ Correct select field with options
757
- {
758
- name: 'status',
759
- type: 'select',
760
- options: [ // ← Must have options array
761
- { label: 'Active', value: 'active' },
762
- { label: 'Inactive', value: 'inactive' }
763
- ]
764
- }
765
-
766
- // ❌ Missing options won't work
767
- {
768
- name: 'status',
769
- type: 'select'
770
- // ← No options array
771
- }
772
- ```
773
-
774
- </details>
775
-
776
- <details>
777
- <summary>🎨 <strong>Styling issues</strong></summary>
778
-
779
- **❌ Problem:** Filters look broken or unstyled
780
-
781
- **✅ Solutions:**
782
-
783
- 1. **Ensure Tailwind CSS is configured:**
784
-
785
- ```javascript
786
- // tailwind.config.js
787
- module.exports = {
788
- content: [
789
- './src/**/*.{js,ts,jsx,tsx}',
790
- './src/plugins/**/*.{js,ts,jsx,tsx}', // ← Include plugins
791
- ],
792
- };
793
- ```
794
-
795
- 2. **Check CSS imports:**
796
-
797
- ```typescript
798
- // Make sure Tailwind is imported in your app
799
- import 'tailwindcss/tailwind.css';
800
- ```
801
-
802
- 3. **Custom styling conflicts:**
803
-
804
- ```css
805
- /* If you have custom styles, make sure they don't override */
806
- .filter-container .useTw {
807
- /* Plugin styles have priority here */
808
- }
809
- ```
810
-
811
- </details>
812
-
813
- ### 🐛 Debug Mode
814
-
815
- <details>
816
- <summary>🔍 <strong>Enable detailed logging</strong></summary>
817
-
818
- ```typescript
819
- // In your browser console
820
- localStorage.setItem('quickfilter-debug', 'true');
821
-
822
- // Then refresh the page and check console for:
823
- // ✅ Filter configuration loading
824
- // ✅ Query generation details
825
- // ✅ State management logs
826
- // ✅ Error details
827
-
828
- // To disable debug mode:
829
- localStorage.removeItem('quickfilter-debug');
830
- ```
831
-
832
- **🎯 What to look for in console:**
833
-
834
- - `[QuickFilter] Loading filters for collection: users`
835
- - `[QuickFilter] Generated query:` + query object
836
- - `[QuickFilter] Filter state updated:` + state object
837
-
838
- </details>
839
-
840
- ### 🆘 Still Having Issues?
841
-
842
- <details>
843
- <summary>📞 <strong>Get help</strong></summary>
844
-
845
- **Before asking for help, please:**
846
-
847
- 1. ✅ **Check the console** for error messages
848
- 2. ✅ **Enable debug mode** and share the logs
849
- 3. ✅ **Verify your configuration** matches the examples
850
- 4. ✅ **Test with a simple setup** first
851
-
852
- **When reporting issues, include:**
853
-
854
- - 🔧 Your PayloadCMS version
855
- - 📋 Your collection configuration
856
- - 🎯 Your filterList configuration
857
- - 🐛 Console error messages
858
- - 📸 Screenshots of the issue
859
-
860
- </details>
861
479
 
862
480
  ## Contributing
863
481
 
@@ -870,4 +488,4 @@ The plugin is designed to be extensible. To add new filter types:
870
488
 
871
489
  ## License
872
490
 
873
- This plugin is part of your PayloadCMS project and follows the same licensing terms.
491
+ This plugin is licensed under the Apache License, Version 2.0.
@@ -1 +1 @@
1
- {"version":3,"file":"QuickFilter.d.ts","sourceRoot":"","sources":["../src/QuickFilter.tsx"],"names":[],"mappings":"AAmQA,QAAA,MAAM,WAAW,0BAGd;IACD,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,CAAC,MAAM,GAAG;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,EAAE,EAAE,CAAC;CAC5D,gCA0SA,CAAC;AAEF,eAAe,WAAW,CAAC"}
1
+ {"version":3,"file":"QuickFilter.d.ts","sourceRoot":"","sources":["../src/QuickFilter.tsx"],"names":[],"mappings":"AA2QA,QAAA,MAAM,WAAW,0BAGd;IACD,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,CAAC,MAAM,GAAG;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,EAAE,EAAE,CAAC;CAC5D,gCA0SA,CAAC;AAEF,eAAe,WAAW,CAAC"}
@@ -11,6 +11,13 @@ import { getDateRangeForOption } from './filters/utils/date-helpers';
11
11
  import { isEqual } from 'lodash';
12
12
  import { futureOptionKeys, getDateFilterOptions, pastOptionKeys } from './filters/constants/date-filter-options';
13
13
  import { Button } from './ui/button';
14
+ // Helper function to get localized label
15
+ const getLocalizedLabel = (label, locale)=>{
16
+ if (typeof label === 'object' && label !== null) {
17
+ return label[locale] || label['en'] || Object.values(label)[0] || '';
18
+ }
19
+ return label || '';
20
+ };
14
21
  // Recursive function to find fields by name
15
22
  function findFieldsByName(fields, fieldNames) {
16
23
  const results = [];
@@ -425,7 +432,7 @@ const QuickFilter = ({ slug, filterList })=>{
425
432
  } else if (selectValue.selectedValues.length === 1) {
426
433
  // Show the actual option name when only one is selected
427
434
  const selectedOption = field.options?.find((opt)=>opt.value === selectValue.selectedValues[0]);
428
- const optionLabel = selectedOption ? selectedOption.label : selectValue.selectedValues[0];
435
+ const optionLabel = selectedOption ? getLocalizedLabel(selectedOption.label, locale) : selectValue.selectedValues[0];
429
436
  activeFilters.push(`${field.label} (${optionLabel})`);
430
437
  } else {
431
438
  // Show count for multiple selections
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/QuickFilter.tsx"],"sourcesContent":["'use client';\n\nimport { useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport { useConfig, useListQuery, useTranslation } from '@payloadcms/ui';\nimport type { ClientField, FieldAffectingData, OptionObject, SelectField } from 'payload';\nimport { getTranslation } from '@payloadcms/translations';\nimport FilterField from './FilterField';\nimport { getLabel, SupportedLocale } from './labels';\nimport type {\n CheckboxFilterState,\n DateFilterValue,\n FilterDetaild,\n FilterRow,\n SelectFilterValue,\n} from './filters/types/filters-type';\nimport { groupFiltersByRow, parseColumns } from './filters/utils/layout-helpers';\nimport { ChevronDown, ChevronUp, Filter, X } from 'lucide-react';\n\nimport { getDateRangeForOption } from './filters/utils/date-helpers';\nimport { isEqual } from 'lodash';\nimport {\n futureOptionKeys,\n getDateFilterOptions,\n pastOptionKeys,\n} from './filters/constants/date-filter-options';\nimport { Button } from './ui/button';\n\n// Recursive function to find fields by name\nfunction findFieldsByName(fields: ClientField[], fieldNames: string[]): ClientField[] {\n const results: ClientField[] = [];\n function recursiveSearch(currentFields: ClientField[]) {\n const filteredFields = currentFields.filter(\n (field) => 'name' in field && fieldNames.includes(field.name as string),\n );\n results.push(...filteredFields);\n currentFields.forEach((item) => {\n if (\n (item.type === 'array' || item.type === 'row' || item.type === 'collapsible') &&\n 'fields' in item &&\n Array.isArray(item.fields)\n ) {\n recursiveSearch(item.fields);\n } else if (item.type === 'tabs' && Array.isArray(item.tabs)) {\n item.tabs.forEach((tab) => {\n if ('fields' in tab && Array.isArray(tab.fields)) {\n recursiveSearch(tab.fields);\n }\n });\n } else if (item.type === 'blocks' && Array.isArray(item.blocks)) {\n item.blocks.forEach((block) => {\n if ('fields' in block && Array.isArray(block.fields)) {\n recursiveSearch(block.fields);\n }\n });\n }\n });\n }\n recursiveSearch(fields);\n return results;\n}\n\n// Builds an array of condition objects from the quick filter values\nconst buildQuickFilterConditions = (\n values: Record<string, any>,\n fieldDefs: FilterDetaild[],\n locale: SupportedLocale,\n): Record<string, any>[] => {\n const conditions: Record<string, any>[] = [];\n\n Object.entries(values).forEach(([fieldName, value]) => {\n if (!value) return;\n const fieldDef = fieldDefs.find((f) => f.name === fieldName);\n if (!fieldDef) return;\n\n let condition: Record<string, any> | null = null;\n\n switch (fieldDef.type) {\n case 'date': {\n const dateValue = value as DateFilterValue;\n let from: Date | undefined;\n let to: Date | undefined;\n\n if (dateValue.predefinedValue) {\n const range = getDateRangeForOption(dateValue.predefinedValue, locale);\n from = range.from;\n to = range.to;\n } else if (dateValue.customRange) {\n if (dateValue.customRange.from) from = new Date(dateValue.customRange.from);\n if (dateValue.customRange.to) to = new Date(dateValue.customRange.to);\n }\n\n if (from || to) {\n const dateQuery: any = {};\n if (from) dateQuery.greater_than_equal = from;\n if (to) dateQuery.less_than_equal = to;\n if (Object.keys(dateQuery).length > 0) {\n condition = { [fieldName]: dateQuery };\n }\n }\n break;\n }\n case 'select': {\n const selectValue = value as SelectFilterValue;\n if (selectValue.selectedValues && selectValue.selectedValues.length > 0) {\n if (selectValue.selectedValues.length === 1) {\n condition = { [fieldName]: { equals: selectValue.selectedValues[0] } };\n } else {\n condition = { [fieldName]: { in: selectValue.selectedValues } };\n }\n }\n break;\n }\n case 'checkbox': {\n const checkboxState = value as CheckboxFilterState;\n if (checkboxState === 'checked') {\n condition = { [fieldName]: { equals: 'true' } };\n } else if (checkboxState === 'unchecked') {\n condition = { [fieldName]: { equals: 'false' } };\n }\n break;\n }\n }\n if (condition) {\n conditions.push(condition);\n }\n });\n return conditions;\n};\n\n// Helper function to remove quick filter conditions from a 'where' clause\nconst cleanWhereClause = (clause: any, fieldsToClean: Set<string>): any => {\n if (!clause || typeof clause !== 'object' || Array.isArray(clause)) {\n return clause;\n }\n\n const newClause: Record<string, any> = {};\n\n for (const key in clause) {\n if (key === 'and' || key === 'or') {\n const cleanedSubClauses = clause[key]\n .map((subClause: any) => cleanWhereClause(subClause, fieldsToClean))\n .filter(Boolean);\n\n if (cleanedSubClauses.length > 0) {\n newClause[key] = cleanedSubClauses;\n }\n } else if (!fieldsToClean.has(key)) {\n newClause[key] = clause[key];\n }\n }\n\n if (Object.keys(newClause).length === 0) {\n return null;\n }\n\n if (newClause.and?.length === 1 && Object.keys(newClause).length === 1) {\n return newClause.and[0];\n }\n if (newClause.or?.length === 1 && Object.keys(newClause).length === 1) {\n return newClause.or[0];\n }\n\n return newClause;\n};\n\n// Translates URL query conditions to the quick filter's internal state\nconst parseWhereClauseToFilterValues = (\n where: any,\n fields: FilterDetaild[],\n locale: SupportedLocale,\n): Record<string, any> => {\n const values: Record<string, any> = {};\n const fieldNames = new Set(fields.map((f) => f.name));\n\n const recursiveParse = (clause: any) => {\n if (!clause || typeof clause !== 'object') return;\n\n if (clause.and) {\n clause.and.forEach(recursiveParse);\n return;\n }\n if (clause.or) {\n clause.or.forEach(recursiveParse);\n return;\n }\n\n for (const fieldName in clause) {\n if (fieldNames.has(fieldName)) {\n const fieldDef = fields.find((f) => f.name === fieldName);\n const condition = clause[fieldName];\n\n if (fieldDef && condition && typeof condition === 'object') {\n if ('equals' in condition) {\n if (fieldDef.type === 'checkbox') {\n values[fieldName] = condition.equals == 'true' ? 'checked' : 'unchecked';\n } else if (fieldDef.type === 'select') {\n values[fieldName] = { selectedValues: [condition.equals] };\n }\n } else if ('in' in condition && Array.isArray(condition.in)) {\n if (fieldDef.type === 'select') {\n values[fieldName] = { selectedValues: condition.in };\n }\n } else if ('greater_than_equal' in condition || 'less_than_equal' in condition) {\n if (fieldDef.type === 'date') {\n const fromDate = condition.greater_than_equal\n ? new Date(condition.greater_than_equal)\n : null;\n const toDate = condition.less_than_equal ? new Date(condition.less_than_equal) : null;\n const allDateOptions = [...pastOptionKeys, ...futureOptionKeys];\n let matchedOption = null;\n\n for (const option of allDateOptions) {\n const range = getDateRangeForOption(option, locale);\n let isFromMatch;\n if (fromDate) {\n isFromMatch = range.from?.toDateString() === fromDate.toDateString();\n } else if (fromDate == null && range.to == undefined) {\n // all future: fromDate == null & range.to == undefined\n isFromMatch = true;\n }\n let isToMatch;\n if (toDate) {\n isToMatch = range.to?.toDateString() === toDate.toDateString();\n } else if (toDate == null && range.to == undefined) {\n // all future: fromDate == null & range.to == undefined\n isToMatch = true;\n }\n\n if (isFromMatch && isToMatch) {\n matchedOption = option;\n break;\n }\n }\n\n if (matchedOption) {\n values[fieldName] = {\n type: 'predefined',\n predefinedValue: matchedOption,\n };\n } else {\n values[fieldName] = {\n type: 'custom',\n customRange: {\n from: fromDate,\n to: toDate,\n },\n };\n }\n }\n }\n }\n }\n }\n };\n\n recursiveParse(where);\n return values;\n};\n\nconst QuickFilter = ({\n slug,\n filterList,\n}: {\n slug: string;\n filterList: (string | { name: string; width: string })[][];\n}) => {\n const localStorageKey = useMemo(() => `direct-filter-${slug}`, [slug]);\n\n const [fields, setFields] = useState<FilterDetaild[]>([]);\n const [filterRows, setFilterRows] = useState<FilterRow[]>([]);\n const [showFilters, setShowFilters] = useState(false);\n const { refineListData, query } = useListQuery();\n const { getEntityConfig } = useConfig();\n const { i18n } = useTranslation();\n const locale = i18n.language as SupportedLocale;\n const isSyncingFromQuery = useRef(false);\n\n const [filterValues, setFilterValues] = useState<Record<string, any>>(() => {\n if (typeof window == 'undefined') return {};\n try {\n const item = window.localStorage.getItem(localStorageKey);\n if (!item) return {};\n const dateTimeReviver = (key: string, value: any) => {\n const isoDateRegex = /^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$/;\n if (typeof value === 'string' && isoDateRegex.test(value)) {\n return new Date(value);\n }\n return value;\n };\n return JSON.parse(item, dateTimeReviver);\n } catch (error) {\n console.error('Error reading and parsing filters from localStorage.', error);\n return {};\n }\n });\n\n // Build the list of filter fields from config\n useEffect(() => {\n const collection = getEntityConfig({ collectionSlug: slug });\n const flattenedFieldConfigs = filterList.flatMap((row, rowIndex) =>\n row.map((field, fieldIndex) => ({\n field,\n rowIndex,\n fieldIndex,\n })),\n );\n const fieldNames = flattenedFieldConfigs.map(({ field }) =>\n typeof field === 'string' ? field : field.name,\n );\n const matchedFields = findFieldsByName(collection?.fields || [], fieldNames);\n const simplifiedFields: FilterDetaild[] = matchedFields.map((field) => {\n const label = (field as FieldAffectingData).label;\n const translatedLabel = getTranslation(label as string, i18n);\n const fieldName = (field as FieldAffectingData).name as string;\n const fieldConfig = flattenedFieldConfigs.find(({ field: f }) =>\n typeof f === 'string' ? f === fieldName : f.name === fieldName,\n );\n return {\n name: fieldName,\n label: translatedLabel as string,\n type: field.type,\n options: (field as SelectField).options as OptionObject[],\n row: fieldConfig ? fieldConfig.rowIndex : 0,\n width:\n typeof fieldConfig?.field === 'object' && 'width' in fieldConfig.field\n ? fieldConfig.field.width\n : undefined,\n };\n });\n const sortedFields = flattenedFieldConfigs\n .map(({ field }) => {\n const fieldName = typeof field === 'string' ? field : field.name;\n return simplifiedFields.find((f) => f.name === fieldName);\n })\n .filter((f): f is FilterDetaild => !!f);\n setFields(sortedFields);\n setFilterRows(groupFiltersByRow(sortedFields));\n }, [slug, filterList, getEntityConfig, i18n]);\n // Sync from URL (query.where) into internal state\n useEffect(() => {\n if (fields.length === 0) return;\n\n const valuesFromQuery: Record<string, any> = parseWhereClauseToFilterValues(\n query.where,\n fields,\n locale,\n );\n\n if (!isEqual(valuesFromQuery, filterValues)) {\n // Lock to prevent feedback loop when internal state changes\n isSyncingFromQuery.current = true;\n setFilterValues(valuesFromQuery);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [query.where, fields]);\n\n // Sync internal state (filterValues) back into the URL\n useEffect(() => {\n // If the change originated from the first effect, skip to avoid infinite loop\n if (isSyncingFromQuery.current) {\n isSyncingFromQuery.current = false;\n return;\n }\n\n if (fields.length === 0) return;\n\n const quickFilterConditions = buildQuickFilterConditions(filterValues, fields, locale);\n const quickFilterFieldNames = new Set(fields.map((f) => f.name));\n const otherFilters = cleanWhereClause(query.where, quickFilterFieldNames);\n\n const allConditions = [...quickFilterConditions];\n if (otherFilters) {\n if (otherFilters.and && Array.isArray(otherFilters.and)) {\n allConditions.push(...otherFilters.and);\n } else if (Object.keys(otherFilters).length > 0) {\n allConditions.push(otherFilters);\n }\n }\n\n let newWhere: Record<string, any> = {};\n if (allConditions.length > 1) {\n newWhere = { and: allConditions };\n } else if (allConditions.length === 1) {\n newWhere = allConditions[0];\n }\n\n // Only update if the query has actually changed to avoid unnecessary updates\n if (!isEqual(newWhere, query.where)) {\n refineListData({\n columns: parseColumns(query.columns),\n where: newWhere,\n page: '1',\n });\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [filterValues, fields, i18n.language, refineListData]);\n // Effect for persisting to localStorage\n useEffect(() => {\n try {\n if (Object.keys(filterValues).length > 0) {\n localStorage.setItem(localStorageKey, JSON.stringify(filterValues));\n } else {\n localStorage.removeItem(localStorageKey);\n }\n } catch (error) {\n console.error('Failed to save filters to localStorage', error);\n }\n }, [filterValues, localStorageKey]);\n\n // Updates only the internal state\n const handleFilterChange = useCallback((fieldName: string, value: any) => {\n setFilterValues((prev) => {\n const newValues = { ...prev };\n if (\n value === undefined ||\n value === null ||\n value === 'indeterminate' ||\n (value && value.type === 'none')\n ) {\n delete newValues[fieldName];\n } else {\n newValues[fieldName] = value;\n }\n return newValues;\n });\n }, []);\n\n // This function remains largely the same.\n const getActiveFiltersDetails = () => {\n const activeFilters: string[] = [];\n const locale = i18n.language as SupportedLocale;\n Object.entries(filterValues).forEach(([fieldName, value]) => {\n const field = fields.find((f) => f.name === fieldName);\n if (!field) return;\n\n switch (field.type) {\n case 'date':\n if (value !== undefined) {\n const dateValue = value as DateFilterValue;\n let dateDescription = '';\n\n if (dateValue.type === 'predefined' && dateValue.predefinedValue) {\n const { pastOptions, futureOptions } = getDateFilterOptions(locale);\n const allOptions = [...pastOptions, ...futureOptions];\n const option = allOptions.find((opt) => opt.value === dateValue.predefinedValue);\n dateDescription = option ? option.label : getLabel('custom', locale);\n } else if (dateValue.type === 'custom' || dateValue.customRange) {\n dateDescription = getLabel('custom', locale);\n }\n\n if (dateDescription) {\n activeFilters.push(`${field.label} (${dateDescription})`);\n }\n }\n break;\n case 'select': {\n const selectValue = value as SelectFilterValue;\n if (selectValue && selectValue.selectedValues && selectValue.selectedValues.length > 0) {\n const totalOptions = field.options?.length || 0;\n\n if (selectValue.selectedValues.length === totalOptions) {\n activeFilters.push(`${field.label} (${getLabel('all', locale)})`);\n } else if (selectValue.selectedValues.length === 1) {\n // Show the actual option name when only one is selected\n const selectedOption = field.options?.find(\n (opt: any) => opt.value === selectValue.selectedValues[0],\n );\n const optionLabel = selectedOption\n ? selectedOption.label\n : selectValue.selectedValues[0];\n activeFilters.push(`${field.label} (${optionLabel})`);\n } else {\n // Show count for multiple selections\n activeFilters.push(`${field.label} (${selectValue.selectedValues.length})`);\n }\n }\n break;\n }\n case 'checkbox':\n if (value !== 'indeterminate') {\n const checkboxValue =\n value === 'checked' ? getLabel('yes', locale) : getLabel('no', locale);\n activeFilters.push(`${field.label} (${checkboxValue})`);\n }\n break;\n }\n });\n\n return activeFilters;\n };\n\n const clearAllFilters = () => {\n setFilterValues({});\n };\n\n const memoizedFilterRows = useMemo(() => {\n return filterRows.map((row) => (\n <div key={row.rowNumber}>\n <div className='flex flex-wrap gap-6 mb-4'>\n {row.filters.map((field) => (\n <FilterField\n key={field.name}\n field={field}\n onFilterChange={handleFilterChange}\n value={filterValues[field.name]}\n />\n ))}\n </div>\n </div>\n ));\n }, [filterRows, handleFilterChange, filterValues]);\n\n const toggleFilters = () => {\n setShowFilters((prev) => !prev);\n };\n\n const activeFiltersDetails = getActiveFiltersDetails();\n const hasActiveFilters = activeFiltersDetails.length > 0;\n\n if (!fields.length) return null;\n\n return (\n <div className='filter-container useTw'>\n <div style={{ position: 'relative', top: '-24px', height: '0px' }}>\n <Button\n variant='outline'\n size='sm'\n onClick={toggleFilters}\n className={`flex items-center gap-2 bg-background border-muted-muted hover:bg-muted ${\n hasActiveFilters ? 'w-auto min-w-fit' : ''\n }`}\n >\n <Filter className={`h-4 w-4 ${hasActiveFilters ? 'fill-current' : ''}`} />\n\n {hasActiveFilters ? (\n <>\n <span className='text-sm truncate'>\n <strong>\n {`${activeFiltersDetails.length === 1 ? getLabel('activeFilterSingular', locale) : getLabel('activeFilterPlural', locale)}: `}\n </strong>{' '}\n {activeFiltersDetails.join(' • ')}\n </span>\n\n <span\n onClick={(e) => {\n e.stopPropagation();\n clearAllFilters();\n }}\n className='ml-1 p-0.5 hover:bg-muted rounded-sm transition-colors flex-shrink-0'\n >\n <X className='h-3 w-3 text-gray-500' />\n </span>\n </>\n ) : (\n <span className='text-sm truncate'>{getLabel('quickFilters', locale)}</span>\n )}\n\n {showFilters ? <ChevronUp className='h-4 w-4' /> : <ChevronDown className='h-4 w-4' />}\n </Button>\n </div>\n {showFilters && <div className={'p-4 pb-2 bg-muted'}>{memoizedFilterRows}</div>}\n </div>\n );\n};\n\nexport default QuickFilter;\n"],"names":["useCallback","useEffect","useMemo","useRef","useState","useConfig","useListQuery","useTranslation","getTranslation","FilterField","getLabel","groupFiltersByRow","parseColumns","ChevronDown","ChevronUp","Filter","X","getDateRangeForOption","isEqual","futureOptionKeys","getDateFilterOptions","pastOptionKeys","Button","findFieldsByName","fields","fieldNames","results","recursiveSearch","currentFields","filteredFields","filter","field","includes","name","push","forEach","item","type","Array","isArray","tabs","tab","blocks","block","buildQuickFilterConditions","values","fieldDefs","locale","conditions","Object","entries","fieldName","value","fieldDef","find","f","condition","dateValue","from","to","predefinedValue","range","customRange","Date","dateQuery","greater_than_equal","less_than_equal","keys","length","selectValue","selectedValues","equals","in","checkboxState","cleanWhereClause","clause","fieldsToClean","newClause","key","cleanedSubClauses","map","subClause","Boolean","has","and","or","parseWhereClauseToFilterValues","where","Set","recursiveParse","fromDate","toDate","allDateOptions","matchedOption","option","isFromMatch","toDateString","undefined","isToMatch","QuickFilter","slug","filterList","localStorageKey","setFields","filterRows","setFilterRows","showFilters","setShowFilters","refineListData","query","getEntityConfig","i18n","language","isSyncingFromQuery","filterValues","setFilterValues","window","localStorage","getItem","dateTimeReviver","isoDateRegex","test","JSON","parse","error","console","collection","collectionSlug","flattenedFieldConfigs","flatMap","row","rowIndex","fieldIndex","matchedFields","simplifiedFields","label","translatedLabel","fieldConfig","options","width","sortedFields","valuesFromQuery","current","quickFilterConditions","quickFilterFieldNames","otherFilters","allConditions","newWhere","columns","page","setItem","stringify","removeItem","handleFilterChange","prev","newValues","getActiveFiltersDetails","activeFilters","dateDescription","pastOptions","futureOptions","allOptions","opt","totalOptions","selectedOption","optionLabel","checkboxValue","clearAllFilters","memoizedFilterRows","div","className","filters","onFilterChange","rowNumber","toggleFilters","activeFiltersDetails","hasActiveFilters","style","position","top","height","variant","size","onClick","span","strong","join","e","stopPropagation"],"mappings":"AAAA;;AAEA,SAASA,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,QAAQ;AAC1E,SAASC,SAAS,EAAEC,YAAY,EAAEC,cAAc,QAAQ,iBAAiB;AAEzE,SAASC,cAAc,QAAQ,2BAA2B;AAC1D,OAAOC,iBAAiB,gBAAgB;AACxC,SAASC,QAAQ,QAAyB,WAAW;AAQrD,SAASC,iBAAiB,EAAEC,YAAY,QAAQ,iCAAiC;AACjF,SAASC,WAAW,EAAEC,SAAS,EAAEC,MAAM,EAAEC,CAAC,QAAQ,eAAe;AAEjE,SAASC,qBAAqB,QAAQ,+BAA+B;AACrE,SAASC,OAAO,QAAQ,SAAS;AACjC,SACEC,gBAAgB,EAChBC,oBAAoB,EACpBC,cAAc,QACT,0CAA0C;AACjD,SAASC,MAAM,QAAQ,cAAc;AAErC,4CAA4C;AAC5C,SAASC,iBAAiBC,MAAqB,EAAEC,UAAoB;IACnE,MAAMC,UAAyB,EAAE;IACjC,SAASC,gBAAgBC,aAA4B;QACnD,MAAMC,iBAAiBD,cAAcE,MAAM,CACzC,CAACC,QAAU,UAAUA,SAASN,WAAWO,QAAQ,CAACD,MAAME,IAAI;QAE9DP,QAAQQ,IAAI,IAAIL;QAChBD,cAAcO,OAAO,CAAC,CAACC;YACrB,IACE,AAACA,CAAAA,KAAKC,IAAI,KAAK,WAAWD,KAAKC,IAAI,KAAK,SAASD,KAAKC,IAAI,KAAK,aAAY,KAC3E,YAAYD,QACZE,MAAMC,OAAO,CAACH,KAAKZ,MAAM,GACzB;gBACAG,gBAAgBS,KAAKZ,MAAM;YAC7B,OAAO,IAAIY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../src/QuickFilter.tsx"],"sourcesContent":["'use client';\n\nimport { useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport { useConfig, useListQuery, useTranslation } from '@payloadcms/ui';\nimport type { ClientField, FieldAffectingData, OptionObject, SelectField } from 'payload';\nimport { getTranslation } from '@payloadcms/translations';\nimport FilterField from './FilterField';\nimport { getLabel, SupportedLocale } from './labels';\nimport type {\n CheckboxFilterState,\n DateFilterValue,\n FilterDetaild,\n FilterRow,\n SelectFilterValue,\n} from './filters/types/filters-type';\nimport { groupFiltersByRow, parseColumns } from './filters/utils/layout-helpers';\nimport { ChevronDown, ChevronUp, Filter, X } from 'lucide-react';\n\nimport { getDateRangeForOption } from './filters/utils/date-helpers';\nimport { isEqual } from 'lodash';\nimport {\n futureOptionKeys,\n getDateFilterOptions,\n pastOptionKeys,\n} from './filters/constants/date-filter-options';\nimport { Button } from './ui/button';\n\n// Helper function to get localized label\nconst getLocalizedLabel = (label: any, locale: SupportedLocale): string => {\n if (typeof label === 'object' && label !== null) {\n return label[locale] || label['en'] || Object.values(label)[0] || ''\n }\n return label || ''\n}\n\n// Recursive function to find fields by name\nfunction findFieldsByName(fields: ClientField[], fieldNames: string[]): ClientField[] {\n const results: ClientField[] = [];\n function recursiveSearch(currentFields: ClientField[]) {\n const filteredFields = currentFields.filter(\n (field) => 'name' in field && fieldNames.includes(field.name as string),\n );\n results.push(...filteredFields);\n currentFields.forEach((item) => {\n if (\n (item.type === 'array' || item.type === 'row' || item.type === 'collapsible') &&\n 'fields' in item &&\n Array.isArray(item.fields)\n ) {\n recursiveSearch(item.fields);\n } else if (item.type === 'tabs' && Array.isArray(item.tabs)) {\n item.tabs.forEach((tab) => {\n if ('fields' in tab && Array.isArray(tab.fields)) {\n recursiveSearch(tab.fields);\n }\n });\n } else if (item.type === 'blocks' && Array.isArray(item.blocks)) {\n item.blocks.forEach((block) => {\n if ('fields' in block && Array.isArray(block.fields)) {\n recursiveSearch(block.fields);\n }\n });\n }\n });\n }\n recursiveSearch(fields);\n return results;\n}\n\n// Builds an array of condition objects from the quick filter values\nconst buildQuickFilterConditions = (\n values: Record<string, any>,\n fieldDefs: FilterDetaild[],\n locale: SupportedLocale,\n): Record<string, any>[] => {\n const conditions: Record<string, any>[] = [];\n\n Object.entries(values).forEach(([fieldName, value]) => {\n if (!value) return;\n const fieldDef = fieldDefs.find((f) => f.name === fieldName);\n if (!fieldDef) return;\n\n let condition: Record<string, any> | null = null;\n\n switch (fieldDef.type) {\n case 'date': {\n const dateValue = value as DateFilterValue;\n let from: Date | undefined;\n let to: Date | undefined;\n\n if (dateValue.predefinedValue) {\n const range = getDateRangeForOption(dateValue.predefinedValue, locale);\n from = range.from;\n to = range.to;\n } else if (dateValue.customRange) {\n if (dateValue.customRange.from) from = new Date(dateValue.customRange.from);\n if (dateValue.customRange.to) to = new Date(dateValue.customRange.to);\n }\n\n if (from || to) {\n const dateQuery: any = {};\n if (from) dateQuery.greater_than_equal = from;\n if (to) dateQuery.less_than_equal = to;\n if (Object.keys(dateQuery).length > 0) {\n condition = { [fieldName]: dateQuery };\n }\n }\n break;\n }\n case 'select': {\n const selectValue = value as SelectFilterValue;\n if (selectValue.selectedValues && selectValue.selectedValues.length > 0) {\n if (selectValue.selectedValues.length === 1) {\n condition = { [fieldName]: { equals: selectValue.selectedValues[0] } };\n } else {\n condition = { [fieldName]: { in: selectValue.selectedValues } };\n }\n }\n break;\n }\n case 'checkbox': {\n const checkboxState = value as CheckboxFilterState;\n if (checkboxState === 'checked') {\n condition = { [fieldName]: { equals: 'true' } };\n } else if (checkboxState === 'unchecked') {\n condition = { [fieldName]: { equals: 'false' } };\n }\n break;\n }\n }\n if (condition) {\n conditions.push(condition);\n }\n });\n return conditions;\n};\n\n// Helper function to remove quick filter conditions from a 'where' clause\nconst cleanWhereClause = (clause: any, fieldsToClean: Set<string>): any => {\n if (!clause || typeof clause !== 'object' || Array.isArray(clause)) {\n return clause;\n }\n\n const newClause: Record<string, any> = {};\n\n for (const key in clause) {\n if (key === 'and' || key === 'or') {\n const cleanedSubClauses = clause[key]\n .map((subClause: any) => cleanWhereClause(subClause, fieldsToClean))\n .filter(Boolean);\n\n if (cleanedSubClauses.length > 0) {\n newClause[key] = cleanedSubClauses;\n }\n } else if (!fieldsToClean.has(key)) {\n newClause[key] = clause[key];\n }\n }\n\n if (Object.keys(newClause).length === 0) {\n return null;\n }\n\n if (newClause.and?.length === 1 && Object.keys(newClause).length === 1) {\n return newClause.and[0];\n }\n if (newClause.or?.length === 1 && Object.keys(newClause).length === 1) {\n return newClause.or[0];\n }\n\n return newClause;\n};\n\n// Translates URL query conditions to the quick filter's internal state\nconst parseWhereClauseToFilterValues = (\n where: any,\n fields: FilterDetaild[],\n locale: SupportedLocale,\n): Record<string, any> => {\n const values: Record<string, any> = {};\n const fieldNames = new Set(fields.map((f) => f.name));\n\n const recursiveParse = (clause: any) => {\n if (!clause || typeof clause !== 'object') return;\n\n if (clause.and) {\n clause.and.forEach(recursiveParse);\n return;\n }\n if (clause.or) {\n clause.or.forEach(recursiveParse);\n return;\n }\n\n for (const fieldName in clause) {\n if (fieldNames.has(fieldName)) {\n const fieldDef = fields.find((f) => f.name === fieldName);\n const condition = clause[fieldName];\n\n if (fieldDef && condition && typeof condition === 'object') {\n if ('equals' in condition) {\n if (fieldDef.type === 'checkbox') {\n values[fieldName] = condition.equals == 'true' ? 'checked' : 'unchecked';\n } else if (fieldDef.type === 'select') {\n values[fieldName] = { selectedValues: [condition.equals] };\n }\n } else if ('in' in condition && Array.isArray(condition.in)) {\n if (fieldDef.type === 'select') {\n values[fieldName] = { selectedValues: condition.in };\n }\n } else if ('greater_than_equal' in condition || 'less_than_equal' in condition) {\n if (fieldDef.type === 'date') {\n const fromDate = condition.greater_than_equal\n ? new Date(condition.greater_than_equal)\n : null;\n const toDate = condition.less_than_equal ? new Date(condition.less_than_equal) : null;\n const allDateOptions = [...pastOptionKeys, ...futureOptionKeys];\n let matchedOption = null;\n\n for (const option of allDateOptions) {\n const range = getDateRangeForOption(option, locale);\n let isFromMatch;\n if (fromDate) {\n isFromMatch = range.from?.toDateString() === fromDate.toDateString();\n } else if (fromDate == null && range.to == undefined) {\n // all future: fromDate == null & range.to == undefined\n isFromMatch = true;\n }\n let isToMatch;\n if (toDate) {\n isToMatch = range.to?.toDateString() === toDate.toDateString();\n } else if (toDate == null && range.to == undefined) {\n // all future: fromDate == null & range.to == undefined\n isToMatch = true;\n }\n\n if (isFromMatch && isToMatch) {\n matchedOption = option;\n break;\n }\n }\n\n if (matchedOption) {\n values[fieldName] = {\n type: 'predefined',\n predefinedValue: matchedOption,\n };\n } else {\n values[fieldName] = {\n type: 'custom',\n customRange: {\n from: fromDate,\n to: toDate,\n },\n };\n }\n }\n }\n }\n }\n }\n };\n\n recursiveParse(where);\n return values;\n};\n\nconst QuickFilter = ({\n slug,\n filterList,\n}: {\n slug: string;\n filterList: (string | { name: string; width: string })[][];\n}) => {\n const localStorageKey = useMemo(() => `direct-filter-${slug}`, [slug]);\n\n const [fields, setFields] = useState<FilterDetaild[]>([]);\n const [filterRows, setFilterRows] = useState<FilterRow[]>([]);\n const [showFilters, setShowFilters] = useState(false);\n const { refineListData, query } = useListQuery();\n const { getEntityConfig } = useConfig();\n const { i18n } = useTranslation();\n const locale = i18n.language as SupportedLocale;\n const isSyncingFromQuery = useRef(false);\n\n const [filterValues, setFilterValues] = useState<Record<string, any>>(() => {\n if (typeof window == 'undefined') return {};\n try {\n const item = window.localStorage.getItem(localStorageKey);\n if (!item) return {};\n const dateTimeReviver = (key: string, value: any) => {\n const isoDateRegex = /^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$/;\n if (typeof value === 'string' && isoDateRegex.test(value)) {\n return new Date(value);\n }\n return value;\n };\n return JSON.parse(item, dateTimeReviver);\n } catch (error) {\n console.error('Error reading and parsing filters from localStorage.', error);\n return {};\n }\n });\n\n // Build the list of filter fields from config\n useEffect(() => {\n const collection = getEntityConfig({ collectionSlug: slug });\n const flattenedFieldConfigs = filterList.flatMap((row, rowIndex) =>\n row.map((field, fieldIndex) => ({\n field,\n rowIndex,\n fieldIndex,\n })),\n );\n const fieldNames = flattenedFieldConfigs.map(({ field }) =>\n typeof field === 'string' ? field : field.name,\n );\n const matchedFields = findFieldsByName(collection?.fields || [], fieldNames);\n const simplifiedFields: FilterDetaild[] = matchedFields.map((field) => {\n const label = (field as FieldAffectingData).label;\n const translatedLabel = getTranslation(label as string, i18n);\n const fieldName = (field as FieldAffectingData).name as string;\n const fieldConfig = flattenedFieldConfigs.find(({ field: f }) =>\n typeof f === 'string' ? f === fieldName : f.name === fieldName,\n );\n return {\n name: fieldName,\n label: translatedLabel as string,\n type: field.type,\n options: (field as SelectField).options as OptionObject[],\n row: fieldConfig ? fieldConfig.rowIndex : 0,\n width:\n typeof fieldConfig?.field === 'object' && 'width' in fieldConfig.field\n ? fieldConfig.field.width\n : undefined,\n };\n });\n const sortedFields = flattenedFieldConfigs\n .map(({ field }) => {\n const fieldName = typeof field === 'string' ? field : field.name;\n return simplifiedFields.find((f) => f.name === fieldName);\n })\n .filter((f): f is FilterDetaild => !!f);\n setFields(sortedFields);\n setFilterRows(groupFiltersByRow(sortedFields));\n }, [slug, filterList, getEntityConfig, i18n]);\n // Sync from URL (query.where) into internal state\n useEffect(() => {\n if (fields.length === 0) return;\n\n const valuesFromQuery: Record<string, any> = parseWhereClauseToFilterValues(\n query.where,\n fields,\n locale,\n );\n\n if (!isEqual(valuesFromQuery, filterValues)) {\n // Lock to prevent feedback loop when internal state changes\n isSyncingFromQuery.current = true;\n setFilterValues(valuesFromQuery);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [query.where, fields]);\n\n // Sync internal state (filterValues) back into the URL\n useEffect(() => {\n // If the change originated from the first effect, skip to avoid infinite loop\n if (isSyncingFromQuery.current) {\n isSyncingFromQuery.current = false;\n return;\n }\n\n if (fields.length === 0) return;\n\n const quickFilterConditions = buildQuickFilterConditions(filterValues, fields, locale);\n const quickFilterFieldNames = new Set(fields.map((f) => f.name));\n const otherFilters = cleanWhereClause(query.where, quickFilterFieldNames);\n\n const allConditions = [...quickFilterConditions];\n if (otherFilters) {\n if (otherFilters.and && Array.isArray(otherFilters.and)) {\n allConditions.push(...otherFilters.and);\n } else if (Object.keys(otherFilters).length > 0) {\n allConditions.push(otherFilters);\n }\n }\n\n let newWhere: Record<string, any> = {};\n if (allConditions.length > 1) {\n newWhere = { and: allConditions };\n } else if (allConditions.length === 1) {\n newWhere = allConditions[0];\n }\n\n // Only update if the query has actually changed to avoid unnecessary updates\n if (!isEqual(newWhere, query.where)) {\n refineListData({\n columns: parseColumns(query.columns),\n where: newWhere,\n page: '1',\n });\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [filterValues, fields, i18n.language, refineListData]);\n // Effect for persisting to localStorage\n useEffect(() => {\n try {\n if (Object.keys(filterValues).length > 0) {\n localStorage.setItem(localStorageKey, JSON.stringify(filterValues));\n } else {\n localStorage.removeItem(localStorageKey);\n }\n } catch (error) {\n console.error('Failed to save filters to localStorage', error);\n }\n }, [filterValues, localStorageKey]);\n\n // Updates only the internal state\n const handleFilterChange = useCallback((fieldName: string, value: any) => {\n setFilterValues((prev) => {\n const newValues = { ...prev };\n if (\n value === undefined ||\n value === null ||\n value === 'indeterminate' ||\n (value && value.type === 'none')\n ) {\n delete newValues[fieldName];\n } else {\n newValues[fieldName] = value;\n }\n return newValues;\n });\n }, []);\n\n // This function remains largely the same.\n const getActiveFiltersDetails = () => {\n const activeFilters: string[] = [];\n const locale = i18n.language as SupportedLocale;\n Object.entries(filterValues).forEach(([fieldName, value]) => {\n const field = fields.find((f) => f.name === fieldName);\n if (!field) return;\n\n switch (field.type) {\n case 'date':\n if (value !== undefined) {\n const dateValue = value as DateFilterValue;\n let dateDescription = '';\n\n if (dateValue.type === 'predefined' && dateValue.predefinedValue) {\n const { pastOptions, futureOptions } = getDateFilterOptions(locale);\n const allOptions = [...pastOptions, ...futureOptions];\n const option = allOptions.find((opt) => opt.value === dateValue.predefinedValue);\n dateDescription = option ? option.label : getLabel('custom', locale);\n } else if (dateValue.type === 'custom' || dateValue.customRange) {\n dateDescription = getLabel('custom', locale);\n }\n\n if (dateDescription) {\n activeFilters.push(`${field.label} (${dateDescription})`);\n }\n }\n break;\n case 'select': {\n const selectValue = value as SelectFilterValue;\n if (selectValue && selectValue.selectedValues && selectValue.selectedValues.length > 0) {\n const totalOptions = field.options?.length || 0;\n\n if (selectValue.selectedValues.length === totalOptions) {\n activeFilters.push(`${field.label} (${getLabel('all', locale)})`);\n } else if (selectValue.selectedValues.length === 1) {\n // Show the actual option name when only one is selected\n const selectedOption = field.options?.find(\n (opt: any) => opt.value === selectValue.selectedValues[0],\n );\n const optionLabel = selectedOption\n ? getLocalizedLabel(selectedOption.label, locale)\n : selectValue.selectedValues[0];\n activeFilters.push(`${field.label} (${optionLabel})`);\n } else {\n // Show count for multiple selections\n activeFilters.push(`${field.label} (${selectValue.selectedValues.length})`);\n }\n }\n break;\n }\n case 'checkbox':\n if (value !== 'indeterminate') {\n const checkboxValue =\n value === 'checked' ? getLabel('yes', locale) : getLabel('no', locale);\n activeFilters.push(`${field.label} (${checkboxValue})`);\n }\n break;\n }\n });\n\n return activeFilters;\n };\n\n const clearAllFilters = () => {\n setFilterValues({});\n };\n\n const memoizedFilterRows = useMemo(() => {\n return filterRows.map((row) => (\n <div key={row.rowNumber}>\n <div className='flex flex-wrap gap-6 mb-4'>\n {row.filters.map((field) => (\n <FilterField\n key={field.name}\n field={field}\n onFilterChange={handleFilterChange}\n value={filterValues[field.name]}\n />\n ))}\n </div>\n </div>\n ));\n }, [filterRows, handleFilterChange, filterValues]);\n\n const toggleFilters = () => {\n setShowFilters((prev) => !prev);\n };\n\n const activeFiltersDetails = getActiveFiltersDetails();\n const hasActiveFilters = activeFiltersDetails.length > 0;\n\n if (!fields.length) return null;\n\n return (\n <div className='filter-container useTw'>\n <div style={{ position: 'relative', top: '-24px', height: '0px' }}>\n <Button\n variant='outline'\n size='sm'\n onClick={toggleFilters}\n className={`flex items-center gap-2 bg-background border-muted-muted hover:bg-muted ${\n hasActiveFilters ? 'w-auto min-w-fit' : ''\n }`}\n >\n <Filter className={`h-4 w-4 ${hasActiveFilters ? 'fill-current' : ''}`} />\n\n {hasActiveFilters ? (\n <>\n <span className='text-sm truncate'>\n <strong>\n {`${activeFiltersDetails.length === 1 ? getLabel('activeFilterSingular', locale) : getLabel('activeFilterPlural', locale)}: `}\n </strong>{' '}\n {activeFiltersDetails.join(' • ')}\n </span>\n\n <span\n onClick={(e) => {\n e.stopPropagation();\n clearAllFilters();\n }}\n className='ml-1 p-0.5 hover:bg-muted rounded-sm transition-colors flex-shrink-0'\n >\n <X className='h-3 w-3 text-gray-500' />\n </span>\n </>\n ) : (\n <span className='text-sm truncate'>{getLabel('quickFilters', locale)}</span>\n )}\n\n {showFilters ? <ChevronUp className='h-4 w-4' /> : <ChevronDown className='h-4 w-4' />}\n </Button>\n </div>\n {showFilters && <div className={'p-4 pb-2 bg-muted'}>{memoizedFilterRows}</div>}\n </div>\n );\n};\n\nexport default QuickFilter;\n"],"names":["useCallback","useEffect","useMemo","useRef","useState","useConfig","useListQuery","useTranslation","getTranslation","FilterField","getLabel","groupFiltersByRow","parseColumns","ChevronDown","ChevronUp","Filter","X","getDateRangeForOption","isEqual","futureOptionKeys","getDateFilterOptions","pastOptionKeys","Button","getLocalizedLabel","label","locale","Object","values","findFieldsByName","fields","fieldNames","results","recursiveSearch","currentFields","filteredFields","filter","field","includes","name","push","forEach","item","type","Array","isArray","tabs","tab","blocks","block","buildQuickFilterConditions","fieldDefs","conditions","entries","fieldName","value","fieldDef","find","f","condition","dateValue","from","to","predefinedValue","range","customRange","Date","dateQuery","greater_than_equal","less_than_equal","keys","length","selectValue","selectedValues","equals","in","checkboxState","cleanWhereClause","clause","fieldsToClean","newClause","key","cleanedSubClauses","map","subClause","Boolean","has","and","or","parseWhereClauseToFilterValues","where","Set","recursiveParse","fromDate","toDate","allDateOptions","matchedOption","option","isFromMatch","toDateString","undefined","isToMatch","QuickFilter","slug","filterList","localStorageKey","setFields","filterRows","setFilterRows","showFilters","setShowFilters","refineListData","query","getEntityConfig","i18n","language","isSyncingFromQuery","filterValues","setFilterValues","window","localStorage","getItem","dateTimeReviver","isoDateRegex","test","JSON","parse","error","console","collection","collectionSlug","flattenedFieldConfigs","flatMap","row","rowIndex","fieldIndex","matchedFields","simplifiedFields","translatedLabel","fieldConfig","options","width","sortedFields","valuesFromQuery","current","quickFilterConditions","quickFilterFieldNames","otherFilters","allConditions","newWhere","columns","page","setItem","stringify","removeItem","handleFilterChange","prev","newValues","getActiveFiltersDetails","activeFilters","dateDescription","pastOptions","futureOptions","allOptions","opt","totalOptions","selectedOption","optionLabel","checkboxValue","clearAllFilters","memoizedFilterRows","div","className","filters","onFilterChange","rowNumber","toggleFilters","activeFiltersDetails","hasActiveFilters","style","position","top","height","variant","size","onClick","span","strong","join","e","stopPropagation"],"mappings":"AAAA;;AAEA,SAASA,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,QAAQ;AAC1E,SAASC,SAAS,EAAEC,YAAY,EAAEC,cAAc,QAAQ,iBAAiB;AAEzE,SAASC,cAAc,QAAQ,2BAA2B;AAC1D,OAAOC,iBAAiB,gBAAgB;AACxC,SAASC,QAAQ,QAAyB,WAAW;AAQrD,SAASC,iBAAiB,EAAEC,YAAY,QAAQ,iCAAiC;AACjF,SAASC,WAAW,EAAEC,SAAS,EAAEC,MAAM,EAAEC,CAAC,QAAQ,eAAe;AAEjE,SAASC,qBAAqB,QAAQ,+BAA+B;AACrE,SAASC,OAAO,QAAQ,SAAS;AACjC,SACEC,gBAAgB,EAChBC,oBAAoB,EACpBC,cAAc,QACT,0CAA0C;AACjD,SAASC,MAAM,QAAQ,cAAc;AAErC,yCAAyC;AACzC,MAAMC,oBAAoB,CAACC,OAAYC;IACrC,IAAI,OAAOD,UAAU,YAAYA,UAAU,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AEF,KAAClK;4BAAO4J,WAAW,CAAC,QAAQ,EAAEM,mBAAmB,iBAAiB,IAAI;;wBAErEA,iCACC;;8CACE,MAACQ;oCAAKd,WAAU;;sDACd,KAACe;sDACE,GAAGV,qBAAqB1G,MAAM,KAAK,IAAI5D,SAAS,wBAAwBe,UAAUf,SAAS,sBAAsBe,QAAQ,EAAE,CAAC;;wCACrH;wCACTuJ,qBAAqBW,IAAI,CAAC;;;8CAG7B,KAACF;oCACCD,SAAS,CAACI;wCACRA,EAAEC,eAAe;wCACjBrB;oCACF;oCACAG,WAAU;8CAEV,cAAA,KAAC3J;wCAAE2J,WAAU;;;;2CAIjB,KAACc;4BAAKd,WAAU;sCAAoBjK,SAAS,gBAAgBe;;wBAG9DmF,4BAAc,KAAC9F;4BAAU6J,WAAU;2CAAe,KAAC9J;4BAAY8J,WAAU;;;;;YAG7E/D,6BAAe,KAAC8D;gBAAIC,WAAW;0BAAsBF;;;;AAG5D;AAEA,eAAepE,YAAY"}
package/dist/index.js CHANGED
@@ -28,7 +28,7 @@ export const CollectionQuickFilterPlugin = (pluginOptions = {})=>(config)=>{
28
28
  }
29
29
  // Add the QuickFilter component
30
30
  newCollection.admin.components.beforeListTable.push({
31
- path: '/plugins/quickfilter/QuickFilter',
31
+ path: '@shefing/quickfilter/QuickFilter',
32
32
  clientProps: {
33
33
  filterList: collection.custom.filterList,
34
34
  slug: collection.slug
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type { Config } from 'payload';\n\nexport type CollectionFilterPluginConfig = {\n /**\n * List of collections to add filters to\n */\n disabled?: boolean;\n};\n\nexport const CollectionQuickFilterPlugin =\n (pluginOptions: CollectionFilterPluginConfig = {}) =>\n (config: Config): Config => {\n if (!config.collections) {\n config.collections = [];\n }\n\n // Process each collection to add the QuickFilter component\n config.collections = config.collections.map((collection) => {\n // Check if the collection has a filterList configuration\n // or if it's specified in the plugin options\n if (collection.custom?.filterList && Array.isArray(collection.custom.filterList)) {\n // Clone the collection to avoid mutating the original\n const newCollection = { ...collection };\n\n // Initialize components if not exists\n if (!newCollection.admin) {\n newCollection.admin = {};\n }\n\n if (!newCollection.admin.components) {\n newCollection.admin.components = {};\n }\n\n if (!newCollection.admin.components.beforeListTable) {\n newCollection.admin.components.beforeListTable = [];\n } else if (!Array.isArray(newCollection.admin.components.beforeListTable)) {\n // If it's not an array, convert it to an array\n newCollection.admin.components.beforeListTable = [\n newCollection.admin.components.beforeListTable,\n ];\n }\n\n // Add the QuickFilter component\n newCollection.admin.components.beforeListTable.push({\n path: '/plugins/quickfilter/QuickFilter',\n clientProps: {\n filterList: collection.custom.filterList,\n slug: collection.slug,\n },\n });\n\n return newCollection;\n }\n\n return collection;\n });\n\n /**\n * If the plugin is disabled, we still want to keep added collections/fields so the database schema is consistent which is important for migrations.\n * If your plugin heavily modifies the database schema, you may want to remove this property.\n */\n if (pluginOptions.disabled) {\n return config;\n }\n\n return config;\n };\n\nexport default CollectionQuickFilterPlugin;\n"],"names":["CollectionQuickFilterPlugin","pluginOptions","config","collections","map","collection","custom","filterList","Array","isArray","newCollection","admin","components","beforeListTable","push","path","clientProps","slug","disabled"],"mappings":"AASA,OAAO,MAAMA,8BACX,CAACC,gBAA8C,CAAC,CAAC,GACjD,CAACC;QACC,IAAI,CAACA,OAAOC,WAAW,EAAE;YACvBD,OAAOC,WAAW,GAAG,EAAE;QACzB;QAEA,2DAA2D;QAC3DD,OAAOC,WAAW,GAAGD,OAAOC,WAAW,CAACC,GAAG,CAAC,CAACC;YAC3C,yDAAyD;YACzD,6CAA6C;YAC7C,IAAIA,WAAWC,MAAM,EAAEC,cAAcC,MAAMC,OAAO,CAACJ,WAAWC,MAAM,CAACC,UAAU,GAAG;gBAChF,sDAAsD;gBACtD,MAAMG,gBAAgB;oBAAE,GAAGL,UAAU;gBAAC;gBAEtC,sCAAsC;gBACtC,IAAI,CAACK,cAAcC,KAAK,EAAE;oBACxBD,cAAcC,KAAK,GAAG,CAAC;gBACzB;gBAEA,IAAI,CAACD,cAAcC,KAAK,CAACC,UAAU,EAAE;oBACnCF,cAAcC,KAAK,CAACC,UAAU,GAAG,CAAC;gBACpC;gBAEA,IAAI,CAACF,cAAcC,KAAK,CAACC,UAAU,CAACC,eAAe,EAAE;oBACnDH,cAAcC,KAAK,CAACC,UAAU,CAACC,eAAe,GAAG,EAAE;gBACrD,OAAO,IAAI,CAACL,MAAMC,OAAO,CAACC,cAAcC,KAAK,CAACC,UAAU,CAACC,eAAe,GAAG;oBACzE,+CAA+C;oBAC/CH,cAAcC,KAAK,CAACC,UAAU,CAACC,eAAe,GAAG;wBAC/CH,cAAcC,KAAK,CAACC,UAAU,CAACC,eAAe;qBAC/C;gBACH;gBAEA,gCAAgC;gBAChCH,cAAcC,KAAK,CAACC,UAAU,CAACC,eAAe,CAACC,IAAI,CAAC;oBAClDC,MAAM;oBACNC,aAAa;wBACXT,YAAYF,WAAWC,MAAM,CAACC,UAAU;wBACxCU,MAAMZ,WAAWY,IAAI;oBACvB;gBACF;gBAEA,OAAOP;YACT;YAEA,OAAOL;QACT;QAEA;;;KAGC,GACD,IAAIJ,cAAciB,QAAQ,EAAE;YAC1B,OAAOhB;QACT;QAEA,OAAOA;IACT,EAAE;AAEJ,eAAeF,4BAA4B"}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type { Config } from 'payload';\n\nexport type CollectionFilterPluginConfig = {\n /**\n * List of collections to add filters to\n */\n disabled?: boolean;\n};\n\nexport const CollectionQuickFilterPlugin =\n (pluginOptions: CollectionFilterPluginConfig = {}) =>\n (config: Config): Config => {\n if (!config.collections) {\n config.collections = [];\n }\n\n // Process each collection to add the QuickFilter component\n config.collections = config.collections.map((collection) => {\n // Check if the collection has a filterList configuration\n // or if it's specified in the plugin options\n if (collection.custom?.filterList && Array.isArray(collection.custom.filterList)) {\n // Clone the collection to avoid mutating the original\n const newCollection = { ...collection };\n\n // Initialize components if not exists\n if (!newCollection.admin) {\n newCollection.admin = {};\n }\n\n if (!newCollection.admin.components) {\n newCollection.admin.components = {};\n }\n\n if (!newCollection.admin.components.beforeListTable) {\n newCollection.admin.components.beforeListTable = [];\n } else if (!Array.isArray(newCollection.admin.components.beforeListTable)) {\n // If it's not an array, convert it to an array\n newCollection.admin.components.beforeListTable = [\n newCollection.admin.components.beforeListTable,\n ];\n }\n\n // Add the QuickFilter component\n newCollection.admin.components.beforeListTable.push({\n path: '@shefing/quickfilter/QuickFilter',\n clientProps: {\n filterList: collection.custom.filterList,\n slug: collection.slug,\n },\n });\n\n return newCollection;\n }\n\n return collection;\n });\n\n /**\n * If the plugin is disabled, we still want to keep added collections/fields so the database schema is consistent which is important for migrations.\n * If your plugin heavily modifies the database schema, you may want to remove this property.\n */\n if (pluginOptions.disabled) {\n return config;\n }\n\n return config;\n };\n\nexport default CollectionQuickFilterPlugin;\n"],"names":["CollectionQuickFilterPlugin","pluginOptions","config","collections","map","collection","custom","filterList","Array","isArray","newCollection","admin","components","beforeListTable","push","path","clientProps","slug","disabled"],"mappings":"AASA,OAAO,MAAMA,8BACX,CAACC,gBAA8C,CAAC,CAAC,GACjD,CAACC;QACC,IAAI,CAACA,OAAOC,WAAW,EAAE;YACvBD,OAAOC,WAAW,GAAG,EAAE;QACzB;QAEA,2DAA2D;QAC3DD,OAAOC,WAAW,GAAGD,OAAOC,WAAW,CAACC,GAAG,CAAC,CAACC;YAC3C,yDAAyD;YACzD,6CAA6C;YAC7C,IAAIA,WAAWC,MAAM,EAAEC,cAAcC,MAAMC,OAAO,CAACJ,WAAWC,MAAM,CAACC,UAAU,GAAG;gBAChF,sDAAsD;gBACtD,MAAMG,gBAAgB;oBAAE,GAAGL,UAAU;gBAAC;gBAEtC,sCAAsC;gBACtC,IAAI,CAACK,cAAcC,KAAK,EAAE;oBACxBD,cAAcC,KAAK,GAAG,CAAC;gBACzB;gBAEA,IAAI,CAACD,cAAcC,KAAK,CAACC,UAAU,EAAE;oBACnCF,cAAcC,KAAK,CAACC,UAAU,GAAG,CAAC;gBACpC;gBAEA,IAAI,CAACF,cAAcC,KAAK,CAACC,UAAU,CAACC,eAAe,EAAE;oBACnDH,cAAcC,KAAK,CAACC,UAAU,CAACC,eAAe,GAAG,EAAE;gBACrD,OAAO,IAAI,CAACL,MAAMC,OAAO,CAACC,cAAcC,KAAK,CAACC,UAAU,CAACC,eAAe,GAAG;oBACzE,+CAA+C;oBAC/CH,cAAcC,KAAK,CAACC,UAAU,CAACC,eAAe,GAAG;wBAC/CH,cAAcC,KAAK,CAACC,UAAU,CAACC,eAAe;qBAC/C;gBACH;gBAEA,gCAAgC;gBAChCH,cAAcC,KAAK,CAACC,UAAU,CAACC,eAAe,CAACC,IAAI,CAAC;oBAClDC,MAAM;oBACNC,aAAa;wBACXT,YAAYF,WAAWC,MAAM,CAACC,UAAU;wBACxCU,MAAMZ,WAAWY,IAAI;oBACvB;gBACF;gBAEA,OAAOP;YACT;YAEA,OAAOL;QACT;QAEA;;;KAGC,GACD,IAAIJ,cAAciB,QAAQ,EAAE;YAC1B,OAAOhB;QACT;QAEA,OAAOA;IACT,EAAE;AAEJ,eAAeF,4BAA4B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shefing/quickfilter",
3
- "version": "1.0.12",
3
+ "version": "1.0.15",
4
4
  "private": false,
5
5
  "bugs": "https://github.com/shefing/payload-tools/issues",
6
6
  "repository": "https://github.com/shefing/payload-tools",
@@ -23,56 +23,63 @@
23
23
  "require": "./dist/QuickFilter.js"
24
24
  }
25
25
  },
26
- "scripts": {
27
- "build": "pnpm copyfiles && pnpm build:swc && pnpm build:types",
28
- "build:swc": "swc ./src -d ./dist --config-file .swcrc",
29
- "build:types": "tsc --emitDeclarationOnly --outDir dist",
30
- "clean": "rimraf dist && rimraf tsconfig.tsbuildinfo",
31
- "copyfiles": "copyfiles -u 1 \"src/**/*.{html,css,scss,ttf,woff,woff2,eot,svg,jpg,png,json}\" dist/",
32
- "lint": "eslint src",
33
- "lint:fix": "eslint --fix --ext .ts,.tsx src",
34
- "prepublishOnly": "pnpm clean && pnpm build",
35
- "reinstall": "rm -rf node_modules .next && rm -rf .next && rm pnpm-lock.yaml && pnpm install"
36
- },
37
26
  "devDependencies": {
38
- "payload": "^3.47.0",
39
- "typescript": "5.7.3",
40
- "lucide-react": "^0.475.0",
41
27
  "@radix-ui/react-slot": "^1.2.3",
42
- "class-variance-authority": "^0.7.1",
43
- "tailwind-merge": "^3.0.1",
44
- "tailwindcss": "3.4.17",
45
- "next": "15.3.3",
46
- "react": "19.0.0",
28
+ "@swc/cli": "^0.1.65",
29
+ "@swc/core": "^1.6.3",
47
30
  "@types/react": "19.0.7",
48
31
  "@types/react-dom": "19.0.3",
49
- "postcss": "^8.5.2"
50
- },
51
- "dependencies": {
52
- "payload": "^3.47.0",
53
- "typescript": "5.7.3",
54
- "lucide-react": "^0.475.0",
55
- "@radix-ui/react-slot": "^1.2.3",
56
32
  "class-variance-authority": "^0.7.1",
57
- "tailwind-merge": "^3.0.1",
33
+ "copyfiles": "^2.4.1",
34
+ "lucide-react": "^0.475.0",
58
35
  "next": "15.3.3",
36
+ "payload": "^3.47.0",
37
+ "postcss": "^8.5.2",
59
38
  "react": "19.0.0",
60
- "@types/react": "19.0.7",
61
- "@types/react-dom": "19.0.3",
39
+ "rimraf": "^5.0.5",
40
+ "tailwind-merge": "^3.0.1",
41
+ "tailwindcss": "3.4.17",
42
+ "typescript": "5.7.3"
43
+ },
44
+ "dependencies": {
62
45
  "@payloadcms/translations": "^3.47.0",
63
46
  "@payloadcms/ui": "^3.47.0",
47
+ "@radix-ui/react-checkbox": "^1.1.4",
48
+ "@radix-ui/react-dialog": "^1.1.6",
64
49
  "@radix-ui/react-label": "^2.1.2",
65
- "react-day-picker": "^9.8.0",
66
50
  "@radix-ui/react-popover": "^1.1.6",
67
51
  "@radix-ui/react-separator": "^1.1.2",
52
+ "@radix-ui/react-slot": "^1.2.3",
53
+ "@types/lodash": "^4.14.202",
54
+ "@types/react": "19.0.7",
55
+ "@types/react-dom": "19.0.3",
56
+ "class-variance-authority": "^0.7.1",
57
+ "clsx": "^2.1.0",
68
58
  "cmdk": "^1.0.4",
69
- "@radix-ui/react-dialog": "^1.1.6",
70
- "@radix-ui/react-checkbox": "^1.1.4",
59
+ "date-fns": "^3.6.0",
60
+ "lodash": "^4.17.21",
61
+ "lucide-react": "^0.475.0",
62
+ "next": "15.3.3",
63
+ "payload": "^3.47.0",
64
+ "react": "19.0.0",
65
+ "react-day-picker": "^9.8.0",
66
+ "tailwind-merge": "^3.0.1",
67
+ "tailwindcss": "3.4.17",
71
68
  "tailwindcss-animate": "^1.0.7",
72
69
  "tailwindcss-scoped-preflight": "^3.4.10",
73
- "tailwindcss": "3.4.17"
70
+ "typescript": "5.7.3"
74
71
  },
75
72
  "publishConfig": {
76
73
  "access": "public"
74
+ },
75
+ "scripts": {
76
+ "build": "pnpm copyfiles && pnpm build:swc && pnpm build:types",
77
+ "build:swc": "swc ./src -d ./dist --config-file .swcrc",
78
+ "build:types": "tsc --emitDeclarationOnly --outDir dist",
79
+ "clean": "rimraf dist && rimraf tsconfig.tsbuildinfo",
80
+ "copyfiles": "copyfiles -u 1 \"src/**/*.{html,css,scss,ttf,woff,woff2,eot,svg,jpg,png,json}\" dist/",
81
+ "lint": "eslint src",
82
+ "lint:fix": "eslint --fix --ext .ts,.tsx src",
83
+ "reinstall": "rm -rf node_modules .next && rm -rf .next && rm pnpm-lock.yaml && pnpm install"
77
84
  }
78
- }
85
+ }