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
4cc453b5
Commit
4cc453b5
authored
May 13, 2016
by
Alexander.Trofimov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
support text values for colorscale
parent
0ff5d20d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
26 deletions
+46
-26
cell/model/Workbook.js
cell/model/Workbook.js
+46
-26
No files found.
cell/model/Workbook.js
View file @
4cc453b5
...
@@ -1898,6 +1898,13 @@ function angleInterfaceToFormat(val)
...
@@ -1898,6 +1898,13 @@ function angleInterfaceToFormat(val)
nRes
=
0
;
nRes
=
0
;
return
nRes
;
return
nRes
;
}
}
function
getUniqueKeys
(
array
)
{
var
i
,
o
=
{};
for
(
i
=
0
;
i
<
array
.
length
;
++
i
)
{
o
[
array
[
i
]]
=
!
o
.
hasOwnProperty
(
array
[
i
]);
}
return
o
;
}
//-------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------
/**
/**
* @constructor
* @constructor
...
@@ -3472,13 +3479,24 @@ Woorksheet.prototype.initPostOpen = function(handlers){
...
@@ -3472,13 +3479,24 @@ Woorksheet.prototype.initPostOpen = function(handlers){
this
.
handlers
=
handlers
;
this
.
handlers
=
handlers
;
this
.
_setHandlersTablePart
();
this
.
_setHandlersTablePart
();
};
};
Woorksheet
.
prototype
.
_getValuesForConditionalFormatting
=
function
(
sqref
)
{
var
aValues
=
[],
aCells
=
[];
var
tmp
;
this
.
getRange3
(
sqref
.
r1
,
sqref
.
c1
,
sqref
.
r2
,
sqref
.
c2
).
_setPropertyNoEmpty
(
null
,
null
,
function
(
c
)
{
if
(
!
c
.
isEmptyTextString
())
{
aCells
.
push
(
c
);
aValues
.
push
(
c
.
getValueWithoutFormat
());
}
});
return
{
c
:
aCells
,
v
:
aValues
};
};
Woorksheet
.
prototype
.
_updateConditionalFormatting
=
function
(
range
)
{
Woorksheet
.
prototype
.
_updateConditionalFormatting
=
function
(
range
)
{
var
oGradient
=
null
;
var
oGradient
=
null
;
var
aCFs
=
this
.
aConditionalFormatting
;
var
aCFs
=
this
.
aConditionalFormatting
;
var
aRules
,
oRule
;
var
aRules
,
oRule
;
var
oRuleElement
=
null
;
var
oRuleElement
=
null
;
var
aValues
=
[],
aCells
=
[]
;
var
o
;
var
tmp
,
i
,
j
,
cell
,
sqre
f
;
var
i
,
j
,
cell
,
sqref
,
values
,
tmp
,
min
,
max
,
dx
f
;
for
(
i
=
0
;
i
<
aCFs
.
length
;
++
i
)
{
for
(
i
=
0
;
i
<
aCFs
.
length
;
++
i
)
{
sqref
=
aCFs
[
i
].
sqref
;
sqref
=
aCFs
[
i
].
sqref
;
// ToDo убрать null === sqref когда научимся мультиселект обрабатывать (\\192.168.5.2\source\DOCUMENTS\XLSX\Matematika Quantum Sedekah.xlsx)
// ToDo убрать null === sqref когда научимся мультиселект обрабатывать (\\192.168.5.2\source\DOCUMENTS\XLSX\Matematika Quantum Sedekah.xlsx)
...
@@ -3490,17 +3508,6 @@ Woorksheet.prototype._updateConditionalFormatting = function(range) {
...
@@ -3490,17 +3508,6 @@ Woorksheet.prototype._updateConditionalFormatting = function(range) {
for
(
j
=
0
;
j
<
aRules
.
length
;
++
j
)
{
for
(
j
=
0
;
j
<
aRules
.
length
;
++
j
)
{
oRule
=
aRules
[
j
];
oRule
=
aRules
[
j
];
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
))
{
return
;
}
aCells
.
push
(
c
);
aValues
.
push
(
tmp
);
}
});
// ToDo aboveAverage, beginsWith, cellIs, containsBlanks, containsErrors,
// ToDo aboveAverage, beginsWith, cellIs, containsBlanks, containsErrors,
// ToDo containsText, dataBar, duplicateValues, endsWith, expression, iconSet, notContainsBlanks,
// ToDo containsText, dataBar, duplicateValues, endsWith, expression, iconSet, notContainsBlanks,
// ToDo notContainsErrors, notContainsText, timePeriod, top10, uniqueValues (page 2679)
// ToDo notContainsErrors, notContainsText, timePeriod, top10, uniqueValues (page 2679)
...
@@ -3513,26 +3520,39 @@ Woorksheet.prototype._updateConditionalFormatting = function(range) {
...
@@ -3513,26 +3520,39 @@ Woorksheet.prototype._updateConditionalFormatting = function(range) {
if
(
!
(
oRuleElement
instanceof
AscCommonExcel
.
CColorScale
))
{
if
(
!
(
oRuleElement
instanceof
AscCommonExcel
.
CColorScale
))
{
break
;
break
;
}
}
min
=
Number
.
MAX_VALUE
;
max
=
-
Number
.
MAX_VALUE
;
values
=
this
.
_getValuesForConditionalFormatting
(
sqref
);
for
(
cell
=
0
;
cell
<
values
.
v
.
length
;
++
cell
)
{
if
(
CellValueType
.
Number
===
values
.
c
[
cell
].
getType
()
&&
!
isNaN
(
tmp
=
parseFloat
(
values
.
v
[
cell
])))
{
values
.
v
[
cell
]
=
tmp
;
min
=
Math
.
min
(
min
,
tmp
);
max
=
Math
.
max
(
max
,
tmp
);
}
else
{
values
.
v
[
cell
]
=
null
;
}
}
// ToDo CFVO Type (formula, max, min, num, percent, percentile) (page 2681)
// ToDo CFVO Type (formula, max, min, num, percent, percentile) (page 2681)
// ToDo support 3 colors in rule
// ToDo support 3 colors in rule
if
(
0
<
aCells
.
length
&&
2
===
oRuleElement
.
aColors
.
length
)
{
if
(
0
<
values
.
c
.
length
&&
2
===
oRuleElement
.
aColors
.
length
)
{
oGradient
=
new
AscCommonExcel
.
CGradient
(
oRuleElement
.
aColors
[
0
],
oRuleElement
.
aColors
[
1
]);
oGradient
=
new
AscCommonExcel
.
CGradient
(
oRuleElement
.
aColors
[
0
],
oRuleElement
.
aColors
[
1
]);
oGradient
.
init
(
Math
.
min
.
apply
(
Math
,
aValues
),
Math
.
max
.
apply
(
Math
,
aValues
)
);
oGradient
.
init
(
min
,
max
);
for
(
cell
=
0
;
cell
<
aCells
.
length
;
++
cell
)
{
for
(
cell
=
0
;
cell
<
values
.
c
.
length
;
++
cell
)
{
var
dxf
=
new
AscCommonExcel
.
CellXfs
();
dxf
=
null
;
dxf
.
fill
=
new
AscCommonExcel
.
Fill
({
bg
:
oGradient
.
calculateColor
(
aValues
[
cell
])});
if
(
null
!==
values
.
v
[
cell
])
{
aCells
[
cell
].
setConditionalFormattingStyle
(
dxf
);
dxf
=
new
AscCommonExcel
.
CellXfs
();
dxf
.
fill
=
new
AscCommonExcel
.
Fill
({
bg
:
oGradient
.
calculateColor
(
values
.
v
[
cell
])});
}
values
.
c
[
cell
].
setConditionalFormattingStyle
(
dxf
);
}
}
}
}
break
;
break
;
case
Asc
.
ECfType
.
uniqueValues
:
case
Asc
.
ECfType
.
uniqueValues
:
o
=
getUniqueKeys
(
values
.
v
);
break
;
break
;
}
}
aCells
.
length
=
0
;
aValues
.
length
=
0
;
}
}
}
}
}
}
...
@@ -8811,7 +8831,7 @@ function _isSameSizeMerged(bbox, aMerged) {
...
@@ -8811,7 +8831,7 @@ function _isSameSizeMerged(bbox, aMerged) {
}
}
}
}
return
oRes
;
return
oRes
;
}
;
}
function
_canPromote
(
from
,
wsFrom
,
to
,
wsTo
,
bIsPromote
,
nWidth
,
nHeight
,
bVertical
,
nIndex
)
{
function
_canPromote
(
from
,
wsFrom
,
to
,
wsTo
,
bIsPromote
,
nWidth
,
nHeight
,
bVertical
,
nIndex
)
{
var
oRes
=
{
oMergedFrom
:
null
,
oMergedTo
:
null
};
var
oRes
=
{
oMergedFrom
:
null
,
oMergedTo
:
null
};
//если надо только удалить внутреннее содержимое не смотрим на замерженость
//если надо только удалить внутреннее содержимое не смотрим на замерженость
...
@@ -8844,7 +8864,7 @@ function _canPromote(from, wsFrom, to, wsTo, bIsPromote, nWidth, nHeight, bVerti
...
@@ -8844,7 +8864,7 @@ function _canPromote(from, wsFrom, to, wsTo, bIsPromote, nWidth, nHeight, bVerti
}
}
}
}
return
oRes
;
return
oRes
;
}
;
}
// Подготовка Copy Style
// Подготовка Copy Style
function
preparePromoteFromTo
(
from
,
to
)
{
function
preparePromoteFromTo
(
from
,
to
)
{
var
bSuccess
=
true
;
var
bSuccess
=
true
;
...
@@ -8860,7 +8880,7 @@ function preparePromoteFromTo(from, to) {
...
@@ -8860,7 +8880,7 @@ function preparePromoteFromTo(from, to) {
}
else
}
else
bSuccess
=
false
;
bSuccess
=
false
;
return
bSuccess
;
return
bSuccess
;
}
;
}
// Перед promoteFromTo обязательно должна быть вызывана функция preparePromoteFromTo
// Перед promoteFromTo обязательно должна быть вызывана функция preparePromoteFromTo
function
promoteFromTo
(
from
,
wsFrom
,
to
,
wsTo
)
{
function
promoteFromTo
(
from
,
wsFrom
,
to
,
wsTo
)
{
var
bVertical
=
true
;
var
bVertical
=
true
;
...
@@ -8888,7 +8908,7 @@ function promoteFromTo(from, wsFrom, to, wsTo) {
...
@@ -8888,7 +8908,7 @@ function promoteFromTo(from, wsFrom, to, wsTo) {
wsTo
.
mergeManager
.
remove
(
to
,
true
);
wsTo
.
mergeManager
.
remove
(
to
,
true
);
_promoteFromTo
(
from
,
wsFrom
,
to
,
wsTo
,
false
,
oCanPromote
,
false
,
bVertical
,
nIndex
);
_promoteFromTo
(
from
,
wsFrom
,
to
,
wsTo
,
false
,
oCanPromote
,
false
,
bVertical
,
nIndex
);
}
}
}
;
}
Range
.
prototype
.
promote
=
function
(
bCtrl
,
bVertical
,
nIndex
){
Range
.
prototype
.
promote
=
function
(
bCtrl
,
bVertical
,
nIndex
){
//todo отдельный метод для promote в таблицах и merge в таблицах
//todo отдельный метод для promote в таблицах и merge в таблицах
var
oBBox
=
this
.
bbox
;
var
oBBox
=
this
.
bbox
;
...
...
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