Skip to content

Commit 59e92fe

Browse files
committed
bump version to 2.2.7
1 parent 32e8120 commit 59e92fe

24 files changed

+222
-802
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ and load the required script into your html page
9494
<!-- required for number formatting only -->
9595
<script src="numeral.min.js"></script>
9696
<!-- the jquery calx lib -->
97-
<script src="jquery-calx-2.2.5.min.js"></script>
97+
<script src="jquery-calx-2.2.7.min.js"></script>
9898
```
9999

100100
For detailed documentation, [http://www.xsanisty.com/project/calx2](http://www.xsanisty.com/project/calx2).

bower.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
{
22
"name": "jquery-calx",
3-
"version": "2.2.5",
3+
"version": "2.2.7",
44
"authors": [
55
"Xsanisty Developer Team <[email protected]>"
66
],
77
"repo": "xsanisty/jquery-calx",
88
"description": "jQuery plugin for building excel-formula based calculation form",
9-
"main": "jquery-calx-2.2.5.min.js",
10-
"scripts": ["jquery-calx-2.2.5.min.js"],
9+
"main": "jquery-calx-2.2.7.min.js",
10+
"scripts": ["jquery-calx-2.2.7.min.js"],
1111
"moduleType": [
1212
"globals"
1313
],

calx.jquery.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"title": "jQuery Calx",
44
"description": "jQuery plugin for creating calculation form or calculation table with user provided formula",
55
"keywords": ["form", "calculator", "excel", "formula"],
6-
"version": "2.2.5",
6+
"version": "2.2.7",
77
"author": {
88
"name": "Xsanisty Development Team",
99
"url": "http://www.xsanisty.com/"

jquery-calx-2.2.6.js jquery-calx-2.2.7.js

+47-21
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* jQuery Calx 2.2.6
2+
* jQuery Calx 2.2.7
33
*
44
* author : Xsanisty Developer Team <[email protected]>
55
* Ikhsan Agustian <[email protected]>
@@ -29,7 +29,7 @@ if(typeof(jStat) == 'undefined'){
2929
if(typeof($) == 'undefined'){
3030
return false;
3131
}
32-
32+
3333
/************************************************
3434
* Begin of IE Hack *
3535
************************************************/
@@ -5826,7 +5826,7 @@ logical : {
58265826

58275827
},
58285828
geometry : {
5829-
5829+
58305830
},
58315831
text:{
58325832
CONCAT : function(){
@@ -6095,7 +6095,7 @@ logical : {
60956095
}
60966096
},
60976097
trigonometry:{
6098-
6098+
60996099
},
61006100
general: {
61016101

@@ -8546,7 +8546,18 @@ cell.fx.init = function(){
85468546

85478547

85488548
//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);
85508561

85518562
if($.trim($value) != '' && $.isNumeric($value)){
85528563
this.renderComputedValue();
@@ -9102,21 +9113,12 @@ cell.fx.getFormattedValue = function(){
91029113
};/**
91039114
* set cell value and sync it with the bound element, and trigger recalculation on all cell depend to it
91049115
* @param {mixed} value value to be inserted into the cell
9105-
* @param {bool} render render computed value of it's dependant or not
91069116
*/
9107-
cell.fx.setValue = function(value, render){
9117+
cell.fx.setValue = function(value){
91089118

91099119
//console.log('cell[#'+this.sheet.elementId+'!'+this.address+'] : setting value to be : '+value);
91109120

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;
91209122

91219123
if(this.sheet.affectedCell.indexOf(this.address) == -1){
91229124
this.sheet.affectedCell.push(this.address);
@@ -9605,6 +9607,10 @@ sheet.fx.registerCell = function(cell){
96059607
if(typeof cellConfig.formula != 'undefined'){
96069608
cell.setFormula(cellConfig.formula);
96079609
}
9610+
9611+
if(typeof cellConfig.conditional_style != 'undefined'){
9612+
cell.setConditionalStyle(cellConfig.conditional_style);
9613+
}
96089614
}
96099615

96109616
if(this.affectedCell.indexOf(cell.getAddress()) == -1){
@@ -9744,7 +9750,7 @@ sheet.fx.getActiveCell = function(){
97449750
cellValue = currentCell.getValue(),
97459751
cellFormat = currentCell.getFormat();
97469752

9747-
if(cellFormat && cellFormat.indexOf('%') > -1){
9753+
if(cellFormat && cellFormat.indexOf('%') >= 0){
97489754
cellValue = cellValue*100+' %';
97499755
}
97509756

@@ -9768,10 +9774,12 @@ sheet.fx.getActiveCell = function(){
97689774
* update value of the current cell internally
97699775
*/
97709776
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'),
97729779
currentCell = currentSheet.cells[cellAddr],
97739780
oldVal = currentCell.getValue(),
9774-
newVal = currentCell.el.val();
9781+
newVal = currentCell.el.val(),
9782+
cellFormat = currentCell.getFormat();
97759783

97769784
if(currentCell.isCheckbox && currentCell.el.attr('type') == 'checkbox'){
97779785
if(currentCell.el.prop('checked')){
@@ -9799,7 +9807,18 @@ sheet.fx.getActiveCell = function(){
97999807
currentSheet.cells[cellAddr].setValue(uncheckedVal);
98009808
});
98019809
}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);
98039822
}
98049823

98059824
if(oldVal != newVal){
@@ -9918,7 +9937,7 @@ sheet.fx.detachEvent = function(){
99189937
isCalculating : false,
99199938

99209939
/** Calx version */
9921-
version : '2.2.6',
9940+
version : '2.2.7',
99229941

99239942
/** sheets collection */
99249943
sheetRegistry : {},
@@ -10096,6 +10115,13 @@ getCell : function(address){
1009610115
*/
1009710116
getUtility : function(){
1009810117
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;
1009910125
},
1010010126
/**
1010110127
* Evaluate formula specific to the selected sheet,

0 commit comments

Comments
 (0)