element-plus
Version:
A Component Library for Vue 3
1 lines • 3.23 kB
Source Map (JSON)
{"version":3,"file":"calendar.mjs","sources":["../../../../../../packages/components/calendar/src/calendar.ts"],"sourcesContent":["import {\n buildProps,\n definePropType,\n isArray,\n isDate,\n} from '@element-plus/utils'\nimport { INPUT_EVENT, UPDATE_MODEL_EVENT } from '@element-plus/constants'\n\nimport type { ExtractPublicPropTypes } from 'vue'\n\nexport type CalendarDateType =\n | 'prev-month'\n | 'next-month'\n | 'prev-year'\n | 'next-year'\n | 'today'\n\nconst isValidRange = (range: unknown): range is [Date, Date] =>\n isArray(range) && range.length === 2 && range.every((item) => isDate(item))\n\nexport interface CalendarProps {\n /**\n * @description binding value\n */\n modelValue?: Date\n /**\n * @description time range, including start time and end time.\n * Start time must be start day of week, end time must be end day of week, the time span cannot exceed two months.\n */\n range?: [Date, Date]\n /**\n * @description type of the controller for the Calendar header\n */\n controllerType?: 'button' | 'select'\n /**\n * @description format label when `controller-type` is 'select'\n */\n formatter?: (value: number, type: 'year' | 'month') => string | number\n}\n\n/**\n * @deprecated Removed after 3.0.0, Use `CalendarProps` instead.\n */\nexport const calendarProps = buildProps({\n /**\n * @description binding value\n */\n modelValue: {\n type: Date,\n },\n /**\n * @description time range, including start time and end time.\n * Start time must be start day of week, end time must be end day of week, the time span cannot exceed two months.\n */\n range: {\n type: definePropType<[Date, Date]>(Array),\n validator: isValidRange,\n },\n /**\n * @description type of the controller for the Calendar header\n */\n controllerType: {\n type: String,\n values: ['button', 'select'],\n default: 'button',\n },\n /**\n * @description format label when `controller-type` is 'select'\n */\n formatter: {\n type: definePropType<\n (value: number, type: 'year' | 'month') => string | number\n >(Function),\n },\n} as const)\n/**\n * @deprecated Removed after 3.0.0, Use `CalendarProps` instead.\n */\nexport type CalendarPropsPublic = ExtractPublicPropTypes<typeof calendarProps>\n\nexport const calendarEmits = {\n [UPDATE_MODEL_EVENT]: (value: Date) => isDate(value),\n [INPUT_EVENT]: (value: Date) => isDate(value),\n}\nexport type CalendarEmits = typeof calendarEmits\n"],"names":[],"mappings":";;;;AAiBA,MAAM,YAAA,GAAe,CAAC,KAAA,KACpB,OAAA,CAAQ,KAAK,CAAA,IAAK,KAAA,CAAM,MAAA,KAAW,CAAA,IAAK,MAAM,KAAA,CAAM,CAAC,IAAA,KAAS,MAAA,CAAO,IAAI,CAAC,CAAA;AAyBrE,MAAM,gBAAgB,UAAA,CAAW;AAAA;AAAA;AAAA;AAAA,EAItC,UAAA,EAAY;AAAA,IACV,IAAA,EAAM;AAAA,GACR;AAAA;AAAA;AAAA;AAAA;AAAA,EAKA,KAAA,EAAO;AAAA,IACL,IAAA,EAAM,eAA6B,KAAK,CAAA;AAAA,IACxC,SAAA,EAAW;AAAA,GACb;AAAA;AAAA;AAAA;AAAA,EAIA,cAAA,EAAgB;AAAA,IACd,IAAA,EAAM,MAAA;AAAA,IACN,MAAA,EAAQ,CAAC,QAAA,EAAU,QAAQ,CAAA;AAAA,IAC3B,OAAA,EAAS;AAAA,GACX;AAAA;AAAA;AAAA;AAAA,EAIA,SAAA,EAAW;AAAA,IACT,IAAA,EAAM,eAEJ,QAAQ;AAAA;AAEd,CAAU;AAMH,MAAM,aAAA,GAAgB;AAAA,EAC3B,CAAC,kBAAkB,GAAG,CAAC,KAAA,KAAgB,OAAO,KAAK,CAAA;AAAA,EACnD,CAAC,WAAW,GAAG,CAAC,KAAA,KAAgB,OAAO,KAAK;AAC9C;;;;"}