Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat(b-calendar/b-form-datepicker): add day, month, and year type options (closes #6034)#6801

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
christianklemp wants to merge9 commits intobootstrap-vue:dev
base:dev
Choose a base branch
Loading
fromchristianklemp:datepicker-types
Open
Show file tree
Hide file tree
Changes fromall commits
Commits
Show all changes
9 commits
Select commitHold shift + click to select a range
a7a56e5
feat(b-calendar): add day, month, and year type options
christianklempJul 1, 2021
3ef148f
feat(b-form-datepicker): add day, month, and year type picker options
christianklempJul 1, 2021
28af57a
docs(b-calendar): update example documentation to be simpler
christianklempOct 7, 2021
b31e6fb
feat(b-calendar): add keyboard navigation support for all types
christianklempOct 7, 2021
ce1eecc
feat(b-calendar): add home and end keyboard navigation support for mo…
christianklempOct 7, 2021
f5ee32c
docs(b-calendar): fixes typo of which type `labelCurrentMonth` applie…
christianklempOct 8, 2021
791d4cf
chore: updates added tests to use `toBeTruthy()` instead of `toBe(true)`
christianklempOct 8, 2021
0aca380
Merge branch 'dev' into datepicker-types
christianklempJan 18, 2022
8a477e8
Merge branch 'dev' into datepicker-types
HiwsApr 28, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletionssrc/components/calendar/README.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -58,6 +58,67 @@ If no date is selected, `<b-calendar>` returns an empty string `''`, or returns
Note that when `value-as-date` prop is set, the returned `Date` object will be in the browser's
default timezone.

## Types

<span class="badge badge-info small">v2.XX.0+</span>

Displaying different calendar types can now be specified by the `type` prop. Valid options are
`'date'`, `'day'`, `'month'`, or `'year'`, with the default of `'date'`.

Setting to `'day'` will display the days of the week, and the return value will be the date of the
day of the current week selected. Setting to `'month'` will display the months of the year, and the
return value will be the first day of the selected month. Setting to `'year'` will display years in
a decade, and the return value will be the first day of the selected year.

```html
<template>
<b-row>
<b-col md="auto">
<b-form-group
label="Calendar type"
v-slot="{ ariaDescribedby }"
>
<b-form-radio-group
v-model="type"
:aria-describedby="ariaDescribedby"
aria-controls="ex-type"
>
<b-form-radio value="date">Date</b-form-radio>
<b-form-radio value="day">Day</b-form-radio>
<b-form-radio value="month">Month</b-form-radio>
<b-form-radio value="year">Year</b-form-radio>
</b-form-radio-group>
</b-form-group>

<b-calendar v-model="value" @context="onContext" locale="en-US" :type="type"></b-calendar>
</b-col>
<b-col>
<p>Value: <b>'{{ value }}'</b></p>
<p class="mb-0">Context:</p>
<pre class="small">{{ context }}</pre>
</b-col>
</b-row>
</template>

<script>
export default {
data() {
return {
type: 'date',
value: '',
context: null
}
},
methods: {
onContext(ctx) {
this.context = ctx
}
}
}
</script>
<!-- b-calendar.vue -->
```

## Disabled and readonly states

Setting the `disabled` prop will remove all interactivity of the `<b-calendar>` component.
Expand Down
10 changes: 10 additions & 0 deletionssrc/components/calendar/_calendar.scss
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -60,6 +60,16 @@
margin: 3px auto;
padding: 9px 0;
}

&.day,
&.month,
&.year {
.btn {
width: auto;
height: auto;
padding: 9px 12px;
}
}
}
}

Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp