Browse Source

Merge pull request #394 in FUI/fineui from ~WINDY/fui:master to master

* commit 'f47ba3ef0a052e447103f630a8e3b366da6079d9':
  update
  BI-19488
  update
  BI-19065
es6
guy 7 years ago
parent
commit
6f341421a9
  1. 46
      dist/_fineui.min.js
  2. 4
      dist/base.js
  3. 49
      dist/bundle.js
  4. 46
      dist/bundle.min.js
  5. 45
      dist/case.js
  6. 105
      dist/demo.js
  7. 49
      dist/fineui.js
  8. 46
      dist/fineui.min.js
  9. 4
      src/base/single/single.js
  10. 45
      src/case/colorchooser/colorpicker/editor.colorpicker.js

46
dist/_fineui.min.js vendored

File diff suppressed because one or more lines are too long

4
dist/base.js vendored

@ -430,7 +430,7 @@ BI.Single = BI.inherit(BI.Widget, {
// opt: {container: '', belowMouse: false}
setTitle: function (title, opt) {
this.options.title = title;
if (BI.isKey(title)) {
if (BI.isKey(title) || BI.isFunction(title)) {
this.enableHover(opt);
} else {
this.disabledHover();
@ -439,7 +439,7 @@ BI.Single = BI.inherit(BI.Widget, {
setWarningTitle: function (title, opt) {
this.options.warningTitle = title;
if (BI.isKey(title)) {
if (BI.isKey(title) || BI.isFunction(title)) {
this.enableHover(opt);
} else {
this.disabledHover();

49
dist/bundle.js vendored

@ -36196,7 +36196,7 @@ BI.Single = BI.inherit(BI.Widget, {
// opt: {container: '', belowMouse: false}
setTitle: function (title, opt) {
this.options.title = title;
if (BI.isKey(title)) {
if (BI.isKey(title) || BI.isFunction(title)) {
this.enableHover(opt);
} else {
this.disabledHover();
@ -36205,7 +36205,7 @@ BI.Single = BI.inherit(BI.Widget, {
setWarningTitle: function (title, opt) {
this.options.warningTitle = title;
if (BI.isKey(title)) {
if (BI.isKey(title) || BI.isFunction(title)) {
this.enableHover(opt);
} else {
this.disabledHover();
@ -76904,6 +76904,7 @@ BI.ColorPickerEditor = BI.inherit(BI.Widget, {
_init: function () {
BI.ColorPickerEditor.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.storeValue = {};
this.colorShow = BI.createWidget({
type: "bi.layout",
cls: "color-picker-editor-display bi-card",
@ -76924,14 +76925,15 @@ BI.ColorPickerEditor = BI.inherit(BI.Widget, {
cls: "color-picker-editor-input",
validationChecker: checker,
errorText: BI.i18nText("BI-Color_Picker_Error_Text"),
allowBlank: true,
allowBlank: false,
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._checkEditors();
if (checker(self.storeValue.r) && checker(self.storeValue.g) && checker(self.storeValue.b)) {
self.colorShow.element.css("background-color", self.getValue());
self.fireEvent(BI.ColorPickerEditor.EVENT_CHANGE);
}
@ -77031,6 +77033,23 @@ BI.ColorPickerEditor = BI.inherit(BI.Widget, {
});
},
_checkEditors: function () {
if(BI.isEmptyString(this.R.getValue())) {
this.R.setValue(0);
}
if(BI.isEmptyString(this.G.getValue())) {
this.G.setValue(0);
}
if(BI.isEmptyString(this.B.getValue())) {
this.B.setValue(0);
}
this.storeValue = {
r: this.R.getValue() || 0,
g: this.G.getValue() || 0,
b: this.B.getValue() || 0
};
},
_showPreColor: function (color) {
if (color === "") {
this.colorShow.element.css("background-color", "").removeClass("trans-color-background").addClass("auto-color-background");
@ -77049,6 +77068,11 @@ BI.ColorPickerEditor = BI.inherit(BI.Widget, {
this.R.setValue("");
this.G.setValue("");
this.B.setValue("");
this.storeValue = {
r: "",
g: "",
b: ""
};
return;
}
if (!color) {
@ -77060,9 +77084,14 @@ BI.ColorPickerEditor = BI.inherit(BI.Widget, {
this.transparent.setSelected(false);
this._showPreColor(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);
this.storeValue = {
r: BI.isNull(json.r) ? "" : json.r,
g: BI.isNull(json.r) ? "" : json.g,
b: BI.isNull(json.r) ? "" : json.b
};
this.R.setValue(this.storeValue.r);
this.G.setValue(this.storeValue.g);
this.B.setValue(this.storeValue.b);
},
getValue: function () {
@ -77070,9 +77099,9 @@ BI.ColorPickerEditor = BI.inherit(BI.Widget, {
return "transparent";
}
return BI.DOM.rgb2hex(BI.DOM.json2rgb({
r: this.R.getValue(),
g: this.G.getValue(),
b: this.B.getValue()
r: this.storeValue.r,
g: this.storeValue.g,
b: this.storeValue.b
}));
}
});

46
dist/bundle.min.js vendored

File diff suppressed because one or more lines are too long

45
dist/case.js vendored

@ -4431,6 +4431,7 @@ BI.ColorPickerEditor = BI.inherit(BI.Widget, {
_init: function () {
BI.ColorPickerEditor.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.storeValue = {};
this.colorShow = BI.createWidget({
type: "bi.layout",
cls: "color-picker-editor-display bi-card",
@ -4451,14 +4452,15 @@ BI.ColorPickerEditor = BI.inherit(BI.Widget, {
cls: "color-picker-editor-input",
validationChecker: checker,
errorText: BI.i18nText("BI-Color_Picker_Error_Text"),
allowBlank: true,
allowBlank: false,
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._checkEditors();
if (checker(self.storeValue.r) && checker(self.storeValue.g) && checker(self.storeValue.b)) {
self.colorShow.element.css("background-color", self.getValue());
self.fireEvent(BI.ColorPickerEditor.EVENT_CHANGE);
}
@ -4558,6 +4560,23 @@ BI.ColorPickerEditor = BI.inherit(BI.Widget, {
});
},
_checkEditors: function () {
if(BI.isEmptyString(this.R.getValue())) {
this.R.setValue(0);
}
if(BI.isEmptyString(this.G.getValue())) {
this.G.setValue(0);
}
if(BI.isEmptyString(this.B.getValue())) {
this.B.setValue(0);
}
this.storeValue = {
r: this.R.getValue() || 0,
g: this.G.getValue() || 0,
b: this.B.getValue() || 0
};
},
_showPreColor: function (color) {
if (color === "") {
this.colorShow.element.css("background-color", "").removeClass("trans-color-background").addClass("auto-color-background");
@ -4576,6 +4595,11 @@ BI.ColorPickerEditor = BI.inherit(BI.Widget, {
this.R.setValue("");
this.G.setValue("");
this.B.setValue("");
this.storeValue = {
r: "",
g: "",
b: ""
};
return;
}
if (!color) {
@ -4587,9 +4611,14 @@ BI.ColorPickerEditor = BI.inherit(BI.Widget, {
this.transparent.setSelected(false);
this._showPreColor(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);
this.storeValue = {
r: BI.isNull(json.r) ? "" : json.r,
g: BI.isNull(json.r) ? "" : json.g,
b: BI.isNull(json.r) ? "" : json.b
};
this.R.setValue(this.storeValue.r);
this.G.setValue(this.storeValue.g);
this.B.setValue(this.storeValue.b);
},
getValue: function () {
@ -4597,9 +4626,9 @@ BI.ColorPickerEditor = BI.inherit(BI.Widget, {
return "transparent";
}
return BI.DOM.rgb2hex(BI.DOM.json2rgb({
r: this.R.getValue(),
g: this.G.getValue(),
b: this.B.getValue()
r: this.storeValue.r,
g: this.storeValue.g,
b: this.storeValue.b
}));
}
});

105
dist/demo.js vendored

@ -11014,6 +11014,111 @@ BI.shortcut("demo.tmp", Demo.Func);
});
BI.shortcut("demo.fix_global_watcher", Demo.Fix);
}());(function () {
var State = BI.inherit(Fix.Model, {
state: function () {
return {
name: "原始属性",
info: {
age: 12,
sex: "male",
birth: {
year: 2018,
month: 9,
day: 11
}
},
career: [{
a: 1,
b: 2,
c: 3
}]
};
},
computed: {
b: function () {
return this.model.name + "-计算属性";
},
birth: function () {
return this.model.info.birth;
}
}
});
Demo.Fix = BI.inherit(BI.Widget, {
_store: function () {
return new State();
},
watch: {
b: function () {
this.button.setText(this.model.b);
},
"birth.**": function () {
console.log(123);
}
},
render: function () {
var self = this;
return {
type: "bi.vertical",
items: [{
el: {
type: "bi.button",
ref: function () {
self.button = this;
},
handler: function () {
self.model.name = "这是改变后的属性";
},
text: this.model.b
}
}, {
el: {
type: "bi.button",
ref: function () {
self.button = this;
},
handler: function () {
self.model.birth.year = 2019;
},
text: "birthYearButton"
}
}, {
el: {
type: "bi.button",
ref: function () {
self.button = this;
},
handler: function () {
self.model.career.push({
year: 2017,
month: 3,
day: 24
});
},
text: "careerAddButton"
}
}, {
el: {
type: "bi.button",
ref: function () {
self.button = this;
},
handler: function () {
self.model.career[0].a = 24;
},
text: "careerChangeButton"
}
}]
};
},
mounted: function () {
}
});
BI.shortcut("demo.fix_immutable", Demo.Fix);
}());/**
* @Author: Young
* @CreationDate 2017-11-06 10:32

49
dist/fineui.js vendored

@ -36439,7 +36439,7 @@ BI.Single = BI.inherit(BI.Widget, {
// opt: {container: '', belowMouse: false}
setTitle: function (title, opt) {
this.options.title = title;
if (BI.isKey(title)) {
if (BI.isKey(title) || BI.isFunction(title)) {
this.enableHover(opt);
} else {
this.disabledHover();
@ -36448,7 +36448,7 @@ BI.Single = BI.inherit(BI.Widget, {
setWarningTitle: function (title, opt) {
this.options.warningTitle = title;
if (BI.isKey(title)) {
if (BI.isKey(title) || BI.isFunction(title)) {
this.enableHover(opt);
} else {
this.disabledHover();
@ -77147,6 +77147,7 @@ BI.ColorPickerEditor = BI.inherit(BI.Widget, {
_init: function () {
BI.ColorPickerEditor.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.storeValue = {};
this.colorShow = BI.createWidget({
type: "bi.layout",
cls: "color-picker-editor-display bi-card",
@ -77167,14 +77168,15 @@ BI.ColorPickerEditor = BI.inherit(BI.Widget, {
cls: "color-picker-editor-input",
validationChecker: checker,
errorText: BI.i18nText("BI-Color_Picker_Error_Text"),
allowBlank: true,
allowBlank: false,
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._checkEditors();
if (checker(self.storeValue.r) && checker(self.storeValue.g) && checker(self.storeValue.b)) {
self.colorShow.element.css("background-color", self.getValue());
self.fireEvent(BI.ColorPickerEditor.EVENT_CHANGE);
}
@ -77274,6 +77276,23 @@ BI.ColorPickerEditor = BI.inherit(BI.Widget, {
});
},
_checkEditors: function () {
if(BI.isEmptyString(this.R.getValue())) {
this.R.setValue(0);
}
if(BI.isEmptyString(this.G.getValue())) {
this.G.setValue(0);
}
if(BI.isEmptyString(this.B.getValue())) {
this.B.setValue(0);
}
this.storeValue = {
r: this.R.getValue() || 0,
g: this.G.getValue() || 0,
b: this.B.getValue() || 0
};
},
_showPreColor: function (color) {
if (color === "") {
this.colorShow.element.css("background-color", "").removeClass("trans-color-background").addClass("auto-color-background");
@ -77292,6 +77311,11 @@ BI.ColorPickerEditor = BI.inherit(BI.Widget, {
this.R.setValue("");
this.G.setValue("");
this.B.setValue("");
this.storeValue = {
r: "",
g: "",
b: ""
};
return;
}
if (!color) {
@ -77303,9 +77327,14 @@ BI.ColorPickerEditor = BI.inherit(BI.Widget, {
this.transparent.setSelected(false);
this._showPreColor(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);
this.storeValue = {
r: BI.isNull(json.r) ? "" : json.r,
g: BI.isNull(json.r) ? "" : json.g,
b: BI.isNull(json.r) ? "" : json.b
};
this.R.setValue(this.storeValue.r);
this.G.setValue(this.storeValue.g);
this.B.setValue(this.storeValue.b);
},
getValue: function () {
@ -77313,9 +77342,9 @@ BI.ColorPickerEditor = BI.inherit(BI.Widget, {
return "transparent";
}
return BI.DOM.rgb2hex(BI.DOM.json2rgb({
r: this.R.getValue(),
g: this.G.getValue(),
b: this.B.getValue()
r: this.storeValue.r,
g: this.storeValue.g,
b: this.storeValue.b
}));
}
});

46
dist/fineui.min.js vendored

File diff suppressed because one or more lines are too long

4
src/base/single/single.js

@ -106,7 +106,7 @@ BI.Single = BI.inherit(BI.Widget, {
// opt: {container: '', belowMouse: false}
setTitle: function (title, opt) {
this.options.title = title;
if (BI.isKey(title)) {
if (BI.isKey(title) || BI.isFunction(title)) {
this.enableHover(opt);
} else {
this.disabledHover();
@ -115,7 +115,7 @@ BI.Single = BI.inherit(BI.Widget, {
setWarningTitle: function (title, opt) {
this.options.warningTitle = title;
if (BI.isKey(title)) {
if (BI.isKey(title) || BI.isFunction(title)) {
this.enableHover(opt);
} else {
this.disabledHover();

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

@ -18,6 +18,7 @@ BI.ColorPickerEditor = BI.inherit(BI.Widget, {
_init: function () {
BI.ColorPickerEditor.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.storeValue = {};
this.colorShow = BI.createWidget({
type: "bi.layout",
cls: "color-picker-editor-display bi-card",
@ -38,14 +39,15 @@ BI.ColorPickerEditor = BI.inherit(BI.Widget, {
cls: "color-picker-editor-input",
validationChecker: checker,
errorText: BI.i18nText("BI-Color_Picker_Error_Text"),
allowBlank: true,
allowBlank: false,
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._checkEditors();
if (checker(self.storeValue.r) && checker(self.storeValue.g) && checker(self.storeValue.b)) {
self.colorShow.element.css("background-color", self.getValue());
self.fireEvent(BI.ColorPickerEditor.EVENT_CHANGE);
}
@ -145,6 +147,23 @@ BI.ColorPickerEditor = BI.inherit(BI.Widget, {
});
},
_checkEditors: function () {
if(BI.isEmptyString(this.R.getValue())) {
this.R.setValue(0);
}
if(BI.isEmptyString(this.G.getValue())) {
this.G.setValue(0);
}
if(BI.isEmptyString(this.B.getValue())) {
this.B.setValue(0);
}
this.storeValue = {
r: this.R.getValue() || 0,
g: this.G.getValue() || 0,
b: this.B.getValue() || 0
};
},
_showPreColor: function (color) {
if (color === "") {
this.colorShow.element.css("background-color", "").removeClass("trans-color-background").addClass("auto-color-background");
@ -163,6 +182,11 @@ BI.ColorPickerEditor = BI.inherit(BI.Widget, {
this.R.setValue("");
this.G.setValue("");
this.B.setValue("");
this.storeValue = {
r: "",
g: "",
b: ""
};
return;
}
if (!color) {
@ -174,9 +198,14 @@ BI.ColorPickerEditor = BI.inherit(BI.Widget, {
this.transparent.setSelected(false);
this._showPreColor(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);
this.storeValue = {
r: BI.isNull(json.r) ? "" : json.r,
g: BI.isNull(json.r) ? "" : json.g,
b: BI.isNull(json.r) ? "" : json.b
};
this.R.setValue(this.storeValue.r);
this.G.setValue(this.storeValue.g);
this.B.setValue(this.storeValue.b);
},
getValue: function () {
@ -184,9 +213,9 @@ BI.ColorPickerEditor = BI.inherit(BI.Widget, {
return "transparent";
}
return BI.DOM.rgb2hex(BI.DOM.json2rgb({
r: this.R.getValue(),
g: this.G.getValue(),
b: this.B.getValue()
r: this.storeValue.r,
g: this.storeValue.g,
b: this.storeValue.b
}));
}
});

Loading…
Cancel
Save