Skip to content

Commit 3dee8ee

Browse files
authored
feat(input): add html input attributes autofocus/maxlength/pattern
* feat(input): add html input attributes autofocus/maxlength/pattern * docs(project): small adjustments for disabledDates
1 parent 8acc799 commit 3dee8ee

File tree

5 files changed

+29
-2
lines changed

5 files changed

+29
-2
lines changed

docs/guide/DisabledDates/README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ var state = {
3737
}
3838
}
3939
```
40-
Every Saturday and Sunday is disabled
40+
Every Saturday and Sunday is disabled
4141

4242
## Disable specific days of each month
4343
```js
@@ -67,13 +67,16 @@ Following dates are disabled:
6767
2016-10-18
6868

6969
## Disable in given ranges
70+
::: tip IMPORTANT
71+
Both `to` and `from` properties are required to define a range of dates to highlight.
72+
:::
7073
```js
7174
var state = {
7275
disabledDates: {
7376
ranges: [{
7477
from: new Date(2016, 11, 25),
7578
to: new Date(2016, 11, 30)
76-
},
79+
},
7780
{
7881
from: new Date(2017, 1, 12),
7982
to: new Date(2017, 2, 25)

docs/guide/Props/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
| Prop | Type | Default | Description |
55
| ----------------------------- | -----------------| ----------- | ----------------------------------------------- |
6+
| autofocus | String | | Sets html `autofocus` attribute on input |
67
| bootstrap-styling | Boolean | false | Use bootstrap v4 styling classes. |
78
| calendar-button | Boolean | false | Show an icon that that can be clicked |
89
| calendar-button-icon | String | | Use icon for button (ex: fa fa-calendar) |
@@ -21,11 +22,13 @@
2122
| inline | Boolean | | To show the datepicker always open |
2223
| input-class | String\|Object\|Array | | CSS class(es) applied to the input el |
2324
| language | Object | en | Translation for days and months |
25+
| maxlength | String | | Sets html `maxlength` attribute on input |
2426
| maximum-view | String | 'year' | If set, higher-level views won't show |
2527
| minimum-view | String | 'day' | If set, lower-level views won't show |
2628
| monday-first | Boolean | false | To start the week on Monday |
2729
| name | String | | Input name property |
2830
| open-date | Date\|String | | If set, open on that date |
31+
| pattern | String | | Sets html `pattern` attribute on input |
2932
| placeholder | String | | Input placeholder text |
3033
| required | Boolean | false | Sets html required attribute on input |
3134
| ref-name | String | | Sets a ref name directly on the input field |

src/components/DateInput.vue

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@
3232
:disabled="disabled"
3333
:required="required"
3434
:readonly="!typeable"
35+
:autofocus="autofocus"
36+
:maxlength="maxlength"
37+
:pattern="pattern"
3538
:tabindex="tabindex"
3639
autocomplete="off"
3740
@click="showCalendar(false)"

src/components/Datepicker.vue

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@
2424
:calendar-button-icon-content="calendarButtonIconContent"
2525
:disabled="disabled"
2626
:required="required"
27+
:autofocus="autofocus"
28+
:maxlength="maxlength"
29+
:pattern="pattern"
2730
:bootstrap-styling="bootstrapStyling"
2831
:use-utc="useUtc"
2932
:show-calendar-on-focus="showCalendarOnFocus"

src/mixins/inputProps.vue

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,21 @@ export default ({
108108
type: Boolean,
109109
default: false,
110110
},
111+
autofocus: {
112+
type: Boolean,
113+
default: false,
114+
},
115+
maxlength: {
116+
type: [
117+
Number,
118+
String,
119+
],
120+
default: null,
121+
},
122+
pattern: {
123+
type: String,
124+
default: null,
125+
},
111126
},
112127
})
113128
</script>

0 commit comments

Comments
 (0)