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
03ac22a2
Commit
03ac22a2
authored
May 16, 2016
by
Alexander.Trofimov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
support cellIs in conditions formatting
parent
c3de53f7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
79 additions
and
18 deletions
+79
-18
cell/model/ConditionalFormatting.js
cell/model/ConditionalFormatting.js
+53
-0
cell/model/Serialize.js
cell/model/Serialize.js
+2
-1
cell/model/Workbook.js
cell/model/Workbook.js
+24
-17
No files found.
cell/model/ConditionalFormatting.js
View file @
03ac22a2
...
...
@@ -138,6 +138,48 @@
}
return
{
start
:
start
,
end
:
end
};
};
CConditionalFormattingRule
.
prototype
.
cellIs
=
function
(
val
,
v1
,
v2
)
{
var
res
=
false
;
switch
(
this
.
operator
)
{
case
AscCommonExcel
.
ECfOperator
.
Operator_beginsWith
:
res
=
val
.
endsWith
(
v1
);
break
;
case
AscCommonExcel
.
ECfOperator
.
Operator_between
:
res
=
v1
<=
val
&&
val
<=
v2
;
break
;
case
AscCommonExcel
.
ECfOperator
.
Operator_containsText
:
res
=
-
1
!==
val
.
indexOf
(
v1
);
break
;
case
AscCommonExcel
.
ECfOperator
.
Operator_endsWith
:
res
=
val
.
startsWith
(
v1
);
break
;
case
AscCommonExcel
.
ECfOperator
.
Operator_equal
:
res
=
val
==
v1
;
break
;
case
AscCommonExcel
.
ECfOperator
.
Operator_greaterThan
:
res
=
val
>
v1
;
break
;
case
AscCommonExcel
.
ECfOperator
.
Operator_greaterThanOrEqual
:
res
=
val
>=
v1
;
break
;
case
AscCommonExcel
.
ECfOperator
.
Operator_lessThan
:
res
=
val
<
v1
;
break
;
case
AscCommonExcel
.
ECfOperator
.
Operator_lessThanOrEqual
:
res
=
val
<=
v1
;
break
;
case
AscCommonExcel
.
ECfOperator
.
Operator_notBetween
:
res
=
!
(
v1
<=
val
&&
val
<=
v2
);
break
;
case
AscCommonExcel
.
ECfOperator
.
Operator_notContains
:
res
=
-
1
===
val
.
indexOf
(
v1
);
break
;
case
AscCommonExcel
.
ECfOperator
.
Operator_notEqual
:
res
=
val
!=
v1
;
break
;
}
return
res
;
};
function
CColorScale
()
{
this
.
aCFVOs
=
[];
...
...
@@ -214,6 +256,7 @@
function
CFormulaCF
()
{
this
.
Text
=
null
;
this
.
_f
=
null
;
return
this
;
}
...
...
@@ -222,6 +265,16 @@
res
.
Text
=
this
.
Text
;
return
res
;
};
CFormulaCF
.
prototype
.
init
=
function
(
ws
)
{
if
(
!
this
.
_f
)
{
this
.
_f
=
new
AscCommonExcel
.
parserFormula
(
this
.
Text
,
''
,
ws
);
this
.
_f
.
parse
();
}
};
CFormulaCF
.
prototype
.
getValue
=
function
(
ws
)
{
this
.
init
(
ws
);
return
this
.
_f
.
calculate
().
getValue
();
};
function
CIconSet
()
{
this
.
IconSet
=
Asc
.
EIconSetType
.
Traffic3Lights1
;
...
...
cell/model/Serialize.js
View file @
03ac22a2
...
...
@@ -8100,7 +8100,8 @@
window
[
"
Asc
"
].
ETableStyleType
=
ETableStyleType
;
window
[
"
Asc
"
].
EFontScheme
=
EFontScheme
;
window
[
"
Asc
"
].
EIconSetType
=
EIconSetType
;
window
[
"
Asc
"
].
ECfType
=
ECfType
;
window
[
"
AscCommonExcel
"
].
ECfOperator
=
ECfOperator
;
window
[
"
AscCommonExcel
"
].
ECfType
=
ECfType
;
window
[
"
AscCommonExcel
"
].
ECfvoType
=
ECfvoType
;
window
[
"
AscCommonExcel
"
].
ST_TimePeriod
=
ST_TimePeriod
;
window
[
"
Asc
"
].
ESparklineType
=
ESparklineType
;
...
...
cell/model/Workbook.js
View file @
03ac22a2
...
...
@@ -3510,9 +3510,9 @@ Woorksheet.prototype._updateConditionalFormatting = function(range) {
for
(
j
=
0
;
j
<
aRules
.
length
;
++
j
)
{
oRule
=
aRules
[
j
];
// ToDo aboveAverage,
cellIs,
// ToDo aboveAverage,
// ToDo dataBar, expression, iconSet (page 2679)
if
(
Asc
.
ECfType
.
colorScale
===
oRule
.
type
)
{
if
(
Asc
CommonExcel
.
ECfType
.
colorScale
===
oRule
.
type
)
{
if
(
1
!==
oRule
.
aRuleElements
.
length
)
{
break
;
}
...
...
@@ -3565,7 +3565,7 @@ Woorksheet.prototype._updateConditionalFormatting = function(range) {
value
.
c
.
setConditionalFormattingStyle
(
dxf
);
}
}
}
else
if
(
Asc
.
ECfType
.
top10
===
oRule
.
type
)
{
}
else
if
(
Asc
CommonExcel
.
ECfType
.
top10
===
oRule
.
type
)
{
if
(
oRule
.
rank
>
0
&&
oRule
.
dxf
)
{
nc
=
0
;
values
=
this
.
_getValuesForConditionalFormatting
(
sqref
,
false
);
...
...
@@ -3599,30 +3599,30 @@ Woorksheet.prototype._updateConditionalFormatting = function(range) {
values
=
this
.
_getValuesForConditionalFormatting
(
sqref
,
true
);
switch
(
oRule
.
type
)
{
case
Asc
.
ECfType
.
duplicateValues
:
case
Asc
.
ECfType
.
uniqueValues
:
case
Asc
CommonExcel
.
ECfType
.
duplicateValues
:
case
Asc
CommonExcel
.
ECfType
.
uniqueValues
:
o
=
getUniqueKeys
(
values
);
compareFunction
=
(
function
(
obj
,
condition
){
return
function
(
val
)
{
return
condition
===
obj
[
val
];
};
})(
o
,
oRule
.
type
===
Asc
.
ECfType
.
duplicateValues
);
})(
o
,
oRule
.
type
===
Asc
CommonExcel
.
ECfType
.
duplicateValues
);
break
;
case
Asc
.
ECfType
.
containsText
:
case
Asc
CommonExcel
.
ECfType
.
containsText
:
compareFunction
=
(
function
(
text
){
return
function
(
val
)
{
return
-
1
!==
val
.
indexOf
(
text
);
};
})(
oRule
.
text
);
break
;
case
Asc
.
ECfType
.
notContainsText
:
case
Asc
CommonExcel
.
ECfType
.
notContainsText
:
compareFunction
=
(
function
(
text
){
return
function
(
val
)
{
return
-
1
===
val
.
indexOf
(
text
);
};
})(
oRule
.
text
);
break
;
case
Asc
.
ECfType
.
beginsWith
:
case
Asc
CommonExcel
.
ECfType
.
beginsWith
:
compareFunction
=
(
function
(
text
){
return
function
(
val
)
{
return
val
.
startsWith
(
text
);
...
...
@@ -3630,45 +3630,52 @@ Woorksheet.prototype._updateConditionalFormatting = function(range) {
})(
oRule
.
text
);
break
;
case
Asc
.
ECfType
.
endsWith
:
case
Asc
CommonExcel
.
ECfType
.
endsWith
:
compareFunction
=
(
function
(
text
){
return
function
(
val
)
{
return
val
.
endsWith
(
text
);
};
})(
oRule
.
text
);
break
;
case
Asc
.
ECfType
.
containsErrors
:
case
Asc
CommonExcel
.
ECfType
.
containsErrors
:
compareFunction
=
function
(
val
,
c
)
{
return
CellValueType
.
Error
===
c
.
getType
();
};
break
;
case
Asc
.
ECfType
.
notContainsErrors
:
case
Asc
CommonExcel
.
ECfType
.
notContainsErrors
:
compareFunction
=
function
(
val
,
c
)
{
return
CellValueType
.
Error
!==
c
.
getType
();
};
break
;
case
Asc
.
ECfType
.
containsBlanks
:
case
Asc
CommonExcel
.
ECfType
.
containsBlanks
:
compareFunction
=
function
(
val
,
c
)
{
return
c
.
isEmptyTextString
();
};
break
;
case
Asc
.
ECfType
.
notContainsBlanks
:
case
Asc
CommonExcel
.
ECfType
.
notContainsBlanks
:
compareFunction
=
function
(
val
,
c
)
{
return
!
c
.
isEmptyTextString
();
};
break
;
case
Asc
.
ECfType
.
timePeriod
:
case
Asc
CommonExcel
.
ECfType
.
timePeriod
:
if
(
oRule
.
timePeriod
)
{
compareFunction
=
(
function
(
rule
,
period
)
{
compareFunction
=
(
function
(
period
)
{
return
function
(
val
,
c
)
{
var
n
=
parseFloat
(
val
);
return
period
.
start
<=
n
&&
n
<=
period
.
end
;
};
})(
oRule
,
oRule
.
getTimePeriod
());
})(
oRule
.
getTimePeriod
());
}
else
{
continue
;
}
break
;
case
AscCommonExcel
.
ECfType
.
cellIs
:
compareFunction
=
(
function
(
rule
,
v1
,
v2
)
{
return
function
(
val
,
c
)
{
return
rule
.
cellIs
(
val
,
v1
,
v2
);
};
})(
oRule
,
oRule
.
aRuleElements
[
0
]
&&
oRule
.
aRuleElements
[
0
].
getValue
(
this
),
oRule
.
aRuleElements
[
1
]
&&
oRule
.
aRuleElements
[
1
].
getValue
(
this
));
break
;
default
:
continue
;
break
;
...
...
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