Browse Source

无JRIA fix: 再检查一遍输入框圆角问题

research/test
zsmj 2 years ago
parent
commit
41e1388738
  1. 8
      src/case/colorchooser/colorpicker/button/button.colorshow.js
  2. 68
      src/case/colorchooser/colorpicker/editor.colorpicker.hex.js
  3. 46
      src/case/colorchooser/colorpicker/editor.colorpicker.hex.simple.js
  4. 24
      src/case/colorchooser/colorpicker/editor.colorpicker.js
  5. 18
      src/case/colorchooser/colorpicker/editor.colorpicker.simple.js

8
src/case/colorchooser/colorpicker/button/button.colorshow.js

@ -6,14 +6,15 @@
BI.ColorChooserShowButton = BI.inherit(BI.BasicButton, { BI.ColorChooserShowButton = BI.inherit(BI.BasicButton, {
props: { props: {
baseCls: 'bi-color-chooser-show-button bi-border bi-list-item-effect', baseCls: 'bi-color-chooser-show-button bi-border bi-list-item-effect bi-border-radius',
}, },
render: function () { render: function () {
var self = this, o = this.options; var self = this, o = this.options;
return { return {
type: 'bi.htape', type: 'bi.htape',
items: [{ items: [
{
el: { el: {
type: "bi.icon_label", type: "bi.icon_label",
ref: function (_ref) { ref: function (_ref) {
@ -28,8 +29,9 @@ BI.ColorChooserShowButton = BI.inherit(BI.BasicButton, {
type: 'bi.label', type: 'bi.label',
textAlign: 'left', textAlign: 'left',
text: o.text, text: o.text,
}]
} }
]
};
}, },
doClick: function () { doClick: function () {

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

@ -21,7 +21,7 @@ BI.HexColorPickerEditor = BI.inherit(BI.Widget, {
render: function () { render: function () {
var self = this, o = this.options, c = this.constants; var self = this, o = this.options, c = this.constants;
this.storeValue = {}; this.storeValue = {};
var RGB = BI.createItems([{text: "R"}, {text: "G"}, {text: "B"}], { var RGB = BI.createItems([{ text: "R" }, { text: "G" }, { text: "B" }], {
type: "bi.label", type: "bi.label",
cls: "color-picker-editor-label", cls: "color-picker-editor-label",
height: 20 height: 20
@ -33,14 +33,15 @@ BI.HexColorPickerEditor = BI.inherit(BI.Widget, {
var Ws = BI.map(BI.range(0, 3), function () { var Ws = BI.map(BI.range(0, 3), function () {
return { return {
type: "bi.small_text_editor", type: "bi.small_text_editor",
cls: "color-picker-editor-input", cls: "color-picker-editor-input bi-border-radius",
validationChecker: checker, validationChecker: checker,
errorText: BI.i18nText("BI-Color_Picker_Error_Text"), errorText: BI.i18nText("BI-Color_Picker_Error_Text"),
allowBlank: true, allowBlank: true,
value: 255, value: 255,
width: c.RGB_WIDTH, width: c.RGB_WIDTH,
height: 24, height: 24,
listeners: [{ listeners: [
{
eventName: BI.TextEditor.EVENT_CHANGE, eventName: BI.TextEditor.EVENT_CHANGE,
action: function () { action: function () {
self._checkEditors(); self._checkEditors();
@ -49,33 +50,39 @@ BI.HexColorPickerEditor = BI.inherit(BI.Widget, {
self.fireEvent(BI.ColorPickerEditor.EVENT_CHANGE); self.fireEvent(BI.ColorPickerEditor.EVENT_CHANGE);
} }
} }
}] }
]
}; };
}); });
return { return {
type: "bi.absolute", type: "bi.absolute",
items: [{ items: [
{
el: { el: {
type: "bi.vertical", type: "bi.vertical",
tgap: 10, tgap: 10,
items: [{ items: [
{
type: 'bi.vertical_adapt', type: 'bi.vertical_adapt',
columnSize: ["fill", 'fill'], columnSize: ["fill", 'fill'],
height: 24, height: 24,
items: [{ items: [
{
type: "bi.color_picker_show_button", type: "bi.color_picker_show_button",
cls: "trans-color-icon", cls: "trans-color-icon",
height: 22, height: 22,
title: BI.i18nText("BI-Transparent_Color"), title: BI.i18nText("BI-Transparent_Color"),
text: BI.i18nText("BI-Transparent_Color"), text: BI.i18nText("BI-Transparent_Color"),
listeners: [{ listeners: [
{
eventName: BI.ColorChooserShowButton.EVENT_CHANGE, eventName: BI.ColorChooserShowButton.EVENT_CHANGE,
action: function () { action: function () {
self.setValue("transparent"); self.setValue("transparent");
self.fireEvent(BI.ColorPickerEditor.EVENT_CHANGE); self.fireEvent(BI.ColorPickerEditor.EVENT_CHANGE);
} }
}], }
],
ref: function (_ref) { ref: function (_ref) {
self.transparent = _ref; self.transparent = _ref;
} }
@ -86,26 +93,30 @@ BI.HexColorPickerEditor = BI.inherit(BI.Widget, {
height: 22, height: 22,
title: BI.i18nText("BI-Basic_Auto"), title: BI.i18nText("BI-Basic_Auto"),
text: BI.i18nText("BI-Basic_Auto"), text: BI.i18nText("BI-Basic_Auto"),
listeners: [{ listeners: [
{
eventName: BI.ColorChooserShowButton.EVENT_CHANGE, eventName: BI.ColorChooserShowButton.EVENT_CHANGE,
action: function () { action: function () {
self.setValue(""); self.setValue("");
self.fireEvent(BI.ColorPickerEditor.EVENT_CHANGE); self.fireEvent(BI.ColorPickerEditor.EVENT_CHANGE);
} }
}], }
],
ref: function (_ref) { ref: function (_ref) {
self.none = _ref; self.none = _ref;
} }
}, },
lgap: 10, lgap: 10,
}] }
]
}, { }, {
el: { el: {
type: "bi.vertical_adapt", type: "bi.vertical_adapt",
columnSize: [22, 10, 'fill', 12, c.RGB_WIDTH, 12, c.RGB_WIDTH, 12, c.RGB_WIDTH], columnSize: [22, 10, 'fill', 12, c.RGB_WIDTH, 12, c.RGB_WIDTH, 12, c.RGB_WIDTH],
rgap: 5, rgap: 5,
items: [{ items: [
{
el: { el: {
type: "bi.layout", type: "bi.layout",
cls: "color-picker-editor-display bi-card bi-border", cls: "color-picker-editor-display bi-card bi-border",
@ -125,13 +136,14 @@ BI.HexColorPickerEditor = BI.inherit(BI.Widget, {
ref: function (_ref) { ref: function (_ref) {
self.hexEditor = _ref; self.hexEditor = _ref;
}, },
cls: "color-picker-editor-input", cls: "color-picker-editor-input bi-border-radius",
validationChecker: this._hexChecker, validationChecker: this._hexChecker,
allowBlank: true, 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: 24, height: 24,
listeners: [{ listeners: [
{
eventName: "EVENT_CHANGE", eventName: "EVENT_CHANGE",
action: function () { action: function () {
self._checkHexEditor(); self._checkHexEditor();
@ -141,38 +153,42 @@ BI.HexColorPickerEditor = BI.inherit(BI.Widget, {
} }
} }
}] }
]
}, RGB[0], { }, RGB[0], {
el: BI.extend(Ws[0], { el: BI.extend(Ws[0], {
ref: function (_ref) { ref: function (_ref) {
self.R = _ref self.R = _ref;
} }
}), }),
width: c.RGB_WIDTH width: c.RGB_WIDTH
}, RGB[1], { }, RGB[1], {
el: BI.extend(Ws[1], { el: BI.extend(Ws[1], {
ref: function (_ref) { ref: function (_ref) {
self.G = _ref self.G = _ref;
} }
}), }),
width: c.RGB_WIDTH width: c.RGB_WIDTH
}, RGB[2], { }, RGB[2], {
el: BI.extend(Ws[2], { el: BI.extend(Ws[2], {
ref: function (_ref) { ref: function (_ref) {
self.B = _ref self.B = _ref;
} }
}), }),
rgap: -5, rgap: -5,
width: c.RGB_WIDTH width: c.RGB_WIDTH
}]
} }
}] ]
}
}
]
}, },
left: 0, left: 0,
right: 0, right: 0,
top: 0, top: 0,
bottom: 0 bottom: 0
}] }
]
}; };
}, },
@ -181,13 +197,13 @@ BI.HexColorPickerEditor = BI.inherit(BI.Widget, {
}, },
_checkEditors: function () { _checkEditors: function () {
if(BI.isEmptyString(this.R.getValue())) { if (BI.isEmptyString(this.R.getValue())) {
this.R.setValue(0); this.R.setValue(0);
} }
if(BI.isEmptyString(this.G.getValue())) { if (BI.isEmptyString(this.G.getValue())) {
this.G.setValue(0); this.G.setValue(0);
} }
if(BI.isEmptyString(this.B.getValue())) { if (BI.isEmptyString(this.B.getValue())) {
this.B.setValue(0); this.B.setValue(0);
} }
this.storeValue = { this.storeValue = {
@ -223,7 +239,7 @@ BI.HexColorPickerEditor = BI.inherit(BI.Widget, {
} else if (color === "transparent") { } else if (color === "transparent") {
this.colorShow.element.css("background-color", "").removeClass("auto-color-square-normal-background").addClass("trans-color-background"); this.colorShow.element.css("background-color", "").removeClass("auto-color-square-normal-background").addClass("trans-color-background");
} else { } else {
this.colorShow.element.css({"background-color": color}).removeClass("auto-color-square-normal-background").removeClass("trans-color-background"); this.colorShow.element.css({ "background-color": color }).removeClass("auto-color-square-normal-background").removeClass("trans-color-background");
} }
}, },

46
src/case/colorchooser/colorpicker/editor.colorpicker.hex.simple.js

@ -19,7 +19,7 @@ BI.SimpleHexColorPickerEditor = BI.inherit(BI.Widget, {
render: function () { render: function () {
var self = this, o = this.options, c = this.constants; var self = this, o = this.options, c = this.constants;
var RGB = BI.createItems([{text: "R"}, {text: "G"}, {text: "B"}], { var RGB = BI.createItems([{ text: "R" }, { text: "G" }, { text: "B" }], {
type: "bi.label", type: "bi.label",
cls: "color-picker-editor-label", cls: "color-picker-editor-label",
height: 20 height: 20
@ -31,14 +31,15 @@ BI.SimpleHexColorPickerEditor = BI.inherit(BI.Widget, {
var Ws = BI.map(BI.range(0, 3), function () { var Ws = BI.map(BI.range(0, 3), function () {
return { return {
type: "bi.small_text_editor", type: "bi.small_text_editor",
cls: "color-picker-editor-input", cls: "color-picker-editor-input bi-border-radius",
validationChecker: checker, validationChecker: checker,
errorText: BI.i18nText("BI-Color_Picker_Error_Text"), errorText: BI.i18nText("BI-Color_Picker_Error_Text"),
allowBlank: true, allowBlank: true,
value: 255, value: 255,
width: c.RGB_WIDTH, width: c.RGB_WIDTH,
height: 24, height: 24,
listeners: [{ listeners: [
{
eventName: BI.TextEditor.EVENT_CHANGE, eventName: BI.TextEditor.EVENT_CHANGE,
action: function () { action: function () {
self._checkEditors(); self._checkEditors();
@ -47,19 +48,22 @@ BI.SimpleHexColorPickerEditor = BI.inherit(BI.Widget, {
self.fireEvent(BI.SimpleColorPickerEditor.EVENT_CHANGE); self.fireEvent(BI.SimpleColorPickerEditor.EVENT_CHANGE);
} }
} }
}]
} }
]
};
}); });
return { return {
type: "bi.vertical", type: "bi.vertical",
tgap: 10, tgap: 10,
items: [{ items: [
{
el: { el: {
type: "bi.vertical_adapt", type: "bi.vertical_adapt",
rgap: 5, rgap: 5,
columnSize: [22, 10, 'fill', 12, c.RGB_WIDTH, 12, c.RGB_WIDTH, 12, c.RGB_WIDTH], columnSize: [22, 10, 'fill', 12, c.RGB_WIDTH, 12, c.RGB_WIDTH, 12, c.RGB_WIDTH],
items: [{ items: [
{
el: { el: {
type: "bi.layout", type: "bi.layout",
cls: "color-picker-editor-display bi-card bi-border", cls: "color-picker-editor-display bi-card bi-border",
@ -79,13 +83,14 @@ BI.SimpleHexColorPickerEditor = BI.inherit(BI.Widget, {
ref: function (_ref) { ref: function (_ref) {
self.hexEditor = _ref; self.hexEditor = _ref;
}, },
cls: "color-picker-editor-input", cls: "color-picker-editor-input bi-border-radius",
validationChecker: this._hexChecker, validationChecker: this._hexChecker,
allowBlank: true, 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: 24, height: 24,
listeners: [{ listeners: [
{
eventName: "EVENT_CHANGE", eventName: "EVENT_CHANGE",
action: function () { action: function () {
self._checkHexEditor(); self._checkHexEditor();
@ -94,34 +99,37 @@ BI.SimpleHexColorPickerEditor = BI.inherit(BI.Widget, {
self.fireEvent(BI.ColorPickerEditor.EVENT_CHANGE); self.fireEvent(BI.ColorPickerEditor.EVENT_CHANGE);
} }
} }
}] }
]
}, RGB[0], { }, RGB[0], {
el: BI.extend(Ws[0], { el: BI.extend(Ws[0], {
ref: function (_ref) { ref: function (_ref) {
self.R = _ref self.R = _ref;
} }
}), }),
width: c.RGB_WIDTH width: c.RGB_WIDTH
}, RGB[1], { }, RGB[1], {
el: BI.extend(Ws[1], { el: BI.extend(Ws[1], {
ref: function (_ref) { ref: function (_ref) {
self.G = _ref self.G = _ref;
} }
}), }),
width: c.RGB_WIDTH width: c.RGB_WIDTH
}, RGB[2], { }, RGB[2], {
el: BI.extend(Ws[2], { el: BI.extend(Ws[2], {
ref: function (_ref) { ref: function (_ref) {
self.B = _ref self.B = _ref;
} }
}), }),
rgap: -5, rgap: -5,
width: c.RGB_WIDTH width: c.RGB_WIDTH
}]
} }
}] ]
} }
}
]
};
}, },
_hexChecker: function (v) { _hexChecker: function (v) {
@ -129,13 +137,13 @@ BI.SimpleHexColorPickerEditor = BI.inherit(BI.Widget, {
}, },
_checkEditors: function () { _checkEditors: function () {
if(BI.isEmptyString(this.R.getValue())) { if (BI.isEmptyString(this.R.getValue())) {
this.R.setValue(0); this.R.setValue(0);
} }
if(BI.isEmptyString(this.G.getValue())) { if (BI.isEmptyString(this.G.getValue())) {
this.G.setValue(0); this.G.setValue(0);
} }
if(BI.isEmptyString(this.B.getValue())) { if (BI.isEmptyString(this.B.getValue())) {
this.B.setValue(0); this.B.setValue(0);
} }
this.hexEditor.setValue(this.getValue().slice(this.constants.HEX_PREFIX_POSITION)); this.hexEditor.setValue(this.getValue().slice(this.constants.HEX_PREFIX_POSITION));
@ -157,7 +165,7 @@ BI.SimpleHexColorPickerEditor = BI.inherit(BI.Widget, {
}, },
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));
this.R.setValue(BI.isNull(json.r) ? "" : json.r); this.R.setValue(BI.isNull(json.r) ? "" : json.r);
this.G.setValue(BI.isNull(json.g) ? "" : json.g); this.G.setValue(BI.isNull(json.g) ? "" : json.g);

24
src/case/colorchooser/colorpicker/editor.colorpicker.js

@ -29,7 +29,7 @@ BI.ColorPickerEditor = BI.inherit(BI.Widget, {
height: 16, height: 16,
width: 16 width: 16
}); });
var RGB = BI.createWidgets(BI.createItems([{text: "R"}, {text: "G"}, {text: "B"}], { var RGB = BI.createWidgets(BI.createItems([{ text: "R" }, { text: "G" }, { text: "B" }], {
type: "bi.label", type: "bi.label",
cls: "color-picker-editor-label", cls: "color-picker-editor-label",
width: 20, width: 20,
@ -41,7 +41,7 @@ BI.ColorPickerEditor = BI.inherit(BI.Widget, {
}; };
var Ws = BI.createWidgets([{}, {}, {}], { var Ws = BI.createWidgets([{}, {}, {}], {
type: "bi.small_text_editor", type: "bi.small_text_editor",
cls: "color-picker-editor-input", cls: "color-picker-editor-input bi-border-radius",
validationChecker: checker, validationChecker: checker,
errorText: BI.i18nText("BI-Color_Picker_Error_Text"), errorText: BI.i18nText("BI-Color_Picker_Error_Text"),
allowBlank: true, allowBlank: true,
@ -95,10 +95,12 @@ BI.ColorPickerEditor = BI.inherit(BI.Widget, {
BI.createWidget({ BI.createWidget({
type: "bi.absolute", type: "bi.absolute",
element: this, element: this,
items: [{ items: [
{
el: { el: {
type: "bi.vertical_adapt", type: "bi.vertical_adapt",
items: [{ items: [
{
el: this.colorShow, el: this.colorShow,
width: 16 width: 16
}, { }, {
@ -127,24 +129,26 @@ BI.ColorPickerEditor = BI.inherit(BI.Widget, {
el: this.none, el: this.none,
width: 16, width: 16,
lgap: 5 lgap: 5
}] }
]
}, },
left: 10, left: 10,
right: 10, right: 10,
top: 0, top: 0,
bottom: 0 bottom: 0
}] }
]
}); });
}, },
_checkEditors: function () { _checkEditors: function () {
if(BI.isEmptyString(this.R.getValue())) { if (BI.isEmptyString(this.R.getValue())) {
this.R.setValue(0); this.R.setValue(0);
} }
if(BI.isEmptyString(this.G.getValue())) { if (BI.isEmptyString(this.G.getValue())) {
this.G.setValue(0); this.G.setValue(0);
} }
if(BI.isEmptyString(this.B.getValue())) { if (BI.isEmptyString(this.B.getValue())) {
this.B.setValue(0); this.B.setValue(0);
} }
this.storeValue = { this.storeValue = {
@ -164,7 +168,7 @@ BI.ColorPickerEditor = BI.inherit(BI.Widget, {
} else if (color === "transparent") { } else if (color === "transparent") {
this.colorShow.element.css("background-color", "").removeClass("auto-color-normal-background").addClass("trans-color-background"); this.colorShow.element.css("background-color", "").removeClass("auto-color-normal-background").addClass("trans-color-background");
} else { } else {
this.colorShow.element.css({"background-color": color}).removeClass("auto-color-normal-background").removeClass("trans-color-background"); this.colorShow.element.css({ "background-color": color }).removeClass("auto-color-normal-background").removeClass("trans-color-background");
} }
}, },

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

@ -28,7 +28,7 @@ BI.SimpleColorPickerEditor = BI.inherit(BI.Widget, {
height: 16, height: 16,
width: 16 width: 16
}); });
var RGB = BI.createWidgets(BI.createItems([{text: "R"}, {text: "G"}, {text: "B"}], { var RGB = BI.createWidgets(BI.createItems([{ text: "R" }, { text: "G" }, { text: "B" }], {
type: "bi.label", type: "bi.label",
cls: "color-picker-editor-label", cls: "color-picker-editor-label",
width: 20, width: 20,
@ -40,7 +40,7 @@ BI.SimpleColorPickerEditor = BI.inherit(BI.Widget, {
}; };
var Ws = BI.createWidgets([{}, {}, {}], { var Ws = BI.createWidgets([{}, {}, {}], {
type: "bi.small_text_editor", type: "bi.small_text_editor",
cls: "color-picker-editor-input", cls: "color-picker-editor-input bi-border-radius",
validationChecker: checker, validationChecker: checker,
errorText: BI.i18nText("BI-Color_Picker_Error_Text"), errorText: BI.i18nText("BI-Color_Picker_Error_Text"),
allowBlank: true, allowBlank: true,
@ -64,7 +64,8 @@ BI.SimpleColorPickerEditor = BI.inherit(BI.Widget, {
BI.createWidget({ BI.createWidget({
type: "bi.vertical_adapt", type: "bi.vertical_adapt",
element: this, element: this,
items: [{ items: [
{
el: this.colorShow, el: this.colorShow,
width: 16, width: 16,
lgap: 20, lgap: 20,
@ -87,24 +88,25 @@ BI.SimpleColorPickerEditor = BI.inherit(BI.Widget, {
}, { }, {
el: this.B, el: this.B,
width: c.RGB_WIDTH width: c.RGB_WIDTH
}] }
]
}); });
}, },
_checkEditors: function () { _checkEditors: function () {
if(BI.isEmptyString(this.R.getValue())) { if (BI.isEmptyString(this.R.getValue())) {
this.R.setValue(0); this.R.setValue(0);
} }
if(BI.isEmptyString(this.G.getValue())) { if (BI.isEmptyString(this.G.getValue())) {
this.G.setValue(0); this.G.setValue(0);
} }
if(BI.isEmptyString(this.B.getValue())) { if (BI.isEmptyString(this.B.getValue())) {
this.B.setValue(0); this.B.setValue(0);
} }
}, },
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));
this.R.setValue(BI.isNull(json.r) ? "" : json.r); this.R.setValue(BI.isNull(json.r) ? "" : json.r);
this.G.setValue(BI.isNull(json.g) ? "" : json.g); this.G.setValue(BI.isNull(json.g) ? "" : json.g);

Loading…
Cancel
Save