Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

calendar-base.js 2.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. // Mixins
  2. import mixins from '../../../util/mixins';
  3. import Themeable from '../../../mixins/themeable';
  4. import Colorable from '../../../mixins/colorable';
  5. import Times from './times';
  6. import Mouse from './mouse';
  7. // Util
  8. import props from '../util/props';
  9. import { parseTimestamp, getWeekdaySkips, createDayList, createNativeLocaleFormatter, getStartOfWeek as _getStartOfWeek, getEndOfWeek as _getEndOfWeek } from '../util/timestamp';
  10. /* @vue/component */
  11. export default mixins(Colorable, Themeable, Times, Mouse).extend({
  12. name: 'calendar-base',
  13. props: props.base,
  14. computed: {
  15. weekdaySkips: function weekdaySkips() {
  16. return getWeekdaySkips(this.weekdays);
  17. },
  18. parsedStart: function parsedStart() {
  19. return parseTimestamp(this.start);
  20. },
  21. parsedEnd: function parsedEnd() {
  22. return parseTimestamp(this.end);
  23. },
  24. days: function days() {
  25. return createDayList(this.parsedStart, this.parsedEnd, this.times.today, this.weekdaySkips);
  26. },
  27. dayFormatter: function dayFormatter() {
  28. if (this.dayFormat) {
  29. return this.dayFormat;
  30. }
  31. var options = { timeZone: 'UTC', day: 'numeric' };
  32. return createNativeLocaleFormatter(this.locale, function (_tms, _short) {
  33. return options;
  34. });
  35. },
  36. weekdayFormatter: function weekdayFormatter() {
  37. if (this.weekdayFormat) {
  38. return this.weekdayFormat;
  39. }
  40. var longOptions = { timeZone: 'UTC', weekday: 'long' };
  41. var shortOptions = { timeZone: 'UTC', weekday: 'short' };
  42. return createNativeLocaleFormatter(this.locale, function (_tms, short) {
  43. return short ? shortOptions : longOptions;
  44. });
  45. }
  46. },
  47. methods: {
  48. getRelativeClasses: function getRelativeClasses(timestamp) {
  49. var outside = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  50. return {
  51. 'v-present': timestamp.present,
  52. 'v-past': timestamp.past,
  53. 'v-future': timestamp.future,
  54. 'v-outside': outside
  55. };
  56. },
  57. getStartOfWeek: function getStartOfWeek(timestamp) {
  58. return _getStartOfWeek(timestamp, this.weekdays, this.times.today);
  59. },
  60. getEndOfWeek: function getEndOfWeek(timestamp) {
  61. return _getEndOfWeek(timestamp, this.weekdays, this.times.today);
  62. }
  63. }
  64. });
  65. //# sourceMappingURL=calendar-base.js.map