Skip to content

Commit e0c2c93

Browse files
authored
Merge pull request #129 from phoenixwong/alpha
Release v1.1.4
2 parents 7342533 + dffcb20 commit e0c2c93

13 files changed

+296
-37
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22

33
> The Change Log of Vue2 Timepicker `vue2-timepicker`
44
5+
## v 1.1.4
6+
7+
### New
8+
9+
- Support customized clear button and dropdown button with the `clearButton` and `dropdownButton` **v-slot** (Thanks to @jost-s).
10+
- Added new `icon` **v-slot** for displaying an extra input icon.
11+
- Added new `fixed-dropdown-button` property, to make the dropdown button always visible.
12+
513
## v 1.1.3
614

715
### Improvements

README.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -869,6 +869,42 @@ Furthermore, you can replace those _am/pm_ (or _AM/PM_) string by setting the `a
869869
<vue-timepicker hour-label="" minute-label="" second-label="" apm-label="" am-text="上午" pm-text="下午" format="h:mm:ss a"></vue-timepicker>
870870
```
871871

872+
873+
## Slots
874+
875+
We introduce three slots in `v.1.1.4` to help you customize the clear button, the dropdown button, and the input icon with your own icon/image.
876+
877+
Slot Name | Position | Description
878+
------------------ | -------- | --------------
879+
**icon** | _left_ | On the lefthand side of the `<input>`
880+
**clearButton** | _right_ | In the same spot of the default clear button
881+
**dropdownButton** | _right_ | In the same spot of the default dropdown button
882+
883+
> Please note that Vue v2.6.0+ introduces a significant update of the Named Slots syntax. Check the [official documentation](https://vuejs.org/v2/guide/components-slots.html#Named-Slots) for more information.
884+
885+
```html
886+
<!-- For Vue 2.6.0+ -->
887+
888+
<!-- Input icon (image) -->
889+
<vue-timepicker>
890+
<template v-slot:icon>
891+
<img src="$YOUR_ICON_SRC" />
892+
</template>
893+
</vue-timepicker>
894+
895+
<!-- Customized clear button (image) -->
896+
<vue-timepicker>
897+
<template v-slot:clearButton>
898+
<img src="$YOUR_CUSTOM_IMAGE_SRC" />
899+
</template>
900+
</vue-timepicker>
901+
902+
<!-- Customized dropdown button (character entity) -->
903+
<vue-timepicker manual-input hide-dropdown>
904+
<template v-slot:dropdownButton>&#x02263;</template>
905+
</vue-timepicker>
906+
```
907+
872908
## Contribution
873909

874910
Please feel free to fork and help developing. Check [CONTRIBUTING.md](https://github.com/phoenixwong/vue2-timepicker/blob/master/CONTRIBUTING.md) for more details.

demo/src/components/Playground.vue

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ export default {
7070
advancedKeyboard: false,
7171
manualInput: false,
7272
hideDropdown: false,
73+
fixedDropdownBtn: false,
7374
lazyMode: false,
7475
autoScroll: false,
7576
skipErrorStyle: false,
@@ -207,6 +208,10 @@ export default {
207208
start += ('\n advanced-keyboard')
208209
}
209210
211+
if (this.fixedDropdownBtn) {
212+
start += ('\n fixed-dropdown-button')
213+
}
214+
210215
if (this.hideClearBtn) {
211216
start += ('\n hide-clear-button')
212217
}
@@ -800,6 +805,18 @@ section#playground
800805
input(v-model="hideDropdown" type="radio" id="hide_dropdown_false" name="hide_dropdown", :value="false")
801806
| &nbsp;Disable
802807

808+
#manualInputTimeout.config-block(v-if="manualInput")
809+
h3.subtitle
810+
a.anchor #
811+
| Customized Manual Input Timeout
812+
config-row(is-group)
813+
label.options
814+
input(v-model="customManualInputTimeout" type="checkbox" @input="toggleManualInputTimeout")
815+
| &nbsp;Set Manual Input Timeout
816+
label.range-wrapper(v-if="customManualInputTimeout")
817+
input(v-model.number="manualInputTimeout" type="range" min="50" max="5000" step="50")
818+
span(v-text="manualInputTimeout")
819+
803820
#advancedKeyboard.config-block
804821
h3.subtitle
805822
a.anchor #
@@ -824,17 +841,17 @@ section#playground
824841
input(v-model.number="blurDelay" type="range" min="50" max="1500" step="50")
825842
span(v-text="blurDelay")
826843

827-
#manualInputTimeout.config-block(v-if="manualInput")
844+
#fixedDropdownBtn.config-block
828845
h3.subtitle
829846
a.anchor #
830-
| Customized Manual Input Timeout
847+
| Fixed Dropdown Button
831848
config-row(is-group)
832-
label.options
833-
input(v-model="customManualInputTimeout" type="checkbox" @input="toggleManualInputTimeout")
834-
| &nbsp;Set Manual Input Timeout
835-
label.range-wrapper(v-if="customManualInputTimeout")
836-
input(v-model.number="manualInputTimeout" type="range" min="50" max="5000" step="50")
837-
span(v-text="manualInputTimeout")
849+
label.options(for="fixed_dd_btn_true")
850+
input(v-model="fixedDropdownBtn" type="radio" id="fixed_dd_btn_true" name="fixed_dd_btn", :value="true")
851+
| &nbsp;Enable
852+
label.options(for="fixed_dd_btn_false")
853+
input(v-model="fixedDropdownBtn" type="radio" id="fixed_dd_btn_false" name="fixed_dd_btn", :value="false")
854+
| &nbsp;Disable
838855

839856
#skipErrorStyle.config-block
840857
h3.subtitle
@@ -884,6 +901,7 @@ section#playground
884901
:blur-delay="blurDelay"
885902
:manual-input-timeout="manualInputTimeout"
886903
:hide-clear-button="hideClearBtn"
904+
:fixed-dropdown-button="fixedDropdownBtn"
887905
:disabled="disablePicker"
888906
:lazy="lazyMode"
889907
:auto-scroll="autoScroll"

demo/src/components/Samples.vue

Lines changed: 99 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ export default {
5151
5252
manualStringValue: '8:15 pm',
5353
54+
customCloseBtnValue: '10:05',
55+
5456
autoScrollData1: '08:40',
5557
autoScrollData2: '5:30:20 pm',
5658
@@ -80,7 +82,9 @@ export default {
8082
{ title: 'Customized Picker Labels', anchor: 'customPickerLabels' },
8183
{ title: 'Adjust Input Width', anchor: 'inputWidth' },
8284
{ title: 'Auto-Scroll', anchor: 'autoScroll' },
83-
{ title: 'More Powerful format String', anchor: 'morePowerfulFormat' }
85+
{ title: 'More Powerful format String', anchor: 'morePowerfulFormat' },
86+
{ title: 'Customized Buttons And Icon', anchor: 'customButtonIcon' },
87+
{ title: 'Fixed Dropdown Button', anchor: 'fixedDropdownButton' }
8488
]
8589
}
8690
},
@@ -462,6 +466,7 @@ section#mostlyUsedSamples
462466
template(v-slot:preview)
463467
vue-timepicker(hide-clear-button)
464468

469+
465470
//- Disable Picker
466471
sample-block#disablePicker
467472
template(v-slot:title) Disable Picker
@@ -851,6 +856,97 @@ section#mostlyUsedSamples
851856
| &nbsp;
852857
vue-timepicker(format="a" input-width="60px")
853858

859+
//- Custom Button And Icon
860+
sample-block#customButtonIcon
861+
template(v-slot:title) Customized Buttons And Input Icon
862+
template(v-slot:description)
863+
p You can customize the clear button, and the dropdown button with your own icon/image starts from <code>v1.1.4+</code>. There's an additional slot for the input icon as well.
864+
p Please note that Vue v2.6.0+ introduces a significant update of the <b>Named Slots</b> syntax. Check the <a href="https://vuejs.org/v2/guide/components-slots.html#Named-Slots" target="_black">official documentation</a> for more information.
865+
866+
template(v-slot:codes)
867+
highlight-code(lang="html" data-title="HTML")
868+
pre
869+
| &lt;!-- For Vue 2.6.0+ --&gt;
870+
|
871+
| &lt;!-- Input icon (image) --&gt;
872+
| &lt;vue-timepicker&gt;
873+
| &lt;template v-slot:icon&gt;
874+
| &lt;img src="$YOUR_ICON_SRC" /&gt;
875+
| &lt;/template&gt;
876+
| &lt;/vue-timepicker&gt;
877+
|
878+
| &lt;!-- Customized clear button (image) --&gt;
879+
| &lt;vue-timepicker&gt;
880+
| &lt;template v-slot:clearButton&gt;
881+
| &lt;img src="$YOUR_CUSTOM_IMAGE_SRC" /&gt;
882+
| &lt;/template&gt;
883+
| &lt;/vue-timepicker&gt;
884+
|
885+
| &lt;!-- Customized dropdown button (character entity) --&gt;
886+
| &lt;vue-timepicker manual-input hide-dropdown&gt;
887+
| &lt;template v-slot:dropdownButton&gt;&amp;#x02263;&lt;/template&gt;
888+
| &lt;/vue-timepicker&gt;
889+
890+
template(v-slot:preview)
891+
b Input icon (image)
892+
p
893+
vue-timepicker
894+
template(v-slot:icon)
895+
img(src="https://i.postimg.cc/CLkZcW46/custom-clock.png")
896+
b Customized clear button (image)
897+
p
898+
vue-timepicker(v-model="customCloseBtnValue")
899+
template(v-slot:clearButton)
900+
img(src="https://i.postimg.cc/Y0f6RHF8/custom-close.png")
901+
b Customized dropdown button (character entity)
902+
p
903+
vue-timepicker(manual-input hide-dropdown)
904+
template(v-slot:dropdownButton) &#x02263;
905+
906+
907+
//- Fixed Dropdown Button
908+
sample-block#fixedDropdownButton
909+
template(v-slot:title) Fixed Dropdown Button
910+
template(v-slot:description)
911+
p You can make the dropdown button always visible in the UI with <code>fixed-dropdown-button</code>.
912+
p When paired with a customized dropdown button, it's similar to an input icon on the righthand side.
913+
914+
template(v-slot:codes)
915+
highlight-code(lang="html" data-title="HTML")
916+
pre
917+
| &lt;!-- Default dropdown button --&gt;
918+
| &lt;vue-timepicker fixed-dropdown-button&gt;&lt;/vue-timepicker&gt;
919+
|
920+
| &lt;!-- Customized + fixed dropdown button --&gt;
921+
| &lt;vue-timepicker fixed-dropdown-button&gt;
922+
| &lt;template v-slot:dropdownButton&gt;
923+
| &lt;img src="$YOUR_BUTTON_IMAGE_SRC" /&gt;
924+
| &lt;/template&gt;
925+
| &lt;/vue-timepicker&gt;
926+
|
927+
| &lt;!-- To display only one button on the right --&gt;
928+
| &lt;!-- Customized + fixed dropdown button + hide clear button --&gt;
929+
| &lt;vue-timepicker fixed-dropdown-button hide-clear-button&gt;
930+
| &lt;template v-slot:dropdownButton&gt;
931+
| &lt;img src="$YOUR_BUTTON_IMAGE_SRC" /&gt;
932+
| &lt;/template&gt;
933+
| &lt;/vue-timepicker&gt;
934+
935+
template(v-slot:preview)
936+
b Default dropdown button
937+
p
938+
vue-timepicker(fixed-dropdown-button)
939+
b Customized + fixed dropdown button
940+
p
941+
vue-timepicker(fixed-dropdown-button)
942+
template(v-slot:dropdownButton)
943+
img(src="https://i.postimg.cc/CLkZcW46/custom-clock.png")
944+
b Customized + fixed dropdown button + hide clear button
945+
p
946+
vue-timepicker(fixed-dropdown-button hide-clear-button)
947+
template(v-slot:dropdownButton)
948+
img(src="https://i.postimg.cc/CLkZcW46/custom-clock.png")
949+
854950
//- Footer Links
855951
.footer-links
856952
slot(name="footer-links")
@@ -889,6 +985,8 @@ section#mostlyUsedSamples
889985
width: 20%
890986
bottom: 0
891987
left: 0
988+
max-height: calc(100vh - 50px)
989+
overflow-y: auto
892990
893991
ul
894992
padding: 0 0 0.5em 1.5em

0 commit comments

Comments
 (0)