imp 7 years ago
parent
commit
c154d9c7d0
  1. 73442
      bi/base.js
  2. 25056
      bi/case.js
  3. 11
      bi/sliders.js
  4. 1
      demo/js/addons/slider/demo.slider.js
  5. 325
      dist/demo.js
  6. 11
      dist/sliders.js
  7. 11
      src/addons/sliders/js/intervalslider/intervalslider.label.js

73442
bi/base.js

File diff suppressed because it is too large Load Diff

25056
bi/case.js

File diff suppressed because it is too large Load Diff

11
bi/sliders.js

@ -552,6 +552,7 @@ BI.IntervalSliderLabel = BI.inherit(BI.Widget, {
var v = self._getValueByPercent(significantPercent); var v = self._getValueByPercent(significantPercent);
v = self._assertValue(v); v = self._assertValue(v);
v = o.digit === false ? v : v.toFixed(o.digit); v = o.digit === false ? v : v.toFixed(o.digit);
self.labelOne.setValue(v);
self.labelOne.setText(v + o.unit); self.labelOne.setText(v + o.unit);
self.valueOne = v; self.valueOne = v;
self._setBlueTrack(); self._setBlueTrack();
@ -578,6 +579,7 @@ BI.IntervalSliderLabel = BI.inherit(BI.Widget, {
var v = self._getValueByPercent(significantPercent); var v = self._getValueByPercent(significantPercent);
v = self._assertValue(v); v = self._assertValue(v);
v = o.digit === false ? v : v.toFixed(o.digit); v = o.digit === false ? v : v.toFixed(o.digit);
self.labelTwo.setValue(v);
self.labelTwo.setText(v + o.unit); self.labelTwo.setText(v + o.unit);
self.valueTwo = v; self.valueTwo = v;
self._setBlueTrack(); self._setBlueTrack();
@ -901,16 +903,21 @@ BI.IntervalSliderLabel = BI.inherit(BI.Widget, {
}, },
populate: function () { populate: function () {
var o = this.options;
if (!isNaN(this.min) && !isNaN(this.max)) { if (!isNaN(this.min) && !isNaN(this.max)) {
this.enable = true; this.enable = true;
this._setVisible(true); this._setVisible(true);
if ((BI.isNumeric(this.valueOne) || BI.isNotEmptyString(this.valueOne)) && (BI.isNumeric(this.valueTwo) || BI.isNotEmptyString(this.valueTwo))) { if ((BI.isNumeric(this.valueOne) || BI.isNotEmptyString(this.valueOne)) && (BI.isNumeric(this.valueTwo) || BI.isNotEmptyString(this.valueTwo))) {
this.labelOne.setValue(this.valueOne); this.labelOne.setValue(this.valueOne);
this.labelTwo.setValue(this.valueTwo); this.labelTwo.setValue(this.valueTwo);
this.labelOne.setText(this.valueOne + o.unit);
this.labelTwo.setText(this.valueTwo + o.unit);
this._setAllPosition(this._getPercentByValue(this.valueOne), this._getPercentByValue(this.valueTwo)); this._setAllPosition(this._getPercentByValue(this.valueOne), this._getPercentByValue(this.valueTwo));
} else { } else {
this.labelOne.setValue(this.min); this.labelOne.setValue(this.valueOne);
this.labelTwo.setValue(this.max); this.labelTwo.setValue(this.valueTwo);
this.labelOne.setText(this.min + o.unit);
this.labelTwo.setText(this.max + o.unit);
this._setAllPosition(0, 100) this._setAllPosition(0, 100)
} }
} }

1
demo/js/addons/slider/demo.slider.js

@ -78,6 +78,7 @@ Demo.Slider = BI.inherit(BI.Widget, {
var intervalSliderLabel = BI.createWidget({ var intervalSliderLabel = BI.createWidget({
type: "bi.interval_slider_label", type: "bi.interval_slider_label",
width: 300, width: 300,
unit: "个",
cls: "layout-bg-white" cls: "layout-bg-white"
}); });
intervalSliderLabel.setMinAndMax({ intervalSliderLabel.setMinAndMax({

325
dist/demo.js vendored

@ -89,6 +89,7 @@ Demo.Slider = BI.inherit(BI.Widget, {
var intervalSliderLabel = BI.createWidget({ var intervalSliderLabel = BI.createWidget({
type: "bi.interval_slider_label", type: "bi.interval_slider_label",
width: 300, width: 300,
unit: "个",
cls: "layout-bg-white" cls: "layout-bg-white"
}); });
intervalSliderLabel.setMinAndMax({ intervalSliderLabel.setMinAndMax({
@ -2141,8 +2142,9 @@ BI.shortcut("demo.clipboard", Demo.Func);Demo.Func = BI.inherit(BI.Widget, {
type: "bi.absolute", type: "bi.absolute",
items: [{ items: [{
el: { el: {
type: "bi.color_chooser_popup", type: "bi.color_chooser",
cls: "bi-card" width: 30,
height: 30
}, },
left: 100, left: 100,
top: 250 top: 250
@ -2150,7 +2152,7 @@ BI.shortcut("demo.clipboard", Demo.Func);Demo.Func = BI.inherit(BI.Widget, {
} }
} }
}); });
BI.shortcut("demo.color_chooser_popup", Demo.Func);Demo.Func = BI.inherit(BI.Widget, { BI.shortcut("demo.color_chooser", Demo.Func);Demo.Func = BI.inherit(BI.Widget, {
props: { props: {
baseCls: "demo-func" baseCls: "demo-func"
}, },
@ -2160,9 +2162,8 @@ BI.shortcut("demo.color_chooser_popup", Demo.Func);Demo.Func = BI.inherit(BI.Wid
type: "bi.absolute", type: "bi.absolute",
items: [{ items: [{
el: { el: {
type: "bi.color_chooser", type: "bi.color_chooser_popup",
width: 30, cls: "bi-card"
height: 30
}, },
left: 100, left: 100,
top: 250 top: 250
@ -2170,7 +2171,7 @@ BI.shortcut("demo.color_chooser_popup", Demo.Func);Demo.Func = BI.inherit(BI.Wid
} }
} }
}); });
BI.shortcut("demo.color_chooser", Demo.Func);Demo.Func = BI.inherit(BI.Widget, { BI.shortcut("demo.color_chooser_popup", Demo.Func);Demo.Func = BI.inherit(BI.Widget, {
props: { props: {
baseCls: "demo-func" baseCls: "demo-func"
}, },
@ -5379,92 +5380,6 @@ Demo.COMPONENT_CONFIG = [{
props: { props: {
baseCls: "demo-func" baseCls: "demo-func"
}, },
child: [{
type: "bi.combo_group",
el: {
type: "bi.icon_text_icon_item",
text: "2010年",
value: 2010,
height: 25,
iconCls: "close-ha-font"
},
children: [{
type: "bi.single_select_item",
height: 25,
text: "一月",
value: 11
}, {
type: "bi.icon_text_icon_item",
height: 25,
text: "二月",
value: 12,
children: [{type: "bi.single_select_item", text: "一号", value: 101, height: 25}]
}]
}, {
text: "2011年", value: 2011
}, {
text: "2012年", value: 2012, iconCls: "close-ha-font"
}, {
text: "2013年", value: 2013
}, {
text: "2014年", value: 2014, iconCls: "close-ha-font"
}, {
text: "2015年", value: 2015, iconCls: "close-ha-font"
}],
_createBottom: function () {
var childCombo = BI.createWidget({
type: "bi.combo",
el: {
type: "bi.text_button",
cls: "button-combo",
height: 30
},
popup: {
el: {
type: "bi.button_tree",
items: BI.createItems(BI.deepClone(this.child), {
type: "bi.single_select_item",
height: 25,
handler: function (v) {
}
}),
layouts: [{
type: "bi.vertical"
}]
}
},
width: 200
});
childCombo.setValue(BI.deepClone(this.child)[0].children[0].value);
return BI.createWidget({
type: "bi.left",
items: [childCombo],
hgap: 20,
vgap: 20
})
},
render: function () {
return {
type: "bi.grid",
columns: 1,
rows: 1,
items: [{
column: 0,
row: 0,
el: this._createBottom()
}]
}
}
});
BI.shortcut("demo.combo_group", Demo.Func);Demo.Func = BI.inherit(BI.Widget, {
props: {
baseCls: "demo-func"
},
years: [{ years: [{
text: "2010年", value: 2010, iconCls: "close-ha-font" text: "2010年", value: 2010, iconCls: "close-ha-font"
}, { }, {
@ -6119,6 +6034,92 @@ BI.shortcut("demo.combo2", Demo.Func);Demo.Func = BI.inherit(BI.Widget, {
props: { props: {
baseCls: "demo-func" baseCls: "demo-func"
}, },
child: [{
type: "bi.combo_group",
el: {
type: "bi.icon_text_icon_item",
text: "2010年",
value: 2010,
height: 25,
iconCls: "close-ha-font"
},
children: [{
type: "bi.single_select_item",
height: 25,
text: "一月",
value: 11
}, {
type: "bi.icon_text_icon_item",
height: 25,
text: "二月",
value: 12,
children: [{type: "bi.single_select_item", text: "一号", value: 101, height: 25}]
}]
}, {
text: "2011年", value: 2011
}, {
text: "2012年", value: 2012, iconCls: "close-ha-font"
}, {
text: "2013年", value: 2013
}, {
text: "2014年", value: 2014, iconCls: "close-ha-font"
}, {
text: "2015年", value: 2015, iconCls: "close-ha-font"
}],
_createBottom: function () {
var childCombo = BI.createWidget({
type: "bi.combo",
el: {
type: "bi.text_button",
cls: "button-combo",
height: 30
},
popup: {
el: {
type: "bi.button_tree",
items: BI.createItems(BI.deepClone(this.child), {
type: "bi.single_select_item",
height: 25,
handler: function (v) {
}
}),
layouts: [{
type: "bi.vertical"
}]
}
},
width: 200
});
childCombo.setValue(BI.deepClone(this.child)[0].children[0].value);
return BI.createWidget({
type: "bi.left",
items: [childCombo],
hgap: 20,
vgap: 20
})
},
render: function () {
return {
type: "bi.grid",
columns: 1,
rows: 1,
items: [{
column: 0,
row: 0,
el: this._createBottom()
}]
}
}
});
BI.shortcut("demo.combo_group", Demo.Func);Demo.Func = BI.inherit(BI.Widget, {
props: {
baseCls: "demo-func"
},
render: function () { render: function () {
return { return {
type: "bi.vertical", type: "bi.vertical",
@ -7081,24 +7082,7 @@ Demo.BorderLayout = BI.inherit(BI.Widget, {
} }
} }
}); });
BI.shortcut("demo.border", Demo.BorderLayout);Demo.CenterAdapt = BI.inherit(BI.Widget, { BI.shortcut("demo.border", Demo.BorderLayout);/**
props: {
baseCls: "demo-absolute"
},
render: function () {
return {
type: "bi.center_adapt",
items: [{
type: "bi.label",
text: "水平垂直居中",
width: 300,
height: 200,
cls: "layout-bg1"
}]
}
},
});
BI.shortcut("demo.center_adapt", Demo.CenterAdapt);/**
* Created by User on 2017/3/22. * Created by User on 2017/3/22.
*/ */
Demo.CenterLayout = BI.inherit(BI.Widget, { Demo.CenterLayout = BI.inherit(BI.Widget, {
@ -7132,7 +7116,24 @@ Demo.CenterLayout = BI.inherit(BI.Widget, {
} }
} }
}); });
BI.shortcut("demo.center_layout", Demo.CenterLayout);/** BI.shortcut("demo.center_layout", Demo.CenterLayout);Demo.CenterAdapt = BI.inherit(BI.Widget, {
props: {
baseCls: "demo-absolute"
},
render: function () {
return {
type: "bi.center_adapt",
items: [{
type: "bi.label",
text: "水平垂直居中",
width: 300,
height: 200,
cls: "layout-bg1"
}]
}
},
});
BI.shortcut("demo.center_adapt", Demo.CenterAdapt);/**
* Created by User on 2017/3/22. * Created by User on 2017/3/22.
*/ */
Demo.FloatCenterLayout = BI.inherit(BI.Widget, { Demo.FloatCenterLayout = BI.inherit(BI.Widget, {
@ -7379,6 +7380,32 @@ Demo.GridLayout = BI.inherit(BI.Widget, {
} }
}); });
BI.shortcut("demo.grid", Demo.GridLayout);/** BI.shortcut("demo.grid", Demo.GridLayout);/**
* Created by User on 2017/3/21.
*/
Demo.Horizontal = BI.inherit(BI.Widget, {
props: {
baseCls: "demo-horizontal"
},
render: function () {
return {
type: "bi.horizontal",
items: [{
type: "bi.label",
text: "水平布局",
cls: "layout-bg3",
width: 300,
height: 30
}, {
type: "bi.label",
text: "水平布局",
cls: "layout-bg4",
width: 300,
height: 30
}]
}
}
});
BI.shortcut("demo.horizontal", Demo.Horizontal);/**
* Created by User on 2017/3/22. * Created by User on 2017/3/22.
*/ */
Demo.HorizontalAdapt = BI.inherit(BI.Widget, { Demo.HorizontalAdapt = BI.inherit(BI.Widget, {
@ -7495,32 +7522,6 @@ Demo.HorizontalFloat = BI.inherit(BI.Widget, {
} }
}); });
BI.shortcut("demo.horizontal_float", Demo.HorizontalFloat);/** BI.shortcut("demo.horizontal_float", Demo.HorizontalFloat);/**
* Created by User on 2017/3/21.
*/
Demo.Horizontal = BI.inherit(BI.Widget, {
props: {
baseCls: "demo-horizontal"
},
render: function () {
return {
type: "bi.horizontal",
items: [{
type: "bi.label",
text: "水平布局",
cls: "layout-bg3",
width: 300,
height: 30
}, {
type: "bi.label",
text: "水平布局",
cls: "layout-bg4",
width: 300,
height: 30
}]
}
}
});
BI.shortcut("demo.horizontal", Demo.Horizontal);/**
* Created by User on 2017/3/22. * Created by User on 2017/3/22.
*/ */
Demo.HtapeLayout = BI.inherit(BI.Widget, { Demo.HtapeLayout = BI.inherit(BI.Widget, {
@ -7820,6 +7821,30 @@ Demo.TdLayout = BI.inherit(BI.Widget, {
} }
}); });
BI.shortcut("demo.td", Demo.TdLayout);/** BI.shortcut("demo.td", Demo.TdLayout);/**
* Created by User on 2017/3/21.
*/
Demo.VerticalLayout = BI.inherit(BI.Widget, {
props: {
baseCls: "demo-vertical"
},
render: function () {
return {
type: "bi.vertical",
items: [{
type: "bi.label",
cls: "layout-bg3",
text: "垂直布局",
height: 30
}, {
type: "bi.label",
cls: "layout-bg4",
text: "垂直布局",
height: 30
}]
}
}
});
BI.shortcut("demo.vertical", Demo.VerticalLayout);/**
* Created by User on 2017/3/22. * Created by User on 2017/3/22.
*/ */
Demo.VerticalAdaptLayout = BI.inherit(BI.Widget, { Demo.VerticalAdaptLayout = BI.inherit(BI.Widget, {
@ -7861,30 +7886,6 @@ Demo.VerticalAdaptLayout = BI.inherit(BI.Widget, {
} }
}); });
BI.shortcut("demo.vertical_adapt", Demo.VerticalAdaptLayout);/** BI.shortcut("demo.vertical_adapt", Demo.VerticalAdaptLayout);/**
* Created by User on 2017/3/21.
*/
Demo.VerticalLayout = BI.inherit(BI.Widget, {
props: {
baseCls: "demo-vertical"
},
render: function () {
return {
type: "bi.vertical",
items: [{
type: "bi.label",
cls: "layout-bg3",
text: "垂直布局",
height: 30
}, {
type: "bi.label",
cls: "layout-bg4",
text: "垂直布局",
height: 30
}]
}
}
});
BI.shortcut("demo.vertical", Demo.VerticalLayout);/**
* Created by User on 2017/3/22. * Created by User on 2017/3/22.
*/ */
Demo.VtapeLayout = BI.inherit(BI.Widget, { Demo.VtapeLayout = BI.inherit(BI.Widget, {

11
dist/sliders.js vendored

@ -552,6 +552,7 @@ BI.IntervalSliderLabel = BI.inherit(BI.Widget, {
var v = self._getValueByPercent(significantPercent); var v = self._getValueByPercent(significantPercent);
v = self._assertValue(v); v = self._assertValue(v);
v = o.digit === false ? v : v.toFixed(o.digit); v = o.digit === false ? v : v.toFixed(o.digit);
self.labelOne.setValue(v);
self.labelOne.setText(v + o.unit); self.labelOne.setText(v + o.unit);
self.valueOne = v; self.valueOne = v;
self._setBlueTrack(); self._setBlueTrack();
@ -578,6 +579,7 @@ BI.IntervalSliderLabel = BI.inherit(BI.Widget, {
var v = self._getValueByPercent(significantPercent); var v = self._getValueByPercent(significantPercent);
v = self._assertValue(v); v = self._assertValue(v);
v = o.digit === false ? v : v.toFixed(o.digit); v = o.digit === false ? v : v.toFixed(o.digit);
self.labelTwo.setValue(v);
self.labelTwo.setText(v + o.unit); self.labelTwo.setText(v + o.unit);
self.valueTwo = v; self.valueTwo = v;
self._setBlueTrack(); self._setBlueTrack();
@ -901,16 +903,21 @@ BI.IntervalSliderLabel = BI.inherit(BI.Widget, {
}, },
populate: function () { populate: function () {
var o = this.options;
if (!isNaN(this.min) && !isNaN(this.max)) { if (!isNaN(this.min) && !isNaN(this.max)) {
this.enable = true; this.enable = true;
this._setVisible(true); this._setVisible(true);
if ((BI.isNumeric(this.valueOne) || BI.isNotEmptyString(this.valueOne)) && (BI.isNumeric(this.valueTwo) || BI.isNotEmptyString(this.valueTwo))) { if ((BI.isNumeric(this.valueOne) || BI.isNotEmptyString(this.valueOne)) && (BI.isNumeric(this.valueTwo) || BI.isNotEmptyString(this.valueTwo))) {
this.labelOne.setValue(this.valueOne); this.labelOne.setValue(this.valueOne);
this.labelTwo.setValue(this.valueTwo); this.labelTwo.setValue(this.valueTwo);
this.labelOne.setText(this.valueOne + o.unit);
this.labelTwo.setText(this.valueTwo + o.unit);
this._setAllPosition(this._getPercentByValue(this.valueOne), this._getPercentByValue(this.valueTwo)); this._setAllPosition(this._getPercentByValue(this.valueOne), this._getPercentByValue(this.valueTwo));
} else { } else {
this.labelOne.setValue(this.min); this.labelOne.setValue(this.valueOne);
this.labelTwo.setValue(this.max); this.labelTwo.setValue(this.valueTwo);
this.labelOne.setText(this.min + o.unit);
this.labelTwo.setText(this.max + o.unit);
this._setAllPosition(0, 100) this._setAllPosition(0, 100)
} }
} }

11
src/addons/sliders/js/intervalslider/intervalslider.label.js

@ -69,6 +69,7 @@ BI.IntervalSliderLabel = BI.inherit(BI.Widget, {
var v = self._getValueByPercent(significantPercent); var v = self._getValueByPercent(significantPercent);
v = self._assertValue(v); v = self._assertValue(v);
v = o.digit === false ? v : v.toFixed(o.digit); v = o.digit === false ? v : v.toFixed(o.digit);
self.labelOne.setValue(v);
self.labelOne.setText(v + o.unit); self.labelOne.setText(v + o.unit);
self.valueOne = v; self.valueOne = v;
self._setBlueTrack(); self._setBlueTrack();
@ -95,6 +96,7 @@ BI.IntervalSliderLabel = BI.inherit(BI.Widget, {
var v = self._getValueByPercent(significantPercent); var v = self._getValueByPercent(significantPercent);
v = self._assertValue(v); v = self._assertValue(v);
v = o.digit === false ? v : v.toFixed(o.digit); v = o.digit === false ? v : v.toFixed(o.digit);
self.labelTwo.setValue(v);
self.labelTwo.setText(v + o.unit); self.labelTwo.setText(v + o.unit);
self.valueTwo = v; self.valueTwo = v;
self._setBlueTrack(); self._setBlueTrack();
@ -418,16 +420,21 @@ BI.IntervalSliderLabel = BI.inherit(BI.Widget, {
}, },
populate: function () { populate: function () {
var o = this.options;
if (!isNaN(this.min) && !isNaN(this.max)) { if (!isNaN(this.min) && !isNaN(this.max)) {
this.enable = true; this.enable = true;
this._setVisible(true); this._setVisible(true);
if ((BI.isNumeric(this.valueOne) || BI.isNotEmptyString(this.valueOne)) && (BI.isNumeric(this.valueTwo) || BI.isNotEmptyString(this.valueTwo))) { if ((BI.isNumeric(this.valueOne) || BI.isNotEmptyString(this.valueOne)) && (BI.isNumeric(this.valueTwo) || BI.isNotEmptyString(this.valueTwo))) {
this.labelOne.setValue(this.valueOne); this.labelOne.setValue(this.valueOne);
this.labelTwo.setValue(this.valueTwo); this.labelTwo.setValue(this.valueTwo);
this.labelOne.setText(this.valueOne + o.unit);
this.labelTwo.setText(this.valueTwo + o.unit);
this._setAllPosition(this._getPercentByValue(this.valueOne), this._getPercentByValue(this.valueTwo)); this._setAllPosition(this._getPercentByValue(this.valueOne), this._getPercentByValue(this.valueTwo));
} else { } else {
this.labelOne.setValue(this.min); this.labelOne.setValue(this.valueOne);
this.labelTwo.setValue(this.max); this.labelTwo.setValue(this.valueTwo);
this.labelOne.setText(this.min + o.unit);
this.labelTwo.setText(this.max + o.unit);
this._setAllPosition(0, 100) this._setAllPosition(0, 100)
} }
} }

Loading…
Cancel
Save