Browse Source

Merge remote-tracking branch 'origin/master' into bugfix

es6
iapyang 4 years ago
parent
commit
24f5bf05f1
  1. 5
      changelog.md
  2. 4
      dist/2.0/fineui.css
  3. 4
      dist/2.0/fineui.ie.min.js
  4. 2
      dist/2.0/fineui.ie.min.js.map
  5. 2037
      dist/2.0/fineui.js
  6. 2
      dist/2.0/fineui.js.map
  7. 4
      dist/2.0/fineui.min.css
  8. 4
      dist/2.0/fineui.min.js
  9. 2
      dist/2.0/fineui.min.js.map
  10. 4
      dist/2.0/fineui_without_normalize.css
  11. 4
      dist/2.0/fineui_without_normalize.min.css
  12. 4
      dist/bundle.min.css
  13. 4
      dist/bundle.min.js
  14. 2
      dist/bundle.min.js.map
  15. 3
      dist/config.js
  16. 4
      dist/core.css
  17. 2533
      dist/core.js
  18. 2
      dist/core.js.map
  19. 4
      dist/demo.css
  20. 2289
      dist/demo.js
  21. 2
      dist/demo.js.map
  22. 4
      dist/fineui.css
  23. 4
      dist/fineui.ie.min.js
  24. 2
      dist/fineui.ie.min.js.map
  25. 1519
      dist/fineui.js
  26. 2
      dist/fineui.js.map
  27. 4
      dist/fineui.min.css
  28. 4
      dist/fineui.min.js
  29. 2
      dist/fineui.min.js.map
  30. 813
      dist/fineui_without_jquery_polyfill.js
  31. 2
      dist/fineui_without_jquery_polyfill.js.map
  32. 4
      dist/fix/worker.compact.js
  33. 2
      dist/font.css
  34. 2
      dist/resource.css
  35. 89
      dist/utils.js
  36. 2
      dist/utils.js.map
  37. 4
      dist/utils.min.js
  38. 2
      dist/utils.min.js.map
  39. 36
      hooks.html
  40. 3
      i18n/i18n.cn.js
  41. 4
      package.json
  42. 2
      src/base/collection/collection.js
  43. 11
      src/base/single/editor/editor.textarea.js
  44. 43
      src/base/single/text.pure.js
  45. 25
      src/case/colorchooser/colorpicker/editor.colorpicker.hex.js
  46. 26
      src/case/colorchooser/colorpicker/editor.colorpicker.hex.simple.js
  47. 11
      src/case/editor/editor.state.js
  48. 5
      src/core/__test__/base.test.js
  49. 2
      src/core/__test__/context.test.js
  50. 38
      src/core/__test__/widget.test.js
  51. 2
      src/core/inject.js
  52. 8
      src/core/widget.js
  53. 6
      src/core/wrapper/layout.js
  54. 2
      src/core/wrapper/layout/layout.card.js
  55. 4
      src/less/base/segment/segment.less
  56. 132
      src/less/core/utils/common.less
  57. 4
      src/less/lib/constant.less
  58. 15
      webpack/attachments.js
  59. 4
      yarn.lock

5
changelog.md

@ -1,5 +1,10 @@
# 更新日志 # 更新日志
2.0(2020-11) 2.0(2020-11)
- bi.textarea_editor添加setWatermark方法
- 生命周期可以通过属性传递来操作
- 修复了颜色选择器hex框不能输入为空的问题
- 增加纯文本组件bi.pure_text
- store支持webworker,引入多线程机制
- 修复了Popover小屏幕上看不完整的问题 - 修复了Popover小屏幕上看不完整的问题
- 颜色选择器支持输入16进制颜色编号 - 颜色选择器支持输入16进制颜色编号
- bi.textarea_editor支持气泡提示报错 - bi.textarea_editor支持气泡提示报错

4
dist/2.0/fineui.css vendored

File diff suppressed because one or more lines are too long

4
dist/2.0/fineui.ie.min.js vendored

File diff suppressed because one or more lines are too long

2
dist/2.0/fineui.ie.min.js.map vendored

File diff suppressed because one or more lines are too long

2037
dist/2.0/fineui.js vendored

File diff suppressed because it is too large Load Diff

2
dist/2.0/fineui.js.map vendored

File diff suppressed because one or more lines are too long

4
dist/2.0/fineui.min.css vendored

File diff suppressed because one or more lines are too long

4
dist/2.0/fineui.min.js vendored

File diff suppressed because one or more lines are too long

2
dist/2.0/fineui.min.js.map vendored

File diff suppressed because one or more lines are too long

4
dist/2.0/fineui_without_normalize.css vendored

File diff suppressed because one or more lines are too long

4
dist/2.0/fineui_without_normalize.min.css vendored

File diff suppressed because one or more lines are too long

4
dist/bundle.min.css vendored

File diff suppressed because one or more lines are too long

4
dist/bundle.min.js vendored

File diff suppressed because one or more lines are too long

2
dist/bundle.min.js.map vendored

File diff suppressed because one or more lines are too long

3
dist/config.js vendored

@ -10,7 +10,7 @@ BI.i18n = {
"BI-Basic_Altogether": "共", "BI-Basic_Altogether": "共",
"BI-Basic_Sunday": "星期日", "BI-Basic_Sunday": "星期日",
"BI-Widget_Background_Colour": "组件背景", "BI-Widget_Background_Colour": "组件背景",
"BI-Color_Picker_Error_Text": "请输入0~255的正整数", "BI-Color_Picker_Error_Text": "请输入0-255的正整数",
"BI-Multi_Date_Month": "月", "BI-Multi_Date_Month": "月",
"BI-No_Selected_Item": "没有可选项", "BI-No_Selected_Item": "没有可选项",
"BI-Multi_Date_Year_Begin": "年初", "BI-Multi_Date_Year_Begin": "年初",
@ -92,6 +92,7 @@ BI.i18n = {
"BI-Summary_Values": "汇总", "BI-Summary_Values": "汇总",
"BI-Basic_Clear": "清除", "BI-Basic_Clear": "清除",
"BI-Upload_File_Size_Error": "文件大小不支持", "BI-Upload_File_Size_Error": "文件大小不支持",
"BI-Upload_File_Count_Error": "超出上传数量上限,请重新上传",
"BI-Up_Page": "向上翻页", "BI-Up_Page": "向上翻页",
"BI-Basic_Simple_Sunday": "日", "BI-Basic_Simple_Sunday": "日",
"BI-Multi_Date_Relative_Current_Time": "相对当前时间", "BI-Multi_Date_Relative_Current_Time": "相对当前时间",

4
dist/core.css vendored

File diff suppressed because one or more lines are too long

2533
dist/core.js vendored

File diff suppressed because one or more lines are too long

2
dist/core.js.map vendored

File diff suppressed because one or more lines are too long

4
dist/demo.css vendored

File diff suppressed because one or more lines are too long

2289
dist/demo.js vendored

File diff suppressed because it is too large Load Diff

2
dist/demo.js.map vendored

File diff suppressed because one or more lines are too long

4
dist/fineui.css vendored

File diff suppressed because one or more lines are too long

4
dist/fineui.ie.min.js vendored

File diff suppressed because one or more lines are too long

2
dist/fineui.ie.min.js.map vendored

File diff suppressed because one or more lines are too long

1519
dist/fineui.js vendored

File diff suppressed because it is too large Load Diff

2
dist/fineui.js.map vendored

File diff suppressed because one or more lines are too long

4
dist/fineui.min.css vendored

File diff suppressed because one or more lines are too long

4
dist/fineui.min.js vendored

File diff suppressed because one or more lines are too long

2
dist/fineui.min.js.map vendored

File diff suppressed because one or more lines are too long

813
dist/fineui_without_jquery_polyfill.js vendored

File diff suppressed because it is too large Load Diff

2
dist/fineui_without_jquery_polyfill.js.map vendored

File diff suppressed because one or more lines are too long

4
dist/fix/worker.compact.js vendored

@ -78,7 +78,7 @@
}); });
var store = {}; var store = {};
this.store = new Proxy(store, { this.store = new Proxy(store, {
get (target, key) { get: function (target, key) {
return function () { return function () {
WORKER.postMessage({ WORKER.postMessage({
type: modelType, type: modelType,
@ -89,7 +89,7 @@
}); });
}; };
}, },
set (target, key, value) { set: function (target, key, value) {
return Reflect.set(target, key, value); return Reflect.set(target, key, value);
} }
}); });

2
dist/font.css vendored

File diff suppressed because one or more lines are too long

2
dist/resource.css vendored

File diff suppressed because one or more lines are too long

89
dist/utils.js vendored

@ -1,4 +1,4 @@
/*! time: 2020-11-16 17:10:38 */ /*! time: 2020-11-27 10:11:48 */
/******/ (function(modules) { // webpackBootstrap /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache /******/ // The module cache
/******/ var installedModules = {}; /******/ var installedModules = {};
@ -82,7 +82,7 @@
/******/ /******/
/******/ /******/
/******/ // Load entry module and return exports /******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 1089); /******/ return __webpack_require__(__webpack_require__.s = 1090);
/******/ }) /******/ })
/************************************************************************/ /************************************************************************/
/******/ ({ /******/ ({
@ -4238,45 +4238,6 @@ if (!_global.BI) {
}); });
}()); }());
/***/ }),
/***/ 1089:
/***/ (function(module, exports, __webpack_require__) {
__webpack_require__(101);
__webpack_require__(102);
__webpack_require__(130);
__webpack_require__(123);
__webpack_require__(126);
__webpack_require__(127);
__webpack_require__(124);
__webpack_require__(125);
__webpack_require__(105);
__webpack_require__(107);
__webpack_require__(122);
__webpack_require__(129);
__webpack_require__(128);
__webpack_require__(108);
__webpack_require__(109);
__webpack_require__(110);
__webpack_require__(111);
__webpack_require__(112);
__webpack_require__(113);
__webpack_require__(114);
__webpack_require__(115);
__webpack_require__(116);
__webpack_require__(117);
__webpack_require__(118);
__webpack_require__(119);
__webpack_require__(120);
__webpack_require__(121);
__webpack_require__(754);
__webpack_require__(1090);
__webpack_require__(131);
__webpack_require__(132);
module.exports = __webpack_require__(133);
/***/ }), /***/ }),
/***/ 109: /***/ 109:
@ -4349,6 +4310,45 @@ module.exports = __webpack_require__(133);
/***/ }), /***/ }),
/***/ 1090: /***/ 1090:
/***/ (function(module, exports, __webpack_require__) {
__webpack_require__(101);
__webpack_require__(102);
__webpack_require__(130);
__webpack_require__(123);
__webpack_require__(126);
__webpack_require__(127);
__webpack_require__(124);
__webpack_require__(125);
__webpack_require__(105);
__webpack_require__(107);
__webpack_require__(122);
__webpack_require__(129);
__webpack_require__(128);
__webpack_require__(108);
__webpack_require__(109);
__webpack_require__(110);
__webpack_require__(111);
__webpack_require__(112);
__webpack_require__(113);
__webpack_require__(114);
__webpack_require__(115);
__webpack_require__(116);
__webpack_require__(117);
__webpack_require__(118);
__webpack_require__(119);
__webpack_require__(120);
__webpack_require__(121);
__webpack_require__(951);
__webpack_require__(1091);
__webpack_require__(131);
__webpack_require__(132);
module.exports = __webpack_require__(133);
/***/ }),
/***/ 1091:
/***/ (function(module, exports) { /***/ (function(module, exports) {
/** /**
@ -8618,7 +8618,7 @@ _.extend(BI, {
} }
}; };
BI.getContext = BI.getContext || function (type, config) { BI.getResource = BI.getResource || function (type, config) {
if (constantInjection[type]) { if (constantInjection[type]) {
return BI.Constants.getConstant(type); return BI.Constants.getConstant(type);
} }
@ -9172,7 +9172,7 @@ process.umask = function () {
/***/ }), /***/ }),
/***/ 754: /***/ 951:
/***/ (function(module, exports) { /***/ (function(module, exports) {
BI.i18n = { BI.i18n = {
@ -9186,7 +9186,7 @@ BI.i18n = {
"BI-Basic_Altogether": "共", "BI-Basic_Altogether": "共",
"BI-Basic_Sunday": "星期日", "BI-Basic_Sunday": "星期日",
"BI-Widget_Background_Colour": "组件背景", "BI-Widget_Background_Colour": "组件背景",
"BI-Color_Picker_Error_Text": "请输入0~255的正整数", "BI-Color_Picker_Error_Text": "请输入0-255的正整数",
"BI-Multi_Date_Month": "月", "BI-Multi_Date_Month": "月",
"BI-No_Selected_Item": "没有可选项", "BI-No_Selected_Item": "没有可选项",
"BI-Multi_Date_Year_Begin": "年初", "BI-Multi_Date_Year_Begin": "年初",
@ -9268,6 +9268,7 @@ BI.i18n = {
"BI-Summary_Values": "汇总", "BI-Summary_Values": "汇总",
"BI-Basic_Clear": "清除", "BI-Basic_Clear": "清除",
"BI-Upload_File_Size_Error": "文件大小不支持", "BI-Upload_File_Size_Error": "文件大小不支持",
"BI-Upload_File_Count_Error": "超出上传数量上限,请重新上传",
"BI-Up_Page": "向上翻页", "BI-Up_Page": "向上翻页",
"BI-Basic_Simple_Sunday": "日", "BI-Basic_Simple_Sunday": "日",
"BI-Multi_Date_Relative_Current_Time": "相对当前时间", "BI-Multi_Date_Relative_Current_Time": "相对当前时间",

2
dist/utils.js.map vendored

File diff suppressed because one or more lines are too long

4
dist/utils.min.js vendored

File diff suppressed because one or more lines are too long

2
dist/utils.min.js.map vendored

File diff suppressed because one or more lines are too long

36
hooks.html

@ -50,11 +50,10 @@
}); });
BI.model("demo.model", Model); BI.model("demo.model", Model);
function expandFunction () {
function expandFunction (storeCreator) {
var button; var button;
var store = BI.useStore(function () { var store = BI.useStore(storeCreator);
return BI.Models.getModel("demo.model");
});
BI.onBeforeMount(function () { BI.onBeforeMount(function () {
}); });
@ -84,11 +83,9 @@
}; };
} }
function clearAllFunction () { function clearAllFunction (storeCreator) {
var button; var button;
var store = BI.useStore(function () { var store = BI.useStore(storeCreator);
return BI.Models.getModel("demo.model");
});
BI.onBeforeMount(function () { BI.onBeforeMount(function () {
}); });
@ -118,11 +115,9 @@
}; };
} }
function undoFunction () { function undoFunction (storeCreator) {
var button; var button;
var store = BI.useStore(function () { var store = BI.useStore(storeCreator);
return BI.Models.getModel("demo.model");
});
BI.onBeforeMount(function () { BI.onBeforeMount(function () {
}); });
@ -152,11 +147,9 @@
}; };
} }
function redoFunction () { function redoFunction (storeCreator) {
var button; var button;
var store = BI.useStore(function () { var store = BI.useStore(storeCreator);
return BI.Models.getModel("demo.model");
});
BI.onBeforeMount(function () { BI.onBeforeMount(function () {
}); });
@ -188,10 +181,13 @@
var Widget = BI.inherit(BI.Widget, { var Widget = BI.inherit(BI.Widget, {
setup: function () { setup: function () {
var expandComponent = expandFunction(); var storeCreator = function () {
var clearAllComponent = clearAllFunction(); return BI.Models.getModel("demo.model");
var undoComponent = undoFunction(); };
var redoComponent = redoFunction(); var expandComponent = expandFunction(storeCreator);
var clearAllComponent = clearAllFunction(storeCreator);
var undoComponent = undoFunction(storeCreator);
var redoComponent = redoFunction(storeCreator);
return function () { return function () {
return { return {
type: "bi.vertical", type: "bi.vertical",

3
i18n/i18n.cn.js

@ -9,7 +9,7 @@ BI.i18n = {
"BI-Basic_Altogether": "共", "BI-Basic_Altogether": "共",
"BI-Basic_Sunday": "星期日", "BI-Basic_Sunday": "星期日",
"BI-Widget_Background_Colour": "组件背景", "BI-Widget_Background_Colour": "组件背景",
"BI-Color_Picker_Error_Text": "请输入0~255的正整数", "BI-Color_Picker_Error_Text": "请输入0-255的正整数",
"BI-Multi_Date_Month": "月", "BI-Multi_Date_Month": "月",
"BI-No_Selected_Item": "没有可选项", "BI-No_Selected_Item": "没有可选项",
"BI-Multi_Date_Year_Begin": "年初", "BI-Multi_Date_Year_Begin": "年初",
@ -91,6 +91,7 @@ BI.i18n = {
"BI-Summary_Values": "汇总", "BI-Summary_Values": "汇总",
"BI-Basic_Clear": "清除", "BI-Basic_Clear": "清除",
"BI-Upload_File_Size_Error": "文件大小不支持", "BI-Upload_File_Size_Error": "文件大小不支持",
"BI-Upload_File_Count_Error": "超出上传数量上限,请重新上传",
"BI-Up_Page": "向上翻页", "BI-Up_Page": "向上翻页",
"BI-Basic_Simple_Sunday": "日", "BI-Basic_Simple_Sunday": "日",
"BI-Multi_Date_Relative_Current_Time": "相对当前时间", "BI-Multi_Date_Relative_Current_Time": "相对当前时间",

4
package.json

@ -1,6 +1,6 @@
{ {
"name": "fineui", "name": "fineui",
"version": "2.0.20201116171157", "version": "2.0.20201127101300",
"description": "fineui", "description": "fineui",
"main": "dist/fineui.min.js", "main": "dist/fineui.min.js",
"types": "dist/lib/index.d.ts", "types": "dist/lib/index.d.ts",
@ -79,4 +79,4 @@
}, },
"author": "fanruan", "author": "fanruan",
"license": "MIT" "license": "MIT"
} }

2
src/base/collection/collection.js

@ -181,7 +181,7 @@ BI.CollectionView = BI.inherit(BI.Widget, {
width: datum.width, width: datum.width,
height: datum.height height: datum.height
}, o.items[datum.index], { }, o.items[datum.index], {
cls: (o.items[datum.index].cls || "") + " container-cell" + (datum.y === 0 ? " first-row" : "") + (datum.x === 0 ? " first-col" : ""), cls: (o.items[datum.index].cls || "") + " collection-cell" + (datum.y === 0 ? " first-row" : "") + (datum.x === 0 ? " first-col" : ""),
_left: datum.x, _left: datum.x,
_top: datum.y _top: datum.y
})); }));

11
src/base/single/editor/editor.textarea.js

@ -16,7 +16,7 @@ BI.TextAreaEditor = BI.inherit(BI.Single, {
}); });
}, },
render: function() { render: function () {
var o = this.options, self = this; var o = this.options, self = this;
this.content = BI.createWidget({ this.content = BI.createWidget({
type: "bi.layout", type: "bi.layout",
@ -25,7 +25,7 @@ BI.TextAreaEditor = BI.inherit(BI.Single, {
height: "100%", height: "100%",
cls: "bi-textarea textarea-editor-content display-block" cls: "bi-textarea textarea-editor-content display-block"
}); });
this.content.element.css({resize: "none"}); this.content.element.css({ resize: "none" });
BI.createWidget({ BI.createWidget({
type: "bi.absolute", type: "bi.absolute",
element: this, element: this,
@ -175,6 +175,11 @@ BI.TextAreaEditor = BI.inherit(BI.Single, {
return this.style; return this.style;
}, },
setWatermark: function (v) {
this.options.watermark = v;
this._checkWaterMark();
},
_setValid: function (b) { _setValid: function (b) {
BI.TextAreaEditor.superclass._setValid.apply(this, arguments); BI.TextAreaEditor.superclass._setValid.apply(this, arguments);
// this.content.setValid(b); // this.content.setValid(b);
@ -189,4 +194,4 @@ BI.TextAreaEditor = BI.inherit(BI.Single, {
BI.TextAreaEditor.EVENT_CHANGE = "EVENT_CHANGE"; BI.TextAreaEditor.EVENT_CHANGE = "EVENT_CHANGE";
BI.TextAreaEditor.EVENT_BLUR = "EVENT_BLUR"; BI.TextAreaEditor.EVENT_BLUR = "EVENT_BLUR";
BI.TextAreaEditor.EVENT_FOCUS = "EVENT_FOCUS"; BI.TextAreaEditor.EVENT_FOCUS = "EVENT_FOCUS";
BI.shortcut("bi.textarea_editor", BI.TextAreaEditor); BI.shortcut("bi.textarea_editor", BI.TextAreaEditor);

43
src/base/single/text.pure.js

@ -0,0 +1,43 @@
/**
* 没有html标签的纯文本
*/
!(function () {
BI.PureText = BI.inherit(BI.Widget, {
props: {
tagName: null
},
render: function () {
var self = this, o = this.options;
var text = this._getShowText();
if (BI.isKey(text)) {
this.setText(text);
} else if (BI.isKey(o.value)) {
this.setText(o.value);
}
},
_getShowText: function () {
var o = this.options;
var text = BI.isFunction(o.text) ? o.text() : o.text;
text = BI.isKey(text) ? text : o.value;
if (!BI.isKey(text)) {
return "";
}
return BI.Text.formatText(text + "");
},
setValue: function (value) {
this.options.value = value;
this.setText(value);
},
setText: function (text) {
this.options.text = BI.isNotNull(text) ? text : "";
this.element.__textKeywordMarked__(this._getShowText());
}
});
BI.shortcut("bi.pure_text", BI.PureText);
}());

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

@ -85,15 +85,19 @@ BI.HexColorPickerEditor = 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();
self.colorShow.element.css("background-color", self.getValue()); if (checker(self.storeValue.r) && checker(self.storeValue.g) && checker(self.storeValue.b)) {
self.fireEvent(BI.ColorPickerEditor.EVENT_CHANGE); self.colorShow.element.css("background-color", self.getValue());
self.fireEvent(BI.ColorPickerEditor.EVENT_CHANGE);
}
} }
}] }]
}, { }, {
@ -238,6 +242,21 @@ BI.HexColorPickerEditor = BI.inherit(BI.Widget, {
return BI.isEmptyString(this.storeValue.r) && BI.isEmptyString(this.storeValue.g) && BI.isEmptyString(this.storeValue.b); return BI.isEmptyString(this.storeValue.r) && BI.isEmptyString(this.storeValue.g) && BI.isEmptyString(this.storeValue.b);
}, },
_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);
},
_showPreColor: function (color) { _showPreColor: function (color) {
if (color === "") { if (color === "") {
this.colorShow.element.css("background-color", "").removeClass("trans-color-background").addClass("auto-color-normal-background"); this.colorShow.element.css("background-color", "").removeClass("trans-color-background").addClass("auto-color-normal-background");

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

@ -82,15 +82,18 @@ 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();
self.colorShow.element.css("background-color", self.getValue()); if (checker(self.storeValue.r) && checker(self.storeValue.g) && checker(self.storeValue.b)) {
self.fireEvent(BI.ColorPickerEditor.EVENT_CHANGE); self.colorShow.element.css("background-color", self.getValue());
self.fireEvent(BI.ColorPickerEditor.EVENT_CHANGE);
}
} }
}] }]
}, { }, {
@ -157,13 +160,28 @@ 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));
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);
this.B.setValue(BI.isNull(json.b) ? "" : json.b); this.B.setValue(BI.isNull(json.b) ? "" : json.b);
this.hexEditor.setValue(color.slice(this.constants.HEX_PREFIX_POSITION)); this.hexEditor.setValue(BI.isEmptyObject(json) ? "" : color.slice(this.constants.HEX_PREFIX_POSITION));
}, },
getValue: function () { getValue: function () {

11
src/case/editor/editor.state.js

@ -244,6 +244,7 @@ BI.StateEditor = BI.inherit(BI.Widget, {
setState: function (v) { setState: function (v) {
var o = this.options; var o = this.options;
var defaultText = BI.isFunction(o.defaultText) ? o.defaultText() : o.defaultText;
BI.StateEditor.superclass.setValue.apply(this, arguments); BI.StateEditor.superclass.setValue.apply(this, arguments);
this.stateValue = v; this.stateValue = v;
if (BI.isNumber(v)) { if (BI.isNumber(v)) {
@ -254,21 +255,21 @@ BI.StateEditor = BI.inherit(BI.Widget, {
this._setText(BI.i18nText("BI-Select_Part")); this._setText(BI.i18nText("BI-Select_Part"));
this.text.element.removeClass("bi-water-mark"); this.text.element.removeClass("bi-water-mark");
} else { } else {
this._setText(BI.isKey(o.defaultText) ? o.defaultText : o.text); this._setText(BI.isKey(defaultText) ? defaultText : o.text);
BI.isKey(o.defaultText) ? this.text.element.addClass("bi-water-mark") : this.text.element.removeClass("bi-water-mark"); BI.isKey(defaultText) ? this.text.element.addClass("bi-water-mark") : this.text.element.removeClass("bi-water-mark");
} }
return; return;
} }
if (BI.isString(v)) { if (BI.isString(v)) {
this._setText(v); this._setText(v);
// 配置了defaultText才判断标灰,其他情况不标灰 // 配置了defaultText才判断标灰,其他情况不标灰
(BI.isKey(o.defaultText) && o.defaultText === v) ? this.text.element.addClass("bi-water-mark") : this.text.element.removeClass("bi-water-mark"); (BI.isKey(defaultText) && defaultText === v) ? this.text.element.addClass("bi-water-mark") : this.text.element.removeClass("bi-water-mark");
return; return;
} }
if (BI.isArray(v)) { if (BI.isArray(v)) {
if (BI.isEmpty(v)) { if (BI.isEmpty(v)) {
this._setText(BI.isKey(o.defaultText) ? o.defaultText : o.text); this._setText(BI.isKey(defaultText) ? defaultText : o.text);
BI.isKey(o.defaultText) ? this.text.element.addClass("bi-water-mark") : this.text.element.removeClass("bi-water-mark"); BI.isKey(defaultText) ? this.text.element.addClass("bi-water-mark") : this.text.element.removeClass("bi-water-mark");
} else if (v.length === 1) { } else if (v.length === 1) {
this._setText(v[0]); this._setText(v[0]);
this.text.element.removeClass("bi-water-mark"); this.text.element.removeClass("bi-water-mark");

5
src/core/__test__/base.test.js

@ -437,7 +437,8 @@ describe("baseFunctionTest", function () {
* test_author_teller * test_author_teller
* 只传一个时分秒format的时间进去后,在某些情况下,返回的是当前时间,然而想要的是返回正确的时分秒 * 只传一个时分秒format的时间进去后,在某些情况下,返回的是当前时间,然而想要的是返回正确的时分秒
*/ */
it("parseDateTime", function () { it("parseDateTime2", function () {
expect(BI.parseDateTime("14:13:16", "%H:%M:%S").getTime()).to.eql(1602655996000); var date = BI.getDate();
expect(BI.parseDateTime("14:13:16", "%H:%M:%S").getTime()).to.eql(BI.getDate(date.getFullYear(), date.getMonth(), 14, 14, 13, 16).getTime());
}); });
}); });

2
src/core/__test__/context.test.js

@ -1,5 +1,5 @@
/** /**
* Created by windy on 2018/01/23. * Created by guy on 2018/01/23.
*/ */
describe("contextTest", function () { describe("contextTest", function () {

38
src/core/__test__/widget.test.js

@ -0,0 +1,38 @@
/**
* Created by guy on 2018/01/23.
*/
describe("widgetTest", function () {
before(function () {
});
/**
* test_author_guy
*/
it("widget生命周期测试", function () {
var Demo = BI.inherit(BI.Widget, {
render: function () {
return {
type: "bi.label",
text: "old"
};
}
});
BI.shortcut("demo.demo", Demo);
var demo = BI.Test.createWidget({
type: "demo.demo",
render: function () {
return {
type: "bi.label",
text: "new"
};
}
});
expect(demo.element.text()).to.equal("new");
demo.destroy();
});
});

2
src/core/inject.js

@ -264,7 +264,7 @@
} }
}; };
BI.getContext = BI.getContext || function (type, config) { BI.getResource = BI.getResource || function (type, config) {
if (constantInjection[type]) { if (constantInjection[type]) {
return BI.Constants.getConstant(type); return BI.Constants.getConstant(type);
} }

8
src/core/widget.js

@ -11,7 +11,7 @@
if (self[life]) { if (self[life]) {
var hooks = BI.isArray(self[life]) ? self[life] : [self[life]]; var hooks = BI.isArray(self[life]) ? self[life] : [self[life]];
BI.each(hooks, function (i, hook) { BI.each(hooks, function (i, hook) {
hook.apply(self); hook.call(self);
}); });
} }
} }
@ -610,7 +610,10 @@
if (o.element) { if (o.element) {
return BI.$(o.element); return BI.$(o.element);
} }
return BI.$(document.createElement(o.tagName)); if (o.tagName) {
return BI.$(document.createElement(o.tagName));
}
return BI.$(document.createDocumentFragment());
} }
return BI.$(widget); return BI.$(widget);
}, },
@ -655,3 +658,4 @@
return widget._mount(true, false, false, predicate); return widget._mount(true, false, false, predicate);
}; };
})(); })();

6
src/core/wrapper/layout.js

@ -83,7 +83,7 @@ BI.Layout = BI.inherit(BI.Widget, {
}, },
_getChildName: function (index) { _getChildName: function (index) {
return this.getName() + "_" + index; return "" + index;
}, },
_addElement: function (i, item, context) { _addElement: function (i, item, context) {
@ -94,7 +94,7 @@ BI.Layout = BI.inherit(BI.Widget, {
BI.each(self._children, function (name, child) { BI.each(self._children, function (name, child) {
if (child === w) { if (child === w) {
BI.remove(self._children, child); BI.remove(self._children, child);
self.removeItemAt(name.replace(self.getName() + "_", "") | 0); self.removeItemAt(name | 0);
} }
}); });
}); });
@ -568,7 +568,7 @@ BI.Layout = BI.inherit(BI.Widget, {
if (BI.isWidget(nameOrWidget)) { if (BI.isWidget(nameOrWidget)) {
BI.each(this._children, function (name, child) { BI.each(this._children, function (name, child) {
if (child === nameOrWidget) { if (child === nameOrWidget) {
removeIndex = name.replace(self.getName() + "_", ""); removeIndex = name;
} }
}); });
} else { } else {

2
src/core/wrapper/layout/layout.card.js

@ -196,7 +196,7 @@ BI.CardLayout = BI.inherit(BI.Layout, {
if (BI.isWidget(nameOrWidget)) { if (BI.isWidget(nameOrWidget)) {
BI.each(this._children, function (name, child) { BI.each(this._children, function (name, child) {
if (child === nameOrWidget) { if (child === nameOrWidget) {
removeName = name.replace(self.getName() + "_", ""); removeName = name;
} }
}); });
} else { } else {

4
src/less/base/segment/segment.less

@ -30,7 +30,7 @@
border-bottom: 1px solid @color-bi-border-line-theme-dark; border-bottom: 1px solid @color-bi-border-line-theme-dark;
} }
& > .first-element{ & > .first-element{
border-left: 1px solid @color-bi-background-default-theme-dark; border-left: 1px solid @color-bi-border-line-theme-dark;
} }
} }
} }

132
src/less/core/utils/common.less

@ -927,35 +927,83 @@ textarea {
} }
} }
&.disabled { &.disabled {
color: @color-bi-text-disabled !important; &, &:hover, &:active {
& .bi-input {
color: @color-bi-text-disabled !important;
}
& .bi-textarea {
color: @color-bi-text-disabled !important;
}
background-color: transparent !important;
& .bi-high-light {
color: @color-bi-text-disabled !important; color: @color-bi-text-disabled !important;
}
&.bi-high-light-border {
border-color: @color-bi-border-disabled;
}
&.hover, &.active {
color: @color-bi-text !important;
& .bi-input { & .bi-input {
color: @color-bi-text !important; color: @color-bi-text-disabled !important;
} }
& .bi-textarea { & .bi-textarea {
color: @color-bi-text !important; color: @color-bi-text-disabled !important;
} }
background-color: @color-bi-background-dark-gray !important; background-color: transparent !important;
& .bi-high-light { & .bi-high-light {
color: @color-bi-text-disabled !important; color: @color-bi-text-disabled !important;
} }
&.bi-high-light-border { &.bi-high-light-border {
border-color: @color-bi-border-disabled; border-color: @color-bi-border-disabled;
} }
&.hover, &.active {
color: @color-bi-text !important;
& .bi-input {
color: @color-bi-text !important;
}
& .bi-textarea {
color: @color-bi-text !important;
}
background-color: @color-bi-background-dark-gray !important;
& .bi-high-light {
color: @color-bi-text-disabled !important;
}
&.bi-high-light-border {
border-color: @color-bi-border-disabled;
}
}
}
}
}
.bi-theme-dark {
.bi-list-item-select {
&:hover, &.hover {
color: @color-bi-text;
& .bi-input {
color: @color-bi-text;
}
& .bi-textarea {
color: @color-bi-text;
}
.background-color(@color-bi-background-default, 5%);
}
&:active, &.active {
color: @color-bi-text;
& .bi-input {
color: @color-bi-text;
}
& .bi-textarea {
color: @color-bi-text;
}
background-color: @color-bi-background-highlight;
& .bi-high-light {
color: @color-bi-text;
}
}
&.disabled {
&, &:hover, &:active {
background-color: transparent !important;
color: @color-bi-text-disabled-theme-dark !important;
& .bi-input {
color: @color-bi-text-disabled-theme-dark !important;
}
& .bi-textarea {
color: @color-bi-text-disabled-theme-dark !important;
}
& .bi-high-light {
color: @color-bi-text-disabled-theme-dark !important;
}
}
&.hover, &.active {
background-color: @background-color-black-theme-dark !important;
}
} }
} }
} }
@ -1031,7 +1079,7 @@ textarea {
&.active { &.active {
background-color: @color-bi-background-default-theme-dark; background-color: @color-bi-background-default-theme-dark;
} }
&.disabled { &.disabled {
&, &:hover, &:active { &, &:hover, &:active {
background-color: transparent !important; background-color: transparent !important;
@ -1046,6 +1094,9 @@ textarea {
color: @color-bi-text-disabled-theme-dark !important; color: @color-bi-text-disabled-theme-dark !important;
} }
} }
&.active {
background-color: @background-color-black-theme-dark !important;
}
} }
} }
} }
@ -1095,49 +1146,6 @@ textarea {
} }
} }
.bi-theme-dark {
.bi-list-item-select {
&:hover, &.hover {
color: @color-bi-text;
& .bi-input {
color: @color-bi-text;
}
& .bi-textarea {
color: @color-bi-text;
}
.background-color(@color-bi-background-default, 5%);
}
&:active, &.active {
color: @color-bi-text;
& .bi-input {
color: @color-bi-text;
}
& .bi-textarea {
color: @color-bi-text;
}
background-color: @color-bi-background-highlight;
& .bi-high-light {
color: @color-bi-text;
}
}
&.disabled {
&, &:hover, &:active {
background-color: transparent !important;
color: @color-bi-text-disabled-theme-dark !important;
& .bi-input {
color: @color-bi-text-disabled-theme-dark !important;
}
& .bi-textarea {
color: @color-bi-text-disabled-theme-dark !important;
}
& .bi-high-light {
color: @color-bi-text-disabled-theme-dark !important;
}
}
}
}
}
//去掉list-item效果 //去掉list-item效果
.bi-list-item-none { .bi-list-item-none {
&:hover, &.hover { &:hover, &.hover {

4
src/less/lib/constant.less

@ -103,8 +103,8 @@
@border-color-normal-success: #eddea2; @border-color-normal-success: #eddea2;
//split color //split color
@border-color-disabled: #d0d4da; @border-color-disabled: #e8eaed;
@border-color-disabled-theme-dark: #606479; @border-color-disabled-theme-dark: #363e55;
//scroll color //scroll color
@scroll-color: #232e40; @scroll-color: #232e40;

15
webpack/attachments.js

@ -10,6 +10,9 @@ function sync(patterns) {
const fixJs = "./dist/fix/fix.js"; const fixJs = "./dist/fix/fix.js";
const fixIEJs = "./dist/fix/fix.ie.js"; const fixIEJs = "./dist/fix/fix.ie.js";
const fixCompact = "./dist/fix/fix.compact.js";
const fixIECompact = './dist/fix/fix.compact.ie.js';
const workerCompact = './dist/fix/worker.compact.js';
const lodashJs = "src/core/lodash.js"; const lodashJs = "src/core/lodash.js";
const basicAttachmentMap = { const basicAttachmentMap = {
@ -125,7 +128,7 @@ const bundle = [].concat(
basicAttachmentMap.case, basicAttachmentMap.case,
basicAttachmentMap.widget, basicAttachmentMap.widget,
sync(["public/less/app.less", "public/less/**/*.less"]), sync(["public/less/app.less", "public/less/**/*.less"]),
['./dist/fix/fix.compact.js'], [fixCompact, workerCompact],
basicAttachmentMap.router, basicAttachmentMap.router,
sync(["public/js/**/*.js", "public/js/index.js", "i18n/i18n.cn.js"]), sync(["public/js/**/*.js", "public/js/index.js", "i18n/i18n.cn.js"]),
basicAttachmentMap.ts, basicAttachmentMap.ts,
@ -155,7 +158,7 @@ const bundleIE = [].concat(
basicAttachmentMap.case, basicAttachmentMap.case,
basicAttachmentMap.widget, basicAttachmentMap.widget,
sync(["public/less/app.less", "public/less/**/*.less"]), sync(["public/less/app.less", "public/less/**/*.less"]),
['./dist/fix/fix.compact.ie.js'], [fixIECompact, workerCompact],
basicAttachmentMap.router, basicAttachmentMap.router,
sync(["public/js/**/*.js", "public/js/index.js", "i18n/i18n.cn.js"]), sync(["public/js/**/*.js", "public/js/index.js", "i18n/i18n.cn.js"]),
basicAttachmentMap.ts, basicAttachmentMap.ts,
@ -180,7 +183,7 @@ const fineui = [].concat(
basicAttachmentMap.case, basicAttachmentMap.case,
basicAttachmentMap.widget, basicAttachmentMap.widget,
basicAttachmentMap.router, basicAttachmentMap.router,
["./dist/fix/fix.compact.js"], [fixCompact, workerCompact],
basicAttachmentMap.ui, basicAttachmentMap.ui,
basicAttachmentMap.ts, basicAttachmentMap.ts,
); );
@ -193,7 +196,7 @@ const fineuiIE = [].concat(
basicAttachmentMap.case, basicAttachmentMap.case,
basicAttachmentMap.widget, basicAttachmentMap.widget,
basicAttachmentMap.router, basicAttachmentMap.router,
["./dist/fix/fix.compact.ie.js"], [fixIECompact, workerCompact],
basicAttachmentMap.ui, basicAttachmentMap.ui,
basicAttachmentMap.ts, basicAttachmentMap.ts,
); );
@ -236,7 +239,7 @@ const fineuiWithoutJqueryAndPolyfillJs = [].concat(
"!src/case/tree/ztree/**/*.js", "!src/case/tree/ztree/**/*.js",
]), ]),
basicAttachmentMap.widget, basicAttachmentMap.widget,
sync(["dist/fix/fix.compact.js", "ui/js/**/*.js"]), sync([fixCompact, workerCompact, "ui/js/**/*.js"]),
basicAttachmentMap.ts, basicAttachmentMap.ts,
); );
@ -249,7 +252,7 @@ const demo = [].concat(
basicAttachmentMap.case, basicAttachmentMap.case,
basicAttachmentMap.widget, basicAttachmentMap.widget,
sync(["public/less/app.less", "public/less/**/*.less"]), sync(["public/less/app.less", "public/less/**/*.less"]),
['./dist/fix/fix.compact.js'], [fixCompact, workerCompact],
basicAttachmentMap.config, basicAttachmentMap.config,
basicAttachmentMap.ts, basicAttachmentMap.ts,
sync(["demo/less/*.less", "demo/less/**/*.less", "demo/app.js", "demo/js/**/*.js", "demo/config.js"]), sync(["demo/less/*.less", "demo/less/**/*.less", "demo/app.js", "demo/js/**/*.js", "demo/config.js"]),

4
yarn.lock

@ -2482,9 +2482,9 @@ concat-stream@^1.5.0, concat-stream@^1.6.2:
readable-stream "^2.2.2" readable-stream "^2.2.2"
typedarray "^0.0.6" typedarray "^0.0.6"
concat@^1.0.3: concat@1.0.3:
version "1.0.3" version "1.0.3"
resolved "https://registry.yarnpkg.com/concat/-/concat-1.0.3.tgz#40f3353089d65467695cb1886b45edd637d8cca8" resolved "https://registry.npm.taobao.org/concat/download/concat-1.0.3.tgz#40f3353089d65467695cb1886b45edd637d8cca8"
integrity sha1-QPM1MInWVGdpXLGIa0Xt1jfYzKg= integrity sha1-QPM1MInWVGdpXLGIa0Xt1jfYzKg=
dependencies: dependencies:
commander "^2.9.0" commander "^2.9.0"

Loading…
Cancel
Save