Browse Source

chore: 优化代码

es6
guy 3 years ago
parent
commit
fabf8d7fc6
  1. 33
      src/case/colorchooser/colorchooser.popup.hex.js
  2. 2
      src/case/colorchooser/colorpicker/colorpicker.hex.js
  3. 2
      src/case/colorchooser/colorpicker/editor.colorpicker.hex.js

33
src/case/colorchooser/colorchooser.popup.hex.js

@ -16,8 +16,7 @@ BI.HexColorChooserPopup = BI.inherit(BI.Widget, {
var self = this, o = this.options; var self = this, o = this.options;
var hasRecommendColors = BI.isNotNull(o.recommendColorsGetter()); var hasRecommendColors = BI.isNotNull(o.recommendColorsGetter());
return [{ return [{
el: { type: "bi.vertical",
type: 'bi.vertical',
items: [{ items: [{
el: { el: {
type: "bi.vertical", type: "bi.vertical",
@ -60,12 +59,12 @@ BI.HexColorChooserPopup = BI.inherit(BI.Widget, {
height: 22 height: 22
}, { }, {
el: hasRecommendColors ? { el: hasRecommendColors ? {
type: 'bi.vertical', type: "bi.vertical",
items: [{ items: [{
type: 'bi.label', type: "bi.label",
text: BI.i18nText('BI-Basic_Recommend_Color'), text: BI.i18nText("BI-Basic_Recommend_Color"),
textAlign: 'left', textAlign: "left",
height: 24, height: 24
}, { }, {
type: "bi.hex_color_picker", type: "bi.hex_color_picker",
cls: "bi-border-bottom bi-border-right", cls: "bi-border-bottom bi-border-right",
@ -84,18 +83,18 @@ BI.HexColorChooserPopup = BI.inherit(BI.Widget, {
self.recommendColors = _ref; self.recommendColors = _ref;
} }
}] }]
} : { type: 'bi.layout' }, } : {type: "bi.layout"},
tgap: hasRecommendColors ? 10 : 0, tgap: hasRecommendColors ? 10 : 0,
height: hasRecommendColors ? 47 : 0 height: hasRecommendColors ? 47 : 0
}, { }, {
el: { el: {
type: 'bi.layout', type: "bi.layout",
cls: 'bi-border-top', cls: "bi-border-top"
}, },
vgap: 10, vgap: 10,
height: 1 height: 1
}, { }, {
type: 'bi.absolute', type: "bi.absolute",
items: [{ items: [{
el: { el: {
type: "bi.hex_color_picker", type: "bi.hex_color_picker",
@ -111,14 +110,14 @@ BI.HexColorChooserPopup = BI.inherit(BI.Widget, {
}], }],
ref: function (_ref) { ref: function (_ref) {
self.colorPicker = _ref; self.colorPicker = _ref;
}, }
}, },
top: 0, top: 0,
left: 0, left: 0,
right: 0, right: 0,
bottom: 1, bottom: 1
}], }],
height: 80, height: 80
}] }]
} }
}, { }, {
@ -186,11 +185,6 @@ BI.HexColorChooserPopup = BI.inherit(BI.Widget, {
tgap: 10, tgap: 10,
height: 24 height: 24
}] }]
},
left: 0,
right: 0,
top: 0,
bottom: 0
}, { }, {
type: "bi.absolute", type: "bi.absolute",
items: [{ items: [{
@ -212,7 +206,6 @@ BI.HexColorChooserPopup = BI.inherit(BI.Widget, {
// 这里就实现的不好了,setValue里面有个editor,editor的setValue会检测错误然后出bubble提示 // 这里就实现的不好了,setValue里面有个editor,editor的setValue会检测错误然后出bubble提示
mounted: function () { mounted: function () {
var self = this;
var o = this.options; var o = this.options;
if (BI.isNotNull(o.value)) { if (BI.isNotNull(o.value)) {
this.setValue(o.value); this.setValue(o.value);

2
src/case/colorchooser/colorpicker/colorpicker.hex.js

@ -110,8 +110,6 @@ BI.HexColorPicker = BI.inherit(BI.Widget, {
render: function () { render: function () {
var self = this, o = this.options; var self = this, o = this.options;
this.colors = BI.createWidget();
return { return {
type: "bi.button_group", type: "bi.button_group",
items: this._digest(o.items || this._items), items: this._digest(o.items || this._items),

2
src/case/colorchooser/colorpicker/editor.colorpicker.hex.js

@ -61,7 +61,7 @@ BI.HexColorPickerEditor = BI.inherit(BI.Widget, {
tgap: 10, tgap: 10,
items: [{ items: [{
type: 'bi.vertical_adapt', type: 'bi.vertical_adapt',
columnSize: [0.5, 'fill'], columnSize: ["fill", 'fill'],
height: 24, height: 24,
items: [{ items: [{
type: "bi.color_picker_show_button", type: "bi.color_picker_show_button",

Loading…
Cancel
Save