91f197ac98340c3261a5ed6010fb2ddf5661a7071fdbb5aa180a3e5d93abcfa22ee155deb2710bd8340a24e365fbfa44a58beb8135e123e78452551ecd039f 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. import { rangeArr } from '../../time-picker/src/utils.mjs';
  2. import { buildProps, definePropType } from '../../../utils/vue/props/runtime.mjs';
  3. import { isObject } from '@vue/shared';
  4. const getPrevMonthLastDays = (date, count) => {
  5. const lastDay = date.subtract(1, "month").endOf("month").date();
  6. return rangeArr(count).map((_, index) => lastDay - (count - index - 1));
  7. };
  8. const getMonthDays = (date) => {
  9. const days = date.daysInMonth();
  10. return rangeArr(days).map((_, index) => index + 1);
  11. };
  12. const toNestedArr = (days) => rangeArr(days.length / 7).map((index) => {
  13. const start = index * 7;
  14. return days.slice(start, start + 7);
  15. });
  16. const dateTableProps = buildProps({
  17. selectedDay: {
  18. type: definePropType(Object)
  19. },
  20. range: {
  21. type: definePropType(Array)
  22. },
  23. date: {
  24. type: definePropType(Object),
  25. required: true
  26. },
  27. hideHeader: {
  28. type: Boolean
  29. }
  30. });
  31. const dateTableEmits = {
  32. pick: (value) => isObject(value)
  33. };
  34. export { dateTableEmits, dateTableProps, getMonthDays, getPrevMonthLastDays, toNestedArr };
  35. //# sourceMappingURL=date-table.mjs.map