Browse Source

针对移动端rem进行适配

es6
guy 4 years ago
parent
commit
ec0605f17f
  1. 8
      src/case/button/item.singleselect.radio.js
  2. 4
      src/widget/singleselect/search/singleselect.search.loader.js
  3. 65
      src/widget/singleselect/singleselect.item.js
  4. 2
      src/widget/singleselect/singleselect.loader.js

8
src/case/button/item.singleselect.radio.js

@ -10,7 +10,6 @@ BI.SingleSelectRadioItem = BI.inherit(BI.BasicButton, {
logic: { logic: {
dynamic: false dynamic: false
}, },
hgap: 10,
height: 24 height: 24
}); });
}, },
@ -18,8 +17,7 @@ BI.SingleSelectRadioItem = BI.inherit(BI.BasicButton, {
BI.SingleSelectRadioItem.superclass._init.apply(this, arguments); BI.SingleSelectRadioItem.superclass._init.apply(this, arguments);
var self = this, o = this.options; var self = this, o = this.options;
this.radio = BI.createWidget({ this.radio = BI.createWidget({
type: "bi.radio", type: "bi.radio"
once: o.once
}); });
this.text = BI.createWidget({ this.text = BI.createWidget({
type: "bi.label", type: "bi.label",
@ -41,7 +39,7 @@ BI.SingleSelectRadioItem = BI.inherit(BI.BasicButton, {
items: BI.LogicFactory.createLogicItemsByDirection("left", { items: BI.LogicFactory.createLogicItemsByDirection("left", {
type: "bi.center_adapt", type: "bi.center_adapt",
items: [this.radio], items: [this.radio],
width: 16 width: 26
}, this.text) }, this.text)
})))); }))));
}, },
@ -70,4 +68,4 @@ BI.SingleSelectRadioItem = BI.inherit(BI.BasicButton, {
}); });
BI.SingleSelectRadioItem.EVENT_CHANGE = "EVENT_CHANGE"; BI.SingleSelectRadioItem.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.single_select_radio_item", BI.SingleSelectRadioItem); BI.shortcut("bi.single_select_radio_item", BI.SingleSelectRadioItem);

4
src/widget/singleselect/search/singleselect.search.loader.js

@ -84,7 +84,7 @@ BI.SingleSelectSearchLoader = BI.inherit(BI.Widget, {
_createItems: function (items) { _createItems: function (items) {
return BI.createItems(items, { return BI.createItems(items, {
type: this.options.allowNoSelect ? "bi.single_select_item" : "bi.single_select_combo_item", type: this.options.allowNoSelect ? "bi.single_select_item" : "bi.single_select_radio_item",
cls: "bi-list-item-active", cls: "bi-list-item-active",
logic: { logic: {
dynamic: false dynamic: false
@ -150,4 +150,4 @@ BI.SingleSelectSearchLoader = BI.inherit(BI.Widget, {
}); });
BI.SingleSelectSearchLoader.EVENT_CHANGE = "EVENT_CHANGE"; BI.SingleSelectSearchLoader.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.single_select_search_loader", BI.SingleSelectSearchLoader); BI.shortcut("bi.single_select_search_loader", BI.SingleSelectSearchLoader);

65
src/widget/singleselect/singleselect.item.js

@ -1,65 +0,0 @@
BI.SingleSelectComboItem = BI.inherit(BI.BasicButton, {
_defaultConfig: function () {
return BI.extend(BI.SingleSelectComboItem.superclass._defaultConfig.apply(this, arguments), {
extraCls: "bi-single-select-radio-item",
logic: {
dynamic: false
},
height: 24
});
},
_init: function () {
BI.SingleSelectComboItem.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.radio = BI.createWidget({
type: "bi.radio"
});
this.text = BI.createWidget({
type: "bi.label",
cls: "list-item-text",
textAlign: "left",
whiteSpace: "nowrap",
textHeight: o.height,
height: o.height,
hgap: o.hgap,
text: o.text,
keyword: o.keyword,
value: o.value,
py: o.py
});
BI.createWidget(BI.extend({
element: this
}, BI.LogicFactory.createLogic("horizontal", BI.extend(o.logic, {
items: BI.LogicFactory.createLogicItemsByDirection("left", {
type: "bi.center_adapt",
items: [this.radio],
width: 26
}, this.text)
}))));
},
doRedMark: function () {
this.text.doRedMark.apply(this.text, arguments);
},
unRedMark: function () {
this.text.unRedMark.apply(this.text, arguments);
},
doClick: function () {
BI.SingleSelectComboItem.superclass.doClick.apply(this, arguments);
this.radio.setSelected(this.isSelected());
if (this.isValid()) {
this.fireEvent(BI.SingleSelectComboItem.EVENT_CHANGE, this.isSelected(), this);
}
},
setSelected: function (v) {
BI.SingleSelectComboItem.superclass.setSelected.apply(this, arguments);
this.radio.setSelected(v);
}
});
BI.SingleSelectComboItem.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.single_select_combo_item", BI.SingleSelectComboItem);

2
src/widget/singleselect/singleselect.loader.js

@ -105,7 +105,7 @@ BI.SingleSelectLoader = BI.inherit(BI.Widget, {
_createItems: function (items) { _createItems: function (items) {
return BI.createItems(items, { return BI.createItems(items, {
type: this.options.allowNoSelect ? "bi.single_select_item" : "bi.single_select_combo_item", type: this.options.allowNoSelect ? "bi.single_select_item" : "bi.single_select_radio_item",
logic: this.options.logic, logic: this.options.logic,
cls: "bi-list-item-active", cls: "bi-list-item-active",
height: 24, height: 24,

Loading…
Cancel
Save