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
2d55616c
Commit
2d55616c
authored
Oct 07, 2016
by
konovalovsergey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
if promote cell to the table header that will create more than one history point
parent
4c227e54
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
43 deletions
+49
-43
cell/model/Workbook.js
cell/model/Workbook.js
+42
-40
cell/view/WorksheetView.js
cell/view/WorksheetView.js
+7
-3
No files found.
cell/model/Workbook.js
View file @
2d55616c
...
...
@@ -9209,7 +9209,7 @@ function _isSameSizeMerged(bbox, aMerged) {
return
oRes
;
}
function
_canPromote
(
from
,
wsFrom
,
to
,
wsTo
,
bIsPromote
,
nWidth
,
nHeight
,
bVertical
,
nIndex
)
{
var
oRes
=
{
oMergedFrom
:
null
,
oMergedTo
:
null
};
var
oRes
=
{
oMergedFrom
:
null
,
oMergedTo
:
null
,
to
:
to
};
//если надо только удалить внутреннее содержимое не смотрим на замерженость
if
(
!
bIsPromote
||
!
((
true
==
bVertical
&&
nIndex
>=
0
&&
nIndex
<
nHeight
)
||
(
false
==
bVertical
&&
nIndex
>=
0
&&
nIndex
<
nWidth
)))
{
...
...
@@ -9285,52 +9285,55 @@ function promoteFromTo(from, wsFrom, to, wsTo) {
_promoteFromTo
(
from
,
wsFrom
,
to
,
wsTo
,
false
,
oCanPromote
,
false
,
bVertical
,
nIndex
);
}
}
Range
.
prototype
.
promote
=
function
(
bCtrl
,
bVertical
,
nIndex
){
//todo отдельный метод для promote в таблицах и merge в таблицах
var
oBBox
=
this
.
bbox
;
var
nWidth
=
oBBox
.
c2
-
oBBox
.
c1
+
1
;
var
nHeight
=
oBBox
.
r2
-
oBBox
.
r1
+
1
;
var
bWholeCol
=
false
;
var
bWholeRow
=
false
;
if
(
0
==
oBBox
.
r1
&&
gc_nMaxRow0
==
oBBox
.
r2
)
bWholeCol
=
true
;
if
(
0
==
oBBox
.
c1
&&
gc_nMaxCol0
==
oBBox
.
c2
)
bWholeRow
=
true
;
if
((
bWholeCol
&&
bWholeRow
)
||
(
true
==
bVertical
&&
bWholeCol
)
||
(
false
==
bVertical
&&
bWholeRow
))
return
false
;
var
oPromoteAscRange
=
null
;
if
(
0
==
nIndex
)
oPromoteAscRange
=
Asc
.
Range
(
oBBox
.
c1
,
oBBox
.
r1
,
oBBox
.
c2
,
oBBox
.
r2
);
else
{
if
(
bVertical
)
Range
.
prototype
.
canPromote
=
function
(
bCtrl
,
bVertical
,
nIndex
){
var
oBBox
=
this
.
bbox
;
var
nWidth
=
oBBox
.
c2
-
oBBox
.
c1
+
1
;
var
nHeight
=
oBBox
.
r2
-
oBBox
.
r1
+
1
;
var
bWholeCol
=
false
;
var
bWholeRow
=
false
;
if
(
0
==
oBBox
.
r1
&&
gc_nMaxRow0
==
oBBox
.
r2
)
bWholeCol
=
true
;
if
(
0
==
oBBox
.
c1
&&
gc_nMaxCol0
==
oBBox
.
c2
)
bWholeRow
=
true
;
if
((
bWholeCol
&&
bWholeRow
)
||
(
true
==
bVertical
&&
bWholeCol
)
||
(
false
==
bVertical
&&
bWholeRow
))
return
null
;
var
oPromoteAscRange
=
null
;
if
(
0
==
nIndex
)
oPromoteAscRange
=
Asc
.
Range
(
oBBox
.
c1
,
oBBox
.
r1
,
oBBox
.
c2
,
oBBox
.
r2
);
else
{
if
(
nIndex
>
0
)
if
(
bVertical
)
{
if
(
nIndex
>=
nHeight
)
oPromoteAscRange
=
Asc
.
Range
(
oBBox
.
c1
,
oBBox
.
r2
+
1
,
oBBox
.
c2
,
oBBox
.
r1
+
nIndex
);
if
(
nIndex
>
0
)
{
if
(
nIndex
>=
nHeight
)
oPromoteAscRange
=
Asc
.
Range
(
oBBox
.
c1
,
oBBox
.
r2
+
1
,
oBBox
.
c2
,
oBBox
.
r1
+
nIndex
);
else
oPromoteAscRange
=
Asc
.
Range
(
oBBox
.
c1
,
oBBox
.
r1
+
nIndex
,
oBBox
.
c2
,
oBBox
.
r2
);
}
else
oPromoteAscRange
=
Asc
.
Range
(
oBBox
.
c1
,
oBBox
.
r1
+
nIndex
,
oBBox
.
c2
,
oBBox
.
r
2
);
oPromoteAscRange
=
Asc
.
Range
(
oBBox
.
c1
,
oBBox
.
r1
+
nIndex
,
oBBox
.
c2
,
oBBox
.
r
1
-
1
);
}
else
oPromoteAscRange
=
Asc
.
Range
(
oBBox
.
c1
,
oBBox
.
r1
+
nIndex
,
oBBox
.
c2
,
oBBox
.
r1
-
1
);
}
else
{
if
(
nIndex
>
0
)
{
if
(
nIndex
>=
nWidth
)
oPromoteAscRange
=
Asc
.
Range
(
oBBox
.
c2
+
1
,
oBBox
.
r1
,
oBBox
.
c1
+
nIndex
,
oBBox
.
r2
);
if
(
nIndex
>
0
)
{
if
(
nIndex
>=
nWidth
)
oPromoteAscRange
=
Asc
.
Range
(
oBBox
.
c2
+
1
,
oBBox
.
r1
,
oBBox
.
c1
+
nIndex
,
oBBox
.
r2
);
else
oPromoteAscRange
=
Asc
.
Range
(
oBBox
.
c1
+
nIndex
,
oBBox
.
r1
,
oBBox
.
c2
,
oBBox
.
r2
);
}
else
oPromoteAscRange
=
Asc
.
Range
(
oBBox
.
c1
+
nIndex
,
oBBox
.
r1
,
oBBox
.
c
2
,
oBBox
.
r2
);
oPromoteAscRange
=
Asc
.
Range
(
oBBox
.
c1
+
nIndex
,
oBBox
.
r1
,
oBBox
.
c
1
-
1
,
oBBox
.
r2
);
}
else
oPromoteAscRange
=
Asc
.
Range
(
oBBox
.
c1
+
nIndex
,
oBBox
.
r1
,
oBBox
.
c1
-
1
,
oBBox
.
r2
);
}
}
//проверяем можно ли осуществить promote
var
oCanPromote
=
_canPromote
(
oBBox
,
this
.
worksheet
,
oPromoteAscRange
,
this
.
worksheet
,
true
,
nWidth
,
nHeight
,
bVertical
,
nIndex
);
if
(
null
==
oCanPromote
)
return
false
;
//проверяем можно ли осуществить promote
return
_canPromote
(
oBBox
,
this
.
worksheet
,
oPromoteAscRange
,
this
.
worksheet
,
true
,
nWidth
,
nHeight
,
bVertical
,
nIndex
);
};
Range
.
prototype
.
promote
=
function
(
bCtrl
,
bVertical
,
nIndex
,
oCanPromote
){
//todo отдельный метод для promote в таблицах и merge в таблицах
var
oBBox
=
this
.
bbox
;
var
nWidth
=
oBBox
.
c2
-
oBBox
.
c1
+
1
;
var
nHeight
=
oBBox
.
r2
-
oBBox
.
r1
+
1
;
History
.
Create_NewPoint
();
var
oSelection
=
History
.
GetSelection
();
...
...
@@ -9377,10 +9380,9 @@ Range.prototype.promote=function(bCtrl, bVertical, nIndex){
}
oFormulaLocaleInfo
.
Parse
=
false
;
oFormulaLocaleInfo
.
DigitSep
=
false
;
_promoteFromTo
(
oBBox
,
this
.
worksheet
,
o
PromoteAscRange
,
this
.
worksheet
,
true
,
oCanPromote
,
bCtrl
,
bVertical
,
nIndex
);
_promoteFromTo
(
oBBox
,
this
.
worksheet
,
o
CanPromote
.
to
,
this
.
worksheet
,
true
,
oCanPromote
,
bCtrl
,
bVertical
,
nIndex
);
oFormulaLocaleInfo
.
Parse
=
true
;
oFormulaLocaleInfo
.
DigitSep
=
true
;
return
true
;
};
function
_promoteFromTo
(
from
,
wsFrom
,
to
,
wsTo
,
bIsPromote
,
oCanPromote
,
bCtrl
,
bVertical
,
nIndex
)
{
var
wb
=
wsFrom
.
workbook
;
...
...
cell/view/WorksheetView.js
View file @
2d55616c
...
...
@@ -8144,11 +8144,15 @@
var
applyFillHandleCallback
=
function
(
res
)
{
if
(
res
)
{
// Автозаполняем ячейки
if
(
range
.
promote
(
/*bCtrl*/
ctrlPress
,
/*bVertical*/
(
1
===
t
.
fillHandleDirection
),
nIndex
)
)
{
var
oCanPromote
=
range
.
canPromote
(
/*bCtrl*/
ctrlPress
,
/*bVertical*/
(
1
===
t
.
fillHandleDirection
),
nIndex
);
if
(
null
!=
oCanPromote
)
{
History
.
Create_NewPoint
();
History
.
StartTransaction
();
range
.
promote
(
/*bCtrl*/
ctrlPress
,
/*bVertical*/
(
1
===
t
.
fillHandleDirection
),
nIndex
,
oCanPromote
);
// Вызываем функцию пересчета для заголовков форматированной таблицы
t
.
model
.
autoFilters
.
renameTableColumn
(
arn
);
}
else
{
History
.
EndTransaction
();
}
else
{
t
.
handlers
.
trigger
(
"
onErrorEvent
"
,
c_oAscError
.
ID
.
CannotFillRange
,
c_oAscError
.
Level
.
NoCritical
);
t
.
activeRange
.
assign2
(
range
.
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