UNPKG

element-plus

Version:

A Component Library for Vue 3

1 lines 1.94 kB
{"version":3,"file":"calendar2.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 { ExtractPropTypes, 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 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} as const)\nexport type CalendarProps = ExtractPropTypes<typeof calendarProps>\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,YAAe,GAAA,CAAC,KACpB,KAAA,OAAA,CAAQ,KAAK,CAAK,IAAA,KAAA,CAAM,MAAW,KAAA,CAAA,IAAK,MAAM,KAAM,CAAA,CAAC,IAAS,KAAA,MAAA,CAAO,IAAI,CAAC,CAAA,CAAA;AAErE,MAAM,gBAAgB,UAAW,CAAA;AAAA,EAItC,UAAY,EAAA;AAAA,IACV,IAAM,EAAA,IAAA;AAAA,GACR;AAAA,EAKA,KAAO,EAAA;AAAA,IACL,IAAA,EAAM,eAA6B,KAAK,CAAA;AAAA,IACxC,SAAW,EAAA,YAAA;AAAA,GACb;AACF,CAAU,EAAA;AAIH,MAAM,aAAgB,GAAA;AAAA,EAC3B,CAAC,kBAAA,GAAqB,CAAC,KAAA,KAAgB,OAAO,KAAK,CAAA;AAAA,EACnD,CAAC,WAAA,GAAc,CAAC,KAAA,KAAgB,OAAO,KAAK,CAAA;AAC9C;;;;"}