Browse Source

无JIRA任务 图标标签和slider的编辑框新方案

es6
windy 6 years ago
parent
commit
1b6d473c7b
  1. 20
      demo/js/base/demo.icon_label.js
  2. 4
      demo/js/config/base.js
  3. 62
      dist/_fineui.min.js
  4. 41
      dist/base.js
  5. 87
      dist/bundle.js
  6. 64
      dist/bundle.min.js
  7. 25
      dist/demo.js
  8. 87
      dist/fineui.js
  9. 62
      dist/fineui.min.js
  10. 46
      dist/widget.js
  11. 42
      src/base/single/label/icon.label.js
  12. 12
      src/widget/intervalslider/intervalslider.js
  13. 27
      src/widget/singleslider/button/editor.sign.text.js
  14. 7
      src/widget/singleslider/singleslider.js

20
demo/js/base/demo.icon_label.js

@ -0,0 +1,20 @@
Demo.IconLabel = BI.inherit(BI.Widget, {
props: {
baseCls: "demo-bubble"
},
render: function () {
return {
type: "bi.default",
items: [{
type: "bi.label",
text: "这是一个icon标签,在加了border之后仍然是居中显示的"
}, {
type: "bi.icon_label",
cls: "date-font bi-border",
height: 40,
width: 40
}]
};
}
});
BI.shortcut("demo.icon_label", Demo.IconLabel);

4
demo/js/config/base.js

@ -6,6 +6,10 @@ Demo.BASE_CONFIG = [{
pId: 2,
text: "bi.label",
value: "demo.label"
}, {
pId: 2,
text: "bi.icon_label",
value: "demo.icon_label"
}, {
pId: 2,
text: "title提示",

62
dist/_fineui.min.js vendored

File diff suppressed because one or more lines are too long

41
dist/base.js vendored

@ -19995,6 +19995,47 @@ BI.Radio = BI.inherit(BI.IconButton, {
BI.Radio.EVENT_CHANGE = "Radio.EVENT_CHANGE";
BI.shortcut("bi.radio", BI.Radio);/**
* @class BI.IconButton
* @extends BI.BasicButton
* 图标标签
*/
BI.IconLabel = BI.inherit(BI.Single, {
props: {
baseCls: "bi-icon-label horizon-center",
iconWidth: null,
iconHeight: null
},
_init: function () {
BI.IconLabel.superclass._init.apply(this, arguments);
var o = this.options;
this.element.css({
textAlign: "center"
});
this.icon = BI.createWidget({
type: "bi.icon",
width: o.iconWidth,
height: o.iconHeight
});
if (BI.isNumber(o.height) && o.height > 0 && BI.isNull(o.iconWidth) && BI.isNull(o.iconHeight)) {
this.element.css("lineHeight", o.height + "px");
BI.createWidget({
type: "bi.default",
element: this,
items: [this.icon]
});
} else {
this.element.css("lineHeight", "1");
BI.createWidget({
element: this,
type: "bi.center_adapt",
items: [this.icon]
});
}
}
});
BI.shortcut("bi.icon_label", BI.IconLabel);/**
* Created by GUY on 2015/6/26.
*/

87
dist/bundle.js vendored

@ -55802,6 +55802,47 @@ BI.Radio = BI.inherit(BI.IconButton, {
BI.Radio.EVENT_CHANGE = "Radio.EVENT_CHANGE";
BI.shortcut("bi.radio", BI.Radio);/**
* @class BI.IconButton
* @extends BI.BasicButton
* 图标标签
*/
BI.IconLabel = BI.inherit(BI.Single, {
props: {
baseCls: "bi-icon-label horizon-center",
iconWidth: null,
iconHeight: null
},
_init: function () {
BI.IconLabel.superclass._init.apply(this, arguments);
var o = this.options;
this.element.css({
textAlign: "center"
});
this.icon = BI.createWidget({
type: "bi.icon",
width: o.iconWidth,
height: o.iconHeight
});
if (BI.isNumber(o.height) && o.height > 0 && BI.isNull(o.iconWidth) && BI.isNull(o.iconHeight)) {
this.element.css("lineHeight", o.height + "px");
BI.createWidget({
type: "bi.default",
element: this,
items: [this.icon]
});
} else {
this.element.css("lineHeight", "1");
BI.createWidget({
element: this,
type: "bi.center_adapt",
items: [this.icon]
});
}
}
});
BI.shortcut("bi.icon_label", BI.IconLabel);/**
* Created by GUY on 2015/6/26.
*/
@ -94057,7 +94098,7 @@ BI.IntervalSlider = BI.inherit(BI.Single, {
type: "bi.sign_text_editor",
cls: "slider-editor-button",
text: this.options.unit,
errorText: "",
textAlign: "left",
allowBlank: false,
width: c.EDITOR_WIDTH,
validationChecker: function (v) {
@ -94083,10 +94124,10 @@ BI.IntervalSlider = BI.inherit(BI.Single, {
this.labelTwo = BI.createWidget({
type: "bi.sign_text_editor",
cls: "slider-editor-button",
errorText: "",
text: this.options.unit,
allowBlank: false,
width: c.EDITOR_WIDTH,
textAlign: "right",
validationChecker: function (v) {
return self._checkValidation(v);
}
@ -94336,13 +94377,13 @@ BI.IntervalSlider = BI.inherit(BI.Single, {
},
_setLabelOnePosition: function (percent) {
this.labelOne.element.css({left: percent + "%"});
this._checkOverlap();
// this.labelOne.element.css({left: percent + "%"});
// this._checkOverlap();
},
_setLabelTwoPosition: function (percent) {
this.labelTwo.element.css({left: percent + "%"});
this._checkOverlap();
// this.labelTwo.element.css({left: percent + "%"});
// this._checkOverlap();
},
_setSliderOnePosition: function (percent) {
@ -107802,17 +107843,7 @@ BI.SignTextEditor = BI.inherit(BI.Widget, {
var conf = BI.SignTextEditor.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-sign-initial-editor",
hgap: 4,
vgap: 2,
lgap: 0,
rgap: 0,
tgap: 0,
bgap: 0,
validationChecker: BI.emptyFn,
quitChecker: BI.emptyFn,
allowBlank: true,
watermark: "",
errorText: "",
text: "",
height: 24
});
@ -107824,18 +107855,11 @@ BI.SignTextEditor = BI.inherit(BI.Widget, {
this.editor = BI.createWidget({
type: "bi.editor",
height: o.height,
hgap: o.hgap,
vgap: o.vgap,
lgap: o.lgap,
rgap: o.rgap,
tgap: o.tgap,
bgap: o.bgap,
hgap: 4,
vgap: 2,
value: o.value,
validationChecker: o.validationChecker,
quitChecker: o.quitChecker,
allowBlank: o.allowBlank,
watermark: o.watermark,
errorText: o.errorText
allowBlank: false
});
this.text = BI.createWidget({
type: "bi.text_button",
@ -107843,9 +107867,7 @@ BI.SignTextEditor = BI.inherit(BI.Widget, {
title: function () {
return self.getValue();
},
warningTitle: o.warningTitle,
tipType: o.tipType,
textAlign: "left",
textAlign: o.textAlign,
height: o.height,
hgap: 4,
handler: function () {
@ -108113,10 +108135,10 @@ BI.SingleSlider = BI.inherit(BI.Widget, {
this.label = BI.createWidget({
type: "bi.sign_text_editor",
cls: "slider-editor-button",
errorText: "",
text: o.unit,
width: c.EDITOR_WIDTH - 2,
allowBlank: false,
textAlign: "center",
validationChecker: function (v) {
return self._checkValidation(v);
}
@ -108164,10 +108186,9 @@ BI.SingleSlider = BI.inherit(BI.Widget, {
el: {
type: "bi.vertical",
items: [{
type: "bi.absolute",
type: "bi.horizontal_auto",
items: [this.label]
}],
rgap: c.EDITOR_WIDTH,
height: c.EDITOR_HEIGHT
},
top: 0,
@ -108276,7 +108297,7 @@ BI.SingleSlider = BI.inherit(BI.Widget, {
},
_setLabelPosition: function (percent) {
this.label.element.css({left: percent + "%"});
// this.label.element.css({left: percent + "%"});
},
_setSliderPosition: function (percent) {

64
dist/bundle.min.js vendored

File diff suppressed because one or more lines are too long

25
dist/demo.js vendored

@ -369,7 +369,26 @@ BI.shortcut("demo.text_button", Demo.Button);Demo.Func = BI.inherit(BI.Widget, {
});
}
});
BI.shortcut("demo.canvas", Demo.Func);Demo.Label = BI.inherit(BI.Widget, {
BI.shortcut("demo.canvas", Demo.Func);Demo.IconLabel = BI.inherit(BI.Widget, {
props: {
baseCls: "demo-bubble"
},
render: function () {
return {
type: "bi.default",
items: [{
type: "bi.label",
text: "这是一个icon标签,在加了border之后仍然是居中显示的"
}, {
type: "bi.icon_label",
cls: "date-font bi-border",
height: 40,
width: 40
}]
};
}
});
BI.shortcut("demo.icon_label", Demo.IconLabel);Demo.Label = BI.inherit(BI.Widget, {
props: {
baseCls: "demo-label"
},
@ -5099,6 +5118,10 @@ BI.shortcut("demo.value_chooser_pane", Demo.ValueChooserPane);Demo.BASE_CONFIG =
pId: 2,
text: "bi.label",
value: "demo.label"
}, {
pId: 2,
text: "bi.icon_label",
value: "demo.icon_label"
}, {
pId: 2,
text: "title提示",

87
dist/fineui.js vendored

@ -56051,6 +56051,47 @@ BI.Radio = BI.inherit(BI.IconButton, {
BI.Radio.EVENT_CHANGE = "Radio.EVENT_CHANGE";
BI.shortcut("bi.radio", BI.Radio);/**
* @class BI.IconButton
* @extends BI.BasicButton
* 图标标签
*/
BI.IconLabel = BI.inherit(BI.Single, {
props: {
baseCls: "bi-icon-label horizon-center",
iconWidth: null,
iconHeight: null
},
_init: function () {
BI.IconLabel.superclass._init.apply(this, arguments);
var o = this.options;
this.element.css({
textAlign: "center"
});
this.icon = BI.createWidget({
type: "bi.icon",
width: o.iconWidth,
height: o.iconHeight
});
if (BI.isNumber(o.height) && o.height > 0 && BI.isNull(o.iconWidth) && BI.isNull(o.iconHeight)) {
this.element.css("lineHeight", o.height + "px");
BI.createWidget({
type: "bi.default",
element: this,
items: [this.icon]
});
} else {
this.element.css("lineHeight", "1");
BI.createWidget({
element: this,
type: "bi.center_adapt",
items: [this.icon]
});
}
}
});
BI.shortcut("bi.icon_label", BI.IconLabel);/**
* Created by GUY on 2015/6/26.
*/
@ -94306,7 +94347,7 @@ BI.IntervalSlider = BI.inherit(BI.Single, {
type: "bi.sign_text_editor",
cls: "slider-editor-button",
text: this.options.unit,
errorText: "",
textAlign: "left",
allowBlank: false,
width: c.EDITOR_WIDTH,
validationChecker: function (v) {
@ -94332,10 +94373,10 @@ BI.IntervalSlider = BI.inherit(BI.Single, {
this.labelTwo = BI.createWidget({
type: "bi.sign_text_editor",
cls: "slider-editor-button",
errorText: "",
text: this.options.unit,
allowBlank: false,
width: c.EDITOR_WIDTH,
textAlign: "right",
validationChecker: function (v) {
return self._checkValidation(v);
}
@ -94585,13 +94626,13 @@ BI.IntervalSlider = BI.inherit(BI.Single, {
},
_setLabelOnePosition: function (percent) {
this.labelOne.element.css({left: percent + "%"});
this._checkOverlap();
// this.labelOne.element.css({left: percent + "%"});
// this._checkOverlap();
},
_setLabelTwoPosition: function (percent) {
this.labelTwo.element.css({left: percent + "%"});
this._checkOverlap();
// this.labelTwo.element.css({left: percent + "%"});
// this._checkOverlap();
},
_setSliderOnePosition: function (percent) {
@ -108051,17 +108092,7 @@ BI.SignTextEditor = BI.inherit(BI.Widget, {
var conf = BI.SignTextEditor.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-sign-initial-editor",
hgap: 4,
vgap: 2,
lgap: 0,
rgap: 0,
tgap: 0,
bgap: 0,
validationChecker: BI.emptyFn,
quitChecker: BI.emptyFn,
allowBlank: true,
watermark: "",
errorText: "",
text: "",
height: 24
});
@ -108073,18 +108104,11 @@ BI.SignTextEditor = BI.inherit(BI.Widget, {
this.editor = BI.createWidget({
type: "bi.editor",
height: o.height,
hgap: o.hgap,
vgap: o.vgap,
lgap: o.lgap,
rgap: o.rgap,
tgap: o.tgap,
bgap: o.bgap,
hgap: 4,
vgap: 2,
value: o.value,
validationChecker: o.validationChecker,
quitChecker: o.quitChecker,
allowBlank: o.allowBlank,
watermark: o.watermark,
errorText: o.errorText
allowBlank: false
});
this.text = BI.createWidget({
type: "bi.text_button",
@ -108092,9 +108116,7 @@ BI.SignTextEditor = BI.inherit(BI.Widget, {
title: function () {
return self.getValue();
},
warningTitle: o.warningTitle,
tipType: o.tipType,
textAlign: "left",
textAlign: o.textAlign,
height: o.height,
hgap: 4,
handler: function () {
@ -108362,10 +108384,10 @@ BI.SingleSlider = BI.inherit(BI.Widget, {
this.label = BI.createWidget({
type: "bi.sign_text_editor",
cls: "slider-editor-button",
errorText: "",
text: o.unit,
width: c.EDITOR_WIDTH - 2,
allowBlank: false,
textAlign: "center",
validationChecker: function (v) {
return self._checkValidation(v);
}
@ -108413,10 +108435,9 @@ BI.SingleSlider = BI.inherit(BI.Widget, {
el: {
type: "bi.vertical",
items: [{
type: "bi.absolute",
type: "bi.horizontal_auto",
items: [this.label]
}],
rgap: c.EDITOR_WIDTH,
height: c.EDITOR_HEIGHT
},
top: 0,
@ -108525,7 +108546,7 @@ BI.SingleSlider = BI.inherit(BI.Widget, {
},
_setLabelPosition: function (percent) {
this.label.element.css({left: percent + "%"});
// this.label.element.css({left: percent + "%"});
},
_setSliderPosition: function (percent) {

62
dist/fineui.min.js vendored

File diff suppressed because one or more lines are too long

46
dist/widget.js vendored

@ -6248,7 +6248,7 @@ BI.IntervalSlider = BI.inherit(BI.Single, {
type: "bi.sign_text_editor",
cls: "slider-editor-button",
text: this.options.unit,
errorText: "",
textAlign: "left",
allowBlank: false,
width: c.EDITOR_WIDTH,
validationChecker: function (v) {
@ -6274,10 +6274,10 @@ BI.IntervalSlider = BI.inherit(BI.Single, {
this.labelTwo = BI.createWidget({
type: "bi.sign_text_editor",
cls: "slider-editor-button",
errorText: "",
text: this.options.unit,
allowBlank: false,
width: c.EDITOR_WIDTH,
textAlign: "right",
validationChecker: function (v) {
return self._checkValidation(v);
}
@ -6527,13 +6527,13 @@ BI.IntervalSlider = BI.inherit(BI.Single, {
},
_setLabelOnePosition: function (percent) {
this.labelOne.element.css({left: percent + "%"});
this._checkOverlap();
// this.labelOne.element.css({left: percent + "%"});
// this._checkOverlap();
},
_setLabelTwoPosition: function (percent) {
this.labelTwo.element.css({left: percent + "%"});
this._checkOverlap();
// this.labelTwo.element.css({left: percent + "%"});
// this._checkOverlap();
},
_setSliderOnePosition: function (percent) {
@ -19993,17 +19993,7 @@ BI.SignTextEditor = BI.inherit(BI.Widget, {
var conf = BI.SignTextEditor.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-sign-initial-editor",
hgap: 4,
vgap: 2,
lgap: 0,
rgap: 0,
tgap: 0,
bgap: 0,
validationChecker: BI.emptyFn,
quitChecker: BI.emptyFn,
allowBlank: true,
watermark: "",
errorText: "",
text: "",
height: 24
});
@ -20015,18 +20005,11 @@ BI.SignTextEditor = BI.inherit(BI.Widget, {
this.editor = BI.createWidget({
type: "bi.editor",
height: o.height,
hgap: o.hgap,
vgap: o.vgap,
lgap: o.lgap,
rgap: o.rgap,
tgap: o.tgap,
bgap: o.bgap,
hgap: 4,
vgap: 2,
value: o.value,
validationChecker: o.validationChecker,
quitChecker: o.quitChecker,
allowBlank: o.allowBlank,
watermark: o.watermark,
errorText: o.errorText
allowBlank: false
});
this.text = BI.createWidget({
type: "bi.text_button",
@ -20034,9 +20017,7 @@ BI.SignTextEditor = BI.inherit(BI.Widget, {
title: function () {
return self.getValue();
},
warningTitle: o.warningTitle,
tipType: o.tipType,
textAlign: "left",
textAlign: o.textAlign,
height: o.height,
hgap: 4,
handler: function () {
@ -20304,10 +20285,10 @@ BI.SingleSlider = BI.inherit(BI.Widget, {
this.label = BI.createWidget({
type: "bi.sign_text_editor",
cls: "slider-editor-button",
errorText: "",
text: o.unit,
width: c.EDITOR_WIDTH - 2,
allowBlank: false,
textAlign: "center",
validationChecker: function (v) {
return self._checkValidation(v);
}
@ -20355,10 +20336,9 @@ BI.SingleSlider = BI.inherit(BI.Widget, {
el: {
type: "bi.vertical",
items: [{
type: "bi.absolute",
type: "bi.horizontal_auto",
items: [this.label]
}],
rgap: c.EDITOR_WIDTH,
height: c.EDITOR_HEIGHT
},
top: 0,
@ -20467,7 +20447,7 @@ BI.SingleSlider = BI.inherit(BI.Widget, {
},
_setLabelPosition: function (percent) {
this.label.element.css({left: percent + "%"});
// this.label.element.css({left: percent + "%"});
},
_setSliderPosition: function (percent) {

42
src/base/single/label/icon.label.js

@ -0,0 +1,42 @@
/**
* @class BI.IconButton
* @extends BI.BasicButton
* 图标标签
*/
BI.IconLabel = BI.inherit(BI.Single, {
props: {
baseCls: "bi-icon-label horizon-center",
iconWidth: null,
iconHeight: null
},
_init: function () {
BI.IconLabel.superclass._init.apply(this, arguments);
var o = this.options;
this.element.css({
textAlign: "center"
});
this.icon = BI.createWidget({
type: "bi.icon",
width: o.iconWidth,
height: o.iconHeight
});
if (BI.isNumber(o.height) && o.height > 0 && BI.isNull(o.iconWidth) && BI.isNull(o.iconHeight)) {
this.element.css("lineHeight", o.height + "px");
BI.createWidget({
type: "bi.default",
element: this,
items: [this.icon]
});
} else {
this.element.css("lineHeight", "1");
BI.createWidget({
element: this,
type: "bi.center_adapt",
items: [this.icon]
});
}
}
});
BI.shortcut("bi.icon_label", BI.IconLabel);

12
src/widget/intervalslider/intervalslider.js

@ -48,7 +48,7 @@ BI.IntervalSlider = BI.inherit(BI.Single, {
type: "bi.sign_text_editor",
cls: "slider-editor-button",
text: this.options.unit,
errorText: "",
textAlign: "left",
allowBlank: false,
width: c.EDITOR_WIDTH,
validationChecker: function (v) {
@ -74,10 +74,10 @@ BI.IntervalSlider = BI.inherit(BI.Single, {
this.labelTwo = BI.createWidget({
type: "bi.sign_text_editor",
cls: "slider-editor-button",
errorText: "",
text: this.options.unit,
allowBlank: false,
width: c.EDITOR_WIDTH,
textAlign: "right",
validationChecker: function (v) {
return self._checkValidation(v);
}
@ -327,13 +327,13 @@ BI.IntervalSlider = BI.inherit(BI.Single, {
},
_setLabelOnePosition: function (percent) {
this.labelOne.element.css({left: percent + "%"});
this._checkOverlap();
// this.labelOne.element.css({left: percent + "%"});
// this._checkOverlap();
},
_setLabelTwoPosition: function (percent) {
this.labelTwo.element.css({left: percent + "%"});
this._checkOverlap();
// this.labelTwo.element.css({left: percent + "%"});
// this._checkOverlap();
},
_setSliderOnePosition: function (percent) {

27
src/widget/singleslider/button/editor.sign.text.js

@ -6,17 +6,7 @@ BI.SignTextEditor = BI.inherit(BI.Widget, {
var conf = BI.SignTextEditor.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-sign-initial-editor",
hgap: 4,
vgap: 2,
lgap: 0,
rgap: 0,
tgap: 0,
bgap: 0,
validationChecker: BI.emptyFn,
quitChecker: BI.emptyFn,
allowBlank: true,
watermark: "",
errorText: "",
text: "",
height: 24
});
@ -28,18 +18,11 @@ BI.SignTextEditor = BI.inherit(BI.Widget, {
this.editor = BI.createWidget({
type: "bi.editor",
height: o.height,
hgap: o.hgap,
vgap: o.vgap,
lgap: o.lgap,
rgap: o.rgap,
tgap: o.tgap,
bgap: o.bgap,
hgap: 4,
vgap: 2,
value: o.value,
validationChecker: o.validationChecker,
quitChecker: o.quitChecker,
allowBlank: o.allowBlank,
watermark: o.watermark,
errorText: o.errorText
allowBlank: false
});
this.text = BI.createWidget({
type: "bi.text_button",
@ -47,9 +30,7 @@ BI.SignTextEditor = BI.inherit(BI.Widget, {
title: function () {
return self.getValue();
},
warningTitle: o.warningTitle,
tipType: o.tipType,
textAlign: "left",
textAlign: o.textAlign,
height: o.height,
hgap: 4,
handler: function () {

7
src/widget/singleslider/singleslider.js

@ -75,10 +75,10 @@ BI.SingleSlider = BI.inherit(BI.Widget, {
this.label = BI.createWidget({
type: "bi.sign_text_editor",
cls: "slider-editor-button",
errorText: "",
text: o.unit,
width: c.EDITOR_WIDTH - 2,
allowBlank: false,
textAlign: "center",
validationChecker: function (v) {
return self._checkValidation(v);
}
@ -126,10 +126,9 @@ BI.SingleSlider = BI.inherit(BI.Widget, {
el: {
type: "bi.vertical",
items: [{
type: "bi.absolute",
type: "bi.horizontal_auto",
items: [this.label]
}],
rgap: c.EDITOR_WIDTH,
height: c.EDITOR_HEIGHT
},
top: 0,
@ -238,7 +237,7 @@ BI.SingleSlider = BI.inherit(BI.Widget, {
},
_setLabelPosition: function (percent) {
this.label.element.css({left: percent + "%"});
// this.label.element.css({left: percent + "%"});
},
_setSliderPosition: function (percent) {

Loading…
Cancel
Save