index.sjs 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. var antmove_export = {};
  2. import antmove_1_module from '../../utils.sjs';
  3. /* eslint-disable */
  4. var utils = antmove_1_module;
  5. function getMark(date) {
  6. return getDate(date).getMonth() + 1;
  7. }
  8. var ROW_HEIGHT = 64;
  9. function getDayStyle(type, index, date, rowHeight, color) {
  10. var style = [];
  11. var offset = getDate(date).getDay();
  12. if (index === 0) {
  13. style.push(['margin-left', 100 * offset / 7 + '%']);
  14. }
  15. if (rowHeight !== ROW_HEIGHT) {
  16. style.push(['height', rowHeight + 'px']);
  17. }
  18. if (color) {
  19. if (type === 'start' || type === 'end' || type === 'multiple-selected' || type === 'multiple-middle') {
  20. style.push(['background', color]);
  21. } else if (type === 'middle') {
  22. style.push(['color', color]);
  23. }
  24. }
  25. return style.map(function (item) {
  26. return item.join(':');
  27. }).join(';');
  28. }
  29. function formatMonthTitle(date) {
  30. date = getDate(date);
  31. return date.getFullYear() + '年' + (date.getMonth() + 1) + '月';
  32. }
  33. function getMonthStyle(visible, date, rowHeight) {
  34. if (!visible) {
  35. date = getDate(date);
  36. var totalDay = utils.getMonthEndDay(date.getFullYear(), date.getMonth() + 1);
  37. var offset = getDate(date).getDay();
  38. var padding = Math.ceil((totalDay + offset) / 7) * rowHeight;
  39. return 'padding-bottom:' + padding + 'px';
  40. }
  41. }
  42. antmove_export = {
  43. getMark: getMark,
  44. getDayStyle: getDayStyle,
  45. formatMonthTitle: formatMonthTitle,
  46. getMonthStyle: getMonthStyle
  47. };
  48. export default antmove_export;