uil 0.1.0 → 4.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,261 +0,0 @@
1
- import { Tools } from '../core/Tools';
2
- import { Proto } from '../core/Proto';
3
-
4
- function Slide ( o ){
5
-
6
- Proto.call( this, o );
7
-
8
- this.setTypeNumber( o );
9
-
10
- this.stype = o.stype || 0;
11
- this.buttonColor = o.bColor || Tools.colors.button;
12
-
13
- //this.old = this.value;
14
- this.isDown = false;
15
- this.isOver = false;
16
- this.allway = o.allway || false;
17
-
18
- this.c[2] = Tools.dom( 'div', Tools.css.txtselect + 'letter-spacing:-1px; padding:2px 5px; text-align:right; cursor:pointer; width:47px; border:none; color:'+ this.fontColor );
19
- this.c[3] = Tools.dom( 'div', Tools.css.basic + 'pointer-events:auto; cursor:w-resize; top:0; height:'+this.h+'px;' );
20
- this.c[4] = Tools.dom( 'div', Tools.css.basic + 'border:1px solid '+Tools.colors.border+'; pointer-events:none; background:rgba(0,0,0,0.3); top:2px; height:'+(this.h-4)+'px;' );
21
- this.c[5] = Tools.dom( 'div', Tools.css.basic + 'left:4px; top:5px; height:'+(this.h-10)+'px; background:' + this.fontColor +';' );
22
-
23
- this.c[2].name = 'text';
24
- this.c[3].name = 'scroll';
25
-
26
- if(this.stype !== 0){
27
- if(this.stype === 1 || this.stype === 3){
28
- var h1 = 4;
29
- var h2 = 8;
30
- var ww = this.h-4;
31
- var ra = 20;
32
- }
33
-
34
- if(this.stype === 2){
35
- h1 = 2;
36
- h2 = 4;
37
- ra = 2;
38
- ww = (this.h-4)*0.5
39
- }
40
-
41
- if(this.stype === 3) this.c[5].style.visible = 'none';
42
-
43
- this.c[4].style.borderRadius = h1 + 'px';
44
- this.c[4].style.height = h2 + 'px';
45
- this.c[4].style.top = (this.h*0.5) - h1 + 'px';
46
- this.c[5].style.borderRadius = (h1*0.5) + 'px';
47
- this.c[5].style.height = h1 + 'px';
48
- this.c[5].style.top = (this.h*0.5)-(h1*0.5) + 'px';
49
-
50
- this.c[6] = Tools.dom( 'div', Tools.css.basic + 'border-radius:'+ra+'px; margin-left:'+(-ww*0.5)+'px; border:1px solid '+Tools.colors.border+'; background:'+this.buttonColor+'; left:4px; top:2px; height:'+(this.h-4)+'px; width:'+ww+'px;' );
51
- }
52
-
53
- this.c[3].events = [ 'mouseover', 'mousedown', 'mouseout' ];
54
- this.c[2].events = [ 'keydown', 'keyup', 'mousedown', 'blur', 'focus' ];
55
-
56
- this.init();
57
-
58
- };
59
-
60
- Slide.prototype = Object.create( Proto.prototype );
61
- Slide.prototype.constructor = Slide;
62
-
63
- Slide.prototype.handleEvent = function( e ) {
64
-
65
- //e.preventDefault();
66
-
67
- //console.log(e.target.name)
68
-
69
- switch( e.type ) {
70
- case 'mouseover': this.over( e ); break;
71
- case 'mousedown': e.target.name === 'text' ? this.textdown( e ) : this.down( e ); break;
72
- case 'mouseout': this.out( e ); break;
73
-
74
- case 'mouseup': this.up( e ); break;
75
- case 'mousemove': if(this.isDown) this.move( e ); break;
76
-
77
- case 'blur': this.blur( e ); break;
78
- case 'focus': this.focus( e ); break;
79
- case 'keydown': this.keydown( e ); break;
80
- case 'keyup': this.keyup( e ); break;
81
- }
82
-
83
- };
84
-
85
- Slide.prototype.mode = function( mode ){
86
-
87
- var s = this.s;
88
-
89
- switch(mode){
90
- case 0: // base
91
- s[2].color = this.fontColor;
92
- s[4].background = 'rgba(0,0,0,0.3)';
93
- s[5].background = this.fontColor;
94
- break;
95
- case 1: // over
96
- s[2].color = this.colorPlus;
97
- // if( !s[6] ) s[4].background = UIL.SlideBG;
98
- // else
99
- s[4].background = 'rgba(0,0,0,0.6)';
100
- s[5].background = this.colorPlus;
101
- break;
102
- }
103
- }
104
-
105
- Slide.prototype.over = function( e ){
106
-
107
- e.preventDefault();
108
- e.stopPropagation();
109
-
110
- this.isOver = true;
111
- this.mode(1);
112
-
113
- };
114
-
115
- Slide.prototype.out = function( e ){
116
-
117
- e.preventDefault();
118
- e.stopPropagation();
119
-
120
- this.isOver = false;
121
- if(this.isDown) return;
122
- this.mode(0);
123
-
124
- };
125
-
126
- Slide.prototype.up = function( e ){
127
-
128
- e.preventDefault();
129
- e.stopPropagation();
130
-
131
- this.isDown = false;
132
- document.removeEventListener( 'mouseup', this, false );
133
- document.removeEventListener( 'mousemove', this, false );
134
-
135
- if(this.isOver) this.mode(1);
136
- else this.mode(0);
137
-
138
- this.sendEnd();
139
-
140
- };
141
-
142
- Slide.prototype.down = function( e ){
143
-
144
- e.preventDefault();
145
- e.stopPropagation();
146
-
147
- this.isDown = true;
148
- document.addEventListener( 'mouseup', this, false );
149
- document.addEventListener( 'mousemove', this, false );
150
-
151
- this.left = this.c[3].getBoundingClientRect().left;
152
- this.old = this.value;
153
- this.move( e );
154
-
155
- };
156
-
157
- Slide.prototype.move = function( e ){
158
-
159
- var n = ((( e.clientX - this.left - 3 ) / this.w ) * this.range + this.min ) - this.old;
160
- if(n >= this.step || n <= this.step){
161
- n = ~~ ( n / this.step );
162
- this.value = this.numValue( this.old + ( n * this.step ) );
163
- this.update( true );
164
- this.old = this.value;
165
- }
166
-
167
- };
168
-
169
- Slide.prototype.update = function( up ){
170
-
171
- var ww = this.w * (( this.value - this.min ) / this.range );
172
-
173
- if(this.stype !== 3) this.s[5].width = ~~ ww + 'px';
174
- if(this.s[6]) this.s[6].left = ~~ (this.sa +ww + 3) + 'px';
175
- this.c[2].textContent = this.value;
176
-
177
- if( up ) this.send();
178
-
179
- };
180
-
181
- Slide.prototype.rSize = function(){
182
-
183
- Proto.prototype.rSize.call( this );
184
-
185
- var w = this.sb - this.sc;
186
- this.w = w - 6;
187
-
188
- var tx = this.sc;
189
- if(this.isUI || !this.simple) tx = this.sc+10;
190
-
191
- var ty = ~~(this.h * 0.5) - 8;
192
-
193
- var s = this.s;
194
-
195
- s[2].width = (this.sc -2 )+ 'px';
196
- s[2].left = (this.width - tx +2) + 'px';
197
- s[2].top = ty + 'px';
198
- s[3].left = this.sa + 'px';
199
- s[3].width = w + 'px';
200
- s[4].left = this.sa + 'px';
201
- s[4].width = w + 'px';
202
- s[5].left = (this.sa + 3) + 'px';
203
-
204
- this.update();
205
-
206
- };
207
-
208
- // text
209
-
210
- Slide.prototype.validate = function( e ){
211
-
212
- if(!isNaN( this.c[2].textContent )){
213
- this.value = this.numValue( this.c[2].textContent );
214
- this.update(true);
215
- }
216
- else this.c[2].textContent = this.value;
217
-
218
- };
219
-
220
- Slide.prototype.textdown = function( e ){
221
-
222
- e.target.contentEditable = true;
223
- e.target.focus();
224
- this.isEdit = true;
225
-
226
- };
227
-
228
- Slide.prototype.keydown = function( e ){
229
-
230
- e.stopPropagation();
231
-
232
- if( e.keyCode === 13 ){
233
- e.preventDefault();
234
- this.validate();
235
- e.target.blur();
236
- }
237
-
238
- };
239
-
240
- Slide.prototype.keyup = function( e ){
241
-
242
- e.stopPropagation();
243
- if( this.allway ) this.validate();
244
-
245
- };
246
-
247
- Slide.prototype.blur = function( e ){
248
-
249
- e.target.style.border = 'none';
250
- e.target.contentEditable = false;
251
- this.isEdit = false;
252
-
253
- };
254
-
255
- Slide.prototype.focus = function( e ){
256
-
257
- e.target.style.border = '1px dashed ' + Tools.colors.borderSelect;
258
-
259
- };
260
-
261
- export { Slide };
@@ -1,91 +0,0 @@
1
- import { Tools } from '../core/Tools';
2
- import { Proto } from '../core/Proto';
3
-
4
- function TextInput( o ){
5
-
6
- Proto.call( this, o );
7
-
8
- this.value = o.value || '';
9
- this.allway = o.allway || false;
10
-
11
- this.c[2] = Tools.dom( 'div', Tools.css.txtselect );
12
- this.c[2].name = 'input';
13
- //this.c[2].style.color = ;
14
- this.c[2].textContent = this.value;
15
-
16
- this.c[2].events = [ 'mousedown', 'keydown', 'keyup', 'blur', 'focus' ];
17
-
18
- this.init();
19
-
20
- };
21
-
22
- TextInput.prototype = Object.create( Proto.prototype );
23
- TextInput.prototype.constructor = TextInput;
24
-
25
- TextInput.prototype.handleEvent = function( e ) {
26
-
27
- switch( e.type ) {
28
- case 'mousedown': this.down( e ); break;
29
- case 'blur': this.blur( e ); break;
30
- case 'focus': this.focus( e ); break
31
- case 'keydown': this.keydown( e ); break;
32
- case 'keyup': this.keyup( e ); break;
33
- }
34
-
35
- };
36
-
37
- TextInput.prototype.down = function( e ){
38
-
39
- e.target.contentEditable = true;
40
- e.target.focus();
41
- e.target.style.cursor = 'auto';
42
-
43
- };
44
-
45
- TextInput.prototype.blur = function( e ){
46
-
47
- e.target.style.borderColor = Tools.colors.border;
48
- e.target.contentEditable = false;
49
-
50
- };
51
-
52
- TextInput.prototype.focus = function( e ){
53
-
54
- e.target.style.borderColor = Tools.colors.borderSelect;
55
-
56
- };
57
-
58
- TextInput.prototype.keydown = function( e ){
59
-
60
- e.stopPropagation();
61
-
62
- if( e.keyCode === 13 ){
63
- e.preventDefault();
64
- this.value = e.target.textContent;
65
- e.target.blur();
66
- this.send();
67
- }
68
-
69
- };
70
-
71
- TextInput.prototype.keyup = function( e ){
72
-
73
- e.stopPropagation();
74
-
75
- this.value = e.target.textContent;
76
- if( this.allway ) this.send();
77
-
78
- };
79
-
80
- TextInput.prototype.rSize = function(){
81
-
82
- Proto.prototype.rSize.call( this );
83
- this.s[2].color = this.fontColor;
84
- this.s[2].left = this.sa + 'px';
85
- this.s[2].width = this.sb + 'px';
86
- this.s[2].height = this.h -4 + 'px';
87
- this.s[2].lineHeight = this.h - 8 + 'px';
88
-
89
- };
90
-
91
- export { TextInput };
@@ -1,52 +0,0 @@
1
- import { Tools } from '../core/Tools';
2
- import { Proto } from '../core/Proto';
3
-
4
- function Title ( o ){
5
-
6
- Proto.call( this, o );
7
-
8
- //var id = o.id || 0;
9
- var prefix = o.prefix || '';
10
-
11
- this.c[2] = Tools.dom( 'div', Tools.css.txt + 'text-align:right; width:60px; line-height:'+ (this.h-8) + 'px; color:' + this.fontColor );
12
-
13
- if( this.h === 31 ){
14
-
15
- this.s[0].height = this.h + 'px';
16
- this.s[1].top = 8 + 'px';
17
- this.c[2].style.top = 8 + 'px';
18
-
19
- }
20
-
21
- this.c[1].textContent = this.txt.substring(0,1).toUpperCase() + this.txt.substring(1).replace("-", " ");
22
- this.c[2].textContent = prefix;
23
-
24
- this.init();
25
-
26
- };
27
-
28
- Title.prototype = Object.create( Proto.prototype );
29
- Title.prototype.constructor = Title;
30
-
31
-
32
- Title.prototype.rSize = function(){
33
-
34
- Proto.prototype.rSize.call( this );
35
- this.s[1].width = this.width-50 + 'px';
36
- this.s[2].left = this.width-(50+26) + 'px';
37
-
38
- };
39
-
40
- Title.prototype.text = function(txt){
41
-
42
- this.c[1].textContent = txt;
43
-
44
- };
45
-
46
- Title.prototype.text2 = function(txt){
47
-
48
- this.c[2].textContent = txt;
49
-
50
- };
51
-
52
- export { Title };