Skip to content

Commit 2c61350

Browse files
committed
add StaticTextArea component
1 parent dcefe74 commit 2c61350

4 files changed

Lines changed: 124 additions & 0 deletions

File tree

src/components/StaticTextArea.vue

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
<!--
2+
- MIT License
3+
-
4+
- Copyright (c) 2018 Darren Fang
5+
-
6+
- Permission is hereby granted, free of charge, to any person obtaining a copy
7+
- of this software and associated documentation files (the "Software"), to deal
8+
- in the Software without restriction, including without limitation the rights
9+
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
- copies of the Software, and to permit persons to whom the Software is
11+
- furnished to do so, subject to the following conditions:
12+
-
13+
- The above copyright notice and this permission notice shall be included in all
14+
- copies or substantial portions of the Software.
15+
-
16+
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
- SOFTWARE.
23+
-
24+
-->
25+
26+
<template>
27+
<div>
28+
<v-textarea
29+
:value="displayText"
30+
:label="label"
31+
:hint="hint"
32+
:persistent-hint="persistentHint"
33+
:loading="loading"
34+
:counter="counter"
35+
:rows="rows"
36+
readonly
37+
disabled
38+
auto-grow
39+
class="v-static-textarea"
40+
>
41+
<template v-slot:progress>
42+
<v-progress-linear
43+
:indeterminate="true"
44+
:color="progressColor"
45+
:height="progressHeight"
46+
>
47+
</v-progress-linear>
48+
</template>
49+
</v-textarea>
50+
</div>
51+
</template>
52+
53+
<script>
54+
export default {
55+
name: 'v-static-textarea',
56+
props: {
57+
label: {
58+
type: String
59+
},
60+
value: {
61+
required: true
62+
},
63+
hint: {
64+
type: String
65+
},
66+
counter: {
67+
type: Boolean
68+
},
69+
rows: {
70+
type: [Number, String]
71+
},
72+
persistentHint: {
73+
type: Boolean
74+
},
75+
loading: {
76+
type: Boolean
77+
},
78+
progressColor: {
79+
type: String,
80+
default: 'primary'
81+
},
82+
progressHeight: {
83+
type: Number,
84+
default: 3
85+
}
86+
},
87+
computed: {
88+
displayText: function () {
89+
return this.loading ? '' : this.value
90+
}
91+
}
92+
}
93+
</script>

src/components/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@ import ConfirmBox from './ConfirmBox'
22
import Message from './Message'
33
import StaticTextField from './StaticTextField'
44
import SwitchField from './SwitchField'
5+
import StaticTextArea from './StaticTextArea'
56

67
const install = (Vue) => {
78
Vue.component(ConfirmBox.name, ConfirmBox)
89
Vue.component(Message.name, Message)
910
Vue.component(StaticTextField.name, StaticTextField)
1011
Vue.component(SwitchField.name, SwitchField)
12+
Vue.component(StaticTextArea.name, StaticTextArea)
1113
}
1214

1315
export default install

src/stylus/main.styl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
@import "switch-field.styl"
22
@import 'static-text-field.styl'
3+
@import 'static-textarea.styl'

src/stylus/static-textarea.styl

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/*
2+
* MIT License
3+
*
4+
* Copyright (c) 2018 Darren Fang
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy
7+
* of this software and associated documentation files (the "Software"), to deal
8+
* in the Software without restriction, including without limitation the rights
9+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
* copies of the Software, and to permit persons to whom the Software is
11+
* furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in all
14+
* copies or substantial portions of the Software.
15+
*
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
* SOFTWARE.
23+
*
24+
*/
25+
26+
.v-static-textarea
27+
textarea:disabled
28+
color #FFF

0 commit comments

Comments
 (0)