035bbee3
Luigi Serra
Datalets and cont...
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
<!--
@license
The MIT License (MIT)
Copyright (c) 2015 Dipartimento di Informatica - Università di Salerno - Italy
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-->
|
ae17a8dc
Luigi Serra
Controllet and da...
|
26
|
<!--
|
950d181d
Luigi Serra
license updates
|
27
28
|
* Developed by :
* ROUTE-TO-PA Project - grant No 645860. - www.routetopa.eu
|
ae17a8dc
Luigi Serra
Controllet and da...
|
29
30
31
|
*
-->
|
035bbee3
Luigi Serra
Datalets and cont...
|
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
|
<link rel="import" href="../../bower_components/polymer/polymer.html">
<link rel="import" href="../../bower_components/paper-styles/color.html">
<!--
`text-element-controllet` is a text area with heading. It fires an event when the text value is modified. This event can be useful when you have to monitor many af this elements.
Example:
<text-element-controllet heading="myField"
description="myFieldDescription"
number="1">
</text-element-controllet>
@element text-element-controllet
@status beta
@homepage
@group controllets
-->
<dom-module id="text-element-controllet">
<template>
<style is="custom-style">
.avatar {
display: inline-block;
position: relative;
float: left;
height: 1.7em;
width: 1.7em;
border-radius: 50%;
background: var(--paper-blue-500);
color: white;
line-height: 2em;
font-size: 0.74em;
text-align: center;
}
.heading{
/*width: 12.5em;*/
}
.big {
display: inline-block;
position: relative;
float: left;
font-size: 1em;
padding: 0.5em 0.25em 0.5em;
color: var(--google-grey-500);
}
.medium {
position: relative;
float: left;
font-size: 0.8125em;
padding-bottom: 0px;
display: inline-block;
width: 32.5em;
padding-left: 10px;
}
</style>
<div>
<div>
<div class="heading">
<div class="avatar">{{number}}</div>
<div class="medium">{{description}}</div>
</div>
</div><br>
<paper-textarea id="text" label="{{heading}}" floatingLabel value="{{value}}"></paper-textarea>
</div>
</template>
<script>
Polymer({
is: 'text-element-controllet',
/**
* Fired when the user change the text value
*
* @event text-element-controllet_content-changed
*/
|
035bbee3
Luigi Serra
Datalets and cont...
|
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
|
properties: {
/**
* It's the name of the elelent
*
* @attribute heading
* @type Strig
* @default 'Heading'
*/
heading : {
type : String,
value : "Heading"
},
/**
* It's the description of the elelent
*
* @attribute description
* @type Strig
* @default 'Description'
*/
description: {
type: String,
value: "Description"
},
/**
* It's a string value the represent the current number of elelent. It will be use in the label section.
*
* @attribute number
* @type Strig
* @default '0'
*/
number: {
type: String,
value : "0"
},
|
82ad1c41
Luigi Serra
Text-element-cont...
|
157
|
|
035bbee3
Luigi Serra
Datalets and cont...
|
158
159
160
161
|
value :{
type: String,
value: "",
observer : '_valueChanged'
|
82ad1c41
Luigi Serra
Text-element-cont...
|
162
163
164
165
166
|
},
timer :{
type: Number,
value : 0
|
035bbee3
Luigi Serra
Datalets and cont...
|
167
168
169
170
171
172
173
174
175
176
|
}
},
/**
* Callback related to text change
*
* @method _valueChanged
*
* @param {Event} e
*/
_valueChanged : function(oldvalue, newValue){
|
82ad1c41
Luigi Serra
Text-element-cont...
|
177
178
|
clearTimeout (this.timer);
this.timer = setTimeout(this.fire('text-element-controllet_content-changed', {newValue: newValue}), 2000);
|
035bbee3
Luigi Serra
Datalets and cont...
|
179
180
181
182
183
184
185
186
187
188
189
190
191
192
|
},
/**
* It returns the value in text area
*
* @method getValue
*/
getValue : function(){
return this.$.text.value;
}
});
</script>
</dom-module>
|