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
af7bf5c5
Commit
af7bf5c5
authored
May 13, 2016
by
Alexander.Trofimov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update conditionalFormatting after change cell value
parent
5f5a28be
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
70 additions
and
84 deletions
+70
-84
cell/model/ConditionalFormatting.js
cell/model/ConditionalFormatting.js
+34
-62
cell/model/Serialize.js
cell/model/Serialize.js
+14
-15
cell/model/Workbook.js
cell/model/Workbook.js
+9
-7
cell/utils/utils.js
cell/utils/utils.js
+13
-0
No files found.
cell/model/ConditionalFormatting.js
View file @
af7bf5c5
...
...
@@ -15,50 +15,41 @@
* @memberOf Asc
*/
function
CConditionalFormatting
()
{
if
(
!
(
this
instanceof
CConditionalFormatting
)
)
{
return
new
CConditionalFormatting
();
}
this
.
Pivot
=
false
;
this
.
SqRef
=
null
;
this
.
pivot
=
false
;
this
.
sqref
=
null
;
this
.
aRules
=
[];
this
.
SqRefRange
=
null
;
return
this
;
}
CConditionalFormatting
.
prototype
.
clone
=
function
(
ws
)
{
CConditionalFormatting
.
prototype
.
setSqref
=
function
(
sqref
)
{
this
.
sqref
=
AscCommonExcel
.
g_oRangeCache
.
getAscRange
(
sqref
);
};
CConditionalFormatting
.
prototype
.
clone
=
function
()
{
var
i
,
res
=
new
CConditionalFormatting
();
res
.
Pivot
=
this
.
P
ivot
;
res
.
SqRef
=
this
.
SqRef
;
res
.
pivot
=
this
.
p
ivot
;
res
.
sqref
=
this
.
sqref
?
this
.
sqref
.
clone
()
:
null
;
for
(
i
=
0
;
i
<
this
.
aRules
.
length
;
++
i
)
res
.
aRules
.
push
(
this
.
aRules
[
i
].
clone
());
res
.
recalc
(
ws
);
return
res
;
};
CConditionalFormatting
.
prototype
.
recalc
=
function
(
ws
)
{
this
.
SqRefRange
=
ws
.
getRange2
(
this
.
SqRef
);
};
function
CConditionalFormattingRule
()
{
if
(
!
(
this
instanceof
CConditionalFormattingRule
)
)
{
return
new
CConditionalFormattingRule
();
}
this
.
AboveAverage
=
true
;
this
.
Bottom
=
false
;
this
.
aboveAverage
=
true
;
this
.
activePresent
=
false
;
this
.
bottom
=
false
;
this
.
dxf
=
null
;
this
.
EqualAverage
=
false
;
this
.
Operator
=
null
;
this
.
Percent
=
false
;
this
.
Priority
=
null
;
this
.
Rank
=
null
;
this
.
StdDev
=
null
;
this
.
StopIfTrue
=
false
;
this
.
Text
=
null
;
this
.
TimePeriod
=
null
;
this
.
Type
=
null
;
this
.
equalAverage
=
false
;
this
.
id
=
null
;
this
.
operator
=
null
;
this
.
percent
=
false
;
this
.
priority
=
null
;
this
.
rank
=
null
;
this
.
stdDev
=
null
;
this
.
stopIfTrue
=
false
;
this
.
text
=
null
;
this
.
timePeriod
=
null
;
this
.
type
=
null
;
this
.
aRuleElements
=
[];
...
...
@@ -66,20 +57,20 @@
}
CConditionalFormattingRule
.
prototype
.
clone
=
function
()
{
var
i
,
res
=
new
CConditionalFormattingRule
();
res
.
AboveAverage
=
this
.
A
boveAverage
;
res
.
Bottom
=
this
.
B
ottom
;
res
.
aboveAverage
=
this
.
a
boveAverage
;
res
.
bottom
=
this
.
b
ottom
;
if
(
this
.
dxf
)
res
.
dxf
=
this
.
dxf
.
clone
();
res
.
EqualAverage
=
this
.
E
qualAverage
;
res
.
Operator
=
this
.
O
perator
;
res
.
Percent
=
this
.
P
ercent
;
res
.
Priority
=
this
.
P
riority
;
res
.
Rank
=
this
.
R
ank
;
res
.
StdDev
=
this
.
S
tdDev
;
res
.
StopIfTrue
=
this
.
S
topIfTrue
;
res
.
Text
=
this
.
T
ext
;
res
.
TimePeriod
=
this
.
T
imePeriod
;
res
.
Type
=
this
.
T
ype
;
res
.
equalAverage
=
this
.
e
qualAverage
;
res
.
operator
=
this
.
o
perator
;
res
.
percent
=
this
.
p
ercent
;
res
.
priority
=
this
.
p
riority
;
res
.
rank
=
this
.
r
ank
;
res
.
stdDev
=
this
.
s
tdDev
;
res
.
stopIfTrue
=
this
.
s
topIfTrue
;
res
.
text
=
this
.
t
ext
;
res
.
timePeriod
=
this
.
t
imePeriod
;
res
.
type
=
this
.
t
ype
;
for
(
i
=
0
;
i
<
this
.
aRuleElements
.
length
;
++
i
)
res
.
aRuleElements
.
push
(
this
.
aRuleElements
[
i
].
clone
());
...
...
@@ -87,10 +78,6 @@
};
function
CColorScale
()
{
if
(
!
(
this
instanceof
CColorScale
)
)
{
return
new
CColorScale
();
}
this
.
aCFVOs
=
[];
this
.
aColors
=
[];
...
...
@@ -106,10 +93,6 @@
};
function
CDataBar
()
{
if
(
!
(
this
instanceof
CDataBar
)
)
{
return
new
CDataBar
();
}
this
.
MaxLength
=
90
;
this
.
MinLength
=
10
;
this
.
ShowValue
=
true
;
...
...
@@ -132,10 +115,6 @@
};
function
CFormulaCF
()
{
if
(
!
(
this
instanceof
CFormulaCF
)
)
{
return
new
CFormulaCF
();
}
this
.
Text
=
null
;
return
this
;
...
...
@@ -147,9 +126,6 @@
};
function
CIconSet
()
{
if
(
!
(
this
instanceof
CIconSet
)
)
{
return
new
CIconSet
();
}
this
.
IconSet
=
Asc
.
EIconSetType
.
Traffic3Lights1
;
this
.
Percent
=
true
;
this
.
Reverse
=
false
;
...
...
@@ -171,10 +147,6 @@
};
function
CConditionalFormatValueObject
()
{
if
(
!
(
this
instanceof
CConditionalFormatValueObject
)
)
{
return
new
CConditionalFormatValueObject
();
}
this
.
Gte
=
true
;
this
.
Type
=
null
;
this
.
Val
=
null
;
...
...
cell/model/Serialize.js
View file @
af7bf5c5
...
...
@@ -5575,7 +5575,6 @@
res
=
this
.
bcr
.
Read1
(
length
,
function
(
t
,
l
)
{
return
oThis
.
ReadConditionalFormatting
(
t
,
l
,
oConditionalFormatting
);
});
oConditionalFormatting
.
recalc
(
oWorksheet
);
oWorksheet
.
aConditionalFormatting
.
push
(
oConditionalFormatting
);
}
else
if
(
c_oSerWorksheetsTypes
.
SheetViews
===
type
)
{
res
=
this
.
bcr
.
Read1
(
length
,
function
(
t
,
l
)
{
...
...
@@ -6297,9 +6296,9 @@
var
oThis
=
this
;
var
oConditionalFormattingRule
=
null
;
if
(
c_oSer_ConditionalFormatting
.
Pivot
===
type
)
oConditionalFormatting
.
P
ivot
=
this
.
stream
.
GetBool
();
oConditionalFormatting
.
p
ivot
=
this
.
stream
.
GetBool
();
else
if
(
c_oSer_ConditionalFormatting
.
SqRef
===
type
)
{
oConditionalFormatting
.
SqRef
=
this
.
stream
.
GetString2LE
(
length
);
oConditionalFormatting
.
setSqref
(
this
.
stream
.
GetString2LE
(
length
)
);
}
else
if
(
c_oSer_ConditionalFormatting
.
ConditionalFormattingRule
===
type
)
{
oConditionalFormattingRule
=
new
AscCommonExcel
.
CConditionalFormattingRule
();
...
...
@@ -6318,34 +6317,34 @@
var
oConditionalFormattingRuleElement
=
null
;
if
(
c_oSer_ConditionalFormattingRule
.
AboveAverage
===
type
)
oConditionalFormattingRule
.
A
boveAverage
=
this
.
stream
.
GetBool
();
oConditionalFormattingRule
.
a
boveAverage
=
this
.
stream
.
GetBool
();
else
if
(
c_oSer_ConditionalFormattingRule
.
Bottom
===
type
)
oConditionalFormattingRule
.
B
ottom
=
this
.
stream
.
GetBool
();
oConditionalFormattingRule
.
b
ottom
=
this
.
stream
.
GetBool
();
else
if
(
c_oSer_ConditionalFormattingRule
.
DxfId
===
type
)
{
var
DxfId
=
this
.
stream
.
GetULongLE
();
oConditionalFormattingRule
.
dxf
=
this
.
Dxfs
[
DxfId
];
}
else
if
(
c_oSer_ConditionalFormattingRule
.
EqualAverage
===
type
)
oConditionalFormattingRule
.
E
qualAverage
=
this
.
stream
.
GetBool
();
oConditionalFormattingRule
.
e
qualAverage
=
this
.
stream
.
GetBool
();
else
if
(
c_oSer_ConditionalFormattingRule
.
Operator
===
type
)
oConditionalFormattingRule
.
O
perator
=
this
.
stream
.
GetUChar
();
oConditionalFormattingRule
.
o
perator
=
this
.
stream
.
GetUChar
();
else
if
(
c_oSer_ConditionalFormattingRule
.
Percent
===
type
)
oConditionalFormattingRule
.
P
ercent
=
this
.
stream
.
GetBool
();
oConditionalFormattingRule
.
p
ercent
=
this
.
stream
.
GetBool
();
else
if
(
c_oSer_ConditionalFormattingRule
.
Priority
===
type
)
oConditionalFormattingRule
.
P
riority
=
this
.
stream
.
GetULongLE
();
oConditionalFormattingRule
.
p
riority
=
this
.
stream
.
GetULongLE
();
else
if
(
c_oSer_ConditionalFormattingRule
.
Rank
===
type
)
oConditionalFormattingRule
.
R
ank
=
this
.
stream
.
GetULongLE
();
oConditionalFormattingRule
.
r
ank
=
this
.
stream
.
GetULongLE
();
else
if
(
c_oSer_ConditionalFormattingRule
.
StdDev
===
type
)
oConditionalFormattingRule
.
S
tdDev
=
this
.
stream
.
GetULongLE
();
oConditionalFormattingRule
.
s
tdDev
=
this
.
stream
.
GetULongLE
();
else
if
(
c_oSer_ConditionalFormattingRule
.
StopIfTrue
===
type
)
oConditionalFormattingRule
.
S
topIfTrue
=
this
.
stream
.
GetBool
();
oConditionalFormattingRule
.
s
topIfTrue
=
this
.
stream
.
GetBool
();
else
if
(
c_oSer_ConditionalFormattingRule
.
Text
===
type
)
oConditionalFormattingRule
.
T
ext
=
this
.
stream
.
GetString2LE
(
length
);
oConditionalFormattingRule
.
t
ext
=
this
.
stream
.
GetString2LE
(
length
);
else
if
(
c_oSer_ConditionalFormattingRule
.
TimePeriod
===
type
)
oConditionalFormattingRule
.
T
imePeriod
=
this
.
stream
.
GetString2LE
(
length
);
oConditionalFormattingRule
.
t
imePeriod
=
this
.
stream
.
GetString2LE
(
length
);
else
if
(
c_oSer_ConditionalFormattingRule
.
Type
===
type
)
oConditionalFormattingRule
.
T
ype
=
this
.
stream
.
GetUChar
();
oConditionalFormattingRule
.
t
ype
=
this
.
stream
.
GetUChar
();
else
if
(
c_oSer_ConditionalFormattingRule
.
ColorScale
===
type
)
{
oConditionalFormattingRuleElement
=
new
AscCommonExcel
.
CColorScale
();
res
=
this
.
bcr
.
Read1
(
length
,
function
(
t
,
l
)
{
...
...
cell/model/Workbook.js
View file @
af7bf5c5
...
...
@@ -3350,7 +3350,7 @@ Woorksheet.prototype.clone=function(sNewId, sName){
oNewWs
.
sheetViews
.
push
(
this
.
sheetViews
[
i
].
clone
());
}
for
(
i
=
0
;
i
<
this
.
aConditionalFormatting
.
length
;
++
i
)
{
oNewWs
.
aConditionalFormatting
.
push
(
this
.
aConditionalFormatting
[
i
].
clone
(
oNewWs
));
oNewWs
.
aConditionalFormatting
.
push
(
this
.
aConditionalFormatting
[
i
].
clone
());
}
if
(
this
.
sheetPr
)
oNewWs
.
sheetPr
=
this
.
sheetPr
.
clone
();
...
...
@@ -3480,20 +3480,21 @@ Woorksheet.prototype._updateConditionalFormatting = function(range) {
var
min
=
Number
.
MAX_VALUE
;
var
max
=
-
Number
.
MAX_VALUE
;
var
arrayCells
=
[];
var
tmp
,
i
,
j
,
cell
;
var
tmp
,
i
,
j
,
cell
,
sqref
;
for
(
i
=
0
;
i
<
aCFs
.
length
;
++
i
)
{
// ToDo убрать null === aCFs[i].SqRefRange когда научимся мультиселект обрабатывать (\\192.168.5.2\source\DOCUMENTS\XLSX\Matematika Quantum Sedekah.xlsx)
if
(
null
===
aCFs
[
i
].
SqRefRange
)
{
sqref
=
aCFs
[
i
].
sqref
;
// ToDo убрать null === sqref когда научимся мультиселект обрабатывать (\\192.168.5.2\source\DOCUMENTS\XLSX\Matematika Quantum Sedekah.xlsx)
if
(
null
===
sqref
)
{
continue
;
}
if
(
!
range
||
range
.
i
ntersection
(
aCFs
[
i
].
SqRefRange
))
{
if
(
!
range
||
range
.
i
sIntersect
(
sqref
))
{
aRules
=
aCFs
[
i
].
aRules
;
for
(
j
=
0
;
j
<
aRules
.
length
;
++
j
)
{
oRule
=
aRules
[
j
];
// ToDo aboveAverage, beginsWith, cellIs, containsBlanks, containsErrors,
// ToDo containsText, dataBar, duplicateValues, endsWith, expression, iconSet, notContainsBlanks,
// ToDo notContainsErrors, notContainsText, timePeriod, top10, uniqueValues (page 2679)
switch
(
oRule
.
T
ype
)
{
switch
(
oRule
.
t
ype
)
{
case
Asc
.
ECfType
.
colorScale
:
if
(
1
!==
oRule
.
aRuleElements
.
length
)
{
break
;
...
...
@@ -3503,7 +3504,7 @@ Woorksheet.prototype._updateConditionalFormatting = function(range) {
break
;
}
aCFs
[
i
].
SqRefRange
.
_setPropertyNoEmpty
(
null
,
null
,
function
(
c
)
{
this
.
getRange3
(
sqref
.
r1
,
sqref
.
c1
,
sqref
.
r2
,
sqref
.
c2
)
.
_setPropertyNoEmpty
(
null
,
null
,
function
(
c
)
{
if
(
CellValueType
.
Number
===
c
.
getType
()
&&
false
===
c
.
isEmptyTextString
())
{
tmp
=
parseFloat
(
c
.
getValueWithoutFormat
());
if
(
isNaN
(
tmp
))
{
...
...
@@ -5369,6 +5370,7 @@ Woorksheet.prototype.createTablePart = function(){
};
Woorksheet
.
prototype
.
onUpdateRanges
=
function
(
ranges
)
{
this
.
workbook
.
updateSparklineCache
(
this
.
sName
,
ranges
);
this
.
_updateConditionalFormatting
(
new
AscCommonExcel
.
MultiplyRange
(
ranges
));
};
Woorksheet
.
prototype
.
updateSparklineCache
=
function
(
sheet
,
ranges
)
{
for
(
var
i
=
0
;
i
<
this
.
sparklineGroups
.
arrSparklineGroup
.
length
;
++
i
)
{
...
...
cell/utils/utils.js
View file @
af7bf5c5
...
...
@@ -699,6 +699,18 @@
return
sRes
;
};
function
MultiplyRange
(
ranges
)
{
this
.
ranges
=
ranges
;
}
MultiplyRange
.
prototype
.
isIntersect
=
function
(
range
)
{
for
(
var
i
=
0
;
i
<
this
.
ranges
.
length
;
++
i
)
{
if
(
range
.
isIntersect
(
this
.
ranges
[
i
]))
{
return
true
;
}
}
return
false
;
};
function
VisibleRange
(
visibleRange
,
offsetX
,
offsetY
)
{
this
.
visibleRange
=
visibleRange
;
this
.
offsetX
=
offsetX
;
...
...
@@ -1607,6 +1619,7 @@
window
[
"
AscCommonExcel
"
].
Range3D
=
Range3D
;
window
[
"
AscCommonExcel
"
].
ActiveRange
=
ActiveRange
;
window
[
"
AscCommonExcel
"
].
FormulaRange
=
FormulaRange
;
window
[
"
AscCommonExcel
"
].
MultiplyRange
=
MultiplyRange
;
window
[
"
AscCommonExcel
"
].
VisibleRange
=
VisibleRange
;
window
[
"
AscCommonExcel
"
].
g_oRangeCache
=
g_oRangeCache
;
...
...
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