rsence-pre 3.0.0.8 → 3.0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/client/conf/client_pkg.yaml +6 -2
- data/client/js/comm/queue/queue.js +32 -44
- data/client/js/comm/transporter/transporter.js +24 -16
- data/client/js/comm/values/values.js +27 -15
- data/client/js/controls/button/button.coffee +14 -5
- data/client/js/controls/button/themes/default/button.css +4 -2
- data/client/js/controls/checkbox/checkbox.js +4 -4
- data/client/js/controls/dialogs/sheet/sheet.js +11 -11
- data/client/js/controls/dialogs/sheet/themes/default/sheet.html +1 -1
- data/client/js/controls/imageview/imageview.js +15 -15
- data/client/js/controls/numerictextcontrol/numerictextcontrol.coffee +32 -10
- data/client/js/controls/onoffbutton/onoffbutton.coffee +5 -5
- data/client/js/controls/progress/progressbar/progressbar.js +6 -7
- data/client/js/controls/progress/progressbar/themes/default/progressbar.css +4 -4
- data/client/js/controls/progress/progressbar/themes/default/progressbar.html +1 -2
- data/client/js/controls/sliders/slider/slider.js +74 -79
- data/client/js/controls/stepper/stepper.js +31 -31
- data/client/js/controls/stringview/stringview.js +20 -8
- data/client/js/controls/tab/tab.js +57 -63
- data/client/js/controls/tab/themes/default/tab.html +4 -1
- data/client/js/controls/textcontrol/textcontrol.coffee +13 -3
- data/client/js/controls/validatorview/validatorview.js +4 -4
- data/client/js/controls/window/window.js +43 -56
- data/client/js/core/class/class.js +25 -23
- data/client/js/core/elem/elem.coffee +8 -1
- data/client/js/core/rsence_ns/rsence_ns.coffee +6 -2
- data/client/js/core/util/util_methods/util_methods.coffee +57 -15
- data/client/js/datetime/calendar/calendar.coffee +196 -199
- data/client/js/datetime/calendar/themes/default/calendar.css +81 -159
- data/client/js/datetime/calendar/themes/default/calendar.html +9 -18
- data/client/js/datetime/datepicker/datepicker.coffee +18 -3
- data/client/js/datetime/datetimepicker/datetimepicker.coffee +6 -1
- data/client/js/datetime/datetimevalue/datetimevalue.coffee +194 -0
- data/client/js/datetime/momentjs/momentjs.js +310 -76
- data/client/js/datetime/timepicker/timepicker.coffee +6 -1
- data/client/js/datetime/timesheet/timesheet.js +59 -61
- data/client/js/foundation/control/control.js +45 -44
- data/client/js/foundation/control/controldefaults/controldefaults.js +13 -9
- data/client/js/foundation/control/dyncontrol/dyncontrol.js +45 -57
- data/client/js/foundation/control/eventresponder/eventresponder.js +97 -97
- data/client/js/foundation/control/valuematrix/valuematrix.js +13 -13
- data/client/js/foundation/eventmanager/eventmanager.coffee +50 -32
- data/client/js/foundation/geom/rect/rect.js +43 -32
- data/client/js/foundation/locale_settings/locale_settings.js +36 -25
- data/client/js/foundation/system/system.js +79 -67
- data/client/js/foundation/thememanager/thememanager.coffee +11 -1
- data/client/js/foundation/value/pullvalue/pullvalue.coffee +7 -0
- data/client/js/foundation/value/pushvalue/pushvalue.coffee +25 -0
- data/client/js/foundation/value/value.js +22 -15
- data/client/js/foundation/view/view.js +94 -55
- data/client/js/foundation/view/viewdefaults/viewdefaults.js +5 -1
- data/client/js/lists/listitems/listitems.js +26 -4
- data/client/js/menus/combobox/combobox.coffee +55 -0
- data/client/js/menus/minimenu/minimenu.js +61 -30
- data/client/js/menus/minimenu/themes/default/minimenu.css +1 -6
- data/client/js/menus/minimenu/themes/default/minimenu.html +5 -4
- data/client/js/menus/minimenuitem/minimenuitem.js +6 -6
- data/client/js/menus/popupmenu/themes/default/popupmenu.css +1 -6
- data/client/js/menus/popupmenu/themes/default/popupmenu.html +5 -4
- data/client/js/tables/table/table.coffee +109 -64
- data/client/js/tables/table/themes/default/table.css +4 -0
- data/lib/rsence/msg.rb +64 -64
- data/lib/rsence/plugins/plugin.rb +68 -52
- data/lib/rsence/session/sequel_sessionstorage.rb +5 -5
- data/lib/rsence/value.rb +79 -59
- data/plugins/client_pkg/lib/client_pkg_build.rb +5 -1
- data/plugins/client_pkg/lib/client_pkg_serve.rb +40 -32
- data/plugins/main/js/main.js +46 -28
- metadata +6 -8
- data/client/js/datetime/calendar/themes/default/calendar_arrows.png +0 -0
- data/client/js/datetime/calendar/themes/default/calendar_bg.png +0 -0
- data/client/js/datetime/calendar/themes/default/calendar_parts1.png +0 -0
- data/client/js/datetime/calendar/themes/default/calendar_parts2.png +0 -0
- data/client/js/datetime/datetimepicker/datetimepicker.js +0 -210
- data/client/js/datetime/datetimevalue/datetimevalue.js +0 -265
@@ -26,6 +26,7 @@ HView = UtilMethods.extend({
|
|
26
26
|
|
27
27
|
isView: true, // attribute to check if the object is a view
|
28
28
|
isCtrl: false, // attribute to check for if the object is a control
|
29
|
+
isDead: false, // attribute to check for killed object references
|
29
30
|
|
30
31
|
/** Component specific theme path.
|
31
32
|
**/
|
@@ -294,13 +295,17 @@ HView = UtilMethods.extend({
|
|
294
295
|
*
|
295
296
|
**/
|
296
297
|
constructor: function(_rect, _parent, _options) {
|
298
|
+
|
299
|
+
// destructable timeouts:
|
300
|
+
this.timeouts = [];
|
301
|
+
|
297
302
|
if( !_options ){
|
298
303
|
_options = {};
|
299
304
|
}
|
300
305
|
if(!this.isinherited){
|
301
306
|
_options = (this.viewDefaults.extend(_options)).nu(this);
|
302
307
|
}
|
303
|
-
|
308
|
+
if( typeof this.customOptions === 'function' ){ this.customOptions( _options ); }
|
304
309
|
this.options = _options;
|
305
310
|
this.label = _options.label;
|
306
311
|
|
@@ -317,7 +322,7 @@ HView = UtilMethods.extend({
|
|
317
322
|
this.preserveTheme = true;
|
318
323
|
}
|
319
324
|
|
320
|
-
if(_options.visible === false) {
|
325
|
+
if(_options.visible === false || _options.hidden === true) {
|
321
326
|
this.isHidden = true;
|
322
327
|
}
|
323
328
|
|
@@ -346,7 +351,7 @@ HView = UtilMethods.extend({
|
|
346
351
|
// deleted from the element manager when the view gets destroyed.
|
347
352
|
this._domElementBindings = [];
|
348
353
|
|
349
|
-
if(!this.isinherited) {
|
354
|
+
if(!this.isinherited && this.options.autoDraw) {
|
350
355
|
this.draw();
|
351
356
|
}
|
352
357
|
},
|
@@ -539,24 +544,6 @@ HView = UtilMethods.extend({
|
|
539
544
|
ELEM.setAttr( this.elemId, 'elem_id', this.elemId, true );
|
540
545
|
},
|
541
546
|
|
542
|
-
/** --
|
543
|
-
* = Description
|
544
|
-
* The _setCSS method does the initial styling of the element.
|
545
|
-
* It's a separate method to ease creating component that require
|
546
|
-
* other initial styles.
|
547
|
-
* ++
|
548
|
-
**/
|
549
|
-
_setCSS: function(_additional){
|
550
|
-
var _cssStyle = 'overflow:hidden;visibility:hidden;';
|
551
|
-
if(this.isAbsolute){
|
552
|
-
_cssStyle += 'position:absolute;';
|
553
|
-
} else {
|
554
|
-
_cssStyle += 'position:relative;';
|
555
|
-
}
|
556
|
-
_cssStyle += _additional;
|
557
|
-
ELEM.setCSS(this.elemId,_cssStyle);
|
558
|
-
},
|
559
|
-
|
560
547
|
/** --
|
561
548
|
* = Description
|
562
549
|
* The _getParentElemId method returns the ELEM ID of the parent.
|
@@ -607,7 +594,12 @@ HView = UtilMethods.extend({
|
|
607
594
|
if(!this.elemId) {
|
608
595
|
|
609
596
|
this._makeElem(this._getParentElemId());
|
610
|
-
|
597
|
+
|
598
|
+
ELEM.setStyle(this.elemId,'overflow','hidden',true);
|
599
|
+
ELEM.setStyle(this.elemId,'visibility','hidden',true);
|
600
|
+
|
601
|
+
if(this.isAbsolute){ ELEM.setStyle(this.elemId,'position','absolute'); }
|
602
|
+
else { ELEM.setStyle(this.elemId,'position','relative'); }
|
611
603
|
|
612
604
|
// Theme name == CSS class name
|
613
605
|
if(this.preserveTheme){
|
@@ -616,6 +608,9 @@ HView = UtilMethods.extend({
|
|
616
608
|
else {
|
617
609
|
ELEM.addClassName( this.elemId, HThemeManager.currentTheme );
|
618
610
|
}
|
611
|
+
if( this.componentName !== undefined ){
|
612
|
+
ELEM.addClassName( this.elemId, this.componentName );
|
613
|
+
}
|
619
614
|
if( this.options.textSelectable !== undefined ){
|
620
615
|
this.textSelectable = this.options.textSelectable;
|
621
616
|
}
|
@@ -730,10 +725,10 @@ HView = UtilMethods.extend({
|
|
730
725
|
ELEM.setStyle( this._ieNoThrough, 'opacity', 0.01 );
|
731
726
|
}
|
732
727
|
if(this.options.style){
|
733
|
-
this.setStyles( this.options.style );
|
728
|
+
this.setStyles( this.options.style ); // optimize
|
734
729
|
}
|
735
730
|
if(this.options.html){
|
736
|
-
this.setHTML(this.options.html);
|
731
|
+
this.setHTML(this.options.html); // optimize
|
737
732
|
}
|
738
733
|
// Extended draw for components to define / extend.
|
739
734
|
// This is preferred over drawSubviews, when defining
|
@@ -757,6 +752,7 @@ HView = UtilMethods.extend({
|
|
757
752
|
this.show();
|
758
753
|
}
|
759
754
|
}
|
755
|
+
_timeI = 10;
|
760
756
|
this.refresh();
|
761
757
|
return this;
|
762
758
|
},
|
@@ -813,32 +809,57 @@ HView = UtilMethods.extend({
|
|
813
809
|
},
|
814
810
|
|
815
811
|
/** = Description
|
816
|
-
* Sets or unsets the
|
817
|
-
*
|
812
|
+
* Sets or unsets the _className into a DOM element that goes by the ID
|
813
|
+
* _elemId.
|
818
814
|
*
|
819
815
|
* = Parameters
|
820
|
-
* +
|
816
|
+
* +_elemId+:: ID of the DOM element, or the element itself, to be
|
821
817
|
* modified.
|
822
|
-
* +
|
823
|
-
* +
|
824
|
-
* removed.
|
818
|
+
* +_className+:: Name of the CSS class to be added or removed.
|
819
|
+
* +_state+:: Boolean value that tells should the CSS class be added or
|
820
|
+
* removed. If undefined or null, toggles the current state.
|
825
821
|
*
|
826
822
|
* = Returns
|
827
823
|
* +self+
|
828
824
|
*
|
829
825
|
**/
|
830
|
-
toggleCSSClass: function(
|
831
|
-
if(
|
832
|
-
if
|
833
|
-
|
826
|
+
toggleCSSClass: function(_elemId, _className, _state) {
|
827
|
+
if(_elemId !== null && _elemId !== undefined) {
|
828
|
+
// if(_elemId == 920){debugger;}
|
829
|
+
if (this.typeChr(_elemId) === 's'){
|
830
|
+
_elemId = this.markupElemIds[_elemId];
|
831
|
+
}
|
832
|
+
if (_state === null || _state === undefined ){
|
833
|
+
_state = !ELEM.hasClassName(_elemId,_className);
|
834
|
+
}
|
835
|
+
if (_state) {
|
836
|
+
ELEM.addClassName(_elemId, _className);
|
834
837
|
}
|
835
838
|
else {
|
836
|
-
ELEM.delClassName(
|
839
|
+
ELEM.delClassName(_elemId, _className);
|
837
840
|
}
|
838
841
|
}
|
839
842
|
return this;
|
840
843
|
},
|
841
844
|
|
845
|
+
setCSSClass: function( _className, _other ){
|
846
|
+
if(_other){
|
847
|
+
this.toggleCSSClass( _className, _other, true );
|
848
|
+
}
|
849
|
+
else{
|
850
|
+
this.toggleCSSClass( this.elemId, _className, true );
|
851
|
+
}
|
852
|
+
},
|
853
|
+
|
854
|
+
unsetCSSClass: function( _className, _other ){
|
855
|
+
if(_other){
|
856
|
+
this.toggleCSSClass( _className, _other, false );
|
857
|
+
}
|
858
|
+
else{
|
859
|
+
this.toggleCSSClass( this.elemId, _className, false );
|
860
|
+
}
|
861
|
+
},
|
862
|
+
|
842
863
|
/** = Description
|
843
864
|
* Replaces the contents of the view's DOM element with custom html.
|
844
865
|
*
|
@@ -918,7 +939,7 @@ HView = UtilMethods.extend({
|
|
918
939
|
if( this.themeStyle !== undefined && typeof this.themeStyle === 'function' ){
|
919
940
|
this.themeStyle.call(this);
|
920
941
|
}
|
921
|
-
if(this.optimizeWidthOnRefresh && this.options.pack) {
|
942
|
+
if(this.optimizeWidthOnRefresh && this.options.pack && this.drawn) {
|
922
943
|
this.optimizeWidth();
|
923
944
|
}
|
924
945
|
return this;
|
@@ -1254,7 +1275,12 @@ HView = UtilMethods.extend({
|
|
1254
1275
|
!this.isProduction && console.log('Warning, setStyleOfPart: partName "'+_partName+'" does not exist for viewId '+this.viewId+'.');
|
1255
1276
|
}
|
1256
1277
|
else {
|
1257
|
-
|
1278
|
+
if( this.typeChr(_name) === 'h'){
|
1279
|
+
ELEM.setStyles(this.markupElemIds[_partName], _name );
|
1280
|
+
}
|
1281
|
+
else{
|
1282
|
+
ELEM.setStyle(this.markupElemIds[_partName], _name, _value, _force);
|
1283
|
+
}
|
1258
1284
|
}
|
1259
1285
|
return this;
|
1260
1286
|
},
|
@@ -1508,14 +1534,24 @@ HView = UtilMethods.extend({
|
|
1508
1534
|
*
|
1509
1535
|
**/
|
1510
1536
|
die: function() {
|
1537
|
+
if(this.isDead && !this.isProduction){
|
1538
|
+
console.warn('double kill!');
|
1539
|
+
return;
|
1540
|
+
}
|
1541
|
+
this.isDead = true;
|
1511
1542
|
// hide self, makes destruction seem faster
|
1512
1543
|
this.hide();
|
1513
1544
|
this.drawn = false;
|
1514
1545
|
this.stopAnimation();
|
1546
|
+
if( this.timeouts ){
|
1547
|
+
while( this.timeouts.length ){ clearTimeout(this.timeouts.pop()); }
|
1548
|
+
delete this.timeouts;
|
1549
|
+
}
|
1515
1550
|
// Delete the children first.
|
1516
1551
|
var _childViewId, i;
|
1517
|
-
if(!this.views
|
1552
|
+
if(!this.views){
|
1518
1553
|
console.log('HView#die: no sub-views for component name: ',this.componentName,', self:',this);
|
1554
|
+
return;
|
1519
1555
|
}
|
1520
1556
|
while (this.views && this.views.length !== 0) {
|
1521
1557
|
_childViewId = this.views[0];
|
@@ -1922,31 +1958,34 @@ HView = UtilMethods.extend({
|
|
1922
1958
|
* +_elemId+:: Optional, The element ID where the temporary string is created
|
1923
1959
|
* in.
|
1924
1960
|
* +_wrap+:: Optional boolean value, wrap white-space?
|
1925
|
-
* +
|
1961
|
+
* +_customStyle+:: Optional, extra css to add.
|
1926
1962
|
*
|
1927
1963
|
* = Returns
|
1928
1964
|
* The width in pixels required to draw a string in the font.
|
1929
1965
|
*
|
1930
1966
|
**/
|
1931
|
-
stringSize: function(_string, _length, _elemId, _wrap,
|
1967
|
+
stringSize: function(_string, _length, _elemId, _wrap, _customStyle) {
|
1968
|
+
if(!_customStyle){_customStyle = {};}
|
1969
|
+
if(this.typeChr(_customStyle) === 's'){
|
1970
|
+
console.warn("#stringSize: use styles instead of css text!");
|
1971
|
+
_customStyle = {};
|
1972
|
+
}
|
1932
1973
|
if (_length || _length === 0) {
|
1933
1974
|
_string = _string.substring(0, _length);
|
1934
1975
|
}
|
1935
1976
|
if (!_elemId && _elemId !== 0) {
|
1936
|
-
_elemId = 0;
|
1937
|
-
}
|
1938
|
-
if (!_extraCss) {
|
1939
|
-
_extraCss = '';
|
1977
|
+
_elemId = 0;
|
1940
1978
|
}
|
1979
|
+
_customStyle.visibility = 'hidden';
|
1941
1980
|
if (!_wrap){
|
1942
|
-
|
1981
|
+
_customStyle.whiteSpace = 'nowrap';
|
1943
1982
|
}
|
1944
1983
|
var
|
1945
1984
|
_stringParent = ELEM.make(_elemId,'div'),
|
1946
1985
|
_stringElem = ELEM.make(_stringParent,'span');
|
1947
|
-
ELEM.
|
1986
|
+
ELEM.setStyles(_stringElem, _customStyle);
|
1948
1987
|
ELEM.setHTML(_stringElem, _string);
|
1949
|
-
ELEM.
|
1988
|
+
ELEM.flushElem([_stringParent,_stringElem]);
|
1950
1989
|
var _visibleSize=ELEM.getSize(_stringElem);
|
1951
1990
|
ELEM.del(_stringElem); ELEM.del(_stringParent);
|
1952
1991
|
return [_visibleSize[0]+_visibleSize[0]%2,_visibleSize[1]+_visibleSize[1]%2];
|
@@ -1954,14 +1993,14 @@ HView = UtilMethods.extend({
|
|
1954
1993
|
|
1955
1994
|
/** Returns the string width
|
1956
1995
|
**/
|
1957
|
-
stringWidth: function(_string, _length, _elemId,
|
1958
|
-
return this.stringSize(_string, _length, _elemId, false,
|
1996
|
+
stringWidth: function(_string, _length, _elemId, _customStyle){
|
1997
|
+
return this.stringSize(_string, _length, _elemId, false, _customStyle)[0];
|
1959
1998
|
},
|
1960
1999
|
|
1961
2000
|
/** Returns the string height.
|
1962
2001
|
**/
|
1963
|
-
stringHeight: function(_string, _length, _elemId,
|
1964
|
-
return this.stringSize(_string, _length, _elemId, true,
|
2002
|
+
stringHeight: function(_string, _length, _elemId, _customStyle){
|
2003
|
+
return this.stringSize(_string, _length, _elemId, true, _customStyle)[1];
|
1965
2004
|
},
|
1966
2005
|
|
1967
2006
|
/** Returns the X coordinate that has the scrolled position calculated.
|
@@ -2068,14 +2107,14 @@ HView = UtilMethods.extend({
|
|
2068
2107
|
* nodes from the cache.
|
2069
2108
|
*
|
2070
2109
|
* = Parameters
|
2071
|
-
* +
|
2110
|
+
* +_elemId+:: The id of the element in the element manager's cache
|
2072
2111
|
* that is to be removed from the cache.
|
2073
2112
|
*
|
2074
2113
|
**/
|
2075
|
-
unbindDomElement: function(
|
2076
|
-
var _indexOfElementId = this._domElementBindings.indexOf(
|
2114
|
+
unbindDomElement: function(_elemId) {
|
2115
|
+
var _indexOfElementId = this._domElementBindings.indexOf(_elemId);
|
2077
2116
|
if (~_indexOfElementId) {
|
2078
|
-
ELEM.del(
|
2117
|
+
ELEM.del(_elemId);
|
2079
2118
|
this._domElementBindings.splice(_indexOfElementId, 1);
|
2080
2119
|
}
|
2081
2120
|
},
|
@@ -5,7 +5,11 @@
|
|
5
5
|
***/
|
6
6
|
var//RSence.Foundation
|
7
7
|
HViewDefaults = HClass.extend({
|
8
|
-
|
8
|
+
|
9
|
+
/** Whether or not to draw when constructed.
|
10
|
+
*/
|
11
|
+
autoDraw: true,
|
12
|
+
|
9
13
|
/** The default label. A label is the "visual value" of a component that
|
10
14
|
* operates on a "hidden" value.
|
11
15
|
**/
|
@@ -17,7 +17,7 @@
|
|
17
17
|
***/
|
18
18
|
var//RSence.Lists
|
19
19
|
HListItems = HValueResponder.extend({
|
20
|
-
|
20
|
+
|
21
21
|
constructor: function( _rect, _parent, _options ){
|
22
22
|
if( _rect.hasAncestor && _rect.hasAncestor( HView ) ){
|
23
23
|
_options = _parent;
|
@@ -43,7 +43,7 @@ HListItems = HValueResponder.extend({
|
|
43
43
|
}
|
44
44
|
}
|
45
45
|
},
|
46
|
-
|
46
|
+
|
47
47
|
die: function() {
|
48
48
|
var _this = this;
|
49
49
|
if(_this.valueObj){
|
@@ -52,7 +52,7 @@ HListItems = HValueResponder.extend({
|
|
52
52
|
}
|
53
53
|
_this.value = null;
|
54
54
|
},
|
55
|
-
|
55
|
+
|
56
56
|
/** = Description
|
57
57
|
* Iterates through this.value array and calls
|
58
58
|
* the setListItems function of the parent class.
|
@@ -82,7 +82,7 @@ HListItemControl = HControl.extend({
|
|
82
82
|
i = 0;
|
83
83
|
for ( ; i < _listItemsIn.length ; i++ ){
|
84
84
|
_row = _listItemsIn[i];
|
85
|
-
_rowType =
|
85
|
+
_rowType = this.typeChr( _row );
|
86
86
|
// console.log('row:',_row,' rowType:',_rowType);
|
87
87
|
// hashes
|
88
88
|
if ( _rowType === 'h' ) {
|
@@ -110,6 +110,28 @@ HListItemControl = HControl.extend({
|
|
110
110
|
return _listItems;
|
111
111
|
},
|
112
112
|
|
113
|
+
isValueInList: function(_value){
|
114
|
+
var i=0, _row, _rowType, _listItems = this.listItems;
|
115
|
+
if(!_listItems){
|
116
|
+
!this.isProduction && console.log("No listItems");
|
117
|
+
return false;
|
118
|
+
}
|
119
|
+
for( ; i<_listItems.length; i++ ){
|
120
|
+
_row = _listItems[i];
|
121
|
+
_rowType = this.typeChr( _row );
|
122
|
+
if( _rowType === 'h' ){
|
123
|
+
if( _row.value === _value ){ return true; }
|
124
|
+
}
|
125
|
+
else if( _rowType === 'a' ){
|
126
|
+
if( _row[0] === _value ){ return true; }
|
127
|
+
}
|
128
|
+
else if( ~['s','n'].indexOf(_rowType) ){
|
129
|
+
if( _row === _value ){ return true; }
|
130
|
+
}
|
131
|
+
}
|
132
|
+
return false;
|
133
|
+
},
|
134
|
+
|
113
135
|
setListItems: function( _listItems ){
|
114
136
|
_listItems = this._cleanListItems(_listItems);
|
115
137
|
}
|
@@ -0,0 +1,55 @@
|
|
1
|
+
HComboBoxInterface =
|
2
|
+
refreshValue: ->
|
3
|
+
@base()
|
4
|
+
if @menu?
|
5
|
+
if @menu.isValueInList(@value)
|
6
|
+
@menu.setValue(@value)
|
7
|
+
else
|
8
|
+
@menu.setValue(@value)
|
9
|
+
@menu.valueMatrix.setValue(-1)
|
10
|
+
drawSubviews: ->
|
11
|
+
@base()
|
12
|
+
@stepper = null
|
13
|
+
@options.withStepper = false
|
14
|
+
_menuOptions = @options.menuOptions
|
15
|
+
_menuOptions.value = @value unless _menuOptions.value
|
16
|
+
_menuOptions.enabled = @enabled
|
17
|
+
_menuOptions.hidden = @isHidden
|
18
|
+
_menuOptions.listItems = [] unless _menuOptions.listItems
|
19
|
+
@menu = HPopupMenu.extend(
|
20
|
+
refreshValue: ->
|
21
|
+
@base()
|
22
|
+
@parent.setValue(@value) unless @parent.value == @value or @value == null
|
23
|
+
_firstRect: true
|
24
|
+
menuItemViewRect: ->
|
25
|
+
if @_firstRect
|
26
|
+
@_firstRect = false
|
27
|
+
return [ -1000, -1000, @parent.rect.width, (@listItems.length or 1)*24 ]
|
28
|
+
w = @parent.rect.width-2
|
29
|
+
[ x, y ] = [ @pageX(), @pageY() ]
|
30
|
+
x += -2 - w + @rect.width
|
31
|
+
if @options.menuBelow
|
32
|
+
y += @parent.rect.height
|
33
|
+
_rect = [ x, y, w, (@listItems.length or 1)*24 ]
|
34
|
+
_rect
|
35
|
+
repositionMenuItems: ->
|
36
|
+
@menuItemView.setRect( @menuItemViewRect() )
|
37
|
+
@menuItemView.drawRect()
|
38
|
+
drawSubviews: ->
|
39
|
+
@base()
|
40
|
+
@setMarkupOfPart('bg','▾')
|
41
|
+
@setStyleOfPart('bg',
|
42
|
+
lineHeight: (@rect.height+2)+'px'
|
43
|
+
verticalAlign: 'middle'
|
44
|
+
borderLeft: '1px solid #ccc'
|
45
|
+
)
|
46
|
+
@refreshValue()
|
47
|
+
).new( [null,-1,14,@rect.height,0,null], @, _menuOptions )
|
48
|
+
@_extraLabelRight += 14
|
49
|
+
if @unitSuffix
|
50
|
+
ELEM.setStyle(@unitSuffix.elemId,'paddingRight','14px')
|
51
|
+
@unitSuffix.drawRect()
|
52
|
+
@setStyleOfPart('label','right',this._extraLabelRight+'px')
|
53
|
+
@menu.bringToFront()
|
54
|
+
HComboBox = HTextControl.extend(HComboBoxInterface)
|
55
|
+
HNumericComboBox = HNumericTextControl.extend(HComboBoxInterface)
|
@@ -5,9 +5,9 @@
|
|
5
5
|
***/
|
6
6
|
var//RSence.Menus
|
7
7
|
HMiniMenu = HRadioButtonList.extend({
|
8
|
-
|
8
|
+
|
9
9
|
componentName: 'minimenu',
|
10
|
-
|
10
|
+
|
11
11
|
defaultEvents: {
|
12
12
|
draggable: true,
|
13
13
|
mouseUp: true,
|
@@ -15,12 +15,25 @@ HMiniMenu = HRadioButtonList.extend({
|
|
15
15
|
resize: true
|
16
16
|
},
|
17
17
|
|
18
|
+
markupElemNames: [ 'bg', 'control', 'label' ],
|
19
|
+
|
20
|
+
controlDefaults: HRadioButtonList.prototype.controlDefaults.extend({
|
21
|
+
itemStyle: {
|
22
|
+
'background-color': '#f6f6f6',
|
23
|
+
'border': '1px solid #999',
|
24
|
+
'overflow': 'auto',
|
25
|
+
'overflow-x': 'hidden',
|
26
|
+
'display': 'none',
|
27
|
+
'opacity': 1
|
28
|
+
}
|
29
|
+
}),
|
30
|
+
|
18
31
|
subComponentHeight: 15,
|
19
32
|
|
20
33
|
resize: function(){
|
21
34
|
this.repositionMenuItems();
|
22
35
|
},
|
23
|
-
|
36
|
+
|
24
37
|
repositionMenuItems: function(){
|
25
38
|
var
|
26
39
|
x = this.pageX(),
|
@@ -55,14 +68,15 @@ HMiniMenu = HRadioButtonList.extend({
|
|
55
68
|
|
56
69
|
click: function(){
|
57
70
|
if(!this.active){return false;}
|
58
|
-
if(
|
71
|
+
if( !this._menuShown || this._menuShowTime+500 > this.msNow() ) {
|
59
72
|
this.menuShow();
|
60
|
-
}
|
73
|
+
}
|
74
|
+
else{
|
61
75
|
this.menuHide();
|
62
76
|
}
|
63
77
|
return false;
|
64
78
|
},
|
65
|
-
|
79
|
+
|
66
80
|
refreshValue: function(){
|
67
81
|
this.base();
|
68
82
|
if(this.listItems && this.listItems.length !== 0 && this.valueMatrix !== undefined ) {
|
@@ -74,19 +88,42 @@ HMiniMenu = HRadioButtonList.extend({
|
|
74
88
|
}
|
75
89
|
}
|
76
90
|
},
|
77
|
-
|
91
|
+
|
92
|
+
_menuShowTime: 0,
|
93
|
+
_menuShown: false,
|
78
94
|
menuShow: function(){
|
95
|
+
if(this._menuShown){
|
96
|
+
return false;
|
97
|
+
}
|
98
|
+
this._menuShown = true;
|
99
|
+
this._menuShowTime = this.msNow();
|
79
100
|
this.repositionMenuItems();
|
80
101
|
if( this._menuItemViewShowPos ){
|
81
102
|
var m = this._menuItemViewShowPos, x=m[0], y=m[1];
|
82
103
|
this.menuItemView.offsetTo( x, y );
|
83
104
|
}
|
84
105
|
this.menuItemView.bringToFront();
|
106
|
+
var _menu = this;
|
107
|
+
this.pushTask( function(){
|
108
|
+
_menu._hideElemId = ELEM.make( 0 );
|
109
|
+
ELEM.setStyles( _menu._hideElemId, {
|
110
|
+
position: 'absolute', left: 0, top: 0, right: 0, bottom: 0//, backgroundColor: '#000', opacity: 0.2
|
111
|
+
} );
|
112
|
+
Event.observe( ELEM.get( _menu._hideElemId ), 'mousedown', function(e){_menu.menuHide();EVENT.mouseDown(e);return false;} );
|
113
|
+
ELEM.setStyle( _menu._hideElemId, 'z-index', ELEM.getStyle(_menu.menuItemView.elemId,'z-index')-1 );
|
114
|
+
} );
|
85
115
|
this.menuItemView.show();
|
86
116
|
return true;
|
87
117
|
},
|
88
|
-
|
118
|
+
|
89
119
|
menuHide: function(){
|
120
|
+
if( this._hideElemId ) {
|
121
|
+
ELEM.del( this._hideElemId );
|
122
|
+
this._hideElemId = null;
|
123
|
+
delete this._hideElemId;
|
124
|
+
}
|
125
|
+
this._menuShown = false;
|
126
|
+
this._menuShowTime = 0;
|
90
127
|
if( this.menuItemView ){
|
91
128
|
if( this._menuItemViewHidePos ){
|
92
129
|
var m = this._menuItemViewHidePos, x=m[0], y=m[1];
|
@@ -96,21 +133,21 @@ HMiniMenu = HRadioButtonList.extend({
|
|
96
133
|
this.menuItemView.hide();
|
97
134
|
}
|
98
135
|
},
|
99
|
-
|
136
|
+
|
100
137
|
startDrag: function(x,y){
|
101
|
-
this.dragStart = [x,y];
|
138
|
+
this.dragStart = [x,y,this.msNow()];
|
102
139
|
if(!this.active){return false;}
|
103
140
|
this.menuShow();
|
104
141
|
return false;
|
105
142
|
},
|
106
|
-
|
143
|
+
|
107
144
|
lostActiveStatus: function(_newActive){
|
108
145
|
if( _newActive && !_newActive.isChildOf( this.menuItemView ) ){
|
109
146
|
this.menuHide();
|
110
147
|
}
|
111
148
|
this.base(_newActive);
|
112
149
|
},
|
113
|
-
|
150
|
+
|
114
151
|
gainedActiveStatus: function(_prevActive){
|
115
152
|
if( _prevActive && _prevActive.isChildOf( this.menuItemView ) ){
|
116
153
|
this.menuHide();
|
@@ -119,8 +156,8 @@ HMiniMenu = HRadioButtonList.extend({
|
|
119
156
|
},
|
120
157
|
|
121
158
|
endDrag: function(x,y){
|
122
|
-
if(
|
123
|
-
(Math.round(this.dragStart[1]*0.2)===Math.round(y*0.2))
|
159
|
+
if(((Math.round(this.dragStart[0]*0.2)===Math.round(x*0.2)) &&
|
160
|
+
(Math.round(this.dragStart[1]*0.2)===Math.round(y*0.2)))
|
124
161
|
){
|
125
162
|
this.menuShow();
|
126
163
|
}
|
@@ -129,8 +166,13 @@ HMiniMenu = HRadioButtonList.extend({
|
|
129
166
|
}
|
130
167
|
return false;
|
131
168
|
},
|
132
|
-
|
169
|
+
|
133
170
|
die: function(){
|
171
|
+
if( this._hideElemId ) {
|
172
|
+
ELEM.del( this._hideElemId );
|
173
|
+
this._hideElemId = null;
|
174
|
+
delete this._hideElemId;
|
175
|
+
}
|
134
176
|
this.valueMatrix = null;
|
135
177
|
var _menuItemView = this.menuItemView;
|
136
178
|
this.base();
|
@@ -142,28 +184,17 @@ HMiniMenu = HRadioButtonList.extend({
|
|
142
184
|
return [ 0-this.rect.width, 0-this.rect.height, this.rect.width, 10 ];
|
143
185
|
},
|
144
186
|
drawSubviews: function(){
|
145
|
-
var
|
146
|
-
itemStyle = {
|
147
|
-
'background-color': '#f6f6f6',
|
148
|
-
'border': '1px solid #999',
|
149
|
-
'overflow': 'auto',
|
150
|
-
'overflow-x': 'hidden',
|
151
|
-
'display': 'none'
|
152
|
-
};
|
153
|
-
if(!BROWSER_TYPE.ie){
|
154
|
-
itemStyle.opacity = 0.9;
|
155
|
-
}
|
156
187
|
this.menuItemView = HView.nu(
|
157
188
|
// [ this.rect.left, this.rect.top, this.rect.width, 10 ],
|
158
189
|
this.menuItemViewRect(),
|
159
190
|
this.app, {
|
160
191
|
visible: false,
|
161
|
-
style: itemStyle,
|
192
|
+
style: this.options.itemStyle,
|
162
193
|
logicParent: this
|
163
194
|
}
|
164
195
|
);
|
165
196
|
},
|
166
|
-
|
197
|
+
|
167
198
|
setListItems: function(_listItems){
|
168
199
|
this.base(_listItems);
|
169
200
|
this.valueMatrix = this.menuItemView.valueMatrix;
|
@@ -173,7 +204,7 @@ HMiniMenu = HRadioButtonList.extend({
|
|
173
204
|
this.menuShow();
|
174
205
|
}
|
175
206
|
},
|
176
|
-
|
207
|
+
|
177
208
|
createComponent: function( i, _label ){
|
178
209
|
return HMiniMenuItem.nu(
|
179
210
|
[ 0, (i*this.subComponentHeight), null, this.subComponentHeight, 0, null ],
|
@@ -182,5 +213,5 @@ HMiniMenu = HRadioButtonList.extend({
|
|
182
213
|
}
|
183
214
|
);
|
184
215
|
}
|
185
|
-
|
216
|
+
|
186
217
|
});
|
@@ -3,8 +3,7 @@
|
|
3
3
|
.minimenu_edge_left,
|
4
4
|
.minimenu_center,
|
5
5
|
.minimenu_edge_right,
|
6
|
-
.minimenu_label
|
7
|
-
.minimenu_antiselect {
|
6
|
+
.minimenu_label {
|
8
7
|
position: absolute;
|
9
8
|
top: 0px; height: 15px;
|
10
9
|
}
|
@@ -57,7 +56,3 @@
|
|
57
56
|
.disabled .minimenu_control {
|
58
57
|
opacity: 0.8;
|
59
58
|
}
|
60
|
-
|
61
|
-
.minimenu_antiselect {
|
62
|
-
left: 0px; right: 0px;
|
63
|
-
}
|
@@ -1,7 +1,8 @@
|
|
1
1
|
<div class="minimenu_control" id="control]I[">
|
2
|
-
<
|
3
|
-
|
4
|
-
|
2
|
+
<span id="bg]I[">
|
3
|
+
<div class="minimenu_edge_left"></div>
|
4
|
+
<div class="minimenu_center"></div>
|
5
|
+
<div class="minimenu_edge_right"></div>
|
6
|
+
</span>
|
5
7
|
<div class="minimenu_label" id="label]I[">#{this.label}</div>
|
6
|
-
<div class="minimenu_antiselect"></div>
|
7
8
|
</div>
|