-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Date Range component #201 [work in progress]
- Loading branch information
1 parent
6f15dd3
commit 1ce41ce
Showing
3 changed files
with
103 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
<template> | ||
<div> | ||
<q-datetime | ||
v-model="model.min" | ||
:type="type" | ||
:min="min" | ||
:max="model.max || max" | ||
:format="format" | ||
:no-clear="noClear" | ||
:clear-label="clearLabel" | ||
:ok-label="okLabel" | ||
:cancel-label="cancelLabel" | ||
:label="label" | ||
:placeholder="placeholder" | ||
:static-label="staticLabel" | ||
:readonly="readonly" | ||
:disable="disable" | ||
></q-datetime> | ||
|
||
<q-datetime | ||
v-model="model.max" | ||
:type="type" | ||
:min="model.min || min" | ||
:max="max" | ||
:format="format" | ||
:no-clear="noClear" | ||
:clear-label="clearLabel" | ||
:ok-label="okLabel" | ||
:cancel-label="cancelLabel" | ||
:label="label" | ||
:placeholder="placeholder" | ||
:static-label="staticLabel" | ||
:readonly="readonly" | ||
:disable="disable" | ||
></q-datetime> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
props: { | ||
value: { | ||
type: Object, | ||
validator (val) { | ||
if (typeof val.min !== 'string' || typeof val.max !== 'string') { | ||
console.error('DatetimeRange requires a {min, max} model.') | ||
return false | ||
} | ||
return true | ||
}, | ||
required: true | ||
}, | ||
type: { | ||
type: String, | ||
default: 'date' | ||
}, | ||
min: { | ||
type: String, | ||
default: '' | ||
}, | ||
max: { | ||
type: String, | ||
default: '' | ||
}, | ||
format: String, | ||
noClear: Boolean, | ||
clearLabel: { | ||
type: String, | ||
default: 'Clear' | ||
}, | ||
okLabel: { | ||
type: String, | ||
default: 'Set' | ||
}, | ||
cancelLabel: { | ||
type: String, | ||
default: 'Cancel' | ||
}, | ||
label: String, | ||
placeholder: String, | ||
staticLabel: String, | ||
readonly: Boolean, | ||
disable: Boolean | ||
}, | ||
computed: { | ||
model: { | ||
get () { | ||
return this.value | ||
}, | ||
set (value) { | ||
this.$emit('input', value) | ||
} | ||
} | ||
} | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters