1 line
10 KiB
JSON
1 line
10 KiB
JSON
|
{"ast":null,"code":"import * as React from 'react';\nimport useSelectIcons from '../select/useIcons';\nexport function getPlaceholder(locale, picker, customizePlaceholder) {\n if (customizePlaceholder !== undefined) {\n return customizePlaceholder;\n }\n if (picker === 'year' && locale.lang.yearPlaceholder) {\n return locale.lang.yearPlaceholder;\n }\n if (picker === 'quarter' && locale.lang.quarterPlaceholder) {\n return locale.lang.quarterPlaceholder;\n }\n if (picker === 'month' && locale.lang.monthPlaceholder) {\n return locale.lang.monthPlaceholder;\n }\n if (picker === 'week' && locale.lang.weekPlaceholder) {\n return locale.lang.weekPlaceholder;\n }\n if (picker === 'time' && locale.timePickerLocale.placeholder) {\n return locale.timePickerLocale.placeholder;\n }\n return locale.lang.placeholder;\n}\nexport function getRangePlaceholder(locale, picker, customizePlaceholder) {\n if (customizePlaceholder !== undefined) {\n return customizePlaceholder;\n }\n if (picker === 'year' && locale.lang.yearPlaceholder) {\n return locale.lang.rangeYearPlaceholder;\n }\n if (picker === 'quarter' && locale.lang.quarterPlaceholder) {\n return locale.lang.rangeQuarterPlaceholder;\n }\n if (picker === 'month' && locale.lang.monthPlaceholder) {\n return locale.lang.rangeMonthPlaceholder;\n }\n if (picker === 'week' && locale.lang.weekPlaceholder) {\n return locale.lang.rangeWeekPlaceholder;\n }\n if (picker === 'time' && locale.timePickerLocale.placeholder) {\n return locale.timePickerLocale.rangePlaceholder;\n }\n return locale.lang.rangePlaceholder;\n}\nexport function transPlacement2DropdownAlign(direction, placement) {\n const overflow = {\n adjustX: 1,\n adjustY: 1\n };\n switch (placement) {\n case 'bottomLeft':\n {\n return {\n points: ['tl', 'bl'],\n offset: [0, 4],\n overflow\n };\n }\n case 'bottomRight':\n {\n return {\n points: ['tr', 'br'],\n offset: [0, 4],\n overflow\n };\n }\n case 'topLeft':\n {\n return {\n points: ['bl', 'tl'],\n offset: [0, -4],\n overflow\n };\n }\n case 'topRight':\n {\n return {\n points: ['br', 'tr'],\n offset: [0, -4],\n overflow\n };\n }\n default:\n {\n return {\n points: direction === 'rtl' ? ['tr', 'br'] : ['tl', 'bl'],\n offset: [0, 4],\n overflow\n };\n }\n }\n}\nexport function useIcons(props, prefixCls) {\n const {\n allowClear = true\n } = props;\n const {\n clearIcon,\n removeIcon\n } = useSelectIcons(Object.assign(Object.assign({}, props), {\n prefixCls,\n componentName: 'DatePicker'\n }));\n const mergedAllowClear = React.useMemo(() => {\n if (allowClear === false) {\n return false;\n }\n const allowClearConfig = allowClear === true ? {} : allowClear;\n return Object.assign({\n clearIcon: clearIcon\n }, allowClearConfig);\n }, [allowClear, clearIcon]);\n return [mergedAllowClear, removeIcon];\n}","map":{"version":3,"names":["React","useSelectIcons","getPlaceholder","locale","picker","customizePlaceholder","undefined","lang","yearPlaceholder","quarterPlaceholder","monthPlaceholder","weekPlaceholder","timePickerLocale","placeholder","getRangePlaceholder","rangeYearPlaceholder","rangeQuarterPlaceholder","rangeMonthPlaceholder","rangeWeekPlaceholder","rangePlaceholder","transPlacement2DropdownAlign","direction","placement","overflow","adjustX","adjustY","points","offset","useIcons","props","prefixCls","allowClear","clearIcon","removeIcon","Object","assign","componentName","mergedAllowClear","useMemo","allowClearConfig"],"sources":["C:/Users/Аришина)/source/repos/PromoCursed/node_modules/antd/es/date-picker/util.js"],"sourcesContent":["import * as React from 'react';\nimport useSelectIcons from '../select/useIcons';\nexport function getPlaceholder(locale, picker, customizePlaceholder) {\n if (
|