vuetify eingebunden + erster Versuch Combobox
This commit is contained in:
+309
@@ -0,0 +1,309 @@
|
||||
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
|
||||
|
||||
// Components
|
||||
import VTimePickerTitle from './VTimePickerTitle';
|
||||
import VTimePickerClock from './VTimePickerClock';
|
||||
// Mixins
|
||||
import Picker from '../../mixins/picker';
|
||||
// Utils
|
||||
import { createRange } from '../../util/helpers';
|
||||
import pad from '../VDatePicker/util/pad';
|
||||
import mixins from '../../util/mixins';
|
||||
var rangeHours24 = createRange(24);
|
||||
var rangeHours12am = createRange(12);
|
||||
var rangeHours12pm = rangeHours12am.map(function (v) {
|
||||
return v + 12;
|
||||
});
|
||||
var range60 = createRange(60);
|
||||
var selectingTimes = { hour: 1, minute: 2, second: 3 };
|
||||
var selectingNames = { 1: 'hour', 2: 'minute', 3: 'second' };
|
||||
export { selectingTimes };
|
||||
export default mixins(Picker
|
||||
/* @vue/component */
|
||||
).extend({
|
||||
name: 'v-time-picker',
|
||||
props: {
|
||||
allowedHours: Function,
|
||||
allowedMinutes: Function,
|
||||
allowedSeconds: Function,
|
||||
disabled: Boolean,
|
||||
format: {
|
||||
type: String,
|
||||
default: 'ampm',
|
||||
validator: function validator(val) {
|
||||
return ['ampm', '24hr'].includes(val);
|
||||
}
|
||||
},
|
||||
min: String,
|
||||
max: String,
|
||||
readonly: Boolean,
|
||||
scrollable: Boolean,
|
||||
useSeconds: Boolean,
|
||||
value: null
|
||||
},
|
||||
data: function data() {
|
||||
return {
|
||||
inputHour: null,
|
||||
inputMinute: null,
|
||||
inputSecond: null,
|
||||
lazyInputHour: null,
|
||||
lazyInputMinute: null,
|
||||
lazyInputSecond: null,
|
||||
period: 'am',
|
||||
selecting: selectingTimes.hour
|
||||
};
|
||||
},
|
||||
|
||||
computed: {
|
||||
selectingHour: {
|
||||
get: function get() {
|
||||
return this.selecting === selectingTimes.hour;
|
||||
},
|
||||
set: function set(v) {
|
||||
this.selecting = selectingTimes.hour;
|
||||
}
|
||||
},
|
||||
selectingMinute: {
|
||||
get: function get() {
|
||||
return this.selecting === selectingTimes.minute;
|
||||
},
|
||||
set: function set(v) {
|
||||
this.selecting = selectingTimes.minute;
|
||||
}
|
||||
},
|
||||
selectingSecond: {
|
||||
get: function get() {
|
||||
return this.selecting === selectingTimes.second;
|
||||
},
|
||||
set: function set(v) {
|
||||
this.selecting = selectingTimes.second;
|
||||
}
|
||||
},
|
||||
isAllowedHourCb: function isAllowedHourCb() {
|
||||
var _this = this;
|
||||
|
||||
if (!this.min && !this.max) return this.allowedHours;
|
||||
var minHour = this.min ? Number(this.min.split(':')[0]) : 0;
|
||||
var maxHour = this.max ? Number(this.max.split(':')[0]) : 23;
|
||||
return function (val) {
|
||||
return val >= minHour * 1 && val <= maxHour * 1 && (!_this.allowedHours || _this.allowedHours(val));
|
||||
};
|
||||
},
|
||||
isAllowedMinuteCb: function isAllowedMinuteCb() {
|
||||
var _this2 = this;
|
||||
|
||||
var isHourAllowed = !this.allowedHours || this.allowedHours(this.inputHour);
|
||||
if (!this.min && !this.max) {
|
||||
return isHourAllowed ? this.allowedMinutes : function () {
|
||||
return false;
|
||||
};
|
||||
}
|
||||
|
||||
var _ref = this.min ? this.min.split(':').map(Number) : [0, 0],
|
||||
_ref2 = _slicedToArray(_ref, 2),
|
||||
minHour = _ref2[0],
|
||||
minMinute = _ref2[1];
|
||||
|
||||
var _ref3 = this.max ? this.max.split(':').map(Number) : [23, 59],
|
||||
_ref4 = _slicedToArray(_ref3, 2),
|
||||
maxHour = _ref4[0],
|
||||
maxMinute = _ref4[1];
|
||||
|
||||
var minTime = minHour * 60 + minMinute * 1;
|
||||
var maxTime = maxHour * 60 + maxMinute * 1;
|
||||
return function (val) {
|
||||
var time = 60 * _this2.inputHour + val;
|
||||
return time >= minTime && time <= maxTime && isHourAllowed && (!_this2.allowedMinutes || _this2.allowedMinutes(val));
|
||||
};
|
||||
},
|
||||
isAllowedSecondCb: function isAllowedSecondCb() {
|
||||
var _this3 = this;
|
||||
|
||||
var isHourAllowed = !this.allowedHours || this.allowedHours(this.inputHour);
|
||||
var isMinuteAllowed = !this.allowedMinutes || this.allowedMinutes(this.inputMinute);
|
||||
if (!this.min && !this.max) {
|
||||
return isHourAllowed && isMinuteAllowed ? this.allowedSeconds : function () {
|
||||
return false;
|
||||
};
|
||||
}
|
||||
|
||||
var _ref5 = this.min ? this.min.split(':').map(Number) : [0, 0, 0],
|
||||
_ref6 = _slicedToArray(_ref5, 3),
|
||||
minHour = _ref6[0],
|
||||
minMinute = _ref6[1],
|
||||
minSecond = _ref6[2];
|
||||
|
||||
var _ref7 = this.max ? this.max.split(':').map(Number) : [23, 59, 59],
|
||||
_ref8 = _slicedToArray(_ref7, 3),
|
||||
maxHour = _ref8[0],
|
||||
maxMinute = _ref8[1],
|
||||
maxSecond = _ref8[2];
|
||||
|
||||
var minTime = minHour * 3600 + minMinute * 60 + (minSecond || 0) * 1;
|
||||
var maxTime = maxHour * 3600 + maxMinute * 60 + (maxSecond || 0) * 1;
|
||||
return function (val) {
|
||||
var time = 3600 * _this3.inputHour + 60 * _this3.inputMinute + val;
|
||||
return time >= minTime && time <= maxTime && isHourAllowed && isMinuteAllowed && (!_this3.allowedSeconds || _this3.allowedSeconds(val));
|
||||
};
|
||||
},
|
||||
isAmPm: function isAmPm() {
|
||||
return this.format === 'ampm';
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
value: 'setInputData'
|
||||
},
|
||||
mounted: function mounted() {
|
||||
this.setInputData(this.value);
|
||||
},
|
||||
|
||||
methods: {
|
||||
genValue: function genValue() {
|
||||
if (this.inputHour != null && this.inputMinute != null && (!this.useSeconds || this.inputSecond != null)) {
|
||||
return pad(this.inputHour) + ':' + pad(this.inputMinute) + (this.useSeconds ? ':' + pad(this.inputSecond) : '');
|
||||
}
|
||||
return null;
|
||||
},
|
||||
emitValue: function emitValue() {
|
||||
var value = this.genValue();
|
||||
if (value !== null) this.$emit('input', value);
|
||||
},
|
||||
setPeriod: function setPeriod(period) {
|
||||
this.period = period;
|
||||
if (this.inputHour != null) {
|
||||
var newHour = this.inputHour + (period === 'am' ? -12 : 12);
|
||||
this.inputHour = this.firstAllowed('hour', newHour);
|
||||
this.emitValue();
|
||||
}
|
||||
},
|
||||
setInputData: function setInputData(value) {
|
||||
if (value == null || value === '') {
|
||||
this.inputHour = null;
|
||||
this.inputMinute = null;
|
||||
this.inputSecond = null;
|
||||
} else if (value instanceof Date) {
|
||||
this.inputHour = value.getHours();
|
||||
this.inputMinute = value.getMinutes();
|
||||
this.inputSecond = value.getSeconds();
|
||||
} else {
|
||||
var _ref9 = value.trim().toLowerCase().match(/^(\d+):(\d+)(:(\d+))?([ap]m)?$/) || new Array(6),
|
||||
_ref10 = _slicedToArray(_ref9, 6),
|
||||
hour = _ref10[1],
|
||||
minute = _ref10[2],
|
||||
second = _ref10[4],
|
||||
period = _ref10[5];
|
||||
|
||||
this.inputHour = period ? this.convert12to24(parseInt(hour, 10), period) : parseInt(hour, 10);
|
||||
this.inputMinute = parseInt(minute, 10);
|
||||
this.inputSecond = parseInt(second || 0, 10);
|
||||
}
|
||||
this.period = this.inputHour == null || this.inputHour < 12 ? 'am' : 'pm';
|
||||
},
|
||||
convert24to12: function convert24to12(hour) {
|
||||
return hour ? (hour - 1) % 12 + 1 : 12;
|
||||
},
|
||||
convert12to24: function convert12to24(hour, period) {
|
||||
return hour % 12 + (period === 'pm' ? 12 : 0);
|
||||
},
|
||||
onInput: function onInput(value) {
|
||||
if (this.selecting === selectingTimes.hour) {
|
||||
this.inputHour = this.isAmPm ? this.convert12to24(value, this.period) : value;
|
||||
} else if (this.selecting === selectingTimes.minute) {
|
||||
this.inputMinute = value;
|
||||
} else {
|
||||
this.inputSecond = value;
|
||||
}
|
||||
this.emitValue();
|
||||
},
|
||||
onChange: function onChange(value) {
|
||||
this.$emit('click:' + selectingNames[this.selecting], value);
|
||||
var emitChange = this.selecting === (this.useSeconds ? selectingTimes.second : selectingTimes.minute);
|
||||
if (this.selecting === selectingTimes.hour) {
|
||||
this.selecting = selectingTimes.minute;
|
||||
} else if (this.useSeconds && this.selecting === selectingTimes.minute) {
|
||||
this.selecting = selectingTimes.second;
|
||||
}
|
||||
if (this.inputHour === this.lazyInputHour && this.inputMinute === this.lazyInputMinute && (!this.useSeconds || this.inputSecond === this.lazyInputSecond)) return;
|
||||
var time = this.genValue();
|
||||
if (time === null) return;
|
||||
this.lazyInputHour = this.inputHour;
|
||||
this.lazyInputMinute = this.inputMinute;
|
||||
this.useSeconds && (this.lazyInputSecond = this.inputSecond);
|
||||
emitChange && this.$emit('change', time);
|
||||
},
|
||||
firstAllowed: function firstAllowed(type, value) {
|
||||
var allowedFn = type === 'hour' ? this.isAllowedHourCb : type === 'minute' ? this.isAllowedMinuteCb : this.isAllowedSecondCb;
|
||||
if (!allowedFn) return value;
|
||||
// TODO: clean up
|
||||
var range = type === 'minute' ? range60 : type === 'second' ? range60 : this.isAmPm ? value < 12 ? rangeHours12am : rangeHours12pm : rangeHours24;
|
||||
var first = range.find(function (v) {
|
||||
return allowedFn((v + value) % range.length + range[0]);
|
||||
});
|
||||
return ((first || 0) + value) % range.length + range[0];
|
||||
},
|
||||
genClock: function genClock() {
|
||||
return this.$createElement(VTimePickerClock, {
|
||||
props: {
|
||||
allowedValues: this.selecting === selectingTimes.hour ? this.isAllowedHourCb : this.selecting === selectingTimes.minute ? this.isAllowedMinuteCb : this.isAllowedSecondCb,
|
||||
color: this.color,
|
||||
dark: this.dark,
|
||||
disabled: this.disabled,
|
||||
double: this.selecting === selectingTimes.hour && !this.isAmPm,
|
||||
format: this.selecting === selectingTimes.hour ? this.isAmPm ? this.convert24to12 : function (val) {
|
||||
return val;
|
||||
} : function (val) {
|
||||
return pad(val, 2);
|
||||
},
|
||||
light: this.light,
|
||||
max: this.selecting === selectingTimes.hour ? this.isAmPm && this.period === 'am' ? 11 : 23 : 59,
|
||||
min: this.selecting === selectingTimes.hour && this.isAmPm && this.period === 'pm' ? 12 : 0,
|
||||
readonly: this.readonly,
|
||||
scrollable: this.scrollable,
|
||||
size: Number(this.width) - (!this.fullWidth && this.landscape ? 80 : 20),
|
||||
step: this.selecting === selectingTimes.hour ? 1 : 5,
|
||||
value: this.selecting === selectingTimes.hour ? this.inputHour : this.selecting === selectingTimes.minute ? this.inputMinute : this.inputSecond
|
||||
},
|
||||
on: {
|
||||
input: this.onInput,
|
||||
change: this.onChange
|
||||
},
|
||||
ref: 'clock'
|
||||
});
|
||||
},
|
||||
genPickerBody: function genPickerBody() {
|
||||
return this.$createElement('div', {
|
||||
staticClass: 'v-time-picker-clock__container',
|
||||
key: this.selecting
|
||||
}, [this.genClock()]);
|
||||
},
|
||||
genPickerTitle: function genPickerTitle() {
|
||||
var _this4 = this;
|
||||
|
||||
return this.$createElement(VTimePickerTitle, {
|
||||
props: {
|
||||
ampm: this.isAmPm,
|
||||
disabled: this.disabled,
|
||||
hour: this.inputHour,
|
||||
minute: this.inputMinute,
|
||||
second: this.inputSecond,
|
||||
period: this.period,
|
||||
readonly: this.readonly,
|
||||
useSeconds: this.useSeconds,
|
||||
selecting: this.selecting
|
||||
},
|
||||
on: {
|
||||
'update:selecting': function updateSelecting(value) {
|
||||
return _this4.selecting = value;
|
||||
},
|
||||
'update:period': this.setPeriod
|
||||
},
|
||||
ref: 'title',
|
||||
slot: 'title'
|
||||
});
|
||||
}
|
||||
},
|
||||
render: function render() {
|
||||
return this.genPicker('v-picker--time');
|
||||
}
|
||||
});
|
||||
//# sourceMappingURL=VTimePicker.js.map
|
||||
+1
File diff suppressed because one or more lines are too long
+239
@@ -0,0 +1,239 @@
|
||||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
||||
|
||||
import '../../../src/stylus/components/_time-picker-clock.styl';
|
||||
// Mixins
|
||||
import Colorable from '../../mixins/colorable';
|
||||
import Themeable from '../../mixins/themeable';
|
||||
import mixins from '../../util/mixins';
|
||||
export default mixins(Colorable, Themeable
|
||||
/* @vue/component */
|
||||
).extend({
|
||||
name: 'v-time-picker-clock',
|
||||
props: {
|
||||
allowedValues: Function,
|
||||
disabled: Boolean,
|
||||
double: Boolean,
|
||||
format: {
|
||||
type: Function,
|
||||
default: function _default(val) {
|
||||
return val;
|
||||
}
|
||||
},
|
||||
max: {
|
||||
type: Number,
|
||||
required: true
|
||||
},
|
||||
min: {
|
||||
type: Number,
|
||||
required: true
|
||||
},
|
||||
scrollable: Boolean,
|
||||
readonly: Boolean,
|
||||
rotate: {
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
step: {
|
||||
type: Number,
|
||||
default: 1
|
||||
},
|
||||
value: Number
|
||||
},
|
||||
data: function data() {
|
||||
return {
|
||||
inputValue: this.value,
|
||||
isDragging: false,
|
||||
valueOnMouseDown: null,
|
||||
valueOnMouseUp: null
|
||||
};
|
||||
},
|
||||
|
||||
computed: {
|
||||
count: function count() {
|
||||
return this.max - this.min + 1;
|
||||
},
|
||||
degreesPerUnit: function degreesPerUnit() {
|
||||
return 360 / this.roundCount;
|
||||
},
|
||||
degrees: function degrees() {
|
||||
return this.degreesPerUnit * Math.PI / 180;
|
||||
},
|
||||
displayedValue: function displayedValue() {
|
||||
return this.value == null ? this.min : this.value;
|
||||
},
|
||||
innerRadiusScale: function innerRadiusScale() {
|
||||
return 0.62;
|
||||
},
|
||||
roundCount: function roundCount() {
|
||||
return this.double ? this.count / 2 : this.count;
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
value: function value(_value) {
|
||||
this.inputValue = _value;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
wheel: function wheel(e) {
|
||||
e.preventDefault();
|
||||
var delta = Math.sign(-e.deltaY || 1);
|
||||
var value = this.displayedValue;
|
||||
do {
|
||||
value = value + delta;
|
||||
value = (value - this.min + this.count) % this.count + this.min;
|
||||
} while (!this.isAllowed(value) && value !== this.displayedValue);
|
||||
if (value !== this.displayedValue) {
|
||||
this.update(value);
|
||||
}
|
||||
},
|
||||
isInner: function isInner(value) {
|
||||
return this.double && value - this.min >= this.roundCount;
|
||||
},
|
||||
handScale: function handScale(value) {
|
||||
return this.isInner(value) ? this.innerRadiusScale : 1;
|
||||
},
|
||||
isAllowed: function isAllowed(value) {
|
||||
return !this.allowedValues || this.allowedValues(value);
|
||||
},
|
||||
genValues: function genValues() {
|
||||
var children = [];
|
||||
for (var value = this.min; value <= this.max; value = value + this.step) {
|
||||
var color = value === this.value && (this.color || 'accent');
|
||||
children.push(this.$createElement('span', this.setBackgroundColor(color, {
|
||||
staticClass: 'v-time-picker-clock__item',
|
||||
'class': {
|
||||
'v-time-picker-clock__item--active': value === this.displayedValue,
|
||||
'v-time-picker-clock__item--disabled': this.disabled || !this.isAllowed(value)
|
||||
},
|
||||
style: this.getTransform(value),
|
||||
domProps: { innerHTML: '<span>' + this.format(value) + '</span>' }
|
||||
})));
|
||||
}
|
||||
return children;
|
||||
},
|
||||
genHand: function genHand() {
|
||||
var scale = 'scaleY(' + this.handScale(this.displayedValue) + ')';
|
||||
var angle = this.rotate + this.degreesPerUnit * (this.displayedValue - this.min);
|
||||
var color = this.value != null && (this.color || 'accent');
|
||||
return this.$createElement('div', this.setBackgroundColor(color, {
|
||||
staticClass: 'v-time-picker-clock__hand',
|
||||
'class': {
|
||||
'v-time-picker-clock__hand--inner': this.isInner(this.value)
|
||||
},
|
||||
style: {
|
||||
transform: 'rotate(' + angle + 'deg) ' + scale
|
||||
}
|
||||
}));
|
||||
},
|
||||
getTransform: function getTransform(i) {
|
||||
var _getPosition = this.getPosition(i),
|
||||
x = _getPosition.x,
|
||||
y = _getPosition.y;
|
||||
|
||||
return {
|
||||
left: 50 + x * 50 + '%',
|
||||
top: 50 + y * 50 + '%'
|
||||
};
|
||||
},
|
||||
getPosition: function getPosition(value) {
|
||||
var rotateRadians = this.rotate * Math.PI / 180;
|
||||
return {
|
||||
x: Math.sin((value - this.min) * this.degrees + rotateRadians) * this.handScale(value),
|
||||
y: -Math.cos((value - this.min) * this.degrees + rotateRadians) * this.handScale(value)
|
||||
};
|
||||
},
|
||||
onMouseDown: function onMouseDown(e) {
|
||||
e.preventDefault();
|
||||
this.valueOnMouseDown = null;
|
||||
this.valueOnMouseUp = null;
|
||||
this.isDragging = true;
|
||||
this.onDragMove(e);
|
||||
},
|
||||
onMouseUp: function onMouseUp() {
|
||||
this.isDragging = false;
|
||||
if (this.valueOnMouseUp !== null && this.isAllowed(this.valueOnMouseUp)) {
|
||||
this.$emit('change', this.valueOnMouseUp);
|
||||
}
|
||||
},
|
||||
onDragMove: function onDragMove(e) {
|
||||
e.preventDefault();
|
||||
if (!this.isDragging && e.type !== 'click') return;
|
||||
|
||||
var _$refs$clock$getBound = this.$refs.clock.getBoundingClientRect(),
|
||||
width = _$refs$clock$getBound.width,
|
||||
top = _$refs$clock$getBound.top,
|
||||
left = _$refs$clock$getBound.left;
|
||||
|
||||
var _$refs$innerClock$get = this.$refs.innerClock.getBoundingClientRect(),
|
||||
innerWidth = _$refs$innerClock$get.width;
|
||||
|
||||
var _ref = 'touches' in e ? e.touches[0] : e,
|
||||
clientX = _ref.clientX,
|
||||
clientY = _ref.clientY;
|
||||
|
||||
var center = { x: width / 2, y: -width / 2 };
|
||||
var coords = { x: clientX - left, y: top - clientY };
|
||||
var handAngle = Math.round(this.angle(center, coords) - this.rotate + 360) % 360;
|
||||
var insideClick = this.double && this.euclidean(center, coords) < (innerWidth + innerWidth * this.innerRadiusScale) / 4;
|
||||
var value = (Math.round(handAngle / this.degreesPerUnit) + (insideClick ? this.roundCount : 0)) % this.count + this.min;
|
||||
// Necessary to fix edge case when selecting left part of the value(s) at 12 o'clock
|
||||
var newValue = void 0;
|
||||
if (handAngle >= 360 - this.degreesPerUnit / 2) {
|
||||
newValue = insideClick ? this.max - this.roundCount + 1 : this.min;
|
||||
} else {
|
||||
newValue = value;
|
||||
}
|
||||
if (this.isAllowed(value)) {
|
||||
if (this.valueOnMouseDown === null) {
|
||||
this.valueOnMouseDown = newValue;
|
||||
}
|
||||
this.valueOnMouseUp = newValue;
|
||||
this.update(newValue);
|
||||
}
|
||||
},
|
||||
update: function update(value) {
|
||||
if (this.inputValue !== value) {
|
||||
this.inputValue = value;
|
||||
this.$emit('input', value);
|
||||
}
|
||||
},
|
||||
euclidean: function euclidean(p0, p1) {
|
||||
var dx = p1.x - p0.x;
|
||||
var dy = p1.y - p0.y;
|
||||
return Math.sqrt(dx * dx + dy * dy);
|
||||
},
|
||||
angle: function angle(center, p1) {
|
||||
var value = 2 * Math.atan2(p1.y - center.y - this.euclidean(center, p1), p1.x - center.x);
|
||||
return Math.abs(value * 180 / Math.PI);
|
||||
}
|
||||
},
|
||||
render: function render(h) {
|
||||
var _this = this;
|
||||
|
||||
var data = {
|
||||
staticClass: 'v-time-picker-clock',
|
||||
class: _extends({
|
||||
'v-time-picker-clock--indeterminate': this.value == null
|
||||
}, this.themeClasses),
|
||||
on: this.readonly || this.disabled ? undefined : Object.assign({
|
||||
mousedown: this.onMouseDown,
|
||||
mouseup: this.onMouseUp,
|
||||
mouseleave: function mouseleave() {
|
||||
return _this.isDragging && _this.onMouseUp();
|
||||
},
|
||||
touchstart: this.onMouseDown,
|
||||
touchend: this.onMouseUp,
|
||||
mousemove: this.onDragMove,
|
||||
touchmove: this.onDragMove
|
||||
}, this.scrollable ? {
|
||||
wheel: this.wheel
|
||||
} : {}),
|
||||
ref: 'clock'
|
||||
};
|
||||
return h('div', data, [h('div', {
|
||||
staticClass: 'v-time-picker-clock__inner',
|
||||
ref: 'innerClock'
|
||||
}, [this.genHand(), this.genValues()])]);
|
||||
}
|
||||
});
|
||||
//# sourceMappingURL=VTimePickerClock.js.map
|
||||
+1
File diff suppressed because one or more lines are too long
+60
@@ -0,0 +1,60 @@
|
||||
import '../../../src/stylus/components/_time-picker-title.styl';
|
||||
// Mixins
|
||||
import PickerButton from '../../mixins/picker-button';
|
||||
// Utils
|
||||
import { pad } from '../VDatePicker/util';
|
||||
import mixins from '../../util/mixins';
|
||||
import { selectingTimes } from './VTimePicker';
|
||||
export default mixins(PickerButton
|
||||
/* @vue/component */
|
||||
).extend({
|
||||
name: 'v-time-picker-title',
|
||||
props: {
|
||||
ampm: Boolean,
|
||||
disabled: Boolean,
|
||||
hour: Number,
|
||||
minute: Number,
|
||||
second: Number,
|
||||
period: {
|
||||
type: String,
|
||||
validator: function validator(period) {
|
||||
return period === 'am' || period === 'pm';
|
||||
}
|
||||
},
|
||||
readonly: Boolean,
|
||||
useSeconds: Boolean,
|
||||
selecting: Number
|
||||
},
|
||||
methods: {
|
||||
genTime: function genTime() {
|
||||
var hour = this.hour;
|
||||
if (this.ampm) {
|
||||
hour = hour ? (hour - 1) % 12 + 1 : 12;
|
||||
}
|
||||
var displayedHour = this.hour == null ? '--' : this.ampm ? String(hour) : pad(hour);
|
||||
var displayedMinute = this.minute == null ? '--' : pad(this.minute);
|
||||
var titleContent = [this.genPickerButton('selecting', selectingTimes.hour, displayedHour, this.disabled), this.$createElement('span', ':'), this.genPickerButton('selecting', selectingTimes.minute, displayedMinute, this.disabled)];
|
||||
if (this.useSeconds) {
|
||||
var displayedSecond = this.second == null ? '--' : pad(this.second);
|
||||
titleContent.push(this.$createElement('span', ':'));
|
||||
titleContent.push(this.genPickerButton('selecting', selectingTimes.second, displayedSecond, this.disabled));
|
||||
}
|
||||
return this.$createElement('div', {
|
||||
'class': 'v-time-picker-title__time'
|
||||
}, titleContent);
|
||||
},
|
||||
genAmPm: function genAmPm() {
|
||||
return this.$createElement('div', {
|
||||
staticClass: 'v-time-picker-title__ampm'
|
||||
}, [this.genPickerButton('period', 'am', 'am', this.disabled || this.readonly), this.genPickerButton('period', 'pm', 'pm', this.disabled || this.readonly)]);
|
||||
}
|
||||
},
|
||||
render: function render(h) {
|
||||
var children = [this.genTime()];
|
||||
this.ampm && children.push(this.genAmPm());
|
||||
return h('div', {
|
||||
staticClass: 'v-time-picker-title'
|
||||
}, children);
|
||||
}
|
||||
});
|
||||
//# sourceMappingURL=VTimePickerTitle.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../src/components/VTimePicker/VTimePickerTitle.ts"],"names":[],"mappings":"AAAA,OAAO,wDAAP;AAEA;AACA,OAAO,YAAP,MAAyB,4BAAzB;AAEA;AACA,SAAS,GAAT,QAAoB,qBAApB;AACA,OAAO,MAAP,MAAmB,mBAAnB;AAEA,SAAS,cAAT,QAA+B,eAA/B;AAIA,eAAe,OACb;AACF;AAFe,EAGb,MAHa,CAGN;AACP,UAAM,qBADC;AAGP,WAAO;AACL,cAAM,OADD;AAEL,kBAAU,OAFL;AAGL,cAAM,MAHD;AAIL,gBAAQ,MAJH;AAKL,gBAAQ,MALH;AAML,gBAAQ;AACN,kBAAM,MADA;AAEN,uBAAW;AAAA,uBAAU,WAAW,IAAX,IAAmB,WAAW,IAAxC;AAAA;AAFL,SANH;AAUL,kBAAU,OAVL;AAWL,oBAAY,OAXP;AAYL,mBAAW;AAZN,KAHA;AAkBP,aAAS;AACP,eADO,qBACA;AACL,gBAAI,OAAO,KAAK,IAAhB;AACA,gBAAI,KAAK,IAAT,EAAe;AACb,uBAAO,OAAQ,CAAC,OAAO,CAAR,IAAa,EAAb,GAAkB,CAA1B,GAA+B,EAAtC;AACD;AAED,gBAAM,gBAAgB,KAAK,IAAL,IAAa,IAAb,GAAoB,IAApB,GAA2B,KAAK,IAAL,GAAY,OAAO,IAAP,CAAZ,GAA2B,IAAI,IAAJ,CAA5E;AACA,gBAAM,kBAAkB,KAAK,MAAL,IAAe,IAAf,GAAsB,IAAtB,GAA6B,IAAI,KAAK,MAAT,CAArD;AACA,gBAAM,eAAe,CACnB,KAAK,eAAL,CAAqB,WAArB,EAAkC,eAAe,IAAjD,EAAuD,aAAvD,EAAsE,KAAK,QAA3E,CADmB,EAEnB,KAAK,cAAL,CAAoB,MAApB,EAA4B,GAA5B,CAFmB,EAGnB,KAAK,eAAL,CAAqB,WAArB,EAAkC,eAAe,MAAjD,EAAyD,eAAzD,EAA0E,KAAK,QAA/E,CAHmB,CAArB;AAMA,gBAAI,KAAK,UAAT,EAAqB;AACnB,oBAAM,kBAAkB,KAAK,MAAL,IAAe,IAAf,GAAsB,IAAtB,GAA6B,IAAI,KAAK,MAAT,CAArD;AACA,6BAAa,IAAb,CAAkB,KAAK,cAAL,CAAoB,MAApB,EAA4B,GAA5B,CAAlB;AACA,6BAAa,IAAb,CAAkB,KAAK,eAAL,CAAqB,WAArB,EAAkC,eAAe,MAAjD,EAAyD,eAAzD,EAA0E,KAAK,QAA/E,CAAlB;AACD;AACD,mBAAO,KAAK,cAAL,CAAoB,KAApB,EAA2B;AAChC,yBAAS;AADuB,aAA3B,EAEJ,YAFI,CAAP;AAGD,SAvBM;AAwBP,eAxBO,qBAwBA;AACL,mBAAO,KAAK,cAAL,CAAoB,KAApB,EAA2B;AAChC,6BAAa;AADmB,aAA3B,EAEJ,CACD,KAAK,eAAL,CAAqB,QAArB,EAA+B,IAA/B,EAAqC,IAArC,EAA2C,KAAK,QAAL,IAAiB,KAAK,QAAjE,CADC,EAED,KAAK,eAAL,CAAqB,QAArB,EAA+B,IAA/B,EAAqC,IAArC,EAA2C,KAAK,QAAL,IAAiB,KAAK,QAAjE,CAFC,CAFI,CAAP;AAMD;AA/BM,KAlBF;AAoDP,UApDO,kBAoDC,CApDD,EAoDE;AACP,YAAM,WAAW,CAAC,KAAK,OAAL,EAAD,CAAjB;AAEA,aAAK,IAAL,IAAa,SAAS,IAAT,CAAc,KAAK,OAAL,EAAd,CAAb;AAEA,eAAO,EAAE,KAAF,EAAS;AACd,yBAAa;AADC,SAAT,EAEJ,QAFI,CAAP;AAGD;AA5DM,CAHM,CAAf","sourcesContent":["import '../../stylus/components/_time-picker-title.styl'\n\n// Mixins\nimport PickerButton from '../../mixins/picker-button'\n\n// Utils\nimport { pad } from '../VDatePicker/util'\nimport mixins from '../../util/mixins'\n\nimport { selectingTimes } from './VTimePicker'\nimport { PropValidator } from 'vue/types/options'\nimport { VNode } from 'vue'\n\nexport default mixins(\n PickerButton\n/* @vue/component */\n).extend({\n name: 'v-time-picker-title',\n\n props: {\n ampm: Boolean,\n disabled: Boolean,\n hour: Number,\n minute: Number,\n second: Number,\n period: {\n type: String,\n validator: period => period === 'am' || period === 'pm'\n } as PropValidator<'am' | 'pm'>,\n readonly: Boolean,\n useSeconds: Boolean,\n selecting: Number\n },\n\n methods: {\n genTime () {\n let hour = this.hour\n if (this.ampm) {\n hour = hour ? ((hour - 1) % 12 + 1) : 12\n }\n\n const displayedHour = this.hour == null ? '--' : this.ampm ? String(hour) : pad(hour)\n const displayedMinute = this.minute == null ? '--' : pad(this.minute)\n const titleContent = [\n this.genPickerButton('selecting', selectingTimes.hour, displayedHour, this.disabled),\n this.$createElement('span', ':'),\n this.genPickerButton('selecting', selectingTimes.minute, displayedMinute, this.disabled)\n ]\n\n if (this.useSeconds) {\n const displayedSecond = this.second == null ? '--' : pad(this.second)\n titleContent.push(this.$createElement('span', ':'))\n titleContent.push(this.genPickerButton('selecting', selectingTimes.second, displayedSecond, this.disabled))\n }\n return this.$createElement('div', {\n 'class': 'v-time-picker-title__time'\n }, titleContent)\n },\n genAmPm () {\n return this.$createElement('div', {\n staticClass: 'v-time-picker-title__ampm'\n }, [\n this.genPickerButton('period', 'am', 'am', this.disabled || this.readonly),\n this.genPickerButton('period', 'pm', 'pm', this.disabled || this.readonly)\n ])\n }\n },\n\n render (h): VNode {\n const children = [this.genTime()]\n\n this.ampm && children.push(this.genAmPm())\n\n return h('div', {\n staticClass: 'v-time-picker-title'\n }, children)\n }\n})\n"],"sourceRoot":""}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
import VTimePicker from './VTimePicker';
|
||||
import VTimePickerClock from './VTimePickerClock';
|
||||
import VTimePickerTitle from './VTimePickerTitle';
|
||||
export { VTimePicker, VTimePickerClock, VTimePickerTitle };
|
||||
export default {
|
||||
$_vuetify_subcomponents: {
|
||||
VTimePicker: VTimePicker,
|
||||
VTimePickerClock: VTimePickerClock,
|
||||
VTimePickerTitle: VTimePickerTitle
|
||||
}
|
||||
};
|
||||
//# sourceMappingURL=index.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../src/components/VTimePicker/index.ts"],"names":[],"mappings":"AAAA,OAAO,WAAP,MAAwB,eAAxB;AACA,OAAO,gBAAP,MAA6B,oBAA7B;AACA,OAAO,gBAAP,MAA6B,oBAA7B;AAEA,SAAS,WAAT,EAAsB,gBAAtB,EAAwC,gBAAxC;AAEA,eAAe;AACb,6BAAyB;AACvB,gCADuB;AAEvB,0CAFuB;AAGvB;AAHuB;AADZ,CAAf","sourcesContent":["import VTimePicker from './VTimePicker'\nimport VTimePickerClock from './VTimePickerClock'\nimport VTimePickerTitle from './VTimePickerTitle'\n\nexport { VTimePicker, VTimePickerClock, VTimePickerTitle }\n\nexport default {\n $_vuetify_subcomponents: {\n VTimePicker,\n VTimePickerClock,\n VTimePickerTitle\n }\n}\n"],"sourceRoot":""}
|
||||
Reference in New Issue
Block a user