Browse Source

update

master
guy 7 years ago
parent
commit
27677b9a06
  1. 16
      demo/js/case/demo.color_chooser.js
  2. 7
      demo/js/case/demo.color_chooser_popup.js
  3. 42
      dist/_fineui.min.js
  4. 24
      dist/bundle.css
  5. 328
      dist/bundle.js
  6. 2
      dist/bundle.min.css
  7. 42
      dist/bundle.min.js
  8. 328
      dist/case.js
  9. 23
      dist/demo.js
  10. 24
      dist/fineui.css
  11. 2
      dist/fineui.min.css
  12. 42
      dist/fineui.min.js
  13. 24
      dist/resource.css
  14. 24
      public/css/icon.css
  15. 4
      src/case/colorchooser/colorchooser.custom.js
  16. 12
      src/case/colorchooser/colorchooser.js
  17. 5
      src/case/colorchooser/colorchooser.popup.js
  18. 49
      src/case/colorchooser/colorchooser.popup.simple.js
  19. 55
      src/case/colorchooser/colorchooser.simple.js
  20. 2
      src/case/colorchooser/colorchooser.trigger.js
  21. 97
      src/case/colorchooser/colorchooser.trigger.long.js
  22. 108
      src/case/colorchooser/colorpicker/editor.colorpicker.simple.js
  23. 24
      src/css/resource/icon.css
  24. 2
      src/less/resource/icon.less
  25. 24
      ui/css/icon.css

16
demo/js/case/demo.color_chooser.js

@ -14,6 +14,22 @@ Demo.Func = BI.inherit(BI.Widget, {
}, },
left: 100, left: 100,
top: 250 top: 250
}, {
el: {
type: "bi.simple_color_chooser",
width: 30,
height: 30
},
left: 400,
top: 250
}, {
el: {
type: "bi.color_chooser",
width: 230,
height: 30
},
left: 100,
top: 350
}] }]
}; };
} }

7
demo/js/case/demo.color_chooser_popup.js

@ -13,6 +13,13 @@ Demo.Func = BI.inherit(BI.Widget, {
}, },
left: 100, left: 100,
top: 250 top: 250
}, {
el: {
type: "bi.simple_color_chooser_popup",
cls: "bi-card"
},
left: 400,
top: 250
}] }]
}; };
} }

42
dist/_fineui.min.js vendored

File diff suppressed because one or more lines are too long

24
dist/bundle.css vendored

@ -6806,6 +6806,30 @@ textarea::-webkit-scrollbar-thumb:hover {
_filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='https://fanruan.coding.me/fineui/dist/images/1x/icon/slider_normal_small.png'); _filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='https://fanruan.coding.me/fineui/dist/images/1x/icon/slider_normal_small.png');
_background: none; _background: none;
} }
.static-auto-color-icon .x-icon {
display: block;
background: url('https://fanruan.coding.me/fineui/dist/images/2x/icon/auto_normal.png') no-repeat center center;
_filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='https://fanruan.coding.me/fineui/dist/images/2x/icon/auto_normal.png');
background-size: contain;
_background: none;
}
.static-auto-color-icon .x-icon.hack {
background: url('https://fanruan.coding.me/fineui/dist/images/1x/icon/auto_normal.png') no-repeat center center;
_filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='https://fanruan.coding.me/fineui/dist/images/1x/icon/auto_normal.png');
_background: none;
}
.static-trans-color-icon .x-icon {
display: block;
background: url('https://fanruan.coding.me/fineui/dist/images/2x/icon/trans_normal.png') no-repeat center center;
_filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='https://fanruan.coding.me/fineui/dist/images/2x/icon/trans_normal.png');
background-size: contain;
_background: none;
}
.static-trans-color-icon .x-icon.hack {
background: url('https://fanruan.coding.me/fineui/dist/images/1x/icon/trans_normal.png') no-repeat center center;
_filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='https://fanruan.coding.me/fineui/dist/images/1x/icon/trans_normal.png');
_background: none;
}
.auto-color-icon .x-icon { .auto-color-icon .x-icon {
display: block; display: block;
background: url('https://fanruan.coding.me/fineui/dist/images/2x/icon/auto_normal.png') no-repeat center center; background: url('https://fanruan.coding.me/fineui/dist/images/2x/icon/auto_normal.png') no-repeat center center;

328
dist/bundle.js vendored

@ -76001,8 +76001,8 @@ BI.CustomColorChooser = BI.inherit(BI.Widget, {
_init: function () { _init: function () {
BI.CustomColorChooser.superclass._init.apply(this, arguments); BI.CustomColorChooser.superclass._init.apply(this, arguments);
var self = this; var self = this, o = this.options;
this.editor = BI.createWidget({ this.editor = BI.createWidget(o.editor, {
type: "bi.color_picker_editor" type: "bi.color_picker_editor"
}); });
this.editor.on(BI.ColorPickerEditor.EVENT_CHANGE, function () { this.editor.on(BI.ColorPickerEditor.EVENT_CHANGE, function () {
@ -76062,7 +76062,7 @@ BI.ColorChooser = BI.inherit(BI.Widget, {
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.ColorChooser.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.ColorChooser.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-color-chooser", baseCls: "bi-color-chooser",
el: {} value: ""
}); });
}, },
@ -76074,8 +76074,10 @@ BI.ColorChooser = BI.inherit(BI.Widget, {
type: "bi.combo", type: "bi.combo",
element: this, element: this,
adjustLength: 1, adjustLength: 1,
isNeedAdjustWidth: false,
isNeedAdjustHeight: false,
el: BI.extend({ el: BI.extend({
type: "bi.color_chooser_trigger", type: o.width <= 30 ? "bi.color_chooser_trigger" : "bi.long_color_chooser_trigger",
ref: function (_ref) { ref: function (_ref) {
self.trigger = _ref; self.trigger = _ref;
}, },
@ -76083,7 +76085,7 @@ BI.ColorChooser = BI.inherit(BI.Widget, {
height: o.height height: o.height
}, o.el), }, o.el),
popup: { popup: {
el: { el: BI.extend({
type: "bi.color_chooser_popup", type: "bi.color_chooser_popup",
ref: function (_ref) { ref: function (_ref) {
self.colorPicker = _ref; self.colorPicker = _ref;
@ -76100,9 +76102,9 @@ BI.ColorChooser = BI.inherit(BI.Widget, {
self.combo.hideView(); self.combo.hideView();
} }
}] }]
}, }, o.popup),
stopPropagation: false, stopPropagation: false,
minWidth: 202 width: 202
}, },
value: o.value value: o.value
}); });
@ -76167,7 +76169,7 @@ BI.ColorChooserPopup = BI.inherit(BI.Widget, {
_init: function () { _init: function () {
BI.ColorChooserPopup.superclass._init.apply(this, arguments); BI.ColorChooserPopup.superclass._init.apply(this, arguments);
var self = this, o = this.options; var self = this, o = this.options;
this.colorEditor = BI.createWidget({ this.colorEditor = BI.createWidget(o.editor, {
type: "bi.color_picker_editor", type: "bi.color_picker_editor",
value: o.value value: o.value
}); });
@ -76226,7 +76228,8 @@ BI.ColorChooserPopup = BI.inherit(BI.Widget, {
}); });
this.customColorChooser = BI.createWidget({ this.customColorChooser = BI.createWidget({
type: "bi.custom_color_chooser" type: "bi.custom_color_chooser",
editor: o.editor
}); });
var panel = BI.createWidget({ var panel = BI.createWidget({
@ -76348,6 +76351,108 @@ BI.ColorChooserPopup = BI.inherit(BI.Widget, {
BI.ColorChooserPopup.EVENT_VALUE_CHANGE = "ColorChooserPopup.EVENT_VALUE_CHANGE"; BI.ColorChooserPopup.EVENT_VALUE_CHANGE = "ColorChooserPopup.EVENT_VALUE_CHANGE";
BI.ColorChooserPopup.EVENT_CHANGE = "ColorChooserPopup.EVENT_CHANGE"; BI.ColorChooserPopup.EVENT_CHANGE = "ColorChooserPopup.EVENT_CHANGE";
BI.shortcut("bi.color_chooser_popup", BI.ColorChooserPopup);/** BI.shortcut("bi.color_chooser_popup", BI.ColorChooserPopup);/**
* 选色控件
*
* Created by GUY on 2015/11/17.
* @class BI.SimpleColorChooserPopup
* @extends BI.Widget
*/
BI.SimpleColorChooserPopup = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.SimpleColorChooserPopup.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-color-chooser-popup"
});
},
_init: function () {
BI.SimpleColorChooserPopup.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.popup = BI.createWidget({
type: "bi.color_chooser_popup",
value: o.value,
element: this,
editor: {
type: "bi.simple_color_picker_editor"
}
});
this.popup.on(BI.ColorChooserPopup.EVENT_CHANGE, function () {
self.fireEvent(BI.SimpleColorChooserPopup.EVENT_CHANGE, arguments);
});
this.popup.on(BI.ColorChooserPopup.EVENT_VALUE_CHANGE, function () {
self.fireEvent(BI.SimpleColorChooserPopup.EVENT_VALUE_CHANGE, arguments);
});
},
setStoreColors: function (colors) {
this.popup.setStoreColors(colors);
},
setValue: function (color) {
this.popup.setValue(color);
},
getValue: function () {
return this.popup.getValue();
}
});
BI.SimpleColorChooserPopup.EVENT_VALUE_CHANGE = "ColorChooserPopup.EVENT_VALUE_CHANGE";
BI.SimpleColorChooserPopup.EVENT_CHANGE = "ColorChooserPopup.EVENT_CHANGE";
BI.shortcut("bi.simple_color_chooser_popup", BI.SimpleColorChooserPopup);/**
* 简单选色控件没有自动和透明
*
* Created by GUY on 2015/11/17.
* @class BI.SimpleColorChooser
* @extends BI.Widget
*/
BI.SimpleColorChooser = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.SimpleColorChooser.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-simple-color-chooser",
value: "#ffffff"
});
},
_init: function () {
BI.SimpleColorChooser.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.combo = BI.createWidget({
type: "bi.color_chooser",
element: this,
value: o.value,
popup: {
type: "bi.simple_color_chooser_popup"
}
});
this.combo.on(BI.ColorChooser.EVENT_CHANGE, function () {
self.fireEvent(BI.SimpleColorChooser.EVENT_CHANGE, arguments);
});
},
isViewVisible: function () {
return this.combo.isViewVisible();
},
hideView: function () {
this.combo.hideView();
},
showView: function () {
this.combo.showView();
},
setValue: function (color) {
this.combo.setValue(color);
},
getValue: function () {
return this.combo.getValue();
}
});
BI.SimpleColorChooser.EVENT_CHANGE = "ColorChooser.EVENT_CHANGE";
BI.shortcut("bi.simple_color_chooser", BI.SimpleColorChooser);/**
* 选色控件 * 选色控件
* *
* Created by GUY on 2015/11/17. * Created by GUY on 2015/11/17.
@ -76394,7 +76499,7 @@ BI.ColorChooserTrigger = BI.inherit(BI.Trigger, {
bottom: 3 bottom: 3
}] }]
}); });
if (this.options.value) { if (BI.isNotNull(this.options.value)) {
this.setValue(this.options.value); this.setValue(this.options.value);
} }
}, },
@ -76412,6 +76517,102 @@ BI.ColorChooserTrigger = BI.inherit(BI.Trigger, {
}); });
BI.ColorChooserTrigger.EVENT_CHANGE = "ColorChooserTrigger.EVENT_CHANGE"; BI.ColorChooserTrigger.EVENT_CHANGE = "ColorChooserTrigger.EVENT_CHANGE";
BI.shortcut("bi.color_chooser_trigger", BI.ColorChooserTrigger);/** BI.shortcut("bi.color_chooser_trigger", BI.ColorChooserTrigger);/**
* 选色控件
*
* Created by GUY on 2015/11/17.
* @class BI.LongColorChooserTrigger
* @extends BI.Trigger
*/
BI.LongColorChooserTrigger = BI.inherit(BI.Trigger, {
_defaultConfig: function () {
var conf = BI.LongColorChooserTrigger.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-color-chooser-trigger",
height: 30
});
},
_init: function () {
BI.LongColorChooserTrigger.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.colorContainer = BI.createWidget({
type: "bi.htape",
cls: "bi-card color-chooser-trigger-content",
items: [{
type: "bi.icon_change_button",
ref: function (_ref) {
self.changeIcon = _ref;
},
iconCls: "static-auto-color-icon",
width: 24,
iconWidth: 16,
iconHeight: 16
}, {
el: {
type: "bi.label",
ref: function (_ref) {
self.label = _ref;
},
textAlign: "left",
hgap: 5,
height: 24,
text: BI.i18nText("BI-Basic_Auto")
}
}]
});
var down = BI.createWidget({
type: "bi.icon_button",
disableSelected: true,
cls: "icon-combo-down-icon trigger-triangle-font",
width: 12,
height: 8
});
BI.createWidget({
type: "bi.absolute",
element: this,
items: [{
el: this.colorContainer,
left: 3,
right: 3,
top: 3,
bottom: 3
}, {
el: down,
right: 3,
bottom: 3
}]
});
if (this.options.value) {
this.setValue(this.options.value);
}
},
setValue: function (color) {
BI.LongColorChooserTrigger.superclass.setValue.apply(this, arguments);
if (color === "") {
this.colorContainer.element.css("background-color", "");
this.changeIcon.setVisible(true);
this.label.setVisible(true);
this.changeIcon.setIcon("static-auto-color-icon");
this.label.setText(BI.i18nText("BI-Basic_Auto"));
} else if (color === "transparent") {
this.colorContainer.element.css("background-color", "");
this.changeIcon.setVisible(true);
this.label.setVisible(true);
this.changeIcon.setIcon("static-trans-color-icon");
this.label.setText(BI.i18nText("BI-Transparent_Color"));
} else {
this.colorContainer.element.css({"background-color": color});
this.changeIcon.setVisible(false);
this.label.setVisible(false);
}
}
});
BI.LongColorChooserTrigger.EVENT_CHANGE = "ColorChooserTrigger.EVENT_CHANGE";
BI.shortcut("bi.long_color_chooser_trigger", BI.LongColorChooserTrigger);/**
* 简单选色控件按钮 * 简单选色控件按钮
* *
* Created by GUY on 2015/11/16. * Created by GUY on 2015/11/16.
@ -76853,6 +77054,113 @@ BI.ColorPickerEditor = BI.inherit(BI.Widget, {
}); });
BI.ColorPickerEditor.EVENT_CHANGE = "ColorPickerEditor.EVENT_CHANGE"; BI.ColorPickerEditor.EVENT_CHANGE = "ColorPickerEditor.EVENT_CHANGE";
BI.shortcut("bi.color_picker_editor", BI.ColorPickerEditor);/** BI.shortcut("bi.color_picker_editor", BI.ColorPickerEditor);/**
* 简单选色控件
*
* Created by GUY on 2015/11/16.
* @class BI.SimpleColorPickerEditor
* @extends BI.Widget
*/
BI.SimpleColorPickerEditor = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.SimpleColorPickerEditor.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-color-picker-editor",
// width: 200,
height: 20
});
},
_init: function () {
BI.SimpleColorPickerEditor.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.colorShow = BI.createWidget({
type: "bi.layout",
cls: "color-picker-editor-display bi-card",
height: 20
});
var RGB = BI.createWidgets(BI.createItems([{text: "R"}, {text: "G"}, {text: "B"}], {
type: "bi.label",
cls: "color-picker-editor-label",
width: 10,
height: 20
}));
var checker = function (v) {
return BI.isNumeric(v) && (v | 0) >= 0 && (v | 0) <= 255;
};
var Ws = BI.createWidgets([{}, {}, {}], {
type: "bi.small_text_editor",
cls: "color-picker-editor-input",
validationChecker: checker,
errorText: BI.i18nText("BI-Color_Picker_Error_Text"),
allowBlank: true,
value: 255,
width: 32,
height: 20
});
BI.each(Ws, function (i, w) {
w.on(BI.TextEditor.EVENT_CHANGE, function () {
if (self.R.isValid() && self.G.isValid() && self.B.isValid()) {
self.colorShow.element.css("background-color", self.getValue());
self.fireEvent(BI.SimpleColorPickerEditor.EVENT_CHANGE);
}
});
});
this.R = Ws[0];
this.G = Ws[1];
this.B = Ws[2];
BI.createWidget({
type: "bi.htape",
element: this,
items: [{
el: this.colorShow,
lgap: 5,
rgap: 5
}, {
el: RGB[0],
lgap: 10,
width: 16
}, {
el: this.R,
width: 36
}, {
el: RGB[1],
lgap: 10,
width: 16
}, {
el: this.G,
width: 36
}, {
el: RGB[2],
lgap: 10,
width: 16
}, {
el: this.B,
width: 36,
rgap: 10
}]
});
},
setValue: function (color) {
this.colorShow.element.css({"background-color": color});
var json = BI.DOM.rgb2json(BI.DOM.hex2rgb(color));
this.R.setValue(BI.isNull(json.r) ? "" : json.r);
this.G.setValue(BI.isNull(json.g) ? "" : json.g);
this.B.setValue(BI.isNull(json.b) ? "" : json.b);
},
getValue: function () {
return BI.DOM.rgb2hex(BI.DOM.json2rgb({
r: this.R.getValue(),
g: this.G.getValue(),
b: this.B.getValue()
}));
}
});
BI.SimpleColorPickerEditor.EVENT_CHANGE = "SimpleColorPickerEditor.EVENT_CHANGE";
BI.shortcut("bi.simple_color_picker_editor", BI.SimpleColorPickerEditor);/**
* 选色控件 * 选色控件
* *
* Created by GUY on 2015/11/16. * Created by GUY on 2015/11/16.

2
dist/bundle.min.css vendored

File diff suppressed because one or more lines are too long

42
dist/bundle.min.js vendored

File diff suppressed because one or more lines are too long

328
dist/case.js vendored

@ -3552,8 +3552,8 @@ BI.CustomColorChooser = BI.inherit(BI.Widget, {
_init: function () { _init: function () {
BI.CustomColorChooser.superclass._init.apply(this, arguments); BI.CustomColorChooser.superclass._init.apply(this, arguments);
var self = this; var self = this, o = this.options;
this.editor = BI.createWidget({ this.editor = BI.createWidget(o.editor, {
type: "bi.color_picker_editor" type: "bi.color_picker_editor"
}); });
this.editor.on(BI.ColorPickerEditor.EVENT_CHANGE, function () { this.editor.on(BI.ColorPickerEditor.EVENT_CHANGE, function () {
@ -3613,7 +3613,7 @@ BI.ColorChooser = BI.inherit(BI.Widget, {
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.ColorChooser.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.ColorChooser.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-color-chooser", baseCls: "bi-color-chooser",
el: {} value: ""
}); });
}, },
@ -3625,8 +3625,10 @@ BI.ColorChooser = BI.inherit(BI.Widget, {
type: "bi.combo", type: "bi.combo",
element: this, element: this,
adjustLength: 1, adjustLength: 1,
isNeedAdjustWidth: false,
isNeedAdjustHeight: false,
el: BI.extend({ el: BI.extend({
type: "bi.color_chooser_trigger", type: o.width <= 30 ? "bi.color_chooser_trigger" : "bi.long_color_chooser_trigger",
ref: function (_ref) { ref: function (_ref) {
self.trigger = _ref; self.trigger = _ref;
}, },
@ -3634,7 +3636,7 @@ BI.ColorChooser = BI.inherit(BI.Widget, {
height: o.height height: o.height
}, o.el), }, o.el),
popup: { popup: {
el: { el: BI.extend({
type: "bi.color_chooser_popup", type: "bi.color_chooser_popup",
ref: function (_ref) { ref: function (_ref) {
self.colorPicker = _ref; self.colorPicker = _ref;
@ -3651,9 +3653,9 @@ BI.ColorChooser = BI.inherit(BI.Widget, {
self.combo.hideView(); self.combo.hideView();
} }
}] }]
}, }, o.popup),
stopPropagation: false, stopPropagation: false,
minWidth: 202 width: 202
}, },
value: o.value value: o.value
}); });
@ -3718,7 +3720,7 @@ BI.ColorChooserPopup = BI.inherit(BI.Widget, {
_init: function () { _init: function () {
BI.ColorChooserPopup.superclass._init.apply(this, arguments); BI.ColorChooserPopup.superclass._init.apply(this, arguments);
var self = this, o = this.options; var self = this, o = this.options;
this.colorEditor = BI.createWidget({ this.colorEditor = BI.createWidget(o.editor, {
type: "bi.color_picker_editor", type: "bi.color_picker_editor",
value: o.value value: o.value
}); });
@ -3777,7 +3779,8 @@ BI.ColorChooserPopup = BI.inherit(BI.Widget, {
}); });
this.customColorChooser = BI.createWidget({ this.customColorChooser = BI.createWidget({
type: "bi.custom_color_chooser" type: "bi.custom_color_chooser",
editor: o.editor
}); });
var panel = BI.createWidget({ var panel = BI.createWidget({
@ -3899,6 +3902,108 @@ BI.ColorChooserPopup = BI.inherit(BI.Widget, {
BI.ColorChooserPopup.EVENT_VALUE_CHANGE = "ColorChooserPopup.EVENT_VALUE_CHANGE"; BI.ColorChooserPopup.EVENT_VALUE_CHANGE = "ColorChooserPopup.EVENT_VALUE_CHANGE";
BI.ColorChooserPopup.EVENT_CHANGE = "ColorChooserPopup.EVENT_CHANGE"; BI.ColorChooserPopup.EVENT_CHANGE = "ColorChooserPopup.EVENT_CHANGE";
BI.shortcut("bi.color_chooser_popup", BI.ColorChooserPopup);/** BI.shortcut("bi.color_chooser_popup", BI.ColorChooserPopup);/**
* 选色控件
*
* Created by GUY on 2015/11/17.
* @class BI.SimpleColorChooserPopup
* @extends BI.Widget
*/
BI.SimpleColorChooserPopup = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.SimpleColorChooserPopup.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-color-chooser-popup"
});
},
_init: function () {
BI.SimpleColorChooserPopup.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.popup = BI.createWidget({
type: "bi.color_chooser_popup",
value: o.value,
element: this,
editor: {
type: "bi.simple_color_picker_editor"
}
});
this.popup.on(BI.ColorChooserPopup.EVENT_CHANGE, function () {
self.fireEvent(BI.SimpleColorChooserPopup.EVENT_CHANGE, arguments);
});
this.popup.on(BI.ColorChooserPopup.EVENT_VALUE_CHANGE, function () {
self.fireEvent(BI.SimpleColorChooserPopup.EVENT_VALUE_CHANGE, arguments);
});
},
setStoreColors: function (colors) {
this.popup.setStoreColors(colors);
},
setValue: function (color) {
this.popup.setValue(color);
},
getValue: function () {
return this.popup.getValue();
}
});
BI.SimpleColorChooserPopup.EVENT_VALUE_CHANGE = "ColorChooserPopup.EVENT_VALUE_CHANGE";
BI.SimpleColorChooserPopup.EVENT_CHANGE = "ColorChooserPopup.EVENT_CHANGE";
BI.shortcut("bi.simple_color_chooser_popup", BI.SimpleColorChooserPopup);/**
* 简单选色控件没有自动和透明
*
* Created by GUY on 2015/11/17.
* @class BI.SimpleColorChooser
* @extends BI.Widget
*/
BI.SimpleColorChooser = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.SimpleColorChooser.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-simple-color-chooser",
value: "#ffffff"
});
},
_init: function () {
BI.SimpleColorChooser.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.combo = BI.createWidget({
type: "bi.color_chooser",
element: this,
value: o.value,
popup: {
type: "bi.simple_color_chooser_popup"
}
});
this.combo.on(BI.ColorChooser.EVENT_CHANGE, function () {
self.fireEvent(BI.SimpleColorChooser.EVENT_CHANGE, arguments);
});
},
isViewVisible: function () {
return this.combo.isViewVisible();
},
hideView: function () {
this.combo.hideView();
},
showView: function () {
this.combo.showView();
},
setValue: function (color) {
this.combo.setValue(color);
},
getValue: function () {
return this.combo.getValue();
}
});
BI.SimpleColorChooser.EVENT_CHANGE = "ColorChooser.EVENT_CHANGE";
BI.shortcut("bi.simple_color_chooser", BI.SimpleColorChooser);/**
* 选色控件 * 选色控件
* *
* Created by GUY on 2015/11/17. * Created by GUY on 2015/11/17.
@ -3945,7 +4050,7 @@ BI.ColorChooserTrigger = BI.inherit(BI.Trigger, {
bottom: 3 bottom: 3
}] }]
}); });
if (this.options.value) { if (BI.isNotNull(this.options.value)) {
this.setValue(this.options.value); this.setValue(this.options.value);
} }
}, },
@ -3963,6 +4068,102 @@ BI.ColorChooserTrigger = BI.inherit(BI.Trigger, {
}); });
BI.ColorChooserTrigger.EVENT_CHANGE = "ColorChooserTrigger.EVENT_CHANGE"; BI.ColorChooserTrigger.EVENT_CHANGE = "ColorChooserTrigger.EVENT_CHANGE";
BI.shortcut("bi.color_chooser_trigger", BI.ColorChooserTrigger);/** BI.shortcut("bi.color_chooser_trigger", BI.ColorChooserTrigger);/**
* 选色控件
*
* Created by GUY on 2015/11/17.
* @class BI.LongColorChooserTrigger
* @extends BI.Trigger
*/
BI.LongColorChooserTrigger = BI.inherit(BI.Trigger, {
_defaultConfig: function () {
var conf = BI.LongColorChooserTrigger.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-color-chooser-trigger",
height: 30
});
},
_init: function () {
BI.LongColorChooserTrigger.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.colorContainer = BI.createWidget({
type: "bi.htape",
cls: "bi-card color-chooser-trigger-content",
items: [{
type: "bi.icon_change_button",
ref: function (_ref) {
self.changeIcon = _ref;
},
iconCls: "static-auto-color-icon",
width: 24,
iconWidth: 16,
iconHeight: 16
}, {
el: {
type: "bi.label",
ref: function (_ref) {
self.label = _ref;
},
textAlign: "left",
hgap: 5,
height: 24,
text: BI.i18nText("BI-Basic_Auto")
}
}]
});
var down = BI.createWidget({
type: "bi.icon_button",
disableSelected: true,
cls: "icon-combo-down-icon trigger-triangle-font",
width: 12,
height: 8
});
BI.createWidget({
type: "bi.absolute",
element: this,
items: [{
el: this.colorContainer,
left: 3,
right: 3,
top: 3,
bottom: 3
}, {
el: down,
right: 3,
bottom: 3
}]
});
if (this.options.value) {
this.setValue(this.options.value);
}
},
setValue: function (color) {
BI.LongColorChooserTrigger.superclass.setValue.apply(this, arguments);
if (color === "") {
this.colorContainer.element.css("background-color", "");
this.changeIcon.setVisible(true);
this.label.setVisible(true);
this.changeIcon.setIcon("static-auto-color-icon");
this.label.setText(BI.i18nText("BI-Basic_Auto"));
} else if (color === "transparent") {
this.colorContainer.element.css("background-color", "");
this.changeIcon.setVisible(true);
this.label.setVisible(true);
this.changeIcon.setIcon("static-trans-color-icon");
this.label.setText(BI.i18nText("BI-Transparent_Color"));
} else {
this.colorContainer.element.css({"background-color": color});
this.changeIcon.setVisible(false);
this.label.setVisible(false);
}
}
});
BI.LongColorChooserTrigger.EVENT_CHANGE = "ColorChooserTrigger.EVENT_CHANGE";
BI.shortcut("bi.long_color_chooser_trigger", BI.LongColorChooserTrigger);/**
* 简单选色控件按钮 * 简单选色控件按钮
* *
* Created by GUY on 2015/11/16. * Created by GUY on 2015/11/16.
@ -4404,6 +4605,113 @@ BI.ColorPickerEditor = BI.inherit(BI.Widget, {
}); });
BI.ColorPickerEditor.EVENT_CHANGE = "ColorPickerEditor.EVENT_CHANGE"; BI.ColorPickerEditor.EVENT_CHANGE = "ColorPickerEditor.EVENT_CHANGE";
BI.shortcut("bi.color_picker_editor", BI.ColorPickerEditor);/** BI.shortcut("bi.color_picker_editor", BI.ColorPickerEditor);/**
* 简单选色控件
*
* Created by GUY on 2015/11/16.
* @class BI.SimpleColorPickerEditor
* @extends BI.Widget
*/
BI.SimpleColorPickerEditor = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.SimpleColorPickerEditor.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-color-picker-editor",
// width: 200,
height: 20
});
},
_init: function () {
BI.SimpleColorPickerEditor.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.colorShow = BI.createWidget({
type: "bi.layout",
cls: "color-picker-editor-display bi-card",
height: 20
});
var RGB = BI.createWidgets(BI.createItems([{text: "R"}, {text: "G"}, {text: "B"}], {
type: "bi.label",
cls: "color-picker-editor-label",
width: 10,
height: 20
}));
var checker = function (v) {
return BI.isNumeric(v) && (v | 0) >= 0 && (v | 0) <= 255;
};
var Ws = BI.createWidgets([{}, {}, {}], {
type: "bi.small_text_editor",
cls: "color-picker-editor-input",
validationChecker: checker,
errorText: BI.i18nText("BI-Color_Picker_Error_Text"),
allowBlank: true,
value: 255,
width: 32,
height: 20
});
BI.each(Ws, function (i, w) {
w.on(BI.TextEditor.EVENT_CHANGE, function () {
if (self.R.isValid() && self.G.isValid() && self.B.isValid()) {
self.colorShow.element.css("background-color", self.getValue());
self.fireEvent(BI.SimpleColorPickerEditor.EVENT_CHANGE);
}
});
});
this.R = Ws[0];
this.G = Ws[1];
this.B = Ws[2];
BI.createWidget({
type: "bi.htape",
element: this,
items: [{
el: this.colorShow,
lgap: 5,
rgap: 5
}, {
el: RGB[0],
lgap: 10,
width: 16
}, {
el: this.R,
width: 36
}, {
el: RGB[1],
lgap: 10,
width: 16
}, {
el: this.G,
width: 36
}, {
el: RGB[2],
lgap: 10,
width: 16
}, {
el: this.B,
width: 36,
rgap: 10
}]
});
},
setValue: function (color) {
this.colorShow.element.css({"background-color": color});
var json = BI.DOM.rgb2json(BI.DOM.hex2rgb(color));
this.R.setValue(BI.isNull(json.r) ? "" : json.r);
this.G.setValue(BI.isNull(json.g) ? "" : json.g);
this.B.setValue(BI.isNull(json.b) ? "" : json.b);
},
getValue: function () {
return BI.DOM.rgb2hex(BI.DOM.json2rgb({
r: this.R.getValue(),
g: this.G.getValue(),
b: this.B.getValue()
}));
}
});
BI.SimpleColorPickerEditor.EVENT_CHANGE = "SimpleColorPickerEditor.EVENT_CHANGE";
BI.shortcut("bi.simple_color_picker_editor", BI.SimpleColorPickerEditor);/**
* 选色控件 * 选色控件
* *
* Created by GUY on 2015/11/16. * Created by GUY on 2015/11/16.

23
dist/demo.js vendored

@ -2410,6 +2410,13 @@ BI.shortcut("demo.clipboard", Demo.Func);Demo.Func = BI.inherit(BI.Widget, {
}, },
left: 100, left: 100,
top: 250 top: 250
}, {
el: {
type: "bi.simple_color_chooser_popup",
cls: "bi-card"
},
left: 400,
top: 250
}] }]
}; };
} }
@ -2430,6 +2437,22 @@ BI.shortcut("demo.color_chooser_popup", Demo.Func);Demo.Func = BI.inherit(BI.Wid
}, },
left: 100, left: 100,
top: 250 top: 250
}, {
el: {
type: "bi.simple_color_chooser",
width: 30,
height: 30
},
left: 400,
top: 250
}, {
el: {
type: "bi.color_chooser",
width: 230,
height: 30
},
left: 100,
top: 350
}] }]
}; };
} }

24
dist/fineui.css vendored

@ -6806,6 +6806,30 @@ textarea::-webkit-scrollbar-thumb:hover {
_filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='resources?path=/com/fr/web/ui/images/1x/icon/slider_normal_small.png'); _filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='resources?path=/com/fr/web/ui/images/1x/icon/slider_normal_small.png');
_background: none; _background: none;
} }
.static-auto-color-icon .x-icon {
display: block;
background: url('resources?path=/com/fr/web/ui/images/2x/icon/auto_normal.png') no-repeat center center;
_filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='resources?path=/com/fr/web/ui/images/2x/icon/auto_normal.png');
background-size: contain;
_background: none;
}
.static-auto-color-icon .x-icon.hack {
background: url('resources?path=/com/fr/web/ui/images/1x/icon/auto_normal.png') no-repeat center center;
_filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='resources?path=/com/fr/web/ui/images/1x/icon/auto_normal.png');
_background: none;
}
.static-trans-color-icon .x-icon {
display: block;
background: url('resources?path=/com/fr/web/ui/images/2x/icon/trans_normal.png') no-repeat center center;
_filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='resources?path=/com/fr/web/ui/images/2x/icon/trans_normal.png');
background-size: contain;
_background: none;
}
.static-trans-color-icon .x-icon.hack {
background: url('resources?path=/com/fr/web/ui/images/1x/icon/trans_normal.png') no-repeat center center;
_filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='resources?path=/com/fr/web/ui/images/1x/icon/trans_normal.png');
_background: none;
}
.auto-color-icon .x-icon { .auto-color-icon .x-icon {
display: block; display: block;
background: url('resources?path=/com/fr/web/ui/images/2x/icon/auto_normal.png') no-repeat center center; background: url('resources?path=/com/fr/web/ui/images/2x/icon/auto_normal.png') no-repeat center center;

2
dist/fineui.min.css vendored

File diff suppressed because one or more lines are too long

42
dist/fineui.min.js vendored

File diff suppressed because one or more lines are too long

24
dist/resource.css vendored

@ -1594,6 +1594,30 @@ textarea::-webkit-scrollbar-thumb:hover {
_filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/1x/icon/slider_normal_small.png'); _filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/1x/icon/slider_normal_small.png');
_background: none; _background: none;
} }
.static-auto-color-icon .x-icon {
display: block;
background: url('images/2x/icon/auto_normal.png') no-repeat center center;
_filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/2x/icon/auto_normal.png');
background-size: contain;
_background: none;
}
.static-auto-color-icon .x-icon.hack {
background: url('images/1x/icon/auto_normal.png') no-repeat center center;
_filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/1x/icon/auto_normal.png');
_background: none;
}
.static-trans-color-icon .x-icon {
display: block;
background: url('images/2x/icon/trans_normal.png') no-repeat center center;
_filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/2x/icon/trans_normal.png');
background-size: contain;
_background: none;
}
.static-trans-color-icon .x-icon.hack {
background: url('images/1x/icon/trans_normal.png') no-repeat center center;
_filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/1x/icon/trans_normal.png');
_background: none;
}
.auto-color-icon .x-icon { .auto-color-icon .x-icon {
display: block; display: block;
background: url('images/2x/icon/auto_normal.png') no-repeat center center; background: url('images/2x/icon/auto_normal.png') no-repeat center center;

24
public/css/icon.css

@ -460,6 +460,30 @@
_filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='https://fanruan.coding.me/fineui/dist/images/1x/icon/slider_normal_small.png'); _filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='https://fanruan.coding.me/fineui/dist/images/1x/icon/slider_normal_small.png');
_background: none; _background: none;
} }
.static-auto-color-icon .x-icon {
display: block;
background: url('https://fanruan.coding.me/fineui/dist/images/2x/icon/auto_normal.png') no-repeat center center;
_filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='https://fanruan.coding.me/fineui/dist/images/2x/icon/auto_normal.png');
background-size: contain;
_background: none;
}
.static-auto-color-icon .x-icon.hack {
background: url('https://fanruan.coding.me/fineui/dist/images/1x/icon/auto_normal.png') no-repeat center center;
_filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='https://fanruan.coding.me/fineui/dist/images/1x/icon/auto_normal.png');
_background: none;
}
.static-trans-color-icon .x-icon {
display: block;
background: url('https://fanruan.coding.me/fineui/dist/images/2x/icon/trans_normal.png') no-repeat center center;
_filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='https://fanruan.coding.me/fineui/dist/images/2x/icon/trans_normal.png');
background-size: contain;
_background: none;
}
.static-trans-color-icon .x-icon.hack {
background: url('https://fanruan.coding.me/fineui/dist/images/1x/icon/trans_normal.png') no-repeat center center;
_filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='https://fanruan.coding.me/fineui/dist/images/1x/icon/trans_normal.png');
_background: none;
}
.auto-color-icon .x-icon { .auto-color-icon .x-icon {
display: block; display: block;
background: url('https://fanruan.coding.me/fineui/dist/images/2x/icon/auto_normal.png') no-repeat center center; background: url('https://fanruan.coding.me/fineui/dist/images/2x/icon/auto_normal.png') no-repeat center center;

4
src/case/colorchooser/colorchooser.custom.js

@ -17,8 +17,8 @@ BI.CustomColorChooser = BI.inherit(BI.Widget, {
_init: function () { _init: function () {
BI.CustomColorChooser.superclass._init.apply(this, arguments); BI.CustomColorChooser.superclass._init.apply(this, arguments);
var self = this; var self = this, o = this.options;
this.editor = BI.createWidget({ this.editor = BI.createWidget(o.editor, {
type: "bi.color_picker_editor" type: "bi.color_picker_editor"
}); });
this.editor.on(BI.ColorPickerEditor.EVENT_CHANGE, function () { this.editor.on(BI.ColorPickerEditor.EVENT_CHANGE, function () {

12
src/case/colorchooser/colorchooser.js

@ -10,7 +10,7 @@ BI.ColorChooser = BI.inherit(BI.Widget, {
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.ColorChooser.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.ColorChooser.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-color-chooser", baseCls: "bi-color-chooser",
el: {} value: ""
}); });
}, },
@ -22,8 +22,10 @@ BI.ColorChooser = BI.inherit(BI.Widget, {
type: "bi.combo", type: "bi.combo",
element: this, element: this,
adjustLength: 1, adjustLength: 1,
isNeedAdjustWidth: false,
isNeedAdjustHeight: false,
el: BI.extend({ el: BI.extend({
type: "bi.color_chooser_trigger", type: o.width <= 30 ? "bi.color_chooser_trigger" : "bi.long_color_chooser_trigger",
ref: function (_ref) { ref: function (_ref) {
self.trigger = _ref; self.trigger = _ref;
}, },
@ -31,7 +33,7 @@ BI.ColorChooser = BI.inherit(BI.Widget, {
height: o.height height: o.height
}, o.el), }, o.el),
popup: { popup: {
el: { el: BI.extend({
type: "bi.color_chooser_popup", type: "bi.color_chooser_popup",
ref: function (_ref) { ref: function (_ref) {
self.colorPicker = _ref; self.colorPicker = _ref;
@ -48,9 +50,9 @@ BI.ColorChooser = BI.inherit(BI.Widget, {
self.combo.hideView(); self.combo.hideView();
} }
}] }]
}, }, o.popup),
stopPropagation: false, stopPropagation: false,
minWidth: 202 width: 202
}, },
value: o.value value: o.value
}); });

5
src/case/colorchooser/colorchooser.popup.js

@ -18,7 +18,7 @@ BI.ColorChooserPopup = BI.inherit(BI.Widget, {
_init: function () { _init: function () {
BI.ColorChooserPopup.superclass._init.apply(this, arguments); BI.ColorChooserPopup.superclass._init.apply(this, arguments);
var self = this, o = this.options; var self = this, o = this.options;
this.colorEditor = BI.createWidget({ this.colorEditor = BI.createWidget(o.editor, {
type: "bi.color_picker_editor", type: "bi.color_picker_editor",
value: o.value value: o.value
}); });
@ -77,7 +77,8 @@ BI.ColorChooserPopup = BI.inherit(BI.Widget, {
}); });
this.customColorChooser = BI.createWidget({ this.customColorChooser = BI.createWidget({
type: "bi.custom_color_chooser" type: "bi.custom_color_chooser",
editor: o.editor
}); });
var panel = BI.createWidget({ var panel = BI.createWidget({

49
src/case/colorchooser/colorchooser.popup.simple.js

@ -0,0 +1,49 @@
/**
* 选色控件
*
* Created by GUY on 2015/11/17.
* @class BI.SimpleColorChooserPopup
* @extends BI.Widget
*/
BI.SimpleColorChooserPopup = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.SimpleColorChooserPopup.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-color-chooser-popup"
});
},
_init: function () {
BI.SimpleColorChooserPopup.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.popup = BI.createWidget({
type: "bi.color_chooser_popup",
value: o.value,
element: this,
editor: {
type: "bi.simple_color_picker_editor"
}
});
this.popup.on(BI.ColorChooserPopup.EVENT_CHANGE, function () {
self.fireEvent(BI.SimpleColorChooserPopup.EVENT_CHANGE, arguments);
});
this.popup.on(BI.ColorChooserPopup.EVENT_VALUE_CHANGE, function () {
self.fireEvent(BI.SimpleColorChooserPopup.EVENT_VALUE_CHANGE, arguments);
});
},
setStoreColors: function (colors) {
this.popup.setStoreColors(colors);
},
setValue: function (color) {
this.popup.setValue(color);
},
getValue: function () {
return this.popup.getValue();
}
});
BI.SimpleColorChooserPopup.EVENT_VALUE_CHANGE = "ColorChooserPopup.EVENT_VALUE_CHANGE";
BI.SimpleColorChooserPopup.EVENT_CHANGE = "ColorChooserPopup.EVENT_CHANGE";
BI.shortcut("bi.simple_color_chooser_popup", BI.SimpleColorChooserPopup);

55
src/case/colorchooser/colorchooser.simple.js

@ -0,0 +1,55 @@
/**
* 简单选色控件没有自动和透明
*
* Created by GUY on 2015/11/17.
* @class BI.SimpleColorChooser
* @extends BI.Widget
*/
BI.SimpleColorChooser = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.SimpleColorChooser.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-simple-color-chooser",
value: "#ffffff"
});
},
_init: function () {
BI.SimpleColorChooser.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.combo = BI.createWidget({
type: "bi.color_chooser",
element: this,
value: o.value,
popup: {
type: "bi.simple_color_chooser_popup"
}
});
this.combo.on(BI.ColorChooser.EVENT_CHANGE, function () {
self.fireEvent(BI.SimpleColorChooser.EVENT_CHANGE, arguments);
});
},
isViewVisible: function () {
return this.combo.isViewVisible();
},
hideView: function () {
this.combo.hideView();
},
showView: function () {
this.combo.showView();
},
setValue: function (color) {
this.combo.setValue(color);
},
getValue: function () {
return this.combo.getValue();
}
});
BI.SimpleColorChooser.EVENT_CHANGE = "ColorChooser.EVENT_CHANGE";
BI.shortcut("bi.simple_color_chooser", BI.SimpleColorChooser);

2
src/case/colorchooser/colorchooser.trigger.js

@ -45,7 +45,7 @@ BI.ColorChooserTrigger = BI.inherit(BI.Trigger, {
bottom: 3 bottom: 3
}] }]
}); });
if (this.options.value) { if (BI.isNotNull(this.options.value)) {
this.setValue(this.options.value); this.setValue(this.options.value);
} }
}, },

97
src/case/colorchooser/colorchooser.trigger.long.js

@ -0,0 +1,97 @@
/**
* 选色控件
*
* Created by GUY on 2015/11/17.
* @class BI.LongColorChooserTrigger
* @extends BI.Trigger
*/
BI.LongColorChooserTrigger = BI.inherit(BI.Trigger, {
_defaultConfig: function () {
var conf = BI.LongColorChooserTrigger.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-color-chooser-trigger",
height: 30
});
},
_init: function () {
BI.LongColorChooserTrigger.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.colorContainer = BI.createWidget({
type: "bi.htape",
cls: "bi-card color-chooser-trigger-content",
items: [{
type: "bi.icon_change_button",
ref: function (_ref) {
self.changeIcon = _ref;
},
iconCls: "static-auto-color-icon",
width: 24,
iconWidth: 16,
iconHeight: 16
}, {
el: {
type: "bi.label",
ref: function (_ref) {
self.label = _ref;
},
textAlign: "left",
hgap: 5,
height: 24,
text: BI.i18nText("BI-Basic_Auto")
}
}]
});
var down = BI.createWidget({
type: "bi.icon_button",
disableSelected: true,
cls: "icon-combo-down-icon trigger-triangle-font",
width: 12,
height: 8
});
BI.createWidget({
type: "bi.absolute",
element: this,
items: [{
el: this.colorContainer,
left: 3,
right: 3,
top: 3,
bottom: 3
}, {
el: down,
right: 3,
bottom: 3
}]
});
if (this.options.value) {
this.setValue(this.options.value);
}
},
setValue: function (color) {
BI.LongColorChooserTrigger.superclass.setValue.apply(this, arguments);
if (color === "") {
this.colorContainer.element.css("background-color", "");
this.changeIcon.setVisible(true);
this.label.setVisible(true);
this.changeIcon.setIcon("static-auto-color-icon");
this.label.setText(BI.i18nText("BI-Basic_Auto"));
} else if (color === "transparent") {
this.colorContainer.element.css("background-color", "");
this.changeIcon.setVisible(true);
this.label.setVisible(true);
this.changeIcon.setIcon("static-trans-color-icon");
this.label.setText(BI.i18nText("BI-Transparent_Color"));
} else {
this.colorContainer.element.css({"background-color": color});
this.changeIcon.setVisible(false);
this.label.setVisible(false);
}
}
});
BI.LongColorChooserTrigger.EVENT_CHANGE = "ColorChooserTrigger.EVENT_CHANGE";
BI.shortcut("bi.long_color_chooser_trigger", BI.LongColorChooserTrigger);

108
src/case/colorchooser/colorpicker/editor.colorpicker.simple.js

@ -0,0 +1,108 @@
/**
* 简单选色控件
*
* Created by GUY on 2015/11/16.
* @class BI.SimpleColorPickerEditor
* @extends BI.Widget
*/
BI.SimpleColorPickerEditor = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.SimpleColorPickerEditor.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-color-picker-editor",
// width: 200,
height: 20
});
},
_init: function () {
BI.SimpleColorPickerEditor.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.colorShow = BI.createWidget({
type: "bi.layout",
cls: "color-picker-editor-display bi-card",
height: 20
});
var RGB = BI.createWidgets(BI.createItems([{text: "R"}, {text: "G"}, {text: "B"}], {
type: "bi.label",
cls: "color-picker-editor-label",
width: 10,
height: 20
}));
var checker = function (v) {
return BI.isNumeric(v) && (v | 0) >= 0 && (v | 0) <= 255;
};
var Ws = BI.createWidgets([{}, {}, {}], {
type: "bi.small_text_editor",
cls: "color-picker-editor-input",
validationChecker: checker,
errorText: BI.i18nText("BI-Color_Picker_Error_Text"),
allowBlank: true,
value: 255,
width: 32,
height: 20
});
BI.each(Ws, function (i, w) {
w.on(BI.TextEditor.EVENT_CHANGE, function () {
if (self.R.isValid() && self.G.isValid() && self.B.isValid()) {
self.colorShow.element.css("background-color", self.getValue());
self.fireEvent(BI.SimpleColorPickerEditor.EVENT_CHANGE);
}
});
});
this.R = Ws[0];
this.G = Ws[1];
this.B = Ws[2];
BI.createWidget({
type: "bi.htape",
element: this,
items: [{
el: this.colorShow,
lgap: 5,
rgap: 5
}, {
el: RGB[0],
lgap: 10,
width: 16
}, {
el: this.R,
width: 36
}, {
el: RGB[1],
lgap: 10,
width: 16
}, {
el: this.G,
width: 36
}, {
el: RGB[2],
lgap: 10,
width: 16
}, {
el: this.B,
width: 36,
rgap: 10
}]
});
},
setValue: function (color) {
this.colorShow.element.css({"background-color": color});
var json = BI.DOM.rgb2json(BI.DOM.hex2rgb(color));
this.R.setValue(BI.isNull(json.r) ? "" : json.r);
this.G.setValue(BI.isNull(json.g) ? "" : json.g);
this.B.setValue(BI.isNull(json.b) ? "" : json.b);
},
getValue: function () {
return BI.DOM.rgb2hex(BI.DOM.json2rgb({
r: this.R.getValue(),
g: this.G.getValue(),
b: this.B.getValue()
}));
}
});
BI.SimpleColorPickerEditor.EVENT_CHANGE = "SimpleColorPickerEditor.EVENT_CHANGE";
BI.shortcut("bi.simple_color_picker_editor", BI.SimpleColorPickerEditor);

24
src/css/resource/icon.css

@ -460,6 +460,30 @@
_filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/1x/icon/slider_normal_small.png'); _filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/1x/icon/slider_normal_small.png');
_background: none; _background: none;
} }
.static-auto-color-icon .x-icon {
display: block;
background: url('images/2x/icon/auto_normal.png') no-repeat center center;
_filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/2x/icon/auto_normal.png');
background-size: contain;
_background: none;
}
.static-auto-color-icon .x-icon.hack {
background: url('images/1x/icon/auto_normal.png') no-repeat center center;
_filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/1x/icon/auto_normal.png');
_background: none;
}
.static-trans-color-icon .x-icon {
display: block;
background: url('images/2x/icon/trans_normal.png') no-repeat center center;
_filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/2x/icon/trans_normal.png');
background-size: contain;
_background: none;
}
.static-trans-color-icon .x-icon.hack {
background: url('images/1x/icon/trans_normal.png') no-repeat center center;
_filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/1x/icon/trans_normal.png');
_background: none;
}
.auto-color-icon .x-icon { .auto-color-icon .x-icon {
display: block; display: block;
background: url('images/2x/icon/auto_normal.png') no-repeat center center; background: url('images/2x/icon/auto_normal.png') no-repeat center center;

2
src/less/resource/icon.less

@ -70,5 +70,7 @@
.icon_hover(slider-icon, @icon-slider-normal, @icon-slider-active); .icon_hover(slider-icon, @icon-slider-normal, @icon-slider-active);
//颜色自动、透明 //颜色自动、透明
.icon(static-auto-color-icon, @icon-auto-normal);
.icon(static-trans-color-icon, @icon-trans-normal);
.icon_select(auto-color-icon, @icon-auto-normal, @icon-auto-select, @icon-auto-disable); .icon_select(auto-color-icon, @icon-auto-normal, @icon-auto-select, @icon-auto-disable);
.icon_select(trans-color-icon, @icon-trans-normal, @icon-trans-select, @icon-trans-disable); .icon_select(trans-color-icon, @icon-trans-normal, @icon-trans-select, @icon-trans-disable);

24
ui/css/icon.css

@ -460,6 +460,30 @@
_filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='resources?path=/com/fr/web/ui/images/1x/icon/slider_normal_small.png'); _filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='resources?path=/com/fr/web/ui/images/1x/icon/slider_normal_small.png');
_background: none; _background: none;
} }
.static-auto-color-icon .x-icon {
display: block;
background: url('resources?path=/com/fr/web/ui/images/2x/icon/auto_normal.png') no-repeat center center;
_filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='resources?path=/com/fr/web/ui/images/2x/icon/auto_normal.png');
background-size: contain;
_background: none;
}
.static-auto-color-icon .x-icon.hack {
background: url('resources?path=/com/fr/web/ui/images/1x/icon/auto_normal.png') no-repeat center center;
_filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='resources?path=/com/fr/web/ui/images/1x/icon/auto_normal.png');
_background: none;
}
.static-trans-color-icon .x-icon {
display: block;
background: url('resources?path=/com/fr/web/ui/images/2x/icon/trans_normal.png') no-repeat center center;
_filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='resources?path=/com/fr/web/ui/images/2x/icon/trans_normal.png');
background-size: contain;
_background: none;
}
.static-trans-color-icon .x-icon.hack {
background: url('resources?path=/com/fr/web/ui/images/1x/icon/trans_normal.png') no-repeat center center;
_filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='resources?path=/com/fr/web/ui/images/1x/icon/trans_normal.png');
_background: none;
}
.auto-color-icon .x-icon { .auto-color-icon .x-icon {
display: block; display: block;
background: url('resources?path=/com/fr/web/ui/images/2x/icon/auto_normal.png') no-repeat center center; background: url('resources?path=/com/fr/web/ui/images/2x/icon/auto_normal.png') no-repeat center center;

Loading…
Cancel
Save