1
1
/**
2
- * jQuery Calx 2.2.6
2
+ * jQuery Calx 2.2.7
3
3
*
4
4
* author : Xsanisty Developer Team <[email protected] >
5
5
* Ikhsan Agustian <[email protected] >
@@ -29,7 +29,7 @@ if(typeof(jStat) == 'undefined'){
29
29
if ( typeof ( $ ) == 'undefined' ) {
30
30
return false ;
31
31
}
32
-
32
+
33
33
/************************************************
34
34
* Begin of IE Hack *
35
35
************************************************/
@@ -5826,7 +5826,7 @@ logical : {
5826
5826
5827
5827
} ,
5828
5828
geometry : {
5829
-
5829
+
5830
5830
} ,
5831
5831
text :{
5832
5832
CONCAT : function ( ) {
@@ -6095,7 +6095,7 @@ logical : {
6095
6095
}
6096
6096
} ,
6097
6097
trigonometry :{
6098
-
6098
+
6099
6099
} ,
6100
6100
general : {
6101
6101
@@ -8546,7 +8546,18 @@ cell.fx.init = function(){
8546
8546
8547
8547
8548
8548
//console.log('cell[#'+this.sheet.elementId+'!'+$address+'] : Initializing the cell');
8549
- this . setValue ( $value ) ;
8549
+ if ( $format && typeof ( numeral ) != 'undefined' && $ . trim ( $value ) !== '' ) {
8550
+ rawValue = numeral ( ) . unformat ( $value ) ;
8551
+
8552
+ if ( $format . indexOf ( '%' ) > - 1 && ( $value ) . indexOf ( '%' ) == - 1 ) {
8553
+ rawValue = rawValue / 100 ;
8554
+
8555
+ }
8556
+ } else {
8557
+ rawValue = ( $ . isNumeric ( $value ) ) ? parseFloat ( $value ) : $value ;
8558
+ }
8559
+
8560
+ this . setValue ( rawValue ) ;
8550
8561
8551
8562
if ( $ . trim ( $value ) != '' && $ . isNumeric ( $value ) ) {
8552
8563
this . renderComputedValue ( ) ;
@@ -9102,21 +9113,12 @@ cell.fx.getFormattedValue = function(){
9102
9113
} ; /**
9103
9114
* set cell value and sync it with the bound element, and trigger recalculation on all cell depend to it
9104
9115
* @param {mixed } value value to be inserted into the cell
9105
- * @param {bool } render render computed value of it's dependant or not
9106
9116
*/
9107
- cell . fx . setValue = function ( value , render ) {
9117
+ cell . fx . setValue = function ( value ) {
9108
9118
9109
9119
//console.log('cell[#'+this.sheet.elementId+'!'+this.address+'] : setting value to be : '+value);
9110
9120
9111
- if ( this . format && typeof ( numeral ) != 'undefined' && $ . trim ( value ) !== '' ) {
9112
- this . value = numeral ( ) . unformat ( value + '' ) ;
9113
-
9114
- if ( this . format . indexOf ( '%' ) > - 1 && ( value + '' ) . indexOf ( '%' ) == - 1 ) {
9115
- this . value = this . value / 100 ;
9116
- }
9117
- } else {
9118
- this . value = ( $ . isNumeric ( value ) ) ? parseFloat ( value ) : value ;
9119
- }
9121
+ this . value = value ;
9120
9122
9121
9123
if ( this . sheet . affectedCell . indexOf ( this . address ) == - 1 ) {
9122
9124
this . sheet . affectedCell . push ( this . address ) ;
@@ -9605,6 +9607,10 @@ sheet.fx.registerCell = function(cell){
9605
9607
if ( typeof cellConfig . formula != 'undefined' ) {
9606
9608
cell . setFormula ( cellConfig . formula ) ;
9607
9609
}
9610
+
9611
+ if ( typeof cellConfig . conditional_style != 'undefined' ) {
9612
+ cell . setConditionalStyle ( cellConfig . conditional_style ) ;
9613
+ }
9608
9614
}
9609
9615
9610
9616
if ( this . affectedCell . indexOf ( cell . getAddress ( ) ) == - 1 ) {
@@ -9744,7 +9750,7 @@ sheet.fx.getActiveCell = function(){
9744
9750
cellValue = currentCell . getValue ( ) ,
9745
9751
cellFormat = currentCell . getFormat ( ) ;
9746
9752
9747
- if ( cellFormat && cellFormat . indexOf ( '%' ) > - 1 ) {
9753
+ if ( cellFormat && cellFormat . indexOf ( '%' ) >= 0 ) {
9748
9754
cellValue = cellValue * 100 + ' %' ;
9749
9755
}
9750
9756
@@ -9768,10 +9774,12 @@ sheet.fx.getActiveCell = function(){
9768
9774
* update value of the current cell internally
9769
9775
*/
9770
9776
this . el . on ( 'calx.setValue' , 'input[data-cell], select[data-cell]' , function ( ) {
9771
- var cellAddr = $ ( this ) . attr ( 'data-cell' ) ,
9777
+ var element = $ ( this ) ,
9778
+ cellAddr = element . attr ( 'data-cell' ) ,
9772
9779
currentCell = currentSheet . cells [ cellAddr ] ,
9773
9780
oldVal = currentCell . getValue ( ) ,
9774
- newVal = currentCell . el . val ( ) ;
9781
+ newVal = currentCell . el . val ( ) ,
9782
+ cellFormat = currentCell . getFormat ( ) ;
9775
9783
9776
9784
if ( currentCell . isCheckbox && currentCell . el . attr ( 'type' ) == 'checkbox' ) {
9777
9785
if ( currentCell . el . prop ( 'checked' ) ) {
@@ -9799,7 +9807,18 @@ sheet.fx.getActiveCell = function(){
9799
9807
currentSheet . cells [ cellAddr ] . setValue ( uncheckedVal ) ;
9800
9808
} ) ;
9801
9809
} else {
9802
- currentCell . setValue ( newVal ) ;
9810
+ if ( cellFormat && typeof ( numeral ) != 'undefined' && $ . trim ( newVal ) !== '' ) {
9811
+ rawValue = numeral ( ) . unformat ( newVal ) ;
9812
+
9813
+ if ( cellFormat . indexOf ( '%' ) > - 1 && ( newVal ) . indexOf ( '%' ) == - 1 ) {
9814
+ rawValue = rawValue / 100 ;
9815
+
9816
+ }
9817
+ } else {
9818
+ rawValue = ( $ . isNumeric ( newVal ) ) ? parseFloat ( newVal ) : newVal ;
9819
+ }
9820
+
9821
+ currentCell . setValue ( rawValue ) ;
9803
9822
}
9804
9823
9805
9824
if ( oldVal != newVal ) {
@@ -9918,7 +9937,7 @@ sheet.fx.detachEvent = function(){
9918
9937
isCalculating : false ,
9919
9938
9920
9939
/** Calx version */
9921
- version : '2.2.6 ' ,
9940
+ version : '2.2.7 ' ,
9922
9941
9923
9942
/** sheets collection */
9924
9943
sheetRegistry : { } ,
@@ -10096,6 +10115,13 @@ getCell : function(address){
10096
10115
*/
10097
10116
getUtility : function ( ) {
10098
10117
return utility ;
10118
+ } ,
10119
+ /**
10120
+ * Get the full forula set object in case its needed
10121
+ * @return {object } formula object
10122
+ */
10123
+ getFormula : function ( ) {
10124
+ return formula ;
10099
10125
} ,
10100
10126
/**
10101
10127
* Evaluate formula specific to the selected sheet,
0 commit comments