Skip to content

Commit 59051d3

Browse files
WilliamDASILVAwalokra
authored andcommitted
Merge pull request chronotruck#324 from crutch12/feat/vue3
1 parent 02e500e commit 59051d3

File tree

30 files changed

+15932
-7677
lines changed

30 files changed

+15932
-7677
lines changed

.eslintrc.js

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,30 @@ module.exports = {
2626
'never'
2727
],
2828
'no-var': 'error',
29-
'vue/attributes-order': 'error',
29+
'vue/attributes-order': ['error', {
30+
order: [
31+
'DEFINITION',
32+
'LIST_RENDERING',
33+
'CONDITIONALS',
34+
'RENDER_MODIFIERS',
35+
'UNIQUE',
36+
'TWO_WAY_BINDING',
37+
'OTHER_DIRECTIVES',
38+
[
39+
'OTHER_ATTR', // v-bind order is important since vue3 (https://v3.vuejs.org/guide/migration/v-bind.html#_3-x-syntax)
40+
'GLOBAL'
41+
],
42+
'EVENTS',
43+
'CONTENT'
44+
],
45+
alphabetical: false
46+
}],
3047
'vue/no-confusing-v-for-v-if': 'error',
3148
'vue/no-v-html': 'error',
3249
'vue/order-in-components': 'error',
3350
'vue/this-in-template': 'error',
3451
'vue/script-indent': 'error',
52+
'vue/v-slot-style': 'off',
3553
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off'
3654
},
3755

README.md

Lines changed: 35 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -81,15 +81,25 @@ Vue.component('VueCtkDateTimePicker', VueCtkDateTimePicker);
8181

8282
Here is an example of [UMD implementation](https://codepen.io/louismazel/pen/jQWNzQ).
8383

84-
## Use custom element to trigger the component
85-
84+
## Use custom element to trigger the component (using [Slots api](https://v3.vuejs.org/api/directives.html#v-slot))
8685
```html
87-
<VueCtkDateTimePicker :no-value-to-custom-elem="(true|false)" />
88-
...
89-
<input type="text" />
90-
... or
91-
<button type="button">Label</button>
92-
...
86+
<VueCtkDateTimePicker>
87+
<template v-slot="{ dateFormatted, toggleDatePicker, isOpen, close }">
88+
...
89+
<input
90+
type="text"
91+
:value="dateFormatted"
92+
@focus="toggleDatePicker(true)"
93+
>
94+
... or
95+
<button
96+
type="button"
97+
@click="toggleDatePicker(true)"
98+
>
99+
{{ dateFormatted }}
100+
</button>
101+
...
102+
</template>
93103
</VueCtkDateTimePicker>
94104
```
95105

@@ -114,9 +124,8 @@ Here is an example of [UMD implementation](https://codepen.io/louismazel/pen/jQW
114124
| only-date | Boolean | no | false |
115125
| no-label | Boolean | no | false |
116126
| no-header | Boolean | no | false |
117-
| no-value-to-custom-elem (6) | Boolean | no | false |
118-
| min-date (7) | String | no | - |
119-
| max-date (7) | String | no | - |
127+
| min-date (6) | String | no | - |
128+
| max-date (6) | String | no | - |
120129
| no-weekends-days | Boolean | no | false |
121130
| auto-close | Boolean | no | false |
122131
| inline | Boolean | no | false |
@@ -129,16 +138,16 @@ Here is an example of [UMD implementation](https://codepen.io/louismazel/pen/jQW
129138
| button-now-translation | String | no | 'Now' |
130139
| no-button-now | Boolean | no | false |
131140
| first-day-of-week | Int (0 to 7) | no | - |
132-
| disabled-dates (8) | Array`<string>` | no | [] |
133-
| disabled-hours (9) | Array`<string>` | no | - |
141+
| disabled-dates (7) | Array`<string>` | no | [] |
142+
| disabled-hours (8) | Array`<string>` | no | - |
134143
| shortcut | String | no | - |
135-
| custom-shortcuts (10) | Array`<object>` | no | - |
136-
| disabled-weekly (11) | Array`<integer>` | no | [] |
137-
| no-keyboard (12) | Boolean | no | false |
138-
| right (13) | Boolean | no | false |
144+
| custom-shortcuts (9) | Array`<object>` | no | - |
145+
| disabled-weekly (10) | Array`<integer>` | no | [] |
146+
| no-keyboard (11) | Boolean | no | false |
147+
| right (12) | Boolean | no | false |
139148
| noClearButton | Boolean | no | false |
140149
| behaviour | Object | no | [See behaviour](#Behaviour) |
141-
| id (14) | String | no | undefined |
150+
| id (13) | String | no | undefined |
142151

143152
(1) hint : Is a text that replaces the label/placeholder (Ex : Error designation)
144153

@@ -150,15 +159,13 @@ Here is an example of [UMD implementation](https://codepen.io/louismazel/pen/jQW
150159

151160
(5) locale : Default value is the locale of the browser - Ex : Set `locale="fr"` to force to French language
152161

153-
(6) no-value-to-custom-elem : No value will set to your elem (you can get the formatted value with @formatted-value event)
154-
155-
(7) min-date && max-date should be in the same format as property format specified. If format not set - it is set to 'YYYY-MM-DD hh:mm a' by default
162+
(6) min-date && max-date should be in the same format as property format specified. If format not set - it is set to 'YYYY-MM-DD hh:mm a' by default
156163

157-
(8) Disabled-Dates is an Array of dates in 'YYYY-MM-DD' format (ex: `['2018-04-03', '2018-04-07', '2018-04-09']`)
164+
(7) Disabled-Dates is an Array of dates in 'YYYY-MM-DD' format (ex: `['2018-04-03', '2018-04-07', '2018-04-09']`)
158165

159-
(9) disabled-hours : Must be an Array of hours in 24h format ('00' to '23') : `['00','01','02','03','04','05','06','07','19','20','21','22','23']`
166+
(8) disabled-hours : Must be an Array of hours in 24h format ('00' to '23') : `['00','01','02','03','04','05','06','07','19','20','21','22','23']`
160167

161-
(10) custom-shortcuts - It's an array of objects. Each object represents a single shortcut.
168+
(9) custom-shortcuts - It's an array of objects. Each object represents a single shortcut.
162169

163170
```js
164171
[
@@ -205,13 +212,13 @@ With the `shortcut` property, you can specify a shortcut that's selected by defa
205212
:shortcut="'thisMonth'"
206213
```
207214

208-
(11) disabled-weekly : Days of the week which are disabled every week, in Array format with day index, Sunday as 0 and Saturday as 6: `[0,4,6]`
215+
(10) disabled-weekly : Days of the week which are disabled every week, in Array format with day index, Sunday as 0 and Saturday as 6: `[0,4,6]`
209216

210-
(12) no-keyboard : Disable keyboard accessibility & navigation
217+
(11) no-keyboard : Disable keyboard accessibility & navigation
211218

212-
(13) right : add this attribute to align the picker on right
219+
(12) right : add this attribute to align the picker on right
213220

214-
(14) id : it assign id such as 'passedstring-input' to input help diffrentiate between two date-time-picker on same component.
221+
(13) id : it assign id such as 'passedstring-input' to input help diffrentiate between two date-time-picker on same component.
215222

216223
> Any additionnal attribute passed to the component will be automatically be binded to the input component. (eg. if you passes a `type` attribute, the `<input>` will receive it).
217224

babel.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module.exports = {
22
presets: [
3-
'@vue/app'
3+
'@vue/cli-plugin-babel/preset'
44
]
55
}

0 commit comments

Comments
 (0)