Skip to content

Commit

Permalink
buefy#1718 add hours-label and minutes-label to clockpicker
Browse files Browse the repository at this point in the history
  • Loading branch information
jtommy committed Aug 31, 2019
1 parent 97b32c5 commit 2318232
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 10 deletions.
16 changes: 9 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@

### New features

Add ``customIconPacks`` constructor option to use custom icon packs (thanks @service-paradis)
Add ``can-close`` prop to dropdown (thanks @service-paradis)
Add ``close-on-click`` prop to form navbar (thanks @wanxe)
Add ``icon-prev`` and ``icon-next`` props to datepicker, steps and pagination (thanks @service-paradis)
Add ``lazy`` prop to slider (thanks @yxngl)
Add ``dragging``, ``dragstart`` and ``dragend`` events to slider (thanks @yxngl)
Add ``setValidity`` method to form components (thanks @GerryWilko)
* Add ``customIconPacks`` constructor option to use custom icon packs (thanks @service-paradis)
* Add ``can-close`` prop to dropdown (thanks @service-paradis)
* Add ``close-on-click`` prop to form navbar (thanks @wanxe)
* Add ``icon-prev`` and ``icon-next`` props to datepicker, steps and pagination (thanks @service-paradis)
* Add ``lazy`` prop to slider (thanks @yxngl)
* Add ``dragging``, ``dragstart`` and ``dragend`` events to slider (thanks @yxngl)
* Add ``setValidity`` method to form components (thanks @GerryWilko)
* Add ``hours-label`` and ``minutes-label`` props to clockpicker
* #1677 Add ``wrapper-class`` prop to navbar (thanks @wanxe)
* Improve steps look on mobile (thanks @service-paradis)

### Fixes

Expand Down
14 changes: 14 additions & 0 deletions docs/pages/components/clockpicker/api/clockpicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,20 @@ export default [
values: '—',
default: '<code>false</code>'
},
{
name: '<code>hours-label</code>',
description: `Label to show on hour button`,
type: 'String',
values: '—',
default: `<code>Hours</code>`
},
{
name: '<code>minutes-label</code>',
description: `Label to show on minutes button`,
type: 'String',
values: '—',
default: `<code>Min</code>`
},
{
name: 'Any native attribute',
description: '—',
Expand Down
14 changes: 14 additions & 0 deletions docs/pages/installation/api/constructor-options.js
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,20 @@ export default [
values: '—',
default: '—'
},
{
name: '<code>defaultClockpickerHoursLabel</code>',
description: `Default clockpicker <code>hours-label</code> attribute`,
type: 'String',
values: '—',
default: `<code>Hours</code>`
},
{
name: '<code>defaultClockpickerMinutesLabel</code>',
description: `Default clockpicker <code>minutes-label</code> attribute`,
type: 'String',
values: '—',
default: `<code>Min</code>`
}
]
}
]
13 changes: 11 additions & 2 deletions src/components/clockpicker/Clockpicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@
<div
class="b-clockpicker-btn"
:class="{ active: isSelectingHour }"
@click="isSelectingHour = true">Hours</div>
@click="isSelectingHour = true">{{ hoursLabel }}</div>
<span
class="b-clockpicker-btn"
:class="{ active: !isSelectingHour }"
@click="isSelectingHour = false">Min</span>
@click="isSelectingHour = false">{{ minutesLabel }}</span>
</div>
<div v-if="!isHourFormat24 && !inline" class="b-clockpicker-period">
<div
Expand Down Expand Up @@ -134,6 +134,7 @@ import Input from '../input/Input'
import Field from '../field/Field'
import Icon from '../icon/Icon'
import ClockpickerFace from './ClockpickerFace'
import config from '../../utils/config'
const outerPadding = 12
Expand Down Expand Up @@ -171,6 +172,14 @@ export default {
type: {
type: String,
default: 'is-primary'
},
hoursLabel: {
type: String,
default: () => config.defaultClockpickerHoursLabel || 'Hours'
},
minutesLabel: {
type: String,
default: () => config.defaultClockpickerMinutesLabel || 'Min'
}
},
data() {
Expand Down
3 changes: 2 additions & 1 deletion types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,9 @@ export declare type BuefyConfig = {
defaultDatepickerNearbyMonthDays?: boolean;
defaultDatepickerNearbySelectableMonthDays?: boolean;
defaultDatepickerShowWeekNumber?: boolean;

customIconPacks?: any;
defaultClockpickerHoursLabel?: string;
defaultClockpickerMinutesLabel?: string;
};

declare const _default: {
Expand Down

0 comments on commit 2318232

Please sign in to comment.