A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/bootstrap-vue/bootstrap-vue/commit/b1f74a84f4021022e606360ee6824c6645b6fbd0 below:

add optional decade navigation b… · bootstrap-vue/bootstrap-vue@b1f74a8 · GitHub

@@ -16,6 +16,8 @@ import {

16 16

oneMonthAhead,

17 17

oneYearAgo,

18 18

oneYearAhead,

19 +

oneDecadeAgo,

20 +

oneDecadeAhead,

19 21

parseYMD,

20 22

resolveLocale

21 23

} from '../../utils/date'

@@ -26,7 +28,12 @@ import { toInteger } from '../../utils/number'

26 28

import { toString } from '../../utils/string'

27 29

import idMixin from '../../mixins/id'

28 30

import normalizeSlotMixin from '../../mixins/normalize-slot'

29 -

import { BIconChevronLeft, BIconChevronDoubleLeft, BIconCircleFill } from '../../icons/icons'

31 +

import {

32 +

BIconChevronLeft,

33 +

BIconChevronDoubleLeft,

34 +

BIconChevronBarLeft,

35 +

BIconCircleFill

36 +

} from '../../icons/icons'

30 37 31 38

// --- Constants ---

32 39

@@ -141,6 +148,11 @@ export const BCalendar = Vue.extend({

141 148

type: Boolean,

142 149

default: false

143 150

},

151 +

showDecadeNav: {

152 +

// When `true` enables the decade navigation buttons

153 +

type: Boolean,

154 +

default: false

155 +

},

144 156

hidden: {

145 157

// When `true`, renders a comment node, but keeps the component instance active

146 158

// Mainly for <b-form-date>, so that we can get the component's value and locale

@@ -158,6 +170,10 @@ export const BCalendar = Vue.extend({

158 170

// default: null

159 171

},

160 172

// Labels for buttons and keyboard shortcuts

173 +

labelPrevDecade: {

174 +

type: String,

175 +

default: () => getComponentConfig(NAME, 'labelPrevDecade')

176 +

},

161 177

labelPrevYear: {

162 178

type: String,

163 179

default: () => getComponentConfig(NAME, 'labelPrevYear')

@@ -178,6 +194,10 @@ export const BCalendar = Vue.extend({

178 194

type: String,

179 195

default: () => getComponentConfig(NAME, 'labelNextYear')

180 196

},

197 +

labelNextDecade: {

198 +

type: String,

199 +

default: () => getComponentConfig(NAME, 'labelNextDecade')

200 +

},

181 201

labelToday: {

182 202

type: String,

183 203

default: () => getComponentConfig(NAME, 'labelToday')

@@ -397,6 +417,10 @@ export const BCalendar = Vue.extend({

397 417

return createDateFormatter(this.calendarLocale, { day: 'numeric', calendar: 'gregory' })

398 418

},

399 419

// Disabled states for the nav buttons

420 +

prevDecadeDisabled() {

421 +

const min = this.computedMin

422 +

return this.disabled || (min && lastDateOfMonth(oneDecadeAgo(this.activeDate)) < min)

423 +

},

400 424

prevYearDisabled() {

401 425

const min = this.computedMin

402 426

return this.disabled || (min && lastDateOfMonth(oneYearAgo(this.activeDate)) < min)

@@ -417,7 +441,11 @@ export const BCalendar = Vue.extend({

417 441

const max = this.computedMax

418 442

return this.disabled || (max && firstDateOfMonth(oneYearAhead(this.activeDate)) > max)

419 443

},

420 -

// Calendar generation

444 +

nextDecadeDisabled() {

445 +

const max = this.computedMax

446 +

return this.disabled || (max && firstDateOfMonth(oneDecadeAhead(this.activeDate)) > max)

447 +

},

448 +

// Calendar dates generation

421 449

calendar() {

422 450

const matrix = []

423 451

const firstDay = this.calendarFirstDay

@@ -571,8 +599,7 @@ export const BCalendar = Vue.extend({

571 599

// Calendar keyboard navigation

572 600

// Handles PAGEUP/PAGEDOWN/END/HOME/LEFT/UP/RIGHT/DOWN

573 601

// Focuses grid after updating

574 -

const keyCode = evt.keyCode

575 -

const altKey = evt.altKey

602 +

const { altKey, ctrlKey, keyCode } = evt

576 603

if (!arrayIncludes([PAGEUP, PAGEDOWN, END, HOME, LEFT, UP, RIGHT, DOWN], keyCode)) {

577 604

/* istanbul ignore next */

578 605

return

@@ -586,13 +613,15 @@ export const BCalendar = Vue.extend({

586 613

const isRTL = this.isRTL

587 614

if (keyCode === PAGEUP) {

588 615

// PAGEUP - Previous month/year

589 -

activeDate = (altKey ? oneYearAgo : oneMonthAgo)(activeDate)

616 +

activeDate = (altKey ? (ctrlKey ? oneDecadeAgo : oneYearAgo) : oneMonthAgo)(activeDate)

590 617

// We check the first day of month to be in rage

591 618

checkDate = createDate(activeDate)

592 619

checkDate.setDate(1)

593 620

} else if (keyCode === PAGEDOWN) {

594 621

// PAGEDOWN - Next month/year

595 -

activeDate = (altKey ? oneYearAhead : oneMonthAhead)(activeDate)

622 +

activeDate = (altKey ? (ctrlKey ? oneDecadeAhead : oneYearAhead) : oneMonthAhead)(

623 +

activeDate

624 +

)

596 625

// We check the last day of month to be in rage

597 626

checkDate = createDate(activeDate)

598 627

checkDate.setMonth(checkDate.getMonth() + 1)

@@ -670,6 +699,9 @@ export const BCalendar = Vue.extend({

670 699

this.focus()

671 700

}

672 701

},

702 +

gotoPrevDecade() {

703 +

this.activeYMD = formatYMD(this.constrainDate(oneDecadeAgo(this.activeDate)))

704 +

},

673 705

gotoPrevYear() {

674 706

this.activeYMD = formatYMD(this.constrainDate(oneYearAgo(this.activeDate)))

675 707

},

@@ -686,6 +718,9 @@ export const BCalendar = Vue.extend({

686 718

gotoNextYear() {

687 719

this.activeYMD = formatYMD(this.constrainDate(oneYearAhead(this.activeDate)))

688 720

},

721 +

gotoNextDecade() {

722 +

this.activeYMD = formatYMD(this.constrainDate(oneDecadeAhead(this.activeDate)))

723 +

},

689 724

onHeaderClick() {

690 725

if (!this.disabled) {

691 726

this.activeYMD = this.selectedYMD || formatYMD(this.getToday())

@@ -700,6 +735,7 @@ export const BCalendar = Vue.extend({

700 735

}

701 736 702 737

const isRTL = this.isRTL

738 +

const hideDecadeNav = !this.showDecadeNav

703 739

const todayYMD = formatYMD(this.getToday())

704 740

const selectedYMD = this.selectedYMD

705 741

const activeYMD = this.activeYMD

@@ -762,11 +798,13 @@ export const BCalendar = Vue.extend({

762 798

)

763 799 764 800

// Content for the date navigation buttons

801 +

const $prevDecadeIcon = h(BIconChevronBarLeft, { props: { shiftV: 0.5, flipH: isRTL } })

765 802

const $prevYearIcon = h(BIconChevronDoubleLeft, { props: { shiftV: 0.5, flipH: isRTL } })

766 803

const $prevMonthIcon = h(BIconChevronLeft, { props: { shiftV: 0.5, flipH: isRTL } })

767 804

const $thisMonthIcon = h(BIconCircleFill, { props: { shiftV: 0.5 } })

768 805

const $nextMonthIcon = h(BIconChevronLeft, { props: { shiftV: 0.5, flipH: !isRTL } })

769 806

const $nextYearIcon = h(BIconChevronDoubleLeft, { props: { shiftV: 0.5, flipH: !isRTL } })

807 +

const $nextDecadeIcon = h(BIconChevronBarLeft, { props: { shiftV: 0.5, flipH: !isRTL } })

770 808 771 809

// Utility to create the date navigation buttons

772 810

const makeNavBtn = (content, label, handler, btnDisabled, shortcut) => {

@@ -802,6 +840,15 @@ export const BCalendar = Vue.extend({

802 840

}

803 841

},

804 842

[

843 +

hideDecadeNav

844 +

? h()

845 +

: makeNavBtn(

846 +

$prevDecadeIcon,

847 +

this.labelPrevDecade,

848 +

this.gotoPrevDecade,

849 +

this.prevDecadeDisabled,

850 +

'Ctrl+Alt+PageDown'

851 +

),

805 852

makeNavBtn(

806 853

$prevYearIcon,

807 854

this.labelPrevYear,

@@ -836,7 +883,16 @@ export const BCalendar = Vue.extend({

836 883

this.gotoNextYear,

837 884

this.nextYearDisabled,

838 885

'Alt+PageUp'

839 -

)

886 +

),

887 +

hideDecadeNav

888 +

? h()

889 +

: makeNavBtn(

890 +

$nextDecadeIcon,

891 +

this.labelNextDecade,

892 +

this.gotoNextDecade,

893 +

this.nextDecadeDisabled,

894 +

'Ctrl+Alt+PageUp'

895 +

)

840 896

]

841 897

)

842 898

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4