@shefing/quickfilter 1.0.24 → 1.0.26

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 CHANGED
@@ -1,8 +1,10 @@
1
1
  # 🚀 QuickFilter Plugin for PayloadCMS
2
2
 
3
- > **Lightning-fast filtering that your users will love!**
3
+ #!!! Payload 3.49 breaks the plugin - https://github.com/payloadcms/payload/pull/13200 We are working to fix that
4
4
 
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!
5
+ **Lightning-fast and intuitive filtering that your users will love!**
6
+
7
+ Transform your PayloadCMS admin experience with instant, intuitive filters that appear right where you need them. Say goodbye to clunky filter forms and welcome to seamless data exploration!
6
8
 
7
9
  ## ✨ Features
8
10
 
@@ -17,7 +19,11 @@ Transform your PayloadCMS admin experience with instant, intuitive filters that
17
19
 
18
20
  ### 🎥 See It In Action
19
21
 
20
- [Video placeholder]
22
+
23
+
24
+ https://github.com/user-attachments/assets/e609ca50-26fc-46c3-98fe-1651d2bacc7b
25
+
26
+
21
27
 
22
28
  ---
23
29
 
@@ -184,7 +190,7 @@ filterList: [
184
190
 
185
191
  **✨ What you get:**
186
192
 
187
- - 🕐 **Predefined ranges**: Yesterday, Last Week, Last Month, All Past
193
+ - 🕐 **Predefined time ranges**: Yesterday, Last Week, Last Month, All Past
188
194
  - 🔮 **Future options**: Today, Next Week, Next Month, All Future
189
195
  - 🎯 **Custom range**: Pick any from/to dates
190
196
  - 🌍 **Localized**: Date formats adapt to user's language
@@ -233,7 +239,7 @@ filterList: [
233
239
 
234
240
  - ✅ **Checked**: Show only `true` values
235
241
  - ❌ **Unchecked**: Show only `false` values
236
- - ➖ **Indeterminate**: Show all (default)
242
+ - ➖ **Undefined**: Show all (default)
237
243
 
238
244
  Perfect for boolean fields like active/inactive, published/unpublished, etc.
239
245
 
@@ -325,7 +331,7 @@ The magic happens right above your collection table! Here's what your users will
325
331
  | -------------------- | ------ | ------------------------ | -------------------------- |
326
332
  | ✅ **Checked** | `[✓]` | Show only `true` values | "Show only active users" |
327
333
  | ❌ **Unchecked** | `[ ]` | Show only `false` values | "Show only inactive users" |
328
- | ➖ **Indeterminate** | `[-]` | Show all values | "Show everyone" (default) |
334
+ | ➖ **Undefined** | `[-]` | Show all values | "Show everyone" (default) |
329
335
 
330
336
  Perfect for boolean fields like:
331
337
 
@@ -345,10 +351,10 @@ Perfect for boolean fields like:
345
351
 
346
352
  | Aspect | QuickFilter Experience | Regular Filter Experience |
347
353
  | ----------------- | ------------------------------------------- | ------------------------------------------ |
354
+ | **🎯 Simplicity** | Click and filter | Navigate to filter page, fill form, submit |
348
355
  | **⚡ Speed** | Instant results as you click | Wait for page reload every time |
349
356
  | **👀 Clarity** | `🔍 3 Active filters: Status • Role • Date` | Guess what filters are active |
350
- | **💾 Memory** | Filters persist across sessions | Start over every time |
351
- | **🎯 Simplicity** | Click and filter | Navigate to filter page, fill form, submit |
357
+ | **💾 Persistent** | Filters persist across sessions | Start over every time |
352
358
 
353
359
 
354
360
  </details>
@@ -377,11 +383,11 @@ The plugin speaks your users' language! Full translations included for:
377
383
  | Language | Code | RTL Support | Status |
378
384
  | -------------- | ---- | ----------- | ----------- |
379
385
  | 🇺🇸 **English** | `en` | - | ✅ Complete |
386
+ | 🇮🇱 **Hebrew** | `he` | ✅ Yes | ✅ Complete |
380
387
  | 🇸🇦 **Arabic** | `ar` | ✅ Yes | ✅ Complete |
381
388
  | 🇫🇷 **French** | `fr` | - | ✅ Complete |
382
389
  | 🇪🇸 **Spanish** | `es` | - | ✅ Complete |
383
390
  | 🇨🇳 **Chinese** | `zh` | - | ✅ Complete |
384
- | 🇮🇱 **Hebrew** | `he` | ✅ Yes | ✅ Complete |
385
391
 
386
392
  ### 🔧 Adding Custom Languages
387
393
 
@@ -1 +1 @@
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"}
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,gCA4SA,CAAC;AAEF,eAAe,WAAW,CAAC"}
@@ -352,18 +352,19 @@ const QuickFilter = ({ slug, filterList })=>{
352
352
  }
353
353
  // Only update if the query has actually changed to avoid unnecessary updates
354
354
  if (!isEqual(newWhere, query.where)) {
355
- refineListData({
356
- columns: parseColumns(query.columns),
357
- where: newWhere,
358
- page: '1'
359
- });
355
+ if (newWhere) {
356
+ refineListData({
357
+ columns: parseColumns(query.columns),
358
+ where: newWhere,
359
+ page: 1
360
+ });
361
+ }
360
362
  }
361
363
  // eslint-disable-next-line react-hooks/exhaustive-deps
362
364
  }, [
363
365
  filterValues,
364
366
  fields,
365
- i18n.language,
366
- refineListData
367
+ i18n.language
367
368
  ]);
368
369
  // Effect for persisting to localStorage
369
370
  useEffect(()=>{
@@ -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// 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,MAAM;QAC/C,OAAOA,KAAK,CAACC,OAAO,IAAID,KAAK,CAAC,KAAK,IAAIE,OAAOC,MAAM,CAACH,MAAM,CAAC,EAAE,IAAI;IACpE;IACA,OAAOA,SAAS;AAClB;AAEA,4CAA4C;AAC5C,SAASI,iBAAiBC,MAAqB,EAAEC,UAAoB;IACnE,MAAM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AAQ,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"}
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// 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 if(newWhere){\n refineListData({\n columns: parseColumns(query.columns),\n where: newWhere,\n page: 1,\n });\n }\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [filterValues, fields, i18n.language]);\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,O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D;QAAoBtC;KAAa;IAEjD,MAAM2D,gBAAgB;QACpBlE,eAAe,CAAC8C,OAAS,CAACA;IAC5B;IAEA,MAAMqB,uBAAuBnB;IAC7B,MAAMoB,mBAAmBD,qBAAqB1G,MAAM,GAAG;IAEvD,IAAI,CAACzC,OAAOyC,MAAM,EAAE,OAAO;IAE3B,qBACE,MAACoG;QAAIC,WAAU;;0BACb,KAACD;gBAAIQ,OAAO;oBAAEC,UAAU;oBAAYC,KAAK;oBAASC,QAAQ;gBAAM;0BAC9D,cAAA,MAAC/J;oBACCgK,SAAQ;oBACRC,MAAK;oBACLC,SAAST;oBACTJ,WAAW,CAAC,wEAAwE,EAClFM,mBAAmB,qBAAqB,IACxC;;sCAEF,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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shefing/quickfilter",
3
- "version": "1.0.24",
3
+ "version": "1.0.26",
4
4
  "private": false,
5
5
  "bugs": "https://github.com/shefing/payload-tools/issues",
6
6
  "repository": "https://github.com/shefing/payload-tools",