@shefing/quickfilter 1.0.13 → 1.0.17

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.
@@ -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,gBAA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I,qBAAqBW,IAAI,CAAC;;;8CAG7B,KAACF;oCACCD,SAAS,CAACI;wCACRA,EAAEC,eAAe;wCACjBrB;oCACF;oCACAG,WAAU;8CAEV,cAAA,KAAC1J;wCAAE0J,WAAU;;;;2CAIjB,KAACc;4BAAKd,WAAU;sCAAoBhK,SAAS,gBAAgBqC;;wBAG9D2D,4BAAc,KAAC5F;4BAAU4J,WAAU;2CAAe,KAAC7J;4BAAY6J,WAAU;;;;;YAG7EhE,6BAAe,KAAC+D;gBAAIC,WAAW;0BAAsBF;;;;AAG5D;AAEA,eAAerE,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 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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AC8C,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"}
@@ -1,7 +1,7 @@
1
1
  import type { SupportedLocale } from '../../labels';
2
2
  import { DateFilterOption } from '../types/filters-type';
3
- export declare const pastOptionKeys: readonly ["yesterday", "lastWeek", "lastMonth", "allPast"];
4
- export declare const futureOptionKeys: readonly ["today", "nextWeek", "nextMonth", "allFuture"];
3
+ export declare const pastOptionKeys: readonly ["yesterday", "last7Days", "lastWeek", "last30Days", "lastMonth", "allPast"];
4
+ export declare const futureOptionKeys: readonly ["today", "next7Days", "thisWeek", "next30Days", "thisMonth", "allFuture"];
5
5
  export declare const getDateFilterOptions: (locale: SupportedLocale | string) => {
6
6
  pastOptions: DateFilterOption[];
7
7
  futureOptions: DateFilterOption[];
@@ -1 +1 @@
1
- {"version":3,"file":"date-filter-options.d.ts","sourceRoot":"","sources":["../../../src/filters/constants/date-filter-options.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAGzD,eAAO,MAAM,cAAc,4DAA6D,CAAC;AACzF,eAAO,MAAM,gBAAgB,0DAA2D,CAAC;AAazF,eAAO,MAAM,oBAAoB,WAAY,eAAe,GAAG,MAAM;;;CAKpE,CAAC"}
1
+ {"version":3,"file":"date-filter-options.d.ts","sourceRoot":"","sources":["../../../src/filters/constants/date-filter-options.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAY,eAAe,EAAE,MAAM,cAAc,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAGzD,eAAO,MAAM,cAAc,uFAAwF,CAAC;AACpH,eAAO,MAAM,gBAAgB,qFAAsF,CAAC;AAapH,eAAO,MAAM,oBAAoB,WAAY,eAAe,GAAG,MAAM;;;CAKpE,CAAC"}
@@ -2,14 +2,18 @@ import { getLabel } from '../../labels';
2
2
  // Define the option keys for past and future date filters
3
3
  export const pastOptionKeys = [
4
4
  'yesterday',
5
+ 'last7Days',
5
6
  'lastWeek',
7
+ 'last30Days',
6
8
  'lastMonth',
7
9
  'allPast'
8
10
  ];
9
11
  export const futureOptionKeys = [
10
12
  'today',
11
- 'nextWeek',
12
- 'nextMonth',
13
+ 'next7Days',
14
+ 'thisWeek',
15
+ 'next30Days',
16
+ 'thisMonth',
13
17
  'allFuture'
14
18
  ];
15
19
  // Create date filter options dynamically based on locale
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/filters/constants/date-filter-options.ts"],"sourcesContent":["import { getLabel } from '../../labels';\nimport type { SupportedLocale } from '../../labels';\nimport { DateFilterOption } from '../types/filters-type';\n\n// Define the option keys for past and future date filters\nexport const pastOptionKeys = ['yesterday', 'lastWeek', 'lastMonth', 'allPast'] as const;\nexport const futureOptionKeys = ['today', 'nextWeek', 'nextMonth', 'allFuture'] as const;\n\n// Create date filter options dynamically based on locale\nconst createDateFilterOptions = (\n keys: readonly string[],\n locale: SupportedLocale | string,\n): DateFilterOption[] => {\n return keys.map((key) => ({\n value: key,\n label: getLabel(key as any, locale as SupportedLocale),\n }));\n};\n\nexport const getDateFilterOptions = (locale: SupportedLocale | string) => {\n return {\n pastOptions: createDateFilterOptions(pastOptionKeys, locale),\n futureOptions: createDateFilterOptions(futureOptionKeys, locale),\n };\n};\n"],"names":["getLabel","pastOptionKeys","futureOptionKeys","createDateFilterOptions","keys","locale","map","key","value","label","getDateFilterOptions","pastOptions","futureOptions"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,eAAe;AAIxC,0DAA0D;AAC1D,OAAO,MAAMC,iBAAiB;IAAC;IAAa;IAAY;IAAa;CAAU,CAAU;AACzF,OAAO,MAAMC,mBAAmB;IAAC;IAAS;IAAY;IAAa;CAAY,CAAU;AAEzF,yDAAyD;AACzD,MAAMC,0BAA0B,CAC9BC,MACAC;IAEA,OAAOD,KAAKE,GAAG,CAAC,CAACC,MAAS,CAAA;YACxBC,OAAOD;YACPE,OAAOT,SAASO,KAAYF;QAC9B,CAAA;AACF;AAEA,OAAO,MAAMK,uBAAuB,CAACL;IACnC,OAAO;QACLM,aAAaR,wBAAwBF,gBAAgBI;QACrDO,eAAeT,wBAAwBD,kBAAkBG;IAC3D;AACF,EAAE"}
1
+ {"version":3,"sources":["../../../src/filters/constants/date-filter-options.ts"],"sourcesContent":["import { getLabel } from '../../labels';\nimport type { LabelKey, SupportedLocale } from '../../labels';\nimport { DateFilterOption } from '../types/filters-type';\n\n// Define the option keys for past and future date filters\nexport const pastOptionKeys = ['yesterday', 'last7Days', 'lastWeek', 'last30Days', 'lastMonth', 'allPast'] as const;\nexport const futureOptionKeys = ['today', 'next7Days', 'thisWeek', 'next30Days', 'thisMonth', 'allFuture'] as const;\n\n// Create date filter options dynamically based on locale\nconst createDateFilterOptions = (\n keys: readonly string[],\n locale: SupportedLocale | string,\n): DateFilterOption[] => {\n return keys.map((key) => ({\n value: key,\n label: getLabel(key as LabelKey, locale as SupportedLocale),\n }));\n};\n\nexport const getDateFilterOptions = (locale: SupportedLocale | string) => {\n return {\n pastOptions: createDateFilterOptions(pastOptionKeys, locale),\n futureOptions: createDateFilterOptions(futureOptionKeys, locale),\n };\n};\n"],"names":["getLabel","pastOptionKeys","futureOptionKeys","createDateFilterOptions","keys","locale","map","key","value","label","getDateFilterOptions","pastOptions","futureOptions"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,eAAe;AAIxC,0DAA0D;AAC1D,OAAO,MAAMC,iBAAiB;IAAC;IAAa;IAAa;IAAY;IAAc;IAAa;CAAU,CAAU;AACpH,OAAO,MAAMC,mBAAmB;IAAC;IAAS;IAAa;IAAY;IAAc;IAAa;CAAY,CAAU;AAEpH,yDAAyD;AACzD,MAAMC,0BAA0B,CAC9BC,MACAC;IAEA,OAAOD,KAAKE,GAAG,CAAC,CAACC,MAAS,CAAA;YACxBC,OAAOD;YACPE,OAAOT,SAASO,KAAiBF;QACnC,CAAA;AACF;AAEA,OAAO,MAAMK,uBAAuB,CAACL;IACnC,OAAO;QACLM,aAAaR,wBAAwBF,gBAAgBI;QACrDO,eAAeT,wBAAwBD,kBAAkBG;IAC3D;AACF,EAAE"}
@@ -1 +1 @@
1
- {"version":3,"file":"date-helpers.d.ts","sourceRoot":"","sources":["../../../src/filters/utils/date-helpers.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAY,MAAM,cAAc,CAAC;AAEzD,wBAAgB,OAAO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AAC,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAqBhE;AAED,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,MAAM,EACd,MAAM,GAAE,eAAsB,GAC7B;IAAE,IAAI,EAAE,IAAI,GAAG,SAAS,CAAC;IAAC,EAAE,EAAE,IAAI,GAAG,SAAS,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,CA8GvE"}
@@ -109,6 +109,20 @@ export function getDateRangeForOption(option, locale = 'he') {
109
109
  to: lastMonthEnd,
110
110
  description: `(${formatDate(lastMonthStart, 'MM/yyyy')})`
111
111
  };
112
+ case 'last7Days':
113
+ const last7DaysStart = startOfDay(subDays(now, 6));
114
+ return {
115
+ from: last7DaysStart,
116
+ to: endOfDay(now),
117
+ description: `(${formatDate(last7DaysStart, 'dd/MM')} - ${formatDate(now, 'dd/MM/yyyy')})`
118
+ };
119
+ case 'last30Days':
120
+ const last30DaysStart = startOfDay(subDays(now, 29));
121
+ return {
122
+ from: last30DaysStart,
123
+ to: endOfDay(now),
124
+ description: `(${formatDate(last30DaysStart, 'dd/MM')} - ${formatDate(now, 'dd/MM/yyyy')})`
125
+ };
112
126
  case 'allPast':
113
127
  {
114
128
  const yesterday = subDays(now, 1);
@@ -124,7 +138,7 @@ export function getDateRangeForOption(option, locale = 'he') {
124
138
  to: endOfDay(now),
125
139
  description: `(${formatDate(now, 'dd/MM/yyyy')})`
126
140
  };
127
- case 'nextWeek':
141
+ case 'thisWeek':
128
142
  const thisWeekStart = startOfWeek(now, {
129
143
  weekStartsOn: 0
130
144
  });
@@ -136,7 +150,7 @@ export function getDateRangeForOption(option, locale = 'he') {
136
150
  to: thisWeekEnd,
137
151
  description: `(${formatDate(thisWeekStart, 'dd/MM')} - ${formatDate(thisWeekEnd, 'dd/MM/yyyy')})`
138
152
  };
139
- case 'nextMonth':
153
+ case 'thisMonth':
140
154
  const thisMonthStart = startOfMonth(now);
141
155
  const thisMonthEnd = endOfMonth(now);
142
156
  return {
@@ -144,6 +158,20 @@ export function getDateRangeForOption(option, locale = 'he') {
144
158
  to: thisMonthEnd,
145
159
  description: `(${formatDate(thisMonthStart, 'MM/yyyy')})`
146
160
  };
161
+ case 'next7Days':
162
+ const next7DaysEnd = endOfDay(addDays(now, 6));
163
+ return {
164
+ from: startOfDay(now),
165
+ to: next7DaysEnd,
166
+ description: `(${formatDate(now, 'dd/MM')} - ${formatDate(next7DaysEnd, 'dd/MM/yyyy')})`
167
+ };
168
+ case 'next30Days':
169
+ const next30DaysEnd = endOfDay(addDays(now, 29));
170
+ return {
171
+ from: startOfDay(now),
172
+ to: next30DaysEnd,
173
+ description: `(${formatDate(now, 'dd/MM')} - ${formatDate(next30DaysEnd, 'dd/MM/yyyy')})`
174
+ };
147
175
  case 'allFuture':
148
176
  return {
149
177
  from: startOfDay(now),
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/filters/utils/date-helpers.ts"],"sourcesContent":["// Custom date utilities to replace date-fns\n\nimport { SupportedLocale, getLabel } from '../../labels';\n\nexport function addDays(date: Date, days: number): Date {\n const result = new Date(date);\n result.setDate(result.getDate() + days);\n return result;\n}\n\nexport function subDays(date: Date, days: number): Date {\n return addDays(date, -days);\n}\n\nexport function addWeeks(date: Date, weeks: number): Date {\n return addDays(date, weeks * 7);\n}\n\nexport function subWeeks(date: Date, weeks: number): Date {\n return addWeeks(date, -weeks);\n}\n\nexport function addMonths(date: Date, months: number): Date {\n const result = new Date(date);\n result.setMonth(result.getMonth() + months);\n return result;\n}\n\nexport function subMonths(date: Date, months: number): Date {\n return addMonths(date, -months);\n}\n\nexport function startOfDay(date: Date): Date {\n const result = new Date(date);\n result.setHours(0, 0, 0, 0);\n return result;\n}\n\nexport function endOfDay(date: Date): Date {\n const result = new Date(date);\n result.setHours(23, 59, 59, 999);\n return result;\n}\n\nexport function startOfWeek(date: Date, options: { weekStartsOn?: number } = {}): Date {\n const { weekStartsOn = 0 } = options;\n const result = new Date(date);\n const day = result.getDay();\n const diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;\n result.setDate(result.getDate() - diff);\n return startOfDay(result);\n}\n\nexport function endOfWeek(date: Date, options: { weekStartsOn?: number } = {}): Date {\n const { weekStartsOn = 0 } = options;\n const result = startOfWeek(date, { weekStartsOn });\n result.setDate(result.getDate() + 6);\n return endOfDay(result);\n}\n\nexport function startOfMonth(date: Date): Date {\n const result = new Date(date);\n result.setDate(1);\n return startOfDay(result);\n}\n\nexport function endOfMonth(date: Date): Date {\n const result = new Date(date);\n result.setMonth(result.getMonth() + 1, 0);\n return endOfDay(result);\n}\n\nexport function formatDate(date: Date, formatStr: string): string {\n const day = date.getDate().toString().padStart(2, '0');\n const month = (date.getMonth() + 1).toString().padStart(2, '0');\n const year = date.getFullYear().toString();\n\n switch (formatStr) {\n case 'dd/MM/yyyy':\n return `${day}/${month}/${year}`;\n case 'dd/MM':\n return `${day}/${month}`;\n case 'MM/yyyy':\n return `${month}/${year}`;\n case 'PPP':\n return date.toLocaleDateString('en-US', {\n year: 'numeric',\n month: 'long',\n day: 'numeric',\n });\n default:\n return date.toLocaleDateString();\n }\n}\n\nexport function getDateRangeForOption(\n option: string,\n locale: SupportedLocale = 'he',\n): { from: Date | undefined; to: Date | undefined; description: string } {\n const now = new Date();\n\n switch (option) {\n case 'yesterday':\n const yesterday = subDays(now, 1);\n return {\n from: startOfDay(yesterday),\n to: endOfDay(yesterday),\n description: `(${formatDate(yesterday, 'dd/MM/yyyy')})`,\n };\n\n case 'lastWeek':\n const lastWeekStart = startOfWeek(subWeeks(now, 1), { weekStartsOn: 0 });\n const lastWeekEnd = endOfWeek(subWeeks(now, 1), { weekStartsOn: 0 });\n return {\n from: lastWeekStart,\n to: lastWeekEnd,\n description: `(${formatDate(lastWeekStart, 'dd/MM')} - ${formatDate(lastWeekEnd, 'dd/MM/yyyy')})`,\n };\n\n case 'lastMonth':\n const lastMonthStart = startOfMonth(subMonths(now, 1));\n const lastMonthEnd = endOfMonth(subMonths(now, 1));\n return {\n from: lastMonthStart,\n to: lastMonthEnd,\n description: `(${formatDate(lastMonthStart, 'MM/yyyy')})`,\n };\n\n case 'allPast': {\n const yesterday = subDays(now, 1);\n return {\n from: undefined,\n to: endOfDay(yesterday),\n description: `(${getLabel('allPast', locale)})`,\n };\n }\n\n case 'today':\n return {\n from: startOfDay(now),\n to: endOfDay(now),\n description: `(${formatDate(now, 'dd/MM/yyyy')})`,\n };\n\n case 'nextWeek':\n const thisWeekStart = startOfWeek(now, { weekStartsOn: 0 });\n const thisWeekEnd = endOfWeek(now, { weekStartsOn: 0 });\n return {\n from: thisWeekStart,\n to: thisWeekEnd,\n description: `(${formatDate(thisWeekStart, 'dd/MM')} - ${formatDate(thisWeekEnd, 'dd/MM/yyyy')})`,\n };\n\n case 'nextMonth':\n const thisMonthStart = startOfMonth(now);\n const thisMonthEnd = endOfMonth(now);\n return {\n from: thisMonthStart,\n to: thisMonthEnd,\n description: `(${formatDate(thisMonthStart, 'MM/yyyy')})`,\n };\n\n case 'allFuture':\n return {\n from: startOfDay(now),\n to: undefined,\n description: `(${getLabel('allFuture', locale)})`,\n };\n\n default:\n return {\n from: startOfDay(now),\n to: endOfDay(now),\n description: '',\n };\n }\n}\n"],"names":["getLabel","addDays","date","days","result","Date","setDate","getDate","subDays","addWeeks","weeks","subWeeks","addMonths","months","setMonth","getMonth","subMonths","startOfDay","setHours","endOfDay","startOfWeek","options","weekStartsOn","day","getDay","diff","endOfWeek","startOfMonth","endOfMonth","formatDate","formatStr","toString","padStart","month","year","getFullYear","toLocaleDateString","getDateRangeForOption","option","locale","now","yesterday","from","to","description","lastWeekStart","lastWeekEnd","lastMonthStart","lastMonthEnd","undefined","thisWeekStart","thisWeekEnd","thisMonthStart","thisMonthEnd"],"mappings":"AAAA,4CAA4C;AAE5C,SAA0BA,QAAQ,QAAQ,eAAe;AAEzD,OAAO,SAASC,QAAQC,IAAU,EAAEC,IAAY;IAC9C,MAAMC,SAAS,IAAIC,KAAKH;IACxBE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a,eAAezB,WAAWY;YAChC,OAAO;gBACLE,MAAMU;gBACNT,IAAIU;gBACJT,aAAa,CAAC,CAAC,EAAEf,WAAWuB,gBAAgB,WAAW,CAAC,CAAC;YAC3D;QAEF,KAAK;YACH,OAAO;gBACLV,MAAMzB,WAAWuB;gBACjBG,IAAIM;gBACJL,aAAa,CAAC,CAAC,EAAE5C,SAAS,aAAauC,QAAQ,CAAC,CAAC;YACnD;QAEF;YACE,OAAO;gBACLG,MAAMzB,WAAWuB;gBACjBG,IAAIxB,SAASqB;gBACbI,aAAa;YACf;IACJ;AACF"}
1
+ {"version":3,"sources":["../../../src/filters/utils/date-helpers.ts"],"sourcesContent":["// Custom date utilities to replace date-fns\n\nimport { SupportedLocale, getLabel } from '../../labels';\n\nexport function addDays(date: Date, days: number): Date {\n const result = new Date(date);\n result.setDate(result.getDate() + days);\n return result;\n}\n\nexport function subDays(date: Date, days: number): Date {\n return addDays(date, -days);\n}\n\nexport function addWeeks(date: Date, weeks: number): Date {\n return addDays(date, weeks * 7);\n}\n\nexport function subWeeks(date: Date, weeks: number): Date {\n return addWeeks(date, -weeks);\n}\n\nexport function addMonths(date: Date, months: number): Date {\n const result = new Date(date);\n result.setMonth(result.getMonth() + months);\n return result;\n}\n\nexport function subMonths(date: Date, months: number): Date {\n return addMonths(date, -months);\n}\n\nexport function startOfDay(date: Date): Date {\n const result = new Date(date);\n result.setHours(0, 0, 0, 0);\n return result;\n}\n\nexport function endOfDay(date: Date): Date {\n const result = new Date(date);\n result.setHours(23, 59, 59, 999);\n return result;\n}\n\nexport function startOfWeek(date: Date, options: { weekStartsOn?: number } = {}): Date {\n const { weekStartsOn = 0 } = options;\n const result = new Date(date);\n const day = result.getDay();\n const diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;\n result.setDate(result.getDate() - diff);\n return startOfDay(result);\n}\n\nexport function endOfWeek(date: Date, options: { weekStartsOn?: number } = {}): Date {\n const { weekStartsOn = 0 } = options;\n const result = startOfWeek(date, { weekStartsOn });\n result.setDate(result.getDate() + 6);\n return endOfDay(result);\n}\n\nexport function startOfMonth(date: Date): Date {\n const result = new Date(date);\n result.setDate(1);\n return startOfDay(result);\n}\n\nexport function endOfMonth(date: Date): Date {\n const result = new Date(date);\n result.setMonth(result.getMonth() + 1, 0);\n return endOfDay(result);\n}\n\nexport function formatDate(date: Date, formatStr: string): string {\n const day = date.getDate().toString().padStart(2, '0');\n const month = (date.getMonth() + 1).toString().padStart(2, '0');\n const year = date.getFullYear().toString();\n\n switch (formatStr) {\n case 'dd/MM/yyyy':\n return `${day}/${month}/${year}`;\n case 'dd/MM':\n return `${day}/${month}`;\n case 'MM/yyyy':\n return `${month}/${year}`;\n case 'PPP':\n return date.toLocaleDateString('en-US', {\n year: 'numeric',\n month: 'long',\n day: 'numeric',\n });\n default:\n return date.toLocaleDateString();\n }\n}\n\nexport function getDateRangeForOption(\n option: string,\n locale: SupportedLocale = 'he',\n): { from: Date | undefined; to: Date | undefined; description: string } {\n const now = new Date();\n\n switch (option) {\n case 'yesterday':\n const yesterday = subDays(now, 1);\n return {\n from: startOfDay(yesterday),\n to: endOfDay(yesterday),\n description: `(${formatDate(yesterday, 'dd/MM/yyyy')})`,\n };\n\n case 'lastWeek':\n const lastWeekStart = startOfWeek(subWeeks(now, 1), { weekStartsOn: 0 });\n const lastWeekEnd = endOfWeek(subWeeks(now, 1), { weekStartsOn: 0 });\n return {\n from: lastWeekStart,\n to: lastWeekEnd,\n description: `(${formatDate(lastWeekStart, 'dd/MM')} - ${formatDate(lastWeekEnd, 'dd/MM/yyyy')})`,\n };\n\n case 'lastMonth':\n const lastMonthStart = startOfMonth(subMonths(now, 1));\n const lastMonthEnd = endOfMonth(subMonths(now, 1));\n return {\n from: lastMonthStart,\n to: lastMonthEnd,\n description: `(${formatDate(lastMonthStart, 'MM/yyyy')})`,\n };\n\n case 'last7Days':\n const last7DaysStart = startOfDay(subDays(now, 6));\n return {\n from: last7DaysStart,\n to: endOfDay(now),\n description: `(${formatDate(last7DaysStart, 'dd/MM')} - ${formatDate(now, 'dd/MM/yyyy')})`,\n };\n\n case 'last30Days':\n const last30DaysStart = startOfDay(subDays(now, 29));\n return {\n from: last30DaysStart,\n to: endOfDay(now),\n description: `(${formatDate(last30DaysStart, 'dd/MM')} - ${formatDate(now, 'dd/MM/yyyy')})`,\n };\n\n case 'allPast': {\n const yesterday = subDays(now, 1);\n return {\n from: undefined,\n to: endOfDay(yesterday),\n description: `(${getLabel('allPast', locale)})`,\n };\n }\n\n case 'today':\n return {\n from: startOfDay(now),\n to: endOfDay(now),\n description: `(${formatDate(now, 'dd/MM/yyyy')})`,\n };\n\n case 'thisWeek':\n const thisWeekStart = startOfWeek(now, { weekStartsOn: 0 });\n const thisWeekEnd = endOfWeek(now, { weekStartsOn: 0 });\n return {\n from: thisWeekStart,\n to: thisWeekEnd,\n description: `(${formatDate(thisWeekStart, 'dd/MM')} - ${formatDate(thisWeekEnd, 'dd/MM/yyyy')})`,\n };\n\n case 'thisMonth':\n const thisMonthStart = startOfMonth(now);\n const thisMonthEnd = endOfMonth(now);\n return {\n from: thisMonthStart,\n to: thisMonthEnd,\n description: `(${formatDate(thisMonthStart, 'MM/yyyy')})`,\n };\n\n case 'next7Days':\n const next7DaysEnd = endOfDay(addDays(now, 6));\n return {\n from: startOfDay(now),\n to: next7DaysEnd,\n description: `(${formatDate(now, 'dd/MM')} - ${formatDate(next7DaysEnd, 'dd/MM/yyyy')})`,\n };\n\n case 'next30Days':\n const next30DaysEnd = endOfDay(addDays(now, 29));\n return {\n from: startOfDay(now),\n to: next30DaysEnd,\n description: `(${formatDate(now, 'dd/MM')} - ${formatDate(next30DaysEnd, 'dd/MM/yyyy')})`,\n };\n\n case 'allFuture':\n return {\n from: startOfDay(now),\n to: undefined,\n description: `(${getLabel('allFuture', locale)})`,\n };\n\n default:\n return {\n from: startOfDay(now),\n to: endOfDay(now),\n description: '',\n };\n }\n}\n"],"names":["getLabel","addDays","date","days","result","Date","setDate","getDate","subDays","addWeeks","weeks","subWeeks","addMonths","months","setMonth","getMonth","subMonths","startOfDay","setHours","endOfDay","startOfWeek","options","weekStartsOn","day","getDay","diff","endOfWeek","startOfMonth","endOfMonth","formatDate","formatStr","toString","padStart","month","year","getFullYear","toLocaleDateString","getDateRangeForOption","option","locale","now","yesterday","from","to","description","lastWeekStart","lastWeekEnd","lastMonthStart","lastMonthEnd","last7DaysStart","last30DaysStart","undefined","thisWeekStart","thisWeekEnd","thisMonthStart","thisMonthEnd","next7DaysEnd","next30DaysEnd"],"mappings":"AAAA,4CAA4C;AAE5C,SAA0BA,QAAQ,QAAQ,eAAe;AAEzD,OAAO,SAASC,QAAQC,IAAU,EAAEC,IAAY;IAC9C,MAAMC,SAAS,IAAIC,KAAKH;IACxBE,OAAOE,OAAO,CAACF,OAAOG,OAAO,KAAKJ;IAClC,OAAOC;AACT;AAEA,OAAO,SAASI,QAAQN,IAAU,EAAEC,IAAY;IAC9C,OAAOF,QAAQC,MAAM,CAACC;AACxB;AAEA,OAAO,SAASM,SAASP,IAAU,EAAEQ,KAAa;IAChD,OAAOT,QAAQC,MAAMQ,QAAQ;AAC/B;AAEA,OAAO,SAASC,SAAST,IAAU,EAAEQ,KAAa;IAChD,OAAOD,SAASP,MAAM,CAACQ;AACzB;AAEA,OAAO,SAASE,UAAUV,IAAU,EAAEW,MAAc;IAClD,MAAMT,SAAS,IAAIC,KAAKH;IACxBE,OAAOU,QAAQ,CAACV,OAAOW,QAAQ,KAAKF;IACpC,OAAOT;AACT;AAEA,OAAO,SAASY,UAAUd,IAAU,EAAEW,MAAc;IAClD,OAAOD,UAAUV,MAAM,CAACW;AAC1B;AAEA,OAAO,SAASI,WAAWf,IAAU;IACnC,MAAME,SAAS,IAAIC,KAAKH;IACxBE,OAAOc,QAAQ,CAAC,GAAG,GAAG,GAAG;IACzB,OAAOd;AACT;AAEA,OAAO,SAASe,SAASjB,IAAU;IACjC,MAAME,SAAS,IAAIC,KAAKH;IACxBE,OAAOc,QAAQ,CAAC,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;YAC1F;QAEF,KAAK;YACH,MAAMC,gBAAgBtC,SAASlB,QAAQuC,KAAK;YAC5C,OAAO;gBACLE,MAAMzB,WAAWuB;gBACjBG,IAAIc;gBACJb,aAAa,CAAC,CAAC,EAAEf,WAAWW,KAAK,SAAS,GAAG,EAAEX,WAAW4B,eAAe,cAAc,CAAC,CAAC;YAC3F;QAEF,KAAK;YACH,OAAO;gBACLf,MAAMzB,WAAWuB;gBACjBG,IAAIQ;gBACJP,aAAa,CAAC,CAAC,EAAE5C,SAAS,aAAauC,QAAQ,CAAC,CAAC;YACnD;QAEF;YACE,OAAO;gBACLG,MAAMzB,WAAWuB;gBACjBG,IAAIxB,SAASqB;gBACbI,aAAa;YACf;IACJ;AACF"}
package/dist/labels.d.ts CHANGED
@@ -21,10 +21,14 @@ export declare const PLUGIN_LABELS: {
21
21
  readonly yesterday: "Yesterday";
22
22
  readonly lastWeek: "Last Week";
23
23
  readonly lastMonth: "Last Month";
24
+ readonly last7Days: "Last 7 Days";
25
+ readonly last30Days: "Last 30 Days";
24
26
  readonly allPast: "All Past";
25
27
  readonly today: "Today";
26
- readonly nextWeek: "Next Week";
27
- readonly nextMonth: "Next Month";
28
+ readonly thisWeek: "This Week";
29
+ readonly thisMonth: "This Month";
30
+ readonly next7Days: "Next 7 Days";
31
+ readonly next30Days: "Next 30 Days";
28
32
  readonly allFuture: "All Future";
29
33
  };
30
34
  readonly ar: {
@@ -48,10 +52,14 @@ export declare const PLUGIN_LABELS: {
48
52
  readonly yesterday: "أمس";
49
53
  readonly lastWeek: "الأسبوع الماضي";
50
54
  readonly lastMonth: "الشهر الماضي";
55
+ readonly last7Days: "آخر 7 أيام";
56
+ readonly last30Days: "آخر 30 يومًا";
51
57
  readonly allPast: "كل الماضي";
52
58
  readonly today: "اليوم";
53
- readonly nextWeek: "الأسبوع القادم";
54
- readonly nextMonth: "الشهر القادم";
59
+ readonly thisWeek: "هذا الأسبوع";
60
+ readonly thisMonth: "هذا الشهر";
61
+ readonly next7Days: "الـ 7 أيام القادمة";
62
+ readonly next30Days: "الـ 30 يومًا القادمة";
55
63
  readonly allFuture: "كل المستقبل";
56
64
  };
57
65
  readonly fr: {
@@ -75,10 +83,14 @@ export declare const PLUGIN_LABELS: {
75
83
  readonly yesterday: "Hier";
76
84
  readonly lastWeek: "Semaine dernière";
77
85
  readonly lastMonth: "Mois dernier";
86
+ readonly last7Days: "7 derniers jours";
87
+ readonly last30Days: "30 derniers jours";
78
88
  readonly allPast: "Tout le passé";
79
89
  readonly today: "Aujourd’hui";
80
- readonly nextWeek: "Semaine prochaine";
81
- readonly nextMonth: "Mois prochain";
90
+ readonly thisWeek: "Cette semaine";
91
+ readonly thisMonth: "Ce mois";
92
+ readonly next7Days: "7 prochains jours";
93
+ readonly next30Days: "30 prochains jours";
82
94
  readonly allFuture: "Tout le futur";
83
95
  };
84
96
  readonly es: {
@@ -102,10 +114,14 @@ export declare const PLUGIN_LABELS: {
102
114
  readonly yesterday: "Ayer";
103
115
  readonly lastWeek: "Semana pasada";
104
116
  readonly lastMonth: "Mes pasado";
117
+ readonly last7Days: "Últimos 7 días";
118
+ readonly last30Days: "Últimos 30 días";
105
119
  readonly allPast: "Todo el pasado";
106
120
  readonly today: "Hoy";
107
- readonly nextWeek: "Próxima semana";
108
- readonly nextMonth: "Próximo mes";
121
+ readonly thisWeek: "Esta semana";
122
+ readonly thisMonth: "Este mes";
123
+ readonly next7Days: "Próximos 7 días";
124
+ readonly next30Days: "Próximos 30 días";
109
125
  readonly allFuture: "Todo el futuro";
110
126
  };
111
127
  readonly zh: {
@@ -129,10 +145,14 @@ export declare const PLUGIN_LABELS: {
129
145
  readonly yesterday: "昨天";
130
146
  readonly lastWeek: "上周";
131
147
  readonly lastMonth: "上个月";
148
+ readonly last7Days: "过去7天";
149
+ readonly last30Days: "过去30天";
132
150
  readonly allPast: "所有过去";
133
151
  readonly today: "今天";
134
- readonly nextWeek: "下周";
135
- readonly nextMonth: "下个月";
152
+ readonly thisWeek: "本周";
153
+ readonly thisMonth: "本月";
154
+ readonly next7Days: "未来7天";
155
+ readonly next30Days: "未来30天";
136
156
  readonly allFuture: "所有未来";
137
157
  };
138
158
  readonly he: {
@@ -156,10 +176,14 @@ export declare const PLUGIN_LABELS: {
156
176
  readonly yesterday: "אתמול";
157
177
  readonly lastWeek: "שבוע שעבר";
158
178
  readonly lastMonth: "חודש שעבר";
179
+ readonly last7Days: "7 ימים אחרונים";
180
+ readonly last30Days: "30 ימים אחרונים";
159
181
  readonly allPast: "בעבר";
160
182
  readonly today: "היום";
161
- readonly nextWeek: "השבוע הבא";
162
- readonly nextMonth: "החודש הבא";
183
+ readonly thisWeek: "השבוע";
184
+ readonly thisMonth: "החודש";
185
+ readonly next7Days: "7 ימים הבאים";
186
+ readonly next30Days: "30 ימים הבאים";
163
187
  readonly allFuture: "בעתיד";
164
188
  };
165
189
  };
@@ -186,10 +210,14 @@ export declare const getLabels: (locale?: SupportedLocale) => {
186
210
  readonly yesterday: "Yesterday";
187
211
  readonly lastWeek: "Last Week";
188
212
  readonly lastMonth: "Last Month";
213
+ readonly last7Days: "Last 7 Days";
214
+ readonly last30Days: "Last 30 Days";
189
215
  readonly allPast: "All Past";
190
216
  readonly today: "Today";
191
- readonly nextWeek: "Next Week";
192
- readonly nextMonth: "Next Month";
217
+ readonly thisWeek: "This Week";
218
+ readonly thisMonth: "This Month";
219
+ readonly next7Days: "Next 7 Days";
220
+ readonly next30Days: "Next 30 Days";
193
221
  readonly allFuture: "All Future";
194
222
  } | {
195
223
  readonly quickFilters: "فلاتر سريعة";
@@ -212,10 +240,14 @@ export declare const getLabels: (locale?: SupportedLocale) => {
212
240
  readonly yesterday: "أمس";
213
241
  readonly lastWeek: "الأسبوع الماضي";
214
242
  readonly lastMonth: "الشهر الماضي";
243
+ readonly last7Days: "آخر 7 أيام";
244
+ readonly last30Days: "آخر 30 يومًا";
215
245
  readonly allPast: "كل الماضي";
216
246
  readonly today: "اليوم";
217
- readonly nextWeek: "الأسبوع القادم";
218
- readonly nextMonth: "الشهر القادم";
247
+ readonly thisWeek: "هذا الأسبوع";
248
+ readonly thisMonth: "هذا الشهر";
249
+ readonly next7Days: "الـ 7 أيام القادمة";
250
+ readonly next30Days: "الـ 30 يومًا القادمة";
219
251
  readonly allFuture: "كل المستقبل";
220
252
  } | {
221
253
  readonly quickFilters: "Filtres rapides";
@@ -238,10 +270,14 @@ export declare const getLabels: (locale?: SupportedLocale) => {
238
270
  readonly yesterday: "Hier";
239
271
  readonly lastWeek: "Semaine dernière";
240
272
  readonly lastMonth: "Mois dernier";
273
+ readonly last7Days: "7 derniers jours";
274
+ readonly last30Days: "30 derniers jours";
241
275
  readonly allPast: "Tout le passé";
242
276
  readonly today: "Aujourd’hui";
243
- readonly nextWeek: "Semaine prochaine";
244
- readonly nextMonth: "Mois prochain";
277
+ readonly thisWeek: "Cette semaine";
278
+ readonly thisMonth: "Ce mois";
279
+ readonly next7Days: "7 prochains jours";
280
+ readonly next30Days: "30 prochains jours";
245
281
  readonly allFuture: "Tout le futur";
246
282
  } | {
247
283
  readonly quickFilters: "Filtros rápidos";
@@ -264,10 +300,14 @@ export declare const getLabels: (locale?: SupportedLocale) => {
264
300
  readonly yesterday: "Ayer";
265
301
  readonly lastWeek: "Semana pasada";
266
302
  readonly lastMonth: "Mes pasado";
303
+ readonly last7Days: "Últimos 7 días";
304
+ readonly last30Days: "Últimos 30 días";
267
305
  readonly allPast: "Todo el pasado";
268
306
  readonly today: "Hoy";
269
- readonly nextWeek: "Próxima semana";
270
- readonly nextMonth: "Próximo mes";
307
+ readonly thisWeek: "Esta semana";
308
+ readonly thisMonth: "Este mes";
309
+ readonly next7Days: "Próximos 7 días";
310
+ readonly next30Days: "Próximos 30 días";
271
311
  readonly allFuture: "Todo el futuro";
272
312
  } | {
273
313
  readonly quickFilters: "快速筛选";
@@ -290,10 +330,14 @@ export declare const getLabels: (locale?: SupportedLocale) => {
290
330
  readonly yesterday: "昨天";
291
331
  readonly lastWeek: "上周";
292
332
  readonly lastMonth: "上个月";
333
+ readonly last7Days: "过去7天";
334
+ readonly last30Days: "过去30天";
293
335
  readonly allPast: "所有过去";
294
336
  readonly today: "今天";
295
- readonly nextWeek: "下周";
296
- readonly nextMonth: "下个月";
337
+ readonly thisWeek: "本周";
338
+ readonly thisMonth: "本月";
339
+ readonly next7Days: "未来7天";
340
+ readonly next30Days: "未来30天";
297
341
  readonly allFuture: "所有未来";
298
342
  } | {
299
343
  readonly quickFilters: "סינון מהיר";
@@ -316,10 +360,14 @@ export declare const getLabels: (locale?: SupportedLocale) => {
316
360
  readonly yesterday: "אתמול";
317
361
  readonly lastWeek: "שבוע שעבר";
318
362
  readonly lastMonth: "חודש שעבר";
363
+ readonly last7Days: "7 ימים אחרונים";
364
+ readonly last30Days: "30 ימים אחרונים";
319
365
  readonly allPast: "בעבר";
320
366
  readonly today: "היום";
321
- readonly nextWeek: "השבוע הבא";
322
- readonly nextMonth: "החודש הבא";
367
+ readonly thisWeek: "השבוע";
368
+ readonly thisMonth: "החודש";
369
+ readonly next7Days: "7 ימים הבאים";
370
+ readonly next30Days: "30 ימים הבאים";
323
371
  readonly allFuture: "בעתיד";
324
372
  };
325
373
  export declare const getLabel: (key: LabelKey, locale?: SupportedLocale) => string;
@@ -1 +1 @@
1
- {"version":3,"file":"labels.d.ts","sourceRoot":"","sources":["../src/labels.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,iBAAiB,UAAuC,CAAC;AAEtE,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqKhB,CAAC;AACX,MAAM,MAAM,eAAe,GAAG,MAAM,OAAO,aAAa,CAAC;AACzD,MAAM,MAAM,QAAQ,GAAG,MAAM,OAAO,aAAa,CAAC,E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