@shefing/quickfilter 1.0.17 → 1.0.20
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/dist/filters/components/date-filter.d.ts.map +1 -1
- package/dist/filters/components/date-filter.js +9 -8
- package/dist/filters/components/date-filter.js.map +1 -1
- package/dist/filters/constants/date-filter-options.d.ts +2 -2
- package/dist/filters/constants/date-filter-options.d.ts.map +1 -1
- package/dist/filters/constants/date-filter-options.js +4 -4
- package/dist/filters/constants/date-filter-options.js.map +1 -1
- package/dist/filters/utils/date-helpers.js +6 -6
- package/dist/filters/utils/date-helpers.js.map +1 -1
- package/dist/labels.d.ts +12 -0
- package/dist/labels.d.ts.map +1 -1
- package/dist/labels.js +6 -0
- package/dist/labels.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date-filter.d.ts","sourceRoot":"","sources":["../../../src/filters/components/date-filter.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,eAAe,EAAa,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAW3E,UAAU,eAAe;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB,QAAQ,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,CAAC;IAC3C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CAC7B;AAED,wBAAgB,UAAU,CAAC,EACzB,KAAK,EACL,KAAK,EACL,QAAQ,EACR,MAAyC,EACzC,SAAS,EACT,KAAK,GACN,EAAE,eAAe,+
|
|
1
|
+
{"version":3,"file":"date-filter.d.ts","sourceRoot":"","sources":["../../../src/filters/components/date-filter.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,eAAe,EAAa,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAW3E,UAAU,eAAe;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB,QAAQ,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,CAAC;IAC3C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CAC7B;AAED,wBAAgB,UAAU,CAAC,EACzB,KAAK,EACL,KAAK,EACL,QAAQ,EACR,MAAyC,EACzC,SAAS,EACT,KAAK,GACN,EAAE,eAAe,+BAmVjB"}
|
|
@@ -43,6 +43,7 @@ export function DateFilter({ label, value, onChange, locale = {
|
|
|
43
43
|
selectDate: getLabel('selectDate', localeCode),
|
|
44
44
|
past: getLabel('past', localeCode),
|
|
45
45
|
future: getLabel('future', localeCode),
|
|
46
|
+
presentFuture: getLabel('presentFuture', localeCode),
|
|
46
47
|
custom: getLabel('customRange', localeCode),
|
|
47
48
|
apply: getLabel('apply', localeCode),
|
|
48
49
|
cancel: getLabel('cancel', localeCode)
|
|
@@ -104,9 +105,9 @@ export function DateFilter({ label, value, onChange, locale = {
|
|
|
104
105
|
if (from && to) {
|
|
105
106
|
return `${formatDate(from, 'dd/MM/yyyy')}-${formatDate(to, 'dd/MM/yyyy')}`;
|
|
106
107
|
} else if (from) {
|
|
107
|
-
return `${labels.from}
|
|
108
|
+
return `${labels.from}:${formatDate(from, 'dd/MM/yyyy')}`;
|
|
108
109
|
} else if (to) {
|
|
109
|
-
return `${labels.to}
|
|
110
|
+
return `${labels.to}:${formatDate(to, 'dd/MM/yyyy')}`;
|
|
110
111
|
}
|
|
111
112
|
return labels.custom;
|
|
112
113
|
}
|
|
@@ -117,7 +118,7 @@ export function DateFilter({ label, value, onChange, locale = {
|
|
|
117
118
|
];
|
|
118
119
|
const option = allOptions.find((opt)=>opt.value === internalValue.predefinedValue);
|
|
119
120
|
const dateRange = getDateRangeForOption(internalValue.predefinedValue, locale.code);
|
|
120
|
-
return `${option?.label || internalValue.predefinedValue}
|
|
121
|
+
return `${option?.label || internalValue.predefinedValue}${dateRange.description}`;
|
|
121
122
|
}
|
|
122
123
|
return labels.selectOption;
|
|
123
124
|
};
|
|
@@ -178,7 +179,7 @@ export function DateFilter({ label, value, onChange, locale = {
|
|
|
178
179
|
variant: "outline",
|
|
179
180
|
role: "combobox",
|
|
180
181
|
"aria-expanded": isOpen,
|
|
181
|
-
className: "useTw w-full justify-between bg-background relative min-w-70",
|
|
182
|
+
className: "useTw w-full justify-between bg-background relative min-w-70 px-2",
|
|
182
183
|
children: [
|
|
183
184
|
/*#__PURE__*/ _jsx("span", {
|
|
184
185
|
className: `useTw truncate ${isRTL && 'text-right'}`,
|
|
@@ -203,11 +204,11 @@ export function DateFilter({ label, value, onChange, locale = {
|
|
|
203
204
|
children: [
|
|
204
205
|
/*#__PURE__*/ _jsx("div", {
|
|
205
206
|
className: cn('text-sm font-semibold text-muted-foreground mb-2', isRTL && 'text-right'),
|
|
206
|
-
children: labels.
|
|
207
|
+
children: labels.past
|
|
207
208
|
}),
|
|
208
209
|
/*#__PURE__*/ _jsx("div", {
|
|
209
210
|
className: "space-y-0.5",
|
|
210
|
-
children:
|
|
211
|
+
children: pastOptions.map((option)=>/*#__PURE__*/ _jsx("div", {
|
|
211
212
|
children: renderOptionWithDate(option)
|
|
212
213
|
}, option.value))
|
|
213
214
|
})
|
|
@@ -218,11 +219,11 @@ export function DateFilter({ label, value, onChange, locale = {
|
|
|
218
219
|
children: [
|
|
219
220
|
/*#__PURE__*/ _jsx("div", {
|
|
220
221
|
className: cn('text-sm font-semibold text-muted-foreground mb-2', isRTL && 'text-right'),
|
|
221
|
-
children: labels.
|
|
222
|
+
children: labels.presentFuture
|
|
222
223
|
}),
|
|
223
224
|
/*#__PURE__*/ _jsx("div", {
|
|
224
225
|
className: "space-y-0.5",
|
|
225
|
-
children:
|
|
226
|
+
children: futureOptions.map((option)=>/*#__PURE__*/ _jsx("div", {
|
|
226
227
|
children: renderOptionWithDate(option)
|
|
227
228
|
}, option.value))
|
|
228
229
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/filters/components/date-filter.tsx"],"sourcesContent":["'use client';\n\nimport { useEffect, useState } from 'react';\nimport { CalendarIcon, ChevronDown, X } from 'lucide-react';\n\nimport { formatDate, getDateRangeForOption } from '../utils/date-helpers';\nimport { DateFilterValue, DateRange, Locale } from '../types/filters-type';\nimport { Button } from '../../ui/button';\nimport { cn } from '../../lib/utils';\nimport { Label } from '../../ui/label';\nimport { Popover, PopoverContent, PopoverTrigger } from '../../ui/popover';\nimport { Separator } from '../../ui/separator';\nimport { Calendar } from '../../ui/calendar';\nimport { getDateFilterOptions } from '../constants/date-filter-options';\nimport { SupportedLocale, getLabel } from '../../labels';\n\n\ninterface DateFilterProps {\n label?: string;\n value?: DateFilterValue;\n onChange: (value: DateFilterValue) => void;\n locale?: Locale;\n className?: string;\n style?: React.CSSProperties;\n}\n\nexport function DateFilter({\n label,\n value,\n onChange,\n locale = { code: 'he', direction: 'rtl' },\n className,\n style,\n}: DateFilterProps) {\n const [internalValue, setInternalValue] = useState<DateFilterValue | undefined>(value);\n const [customRange, setCustomRange] = useState<DateRange>({ from: undefined, to: undefined });\n const [showCustom, setShowCustom] = useState(false);\n const [isOpen, setIsOpen] = useState(false);\n const [openFromCalendar, setOpenFromCalendar] = useState(false);\n const [openToCalendar, setOpenToCalendar] = useState(false);\n\n const isRTL = locale.direction === 'rtl';\n const localeCode = locale.code as SupportedLocale;\n const { pastOptions, futureOptions } = getDateFilterOptions(localeCode);\n\n // Sync internal state with external value prop\n useEffect(() => {\n setInternalValue(value);\n if (value?.type === 'custom' && value.customRange) {\n setCustomRange(value.customRange);\n }\n }, [value]);\n\n const labels = {\n selectOption: getLabel('selectOption', localeCode),\n from: getLabel('from', localeCode),\n to: getLabel('to', localeCode),\n selectDate: getLabel('selectDate', localeCode),\n past: getLabel('past', localeCode),\n future: getLabel('future', localeCode),\n custom: getLabel('customRange', localeCode),\n apply: getLabel('apply', localeCode),\n cancel: getLabel('cancel', localeCode),\n };\n\n const handlePredefinedSelect = (optionValue: string) => {\n setShowCustom(false);\n setIsOpen(false);\n\n const dateRange = getDateRangeForOption(optionValue, locale.code);\n const newValue: DateFilterValue = {\n type: 'predefined',\n predefinedValue: optionValue,\n customRange: { from: dateRange.from, to: dateRange.to },\n };\n\n setInternalValue(newValue);\n onChange(newValue);\n };\n\n const handleCustomSelect = () => {\n setShowCustom(true);\n };\n\n const handleCustomRangeChange = (newRange: DateRange) => {\n setCustomRange(newRange);\n };\n\n const handleApplyCustomRange = () => {\n const newValue: DateFilterValue = {\n type: 'custom',\n customRange,\n };\n\n setInternalValue(newValue);\n onChange(newValue);\n setIsOpen(false);\n setShowCustom(false);\n };\n\n const handleCancelCustomRange = () => {\n setIsOpen(false);\n setShowCustom(false);\n setCustomRange({ from: undefined, to: undefined });\n };\n\n const handleClearAll = () => {\n setInternalValue(undefined);\n setCustomRange({ from: undefined, to: undefined });\n setShowCustom(false);\n onChange({} as DateFilterValue);\n };\n\n const hasValue = () => {\n return (\n internalValue && (internalValue.type === 'predefined' || internalValue.type === 'custom')\n );\n };\n\n const getDisplayValue = () => {\n if (internalValue?.type === 'custom' && internalValue.customRange) {\n const { from, to } = internalValue.customRange;\n if (from && to) {\n return `${formatDate(from, 'dd/MM/yyyy')}-${formatDate(to, 'dd/MM/yyyy')}`;\n } else if (from) {\n return `${labels.from}: ${formatDate(from, 'dd/MM/yyyy')}`;\n } else if (to) {\n return `${labels.to}: ${formatDate(to, 'dd/MM/yyyy')}`;\n }\n return labels.custom;\n }\n\n if (internalValue?.type === 'predefined' && internalValue.predefinedValue) {\n const allOptions = [...pastOptions, ...futureOptions];\n const option = allOptions.find((opt) => opt.value === internalValue.predefinedValue);\n const dateRange = getDateRangeForOption(internalValue.predefinedValue, locale.code);\n return `${option?.label || internalValue.predefinedValue} ${dateRange.description}`;\n }\n\n return labels.selectOption;\n };\n\n const formatDateRange = (description: string) => {\n // Check if description contains a date range (has \" - \" in it)\n if (description.includes(' - ') && isRTL) {\n // Split by \" - \" and reverse the order for RTL\n const parts = description.replace(/[()]/g, '').split(' - ');\n if (parts.length === 2) {\n return `(${parts[1]}-${parts[0]})`;\n }\n }\n return description;\n };\n\n const renderOptionWithDate = (option: { value: string; label: string }) => {\n const dateRange = getDateRangeForOption(option.value, locale.code);\n const formattedDescription = formatDateRange(dateRange.description);\n\n return (\n <Button\n key={option.value}\n variant='ghost'\n className={cn(\n ' w-full h-auto py-1 px-2 text-xs leading-tight justify-start',\n isRTL ? ' text-right' : ' text-left',\n internalValue?.predefinedValue === option.value && 'bg-accent',\n )}\n onClick={() => handlePredefinedSelect(option.value)}\n >\n <div className={cn('flex flex-col')}>\n <span className='font-medium'>{option.label}</span>\n <span className='text-[10px] text-muted-foreground' dir={locale.direction}>\n {formattedDescription}\n </span>\n </div>\n </Button>\n );\n };\n\n return (\n <div className={cn('useTw space-y-1', className)} dir={locale.direction} style={style}>\n {label && (\n <Label className={cn('useTw text-sm font-medium', isRTL && 'text-right block')}>\n {label}\n </Label>\n )}\n\n <div className='relative useTw'>\n <Popover open={isOpen} onOpenChange={setIsOpen}>\n <PopoverTrigger asChild className='useTw'>\n <Button\n variant='outline'\n role='combobox'\n aria-expanded={isOpen}\n className='useTw w-full justify-between bg-background relative min-w-70'\n >\n <span className={`useTw truncate ${isRTL && 'text-right'}`}>{getDisplayValue()}</span>\n <ChevronDown className='useTw h-4 w-4 shrink-0 opacity-50' />\n </Button>\n </PopoverTrigger>\n <PopoverContent className='useTw w-80 p-0'>\n <div className='p-4'>\n <div className='grid grid-cols-2 gap-4'>\n {/* Future Options - Left column */}\n <div className='space-y-1'>\n <div\n className={cn(\n 'text-sm font-semibold text-muted-foreground mb-2',\n isRTL && 'text-right',\n )}\n >\n {labels.future}\n </div>\n <div className='space-y-0.5'>\n {futureOptions.map((option) => (\n <div key={option.value}>{renderOptionWithDate(option)}</div>\n ))}\n </div>\n </div>\n\n {/* Past Options - Right column */}\n <div className='space-y-1'>\n <div\n className={cn(\n 'text-sm font-semibold text-muted-foreground mb-2',\n isRTL && 'text-right',\n )}\n >\n {labels.past}\n </div>\n <div className='space-y-0.5'>\n {pastOptions.map((option) => (\n <div key={option.value}>{renderOptionWithDate(option)}</div>\n ))}\n </div>\n </div>\n </div>\n\n <Separator className='my-4' />\n\n {/* Custom Option */}\n <div className='space-y-3'>\n <Button\n variant='ghost'\n className={cn(\n 'useTw w-full justify-start h-auto py-2 px-2',\n (showCustom || internalValue?.type === 'custom') && 'bg-accent',\n isRTL && 'justify-start text-right',\n )}\n onClick={handleCustomSelect}\n >\n {labels.custom}\n </Button>\n\n {/* Custom Date Range - appears next to custom label */}\n {showCustom && (\n <div className='space-y-3 pl-2'>\n <div className='grid grid-cols-1 gap-3'>\n {/* From Date */}\n <div className={cn('flex items-center gap-2')}>\n <Label className={cn('useTw text-xs w-[20%]', isRTL && 'text-right')}>\n {labels.from}\n </Label>\n <Popover open={openFromCalendar} onOpenChange={setOpenFromCalendar}>\n <PopoverTrigger asChild className='useTw'>\n <Button\n variant='outline'\n className={cn(\n 'useTw w-[60%] justify-start text-left font-normal text-xs h-8 bg-background',\n !customRange.from && 'text-muted-foreground',\n )}\n >\n <CalendarIcon className='useTw mr-1 h-3 w-3' />\n <span dir={locale.direction}>\n {customRange.from\n ? formatDate(customRange.from, 'dd/MM/yyyy')\n : labels.selectDate}\n </span>\n </Button>\n </PopoverTrigger>\n <PopoverContent className='useTw w-auto p-0' align='start'>\n <Calendar\n mode='single'\n selected={customRange.from}\n onSelect={(date) => {\n handleCustomRangeChange({ ...customRange, from: date });\n setOpenFromCalendar(false);\n }}\n initialFocus\n className='useTw'\n />\n </PopoverContent>\n </Popover>\n </div>\n\n {/* To Date */}\n <div className={cn('flex items-center gap-2')}>\n <Label className={cn('useTw text-xs w-[20%]', isRTL && 'text-right')}>\n {labels.to}\n </Label>\n <Popover open={openToCalendar} onOpenChange={setOpenToCalendar}>\n <PopoverTrigger asChild className='useTw'>\n <Button\n variant='outline'\n className={cn(\n 'useTw w-[60%] justify-start text-left font-normal text-xs h-8 bg-background',\n !customRange.to && 'text-muted-foreground',\n )}\n >\n <CalendarIcon className='useTw mr-1 h-3 w-3' />\n <span dir={locale.direction}>\n {customRange.to\n ? formatDate(customRange.to, 'dd/MM/yyyy')\n : labels.selectDate}\n </span>\n </Button>\n </PopoverTrigger>\n <PopoverContent className='useTw w-auto p-0' align='start'>\n <Calendar\n mode='single'\n selected={customRange.to}\n onSelect={(date) => {\n handleCustomRangeChange({ ...customRange, to: date });\n setOpenToCalendar(false);\n }}\n initialFocus\n className='useTw'\n />\n </PopoverContent>\n </Popover>\n </div>\n </div>\n\n {/* Action Buttons */}\n <div className='flex gap-2'>\n <Button\n onClick={handleApplyCustomRange}\n className='useTw flex-1 text-xs h-8'\n disabled={!customRange.from && !customRange.to}\n >\n {labels.apply}\n </Button>\n <Button\n onClick={handleCancelCustomRange}\n variant='outline'\n className='useTw flex-1 text-xs h-8 bg-transparent'\n >\n {labels.cancel}\n </Button>\n </div>\n </div>\n )}\n </div>\n </div>\n </PopoverContent>\n </Popover>\n {hasValue() && (\n <button\n className={`useTw absolute ${isRTL ? 'left-8' : 'right-8'} top-1/2 -translate-y-1/2 h-4 w-4 p-0 hover:bg-muted rounded-sm flex items-center justify-center z-10 `}\n onClick={(e) => {\n e.stopPropagation();\n handleClearAll();\n }}\n >\n <X className='useTw h-3 w-3' />\n </button>\n )}\n </div>\n </div>\n );\n}\n"],"names":["useEffect","useState","CalendarIcon","ChevronDown","X","formatDate","getDateRangeForOption","Button","cn","Label","Popover","PopoverContent","PopoverTrigger","Separator","Calendar","getDateFilterOptions","getLabel","DateFilter","label","value","onChange","locale","code","direction","className","style","internalValue","setInternalValue","customRange","setCustomRange","from","undefined","to","showCustom","setShowCustom","isOpen","setIsOpen","openFromCalendar","setOpenFromCalendar","openToCalendar","setOpenToCalendar","isRTL","localeCode","pastOptions","futureOptions","type","labels","selectOption","selectDate","past","future","custom","apply","cancel","handlePredefinedSelect","optionValue","dateRange","newValue","predefinedValue","handleCustomSelect","handleCustomRangeChange","newRange","handleApplyCustomRange","handleCancelCustomRange","handleClearAll","hasValue","getDisplayValue","allOptions","option","find","opt","description","formatDateRange","includes","parts","replace","split","length","renderOptionWithDate","formattedDescription","variant","onClick","div","span","dir","open","onOpenChange","asChild","role","aria-expanded","map","align","mode","selected","onSelect","date","initialFocus","disabled","button","e","stopPropagation"],"mappings":"AAAA;;AAEA,SAASA,SAAS,EAAEC,QAAQ,QAAQ,QAAQ;AAC5C,SAASC,YAAY,EAAEC,WAAW,EAAEC,CAAC,QAAQ,eAAe;AAE5D,SAASC,UAAU,EAAEC,qBAAqB,QAAQ,wBAAwB;AAE1E,SAASC,MAAM,QAAQ,kBAAkB;AACzC,SAASC,EAAE,QAAQ,kBAAkB;AACrC,SAASC,KAAK,QAAQ,iBAAiB;AACvC,SAASC,OAAO,EAAEC,cAAc,EAAEC,cAAc,QAAQ,mBAAmB;AAC3E,SAASC,SAAS,QAAQ,qBAAqB;AAC/C,SAASC,QAAQ,QAAQ,oBAAoB;AAC7C,SAASC,oBAAoB,QAAQ,mCAAmC;AACxE,SAA0BC,QAAQ,QAAQ,eAAe;AAYzD,OAAO,SAASC,WAAW,EACzBC,KAAK,EACLC,KAAK,EACLC,QAAQ,EACRC,SAAS;IAAEC,MAAM;IAAMC,WAAW;AAAM,CAAC,EACzCC,SAAS,EACTC,KAAK,EACW;IAChB,MAAM,CAACC,eAAeC,iBAAiB,GAAG1B,SAAsCkB;IAChF,MAAM,CAACS,aAAaC,eAAe,GAAG5B,SAAoB;QAAE6B,MAAMC;QAAWC,IAAID;IAAU;IAC3F,MAAM,CAACE,YAAYC,cAAc,GAAGjC,SAAS;IAC7C,MAAM,CAACkC,QAAQC,UAAU,GAAGnC,SAAS;IACrC,MAAM,CAACoC,kBAAkBC,oBAAoB,GAAGrC,SA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VyE,UAAU,CAACrE,YAAYE,IAAI,IAAI,CAACF,YAAYI,EAAE;8EAE7Cc,OAAOM,KAAK;;8EAEf,KAAC7C;oEACC0E,SAASlB;oEACTiB,SAAQ;oEACRxD,WAAU;8EAETsB,OAAOO,MAAM;;;;;;;;;;;;;oBAS7BY,4BACC,KAACiC;wBACC1E,WAAW,CAAC,eAAe,EAAEiB,QAAQ,WAAW,UAAU,sGAAsG,CAAC;wBACjKwC,SAAS,CAACkB;4BACRA,EAAEC,eAAe;4BACjBpC;wBACF;kCAEA,cAAA,KAAC5D;4BAAEoB,WAAU;;;;;;;AAMzB"}
|
|
1
|
+
{"version":3,"sources":["../../../src/filters/components/date-filter.tsx"],"sourcesContent":["'use client';\n\nimport { useEffect, useState } from 'react';\nimport { CalendarIcon, ChevronDown, X } from 'lucide-react';\n\nimport { formatDate, getDateRangeForOption } from '../utils/date-helpers';\nimport { DateFilterValue, DateRange, Locale } from '../types/filters-type';\nimport { Button } from '../../ui/button';\nimport { cn } from '../../lib/utils';\nimport { Label } from '../../ui/label';\nimport { Popover, PopoverContent, PopoverTrigger } from '../../ui/popover';\nimport { Separator } from '../../ui/separator';\nimport { Calendar } from '../../ui/calendar';\nimport { getDateFilterOptions } from '../constants/date-filter-options';\nimport { SupportedLocale, getLabel } from '../../labels';\n\n\ninterface DateFilterProps {\n label?: string;\n value?: DateFilterValue;\n onChange: (value: DateFilterValue) => void;\n locale?: Locale;\n className?: string;\n style?: React.CSSProperties;\n}\n\nexport function DateFilter({\n label,\n value,\n onChange,\n locale = { code: 'he', direction: 'rtl' },\n className,\n style,\n}: DateFilterProps) {\n const [internalValue, setInternalValue] = useState<DateFilterValue | undefined>(value);\n const [customRange, setCustomRange] = useState<DateRange>({ from: undefined, to: undefined });\n const [showCustom, setShowCustom] = useState(false);\n const [isOpen, setIsOpen] = useState(false);\n const [openFromCalendar, setOpenFromCalendar] = useState(false);\n const [openToCalendar, setOpenToCalendar] = useState(false);\n\n const isRTL = locale.direction === 'rtl';\n const localeCode = locale.code as SupportedLocale;\n const { pastOptions, futureOptions } = getDateFilterOptions(localeCode);\n\n // Sync internal state with external value prop\n useEffect(() => {\n setInternalValue(value);\n if (value?.type === 'custom' && value.customRange) {\n setCustomRange(value.customRange);\n }\n }, [value]);\n\n const labels = {\n selectOption: getLabel('selectOption', localeCode),\n from: getLabel('from', localeCode),\n to: getLabel('to', localeCode),\n selectDate: getLabel('selectDate', localeCode),\n past: getLabel('past', localeCode),\n future: getLabel('future', localeCode),\n presentFuture: getLabel('presentFuture', localeCode),\n custom: getLabel('customRange', localeCode),\n apply: getLabel('apply', localeCode),\n cancel: getLabel('cancel', localeCode),\n };\n\n const handlePredefinedSelect = (optionValue: string) => {\n setShowCustom(false);\n setIsOpen(false);\n\n const dateRange = getDateRangeForOption(optionValue, locale.code);\n const newValue: DateFilterValue = {\n type: 'predefined',\n predefinedValue: optionValue,\n customRange: { from: dateRange.from, to: dateRange.to },\n };\n\n setInternalValue(newValue);\n onChange(newValue);\n };\n\n const handleCustomSelect = () => {\n setShowCustom(true);\n };\n\n const handleCustomRangeChange = (newRange: DateRange) => {\n setCustomRange(newRange);\n };\n\n const handleApplyCustomRange = () => {\n const newValue: DateFilterValue = {\n type: 'custom',\n customRange,\n };\n\n setInternalValue(newValue);\n onChange(newValue);\n setIsOpen(false);\n setShowCustom(false);\n };\n\n const handleCancelCustomRange = () => {\n setIsOpen(false);\n setShowCustom(false);\n setCustomRange({ from: undefined, to: undefined });\n };\n\n const handleClearAll = () => {\n setInternalValue(undefined);\n setCustomRange({ from: undefined, to: undefined });\n setShowCustom(false);\n onChange({} as DateFilterValue);\n };\n\n const hasValue = () => {\n return (\n internalValue && (internalValue.type === 'predefined' || internalValue.type === 'custom')\n );\n };\n\n const getDisplayValue = () => {\n if (internalValue?.type === 'custom' && internalValue.customRange) {\n const { from, to } = internalValue.customRange;\n if (from && to) {\n return `${formatDate(from, 'dd/MM/yyyy')}-${formatDate(to, 'dd/MM/yyyy')}`;\n } else if (from) {\n return `${labels.from}:${formatDate(from, 'dd/MM/yyyy')}`;\n } else if (to) {\n return `${labels.to}:${formatDate(to, 'dd/MM/yyyy')}`;\n }\n return labels.custom;\n }\n\n if (internalValue?.type === 'predefined' && internalValue.predefinedValue) {\n const allOptions = [...pastOptions, ...futureOptions];\n const option = allOptions.find((opt) => opt.value === internalValue.predefinedValue);\n const dateRange = getDateRangeForOption(internalValue.predefinedValue, locale.code);\n return `${option?.label || internalValue.predefinedValue}${dateRange.description}`;\n }\n\n return labels.selectOption;\n };\n\n const formatDateRange = (description: string) => {\n // Check if description contains a date range (has \" - \" in it)\n if (description.includes(' - ') && isRTL) {\n // Split by \" - \" and reverse the order for RTL\n const parts = description.replace(/[()]/g, '').split(' - ');\n if (parts.length === 2) {\n return `(${parts[1]}-${parts[0]})`;\n }\n }\n return description;\n };\n\n const renderOptionWithDate = (option: { value: string; label: string }) => {\n const dateRange = getDateRangeForOption(option.value, locale.code);\n const formattedDescription = formatDateRange(dateRange.description);\n\n return (\n <Button\n key={option.value}\n variant='ghost'\n className={cn(\n ' w-full h-auto py-1 px-2 text-xs leading-tight justify-start',\n isRTL ? ' text-right' : ' text-left',\n internalValue?.predefinedValue === option.value && 'bg-accent',\n )}\n onClick={() => handlePredefinedSelect(option.value)}\n >\n <div className={cn('flex flex-col')}>\n <span className='font-medium'>{option.label}</span>\n <span className='text-[10px] text-muted-foreground' dir={locale.direction}>\n {formattedDescription}\n </span>\n </div>\n </Button>\n );\n };\n\n return (\n <div className={cn('useTw space-y-1', className)} dir={locale.direction} style={style}>\n {label && (\n <Label className={cn('useTw text-sm font-medium', isRTL && 'text-right block')}>\n {label}\n </Label>\n )}\n\n <div className='relative useTw'>\n <Popover open={isOpen} onOpenChange={setIsOpen}>\n <PopoverTrigger asChild className='useTw'>\n <Button\n variant='outline'\n role='combobox'\n aria-expanded={isOpen}\n className='useTw w-full justify-between bg-background relative min-w-70 px-2'\n >\n <span className={`useTw truncate ${isRTL && 'text-right'}`}>{getDisplayValue()}</span>\n <ChevronDown className='useTw h-4 w-4 shrink-0 opacity-50' />\n </Button>\n </PopoverTrigger>\n <PopoverContent className='useTw w-80 p-0'>\n <div className='p-4'>\n <div className='grid grid-cols-2 gap-4'>\n\n {/* Past Options - Right column */}\n <div className='space-y-1'>\n <div\n className={cn(\n 'text-sm font-semibold text-muted-foreground mb-2',\n isRTL && 'text-right',\n )}\n >\n {labels.past}\n </div>\n <div className='space-y-0.5'>\n {pastOptions.map((option) => (\n <div key={option.value}>{renderOptionWithDate(option)}</div>\n ))}\n </div>\n </div>\n {/* Future Options - Left column */}\n <div className='space-y-1'>\n <div\n className={cn(\n 'text-sm font-semibold text-muted-foreground mb-2',\n isRTL && 'text-right',\n )}\n >\n {labels.presentFuture}\n </div>\n <div className='space-y-0.5'>\n {futureOptions.map((option) => (\n <div key={option.value}>{renderOptionWithDate(option)}</div>\n ))}\n </div>\n </div>\n\n </div>\n\n <Separator className='my-4' />\n\n {/* Custom Option */}\n <div className='space-y-3'>\n <Button\n variant='ghost'\n className={cn(\n 'useTw w-full justify-start h-auto py-2 px-2',\n (showCustom || internalValue?.type === 'custom') && 'bg-accent',\n isRTL && 'justify-start text-right',\n )}\n onClick={handleCustomSelect}\n >\n {labels.custom}\n </Button>\n\n {/* Custom Date Range - appears next to custom label */}\n {showCustom && (\n <div className='space-y-3 pl-2'>\n <div className='grid grid-cols-1 gap-3'>\n {/* From Date */}\n <div className={cn('flex items-center gap-2')}>\n <Label className={cn('useTw text-xs w-[20%]', isRTL && 'text-right')}>\n {labels.from}\n </Label>\n <Popover open={openFromCalendar} onOpenChange={setOpenFromCalendar}>\n <PopoverTrigger asChild className='useTw'>\n <Button\n variant='outline'\n className={cn(\n 'useTw w-[60%] justify-start text-left font-normal text-xs h-8 bg-background',\n !customRange.from && 'text-muted-foreground',\n )}\n >\n <CalendarIcon className='useTw mr-1 h-3 w-3' />\n <span dir={locale.direction}>\n {customRange.from\n ? formatDate(customRange.from, 'dd/MM/yyyy')\n : labels.selectDate}\n </span>\n </Button>\n </PopoverTrigger>\n <PopoverContent className='useTw w-auto p-0' align='start'>\n <Calendar\n mode='single'\n selected={customRange.from}\n onSelect={(date) => {\n handleCustomRangeChange({ ...customRange, from: date });\n setOpenFromCalendar(false);\n }}\n initialFocus\n className='useTw'\n />\n </PopoverContent>\n </Popover>\n </div>\n\n {/* To Date */}\n <div className={cn('flex items-center gap-2')}>\n <Label className={cn('useTw text-xs w-[20%]', isRTL && 'text-right')}>\n {labels.to}\n </Label>\n <Popover open={openToCalendar} onOpenChange={setOpenToCalendar}>\n <PopoverTrigger asChild className='useTw'>\n <Button\n variant='outline'\n className={cn(\n 'useTw w-[60%] justify-start text-left font-normal text-xs h-8 bg-background',\n !customRange.to && 'text-muted-foreground',\n )}\n >\n <CalendarIcon className='useTw mr-1 h-3 w-3' />\n <span dir={locale.direction}>\n {customRange.to\n ? formatDate(customRange.to, 'dd/MM/yyyy')\n : labels.selectDate}\n </span>\n </Button>\n </PopoverTrigger>\n <PopoverContent className='useTw w-auto p-0' align='start'>\n <Calendar\n mode='single'\n selected={customRange.to}\n onSelect={(date) => {\n handleCustomRangeChange({ ...customRange, to: date });\n setOpenToCalendar(false);\n }}\n initialFocus\n className='useTw'\n />\n </PopoverContent>\n </Popover>\n </div>\n </div>\n\n {/* Action Buttons */}\n <div className='flex gap-2'>\n <Button\n onClick={handleApplyCustomRange}\n className='useTw flex-1 text-xs h-8'\n disabled={!customRange.from && !customRange.to}\n >\n {labels.apply}\n </Button>\n <Button\n onClick={handleCancelCustomRange}\n variant='outline'\n className='useTw flex-1 text-xs h-8 bg-transparent'\n >\n {labels.cancel}\n </Button>\n </div>\n </div>\n )}\n </div>\n </div>\n </PopoverContent>\n </Popover>\n {hasValue() && (\n <button\n className={`useTw absolute ${isRTL ? 'left-8' : 'right-8'} top-1/2 -translate-y-1/2 h-4 w-4 p-0 hover:bg-muted rounded-sm flex items-center justify-center z-10 `}\n onClick={(e) => {\n e.stopPropagation();\n handleClearAll();\n }}\n >\n <X className='useTw h-3 w-3' />\n </button>\n )}\n </div>\n </div>\n );\n}\n"],"names":["useEffect","useState","CalendarIcon","ChevronDown","X","formatDate","getDateRangeForOption","Button","cn","Label","Popover","PopoverContent","PopoverTrigger","Separator","Calendar","getDateFilterOptions","getLabel","DateFilter","label","value","onChange","locale","code","direction","className","style","internalValue","setInternalValue","customRange","setCustomRange","from","undefined","to","showCustom","setShowCustom","isOpen","setIsOpen","openFromCalendar","setOpenFromCalendar","openToCalendar","setOpenToCalendar","isRTL","localeCode","pastOptions","futureOptions","type","labels","selectOption","selectDate","past","future","presentFuture","custom","apply","cancel","handlePredefinedSelect","optionValue","dateRange","newValue","predefinedValue","handleCustomSelect","handleCustomRangeChange","newRange","handleApplyCustomRange","handleCancelCustomRange","handleClearAll","hasValue","getDisplayValue","allOptions","option","find","opt","description","formatDateRange","includes","parts","replace","split","length","renderOptionWithDate","formattedDescription","variant","onClick","div","span","dir","open","onOpenChange","asChild","role","aria-expanded","map","align","mode","selected","onSelect","date","initialFocus","disabled","button","e","stopPropagation"],"mappings":"AAAA;;AAEA,SAASA,SAAS,EAAEC,QAAQ,QAAQ,QAAQ;AAC5C,SAASC,YAAY,EAAEC,WAAW,EAAEC,CAAC,QAAQ,eAAe;AAE5D,SAASC,UAAU,EAAEC,qBAAqB,QAAQ,wBAAwB;AAE1E,SAASC,MAAM,QAAQ,kBAAkB;AACzC,SAASC,EAAE,QAAQ,kBAAkB;AACrC,SAASC,KAAK,QAAQ,iBAAiB;AACvC,SAASC,OAAO,EAAEC,cAAc,EAAEC,cAAc,QAAQ,mBAAmB;AAC3E,SAASC,SAAS,QAAQ,qBAAqB;AAC/C,SAASC,QAAQ,QAAQ,oBAAoB;AAC7C,SAASC,oBAAoB,QAAQ,mCAAmC;AACxE,SAA0BC,QAAQ,QAAQ,eAAe;AAYzD,OAAO,SAASC,WAAW,EACzBC,KAAK,EACLC,KAAK,EACLC,QAAQ,EACRC,SAAS;IAAEC,MAAM;IAAMC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AI3B,KAACrC;oFAAea,WAAU;oFAAmBoE,OAAM;8FACjD,cAAA,KAAC9E;wFACC+E,MAAK;wFACLC,UAAUlE,YAAYI,EAAE;wFACxB+D,UAAU,CAACC;4FACTnC,wBAAwB;gGAAE,GAAGjC,WAAW;gGAAEI,IAAIgE;4FAAK;4FACnDxD,kBAAkB;wFACpB;wFACAyD,YAAY;wFACZzE,WAAU;;;;;;;;;sEAQpB,MAAC2D;4DAAI3D,WAAU;;8EACb,KAACjB;oEACC2E,SAASnB;oEACTvC,WAAU;oEACV0E,UAAU,CAACtE,YAAYE,IAAI,IAAI,CAACF,YAAYI,EAAE;8EAE7Cc,OAAOO,KAAK;;8EAEf,KAAC9C;oEACC2E,SAASlB;oEACTiB,SAAQ;oEACRzD,WAAU;8EAETsB,OAAOQ,MAAM;;;;;;;;;;;;;oBAS7BY,4BACC,KAACiC;wBACC3E,WAAW,CAAC,eAAe,EAAEiB,QAAQ,WAAW,UAAU,sGAAsG,CAAC;wBACjKyC,SAAS,CAACkB;4BACRA,EAAEC,eAAe;4BACjBpC;wBACF;kCAEA,cAAA,KAAC7D;4BAAEoB,WAAU;;;;;;;AAMzB"}
|
|
@@ -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", "
|
|
4
|
-
export declare const futureOptionKeys: readonly ["today", "
|
|
3
|
+
export declare const pastOptionKeys: readonly ["yesterday", "lastWeek", "lastMonth", "last7Days", "last30Days", "allPast"];
|
|
4
|
+
export declare const futureOptionKeys: readonly ["today", "thisWeek", "thisMonth", "next7Days", "next30Days", "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":"
|
|
1
|
+
{"version":3,"file":"date-filter-options.d.ts","sourceRoot":"","sources":["../../../src/filters/constants/date-filter-options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAY,eAAe,EAAE,MAAM,cAAc,CAAC;AAE9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAGzD,eAAO,MAAM,cAAc,uFAOjB,CAAC;AACX,eAAO,MAAM,gBAAgB,qFAOnB,CAAC;AAaX,eAAO,MAAM,oBAAoB,WAAY,eAAe,GAAG,MAAM;;;CAKpE,CAAC"}
|
|
@@ -2,18 +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',
|
|
6
5
|
'lastWeek',
|
|
7
|
-
'last30Days',
|
|
8
6
|
'lastMonth',
|
|
7
|
+
'last7Days',
|
|
8
|
+
'last30Days',
|
|
9
9
|
'allPast'
|
|
10
10
|
];
|
|
11
11
|
export const futureOptionKeys = [
|
|
12
12
|
'today',
|
|
13
|
-
'next7Days',
|
|
14
13
|
'thisWeek',
|
|
15
|
-
'next30Days',
|
|
16
14
|
'thisMonth',
|
|
15
|
+
'next7Days',
|
|
16
|
+
'next30Days',
|
|
17
17
|
'allFuture'
|
|
18
18
|
];
|
|
19
19
|
// Create date filter options dynamically based on locale
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/filters/constants/date-filter-options.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"sources":["../../../src/filters/constants/date-filter-options.ts"],"sourcesContent":["import type { LabelKey, SupportedLocale } from '../../labels';\nimport { getLabel } from '../../labels';\nimport { DateFilterOption } from '../types/filters-type'; // Define the option keys for past and future date filters\n\n// Define the option keys for past and future date filters\nexport const pastOptionKeys = [\n 'yesterday',\n 'lastWeek',\n 'lastMonth',\n 'last7Days',\n 'last30Days',\n 'allPast',\n] as const;\nexport const futureOptionKeys = [\n 'today',\n 'thisWeek',\n 'thisMonth',\n 'next7Days',\n 'next30Days',\n 'allFuture',\n] 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":"AACA,SAASA,QAAQ,QAAQ,eAAe;AAGxC,0DAA0D;AAC1D,OAAO,MAAMC,iBAAiB;IAC5B;IACA;IACA;IACA;IACA;IACA;CACD,CAAU;AACX,OAAO,MAAMC,mBAAmB;IAC9B;IACA;IACA;IACA;IACA;IACA;CACD,CAAU;AAEX,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"}
|
|
@@ -99,7 +99,7 @@ export function getDateRangeForOption(option, locale = 'he') {
|
|
|
99
99
|
return {
|
|
100
100
|
from: lastWeekStart,
|
|
101
101
|
to: lastWeekEnd,
|
|
102
|
-
description: `(${formatDate(lastWeekStart, 'dd/MM')}
|
|
102
|
+
description: `(${formatDate(lastWeekStart, 'dd/MM')}-${formatDate(lastWeekEnd, 'dd/MM/yyyy')})`
|
|
103
103
|
};
|
|
104
104
|
case 'lastMonth':
|
|
105
105
|
const lastMonthStart = startOfMonth(subMonths(now, 1));
|
|
@@ -114,14 +114,14 @@ export function getDateRangeForOption(option, locale = 'he') {
|
|
|
114
114
|
return {
|
|
115
115
|
from: last7DaysStart,
|
|
116
116
|
to: endOfDay(now),
|
|
117
|
-
description: `(${formatDate(last7DaysStart, 'dd/MM')}
|
|
117
|
+
description: `(${formatDate(last7DaysStart, 'dd/MM')}-${formatDate(now, 'dd/MM/yyyy')})`
|
|
118
118
|
};
|
|
119
119
|
case 'last30Days':
|
|
120
120
|
const last30DaysStart = startOfDay(subDays(now, 29));
|
|
121
121
|
return {
|
|
122
122
|
from: last30DaysStart,
|
|
123
123
|
to: endOfDay(now),
|
|
124
|
-
description: `(${formatDate(last30DaysStart, 'dd/MM')}
|
|
124
|
+
description: `(${formatDate(last30DaysStart, 'dd/MM')}-${formatDate(now, 'dd/MM/yyyy')})`
|
|
125
125
|
};
|
|
126
126
|
case 'allPast':
|
|
127
127
|
{
|
|
@@ -148,7 +148,7 @@ export function getDateRangeForOption(option, locale = 'he') {
|
|
|
148
148
|
return {
|
|
149
149
|
from: thisWeekStart,
|
|
150
150
|
to: thisWeekEnd,
|
|
151
|
-
description: `(${formatDate(thisWeekStart, 'dd/MM')}
|
|
151
|
+
description: `(${formatDate(thisWeekStart, 'dd/MM')}-${formatDate(thisWeekEnd, 'dd/MM/yyyy')})`
|
|
152
152
|
};
|
|
153
153
|
case 'thisMonth':
|
|
154
154
|
const thisMonthStart = startOfMonth(now);
|
|
@@ -163,14 +163,14 @@ export function getDateRangeForOption(option, locale = 'he') {
|
|
|
163
163
|
return {
|
|
164
164
|
from: startOfDay(now),
|
|
165
165
|
to: next7DaysEnd,
|
|
166
|
-
description: `(${formatDate(now, 'dd/MM')}
|
|
166
|
+
description: `(${formatDate(now, 'dd/MM')}-${formatDate(next7DaysEnd, 'dd/MM/yyyy')})`
|
|
167
167
|
};
|
|
168
168
|
case 'next30Days':
|
|
169
169
|
const next30DaysEnd = endOfDay(addDays(now, 29));
|
|
170
170
|
return {
|
|
171
171
|
from: startOfDay(now),
|
|
172
172
|
to: next30DaysEnd,
|
|
173
|
-
description: `(${formatDate(now, 'dd/MM')}
|
|
173
|
+
description: `(${formatDate(now, 'dd/MM')}-${formatDate(next30DaysEnd, 'dd/MM/yyyy')})`
|
|
174
174
|
};
|
|
175
175
|
case 'allFuture':
|
|
176
176
|
return {
|
|
@@ -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 '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,IAAI,IAAI,IAAI;IAC5B,OAAOd;AACT;A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BtC,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"}
|
|
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,M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K,SAAS,CAAC,EAAEX,WAAW2B,cAAc,cAAc,CAAC,CAAC;YACxF;QAEF,KAAK;YACH,MAAMC,gBAAgBtC,SAASlB,QAAQuC,KAAK;YAC5C,OAAO;gBACLE,MAAMzB,WAAWuB;gBACjBG,IAAIc;gBACJb,aAAa,CAAC,CAAC,EAAEf,WAAWW,KAAK,SAAS,CAAC,EAAEX,WAAW4B,eAAe,cAAc,CAAC,CAAC;YACzF;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
|
@@ -15,6 +15,7 @@ export declare const PLUGIN_LABELS: {
|
|
|
15
15
|
readonly selectDate: "Select Date";
|
|
16
16
|
readonly past: "Past";
|
|
17
17
|
readonly future: "Future";
|
|
18
|
+
readonly presentFuture: "Present & Future";
|
|
18
19
|
readonly customRange: "Custom Range";
|
|
19
20
|
readonly apply: "Apply";
|
|
20
21
|
readonly cancel: "Cancel";
|
|
@@ -46,6 +47,7 @@ export declare const PLUGIN_LABELS: {
|
|
|
46
47
|
readonly selectDate: "اختر التاريخ";
|
|
47
48
|
readonly past: "الماضي";
|
|
48
49
|
readonly future: "المستقبل";
|
|
50
|
+
readonly presentFuture: "الحاضر والمستقبل";
|
|
49
51
|
readonly customRange: "نطاق مخصص";
|
|
50
52
|
readonly apply: "تطبيق";
|
|
51
53
|
readonly cancel: "إلغاء";
|
|
@@ -77,6 +79,7 @@ export declare const PLUGIN_LABELS: {
|
|
|
77
79
|
readonly selectDate: "Sélectionner une date";
|
|
78
80
|
readonly past: "Passé";
|
|
79
81
|
readonly future: "Futur";
|
|
82
|
+
readonly presentFuture: "Présent & Futur";
|
|
80
83
|
readonly customRange: "Plage personnalisée";
|
|
81
84
|
readonly apply: "Appliquer";
|
|
82
85
|
readonly cancel: "Annuler";
|
|
@@ -108,6 +111,7 @@ export declare const PLUGIN_LABELS: {
|
|
|
108
111
|
readonly selectDate: "Seleccionar fecha";
|
|
109
112
|
readonly past: "Pasado";
|
|
110
113
|
readonly future: "Futuro";
|
|
114
|
+
readonly presentFuture: "Presente & Futuro";
|
|
111
115
|
readonly customRange: "Rango personalizado";
|
|
112
116
|
readonly apply: "Aplicar";
|
|
113
117
|
readonly cancel: "Cancelar";
|
|
@@ -139,6 +143,7 @@ export declare const PLUGIN_LABELS: {
|
|
|
139
143
|
readonly selectDate: "选择日期";
|
|
140
144
|
readonly past: "过去";
|
|
141
145
|
readonly future: "未来";
|
|
146
|
+
readonly presentFuture: "现在和未来";
|
|
142
147
|
readonly customRange: "自定义范围";
|
|
143
148
|
readonly apply: "应用";
|
|
144
149
|
readonly cancel: "取消";
|
|
@@ -170,6 +175,7 @@ export declare const PLUGIN_LABELS: {
|
|
|
170
175
|
readonly selectDate: "בחר תאריך";
|
|
171
176
|
readonly past: "עבר";
|
|
172
177
|
readonly future: "עתיד";
|
|
178
|
+
readonly presentFuture: "הווה ועתיד";
|
|
173
179
|
readonly customRange: "טווח מותאם אישית";
|
|
174
180
|
readonly apply: "החל";
|
|
175
181
|
readonly cancel: "ביטול";
|
|
@@ -204,6 +210,7 @@ export declare const getLabels: (locale?: SupportedLocale) => {
|
|
|
204
210
|
readonly selectDate: "Select Date";
|
|
205
211
|
readonly past: "Past";
|
|
206
212
|
readonly future: "Future";
|
|
213
|
+
readonly presentFuture: "Present & Future";
|
|
207
214
|
readonly customRange: "Custom Range";
|
|
208
215
|
readonly apply: "Apply";
|
|
209
216
|
readonly cancel: "Cancel";
|
|
@@ -234,6 +241,7 @@ export declare const getLabels: (locale?: SupportedLocale) => {
|
|
|
234
241
|
readonly selectDate: "اختر التاريخ";
|
|
235
242
|
readonly past: "الماضي";
|
|
236
243
|
readonly future: "المستقبل";
|
|
244
|
+
readonly presentFuture: "الحاضر والمستقبل";
|
|
237
245
|
readonly customRange: "نطاق مخصص";
|
|
238
246
|
readonly apply: "تطبيق";
|
|
239
247
|
readonly cancel: "إلغاء";
|
|
@@ -264,6 +272,7 @@ export declare const getLabels: (locale?: SupportedLocale) => {
|
|
|
264
272
|
readonly selectDate: "Sélectionner une date";
|
|
265
273
|
readonly past: "Passé";
|
|
266
274
|
readonly future: "Futur";
|
|
275
|
+
readonly presentFuture: "Présent & Futur";
|
|
267
276
|
readonly customRange: "Plage personnalisée";
|
|
268
277
|
readonly apply: "Appliquer";
|
|
269
278
|
readonly cancel: "Annuler";
|
|
@@ -294,6 +303,7 @@ export declare const getLabels: (locale?: SupportedLocale) => {
|
|
|
294
303
|
readonly selectDate: "Seleccionar fecha";
|
|
295
304
|
readonly past: "Pasado";
|
|
296
305
|
readonly future: "Futuro";
|
|
306
|
+
readonly presentFuture: "Presente & Futuro";
|
|
297
307
|
readonly customRange: "Rango personalizado";
|
|
298
308
|
readonly apply: "Aplicar";
|
|
299
309
|
readonly cancel: "Cancelar";
|
|
@@ -324,6 +334,7 @@ export declare const getLabels: (locale?: SupportedLocale) => {
|
|
|
324
334
|
readonly selectDate: "选择日期";
|
|
325
335
|
readonly past: "过去";
|
|
326
336
|
readonly future: "未来";
|
|
337
|
+
readonly presentFuture: "现在和未来";
|
|
327
338
|
readonly customRange: "自定义范围";
|
|
328
339
|
readonly apply: "应用";
|
|
329
340
|
readonly cancel: "取消";
|
|
@@ -354,6 +365,7 @@ export declare const getLabels: (locale?: SupportedLocale) => {
|
|
|
354
365
|
readonly selectDate: "בחר תאריך";
|
|
355
366
|
readonly past: "עבר";
|
|
356
367
|
readonly future: "עתיד";
|
|
368
|
+
readonly presentFuture: "הווה ועתיד";
|
|
357
369
|
readonly customRange: "טווח מותאם אישית";
|
|
358
370
|
readonly apply: "החל";
|
|
359
371
|
readonly cancel: "ביטול";
|
package/dist/labels.d.ts.map
CHANGED
|
@@ -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
|
|
1
|
+
{"version":3,"file":"labels.d.ts","sourceRoot":"","sources":["../src/labels.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,iBAAiB,UAAuC,CAAC;AAEtE,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmMhB,CAAC;AACX,MAAM,MAAM,eAAe,GAAG,MAAM,OAAO,aAAa,CAAC;AACzD,MAAM,MAAM,QAAQ,GAAG,MAAM,OAAO,aAAa,CAAC,EAAE,CAAC;AAGrD,eAAO,MAAM,SAAS,YAAY,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAEhD,CAAC;AAGF,eAAO,MAAM,QAAQ,QAAS,QAAQ,WAAU,eAAe,KAAU,MAaxE,CAAC"}
|
package/dist/labels.js
CHANGED
|
@@ -24,6 +24,7 @@ export const PLUGIN_LABELS = {
|
|
|
24
24
|
selectDate: 'Select Date',
|
|
25
25
|
past: 'Past',
|
|
26
26
|
future: 'Future',
|
|
27
|
+
presentFuture: 'Present & Future',
|
|
27
28
|
customRange: 'Custom Range',
|
|
28
29
|
apply: 'Apply',
|
|
29
30
|
cancel: 'Cancel',
|
|
@@ -55,6 +56,7 @@ export const PLUGIN_LABELS = {
|
|
|
55
56
|
selectDate: 'اختر التاريخ',
|
|
56
57
|
past: 'الماضي',
|
|
57
58
|
future: 'المستقبل',
|
|
59
|
+
presentFuture: 'الحاضر والمستقبل',
|
|
58
60
|
customRange: 'نطاق مخصص',
|
|
59
61
|
apply: 'تطبيق',
|
|
60
62
|
cancel: 'إلغاء',
|
|
@@ -86,6 +88,7 @@ export const PLUGIN_LABELS = {
|
|
|
86
88
|
selectDate: 'Sélectionner une date',
|
|
87
89
|
past: 'Passé',
|
|
88
90
|
future: 'Futur',
|
|
91
|
+
presentFuture: 'Présent & Futur',
|
|
89
92
|
customRange: 'Plage personnalisée',
|
|
90
93
|
apply: 'Appliquer',
|
|
91
94
|
cancel: 'Annuler',
|
|
@@ -117,6 +120,7 @@ export const PLUGIN_LABELS = {
|
|
|
117
120
|
selectDate: 'Seleccionar fecha',
|
|
118
121
|
past: 'Pasado',
|
|
119
122
|
future: 'Futuro',
|
|
123
|
+
presentFuture: 'Presente & Futuro',
|
|
120
124
|
customRange: 'Rango personalizado',
|
|
121
125
|
apply: 'Aplicar',
|
|
122
126
|
cancel: 'Cancelar',
|
|
@@ -148,6 +152,7 @@ export const PLUGIN_LABELS = {
|
|
|
148
152
|
selectDate: '选择日期',
|
|
149
153
|
past: '过去',
|
|
150
154
|
future: '未来',
|
|
155
|
+
presentFuture: '现在和未来',
|
|
151
156
|
customRange: '自定义范围',
|
|
152
157
|
apply: '应用',
|
|
153
158
|
cancel: '取消',
|
|
@@ -179,6 +184,7 @@ export const PLUGIN_LABELS = {
|
|
|
179
184
|
selectDate: 'בחר תאריך',
|
|
180
185
|
past: 'עבר',
|
|
181
186
|
future: 'עתיד',
|
|
187
|
+
presentFuture: 'הווה ועתיד',
|
|
182
188
|
customRange: 'טווח מותאם אישית',
|
|
183
189
|
apply: 'החל',
|
|
184
190
|
cancel: 'ביטול',
|
package/dist/labels.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/labels.ts"],"sourcesContent":["// Centralized labels for the quickfilter plugin\n\n// List of all accepted languages in the system - only those defined in PLUGIN_LABELS\nexport const acceptedLanguages = ['ar', 'en', 'es', 'fr', 'he', 'zh'];\n\nexport const PLUGIN_LABELS = {\n en: {\n quickFilters: 'Quick Filters',\n clearFilters: 'Clear Filters',\n activeFilterSingular: 'Active filter on column',\n activeFilterPlural: 'Active filters on columns',\n custom: 'Custom',\n all: 'All',\n yes: 'Yes',\n no: 'No',\n selectOption: 'Select Option',\n from: 'From',\n to: 'To',\n selectDate: 'Select Date',\n past: 'Past',\n future: 'Future',\n customRange: 'Custom Range',\n apply: 'Apply',\n cancel: 'Cancel',\n yesterday: 'Yesterday',\n lastWeek: 'Last Week',\n lastMonth: 'Last Month',\n last7Days: 'Last 7 Days',\n last30Days: 'Last 30 Days',\n allPast: 'All Past',\n today: 'Today',\n thisWeek: 'This Week',\n thisMonth: 'This Month',\n next7Days: 'Next 7 Days',\n next30Days: 'Next 30 Days',\n allFuture: 'All Future',\n },\n ar: {\n quickFilters: 'فلاتر سريعة',\n clearFilters: 'مسح الفلاتر',\n activeFilterSingular: 'فلتر نشط على العمود',\n activeFilterPlural: 'فلاتر نشطة على الأعمدة',\n custom: 'مخصص',\n all: 'الكل',\n yes: 'نعم',\n no: 'لا',\n selectOption: 'اختر خيارًا',\n from: 'من',\n to: 'إلى',\n selectDate: 'اختر التاريخ',\n past: 'الماضي',\n future: 'المستقبل',\n customRange: 'نطاق مخصص',\n apply: 'تطبيق',\n cancel: 'إلغاء',\n yesterday: 'أمس',\n lastWeek: 'الأسبوع الماضي',\n lastMonth: 'الشهر الماضي',\n last7Days: 'آخر 7 أيام',\n last30Days: 'آخر 30 يومًا',\n allPast: 'كل الماضي',\n today: 'اليوم',\n thisWeek: 'هذا الأسبوع',\n thisMonth: 'هذا الشهر',\n next7Days: 'الـ 7 أيام القادمة',\n next30Days: 'الـ 30 يومًا القادمة',\n allFuture: 'كل المستقبل',\n },\n fr: {\n quickFilters: 'Filtres rapides',\n clearFilters: 'Effacer les filtres',\n activeFilterSingular: 'Filtre actif sur la colonne',\n activeFilterPlural: 'Filtres actifs sur les colonnes',\n custom: 'Personnalisé',\n all: 'Tous',\n yes: 'Oui',\n no: 'Non',\n selectOption: 'Sélectionner une option',\n from: 'De',\n to: 'À',\n selectDate: 'Sélectionner une date',\n past: 'Passé',\n future: 'Futur',\n customRange: 'Plage personnalisée',\n apply: 'Appliquer',\n cancel: 'Annuler',\n yesterday: 'Hier',\n lastWeek: 'Semaine dernière',\n lastMonth: 'Mois dernier',\n last7Days: '7 derniers jours',\n last30Days: '30 derniers jours',\n allPast: 'Tout le passé',\n today: 'Aujourd’hui',\n thisWeek: 'Cette semaine',\n thisMonth: 'Ce mois',\n next7Days: '7 prochains jours',\n next30Days: '30 prochains jours',\n allFuture: 'Tout le futur',\n },\n es: {\n quickFilters: 'Filtros rápidos',\n clearFilters: 'Borrar filtros',\n activeFilterSingular: 'Filtro activo en la columna',\n activeFilterPlural: 'Filtros activos en las columnas',\n custom: 'Personalizado',\n all: 'Todos',\n yes: 'Sí',\n no: 'No',\n selectOption: 'Seleccionar opción',\n from: 'Desde',\n to: 'Hasta',\n selectDate: 'Seleccionar fecha',\n past: 'Pasado',\n future: 'Futuro',\n customRange: 'Rango personalizado',\n apply: 'Aplicar',\n cancel: 'Cancelar',\n yesterday: 'Ayer',\n lastWeek: 'Semana pasada',\n lastMonth: 'Mes pasado',\n last7Days: 'Últimos 7 días',\n last30Days: 'Últimos 30 días',\n allPast: 'Todo el pasado',\n today: 'Hoy',\n thisWeek: 'Esta semana',\n thisMonth: 'Este mes',\n next7Days: 'Próximos 7 días',\n next30Days: 'Próximos 30 días',\n allFuture: 'Todo el futuro',\n },\n zh: {\n quickFilters: '快速筛选',\n clearFilters: '清除筛选',\n activeFilterSingular: '列上激活的筛选',\n activeFilterPlural: '多列上激活的筛选',\n custom: '自定义',\n all: '全部',\n yes: '是',\n no: '否',\n selectOption: '选择选项',\n from: '从',\n to: '到',\n selectDate: '选择日期',\n past: '过去',\n future: '未来',\n customRange: '自定义范围',\n apply: '应用',\n cancel: '取消',\n yesterday: '昨天',\n lastWeek: '上周',\n lastMonth: '上个月',\n last7Days: '过去7天',\n last30Days: '过去30天',\n allPast: '所有过去',\n today: '今天',\n thisWeek: '本周',\n thisMonth: '本月',\n next7Days: '未来7天',\n next30Days: '未来30天',\n allFuture: '所有未来',\n },\n he: {\n quickFilters: 'סינון מהיר',\n clearFilters: 'נקה סינון',\n activeFilterSingular: 'סינון פעיל בעמודה',\n activeFilterPlural: 'סינון פעיל בעמודות',\n custom: 'מותאם אישית',\n all: 'הכל',\n yes: 'כן',\n no: 'לא',\n selectOption: 'בחר אפשרות',\n from: 'מתאריך',\n to: 'עד תאריך',\n selectDate: 'בחר תאריך',\n past: 'עבר',\n future: 'עתיד',\n customRange: 'טווח מותאם אישית',\n apply: 'החל',\n cancel: 'ביטול',\n yesterday: 'אתמול',\n lastWeek: 'שבוע שעבר',\n lastMonth: 'חודש שעבר',\n last7Days: '7 ימים אחרונים',\n last30Days: '30 ימים אחרונים',\n allPast: 'בעבר',\n today: 'היום',\n thisWeek: 'השבוע',\n thisMonth: 'החודש',\n next7Days: '7 ימים הבאים',\n next30Days: '30 ימים הבאים',\n allFuture: 'בעתיד',\n },\n // Placeholder for other languages (az, bg, bn-BD, etc.)\n // These can be structured similarly with proper translations\n} as const;\nexport type SupportedLocale = keyof typeof PLUGIN_LABELS;\nexport type LabelKey = keyof typeof PLUGIN_LABELS.en;\n\n// Helper function to get labels for a specific locale\nexport const getLabels = (locale: SupportedLocale = 'en') => {\n return PLUGIN_LABELS[locale] || PLUGIN_LABELS.en;\n};\n\n// Helper function to get a specific label\nexport const getLabel = (key: LabelKey, locale: SupportedLocale = 'en'): string => {\n const labels = getLabels(locale);\n const value = labels[key as keyof typeof labels];\n\n if (typeof value === 'string') {\n return value;\n }\n\n // Fallback to English if not found\n const fallbackLabels = getLabels('en');\n const fallbackValue = fallbackLabels[key];\n\n return typeof fallbackValue === 'string' ? fallbackValue : String(key);\n};\n"],"names":["acceptedLanguages","PLUGIN_LABELS","en","quickFilters","clearFilters","activeFilterSingular","activeFilterPlural","custom","all","yes","no","selectOption","from","to","selectDate","past","future","customRange","apply","cancel","yesterday","lastWeek","lastMonth","last7Days","last30Days","allPast","today","thisWeek","thisMonth","next7Days","next30Days","allFuture","ar","fr","es","zh","he","getLabels","locale","getLabel","key","labels","value","fallbackLabels","fallbackValue","String"],"mappings":"AAAA,gDAAgD;AAEhD,qFAAqF;AACrF,OAAO,MAAMA,oBAAoB;IAAC;IAAM;IAAM;IAAM;IAAM;IAAM;CAAK,CAAC;AAEtE,OAAO,MAAMC,gBAAgB;IAC3BC,IAAI;QACFC,cAAc;QACdC,cAAc;QACdC,sBAAsB;QACtBC,oBAAoB;QACpBC,QAAQ;QACRC,KAAK;QACLC,KAAK;QACLC,IAAI;QACJC,cAAc;QACdC,MAAM;QACNC,IAAI;QACJC,YAAY;QACZC,MAAM;QACNC,QAAQ;QACRC,aAAa;QACbC,OAAO;QACPC,QAAQ;QACRC,WAAW;QACXC,UAAU;QACVC,WAAW;QACXC,WAAW;QACXC,YAAY;QACZC,SAAS;QACTC,OAAO;QACPC,UAAU;QACVC,WAAW;QACXC,WAAW;QACXC,YAAY;QACZC,WAAW;IACb;IACAC,IAAI;
|
|
1
|
+
{"version":3,"sources":["../src/labels.ts"],"sourcesContent":["// Centralized labels for the quickfilter plugin\n\n// List of all accepted languages in the system - only those defined in PLUGIN_LABELS\nexport const acceptedLanguages = ['ar', 'en', 'es', 'fr', 'he', 'zh'];\n\nexport const PLUGIN_LABELS = {\n en: {\n quickFilters: 'Quick Filters',\n clearFilters: 'Clear Filters',\n activeFilterSingular: 'Active filter on column',\n activeFilterPlural: 'Active filters on columns',\n custom: 'Custom',\n all: 'All',\n yes: 'Yes',\n no: 'No',\n selectOption: 'Select Option',\n from: 'From',\n to: 'To',\n selectDate: 'Select Date',\n past: 'Past',\n future: 'Future',\n presentFuture: 'Present & Future',\n customRange: 'Custom Range',\n apply: 'Apply',\n cancel: 'Cancel',\n yesterday: 'Yesterday',\n lastWeek: 'Last Week',\n lastMonth: 'Last Month',\n last7Days: 'Last 7 Days',\n last30Days: 'Last 30 Days',\n allPast: 'All Past',\n today: 'Today',\n thisWeek: 'This Week',\n thisMonth: 'This Month',\n next7Days: 'Next 7 Days',\n next30Days: 'Next 30 Days',\n allFuture: 'All Future',\n },\n ar: {\n quickFilters: 'فلاتر سريعة',\n clearFilters: 'مسح الفلاتر',\n activeFilterSingular: 'فلتر نشط على العمود',\n activeFilterPlural: 'فلاتر نشطة على الأعمدة',\n custom: 'مخصص',\n all: 'الكل',\n yes: 'نعم',\n no: 'لا',\n selectOption: 'اختر خيارًا',\n from: 'من',\n to: 'إلى',\n selectDate: 'اختر التاريخ',\n past: 'الماضي',\n future: 'المستقبل',\n presentFuture: 'الحاضر والمستقبل',\n customRange: 'نطاق مخصص',\n apply: 'تطبيق',\n cancel: 'إلغاء',\n yesterday: 'أمس',\n lastWeek: 'الأسبوع الماضي',\n lastMonth: 'الشهر الماضي',\n last7Days: 'آخر 7 أيام',\n last30Days: 'آخر 30 يومًا',\n allPast: 'كل الماضي',\n today: 'اليوم',\n thisWeek: 'هذا الأسبوع',\n thisMonth: 'هذا الشهر',\n next7Days: 'الـ 7 أيام القادمة',\n next30Days: 'الـ 30 يومًا القادمة',\n allFuture: 'كل المستقبل',\n },\n fr: {\n quickFilters: 'Filtres rapides',\n clearFilters: 'Effacer les filtres',\n activeFilterSingular: 'Filtre actif sur la colonne',\n activeFilterPlural: 'Filtres actifs sur les colonnes',\n custom: 'Personnalisé',\n all: 'Tous',\n yes: 'Oui',\n no: 'Non',\n selectOption: 'Sélectionner une option',\n from: 'De',\n to: 'À',\n selectDate: 'Sélectionner une date',\n past: 'Passé',\n future: 'Futur',\n presentFuture: 'Présent & Futur',\n customRange: 'Plage personnalisée',\n apply: 'Appliquer',\n cancel: 'Annuler',\n yesterday: 'Hier',\n lastWeek: 'Semaine dernière',\n lastMonth: 'Mois dernier',\n last7Days: '7 derniers jours',\n last30Days: '30 derniers jours',\n allPast: 'Tout le passé',\n today: 'Aujourd’hui',\n thisWeek: 'Cette semaine',\n thisMonth: 'Ce mois',\n next7Days: '7 prochains jours',\n next30Days: '30 prochains jours',\n allFuture: 'Tout le futur',\n },\n es: {\n quickFilters: 'Filtros rápidos',\n clearFilters: 'Borrar filtros',\n activeFilterSingular: 'Filtro activo en la columna',\n activeFilterPlural: 'Filtros activos en las columnas',\n custom: 'Personalizado',\n all: 'Todos',\n yes: 'Sí',\n no: 'No',\n selectOption: 'Seleccionar opción',\n from: 'Desde',\n to: 'Hasta',\n selectDate: 'Seleccionar fecha',\n past: 'Pasado',\n future: 'Futuro',\n presentFuture: 'Presente & Futuro',\n customRange: 'Rango personalizado',\n apply: 'Aplicar',\n cancel: 'Cancelar',\n yesterday: 'Ayer',\n lastWeek: 'Semana pasada',\n lastMonth: 'Mes pasado',\n last7Days: 'Últimos 7 días',\n last30Days: 'Últimos 30 días',\n allPast: 'Todo el pasado',\n today: 'Hoy',\n thisWeek: 'Esta semana',\n thisMonth: 'Este mes',\n next7Days: 'Próximos 7 días',\n next30Days: 'Próximos 30 días',\n allFuture: 'Todo el futuro',\n },\n zh: {\n quickFilters: '快速筛选',\n clearFilters: '清除筛选',\n activeFilterSingular: '列上激活的筛选',\n activeFilterPlural: '多列上激活的筛选',\n custom: '自定义',\n all: '全部',\n yes: '是',\n no: '否',\n selectOption: '选择选项',\n from: '从',\n to: '到',\n selectDate: '选择日期',\n past: '过去',\n future: '未来',\n presentFuture: '现在和未来',\n customRange: '自定义范围',\n apply: '应用',\n cancel: '取消',\n yesterday: '昨天',\n lastWeek: '上周',\n lastMonth: '上个月',\n last7Days: '过去7天',\n last30Days: '过去30天',\n allPast: '所有过去',\n today: '今天',\n thisWeek: '本周',\n thisMonth: '本月',\n next7Days: '未来7天',\n next30Days: '未来30天',\n allFuture: '所有未来',\n },\n he: {\n quickFilters: 'סינון מהיר',\n clearFilters: 'נקה סינון',\n activeFilterSingular: 'סינון פעיל בעמודה',\n activeFilterPlural: 'סינון פעיל בעמודות',\n custom: 'מותאם אישית',\n all: 'הכל',\n yes: 'כן',\n no: 'לא',\n selectOption: 'בחר אפשרות',\n from: 'מתאריך',\n to: 'עד תאריך',\n selectDate: 'בחר תאריך',\n past: 'עבר',\n future: 'עתיד',\n presentFuture: 'הווה ועתיד',\n customRange: 'טווח מותאם אישית',\n apply: 'החל',\n cancel: 'ביטול',\n yesterday: 'אתמול',\n lastWeek: 'שבוע שעבר',\n lastMonth: 'חודש שעבר',\n last7Days: '7 ימים אחרונים',\n last30Days: '30 ימים אחרונים',\n allPast: 'בעבר',\n today: 'היום',\n thisWeek: 'השבוע',\n thisMonth: 'החודש',\n next7Days: '7 ימים הבאים',\n next30Days: '30 ימים הבאים',\n allFuture: 'בעתיד',\n },\n // Placeholder for other languages (az, bg, bn-BD, etc.)\n // These can be structured similarly with proper translations\n} as const;\nexport type SupportedLocale = keyof typeof PLUGIN_LABELS;\nexport type LabelKey = keyof typeof PLUGIN_LABELS.en;\n\n// Helper function to get labels for a specific locale\nexport const getLabels = (locale: SupportedLocale = 'en') => {\n return PLUGIN_LABELS[locale] || PLUGIN_LABELS.en;\n};\n\n// Helper function to get a specific label\nexport const getLabel = (key: LabelKey, locale: SupportedLocale = 'en'): string => {\n const labels = getLabels(locale);\n const value = labels[key as keyof typeof labels];\n\n if (typeof value === 'string') {\n return value;\n }\n\n // Fallback to English if not found\n const fallbackLabels = getLabels('en');\n const fallbackValue = fallbackLabels[key];\n\n return typeof fallbackValue === 'string' ? fallbackValue : String(key);\n};\n"],"names":["acceptedLanguages","PLUGIN_LABELS","en","quickFilters","clearFilters","activeFilterSingular","activeFilterPlural","custom","all","yes","no","selectOption","from","to","selectDate","past","future","presentFuture","customRange","apply","cancel","yesterday","lastWeek","lastMonth","last7Days","last30Days","allPast","today","thisWeek","thisMonth","next7Days","next30Days","allFuture","ar","fr","es","zh","he","getLabels","locale","getLabel","key","labels","value","fallbackLabels","fallbackValue","String"],"mappings":"AAAA,gDAAgD;AAEhD,qFAAqF;AACrF,OAAO,MAAMA,oBAAoB;IAAC;IAAM;IAAM;IAAM;IAAM;IAAM;CAAK,CAAC;AAEtE,OAAO,MAAMC,gBAAgB;IAC3BC,IAAI;QACFC,cAAc;QACdC,cAAc;QACdC,sBAAsB;QACtBC,oBAAoB;QACpBC,QAAQ;QACRC,KAAK;QACLC,KAAK;QACLC,IAAI;QACJC,cAAc;QACdC,MAAM;QACNC,IAAI;QACJC,YAAY;QACZC,MAAM;QACNC,QAAQ;QACRC,eAAe;QACfC,aAAa;QACbC,OAAO;QACPC,QAAQ;QACRC,WAAW;QACXC,UAAU;QACVC,WAAW;QACXC,WAAW;QACXC,YAAY;QACZC,SAAS;QACTC,OAAO;QACPC,UAAU;QACVC,WAAW;QACXC,WAAW;QACXC,YAAY;QACZC,WAAW;IACb;IACAC,IAAI;QACF9B,cAAc;QACdC,cAAc;QACdC,sBAAsB;QACtBC,oBAAoB;QACpBC,QAAQ;QACRC,KAAK;QACLC,KAAK;QACLC,IAAI;QACJC,cAAc;QACdC,MAAM;QACNC,IAAI;QACJC,YAAY;QACZC,MAAM;QACNC,QAAQ;QACRC,eAAe;QACfC,aAAa;QACbC,OAAO;QACPC,QAAQ;QACRC,WAAW;QACXC,UAAU;QACVC,WAAW;QACXC,WAAW;QACXC,YAAY;QACZC,SAAS;QACTC,OAAO;QACPC,UAAU;QACVC,WAAW;QACXC,WAAW;QACXC,YAAY;QACZC,WAAW;IACb;IACAE,IAAI;QACF/B,cAAc;QACdC,cAAc;QACdC,sBAAsB;QACtBC,oBAAoB;QACpBC,QAAQ;QACRC,KAAK;QACLC,KAAK;QACLC,IAAI;QACJC,cAAc;QACdC,MAAM;QACNC,IAAI;QACJC,YAAY;QACZC,MAAM;QACNC,QAAQ;QACRC,eAAe;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