|
|
@ -82,16 +82,19 @@ BI.SimpleHexColorPickerEditor = BI.inherit(BI.Widget, { |
|
|
|
}, |
|
|
|
}, |
|
|
|
cls: "color-picker-editor-input", |
|
|
|
cls: "color-picker-editor-input", |
|
|
|
validationChecker: this._hexChecker, |
|
|
|
validationChecker: this._hexChecker, |
|
|
|
|
|
|
|
allowBlank: true, |
|
|
|
errorText: BI.i18nText("BI-Color_Picker_Error_Text_Hex"), |
|
|
|
errorText: BI.i18nText("BI-Color_Picker_Error_Text_Hex"), |
|
|
|
width: c.HEX_WIDTH, |
|
|
|
width: c.HEX_WIDTH, |
|
|
|
height: 20, |
|
|
|
height: 20, |
|
|
|
listeners: [{ |
|
|
|
listeners: [{ |
|
|
|
eventName: "EVENT_CHANGE", |
|
|
|
eventName: "EVENT_CHANGE", |
|
|
|
action: function () { |
|
|
|
action: function () { |
|
|
|
self.setValue("#" + this.getValue()); |
|
|
|
self._checkHexEditor(); |
|
|
|
|
|
|
|
if (checker(self.storeValue.r) && checker(self.storeValue.g) && checker(self.storeValue.b)) { |
|
|
|
self.colorShow.element.css("background-color", self.getValue()); |
|
|
|
self.colorShow.element.css("background-color", self.getValue()); |
|
|
|
self.fireEvent(BI.ColorPickerEditor.EVENT_CHANGE); |
|
|
|
self.fireEvent(BI.ColorPickerEditor.EVENT_CHANGE); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
}] |
|
|
|
}] |
|
|
|
}, { |
|
|
|
}, { |
|
|
|
el: BI.extend(Ws[0], { |
|
|
|
el: BI.extend(Ws[0], { |
|
|
@ -157,6 +160,21 @@ BI.SimpleHexColorPickerEditor = BI.inherit(BI.Widget, { |
|
|
|
this.hexEditor.setValue(this.getValue().slice(this.constants.HEX_PREFIX_POSITION)); |
|
|
|
this.hexEditor.setValue(this.getValue().slice(this.constants.HEX_PREFIX_POSITION)); |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_checkHexEditor: function () { |
|
|
|
|
|
|
|
if (BI.isEmptyString(this.hexEditor.getValue())) { |
|
|
|
|
|
|
|
this.hexEditor.setValue("000000"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
var json = BI.DOM.rgb2json(BI.DOM.hex2rgb("#" + this.hexEditor.getValue())); |
|
|
|
|
|
|
|
this.storeValue = { |
|
|
|
|
|
|
|
r: json.r || 0, |
|
|
|
|
|
|
|
g: json.g || 0, |
|
|
|
|
|
|
|
b: json.b || 0, |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
this.R.setValue(this.storeValue.r); |
|
|
|
|
|
|
|
this.G.setValue(this.storeValue.g); |
|
|
|
|
|
|
|
this.B.setValue(this.storeValue.b); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
setValue: function (color) { |
|
|
|
setValue: function (color) { |
|
|
|
this.colorShow.element.css({"background-color": color}); |
|
|
|
this.colorShow.element.css({"background-color": color}); |
|
|
|
var json = BI.DOM.rgb2json(BI.DOM.hex2rgb(color)); |
|
|
|
var json = BI.DOM.rgb2json(BI.DOM.hex2rgb(color)); |
|
|
|