Browse Source

Merge pull request #1120 in VISUAL/fineui from ~WINDY/fineui:master to master

* commit 'c5cfb3843504abf72e4773ac0003c418625f585a':
  refactor: 重构numbereditor存值逻辑
  revert: numbereditor修改
  fix: 编写单测发现的问题
  refactor: 换一种搜索方式
  右间距为4
  test: 日期面板控件覆盖率100%
  REPORT-21332 fix: 支持一下默认传value属性
  选色器的trigger图标是否能点击不统一
es6
guy 5 years ago
parent
commit
366fd9c6f4
  1. 4
      Gruntfile.js
  2. 1
      changelog.md
  3. 48
      dist/2.0/fineui.ie.js
  4. 48
      dist/2.0/fineui.js
  5. 2
      dist/base.js
  6. 48
      dist/bundle.ie.js
  7. 48
      dist/bundle.js
  8. 1
      dist/case.js
  9. 48
      dist/fineui.ie.js
  10. 48
      dist/fineui.js
  11. 47
      dist/fineui_without_jquery_polyfill.js
  12. 45
      dist/widget.js
  13. 1
      karma.conf.js
  14. 2
      src/base/single/editor/editor.textarea.js
  15. 1
      src/case/colorchooser/colorchooser.trigger.long.js
  16. 1
      src/component/treevaluechooser/combo.listtreevaluechooser.js
  17. 1
      src/component/treevaluechooser/combo.treevaluechooser.insert.js
  18. 1
      src/component/treevaluechooser/combo.treevaluechooser.js
  19. 1
      src/component/valuechooser/combo.valuechooser.insert.js
  20. 1
      src/component/valuechooser/combo.valuechooser.js
  21. 1
      src/component/valuechooser/pane.valuechooser.js
  22. 143
      src/widget/datepane/__test__/datepane.test.js
  23. 152
      src/widget/datetimepane/__test__/datetimepane.test.js
  24. 2
      src/widget/dynamicdatetime/dynamicdatetime.timeselect.js
  25. 15
      src/widget/multilayerselecttree/multilayerselecttree.trigger.js
  26. 15
      src/widget/multilayersingletree/multilayersingletree.trigger.js
  27. 7
      src/widget/numbereditor/number.editor.js

4
Gruntfile.js

@ -74,10 +74,10 @@ module.exports = function (grunt) {
dest: "dist/case.js" dest: "dist/case.js"
}, },
widgetJs: { widgetJs: {
src: [ src: filterPath([
"src/widget/**/*.js", "src/widget/**/*.js",
"src/component/**/*.js" "src/component/**/*.js"
], ]),
dest: "dist/widget.js" dest: "dist/widget.js"
}, },
routerJs: { routerJs: {

1
changelog.md

@ -1,5 +1,6 @@
# 更新日志 # 更新日志
2.0(2019-08) 2.0(2019-08)
- 修复valueChooser系列不支持value属性的问题
- 更新了若干icon-font的样式 - 更新了若干icon-font的样式
- 修复了单选树同步搜索状态下父节点前可能没有展开符号的问题 - 修复了单选树同步搜索状态下父节点前可能没有展开符号的问题
- 单选树可展示并选中不存在的值 - 单选树可展示并选中不存在的值

48
dist/2.0/fineui.ie.js vendored

@ -47228,7 +47228,7 @@ BI.TextAreaEditor = BI.inherit(BI.Single, {
items: [this.content] items: [this.content]
}, },
left: 4, left: 4,
right: 10, right: 4,
top: 4, top: 4,
bottom: 8 bottom: 8
}] }]
@ -54755,6 +54755,7 @@ BI.LongColorChooserTrigger = BI.inherit(BI.Trigger, {
ref: function (_ref) { ref: function (_ref) {
self.changeIcon = _ref; self.changeIcon = _ref;
}, },
disableSelected: true,
iconCls: "auto-color-icon", iconCls: "auto-color-icon",
width: 24, width: 24,
iconWidth: 16, iconWidth: 16,
@ -66174,7 +66175,7 @@ BI.shortcut("bi.dynamic_date_time_popup", BI.DynamicDateTimePopup);BI.DynamicDat
}, { }, {
eventName: BI.SignEditor.EVENT_CHANGE, eventName: BI.SignEditor.EVENT_CHANGE,
action: function () { action: function () {
var value = self._autoSwitch(this.getLastChangedValue(), BI.DynamicDateTimeSelect.HOUR); var value = self._autoSwitch(this.getValue(), BI.DynamicDateTimeSelect.HOUR);
this.setValue(value); this.setValue(value);
} }
}], }],
@ -69244,11 +69245,16 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, {
_getSearchItems: function(keyword) { _getSearchItems: function(keyword) {
var o = this.options; var o = this.options;
var findingText = BI.Func.getSearchResult(this.nodes, keyword, "text"); // 把数组搜索换成用BI.tree搜索节点, 搜到了就不再往下搜索
var findingValue = o.allowSearchValue ? BI.Func.getSearchResult(this.nodes, keyword, "value") : {find: [], match: []}; var items = [];
var textItems = findingText.find.concat(findingText.match); this.tree.traverse(function (node) {
var valueItems = findingValue.find.concat(findingValue.match); var find = BI.Func.getSearchResult([node.text || (o.allowSearchValue && node.value) || ""], keyword);
return this._fillTreeStructure4Search(BI.uniqBy(textItems.concat(valueItems), "id")); if(find.find.length > 0 || find.match.length > 0) {
items.push(node);
return true;
}
});
return this._fillTreeStructure4Search(items, "id");
}, },
_createJson: function(node, open) { _createJson: function(node, open) {
@ -70415,11 +70421,16 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, {
_getSearchItems: function(keyword) { _getSearchItems: function(keyword) {
var o = this.options; var o = this.options;
var findingText = BI.Func.getSearchResult(this.nodes, keyword, "text"); // 把数组搜索换成用BI.tree搜索节点, 搜到了就不再往下搜索
var findingValue = o.allowSearchValue ? BI.Func.getSearchResult(this.nodes, keyword, "value") : {find: [], match: []}; var items = [];
var textItems = findingText.find.concat(findingText.match); this.tree.traverse(function (node) {
var valueItems = findingValue.find.concat(findingValue.match); var find = BI.Func.getSearchResult([node.text || (o.allowSearchValue && node.value) || ""], keyword);
return this._fillTreeStructure4Search(BI.uniqBy(textItems.concat(valueItems), "id")); if(find.find.length > 0 || find.match.length > 0) {
items.push(node);
return true;
}
});
return this._fillTreeStructure4Search(items, "id");
}, },
_createJson: function(node, open) { _createJson: function(node, open) {
@ -77554,8 +77565,13 @@ BI.NumberEditor = BI.inherit(BI.Widget, {
this.editor.on(BI.TextEditor.EVENT_CHANGE, function () { this.editor.on(BI.TextEditor.EVENT_CHANGE, function () {
self.fireEvent(BI.NumberEditor.EVENT_CHANGE); self.fireEvent(BI.NumberEditor.EVENT_CHANGE);
}); });
this.editor.on(BI.TextEditor.EVENT_CONFIRM, function () { this.editor.on(BI.TextEditor.EVENT_ERROR, function () {
o.value = BI.parseFloat(this.getLastValidValue());
});
this.editor.on(BI.TextEditor.EVENT_VALID, function () {
o.value = BI.parseFloat(this.getValue()); o.value = BI.parseFloat(this.getValue());
});
this.editor.on(BI.TextEditor.EVENT_CONFIRM, function () {
self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); self.fireEvent(BI.NumberEditor.EVENT_CONFIRM);
}); });
this.topBtn = BI.createWidget({ this.topBtn = BI.createWidget({
@ -88538,6 +88554,7 @@ BI.ListTreeValueChooserInsertCombo = BI.inherit(BI.AbstractListTreeValueChooser,
type: "bi.multi_tree_list_combo", type: "bi.multi_tree_list_combo",
element: this, element: this,
text: o.text, text: o.text,
value: o.value,
watermark: o.watermark, watermark: o.watermark,
itemsCreator: BI.bind(this._itemsCreator, this), itemsCreator: BI.bind(this._itemsCreator, this),
valueFormatter: BI.bind(this._valueFormatter, this), valueFormatter: BI.bind(this._valueFormatter, this),
@ -88625,6 +88642,7 @@ BI.TreeValueChooserInsertCombo = BI.inherit(BI.AbstractTreeValueChooser, {
this.combo = BI.createWidget({ this.combo = BI.createWidget({
type: "bi.multi_tree_insert_combo", type: "bi.multi_tree_insert_combo",
text: o.text, text: o.text,
value: o.value,
watermark: o.watermark, watermark: o.watermark,
element: this, element: this,
itemsCreator: BI.bind(this._itemsCreator, this), itemsCreator: BI.bind(this._itemsCreator, this),
@ -88713,6 +88731,7 @@ BI.TreeValueChooserCombo = BI.inherit(BI.AbstractTreeValueChooser, {
this.combo = BI.createWidget({ this.combo = BI.createWidget({
type: "bi.multi_tree_combo", type: "bi.multi_tree_combo",
text: o.text, text: o.text,
value: o.value,
watermark: o.watermark, watermark: o.watermark,
element: this, element: this,
itemsCreator: BI.bind(this._itemsCreator, this), itemsCreator: BI.bind(this._itemsCreator, this),
@ -88943,6 +88962,7 @@ BI.ValueChooserInsertCombo = BI.inherit(BI.AbstractValueChooser, {
type: "bi.multi_select_insert_combo", type: "bi.multi_select_insert_combo",
element: this, element: this,
text: o.text, text: o.text,
value: o.value,
itemsCreator: BI.bind(this._itemsCreator, this), itemsCreator: BI.bind(this._itemsCreator, this),
valueFormatter: BI.bind(this._valueFormatter, this), valueFormatter: BI.bind(this._valueFormatter, this),
width: o.width, width: o.width,
@ -89037,6 +89057,7 @@ BI.ValueChooserCombo = BI.inherit(BI.AbstractValueChooser, {
type: "bi.multi_select_combo", type: "bi.multi_select_combo",
element: this, element: this,
text: o.text, text: o.text,
value: o.value,
itemsCreator: BI.bind(this._itemsCreator, this), itemsCreator: BI.bind(this._itemsCreator, this),
valueFormatter: BI.bind(this._valueFormatter, this), valueFormatter: BI.bind(this._valueFormatter, this),
width: o.width, width: o.width,
@ -89125,6 +89146,7 @@ BI.ValueChooserPane = BI.inherit(BI.AbstractValueChooser, {
this.list = BI.createWidget({ this.list = BI.createWidget({
type: "bi.multi_select_list", type: "bi.multi_select_list",
element: this, element: this,
value: o.value,
itemsCreator: BI.bind(this._itemsCreator, this), itemsCreator: BI.bind(this._itemsCreator, this),
valueFormatter: BI.bind(this._valueFormatter, this) valueFormatter: BI.bind(this._valueFormatter, this)
}); });

48
dist/2.0/fineui.js vendored

@ -47632,7 +47632,7 @@ BI.TextAreaEditor = BI.inherit(BI.Single, {
items: [this.content] items: [this.content]
}, },
left: 4, left: 4,
right: 10, right: 4,
top: 4, top: 4,
bottom: 8 bottom: 8
}] }]
@ -55159,6 +55159,7 @@ BI.LongColorChooserTrigger = BI.inherit(BI.Trigger, {
ref: function (_ref) { ref: function (_ref) {
self.changeIcon = _ref; self.changeIcon = _ref;
}, },
disableSelected: true,
iconCls: "auto-color-icon", iconCls: "auto-color-icon",
width: 24, width: 24,
iconWidth: 16, iconWidth: 16,
@ -66578,7 +66579,7 @@ BI.shortcut("bi.dynamic_date_time_popup", BI.DynamicDateTimePopup);BI.DynamicDat
}, { }, {
eventName: BI.SignEditor.EVENT_CHANGE, eventName: BI.SignEditor.EVENT_CHANGE,
action: function () { action: function () {
var value = self._autoSwitch(this.getLastChangedValue(), BI.DynamicDateTimeSelect.HOUR); var value = self._autoSwitch(this.getValue(), BI.DynamicDateTimeSelect.HOUR);
this.setValue(value); this.setValue(value);
} }
}], }],
@ -69648,11 +69649,16 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, {
_getSearchItems: function(keyword) { _getSearchItems: function(keyword) {
var o = this.options; var o = this.options;
var findingText = BI.Func.getSearchResult(this.nodes, keyword, "text"); // 把数组搜索换成用BI.tree搜索节点, 搜到了就不再往下搜索
var findingValue = o.allowSearchValue ? BI.Func.getSearchResult(this.nodes, keyword, "value") : {find: [], match: []}; var items = [];
var textItems = findingText.find.concat(findingText.match); this.tree.traverse(function (node) {
var valueItems = findingValue.find.concat(findingValue.match); var find = BI.Func.getSearchResult([node.text || (o.allowSearchValue && node.value) || ""], keyword);
return this._fillTreeStructure4Search(BI.uniqBy(textItems.concat(valueItems), "id")); if(find.find.length > 0 || find.match.length > 0) {
items.push(node);
return true;
}
});
return this._fillTreeStructure4Search(items, "id");
}, },
_createJson: function(node, open) { _createJson: function(node, open) {
@ -70819,11 +70825,16 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, {
_getSearchItems: function(keyword) { _getSearchItems: function(keyword) {
var o = this.options; var o = this.options;
var findingText = BI.Func.getSearchResult(this.nodes, keyword, "text"); // 把数组搜索换成用BI.tree搜索节点, 搜到了就不再往下搜索
var findingValue = o.allowSearchValue ? BI.Func.getSearchResult(this.nodes, keyword, "value") : {find: [], match: []}; var items = [];
var textItems = findingText.find.concat(findingText.match); this.tree.traverse(function (node) {
var valueItems = findingValue.find.concat(findingValue.match); var find = BI.Func.getSearchResult([node.text || (o.allowSearchValue && node.value) || ""], keyword);
return this._fillTreeStructure4Search(BI.uniqBy(textItems.concat(valueItems), "id")); if(find.find.length > 0 || find.match.length > 0) {
items.push(node);
return true;
}
});
return this._fillTreeStructure4Search(items, "id");
}, },
_createJson: function(node, open) { _createJson: function(node, open) {
@ -77958,8 +77969,13 @@ BI.NumberEditor = BI.inherit(BI.Widget, {
this.editor.on(BI.TextEditor.EVENT_CHANGE, function () { this.editor.on(BI.TextEditor.EVENT_CHANGE, function () {
self.fireEvent(BI.NumberEditor.EVENT_CHANGE); self.fireEvent(BI.NumberEditor.EVENT_CHANGE);
}); });
this.editor.on(BI.TextEditor.EVENT_CONFIRM, function () { this.editor.on(BI.TextEditor.EVENT_ERROR, function () {
o.value = BI.parseFloat(this.getLastValidValue());
});
this.editor.on(BI.TextEditor.EVENT_VALID, function () {
o.value = BI.parseFloat(this.getValue()); o.value = BI.parseFloat(this.getValue());
});
this.editor.on(BI.TextEditor.EVENT_CONFIRM, function () {
self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); self.fireEvent(BI.NumberEditor.EVENT_CONFIRM);
}); });
this.topBtn = BI.createWidget({ this.topBtn = BI.createWidget({
@ -88942,6 +88958,7 @@ BI.ListTreeValueChooserInsertCombo = BI.inherit(BI.AbstractListTreeValueChooser,
type: "bi.multi_tree_list_combo", type: "bi.multi_tree_list_combo",
element: this, element: this,
text: o.text, text: o.text,
value: o.value,
watermark: o.watermark, watermark: o.watermark,
itemsCreator: BI.bind(this._itemsCreator, this), itemsCreator: BI.bind(this._itemsCreator, this),
valueFormatter: BI.bind(this._valueFormatter, this), valueFormatter: BI.bind(this._valueFormatter, this),
@ -89029,6 +89046,7 @@ BI.TreeValueChooserInsertCombo = BI.inherit(BI.AbstractTreeValueChooser, {
this.combo = BI.createWidget({ this.combo = BI.createWidget({
type: "bi.multi_tree_insert_combo", type: "bi.multi_tree_insert_combo",
text: o.text, text: o.text,
value: o.value,
watermark: o.watermark, watermark: o.watermark,
element: this, element: this,
itemsCreator: BI.bind(this._itemsCreator, this), itemsCreator: BI.bind(this._itemsCreator, this),
@ -89117,6 +89135,7 @@ BI.TreeValueChooserCombo = BI.inherit(BI.AbstractTreeValueChooser, {
this.combo = BI.createWidget({ this.combo = BI.createWidget({
type: "bi.multi_tree_combo", type: "bi.multi_tree_combo",
text: o.text, text: o.text,
value: o.value,
watermark: o.watermark, watermark: o.watermark,
element: this, element: this,
itemsCreator: BI.bind(this._itemsCreator, this), itemsCreator: BI.bind(this._itemsCreator, this),
@ -89347,6 +89366,7 @@ BI.ValueChooserInsertCombo = BI.inherit(BI.AbstractValueChooser, {
type: "bi.multi_select_insert_combo", type: "bi.multi_select_insert_combo",
element: this, element: this,
text: o.text, text: o.text,
value: o.value,
itemsCreator: BI.bind(this._itemsCreator, this), itemsCreator: BI.bind(this._itemsCreator, this),
valueFormatter: BI.bind(this._valueFormatter, this), valueFormatter: BI.bind(this._valueFormatter, this),
width: o.width, width: o.width,
@ -89441,6 +89461,7 @@ BI.ValueChooserCombo = BI.inherit(BI.AbstractValueChooser, {
type: "bi.multi_select_combo", type: "bi.multi_select_combo",
element: this, element: this,
text: o.text, text: o.text,
value: o.value,
itemsCreator: BI.bind(this._itemsCreator, this), itemsCreator: BI.bind(this._itemsCreator, this),
valueFormatter: BI.bind(this._valueFormatter, this), valueFormatter: BI.bind(this._valueFormatter, this),
width: o.width, width: o.width,
@ -89529,6 +89550,7 @@ BI.ValueChooserPane = BI.inherit(BI.AbstractValueChooser, {
this.list = BI.createWidget({ this.list = BI.createWidget({
type: "bi.multi_select_list", type: "bi.multi_select_list",
element: this, element: this,
value: o.value,
itemsCreator: BI.bind(this._itemsCreator, this), itemsCreator: BI.bind(this._itemsCreator, this),
valueFormatter: BI.bind(this._valueFormatter, this) valueFormatter: BI.bind(this._valueFormatter, this)
}); });

2
dist/base.js vendored

@ -9359,7 +9359,7 @@ BI.TextAreaEditor = BI.inherit(BI.Single, {
items: [this.content] items: [this.content]
}, },
left: 4, left: 4,
right: 10, right: 4,
top: 4, top: 4,
bottom: 8 bottom: 8
}] }]

48
dist/bundle.ie.js vendored

@ -47228,7 +47228,7 @@ BI.TextAreaEditor = BI.inherit(BI.Single, {
items: [this.content] items: [this.content]
}, },
left: 4, left: 4,
right: 10, right: 4,
top: 4, top: 4,
bottom: 8 bottom: 8
}] }]
@ -54755,6 +54755,7 @@ BI.LongColorChooserTrigger = BI.inherit(BI.Trigger, {
ref: function (_ref) { ref: function (_ref) {
self.changeIcon = _ref; self.changeIcon = _ref;
}, },
disableSelected: true,
iconCls: "auto-color-icon", iconCls: "auto-color-icon",
width: 24, width: 24,
iconWidth: 16, iconWidth: 16,
@ -66174,7 +66175,7 @@ BI.shortcut("bi.dynamic_date_time_popup", BI.DynamicDateTimePopup);BI.DynamicDat
}, { }, {
eventName: BI.SignEditor.EVENT_CHANGE, eventName: BI.SignEditor.EVENT_CHANGE,
action: function () { action: function () {
var value = self._autoSwitch(this.getLastChangedValue(), BI.DynamicDateTimeSelect.HOUR); var value = self._autoSwitch(this.getValue(), BI.DynamicDateTimeSelect.HOUR);
this.setValue(value); this.setValue(value);
} }
}], }],
@ -69244,11 +69245,16 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, {
_getSearchItems: function(keyword) { _getSearchItems: function(keyword) {
var o = this.options; var o = this.options;
var findingText = BI.Func.getSearchResult(this.nodes, keyword, "text"); // 把数组搜索换成用BI.tree搜索节点, 搜到了就不再往下搜索
var findingValue = o.allowSearchValue ? BI.Func.getSearchResult(this.nodes, keyword, "value") : {find: [], match: []}; var items = [];
var textItems = findingText.find.concat(findingText.match); this.tree.traverse(function (node) {
var valueItems = findingValue.find.concat(findingValue.match); var find = BI.Func.getSearchResult([node.text || (o.allowSearchValue && node.value) || ""], keyword);
return this._fillTreeStructure4Search(BI.uniqBy(textItems.concat(valueItems), "id")); if(find.find.length > 0 || find.match.length > 0) {
items.push(node);
return true;
}
});
return this._fillTreeStructure4Search(items, "id");
}, },
_createJson: function(node, open) { _createJson: function(node, open) {
@ -70415,11 +70421,16 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, {
_getSearchItems: function(keyword) { _getSearchItems: function(keyword) {
var o = this.options; var o = this.options;
var findingText = BI.Func.getSearchResult(this.nodes, keyword, "text"); // 把数组搜索换成用BI.tree搜索节点, 搜到了就不再往下搜索
var findingValue = o.allowSearchValue ? BI.Func.getSearchResult(this.nodes, keyword, "value") : {find: [], match: []}; var items = [];
var textItems = findingText.find.concat(findingText.match); this.tree.traverse(function (node) {
var valueItems = findingValue.find.concat(findingValue.match); var find = BI.Func.getSearchResult([node.text || (o.allowSearchValue && node.value) || ""], keyword);
return this._fillTreeStructure4Search(BI.uniqBy(textItems.concat(valueItems), "id")); if(find.find.length > 0 || find.match.length > 0) {
items.push(node);
return true;
}
});
return this._fillTreeStructure4Search(items, "id");
}, },
_createJson: function(node, open) { _createJson: function(node, open) {
@ -77554,8 +77565,13 @@ BI.NumberEditor = BI.inherit(BI.Widget, {
this.editor.on(BI.TextEditor.EVENT_CHANGE, function () { this.editor.on(BI.TextEditor.EVENT_CHANGE, function () {
self.fireEvent(BI.NumberEditor.EVENT_CHANGE); self.fireEvent(BI.NumberEditor.EVENT_CHANGE);
}); });
this.editor.on(BI.TextEditor.EVENT_CONFIRM, function () { this.editor.on(BI.TextEditor.EVENT_ERROR, function () {
o.value = BI.parseFloat(this.getLastValidValue());
});
this.editor.on(BI.TextEditor.EVENT_VALID, function () {
o.value = BI.parseFloat(this.getValue()); o.value = BI.parseFloat(this.getValue());
});
this.editor.on(BI.TextEditor.EVENT_CONFIRM, function () {
self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); self.fireEvent(BI.NumberEditor.EVENT_CONFIRM);
}); });
this.topBtn = BI.createWidget({ this.topBtn = BI.createWidget({
@ -88538,6 +88554,7 @@ BI.ListTreeValueChooserInsertCombo = BI.inherit(BI.AbstractListTreeValueChooser,
type: "bi.multi_tree_list_combo", type: "bi.multi_tree_list_combo",
element: this, element: this,
text: o.text, text: o.text,
value: o.value,
watermark: o.watermark, watermark: o.watermark,
itemsCreator: BI.bind(this._itemsCreator, this), itemsCreator: BI.bind(this._itemsCreator, this),
valueFormatter: BI.bind(this._valueFormatter, this), valueFormatter: BI.bind(this._valueFormatter, this),
@ -88625,6 +88642,7 @@ BI.TreeValueChooserInsertCombo = BI.inherit(BI.AbstractTreeValueChooser, {
this.combo = BI.createWidget({ this.combo = BI.createWidget({
type: "bi.multi_tree_insert_combo", type: "bi.multi_tree_insert_combo",
text: o.text, text: o.text,
value: o.value,
watermark: o.watermark, watermark: o.watermark,
element: this, element: this,
itemsCreator: BI.bind(this._itemsCreator, this), itemsCreator: BI.bind(this._itemsCreator, this),
@ -88713,6 +88731,7 @@ BI.TreeValueChooserCombo = BI.inherit(BI.AbstractTreeValueChooser, {
this.combo = BI.createWidget({ this.combo = BI.createWidget({
type: "bi.multi_tree_combo", type: "bi.multi_tree_combo",
text: o.text, text: o.text,
value: o.value,
watermark: o.watermark, watermark: o.watermark,
element: this, element: this,
itemsCreator: BI.bind(this._itemsCreator, this), itemsCreator: BI.bind(this._itemsCreator, this),
@ -88943,6 +88962,7 @@ BI.ValueChooserInsertCombo = BI.inherit(BI.AbstractValueChooser, {
type: "bi.multi_select_insert_combo", type: "bi.multi_select_insert_combo",
element: this, element: this,
text: o.text, text: o.text,
value: o.value,
itemsCreator: BI.bind(this._itemsCreator, this), itemsCreator: BI.bind(this._itemsCreator, this),
valueFormatter: BI.bind(this._valueFormatter, this), valueFormatter: BI.bind(this._valueFormatter, this),
width: o.width, width: o.width,
@ -89037,6 +89057,7 @@ BI.ValueChooserCombo = BI.inherit(BI.AbstractValueChooser, {
type: "bi.multi_select_combo", type: "bi.multi_select_combo",
element: this, element: this,
text: o.text, text: o.text,
value: o.value,
itemsCreator: BI.bind(this._itemsCreator, this), itemsCreator: BI.bind(this._itemsCreator, this),
valueFormatter: BI.bind(this._valueFormatter, this), valueFormatter: BI.bind(this._valueFormatter, this),
width: o.width, width: o.width,
@ -89125,6 +89146,7 @@ BI.ValueChooserPane = BI.inherit(BI.AbstractValueChooser, {
this.list = BI.createWidget({ this.list = BI.createWidget({
type: "bi.multi_select_list", type: "bi.multi_select_list",
element: this, element: this,
value: o.value,
itemsCreator: BI.bind(this._itemsCreator, this), itemsCreator: BI.bind(this._itemsCreator, this),
valueFormatter: BI.bind(this._valueFormatter, this) valueFormatter: BI.bind(this._valueFormatter, this)
}); });

48
dist/bundle.js vendored

@ -47632,7 +47632,7 @@ BI.TextAreaEditor = BI.inherit(BI.Single, {
items: [this.content] items: [this.content]
}, },
left: 4, left: 4,
right: 10, right: 4,
top: 4, top: 4,
bottom: 8 bottom: 8
}] }]
@ -55159,6 +55159,7 @@ BI.LongColorChooserTrigger = BI.inherit(BI.Trigger, {
ref: function (_ref) { ref: function (_ref) {
self.changeIcon = _ref; self.changeIcon = _ref;
}, },
disableSelected: true,
iconCls: "auto-color-icon", iconCls: "auto-color-icon",
width: 24, width: 24,
iconWidth: 16, iconWidth: 16,
@ -66578,7 +66579,7 @@ BI.shortcut("bi.dynamic_date_time_popup", BI.DynamicDateTimePopup);BI.DynamicDat
}, { }, {
eventName: BI.SignEditor.EVENT_CHANGE, eventName: BI.SignEditor.EVENT_CHANGE,
action: function () { action: function () {
var value = self._autoSwitch(this.getLastChangedValue(), BI.DynamicDateTimeSelect.HOUR); var value = self._autoSwitch(this.getValue(), BI.DynamicDateTimeSelect.HOUR);
this.setValue(value); this.setValue(value);
} }
}], }],
@ -69648,11 +69649,16 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, {
_getSearchItems: function(keyword) { _getSearchItems: function(keyword) {
var o = this.options; var o = this.options;
var findingText = BI.Func.getSearchResult(this.nodes, keyword, "text"); // 把数组搜索换成用BI.tree搜索节点, 搜到了就不再往下搜索
var findingValue = o.allowSearchValue ? BI.Func.getSearchResult(this.nodes, keyword, "value") : {find: [], match: []}; var items = [];
var textItems = findingText.find.concat(findingText.match); this.tree.traverse(function (node) {
var valueItems = findingValue.find.concat(findingValue.match); var find = BI.Func.getSearchResult([node.text || (o.allowSearchValue && node.value) || ""], keyword);
return this._fillTreeStructure4Search(BI.uniqBy(textItems.concat(valueItems), "id")); if(find.find.length > 0 || find.match.length > 0) {
items.push(node);
return true;
}
});
return this._fillTreeStructure4Search(items, "id");
}, },
_createJson: function(node, open) { _createJson: function(node, open) {
@ -70819,11 +70825,16 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, {
_getSearchItems: function(keyword) { _getSearchItems: function(keyword) {
var o = this.options; var o = this.options;
var findingText = BI.Func.getSearchResult(this.nodes, keyword, "text"); // 把数组搜索换成用BI.tree搜索节点, 搜到了就不再往下搜索
var findingValue = o.allowSearchValue ? BI.Func.getSearchResult(this.nodes, keyword, "value") : {find: [], match: []}; var items = [];
var textItems = findingText.find.concat(findingText.match); this.tree.traverse(function (node) {
var valueItems = findingValue.find.concat(findingValue.match); var find = BI.Func.getSearchResult([node.text || (o.allowSearchValue && node.value) || ""], keyword);
return this._fillTreeStructure4Search(BI.uniqBy(textItems.concat(valueItems), "id")); if(find.find.length > 0 || find.match.length > 0) {
items.push(node);
return true;
}
});
return this._fillTreeStructure4Search(items, "id");
}, },
_createJson: function(node, open) { _createJson: function(node, open) {
@ -77958,8 +77969,13 @@ BI.NumberEditor = BI.inherit(BI.Widget, {
this.editor.on(BI.TextEditor.EVENT_CHANGE, function () { this.editor.on(BI.TextEditor.EVENT_CHANGE, function () {
self.fireEvent(BI.NumberEditor.EVENT_CHANGE); self.fireEvent(BI.NumberEditor.EVENT_CHANGE);
}); });
this.editor.on(BI.TextEditor.EVENT_CONFIRM, function () { this.editor.on(BI.TextEditor.EVENT_ERROR, function () {
o.value = BI.parseFloat(this.getLastValidValue());
});
this.editor.on(BI.TextEditor.EVENT_VALID, function () {
o.value = BI.parseFloat(this.getValue()); o.value = BI.parseFloat(this.getValue());
});
this.editor.on(BI.TextEditor.EVENT_CONFIRM, function () {
self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); self.fireEvent(BI.NumberEditor.EVENT_CONFIRM);
}); });
this.topBtn = BI.createWidget({ this.topBtn = BI.createWidget({
@ -88942,6 +88958,7 @@ BI.ListTreeValueChooserInsertCombo = BI.inherit(BI.AbstractListTreeValueChooser,
type: "bi.multi_tree_list_combo", type: "bi.multi_tree_list_combo",
element: this, element: this,
text: o.text, text: o.text,
value: o.value,
watermark: o.watermark, watermark: o.watermark,
itemsCreator: BI.bind(this._itemsCreator, this), itemsCreator: BI.bind(this._itemsCreator, this),
valueFormatter: BI.bind(this._valueFormatter, this), valueFormatter: BI.bind(this._valueFormatter, this),
@ -89029,6 +89046,7 @@ BI.TreeValueChooserInsertCombo = BI.inherit(BI.AbstractTreeValueChooser, {
this.combo = BI.createWidget({ this.combo = BI.createWidget({
type: "bi.multi_tree_insert_combo", type: "bi.multi_tree_insert_combo",
text: o.text, text: o.text,
value: o.value,
watermark: o.watermark, watermark: o.watermark,
element: this, element: this,
itemsCreator: BI.bind(this._itemsCreator, this), itemsCreator: BI.bind(this._itemsCreator, this),
@ -89117,6 +89135,7 @@ BI.TreeValueChooserCombo = BI.inherit(BI.AbstractTreeValueChooser, {
this.combo = BI.createWidget({ this.combo = BI.createWidget({
type: "bi.multi_tree_combo", type: "bi.multi_tree_combo",
text: o.text, text: o.text,
value: o.value,
watermark: o.watermark, watermark: o.watermark,
element: this, element: this,
itemsCreator: BI.bind(this._itemsCreator, this), itemsCreator: BI.bind(this._itemsCreator, this),
@ -89347,6 +89366,7 @@ BI.ValueChooserInsertCombo = BI.inherit(BI.AbstractValueChooser, {
type: "bi.multi_select_insert_combo", type: "bi.multi_select_insert_combo",
element: this, element: this,
text: o.text, text: o.text,
value: o.value,
itemsCreator: BI.bind(this._itemsCreator, this), itemsCreator: BI.bind(this._itemsCreator, this),
valueFormatter: BI.bind(this._valueFormatter, this), valueFormatter: BI.bind(this._valueFormatter, this),
width: o.width, width: o.width,
@ -89441,6 +89461,7 @@ BI.ValueChooserCombo = BI.inherit(BI.AbstractValueChooser, {
type: "bi.multi_select_combo", type: "bi.multi_select_combo",
element: this, element: this,
text: o.text, text: o.text,
value: o.value,
itemsCreator: BI.bind(this._itemsCreator, this), itemsCreator: BI.bind(this._itemsCreator, this),
valueFormatter: BI.bind(this._valueFormatter, this), valueFormatter: BI.bind(this._valueFormatter, this),
width: o.width, width: o.width,
@ -89529,6 +89550,7 @@ BI.ValueChooserPane = BI.inherit(BI.AbstractValueChooser, {
this.list = BI.createWidget({ this.list = BI.createWidget({
type: "bi.multi_select_list", type: "bi.multi_select_list",
element: this, element: this,
value: o.value,
itemsCreator: BI.bind(this._itemsCreator, this), itemsCreator: BI.bind(this._itemsCreator, this),
valueFormatter: BI.bind(this._valueFormatter, this) valueFormatter: BI.bind(this._valueFormatter, this)
}); });

1
dist/case.js vendored

@ -2731,6 +2731,7 @@ BI.LongColorChooserTrigger = BI.inherit(BI.Trigger, {
ref: function (_ref) { ref: function (_ref) {
self.changeIcon = _ref; self.changeIcon = _ref;
}, },
disableSelected: true,
iconCls: "auto-color-icon", iconCls: "auto-color-icon",
width: 24, width: 24,
iconWidth: 16, iconWidth: 16,

48
dist/fineui.ie.js vendored

@ -47473,7 +47473,7 @@ BI.TextAreaEditor = BI.inherit(BI.Single, {
items: [this.content] items: [this.content]
}, },
left: 4, left: 4,
right: 10, right: 4,
top: 4, top: 4,
bottom: 8 bottom: 8
}] }]
@ -55000,6 +55000,7 @@ BI.LongColorChooserTrigger = BI.inherit(BI.Trigger, {
ref: function (_ref) { ref: function (_ref) {
self.changeIcon = _ref; self.changeIcon = _ref;
}, },
disableSelected: true,
iconCls: "auto-color-icon", iconCls: "auto-color-icon",
width: 24, width: 24,
iconWidth: 16, iconWidth: 16,
@ -66419,7 +66420,7 @@ BI.shortcut("bi.dynamic_date_time_popup", BI.DynamicDateTimePopup);BI.DynamicDat
}, { }, {
eventName: BI.SignEditor.EVENT_CHANGE, eventName: BI.SignEditor.EVENT_CHANGE,
action: function () { action: function () {
var value = self._autoSwitch(this.getLastChangedValue(), BI.DynamicDateTimeSelect.HOUR); var value = self._autoSwitch(this.getValue(), BI.DynamicDateTimeSelect.HOUR);
this.setValue(value); this.setValue(value);
} }
}], }],
@ -69489,11 +69490,16 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, {
_getSearchItems: function(keyword) { _getSearchItems: function(keyword) {
var o = this.options; var o = this.options;
var findingText = BI.Func.getSearchResult(this.nodes, keyword, "text"); // 把数组搜索换成用BI.tree搜索节点, 搜到了就不再往下搜索
var findingValue = o.allowSearchValue ? BI.Func.getSearchResult(this.nodes, keyword, "value") : {find: [], match: []}; var items = [];
var textItems = findingText.find.concat(findingText.match); this.tree.traverse(function (node) {
var valueItems = findingValue.find.concat(findingValue.match); var find = BI.Func.getSearchResult([node.text || (o.allowSearchValue && node.value) || ""], keyword);
return this._fillTreeStructure4Search(BI.uniqBy(textItems.concat(valueItems), "id")); if(find.find.length > 0 || find.match.length > 0) {
items.push(node);
return true;
}
});
return this._fillTreeStructure4Search(items, "id");
}, },
_createJson: function(node, open) { _createJson: function(node, open) {
@ -70660,11 +70666,16 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, {
_getSearchItems: function(keyword) { _getSearchItems: function(keyword) {
var o = this.options; var o = this.options;
var findingText = BI.Func.getSearchResult(this.nodes, keyword, "text"); // 把数组搜索换成用BI.tree搜索节点, 搜到了就不再往下搜索
var findingValue = o.allowSearchValue ? BI.Func.getSearchResult(this.nodes, keyword, "value") : {find: [], match: []}; var items = [];
var textItems = findingText.find.concat(findingText.match); this.tree.traverse(function (node) {
var valueItems = findingValue.find.concat(findingValue.match); var find = BI.Func.getSearchResult([node.text || (o.allowSearchValue && node.value) || ""], keyword);
return this._fillTreeStructure4Search(BI.uniqBy(textItems.concat(valueItems), "id")); if(find.find.length > 0 || find.match.length > 0) {
items.push(node);
return true;
}
});
return this._fillTreeStructure4Search(items, "id");
}, },
_createJson: function(node, open) { _createJson: function(node, open) {
@ -77799,8 +77810,13 @@ BI.NumberEditor = BI.inherit(BI.Widget, {
this.editor.on(BI.TextEditor.EVENT_CHANGE, function () { this.editor.on(BI.TextEditor.EVENT_CHANGE, function () {
self.fireEvent(BI.NumberEditor.EVENT_CHANGE); self.fireEvent(BI.NumberEditor.EVENT_CHANGE);
}); });
this.editor.on(BI.TextEditor.EVENT_CONFIRM, function () { this.editor.on(BI.TextEditor.EVENT_ERROR, function () {
o.value = BI.parseFloat(this.getLastValidValue());
});
this.editor.on(BI.TextEditor.EVENT_VALID, function () {
o.value = BI.parseFloat(this.getValue()); o.value = BI.parseFloat(this.getValue());
});
this.editor.on(BI.TextEditor.EVENT_CONFIRM, function () {
self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); self.fireEvent(BI.NumberEditor.EVENT_CONFIRM);
}); });
this.topBtn = BI.createWidget({ this.topBtn = BI.createWidget({
@ -88783,6 +88799,7 @@ BI.ListTreeValueChooserInsertCombo = BI.inherit(BI.AbstractListTreeValueChooser,
type: "bi.multi_tree_list_combo", type: "bi.multi_tree_list_combo",
element: this, element: this,
text: o.text, text: o.text,
value: o.value,
watermark: o.watermark, watermark: o.watermark,
itemsCreator: BI.bind(this._itemsCreator, this), itemsCreator: BI.bind(this._itemsCreator, this),
valueFormatter: BI.bind(this._valueFormatter, this), valueFormatter: BI.bind(this._valueFormatter, this),
@ -88870,6 +88887,7 @@ BI.TreeValueChooserInsertCombo = BI.inherit(BI.AbstractTreeValueChooser, {
this.combo = BI.createWidget({ this.combo = BI.createWidget({
type: "bi.multi_tree_insert_combo", type: "bi.multi_tree_insert_combo",
text: o.text, text: o.text,
value: o.value,
watermark: o.watermark, watermark: o.watermark,
element: this, element: this,
itemsCreator: BI.bind(this._itemsCreator, this), itemsCreator: BI.bind(this._itemsCreator, this),
@ -88958,6 +88976,7 @@ BI.TreeValueChooserCombo = BI.inherit(BI.AbstractTreeValueChooser, {
this.combo = BI.createWidget({ this.combo = BI.createWidget({
type: "bi.multi_tree_combo", type: "bi.multi_tree_combo",
text: o.text, text: o.text,
value: o.value,
watermark: o.watermark, watermark: o.watermark,
element: this, element: this,
itemsCreator: BI.bind(this._itemsCreator, this), itemsCreator: BI.bind(this._itemsCreator, this),
@ -89188,6 +89207,7 @@ BI.ValueChooserInsertCombo = BI.inherit(BI.AbstractValueChooser, {
type: "bi.multi_select_insert_combo", type: "bi.multi_select_insert_combo",
element: this, element: this,
text: o.text, text: o.text,
value: o.value,
itemsCreator: BI.bind(this._itemsCreator, this), itemsCreator: BI.bind(this._itemsCreator, this),
valueFormatter: BI.bind(this._valueFormatter, this), valueFormatter: BI.bind(this._valueFormatter, this),
width: o.width, width: o.width,
@ -89282,6 +89302,7 @@ BI.ValueChooserCombo = BI.inherit(BI.AbstractValueChooser, {
type: "bi.multi_select_combo", type: "bi.multi_select_combo",
element: this, element: this,
text: o.text, text: o.text,
value: o.value,
itemsCreator: BI.bind(this._itemsCreator, this), itemsCreator: BI.bind(this._itemsCreator, this),
valueFormatter: BI.bind(this._valueFormatter, this), valueFormatter: BI.bind(this._valueFormatter, this),
width: o.width, width: o.width,
@ -89370,6 +89391,7 @@ BI.ValueChooserPane = BI.inherit(BI.AbstractValueChooser, {
this.list = BI.createWidget({ this.list = BI.createWidget({
type: "bi.multi_select_list", type: "bi.multi_select_list",
element: this, element: this,
value: o.value,
itemsCreator: BI.bind(this._itemsCreator, this), itemsCreator: BI.bind(this._itemsCreator, this),
valueFormatter: BI.bind(this._valueFormatter, this) valueFormatter: BI.bind(this._valueFormatter, this)
}); });

48
dist/fineui.js vendored

@ -47877,7 +47877,7 @@ BI.TextAreaEditor = BI.inherit(BI.Single, {
items: [this.content] items: [this.content]
}, },
left: 4, left: 4,
right: 10, right: 4,
top: 4, top: 4,
bottom: 8 bottom: 8
}] }]
@ -55404,6 +55404,7 @@ BI.LongColorChooserTrigger = BI.inherit(BI.Trigger, {
ref: function (_ref) { ref: function (_ref) {
self.changeIcon = _ref; self.changeIcon = _ref;
}, },
disableSelected: true,
iconCls: "auto-color-icon", iconCls: "auto-color-icon",
width: 24, width: 24,
iconWidth: 16, iconWidth: 16,
@ -66823,7 +66824,7 @@ BI.shortcut("bi.dynamic_date_time_popup", BI.DynamicDateTimePopup);BI.DynamicDat
}, { }, {
eventName: BI.SignEditor.EVENT_CHANGE, eventName: BI.SignEditor.EVENT_CHANGE,
action: function () { action: function () {
var value = self._autoSwitch(this.getLastChangedValue(), BI.DynamicDateTimeSelect.HOUR); var value = self._autoSwitch(this.getValue(), BI.DynamicDateTimeSelect.HOUR);
this.setValue(value); this.setValue(value);
} }
}], }],
@ -69893,11 +69894,16 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, {
_getSearchItems: function(keyword) { _getSearchItems: function(keyword) {
var o = this.options; var o = this.options;
var findingText = BI.Func.getSearchResult(this.nodes, keyword, "text"); // 把数组搜索换成用BI.tree搜索节点, 搜到了就不再往下搜索
var findingValue = o.allowSearchValue ? BI.Func.getSearchResult(this.nodes, keyword, "value") : {find: [], match: []}; var items = [];
var textItems = findingText.find.concat(findingText.match); this.tree.traverse(function (node) {
var valueItems = findingValue.find.concat(findingValue.match); var find = BI.Func.getSearchResult([node.text || (o.allowSearchValue && node.value) || ""], keyword);
return this._fillTreeStructure4Search(BI.uniqBy(textItems.concat(valueItems), "id")); if(find.find.length > 0 || find.match.length > 0) {
items.push(node);
return true;
}
});
return this._fillTreeStructure4Search(items, "id");
}, },
_createJson: function(node, open) { _createJson: function(node, open) {
@ -71064,11 +71070,16 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, {
_getSearchItems: function(keyword) { _getSearchItems: function(keyword) {
var o = this.options; var o = this.options;
var findingText = BI.Func.getSearchResult(this.nodes, keyword, "text"); // 把数组搜索换成用BI.tree搜索节点, 搜到了就不再往下搜索
var findingValue = o.allowSearchValue ? BI.Func.getSearchResult(this.nodes, keyword, "value") : {find: [], match: []}; var items = [];
var textItems = findingText.find.concat(findingText.match); this.tree.traverse(function (node) {
var valueItems = findingValue.find.concat(findingValue.match); var find = BI.Func.getSearchResult([node.text || (o.allowSearchValue && node.value) || ""], keyword);
return this._fillTreeStructure4Search(BI.uniqBy(textItems.concat(valueItems), "id")); if(find.find.length > 0 || find.match.length > 0) {
items.push(node);
return true;
}
});
return this._fillTreeStructure4Search(items, "id");
}, },
_createJson: function(node, open) { _createJson: function(node, open) {
@ -78203,8 +78214,13 @@ BI.NumberEditor = BI.inherit(BI.Widget, {
this.editor.on(BI.TextEditor.EVENT_CHANGE, function () { this.editor.on(BI.TextEditor.EVENT_CHANGE, function () {
self.fireEvent(BI.NumberEditor.EVENT_CHANGE); self.fireEvent(BI.NumberEditor.EVENT_CHANGE);
}); });
this.editor.on(BI.TextEditor.EVENT_CONFIRM, function () { this.editor.on(BI.TextEditor.EVENT_ERROR, function () {
o.value = BI.parseFloat(this.getLastValidValue());
});
this.editor.on(BI.TextEditor.EVENT_VALID, function () {
o.value = BI.parseFloat(this.getValue()); o.value = BI.parseFloat(this.getValue());
});
this.editor.on(BI.TextEditor.EVENT_CONFIRM, function () {
self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); self.fireEvent(BI.NumberEditor.EVENT_CONFIRM);
}); });
this.topBtn = BI.createWidget({ this.topBtn = BI.createWidget({
@ -89187,6 +89203,7 @@ BI.ListTreeValueChooserInsertCombo = BI.inherit(BI.AbstractListTreeValueChooser,
type: "bi.multi_tree_list_combo", type: "bi.multi_tree_list_combo",
element: this, element: this,
text: o.text, text: o.text,
value: o.value,
watermark: o.watermark, watermark: o.watermark,
itemsCreator: BI.bind(this._itemsCreator, this), itemsCreator: BI.bind(this._itemsCreator, this),
valueFormatter: BI.bind(this._valueFormatter, this), valueFormatter: BI.bind(this._valueFormatter, this),
@ -89274,6 +89291,7 @@ BI.TreeValueChooserInsertCombo = BI.inherit(BI.AbstractTreeValueChooser, {
this.combo = BI.createWidget({ this.combo = BI.createWidget({
type: "bi.multi_tree_insert_combo", type: "bi.multi_tree_insert_combo",
text: o.text, text: o.text,
value: o.value,
watermark: o.watermark, watermark: o.watermark,
element: this, element: this,
itemsCreator: BI.bind(this._itemsCreator, this), itemsCreator: BI.bind(this._itemsCreator, this),
@ -89362,6 +89380,7 @@ BI.TreeValueChooserCombo = BI.inherit(BI.AbstractTreeValueChooser, {
this.combo = BI.createWidget({ this.combo = BI.createWidget({
type: "bi.multi_tree_combo", type: "bi.multi_tree_combo",
text: o.text, text: o.text,
value: o.value,
watermark: o.watermark, watermark: o.watermark,
element: this, element: this,
itemsCreator: BI.bind(this._itemsCreator, this), itemsCreator: BI.bind(this._itemsCreator, this),
@ -89592,6 +89611,7 @@ BI.ValueChooserInsertCombo = BI.inherit(BI.AbstractValueChooser, {
type: "bi.multi_select_insert_combo", type: "bi.multi_select_insert_combo",
element: this, element: this,
text: o.text, text: o.text,
value: o.value,
itemsCreator: BI.bind(this._itemsCreator, this), itemsCreator: BI.bind(this._itemsCreator, this),
valueFormatter: BI.bind(this._valueFormatter, this), valueFormatter: BI.bind(this._valueFormatter, this),
width: o.width, width: o.width,
@ -89686,6 +89706,7 @@ BI.ValueChooserCombo = BI.inherit(BI.AbstractValueChooser, {
type: "bi.multi_select_combo", type: "bi.multi_select_combo",
element: this, element: this,
text: o.text, text: o.text,
value: o.value,
itemsCreator: BI.bind(this._itemsCreator, this), itemsCreator: BI.bind(this._itemsCreator, this),
valueFormatter: BI.bind(this._valueFormatter, this), valueFormatter: BI.bind(this._valueFormatter, this),
width: o.width, width: o.width,
@ -89774,6 +89795,7 @@ BI.ValueChooserPane = BI.inherit(BI.AbstractValueChooser, {
this.list = BI.createWidget({ this.list = BI.createWidget({
type: "bi.multi_select_list", type: "bi.multi_select_list",
element: this, element: this,
value: o.value,
itemsCreator: BI.bind(this._itemsCreator, this), itemsCreator: BI.bind(this._itemsCreator, this),
valueFormatter: BI.bind(this._valueFormatter, this) valueFormatter: BI.bind(this._valueFormatter, this)
}); });

47
dist/fineui_without_jquery_polyfill.js vendored

@ -34991,7 +34991,7 @@ BI.TextAreaEditor = BI.inherit(BI.Single, {
items: [this.content] items: [this.content]
}, },
left: 4, left: 4,
right: 10, right: 4,
top: 4, top: 4,
bottom: 8 bottom: 8
}] }]
@ -49123,7 +49123,7 @@ BI.shortcut("bi.dynamic_date_time_popup", BI.DynamicDateTimePopup);BI.DynamicDat
}, { }, {
eventName: BI.SignEditor.EVENT_CHANGE, eventName: BI.SignEditor.EVENT_CHANGE,
action: function () { action: function () {
var value = self._autoSwitch(this.getLastChangedValue(), BI.DynamicDateTimeSelect.HOUR); var value = self._autoSwitch(this.getValue(), BI.DynamicDateTimeSelect.HOUR);
this.setValue(value); this.setValue(value);
} }
}], }],
@ -52193,11 +52193,16 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, {
_getSearchItems: function(keyword) { _getSearchItems: function(keyword) {
var o = this.options; var o = this.options;
var findingText = BI.Func.getSearchResult(this.nodes, keyword, "text"); // 把数组搜索换成用BI.tree搜索节点, 搜到了就不再往下搜索
var findingValue = o.allowSearchValue ? BI.Func.getSearchResult(this.nodes, keyword, "value") : {find: [], match: []}; var items = [];
var textItems = findingText.find.concat(findingText.match); this.tree.traverse(function (node) {
var valueItems = findingValue.find.concat(findingValue.match); var find = BI.Func.getSearchResult([node.text || (o.allowSearchValue && node.value) || ""], keyword);
return this._fillTreeStructure4Search(BI.uniqBy(textItems.concat(valueItems), "id")); if(find.find.length > 0 || find.match.length > 0) {
items.push(node);
return true;
}
});
return this._fillTreeStructure4Search(items, "id");
}, },
_createJson: function(node, open) { _createJson: function(node, open) {
@ -53364,11 +53369,16 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, {
_getSearchItems: function(keyword) { _getSearchItems: function(keyword) {
var o = this.options; var o = this.options;
var findingText = BI.Func.getSearchResult(this.nodes, keyword, "text"); // 把数组搜索换成用BI.tree搜索节点, 搜到了就不再往下搜索
var findingValue = o.allowSearchValue ? BI.Func.getSearchResult(this.nodes, keyword, "value") : {find: [], match: []}; var items = [];
var textItems = findingText.find.concat(findingText.match); this.tree.traverse(function (node) {
var valueItems = findingValue.find.concat(findingValue.match); var find = BI.Func.getSearchResult([node.text || (o.allowSearchValue && node.value) || ""], keyword);
return this._fillTreeStructure4Search(BI.uniqBy(textItems.concat(valueItems), "id")); if(find.find.length > 0 || find.match.length > 0) {
items.push(node);
return true;
}
});
return this._fillTreeStructure4Search(items, "id");
}, },
_createJson: function(node, open) { _createJson: function(node, open) {
@ -60503,8 +60513,13 @@ BI.NumberEditor = BI.inherit(BI.Widget, {
this.editor.on(BI.TextEditor.EVENT_CHANGE, function () { this.editor.on(BI.TextEditor.EVENT_CHANGE, function () {
self.fireEvent(BI.NumberEditor.EVENT_CHANGE); self.fireEvent(BI.NumberEditor.EVENT_CHANGE);
}); });
this.editor.on(BI.TextEditor.EVENT_CONFIRM, function () { this.editor.on(BI.TextEditor.EVENT_ERROR, function () {
o.value = BI.parseFloat(this.getLastValidValue());
});
this.editor.on(BI.TextEditor.EVENT_VALID, function () {
o.value = BI.parseFloat(this.getValue()); o.value = BI.parseFloat(this.getValue());
});
this.editor.on(BI.TextEditor.EVENT_CONFIRM, function () {
self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); self.fireEvent(BI.NumberEditor.EVENT_CONFIRM);
}); });
this.topBtn = BI.createWidget({ this.topBtn = BI.createWidget({
@ -71487,6 +71502,7 @@ BI.ListTreeValueChooserInsertCombo = BI.inherit(BI.AbstractListTreeValueChooser,
type: "bi.multi_tree_list_combo", type: "bi.multi_tree_list_combo",
element: this, element: this,
text: o.text, text: o.text,
value: o.value,
watermark: o.watermark, watermark: o.watermark,
itemsCreator: BI.bind(this._itemsCreator, this), itemsCreator: BI.bind(this._itemsCreator, this),
valueFormatter: BI.bind(this._valueFormatter, this), valueFormatter: BI.bind(this._valueFormatter, this),
@ -71574,6 +71590,7 @@ BI.TreeValueChooserInsertCombo = BI.inherit(BI.AbstractTreeValueChooser, {
this.combo = BI.createWidget({ this.combo = BI.createWidget({
type: "bi.multi_tree_insert_combo", type: "bi.multi_tree_insert_combo",
text: o.text, text: o.text,
value: o.value,
watermark: o.watermark, watermark: o.watermark,
element: this, element: this,
itemsCreator: BI.bind(this._itemsCreator, this), itemsCreator: BI.bind(this._itemsCreator, this),
@ -71662,6 +71679,7 @@ BI.TreeValueChooserCombo = BI.inherit(BI.AbstractTreeValueChooser, {
this.combo = BI.createWidget({ this.combo = BI.createWidget({
type: "bi.multi_tree_combo", type: "bi.multi_tree_combo",
text: o.text, text: o.text,
value: o.value,
watermark: o.watermark, watermark: o.watermark,
element: this, element: this,
itemsCreator: BI.bind(this._itemsCreator, this), itemsCreator: BI.bind(this._itemsCreator, this),
@ -71892,6 +71910,7 @@ BI.ValueChooserInsertCombo = BI.inherit(BI.AbstractValueChooser, {
type: "bi.multi_select_insert_combo", type: "bi.multi_select_insert_combo",
element: this, element: this,
text: o.text, text: o.text,
value: o.value,
itemsCreator: BI.bind(this._itemsCreator, this), itemsCreator: BI.bind(this._itemsCreator, this),
valueFormatter: BI.bind(this._valueFormatter, this), valueFormatter: BI.bind(this._valueFormatter, this),
width: o.width, width: o.width,
@ -71986,6 +72005,7 @@ BI.ValueChooserCombo = BI.inherit(BI.AbstractValueChooser, {
type: "bi.multi_select_combo", type: "bi.multi_select_combo",
element: this, element: this,
text: o.text, text: o.text,
value: o.value,
itemsCreator: BI.bind(this._itemsCreator, this), itemsCreator: BI.bind(this._itemsCreator, this),
valueFormatter: BI.bind(this._valueFormatter, this), valueFormatter: BI.bind(this._valueFormatter, this),
width: o.width, width: o.width,
@ -72074,6 +72094,7 @@ BI.ValueChooserPane = BI.inherit(BI.AbstractValueChooser, {
this.list = BI.createWidget({ this.list = BI.createWidget({
type: "bi.multi_select_list", type: "bi.multi_select_list",
element: this, element: this,
value: o.value,
itemsCreator: BI.bind(this._itemsCreator, this), itemsCreator: BI.bind(this._itemsCreator, this),
valueFormatter: BI.bind(this._valueFormatter, this) valueFormatter: BI.bind(this._valueFormatter, this)
}); });

45
dist/widget.js vendored

@ -4233,7 +4233,7 @@ BI.shortcut("bi.dynamic_date_time_popup", BI.DynamicDateTimePopup);BI.DynamicDat
}, { }, {
eventName: BI.SignEditor.EVENT_CHANGE, eventName: BI.SignEditor.EVENT_CHANGE,
action: function () { action: function () {
var value = self._autoSwitch(this.getLastChangedValue(), BI.DynamicDateTimeSelect.HOUR); var value = self._autoSwitch(this.getValue(), BI.DynamicDateTimeSelect.HOUR);
this.setValue(value); this.setValue(value);
} }
}], }],
@ -7303,11 +7303,16 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, {
_getSearchItems: function(keyword) { _getSearchItems: function(keyword) {
var o = this.options; var o = this.options;
var findingText = BI.Func.getSearchResult(this.nodes, keyword, "text"); // 把数组搜索换成用BI.tree搜索节点, 搜到了就不再往下搜索
var findingValue = o.allowSearchValue ? BI.Func.getSearchResult(this.nodes, keyword, "value") : {find: [], match: []}; var items = [];
var textItems = findingText.find.concat(findingText.match); this.tree.traverse(function (node) {
var valueItems = findingValue.find.concat(findingValue.match); var find = BI.Func.getSearchResult([node.text || (o.allowSearchValue && node.value) || ""], keyword);
return this._fillTreeStructure4Search(BI.uniqBy(textItems.concat(valueItems), "id")); if(find.find.length > 0 || find.match.length > 0) {
items.push(node);
return true;
}
});
return this._fillTreeStructure4Search(items, "id");
}, },
_createJson: function(node, open) { _createJson: function(node, open) {
@ -8474,11 +8479,16 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, {
_getSearchItems: function(keyword) { _getSearchItems: function(keyword) {
var o = this.options; var o = this.options;
var findingText = BI.Func.getSearchResult(this.nodes, keyword, "text"); // 把数组搜索换成用BI.tree搜索节点, 搜到了就不再往下搜索
var findingValue = o.allowSearchValue ? BI.Func.getSearchResult(this.nodes, keyword, "value") : {find: [], match: []}; var items = [];
var textItems = findingText.find.concat(findingText.match); this.tree.traverse(function (node) {
var valueItems = findingValue.find.concat(findingValue.match); var find = BI.Func.getSearchResult([node.text || (o.allowSearchValue && node.value) || ""], keyword);
return this._fillTreeStructure4Search(BI.uniqBy(textItems.concat(valueItems), "id")); if(find.find.length > 0 || find.match.length > 0) {
items.push(node);
return true;
}
});
return this._fillTreeStructure4Search(items, "id");
}, },
_createJson: function(node, open) { _createJson: function(node, open) {
@ -15613,8 +15623,13 @@ BI.NumberEditor = BI.inherit(BI.Widget, {
this.editor.on(BI.TextEditor.EVENT_CHANGE, function () { this.editor.on(BI.TextEditor.EVENT_CHANGE, function () {
self.fireEvent(BI.NumberEditor.EVENT_CHANGE); self.fireEvent(BI.NumberEditor.EVENT_CHANGE);
}); });
this.editor.on(BI.TextEditor.EVENT_CONFIRM, function () { this.editor.on(BI.TextEditor.EVENT_ERROR, function () {
o.value = BI.parseFloat(this.getLastValidValue());
});
this.editor.on(BI.TextEditor.EVENT_VALID, function () {
o.value = BI.parseFloat(this.getValue()); o.value = BI.parseFloat(this.getValue());
});
this.editor.on(BI.TextEditor.EVENT_CONFIRM, function () {
self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); self.fireEvent(BI.NumberEditor.EVENT_CONFIRM);
}); });
this.topBtn = BI.createWidget({ this.topBtn = BI.createWidget({
@ -26597,6 +26612,7 @@ BI.ListTreeValueChooserInsertCombo = BI.inherit(BI.AbstractListTreeValueChooser,
type: "bi.multi_tree_list_combo", type: "bi.multi_tree_list_combo",
element: this, element: this,
text: o.text, text: o.text,
value: o.value,
watermark: o.watermark, watermark: o.watermark,
itemsCreator: BI.bind(this._itemsCreator, this), itemsCreator: BI.bind(this._itemsCreator, this),
valueFormatter: BI.bind(this._valueFormatter, this), valueFormatter: BI.bind(this._valueFormatter, this),
@ -26684,6 +26700,7 @@ BI.TreeValueChooserInsertCombo = BI.inherit(BI.AbstractTreeValueChooser, {
this.combo = BI.createWidget({ this.combo = BI.createWidget({
type: "bi.multi_tree_insert_combo", type: "bi.multi_tree_insert_combo",
text: o.text, text: o.text,
value: o.value,
watermark: o.watermark, watermark: o.watermark,
element: this, element: this,
itemsCreator: BI.bind(this._itemsCreator, this), itemsCreator: BI.bind(this._itemsCreator, this),
@ -26772,6 +26789,7 @@ BI.TreeValueChooserCombo = BI.inherit(BI.AbstractTreeValueChooser, {
this.combo = BI.createWidget({ this.combo = BI.createWidget({
type: "bi.multi_tree_combo", type: "bi.multi_tree_combo",
text: o.text, text: o.text,
value: o.value,
watermark: o.watermark, watermark: o.watermark,
element: this, element: this,
itemsCreator: BI.bind(this._itemsCreator, this), itemsCreator: BI.bind(this._itemsCreator, this),
@ -27002,6 +27020,7 @@ BI.ValueChooserInsertCombo = BI.inherit(BI.AbstractValueChooser, {
type: "bi.multi_select_insert_combo", type: "bi.multi_select_insert_combo",
element: this, element: this,
text: o.text, text: o.text,
value: o.value,
itemsCreator: BI.bind(this._itemsCreator, this), itemsCreator: BI.bind(this._itemsCreator, this),
valueFormatter: BI.bind(this._valueFormatter, this), valueFormatter: BI.bind(this._valueFormatter, this),
width: o.width, width: o.width,
@ -27096,6 +27115,7 @@ BI.ValueChooserCombo = BI.inherit(BI.AbstractValueChooser, {
type: "bi.multi_select_combo", type: "bi.multi_select_combo",
element: this, element: this,
text: o.text, text: o.text,
value: o.value,
itemsCreator: BI.bind(this._itemsCreator, this), itemsCreator: BI.bind(this._itemsCreator, this),
valueFormatter: BI.bind(this._valueFormatter, this), valueFormatter: BI.bind(this._valueFormatter, this),
width: o.width, width: o.width,
@ -27184,6 +27204,7 @@ BI.ValueChooserPane = BI.inherit(BI.AbstractValueChooser, {
this.list = BI.createWidget({ this.list = BI.createWidget({
type: "bi.multi_select_list", type: "bi.multi_select_list",
element: this, element: this,
value: o.value,
itemsCreator: BI.bind(this._itemsCreator, this), itemsCreator: BI.bind(this._itemsCreator, this),
valueFormatter: BI.bind(this._valueFormatter, this) valueFormatter: BI.bind(this._valueFormatter, this)
}); });

1
karma.conf.js

@ -21,6 +21,7 @@ module.exports = function (config) {
"src/core/foundation.js", "src/core/foundation.js",
"src/core/lodash.js", "src/core/lodash.js",
"src/core/base.js", "src/core/base.js",
"i18n/i18n.cn.js",
"src/core/ob.js", "src/core/ob.js",
"src/core/widget.js", "src/core/widget.js",
"src/core/shortcut.js", "src/core/shortcut.js",

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

@ -31,7 +31,7 @@ BI.TextAreaEditor = BI.inherit(BI.Single, {
items: [this.content] items: [this.content]
}, },
left: 4, left: 4,
right: 10, right: 4,
top: 4, top: 4,
bottom: 8 bottom: 8
}] }]

1
src/case/colorchooser/colorchooser.trigger.long.js

@ -26,6 +26,7 @@ BI.LongColorChooserTrigger = BI.inherit(BI.Trigger, {
ref: function (_ref) { ref: function (_ref) {
self.changeIcon = _ref; self.changeIcon = _ref;
}, },
disableSelected: true,
iconCls: "auto-color-icon", iconCls: "auto-color-icon",
width: 24, width: 24,
iconWidth: 16, iconWidth: 16,

1
src/component/treevaluechooser/combo.listtreevaluechooser.js

@ -27,6 +27,7 @@ BI.ListTreeValueChooserInsertCombo = BI.inherit(BI.AbstractListTreeValueChooser,
type: "bi.multi_tree_list_combo", type: "bi.multi_tree_list_combo",
element: this, element: this,
text: o.text, text: o.text,
value: o.value,
watermark: o.watermark, watermark: o.watermark,
itemsCreator: BI.bind(this._itemsCreator, this), itemsCreator: BI.bind(this._itemsCreator, this),
valueFormatter: BI.bind(this._valueFormatter, this), valueFormatter: BI.bind(this._valueFormatter, this),

1
src/component/treevaluechooser/combo.treevaluechooser.insert.js

@ -26,6 +26,7 @@ BI.TreeValueChooserInsertCombo = BI.inherit(BI.AbstractTreeValueChooser, {
this.combo = BI.createWidget({ this.combo = BI.createWidget({
type: "bi.multi_tree_insert_combo", type: "bi.multi_tree_insert_combo",
text: o.text, text: o.text,
value: o.value,
watermark: o.watermark, watermark: o.watermark,
element: this, element: this,
itemsCreator: BI.bind(this._itemsCreator, this), itemsCreator: BI.bind(this._itemsCreator, this),

1
src/component/treevaluechooser/combo.treevaluechooser.js

@ -26,6 +26,7 @@ BI.TreeValueChooserCombo = BI.inherit(BI.AbstractTreeValueChooser, {
this.combo = BI.createWidget({ this.combo = BI.createWidget({
type: "bi.multi_tree_combo", type: "bi.multi_tree_combo",
text: o.text, text: o.text,
value: o.value,
watermark: o.watermark, watermark: o.watermark,
element: this, element: this,
itemsCreator: BI.bind(this._itemsCreator, this), itemsCreator: BI.bind(this._itemsCreator, this),

1
src/component/valuechooser/combo.valuechooser.insert.js

@ -25,6 +25,7 @@ BI.ValueChooserInsertCombo = BI.inherit(BI.AbstractValueChooser, {
type: "bi.multi_select_insert_combo", type: "bi.multi_select_insert_combo",
element: this, element: this,
text: o.text, text: o.text,
value: o.value,
itemsCreator: BI.bind(this._itemsCreator, this), itemsCreator: BI.bind(this._itemsCreator, this),
valueFormatter: BI.bind(this._valueFormatter, this), valueFormatter: BI.bind(this._valueFormatter, this),
width: o.width, width: o.width,

1
src/component/valuechooser/combo.valuechooser.js

@ -29,6 +29,7 @@ BI.ValueChooserCombo = BI.inherit(BI.AbstractValueChooser, {
type: "bi.multi_select_combo", type: "bi.multi_select_combo",
element: this, element: this,
text: o.text, text: o.text,
value: o.value,
itemsCreator: BI.bind(this._itemsCreator, this), itemsCreator: BI.bind(this._itemsCreator, this),
valueFormatter: BI.bind(this._valueFormatter, this), valueFormatter: BI.bind(this._valueFormatter, this),
width: o.width, width: o.width,

1
src/component/valuechooser/pane.valuechooser.js

@ -23,6 +23,7 @@ BI.ValueChooserPane = BI.inherit(BI.AbstractValueChooser, {
this.list = BI.createWidget({ this.list = BI.createWidget({
type: "bi.multi_select_list", type: "bi.multi_select_list",
element: this, element: this,
value: o.value,
itemsCreator: BI.bind(this._itemsCreator, this), itemsCreator: BI.bind(this._itemsCreator, this),
valueFormatter: BI.bind(this._valueFormatter, this) valueFormatter: BI.bind(this._valueFormatter, this)
}); });

143
src/widget/datepane/__test__/datepane.test.js

@ -0,0 +1,143 @@
/**
* @author windy
* @version 2.0
* Created by windy on 2019/9/2
*/
describe("DatePane", function () {
/**
* test_author_windy
*/
it("defaultValue", function () {
var datePane = BI.Test.createWidget({
type: "bi.dynamic_date_pane",
value: {
type: 1,
value: {
year: 2017,
month: 12,
day: 11
}
},
});
expect(datePane.element.find(".bi-year-combo .bi-label").text()).to.equal("2017");
expect(datePane.element.find(".bi-month-combo .bi-label").text()).to.equal("12");
expect(datePane.element.find(".bi-calendar .bi-list-item-select.active .bi-text").text()).to.equal("11");
datePane.destroy();
});
/**
* test_author_windy
*/
it("setStaticValue", function () {
var datePane = BI.Test.createWidget({
type: "bi.dynamic_date_pane",
});
datePane.setValue({
type: 1,
value: {
year: 2017,
month: 12,
day: 11
}
});
expect(datePane.element.find(".bi-year-combo .bi-label").text()).to.equal("2017");
expect(datePane.element.find(".bi-month-combo .bi-label").text()).to.equal("12");
expect(datePane.element.find(".bi-calendar .bi-list-item-select.active .bi-text").text()).to.equal("11");
datePane.destroy();
});
/**
* test_author_windy
*/
it("setDynamicValue", function () {
var datePane = BI.Test.createWidget({
type: "bi.dynamic_date_pane",
});
datePane.setValue({
type: 2,
value: {
year: -1,
month: 1,
quarter: -1,
week: 1,
day: 1
}
});
expect(datePane.element.find(".bi-line-segment-button.active").text()).to.equal("动态时间");
datePane.setValue({
type: 2,
value: {
workDay: 1
}
});
expect(datePane.element.find(".bi-line-segment-button.active").text()).to.equal("动态时间");
datePane.destroy();
});
/**
* test_author_windy
*/
it("getStaticValue", function (done) {
var datePane = BI.Test.createWidget({
type: "bi.dynamic_date_pane",
value: {
type: 1,
value: {
year: 2019,
month: 3,
day: 30
}
}
});
BI.nextTick(function () {
datePane.element.find(".bi-month-combo .bi-date-triangle-trigger").click();
datePane.element.find(".bi-month-combo .bi-list-item-select").get(2).click();
BI.nextTick(function () {
datePane.element.find(".bi-calendar:visible .bi-list-item-select :contains(27)").parent().click();
expect(datePane.getValue()).to.deep.equal({
type: 1,
value: {
year: 2019,
month: 2,
day: 27
}
});
datePane.destroy();
done();
})
});
});
/**
* test_author_windy
*/
it("getDynamicValue", function (done) {
var datePane = BI.Test.createWidget({
type: "bi.dynamic_date_pane",
value: {
type: 2,
value: {}
}
});
BI.nextTick(function () {
// 先点到静态时间再到动态时间
datePane.element.find(".bi-linear-segment .bi-line-segment-button").get(0).click();
datePane.element.find(".bi-linear-segment .bi-line-segment-button").get(1).click();
BI.nextTick(function () {
datePane.element.find(".bi-multi-select-item.active").click();
datePane.element.find(".bi-multi-select-item").click();
expect(datePane.getValue()).to.deep.equal({
type: 2,
value: {
workDay: -0
}
});
datePane.destroy();
done();
})
});
});
});

152
src/widget/datetimepane/__test__/datetimepane.test.js

@ -0,0 +1,152 @@
/**
* @author windy
* @version 2.0
* Created by windy on 2019/9/3
*/
/**
* @author windy
* @version 2.0
* Created by windy on 2019/9/2
*/
describe("DateTimePane", function () {
/**
* test_author_windy
*/
it("defaultValue", function () {
var datePane = BI.Test.createWidget({
type: "bi.dynamic_date_time_pane",
value: {
type: 1,
value: {
year: 2017,
month: 12,
day: 11
}
},
});
expect(datePane.element.find(".bi-year-combo .bi-label").text()).to.equal("2017");
expect(datePane.element.find(".bi-month-combo .bi-label").text()).to.equal("12");
expect(datePane.element.find(".bi-calendar .bi-list-item-select.active .bi-text").text()).to.equal("11");
datePane.destroy();
});
/**
* test_author_windy
*/
it("setStaticValue", function () {
var datePane = BI.Test.createWidget({
type: "bi.dynamic_date_time_pane",
});
datePane.setValue({
type: 1,
value: {
year: 2017,
month: 12,
day: 11
}
});
expect(datePane.element.find(".bi-year-combo .bi-label").text()).to.equal("2017");
expect(datePane.element.find(".bi-month-combo .bi-label").text()).to.equal("12");
expect(datePane.element.find(".bi-calendar .bi-list-item-select.active .bi-text").text()).to.equal("11");
datePane.destroy();
});
/**
* test_author_windy
*/
it("setDynamicValue", function () {
var datePane = BI.Test.createWidget({
type: "bi.dynamic_date_time_pane",
});
datePane.setValue({
type: 2,
value: {
year: -1,
month: 1,
quarter: -1,
week: 1,
day: 1
}
});
expect(datePane.element.find(".bi-line-segment-button.active").text()).to.equal("动态时间");
datePane.setValue({
type: 2,
value: {
workDay: 1
}
});
expect(datePane.element.find(".bi-line-segment-button.active").text()).to.equal("动态时间");
datePane.destroy();
});
/**
* test_author_windy
*/
it("getStaticValue", function (done) {
var datePane = BI.Test.createWidget({
type: "bi.dynamic_date_time_pane",
value: {
type: 1,
value: {
year: 2019,
month: 3,
day: 30
}
}
});
BI.nextTick(function () {
datePane.element.find(".bi-month-combo .bi-date-triangle-trigger").click();
datePane.element.find(".bi-month-combo .bi-list-item-select").get(2).click();
BI.nextTick(function () {
datePane.element.find(".bi-calendar:visible .bi-list-item-select :contains(27)").parent().click();
datePane.element.find(".bi-date-time-select .bi-number-editor .top-button").get(0).click();
expect(datePane.getValue()).to.deep.equal({
type: 1,
value: {
year: 2019,
month: 2,
day: 27,
hour: 1,
minute: 0,
second: 0
}
});
datePane.destroy();
done();
})
});
});
/**
* test_author_windy
*/
it("getDynamicValue", function (done) {
var datePane = BI.Test.createWidget({
type: "bi.dynamic_date_time_pane",
value: {
type: 2,
value: {}
}
});
BI.nextTick(function () {
// 先点到静态时间再到动态时间
datePane.element.find(".bi-linear-segment .bi-line-segment-button").get(0).click();
datePane.element.find(".bi-linear-segment .bi-line-segment-button").get(1).click();
BI.nextTick(function () {
datePane.element.find(".bi-multi-select-item.active").click();
datePane.element.find(".bi-multi-select-item").click();
expect(datePane.getValue()).to.deep.equal({
type: 2,
value: {
workDay: -0
}
});
datePane.destroy();
done();
})
});
});
});

2
src/widget/dynamicdatetime/dynamicdatetime.timeselect.js

@ -36,7 +36,7 @@ BI.DynamicDateTimeSelect = BI.inherit(BI.Widget, {
}, { }, {
eventName: BI.SignEditor.EVENT_CHANGE, eventName: BI.SignEditor.EVENT_CHANGE,
action: function () { action: function () {
var value = self._autoSwitch(this.getLastChangedValue(), BI.DynamicDateTimeSelect.HOUR); var value = self._autoSwitch(this.getValue(), BI.DynamicDateTimeSelect.HOUR);
this.setValue(value); this.setValue(value);
} }
}], }],

15
src/widget/multilayerselecttree/multilayerselecttree.trigger.js

@ -130,11 +130,16 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, {
_getSearchItems: function(keyword) { _getSearchItems: function(keyword) {
var o = this.options; var o = this.options;
var findingText = BI.Func.getSearchResult(this.nodes, keyword, "text"); // 把数组搜索换成用BI.tree搜索节点, 搜到了就不再往下搜索
var findingValue = o.allowSearchValue ? BI.Func.getSearchResult(this.nodes, keyword, "value") : {find: [], match: []}; var items = [];
var textItems = findingText.find.concat(findingText.match); this.tree.traverse(function (node) {
var valueItems = findingValue.find.concat(findingValue.match); var find = BI.Func.getSearchResult([node.text || (o.allowSearchValue && node.value) || ""], keyword);
return this._fillTreeStructure4Search(BI.uniqBy(textItems.concat(valueItems), "id")); if(find.find.length > 0 || find.match.length > 0) {
items.push(node);
return true;
}
});
return this._fillTreeStructure4Search(items, "id");
}, },
_createJson: function(node, open) { _createJson: function(node, open) {

15
src/widget/multilayersingletree/multilayersingletree.trigger.js

@ -130,11 +130,16 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, {
_getSearchItems: function(keyword) { _getSearchItems: function(keyword) {
var o = this.options; var o = this.options;
var findingText = BI.Func.getSearchResult(this.nodes, keyword, "text"); // 把数组搜索换成用BI.tree搜索节点, 搜到了就不再往下搜索
var findingValue = o.allowSearchValue ? BI.Func.getSearchResult(this.nodes, keyword, "value") : {find: [], match: []}; var items = [];
var textItems = findingText.find.concat(findingText.match); this.tree.traverse(function (node) {
var valueItems = findingValue.find.concat(findingValue.match); var find = BI.Func.getSearchResult([node.text || (o.allowSearchValue && node.value) || ""], keyword);
return this._fillTreeStructure4Search(BI.uniqBy(textItems.concat(valueItems), "id")); if(find.find.length > 0 || find.match.length > 0) {
items.push(node);
return true;
}
});
return this._fillTreeStructure4Search(items, "id");
}, },
_createJson: function(node, open) { _createJson: function(node, open) {

7
src/widget/numbereditor/number.editor.js

@ -33,8 +33,13 @@ BI.NumberEditor = BI.inherit(BI.Widget, {
this.editor.on(BI.TextEditor.EVENT_CHANGE, function () { this.editor.on(BI.TextEditor.EVENT_CHANGE, function () {
self.fireEvent(BI.NumberEditor.EVENT_CHANGE); self.fireEvent(BI.NumberEditor.EVENT_CHANGE);
}); });
this.editor.on(BI.TextEditor.EVENT_CONFIRM, function () { this.editor.on(BI.TextEditor.EVENT_ERROR, function () {
o.value = BI.parseFloat(this.getLastValidValue());
});
this.editor.on(BI.TextEditor.EVENT_VALID, function () {
o.value = BI.parseFloat(this.getValue()); o.value = BI.parseFloat(this.getValue());
});
this.editor.on(BI.TextEditor.EVENT_CONFIRM, function () {
self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); self.fireEvent(BI.NumberEditor.EVENT_CONFIRM);
}); });
this.topBtn = BI.createWidget({ this.topBtn = BI.createWidget({

Loading…
Cancel
Save