{"version":3,"file":"date-table.mjs","names":[],"sources":["../../../../../../packages/components/calendar/src/date-table.ts"],"sourcesContent":["import { buildProps, definePropType, isObject } from '@element-plus/utils'\nimport { rangeArr } from '@element-plus/components/time-picker'\n\nimport type { ExtractPublicPropTypes } from 'vue'\nimport type { Dayjs } from 'dayjs'\n\nexport type CalendarDateCellType = 'next' | 'prev' | 'current'\nexport type CalendarDateCell = {\n  text: number\n  type: CalendarDateCellType\n}\n\nexport const getPrevMonthLastDays = (date: Dayjs, count: number) => {\n  const lastDay = date.subtract(1, 'month').endOf('month').date()\n  return rangeArr(count).map((_, index) => lastDay - (count - index - 1))\n}\n\nexport const getMonthDays = (date: Dayjs) => {\n  const days = date.daysInMonth()\n  return rangeArr(days).map((_, index) => index + 1)\n}\n\nexport const toNestedArr = (days: CalendarDateCell[]) =>\n  rangeArr(days.length / 7).map((index) => {\n    const start = index * 7\n    return days.slice(start, start + 7)\n  })\n\nexport interface DateTableProps {\n  selectedDay?: Dayjs\n  range?: [Dayjs, Dayjs]\n  date: Dayjs\n  hideHeader?: boolean\n}\n\n/**\n *  @deprecated Removed after 3.0.0, Use `DateTableProps` instead.\n */\nexport const dateTableProps = buildProps({\n  selectedDay: {\n    type: definePropType<Dayjs>(Object),\n  },\n  range: {\n    type: definePropType<[Dayjs, Dayjs]>(Array),\n  },\n  date: {\n    type: definePropType<Dayjs>(Object),\n    required: true,\n  },\n  hideHeader: {\n    type: Boolean,\n  },\n} as const)\n\n/**\n *  @deprecated Removed after 3.0.0, Use `DateTableProps` instead.\n */\nexport type DateTablePropsPublic = ExtractPublicPropTypes<typeof dateTableProps>\n\nexport const dateTableEmits = {\n  pick: (value: Dayjs) => isObject(value),\n}\nexport type DateTableEmits = typeof dateTableEmits\n"],"mappings":";;;;;AAYA,MAAa,wBAAwB,MAAa,UAAkB;CAClE,MAAM,UAAU,KAAK,SAAS,GAAG,QAAQ,CAAC,MAAM,QAAQ,CAAC,MAAM;AAC/D,QAAO,SAAS,MAAM,CAAC,KAAK,GAAG,UAAU,WAAW,QAAQ,QAAQ,GAAG;;AAGzE,MAAa,gBAAgB,SAAgB;AAE3C,QAAO,SADM,KAAK,aAAa,CACV,CAAC,KAAK,GAAG,UAAU,QAAQ,EAAE;;AAGpD,MAAa,eAAe,SAC1B,SAAS,KAAK,SAAS,EAAE,CAAC,KAAK,UAAU;CACvC,MAAM,QAAQ,QAAQ;AACtB,QAAO,KAAK,MAAM,OAAO,QAAQ,EAAE;EACnC;;;;AAYJ,MAAa,iBAAiB,WAAW;CACvC,aAAa,EACX,MAAM,eAAsB,OAAO,EACpC;CACD,OAAO,EACL,MAAM,eAA+B,MAAM,EAC5C;CACD,MAAM;EACJ,MAAM,eAAsB,OAAO;EACnC,UAAU;EACX;CACD,YAAY,EACV,MAAM,SACP;CACF,CAAU;AAOX,MAAa,iBAAiB,EAC5B,OAAO,UAAiB,SAAS,MAAM,EACxC"}