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
c5d17452
Commit
c5d17452
authored
May 16, 2016
by
GoshaZotov
Committed by
Alexander.Trofimov
May 19, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add functions for context menu(filter options)
parent
ec0b939d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
137 additions
and
9 deletions
+137
-9
cell/api.js
cell/api.js
+6
-0
cell/model/UndoRedo.js
cell/model/UndoRedo.js
+2
-2
cell/model/autofilters.js
cell/model/autofilters.js
+29
-2
cell/view/WorksheetView.js
cell/view/WorksheetView.js
+100
-5
No files found.
cell/api.js
View file @
c5d17452
...
...
@@ -552,6 +552,11 @@ var editor;
var
ws
=
this
.
wb
.
getWorksheet
();
ws
.
applyAutoFilter
(
autoFilterObject
);
};
spreadsheet_api
.
prototype
.
asc_applyAutoFilterByType
=
function
(
autoFilterObject
)
{
var
ws
=
this
.
wb
.
getWorksheet
();
ws
.
applyAutoFilterByType
(
autoFilterObject
);
};
spreadsheet_api
.
prototype
.
asc_sortColFilter
=
function
(
type
,
cellId
,
displayName
,
color
)
{
var
ws
=
this
.
wb
.
getWorksheet
();
...
...
@@ -3331,6 +3336,7 @@ var editor;
prot
[
"
asc_addAutoFilter
"
]
=
prot
.
asc_addAutoFilter
;
prot
[
"
asc_changeAutoFilter
"
]
=
prot
.
asc_changeAutoFilter
;
prot
[
"
asc_applyAutoFilter
"
]
=
prot
.
asc_applyAutoFilter
;
prot
[
"
asc_applyAutoFilterByType
"
]
=
prot
.
asc_applyAutoFilterByType
;
prot
[
"
asc_sortColFilter
"
]
=
prot
.
asc_sortColFilter
;
prot
[
"
asc_getAddFormatTableOptions
"
]
=
prot
.
asc_getAddFormatTableOptions
;
prot
[
"
asc_clearFilter
"
]
=
prot
.
asc_clearFilter
;
...
...
cell/model/UndoRedo.js
View file @
c5d17452
...
...
@@ -452,8 +452,8 @@ var UndoRedoDataTypes = new function() {
case
this
.
SheetPositions
:
return
new
UndoRedoData_SheetPositions
();
break
;
case
this
.
ClrScheme
:
return
new
UndoRedoData_ClrScheme
();
break
;
case
this
.
AutoFilter
:
return
new
UndoRedoData_AutoFilter
();
break
;
case
this
.
AutoFiltersOptions
:
return
new
Asc
CommonExcel
.
AutoFiltersOptions
();
break
;
case
this
.
AutoFilterObj
:
return
new
Asc
CommonExcel
.
AutoFilterObj
();
break
;
case
this
.
AutoFiltersOptions
:
return
new
Asc
.
AutoFiltersOptions
();
break
;
case
this
.
AutoFilterObj
:
return
new
Asc
.
AutoFilterObj
();
break
;
case
this
.
CustomFilters
:
return
new
Asc
.
CustomFilters
();
break
;
case
this
.
CustomFilter
:
return
new
Asc
.
CustomFilter
();
break
;
case
this
.
ColorFilter
:
return
new
Asc
.
ColorFilter
();
break
;
...
...
cell/model/autofilters.js
View file @
c5d17452
...
...
@@ -1793,6 +1793,33 @@
return
false
;
},
isStartRangeContainIntoTableOrFilter
:
function
(
range
)
{
var
res
=
null
;
var
worksheet
=
this
.
worksheet
;
var
tableParts
=
worksheet
.
TableParts
;
var
startRange
=
new
Asc
.
Range
(
range
.
startCol
,
range
.
startRow
,
range
.
startCol
,
range
.
startRow
);
for
(
var
i
=
0
;
i
<
tableParts
.
length
;
i
++
)
{
if
(
startRange
.
intersection
(
tableParts
[
i
].
Ref
))
{
res
=
i
;
break
;
}
}
//пересекается, но не равен фильтрованному диапазону. если равен - то фильтр превращается в таблицу
if
(
worksheet
.
AutoFilter
&&
worksheet
.
AutoFilter
.
Ref
&&
startRange
.
intersection
(
worksheet
.
AutoFilter
.
Ref
))
{
res
=
-
1
;
}
return
res
;
},
unmergeTablesAfterMove
:
function
(
arnTo
)
{
var
worksheet
=
this
.
worksheet
;
...
...
@@ -4786,7 +4813,7 @@
window
[
'
AscCommonExcel
'
]
=
window
[
'
AscCommonExcel
'
]
||
{};
window
[
"
AscCommonExcel
"
].
AutoFilters
=
AutoFilters
;
window
[
"
Asc
CommonExcel
"
].
AutoFiltersOptions
=
AutoFiltersOptions
;
window
[
"
Asc
"
].
AutoFiltersOptions
=
AutoFiltersOptions
;
prot
=
AutoFiltersOptions
.
prototype
;
prot
[
"
asc_setSortState
"
]
=
prot
.
asc_setSortState
;
prot
[
"
asc_getSortState
"
]
=
prot
.
asc_getSortState
;
...
...
@@ -4799,7 +4826,7 @@
prot
[
"
asc_getColorsFont
"
]
=
prot
.
asc_getColorsFont
;
prot
[
"
asc_getSortColor
"
]
=
prot
.
asc_getSortColor
;
window
[
"
Asc
CommonExcel
"
].
AutoFilterObj
=
AutoFilterObj
;
window
[
"
Asc
"
].
AutoFilterObj
=
AutoFilterObj
;
prot
=
AutoFilterObj
.
prototype
;
prot
[
"
asc_getType
"
]
=
prot
.
asc_getType
;
prot
[
"
asc_setFilter
"
]
=
prot
.
asc_setFilter
;
...
...
cell/view/WorksheetView.js
View file @
c5d17452
...
...
@@ -12007,6 +12007,95 @@
}
};
this
.
_isLockedAll
(
onChangeAutoFilterCallback
);
};
WorksheetView
.
prototype
.
applyAutoFilterByType
=
function
(
autoFilterObject
)
{
var
t
=
this
;
var
ar
=
t
.
activeRange
.
clone
(
true
);
var
isStartRangeIntoFilterOrTable
=
t
.
model
.
autoFilters
.
isStartRangeContainIntoTableOrFilter
(
ar
);
var
isApplyAutoFilter
=
null
,
iaAddAutoFilter
=
null
,
cellId
,
filterProps
;
if
(
null
!==
isStartRangeIntoFilterOrTable
)
//into autofilter or format table
{
if
(
-
1
===
isStartRangeIntoFilterOrTable
)
//autofilter
{
var
autoFilter
=
t
.
model
.
AutoFilter
;
var
colId
=
ar
.
c1
-
autoFilter
.
Ref
.
c1
;
filterProps
=
{
id
:
null
,
colId
:
colId
};
isApplyAutoFilter
=
true
;
}
else
if
(
t
.
model
.
TableParts
[
isStartRangeIntoFilterOrTable
])
//format table
{
var
formatTable
=
t
.
model
.
TableParts
[
isStartRangeIntoFilterOrTable
];
if
(
formatTable
.
AutoFilter
)
{
var
autoFilter
=
t
.
model
.
AutoFilter
;
var
colId
=
ar
.
c1
-
autoFilter
.
Ref
.
c1
;
filterProps
=
{
id
:
null
,
colId
:
colId
};
isApplyAutoFilter
=
true
;
}
else
{
}
}
}
else
//without filter
{
}
var
onChangeAutoFilterCallback
=
function
(
isSuccess
)
{
if
(
false
===
isSuccess
)
{
return
;
}
History
.
Create_NewPoint
();
History
.
StartTransaction
();
if
(
null
!==
isAddAutoFilter
)
{
t
.
model
.
autoFilters
.
addAutoFilter
(
null
,
ar
,
addFormatTableOptionsObj
);
}
if
(
null
!==
isApplyAutoFilter
)
{
var
autoFilterObject
=
t
.
af_setDialogProp
(
filterProps
,
true
);
var
applyFilterProps
=
t
.
model
.
autoFilters
.
applyAutoFilter
(
autoFilterObject
,
ar
);
var
rowChange
=
applyFilterProps
.
rowChange
;
var
rangeOldFilter
=
applyFilterProps
.
rangeOldFilter
;
if
(
null
!==
rangeOldFilter
&&
!
t
.
model
.
workbook
.
bUndoChanges
&&
!
t
.
model
.
workbook
.
bRedoChanges
)
{
t
.
_onUpdateFormatTable
(
rangeOldFilter
,
false
,
true
);
}
if
(
null
!==
rowChange
)
{
t
.
objectRender
.
updateSizeDrawingObjects
(
{
target
:
c_oTargetType
.
RowResize
,
row
:
rowChange
}
);
}
}
History
.
EndTransaction
();
};
if
(
null
!==
isAddAutoFilter
)
//do not add autoFilter
{
this
.
_isLockedAll
(
onChangeAutoFilterCallback
);
}
else
//add autofilter + apply
{
if
(
t
.
_checkAddAutoFilter
(
ar
,
styleName
,
addFormatTableOptionsObj
)
===
true
)
{
this
.
_isLockedAll
(
onChangeAutoFilterCallback
);
this
.
_isLockedDefNames
(
null
,
null
);
}
}
};
WorksheetView
.
prototype
.
sortColFilter
=
function
(
type
,
cellId
,
displayName
,
color
)
{
...
...
@@ -12622,7 +12711,7 @@
return
result
;
};
WorksheetView
.
prototype
.
af_setDialogProp
=
function
(
filterProp
)
WorksheetView
.
prototype
.
af_setDialogProp
=
function
(
filterProp
,
isReturnProps
)
{
var
ws
=
this
.
model
;
...
...
@@ -12651,7 +12740,7 @@
var
cellId
=
ws
.
autoFilters
.
_rangeToId
(
rangeButton
);
//get filter object
var
filterObj
=
new
Asc
CommonExcel
.
AutoFilterObj
();
var
filterObj
=
new
Asc
.
AutoFilterObj
();
if
(
filters
&&
filters
.
ColorFilter
)
{
filterObj
.
type
=
c_oAscAutoFilterTypes
.
ColorFilter
;
...
...
@@ -12730,7 +12819,7 @@
//set menu object
var
autoFilterObject
=
new
Asc
CommonExcel
.
AutoFiltersOptions
();
var
autoFilterObject
=
new
Asc
.
AutoFiltersOptions
();
autoFilterObject
.
asc_setSortState
(
sortVal
);
autoFilterObject
.
asc_setCellId
(
cellId
);
...
...
@@ -12747,8 +12836,14 @@
autoFilterObject
.
asc_setColorsFill
(
filterTypes
.
colors
);
autoFilterObject
.
asc_setColorsFont
(
filterTypes
.
fontColors
);
this
.
handlers
.
trigger
(
"
setAutoFiltersDialog
"
,
autoFilterObject
);
if
(
isReturnProps
)
{
return
autoFilterObject
;
}
else
{
this
.
handlers
.
trigger
(
"
setAutoFiltersDialog
"
,
autoFilterObject
);
}
};
WorksheetView
.
prototype
.
af_getFilterTypes
=
function
(
columnRange
)
...
...
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