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

VTimePickerTitle.js 2.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. import '../../../src/stylus/components/_time-picker-title.styl';
  2. // Mixins
  3. import PickerButton from '../../mixins/picker-button';
  4. // Utils
  5. import { pad } from '../VDatePicker/util';
  6. import mixins from '../../util/mixins';
  7. import { selectingTimes } from './VTimePicker';
  8. export default mixins(PickerButton
  9. /* @vue/component */
  10. ).extend({
  11. name: 'v-time-picker-title',
  12. props: {
  13. ampm: Boolean,
  14. disabled: Boolean,
  15. hour: Number,
  16. minute: Number,
  17. second: Number,
  18. period: {
  19. type: String,
  20. validator: function validator(period) {
  21. return period === 'am' || period === 'pm';
  22. }
  23. },
  24. readonly: Boolean,
  25. useSeconds: Boolean,
  26. selecting: Number
  27. },
  28. methods: {
  29. genTime: function genTime() {
  30. var hour = this.hour;
  31. if (this.ampm) {
  32. hour = hour ? (hour - 1) % 12 + 1 : 12;
  33. }
  34. var displayedHour = this.hour == null ? '--' : this.ampm ? String(hour) : pad(hour);
  35. var displayedMinute = this.minute == null ? '--' : pad(this.minute);
  36. var titleContent = [this.genPickerButton('selecting', selectingTimes.hour, displayedHour, this.disabled), this.$createElement('span', ':'), this.genPickerButton('selecting', selectingTimes.minute, displayedMinute, this.disabled)];
  37. if (this.useSeconds) {
  38. var displayedSecond = this.second == null ? '--' : pad(this.second);
  39. titleContent.push(this.$createElement('span', ':'));
  40. titleContent.push(this.genPickerButton('selecting', selectingTimes.second, displayedSecond, this.disabled));
  41. }
  42. return this.$createElement('div', {
  43. 'class': 'v-time-picker-title__time'
  44. }, titleContent);
  45. },
  46. genAmPm: function genAmPm() {
  47. return this.$createElement('div', {
  48. staticClass: 'v-time-picker-title__ampm'
  49. }, [this.genPickerButton('period', 'am', 'am', this.disabled || this.readonly), this.genPickerButton('period', 'pm', 'pm', this.disabled || this.readonly)]);
  50. }
  51. },
  52. render: function render(h) {
  53. var children = [this.genTime()];
  54. this.ampm && children.push(this.genAmPm());
  55. return h('div', {
  56. staticClass: 'v-time-picker-title'
  57. }, children);
  58. }
  59. });
  60. //# sourceMappingURL=VTimePickerTitle.js.map