🌐 AI搜索 & 代理 主页
Skip to content

Commit 91b77bc

Browse files
authored
feat(b-form-datepicker): add calendar-width prop (closes #4817) (#4822)
1 parent 4bafce4 commit 91b77bc

File tree

4 files changed

+18
-1
lines changed

4 files changed

+18
-1
lines changed

src/components/calendar/_calendar.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
// BCalendar custom styles
22

33
.b-calendar {
4+
.b-calendar-inner {
5+
// Prevent calendar from going below this width
6+
min-width: 250px;
7+
}
8+
49
output.readonly {
510
background-color: $input-disabled-bg;
611
opacity: 1;

src/components/calendar/calendar.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -855,7 +855,7 @@ export const BCalendar = Vue.extend({
855855
'small',
856856
{
857857
key: idx,
858-
staticClass: 'col',
858+
staticClass: 'col text-truncate',
859859
class: { 'text-muted': this.disabled },
860860
attrs: {
861861
title: d.label === d.text ? null : d.label,
@@ -997,6 +997,7 @@ export const BCalendar = Vue.extend({
997997
const $widget = h(
998998
'div',
999999
{
1000+
staticClass: 'b-calendar-inner',
10001001
class: this.block ? 'd-block' : 'd-inline-block',
10011002
style: this.block ? {} : { width: this.width },
10021003
attrs: {

src/components/form-datepicker/form-datepicker.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,11 @@ const propsMixin = {
102102
type: String,
103103
default: null
104104
},
105+
calendarWidth: {
106+
// Width of the calendar dropdown
107+
type: String,
108+
default: '270px'
109+
},
105110
selectedVariant: {
106111
// Variant color to use for the selected date
107112
type: String,
@@ -260,6 +265,7 @@ export const BFormDatepicker = /*#__PURE__*/ Vue.extend({
260265
locale: self.locale,
261266
startWeekday: self.startWeekday,
262267
direction: self.direction,
268+
width: self.calendarWidth,
263269
dateDisabledFn: self.dateDisabledFn,
264270
selectedVariant: self.selectedVariant,
265271
todayVariant: self.todayVariant,

src/components/form-datepicker/package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@
6464
"prop": "direction",
6565
"description": "Set to the string 'rtl' or 'ltr' to explicitly force the calendar to render in right-to-left or left-ro-right (respectively) mode. Defaults to the resolved locale's directionality"
6666
},
67+
{
68+
"prop": "calendarWidth",
69+
"version": "2.6.0",
70+
"description": "Sets the width of the calendar dropdown (see the `b-calendar` prop `width` for details)"
71+
},
6772
{
6873
"prop": "min",
6974
"description": "The minimum date the calendar will show"

0 commit comments

Comments
 (0)