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
fa9b68e7
Commit
fa9b68e7
authored
Apr 06, 2016
by
GoshaZotov
Committed by
Alexander.Trofimov
May 19, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add to history format table change name
parent
4698887a
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
62 additions
and
20 deletions
+62
-20
cell/model/History.js
cell/model/History.js
+1
-0
cell/model/WorkbookElems.js
cell/model/WorkbookElems.js
+5
-0
cell/model/autofilters.js
cell/model/autofilters.js
+44
-0
cell/view/WorksheetView.js
cell/view/WorksheetView.js
+12
-20
No files found.
cell/model/History.js
View file @
fa9b68e7
...
...
@@ -105,6 +105,7 @@ var historyitem_AutoFilter_Change = 10;
var
historyitem_AutoFilter_CleanFormat
=
11
;
var
historyitem_AutoFilter_ChangeTableInfo
=
12
;
var
historyitem_AutoFilter_ChangeTableRef
=
13
;
var
historyitem_AutoFilter_ChangeTableName
=
14
;
function
CHistory
(
workbook
)
...
...
cell/model/WorkbookElems.js
View file @
fa9b68e7
...
...
@@ -4833,6 +4833,11 @@ TablePart.prototype.generateTotalsRowLabel = function()
this
.
TableColumns
[
0
].
generateTotalsRowLabel
();
};
TablePart
.
prototype
.
changeDisplayName
=
function
(
newName
)
{
this
.
DisplayName
=
newName
;
};
/** @constructor */
function
AutoFilter
()
{
this
.
Ref
=
null
;
...
...
cell/model/autofilters.js
View file @
fa9b68e7
...
...
@@ -730,6 +730,9 @@
case
historyitem_AutoFilter_ChangeTableRef
:
this
.
changeTableRange
(
data
.
displayName
,
data
.
moveTo
);
break
;
case
historyitem_AutoFilter_ChangeTableName
:
this
.
changeDisplayNameTable
(
data
.
displayName
,
data
.
val
);
break
;
}
History
.
TurnOn
();
},
...
...
@@ -800,6 +803,19 @@
}
}
}
else
if
(
type
===
historyitem_AutoFilter_ChangeTableName
)
{
var
oldName
=
cloneData
.
newDisplayName
;
for
(
var
l
=
0
;
l
<
worksheet
.
TableParts
.
length
;
l
++
)
{
if
(
oldName
===
worksheet
.
TableParts
[
l
].
DisplayName
)
{
worksheet
.
TableParts
[
l
]
=
cloneData
.
oldFilter
.
clone
(
null
);
break
;
}
}
}
else
if
(
type
===
historyitem_AutoFilter_Sort
&&
cloneData
.
oldFilter
)
//сортировка
{
if
(
worksheet
.
AutoFilter
&&
cloneData
.
oldFilter
.
getType
()
===
g_nFiltersType
.
autoFilter
)
...
...
@@ -2238,6 +2254,34 @@
this
.
_setColorStyleTable
(
tablePart
.
Ref
,
tablePart
,
null
,
true
);
},
changeDisplayNameTable
:
function
(
tableName
,
newName
)
{
var
tablePart
=
this
.
_getFilterByDisplayName
(
tableName
);
var
worksheet
=
this
.
worksheet
;
if
(
!
tablePart
)
{
return
false
;
}
var
oldFilter
=
tablePart
.
clone
(
null
);
History
.
Create_NewPoint
();
History
.
StartTransaction
();
//TODO добавлять в историю смену именного диапазона
var
oldNamedrange
=
worksheet
.
workbook
.
dependencyFormulas
.
getDefNameNodeByName
(
tablePart
.
DisplayName
);
var
newNamedrange
=
oldNamedrange
.
clone
();
newNamedrange
.
Name
=
newName
;
oldNamedrange
.
changeDefName
(
newNamedrange
);
tablePart
.
changeDisplayName
(
newName
);
this
.
_addHistoryObj
({
oldFilter
:
oldFilter
,
newFilterRef
:
tablePart
.
Ref
.
clone
(),
newDisplayName
:
newName
},
historyitem_AutoFilter_ChangeTableName
,
{
activeCells
:
tablePart
.
Ref
.
clone
(),
val
:
newName
,
displayName
:
tableName
});
History
.
EndTransaction
();
},
_clearRange
:
function
(
range
,
isClearText
)
{
range
.
setTableStyle
(
null
);
...
...
cell/view/WorksheetView.js
View file @
fa9b68e7
...
...
@@ -12803,6 +12803,7 @@
WorksheetView
.
prototype
.
af_changeFormatTableInfo
=
function
(
tableName
,
optionType
,
val
)
{
var
tablePart
=
this
.
model
.
autoFilters
.
_getFilterByDisplayName
(
tableName
);
var
t
=
this
;
if
(
!
tablePart
||
(
tablePart
&&
!
tablePart
.
TableStyleInfo
))
{
...
...
@@ -12811,14 +12812,18 @@
var
isChangeTableInfo
=
this
.
af_checkChangeTableInfo
(
tablePart
,
optionType
);
if
(
isChangeTableInfo
!==
false
)
{
var
callback
=
function
()
{
History
.
Create_NewPoint
();
History
.
StartTransaction
();
this
.
model
.
autoFilters
.
changeFormatTableInfo
(
tableName
,
optionType
,
val
);
t
.
model
.
autoFilters
.
changeFormatTableInfo
(
tableName
,
optionType
,
val
);
this
.
_onUpdateFormatTable
(
isChangeTableInfo
,
false
,
true
);
//TODO добавить перерисовку таблицы и перерисовку шаблонов
t
.
_onUpdateFormatTable
(
isChangeTableInfo
,
false
,
true
);
History
.
EndTransaction
();
};
t
.
_isLockedCells
(
tablePart
.
Ref
,
null
,
callback
);
}
};
...
...
@@ -13032,20 +13037,7 @@
var
ws
=
this
.
model
;
var
acitveRange
=
this
.
activeRange
.
clone
();
var
tablePart
=
ws
.
autoFilters
.
_getFilterByDisplayName
(
tableName
);
if
(
!
tablePart
)
{
return
false
;
}
//TODO тестовый вариант. нужно сделать методы и добавлять в историю
var
oldNamedrange
=
this
.
model
.
workbook
.
dependencyFormulas
.
getDefNameNodeByName
(
tablePart
.
DisplayName
);
var
newNamedrange
=
oldNamedrange
.
clone
();
newNamedrange
.
Name
=
newName
;
oldNamedrange
.
changeDefName
(
newNamedrange
);
tablePart
.
DisplayName
=
newName
;
this
.
model
.
autoFilters
.
changeDisplayNameTable
(
tableName
,
newName
);
};
WorksheetView
.
prototype
.
af_checkInsDelCells
=
function
(
activeRange
,
val
,
prop
)
...
...
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