Skip to content

Commit 1f46436

Browse files
committed
Merge pull request #1 from Newness/master
Removed fittable; added new options
2 parents b71cb28 + 2885171 commit 1f46436

File tree

2 files changed

+54
-7
lines changed

2 files changed

+54
-7
lines changed

v2/SelectDecorator/SelectDecorator.css

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,47 @@
2424
}
2525

2626
.select-decorator .select-decorator-inner {
27+
display: block;
2728
padding: 8px 10px;
2829
}
2930

3031
.select-decorator-inner-text {
32+
margin-top: 1px;
33+
display: inline-block;
3134
white-space: nowrap;
3235
overflow: hidden;
3336
text-overflow: ellipsis;
3437
text-align: left;
38+
39+
}
40+
41+
.select-decorator-inner-icon {
42+
float: left;
43+
width: 32px;
44+
height: 32px;
45+
background-size: cover;
46+
margin: -7px 7px -7px 0;
47+
background-position: 0px 0px;
48+
}
49+
50+
.onyx-button.active .select-decorator-inner-icon,
51+
.onyx-button:active:hover:not([disabled]) .select-decorator-inner-icon {
52+
background-position: 0 -32px;
53+
}
54+
55+
.select-decorator-no-caption .select-decorator-inner-icon {
56+
margin-right: 0;
3557
}
3658

3759
.select-decorator-inner-arrow {
60+
float: right;
61+
margin-left: 7px;
3862
width: 21px;
3963
height: 21px;
4064
background: url(menu-arrow.png) no-repeat center center;
41-
}
65+
}
66+
67+
.select-decorator-no-arrow .select-decorator-inner-arrow {
68+
display: none;
69+
}
70+

v2/SelectDecorator/SelectDecorator.js

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,40 @@ enyo.kind({
22
name: "SelectDecorator",
33
classes: "onyx-button select-decorator",
44
handlers: {
5-
onchange: "changeHandler"
5+
onchange : "changeHandler"
66
},
77
published: {
8-
disabled: false
8+
disabled : false,
9+
showCaption : true,
10+
showArrow : true,
11+
icon: ""
12+
},
13+
showCaptionChanged: function() {
14+
this.$.innerText.setShowing(this.showCaption);
15+
this.addRemoveClass("select-decorator-no-caption", !this.showCaption);
916
},
1017
disabledChanged: function() {
1118
this.addRemoveClass("select-decorator-disabled", this.disabled);
1219
},
20+
showArrowChanged: function() {
21+
this.addRemoveClass("select-decorator-no-arrow", !this.showArrow);
22+
},
23+
iconChanged: function() {
24+
this.$.innerIcon.setStyle("background-image: url('" + this.icon + "')");
25+
this.$.innerIcon.setShowing((this.icon !== ""));
26+
},
1327
create: function() {
1428
this.inherited(arguments);
1529
this.disabledChanged();
30+
this.showCaptionChanged();
31+
this.showArrowChanged();
32+
this.iconChanged();
1633
},
1734
rendered: function() {
1835
this.inherited(arguments);
1936
var select = this.getClientControls()[0];
2037

21-
if (select) {
38+
if(select) {
2239
this.changeHandler(select);
2340
}
2441
},
@@ -27,9 +44,10 @@ enyo.kind({
2744
this.$.innerText.setContent(caption);
2845
},
2946
components: [
30-
{kind: "FittableColumns", noStretch: true, classes: "select-decorator-inner", components: [
31-
{name: "innerText", fit: true, classes: "select-decorator-inner-text"},
32-
{classes: "select-decorator-inner-arrow"}
47+
{classes: "select-decorator-inner", components: [
48+
{classes: "select-decorator-inner-arrow"},
49+
{name: "innerIcon", classes: "select-decorator-inner-icon"},
50+
{name: "innerText", fit : true, classes : "select-decorator-inner-text"}
3351
]}
3452
]
3553
});

0 commit comments

Comments
 (0)