Skip to content

Commit

Permalink
fix(datepicker): fix datepicker disabled can clear
Browse files Browse the repository at this point in the history
  • Loading branch information
luchunyu committed Nov 22, 2018
1 parent 95287b0 commit 12a8261
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 8 deletions.
4 changes: 4 additions & 0 deletions src/components/datepicker/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@
top: 50%;
transform: translateY(-50%);
color: color(var(--text-color) l(65%));

&.disabled {
cursor: not-allowed;
}
}

.c-datepicker__hovericon {
Expand Down
7 changes: 5 additions & 2 deletions src/components/datepicker/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
@click="open"
)
.c-datepicker__icon.c-datepicker__hovericon(
v-if="!disabled && date != '' || daterange != ''"
v-if="!disabled && (date != '' || daterange != '')"
@click="resetDate"
:class="className"
)
Expand Down Expand Up @@ -130,7 +130,10 @@ export default {
return this
},
className () {
return this.size ? `is-size-${this.size}` : ''
return [
this.size ? `is-size-${this.size}` : '',
this.disabled ? 'disabled' : ''
]
},
daterange () {
if (this.type.indexOf('range') === -1) return []
Expand Down
10 changes: 7 additions & 3 deletions src/components/timepicker/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@
display: inline-block;
position: relative;
border-radius: 0.2em;
width: 15em;

& .c-input-wrap {
width: 100%;
width: 12em;
}

& input {
Expand All @@ -24,6 +23,10 @@
top: 50%;
transform: translateY(-50%);
color: color(var(--text-color) l(65%));

&.disabled {
cursor: not-allowed;
}
}

& .c-timepicker__hovericon {
Expand Down Expand Up @@ -111,10 +114,11 @@
}

.c-timepicker__timerange {
width: 100%;
width: 15em;
border: 1px solid color(var(--gray) l(85%));
border-radius: 3px;


& .c-timerange__wrapper {
display: flex;

Expand Down
3 changes: 1 addition & 2 deletions src/components/timepicker/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,7 @@ layout: component
type: 'timerange',
readonly: false,
disabled: false,
format: 'HH:mm',
time: ['10:12', '12:32'],
time: ['10:13:23', '12:32:56'],
}
},
methods: {
Expand Down
5 changes: 4 additions & 1 deletion src/components/timepicker/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,10 @@ export default {
},
computed: {
sizeClassName () {
return this.size ? `is-size-${this.size}` : ''
return [
this.size ? `is-size-${this.size}` : '',
this.disabled ? 'disabled' : ''
]
},
hasHour () {
return this.format.toLowerCase().indexOf('h') > -1
Expand Down

0 comments on commit 12a8261

Please sign in to comment.