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
bb3c31b1
Commit
bb3c31b1
authored
Feb 16, 2017
by
GoshaZotov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bug 34072
parent
9c150821
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
173 additions
and
11 deletions
+173
-11
cell/model/WorkbookElems.js
cell/model/WorkbookElems.js
+153
-3
cell/model/autofilters.js
cell/model/autofilters.js
+20
-8
No files found.
cell/model/WorkbookElems.js
View file @
bb3c31b1
...
@@ -5393,7 +5393,13 @@ TablePart.prototype.moveRef = function(col, row) {
...
@@ -5393,7 +5393,13 @@ TablePart.prototype.moveRef = function(col, row) {
this
.
handlers
.
trigger
(
"
changeRefTablePart
"
,
this
);
this
.
handlers
.
trigger
(
"
changeRefTablePart
"
,
this
);
if
(
this
.
AutoFilter
)
if
(
this
.
AutoFilter
)
{
this
.
AutoFilter
.
moveRef
(
col
,
row
);
this
.
AutoFilter
.
moveRef
(
col
,
row
);
}
if
(
this
.
SortState
)
{
this
.
SortState
.
moveRef
(
col
,
row
);
}
};
};
TablePart
.
prototype
.
changeRef
=
function
(
col
,
row
,
bIsFirst
)
{
TablePart
.
prototype
.
changeRef
=
function
(
col
,
row
,
bIsFirst
)
{
var
ref
=
this
.
Ref
.
clone
();
var
ref
=
this
.
Ref
.
clone
();
...
@@ -5408,7 +5414,13 @@ TablePart.prototype.changeRef = function(col, row, bIsFirst) {
...
@@ -5408,7 +5414,13 @@ TablePart.prototype.changeRef = function(col, row, bIsFirst) {
this
.
handlers
.
trigger
(
"
changeRefTablePart
"
,
this
);
this
.
handlers
.
trigger
(
"
changeRefTablePart
"
,
this
);
if
(
this
.
AutoFilter
)
if
(
this
.
AutoFilter
)
{
this
.
AutoFilter
.
changeRef
(
col
,
row
,
bIsFirst
);
this
.
AutoFilter
.
changeRef
(
col
,
row
,
bIsFirst
);
}
if
(
this
.
SortState
)
{
this
.
SortState
.
changeRef
(
col
,
row
,
bIsFirst
);
}
};
};
TablePart
.
prototype
.
changeRefOnRange
=
function
(
range
,
autoFilters
,
generateNewTableColumns
)
{
TablePart
.
prototype
.
changeRefOnRange
=
function
(
range
,
autoFilters
,
generateNewTableColumns
)
{
if
(
!
range
)
if
(
!
range
)
...
@@ -5511,6 +5523,15 @@ TablePart.prototype.deleteTableColumns = function(activeRange)
...
@@ -5511,6 +5523,15 @@ TablePart.prototype.deleteTableColumns = function(activeRange)
deletedMap
[
deleted
[
i
].
Name
]
=
1
;
deletedMap
[
deleted
[
i
].
Name
]
=
1
;
}
}
this
.
handlers
.
trigger
(
"
deleteColumnTablePart
"
,
this
.
DisplayName
,
deletedMap
);
this
.
handlers
.
trigger
(
"
deleteColumnTablePart
"
,
this
.
DisplayName
,
deletedMap
);
if
(
this
.
SortState
)
{
var
bIsDeleteSortState
=
this
.
SortState
.
changeColumns
(
activeRange
,
true
);
if
(
bIsDeleteSortState
)
{
this
.
SortState
=
null
;
}
}
}
}
};
};
...
@@ -5543,6 +5564,23 @@ TablePart.prototype.addTableColumns = function(activeRange, autoFilters)
...
@@ -5543,6 +5564,23 @@ TablePart.prototype.addTableColumns = function(activeRange, autoFilters)
}
}
this
.
TableColumns
=
newTableColumns
;
this
.
TableColumns
=
newTableColumns
;
/*if(this.SortState && this.SortState.SortConditions && this.SortState.SortConditions[0])
{
var SortConditions = this.SortState.SortConditions[0];
if(activeRange.c1 <= SortConditions.Ref.c1)
{
var offset = activeRange.c2 - activeRange.c1 + 1;
SortConditions.Ref.c1 += offset;
SortConditions.Ref.c2 += offset;
}
}*/
if
(
this
.
SortState
)
{
this
.
SortState
.
changeColumns
(
activeRange
);
}
this
.
buildDependencies
();
this
.
buildDependencies
();
};
};
...
@@ -5787,6 +5825,11 @@ AutoFilter.prototype.moveRef = function(col, row) {
...
@@ -5787,6 +5825,11 @@ AutoFilter.prototype.moveRef = function(col, row) {
var
ref
=
this
.
Ref
.
clone
();
var
ref
=
this
.
Ref
.
clone
();
ref
.
setOffset
({
offsetCol
:
col
?
col
:
0
,
offsetRow
:
row
?
row
:
0
});
ref
.
setOffset
({
offsetCol
:
col
?
col
:
0
,
offsetRow
:
row
?
row
:
0
});
if
(
this
.
SortState
)
{
this
.
SortState
.
moveRef
(
col
,
row
);
}
this
.
Ref
=
ref
;
this
.
Ref
=
ref
;
};
};
AutoFilter
.
prototype
.
changeRef
=
function
(
col
,
row
,
bIsFirst
)
{
AutoFilter
.
prototype
.
changeRef
=
function
(
col
,
row
,
bIsFirst
)
{
...
@@ -5934,7 +5977,29 @@ AutoFilter.prototype._getFilterColumnByColId = function(colId)
...
@@ -5934,7 +5977,29 @@ AutoFilter.prototype._getFilterColumnByColId = function(colId)
}
}
return
res
;
return
res
;
};
};
//функция используется только для изменения данных сортировки, называется так как и в классе TablePart. возможно стоит переименовать.
AutoFilter
.
prototype
.
deleteTableColumns
=
function
(
activeRange
)
{
if
(
this
.
SortState
)
{
var
bIsDeleteSortState
=
this
.
SortState
.
changeColumns
(
activeRange
,
true
);
if
(
bIsDeleteSortState
)
{
this
.
SortState
=
null
;
}
}
};
//функция используется только для изменения данных сортировки, называется так как и в классе TablePart. возможно стоит переименовать.
AutoFilter
.
prototype
.
addTableColumns
=
function
(
activeRange
)
{
if
(
this
.
SortState
)
{
this
.
SortState
.
changeColumns
(
activeRange
);
}
};
function
FilterColumns
()
{
function
FilterColumns
()
{
this
.
ColId
=
null
;
this
.
ColId
=
null
;
...
@@ -5955,9 +6020,10 @@ function SortState() {
...
@@ -5955,9 +6020,10 @@ function SortState() {
this
.
CaseSensitive
=
null
;
this
.
CaseSensitive
=
null
;
this
.
SortConditions
=
null
;
this
.
SortConditions
=
null
;
}
}
SortState
.
prototype
.
clone
=
function
()
{
SortState
.
prototype
.
clone
=
function
()
{
var
i
,
res
=
new
SortState
();
var
i
,
res
=
new
SortState
();
res
.
Ref
=
this
.
Ref
;
res
.
Ref
=
this
.
Ref
?
this
.
Ref
.
clone
()
:
null
;
res
.
CaseSensitive
=
this
.
CaseSensitive
;
res
.
CaseSensitive
=
this
.
CaseSensitive
;
if
(
this
.
SortConditions
)
{
if
(
this
.
SortConditions
)
{
res
.
SortConditions
=
[];
res
.
SortConditions
=
[];
...
@@ -5966,6 +6032,52 @@ SortState.prototype.clone = function() {
...
@@ -5966,6 +6032,52 @@ SortState.prototype.clone = function() {
}
}
return
res
;
return
res
;
};
};
SortState
.
prototype
.
moveRef
=
function
(
col
,
row
)
{
var
ref
=
this
.
Ref
.
clone
();
ref
.
setOffset
({
offsetCol
:
col
?
col
:
0
,
offsetRow
:
row
?
row
:
0
});
this
.
Ref
=
ref
;
if
(
this
.
SortConditions
)
{
for
(
var
i
=
0
;
i
<
this
.
SortConditions
.
length
;
++
i
)
this
.
SortConditions
[
i
].
moveRef
(
col
,
row
);
}
};
SortState
.
prototype
.
changeRef
=
function
(
col
,
row
,
bIsFirst
)
{
var
ref
=
this
.
Ref
.
clone
();
if
(
bIsFirst
)
ref
.
setOffsetFirst
({
offsetCol
:
col
?
col
:
0
,
offsetRow
:
row
?
row
:
0
});
else
ref
.
setOffsetLast
({
offsetCol
:
col
?
col
:
0
,
offsetRow
:
row
?
row
:
0
});
this
.
Ref
=
ref
;
};
SortState
.
prototype
.
changeColumns
=
function
(
activeRange
,
isDelete
)
{
var
bIsSortStateDelete
=
true
;
//если изменяем диапазон так, что удаляется колонка с сортировкой, удаляем ее
if
(
this
.
SortConditions
)
{
for
(
var
i
=
0
;
i
<
this
.
SortConditions
.
length
;
++
i
)
{
var
bIsSortConditionsDelete
=
this
.
SortConditions
[
i
].
changeColumns
(
activeRange
,
isDelete
);
if
(
bIsSortConditionsDelete
)
{
this
.
SortConditions
[
i
]
=
null
;
}
else
{
bIsSortStateDelete
=
false
;
}
}
}
return
bIsSortStateDelete
;
};
/** @constructor */
/** @constructor */
function
TableColumn
()
{
function
TableColumn
()
{
this
.
Name
=
null
;
this
.
Name
=
null
;
...
@@ -7216,13 +7328,51 @@ function SortCondition() {
...
@@ -7216,13 +7328,51 @@ function SortCondition() {
}
}
SortCondition
.
prototype
.
clone
=
function
()
{
SortCondition
.
prototype
.
clone
=
function
()
{
var
res
=
new
SortCondition
();
var
res
=
new
SortCondition
();
res
.
Ref
=
this
.
Ref
;
res
.
Ref
=
this
.
Ref
?
this
.
Ref
.
clone
()
:
null
;
res
.
ConditionSortBy
=
this
.
ConditionSortBy
;
res
.
ConditionSortBy
=
this
.
ConditionSortBy
;
res
.
ConditionDescending
=
this
.
ConditionDescending
;
res
.
ConditionDescending
=
this
.
ConditionDescending
;
if
(
this
.
dxf
)
if
(
this
.
dxf
)
res
.
dxf
=
this
.
dxf
.
clone
();
res
.
dxf
=
this
.
dxf
.
clone
();
return
res
;
return
res
;
};
};
SortCondition
.
prototype
.
moveRef
=
function
(
col
,
row
)
{
var
ref
=
this
.
Ref
.
clone
();
ref
.
setOffset
({
offsetCol
:
col
?
col
:
0
,
offsetRow
:
row
?
row
:
0
});
this
.
Ref
=
ref
;
};
SortCondition
.
prototype
.
changeColumns
=
function
(
activeRange
,
isDelete
)
{
var
bIsDeleteCurSortCondition
=
false
;
var
ref
=
this
.
Ref
.
clone
();
var
offsetCol
=
null
;
if
(
isDelete
)
{
if
(
activeRange
.
c1
<=
ref
.
c1
&&
activeRange
.
c2
>=
ref
.
c1
)
{
bIsDeleteCurSortCondition
=
true
;
}
else
if
(
activeRange
.
c1
<
ref
.
c1
)
{
offsetCol
=
-
(
activeRange
.
c2
-
activeRange
.
c1
+
1
);
}
}
else
{
if
(
activeRange
.
c1
<=
ref
.
c1
)
{
offsetCol
=
activeRange
.
c2
-
activeRange
.
c1
+
1
;
}
}
if
(
null
!==
offsetCol
)
{
ref
.
setOffset
({
offsetCol
:
offsetCol
,
offsetRow
:
0
});
this
.
Ref
=
ref
;
}
return
bIsDeleteCurSortCondition
;
};
function
AutoFilterDateElem
(
start
,
end
,
dateTimeGrouping
)
{
function
AutoFilterDateElem
(
start
,
end
,
dateTimeGrouping
)
{
this
.
start
=
start
;
this
.
start
=
start
;
...
...
cell/model/autofilters.js
View file @
bb3c31b1
...
@@ -1411,8 +1411,7 @@
...
@@ -1411,8 +1411,7 @@
{
{
diffColId
=
ref
.
c1
-
activeRange
.
c2
-
1
;
diffColId
=
ref
.
c1
-
activeRange
.
c2
-
1
;
if
(
bTablePart
)
filter
.
deleteTableColumns
(
activeRange
);
filter
.
deleteTableColumns
(
activeRange
);
filter
.
changeRef
(
-
diffColId
,
null
,
true
);
filter
.
changeRef
(
-
diffColId
,
null
,
true
);
}
}
...
@@ -1424,9 +1423,9 @@
...
@@ -1424,9 +1423,9 @@
oldFilter
=
filter
.
clone
(
null
);
oldFilter
=
filter
.
clone
(
null
);
diffColId
=
activeRange
.
c1
-
ref
.
c2
-
1
;
diffColId
=
activeRange
.
c1
-
ref
.
c2
-
1
;
if
(
diff
<
0
&&
bTablePart
)
if
(
diff
<
0
)
filter
.
deleteTableColumns
(
activeRange
);
filter
.
deleteTableColumns
(
activeRange
);
else
if
(
bTablePart
)
else
filter
.
addTableColumns
(
activeRange
,
t
);
filter
.
addTableColumns
(
activeRange
,
t
);
filter
.
changeRef
(
diffColId
);
filter
.
changeRef
(
diffColId
);
...
@@ -1435,9 +1434,9 @@
...
@@ -1435,9 +1434,9 @@
{
{
oldFilter
=
filter
.
clone
(
null
);
oldFilter
=
filter
.
clone
(
null
);
if
(
diff
<
0
&&
bTablePart
)
if
(
diff
<
0
)
filter
.
deleteTableColumns
(
activeRange
);
filter
.
deleteTableColumns
(
activeRange
);
else
if
(
bTablePart
)
else
filter
.
addTableColumns
(
activeRange
,
t
);
filter
.
addTableColumns
(
activeRange
,
t
);
filter
.
changeRef
(
diff
);
filter
.
changeRef
(
diff
);
...
@@ -1681,6 +1680,7 @@
...
@@ -1681,6 +1680,7 @@
sortProps
=
this
.
getPropForSort
(
cellId
,
activeRange
,
displayName
);
sortProps
=
this
.
getPropForSort
(
cellId
,
activeRange
,
displayName
);
curFilter
=
sortProps
.
curFilter
,
sortRange
=
sortProps
.
sortRange
,
filterRef
=
sortProps
.
filterRef
,
startCol
=
sortProps
.
startCol
,
maxFilterRow
=
sortProps
.
maxFilterRow
;
curFilter
=
sortProps
.
curFilter
,
sortRange
=
sortProps
.
sortRange
,
filterRef
=
sortProps
.
filterRef
,
startCol
=
sortProps
.
startCol
,
maxFilterRow
=
sortProps
.
maxFilterRow
;
var
bIsAutoFilter
=
curFilter
.
isAutoFilter
();
var
onSortAutoFilterCallback
=
function
(
type
)
var
onSortAutoFilterCallback
=
function
(
type
)
{
{
...
@@ -1692,8 +1692,14 @@
...
@@ -1692,8 +1692,14 @@
//изменяем содержимое фильтра
//изменяем содержимое фильтра
if
(
!
curFilter
.
SortState
)
if
(
!
curFilter
.
SortState
)
{
{
var
sortStateRange
=
new
Asc
.
Range
(
curFilter
.
Ref
.
c1
,
curFilter
.
Ref
.
r1
,
curFilter
.
Ref
.
c2
,
maxFilterRow
);
if
(
bIsAutoFilter
||
(
!
bIsAutoFilter
&&
null
===
curFilter
.
HeaderRowCount
))
{
sortStateRange
.
r1
++
;
}
curFilter
.
SortState
=
new
AscCommonExcel
.
SortState
();
curFilter
.
SortState
=
new
AscCommonExcel
.
SortState
();
curFilter
.
SortState
.
Ref
=
new
Asc
.
Range
(
startCol
,
curFilter
.
Ref
.
r1
,
startCol
,
maxFilterRow
)
;
curFilter
.
SortState
.
Ref
=
sortStateRange
;
curFilter
.
SortState
.
SortConditions
=
[];
curFilter
.
SortState
.
SortConditions
=
[];
curFilter
.
SortState
.
SortConditions
[
0
]
=
new
AscCommonExcel
.
SortCondition
();
curFilter
.
SortState
.
SortConditions
[
0
]
=
new
AscCommonExcel
.
SortCondition
();
}
}
...
@@ -1729,8 +1735,14 @@
...
@@ -1729,8 +1735,14 @@
//изменяем содержимое фильтра
//изменяем содержимое фильтра
if
(
!
curFilter
.
SortState
)
if
(
!
curFilter
.
SortState
)
{
{
var
sortStateRange
=
new
Asc
.
Range
(
curFilter
.
Ref
.
c1
,
curFilter
.
Ref
.
r1
,
curFilter
.
Ref
.
c2
,
maxFilterRow
);
if
(
bIsAutoFilter
||
(
!
bIsAutoFilter
&&
null
===
curFilter
.
HeaderRowCount
))
{
sortStateRange
.
r1
++
;
}
curFilter
.
SortState
=
new
AscCommonExcel
.
SortState
();
curFilter
.
SortState
=
new
AscCommonExcel
.
SortState
();
curFilter
.
SortState
.
Ref
=
new
Asc
.
Range
(
startCol
,
curFilter
.
Ref
.
r1
,
startCol
,
maxFilterRow
)
;
curFilter
.
SortState
.
Ref
=
sortStateRange
;
curFilter
.
SortState
.
SortConditions
=
[];
curFilter
.
SortState
.
SortConditions
=
[];
curFilter
.
SortState
.
SortConditions
[
0
]
=
new
AscCommonExcel
.
SortCondition
();
curFilter
.
SortState
.
SortConditions
[
0
]
=
new
AscCommonExcel
.
SortCondition
();
}
}
...
...
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