Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
sdkjs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boris Kocherov
sdkjs
Commits
2d7238f3
Commit
2d7238f3
authored
Aug 04, 2016
by
Alexander.Trofimov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bug 20834
parent
86139e1b
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
199 additions
and
201 deletions
+199
-201
cell/model/FormulaObjects/parserFormula.js
cell/model/FormulaObjects/parserFormula.js
+47
-38
cell/model/FormulaObjects/statisticalFunctions.js
cell/model/FormulaObjects/statisticalFunctions.js
+55
-65
cell/view/CellEditorView.js
cell/view/CellEditorView.js
+95
-96
common/docscoapi.js
common/docscoapi.js
+2
-2
No files found.
cell/model/FormulaObjects/parserFormula.js
View file @
2d7238f3
...
@@ -5275,44 +5275,53 @@ function parseNum( str ) {
...
@@ -5275,44 +5275,53 @@ function parseNum( str ) {
return
!
isNaN
(
str
);
return
!
isNaN
(
str
);
}
}
function
matching
(
x
,
y
,
oper
)
{
function
matching
(
x
,
y
,
operator
)
{
var
res
=
false
,
rS
;
var
res
=
false
,
rS
;
if
(
y
instanceof
cString
)
{
if
(
cElementType
.
string
===
y
.
type
)
{
rS
=
searchRegExp2
(
x
.
value
,
y
.
toString
()
);
y
=
y
.
toString
();
switch
(
oper
)
{
if
(
''
===
y
)
{
case
"
<>
"
:
// Empty compare string
res
=
!
rS
;
rS
=
(
cElementType
.
empty
===
x
.
type
);
break
;
}
else
{
case
"
=
"
:
// Equal only string values
default
:
rS
=
(
cElementType
.
string
===
x
.
type
)
?
searchRegExp2
(
x
.
value
,
y
)
:
false
;
res
=
rS
;
}
break
;
}
switch
(
operator
)
{
}
else
if
(
typeof
x
===
typeof
y
)
{
case
"
<>
"
:
switch
(
oper
)
{
res
=
!
rS
;
case
"
<>
"
:
break
;
res
=
(
x
.
value
!=
y
.
value
);
case
"
=
"
:
break
;
default
:
case
"
>
"
:
res
=
rS
;
res
=
(
x
.
value
>
y
.
value
);
break
;
break
;
}
case
"
<
"
:
}
else
{
res
=
(
x
.
value
<
y
.
value
);
rS
=
(
x
.
type
===
y
.
type
);
break
;
switch
(
operator
)
{
case
"
>=
"
:
case
"
<>
"
:
res
=
(
x
.
value
>=
y
.
value
);
res
=
!
rS
||
(
x
.
value
!=
y
.
value
);
break
;
break
;
case
"
<=
"
:
case
"
>
"
:
res
=
(
x
.
value
<=
y
.
value
);
res
=
rS
&&
(
x
.
value
>
y
.
value
);
break
;
break
;
case
"
=
"
:
case
"
<
"
:
default
:
res
=
rS
&&
(
x
.
value
<
y
.
value
);
res
=
(
x
.
value
==
y
.
value
);
break
;
break
;
case
"
>=
"
:
}
res
=
rS
&&
(
x
.
value
>=
y
.
value
);
}
break
;
return
res
;
case
"
<=
"
:
}
res
=
rS
&&
(
x
.
value
<=
y
.
value
);
break
;
case
"
=
"
:
default
:
res
=
(
x
.
value
==
y
.
value
);
break
;
}
}
return
res
;
}
function
GetDiffDate360
(
nDay1
,
nMonth1
,
nYear1
,
nDay2
,
nMonth2
,
nYear2
,
bUSAMethod
)
{
function
GetDiffDate360
(
nDay1
,
nMonth1
,
nYear1
,
nDay2
,
nMonth2
,
nYear2
,
bUSAMethod
)
{
var
nDayDiff
;
var
nDayDiff
;
...
...
cell/model/FormulaObjects/statisticalFunctions.js
View file @
2d7238f3
...
@@ -1145,81 +1145,71 @@ cCOUNTBLANK.prototype.getInfo = function () {
...
@@ -1145,81 +1145,71 @@ cCOUNTBLANK.prototype.getInfo = function () {
};
};
};
};
function
cCOUNTIF
()
{
function
cCOUNTIF
()
{
// cBaseFunction.call( this, "COUNTIF" );
this
.
name
=
"
COUNTIF
"
;
// this.setArgumentsMin( 2 );
this
.
type
=
cElementType
.
func
;
// this.setArgumentsMax( 2 );
this
.
value
=
null
;
this
.
argumentsMin
=
2
;
this
.
name
=
"
COUNTIF
"
;
this
.
argumentsCurrent
=
0
;
this
.
type
=
cElementType
.
func
;
this
.
argumentsMax
=
2
;
this
.
value
=
null
;
this
.
formatType
=
{
this
.
argumentsMin
=
2
;
def
:
-
1
,
//подразумевается формат первой ячейки входящей в формулу.
this
.
argumentsCurrent
=
0
;
noneFormat
:
-
2
this
.
argumentsMax
=
2
;
};
this
.
formatType
=
{
this
.
numFormat
=
this
.
formatType
.
def
;
def
:
-
1
,
//подразумевается формат первой ячейки входящей в формулу.
noneFormat
:
-
2
};
this
.
numFormat
=
this
.
formatType
.
def
;
}
cCOUNTIF
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
);
cCOUNTIF
.
prototype
.
Calculate
=
function
(
arg
)
{
var
arg0
=
arg
[
0
],
arg1
=
arg
[
1
],
_count
=
0
,
valueForSearching
;
if
(
!
(
arg0
instanceof
cRef
||
arg0
instanceof
cRef3D
||
arg0
instanceof
cArea
||
arg0
instanceof
cArea3D
)
)
{
return
this
.
value
=
new
cError
(
cErrorType
.
wrong_value_type
);
}
}
if
(
arg1
instanceof
cArea
||
arg1
instanceof
cArea3D
)
{
cCOUNTIF
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
);
arg1
=
arg1
.
cross
(
arguments
[
1
].
first
);
cCOUNTIF
.
prototype
.
Calculate
=
function
(
arg
)
{
}
var
arg0
=
arg
[
0
],
arg1
=
arg
[
1
],
_count
=
0
,
valueForSearching
;
else
if
(
arg1
instanceof
cArray
)
{
if
(
!
(
arg0
instanceof
cRef
||
arg0
instanceof
cRef3D
||
arg0
instanceof
cArea
||
arg0
instanceof
cArea3D
))
{
arg1
=
arg1
.
getElementRowCol
(
0
,
0
);
return
this
.
value
=
new
cError
(
cErrorType
.
wrong_value_type
);
}
}
if
(
arg1
instanceof
cArea
||
arg1
instanceof
cArea3D
)
{
arg1
=
arg1
.
cross
(
arguments
[
1
].
first
);
}
else
if
(
arg1
instanceof
cArray
)
{
arg1
=
arg1
.
getElementRowCol
(
0
,
0
);
}
arg1
=
arg1
.
tocString
();
arg1
=
arg1
.
tocString
();
if
(
!
(
arg1
instanceof
cString
)
)
{
if
(
!
(
arg1
instanceof
cString
)
)
{
return
this
.
value
=
new
cError
(
cErrorType
.
wrong_value_type
);
return
this
.
value
=
new
cError
(
cErrorType
.
wrong_value_type
);
}
}
arg1
=
arg1
.
toString
();
arg1
=
arg1
.
toString
();
var
operators
=
new
RegExp
(
"
^ *[<=> ]+ *
"
),
search
,
oper
,
val
,
var
operators
=
new
RegExp
(
"
^ *[<=> ]+ *
"
),
search
,
oper
,
val
,
match
=
arg1
.
match
(
operators
);
match
=
arg1
.
match
(
operators
);
if
(
match
)
{
if
(
match
)
{
search
=
arg1
.
substr
(
match
[
0
].
length
);
search
=
arg1
.
substr
(
match
[
0
].
length
);
oper
=
match
[
0
].
replace
(
/
\s
/g
,
""
);
oper
=
match
[
0
].
replace
(
/
\s
/g
,
""
);
}
}
else
{
else
{
search
=
arg1
;
search
=
arg1
;
}
}
valueForSearching
=
parseNum
(
search
)
?
new
cNumber
(
search
)
:
new
cString
(
search
);
valueForSearching
=
parseNum
(
search
)
?
new
cNumber
(
search
)
:
new
cString
(
search
);
if
(
arg0
instanceof
cArea
)
{
if
(
arg0
instanceof
cArea
)
{
arg0
.
foreach2
(
function
(
_val
)
{
arg0
.
foreach2
(
function
(
_val
)
{
_count
+=
matching
(
_val
,
valueForSearching
,
oper
);
_count
+=
matching
(
_val
,
valueForSearching
,
oper
);
})
}
)
}
else
if
(
arg0
instanceof
cArea3D
)
{
}
val
=
arg0
.
getValue
();
else
if
(
arg0
instanceof
cArea3D
)
{
for
(
var
i
=
0
;
i
<
val
.
length
;
i
++
)
{
val
=
arg0
.
getValue
();
_count
+=
matching
(
val
[
i
],
valueForSearching
,
oper
);
for
(
var
i
=
0
;
i
<
val
.
length
;
i
++
)
{
}
_count
+=
matching
(
val
[
i
],
valueForSearching
,
oper
);
}
else
{
val
=
arg0
.
getValue
();
_count
+=
matching
(
val
,
valueForSearching
,
oper
);
}
}
}
else
{
val
=
arg0
.
getValue
();
_count
+=
matching
(
val
,
valueForSearching
,
oper
);
}
return
this
.
value
=
new
cNumber
(
_count
);
return
this
.
value
=
new
cNumber
(
_count
);
};
};
cCOUNTIF
.
prototype
.
getInfo
=
function
()
{
cCOUNTIF
.
prototype
.
getInfo
=
function
()
{
return
{
return
{
name
:
this
.
name
,
name
:
this
.
name
,
args
:
"
( cell-range, selection-criteria )
"
args
:
"
( cell-range, selection-criteria )
"
};
};
};
};
function
cCOUNTIFS
()
{
function
cCOUNTIFS
()
{
cBaseFunction
.
call
(
this
,
"
COUNTIFS
"
);
cBaseFunction
.
call
(
this
,
"
COUNTIFS
"
);
...
...
cell/view/CellEditorView.js
View file @
2d7238f3
This diff is collapsed.
Click to expand it.
common/docscoapi.js
View file @
2d7238f3
...
@@ -1277,8 +1277,7 @@
...
@@ -1277,8 +1277,7 @@
//TODO: add checks and error handling
//TODO: add checks and error handling
//Get data type
//Get data type
var
dataObject
=
JSON
.
parse
(
e
.
data
);
var
dataObject
=
JSON
.
parse
(
e
.
data
);
var
type
=
dataObject
[
'
type
'
];
switch
(
dataObject
[
'
type
'
])
{
switch
(
type
)
{
case
'
auth
'
:
case
'
auth
'
:
t
.
_onAuth
(
dataObject
);
t
.
_onAuth
(
dataObject
);
break
;
break
;
...
@@ -1325,6 +1324,7 @@
...
@@ -1325,6 +1324,7 @@
break
;
break
;
case
'
license
'
:
case
'
license
'
:
t
.
_onLicense
(
dataObject
);
t
.
_onLicense
(
dataObject
);
break
;
}
}
};
};
sockjs
.
onclose
=
function
(
evt
)
{
sockjs
.
onclose
=
function
(
evt
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment