This commit is contained in:
darenhsu
2022-07-17 13:16:16 +08:00
parent 84759556ff
commit befd344ab0
28070 changed files with 4008428 additions and 1 deletions
+227
View File
@@ -0,0 +1,227 @@
// Styles
import "../../../src/components/VAlert/VAlert.sass"; // Extensions
import VSheet from '../VSheet'; // Components
import VBtn from '../VBtn';
import VIcon from '../VIcon'; // Mixins
import Toggleable from '../../mixins/toggleable';
import Themeable from '../../mixins/themeable';
import Transitionable from '../../mixins/transitionable'; // Utilities
import mixins from '../../util/mixins';
import { breaking } from '../../util/console';
/* @vue/component */
export default mixins(VSheet, Toggleable, Transitionable).extend({
name: 'v-alert',
props: {
border: {
type: String,
validator(val) {
return ['top', 'right', 'bottom', 'left'].includes(val);
}
},
closeLabel: {
type: String,
default: '$vuetify.close'
},
coloredBorder: Boolean,
dense: Boolean,
dismissible: Boolean,
closeIcon: {
type: String,
default: '$cancel'
},
icon: {
default: '',
type: [Boolean, String],
validator(val) {
return typeof val === 'string' || val === false;
}
},
outlined: Boolean,
prominent: Boolean,
text: Boolean,
type: {
type: String,
validator(val) {
return ['info', 'error', 'success', 'warning'].includes(val);
}
},
value: {
type: Boolean,
default: true
}
},
computed: {
__cachedBorder() {
if (!this.border) return null;
let data = {
staticClass: 'v-alert__border',
class: {
[`v-alert__border--${this.border}`]: true
}
};
if (this.coloredBorder) {
data = this.setBackgroundColor(this.computedColor, data);
data.class['v-alert__border--has-color'] = true;
}
return this.$createElement('div', data);
},
__cachedDismissible() {
if (!this.dismissible) return null;
const color = this.iconColor;
return this.$createElement(VBtn, {
staticClass: 'v-alert__dismissible',
props: {
color,
icon: true,
small: true
},
attrs: {
'aria-label': this.$vuetify.lang.t(this.closeLabel)
},
on: {
click: () => this.isActive = false
}
}, [this.$createElement(VIcon, {
props: {
color
}
}, this.closeIcon)]);
},
__cachedIcon() {
if (!this.computedIcon) return null;
return this.$createElement(VIcon, {
staticClass: 'v-alert__icon',
props: {
color: this.iconColor
}
}, this.computedIcon);
},
classes() {
const classes = { ...VSheet.options.computed.classes.call(this),
'v-alert--border': Boolean(this.border),
'v-alert--dense': this.dense,
'v-alert--outlined': this.outlined,
'v-alert--prominent': this.prominent,
'v-alert--text': this.text
};
if (this.border) {
classes[`v-alert--border-${this.border}`] = true;
}
return classes;
},
computedColor() {
return this.color || this.type;
},
computedIcon() {
if (this.icon === false) return false;
if (typeof this.icon === 'string' && this.icon) return this.icon;
if (!['error', 'info', 'success', 'warning'].includes(this.type)) return false;
return `$${this.type}`;
},
hasColoredIcon() {
return this.hasText || Boolean(this.border) && this.coloredBorder;
},
hasText() {
return this.text || this.outlined;
},
iconColor() {
return this.hasColoredIcon ? this.computedColor : undefined;
},
isDark() {
if (this.type && !this.coloredBorder && !this.outlined) return true;
return Themeable.options.computed.isDark.call(this);
}
},
created() {
/* istanbul ignore next */
if (this.$attrs.hasOwnProperty('outline')) {
breaking('outline', 'outlined', this);
}
},
methods: {
genWrapper() {
const children = [this.$slots.prepend || this.__cachedIcon, this.genContent(), this.__cachedBorder, this.$slots.append, this.$scopedSlots.close ? this.$scopedSlots.close({
toggle: this.toggle
}) : this.__cachedDismissible];
const data = {
staticClass: 'v-alert__wrapper'
};
return this.$createElement('div', data, children);
},
genContent() {
return this.$createElement('div', {
staticClass: 'v-alert__content'
}, this.$slots.default);
},
genAlert() {
let data = {
staticClass: 'v-alert',
attrs: {
role: 'alert'
},
class: this.classes,
style: this.styles,
directives: [{
name: 'show',
value: this.isActive
}]
};
if (!this.coloredBorder) {
const setColor = this.hasText ? this.setTextColor : this.setBackgroundColor;
data = setColor(this.computedColor, data);
}
return this.$createElement('div', data, [this.genWrapper()]);
},
/** @public */
toggle() {
this.isActive = !this.isActive;
}
},
render(h) {
const render = this.genAlert();
if (!this.transition) return render;
return h('transition', {
props: {
name: this.transition,
origin: this.origin,
mode: this.mode
}
}, [render]);
}
});
//# sourceMappingURL=VAlert.js.map
File diff suppressed because one or more lines are too long
+4
View File
@@ -0,0 +1,4 @@
import VAlert from './VAlert';
export { VAlert };
export default VAlert;
//# sourceMappingURL=index.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/components/VAlert/index.ts"],"names":[],"mappings":"AAAA,OAAO,MAAP,MAAmB,UAAnB;AAEA,SAAS,MAAT;AACA,eAAe,MAAf","sourcesContent":["import VAlert from './VAlert'\n\nexport { VAlert }\nexport default VAlert\n"],"sourceRoot":"","file":"index.js"}
+59
View File
@@ -0,0 +1,59 @@
// Styles
import "../../../src/components/VApp/VApp.sass"; // Mixins
import Themeable from '../../mixins/themeable'; // Utilities
import mixins from '../../util/mixins';
/* @vue/component */
export default mixins(Themeable).extend({
name: 'v-app',
props: {
dark: {
type: Boolean,
default: undefined
},
id: {
type: String,
default: 'app'
},
light: {
type: Boolean,
default: undefined
}
},
computed: {
isDark() {
return this.$vuetify.theme.dark;
}
},
beforeCreate() {
if (!this.$vuetify || this.$vuetify === this.$root) {
throw new Error('Vuetify is not properly initialized, see https://vuetifyjs.com/getting-started/quick-start#bootstrapping-the-vuetify-object');
}
},
render(h) {
const wrapper = h('div', {
staticClass: 'v-application--wrap'
}, this.$slots.default);
return h('div', {
staticClass: 'v-application',
class: {
'v-application--is-rtl': this.$vuetify.rtl,
'v-application--is-ltr': !this.$vuetify.rtl,
...this.themeClasses
},
attrs: {
'data-app': true
},
domProps: {
id: this.id
}
}, [wrapper]);
}
});
//# sourceMappingURL=VApp.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/components/VApp/VApp.ts"],"names":[],"mappings":"AAAA;AACA,OAAO,wCAAP,C,CAEA;;AACA,OAAO,SAAP,MAAsB,wBAAtB,C,CAEA;;AACA,OAAO,MAAP,MAAmB,mBAAnB;AAEA;;AACA,eAAe,MAAM,CACnB,SADmB,CAAN,CAEb,MAFa,CAEN;AACP,EAAA,IAAI,EAAE,OADC;AAGP,EAAA,KAAK,EAAE;AACL,IAAA,IAAI,EAAE;AACJ,MAAA,IAAI,EAAE,OADF;AAEJ,MAAA,OAAO,EAAE;AAFL,KADD;AAKL,IAAA,EAAE,EAAE;AACF,MAAA,IAAI,EAAE,MADJ;AAEF,MAAA,OAAO,EAAE;AAFP,KALC;AASL,IAAA,KAAK,EAAE;AACL,MAAA,IAAI,EAAE,OADD;AAEL,MAAA,OAAO,EAAE;AAFJ;AATF,GAHA;AAkBP,EAAA,QAAQ,EAAE;AACR,IAAA,MAAM,GAAA;AACJ,aAAO,KAAK,QAAL,CAAc,KAAd,CAAoB,IAA3B;AACD;;AAHO,GAlBH;;AAwBP,EAAA,YAAY,GAAA;AACV,QAAI,CAAC,KAAK,QAAN,IAAmB,KAAK,QAAL,KAAkB,KAAK,KAA9C,EAA6D;AAC3D,YAAM,IAAI,KAAJ,CAAU,6HAAV,CAAN;AACD;AACF,GA5BM;;AA8BP,EAAA,MAAM,CAAE,CAAF,EAAG;AACP,UAAM,OAAO,GAAG,CAAC,CAAC,KAAD,EAAQ;AAAE,MAAA,WAAW,EAAE;AAAf,KAAR,EAAgD,KAAK,MAAL,CAAY,OAA5D,CAAjB;AAEA,WAAO,CAAC,CAAC,KAAD,EAAQ;AACd,MAAA,WAAW,EAAE,eADC;AAEd,MAAA,KAAK,EAAE;AACL,iCAAyB,KAAK,QAAL,CAAc,GADlC;AAEL,iCAAyB,CAAC,KAAK,QAAL,CAAc,GAFnC;AAGL,WAAG,KAAK;AAHH,OAFO;AAOd,MAAA,KAAK,EAAE;AAAE,oBAAY;AAAd,OAPO;AAQd,MAAA,QAAQ,EAAE;AAAE,QAAA,EAAE,EAAE,KAAK;AAAX;AARI,KAAR,EASL,CAAC,OAAD,CATK,CAAR;AAUD;;AA3CM,CAFM,CAAf","sourcesContent":["// Styles\nimport './VApp.sass'\n\n// Mixins\nimport Themeable from '../../mixins/themeable'\n\n// Utilities\nimport mixins from '../../util/mixins'\n\n/* @vue/component */\nexport default mixins(\n Themeable\n).extend({\n name: 'v-app',\n\n props: {\n dark: {\n type: Boolean,\n default: undefined,\n },\n id: {\n type: String,\n default: 'app',\n },\n light: {\n type: Boolean,\n default: undefined,\n },\n },\n\n computed: {\n isDark (): boolean {\n return this.$vuetify.theme.dark\n },\n },\n\n beforeCreate () {\n if (!this.$vuetify || (this.$vuetify === this.$root as any)) {\n throw new Error('Vuetify is not properly initialized, see https://vuetifyjs.com/getting-started/quick-start#bootstrapping-the-vuetify-object')\n }\n },\n\n render (h) {\n const wrapper = h('div', { staticClass: 'v-application--wrap' }, this.$slots.default)\n\n return h('div', {\n staticClass: 'v-application',\n class: {\n 'v-application--is-rtl': this.$vuetify.rtl,\n 'v-application--is-ltr': !this.$vuetify.rtl,\n ...this.themeClasses,\n },\n attrs: { 'data-app': true },\n domProps: { id: this.id },\n }, [wrapper])\n },\n})\n"],"sourceRoot":"","file":"VApp.js"}
+4
View File
@@ -0,0 +1,4 @@
import VApp from './VApp';
export { VApp };
export default VApp;
//# sourceMappingURL=index.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/components/VApp/index.ts"],"names":[],"mappings":"AAAA,OAAO,IAAP,MAAiB,QAAjB;AAEA,SAAS,IAAT;AACA,eAAe,IAAf","sourcesContent":["import VApp from './VApp'\n\nexport { VApp }\nexport default VApp\n"],"sourceRoot":"","file":"index.js"}
+237
View File
@@ -0,0 +1,237 @@
// Styles
import "../../../src/components/VAppBar/VAppBar.sass"; // Extensions
import VToolbar from '../VToolbar/VToolbar'; // Directives
import Scroll from '../../directives/scroll'; // Mixins
import Applicationable from '../../mixins/applicationable';
import Scrollable from '../../mixins/scrollable';
import SSRBootable from '../../mixins/ssr-bootable';
import Toggleable from '../../mixins/toggleable'; // Utilities
import { convertToUnit } from '../../util/helpers';
import mixins from '../../util/mixins';
const baseMixins = mixins(VToolbar, Scrollable, SSRBootable, Toggleable, Applicationable('top', ['clippedLeft', 'clippedRight', 'computedHeight', 'invertedScroll', 'isExtended', 'isProminent', 'value']));
/* @vue/component */
export default baseMixins.extend({
name: 'v-app-bar',
directives: {
Scroll
},
props: {
clippedLeft: Boolean,
clippedRight: Boolean,
collapseOnScroll: Boolean,
elevateOnScroll: Boolean,
fadeImgOnScroll: Boolean,
hideOnScroll: Boolean,
invertedScroll: Boolean,
scrollOffScreen: Boolean,
shrinkOnScroll: Boolean,
value: {
type: Boolean,
default: true
}
},
data() {
return {
isActive: this.value
};
},
computed: {
applicationProperty() {
return !this.bottom ? 'top' : 'bottom';
},
canScroll() {
return Scrollable.options.computed.canScroll.call(this) && (this.invertedScroll || this.elevateOnScroll || this.hideOnScroll || this.collapseOnScroll || this.isBooted || // If falsey, user has provided an
// explicit value which should
// overwrite anything we do
!this.value);
},
classes() {
return { ...VToolbar.options.computed.classes.call(this),
'v-toolbar--collapse': this.collapse || this.collapseOnScroll,
'v-app-bar': true,
'v-app-bar--clipped': this.clippedLeft || this.clippedRight,
'v-app-bar--fade-img-on-scroll': this.fadeImgOnScroll,
'v-app-bar--elevate-on-scroll': this.elevateOnScroll,
'v-app-bar--fixed': !this.absolute && (this.app || this.fixed),
'v-app-bar--hide-shadow': this.hideShadow,
'v-app-bar--is-scrolled': this.currentScroll > 0,
'v-app-bar--shrink-on-scroll': this.shrinkOnScroll
};
},
computedContentHeight() {
if (!this.shrinkOnScroll) return VToolbar.options.computed.computedContentHeight.call(this);
const height = this.computedOriginalHeight;
const min = this.dense ? 48 : 56;
const max = height;
const difference = max - min;
const iteration = difference / this.computedScrollThreshold;
const offset = this.currentScroll * iteration;
return Math.max(min, max - offset);
},
computedFontSize() {
if (!this.isProminent) return undefined;
const max = this.dense ? 96 : 128;
const difference = max - this.computedContentHeight;
const increment = 0.00347; // 1.5rem to a minimum of 1.25rem
return Number((1.50 - difference * increment).toFixed(2));
},
computedLeft() {
if (!this.app || this.clippedLeft) return 0;
return this.$vuetify.application.left;
},
computedMarginTop() {
if (!this.app) return 0;
return this.$vuetify.application.bar;
},
computedOpacity() {
if (!this.fadeImgOnScroll) return undefined;
const opacity = Math.max((this.computedScrollThreshold - this.currentScroll) / this.computedScrollThreshold, 0);
return Number(parseFloat(opacity).toFixed(2));
},
computedOriginalHeight() {
let height = VToolbar.options.computed.computedContentHeight.call(this);
if (this.isExtended) height += parseInt(this.extensionHeight);
return height;
},
computedRight() {
if (!this.app || this.clippedRight) return 0;
return this.$vuetify.application.right;
},
computedScrollThreshold() {
if (this.scrollThreshold) return Number(this.scrollThreshold);
return this.computedOriginalHeight - (this.dense ? 48 : 56);
},
computedTransform() {
if (!this.canScroll || this.elevateOnScroll && this.currentScroll === 0 && this.isActive) return 0;
if (this.isActive) return 0;
const scrollOffScreen = this.scrollOffScreen ? this.computedHeight : this.computedContentHeight;
return this.bottom ? scrollOffScreen : -scrollOffScreen;
},
hideShadow() {
if (this.elevateOnScroll && this.isExtended) {
return this.currentScroll < this.computedScrollThreshold;
}
if (this.elevateOnScroll) {
return this.currentScroll === 0 || this.computedTransform < 0;
}
return (!this.isExtended || this.scrollOffScreen) && this.computedTransform !== 0;
},
isCollapsed() {
if (!this.collapseOnScroll) {
return VToolbar.options.computed.isCollapsed.call(this);
}
return this.currentScroll > 0;
},
isProminent() {
return VToolbar.options.computed.isProminent.call(this) || this.shrinkOnScroll;
},
styles() {
return { ...VToolbar.options.computed.styles.call(this),
fontSize: convertToUnit(this.computedFontSize, 'rem'),
marginTop: convertToUnit(this.computedMarginTop),
transform: `translateY(${convertToUnit(this.computedTransform)})`,
left: convertToUnit(this.computedLeft),
right: convertToUnit(this.computedRight)
};
}
},
watch: {
canScroll: 'onScroll',
computedTransform() {
// Normally we do not want the v-app-bar
// to update the application top value
// to avoid screen jump. However, in
// this situation, we must so that
// the clipped drawer can update
// its top value when scrolled
if (!this.canScroll || !this.clippedLeft && !this.clippedRight) return;
this.callUpdate();
},
invertedScroll(val) {
this.isActive = !val || this.currentScroll !== 0;
}
},
created() {
if (this.invertedScroll) this.isActive = false;
},
methods: {
genBackground() {
const render = VToolbar.options.methods.genBackground.call(this);
render.data = this._b(render.data || {}, render.tag, {
style: {
opacity: this.computedOpacity
}
});
return render;
},
updateApplication() {
return this.invertedScroll ? 0 : this.computedHeight + this.computedTransform;
},
thresholdMet() {
if (this.invertedScroll) {
this.isActive = this.currentScroll > this.computedScrollThreshold;
return;
}
if (this.hideOnScroll) {
this.isActive = this.isScrollingUp || this.currentScroll < this.computedScrollThreshold;
}
if (this.currentThreshold < this.computedScrollThreshold) return;
this.savedScroll = this.currentScroll;
}
},
render(h) {
const render = VToolbar.options.render.call(this, h);
render.data = render.data || {};
if (this.canScroll) {
render.data.directives = render.data.directives || [];
render.data.directives.push({
arg: this.scrollTarget,
name: 'scroll',
value: this.onScroll
});
}
return render;
}
});
//# sourceMappingURL=VAppBar.js.map
File diff suppressed because one or more lines are too long
+30
View File
@@ -0,0 +1,30 @@
// Components
import VIcon from '../VIcon';
import VBtn from '../VBtn/VBtn'; // Types
import Vue from 'vue';
/* @vue/component */
export default Vue.extend({
name: 'v-app-bar-nav-icon',
functional: true,
render(h, {
slots,
listeners,
props,
data
}) {
const d = Object.assign(data, {
staticClass: `v-app-bar__nav-icon ${data.staticClass || ''}`.trim(),
props: { ...props,
icon: true
},
on: listeners
});
const defaultSlot = slots().default;
return h(VBtn, d, defaultSlot || [h(VIcon, '$menu')]);
}
});
//# sourceMappingURL=VAppBarNavIcon.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/components/VAppBar/VAppBarNavIcon.ts"],"names":[],"mappings":"AAAA;AACA,OAAO,KAAP,MAAkB,UAAlB;AACA,OAAO,IAAP,MAAiB,cAAjB,C,CAEA;;AACA,OAAO,GAAP,MAAgB,KAAhB;AAEA;;AACA,eAAe,GAAG,CAAC,MAAJ,CAAW;AACxB,EAAA,IAAI,EAAE,oBADkB;AAGxB,EAAA,UAAU,EAAE,IAHY;;AAKxB,EAAA,MAAM,CAAE,CAAF,EAAK;AAAE,IAAA,KAAF;AAAS,IAAA,SAAT;AAAoB,IAAA,KAApB;AAA2B,IAAA;AAA3B,GAAL,EAAsC;AAC1C,UAAM,CAAC,GAAG,MAAM,CAAC,MAAP,CAAc,IAAd,EAAoB;AAC5B,MAAA,WAAW,EAAG,uBAAuB,IAAI,CAAC,WAAL,IAAoB,EAAE,EAA9C,CAAkD,IAAlD,EADe;AAE5B,MAAA,KAAK,EAAE,EACL,GAAG,KADE;AAEL,QAAA,IAAI,EAAE;AAFD,OAFqB;AAM5B,MAAA,EAAE,EAAE;AANwB,KAApB,CAAV;AASA,UAAM,WAAW,GAAG,KAAK,GAAG,OAA5B;AAEA,WAAO,CAAC,CAAC,IAAD,EAAO,CAAP,EAAU,WAAW,IAAI,CAAC,CAAC,CAAC,KAAD,EAAQ,OAAR,CAAF,CAAzB,CAAR;AACD;;AAlBuB,CAAX,CAAf","sourcesContent":["// Components\nimport VIcon from '../VIcon'\nimport VBtn from '../VBtn/VBtn'\n\n// Types\nimport Vue from 'vue'\n\n/* @vue/component */\nexport default Vue.extend({\n name: 'v-app-bar-nav-icon',\n\n functional: true,\n\n render (h, { slots, listeners, props, data }) {\n const d = Object.assign(data, {\n staticClass: (`v-app-bar__nav-icon ${data.staticClass || ''}`).trim(),\n props: {\n ...props,\n icon: true,\n },\n on: listeners,\n })\n\n const defaultSlot = slots().default\n\n return h(VBtn, d, defaultSlot || [h(VIcon, '$menu')])\n },\n})\n"],"sourceRoot":"","file":"VAppBarNavIcon.js"}
+10
View File
@@ -0,0 +1,10 @@
import VAppBar from './VAppBar';
import VAppBarNavIcon from './VAppBarNavIcon';
export { VAppBar, VAppBarNavIcon };
export default {
$_vuetify_subcomponents: {
VAppBar,
VAppBarNavIcon
}
};
//# sourceMappingURL=index.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/components/VAppBar/index.ts"],"names":[],"mappings":"AAAA,OAAO,OAAP,MAAoB,WAApB;AACA,OAAO,cAAP,MAA2B,kBAA3B;AAEA,SAAS,OAAT,EAAkB,cAAlB;AAEA,eAAe;AACb,EAAA,uBAAuB,EAAE;AACvB,IAAA,OADuB;AAEvB,IAAA;AAFuB;AADZ,CAAf","sourcesContent":["import VAppBar from './VAppBar'\nimport VAppBarNavIcon from './VAppBarNavIcon'\n\nexport { VAppBar, VAppBarNavIcon }\n\nexport default {\n $_vuetify_subcomponents: {\n VAppBar,\n VAppBarNavIcon,\n },\n}\n"],"sourceRoot":"","file":"index.js"}
+370
View File
@@ -0,0 +1,370 @@
// Styles
import "../../../src/components/VAutocomplete/VAutocomplete.sass"; // Extensions
import VSelect, { defaultMenuProps as VSelectMenuProps } from '../VSelect/VSelect';
import VTextField from '../VTextField/VTextField'; // Utilities
import mergeData from '../../util/mergeData';
import { getObjectValueByPath, getPropertyFromItem, keyCodes } from '../../util/helpers';
const defaultMenuProps = { ...VSelectMenuProps,
offsetY: true,
offsetOverflow: true,
transition: false
};
/* @vue/component */
export default VSelect.extend({
name: 'v-autocomplete',
props: {
allowOverflow: {
type: Boolean,
default: true
},
autoSelectFirst: {
type: Boolean,
default: false
},
filter: {
type: Function,
default: (item, queryText, itemText) => {
return itemText.toLocaleLowerCase().indexOf(queryText.toLocaleLowerCase()) > -1;
}
},
hideNoData: Boolean,
menuProps: {
type: VSelect.options.props.menuProps.type,
default: () => defaultMenuProps
},
noFilter: Boolean,
searchInput: {
type: String,
default: undefined
}
},
data() {
return {
lazySearch: this.searchInput
};
},
computed: {
classes() {
return { ...VSelect.options.computed.classes.call(this),
'v-autocomplete': true,
'v-autocomplete--is-selecting-index': this.selectedIndex > -1
};
},
computedItems() {
return this.filteredItems;
},
selectedValues() {
return this.selectedItems.map(item => this.getValue(item));
},
hasDisplayedItems() {
return this.hideSelected ? this.filteredItems.some(item => !this.hasItem(item)) : this.filteredItems.length > 0;
},
currentRange() {
if (this.selectedItem == null) return 0;
return String(this.getText(this.selectedItem)).length;
},
filteredItems() {
if (!this.isSearching || this.noFilter || this.internalSearch == null) return this.allItems;
return this.allItems.filter(item => {
const value = getPropertyFromItem(item, this.itemText);
const text = value != null ? String(value) : '';
return this.filter(item, String(this.internalSearch), text);
});
},
internalSearch: {
get() {
return this.lazySearch;
},
set(val) {
this.lazySearch = val;
this.$emit('update:search-input', val);
}
},
isAnyValueAllowed() {
return false;
},
isDirty() {
return this.searchIsDirty || this.selectedItems.length > 0;
},
isSearching() {
return this.multiple && this.searchIsDirty || this.searchIsDirty && this.internalSearch !== this.getText(this.selectedItem);
},
menuCanShow() {
if (!this.isFocused) return false;
return this.hasDisplayedItems || !this.hideNoData;
},
$_menuProps() {
const props = VSelect.options.computed.$_menuProps.call(this);
props.contentClass = `v-autocomplete__content ${props.contentClass || ''}`.trim();
return { ...defaultMenuProps,
...props
};
},
searchIsDirty() {
return this.internalSearch != null && this.internalSearch !== '';
},
selectedItem() {
if (this.multiple) return null;
return this.selectedItems.find(i => {
return this.valueComparator(this.getValue(i), this.getValue(this.internalValue));
});
},
listData() {
const data = VSelect.options.computed.listData.call(this);
data.props = { ...data.props,
items: this.virtualizedItems,
noFilter: this.noFilter || !this.isSearching || !this.filteredItems.length,
searchInput: this.internalSearch
};
return data;
}
},
watch: {
filteredItems: 'onFilteredItemsChanged',
internalValue: 'setSearch',
isFocused(val) {
if (val) {
document.addEventListener('copy', this.onCopy);
this.$refs.input && this.$refs.input.select();
} else {
document.removeEventListener('copy', this.onCopy);
this.updateSelf();
}
},
isMenuActive(val) {
if (val || !this.hasSlot) return;
this.lazySearch = undefined;
},
items(val, oldVal) {
// If we are focused, the menu
// is not active, hide no data is enabled,
// and items change
// User is probably async loading
// items, try to activate the menu
if (!(oldVal && oldVal.length) && this.hideNoData && this.isFocused && !this.isMenuActive && val.length) this.activateMenu();
},
searchInput(val) {
this.lazySearch = val;
},
internalSearch: 'onInternalSearchChanged',
itemText: 'updateSelf'
},
created() {
this.setSearch();
},
methods: {
onFilteredItemsChanged(val, oldVal) {
// TODO: How is the watcher triggered
// for duplicate items? no idea
if (val === oldVal) return;
this.setMenuIndex(-1);
this.$nextTick(() => {
if (!this.internalSearch || val.length !== 1 && !this.autoSelectFirst) return;
this.$refs.menu.getTiles();
this.setMenuIndex(0);
});
},
onInternalSearchChanged() {
this.updateMenuDimensions();
},
updateMenuDimensions() {
// Type from menuable is not making it through
this.isMenuActive && this.$refs.menu && this.$refs.menu.updateDimensions();
},
changeSelectedIndex(keyCode) {
// Do not allow changing of selectedIndex
// when search is dirty
if (this.searchIsDirty) return;
if (this.multiple && keyCode === keyCodes.left) {
if (this.selectedIndex === -1) {
this.selectedIndex = this.selectedItems.length - 1;
} else {
this.selectedIndex--;
}
} else if (this.multiple && keyCode === keyCodes.right) {
if (this.selectedIndex >= this.selectedItems.length - 1) {
this.selectedIndex = -1;
} else {
this.selectedIndex++;
}
} else if (keyCode === keyCodes.backspace || keyCode === keyCodes.delete) {
this.deleteCurrentItem();
}
},
deleteCurrentItem() {
const curIndex = this.selectedIndex;
const curItem = this.selectedItems[curIndex]; // Do nothing if input or item is disabled
if (!this.isInteractive || this.getDisabled(curItem)) return;
const lastIndex = this.selectedItems.length - 1; // Select the last item if
// there is no selection
if (this.selectedIndex === -1 && lastIndex !== 0) {
this.selectedIndex = lastIndex;
return;
}
const length = this.selectedItems.length;
const nextIndex = curIndex !== length - 1 ? curIndex : curIndex - 1;
const nextItem = this.selectedItems[nextIndex];
if (!nextItem) {
this.setValue(this.multiple ? [] : undefined);
} else {
this.selectItem(curItem);
}
this.selectedIndex = nextIndex;
},
clearableCallback() {
this.internalSearch = undefined;
VSelect.options.methods.clearableCallback.call(this);
},
genInput() {
const input = VTextField.options.methods.genInput.call(this);
input.data = mergeData(input.data, {
attrs: {
'aria-activedescendant': getObjectValueByPath(this.$refs.menu, 'activeTile.id'),
autocomplete: getObjectValueByPath(input.data, 'attrs.autocomplete', 'off')
},
domProps: {
value: this.internalSearch
}
});
return input;
},
genInputSlot() {
const slot = VSelect.options.methods.genInputSlot.call(this);
slot.data.attrs.role = 'combobox';
return slot;
},
genSelections() {
return this.hasSlot || this.multiple ? VSelect.options.methods.genSelections.call(this) : [];
},
onClick(e) {
if (!this.isInteractive) return;
this.selectedIndex > -1 ? this.selectedIndex = -1 : this.onFocus();
if (!this.isAppendInner(e.target)) this.activateMenu();
},
onInput(e) {
if (this.selectedIndex > -1 || !e.target) return;
const target = e.target;
const value = target.value; // If typing and menu is not currently active
if (target.value) this.activateMenu();
this.internalSearch = value;
this.badInput = target.validity && target.validity.badInput;
},
onKeyDown(e) {
const keyCode = e.keyCode;
VSelect.options.methods.onKeyDown.call(this, e); // The ordering is important here
// allows new value to be updated
// and then moves the index to the
// proper location
this.changeSelectedIndex(keyCode);
},
onSpaceDown(e) {},
onTabDown(e) {
VSelect.options.methods.onTabDown.call(this, e);
this.updateSelf();
},
onUpDown(e) {
// Prevent screen from scrolling
e.preventDefault(); // For autocomplete / combobox, cycling
// interfers with native up/down behavior
// instead activate the menu
this.activateMenu();
},
selectItem(item) {
VSelect.options.methods.selectItem.call(this, item);
this.setSearch();
},
setSelectedItems() {
VSelect.options.methods.setSelectedItems.call(this); // #4273 Don't replace if searching
// #4403 Don't replace if focused
if (!this.isFocused) this.setSearch();
},
setSearch() {
// Wait for nextTick so selectedItem
// has had time to update
this.$nextTick(() => {
if (!this.multiple || !this.internalSearch || !this.isMenuActive) {
this.internalSearch = !this.selectedItems.length || this.multiple || this.hasSlot ? null : this.getText(this.selectedItem);
}
});
},
updateSelf() {
if (!this.searchIsDirty && !this.internalValue) return;
if (!this.valueComparator(this.internalSearch, this.getValue(this.internalValue))) {
this.setSearch();
}
},
hasItem(item) {
return this.selectedValues.indexOf(this.getValue(item)) > -1;
},
onCopy(event) {
if (this.selectedIndex === -1) return;
const currentItem = this.selectedItems[this.selectedIndex];
const currentItemText = this.getText(currentItem);
event.clipboardData.setData('text/plain', currentItemText);
event.clipboardData.setData('text/vnd.vuetify.autocomplete.item+plain', currentItemText);
event.preventDefault();
}
}
});
//# sourceMappingURL=VAutocomplete.js.map
File diff suppressed because one or more lines are too long
+4
View File
@@ -0,0 +1,4 @@
import VAutocomplete from './VAutocomplete';
export { VAutocomplete };
export default VAutocomplete;
//# sourceMappingURL=index.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/components/VAutocomplete/index.ts"],"names":[],"mappings":"AAAA,OAAO,aAAP,MAA0B,iBAA1B;AAEA,SAAS,aAAT;AACA,eAAe,aAAf","sourcesContent":["import VAutocomplete from './VAutocomplete'\n\nexport { VAutocomplete }\nexport default VAutocomplete\n"],"sourceRoot":"","file":"index.js"}
+50
View File
@@ -0,0 +1,50 @@
import "../../../src/components/VAvatar/VAvatar.sass"; // Mixins
import Colorable from '../../mixins/colorable';
import Measurable from '../../mixins/measurable';
import Roundable from '../../mixins/roundable'; // Utilities
import { convertToUnit } from '../../util/helpers';
import mixins from '../../util/mixins';
export default mixins(Colorable, Measurable, Roundable).extend({
name: 'v-avatar',
props: {
left: Boolean,
right: Boolean,
size: {
type: [Number, String],
default: 48
}
},
computed: {
classes() {
return {
'v-avatar--left': this.left,
'v-avatar--right': this.right,
...this.roundedClasses
};
},
styles() {
return {
height: convertToUnit(this.size),
minWidth: convertToUnit(this.size),
width: convertToUnit(this.size),
...this.measurableStyles
};
}
},
render(h) {
const data = {
staticClass: 'v-avatar',
class: this.classes,
style: this.styles,
on: this.$listeners
};
return h('div', this.setBackgroundColor(this.color, data), this.$slots.default);
}
});
//# sourceMappingURL=VAvatar.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/components/VAvatar/VAvatar.ts"],"names":[],"mappings":"AAAA,OAAO,8CAAP,C,CAEA;;AACA,OAAO,SAAP,MAAsB,wBAAtB;AACA,OAAO,UAAP,MAAuB,yBAAvB;AACA,OAAO,SAAP,MAAsB,wBAAtB,C,CAEA;;AACA,SAAS,aAAT,QAA8B,oBAA9B;AAIA,OAAO,MAAP,MAAmB,mBAAnB;AAEA,eAAe,MAAM,CACnB,SADmB,EAEnB,UAFmB,EAGnB,SAHmB,CAAN,CAKb,MALa,CAKN;AACP,EAAA,IAAI,EAAE,UADC;AAGP,EAAA,KAAK,EAAE;AACL,IAAA,IAAI,EAAE,OADD;AAEL,IAAA,KAAK,EAAE,OAFF;AAGL,IAAA,IAAI,EAAE;AACJ,MAAA,IAAI,EAAE,CAAC,MAAD,EAAS,MAAT,CADF;AAEJ,MAAA,OAAO,EAAE;AAFL;AAHD,GAHA;AAYP,EAAA,QAAQ,EAAE;AACR,IAAA,OAAO,GAAA;AACL,aAAO;AACL,0BAAkB,KAAK,IADlB;AAEL,2BAAmB,KAAK,KAFnB;AAGL,WAAG,KAAK;AAHH,OAAP;AAKD,KAPO;;AAQR,IAAA,MAAM,GAAA;AACJ,aAAO;AACL,QAAA,MAAM,EAAE,aAAa,CAAC,KAAK,IAAN,CADhB;AAEL,QAAA,QAAQ,EAAE,aAAa,CAAC,KAAK,IAAN,CAFlB;AAGL,QAAA,KAAK,EAAE,aAAa,CAAC,KAAK,IAAN,CAHf;AAIL,WAAG,KAAK;AAJH,OAAP;AAMD;;AAfO,GAZH;;AA8BP,EAAA,MAAM,CAAE,CAAF,EAAG;AACP,UAAM,IAAI,GAAG;AACX,MAAA,WAAW,EAAE,UADF;AAEX,MAAA,KAAK,EAAE,KAAK,OAFD;AAGX,MAAA,KAAK,EAAE,KAAK,MAHD;AAIX,MAAA,EAAE,EAAE,KAAK;AAJE,KAAb;AAOA,WAAO,CAAC,CAAC,KAAD,EAAQ,KAAK,kBAAL,CAAwB,KAAK,KAA7B,EAAoC,IAApC,CAAR,EAAmD,KAAK,MAAL,CAAY,OAA/D,CAAR;AACD;;AAvCM,CALM,CAAf","sourcesContent":["import './VAvatar.sass'\n\n// Mixins\nimport Colorable from '../../mixins/colorable'\nimport Measurable from '../../mixins/measurable'\nimport Roundable from '../../mixins/roundable'\n\n// Utilities\nimport { convertToUnit } from '../../util/helpers'\n\n// Types\nimport { VNode } from 'vue'\nimport mixins from '../../util/mixins'\n\nexport default mixins(\n Colorable,\n Measurable,\n Roundable,\n /* @vue/component */\n).extend({\n name: 'v-avatar',\n\n props: {\n left: Boolean,\n right: Boolean,\n size: {\n type: [Number, String],\n default: 48,\n },\n },\n\n computed: {\n classes (): object {\n return {\n 'v-avatar--left': this.left,\n 'v-avatar--right': this.right,\n ...this.roundedClasses,\n }\n },\n styles (): object {\n return {\n height: convertToUnit(this.size),\n minWidth: convertToUnit(this.size),\n width: convertToUnit(this.size),\n ...this.measurableStyles,\n }\n },\n },\n\n render (h): VNode {\n const data = {\n staticClass: 'v-avatar',\n class: this.classes,\n style: this.styles,\n on: this.$listeners,\n }\n\n return h('div', this.setBackgroundColor(this.color, data), this.$slots.default)\n },\n})\n"],"sourceRoot":"","file":"VAvatar.js"}
+4
View File
@@ -0,0 +1,4 @@
import VAvatar from './VAvatar';
export { VAvatar };
export default VAvatar;
//# sourceMappingURL=index.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/components/VAvatar/index.ts"],"names":[],"mappings":"AAAA,OAAO,OAAP,MAAoB,WAApB;AAEA,SAAS,OAAT;AACA,eAAe,OAAf","sourcesContent":["import VAvatar from './VAvatar'\n\nexport { VAvatar }\nexport default VAvatar\n"],"sourceRoot":"","file":"index.js"}
+187
View File
@@ -0,0 +1,187 @@
// Styles
import "../../../src/components/VBadge/VBadge.sass"; // Components
import VIcon from '../VIcon/VIcon'; // Mixins
import Colorable from '../../mixins/colorable';
import Themeable from '../../mixins/themeable';
import Toggleable from '../../mixins/toggleable';
import Transitionable from '../../mixins/transitionable';
import { factory as PositionableFactory } from '../../mixins/positionable'; // Utilities
import mixins from '../../util/mixins';
import { convertToUnit, getSlot } from '../../util/helpers';
export default mixins(Colorable, PositionableFactory(['left', 'bottom']), Themeable, Toggleable, Transitionable).extend({
name: 'v-badge',
props: {
avatar: Boolean,
bordered: Boolean,
color: {
type: String,
default: 'primary'
},
content: {
required: false
},
dot: Boolean,
label: {
type: String,
default: '$vuetify.badge'
},
icon: String,
inline: Boolean,
offsetX: [Number, String],
offsetY: [Number, String],
overlap: Boolean,
tile: Boolean,
transition: {
type: String,
default: 'scale-rotate-transition'
},
value: {
default: true
}
},
computed: {
classes() {
return {
'v-badge--avatar': this.avatar,
'v-badge--bordered': this.bordered,
'v-badge--bottom': this.bottom,
'v-badge--dot': this.dot,
'v-badge--icon': this.icon != null,
'v-badge--inline': this.inline,
'v-badge--left': this.left,
'v-badge--overlap': this.overlap,
'v-badge--tile': this.tile,
...this.themeClasses
};
},
computedBottom() {
return this.bottom ? 'auto' : this.computedYOffset;
},
computedLeft() {
if (this.isRtl) {
return this.left ? this.computedXOffset : 'auto';
}
return this.left ? 'auto' : this.computedXOffset;
},
computedRight() {
if (this.isRtl) {
return this.left ? 'auto' : this.computedXOffset;
}
return !this.left ? 'auto' : this.computedXOffset;
},
computedTop() {
return this.bottom ? this.computedYOffset : 'auto';
},
computedXOffset() {
return this.calcPosition(this.offsetX);
},
computedYOffset() {
return this.calcPosition(this.offsetY);
},
isRtl() {
return this.$vuetify.rtl;
},
// Default fallback if offsetX
// or offsetY are undefined.
offset() {
if (this.overlap) return this.dot ? 8 : 12;
return this.dot ? 2 : 4;
},
styles() {
if (this.inline) return {};
return {
bottom: this.computedBottom,
left: this.computedLeft,
right: this.computedRight,
top: this.computedTop
};
}
},
methods: {
calcPosition(offset) {
return `calc(100% - ${convertToUnit(offset || this.offset)})`;
},
genBadge() {
const lang = this.$vuetify.lang;
const label = this.$attrs['aria-label'] || lang.t(this.label);
const data = this.setBackgroundColor(this.color, {
staticClass: 'v-badge__badge',
style: this.styles,
attrs: {
'aria-atomic': this.$attrs['aria-atomic'] || 'true',
'aria-label': label,
'aria-live': this.$attrs['aria-live'] || 'polite',
title: this.$attrs.title,
role: this.$attrs.role || 'status'
},
directives: [{
name: 'show',
value: this.isActive
}]
});
const badge = this.$createElement('span', data, [this.genBadgeContent()]);
if (!this.transition) return badge;
return this.$createElement('transition', {
props: {
name: this.transition,
origin: this.origin,
mode: this.mode
}
}, [badge]);
},
genBadgeContent() {
// Dot prop shows no content
if (this.dot) return undefined;
const slot = getSlot(this, 'badge');
if (slot) return slot;
if (this.content) return String(this.content);
if (this.icon) return this.$createElement(VIcon, this.icon);
return undefined;
},
genBadgeWrapper() {
return this.$createElement('span', {
staticClass: 'v-badge__wrapper'
}, [this.genBadge()]);
}
},
render(h) {
const badge = [this.genBadgeWrapper()];
const children = [getSlot(this)];
const {
'aria-atomic': _x,
'aria-label': _y,
'aria-live': _z,
role,
title,
...attrs
} = this.$attrs;
if (this.inline && this.left) children.unshift(badge);else children.push(badge);
return h('span', {
staticClass: 'v-badge',
attrs,
class: this.classes
}, children);
}
});
//# sourceMappingURL=VBadge.js.map
File diff suppressed because one or more lines are too long
+4
View File
@@ -0,0 +1,4 @@
import VBadge from './VBadge';
export { VBadge };
export default VBadge;
//# sourceMappingURL=index.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/components/VBadge/index.ts"],"names":[],"mappings":"AAAA,OAAO,MAAP,MAAmB,UAAnB;AAEA,SAAS,MAAT;AACA,eAAe,MAAf","sourcesContent":["import VBadge from './VBadge'\n\nexport { VBadge }\nexport default VBadge\n"],"sourceRoot":"","file":"index.js"}
+145
View File
@@ -0,0 +1,145 @@
// Styles
import "../../../src/components/VBanner/VBanner.sass"; // Extensions
import VSheet from '../VSheet'; // Components
import VAvatar from '../VAvatar';
import VIcon from '../VIcon';
import { VExpandTransition } from '../transitions'; // Mixins
import Mobile from '../../mixins/mobile';
import Toggleable from '../../mixins/toggleable'; // Utilities
import mixins from '../../util/mixins';
import { convertToUnit, getSlot } from '../../util/helpers';
/* @vue/component */
export default mixins(VSheet, Mobile, Toggleable).extend({
name: 'v-banner',
inheritAttrs: false,
props: {
app: Boolean,
icon: String,
iconColor: String,
singleLine: Boolean,
sticky: Boolean,
value: {
type: Boolean,
default: true
}
},
computed: {
classes() {
return { ...VSheet.options.computed.classes.call(this),
'v-banner--has-icon': this.hasIcon,
'v-banner--is-mobile': this.isMobile,
'v-banner--single-line': this.singleLine,
'v-banner--sticky': this.isSticky
};
},
hasIcon() {
return Boolean(this.icon || this.$slots.icon);
},
isSticky() {
return this.sticky || this.app;
},
styles() {
const styles = { ...VSheet.options.computed.styles.call(this)
};
if (this.isSticky) {
const top = !this.app ? 0 : this.$vuetify.application.bar + this.$vuetify.application.top;
styles.top = convertToUnit(top);
styles.position = 'sticky';
styles.zIndex = 1;
}
return styles;
}
},
methods: {
/** @public */
toggle() {
this.isActive = !this.isActive;
},
iconClick(e) {
this.$emit('click:icon', e);
},
genIcon() {
if (!this.hasIcon) return undefined;
let content;
if (this.icon) {
content = this.$createElement(VIcon, {
props: {
color: this.iconColor,
size: 28
}
}, [this.icon]);
} else {
content = this.$slots.icon;
}
return this.$createElement(VAvatar, {
staticClass: 'v-banner__icon',
props: {
color: this.color,
size: 40
},
on: {
click: this.iconClick
}
}, [content]);
},
genText() {
return this.$createElement('div', {
staticClass: 'v-banner__text'
}, this.$slots.default);
},
genActions() {
const children = getSlot(this, 'actions', {
dismiss: () => this.isActive = false
});
if (!children) return undefined;
return this.$createElement('div', {
staticClass: 'v-banner__actions'
}, children);
},
genContent() {
return this.$createElement('div', {
staticClass: 'v-banner__content'
}, [this.genIcon(), this.genText()]);
},
genWrapper() {
return this.$createElement('div', {
staticClass: 'v-banner__wrapper'
}, [this.genContent(), this.genActions()]);
}
},
render(h) {
return h(VExpandTransition, [h('div', this.setBackgroundColor(this.color, {
staticClass: 'v-banner',
attrs: this.attrs$,
class: this.classes,
style: this.styles,
directives: [{
name: 'show',
value: this.isActive
}]
}), [this.genWrapper()])]);
}
});
//# sourceMappingURL=VBanner.js.map
File diff suppressed because one or more lines are too long
+4
View File
@@ -0,0 +1,4 @@
import VBanner from './VBanner';
export { VBanner };
export default VBanner;
//# sourceMappingURL=index.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/components/VBanner/index.ts"],"names":[],"mappings":"AAAA,OAAO,OAAP,MAAoB,WAApB;AAEA,SAAS,OAAT;AACA,eAAe,OAAf","sourcesContent":["import VBanner from './VBanner'\n\nexport { VBanner }\nexport default VBanner\n"],"sourceRoot":"","file":"index.js"}
@@ -0,0 +1,120 @@
// Styles
import "../../../src/components/VBottomNavigation/VBottomNavigation.sass"; // Mixins
import Applicationable from '../../mixins/applicationable';
import ButtonGroup from '../../mixins/button-group';
import Colorable from '../../mixins/colorable';
import Measurable from '../../mixins/measurable';
import Proxyable from '../../mixins/proxyable';
import Scrollable from '../../mixins/scrollable';
import Themeable from '../../mixins/themeable';
import { factory as ToggleableFactory } from '../../mixins/toggleable'; // Utilities
import mixins from '../../util/mixins';
import { breaking } from '../../util/console';
export default mixins(Applicationable('bottom', ['height', 'inputValue']), Colorable, Measurable, ToggleableFactory('inputValue'), Proxyable, Scrollable, Themeable
/* @vue/component */
).extend({
name: 'v-bottom-navigation',
props: {
activeClass: {
type: String,
default: 'v-btn--active'
},
backgroundColor: String,
grow: Boolean,
height: {
type: [Number, String],
default: 56
},
hideOnScroll: Boolean,
horizontal: Boolean,
inputValue: {
type: Boolean,
default: true
},
mandatory: Boolean,
shift: Boolean
},
data() {
return {
isActive: this.inputValue
};
},
computed: {
canScroll() {
return Scrollable.options.computed.canScroll.call(this) && (this.hideOnScroll || !this.inputValue);
},
classes() {
return {
'v-bottom-navigation--absolute': this.absolute,
'v-bottom-navigation--grow': this.grow,
'v-bottom-navigation--fixed': !this.absolute && (this.app || this.fixed),
'v-bottom-navigation--horizontal': this.horizontal,
'v-bottom-navigation--shift': this.shift
};
},
styles() {
return { ...this.measurableStyles,
transform: this.isActive ? 'none' : 'translateY(100%)'
};
}
},
created() {
/* istanbul ignore next */
if (this.$attrs.hasOwnProperty('active')) {
breaking('active.sync', 'value or v-model', this);
}
},
methods: {
thresholdMet() {
this.isActive = !this.isScrollingUp;
this.$emit('update:input-value', this.isActive);
},
updateApplication() {
return this.$el ? this.$el.clientHeight : 0;
},
updateValue(val) {
this.$emit('change', val);
}
},
render(h) {
const data = this.setBackgroundColor(this.backgroundColor, {
staticClass: 'v-bottom-navigation',
class: this.classes,
style: this.styles,
props: {
activeClass: this.activeClass,
mandatory: Boolean(this.mandatory || this.value !== undefined),
value: this.internalValue
},
on: {
change: this.updateValue
}
});
if (this.canScroll) {
data.directives = data.directives || [];
data.directives.push({
arg: this.scrollTarget,
name: 'scroll',
value: this.onScroll
});
}
return h(ButtonGroup, this.setTextColor(this.color, data), this.$slots.default);
}
});
//# sourceMappingURL=VBottomNavigation.js.map
File diff suppressed because one or more lines are too long
+4
View File
@@ -0,0 +1,4 @@
import VBottomNavigation from './VBottomNavigation';
export { VBottomNavigation };
export default VBottomNavigation;
//# sourceMappingURL=index.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/components/VBottomNavigation/index.ts"],"names":[],"mappings":"AAAA,OAAO,iBAAP,MAA8B,qBAA9B;AAEA,SAAS,iBAAT;AACA,eAAe,iBAAf","sourcesContent":["import VBottomNavigation from './VBottomNavigation'\n\nexport { VBottomNavigation }\nexport default VBottomNavigation\n"],"sourceRoot":"","file":"index.js"}
+29
View File
@@ -0,0 +1,29 @@
import "../../../src/components/VBottomSheet/VBottomSheet.sass"; // Extensions
import VDialog from '../VDialog/VDialog';
/* @vue/component */
export default VDialog.extend({
name: 'v-bottom-sheet',
props: {
inset: Boolean,
maxWidth: {
type: [String, Number],
default: 'auto'
},
transition: {
type: String,
default: 'bottom-sheet-transition'
}
},
computed: {
classes() {
return { ...VDialog.options.computed.classes.call(this),
'v-bottom-sheet': true,
'v-bottom-sheet--inset': this.inset
};
}
}
});
//# sourceMappingURL=VBottomSheet.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/components/VBottomSheet/VBottomSheet.ts"],"names":[],"mappings":"AAAA,OAAO,wDAAP,C,CAEA;;AACA,OAAO,OAAP,MAAoB,oBAApB;AAEA;;AACA,eAAe,OAAO,CAAC,MAAR,CAAe;AAC5B,EAAA,IAAI,EAAE,gBADsB;AAG5B,EAAA,KAAK,EAAE;AACL,IAAA,KAAK,EAAE,OADF;AAEL,IAAA,QAAQ,EAAE;AACR,MAAA,IAAI,EAAE,CAAC,MAAD,EAAS,MAAT,CADE;AAER,MAAA,OAAO,EAAE;AAFD,KAFL;AAML,IAAA,UAAU,EAAE;AACV,MAAA,IAAI,EAAE,MADI;AAEV,MAAA,OAAO,EAAE;AAFC;AANP,GAHqB;AAe5B,EAAA,QAAQ,EAAE;AACR,IAAA,OAAO,GAAA;AACL,aAAO,EACL,GAAG,OAAO,CAAC,OAAR,CAAgB,QAAhB,CAAyB,OAAzB,CAAiC,IAAjC,CAAsC,IAAtC,CADE;AAEL,0BAAkB,IAFb;AAGL,iCAAyB,KAAK;AAHzB,OAAP;AAKD;;AAPO;AAfkB,CAAf,CAAf","sourcesContent":["import './VBottomSheet.sass'\n\n// Extensions\nimport VDialog from '../VDialog/VDialog'\n\n/* @vue/component */\nexport default VDialog.extend({\n name: 'v-bottom-sheet',\n\n props: {\n inset: Boolean,\n maxWidth: {\n type: [String, Number],\n default: 'auto',\n },\n transition: {\n type: String,\n default: 'bottom-sheet-transition',\n },\n },\n\n computed: {\n classes (): object {\n return {\n ...VDialog.options.computed.classes.call(this),\n 'v-bottom-sheet': true,\n 'v-bottom-sheet--inset': this.inset,\n }\n },\n },\n})\n"],"sourceRoot":"","file":"VBottomSheet.js"}
+4
View File
@@ -0,0 +1,4 @@
import VBottomSheet from './VBottomSheet';
export { VBottomSheet };
export default VBottomSheet;
//# sourceMappingURL=index.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/components/VBottomSheet/index.ts"],"names":[],"mappings":"AAAA,OAAO,YAAP,MAAyB,gBAAzB;AAEA,SAAS,YAAT;AACA,eAAe,YAAf","sourcesContent":["import VBottomSheet from './VBottomSheet'\n\nexport { VBottomSheet }\nexport default VBottomSheet\n"],"sourceRoot":"","file":"index.js"}
+70
View File
@@ -0,0 +1,70 @@
// Styles
import "../../../src/components/VBreadcrumbs/VBreadcrumbs.sass"; // Components
import VBreadcrumbsItem from './VBreadcrumbsItem';
import VBreadcrumbsDivider from './VBreadcrumbsDivider'; // Mixins
import Themeable from '../../mixins/themeable'; // Utils
import mixins from '../../util/mixins';
export default mixins(Themeable
/* @vue/component */
).extend({
name: 'v-breadcrumbs',
props: {
divider: {
type: String,
default: '/'
},
items: {
type: Array,
default: () => []
},
large: Boolean
},
computed: {
classes() {
return {
'v-breadcrumbs--large': this.large,
...this.themeClasses
};
}
},
methods: {
genDivider() {
return this.$createElement(VBreadcrumbsDivider, this.$slots.divider ? this.$slots.divider : this.divider);
},
genItems() {
const items = [];
const hasSlot = !!this.$scopedSlots.item;
const keys = [];
for (let i = 0; i < this.items.length; i++) {
const item = this.items[i];
keys.push(item.text);
if (hasSlot) items.push(this.$scopedSlots.item({
item
}));else items.push(this.$createElement(VBreadcrumbsItem, {
key: keys.join('.'),
props: item
}, [item.text]));
if (i < this.items.length - 1) items.push(this.genDivider());
}
return items;
}
},
render(h) {
const children = this.$slots.default || this.genItems();
return h('ul', {
staticClass: 'v-breadcrumbs',
class: this.classes
}, children);
}
});
//# sourceMappingURL=VBreadcrumbs.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/components/VBreadcrumbs/VBreadcrumbs.ts"],"names":[],"mappings":"AAAA;AACA,OAAO,wDAAP,C,CAKA;;AACA,OAAO,gBAAP,MAA6B,oBAA7B;AACA,OAAO,mBAAP,MAAgC,uBAAhC,C,CAEA;;AACA,OAAO,SAAP,MAAsB,wBAAtB,C,CAEA;;AACA,OAAO,MAAP,MAAmB,mBAAnB;AAEA,eAAe,MAAM,CACnB;AACA;AAFmB,CAAN,CAGb,MAHa,CAGN;AACP,EAAA,IAAI,EAAE,eADC;AAGP,EAAA,KAAK,EAAE;AACL,IAAA,OAAO,EAAE;AACP,MAAA,IAAI,EAAE,MADC;AAEP,MAAA,OAAO,EAAE;AAFF,KADJ;AAKL,IAAA,KAAK,EAAE;AACL,MAAA,IAAI,EAAE,KADD;AAEL,MAAA,OAAO,EAAE,MAAO;AAFX,KALF;AASL,IAAA,KAAK,EAAE;AATF,GAHA;AAeP,EAAA,QAAQ,EAAE;AACR,IAAA,OAAO,GAAA;AACL,aAAO;AACL,gCAAwB,KAAK,KADxB;AAEL,WAAG,KAAK;AAFH,OAAP;AAID;;AANO,GAfH;AAwBP,EAAA,OAAO,EAAE;AACP,IAAA,UAAU,GAAA;AACR,aAAO,KAAK,cAAL,CAAoB,mBAApB,EAAyC,KAAK,MAAL,CAAY,OAAZ,GAAsB,KAAK,MAAL,CAAY,OAAlC,GAA4C,KAAK,OAA1F,CAAP;AACD,KAHM;;AAIP,IAAA,QAAQ,GAAA;AACN,YAAM,KAAK,GAAG,EAAd;AACA,YAAM,OAAO,GAAG,CAAC,CAAC,KAAK,YAAL,CAAkB,IAApC;AACA,YAAM,IAAI,GAAG,EAAb;;AAEA,WAAK,IAAI,CAAC,GAAG,CAAb,EAAgB,CAAC,GAAG,KAAK,KAAL,CAAW,MAA/B,EAAuC,CAAC,EAAxC,EAA4C;AAC1C,cAAM,IAAI,GAAG,KAAK,KAAL,CAAW,CAAX,CAAb;AAEA,QAAA,IAAI,CAAC,IAAL,CAAU,IAAI,CAAC,IAAf;AAEA,YAAI,OAAJ,EAAa,KAAK,CAAC,IAAN,CAAW,KAAK,YAAL,CAAkB,IAAlB,CAAwB;AAAE,UAAA;AAAF,SAAxB,CAAX,EAAb,KACK,KAAK,CAAC,IAAN,CAAW,KAAK,cAAL,CAAoB,gBAApB,EAAsC;AAAE,UAAA,GAAG,EAAE,IAAI,CAAC,IAAL,CAAU,GAAV,CAAP;AAAuB,UAAA,KAAK,EAAE;AAA9B,SAAtC,EAA4E,CAAC,IAAI,CAAC,IAAN,CAA5E,CAAX;AAEL,YAAI,CAAC,GAAG,KAAK,KAAL,CAAW,MAAX,GAAoB,CAA5B,EAA+B,KAAK,CAAC,IAAN,CAAW,KAAK,UAAL,EAAX;AAChC;;AAED,aAAO,KAAP;AACD;;AArBM,GAxBF;;AAgDP,EAAA,MAAM,CAAE,CAAF,EAAG;AACP,UAAM,QAAQ,GAAG,KAAK,MAAL,CAAY,OAAZ,IAAuB,KAAK,QAAL,EAAxC;AAEA,WAAO,CAAC,CAAC,IAAD,EAAO;AACb,MAAA,WAAW,EAAE,eADA;AAEb,MAAA,KAAK,EAAE,KAAK;AAFC,KAAP,EAGL,QAHK,CAAR;AAID;;AAvDM,CAHM,CAAf","sourcesContent":["// Styles\nimport './VBreadcrumbs.sass'\n\n// Types\nimport { VNode, PropType } from 'vue'\n\n// Components\nimport VBreadcrumbsItem from './VBreadcrumbsItem'\nimport VBreadcrumbsDivider from './VBreadcrumbsDivider'\n\n// Mixins\nimport Themeable from '../../mixins/themeable'\n\n// Utils\nimport mixins from '../../util/mixins'\n\nexport default mixins(\n Themeable\n /* @vue/component */\n).extend({\n name: 'v-breadcrumbs',\n\n props: {\n divider: {\n type: String,\n default: '/',\n },\n items: {\n type: Array as PropType<any[]>,\n default: () => ([]),\n },\n large: Boolean,\n },\n\n computed: {\n classes (): object {\n return {\n 'v-breadcrumbs--large': this.large,\n ...this.themeClasses,\n }\n },\n },\n\n methods: {\n genDivider () {\n return this.$createElement(VBreadcrumbsDivider, this.$slots.divider ? this.$slots.divider : this.divider)\n },\n genItems () {\n const items = []\n const hasSlot = !!this.$scopedSlots.item\n const keys = []\n\n for (let i = 0; i < this.items.length; i++) {\n const item = this.items[i]\n\n keys.push(item.text)\n\n if (hasSlot) items.push(this.$scopedSlots.item!({ item }))\n else items.push(this.$createElement(VBreadcrumbsItem, { key: keys.join('.'), props: item }, [item.text]))\n\n if (i < this.items.length - 1) items.push(this.genDivider())\n }\n\n return items\n },\n },\n\n render (h): VNode {\n const children = this.$slots.default || this.genItems()\n\n return h('ul', {\n staticClass: 'v-breadcrumbs',\n class: this.classes,\n }, children)\n },\n})\n"],"sourceRoot":"","file":"VBreadcrumbs.js"}
@@ -0,0 +1,3 @@
import { createSimpleFunctional } from '../../util/helpers';
export default createSimpleFunctional('v-breadcrumbs__divider', 'li');
//# sourceMappingURL=VBreadcrumbsDivider.js.map
@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/components/VBreadcrumbs/VBreadcrumbsDivider.ts"],"names":[],"mappings":"AAAA,SAAS,sBAAT,QAAuC,oBAAvC;AAEA,eAAe,sBAAsB,CAAC,wBAAD,EAA2B,IAA3B,CAArC","sourcesContent":["import { createSimpleFunctional } from '../../util/helpers'\n\nexport default createSimpleFunctional('v-breadcrumbs__divider', 'li')\n"],"sourceRoot":"","file":"VBreadcrumbsDivider.js"}
+42
View File
@@ -0,0 +1,42 @@
import Routable from '../../mixins/routable';
import mixins from '../../util/mixins';
/* @vue/component */
export default mixins(Routable).extend({
name: 'v-breadcrumbs-item',
props: {
// In a breadcrumb, the currently
// active item should be dimmed
activeClass: {
type: String,
default: 'v-breadcrumbs__item--disabled'
},
ripple: {
type: [Boolean, Object],
default: false
}
},
computed: {
classes() {
return {
'v-breadcrumbs__item': true,
[this.activeClass]: this.disabled
};
}
},
render(h) {
const {
tag,
data
} = this.generateRouteLink();
return h('li', [h(tag, { ...data,
attrs: { ...data.attrs,
'aria-current': this.isActive && this.isLink ? 'page' : undefined
}
}, this.$slots.default)]);
}
});
//# sourceMappingURL=VBreadcrumbsItem.js.map
@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/components/VBreadcrumbs/VBreadcrumbsItem.ts"],"names":[],"mappings":"AAAA,OAAO,QAAP,MAAqB,uBAArB;AAEA,OAAO,MAAP,MAAmB,mBAAnB;AAGA;;AACA,eAAe,MAAM,CAAC,QAAD,CAAN,CAAiB,MAAjB,CAAwB;AACrC,EAAA,IAAI,EAAE,oBAD+B;AAGrC,EAAA,KAAK,EAAE;AACL;AACA;AACA,IAAA,WAAW,EAAE;AACX,MAAA,IAAI,EAAE,MADK;AAEX,MAAA,OAAO,EAAE;AAFE,KAHR;AAOL,IAAA,MAAM,EAAE;AACN,MAAA,IAAI,EAAE,CAAC,OAAD,EAAU,MAAV,CADA;AAEN,MAAA,OAAO,EAAE;AAFH;AAPH,GAH8B;AAgBrC,EAAA,QAAQ,EAAE;AACR,IAAA,OAAO,GAAA;AACL,aAAO;AACL,+BAAuB,IADlB;AAEL,SAAC,KAAK,WAAN,GAAoB,KAAK;AAFpB,OAAP;AAID;;AANO,GAhB2B;;AAyBrC,EAAA,MAAM,CAAE,CAAF,EAAG;AACP,UAAM;AAAE,MAAA,GAAF;AAAO,MAAA;AAAP,QAAgB,KAAK,iBAAL,EAAtB;AAEA,WAAO,CAAC,CAAC,IAAD,EAAO,CACb,CAAC,CAAC,GAAD,EAAM,EACL,GAAG,IADE;AAEL,MAAA,KAAK,EAAE,EACL,GAAG,IAAI,CAAC,KADH;AAEL,wBAAgB,KAAK,QAAL,IAAiB,KAAK,MAAtB,GAA+B,MAA/B,GAAwC;AAFnD;AAFF,KAAN,EAME,KAAK,MAAL,CAAY,OANd,CADY,CAAP,CAAR;AASD;;AArCoC,CAAxB,CAAf","sourcesContent":["import Routable from '../../mixins/routable'\n\nimport mixins from '../../util/mixins'\nimport { VNode } from 'vue'\n\n/* @vue/component */\nexport default mixins(Routable).extend({\n name: 'v-breadcrumbs-item',\n\n props: {\n // In a breadcrumb, the currently\n // active item should be dimmed\n activeClass: {\n type: String,\n default: 'v-breadcrumbs__item--disabled',\n },\n ripple: {\n type: [Boolean, Object],\n default: false,\n },\n },\n\n computed: {\n classes (): object {\n return {\n 'v-breadcrumbs__item': true,\n [this.activeClass]: this.disabled,\n }\n },\n },\n\n render (h): VNode {\n const { tag, data } = this.generateRouteLink()\n\n return h('li', [\n h(tag, {\n ...data,\n attrs: {\n ...data.attrs,\n 'aria-current': this.isActive && this.isLink ? 'page' : undefined,\n },\n }, this.$slots.default),\n ])\n },\n})\n"],"sourceRoot":"","file":"VBreadcrumbsItem.js"}
+12
View File
@@ -0,0 +1,12 @@
import VBreadcrumbs from './VBreadcrumbs';
import VBreadcrumbsItem from './VBreadcrumbsItem';
import VBreadcrumbsDivider from './VBreadcrumbsDivider';
export { VBreadcrumbs, VBreadcrumbsItem, VBreadcrumbsDivider };
export default {
$_vuetify_subcomponents: {
VBreadcrumbs,
VBreadcrumbsItem,
VBreadcrumbsDivider
}
};
//# sourceMappingURL=index.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/components/VBreadcrumbs/index.ts"],"names":[],"mappings":"AAAA,OAAO,YAAP,MAAyB,gBAAzB;AACA,OAAO,gBAAP,MAA6B,oBAA7B;AACA,OAAO,mBAAP,MAAgC,uBAAhC;AAEA,SAAS,YAAT,EAAuB,gBAAvB,EAAyC,mBAAzC;AAEA,eAAe;AACb,EAAA,uBAAuB,EAAE;AACvB,IAAA,YADuB;AAEvB,IAAA,gBAFuB;AAGvB,IAAA;AAHuB;AADZ,CAAf","sourcesContent":["import VBreadcrumbs from './VBreadcrumbs'\nimport VBreadcrumbsItem from './VBreadcrumbsItem'\nimport VBreadcrumbsDivider from './VBreadcrumbsDivider'\n\nexport { VBreadcrumbs, VBreadcrumbsItem, VBreadcrumbsDivider }\n\nexport default {\n $_vuetify_subcomponents: {\n VBreadcrumbs,\n VBreadcrumbsItem,\n VBreadcrumbsDivider,\n },\n}\n"],"sourceRoot":"","file":"index.js"}
+169
View File
@@ -0,0 +1,169 @@
// Styles
import "../../../src/components/VBtn/VBtn.sass"; // Extensions
import VSheet from '../VSheet'; // Components
import VProgressCircular from '../VProgressCircular'; // Mixins
import { factory as GroupableFactory } from '../../mixins/groupable';
import { factory as ToggleableFactory } from '../../mixins/toggleable';
import Positionable from '../../mixins/positionable';
import Routable from '../../mixins/routable';
import Sizeable from '../../mixins/sizeable'; // Utilities
import mixins from '../../util/mixins';
import { breaking } from '../../util/console';
const baseMixins = mixins(VSheet, Routable, Positionable, Sizeable, GroupableFactory('btnToggle'), ToggleableFactory('inputValue')
/* @vue/component */
);
export default baseMixins.extend().extend({
name: 'v-btn',
props: {
activeClass: {
type: String,
default() {
if (!this.btnToggle) return '';
return this.btnToggle.activeClass;
}
},
block: Boolean,
depressed: Boolean,
fab: Boolean,
icon: Boolean,
loading: Boolean,
outlined: Boolean,
retainFocusOnClick: Boolean,
rounded: Boolean,
tag: {
type: String,
default: 'button'
},
text: Boolean,
tile: Boolean,
type: {
type: String,
default: 'button'
},
value: null
},
data: () => ({
proxyClass: 'v-btn--active'
}),
computed: {
classes() {
return {
'v-btn': true,
...Routable.options.computed.classes.call(this),
'v-btn--absolute': this.absolute,
'v-btn--block': this.block,
'v-btn--bottom': this.bottom,
'v-btn--contained': this.contained,
'v-btn--depressed': this.depressed || this.outlined,
'v-btn--disabled': this.disabled,
'v-btn--fab': this.fab,
'v-btn--fixed': this.fixed,
'v-btn--flat': this.isFlat,
'v-btn--icon': this.icon,
'v-btn--left': this.left,
'v-btn--loading': this.loading,
'v-btn--outlined': this.outlined,
'v-btn--right': this.right,
'v-btn--round': this.isRound,
'v-btn--rounded': this.rounded,
'v-btn--router': this.to,
'v-btn--text': this.text,
'v-btn--tile': this.tile,
'v-btn--top': this.top,
...this.themeClasses,
...this.groupClasses,
...this.elevationClasses,
...this.sizeableClasses
};
},
contained() {
return Boolean(!this.isFlat && !this.depressed && // Contained class only adds elevation
// is not needed if user provides value
!this.elevation);
},
computedRipple() {
const defaultRipple = this.icon || this.fab ? {
circle: true
} : true;
if (this.disabled) return false;else return this.ripple != null ? this.ripple : defaultRipple;
},
isFlat() {
return Boolean(this.icon || this.text || this.outlined);
},
isRound() {
return Boolean(this.icon || this.fab);
},
styles() {
return { ...this.measurableStyles
};
}
},
created() {
const breakingProps = [['flat', 'text'], ['outline', 'outlined'], ['round', 'rounded']];
/* istanbul ignore next */
breakingProps.forEach(([original, replacement]) => {
if (this.$attrs.hasOwnProperty(original)) breaking(original, replacement, this);
});
},
methods: {
click(e) {
// TODO: Remove this in v3
!this.retainFocusOnClick && !this.fab && e.detail && this.$el.blur();
this.$emit('click', e);
this.btnToggle && this.toggle();
},
genContent() {
return this.$createElement('span', {
staticClass: 'v-btn__content'
}, this.$slots.default);
},
genLoader() {
return this.$createElement('span', {
class: 'v-btn__loader'
}, this.$slots.loader || [this.$createElement(VProgressCircular, {
props: {
indeterminate: true,
size: 23,
width: 2
}
})]);
}
},
render(h) {
const children = [this.genContent(), this.loading && this.genLoader()];
const setColor = !this.isFlat ? this.setBackgroundColor : this.setTextColor;
const {
tag,
data
} = this.generateRouteLink();
if (tag === 'button') {
data.attrs.type = this.type;
data.attrs.disabled = this.disabled;
}
data.attrs.value = ['string', 'number'].includes(typeof this.value) ? this.value : JSON.stringify(this.value);
return h(tag, this.disabled ? data : setColor(this.color, data), children);
}
});
//# sourceMappingURL=VBtn.js.map
File diff suppressed because one or more lines are too long
+4
View File
@@ -0,0 +1,4 @@
import VBtn from './VBtn';
export { VBtn };
export default VBtn;
//# sourceMappingURL=index.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/components/VBtn/index.ts"],"names":[],"mappings":"AAAA,OAAO,IAAP,MAAiB,QAAjB;AAEA,SAAS,IAAT;AACA,eAAe,IAAf","sourcesContent":["import VBtn from './VBtn'\n\nexport { VBtn }\nexport default VBtn\n"],"sourceRoot":"","file":"index.js"}
+46
View File
@@ -0,0 +1,46 @@
// Styles
import "../../../src/components/VBtnToggle/VBtnToggle.sass"; // Mixins
import ButtonGroup from '../../mixins/button-group';
import Colorable from '../../mixins/colorable'; // Utilities
import mixins from '../../util/mixins';
/* @vue/component */
export default mixins(ButtonGroup, Colorable).extend({
name: 'v-btn-toggle',
props: {
backgroundColor: String,
borderless: Boolean,
dense: Boolean,
group: Boolean,
rounded: Boolean,
shaped: Boolean,
tile: Boolean
},
computed: {
classes() {
return { ...ButtonGroup.options.computed.classes.call(this),
'v-btn-toggle': true,
'v-btn-toggle--borderless': this.borderless,
'v-btn-toggle--dense': this.dense,
'v-btn-toggle--group': this.group,
'v-btn-toggle--rounded': this.rounded,
'v-btn-toggle--shaped': this.shaped,
'v-btn-toggle--tile': this.tile,
...this.themeClasses
};
}
},
methods: {
genData() {
const data = this.setTextColor(this.color, { ...ButtonGroup.options.methods.genData.call(this)
});
if (this.group) return data;
return this.setBackgroundColor(this.backgroundColor, data);
}
}
});
//# sourceMappingURL=VBtnToggle.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/components/VBtnToggle/VBtnToggle.ts"],"names":[],"mappings":"AAAA;AACA,OAAO,oDAAP,C,CAEA;;AACA,OAAO,WAAP,MAAwB,2BAAxB;AACA,OAAO,SAAP,MAAsB,wBAAtB,C,CAEA;;AACA,OAAO,MAAP,MAAmB,mBAAnB;AAEA;;AACA,eAAe,MAAM,CACnB,WADmB,EAEnB,SAFmB,CAAN,CAGb,MAHa,CAGN;AACP,EAAA,IAAI,EAAE,cADC;AAGP,EAAA,KAAK,EAAE;AACL,IAAA,eAAe,EAAE,MADZ;AAEL,IAAA,UAAU,EAAE,OAFP;AAGL,IAAA,KAAK,EAAE,OAHF;AAIL,IAAA,KAAK,EAAE,OAJF;AAKL,IAAA,OAAO,EAAE,OALJ;AAML,IAAA,MAAM,EAAE,OANH;AAOL,IAAA,IAAI,EAAE;AAPD,GAHA;AAaP,EAAA,QAAQ,EAAE;AACR,IAAA,OAAO,GAAA;AACL,aAAO,EACL,GAAG,WAAW,CAAC,OAAZ,CAAoB,QAApB,CAA6B,OAA7B,CAAqC,IAArC,CAA0C,IAA1C,CADE;AAEL,wBAAgB,IAFX;AAGL,oCAA4B,KAAK,UAH5B;AAIL,+BAAuB,KAAK,KAJvB;AAKL,+BAAuB,KAAK,KALvB;AAML,iCAAyB,KAAK,OANzB;AAOL,gCAAwB,KAAK,MAPxB;AAQL,8BAAsB,KAAK,IARtB;AASL,WAAG,KAAK;AATH,OAAP;AAWD;;AAbO,GAbH;AA6BP,EAAA,OAAO,EAAE;AACP,IAAA,OAAO,GAAA;AACL,YAAM,IAAI,GAAG,KAAK,YAAL,CAAkB,KAAK,KAAvB,EAA8B,EACzC,GAAG,WAAW,CAAC,OAAZ,CAAoB,OAApB,CAA4B,OAA5B,CAAoC,IAApC,CAAyC,IAAzC;AADsC,OAA9B,CAAb;AAIA,UAAI,KAAK,KAAT,EAAgB,OAAO,IAAP;AAEhB,aAAO,KAAK,kBAAL,CAAwB,KAAK,eAA7B,EAA8C,IAA9C,CAAP;AACD;;AATM;AA7BF,CAHM,CAAf","sourcesContent":["// Styles\nimport './VBtnToggle.sass'\n\n// Mixins\nimport ButtonGroup from '../../mixins/button-group'\nimport Colorable from '../../mixins/colorable'\n\n// Utilities\nimport mixins from '../../util/mixins'\n\n/* @vue/component */\nexport default mixins(\n ButtonGroup,\n Colorable\n).extend({\n name: 'v-btn-toggle',\n\n props: {\n backgroundColor: String,\n borderless: Boolean,\n dense: Boolean,\n group: Boolean,\n rounded: Boolean,\n shaped: Boolean,\n tile: Boolean,\n },\n\n computed: {\n classes (): object {\n return {\n ...ButtonGroup.options.computed.classes.call(this),\n 'v-btn-toggle': true,\n 'v-btn-toggle--borderless': this.borderless,\n 'v-btn-toggle--dense': this.dense,\n 'v-btn-toggle--group': this.group,\n 'v-btn-toggle--rounded': this.rounded,\n 'v-btn-toggle--shaped': this.shaped,\n 'v-btn-toggle--tile': this.tile,\n ...this.themeClasses,\n }\n },\n },\n\n methods: {\n genData () {\n const data = this.setTextColor(this.color, {\n ...ButtonGroup.options.methods.genData.call(this),\n })\n\n if (this.group) return data\n\n return this.setBackgroundColor(this.backgroundColor, data)\n },\n },\n})\n"],"sourceRoot":"","file":"VBtnToggle.js"}
+4
View File
@@ -0,0 +1,4 @@
import VBtnToggle from './VBtnToggle';
export { VBtnToggle };
export default VBtnToggle;
//# sourceMappingURL=index.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/components/VBtnToggle/index.ts"],"names":[],"mappings":"AAAA,OAAO,UAAP,MAAuB,cAAvB;AAEA,SAAS,UAAT;AACA,eAAe,UAAf","sourcesContent":["import VBtnToggle from './VBtnToggle'\n\nexport { VBtnToggle }\nexport default VBtnToggle\n"],"sourceRoot":"","file":"index.js"}
+390
View File
@@ -0,0 +1,390 @@
// 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
@@ -0,0 +1,83 @@
// 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
@@ -0,0 +1,254 @@
// 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
@@ -0,0 +1,26 @@
// 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
@@ -0,0 +1 @@
{"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
@@ -0,0 +1,198 @@
// 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
@@ -0,0 +1,16 @@
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
@@ -0,0 +1 @@
{"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
@@ -0,0 +1,103 @@
// 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
@@ -0,0 +1,462 @@
// 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
@@ -0,0 +1,161 @@
// 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
@@ -0,0 +1,87 @@
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
@@ -0,0 +1 @@
{"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
@@ -0,0 +1,70 @@
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
@@ -0,0 +1 @@
{"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
@@ -0,0 +1,18 @@
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
@@ -0,0 +1 @@
{"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
@@ -0,0 +1,119 @@
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
@@ -0,0 +1,7 @@
import { stack } from './stack';
import { column } from './column';
export const CalendarEventOverlapModes = {
stack,
column
};
//# sourceMappingURL=index.js.map
+1
View File
@@ -0,0 +1 @@
{"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
@@ -0,0 +1,242 @@
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
@@ -0,0 +1,37 @@
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
@@ -0,0 +1 @@
{"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
@@ -0,0 +1,255 @@
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
@@ -0,0 +1,454 @@
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
+80
View File
@@ -0,0 +1,80 @@
// Styles
import "../../../src/components/VCard/VCard.sass"; // Extensions
import VSheet from '../VSheet'; // Mixins
import Loadable from '../../mixins/loadable';
import Routable from '../../mixins/routable'; // Helpers
import mixins from '../../util/mixins';
/* @vue/component */
export default mixins(Loadable, Routable, VSheet).extend({
name: 'v-card',
props: {
flat: Boolean,
hover: Boolean,
img: String,
link: Boolean,
loaderHeight: {
type: [Number, String],
default: 4
},
raised: Boolean
},
computed: {
classes() {
return {
'v-card': true,
...Routable.options.computed.classes.call(this),
'v-card--flat': this.flat,
'v-card--hover': this.hover,
'v-card--link': this.isClickable,
'v-card--loading': this.loading,
'v-card--disabled': this.disabled,
'v-card--raised': this.raised,
...VSheet.options.computed.classes.call(this)
};
},
styles() {
const style = { ...VSheet.options.computed.styles.call(this)
};
if (this.img) {
style.background = `url("${this.img}") center center / cover no-repeat`;
}
return style;
}
},
methods: {
genProgress() {
const render = Loadable.options.methods.genProgress.call(this);
if (!render) return null;
return this.$createElement('div', {
staticClass: 'v-card__progress',
key: 'progress'
}, [render]);
}
},
render(h) {
const {
tag,
data
} = this.generateRouteLink();
data.style = this.styles;
if (this.isClickable) {
data.attrs = data.attrs || {};
data.attrs.tabindex = 0;
}
return h(tag, this.setBackgroundColor(this.color, data), [this.genProgress(), this.$slots.default]);
}
});
//# sourceMappingURL=VCard.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/components/VCard/VCard.ts"],"names":[],"mappings":"AAAA;AACA,OAAO,0CAAP,C,CAEA;;AACA,OAAO,MAAP,MAAmB,WAAnB,C,CAEA;;AACA,OAAO,QAAP,MAAqB,uBAArB;AACA,OAAO,QAAP,MAAqB,uBAArB,C,CAEA;;AACA,OAAO,MAAP,MAAmB,mBAAnB;AAKA;;AACA,eAAe,MAAM,CACnB,QADmB,EAEnB,QAFmB,EAGnB,MAHmB,CAAN,CAIb,MAJa,CAIN;AACP,EAAA,IAAI,EAAE,QADC;AAGP,EAAA,KAAK,EAAE;AACL,IAAA,IAAI,EAAE,OADD;AAEL,IAAA,KAAK,EAAE,OAFF;AAGL,IAAA,GAAG,EAAE,MAHA;AAIL,IAAA,IAAI,EAAE,OAJD;AAKL,IAAA,YAAY,EAAE;AACZ,MAAA,IAAI,EAAE,CAAC,MAAD,EAAS,MAAT,CADM;AAEZ,MAAA,OAAO,EAAE;AAFG,KALT;AASL,IAAA,MAAM,EAAE;AATH,GAHA;AAeP,EAAA,QAAQ,EAAE;AACR,IAAA,OAAO,GAAA;AACL,aAAO;AACL,kBAAU,IADL;AAEL,WAAG,QAAQ,CAAC,OAAT,CAAiB,QAAjB,CAA0B,OAA1B,CAAkC,IAAlC,CAAuC,IAAvC,CAFE;AAGL,wBAAgB,KAAK,IAHhB;AAIL,yBAAiB,KAAK,KAJjB;AAKL,wBAAgB,KAAK,WALhB;AAML,2BAAmB,KAAK,OANnB;AAOL,4BAAoB,KAAK,QAPpB;AAQL,0BAAkB,KAAK,MARlB;AASL,WAAG,MAAM,CAAC,OAAP,CAAe,QAAf,CAAwB,OAAxB,CAAgC,IAAhC,CAAqC,IAArC;AATE,OAAP;AAWD,KAbO;;AAcR,IAAA,MAAM,GAAA;AACJ,YAAM,KAAK,GAAuB,EAChC,GAAG,MAAM,CAAC,OAAP,CAAe,QAAf,CAAwB,MAAxB,CAA+B,IAA/B,CAAoC,IAApC;AAD6B,OAAlC;;AAIA,UAAI,KAAK,GAAT,EAAc;AACZ,QAAA,KAAK,CAAC,UAAN,GAAmB,QAAQ,KAAK,GAAG,oCAAnC;AACD;;AAED,aAAO,KAAP;AACD;;AAxBO,GAfH;AA0CP,EAAA,OAAO,EAAE;AACP,IAAA,WAAW,GAAA;AACT,YAAM,MAAM,GAAG,QAAQ,CAAC,OAAT,CAAiB,OAAjB,CAAyB,WAAzB,CAAqC,IAArC,CAA0C,IAA1C,CAAf;AAEA,UAAI,CAAC,MAAL,EAAa,OAAO,IAAP;AAEb,aAAO,KAAK,cAAL,CAAoB,KAApB,EAA2B;AAChC,QAAA,WAAW,EAAE,kBADmB;AAEhC,QAAA,GAAG,EAAE;AAF2B,OAA3B,EAGJ,CAAC,MAAD,CAHI,CAAP;AAID;;AAVM,GA1CF;;AAuDP,EAAA,MAAM,CAAE,CAAF,EAAG;AACP,UAAM;AAAE,MAAA,GAAF;AAAO,MAAA;AAAP,QAAgB,KAAK,iBAAL,EAAtB;AAEA,IAAA,IAAI,CAAC,KAAL,GAAa,KAAK,MAAlB;;AAEA,QAAI,KAAK,WAAT,EAAsB;AACpB,MAAA,IAAI,CAAC,KAAL,GAAa,IAAI,CAAC,KAAL,IAAc,EAA3B;AACA,MAAA,IAAI,CAAC,KAAL,CAAW,QAAX,GAAsB,CAAtB;AACD;;AAED,WAAO,CAAC,CAAC,GAAD,EAAM,KAAK,kBAAL,CAAwB,KAAK,KAA7B,EAAoC,IAApC,CAAN,EAAiD,CACvD,KAAK,WAAL,EADuD,EAEvD,KAAK,MAAL,CAAY,OAF2C,CAAjD,CAAR;AAID;;AArEM,CAJM,CAAf","sourcesContent":["// Styles\nimport './VCard.sass'\n\n// Extensions\nimport VSheet from '../VSheet'\n\n// Mixins\nimport Loadable from '../../mixins/loadable'\nimport Routable from '../../mixins/routable'\n\n// Helpers\nimport mixins from '../../util/mixins'\n\n// Types\nimport { VNode } from 'vue'\n\n/* @vue/component */\nexport default mixins(\n Loadable,\n Routable,\n VSheet\n).extend({\n name: 'v-card',\n\n props: {\n flat: Boolean,\n hover: Boolean,\n img: String,\n link: Boolean,\n loaderHeight: {\n type: [Number, String],\n default: 4,\n },\n raised: Boolean,\n },\n\n computed: {\n classes (): object {\n return {\n 'v-card': true,\n ...Routable.options.computed.classes.call(this),\n 'v-card--flat': this.flat,\n 'v-card--hover': this.hover,\n 'v-card--link': this.isClickable,\n 'v-card--loading': this.loading,\n 'v-card--disabled': this.disabled,\n 'v-card--raised': this.raised,\n ...VSheet.options.computed.classes.call(this),\n }\n },\n styles (): object {\n const style: Dictionary<string> = {\n ...VSheet.options.computed.styles.call(this),\n }\n\n if (this.img) {\n style.background = `url(\"${this.img}\") center center / cover no-repeat`\n }\n\n return style\n },\n },\n\n methods: {\n genProgress () {\n const render = Loadable.options.methods.genProgress.call(this)\n\n if (!render) return null\n\n return this.$createElement('div', {\n staticClass: 'v-card__progress',\n key: 'progress',\n }, [render])\n },\n },\n\n render (h): VNode {\n const { tag, data } = this.generateRouteLink()\n\n data.style = this.styles\n\n if (this.isClickable) {\n data.attrs = data.attrs || {}\n data.attrs.tabindex = 0\n }\n\n return h(tag, this.setBackgroundColor(this.color, data), [\n this.genProgress(),\n this.$slots.default,\n ])\n },\n})\n"],"sourceRoot":"","file":"VCard.js"}
+17
View File
@@ -0,0 +1,17 @@
import VCard from './VCard';
import { createSimpleFunctional } from '../../util/helpers';
const VCardActions = createSimpleFunctional('v-card__actions');
const VCardSubtitle = createSimpleFunctional('v-card__subtitle');
const VCardText = createSimpleFunctional('v-card__text');
const VCardTitle = createSimpleFunctional('v-card__title');
export { VCard, VCardActions, VCardSubtitle, VCardText, VCardTitle };
export default {
$_vuetify_subcomponents: {
VCard,
VCardActions,
VCardSubtitle,
VCardText,
VCardTitle
}
};
//# sourceMappingURL=index.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/components/VCard/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAP,MAAkB,SAAlB;AACA,SAAS,sBAAT,QAAuC,oBAAvC;AAEA,MAAM,YAAY,GAAG,sBAAsB,CAAC,iBAAD,CAA3C;AACA,MAAM,aAAa,GAAG,sBAAsB,CAAC,kBAAD,CAA5C;AACA,MAAM,SAAS,GAAG,sBAAsB,CAAC,cAAD,CAAxC;AACA,MAAM,UAAU,GAAG,sBAAsB,CAAC,eAAD,CAAzC;AAEA,SACE,KADF,EAEE,YAFF,EAGE,aAHF,EAIE,SAJF,EAKE,UALF;AAQA,eAAe;AACb,EAAA,uBAAuB,EAAE;AACvB,IAAA,KADuB;AAEvB,IAAA,YAFuB;AAGvB,IAAA,aAHuB;AAIvB,IAAA,SAJuB;AAKvB,IAAA;AALuB;AADZ,CAAf","sourcesContent":["import VCard from './VCard'\nimport { createSimpleFunctional } from '../../util/helpers'\n\nconst VCardActions = createSimpleFunctional('v-card__actions')\nconst VCardSubtitle = createSimpleFunctional('v-card__subtitle')\nconst VCardText = createSimpleFunctional('v-card__text')\nconst VCardTitle = createSimpleFunctional('v-card__title')\n\nexport {\n VCard,\n VCardActions,\n VCardSubtitle,\n VCardText,\n VCardTitle,\n}\n\nexport default {\n $_vuetify_subcomponents: {\n VCard,\n VCardActions,\n VCardSubtitle,\n VCardText,\n VCardTitle,\n },\n}\n"],"sourceRoot":"","file":"index.js"}
+204
View File
@@ -0,0 +1,204 @@
// Styles
import "../../../src/components/VCarousel/VCarousel.sass"; // Extensions
import VWindow from '../VWindow/VWindow'; // Components
import VBtn from '../VBtn';
import VIcon from '../VIcon';
import VProgressLinear from '../VProgressLinear'; // Mixins
// TODO: Move this into core components v2.0
import ButtonGroup from '../../mixins/button-group'; // Utilities
import { convertToUnit } from '../../util/helpers';
import { breaking } from '../../util/console';
export default VWindow.extend({
name: 'v-carousel',
props: {
continuous: {
type: Boolean,
default: true
},
cycle: Boolean,
delimiterIcon: {
type: String,
default: '$delimiter'
},
height: {
type: [Number, String],
default: 500
},
hideDelimiters: Boolean,
hideDelimiterBackground: Boolean,
interval: {
type: [Number, String],
default: 6000,
validator: value => value > 0
},
mandatory: {
type: Boolean,
default: true
},
progress: Boolean,
progressColor: String,
showArrows: {
type: Boolean,
default: true
},
verticalDelimiters: {
type: String,
default: undefined
}
},
data() {
return {
internalHeight: this.height,
slideTimeout: undefined
};
},
computed: {
classes() {
return { ...VWindow.options.computed.classes.call(this),
'v-carousel': true,
'v-carousel--hide-delimiter-background': this.hideDelimiterBackground,
'v-carousel--vertical-delimiters': this.isVertical
};
},
isDark() {
return this.dark || !this.light;
},
isVertical() {
return this.verticalDelimiters != null;
}
},
watch: {
internalValue: 'restartTimeout',
interval: 'restartTimeout',
height(val, oldVal) {
if (val === oldVal || !val) return;
this.internalHeight = val;
},
cycle(val) {
if (val) {
this.restartTimeout();
} else {
clearTimeout(this.slideTimeout);
this.slideTimeout = undefined;
}
}
},
created() {
/* istanbul ignore next */
if (this.$attrs.hasOwnProperty('hide-controls')) {
breaking('hide-controls', ':show-arrows="false"', this);
}
},
mounted() {
this.startTimeout();
},
methods: {
genControlIcons() {
if (this.isVertical) return null;
return VWindow.options.methods.genControlIcons.call(this);
},
genDelimiters() {
return this.$createElement('div', {
staticClass: 'v-carousel__controls',
style: {
left: this.verticalDelimiters === 'left' && this.isVertical ? 0 : 'auto',
right: this.verticalDelimiters === 'right' ? 0 : 'auto'
}
}, [this.genItems()]);
},
genItems() {
const length = this.items.length;
const children = [];
for (let i = 0; i < length; i++) {
const child = this.$createElement(VBtn, {
staticClass: 'v-carousel__controls__item',
attrs: {
'aria-label': this.$vuetify.lang.t('$vuetify.carousel.ariaLabel.delimiter', i + 1, length)
},
props: {
icon: true,
small: true,
value: this.getValue(this.items[i], i)
}
}, [this.$createElement(VIcon, {
props: {
size: 18
}
}, this.delimiterIcon)]);
children.push(child);
}
return this.$createElement(ButtonGroup, {
props: {
value: this.internalValue,
mandatory: this.mandatory
},
on: {
change: val => {
this.internalValue = val;
}
}
}, children);
},
genProgress() {
return this.$createElement(VProgressLinear, {
staticClass: 'v-carousel__progress',
props: {
color: this.progressColor,
value: (this.internalIndex + 1) / this.items.length * 100
}
});
},
restartTimeout() {
this.slideTimeout && clearTimeout(this.slideTimeout);
this.slideTimeout = undefined;
window.requestAnimationFrame(this.startTimeout);
},
startTimeout() {
if (!this.cycle) return;
this.slideTimeout = window.setTimeout(this.next, +this.interval > 0 ? +this.interval : 6000);
}
},
render(h) {
const render = VWindow.options.render.call(this, h);
render.data.style = `height: ${convertToUnit(this.height)};`;
/* istanbul ignore else */
if (!this.hideDelimiters) {
render.children.push(this.genDelimiters());
}
/* istanbul ignore else */
if (this.progress || this.progressColor) {
render.children.push(this.genProgress());
}
return render;
}
});
//# sourceMappingURL=VCarousel.js.map
File diff suppressed because one or more lines are too long
+45
View File
@@ -0,0 +1,45 @@
// Extensions
import VWindowItem from '../VWindow/VWindowItem'; // Components
import { VImg } from '../VImg'; // Utilities
import mixins from '../../util/mixins';
import { getSlot } from '../../util/helpers';
import Routable from '../../mixins/routable'; // Types
const baseMixins = mixins(VWindowItem, Routable);
/* @vue/component */
export default baseMixins.extend({
name: 'v-carousel-item',
inheritAttrs: false,
methods: {
genDefaultSlot() {
return [this.$createElement(VImg, {
staticClass: 'v-carousel__item',
props: { ...this.$attrs,
height: this.windowGroup.internalHeight
},
on: this.$listeners,
scopedSlots: {
placeholder: this.$scopedSlots.placeholder
}
}, getSlot(this))];
},
genWindowItem() {
const {
tag,
data
} = this.generateRouteLink();
data.staticClass = 'v-window-item';
data.directives.push({
name: 'show',
value: this.isActive
});
return this.$createElement(tag, data, this.genDefaultSlot());
}
}
});
//# sourceMappingURL=VCarouselItem.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/components/VCarousel/VCarouselItem.ts"],"names":[],"mappings":"AAAA;AACA,OAAO,WAAP,MAAwB,wBAAxB,C,CAEA;;AACA,SAAS,IAAT,QAAqB,SAArB,C,CAEA;;AACA,OAAO,MAAP,MAAmB,mBAAnB;AACA,SAAS,OAAT,QAAwB,oBAAxB;AACA,OAAO,QAAP,MAAqB,uBAArB,C,CAEA;;AACA,MAAM,UAAU,GAAG,MAAM,CACvB,WADuB,EAEvB,QAFuB,CAAzB;AAKA;;AACA,eAAe,UAAU,CAAC,MAAX,CAAkB;AAC/B,EAAA,IAAI,EAAE,iBADyB;AAG/B,EAAA,YAAY,EAAE,KAHiB;AAK/B,EAAA,OAAO,EAAE;AACP,IAAA,cAAc,GAAA;AACZ,aAAO,CACL,KAAK,cAAL,CAAoB,IAApB,EAA0B;AACxB,QAAA,WAAW,EAAE,kBADW;AAExB,QAAA,KAAK,EAAE,EACL,GAAG,KAAK,MADH;AAEL,UAAA,MAAM,EAAE,KAAK,WAAL,CAAiB;AAFpB,SAFiB;AAMxB,QAAA,EAAE,EAAE,KAAK,UANe;AAOxB,QAAA,WAAW,EAAE;AACX,UAAA,WAAW,EAAE,KAAK,YAAL,CAAkB;AADpB;AAPW,OAA1B,EAUG,OAAO,CAAC,IAAD,CAVV,CADK,CAAP;AAaD,KAfM;;AAgBP,IAAA,aAAa,GAAA;AACX,YAAM;AAAE,QAAA,GAAF;AAAO,QAAA;AAAP,UAAgB,KAAK,iBAAL,EAAtB;AAEA,MAAA,IAAI,CAAC,WAAL,GAAmB,eAAnB;AACA,MAAA,IAAI,CAAC,UAAL,CAAiB,IAAjB,CAAsB;AACpB,QAAA,IAAI,EAAE,MADc;AAEpB,QAAA,KAAK,EAAE,KAAK;AAFQ,OAAtB;AAKA,aAAO,KAAK,cAAL,CAAoB,GAApB,EAAyB,IAAzB,EAA+B,KAAK,cAAL,EAA/B,CAAP;AACD;;AA1BM;AALsB,CAAlB,CAAf","sourcesContent":["// Extensions\nimport VWindowItem from '../VWindow/VWindowItem'\n\n// Components\nimport { VImg } from '../VImg'\n\n// Utilities\nimport mixins from '../../util/mixins'\nimport { getSlot } from '../../util/helpers'\nimport Routable from '../../mixins/routable'\n\n// Types\nconst baseMixins = mixins(\n VWindowItem,\n Routable\n)\n\n/* @vue/component */\nexport default baseMixins.extend({\n name: 'v-carousel-item',\n\n inheritAttrs: false,\n\n methods: {\n genDefaultSlot () {\n return [\n this.$createElement(VImg, {\n staticClass: 'v-carousel__item',\n props: {\n ...this.$attrs,\n height: this.windowGroup.internalHeight,\n },\n on: this.$listeners,\n scopedSlots: {\n placeholder: this.$scopedSlots.placeholder,\n },\n }, getSlot(this)),\n ]\n },\n genWindowItem () {\n const { tag, data } = this.generateRouteLink()\n\n data.staticClass = 'v-window-item'\n data.directives!.push({\n name: 'show',\n value: this.isActive,\n })\n\n return this.$createElement(tag, data, this.genDefaultSlot())\n },\n },\n})\n"],"sourceRoot":"","file":"VCarouselItem.js"}
+10
View File
@@ -0,0 +1,10 @@
import VCarousel from './VCarousel';
import VCarouselItem from './VCarouselItem';
export { VCarousel, VCarouselItem };
export default {
$_vuetify_subcomponents: {
VCarousel,
VCarouselItem
}
};
//# sourceMappingURL=index.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/components/VCarousel/index.ts"],"names":[],"mappings":"AAAA,OAAO,SAAP,MAAsB,aAAtB;AACA,OAAO,aAAP,MAA0B,iBAA1B;AAEA,SAAS,SAAT,EAAoB,aAApB;AAEA,eAAe;AACb,EAAA,uBAAuB,EAAE;AACvB,IAAA,SADuB;AAEvB,IAAA;AAFuB;AADZ,CAAf","sourcesContent":["import VCarousel from './VCarousel'\nimport VCarouselItem from './VCarouselItem'\n\nexport { VCarousel, VCarouselItem }\n\nexport default {\n $_vuetify_subcomponents: {\n VCarousel,\n VCarouselItem,\n },\n}\n"],"sourceRoot":"","file":"index.js"}

Some files were not shown because too many files have changed in this diff Show More