拿掉 build files

This commit is contained in:
2022-07-18 16:33:23 +08:00
parent 41e2287bcb
commit 3707f158a3
31953 changed files with 0 additions and 4411796 deletions
-390
View File
@@ -1,390 +0,0 @@
// Styles
// import '../../stylus/components/_calendar-daily.styl'
// Mixins
import CalendarWithEvents from './mixins/calendar-with-events'; // Util
import props from './util/props';
import { DAYS_IN_MONTH_MAX, DAY_MIN, DAYS_IN_WEEK, parseTimestamp, validateTimestamp, relativeDays, nextDay, prevDay, copyTimestamp, updateFormatted, updateWeekday, updateRelative, getStartOfMonth, getEndOfMonth, timestampToDate } from './util/timestamp'; // Calendars
import VCalendarMonthly from './VCalendarMonthly';
import VCalendarDaily from './VCalendarDaily';
import VCalendarWeekly from './VCalendarWeekly';
import VCalendarCategory from './VCalendarCategory';
/* @vue/component */
export default CalendarWithEvents.extend({
name: 'v-calendar',
props: { ...props.calendar,
...props.weeks,
...props.intervals,
...props.category
},
data: () => ({
lastStart: null,
lastEnd: null
}),
computed: {
parsedValue() {
return validateTimestamp(this.value) ? parseTimestamp(this.value, true) : this.parsedStart || this.times.today;
},
parsedCategoryDays() {
return parseInt(this.categoryDays) || 1;
},
renderProps() {
const around = this.parsedValue;
let component = null;
let maxDays = this.maxDays;
let weekdays = this.parsedWeekdays;
let categories = this.parsedCategories;
let start = around;
let end = around;
switch (this.type) {
case 'month':
component = VCalendarMonthly;
start = getStartOfMonth(around);
end = getEndOfMonth(around);
break;
case 'week':
component = VCalendarDaily;
start = this.getStartOfWeek(around);
end = this.getEndOfWeek(around);
maxDays = 7;
break;
case 'day':
component = VCalendarDaily;
maxDays = 1;
weekdays = [start.weekday];
break;
case '4day':
component = VCalendarDaily;
end = relativeDays(copyTimestamp(end), nextDay, 4);
updateFormatted(end);
maxDays = 4;
weekdays = [start.weekday, (start.weekday + 1) % 7, (start.weekday + 2) % 7, (start.weekday + 3) % 7];
break;
case 'custom-weekly':
component = VCalendarWeekly;
start = this.parsedStart || around;
end = this.parsedEnd;
break;
case 'custom-daily':
component = VCalendarDaily;
start = this.parsedStart || around;
end = this.parsedEnd;
break;
case 'category':
const days = this.parsedCategoryDays;
component = VCalendarCategory;
end = relativeDays(copyTimestamp(end), nextDay, days);
updateFormatted(end);
maxDays = days;
weekdays = [];
for (let i = 0; i < days; i++) {
weekdays.push((start.weekday + i) % 7);
}
categories = this.getCategoryList(categories);
break;
default:
throw new Error(this.type + ' is not a valid Calendar type');
}
return {
component,
start,
end,
maxDays,
weekdays,
categories
};
},
eventWeekdays() {
return this.renderProps.weekdays;
},
categoryMode() {
return this.type === 'category';
},
title() {
const {
start,
end
} = this.renderProps;
const spanYears = start.year !== end.year;
const spanMonths = spanYears || start.month !== end.month;
if (spanYears) {
return this.monthShortFormatter(start, true) + ' ' + start.year + ' - ' + this.monthShortFormatter(end, true) + ' ' + end.year;
}
if (spanMonths) {
return this.monthShortFormatter(start, true) + ' - ' + this.monthShortFormatter(end, true) + ' ' + end.year;
} else {
return this.monthLongFormatter(start, false) + ' ' + start.year;
}
},
monthLongFormatter() {
return this.getFormatter({
timeZone: 'UTC',
month: 'long'
});
},
monthShortFormatter() {
return this.getFormatter({
timeZone: 'UTC',
month: 'short'
});
},
parsedCategories() {
return typeof this.categories === 'string' && this.categories ? this.categories.split(/\s*,\s*/) : Array.isArray(this.categories) ? this.categories : [];
}
},
watch: {
renderProps: 'checkChange'
},
mounted() {
this.updateEventVisibility();
this.checkChange();
},
updated() {
window.requestAnimationFrame(this.updateEventVisibility);
},
methods: {
checkChange() {
const {
lastStart,
lastEnd
} = this;
const {
start,
end
} = this.renderProps;
if (!lastStart || !lastEnd || start.date !== lastStart.date || end.date !== lastEnd.date) {
this.lastStart = start;
this.lastEnd = end;
this.$emit('change', {
start,
end
});
}
},
move(amount = 1) {
const moved = copyTimestamp(this.parsedValue);
const forward = amount > 0;
const mover = forward ? nextDay : prevDay;
const limit = forward ? DAYS_IN_MONTH_MAX : DAY_MIN;
let times = forward ? amount : -amount;
while (--times >= 0) {
switch (this.type) {
case 'month':
moved.day = limit;
mover(moved);
break;
case 'week':
relativeDays(moved, mover, DAYS_IN_WEEK);
break;
case 'day':
relativeDays(moved, mover, 1);
break;
case '4day':
relativeDays(moved, mover, 4);
break;
case 'category':
relativeDays(moved, mover, this.parsedCategoryDays);
break;
}
}
updateWeekday(moved);
updateFormatted(moved);
updateRelative(moved, this.times.now);
if (this.value instanceof Date) {
this.$emit('input', timestampToDate(moved));
} else if (typeof this.value === 'number') {
this.$emit('input', timestampToDate(moved).getTime());
} else {
this.$emit('input', moved.date);
}
this.$emit('moved', moved);
},
next(amount = 1) {
this.move(amount);
},
prev(amount = 1) {
this.move(-amount);
},
timeToY(time, clamp = true) {
const c = this.$children[0];
if (c && c.timeToY) {
return c.timeToY(time, clamp);
} else {
return false;
}
},
timeDelta(time) {
const c = this.$children[0];
if (c && c.timeDelta) {
return c.timeDelta(time);
} else {
return false;
}
},
minutesToPixels(minutes) {
const c = this.$children[0];
if (c && c.minutesToPixels) {
return c.minutesToPixels(minutes);
} else {
return -1;
}
},
scrollToTime(time) {
const c = this.$children[0];
if (c && c.scrollToTime) {
return c.scrollToTime(time);
} else {
return false;
}
},
parseTimestamp(input, required) {
return parseTimestamp(input, required, this.times.now);
},
timestampToDate(timestamp) {
return timestampToDate(timestamp);
},
getCategoryList(categories) {
if (!this.noEvents) {
const categoryMap = categories.reduce((map, category, index) => {
map[category] = {
index,
count: 0
};
return map;
}, Object.create(null));
if (!this.categoryHideDynamic || !this.categoryShowAll) {
let categoryLength = categories.length;
this.parsedEvents.forEach(ev => {
let category = ev.category;
if (typeof category !== 'string') {
category = this.categoryForInvalid;
}
if (!category) {
return;
}
if (category in categoryMap) {
categoryMap[category].count++;
} else if (!this.categoryHideDynamic) {
categoryMap[category] = {
index: categoryLength++,
count: 1
};
}
});
}
if (!this.categoryShowAll) {
for (const category in categoryMap) {
if (categoryMap[category].count === 0) {
delete categoryMap[category];
}
}
}
categories = Object.keys(categoryMap);
}
return categories;
}
},
render(h) {
const {
start,
end,
maxDays,
component,
weekdays,
categories
} = this.renderProps;
return h(component, {
staticClass: 'v-calendar',
class: {
'v-calendar-events': !this.noEvents
},
props: { ...this.$props,
start: start.date,
end: end.date,
maxDays,
weekdays,
categories
},
directives: [{
modifiers: {
quiet: true
},
name: 'resize',
value: this.updateEventVisibility
}],
on: { ...this.$listeners,
'click:date': day => {
if (this.$listeners['input']) {
this.$emit('input', day.date);
}
if (this.$listeners['click:date']) {
this.$emit('click:date', day);
}
}
},
scopedSlots: this.getScopedSlots()
});
}
});
//# sourceMappingURL=VCalendar.js.map
File diff suppressed because one or more lines are too long
-83
View File
@@ -1,83 +0,0 @@
// Styles
import "../../../src/components/VCalendar/VCalendarCategory.sass"; // Mixins
import VCalendarDaily from './VCalendarDaily'; // Util
import { getSlot } from '../../util/helpers';
import props from './util/props';
/* @vue/component */
export default VCalendarDaily.extend({
name: 'v-calendar-category',
props: props.category,
computed: {
classes() {
return {
'v-calendar-daily': true,
'v-calendar-category': true,
...this.themeClasses
};
},
parsedCategories() {
return typeof this.categories === 'string' && this.categories ? this.categories.split(/\s*,\s*/) : Array.isArray(this.categories) ? this.categories : [];
}
},
methods: {
genDayHeader(day, index) {
const data = {
staticClass: 'v-calendar-category__columns'
};
const scope = {
week: this.days,
...day,
index
};
const children = this.parsedCategories.map(category => this.genDayHeaderCategory(day, this.getCategoryScope(scope, category)));
return [this.$createElement('div', data, children)];
},
getCategoryScope(scope, category) {
return { ...scope,
category: category === this.categoryForInvalid ? null : category
};
},
genDayHeaderCategory(day, scope) {
return this.$createElement('div', {
staticClass: 'v-calendar-category__column-header',
on: this.getDefaultMouseEventHandlers(':day-category', e => {
return this.getCategoryScope(this.getSlotScope(day), scope.category);
})
}, [getSlot(this, 'category', scope) || this.genDayHeaderCategoryTitle(scope.category), getSlot(this, 'day-header', scope)]);
},
genDayHeaderCategoryTitle(category) {
return this.$createElement('div', {
staticClass: 'v-calendar-category__category'
}, category === null ? this.categoryForInvalid : category);
},
genDayBody(day) {
const data = {
staticClass: 'v-calendar-category__columns'
};
const children = this.parsedCategories.map(category => this.genDayBodyCategory(day, category));
return [this.$createElement('div', data, children)];
},
genDayBodyCategory(day, category) {
const data = {
staticClass: 'v-calendar-category__column',
on: this.getDefaultMouseEventHandlers(':time-category', e => {
return this.getCategoryScope(this.getSlotScope(this.getTimestampAtEvent(e, day)), category);
})
};
const children = getSlot(this, 'day-body', () => this.getCategoryScope(this.getSlotScope(day), category));
return this.$createElement('div', data, children);
}
}
});
//# sourceMappingURL=VCalendarCategory.js.map
File diff suppressed because one or more lines are too long
-254
View File
@@ -1,254 +0,0 @@
// Styles
import "../../../src/components/VCalendar/VCalendarDaily.sass"; // Directives
import Resize from '../../directives/resize'; // Components
import VBtn from '../VBtn'; // Mixins
import CalendarWithIntervals from './mixins/calendar-with-intervals'; // Util
import { convertToUnit, getSlot } from '../../util/helpers';
/* @vue/component */
export default CalendarWithIntervals.extend({
name: 'v-calendar-daily',
directives: {
Resize
},
data: () => ({
scrollPush: 0
}),
computed: {
classes() {
return {
'v-calendar-daily': true,
...this.themeClasses
};
}
},
mounted() {
this.init();
},
methods: {
init() {
this.$nextTick(this.onResize);
},
onResize() {
this.scrollPush = this.getScrollPush();
},
getScrollPush() {
const area = this.$refs.scrollArea;
const pane = this.$refs.pane;
return area && pane ? area.offsetWidth - pane.offsetWidth : 0;
},
genHead() {
return this.$createElement('div', {
staticClass: 'v-calendar-daily__head',
style: {
marginRight: this.scrollPush + 'px'
}
}, [this.genHeadIntervals(), ...this.genHeadDays()]);
},
genHeadIntervals() {
const width = convertToUnit(this.intervalWidth);
return this.$createElement('div', {
staticClass: 'v-calendar-daily__intervals-head',
style: {
width
}
}, getSlot(this, 'interval-header'));
},
genHeadDays() {
return this.days.map(this.genHeadDay);
},
genHeadDay(day, index) {
return this.$createElement('div', {
key: day.date,
staticClass: 'v-calendar-daily_head-day',
class: this.getRelativeClasses(day),
on: this.getDefaultMouseEventHandlers(':day', _e => {
return this.getSlotScope(day);
})
}, [this.genHeadWeekday(day), this.genHeadDayLabel(day), ...this.genDayHeader(day, index)]);
},
genDayHeader(day, index) {
return getSlot(this, 'day-header', () => ({
week: this.days,
...day,
index
})) || [];
},
genHeadWeekday(day) {
const color = day.present ? this.color : undefined;
return this.$createElement('div', this.setTextColor(color, {
staticClass: 'v-calendar-daily_head-weekday'
}), this.weekdayFormatter(day, this.shortWeekdays));
},
genHeadDayLabel(day) {
return this.$createElement('div', {
staticClass: 'v-calendar-daily_head-day-label'
}, getSlot(this, 'day-label-header', day) || [this.genHeadDayButton(day)]);
},
genHeadDayButton(day) {
const color = day.present ? this.color : 'transparent';
return this.$createElement(VBtn, {
props: {
color,
fab: true,
depressed: true
},
on: this.getMouseEventHandlers({
'click:date': {
event: 'click',
stop: true
},
'contextmenu:date': {
event: 'contextmenu',
stop: true,
prevent: true,
result: false
}
}, _e => {
return day;
})
}, this.dayFormatter(day, false));
},
genBody() {
return this.$createElement('div', {
staticClass: 'v-calendar-daily__body'
}, [this.genScrollArea()]);
},
genScrollArea() {
return this.$createElement('div', {
ref: 'scrollArea',
staticClass: 'v-calendar-daily__scroll-area'
}, [this.genPane()]);
},
genPane() {
return this.$createElement('div', {
ref: 'pane',
staticClass: 'v-calendar-daily__pane',
style: {
height: convertToUnit(this.bodyHeight)
}
}, [this.genDayContainer()]);
},
genDayContainer() {
return this.$createElement('div', {
staticClass: 'v-calendar-daily__day-container'
}, [this.genBodyIntervals(), ...this.genDays()]);
},
genDays() {
return this.days.map(this.genDay);
},
genDay(day, index) {
return this.$createElement('div', {
key: day.date,
staticClass: 'v-calendar-daily__day',
class: this.getRelativeClasses(day),
on: this.getDefaultMouseEventHandlers(':time', e => {
return this.getSlotScope(this.getTimestampAtEvent(e, day));
})
}, [...this.genDayIntervals(index), ...this.genDayBody(day)]);
},
genDayBody(day) {
return getSlot(this, 'day-body', () => this.getSlotScope(day)) || [];
},
genDayIntervals(index) {
return this.intervals[index].map(this.genDayInterval);
},
genDayInterval(interval) {
const height = convertToUnit(this.intervalHeight);
const styler = this.intervalStyle || this.intervalStyleDefault;
const data = {
key: interval.time,
staticClass: 'v-calendar-daily__day-interval',
style: {
height,
...styler(interval)
}
};
const children = getSlot(this, 'interval', () => this.getSlotScope(interval));
return this.$createElement('div', data, children);
},
genBodyIntervals() {
const width = convertToUnit(this.intervalWidth);
const data = {
staticClass: 'v-calendar-daily__intervals-body',
style: {
width
},
on: this.getDefaultMouseEventHandlers(':interval', e => {
return this.getTimestampAtEvent(e, this.parsedStart);
})
};
return this.$createElement('div', data, this.genIntervalLabels());
},
genIntervalLabels() {
if (!this.intervals.length) return null;
return this.intervals[0].map(this.genIntervalLabel);
},
genIntervalLabel(interval) {
const height = convertToUnit(this.intervalHeight);
const short = this.shortIntervals;
const shower = this.showIntervalLabel || this.showIntervalLabelDefault;
const show = shower(interval);
const label = show ? this.intervalFormatter(interval, short) : undefined;
return this.$createElement('div', {
key: interval.time,
staticClass: 'v-calendar-daily__interval',
style: {
height
}
}, [this.$createElement('div', {
staticClass: 'v-calendar-daily__interval-text'
}, label)]);
}
},
render(h) {
return h('div', {
class: this.classes,
on: {
dragstart: e => {
e.preventDefault();
}
},
directives: [{
modifiers: {
quiet: true
},
name: 'resize',
value: this.onResize
}]
}, [!this.hideHeader ? this.genHead() : '', this.genBody()]);
}
});
//# sourceMappingURL=VCalendarDaily.js.map
File diff suppressed because one or more lines are too long
-26
View File
@@ -1,26 +0,0 @@
// Styles
import "../../../src/components/VCalendar/VCalendarWeekly.sass"; // Mixins
import VCalendarWeekly from './VCalendarWeekly'; // Util
import { parseTimestamp, getStartOfMonth, getEndOfMonth } from './util/timestamp';
/* @vue/component */
export default VCalendarWeekly.extend({
name: 'v-calendar-monthly',
computed: {
staticClass() {
return 'v-calendar-monthly v-calendar-weekly';
},
parsedStart() {
return getStartOfMonth(parseTimestamp(this.start, true));
},
parsedEnd() {
return getEndOfMonth(parseTimestamp(this.end, true));
}
}
});
//# sourceMappingURL=VCalendarMonthly.js.map
@@ -1 +0,0 @@
{"version":3,"sources":["../../../src/components/VCalendar/VCalendarMonthly.ts"],"names":[],"mappings":"AAAA;AACA,OAAO,wDAAP,C,CAEA;;AACA,OAAO,eAAP,MAA4B,mBAA5B,C,CAEA;;AACA,SAAS,cAAT,EAAyB,eAAzB,EAA0C,aAA1C,QAA+D,kBAA/D;AAGA;;AACA,eAAe,eAAe,CAAC,MAAhB,CAAuB;AACpC,EAAA,IAAI,EAAE,oBAD8B;AAGpC,EAAA,QAAQ,EAAE;AACR,IAAA,WAAW,GAAA;AACT,aAAO,sCAAP;AACD,KAHO;;AAIR,IAAA,WAAW,GAAA;AACT,aAAO,eAAe,CAAC,cAAc,CAAC,KAAK,KAAN,EAAa,IAAb,CAAf,CAAtB;AACD,KANO;;AAOR,IAAA,SAAS,GAAA;AACP,aAAO,aAAa,CAAC,cAAc,CAAC,KAAK,GAAN,EAAW,IAAX,CAAf,CAApB;AACD;;AATO;AAH0B,CAAvB,CAAf","sourcesContent":["// Styles\nimport './VCalendarWeekly.sass'\n\n// Mixins\nimport VCalendarWeekly from './VCalendarWeekly'\n\n// Util\nimport { parseTimestamp, getStartOfMonth, getEndOfMonth } from './util/timestamp'\nimport { CalendarTimestamp } from 'vuetify/types'\n\n/* @vue/component */\nexport default VCalendarWeekly.extend({\n name: 'v-calendar-monthly',\n\n computed: {\n staticClass (): string {\n return 'v-calendar-monthly v-calendar-weekly'\n },\n parsedStart (): CalendarTimestamp {\n return getStartOfMonth(parseTimestamp(this.start, true))\n },\n parsedEnd (): CalendarTimestamp {\n return getEndOfMonth(parseTimestamp(this.end, true))\n },\n },\n\n})\n"],"sourceRoot":"","file":"VCalendarMonthly.js"}
-198
View File
@@ -1,198 +0,0 @@
// Styles
import "../../../src/components/VCalendar/VCalendarWeekly.sass"; // Components
import VBtn from '../VBtn'; // Mixins
import CalendarBase from './mixins/calendar-base'; // Util
import { getSlot } from '../../util/helpers';
import { weekNumber } from '../../util/dateTimeUtils';
import props from './util/props';
import { createDayList, getDayIdentifier, createNativeLocaleFormatter } from './util/timestamp';
/* @vue/component */
export default CalendarBase.extend({
name: 'v-calendar-weekly',
props: props.weeks,
computed: {
staticClass() {
return 'v-calendar-weekly';
},
classes() {
return this.themeClasses;
},
parsedMinWeeks() {
return parseInt(this.minWeeks);
},
days() {
const minDays = this.parsedMinWeeks * this.parsedWeekdays.length;
const start = this.getStartOfWeek(this.parsedStart);
const end = this.getEndOfWeek(this.parsedEnd);
return createDayList(start, end, this.times.today, this.weekdaySkips, Number.MAX_SAFE_INTEGER, minDays);
},
todayWeek() {
const today = this.times.today;
const start = this.getStartOfWeek(today);
const end = this.getEndOfWeek(today);
return createDayList(start, end, today, this.weekdaySkips, this.parsedWeekdays.length, this.parsedWeekdays.length);
},
monthFormatter() {
if (this.monthFormat) {
return this.monthFormat;
}
const longOptions = {
timeZone: 'UTC',
month: 'long'
};
const shortOptions = {
timeZone: 'UTC',
month: 'short'
};
return createNativeLocaleFormatter(this.currentLocale, (_tms, short) => short ? shortOptions : longOptions);
}
},
methods: {
isOutside(day) {
const dayIdentifier = getDayIdentifier(day);
return dayIdentifier < getDayIdentifier(this.parsedStart) || dayIdentifier > getDayIdentifier(this.parsedEnd);
},
genHead() {
return this.$createElement('div', {
staticClass: 'v-calendar-weekly__head'
}, this.genHeadDays());
},
genHeadDays() {
const header = this.todayWeek.map(this.genHeadDay);
if (this.showWeek) {
header.unshift(this.$createElement('div', {
staticClass: 'v-calendar-weekly__head-weeknumber'
}));
}
return header;
},
genHeadDay(day, index) {
const outside = this.isOutside(this.days[index]);
const color = day.present ? this.color : undefined;
return this.$createElement('div', this.setTextColor(color, {
key: day.date,
staticClass: 'v-calendar-weekly__head-weekday',
class: this.getRelativeClasses(day, outside)
}), this.weekdayFormatter(day, this.shortWeekdays));
},
genWeeks() {
const days = this.days;
const weekDays = this.parsedWeekdays.length;
const weeks = [];
for (let i = 0; i < days.length; i += weekDays) {
weeks.push(this.genWeek(days.slice(i, i + weekDays), this.getWeekNumber(days[i])));
}
return weeks;
},
genWeek(week, weekNumber) {
const weekNodes = week.map((day, index) => this.genDay(day, index, week));
if (this.showWeek) {
weekNodes.unshift(this.genWeekNumber(weekNumber));
}
return this.$createElement('div', {
key: week[0].date,
staticClass: 'v-calendar-weekly__week'
}, weekNodes);
},
getWeekNumber(determineDay) {
return weekNumber(determineDay.year, determineDay.month - 1, determineDay.day, this.parsedWeekdays[0], parseInt(this.localeFirstDayOfYear));
},
genWeekNumber(weekNumber) {
return this.$createElement('div', {
staticClass: 'v-calendar-weekly__weeknumber'
}, [this.$createElement('small', String(weekNumber))]);
},
genDay(day, index, week) {
const outside = this.isOutside(day);
return this.$createElement('div', {
key: day.date,
staticClass: 'v-calendar-weekly__day',
class: this.getRelativeClasses(day, outside),
on: this.getDefaultMouseEventHandlers(':day', _e => day)
}, [this.genDayLabel(day), ...(getSlot(this, 'day', () => ({
outside,
index,
week,
...day
})) || [])]);
},
genDayLabel(day) {
return this.$createElement('div', {
staticClass: 'v-calendar-weekly__day-label'
}, getSlot(this, 'day-label', day) || [this.genDayLabelButton(day)]);
},
genDayLabelButton(day) {
const color = day.present ? this.color : 'transparent';
const hasMonth = day.day === 1 && this.showMonthOnFirst;
return this.$createElement(VBtn, {
props: {
color,
fab: true,
depressed: true,
small: true
},
on: this.getMouseEventHandlers({
'click:date': {
event: 'click',
stop: true
},
'contextmenu:date': {
event: 'contextmenu',
stop: true,
prevent: true,
result: false
}
}, _e => day)
}, hasMonth ? this.monthFormatter(day, this.shortMonths) + ' ' + this.dayFormatter(day, false) : this.dayFormatter(day, false));
},
genDayMonth(day) {
const color = day.present ? this.color : undefined;
return this.$createElement('div', this.setTextColor(color, {
staticClass: 'v-calendar-weekly__day-month'
}), getSlot(this, 'day-month', day) || this.monthFormatter(day, this.shortMonths));
}
},
render(h) {
return h('div', {
staticClass: this.staticClass,
class: this.classes,
on: {
dragstart: e => {
e.preventDefault();
}
}
}, [!this.hideHeader ? this.genHead() : '', ...this.genWeeks()]);
}
});
//# sourceMappingURL=VCalendarWeekly.js.map
File diff suppressed because one or more lines are too long
-16
View File
@@ -1,16 +0,0 @@
import VCalendar from './VCalendar';
import VCalendarDaily from './VCalendarDaily';
import VCalendarWeekly from './VCalendarWeekly';
import VCalendarMonthly from './VCalendarMonthly';
import VCalendarCategory from './VCalendarCategory';
export { VCalendar, VCalendarCategory, VCalendarDaily, VCalendarWeekly, VCalendarMonthly };
export default {
$_vuetify_subcomponents: {
VCalendar,
VCalendarCategory,
VCalendarDaily,
VCalendarWeekly,
VCalendarMonthly
}
};
//# sourceMappingURL=index.js.map
-1
View File
@@ -1 +0,0 @@
{"version":3,"sources":["../../../src/components/VCalendar/index.ts"],"names":[],"mappings":"AAAA,OAAO,SAAP,MAAsB,aAAtB;AACA,OAAO,cAAP,MAA2B,kBAA3B;AACA,OAAO,eAAP,MAA4B,mBAA5B;AACA,OAAO,gBAAP,MAA6B,oBAA7B;AACA,OAAO,iBAAP,MAA8B,qBAA9B;AAEA,SAAS,SAAT,EAAoB,iBAApB,EAAuC,cAAvC,EAAuD,eAAvD,EAAwE,gBAAxE;AAEA,eAAe;AACb,EAAA,uBAAuB,EAAE;AACvB,IAAA,SADuB;AAEvB,IAAA,iBAFuB;AAGvB,IAAA,cAHuB;AAIvB,IAAA,eAJuB;AAKvB,IAAA;AALuB;AADZ,CAAf","sourcesContent":["import VCalendar from './VCalendar'\nimport VCalendarDaily from './VCalendarDaily'\nimport VCalendarWeekly from './VCalendarWeekly'\nimport VCalendarMonthly from './VCalendarMonthly'\nimport VCalendarCategory from './VCalendarCategory'\n\nexport { VCalendar, VCalendarCategory, VCalendarDaily, VCalendarWeekly, VCalendarMonthly }\n\nexport default {\n $_vuetify_subcomponents: {\n VCalendar,\n VCalendarCategory,\n VCalendarDaily,\n VCalendarWeekly,\n VCalendarMonthly,\n },\n}\n"],"sourceRoot":"","file":"index.js"}
-103
View File
@@ -1,103 +0,0 @@
// Mixins
import mixins from '../../../util/mixins';
import Colorable from '../../../mixins/colorable';
import Localable from '../../../mixins/localable';
import Mouse from './mouse';
import Themeable from '../../../mixins/themeable';
import Times from './times'; // Directives
import Resize from '../../../directives/resize'; // Util
import props from '../util/props';
import { parseTimestamp, getWeekdaySkips, createDayList, createNativeLocaleFormatter, getStartOfWeek, getEndOfWeek, getTimestampIdentifier } from '../util/timestamp';
export default mixins(Colorable, Localable, Mouse, Themeable, Times
/* @vue/component */
).extend({
name: 'calendar-base',
directives: {
Resize
},
props: props.base,
computed: {
parsedWeekdays() {
return Array.isArray(this.weekdays) ? this.weekdays : (this.weekdays || '').split(',').map(x => parseInt(x, 10));
},
weekdaySkips() {
return getWeekdaySkips(this.parsedWeekdays);
},
weekdaySkipsReverse() {
const reversed = this.weekdaySkips.slice();
reversed.reverse();
return reversed;
},
parsedStart() {
return parseTimestamp(this.start, true);
},
parsedEnd() {
const start = this.parsedStart;
const end = this.end ? parseTimestamp(this.end) || start : start;
return getTimestampIdentifier(end) < getTimestampIdentifier(start) ? start : end;
},
days() {
return createDayList(this.parsedStart, this.parsedEnd, this.times.today, this.weekdaySkips);
},
dayFormatter() {
if (this.dayFormat) {
return this.dayFormat;
}
const options = {
timeZone: 'UTC',
day: 'numeric'
};
return createNativeLocaleFormatter(this.currentLocale, (_tms, _short) => options);
},
weekdayFormatter() {
if (this.weekdayFormat) {
return this.weekdayFormat;
}
const longOptions = {
timeZone: 'UTC',
weekday: 'long'
};
const shortOptions = {
timeZone: 'UTC',
weekday: 'short'
};
return createNativeLocaleFormatter(this.currentLocale, (_tms, short) => short ? shortOptions : longOptions);
}
},
methods: {
getRelativeClasses(timestamp, outside = false) {
return {
'v-present': timestamp.present,
'v-past': timestamp.past,
'v-future': timestamp.future,
'v-outside': outside
};
},
getStartOfWeek(timestamp) {
return getStartOfWeek(timestamp, this.parsedWeekdays, this.times.today);
},
getEndOfWeek(timestamp) {
return getEndOfWeek(timestamp, this.parsedWeekdays, this.times.today);
},
getFormatter(options) {
return createNativeLocaleFormatter(this.locale, (_tms, _short) => options);
}
}
});
//# sourceMappingURL=calendar-base.js.map
File diff suppressed because one or more lines are too long
@@ -1,462 +0,0 @@
// Styles
import "../../../../src/components/VCalendar/mixins/calendar-with-events.sass"; // Directives
import ripple from '../../../directives/ripple'; // Mixins
import CalendarBase from './calendar-base'; // Helpers
import { escapeHTML } from '../../../util/helpers'; // Util
import props from '../util/props';
import { CalendarEventOverlapModes } from '../modes';
import { getDayIdentifier, diffMinutes } from '../util/timestamp';
import { parseEvent, isEventStart, isEventOn, isEventOverlapping } from '../util/events';
const WIDTH_FULL = 100;
const WIDTH_START = 95;
const MINUTES_IN_DAY = 1440;
/* @vue/component */
export default CalendarBase.extend({
name: 'calendar-with-events',
directives: {
ripple
},
props: props.events,
computed: {
noEvents() {
return this.events.length === 0;
},
parsedEvents() {
return this.events.map(this.parseEvent);
},
parsedEventOverlapThreshold() {
return parseInt(this.eventOverlapThreshold);
},
eventColorFunction() {
return typeof this.eventColor === 'function' ? this.eventColor : () => this.eventColor;
},
eventTimedFunction() {
return typeof this.eventTimed === 'function' ? this.eventTimed : event => !!event[this.eventTimed];
},
eventCategoryFunction() {
return typeof this.eventCategory === 'function' ? this.eventCategory : event => event[this.eventCategory];
},
eventTextColorFunction() {
return typeof this.eventTextColor === 'function' ? this.eventTextColor : () => this.eventTextColor;
},
eventNameFunction() {
return typeof this.eventName === 'function' ? this.eventName : (event, timedEvent) => escapeHTML(event.input[this.eventName]);
},
eventModeFunction() {
return typeof this.eventOverlapMode === 'function' ? this.eventOverlapMode : CalendarEventOverlapModes[this.eventOverlapMode];
},
eventWeekdays() {
return this.parsedWeekdays;
},
categoryMode() {
return false;
}
},
methods: {
parseEvent(input, index = 0) {
return parseEvent(input, index, this.eventStart, this.eventEnd, this.eventTimedFunction(input), this.categoryMode ? this.eventCategoryFunction(input) : false);
},
formatTime(withTime, ampm) {
const formatter = this.getFormatter({
timeZone: 'UTC',
hour: 'numeric',
minute: withTime.minute > 0 ? 'numeric' : undefined
});
return formatter(withTime, true);
},
updateEventVisibility() {
if (this.noEvents || !this.eventMore) {
return;
}
const eventHeight = this.eventHeight;
const eventsMap = this.getEventsMap();
for (const date in eventsMap) {
const {
parent,
events,
more
} = eventsMap[date];
if (!more) {
break;
}
const parentBounds = parent.getBoundingClientRect();
const last = events.length - 1;
let hide = false;
let hidden = 0;
for (let i = 0; i <= last; i++) {
if (!hide) {
const eventBounds = events[i].getBoundingClientRect();
hide = i === last ? eventBounds.bottom > parentBounds.bottom : eventBounds.bottom + eventHeight > parentBounds.bottom;
}
if (hide) {
events[i].style.display = 'none';
hidden++;
}
}
if (hide) {
more.style.display = '';
more.innerHTML = this.$vuetify.lang.t(this.eventMoreText, hidden);
} else {
more.style.display = 'none';
}
}
},
getEventsMap() {
const eventsMap = {};
const elements = this.$refs.events;
if (!elements || !elements.forEach) {
return eventsMap;
}
elements.forEach(el => {
const date = el.getAttribute('data-date');
if (el.parentElement && date) {
if (!(date in eventsMap)) {
eventsMap[date] = {
parent: el.parentElement,
more: null,
events: []
};
}
if (el.getAttribute('data-more')) {
eventsMap[date].more = el;
} else {
eventsMap[date].events.push(el);
el.style.display = '';
}
}
});
return eventsMap;
},
genDayEvent({
event
}, day) {
const eventHeight = this.eventHeight;
const eventMarginBottom = this.eventMarginBottom;
const dayIdentifier = getDayIdentifier(day);
const week = day.week;
const start = dayIdentifier === event.startIdentifier;
let end = dayIdentifier === event.endIdentifier;
let width = WIDTH_START;
if (!this.categoryMode) {
for (let i = day.index + 1; i < week.length; i++) {
const weekdayIdentifier = getDayIdentifier(week[i]);
if (event.endIdentifier >= weekdayIdentifier) {
width += WIDTH_FULL;
end = end || weekdayIdentifier === event.endIdentifier;
} else {
end = true;
break;
}
}
}
const scope = {
eventParsed: event,
day,
start,
end,
timed: false
};
return this.genEvent(event, scope, false, {
staticClass: 'v-event',
class: {
'v-event-start': start,
'v-event-end': end
},
style: {
height: `${eventHeight}px`,
width: `${width}%`,
'margin-bottom': `${eventMarginBottom}px`
},
attrs: {
'data-date': day.date
},
key: event.index,
ref: 'events',
refInFor: true
});
},
genTimedEvent({
event,
left,
width
}, day) {
if (day.timeDelta(event.end) <= 0 || day.timeDelta(event.start) >= 1) {
return false;
}
const dayIdentifier = getDayIdentifier(day);
const start = event.startIdentifier >= dayIdentifier;
const end = event.endIdentifier > dayIdentifier;
const top = start ? day.timeToY(event.start) : 0;
const bottom = end ? day.timeToY(MINUTES_IN_DAY) : day.timeToY(event.end);
const height = Math.max(this.eventHeight, bottom - top);
const scope = {
eventParsed: event,
day,
start,
end,
timed: true
};
return this.genEvent(event, scope, true, {
staticClass: 'v-event-timed',
style: {
top: `${top}px`,
height: `${height}px`,
left: `${left}%`,
width: `${width}%`
}
});
},
genEvent(event, scopeInput, timedEvent, data) {
const slot = this.$scopedSlots.event;
const text = this.eventTextColorFunction(event.input);
const background = this.eventColorFunction(event.input);
const overlapsNoon = event.start.hour < 12 && event.end.hour >= 12;
const singline = diffMinutes(event.start, event.end) <= this.parsedEventOverlapThreshold;
const formatTime = this.formatTime;
const timeSummary = () => formatTime(event.start, overlapsNoon) + ' - ' + formatTime(event.end, true);
const eventSummary = () => {
const name = this.eventNameFunction(event, timedEvent);
if (event.start.hasTime) {
if (timedEvent) {
const time = timeSummary();
const delimiter = singline ? ', ' : '<br>';
return `<strong>${name}</strong>${delimiter}${time}`;
} else {
const time = formatTime(event.start, true);
return `<strong>${time}</strong> ${name}`;
}
}
return name;
};
const scope = { ...scopeInput,
event: event.input,
outside: scopeInput.day.outside,
singline,
overlapsNoon,
formatTime,
timeSummary,
eventSummary
};
return this.$createElement('div', this.setTextColor(text, this.setBackgroundColor(background, {
on: this.getDefaultMouseEventHandlers(':event', nativeEvent => ({ ...scope,
nativeEvent
})),
directives: [{
name: 'ripple',
value: this.eventRipple != null ? this.eventRipple : true
}],
...data
})), slot ? slot(scope) : [this.genName(eventSummary)]);
},
genName(eventSummary) {
return this.$createElement('div', {
staticClass: 'pl-1',
domProps: {
innerHTML: eventSummary()
}
});
},
genPlaceholder(day) {
const height = this.eventHeight + this.eventMarginBottom;
return this.$createElement('div', {
style: {
height: `${height}px`
},
attrs: {
'data-date': day.date
},
ref: 'events',
refInFor: true
});
},
genMore(day) {
const eventHeight = this.eventHeight;
const eventMarginBottom = this.eventMarginBottom;
return this.$createElement('div', {
staticClass: 'v-event-more pl-1',
class: {
'v-outside': day.outside
},
attrs: {
'data-date': day.date,
'data-more': 1
},
directives: [{
name: 'ripple',
value: this.eventRipple != null ? this.eventRipple : true
}],
on: {
click: () => this.$emit('click:more', day)
},
style: {
display: 'none',
height: `${eventHeight}px`,
'margin-bottom': `${eventMarginBottom}px`
},
ref: 'events',
refInFor: true
});
},
getVisibleEvents() {
const start = getDayIdentifier(this.days[0]);
const end = getDayIdentifier(this.days[this.days.length - 1]);
return this.parsedEvents.filter(event => isEventOverlapping(event, start, end));
},
isEventForCategory(event, category) {
return !this.categoryMode || category === event.category || typeof event.category !== 'string' && category === null;
},
getEventsForDay(day) {
const identifier = getDayIdentifier(day);
const firstWeekday = this.eventWeekdays[0];
return this.parsedEvents.filter(event => isEventStart(event, day, identifier, firstWeekday));
},
getEventsForDayAll(day) {
const identifier = getDayIdentifier(day);
const firstWeekday = this.eventWeekdays[0];
return this.parsedEvents.filter(event => event.allDay && (this.categoryMode ? isEventOn(event, identifier) : isEventStart(event, day, identifier, firstWeekday)) && this.isEventForCategory(event, day.category));
},
getEventsForDayTimed(day) {
const identifier = getDayIdentifier(day);
return this.parsedEvents.filter(event => !event.allDay && isEventOn(event, identifier) && this.isEventForCategory(event, day.category));
},
getScopedSlots() {
if (this.noEvents) {
return { ...this.$scopedSlots
};
}
const mode = this.eventModeFunction(this.parsedEvents, this.eventWeekdays[0], this.parsedEventOverlapThreshold);
const isNode = input => !!input;
const getSlotChildren = (day, getter, mapper, timed) => {
const events = getter(day);
const visuals = mode(day, events, timed, this.categoryMode);
if (timed) {
return visuals.map(visual => mapper(visual, day)).filter(isNode);
}
const children = [];
visuals.forEach((visual, index) => {
while (children.length < visual.column) {
children.push(this.genPlaceholder(day));
}
const mapped = mapper(visual, day);
if (mapped) {
children.push(mapped);
}
});
return children;
};
const slots = this.$scopedSlots;
const slotDay = slots.day;
const slotDayHeader = slots['day-header'];
const slotDayBody = slots['day-body'];
return { ...slots,
day: day => {
let children = getSlotChildren(day, this.getEventsForDay, this.genDayEvent, false);
if (children && children.length > 0 && this.eventMore) {
children.push(this.genMore(day));
}
if (slotDay) {
const slot = slotDay(day);
if (slot) {
children = children ? children.concat(slot) : slot;
}
}
return children;
},
'day-header': day => {
let children = getSlotChildren(day, this.getEventsForDayAll, this.genDayEvent, false);
if (slotDayHeader) {
const slot = slotDayHeader(day);
if (slot) {
children = children ? children.concat(slot) : slot;
}
}
return children;
},
'day-body': day => {
const events = getSlotChildren(day, this.getEventsForDayTimed, this.genTimedEvent, true);
let children = [this.$createElement('div', {
staticClass: 'v-event-timed-container'
}, events)];
if (slotDayBody) {
const slot = slotDayBody(day);
if (slot) {
children = children.concat(slot);
}
}
return children;
}
};
}
}
});
//# sourceMappingURL=calendar-with-events.js.map
File diff suppressed because one or more lines are too long
@@ -1,161 +0,0 @@
// Mixins
import CalendarBase from './calendar-base'; // Util
import props from '../util/props';
import { parseTime, copyTimestamp, updateMinutes, createDayList, createIntervalList, createNativeLocaleFormatter, MINUTES_IN_DAY } from '../util/timestamp';
/* @vue/component */
export default CalendarBase.extend({
name: 'calendar-with-intervals',
props: props.intervals,
computed: {
parsedFirstInterval() {
return parseInt(this.firstInterval);
},
parsedIntervalMinutes() {
return parseInt(this.intervalMinutes);
},
parsedIntervalCount() {
return parseInt(this.intervalCount);
},
parsedIntervalHeight() {
return parseFloat(this.intervalHeight);
},
parsedFirstTime() {
return parseTime(this.firstTime);
},
firstMinute() {
const time = this.parsedFirstTime;
return time !== false && time >= 0 && time <= MINUTES_IN_DAY ? time : this.parsedFirstInterval * this.parsedIntervalMinutes;
},
bodyHeight() {
return this.parsedIntervalCount * this.parsedIntervalHeight;
},
days() {
return createDayList(this.parsedStart, this.parsedEnd, this.times.today, this.weekdaySkips, this.maxDays);
},
intervals() {
const days = this.days;
const first = this.firstMinute;
const minutes = this.parsedIntervalMinutes;
const count = this.parsedIntervalCount;
const now = this.times.now;
return days.map(d => createIntervalList(d, first, minutes, count, now));
},
intervalFormatter() {
if (this.intervalFormat) {
return this.intervalFormat;
}
const longOptions = {
timeZone: 'UTC',
hour: '2-digit',
minute: '2-digit'
};
const shortOptions = {
timeZone: 'UTC',
hour: 'numeric',
minute: '2-digit'
};
const shortHourOptions = {
timeZone: 'UTC',
hour: 'numeric'
};
return createNativeLocaleFormatter(this.currentLocale, (tms, short) => short ? tms.minute === 0 ? shortHourOptions : shortOptions : longOptions);
}
},
methods: {
showIntervalLabelDefault(interval) {
const first = this.intervals[0][0];
const isFirst = first.hour === interval.hour && first.minute === interval.minute;
return !isFirst;
},
intervalStyleDefault(_interval) {
return undefined;
},
getTimestampAtEvent(e, day) {
const timestamp = copyTimestamp(day);
const bounds = e.currentTarget.getBoundingClientRect();
const baseMinutes = this.firstMinute;
const touchEvent = e;
const mouseEvent = e;
const touches = touchEvent.changedTouches || touchEvent.touches;
const clientY = touches && touches[0] ? touches[0].clientY : mouseEvent.clientY;
const addIntervals = (clientY - bounds.top) / this.parsedIntervalHeight;
const addMinutes = Math.floor(addIntervals * this.parsedIntervalMinutes);
const minutes = baseMinutes + addMinutes;
return updateMinutes(timestamp, minutes, this.times.now);
},
getSlotScope(timestamp) {
const scope = copyTimestamp(timestamp);
scope.timeToY = this.timeToY;
scope.timeDelta = this.timeDelta;
scope.minutesToPixels = this.minutesToPixels;
scope.week = this.days;
return scope;
},
scrollToTime(time) {
const y = this.timeToY(time);
const pane = this.$refs.scrollArea;
if (y === false || !pane) {
return false;
}
pane.scrollTop = y;
return true;
},
minutesToPixels(minutes) {
return minutes / this.parsedIntervalMinutes * this.parsedIntervalHeight;
},
timeToY(time, clamp = true) {
let y = this.timeDelta(time);
if (y !== false) {
y *= this.bodyHeight;
if (clamp) {
if (y < 0) {
y = 0;
}
if (y > this.bodyHeight) {
y = this.bodyHeight;
}
}
}
return y;
},
timeDelta(time) {
const minutes = parseTime(time);
if (minutes === false) {
return false;
}
const min = this.firstMinute;
const gap = this.parsedIntervalCount * this.parsedIntervalMinutes;
return (minutes - min) / gap;
}
}
});
//# sourceMappingURL=calendar-with-intervals.js.map
File diff suppressed because one or more lines are too long
-87
View File
@@ -1,87 +0,0 @@
import Vue from 'vue';
export default Vue.extend({
name: 'mouse',
methods: {
getDefaultMouseEventHandlers(suffix, getEvent) {
return this.getMouseEventHandlers({
['click' + suffix]: {
event: 'click'
},
['contextmenu' + suffix]: {
event: 'contextmenu',
prevent: true,
result: false
},
['mousedown' + suffix]: {
event: 'mousedown'
},
['mousemove' + suffix]: {
event: 'mousemove'
},
['mouseup' + suffix]: {
event: 'mouseup'
},
['mouseenter' + suffix]: {
event: 'mouseenter'
},
['mouseleave' + suffix]: {
event: 'mouseleave'
},
['touchstart' + suffix]: {
event: 'touchstart'
},
['touchmove' + suffix]: {
event: 'touchmove'
},
['touchend' + suffix]: {
event: 'touchend'
}
}, getEvent);
},
getMouseEventHandlers(events, getEvent) {
const on = {};
for (const event in events) {
const eventOptions = events[event];
if (!this.$listeners[event]) continue; // TODO somehow pull in modifiers
const prefix = eventOptions.passive ? '&' : (eventOptions.once ? '~' : '') + (eventOptions.capture ? '!' : '');
const key = prefix + eventOptions.event;
const handler = e => {
const mouseEvent = e;
if (eventOptions.button === undefined || mouseEvent.buttons > 0 && mouseEvent.button === eventOptions.button) {
if (eventOptions.prevent) {
e.preventDefault();
}
if (eventOptions.stop) {
e.stopPropagation();
}
this.$emit(event, getEvent(e));
}
return eventOptions.result;
};
if (key in on) {
/* istanbul ignore next */
if (Array.isArray(on[key])) {
on[key].push(handler);
} else {
on[key] = [on[key], handler];
}
} else {
on[key] = handler;
}
}
return on;
}
}
});
//# sourceMappingURL=mouse.js.map
-1
View File
@@ -1 +0,0 @@
{"version":3,"sources":["../../../../src/components/VCalendar/mixins/mouse.ts"],"names":[],"mappings":"AAAA,OAAO,GAAP,MAAgB,KAAhB;AAqBA,eAAe,GAAG,CAAC,MAAJ,CAAW;AACxB,EAAA,IAAI,EAAE,OADkB;AAGxB,EAAA,OAAO,EAAE;AACP,IAAA,4BAA4B,CAAE,MAAF,EAAkB,QAAlB,EAAwC;AAClE,aAAO,KAAK,qBAAL,CAA2B;AAChC,SAAC,UAAU,MAAX,GAAoB;AAAE,UAAA,KAAK,EAAE;AAAT,SADY;AAEhC,SAAC,gBAAgB,MAAjB,GAA0B;AAAE,UAAA,KAAK,EAAE,aAAT;AAAwB,UAAA,OAAO,EAAE,IAAjC;AAAuC,UAAA,MAAM,EAAE;AAA/C,SAFM;AAGhC,SAAC,cAAc,MAAf,GAAwB;AAAE,UAAA,KAAK,EAAE;AAAT,SAHQ;AAIhC,SAAC,cAAc,MAAf,GAAwB;AAAE,UAAA,KAAK,EAAE;AAAT,SAJQ;AAKhC,SAAC,YAAY,MAAb,GAAsB;AAAE,UAAA,KAAK,EAAE;AAAT,SALU;AAMhC,SAAC,eAAe,MAAhB,GAAyB;AAAE,UAAA,KAAK,EAAE;AAAT,SANO;AAOhC,SAAC,eAAe,MAAhB,GAAyB;AAAE,UAAA,KAAK,EAAE;AAAT,SAPO;AAQhC,SAAC,eAAe,MAAhB,GAAyB;AAAE,UAAA,KAAK,EAAE;AAAT,SARO;AAShC,SAAC,cAAc,MAAf,GAAwB;AAAE,UAAA,KAAK,EAAE;AAAT,SATQ;AAUhC,SAAC,aAAa,MAAd,GAAuB;AAAE,UAAA,KAAK,EAAE;AAAT;AAVS,OAA3B,EAWJ,QAXI,CAAP;AAYD,KAdM;;AAeP,IAAA,qBAAqB,CAAE,MAAF,EAAuB,QAAvB,EAA6C;AAChE,YAAM,EAAE,GAAmB,EAA3B;;AAEA,WAAK,MAAM,KAAX,IAAoB,MAApB,EAA4B;AAC1B,cAAM,YAAY,GAAG,MAAM,CAAC,KAAD,CAA3B;AAEA,YAAI,CAAC,KAAK,UAAL,CAAgB,KAAhB,CAAL,EAA6B,SAHH,CAK1B;;AAEA,cAAM,MAAM,GAAG,YAAY,CAAC,OAAb,GAAuB,GAAvB,GAA8B,CAAC,YAAY,CAAC,IAAb,GAAoB,GAApB,GAA0B,EAA3B,KAAkC,YAAY,CAAC,OAAb,GAAuB,GAAvB,GAA6B,EAA/D,CAA7C;AACA,cAAM,GAAG,GAAG,MAAM,GAAG,YAAY,CAAC,KAAlC;;AAEA,cAAM,OAAO,GAAiB,CAAC,IAAG;AAChC,gBAAM,UAAU,GAAe,CAA/B;;AACA,cAAI,YAAY,CAAC,MAAb,KAAwB,SAAxB,IAAsC,UAAU,CAAC,OAAX,GAAqB,CAArB,IAA0B,UAAU,CAAC,MAAX,KAAsB,YAAY,CAAC,MAAvG,EAAgH;AAC9G,gBAAI,YAAY,CAAC,OAAjB,EAA0B;AACxB,cAAA,CAAC,CAAC,cAAF;AACD;;AACD,gBAAI,YAAY,CAAC,IAAjB,EAAuB;AACrB,cAAA,CAAC,CAAC,eAAF;AACD;;AACD,iBAAK,KAAL,CAAW,KAAX,EAAkB,QAAQ,CAAC,CAAD,CAA1B;AACD;;AAED,iBAAO,YAAY,CAAC,MAApB;AACD,SAbD;;AAeA,YAAI,GAAG,IAAI,EAAX,EAAe;AACb;AACA,cAAI,KAAK,CAAC,OAAN,CAAc,EAAE,CAAC,GAAD,CAAhB,CAAJ,EAA4B;AACzB,YAAA,EAAE,CAAC,GAAD,CAAF,CAA2B,IAA3B,CAAgC,OAAhC;AACF,WAFD,MAEO;AACL,YAAA,EAAE,CAAC,GAAD,CAAF,GAAU,CAAC,EAAE,CAAC,GAAD,CAAH,EAAU,OAAV,CAAV;AACD;AACF,SAPD,MAOO;AACL,UAAA,EAAE,CAAC,GAAD,CAAF,GAAU,OAAV;AACD;AACF;;AAED,aAAO,EAAP;AACD;;AAxDM;AAHe,CAAX,CAAf","sourcesContent":["import Vue from 'vue'\n\nexport type MouseHandler = (e: MouseEvent | TouchEvent) => any\n\nexport type MouseEvents = {\n [event: string]: {\n event: string\n passive?: boolean\n capture?: boolean\n once?: boolean\n stop?: boolean\n prevent?: boolean\n button?: number\n result?: any\n }\n}\n\nexport type MouseEventsMap = {\n [event: string]: MouseHandler | MouseHandler[]\n}\n\nexport default Vue.extend({\n name: 'mouse',\n\n methods: {\n getDefaultMouseEventHandlers (suffix: string, getEvent: MouseHandler): MouseEventsMap {\n return this.getMouseEventHandlers({\n ['click' + suffix]: { event: 'click' },\n ['contextmenu' + suffix]: { event: 'contextmenu', prevent: true, result: false },\n ['mousedown' + suffix]: { event: 'mousedown' },\n ['mousemove' + suffix]: { event: 'mousemove' },\n ['mouseup' + suffix]: { event: 'mouseup' },\n ['mouseenter' + suffix]: { event: 'mouseenter' },\n ['mouseleave' + suffix]: { event: 'mouseleave' },\n ['touchstart' + suffix]: { event: 'touchstart' },\n ['touchmove' + suffix]: { event: 'touchmove' },\n ['touchend' + suffix]: { event: 'touchend' },\n }, getEvent)\n },\n getMouseEventHandlers (events: MouseEvents, getEvent: MouseHandler): MouseEventsMap {\n const on: MouseEventsMap = {}\n\n for (const event in events) {\n const eventOptions = events[event]\n\n if (!this.$listeners[event]) continue\n\n // TODO somehow pull in modifiers\n\n const prefix = eventOptions.passive ? '&' : ((eventOptions.once ? '~' : '') + (eventOptions.capture ? '!' : ''))\n const key = prefix + eventOptions.event\n\n const handler: MouseHandler = e => {\n const mouseEvent: MouseEvent = e as MouseEvent\n if (eventOptions.button === undefined || (mouseEvent.buttons > 0 && mouseEvent.button === eventOptions.button)) {\n if (eventOptions.prevent) {\n e.preventDefault()\n }\n if (eventOptions.stop) {\n e.stopPropagation()\n }\n this.$emit(event, getEvent(e))\n }\n\n return eventOptions.result\n }\n\n if (key in on) {\n /* istanbul ignore next */\n if (Array.isArray(on[key])) {\n (on[key] as MouseHandler[]).push(handler)\n } else {\n on[key] = [on[key], handler] as MouseHandler[]\n }\n } else {\n on[key] = handler\n }\n }\n\n return on\n },\n },\n})\n"],"sourceRoot":"","file":"mouse.js"}
-70
View File
@@ -1,70 +0,0 @@
import Vue from 'vue';
import { validateTimestamp, parseTimestamp, parseDate } from '../util/timestamp';
export default Vue.extend({
name: 'times',
props: {
now: {
type: String,
validator: validateTimestamp
}
},
data: () => ({
times: {
now: parseTimestamp('0000-00-00 00:00', true),
today: parseTimestamp('0000-00-00', true)
}
}),
computed: {
parsedNow() {
return this.now ? parseTimestamp(this.now, true) : null;
}
},
watch: {
parsedNow: 'updateTimes'
},
created() {
this.updateTimes();
this.setPresent();
},
methods: {
setPresent() {
this.times.now.present = this.times.today.present = true;
this.times.now.past = this.times.today.past = false;
this.times.now.future = this.times.today.future = false;
},
updateTimes() {
const now = this.parsedNow || this.getNow();
this.updateDay(now, this.times.now);
this.updateTime(now, this.times.now);
this.updateDay(now, this.times.today);
},
getNow() {
return parseDate(new Date());
},
updateDay(now, target) {
if (now.date !== target.date) {
target.year = now.year;
target.month = now.month;
target.day = now.day;
target.weekday = now.weekday;
target.date = now.date;
}
},
updateTime(now, target) {
if (now.time !== target.time) {
target.hour = now.hour;
target.minute = now.minute;
target.time = now.time;
}
}
}
});
//# sourceMappingURL=times.js.map
-1
View File
@@ -1 +0,0 @@
{"version":3,"sources":["../../../../src/components/VCalendar/mixins/times.ts"],"names":[],"mappings":"AAAA,OAAO,GAAP,MAAgB,KAAhB;AAEA,SACE,iBADF,EAEE,cAFF,EAGE,SAHF,QAIO,mBAJP;AAOA,eAAe,GAAG,CAAC,MAAJ,CAAW;AACxB,EAAA,IAAI,EAAE,OADkB;AAGxB,EAAA,KAAK,EAAE;AACL,IAAA,GAAG,EAAE;AACH,MAAA,IAAI,EAAE,MADH;AAEH,MAAA,SAAS,EAAE;AAFR;AADA,GAHiB;AAUxB,EAAA,IAAI,EAAE,OAAO;AACX,IAAA,KAAK,EAAE;AACL,MAAA,GAAG,EAAE,cAAc,CAAC,kBAAD,EAAqB,IAArB,CADd;AAEL,MAAA,KAAK,EAAE,cAAc,CAAC,YAAD,EAAe,IAAf;AAFhB;AADI,GAAP,CAVkB;AAiBxB,EAAA,QAAQ,EAAE;AACR,IAAA,SAAS,GAAA;AACP,aAAO,KAAK,GAAL,GAAW,cAAc,CAAC,KAAK,GAAN,EAAW,IAAX,CAAzB,GAA4C,IAAnD;AACD;;AAHO,GAjBc;AAuBxB,EAAA,KAAK,EAAE;AACL,IAAA,SAAS,EAAE;AADN,GAvBiB;;AA2BxB,EAAA,OAAO,GAAA;AACL,SAAK,WAAL;AACA,SAAK,UAAL;AACD,GA9BuB;;AAgCxB,EAAA,OAAO,EAAE;AACP,IAAA,UAAU,GAAA;AACR,WAAK,KAAL,CAAW,GAAX,CAAe,OAAf,GAAyB,KAAK,KAAL,CAAW,KAAX,CAAiB,OAAjB,GAA2B,IAApD;AACA,WAAK,KAAL,CAAW,GAAX,CAAe,IAAf,GAAsB,KAAK,KAAL,CAAW,KAAX,CAAiB,IAAjB,GAAwB,KAA9C;AACA,WAAK,KAAL,CAAW,GAAX,CAAe,MAAf,GAAwB,KAAK,KAAL,CAAW,KAAX,CAAiB,MAAjB,GAA0B,KAAlD;AACD,KALM;;AAMP,IAAA,WAAW,GAAA;AACT,YAAM,GAAG,GAAsB,KAAK,SAAL,IAAkB,KAAK,MAAL,EAAjD;AACA,WAAK,SAAL,CAAe,GAAf,EAAoB,KAAK,KAAL,CAAW,GAA/B;AACA,WAAK,UAAL,CAAgB,GAAhB,EAAqB,KAAK,KAAL,CAAW,GAAhC;AACA,WAAK,SAAL,CAAe,GAAf,EAAoB,KAAK,KAAL,CAAW,KAA/B;AACD,KAXM;;AAYP,IAAA,MAAM,GAAA;AACJ,aAAO,SAAS,CAAC,IAAI,IAAJ,EAAD,CAAhB;AACD,KAdM;;AAeP,IAAA,SAAS,CAAE,GAAF,EAA0B,MAA1B,EAAmD;AAC1D,UAAI,GAAG,CAAC,IAAJ,KAAa,MAAM,CAAC,IAAxB,EAA8B;AAC5B,QAAA,MAAM,CAAC,IAAP,GAAc,GAAG,CAAC,IAAlB;AACA,QAAA,MAAM,CAAC,KAAP,GAAe,GAAG,CAAC,KAAnB;AACA,QAAA,MAAM,CAAC,GAAP,GAAa,GAAG,CAAC,GAAjB;AACA,QAAA,MAAM,CAAC,OAAP,GAAiB,GAAG,CAAC,OAArB;AACA,QAAA,MAAM,CAAC,IAAP,GAAc,GAAG,CAAC,IAAlB;AACD;AACF,KAvBM;;AAwBP,IAAA,UAAU,CAAE,GAAF,EAA0B,MAA1B,EAAmD;AAC3D,UAAI,GAAG,CAAC,IAAJ,KAAa,MAAM,CAAC,IAAxB,EAA8B;AAC5B,QAAA,MAAM,CAAC,IAAP,GAAc,GAAG,CAAC,IAAlB;AACA,QAAA,MAAM,CAAC,MAAP,GAAgB,GAAG,CAAC,MAApB;AACA,QAAA,MAAM,CAAC,IAAP,GAAc,GAAG,CAAC,IAAlB;AACD;AACF;;AA9BM;AAhCe,CAAX,CAAf","sourcesContent":["import Vue from 'vue'\n\nimport {\n validateTimestamp,\n parseTimestamp,\n parseDate,\n} from '../util/timestamp'\nimport { CalendarTimestamp } from 'vuetify/types'\n\nexport default Vue.extend({\n name: 'times',\n\n props: {\n now: {\n type: String,\n validator: validateTimestamp,\n },\n },\n\n data: () => ({\n times: {\n now: parseTimestamp('0000-00-00 00:00', true),\n today: parseTimestamp('0000-00-00', true),\n },\n }),\n\n computed: {\n parsedNow (): CalendarTimestamp | null {\n return this.now ? parseTimestamp(this.now, true) : null\n },\n },\n\n watch: {\n parsedNow: 'updateTimes',\n },\n\n created () {\n this.updateTimes()\n this.setPresent()\n },\n\n methods: {\n setPresent (): void {\n this.times.now.present = this.times.today.present = true\n this.times.now.past = this.times.today.past = false\n this.times.now.future = this.times.today.future = false\n },\n updateTimes (): void {\n const now: CalendarTimestamp = this.parsedNow || this.getNow()\n this.updateDay(now, this.times.now)\n this.updateTime(now, this.times.now)\n this.updateDay(now, this.times.today)\n },\n getNow (): CalendarTimestamp {\n return parseDate(new Date())\n },\n updateDay (now: CalendarTimestamp, target: CalendarTimestamp): void {\n if (now.date !== target.date) {\n target.year = now.year\n target.month = now.month\n target.day = now.day\n target.weekday = now.weekday\n target.date = now.date\n }\n },\n updateTime (now: CalendarTimestamp, target: CalendarTimestamp): void {\n if (now.time !== target.time) {\n target.hour = now.hour\n target.minute = now.minute\n target.time = now.time\n }\n },\n },\n})\n"],"sourceRoot":"","file":"times.js"}
-18
View File
@@ -1,18 +0,0 @@
import { getOverlapGroupHandler } from './common';
const FULL_WIDTH = 100;
export const column = (events, firstWeekday, overlapThreshold) => {
const handler = getOverlapGroupHandler(firstWeekday);
return (day, dayEvents, timed, reset) => {
const visuals = handler.getVisuals(day, dayEvents, timed, reset);
if (timed) {
visuals.forEach(visual => {
visual.left = visual.column * FULL_WIDTH / visual.columnCount;
visual.width = FULL_WIDTH / visual.columnCount;
});
}
return visuals;
};
};
//# sourceMappingURL=column.js.map
-1
View File
@@ -1 +0,0 @@
{"version":3,"sources":["../../../../src/components/VCalendar/modes/column.ts"],"names":[],"mappings":"AACA,SAAS,sBAAT,QAAuC,UAAvC;AAEA,MAAM,UAAU,GAAG,GAAnB;AAEA,OAAO,MAAM,MAAM,GAA6B,CAAC,MAAD,EAAS,YAAT,EAAuB,gBAAvB,KAA2C;AACzF,QAAM,OAAO,GAAG,sBAAsB,CAAC,YAAD,CAAtC;AAEA,SAAO,CAAC,GAAD,EAAM,SAAN,EAAiB,KAAjB,EAAwB,KAAxB,KAAiC;AACtC,UAAM,OAAO,GAAG,OAAO,CAAC,UAAR,CAAmB,GAAnB,EAAwB,SAAxB,EAAmC,KAAnC,EAA0C,KAA1C,CAAhB;;AAEA,QAAI,KAAJ,EAAW;AACT,MAAA,OAAO,CAAC,OAAR,CAAgB,MAAM,IAAG;AACvB,QAAA,MAAM,CAAC,IAAP,GAAc,MAAM,CAAC,MAAP,GAAgB,UAAhB,GAA6B,MAAM,CAAC,WAAlD;AACA,QAAA,MAAM,CAAC,KAAP,GAAe,UAAU,GAAG,MAAM,CAAC,WAAnC;AACD,OAHD;AAID;;AAED,WAAO,OAAP;AACD,GAXD;AAYD,CAfM","sourcesContent":["import { CalendarEventOverlapMode } from 'vuetify/types'\nimport { getOverlapGroupHandler } from './common'\n\nconst FULL_WIDTH = 100\n\nexport const column: CalendarEventOverlapMode = (events, firstWeekday, overlapThreshold) => {\n const handler = getOverlapGroupHandler(firstWeekday)\n\n return (day, dayEvents, timed, reset) => {\n const visuals = handler.getVisuals(day, dayEvents, timed, reset)\n\n if (timed) {\n visuals.forEach(visual => {\n visual.left = visual.column * FULL_WIDTH / visual.columnCount\n visual.width = FULL_WIDTH / visual.columnCount\n })\n }\n\n return visuals\n }\n}\n"],"sourceRoot":"","file":"column.js"}
-119
View File
@@ -1,119 +0,0 @@
import { getTimestampIdentifier } from '../util/timestamp';
const MILLIS_IN_DAY = 86400000;
export function getVisuals(events, minStart = 0) {
const visuals = events.map(event => ({
event,
columnCount: 0,
column: 0,
left: 0,
width: 100
}));
visuals.sort((a, b) => {
return Math.max(minStart, a.event.startTimestampIdentifier) - Math.max(minStart, b.event.startTimestampIdentifier) || b.event.endTimestampIdentifier - a.event.endTimestampIdentifier;
});
return visuals;
}
export function hasOverlap(s0, e0, s1, e1, exclude = true) {
return exclude ? !(s0 >= e1 || e0 <= s1) : !(s0 > e1 || e0 < s1);
}
export function setColumnCount(groups) {
groups.forEach(group => {
group.visuals.forEach(groupVisual => {
groupVisual.columnCount = groups.length;
});
});
}
export function getRange(event) {
return [event.startTimestampIdentifier, event.endTimestampIdentifier];
}
export function getDayRange(event) {
return [event.startIdentifier, event.endIdentifier];
}
export function getNormalizedRange(event, dayStart) {
return [Math.max(dayStart, event.startTimestampIdentifier), Math.min(dayStart + MILLIS_IN_DAY, event.endTimestampIdentifier)];
}
export function getOpenGroup(groups, start, end, timed) {
for (let i = 0; i < groups.length; i++) {
const group = groups[i];
let intersected = false;
if (hasOverlap(start, end, group.start, group.end, timed)) {
for (let k = 0; k < group.visuals.length; k++) {
const groupVisual = group.visuals[k];
const [groupStart, groupEnd] = timed ? getRange(groupVisual.event) : getDayRange(groupVisual.event);
if (hasOverlap(start, end, groupStart, groupEnd, timed)) {
intersected = true;
break;
}
}
}
if (!intersected) {
return i;
}
}
return -1;
}
export function getOverlapGroupHandler(firstWeekday) {
const handler = {
groups: [],
min: -1,
max: -1,
reset: () => {
handler.groups = [];
handler.min = handler.max = -1;
},
getVisuals: (day, dayEvents, timed, reset = false) => {
if (day.weekday === firstWeekday || reset) {
handler.reset();
}
const dayStart = getTimestampIdentifier(day);
const visuals = getVisuals(dayEvents, dayStart);
visuals.forEach(visual => {
const [start, end] = timed ? getRange(visual.event) : getDayRange(visual.event);
if (handler.groups.length > 0 && !hasOverlap(start, end, handler.min, handler.max, timed)) {
setColumnCount(handler.groups);
handler.reset();
}
let targetGroup = getOpenGroup(handler.groups, start, end, timed);
if (targetGroup === -1) {
targetGroup = handler.groups.length;
handler.groups.push({
start,
end,
visuals: []
});
}
const target = handler.groups[targetGroup];
target.visuals.push(visual);
target.start = Math.min(target.start, start);
target.end = Math.max(target.end, end);
visual.column = targetGroup;
if (handler.min === -1) {
handler.min = start;
handler.max = end;
} else {
handler.min = Math.min(handler.min, start);
handler.max = Math.max(handler.max, end);
}
});
setColumnCount(handler.groups);
if (timed) {
handler.reset();
}
return visuals;
}
};
return handler;
}
//# sourceMappingURL=common.js.map
File diff suppressed because one or more lines are too long
-7
View File
@@ -1,7 +0,0 @@
import { stack } from './stack';
import { column } from './column';
export const CalendarEventOverlapModes = {
stack,
column
};
//# sourceMappingURL=index.js.map
-1
View File
@@ -1 +0,0 @@
{"version":3,"sources":["../../../../src/components/VCalendar/modes/index.ts"],"names":[],"mappings":"AACA,SAAS,KAAT,QAAsB,SAAtB;AACA,SAAS,MAAT,QAAuB,UAAvB;AAEA,OAAO,MAAM,yBAAyB,GAA6C;AACjF,EAAA,KADiF;AAEjF,EAAA;AAFiF,CAA5E","sourcesContent":["import { CalendarEventOverlapMode } from 'vuetify/types'\nimport { stack } from './stack'\nimport { column } from './column'\n\nexport const CalendarEventOverlapModes: Record<string, CalendarEventOverlapMode> = {\n stack,\n column,\n}\n"],"sourceRoot":"","file":"index.js"}
-242
View File
@@ -1,242 +0,0 @@
import { getOverlapGroupHandler, getVisuals, hasOverlap, getNormalizedRange } from './common';
import { getTimestampIdentifier } from '../util/timestamp';
const FULL_WIDTH = 100;
const DEFAULT_OFFSET = 5;
const WIDTH_MULTIPLIER = 1.7;
/**
* Variation of column mode where events can be stacked. The priority of this
* mode is to stack events together taking up the least amount of space while
* trying to ensure the content of the event is always visible as well as its
* start and end. A sibling column has intersecting event content and must be
* placed beside each other. Non-sibling columns are offset by 5% from the
* previous column. The width is scaled by 1.7 so the events overlap and
* whitespace is reduced. If there is a hole in columns the event width is
* scaled up so it intersects with the next column. The columns have equal
* width in the space they are given. If the event doesn't have any to the
* right of it that intersect with it's content it's right side is extended
* to the right side.
*/
export const stack = (events, firstWeekday, overlapThreshold) => {
const handler = getOverlapGroupHandler(firstWeekday); // eslint-disable-next-line max-statements
return (day, dayEvents, timed, reset) => {
if (!timed) {
return handler.getVisuals(day, dayEvents, timed, reset);
}
const dayStart = getTimestampIdentifier(day);
const visuals = getVisuals(dayEvents, dayStart);
const groups = getGroups(visuals, dayStart);
for (const group of groups) {
const nodes = [];
for (const visual of group.visuals) {
const child = getNode(visual, dayStart);
const index = getNextIndex(child, nodes);
if (index === false) {
const parent = getParent(child, nodes);
if (parent) {
child.parent = parent;
child.sibling = hasOverlap(child.start, child.end, parent.start, addTime(parent.start, overlapThreshold));
child.index = parent.index + 1;
parent.children.push(child);
}
} else {
const [parent] = getOverlappingRange(child, nodes, index - 1, index - 1);
const children = getOverlappingRange(child, nodes, index + 1, index + nodes.length, true);
child.children = children;
child.index = index;
if (parent) {
child.parent = parent;
child.sibling = hasOverlap(child.start, child.end, parent.start, addTime(parent.start, overlapThreshold));
parent.children.push(child);
}
for (const grand of children) {
if (grand.parent === parent) {
grand.parent = child;
}
const grandNext = grand.index - child.index <= 1;
if (grandNext && child.sibling && hasOverlap(child.start, addTime(child.start, overlapThreshold), grand.start, grand.end)) {
grand.sibling = true;
}
}
}
nodes.push(child);
}
calculateBounds(nodes, overlapThreshold);
}
visuals.sort((a, b) => a.left - b.left || a.event.startTimestampIdentifier - b.event.startTimestampIdentifier);
return visuals;
};
};
function calculateBounds(nodes, overlapThreshold) {
for (const node of nodes) {
const {
visual,
parent
} = node;
const columns = getMaxChildIndex(node) + 1;
const spaceLeft = parent ? parent.visual.left : 0;
const spaceWidth = FULL_WIDTH - spaceLeft;
const offset = Math.min(DEFAULT_OFFSET, FULL_WIDTH / columns);
const columnWidthMultiplier = getColumnWidthMultiplier(node, nodes);
const columnOffset = spaceWidth / (columns - node.index + 1);
const columnWidth = spaceWidth / (columns - node.index + (node.sibling ? 1 : 0)) * columnWidthMultiplier;
if (parent) {
visual.left = node.sibling ? spaceLeft + columnOffset : spaceLeft + offset;
}
visual.width = hasFullWidth(node, nodes, overlapThreshold) ? FULL_WIDTH - visual.left : Math.min(FULL_WIDTH - visual.left, columnWidth * WIDTH_MULTIPLIER);
}
}
function getColumnWidthMultiplier(node, nodes) {
if (!node.children.length) {
return 1;
}
const maxColumn = node.index + nodes.length;
const minColumn = node.children.reduce((min, c) => Math.min(min, c.index), maxColumn);
return minColumn - node.index;
}
function getOverlappingIndices(node, nodes) {
const indices = [];
for (const other of nodes) {
if (hasOverlap(node.start, node.end, other.start, other.end)) {
indices.push(other.index);
}
}
return indices;
}
function getNextIndex(node, nodes) {
const indices = getOverlappingIndices(node, nodes);
indices.sort();
for (let i = 0; i < indices.length; i++) {
if (i < indices[i]) {
return i;
}
}
return false;
}
function getOverlappingRange(node, nodes, indexMin, indexMax, returnFirstColumn = false) {
const overlapping = [];
for (const other of nodes) {
if (other.index >= indexMin && other.index <= indexMax && hasOverlap(node.start, node.end, other.start, other.end)) {
overlapping.push(other);
}
}
if (returnFirstColumn && overlapping.length > 0) {
const first = overlapping.reduce((min, n) => Math.min(min, n.index), overlapping[0].index);
return overlapping.filter(n => n.index === first);
}
return overlapping;
}
function getParent(node, nodes) {
let parent = null;
for (const other of nodes) {
if (hasOverlap(node.start, node.end, other.start, other.end) && (parent === null || other.index > parent.index)) {
parent = other;
}
}
return parent;
}
function hasFullWidth(node, nodes, overlapThreshold) {
for (const other of nodes) {
if (other !== node && other.index > node.index && hasOverlap(node.start, addTime(node.start, overlapThreshold), other.start, other.end)) {
return false;
}
}
return true;
}
function getGroups(visuals, dayStart) {
const groups = [];
for (const visual of visuals) {
const [start, end] = getNormalizedRange(visual.event, dayStart);
let added = false;
for (const group of groups) {
if (hasOverlap(start, end, group.start, group.end)) {
group.visuals.push(visual);
group.end = Math.max(group.end, end);
added = true;
break;
}
}
if (!added) {
groups.push({
start,
end,
visuals: [visual]
});
}
}
return groups;
}
function getNode(visual, dayStart) {
const [start, end] = getNormalizedRange(visual.event, dayStart);
return {
parent: null,
sibling: true,
index: 0,
visual,
start,
end,
children: []
};
}
function getMaxChildIndex(node) {
let max = node.index;
for (const child of node.children) {
const childMax = getMaxChildIndex(child);
if (childMax > max) {
max = childMax;
}
}
return max;
}
function addTime(identifier, minutes) {
const removeMinutes = identifier % 100;
const totalMinutes = removeMinutes + minutes;
const addHours = Math.floor(totalMinutes / 60);
const addMinutes = totalMinutes % 60;
return identifier - removeMinutes + addHours * 100 + addMinutes;
}
//# sourceMappingURL=stack.js.map
File diff suppressed because one or more lines are too long
-37
View File
@@ -1,37 +0,0 @@
import { parseTimestamp, getDayIdentifier, getTimestampIdentifier, OFFSET_TIME, isTimedless, updateHasTime } from './timestamp';
export function parseEvent(input, index, startProperty, endProperty, timed = false, category = false) {
const startInput = input[startProperty];
const endInput = input[endProperty];
const startParsed = parseTimestamp(startInput, true);
const endParsed = endInput ? parseTimestamp(endInput, true) : startParsed;
const start = isTimedless(startInput) ? updateHasTime(startParsed, timed) : startParsed;
const end = isTimedless(endInput) ? updateHasTime(endParsed, timed) : endParsed;
const startIdentifier = getDayIdentifier(start);
const startTimestampIdentifier = getTimestampIdentifier(start);
const endIdentifier = getDayIdentifier(end);
const endOffset = start.hasTime ? 0 : 2359;
const endTimestampIdentifier = getTimestampIdentifier(end) + endOffset;
const allDay = !start.hasTime;
return {
input,
start,
startIdentifier,
startTimestampIdentifier,
end,
endIdentifier,
endTimestampIdentifier,
allDay,
index,
category
};
}
export function isEventOn(event, dayIdentifier) {
return dayIdentifier >= event.startIdentifier && dayIdentifier <= event.endIdentifier && dayIdentifier * OFFSET_TIME !== event.endTimestampIdentifier;
}
export function isEventStart(event, day, dayIdentifier, firstWeekday) {
return dayIdentifier === event.startIdentifier || firstWeekday === day.weekday && isEventOn(event, dayIdentifier);
}
export function isEventOverlapping(event, startIdentifier, endIdentifier) {
return startIdentifier <= event.endIdentifier && endIdentifier >= event.startIdentifier;
}
//# sourceMappingURL=events.js.map
-1
View File
@@ -1 +0,0 @@
{"version":3,"sources":["../../../../src/components/VCalendar/util/events.ts"],"names":[],"mappings":"AAAA,SACE,cADF,EAEE,gBAFF,EAGE,sBAHF,EAIE,WAJF,EAKE,WALF,EAME,aANF,QAOO,aAPP;AAUA,OAAM,SAAU,UAAV,CACJ,KADI,EAEJ,KAFI,EAGJ,aAHI,EAIJ,WAJI,EAKJ,KAAK,GAAG,KALJ,EAMJ,QAAA,GAA2B,KANvB,EAM4B;AAEhC,QAAM,UAAU,GAAG,KAAK,CAAC,aAAD,CAAxB;AACA,QAAM,QAAQ,GAAG,KAAK,CAAC,WAAD,CAAtB;AACA,QAAM,WAAW,GAAsB,cAAc,CAAC,UAAD,EAAa,IAAb,CAArD;AACA,QAAM,SAAS,GAAuB,QAAQ,GAAG,cAAc,CAAC,QAAD,EAAW,IAAX,CAAjB,GAAoC,WAAlF;AACA,QAAM,KAAK,GAAsB,WAAW,CAAC,UAAD,CAAX,GAC7B,aAAa,CAAC,WAAD,EAAc,KAAd,CADgB,GAE7B,WAFJ;AAGA,QAAM,GAAG,GAAsB,WAAW,CAAC,QAAD,CAAX,GAC3B,aAAa,CAAC,SAAD,EAAY,KAAZ,CADc,GAE3B,SAFJ;AAGA,QAAM,eAAe,GAAW,gBAAgB,CAAC,KAAD,CAAhD;AACA,QAAM,wBAAwB,GAAW,sBAAsB,CAAC,KAAD,CAA/D;AACA,QAAM,aAAa,GAAW,gBAAgB,CAAC,GAAD,CAA9C;AACA,QAAM,SAAS,GAAW,KAAK,CAAC,OAAN,GAAgB,CAAhB,GAAoB,IAA9C;AACA,QAAM,sBAAsB,GAAW,sBAAsB,CAAC,GAAD,CAAtB,GAA8B,SAArE;AACA,QAAM,MAAM,GAAY,CAAC,KAAK,CAAC,OAA/B;AAEA,SAAO;AAAE,IAAA,KAAF;AAAS,IAAA,KAAT;AAAgB,IAAA,eAAhB;AAAiC,IAAA,wBAAjC;AAA2D,IAAA,GAA3D;AAAgE,IAAA,aAAhE;AAA+E,IAAA,sBAA/E;AAAuG,IAAA,MAAvG;AAA+G,IAAA,KAA/G;AAAsH,IAAA;AAAtH,GAAP;AACD;AAED,OAAM,SAAU,SAAV,CAAqB,KAArB,EAAiD,aAAjD,EAAsE;AAC1E,SAAO,aAAa,IAAI,KAAK,CAAC,eAAvB,IACL,aAAa,IAAI,KAAK,CAAC,aADlB,IAEL,aAAa,GAAG,WAAhB,KAAgC,KAAK,CAAC,sBAFxC;AAGD;AAED,OAAM,SAAU,YAAV,CAAwB,KAAxB,EAAoD,GAApD,EAA4E,aAA5E,EAAmG,YAAnG,EAAuH;AAC3H,SAAO,aAAa,KAAK,KAAK,CAAC,eAAxB,IAA4C,YAAY,KAAK,GAAG,CAAC,OAArB,IAAgC,SAAS,CAAC,KAAD,EAAQ,aAAR,CAA5F;AACD;AAED,OAAM,SAAU,kBAAV,CAA8B,KAA9B,EAA0D,eAA1D,EAAmF,aAAnF,EAAwG;AAC5G,SAAO,eAAe,IAAI,KAAK,CAAC,aAAzB,IAA0C,aAAa,IAAI,KAAK,CAAC,eAAxE;AACD","sourcesContent":["import {\n parseTimestamp,\n getDayIdentifier,\n getTimestampIdentifier,\n OFFSET_TIME,\n isTimedless,\n updateHasTime,\n} from './timestamp'\nimport { CalendarTimestamp, CalendarEvent, CalendarEventParsed } from 'vuetify/types'\n\nexport function parseEvent (\n input: CalendarEvent,\n index: number,\n startProperty: string,\n endProperty: string,\n timed = false,\n category: string | false = false,\n): CalendarEventParsed {\n const startInput = input[startProperty]\n const endInput = input[endProperty]\n const startParsed: CalendarTimestamp = parseTimestamp(startInput, true)\n const endParsed: CalendarTimestamp = (endInput ? parseTimestamp(endInput, true) : startParsed)\n const start: CalendarTimestamp = isTimedless(startInput)\n ? updateHasTime(startParsed, timed)\n : startParsed\n const end: CalendarTimestamp = isTimedless(endInput)\n ? updateHasTime(endParsed, timed)\n : endParsed\n const startIdentifier: number = getDayIdentifier(start)\n const startTimestampIdentifier: number = getTimestampIdentifier(start)\n const endIdentifier: number = getDayIdentifier(end)\n const endOffset: number = start.hasTime ? 0 : 2359\n const endTimestampIdentifier: number = getTimestampIdentifier(end) + endOffset\n const allDay: boolean = !start.hasTime\n\n return { input, start, startIdentifier, startTimestampIdentifier, end, endIdentifier, endTimestampIdentifier, allDay, index, category }\n}\n\nexport function isEventOn (event: CalendarEventParsed, dayIdentifier: number): boolean {\n return dayIdentifier >= event.startIdentifier &&\n dayIdentifier <= event.endIdentifier &&\n dayIdentifier * OFFSET_TIME !== event.endTimestampIdentifier\n}\n\nexport function isEventStart (event: CalendarEventParsed, day: CalendarTimestamp, dayIdentifier: number, firstWeekday: number): boolean {\n return dayIdentifier === event.startIdentifier || (firstWeekday === day.weekday && isEventOn(event, dayIdentifier))\n}\n\nexport function isEventOverlapping (event: CalendarEventParsed, startIdentifier: number, endIdentifier: number): boolean {\n return startIdentifier <= event.endIdentifier && endIdentifier >= event.startIdentifier\n}\n"],"sourceRoot":"","file":"events.js"}
-255
View File
@@ -1,255 +0,0 @@
import { validateTimestamp, parseDate, DAYS_IN_WEEK, validateTime } from './timestamp';
import { CalendarEventOverlapModes } from '../modes';
export default {
base: {
start: {
type: [String, Number, Date],
validate: validateTimestamp,
default: () => parseDate(new Date()).date
},
end: {
type: [String, Number, Date],
validate: validateTimestamp
},
weekdays: {
type: [Array, String],
default: () => [0, 1, 2, 3, 4, 5, 6],
validate: validateWeekdays
},
hideHeader: {
type: Boolean
},
shortWeekdays: {
type: Boolean,
default: true
},
weekdayFormat: {
type: Function,
default: null
},
dayFormat: {
type: Function,
default: null
}
},
intervals: {
maxDays: {
type: Number,
default: 7
},
shortIntervals: {
type: Boolean,
default: true
},
intervalHeight: {
type: [Number, String],
default: 48,
validate: validateNumber
},
intervalWidth: {
type: [Number, String],
default: 60,
validate: validateNumber
},
intervalMinutes: {
type: [Number, String],
default: 60,
validate: validateNumber
},
firstInterval: {
type: [Number, String],
default: 0,
validate: validateNumber
},
firstTime: {
type: [Number, String, Object],
validate: validateTime
},
intervalCount: {
type: [Number, String],
default: 24,
validate: validateNumber
},
intervalFormat: {
type: Function,
default: null
},
intervalStyle: {
type: Function,
default: null
},
showIntervalLabel: {
type: Function,
default: null
}
},
weeks: {
localeFirstDayOfYear: {
type: [String, Number],
default: 0
},
minWeeks: {
validate: validateNumber,
default: 1
},
shortMonths: {
type: Boolean,
default: true
},
showMonthOnFirst: {
type: Boolean,
default: true
},
showWeek: Boolean,
monthFormat: {
type: Function,
default: null
}
},
calendar: {
type: {
type: String,
default: 'month'
},
value: {
type: [String, Number, Date],
validate: validateTimestamp
}
},
category: {
categories: {
type: [Array, String],
default: ''
},
categoryHideDynamic: {
type: Boolean
},
categoryShowAll: {
type: Boolean
},
categoryForInvalid: {
type: String,
default: ''
},
categoryDays: {
type: [Number, String],
default: 1,
validate: x => isFinite(parseInt(x)) && parseInt(x) > 0
}
},
events: {
events: {
type: Array,
default: () => []
},
eventStart: {
type: String,
default: 'start'
},
eventEnd: {
type: String,
default: 'end'
},
eventTimed: {
type: [String, Function],
default: 'timed'
},
eventCategory: {
type: [String, Function],
default: 'category'
},
eventHeight: {
type: Number,
default: 20
},
eventColor: {
type: [String, Function],
default: 'primary'
},
eventTextColor: {
type: [String, Function],
default: 'white'
},
eventName: {
type: [String, Function],
default: 'name'
},
eventOverlapThreshold: {
type: [String, Number],
default: 60
},
eventOverlapMode: {
type: [String, Function],
default: 'stack',
validate: mode => mode in CalendarEventOverlapModes || typeof mode === 'function'
},
eventMore: {
type: Boolean,
default: true
},
eventMoreText: {
type: String,
default: '$vuetify.calendar.moreEvents'
},
eventRipple: {
type: [Boolean, Object],
default: null
},
eventMarginBottom: {
type: Number,
default: 1
}
}
};
export function validateNumber(input) {
return isFinite(parseInt(input));
}
export function validateWeekdays(input) {
if (typeof input === 'string') {
input = input.split(',');
}
if (Array.isArray(input)) {
const ints = input.map(x => parseInt(x));
if (ints.length > DAYS_IN_WEEK || ints.length === 0) {
return false;
}
const visited = {};
let wrapped = false;
for (let i = 0; i < ints.length; i++) {
const x = ints[i];
if (!isFinite(x) || x < 0 || x >= DAYS_IN_WEEK) {
return false;
}
if (i > 0) {
const d = x - ints[i - 1];
if (d < 0) {
if (wrapped) {
return false;
}
wrapped = true;
} else if (d === 0) {
return false;
}
}
if (visited[x]) {
return false;
}
visited[x] = true;
}
return true;
}
return false;
}
//# sourceMappingURL=props.js.map
File diff suppressed because one or more lines are too long
-454
View File
@@ -1,454 +0,0 @@
import { isLeapYear } from '../../../util/dateTimeUtils';
export const PARSE_REGEX = /^(\d{4})-(\d{1,2})(-(\d{1,2}))?([^\d]+(\d{1,2}))?(:(\d{1,2}))?(:(\d{1,2}))?$/;
export const PARSE_TIME = /(\d\d?)(:(\d\d?)|)(:(\d\d?)|)/;
export const DAYS_IN_MONTH = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
export const DAYS_IN_MONTH_LEAP = [0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
export const DAYS_IN_MONTH_MIN = 28;
export const DAYS_IN_MONTH_MAX = 31;
export const MONTH_MAX = 12;
export const MONTH_MIN = 1;
export const DAY_MIN = 1;
export const DAYS_IN_WEEK = 7;
export const MINUTES_IN_HOUR = 60;
export const MINUTE_MAX = 59;
export const MINUTES_IN_DAY = 24 * 60;
export const HOURS_IN_DAY = 24;
export const HOUR_MAX = 23;
export const FIRST_HOUR = 0;
export const OFFSET_YEAR = 10000;
export const OFFSET_MONTH = 100;
export const OFFSET_HOUR = 100;
export const OFFSET_TIME = 10000;
export function getStartOfWeek(timestamp, weekdays, today) {
const start = copyTimestamp(timestamp);
findWeekday(start, weekdays[0], prevDay);
updateFormatted(start);
if (today) {
updateRelative(start, today, start.hasTime);
}
return start;
}
export function getEndOfWeek(timestamp, weekdays, today) {
const end = copyTimestamp(timestamp);
findWeekday(end, weekdays[weekdays.length - 1]);
updateFormatted(end);
if (today) {
updateRelative(end, today, end.hasTime);
}
return end;
}
export function getStartOfMonth(timestamp) {
const start = copyTimestamp(timestamp);
start.day = DAY_MIN;
updateWeekday(start);
updateFormatted(start);
return start;
}
export function getEndOfMonth(timestamp) {
const end = copyTimestamp(timestamp);
end.day = daysInMonth(end.year, end.month);
updateWeekday(end);
updateFormatted(end);
return end;
}
export function validateTime(input) {
return typeof input === 'number' && isFinite(input) || !!PARSE_TIME.exec(input) || typeof input === 'object' && isFinite(input.hour) && isFinite(input.minute);
}
export function parseTime(input) {
if (typeof input === 'number') {
// when a number is given, it's minutes since 12:00am
return input;
} else if (typeof input === 'string') {
// when a string is given, it's a hh:mm:ss format where seconds are optional
const parts = PARSE_TIME.exec(input);
if (!parts) {
return false;
}
return parseInt(parts[1]) * 60 + parseInt(parts[3] || 0);
} else if (typeof input === 'object') {
// when an object is given, it must have hour and minute
if (typeof input.hour !== 'number' || typeof input.minute !== 'number') {
return false;
}
return input.hour * 60 + input.minute;
} else {
// unsupported type
return false;
}
}
export function validateTimestamp(input) {
return typeof input === 'number' && isFinite(input) || typeof input === 'string' && !!PARSE_REGEX.exec(input) || input instanceof Date;
}
export function parseTimestamp(input, required = false, now) {
if (typeof input === 'number' && isFinite(input)) {
input = new Date(input);
}
if (input instanceof Date) {
const date = parseDate(input);
if (now) {
updateRelative(date, now, date.hasTime);
}
return date;
}
if (typeof input !== 'string') {
if (required) {
throw new Error(`${input} is not a valid timestamp. It must be a Date, number of seconds since Epoch, or a string in the format of YYYY-MM-DD or YYYY-MM-DD hh:mm. Zero-padding is optional and seconds are ignored.`);
}
return null;
} // YYYY-MM-DD hh:mm:ss
const parts = PARSE_REGEX.exec(input);
if (!parts) {
if (required) {
throw new Error(`${input} is not a valid timestamp. It must be a Date, number of seconds since Epoch, or a string in the format of YYYY-MM-DD or YYYY-MM-DD hh:mm. Zero-padding is optional and seconds are ignored.`);
}
return null;
}
const timestamp = {
date: input,
time: '',
year: parseInt(parts[1]),
month: parseInt(parts[2]),
day: parseInt(parts[4]) || 1,
hour: parseInt(parts[6]) || 0,
minute: parseInt(parts[8]) || 0,
weekday: 0,
hasDay: !!parts[4],
hasTime: !!(parts[6] && parts[8]),
past: false,
present: false,
future: false
};
updateWeekday(timestamp);
updateFormatted(timestamp);
if (now) {
updateRelative(timestamp, now, timestamp.hasTime);
}
return timestamp;
}
export function parseDate(date) {
return updateFormatted({
date: '',
time: '',
year: date.getFullYear(),
month: date.getMonth() + 1,
day: date.getDate(),
weekday: date.getDay(),
hour: date.getHours(),
minute: date.getMinutes(),
hasDay: true,
hasTime: true,
past: false,
present: true,
future: false
});
}
export function getDayIdentifier(timestamp) {
return timestamp.year * OFFSET_YEAR + timestamp.month * OFFSET_MONTH + timestamp.day;
}
export function getTimeIdentifier(timestamp) {
return timestamp.hour * OFFSET_HOUR + timestamp.minute;
}
export function getTimestampIdentifier(timestamp) {
return getDayIdentifier(timestamp) * OFFSET_TIME + getTimeIdentifier(timestamp);
}
export function updateRelative(timestamp, now, time = false) {
let a = getDayIdentifier(now);
let b = getDayIdentifier(timestamp);
let present = a === b;
if (timestamp.hasTime && time && present) {
a = getTimeIdentifier(now);
b = getTimeIdentifier(timestamp);
present = a === b;
}
timestamp.past = b < a;
timestamp.present = present;
timestamp.future = b > a;
return timestamp;
}
export function isTimedless(input) {
return input instanceof Date || typeof input === 'number' && isFinite(input);
}
export function updateHasTime(timestamp, hasTime, now) {
if (timestamp.hasTime !== hasTime) {
timestamp.hasTime = hasTime;
if (!hasTime) {
timestamp.hour = HOUR_MAX;
timestamp.minute = MINUTE_MAX;
timestamp.time = getTime(timestamp);
}
if (now) {
updateRelative(timestamp, now, timestamp.hasTime);
}
}
return timestamp;
}
export function updateMinutes(timestamp, minutes, now) {
timestamp.hasTime = true;
timestamp.hour = Math.floor(minutes / MINUTES_IN_HOUR);
timestamp.minute = minutes % MINUTES_IN_HOUR;
timestamp.time = getTime(timestamp);
if (now) {
updateRelative(timestamp, now, true);
}
return timestamp;
}
export function updateWeekday(timestamp) {
timestamp.weekday = getWeekday(timestamp);
return timestamp;
}
export function updateFormatted(timestamp) {
timestamp.time = getTime(timestamp);
timestamp.date = getDate(timestamp);
return timestamp;
}
export function getWeekday(timestamp) {
if (timestamp.hasDay) {
const _ = Math.floor;
const k = timestamp.day;
const m = (timestamp.month + 9) % MONTH_MAX + 1;
const C = _(timestamp.year / 100);
const Y = timestamp.year % 100 - (timestamp.month <= 2 ? 1 : 0);
return ((k + _(2.6 * m - 0.2) - 2 * C + Y + _(Y / 4) + _(C / 4)) % 7 + 7) % 7;
}
return timestamp.weekday;
}
export function daysInMonth(year, month) {
return isLeapYear(year) ? DAYS_IN_MONTH_LEAP[month] : DAYS_IN_MONTH[month];
}
export function copyTimestamp(timestamp) {
const {
date,
time,
year,
month,
day,
weekday,
hour,
minute,
hasDay,
hasTime,
past,
present,
future
} = timestamp;
return {
date,
time,
year,
month,
day,
weekday,
hour,
minute,
hasDay,
hasTime,
past,
present,
future
};
}
export function padNumber(x, length) {
let padded = String(x);
while (padded.length < length) {
padded = '0' + padded;
}
return padded;
}
export function getDate(timestamp) {
let str = `${padNumber(timestamp.year, 4)}-${padNumber(timestamp.month, 2)}`;
if (timestamp.hasDay) str += `-${padNumber(timestamp.day, 2)}`;
return str;
}
export function getTime(timestamp) {
if (!timestamp.hasTime) {
return '';
}
return `${padNumber(timestamp.hour, 2)}:${padNumber(timestamp.minute, 2)}`;
}
export function nextMinutes(timestamp, minutes) {
timestamp.minute += minutes;
while (timestamp.minute > MINUTES_IN_HOUR) {
timestamp.minute -= MINUTES_IN_HOUR;
timestamp.hour++;
if (timestamp.hour >= HOURS_IN_DAY) {
nextDay(timestamp);
timestamp.hour = FIRST_HOUR;
}
}
return timestamp;
}
export function nextDay(timestamp) {
timestamp.day++;
timestamp.weekday = (timestamp.weekday + 1) % DAYS_IN_WEEK;
if (timestamp.day > DAYS_IN_MONTH_MIN && timestamp.day > daysInMonth(timestamp.year, timestamp.month)) {
timestamp.day = DAY_MIN;
timestamp.month++;
if (timestamp.month > MONTH_MAX) {
timestamp.month = MONTH_MIN;
timestamp.year++;
}
}
return timestamp;
}
export function prevDay(timestamp) {
timestamp.day--;
timestamp.weekday = (timestamp.weekday + 6) % DAYS_IN_WEEK;
if (timestamp.day < DAY_MIN) {
timestamp.month--;
if (timestamp.month < MONTH_MIN) {
timestamp.year--;
timestamp.month = MONTH_MAX;
}
timestamp.day = daysInMonth(timestamp.year, timestamp.month);
}
return timestamp;
}
export function relativeDays(timestamp, mover = nextDay, days = 1) {
while (--days >= 0) mover(timestamp);
return timestamp;
}
export function diffMinutes(min, max) {
const Y = (max.year - min.year) * 525600;
const M = (max.month - min.month) * 43800;
const D = (max.day - min.day) * 1440;
const h = (max.hour - min.hour) * 60;
const m = max.minute - min.minute;
return Y + M + D + h + m;
}
export function findWeekday(timestamp, weekday, mover = nextDay, maxDays = 6) {
while (timestamp.weekday !== weekday && --maxDays >= 0) mover(timestamp);
return timestamp;
}
export function getWeekdaySkips(weekdays) {
const skips = [1, 1, 1, 1, 1, 1, 1];
const filled = [0, 0, 0, 0, 0, 0, 0];
for (let i = 0; i < weekdays.length; i++) {
filled[weekdays[i]] = 1;
}
for (let k = 0; k < DAYS_IN_WEEK; k++) {
let skip = 1;
for (let j = 1; j < DAYS_IN_WEEK; j++) {
const next = (k + j) % DAYS_IN_WEEK;
if (filled[next]) {
break;
}
skip++;
}
skips[k] = filled[k] * skip;
}
return skips;
}
export function timestampToDate(timestamp) {
const time = `${padNumber(timestamp.hour, 2)}:${padNumber(timestamp.minute, 2)}`;
const date = timestamp.date;
return new Date(`${date}T${time}:00+00:00`);
}
export function createDayList(start, end, now, weekdaySkips, max = 42, min = 0) {
const stop = getDayIdentifier(end);
const days = [];
let current = copyTimestamp(start);
let currentIdentifier = 0;
let stopped = currentIdentifier === stop;
if (stop < getDayIdentifier(start)) {
throw new Error('End date is earlier than start date.');
}
while ((!stopped || days.length < min) && days.length < max) {
currentIdentifier = getDayIdentifier(current);
stopped = stopped || currentIdentifier === stop;
if (weekdaySkips[current.weekday] === 0) {
current = nextDay(current);
continue;
}
const day = copyTimestamp(current);
updateFormatted(day);
updateRelative(day, now);
days.push(day);
current = relativeDays(current, nextDay, weekdaySkips[current.weekday]);
}
if (!days.length) throw new Error('No dates found using specified start date, end date, and weekdays.');
return days;
}
export function createIntervalList(timestamp, first, minutes, count, now) {
const intervals = [];
for (let i = 0; i < count; i++) {
const mins = first + i * minutes;
const int = copyTimestamp(timestamp);
intervals.push(updateMinutes(int, mins, now));
}
return intervals;
}
export function createNativeLocaleFormatter(locale, getOptions) {
const emptyFormatter = (_t, _s) => '';
if (typeof Intl === 'undefined' || typeof Intl.DateTimeFormat === 'undefined') {
return emptyFormatter;
}
return (timestamp, short) => {
try {
const intlFormatter = new Intl.DateTimeFormat(locale || undefined, getOptions(timestamp, short));
return intlFormatter.format(timestampToDate(timestamp));
} catch (e) {
return '';
}
};
}
//# sourceMappingURL=timestamp.js.map
File diff suppressed because one or more lines are too long