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
4698887a
Commit
4698887a
authored
Apr 06, 2016
by
GoshaZotov
Committed by
Alexander.Trofimov
May 19, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add function for change format table ref(af_changeTableRange)
parent
455a942a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
76 additions
and
6 deletions
+76
-6
cell/model/History.js
cell/model/History.js
+1
-0
cell/model/WorkbookElems.js
cell/model/WorkbookElems.js
+52
-2
cell/model/autofilters.js
cell/model/autofilters.js
+20
-3
cell/view/WorksheetView.js
cell/view/WorksheetView.js
+3
-1
No files found.
cell/model/History.js
View file @
4698887a
...
@@ -104,6 +104,7 @@ var historyitem_AutoFilter_ChangeTableStyle = 9;
...
@@ -104,6 +104,7 @@ var historyitem_AutoFilter_ChangeTableStyle = 9;
var
historyitem_AutoFilter_Change
=
10
;
var
historyitem_AutoFilter_Change
=
10
;
var
historyitem_AutoFilter_CleanFormat
=
11
;
var
historyitem_AutoFilter_CleanFormat
=
11
;
var
historyitem_AutoFilter_ChangeTableInfo
=
12
;
var
historyitem_AutoFilter_ChangeTableInfo
=
12
;
var
historyitem_AutoFilter_ChangeTableRef
=
13
;
function
CHistory
(
workbook
)
function
CHistory
(
workbook
)
...
...
cell/model/WorkbookElems.js
View file @
4698887a
...
@@ -4563,6 +4563,47 @@ TablePart.prototype.changeRef = function(col, row, bIsFirst) {
...
@@ -4563,6 +4563,47 @@ TablePart.prototype.changeRef = function(col, row, bIsFirst) {
if
(
this
.
AutoFilter
)
if
(
this
.
AutoFilter
)
this
.
AutoFilter
.
changeRef
(
col
,
row
,
bIsFirst
);
this
.
AutoFilter
.
changeRef
(
col
,
row
,
bIsFirst
);
};
};
TablePart
.
prototype
.
changeRefOnRange
=
function
(
range
,
autoFilters
,
generateNewTableColumns
)
{
if
(
!
range
)
return
;
//add table columns
if
(
generateNewTableColumns
)
{
var
newTableColumns
=
[];
var
intersectionRanges
=
this
.
Ref
.
intersection
(
range
);
for
(
var
i
=
range
.
c1
;
i
<=
range
.
c2
;
i
++
)
{
var
tableColumn
;
if
(
i
>=
intersectionRanges
.
c1
&&
i
<=
intersectionRanges
.
c2
)
{
var
tableIndex
=
i
-
this
.
Ref
.
c1
;
tableColumn
=
this
.
TableColumns
[
tableIndex
];
}
else
{
tableColumn
=
new
TableColumn
();
}
newTableColumns
.
push
(
tableColumn
);
}
for
(
var
j
=
0
;
j
<
newTableColumns
.
length
;
j
++
)
{
if
(
newTableColumns
[
j
].
Name
===
null
)
newTableColumns
[
j
].
Name
=
autoFilters
.
_generateColumnName2
(
newTableColumns
);
}
this
.
TableColumns
=
newTableColumns
;
}
this
.
Ref
=
Asc
.
Range
(
range
.
c1
,
range
.
r1
,
range
.
c2
,
range
.
r2
);
//event
this
.
handlers
.
trigger
(
"
changeRefTablePart
"
,
this
.
DisplayName
,
this
.
Ref
);
if
(
this
.
AutoFilter
)
this
.
AutoFilter
.
changeRefOnRange
(
range
);
};
TablePart
.
prototype
.
isApplyAutoFilter
=
function
()
{
TablePart
.
prototype
.
isApplyAutoFilter
=
function
()
{
var
res
=
false
;
var
res
=
false
;
...
@@ -4634,7 +4675,7 @@ TablePart.prototype.addTableColumns = function(activeRange, autoFilters)
...
@@ -4634,7 +4675,7 @@ TablePart.prototype.addTableColumns = function(activeRange, autoFilters)
for
(
var
j
=
0
;
j
<
newTableColumns
.
length
;
j
++
)
for
(
var
j
=
0
;
j
<
newTableColumns
.
length
;
j
++
)
{
{
if
(
newTableColumns
[
j
].
Name
===
null
)
if
(
newTableColumns
[
j
].
Name
===
null
)
newTableColumns
[
j
].
Name
=
autoFilters
.
_generateColumnName2
(
newTableColumns
,
newTableColumns
[
j
-
1
].
Name
);
newTableColumns
[
j
].
Name
=
autoFilters
.
_generateColumnName2
(
newTableColumns
);
}
}
this
.
TableColumns
=
newTableColumns
;
this
.
TableColumns
=
newTableColumns
;
...
@@ -4644,7 +4685,7 @@ TablePart.prototype.addTableLastColumn = function(activeRange, autoFilters, isAd
...
@@ -4644,7 +4685,7 @@ TablePart.prototype.addTableLastColumn = function(activeRange, autoFilters, isAd
{
{
var
newTableColumns
=
this
.
TableColumns
;
var
newTableColumns
=
this
.
TableColumns
;
newTableColumns
.
push
(
new
TableColumn
());
newTableColumns
.
push
(
new
TableColumn
());
newTableColumns
[
newTableColumns
.
length
-
1
].
Name
=
autoFilters
.
_generateColumnName2
(
newTableColumns
,
newTableColumns
[
newTableColumns
.
length
-
2
].
Name
);
newTableColumns
[
newTableColumns
.
length
-
1
].
Name
=
autoFilters
.
_generateColumnName2
(
newTableColumns
);
this
.
TableColumns
=
newTableColumns
;
this
.
TableColumns
=
newTableColumns
;
};
};
...
@@ -4846,6 +4887,15 @@ AutoFilter.prototype.changeRef = function(col, row, bIsFirst) {
...
@@ -4846,6 +4887,15 @@ AutoFilter.prototype.changeRef = function(col, row, bIsFirst) {
this
.
Ref
=
ref
;
this
.
Ref
=
ref
;
};
};
AutoFilter
.
prototype
.
changeRefOnRange
=
function
(
range
)
{
if
(
!
range
)
return
;
this
.
Ref
=
Asc
.
Range
(
range
.
c1
,
range
.
r1
,
range
.
c2
,
range
.
r2
);
if
(
this
.
AutoFilter
)
this
.
AutoFilter
.
changeRefOnRange
(
range
);
};
AutoFilter
.
prototype
.
isApplyAutoFilter
=
function
()
{
AutoFilter
.
prototype
.
isApplyAutoFilter
=
function
()
{
var
res
=
false
;
var
res
=
false
;
...
...
cell/model/autofilters.js
View file @
4698887a
...
@@ -727,6 +727,9 @@
...
@@ -727,6 +727,9 @@
case
historyitem_AutoFilter_ChangeTableInfo
:
case
historyitem_AutoFilter_ChangeTableInfo
:
this
.
changeFormatTableInfo
(
data
.
displayName
,
data
.
type
,
data
.
val
);
this
.
changeFormatTableInfo
(
data
.
displayName
,
data
.
type
,
data
.
val
);
break
;
break
;
case
historyitem_AutoFilter_ChangeTableRef
:
this
.
changeTableRange
(
data
.
displayName
,
data
.
moveTo
);
break
;
}
}
History
.
TurnOn
();
History
.
TurnOn
();
},
},
...
@@ -768,7 +771,7 @@
...
@@ -768,7 +771,7 @@
else
else
worksheet
.
AutoFilter
=
cloneData
;
worksheet
.
AutoFilter
=
cloneData
;
}
}
else
if
(
type
===
historyitem_AutoFilter_Change
||
type
===
historyitem_AutoFilter_ChangeTableInfo
)
//добавление/удаление строк/столбцов
else
if
(
type
===
historyitem_AutoFilter_Change
||
type
===
historyitem_AutoFilter_ChangeTableInfo
||
type
===
historyitem_AutoFilter_ChangeTableRef
)
{
{
if
(
worksheet
.
AutoFilter
&&
cloneData
.
newFilterRef
.
isEqual
(
worksheet
.
AutoFilter
.
Ref
))
if
(
worksheet
.
AutoFilter
&&
cloneData
.
newFilterRef
.
isEqual
(
worksheet
.
AutoFilter
.
Ref
))
worksheet
.
AutoFilter
=
cloneData
.
oldFilter
.
clone
(
null
);
worksheet
.
AutoFilter
=
cloneData
.
oldFilter
.
clone
(
null
);
...
@@ -2217,7 +2220,22 @@
...
@@ -2217,7 +2220,22 @@
changeTableRange
:
function
(
tableName
,
range
)
changeTableRange
:
function
(
tableName
,
range
)
{
{
var
tablePart
=
this
.
_getFilterByDisplayName
(
tableName
);
if
(
!
tablePart
)
{
return
false
;
}
var
oldFilter
=
tablePart
.
clone
(
null
);
tablePart
.
changeRefOnRange
(
range
,
this
,
true
);
this
.
_addHistoryObj
({
oldFilter
:
oldFilter
,
newFilterRef
:
tablePart
.
Ref
.
clone
()},
historyitem_AutoFilter_ChangeTableRef
,
{
activeCells
:
tablePart
.
Ref
.
clone
(),
arnTo
:
range
,
displayName
:
tableName
});
this
.
_cleanStyleTable
(
oldFilter
.
Ref
);
this
.
_setColorStyleTable
(
tablePart
.
Ref
,
tablePart
,
null
,
true
);
},
},
_clearRange
:
function
(
range
,
isClearText
)
_clearRange
:
function
(
range
,
isClearText
)
...
@@ -4380,10 +4398,9 @@
...
@@ -4380,10 +4398,9 @@
}
}
},
},
_generateColumnName2
:
function
(
tableColumns
,
prevColumnName
)
_generateColumnName2
:
function
(
tableColumns
)
{
{
var
columnName
=
"
Column
"
;
var
columnName
=
"
Column
"
;
var
name
=
prevColumnName
.
split
(
columnName
);
var
indexColumn
=
name
[
1
];
var
indexColumn
=
name
[
1
];
var
nextIndex
;
var
nextIndex
;
...
...
cell/view/WorksheetView.js
View file @
4698887a
...
@@ -13181,9 +13181,11 @@
...
@@ -13181,9 +13181,11 @@
{
{
History
.
Create_NewPoint
();
History
.
Create_NewPoint
();
History
.
StartTransaction
();
History
.
StartTransaction
();
range
=
Asc
.
g_oRangeCache
.
getAscRange
(
range
);
this
.
model
.
autoFilters
.
changeTableRange
(
tableName
,
range
);
this
.
model
.
autoFilters
.
changeTableRange
(
tableName
,
range
);
//this._onUpdateFormatTable(isChangeR
ange, false, true);
this
.
_onUpdateFormatTable
(
r
ange
,
false
,
true
);
//TODO добавить перерисовку таблицы и перерисовку шаблонов
//TODO добавить перерисовку таблицы и перерисовку шаблонов
History
.
EndTransaction
();
History
.
EndTransaction
();
};
};
...
...
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