Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
web-apps
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
web-apps
Commits
e290cea2
Commit
e290cea2
authored
May 04, 2016
by
Julia Radzhabova
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[SSE] Выставление цветовых фильтров.
parent
96ed203d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
74 additions
and
36 deletions
+74
-36
apps/common/main/lib/component/ColorPaletteExt.js
apps/common/main/lib/component/ColorPaletteExt.js
+9
-9
apps/spreadsheeteditor/main/app/view/AutoFilterDialog.js
apps/spreadsheeteditor/main/app/view/AutoFilterDialog.js
+65
-27
No files found.
apps/common/main/lib/component/ColorPaletteExt.js
View file @
e290cea2
...
...
@@ -106,13 +106,13 @@ define([
handleClick
:
function
(
e
)
{
var
me
=
this
;
var
target
=
$
(
e
.
target
).
closest
(
'
a
'
);
var
target
=
$
(
e
.
target
).
closest
(
'
div.palette-color-item
'
);
var
color
,
cmp
;
if
(
target
.
length
==
0
)
return
;
if
(
target
.
hasClass
(
'
color-transparent
'
)
)
{
$
(
me
.
el
).
find
(
'
a
.
'
+
me
.
selectedCls
).
removeClass
(
me
.
selectedCls
);
$
(
me
.
el
).
find
(
'
div
.
'
+
me
.
selectedCls
).
removeClass
(
me
.
selectedCls
);
target
.
addClass
(
me
.
selectedCls
);
me
.
value
=
'
transparent
'
;
me
.
trigger
(
'
select
'
,
me
,
'
transparent
'
);
...
...
@@ -120,7 +120,7 @@ define([
if
(
!
/^
[
a-fA-F0-9
]{6}
$/
.
test
(
me
.
value
)
||
_
.
indexOf
(
me
.
colors
,
me
.
value
)
<
0
)
me
.
value
=
false
;
$
(
me
.
el
).
find
(
'
a
.
'
+
me
.
selectedCls
).
removeClass
(
me
.
selectedCls
);
$
(
me
.
el
).
find
(
'
div
.
'
+
me
.
selectedCls
).
removeClass
(
me
.
selectedCls
);
target
.
addClass
(
me
.
selectedCls
);
color
=
target
[
0
].
className
.
match
(
me
.
colorRe
)[
1
];
...
...
@@ -142,21 +142,21 @@ define([
select
:
function
(
color
,
suppressEvent
)
{
var
el
=
$
(
this
.
el
);
el
.
find
(
'
a
.
'
+
this
.
selectedCls
).
removeClass
(
this
.
selectedCls
);
el
.
find
(
'
div
.
'
+
this
.
selectedCls
).
removeClass
(
this
.
selectedCls
);
if
(
!
color
)
return
;
if
(
typeof
(
color
)
==
'
object
'
)
{
var
effectEl
;
if
(
color
.
effectId
!==
undefined
)
{
effectEl
=
el
.
find
(
'
a
[effectid="
'
+
color
.
effectId
+
'
"]
'
).
first
();
effectEl
=
el
.
find
(
'
div
[effectid="
'
+
color
.
effectId
+
'
"]
'
).
first
();
if
(
effectEl
.
length
>
0
)
{
effectEl
.
addClass
(
this
.
selectedCls
);
this
.
value
=
effectEl
[
0
].
className
.
match
(
this
.
colorRe
)[
1
].
toUpperCase
();
}
else
this
.
value
=
false
;
}
else
if
(
color
.
effectValue
!==
undefined
)
{
effectEl
=
el
.
find
(
'
a
[effectvalue="
'
+
color
.
effectValue
+
'
"].color-
'
+
color
.
color
.
toUpperCase
()).
first
();
effectEl
=
el
.
find
(
'
div
[effectvalue="
'
+
color
.
effectValue
+
'
"].color-
'
+
color
.
color
.
toUpperCase
()).
first
();
if
(
effectEl
.
length
>
0
)
{
effectEl
.
addClass
(
this
.
selectedCls
);
this
.
value
=
effectEl
[
0
].
className
.
match
(
this
.
colorRe
)[
1
].
toUpperCase
();
...
...
@@ -173,7 +173,7 @@ define([
if
(
_
.
indexOf
(
this
.
colors
,
this
.
value
)
<
0
)
this
.
value
=
false
;
if
(
color
!=
this
.
value
||
this
.
options
.
allowReselect
)
{
(
color
==
'
transparent
'
)
?
el
.
find
(
'
a.color-transparent
'
).
addClass
(
this
.
selectedCls
)
:
el
.
find
(
'
a
.palette-color.color-
'
+
color
).
first
().
addClass
(
this
.
selectedCls
);
(
color
==
'
transparent
'
)
?
el
.
find
(
'
div.color-transparent
'
).
addClass
(
this
.
selectedCls
)
:
el
.
find
(
'
div
.palette-color.color-
'
+
color
).
first
().
addClass
(
this
.
selectedCls
);
this
.
value
=
color
;
if
(
suppressEvent
!==
true
)
{
this
.
fireEvent
(
'
select
'
,
this
,
color
);
...
...
@@ -182,7 +182,7 @@ define([
}
else
{
var
co
=
el
.
find
(
'
#
'
+
color
).
first
();
if
(
co
.
length
==
0
)
co
=
el
.
find
(
'
a
[color="
'
+
color
+
'
"]
'
).
first
();
co
=
el
.
find
(
'
div
[color="
'
+
color
+
'
"]
'
).
first
();
if
(
co
.
length
>
0
)
{
co
.
addClass
(
this
.
selectedCls
);
this
.
value
=
color
.
toUpperCase
();
...
...
@@ -206,7 +206,7 @@ define([
},
clearSelection
:
function
(
suppressEvent
)
{
$
(
this
.
el
).
find
(
'
a
.
'
+
this
.
selectedCls
).
removeClass
(
this
.
selectedCls
);
$
(
this
.
el
).
find
(
'
div
.
'
+
this
.
selectedCls
).
removeClass
(
this
.
selectedCls
);
this
.
value
=
undefined
;
}
});
...
...
apps/spreadsheeteditor/main/app/view/AutoFilterDialog.js
View file @
e290cea2
...
...
@@ -519,6 +519,7 @@ define([
'
006400
'
,
'
800080
'
,
'
8B0000
'
,
'
808000
'
,
'
FFFFFF
'
,
'
D3D3D3
'
]
});
this
.
mnuSortColorCellsPicker
.
on
(
'
select
'
,
_
.
bind
(
this
.
onSortColorCellsSelect
,
this
));
this
.
mnuSortColorFontPicker
=
new
Common
.
UI
.
ColorPaletteExt
({
el
:
$
(
'
#filter-dlg-sort-font-color
'
),
...
...
@@ -529,6 +530,7 @@ define([
'
006400
'
,
'
800080
'
,
'
8B0000
'
,
'
808000
'
,
'
FFFFFF
'
,
'
D3D3D3
'
]
});
this
.
mnuSortColorFontPicker
.
on
(
'
select
'
,
_
.
bind
(
this
.
onSortColorFontSelect
,
this
));
this
.
mnuFilterColorCellsPicker
=
new
Common
.
UI
.
ColorPaletteExt
({
el
:
$
(
'
#filter-dlg-filter-cells-color
'
),
...
...
@@ -539,6 +541,7 @@ define([
'
006400
'
,
'
800080
'
,
'
8B0000
'
,
'
808000
'
,
'
FFFFFF
'
,
'
D3D3D3
'
]
});
this
.
mnuFilterColorCellsPicker
.
on
(
'
select
'
,
_
.
bind
(
this
.
onFilterColorSelect
,
this
,
null
));
this
.
mnuFilterColorFontPicker
=
new
Common
.
UI
.
ColorPaletteExt
({
el
:
$
(
'
#filter-dlg-filter-font-color
'
),
...
...
@@ -549,6 +552,7 @@ define([
'
006400
'
,
'
800080
'
,
'
8B0000
'
,
'
808000
'
,
'
FFFFFF
'
,
'
D3D3D3
'
]
});
this
.
mnuFilterColorFontPicker
.
on
(
'
select
'
,
_
.
bind
(
this
.
onFilterColorSelect
,
this
,
false
));
this
.
input
=
new
Common
.
UI
.
InputField
({
el
:
$
(
'
#id-sd-cell-search
'
,
this
.
$window
),
...
...
@@ -742,6 +746,30 @@ define([
dlgDigitalFilter
.
show
();
},
onFilterColorSelect
:
function
(
isCellColor
,
picker
,
color
)
{
var
filterObj
=
this
.
configTo
.
asc_getFilterObj
();
if
(
filterObj
.
asc_getType
()
!==
Asc
.
c_oAscAutoFilterTypes
.
ColorFilter
)
{
filterObj
.
asc_setFilter
(
new
Asc
.
ColorFilter
());
filterObj
.
asc_setType
(
Asc
.
c_oAscAutoFilterTypes
.
ColorFilter
);
}
var
colorFilter
=
filterObj
.
asc_getFilter
();
colorFilter
.
asc_setCellColor
(
isCellColor
);
colorFilter
.
asc_setCColor
(
Common
.
Utils
.
ThemeColor
.
getRgbColor
(
color
));
this
.
api
.
asc_applyAutoFilter
(
'
colorFilter
'
,
this
.
configTo
);
this
.
close
();
},
onSortColorCellsSelect
:
function
(
picker
,
color
)
{
},
onSortColorFontSelect
:
function
(
picker
,
color
)
{
},
onCellCheck
:
function
(
listView
,
itemView
,
record
)
{
if
(
this
.
checkCellTrigerBlock
)
return
;
...
...
@@ -834,6 +862,34 @@ define([
this
.
miTextFilter
.
setChecked
(
isCustomFilter
&&
isTextFilter
,
true
);
this
.
miNumFilter
.
setChecked
(
isCustomFilter
&&
!
isTextFilter
,
true
);
if
(
colorsFont
&&
colorsFont
.
length
>
0
)
{
var
colors
=
[];
colorsFont
.
forEach
(
function
(
item
,
index
)
{
colors
.
push
(
Common
.
Utils
.
ThemeColor
.
getHexColor
(
item
.
get_r
(),
item
.
get_g
(),
item
.
get_b
()).
toLocaleUpperCase
());
});
this
.
mnuSortColorFontPicker
.
updateColors
(
colors
);
this
.
mnuFilterColorFontPicker
.
updateColors
(
colors
);
this
.
miSortFontColor
.
setVisible
(
true
);
this
.
miFilterFontColor
.
setVisible
(
true
);
}
else
{
this
.
miSortFontColor
.
setVisible
(
false
);
this
.
miFilterFontColor
.
setVisible
(
false
);
}
if
(
colorsFill
&&
colorsFill
.
length
>
0
)
{
var
colors
=
[];
colorsFill
.
forEach
(
function
(
item
,
index
)
{
colors
.
push
(
Common
.
Utils
.
ThemeColor
.
getHexColor
(
item
.
get_r
(),
item
.
get_g
(),
item
.
get_b
()).
toLocaleUpperCase
());
});
this
.
mnuSortColorCellsPicker
.
updateColors
(
colors
);
this
.
mnuFilterColorCellsPicker
.
updateColors
(
colors
);
this
.
miSortCellColor
.
setVisible
(
true
);
this
.
miFilterCellColor
.
setVisible
(
true
);
}
else
{
this
.
miSortCellColor
.
setVisible
(
false
);
this
.
miFilterCellColor
.
setVisible
(
false
);
}
if
(
isCustomFilter
)
{
var
customFilter
=
filterObj
.
asc_getFilter
(),
customFilters
=
customFilter
.
asc_getCustomFilters
(),
...
...
@@ -855,6 +911,15 @@ define([
}
if
(
isCustomConditions
)
items
[
items
.
length
-
1
].
setChecked
(
true
,
true
);
}
else
if
(
this
.
initialFilterType
===
Asc
.
c_oAscAutoFilterTypes
.
ColorFilter
)
{
var
colorFilter
=
filterObj
.
asc_getFilter
(),
filterColor
=
colorFilter
.
asc_getCColor
();
if
(
filterColor
)
filterColor
=
Common
.
Utils
.
ThemeColor
.
getHexColor
(
filterColor
.
get_r
(),
filterColor
.
get_g
(),
filterColor
.
get_b
()).
toLocaleUpperCase
();
if
(
colorFilter
.
asc_getCellColor
()
===
null
)
// cell color
this
.
mnuFilterColorCellsPicker
.
select
(
filterColor
,
true
);
else
if
(
colorFilter
.
asc_getCellColor
()
===
false
)
// font color
this
.
mnuFilterColorFontPicker
.
select
(
filterColor
,
true
);
}
this
.
miSortLow2High
.
setChecked
(
false
,
true
);
...
...
@@ -868,33 +933,6 @@ define([
}
}
if
(
colorsFont
&&
colorsFont
.
length
>
0
)
{
var
colors
=
[];
colorsFont
.
forEach
(
function
(
item
,
index
)
{
colors
.
push
(
Common
.
Utils
.
ThemeColor
.
getHexColor
(
item
.
get_r
(),
item
.
get_g
(),
item
.
get_b
()).
toLocaleUpperCase
());
});
this
.
mnuSortColorFontPicker
.
updateColors
(
colors
);
this
.
mnuFilterColorFontPicker
.
updateColors
(
colors
);
this
.
miSortFontColor
.
setVisible
(
true
);
this
.
miFilterFontColor
.
setVisible
(
true
);
}
else
{
this
.
miSortFontColor
.
setVisible
(
false
);
this
.
miFilterFontColor
.
setVisible
(
false
);
}
if
(
colorsFill
&&
colorsFill
.
length
>
0
)
{
var
colors
=
[];
colorsFill
.
forEach
(
function
(
item
,
index
)
{
colors
.
push
(
Common
.
Utils
.
ThemeColor
.
getHexColor
(
item
.
get_r
(),
item
.
get_g
(),
item
.
get_b
()).
toLocaleUpperCase
());
});
this
.
mnuSortColorCellsPicker
.
updateColors
(
colors
);
this
.
mnuFilterColorCellsPicker
.
updateColors
(
colors
);
this
.
miSortCellColor
.
setVisible
(
true
);
this
.
miFilterCellColor
.
setVisible
(
true
);
}
else
{
this
.
miSortCellColor
.
setVisible
(
false
);
this
.
miFilterCellColor
.
setVisible
(
false
);
}
this
.
btnOk
.
setDisabled
(
isCustomFilter
);
},
...
...
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