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
+15
View File
@@ -0,0 +1,15 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.SelectingTimes = void 0;
var SelectingTimes;
exports.SelectingTimes = SelectingTimes;
(function (SelectingTimes) {
SelectingTimes[SelectingTimes["Hour"] = 1] = "Hour";
SelectingTimes[SelectingTimes["Minute"] = 2] = "Minute";
SelectingTimes[SelectingTimes["Second"] = 3] = "Second";
})(SelectingTimes || (exports.SelectingTimes = SelectingTimes = {}));
//# sourceMappingURL=SelectingTimes.js.map
@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/components/VTimePicker/SelectingTimes.ts"],"names":[],"mappings":";;;;;;AAAA,IAAK,cAAL;;;AAAA,CAAA,UAAK,cAAL,EAAmB;AACjB,EAAA,cAAA,CAAA,cAAA,CAAA,MAAA,CAAA,GAAA,CAAA,CAAA,GAAA,MAAA;AACA,EAAA,cAAA,CAAA,cAAA,CAAA,QAAA,CAAA,GAAA,CAAA,CAAA,GAAA,QAAA;AACA,EAAA,cAAA,CAAA,cAAA,CAAA,QAAA,CAAA,GAAA,CAAA,CAAA,GAAA,QAAA;AACD,CAJD,EAAK,cAAc,8BAAd,cAAc,GAAA,EAAA,CAAnB","sourcesContent":["enum SelectingTimes {\n Hour = 1,\n Minute = 2,\n Second = 3\n}\n\nexport { SelectingTimes }\n"],"sourceRoot":"","file":"SelectingTimes.js"}
+386
View File
@@ -0,0 +1,386 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "SelectingTimes", {
enumerable: true,
get: function get() {
return _SelectingTimes.SelectingTimes;
}
});
exports.default = void 0;
var _VTimePickerTitle = _interopRequireDefault(require("./VTimePickerTitle"));
var _VTimePickerClock = _interopRequireDefault(require("./VTimePickerClock"));
var _picker = _interopRequireDefault(require("../../mixins/picker"));
var _pickerButton = _interopRequireDefault(require("../../mixins/picker-button"));
var _helpers = require("../../util/helpers");
var _pad = _interopRequireDefault(require("../VDatePicker/util/pad"));
var _mixins = _interopRequireDefault(require("../../util/mixins"));
var _SelectingTimes = require("./SelectingTimes");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
function _iterableToArrayLimit(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"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
var rangeHours24 = (0, _helpers.createRange)(24);
var rangeHours12am = (0, _helpers.createRange)(12);
var rangeHours12pm = rangeHours12am.map(function (v) {
return v + 12;
});
var range60 = (0, _helpers.createRange)(60);
var selectingNames = {
1: 'hour',
2: 'minute',
3: 'second'
};
var _default = (0, _mixins.default)(_picker.default, _pickerButton.default
/* @vue/component */
).extend({
name: 'v-time-picker',
props: {
allowedHours: [Function, Array],
allowedMinutes: [Function, Array],
allowedSeconds: [Function, Array],
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,
ampmInTitle: Boolean
},
data: function data() {
return {
inputHour: null,
inputMinute: null,
inputSecond: null,
lazyInputHour: null,
lazyInputMinute: null,
lazyInputSecond: null,
period: 'am',
selecting: _SelectingTimes.SelectingTimes.Hour
};
},
computed: {
selectingHour: {
get: function get() {
return this.selecting === _SelectingTimes.SelectingTimes.Hour;
},
set: function set(v) {
this.selecting = _SelectingTimes.SelectingTimes.Hour;
}
},
selectingMinute: {
get: function get() {
return this.selecting === _SelectingTimes.SelectingTimes.Minute;
},
set: function set(v) {
this.selecting = _SelectingTimes.SelectingTimes.Minute;
}
},
selectingSecond: {
get: function get() {
return this.selecting === _SelectingTimes.SelectingTimes.Second;
},
set: function set(v) {
this.selecting = _SelectingTimes.SelectingTimes.Second;
}
},
isAllowedHourCb: function isAllowedHourCb() {
var _this = this;
var cb;
if (this.allowedHours instanceof Array) {
cb = function cb(val) {
return _this.allowedHours.includes(val);
};
} else {
cb = this.allowedHours;
}
if (!this.min && !this.max) return cb;
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 && (!cb || cb(val));
};
},
isAllowedMinuteCb: function isAllowedMinuteCb() {
var _this2 = this;
var cb;
var isHourAllowed = !this.isAllowedHourCb || this.inputHour === null || this.isAllowedHourCb(this.inputHour);
if (this.allowedMinutes instanceof Array) {
cb = function cb(val) {
return _this2.allowedMinutes.includes(val);
};
} else {
cb = this.allowedMinutes;
}
if (!this.min && !this.max) {
return isHourAllowed ? cb : 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 && (!cb || cb(val));
};
},
isAllowedSecondCb: function isAllowedSecondCb() {
var _this3 = this;
var cb;
var isHourAllowed = !this.isAllowedHourCb || this.inputHour === null || this.isAllowedHourCb(this.inputHour);
var isMinuteAllowed = isHourAllowed && (!this.isAllowedMinuteCb || this.inputMinute === null || this.isAllowedMinuteCb(this.inputMinute));
if (this.allowedSeconds instanceof Array) {
cb = function cb(val) {
return _this3.allowedSeconds.includes(val);
};
} else {
cb = this.allowedSeconds;
}
if (!this.min && !this.max) {
return isMinuteAllowed ? cb : 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 && isMinuteAllowed && (!cb || cb(val));
};
},
isAmPm: function isAmPm() {
return this.format === 'ampm';
}
},
watch: {
value: 'setInputData'
},
mounted: function mounted() {
this.setInputData(this.value);
this.$on('update:period', this.setPeriod);
},
methods: {
genValue: function genValue() {
if (this.inputHour != null && this.inputMinute != null && (!this.useSeconds || this.inputSecond != null)) {
return "".concat((0, _pad.default)(this.inputHour), ":").concat((0, _pad.default)(this.inputMinute)) + (this.useSeconds ? ":".concat((0, _pad.default)(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.SelectingTimes.Hour) {
this.inputHour = this.isAmPm ? this.convert12to24(value, this.period) : value;
} else if (this.selecting === _SelectingTimes.SelectingTimes.Minute) {
this.inputMinute = value;
} else {
this.inputSecond = value;
}
this.emitValue();
},
onChange: function onChange(value) {
this.$emit("click:".concat(selectingNames[this.selecting]), value);
var emitChange = this.selecting === (this.useSeconds ? _SelectingTimes.SelectingTimes.Second : _SelectingTimes.SelectingTimes.Minute);
if (this.selecting === _SelectingTimes.SelectingTimes.Hour) {
this.selecting = _SelectingTimes.SelectingTimes.Minute;
} else if (this.useSeconds && this.selecting === _SelectingTimes.SelectingTimes.Minute) {
this.selecting = _SelectingTimes.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.default, {
props: {
allowedValues: this.selecting === _SelectingTimes.SelectingTimes.Hour ? this.isAllowedHourCb : this.selecting === _SelectingTimes.SelectingTimes.Minute ? this.isAllowedMinuteCb : this.isAllowedSecondCb,
color: this.color,
dark: this.dark,
disabled: this.disabled,
double: this.selecting === _SelectingTimes.SelectingTimes.Hour && !this.isAmPm,
format: this.selecting === _SelectingTimes.SelectingTimes.Hour ? this.isAmPm ? this.convert24to12 : function (val) {
return val;
} : function (val) {
return (0, _pad.default)(val, 2);
},
light: this.light,
max: this.selecting === _SelectingTimes.SelectingTimes.Hour ? this.isAmPm && this.period === 'am' ? 11 : 23 : 59,
min: this.selecting === _SelectingTimes.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.SelectingTimes.Hour ? 1 : 5,
value: this.selecting === _SelectingTimes.SelectingTimes.Hour ? this.inputHour : this.selecting === _SelectingTimes.SelectingTimes.Minute ? this.inputMinute : this.inputSecond
},
on: {
input: this.onInput,
change: this.onChange
},
ref: 'clock'
});
},
genClockAmPm: function genClockAmPm() {
return this.$createElement('div', this.setTextColor(this.color || 'primary', {
staticClass: 'v-time-picker-clock__ampm'
}), [this.genPickerButton('period', 'am', this.$vuetify.lang.t('$vuetify.timePicker.am'), this.disabled || this.readonly), this.genPickerButton('period', 'pm', this.$vuetify.lang.t('$vuetify.timePicker.pm'), this.disabled || this.readonly)]);
},
genPickerBody: function genPickerBody() {
return this.$createElement('div', {
staticClass: 'v-time-picker-clock__container',
key: this.selecting
}, [!this.ampmInTitle && this.isAmPm && this.genClockAmPm(), this.genClock()]);
},
genPickerTitle: function genPickerTitle() {
var _this4 = this;
return this.$createElement(_VTimePickerTitle.default, {
props: {
ampm: this.isAmPm,
ampmReadonly: this.isAmPm && !this.ampmInTitle,
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': function updatePeriod(period) {
return _this4.$emit('update:period', period);
}
},
ref: 'title',
slot: 'title'
});
}
},
render: function render() {
return this.genPicker('v-picker--time');
}
});
exports.default = _default;
//# sourceMappingURL=VTimePicker.js.map
File diff suppressed because one or more lines are too long
+279
View File
@@ -0,0 +1,279 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
require("../../../src/components/VTimePicker/VTimePickerClock.sass");
var _colorable = _interopRequireDefault(require("../../mixins/colorable"));
var _themeable = _interopRequireDefault(require("../../mixins/themeable"));
var _mixins = _interopRequireDefault(require("../../util/mixins"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var _default2 = (0, _mixins.default)(_colorable.default, _themeable.default
/* @vue/component */
).extend({
name: 'v-time-picker-clock',
props: {
allowedValues: Function,
ampm: Boolean,
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>".concat(this.format(value), "</span>")
}
})));
}
return children;
},
genHand: function genHand() {
var scale = "scaleY(".concat(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(".concat(angle, "deg) ").concat(scale)
}
}));
},
getTransform: function getTransform(i) {
var _this$getPosition = this.getPosition(i),
x = _this$getPosition.x,
y = _this$getPosition.y;
return {
left: "".concat(50 + x * 50, "%"),
top: "".concat(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(e) {
e.stopPropagation();
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 _this$$refs$clock$get = this.$refs.clock.getBoundingClientRect(),
width = _this$$refs$clock$get.width,
top = _this$$refs$clock$get.top,
left = _this$$refs$clock$get.left;
var _this$$refs$innerCloc = this.$refs.innerClock.getBoundingClientRect(),
innerWidth = _this$$refs$innerCloc.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 checksCount = Math.ceil(15 / this.degreesPerUnit);
var value;
for (var i = 0; i < checksCount; i++) {
value = this.angleToValue(handAngle + i * this.degreesPerUnit, insideClick);
if (this.isAllowed(value)) return this.setMouseDownValue(value);
value = this.angleToValue(handAngle - i * this.degreesPerUnit, insideClick);
if (this.isAllowed(value)) return this.setMouseDownValue(value);
}
},
angleToValue: function angleToValue(angle, insideClick) {
var value = (Math.round(angle / 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
if (angle < 360 - this.degreesPerUnit / 2) return value;
return insideClick ? this.max - this.roundCount + 1 : this.min;
},
setMouseDownValue: function setMouseDownValue(value) {
if (this.valueOnMouseDown === null) {
this.valueOnMouseDown = value;
}
this.valueOnMouseUp = value;
this.update(value);
},
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: _objectSpread({
'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(e) {
return _this.isDragging && _this.onMouseUp(e);
},
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()])]);
}
});
exports.default = _default2;
//# sourceMappingURL=VTimePickerClock.js.map
File diff suppressed because one or more lines are too long
+84
View File
@@ -0,0 +1,84 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
require("../../../src/components/VTimePicker/VTimePickerTitle.sass");
var _pickerButton = _interopRequireDefault(require("../../mixins/picker-button"));
var _util = require("../VDatePicker/util");
var _mixins = _interopRequireDefault(require("../../util/mixins"));
var _SelectingTimes = require("./SelectingTimes");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
// Mixins
// Utils
var _default = (0, _mixins.default)(_pickerButton.default
/* @vue/component */
).extend({
name: 'v-time-picker-title',
props: {
ampm: Boolean,
ampmReadonly: 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) : (0, _util.pad)(hour);
var displayedMinute = this.minute == null ? '--' : (0, _util.pad)(this.minute);
var titleContent = [this.genPickerButton('selecting', _SelectingTimes.SelectingTimes.Hour, displayedHour, this.disabled), this.$createElement('span', ':'), this.genPickerButton('selecting', _SelectingTimes.SelectingTimes.Minute, displayedMinute, this.disabled)];
if (this.useSeconds) {
var displayedSecond = this.second == null ? '--' : (0, _util.pad)(this.second);
titleContent.push(this.$createElement('span', ':'));
titleContent.push(this.genPickerButton('selecting', _SelectingTimes.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',
class: {
'v-time-picker-title__ampm--readonly': this.ampmReadonly
}
}, [!this.ampmReadonly || this.period === 'am' ? this.genPickerButton('period', 'am', this.$vuetify.lang.t('$vuetify.timePicker.am'), this.disabled || this.readonly) : null, !this.ampmReadonly || this.period === 'pm' ? this.genPickerButton('period', 'pm', this.$vuetify.lang.t('$vuetify.timePicker.pm'), this.disabled || this.readonly) : null]);
}
},
render: function render(h) {
var children = [this.genTime()];
this.ampm && children.push(this.genAmPm());
return h('div', {
staticClass: 'v-time-picker-title'
}, children);
}
});
exports.default = _default;
//# sourceMappingURL=VTimePickerTitle.js.map
File diff suppressed because one or more lines are too long
+42
View File
@@ -0,0 +1,42 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "VTimePicker", {
enumerable: true,
get: function get() {
return _VTimePicker.default;
}
});
Object.defineProperty(exports, "VTimePickerClock", {
enumerable: true,
get: function get() {
return _VTimePickerClock.default;
}
});
Object.defineProperty(exports, "VTimePickerTitle", {
enumerable: true,
get: function get() {
return _VTimePickerTitle.default;
}
});
exports.default = void 0;
var _VTimePicker = _interopRequireDefault(require("./VTimePicker"));
var _VTimePickerClock = _interopRequireDefault(require("./VTimePickerClock"));
var _VTimePickerTitle = _interopRequireDefault(require("./VTimePickerTitle"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _default = {
$_vuetify_subcomponents: {
VTimePicker: _VTimePicker.default,
VTimePickerClock: _VTimePickerClock.default,
VTimePickerTitle: _VTimePickerTitle.default
}
};
exports.default = _default;
//# sourceMappingURL=index.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/components/VTimePicker/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;;;eAIe;AACb,EAAA,uBAAuB,EAAE;AACvB,IAAA,WAAW,EAAX,oBADuB;AAEvB,IAAA,gBAAgB,EAAhB,yBAFuB;AAGvB,IAAA,gBAAgB,EAAhB;AAHuB;AADZ,C","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":"","file":"index.js"}