iapyang 7 years ago
parent
commit
3cbfbe4481
  1. 68
      dist/_fineui.min.js
  2. 34
      dist/base.js
  3. 191
      dist/bundle.js
  4. 68
      dist/bundle.min.js
  5. 150
      dist/case.js
  6. 105
      dist/demo.js
  7. 191
      dist/fineui.js
  8. 68
      dist/fineui.min.js
  9. 7
      dist/widget.js
  10. 4
      src/base/single/editor/editor.js
  11. 26
      src/base/single/input/input.js
  12. 4
      src/base/single/single.js
  13. 45
      src/case/colorchooser/colorpicker/editor.colorpicker.js
  14. 61
      src/case/richeditor/bar/action.richeditor.param.js
  15. 39
      src/case/richeditor/niceditor/niceditor.js
  16. 5
      src/case/table/table.dynamicsummarylayertree.js
  17. 3
      src/component/valuechooser/pane.valuechooser.js
  18. 3
      src/widget/downlist/popup.downlist.js
  19. 1
      src/widget/dynamicdate/dynamicdate.caculate.js

68
dist/_fineui.min.js vendored

File diff suppressed because one or more lines are too long

34
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();
@ -18602,9 +18602,9 @@ BI.Editor = BI.inherit(BI.Single, {
getValue: function () {
if (!this.isValid()) {
return BI.trim(this.editor.getLastValidValue());
return this.editor.getLastValidValue();
}
return BI.trim(this.editor.getValue());
return this.editor.getValue();
},
isEditing: function () {
@ -19727,7 +19727,7 @@ BI.Input = BI.inherit(BI.Single, {
}
function blur () {
if (!self.isValid() && self.options.quitChecker.apply(self, [BI.trim(self.getValue())]) !== false) {
if (!self.isValid() && self.options.quitChecker.apply(self, [self.getValue()]) !== false) {
self.element.val(self._lastValidValue ? self._lastValidValue : "");
self._checkValidationOnValueChange();
self._defaultState();
@ -19757,11 +19757,11 @@ BI.Input = BI.inherit(BI.Single, {
},
onKeyDown: function (keyCode, ctrlKey) {
if (!this.isValid() || BI.trim(this._lastValidValue) !== BI.trim(this.getValue())) {
if (!this.isValid() || this._lastValidValue !== this.getValue()) {
this._checkValidationOnValueChange();
}
if (this.isValid() && BI.trim(this.getValue()) !== "") {
if (BI.trim(this.getValue()) !== this._lastValue && (!this._start || this._lastValue == null || this._lastValue === "")
if (this.isValid() && this.getValue() !== "") {
if (this.getValue() !== this._lastValue && (!this._start || this._lastValue == null || this._lastValue === "")
|| (this._pause === true && !/(\s|\u00A0)$/.test(this.getValue()))) {
this._start = true;
this._pause = false;
@ -19773,7 +19773,7 @@ BI.Input = BI.inherit(BI.Single, {
this._valueChange();
} else {
if (keyCode == BI.KeyCode.ENTER) {
if (this.isValid() || this.options.quitChecker.apply(this, [BI.trim(this.getValue())]) !== false) {
if (this.isValid() || this.options.quitChecker.apply(this, [this.getValue()]) !== false) {
this.blur();
this.fireEvent(BI.Input.EVENT_ENTER);
} else {
@ -19798,7 +19798,7 @@ BI.Input = BI.inherit(BI.Single, {
this.fireEvent(BI.Input.EVENT_PAUSE);
this._defaultState();
} else if ((keyCode === BI.KeyCode.BACKSPACE || keyCode === BI.KeyCode.DELETE) &&
BI.trim(this.getValue()) === "" && (this._lastValue !== null && BI.trim(this._lastValue) !== "")) {
this.getValue() === "" && (this._lastValue !== null && this._lastValue !== "")) {
this.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.STOPEDIT, this.getValue(), this);
this.fireEvent(BI.Input.EVENT_STOP);
this._valueChange();
@ -19818,10 +19818,10 @@ BI.Input = BI.inherit(BI.Single, {
},
_valueChange: function () {
if (this.isValid() && BI.trim(this.getValue()) !== this._lastSubmitValue) {
if (this.isValid() && this.getValue() !== this._lastSubmitValue) {
this.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.CHANGE, this.getValue(), this);
this.fireEvent(BI.Input.EVENT_CHANGE);
this._lastSubmitValue = BI.trim(this.getValue());
this._lastSubmitValue = this.getValue();
}
if (this.getValue() == "") {
this.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.EMPTY, this.getValue(), this);
@ -19834,10 +19834,10 @@ BI.Input = BI.inherit(BI.Single, {
var o = this.options;
var v = this.getValue();
this.setValid(
(o.allowBlank === true && BI.trim(v) == "") ||
(BI.isNotEmptyString(BI.trim(v))
(o.allowBlank === true && v == "") ||
(BI.isNotEmptyString(v)
&& (v === this._lastValidValue ||
o.validationChecker.apply(this, [BI.trim(v)]) !== false))
o.validationChecker.apply(this, [v]) !== false))
);
},
@ -19897,13 +19897,13 @@ BI.Input = BI.inherit(BI.Single, {
BI.Input.superclass._setValid.apply(this, arguments);
if (this.isValid()) {
this.element.removeClass("bi-input-error");
this.fireEvent(BI.Input.EVENT_VALID, BI.trim(this.getValue()), this);
this.fireEvent(BI.Input.EVENT_VALID, this.getValue(), this);
} else {
if (this._lastValidValue === this.getValue()) {
this._lastValidValue = null;
}
this.element.addClass("bi-input-error");
this.fireEvent(BI.Input.EVENT_ERROR, BI.trim(this.getValue()), this);
this.fireEvent(BI.Input.EVENT_ERROR, this.getValue(), this);
}
},

191
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();
@ -54368,9 +54368,9 @@ BI.Editor = BI.inherit(BI.Single, {
getValue: function () {
if (!this.isValid()) {
return BI.trim(this.editor.getLastValidValue());
return this.editor.getLastValidValue();
}
return BI.trim(this.editor.getValue());
return this.editor.getValue();
},
isEditing: function () {
@ -55493,7 +55493,7 @@ BI.Input = BI.inherit(BI.Single, {
}
function blur () {
if (!self.isValid() && self.options.quitChecker.apply(self, [BI.trim(self.getValue())]) !== false) {
if (!self.isValid() && self.options.quitChecker.apply(self, [self.getValue()]) !== false) {
self.element.val(self._lastValidValue ? self._lastValidValue : "");
self._checkValidationOnValueChange();
self._defaultState();
@ -55523,11 +55523,11 @@ BI.Input = BI.inherit(BI.Single, {
},
onKeyDown: function (keyCode, ctrlKey) {
if (!this.isValid() || BI.trim(this._lastValidValue) !== BI.trim(this.getValue())) {
if (!this.isValid() || this._lastValidValue !== this.getValue()) {
this._checkValidationOnValueChange();
}
if (this.isValid() && BI.trim(this.getValue()) !== "") {
if (BI.trim(this.getValue()) !== this._lastValue && (!this._start || this._lastValue == null || this._lastValue === "")
if (this.isValid() && this.getValue() !== "") {
if (this.getValue() !== this._lastValue && (!this._start || this._lastValue == null || this._lastValue === "")
|| (this._pause === true && !/(\s|\u00A0)$/.test(this.getValue()))) {
this._start = true;
this._pause = false;
@ -55539,7 +55539,7 @@ BI.Input = BI.inherit(BI.Single, {
this._valueChange();
} else {
if (keyCode == BI.KeyCode.ENTER) {
if (this.isValid() || this.options.quitChecker.apply(this, [BI.trim(this.getValue())]) !== false) {
if (this.isValid() || this.options.quitChecker.apply(this, [this.getValue()]) !== false) {
this.blur();
this.fireEvent(BI.Input.EVENT_ENTER);
} else {
@ -55564,7 +55564,7 @@ BI.Input = BI.inherit(BI.Single, {
this.fireEvent(BI.Input.EVENT_PAUSE);
this._defaultState();
} else if ((keyCode === BI.KeyCode.BACKSPACE || keyCode === BI.KeyCode.DELETE) &&
BI.trim(this.getValue()) === "" && (this._lastValue !== null && BI.trim(this._lastValue) !== "")) {
this.getValue() === "" && (this._lastValue !== null && this._lastValue !== "")) {
this.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.STOPEDIT, this.getValue(), this);
this.fireEvent(BI.Input.EVENT_STOP);
this._valueChange();
@ -55584,10 +55584,10 @@ BI.Input = BI.inherit(BI.Single, {
},
_valueChange: function () {
if (this.isValid() && BI.trim(this.getValue()) !== this._lastSubmitValue) {
if (this.isValid() && this.getValue() !== this._lastSubmitValue) {
this.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.CHANGE, this.getValue(), this);
this.fireEvent(BI.Input.EVENT_CHANGE);
this._lastSubmitValue = BI.trim(this.getValue());
this._lastSubmitValue = this.getValue();
}
if (this.getValue() == "") {
this.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.EMPTY, this.getValue(), this);
@ -55600,10 +55600,10 @@ BI.Input = BI.inherit(BI.Single, {
var o = this.options;
var v = this.getValue();
this.setValid(
(o.allowBlank === true && BI.trim(v) == "") ||
(BI.isNotEmptyString(BI.trim(v))
(o.allowBlank === true && v == "") ||
(BI.isNotEmptyString(v)
&& (v === this._lastValidValue ||
o.validationChecker.apply(this, [BI.trim(v)]) !== false))
o.validationChecker.apply(this, [v]) !== false))
);
},
@ -55663,13 +55663,13 @@ BI.Input = BI.inherit(BI.Single, {
BI.Input.superclass._setValid.apply(this, arguments);
if (this.isValid()) {
this.element.removeClass("bi-input-error");
this.fireEvent(BI.Input.EVENT_VALID, BI.trim(this.getValue()), this);
this.fireEvent(BI.Input.EVENT_VALID, this.getValue(), this);
} else {
if (this._lastValidValue === this.getValue()) {
this._lastValidValue = null;
}
this.element.addClass("bi-input-error");
this.fireEvent(BI.Input.EVENT_ERROR, BI.trim(this.getValue()), this);
this.fireEvent(BI.Input.EVENT_ERROR, this.getValue(), this);
}
},
@ -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
}));
}
});
@ -82871,29 +82900,29 @@ BI.RichEditorParamAction = BI.inherit(BI.RichEditorAction, {
BI.RichEditorParamAction.superclass._init.apply(this, arguments);
},
_createBlankNode: function () {
return $("<span>").html("&nbsp;");
},
_addBlank: function ($param) {
var o = this.options;
var instance = o.editor.selectedInstance;
var next = $param.next();
if (next.length === 0) {
var nextNode = this._createBlankNode();
$param.after(nextNode);
instance.setFocus(nextNode[0]);
} else {
instance.setFocus(next[0]);
}
},
// _createBlankNode: function () {
// return $("<span>").html("&nbsp;");
// },
_get$Sel: function () {
var o = this.options;
var instance = o.editor.selectedInstance;
var sel = $(instance.selElm());
return sel;
},
// _addBlank: function ($param) {
// var o = this.options;
// var instance = o.editor.selectedInstance;
// var next = $param.next();
// if (next.length === 0) {
// var nextNode = this._createBlankNode();
// $param.after(nextNode);
// instance.setFocus(nextNode[0]);
// } else {
// instance.setFocus(next[0]);
// }
// },
//
// _get$Sel: function () {
// var o = this.options;
// var instance = o.editor.selectedInstance;
// var sel = $(instance.selElm());
// return sel;
// },
addParam: function (param) {
var o = this.options;
@ -82904,14 +82933,15 @@ BI.RichEditorParamAction = BI.inherit(BI.RichEditorAction, {
image.alt = param;
image.style = attrs.style;
$(image).addClass("rich-editor-param");
var sel = this._get$Sel();
var wrapper = o.editor.instance.getElm().element;
if (wrapper.find(sel).length <= 0) {
wrapper.append(image);
} else {
sel.after(image);
}
this._addBlank($(image));
this.options.editor.insertHTML($("<div>").append(image).html());
// var sel = this._get$Sel();
// var wrapper = o.editor.instance.getElm().element;
// if (wrapper.find(sel).length <= 0) {
// wrapper.append(image);
// } else {
// sel.after(image);
// }
// this._addBlank($(image));
}
});
@ -83124,12 +83154,24 @@ BI.shortcut("bi.rich_editor_text_toolbar", BI.RichEditorTextToolbar);/**
} else {
console.error("不支持此浏览器");
}
if(o.readOnly) {
if (o.readOnly) {
newInstance.disable();
}
return newInstance;
},
insertElem: function ($elem) {
if (this.selectedInstance) {
this.selectedInstance.insertElem($elem);
}
},
insertHTML: function (html) {
if (this.selectedInstance) {
this.selectedInstance.insertHTML(html);
}
},
nicCommand: function (cmd, args) {
if (this.selectedInstance) {
this.selectedInstance.nicCommand(cmd, args);
@ -83372,6 +83414,31 @@ BI.shortcut("bi.rich_editor_text_toolbar", BI.RichEditorTextToolbar);/**
this.elm.element.html(this.content);
},
insertElem: function ($elem) {
var range = this.getRng();
if (range.insertNode) {
range.deleteContents();
range.insertNode($elem);
}
},
insertHTML: function (html) {
var range = this.getRng();
if (document.queryCommandState("insertHTML")) {
// W3C
this.nicCommand("insertHTML", html);
} else if (range.insertNode) {
// IE
range.deleteContents();
range.insertNode($(html)[0]);
} else if (range.pasteHTML) {
// IE <= 10
range.pasteHTML(html);
}
},
nicCommand: function (cmd, args) {
document.execCommand(cmd, false, args);
}
@ -84486,17 +84553,18 @@ BI.DynamicSummaryLayerTreeTable = BI.inherit(BI.Widget, {
var c = [crossHeader[row]];
result.push(c.concat(node || []));
});
var rowHeaderCreator = BI.isFunction(o.rowHeaderCreator) ? o.rowHeaderCreator() : o.rowHeaderCreator;
if (header && header.length > 0) {
var newHeader = this._formatColumns(header);
var deep = this._getHDeep();
if (deep <= 0) {
newHeader.unshift(o.rowHeaderCreator || {
newHeader.unshift(rowHeaderCreator || {
type: "bi.table_style_cell",
text: BI.i18nText("BI-Row_Header"),
styleGetter: o.headerCellStyleGetter
});
} else {
newHeader[0] = o.rowHeaderCreator || {
newHeader[0] = rowHeaderCreator || {
type: "bi.table_style_cell",
text: BI.i18nText("BI-Row_Header"),
styleGetter: o.headerCellStyleGetter
@ -90026,7 +90094,8 @@ BI.DownListPopup = BI.inherit(BI.Pane, {
type: "bi.vertical"
}]
}
},
maxHeight: 378
};
item.el.childValues = [];
BI.each(item.children, function (i, child) {
@ -90248,6 +90317,7 @@ BI.shortcut("bi.down_list_popup", BI.DownListPopup);/**
if (BI.isNotNull(obj.year)) {
return obj.position === BI.DynamicDateCard.OFFSET.BEGIN ? BI.getDate(date.getFullYear(), 0, 1) : BI.getDate(date.getFullYear(), 11, 31);
}
return date;
}
});
})();BI.DynamicDateCard = BI.inherit(BI.Widget, {
@ -111676,8 +111746,7 @@ BI.ValueChooserPane = BI.inherit(BI.AbstractValueChooser, {
self.fireEvent(BI.ValueChooserPane.EVENT_CHANGE);
});
if (BI.isNotNull(o.items)) {
this.items = o.items;
this.populate();
this.populate(o.items);
}
},

68
dist/bundle.min.js vendored

File diff suppressed because one or more lines are too long

150
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
}));
}
});
@ -10398,29 +10427,29 @@ BI.RichEditorParamAction = BI.inherit(BI.RichEditorAction, {
BI.RichEditorParamAction.superclass._init.apply(this, arguments);
},
_createBlankNode: function () {
return $("<span>").html("&nbsp;");
},
_addBlank: function ($param) {
var o = this.options;
var instance = o.editor.selectedInstance;
var next = $param.next();
if (next.length === 0) {
var nextNode = this._createBlankNode();
$param.after(nextNode);
instance.setFocus(nextNode[0]);
} else {
instance.setFocus(next[0]);
}
},
// _createBlankNode: function () {
// return $("<span>").html("&nbsp;");
// },
_get$Sel: function () {
var o = this.options;
var instance = o.editor.selectedInstance;
var sel = $(instance.selElm());
return sel;
},
// _addBlank: function ($param) {
// var o = this.options;
// var instance = o.editor.selectedInstance;
// var next = $param.next();
// if (next.length === 0) {
// var nextNode = this._createBlankNode();
// $param.after(nextNode);
// instance.setFocus(nextNode[0]);
// } else {
// instance.setFocus(next[0]);
// }
// },
//
// _get$Sel: function () {
// var o = this.options;
// var instance = o.editor.selectedInstance;
// var sel = $(instance.selElm());
// return sel;
// },
addParam: function (param) {
var o = this.options;
@ -10431,14 +10460,15 @@ BI.RichEditorParamAction = BI.inherit(BI.RichEditorAction, {
image.alt = param;
image.style = attrs.style;
$(image).addClass("rich-editor-param");
var sel = this._get$Sel();
var wrapper = o.editor.instance.getElm().element;
if (wrapper.find(sel).length <= 0) {
wrapper.append(image);
} else {
sel.after(image);
}
this._addBlank($(image));
this.options.editor.insertHTML($("<div>").append(image).html());
// var sel = this._get$Sel();
// var wrapper = o.editor.instance.getElm().element;
// if (wrapper.find(sel).length <= 0) {
// wrapper.append(image);
// } else {
// sel.after(image);
// }
// this._addBlank($(image));
}
});
@ -10651,12 +10681,24 @@ BI.shortcut("bi.rich_editor_text_toolbar", BI.RichEditorTextToolbar);/**
} else {
console.error("不支持此浏览器");
}
if(o.readOnly) {
if (o.readOnly) {
newInstance.disable();
}
return newInstance;
},
insertElem: function ($elem) {
if (this.selectedInstance) {
this.selectedInstance.insertElem($elem);
}
},
insertHTML: function (html) {
if (this.selectedInstance) {
this.selectedInstance.insertHTML(html);
}
},
nicCommand: function (cmd, args) {
if (this.selectedInstance) {
this.selectedInstance.nicCommand(cmd, args);
@ -10899,6 +10941,31 @@ BI.shortcut("bi.rich_editor_text_toolbar", BI.RichEditorTextToolbar);/**
this.elm.element.html(this.content);
},
insertElem: function ($elem) {
var range = this.getRng();
if (range.insertNode) {
range.deleteContents();
range.insertNode($elem);
}
},
insertHTML: function (html) {
var range = this.getRng();
if (document.queryCommandState("insertHTML")) {
// W3C
this.nicCommand("insertHTML", html);
} else if (range.insertNode) {
// IE
range.deleteContents();
range.insertNode($(html)[0]);
} else if (range.pasteHTML) {
// IE <= 10
range.pasteHTML(html);
}
},
nicCommand: function (cmd, args) {
document.execCommand(cmd, false, args);
}
@ -12013,17 +12080,18 @@ BI.DynamicSummaryLayerTreeTable = BI.inherit(BI.Widget, {
var c = [crossHeader[row]];
result.push(c.concat(node || []));
});
var rowHeaderCreator = BI.isFunction(o.rowHeaderCreator) ? o.rowHeaderCreator() : o.rowHeaderCreator;
if (header && header.length > 0) {
var newHeader = this._formatColumns(header);
var deep = this._getHDeep();
if (deep <= 0) {
newHeader.unshift(o.rowHeaderCreator || {
newHeader.unshift(rowHeaderCreator || {
type: "bi.table_style_cell",
text: BI.i18nText("BI-Row_Header"),
styleGetter: o.headerCellStyleGetter
});
} else {
newHeader[0] = o.rowHeaderCreator || {
newHeader[0] = rowHeaderCreator || {
type: "bi.table_style_cell",
text: BI.i18nText("BI-Row_Header"),
styleGetter: o.headerCellStyleGetter

105
dist/demo.js vendored

@ -11014,111 +11014,6 @@ 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

191
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();
@ -54611,9 +54611,9 @@ BI.Editor = BI.inherit(BI.Single, {
getValue: function () {
if (!this.isValid()) {
return BI.trim(this.editor.getLastValidValue());
return this.editor.getLastValidValue();
}
return BI.trim(this.editor.getValue());
return this.editor.getValue();
},
isEditing: function () {
@ -55736,7 +55736,7 @@ BI.Input = BI.inherit(BI.Single, {
}
function blur () {
if (!self.isValid() && self.options.quitChecker.apply(self, [BI.trim(self.getValue())]) !== false) {
if (!self.isValid() && self.options.quitChecker.apply(self, [self.getValue()]) !== false) {
self.element.val(self._lastValidValue ? self._lastValidValue : "");
self._checkValidationOnValueChange();
self._defaultState();
@ -55766,11 +55766,11 @@ BI.Input = BI.inherit(BI.Single, {
},
onKeyDown: function (keyCode, ctrlKey) {
if (!this.isValid() || BI.trim(this._lastValidValue) !== BI.trim(this.getValue())) {
if (!this.isValid() || this._lastValidValue !== this.getValue()) {
this._checkValidationOnValueChange();
}
if (this.isValid() && BI.trim(this.getValue()) !== "") {
if (BI.trim(this.getValue()) !== this._lastValue && (!this._start || this._lastValue == null || this._lastValue === "")
if (this.isValid() && this.getValue() !== "") {
if (this.getValue() !== this._lastValue && (!this._start || this._lastValue == null || this._lastValue === "")
|| (this._pause === true && !/(\s|\u00A0)$/.test(this.getValue()))) {
this._start = true;
this._pause = false;
@ -55782,7 +55782,7 @@ BI.Input = BI.inherit(BI.Single, {
this._valueChange();
} else {
if (keyCode == BI.KeyCode.ENTER) {
if (this.isValid() || this.options.quitChecker.apply(this, [BI.trim(this.getValue())]) !== false) {
if (this.isValid() || this.options.quitChecker.apply(this, [this.getValue()]) !== false) {
this.blur();
this.fireEvent(BI.Input.EVENT_ENTER);
} else {
@ -55807,7 +55807,7 @@ BI.Input = BI.inherit(BI.Single, {
this.fireEvent(BI.Input.EVENT_PAUSE);
this._defaultState();
} else if ((keyCode === BI.KeyCode.BACKSPACE || keyCode === BI.KeyCode.DELETE) &&
BI.trim(this.getValue()) === "" && (this._lastValue !== null && BI.trim(this._lastValue) !== "")) {
this.getValue() === "" && (this._lastValue !== null && this._lastValue !== "")) {
this.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.STOPEDIT, this.getValue(), this);
this.fireEvent(BI.Input.EVENT_STOP);
this._valueChange();
@ -55827,10 +55827,10 @@ BI.Input = BI.inherit(BI.Single, {
},
_valueChange: function () {
if (this.isValid() && BI.trim(this.getValue()) !== this._lastSubmitValue) {
if (this.isValid() && this.getValue() !== this._lastSubmitValue) {
this.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.CHANGE, this.getValue(), this);
this.fireEvent(BI.Input.EVENT_CHANGE);
this._lastSubmitValue = BI.trim(this.getValue());
this._lastSubmitValue = this.getValue();
}
if (this.getValue() == "") {
this.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.EMPTY, this.getValue(), this);
@ -55843,10 +55843,10 @@ BI.Input = BI.inherit(BI.Single, {
var o = this.options;
var v = this.getValue();
this.setValid(
(o.allowBlank === true && BI.trim(v) == "") ||
(BI.isNotEmptyString(BI.trim(v))
(o.allowBlank === true && v == "") ||
(BI.isNotEmptyString(v)
&& (v === this._lastValidValue ||
o.validationChecker.apply(this, [BI.trim(v)]) !== false))
o.validationChecker.apply(this, [v]) !== false))
);
},
@ -55906,13 +55906,13 @@ BI.Input = BI.inherit(BI.Single, {
BI.Input.superclass._setValid.apply(this, arguments);
if (this.isValid()) {
this.element.removeClass("bi-input-error");
this.fireEvent(BI.Input.EVENT_VALID, BI.trim(this.getValue()), this);
this.fireEvent(BI.Input.EVENT_VALID, this.getValue(), this);
} else {
if (this._lastValidValue === this.getValue()) {
this._lastValidValue = null;
}
this.element.addClass("bi-input-error");
this.fireEvent(BI.Input.EVENT_ERROR, BI.trim(this.getValue()), this);
this.fireEvent(BI.Input.EVENT_ERROR, this.getValue(), this);
}
},
@ -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
}));
}
});
@ -83114,29 +83143,29 @@ BI.RichEditorParamAction = BI.inherit(BI.RichEditorAction, {
BI.RichEditorParamAction.superclass._init.apply(this, arguments);
},
_createBlankNode: function () {
return $("<span>").html("&nbsp;");
},
_addBlank: function ($param) {
var o = this.options;
var instance = o.editor.selectedInstance;
var next = $param.next();
if (next.length === 0) {
var nextNode = this._createBlankNode();
$param.after(nextNode);
instance.setFocus(nextNode[0]);
} else {
instance.setFocus(next[0]);
}
},
// _createBlankNode: function () {
// return $("<span>").html("&nbsp;");
// },
_get$Sel: function () {
var o = this.options;
var instance = o.editor.selectedInstance;
var sel = $(instance.selElm());
return sel;
},
// _addBlank: function ($param) {
// var o = this.options;
// var instance = o.editor.selectedInstance;
// var next = $param.next();
// if (next.length === 0) {
// var nextNode = this._createBlankNode();
// $param.after(nextNode);
// instance.setFocus(nextNode[0]);
// } else {
// instance.setFocus(next[0]);
// }
// },
//
// _get$Sel: function () {
// var o = this.options;
// var instance = o.editor.selectedInstance;
// var sel = $(instance.selElm());
// return sel;
// },
addParam: function (param) {
var o = this.options;
@ -83147,14 +83176,15 @@ BI.RichEditorParamAction = BI.inherit(BI.RichEditorAction, {
image.alt = param;
image.style = attrs.style;
$(image).addClass("rich-editor-param");
var sel = this._get$Sel();
var wrapper = o.editor.instance.getElm().element;
if (wrapper.find(sel).length <= 0) {
wrapper.append(image);
} else {
sel.after(image);
}
this._addBlank($(image));
this.options.editor.insertHTML($("<div>").append(image).html());
// var sel = this._get$Sel();
// var wrapper = o.editor.instance.getElm().element;
// if (wrapper.find(sel).length <= 0) {
// wrapper.append(image);
// } else {
// sel.after(image);
// }
// this._addBlank($(image));
}
});
@ -83367,12 +83397,24 @@ BI.shortcut("bi.rich_editor_text_toolbar", BI.RichEditorTextToolbar);/**
} else {
console.error("不支持此浏览器");
}
if(o.readOnly) {
if (o.readOnly) {
newInstance.disable();
}
return newInstance;
},
insertElem: function ($elem) {
if (this.selectedInstance) {
this.selectedInstance.insertElem($elem);
}
},
insertHTML: function (html) {
if (this.selectedInstance) {
this.selectedInstance.insertHTML(html);
}
},
nicCommand: function (cmd, args) {
if (this.selectedInstance) {
this.selectedInstance.nicCommand(cmd, args);
@ -83615,6 +83657,31 @@ BI.shortcut("bi.rich_editor_text_toolbar", BI.RichEditorTextToolbar);/**
this.elm.element.html(this.content);
},
insertElem: function ($elem) {
var range = this.getRng();
if (range.insertNode) {
range.deleteContents();
range.insertNode($elem);
}
},
insertHTML: function (html) {
var range = this.getRng();
if (document.queryCommandState("insertHTML")) {
// W3C
this.nicCommand("insertHTML", html);
} else if (range.insertNode) {
// IE
range.deleteContents();
range.insertNode($(html)[0]);
} else if (range.pasteHTML) {
// IE <= 10
range.pasteHTML(html);
}
},
nicCommand: function (cmd, args) {
document.execCommand(cmd, false, args);
}
@ -84729,17 +84796,18 @@ BI.DynamicSummaryLayerTreeTable = BI.inherit(BI.Widget, {
var c = [crossHeader[row]];
result.push(c.concat(node || []));
});
var rowHeaderCreator = BI.isFunction(o.rowHeaderCreator) ? o.rowHeaderCreator() : o.rowHeaderCreator;
if (header && header.length > 0) {
var newHeader = this._formatColumns(header);
var deep = this._getHDeep();
if (deep <= 0) {
newHeader.unshift(o.rowHeaderCreator || {
newHeader.unshift(rowHeaderCreator || {
type: "bi.table_style_cell",
text: BI.i18nText("BI-Row_Header"),
styleGetter: o.headerCellStyleGetter
});
} else {
newHeader[0] = o.rowHeaderCreator || {
newHeader[0] = rowHeaderCreator || {
type: "bi.table_style_cell",
text: BI.i18nText("BI-Row_Header"),
styleGetter: o.headerCellStyleGetter
@ -90269,7 +90337,8 @@ BI.DownListPopup = BI.inherit(BI.Pane, {
type: "bi.vertical"
}]
}
},
maxHeight: 378
};
item.el.childValues = [];
BI.each(item.children, function (i, child) {
@ -90491,6 +90560,7 @@ BI.shortcut("bi.down_list_popup", BI.DownListPopup);/**
if (BI.isNotNull(obj.year)) {
return obj.position === BI.DynamicDateCard.OFFSET.BEGIN ? BI.getDate(date.getFullYear(), 0, 1) : BI.getDate(date.getFullYear(), 11, 31);
}
return date;
}
});
})();BI.DynamicDateCard = BI.inherit(BI.Widget, {
@ -111919,8 +111989,7 @@ BI.ValueChooserPane = BI.inherit(BI.AbstractValueChooser, {
self.fireEvent(BI.ValueChooserPane.EVENT_CHANGE);
});
if (BI.isNotNull(o.items)) {
this.items = o.items;
this.populate();
this.populate(o.items);
}
},

68
dist/fineui.min.js vendored

File diff suppressed because one or more lines are too long

7
dist/widget.js vendored

@ -2540,7 +2540,8 @@ BI.DownListPopup = BI.inherit(BI.Pane, {
type: "bi.vertical"
}]
}
},
maxHeight: 378
};
item.el.childValues = [];
BI.each(item.children, function (i, child) {
@ -2762,6 +2763,7 @@ BI.shortcut("bi.down_list_popup", BI.DownListPopup);/**
if (BI.isNotNull(obj.year)) {
return obj.position === BI.DynamicDateCard.OFFSET.BEGIN ? BI.getDate(date.getFullYear(), 0, 1) : BI.getDate(date.getFullYear(), 11, 31);
}
return date;
}
});
})();BI.DynamicDateCard = BI.inherit(BI.Widget, {
@ -24190,8 +24192,7 @@ BI.ValueChooserPane = BI.inherit(BI.AbstractValueChooser, {
self.fireEvent(BI.ValueChooserPane.EVENT_CHANGE);
});
if (BI.isNotNull(o.items)) {
this.items = o.items;
this.populate();
this.populate(o.items);
}
},

4
src/base/single/editor/editor.js

@ -288,9 +288,9 @@ BI.Editor = BI.inherit(BI.Single, {
getValue: function () {
if (!this.isValid()) {
return BI.trim(this.editor.getLastValidValue());
return this.editor.getLastValidValue();
}
return BI.trim(this.editor.getValue());
return this.editor.getValue();
},
isEditing: function () {

26
src/base/single/input/input.js

@ -88,7 +88,7 @@ BI.Input = BI.inherit(BI.Single, {
}
function blur () {
if (!self.isValid() && self.options.quitChecker.apply(self, [BI.trim(self.getValue())]) !== false) {
if (!self.isValid() && self.options.quitChecker.apply(self, [self.getValue()]) !== false) {
self.element.val(self._lastValidValue ? self._lastValidValue : "");
self._checkValidationOnValueChange();
self._defaultState();
@ -118,11 +118,11 @@ BI.Input = BI.inherit(BI.Single, {
},
onKeyDown: function (keyCode, ctrlKey) {
if (!this.isValid() || BI.trim(this._lastValidValue) !== BI.trim(this.getValue())) {
if (!this.isValid() || this._lastValidValue !== this.getValue()) {
this._checkValidationOnValueChange();
}
if (this.isValid() && BI.trim(this.getValue()) !== "") {
if (BI.trim(this.getValue()) !== this._lastValue && (!this._start || this._lastValue == null || this._lastValue === "")
if (this.isValid() && this.getValue() !== "") {
if (this.getValue() !== this._lastValue && (!this._start || this._lastValue == null || this._lastValue === "")
|| (this._pause === true && !/(\s|\u00A0)$/.test(this.getValue()))) {
this._start = true;
this._pause = false;
@ -134,7 +134,7 @@ BI.Input = BI.inherit(BI.Single, {
this._valueChange();
} else {
if (keyCode == BI.KeyCode.ENTER) {
if (this.isValid() || this.options.quitChecker.apply(this, [BI.trim(this.getValue())]) !== false) {
if (this.isValid() || this.options.quitChecker.apply(this, [this.getValue()]) !== false) {
this.blur();
this.fireEvent(BI.Input.EVENT_ENTER);
} else {
@ -159,7 +159,7 @@ BI.Input = BI.inherit(BI.Single, {
this.fireEvent(BI.Input.EVENT_PAUSE);
this._defaultState();
} else if ((keyCode === BI.KeyCode.BACKSPACE || keyCode === BI.KeyCode.DELETE) &&
BI.trim(this.getValue()) === "" && (this._lastValue !== null && BI.trim(this._lastValue) !== "")) {
this.getValue() === "" && (this._lastValue !== null && this._lastValue !== "")) {
this.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.STOPEDIT, this.getValue(), this);
this.fireEvent(BI.Input.EVENT_STOP);
this._valueChange();
@ -179,10 +179,10 @@ BI.Input = BI.inherit(BI.Single, {
},
_valueChange: function () {
if (this.isValid() && BI.trim(this.getValue()) !== this._lastSubmitValue) {
if (this.isValid() && this.getValue() !== this._lastSubmitValue) {
this.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.CHANGE, this.getValue(), this);
this.fireEvent(BI.Input.EVENT_CHANGE);
this._lastSubmitValue = BI.trim(this.getValue());
this._lastSubmitValue = this.getValue();
}
if (this.getValue() == "") {
this.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.EMPTY, this.getValue(), this);
@ -195,10 +195,10 @@ BI.Input = BI.inherit(BI.Single, {
var o = this.options;
var v = this.getValue();
this.setValid(
(o.allowBlank === true && BI.trim(v) == "") ||
(BI.isNotEmptyString(BI.trim(v))
(o.allowBlank === true && v == "") ||
(BI.isNotEmptyString(v)
&& (v === this._lastValidValue ||
o.validationChecker.apply(this, [BI.trim(v)]) !== false))
o.validationChecker.apply(this, [v]) !== false))
);
},
@ -258,13 +258,13 @@ BI.Input = BI.inherit(BI.Single, {
BI.Input.superclass._setValid.apply(this, arguments);
if (this.isValid()) {
this.element.removeClass("bi-input-error");
this.fireEvent(BI.Input.EVENT_VALID, BI.trim(this.getValue()), this);
this.fireEvent(BI.Input.EVENT_VALID, this.getValue(), this);
} else {
if (this._lastValidValue === this.getValue()) {
this._lastValidValue = null;
}
this.element.addClass("bi-input-error");
this.fireEvent(BI.Input.EVENT_ERROR, BI.trim(this.getValue()), this);
this.fireEvent(BI.Input.EVENT_ERROR, this.getValue(), this);
}
},

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
}));
}
});

61
src/case/richeditor/bar/action.richeditor.param.js

@ -17,29 +17,29 @@ BI.RichEditorParamAction = BI.inherit(BI.RichEditorAction, {
BI.RichEditorParamAction.superclass._init.apply(this, arguments);
},
_createBlankNode: function () {
return $("<span>").html("&nbsp;");
},
_addBlank: function ($param) {
var o = this.options;
var instance = o.editor.selectedInstance;
var next = $param.next();
if (next.length === 0) {
var nextNode = this._createBlankNode();
$param.after(nextNode);
instance.setFocus(nextNode[0]);
} else {
instance.setFocus(next[0]);
}
},
// _createBlankNode: function () {
// return $("<span>").html("&nbsp;");
// },
_get$Sel: function () {
var o = this.options;
var instance = o.editor.selectedInstance;
var sel = $(instance.selElm());
return sel;
},
// _addBlank: function ($param) {
// var o = this.options;
// var instance = o.editor.selectedInstance;
// var next = $param.next();
// if (next.length === 0) {
// var nextNode = this._createBlankNode();
// $param.after(nextNode);
// instance.setFocus(nextNode[0]);
// } else {
// instance.setFocus(next[0]);
// }
// },
//
// _get$Sel: function () {
// var o = this.options;
// var instance = o.editor.selectedInstance;
// var sel = $(instance.selElm());
// return sel;
// },
addParam: function (param) {
var o = this.options;
@ -50,14 +50,15 @@ BI.RichEditorParamAction = BI.inherit(BI.RichEditorAction, {
image.alt = param;
image.style = attrs.style;
$(image).addClass("rich-editor-param");
var sel = this._get$Sel();
var wrapper = o.editor.instance.getElm().element;
if (wrapper.find(sel).length <= 0) {
wrapper.append(image);
} else {
sel.after(image);
}
this._addBlank($(image));
this.options.editor.insertHTML($("<div>").append(image).html());
// var sel = this._get$Sel();
// var wrapper = o.editor.instance.getElm().element;
// if (wrapper.find(sel).length <= 0) {
// wrapper.append(image);
// } else {
// sel.after(image);
// }
// this._addBlank($(image));
}
});

39
src/case/richeditor/niceditor/niceditor.js

@ -35,12 +35,24 @@
} else {
console.error("不支持此浏览器");
}
if(o.readOnly) {
if (o.readOnly) {
newInstance.disable();
}
return newInstance;
},
insertElem: function ($elem) {
if (this.selectedInstance) {
this.selectedInstance.insertElem($elem);
}
},
insertHTML: function (html) {
if (this.selectedInstance) {
this.selectedInstance.insertHTML(html);
}
},
nicCommand: function (cmd, args) {
if (this.selectedInstance) {
this.selectedInstance.nicCommand(cmd, args);
@ -283,6 +295,31 @@
this.elm.element.html(this.content);
},
insertElem: function ($elem) {
var range = this.getRng();
if (range.insertNode) {
range.deleteContents();
range.insertNode($elem);
}
},
insertHTML: function (html) {
var range = this.getRng();
if (document.queryCommandState("insertHTML")) {
// W3C
this.nicCommand("insertHTML", html);
} else if (range.insertNode) {
// IE
range.deleteContents();
range.insertNode($(html)[0]);
} else if (range.pasteHTML) {
// IE <= 10
range.pasteHTML(html);
}
},
nicCommand: function (cmd, args) {
document.execCommand(cmd, false, args);
}

5
src/case/table/table.dynamicsummarylayertree.js

@ -68,17 +68,18 @@ BI.DynamicSummaryLayerTreeTable = BI.inherit(BI.Widget, {
var c = [crossHeader[row]];
result.push(c.concat(node || []));
});
var rowHeaderCreator = BI.isFunction(o.rowHeaderCreator) ? o.rowHeaderCreator() : o.rowHeaderCreator;
if (header && header.length > 0) {
var newHeader = this._formatColumns(header);
var deep = this._getHDeep();
if (deep <= 0) {
newHeader.unshift(o.rowHeaderCreator || {
newHeader.unshift(rowHeaderCreator || {
type: "bi.table_style_cell",
text: BI.i18nText("BI-Row_Header"),
styleGetter: o.headerCellStyleGetter
});
} else {
newHeader[0] = o.rowHeaderCreator || {
newHeader[0] = rowHeaderCreator || {
type: "bi.table_style_cell",
text: BI.i18nText("BI-Row_Header"),
styleGetter: o.headerCellStyleGetter

3
src/component/valuechooser/pane.valuechooser.js

@ -31,8 +31,7 @@ BI.ValueChooserPane = BI.inherit(BI.AbstractValueChooser, {
self.fireEvent(BI.ValueChooserPane.EVENT_CHANGE);
});
if (BI.isNotNull(o.items)) {
this.items = o.items;
this.populate();
this.populate(o.items);
}
},

3
src/widget/downlist/popup.downlist.js

@ -105,7 +105,8 @@ BI.DownListPopup = BI.inherit(BI.Pane, {
type: "bi.vertical"
}]
}
},
maxHeight: 378
};
item.el.childValues = [];
BI.each(item.children, function (i, child) {

1
src/widget/dynamicdate/dynamicdate.caculate.js

@ -48,6 +48,7 @@
if (BI.isNotNull(obj.year)) {
return obj.position === BI.DynamicDateCard.OFFSET.BEGIN ? BI.getDate(date.getFullYear(), 0, 1) : BI.getDate(date.getFullYear(), 11, 31);
}
return date;
}
});
})();
Loading…
Cancel
Save