Blame view

controllets/search-panel-controllet/search-panel-controllet.html 7.42 KB
15df8c68   Luigi Serra   search bar contro...
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
26
27
28
29
30
31
32
33
34
35
36
37
38
  <!--

  @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.

  -->

  

  <!--

  * Developed by :

  * ROUTE-TO-PA Project - grant No 645860. - www.routetopa.eu

  *

  -->

  

  <link rel="import" href="../../bower_components/polymer/polymer.html">

  <link rel="import" href="../../bower_components/paper-styles/color.html">

  <link rel="import" href="../../bower_components/paper-input/paper-input.html">

  <link rel="import" href="../../bower_components/paper-icon-button/paper-icon-button.html">

  <link rel="import" href="../../bower_components/neon-animation/neon-animated-pages.html">

  <link rel="import" href="../../bower_components/neon-animation/neon-animatable.html">

  <link rel="import" href="../../bower_components/iron-flex-layout/iron-flex-layout.html">

0242ec8c   Andrea Petta   plugin update
39
  <link rel="import" href="../../bower_components/paper-fab/paper-fab.html">

15df8c68   Luigi Serra   search bar contro...
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
  

  <!--

  `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="search-panel-controllet">

      <template>

  

          <style is="custom-style">

  

              paper-input.search-text{

0242ec8c   Andrea Petta   plugin update
66
67
68
                  --paper-input-container-input-color: var(--search-box-container-color,#ffffff);

                  --paper-input-container-focus-color: var(--search-box-container-color,#ffffff);

                  --paper-input-container-color: var(--search-box-container-color,#ffffff);

a7d52488   Renato De Donato   ln
69
                  position: absolute;

a53fbbed   Renato De Donato   select-dataset ne...
70
71
                  width: 340px;

                  margin-left: -5px;

15df8c68   Luigi Serra   search bar contro...
72
73
              }

  

0242ec8c   Andrea Petta   plugin update
74
75
76
              paper-fab#search_button{

                  height: 40px;

                  width: 40px;

7c272bb3   Andrea Petta   plugin update
77
                  padding: 0px;

0242ec8c   Andrea Petta   plugin update
78
79
              }

  

2ab5559c   Renato De Donato   animated-button-c...
80
              paper-icon-button

563db87f   isisadmin   bug fix
81
              {

15df8c68   Luigi Serra   search bar contro...
82
83
84
85
              }

  

          </style>

          <div class="horizontal layout">

0a87e7be   Luigi Serra   updates
86
87
88
89
              <template is="dom-if" if="{{leftDirection}}">

                  <paper-icon-button id="search_button" icon="search" class="dropdown-trigger" on-click="_toggleClick"></paper-icon-button>

              </template>

  

0242ec8c   Andrea Petta   plugin update
90
91
92
93
              <template is="dom-if" if="{{paperfab}}">

                  <paper-fab id="search_button" icon="search" class="dropdown-trigger" on-click="_toggleClick"></paper-fab>

              </template>

  

15df8c68   Luigi Serra   search bar contro...
94
95
              <neon-animated-pages selected="[[selected]]" entry-animation="[[entryAnimation]]" exit-animation="[[exitAnimation]]">

                  <neon-animatable></neon-animatable>

0a87e7be   Luigi Serra   updates
96
                  <neon-animatable>

a7d52488   Renato De Donato   ln
97
                      <paper-input id="search_text" class="search-text" autofocus autosave="search_text" results="5" transition="fade-in-animation" value="{{searchKey}}" no-label-float>

0a87e7be   Luigi Serra   updates
98
99
                      </paper-input>

                  </neon-animatable>

15df8c68   Luigi Serra   search bar contro...
100
              </neon-animated-pages>

0a87e7be   Luigi Serra   updates
101
102
103
104
  

              <template is="dom-if" if="{{rightDirection}}">

                  <paper-icon-button id="search_button" icon="search" class="dropdown-trigger" on-click="_toggleClick"></paper-icon-button>

              </template>

0242ec8c   Andrea Petta   plugin update
105
  

15df8c68   Luigi Serra   search bar contro...
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
          </div>

  

      </template>

  

      <script>

  

          Polymer({

  

              is: 'search-panel-controllet',

  

              /**

               * Fired when the user change the text value

               *

               * @event search-panel-controllet_content-changed

               */

  

              properties: {

                  timer :{

                      type: Number,

                      value : 0

                  },

                  selected : {

                      type: Number,

                      value : 0

                  },

                  entryAnimation : {

                      type: String,

                      value: ""

                  },

                  exitAnimation : {

                      type: String,

                      value: ""

59190a9b   Luigi Serra   update
138
139
140
141
142
143
                  },

                  searchKey:{

                      type: String,

                      value: undefined,

                      observer: "_valueChanged"

  

0a87e7be   Luigi Serra   updates
144
145
146
147
148
149
150
151
                  },

                  leftDirection: {

                      type: String,

                      value: undefined

                  },

                  rightDirection: {

                      type: String,

                      value: undefined

0242ec8c   Andrea Petta   plugin update
152
153
154
155
                  },

                  paperfab: {

                      type: Boolean,

                      value: false

15df8c68   Luigi Serra   search bar contro...
156
157
                  }

              },

0a87e7be   Luigi Serra   updates
158
159
160
  

              ready: function(){

  

563db87f   isisadmin   bug fix
161
                 if(this.leftDirection != undefined){

0a87e7be   Luigi Serra   updates
162
163
164
                      this.$.search_text.style.left =  '5px';

                  }else if(this.rightDirection != undefined){

                      this.$.search_text.style.right =  '5px';

0242ec8c   Andrea Petta   plugin update
165
166
                  }else if(this.paperfab != undefined)

                     this.$.search_text.style.right =  '45px';

0a87e7be   Luigi Serra   updates
167
168
  

              },

15df8c68   Luigi Serra   search bar contro...
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
              _toggleClick: function(e){

                  if(this.selected == 0) {

                      this.entryAnimation = 'fade-in-animation';//'slide-from-right-animation';

                      this.exitAnimation = 'fade-out-animation';//'slide-left-animation';

                      this.selected = 1;

                  }else{

                      this.entryAnimation = 'fade-in-animation';//'slide-from-left-animation';

                      this.exitAnimation = 'fade-out-animation';//'slide-right-animation';

                      this.selected = 0;

                  }

              },

              /**

               * Callback related to text change

               *

               * @method _valueChanged

               *

               * @param {Event} e

               */

              _valueChanged : function(oldvalue, newValue){

bcfa69c3   isisadmin   search panel cont...
188
189
                  var t = this;

                  clearTimeout(this.timer);

0242ec8c   Andrea Petta   plugin update
190
191
192
                  this.timer = setTimeout(function(){

                      t.fire('search-panel-controllet_content-changed', {searchKey: t.searchKey, id : t.id})

                  }, 0);

15df8c68   Luigi Serra   search bar contro...
193
194
195
196
197
198
199
200
201
202
203
204
205
206
              },

              /**

               * It returns the value in text area

               *

               * @method getValue

               */

              getValue : function(){

                  return this.$.text.value;

              }

          });

  

      </script>

  

  </dom-module>