diff --git a/Gruntfile.js b/Gruntfile.js index d1ea19148..1d2e978d7 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -74,10 +74,10 @@ module.exports = function (grunt) { dest: "dist/case.js" }, widgetJs: { - src: [ + src: filterPath([ "src/widget/**/*.js", "src/component/**/*.js" - ], + ]), dest: "dist/widget.js" }, routerJs: { diff --git a/changelog.md b/changelog.md index 5bc8e600e..0d84d3b1b 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,6 @@ # 更新日志 2.0(2019-08) +- 修复valueChooser系列不支持value属性的问题 - 更新了若干icon-font的样式 - 修复了单选树同步搜索状态下父节点前可能没有展开符号的问题 - 单选树可展示并选中不存在的值 diff --git a/dist/2.0/fineui.ie.js b/dist/2.0/fineui.ie.js index 40cb63121..2167c30fd 100644 --- a/dist/2.0/fineui.ie.js +++ b/dist/2.0/fineui.ie.js @@ -47228,7 +47228,7 @@ BI.TextAreaEditor = BI.inherit(BI.Single, { items: [this.content] }, left: 4, - right: 10, + right: 4, top: 4, bottom: 8 }] @@ -54755,6 +54755,7 @@ BI.LongColorChooserTrigger = BI.inherit(BI.Trigger, { ref: function (_ref) { self.changeIcon = _ref; }, + disableSelected: true, iconCls: "auto-color-icon", width: 24, iconWidth: 16, @@ -66174,7 +66175,7 @@ BI.shortcut("bi.dynamic_date_time_popup", BI.DynamicDateTimePopup);BI.DynamicDat }, { eventName: BI.SignEditor.EVENT_CHANGE, action: function () { - var value = self._autoSwitch(this.getLastChangedValue(), BI.DynamicDateTimeSelect.HOUR); + var value = self._autoSwitch(this.getValue(), BI.DynamicDateTimeSelect.HOUR); this.setValue(value); } }], @@ -69244,11 +69245,16 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, { _getSearchItems: function(keyword) { var o = this.options; - var findingText = BI.Func.getSearchResult(this.nodes, keyword, "text"); - var findingValue = o.allowSearchValue ? BI.Func.getSearchResult(this.nodes, keyword, "value") : {find: [], match: []}; - var textItems = findingText.find.concat(findingText.match); - var valueItems = findingValue.find.concat(findingValue.match); - return this._fillTreeStructure4Search(BI.uniqBy(textItems.concat(valueItems), "id")); + // 把数组搜索换成用BI.tree搜索节点, 搜到了就不再往下搜索 + var items = []; + this.tree.traverse(function (node) { + var find = BI.Func.getSearchResult([node.text || (o.allowSearchValue && node.value) || ""], keyword); + if(find.find.length > 0 || find.match.length > 0) { + items.push(node); + return true; + } + }); + return this._fillTreeStructure4Search(items, "id"); }, _createJson: function(node, open) { @@ -70415,11 +70421,16 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, { _getSearchItems: function(keyword) { var o = this.options; - var findingText = BI.Func.getSearchResult(this.nodes, keyword, "text"); - var findingValue = o.allowSearchValue ? BI.Func.getSearchResult(this.nodes, keyword, "value") : {find: [], match: []}; - var textItems = findingText.find.concat(findingText.match); - var valueItems = findingValue.find.concat(findingValue.match); - return this._fillTreeStructure4Search(BI.uniqBy(textItems.concat(valueItems), "id")); + // 把数组搜索换成用BI.tree搜索节点, 搜到了就不再往下搜索 + var items = []; + this.tree.traverse(function (node) { + var find = BI.Func.getSearchResult([node.text || (o.allowSearchValue && node.value) || ""], keyword); + if(find.find.length > 0 || find.match.length > 0) { + items.push(node); + return true; + } + }); + return this._fillTreeStructure4Search(items, "id"); }, _createJson: function(node, open) { @@ -77554,8 +77565,13 @@ BI.NumberEditor = BI.inherit(BI.Widget, { this.editor.on(BI.TextEditor.EVENT_CHANGE, function () { 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()); + }); + this.editor.on(BI.TextEditor.EVENT_CONFIRM, function () { self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); }); this.topBtn = BI.createWidget({ @@ -88538,6 +88554,7 @@ BI.ListTreeValueChooserInsertCombo = BI.inherit(BI.AbstractListTreeValueChooser, type: "bi.multi_tree_list_combo", element: this, text: o.text, + value: o.value, watermark: o.watermark, itemsCreator: BI.bind(this._itemsCreator, this), valueFormatter: BI.bind(this._valueFormatter, this), @@ -88625,6 +88642,7 @@ BI.TreeValueChooserInsertCombo = BI.inherit(BI.AbstractTreeValueChooser, { this.combo = BI.createWidget({ type: "bi.multi_tree_insert_combo", text: o.text, + value: o.value, watermark: o.watermark, element: this, itemsCreator: BI.bind(this._itemsCreator, this), @@ -88713,6 +88731,7 @@ BI.TreeValueChooserCombo = BI.inherit(BI.AbstractTreeValueChooser, { this.combo = BI.createWidget({ type: "bi.multi_tree_combo", text: o.text, + value: o.value, watermark: o.watermark, element: this, itemsCreator: BI.bind(this._itemsCreator, this), @@ -88943,6 +88962,7 @@ BI.ValueChooserInsertCombo = BI.inherit(BI.AbstractValueChooser, { type: "bi.multi_select_insert_combo", element: this, text: o.text, + value: o.value, itemsCreator: BI.bind(this._itemsCreator, this), valueFormatter: BI.bind(this._valueFormatter, this), width: o.width, @@ -89037,6 +89057,7 @@ BI.ValueChooserCombo = BI.inherit(BI.AbstractValueChooser, { type: "bi.multi_select_combo", element: this, text: o.text, + value: o.value, itemsCreator: BI.bind(this._itemsCreator, this), valueFormatter: BI.bind(this._valueFormatter, this), width: o.width, @@ -89125,6 +89146,7 @@ BI.ValueChooserPane = BI.inherit(BI.AbstractValueChooser, { this.list = BI.createWidget({ type: "bi.multi_select_list", element: this, + value: o.value, itemsCreator: BI.bind(this._itemsCreator, this), valueFormatter: BI.bind(this._valueFormatter, this) }); diff --git a/dist/2.0/fineui.js b/dist/2.0/fineui.js index 540f94e7a..42ef7cbc9 100644 --- a/dist/2.0/fineui.js +++ b/dist/2.0/fineui.js @@ -47632,7 +47632,7 @@ BI.TextAreaEditor = BI.inherit(BI.Single, { items: [this.content] }, left: 4, - right: 10, + right: 4, top: 4, bottom: 8 }] @@ -55159,6 +55159,7 @@ BI.LongColorChooserTrigger = BI.inherit(BI.Trigger, { ref: function (_ref) { self.changeIcon = _ref; }, + disableSelected: true, iconCls: "auto-color-icon", width: 24, iconWidth: 16, @@ -66578,7 +66579,7 @@ BI.shortcut("bi.dynamic_date_time_popup", BI.DynamicDateTimePopup);BI.DynamicDat }, { eventName: BI.SignEditor.EVENT_CHANGE, action: function () { - var value = self._autoSwitch(this.getLastChangedValue(), BI.DynamicDateTimeSelect.HOUR); + var value = self._autoSwitch(this.getValue(), BI.DynamicDateTimeSelect.HOUR); this.setValue(value); } }], @@ -69648,11 +69649,16 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, { _getSearchItems: function(keyword) { var o = this.options; - var findingText = BI.Func.getSearchResult(this.nodes, keyword, "text"); - var findingValue = o.allowSearchValue ? BI.Func.getSearchResult(this.nodes, keyword, "value") : {find: [], match: []}; - var textItems = findingText.find.concat(findingText.match); - var valueItems = findingValue.find.concat(findingValue.match); - return this._fillTreeStructure4Search(BI.uniqBy(textItems.concat(valueItems), "id")); + // 把数组搜索换成用BI.tree搜索节点, 搜到了就不再往下搜索 + var items = []; + this.tree.traverse(function (node) { + var find = BI.Func.getSearchResult([node.text || (o.allowSearchValue && node.value) || ""], keyword); + if(find.find.length > 0 || find.match.length > 0) { + items.push(node); + return true; + } + }); + return this._fillTreeStructure4Search(items, "id"); }, _createJson: function(node, open) { @@ -70819,11 +70825,16 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, { _getSearchItems: function(keyword) { var o = this.options; - var findingText = BI.Func.getSearchResult(this.nodes, keyword, "text"); - var findingValue = o.allowSearchValue ? BI.Func.getSearchResult(this.nodes, keyword, "value") : {find: [], match: []}; - var textItems = findingText.find.concat(findingText.match); - var valueItems = findingValue.find.concat(findingValue.match); - return this._fillTreeStructure4Search(BI.uniqBy(textItems.concat(valueItems), "id")); + // 把数组搜索换成用BI.tree搜索节点, 搜到了就不再往下搜索 + var items = []; + this.tree.traverse(function (node) { + var find = BI.Func.getSearchResult([node.text || (o.allowSearchValue && node.value) || ""], keyword); + if(find.find.length > 0 || find.match.length > 0) { + items.push(node); + return true; + } + }); + return this._fillTreeStructure4Search(items, "id"); }, _createJson: function(node, open) { @@ -77958,8 +77969,13 @@ BI.NumberEditor = BI.inherit(BI.Widget, { this.editor.on(BI.TextEditor.EVENT_CHANGE, function () { 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()); + }); + this.editor.on(BI.TextEditor.EVENT_CONFIRM, function () { self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); }); this.topBtn = BI.createWidget({ @@ -88942,6 +88958,7 @@ BI.ListTreeValueChooserInsertCombo = BI.inherit(BI.AbstractListTreeValueChooser, type: "bi.multi_tree_list_combo", element: this, text: o.text, + value: o.value, watermark: o.watermark, itemsCreator: BI.bind(this._itemsCreator, this), valueFormatter: BI.bind(this._valueFormatter, this), @@ -89029,6 +89046,7 @@ BI.TreeValueChooserInsertCombo = BI.inherit(BI.AbstractTreeValueChooser, { this.combo = BI.createWidget({ type: "bi.multi_tree_insert_combo", text: o.text, + value: o.value, watermark: o.watermark, element: this, itemsCreator: BI.bind(this._itemsCreator, this), @@ -89117,6 +89135,7 @@ BI.TreeValueChooserCombo = BI.inherit(BI.AbstractTreeValueChooser, { this.combo = BI.createWidget({ type: "bi.multi_tree_combo", text: o.text, + value: o.value, watermark: o.watermark, element: this, itemsCreator: BI.bind(this._itemsCreator, this), @@ -89347,6 +89366,7 @@ BI.ValueChooserInsertCombo = BI.inherit(BI.AbstractValueChooser, { type: "bi.multi_select_insert_combo", element: this, text: o.text, + value: o.value, itemsCreator: BI.bind(this._itemsCreator, this), valueFormatter: BI.bind(this._valueFormatter, this), width: o.width, @@ -89441,6 +89461,7 @@ BI.ValueChooserCombo = BI.inherit(BI.AbstractValueChooser, { type: "bi.multi_select_combo", element: this, text: o.text, + value: o.value, itemsCreator: BI.bind(this._itemsCreator, this), valueFormatter: BI.bind(this._valueFormatter, this), width: o.width, @@ -89529,6 +89550,7 @@ BI.ValueChooserPane = BI.inherit(BI.AbstractValueChooser, { this.list = BI.createWidget({ type: "bi.multi_select_list", element: this, + value: o.value, itemsCreator: BI.bind(this._itemsCreator, this), valueFormatter: BI.bind(this._valueFormatter, this) }); diff --git a/dist/base.js b/dist/base.js index 4e75992fc..3fc9bae58 100644 --- a/dist/base.js +++ b/dist/base.js @@ -9359,7 +9359,7 @@ BI.TextAreaEditor = BI.inherit(BI.Single, { items: [this.content] }, left: 4, - right: 10, + right: 4, top: 4, bottom: 8 }] diff --git a/dist/bundle.ie.js b/dist/bundle.ie.js index 40cb63121..2167c30fd 100644 --- a/dist/bundle.ie.js +++ b/dist/bundle.ie.js @@ -47228,7 +47228,7 @@ BI.TextAreaEditor = BI.inherit(BI.Single, { items: [this.content] }, left: 4, - right: 10, + right: 4, top: 4, bottom: 8 }] @@ -54755,6 +54755,7 @@ BI.LongColorChooserTrigger = BI.inherit(BI.Trigger, { ref: function (_ref) { self.changeIcon = _ref; }, + disableSelected: true, iconCls: "auto-color-icon", width: 24, iconWidth: 16, @@ -66174,7 +66175,7 @@ BI.shortcut("bi.dynamic_date_time_popup", BI.DynamicDateTimePopup);BI.DynamicDat }, { eventName: BI.SignEditor.EVENT_CHANGE, action: function () { - var value = self._autoSwitch(this.getLastChangedValue(), BI.DynamicDateTimeSelect.HOUR); + var value = self._autoSwitch(this.getValue(), BI.DynamicDateTimeSelect.HOUR); this.setValue(value); } }], @@ -69244,11 +69245,16 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, { _getSearchItems: function(keyword) { var o = this.options; - var findingText = BI.Func.getSearchResult(this.nodes, keyword, "text"); - var findingValue = o.allowSearchValue ? BI.Func.getSearchResult(this.nodes, keyword, "value") : {find: [], match: []}; - var textItems = findingText.find.concat(findingText.match); - var valueItems = findingValue.find.concat(findingValue.match); - return this._fillTreeStructure4Search(BI.uniqBy(textItems.concat(valueItems), "id")); + // 把数组搜索换成用BI.tree搜索节点, 搜到了就不再往下搜索 + var items = []; + this.tree.traverse(function (node) { + var find = BI.Func.getSearchResult([node.text || (o.allowSearchValue && node.value) || ""], keyword); + if(find.find.length > 0 || find.match.length > 0) { + items.push(node); + return true; + } + }); + return this._fillTreeStructure4Search(items, "id"); }, _createJson: function(node, open) { @@ -70415,11 +70421,16 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, { _getSearchItems: function(keyword) { var o = this.options; - var findingText = BI.Func.getSearchResult(this.nodes, keyword, "text"); - var findingValue = o.allowSearchValue ? BI.Func.getSearchResult(this.nodes, keyword, "value") : {find: [], match: []}; - var textItems = findingText.find.concat(findingText.match); - var valueItems = findingValue.find.concat(findingValue.match); - return this._fillTreeStructure4Search(BI.uniqBy(textItems.concat(valueItems), "id")); + // 把数组搜索换成用BI.tree搜索节点, 搜到了就不再往下搜索 + var items = []; + this.tree.traverse(function (node) { + var find = BI.Func.getSearchResult([node.text || (o.allowSearchValue && node.value) || ""], keyword); + if(find.find.length > 0 || find.match.length > 0) { + items.push(node); + return true; + } + }); + return this._fillTreeStructure4Search(items, "id"); }, _createJson: function(node, open) { @@ -77554,8 +77565,13 @@ BI.NumberEditor = BI.inherit(BI.Widget, { this.editor.on(BI.TextEditor.EVENT_CHANGE, function () { 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()); + }); + this.editor.on(BI.TextEditor.EVENT_CONFIRM, function () { self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); }); this.topBtn = BI.createWidget({ @@ -88538,6 +88554,7 @@ BI.ListTreeValueChooserInsertCombo = BI.inherit(BI.AbstractListTreeValueChooser, type: "bi.multi_tree_list_combo", element: this, text: o.text, + value: o.value, watermark: o.watermark, itemsCreator: BI.bind(this._itemsCreator, this), valueFormatter: BI.bind(this._valueFormatter, this), @@ -88625,6 +88642,7 @@ BI.TreeValueChooserInsertCombo = BI.inherit(BI.AbstractTreeValueChooser, { this.combo = BI.createWidget({ type: "bi.multi_tree_insert_combo", text: o.text, + value: o.value, watermark: o.watermark, element: this, itemsCreator: BI.bind(this._itemsCreator, this), @@ -88713,6 +88731,7 @@ BI.TreeValueChooserCombo = BI.inherit(BI.AbstractTreeValueChooser, { this.combo = BI.createWidget({ type: "bi.multi_tree_combo", text: o.text, + value: o.value, watermark: o.watermark, element: this, itemsCreator: BI.bind(this._itemsCreator, this), @@ -88943,6 +88962,7 @@ BI.ValueChooserInsertCombo = BI.inherit(BI.AbstractValueChooser, { type: "bi.multi_select_insert_combo", element: this, text: o.text, + value: o.value, itemsCreator: BI.bind(this._itemsCreator, this), valueFormatter: BI.bind(this._valueFormatter, this), width: o.width, @@ -89037,6 +89057,7 @@ BI.ValueChooserCombo = BI.inherit(BI.AbstractValueChooser, { type: "bi.multi_select_combo", element: this, text: o.text, + value: o.value, itemsCreator: BI.bind(this._itemsCreator, this), valueFormatter: BI.bind(this._valueFormatter, this), width: o.width, @@ -89125,6 +89146,7 @@ BI.ValueChooserPane = BI.inherit(BI.AbstractValueChooser, { this.list = BI.createWidget({ type: "bi.multi_select_list", element: this, + value: o.value, itemsCreator: BI.bind(this._itemsCreator, this), valueFormatter: BI.bind(this._valueFormatter, this) }); diff --git a/dist/bundle.js b/dist/bundle.js index 540f94e7a..42ef7cbc9 100644 --- a/dist/bundle.js +++ b/dist/bundle.js @@ -47632,7 +47632,7 @@ BI.TextAreaEditor = BI.inherit(BI.Single, { items: [this.content] }, left: 4, - right: 10, + right: 4, top: 4, bottom: 8 }] @@ -55159,6 +55159,7 @@ BI.LongColorChooserTrigger = BI.inherit(BI.Trigger, { ref: function (_ref) { self.changeIcon = _ref; }, + disableSelected: true, iconCls: "auto-color-icon", width: 24, iconWidth: 16, @@ -66578,7 +66579,7 @@ BI.shortcut("bi.dynamic_date_time_popup", BI.DynamicDateTimePopup);BI.DynamicDat }, { eventName: BI.SignEditor.EVENT_CHANGE, action: function () { - var value = self._autoSwitch(this.getLastChangedValue(), BI.DynamicDateTimeSelect.HOUR); + var value = self._autoSwitch(this.getValue(), BI.DynamicDateTimeSelect.HOUR); this.setValue(value); } }], @@ -69648,11 +69649,16 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, { _getSearchItems: function(keyword) { var o = this.options; - var findingText = BI.Func.getSearchResult(this.nodes, keyword, "text"); - var findingValue = o.allowSearchValue ? BI.Func.getSearchResult(this.nodes, keyword, "value") : {find: [], match: []}; - var textItems = findingText.find.concat(findingText.match); - var valueItems = findingValue.find.concat(findingValue.match); - return this._fillTreeStructure4Search(BI.uniqBy(textItems.concat(valueItems), "id")); + // 把数组搜索换成用BI.tree搜索节点, 搜到了就不再往下搜索 + var items = []; + this.tree.traverse(function (node) { + var find = BI.Func.getSearchResult([node.text || (o.allowSearchValue && node.value) || ""], keyword); + if(find.find.length > 0 || find.match.length > 0) { + items.push(node); + return true; + } + }); + return this._fillTreeStructure4Search(items, "id"); }, _createJson: function(node, open) { @@ -70819,11 +70825,16 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, { _getSearchItems: function(keyword) { var o = this.options; - var findingText = BI.Func.getSearchResult(this.nodes, keyword, "text"); - var findingValue = o.allowSearchValue ? BI.Func.getSearchResult(this.nodes, keyword, "value") : {find: [], match: []}; - var textItems = findingText.find.concat(findingText.match); - var valueItems = findingValue.find.concat(findingValue.match); - return this._fillTreeStructure4Search(BI.uniqBy(textItems.concat(valueItems), "id")); + // 把数组搜索换成用BI.tree搜索节点, 搜到了就不再往下搜索 + var items = []; + this.tree.traverse(function (node) { + var find = BI.Func.getSearchResult([node.text || (o.allowSearchValue && node.value) || ""], keyword); + if(find.find.length > 0 || find.match.length > 0) { + items.push(node); + return true; + } + }); + return this._fillTreeStructure4Search(items, "id"); }, _createJson: function(node, open) { @@ -77958,8 +77969,13 @@ BI.NumberEditor = BI.inherit(BI.Widget, { this.editor.on(BI.TextEditor.EVENT_CHANGE, function () { 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()); + }); + this.editor.on(BI.TextEditor.EVENT_CONFIRM, function () { self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); }); this.topBtn = BI.createWidget({ @@ -88942,6 +88958,7 @@ BI.ListTreeValueChooserInsertCombo = BI.inherit(BI.AbstractListTreeValueChooser, type: "bi.multi_tree_list_combo", element: this, text: o.text, + value: o.value, watermark: o.watermark, itemsCreator: BI.bind(this._itemsCreator, this), valueFormatter: BI.bind(this._valueFormatter, this), @@ -89029,6 +89046,7 @@ BI.TreeValueChooserInsertCombo = BI.inherit(BI.AbstractTreeValueChooser, { this.combo = BI.createWidget({ type: "bi.multi_tree_insert_combo", text: o.text, + value: o.value, watermark: o.watermark, element: this, itemsCreator: BI.bind(this._itemsCreator, this), @@ -89117,6 +89135,7 @@ BI.TreeValueChooserCombo = BI.inherit(BI.AbstractTreeValueChooser, { this.combo = BI.createWidget({ type: "bi.multi_tree_combo", text: o.text, + value: o.value, watermark: o.watermark, element: this, itemsCreator: BI.bind(this._itemsCreator, this), @@ -89347,6 +89366,7 @@ BI.ValueChooserInsertCombo = BI.inherit(BI.AbstractValueChooser, { type: "bi.multi_select_insert_combo", element: this, text: o.text, + value: o.value, itemsCreator: BI.bind(this._itemsCreator, this), valueFormatter: BI.bind(this._valueFormatter, this), width: o.width, @@ -89441,6 +89461,7 @@ BI.ValueChooserCombo = BI.inherit(BI.AbstractValueChooser, { type: "bi.multi_select_combo", element: this, text: o.text, + value: o.value, itemsCreator: BI.bind(this._itemsCreator, this), valueFormatter: BI.bind(this._valueFormatter, this), width: o.width, @@ -89529,6 +89550,7 @@ BI.ValueChooserPane = BI.inherit(BI.AbstractValueChooser, { this.list = BI.createWidget({ type: "bi.multi_select_list", element: this, + value: o.value, itemsCreator: BI.bind(this._itemsCreator, this), valueFormatter: BI.bind(this._valueFormatter, this) }); diff --git a/dist/case.js b/dist/case.js index b69ee5783..e693cbb6c 100644 --- a/dist/case.js +++ b/dist/case.js @@ -2731,6 +2731,7 @@ BI.LongColorChooserTrigger = BI.inherit(BI.Trigger, { ref: function (_ref) { self.changeIcon = _ref; }, + disableSelected: true, iconCls: "auto-color-icon", width: 24, iconWidth: 16, diff --git a/dist/fineui.ie.js b/dist/fineui.ie.js index 4f6e23200..a7d14049c 100644 --- a/dist/fineui.ie.js +++ b/dist/fineui.ie.js @@ -47473,7 +47473,7 @@ BI.TextAreaEditor = BI.inherit(BI.Single, { items: [this.content] }, left: 4, - right: 10, + right: 4, top: 4, bottom: 8 }] @@ -55000,6 +55000,7 @@ BI.LongColorChooserTrigger = BI.inherit(BI.Trigger, { ref: function (_ref) { self.changeIcon = _ref; }, + disableSelected: true, iconCls: "auto-color-icon", width: 24, iconWidth: 16, @@ -66419,7 +66420,7 @@ BI.shortcut("bi.dynamic_date_time_popup", BI.DynamicDateTimePopup);BI.DynamicDat }, { eventName: BI.SignEditor.EVENT_CHANGE, action: function () { - var value = self._autoSwitch(this.getLastChangedValue(), BI.DynamicDateTimeSelect.HOUR); + var value = self._autoSwitch(this.getValue(), BI.DynamicDateTimeSelect.HOUR); this.setValue(value); } }], @@ -69489,11 +69490,16 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, { _getSearchItems: function(keyword) { var o = this.options; - var findingText = BI.Func.getSearchResult(this.nodes, keyword, "text"); - var findingValue = o.allowSearchValue ? BI.Func.getSearchResult(this.nodes, keyword, "value") : {find: [], match: []}; - var textItems = findingText.find.concat(findingText.match); - var valueItems = findingValue.find.concat(findingValue.match); - return this._fillTreeStructure4Search(BI.uniqBy(textItems.concat(valueItems), "id")); + // 把数组搜索换成用BI.tree搜索节点, 搜到了就不再往下搜索 + var items = []; + this.tree.traverse(function (node) { + var find = BI.Func.getSearchResult([node.text || (o.allowSearchValue && node.value) || ""], keyword); + if(find.find.length > 0 || find.match.length > 0) { + items.push(node); + return true; + } + }); + return this._fillTreeStructure4Search(items, "id"); }, _createJson: function(node, open) { @@ -70660,11 +70666,16 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, { _getSearchItems: function(keyword) { var o = this.options; - var findingText = BI.Func.getSearchResult(this.nodes, keyword, "text"); - var findingValue = o.allowSearchValue ? BI.Func.getSearchResult(this.nodes, keyword, "value") : {find: [], match: []}; - var textItems = findingText.find.concat(findingText.match); - var valueItems = findingValue.find.concat(findingValue.match); - return this._fillTreeStructure4Search(BI.uniqBy(textItems.concat(valueItems), "id")); + // 把数组搜索换成用BI.tree搜索节点, 搜到了就不再往下搜索 + var items = []; + this.tree.traverse(function (node) { + var find = BI.Func.getSearchResult([node.text || (o.allowSearchValue && node.value) || ""], keyword); + if(find.find.length > 0 || find.match.length > 0) { + items.push(node); + return true; + } + }); + return this._fillTreeStructure4Search(items, "id"); }, _createJson: function(node, open) { @@ -77799,8 +77810,13 @@ BI.NumberEditor = BI.inherit(BI.Widget, { this.editor.on(BI.TextEditor.EVENT_CHANGE, function () { 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()); + }); + this.editor.on(BI.TextEditor.EVENT_CONFIRM, function () { self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); }); this.topBtn = BI.createWidget({ @@ -88783,6 +88799,7 @@ BI.ListTreeValueChooserInsertCombo = BI.inherit(BI.AbstractListTreeValueChooser, type: "bi.multi_tree_list_combo", element: this, text: o.text, + value: o.value, watermark: o.watermark, itemsCreator: BI.bind(this._itemsCreator, this), valueFormatter: BI.bind(this._valueFormatter, this), @@ -88870,6 +88887,7 @@ BI.TreeValueChooserInsertCombo = BI.inherit(BI.AbstractTreeValueChooser, { this.combo = BI.createWidget({ type: "bi.multi_tree_insert_combo", text: o.text, + value: o.value, watermark: o.watermark, element: this, itemsCreator: BI.bind(this._itemsCreator, this), @@ -88958,6 +88976,7 @@ BI.TreeValueChooserCombo = BI.inherit(BI.AbstractTreeValueChooser, { this.combo = BI.createWidget({ type: "bi.multi_tree_combo", text: o.text, + value: o.value, watermark: o.watermark, element: this, itemsCreator: BI.bind(this._itemsCreator, this), @@ -89188,6 +89207,7 @@ BI.ValueChooserInsertCombo = BI.inherit(BI.AbstractValueChooser, { type: "bi.multi_select_insert_combo", element: this, text: o.text, + value: o.value, itemsCreator: BI.bind(this._itemsCreator, this), valueFormatter: BI.bind(this._valueFormatter, this), width: o.width, @@ -89282,6 +89302,7 @@ BI.ValueChooserCombo = BI.inherit(BI.AbstractValueChooser, { type: "bi.multi_select_combo", element: this, text: o.text, + value: o.value, itemsCreator: BI.bind(this._itemsCreator, this), valueFormatter: BI.bind(this._valueFormatter, this), width: o.width, @@ -89370,6 +89391,7 @@ BI.ValueChooserPane = BI.inherit(BI.AbstractValueChooser, { this.list = BI.createWidget({ type: "bi.multi_select_list", element: this, + value: o.value, itemsCreator: BI.bind(this._itemsCreator, this), valueFormatter: BI.bind(this._valueFormatter, this) }); diff --git a/dist/fineui.js b/dist/fineui.js index ff63ff8ee..de2ffea05 100644 --- a/dist/fineui.js +++ b/dist/fineui.js @@ -47877,7 +47877,7 @@ BI.TextAreaEditor = BI.inherit(BI.Single, { items: [this.content] }, left: 4, - right: 10, + right: 4, top: 4, bottom: 8 }] @@ -55404,6 +55404,7 @@ BI.LongColorChooserTrigger = BI.inherit(BI.Trigger, { ref: function (_ref) { self.changeIcon = _ref; }, + disableSelected: true, iconCls: "auto-color-icon", width: 24, iconWidth: 16, @@ -66823,7 +66824,7 @@ BI.shortcut("bi.dynamic_date_time_popup", BI.DynamicDateTimePopup);BI.DynamicDat }, { eventName: BI.SignEditor.EVENT_CHANGE, action: function () { - var value = self._autoSwitch(this.getLastChangedValue(), BI.DynamicDateTimeSelect.HOUR); + var value = self._autoSwitch(this.getValue(), BI.DynamicDateTimeSelect.HOUR); this.setValue(value); } }], @@ -69893,11 +69894,16 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, { _getSearchItems: function(keyword) { var o = this.options; - var findingText = BI.Func.getSearchResult(this.nodes, keyword, "text"); - var findingValue = o.allowSearchValue ? BI.Func.getSearchResult(this.nodes, keyword, "value") : {find: [], match: []}; - var textItems = findingText.find.concat(findingText.match); - var valueItems = findingValue.find.concat(findingValue.match); - return this._fillTreeStructure4Search(BI.uniqBy(textItems.concat(valueItems), "id")); + // 把数组搜索换成用BI.tree搜索节点, 搜到了就不再往下搜索 + var items = []; + this.tree.traverse(function (node) { + var find = BI.Func.getSearchResult([node.text || (o.allowSearchValue && node.value) || ""], keyword); + if(find.find.length > 0 || find.match.length > 0) { + items.push(node); + return true; + } + }); + return this._fillTreeStructure4Search(items, "id"); }, _createJson: function(node, open) { @@ -71064,11 +71070,16 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, { _getSearchItems: function(keyword) { var o = this.options; - var findingText = BI.Func.getSearchResult(this.nodes, keyword, "text"); - var findingValue = o.allowSearchValue ? BI.Func.getSearchResult(this.nodes, keyword, "value") : {find: [], match: []}; - var textItems = findingText.find.concat(findingText.match); - var valueItems = findingValue.find.concat(findingValue.match); - return this._fillTreeStructure4Search(BI.uniqBy(textItems.concat(valueItems), "id")); + // 把数组搜索换成用BI.tree搜索节点, 搜到了就不再往下搜索 + var items = []; + this.tree.traverse(function (node) { + var find = BI.Func.getSearchResult([node.text || (o.allowSearchValue && node.value) || ""], keyword); + if(find.find.length > 0 || find.match.length > 0) { + items.push(node); + return true; + } + }); + return this._fillTreeStructure4Search(items, "id"); }, _createJson: function(node, open) { @@ -78203,8 +78214,13 @@ BI.NumberEditor = BI.inherit(BI.Widget, { this.editor.on(BI.TextEditor.EVENT_CHANGE, function () { 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()); + }); + this.editor.on(BI.TextEditor.EVENT_CONFIRM, function () { self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); }); this.topBtn = BI.createWidget({ @@ -89187,6 +89203,7 @@ BI.ListTreeValueChooserInsertCombo = BI.inherit(BI.AbstractListTreeValueChooser, type: "bi.multi_tree_list_combo", element: this, text: o.text, + value: o.value, watermark: o.watermark, itemsCreator: BI.bind(this._itemsCreator, this), valueFormatter: BI.bind(this._valueFormatter, this), @@ -89274,6 +89291,7 @@ BI.TreeValueChooserInsertCombo = BI.inherit(BI.AbstractTreeValueChooser, { this.combo = BI.createWidget({ type: "bi.multi_tree_insert_combo", text: o.text, + value: o.value, watermark: o.watermark, element: this, itemsCreator: BI.bind(this._itemsCreator, this), @@ -89362,6 +89380,7 @@ BI.TreeValueChooserCombo = BI.inherit(BI.AbstractTreeValueChooser, { this.combo = BI.createWidget({ type: "bi.multi_tree_combo", text: o.text, + value: o.value, watermark: o.watermark, element: this, itemsCreator: BI.bind(this._itemsCreator, this), @@ -89592,6 +89611,7 @@ BI.ValueChooserInsertCombo = BI.inherit(BI.AbstractValueChooser, { type: "bi.multi_select_insert_combo", element: this, text: o.text, + value: o.value, itemsCreator: BI.bind(this._itemsCreator, this), valueFormatter: BI.bind(this._valueFormatter, this), width: o.width, @@ -89686,6 +89706,7 @@ BI.ValueChooserCombo = BI.inherit(BI.AbstractValueChooser, { type: "bi.multi_select_combo", element: this, text: o.text, + value: o.value, itemsCreator: BI.bind(this._itemsCreator, this), valueFormatter: BI.bind(this._valueFormatter, this), width: o.width, @@ -89774,6 +89795,7 @@ BI.ValueChooserPane = BI.inherit(BI.AbstractValueChooser, { this.list = BI.createWidget({ type: "bi.multi_select_list", element: this, + value: o.value, itemsCreator: BI.bind(this._itemsCreator, this), valueFormatter: BI.bind(this._valueFormatter, this) }); diff --git a/dist/fineui_without_jquery_polyfill.js b/dist/fineui_without_jquery_polyfill.js index 30a21fb82..055418cf1 100644 --- a/dist/fineui_without_jquery_polyfill.js +++ b/dist/fineui_without_jquery_polyfill.js @@ -34991,7 +34991,7 @@ BI.TextAreaEditor = BI.inherit(BI.Single, { items: [this.content] }, left: 4, - right: 10, + right: 4, top: 4, bottom: 8 }] @@ -49123,7 +49123,7 @@ BI.shortcut("bi.dynamic_date_time_popup", BI.DynamicDateTimePopup);BI.DynamicDat }, { eventName: BI.SignEditor.EVENT_CHANGE, action: function () { - var value = self._autoSwitch(this.getLastChangedValue(), BI.DynamicDateTimeSelect.HOUR); + var value = self._autoSwitch(this.getValue(), BI.DynamicDateTimeSelect.HOUR); this.setValue(value); } }], @@ -52193,11 +52193,16 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, { _getSearchItems: function(keyword) { var o = this.options; - var findingText = BI.Func.getSearchResult(this.nodes, keyword, "text"); - var findingValue = o.allowSearchValue ? BI.Func.getSearchResult(this.nodes, keyword, "value") : {find: [], match: []}; - var textItems = findingText.find.concat(findingText.match); - var valueItems = findingValue.find.concat(findingValue.match); - return this._fillTreeStructure4Search(BI.uniqBy(textItems.concat(valueItems), "id")); + // 把数组搜索换成用BI.tree搜索节点, 搜到了就不再往下搜索 + var items = []; + this.tree.traverse(function (node) { + var find = BI.Func.getSearchResult([node.text || (o.allowSearchValue && node.value) || ""], keyword); + if(find.find.length > 0 || find.match.length > 0) { + items.push(node); + return true; + } + }); + return this._fillTreeStructure4Search(items, "id"); }, _createJson: function(node, open) { @@ -53364,11 +53369,16 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, { _getSearchItems: function(keyword) { var o = this.options; - var findingText = BI.Func.getSearchResult(this.nodes, keyword, "text"); - var findingValue = o.allowSearchValue ? BI.Func.getSearchResult(this.nodes, keyword, "value") : {find: [], match: []}; - var textItems = findingText.find.concat(findingText.match); - var valueItems = findingValue.find.concat(findingValue.match); - return this._fillTreeStructure4Search(BI.uniqBy(textItems.concat(valueItems), "id")); + // 把数组搜索换成用BI.tree搜索节点, 搜到了就不再往下搜索 + var items = []; + this.tree.traverse(function (node) { + var find = BI.Func.getSearchResult([node.text || (o.allowSearchValue && node.value) || ""], keyword); + if(find.find.length > 0 || find.match.length > 0) { + items.push(node); + return true; + } + }); + return this._fillTreeStructure4Search(items, "id"); }, _createJson: function(node, open) { @@ -60503,8 +60513,13 @@ BI.NumberEditor = BI.inherit(BI.Widget, { this.editor.on(BI.TextEditor.EVENT_CHANGE, function () { 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()); + }); + this.editor.on(BI.TextEditor.EVENT_CONFIRM, function () { self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); }); this.topBtn = BI.createWidget({ @@ -71487,6 +71502,7 @@ BI.ListTreeValueChooserInsertCombo = BI.inherit(BI.AbstractListTreeValueChooser, type: "bi.multi_tree_list_combo", element: this, text: o.text, + value: o.value, watermark: o.watermark, itemsCreator: BI.bind(this._itemsCreator, this), valueFormatter: BI.bind(this._valueFormatter, this), @@ -71574,6 +71590,7 @@ BI.TreeValueChooserInsertCombo = BI.inherit(BI.AbstractTreeValueChooser, { this.combo = BI.createWidget({ type: "bi.multi_tree_insert_combo", text: o.text, + value: o.value, watermark: o.watermark, element: this, itemsCreator: BI.bind(this._itemsCreator, this), @@ -71662,6 +71679,7 @@ BI.TreeValueChooserCombo = BI.inherit(BI.AbstractTreeValueChooser, { this.combo = BI.createWidget({ type: "bi.multi_tree_combo", text: o.text, + value: o.value, watermark: o.watermark, element: this, itemsCreator: BI.bind(this._itemsCreator, this), @@ -71892,6 +71910,7 @@ BI.ValueChooserInsertCombo = BI.inherit(BI.AbstractValueChooser, { type: "bi.multi_select_insert_combo", element: this, text: o.text, + value: o.value, itemsCreator: BI.bind(this._itemsCreator, this), valueFormatter: BI.bind(this._valueFormatter, this), width: o.width, @@ -71986,6 +72005,7 @@ BI.ValueChooserCombo = BI.inherit(BI.AbstractValueChooser, { type: "bi.multi_select_combo", element: this, text: o.text, + value: o.value, itemsCreator: BI.bind(this._itemsCreator, this), valueFormatter: BI.bind(this._valueFormatter, this), width: o.width, @@ -72074,6 +72094,7 @@ BI.ValueChooserPane = BI.inherit(BI.AbstractValueChooser, { this.list = BI.createWidget({ type: "bi.multi_select_list", element: this, + value: o.value, itemsCreator: BI.bind(this._itemsCreator, this), valueFormatter: BI.bind(this._valueFormatter, this) }); diff --git a/dist/widget.js b/dist/widget.js index ad6aa5d23..637a78e70 100644 --- a/dist/widget.js +++ b/dist/widget.js @@ -4233,7 +4233,7 @@ BI.shortcut("bi.dynamic_date_time_popup", BI.DynamicDateTimePopup);BI.DynamicDat }, { eventName: BI.SignEditor.EVENT_CHANGE, action: function () { - var value = self._autoSwitch(this.getLastChangedValue(), BI.DynamicDateTimeSelect.HOUR); + var value = self._autoSwitch(this.getValue(), BI.DynamicDateTimeSelect.HOUR); this.setValue(value); } }], @@ -7303,11 +7303,16 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, { _getSearchItems: function(keyword) { var o = this.options; - var findingText = BI.Func.getSearchResult(this.nodes, keyword, "text"); - var findingValue = o.allowSearchValue ? BI.Func.getSearchResult(this.nodes, keyword, "value") : {find: [], match: []}; - var textItems = findingText.find.concat(findingText.match); - var valueItems = findingValue.find.concat(findingValue.match); - return this._fillTreeStructure4Search(BI.uniqBy(textItems.concat(valueItems), "id")); + // 把数组搜索换成用BI.tree搜索节点, 搜到了就不再往下搜索 + var items = []; + this.tree.traverse(function (node) { + var find = BI.Func.getSearchResult([node.text || (o.allowSearchValue && node.value) || ""], keyword); + if(find.find.length > 0 || find.match.length > 0) { + items.push(node); + return true; + } + }); + return this._fillTreeStructure4Search(items, "id"); }, _createJson: function(node, open) { @@ -8474,11 +8479,16 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, { _getSearchItems: function(keyword) { var o = this.options; - var findingText = BI.Func.getSearchResult(this.nodes, keyword, "text"); - var findingValue = o.allowSearchValue ? BI.Func.getSearchResult(this.nodes, keyword, "value") : {find: [], match: []}; - var textItems = findingText.find.concat(findingText.match); - var valueItems = findingValue.find.concat(findingValue.match); - return this._fillTreeStructure4Search(BI.uniqBy(textItems.concat(valueItems), "id")); + // 把数组搜索换成用BI.tree搜索节点, 搜到了就不再往下搜索 + var items = []; + this.tree.traverse(function (node) { + var find = BI.Func.getSearchResult([node.text || (o.allowSearchValue && node.value) || ""], keyword); + if(find.find.length > 0 || find.match.length > 0) { + items.push(node); + return true; + } + }); + return this._fillTreeStructure4Search(items, "id"); }, _createJson: function(node, open) { @@ -15613,8 +15623,13 @@ BI.NumberEditor = BI.inherit(BI.Widget, { this.editor.on(BI.TextEditor.EVENT_CHANGE, function () { 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()); + }); + this.editor.on(BI.TextEditor.EVENT_CONFIRM, function () { self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); }); this.topBtn = BI.createWidget({ @@ -26597,6 +26612,7 @@ BI.ListTreeValueChooserInsertCombo = BI.inherit(BI.AbstractListTreeValueChooser, type: "bi.multi_tree_list_combo", element: this, text: o.text, + value: o.value, watermark: o.watermark, itemsCreator: BI.bind(this._itemsCreator, this), valueFormatter: BI.bind(this._valueFormatter, this), @@ -26684,6 +26700,7 @@ BI.TreeValueChooserInsertCombo = BI.inherit(BI.AbstractTreeValueChooser, { this.combo = BI.createWidget({ type: "bi.multi_tree_insert_combo", text: o.text, + value: o.value, watermark: o.watermark, element: this, itemsCreator: BI.bind(this._itemsCreator, this), @@ -26772,6 +26789,7 @@ BI.TreeValueChooserCombo = BI.inherit(BI.AbstractTreeValueChooser, { this.combo = BI.createWidget({ type: "bi.multi_tree_combo", text: o.text, + value: o.value, watermark: o.watermark, element: this, itemsCreator: BI.bind(this._itemsCreator, this), @@ -27002,6 +27020,7 @@ BI.ValueChooserInsertCombo = BI.inherit(BI.AbstractValueChooser, { type: "bi.multi_select_insert_combo", element: this, text: o.text, + value: o.value, itemsCreator: BI.bind(this._itemsCreator, this), valueFormatter: BI.bind(this._valueFormatter, this), width: o.width, @@ -27096,6 +27115,7 @@ BI.ValueChooserCombo = BI.inherit(BI.AbstractValueChooser, { type: "bi.multi_select_combo", element: this, text: o.text, + value: o.value, itemsCreator: BI.bind(this._itemsCreator, this), valueFormatter: BI.bind(this._valueFormatter, this), width: o.width, @@ -27184,6 +27204,7 @@ BI.ValueChooserPane = BI.inherit(BI.AbstractValueChooser, { this.list = BI.createWidget({ type: "bi.multi_select_list", element: this, + value: o.value, itemsCreator: BI.bind(this._itemsCreator, this), valueFormatter: BI.bind(this._valueFormatter, this) }); diff --git a/karma.conf.js b/karma.conf.js index ae5a5a85f..398ac8fa9 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -21,6 +21,7 @@ module.exports = function (config) { "src/core/foundation.js", "src/core/lodash.js", "src/core/base.js", + "i18n/i18n.cn.js", "src/core/ob.js", "src/core/widget.js", "src/core/shortcut.js", diff --git a/src/base/single/editor/editor.textarea.js b/src/base/single/editor/editor.textarea.js index 0e66cf283..59cd55ca1 100644 --- a/src/base/single/editor/editor.textarea.js +++ b/src/base/single/editor/editor.textarea.js @@ -31,7 +31,7 @@ BI.TextAreaEditor = BI.inherit(BI.Single, { items: [this.content] }, left: 4, - right: 10, + right: 4, top: 4, bottom: 8 }] diff --git a/src/case/colorchooser/colorchooser.trigger.long.js b/src/case/colorchooser/colorchooser.trigger.long.js index 04c88b88a..946fe67bf 100644 --- a/src/case/colorchooser/colorchooser.trigger.long.js +++ b/src/case/colorchooser/colorchooser.trigger.long.js @@ -26,6 +26,7 @@ BI.LongColorChooserTrigger = BI.inherit(BI.Trigger, { ref: function (_ref) { self.changeIcon = _ref; }, + disableSelected: true, iconCls: "auto-color-icon", width: 24, iconWidth: 16, diff --git a/src/component/treevaluechooser/combo.listtreevaluechooser.js b/src/component/treevaluechooser/combo.listtreevaluechooser.js index c817cd939..383b3184b 100644 --- a/src/component/treevaluechooser/combo.listtreevaluechooser.js +++ b/src/component/treevaluechooser/combo.listtreevaluechooser.js @@ -27,6 +27,7 @@ BI.ListTreeValueChooserInsertCombo = BI.inherit(BI.AbstractListTreeValueChooser, type: "bi.multi_tree_list_combo", element: this, text: o.text, + value: o.value, watermark: o.watermark, itemsCreator: BI.bind(this._itemsCreator, this), valueFormatter: BI.bind(this._valueFormatter, this), diff --git a/src/component/treevaluechooser/combo.treevaluechooser.insert.js b/src/component/treevaluechooser/combo.treevaluechooser.insert.js index e8314110f..2a8b0ca54 100644 --- a/src/component/treevaluechooser/combo.treevaluechooser.insert.js +++ b/src/component/treevaluechooser/combo.treevaluechooser.insert.js @@ -26,6 +26,7 @@ BI.TreeValueChooserInsertCombo = BI.inherit(BI.AbstractTreeValueChooser, { this.combo = BI.createWidget({ type: "bi.multi_tree_insert_combo", text: o.text, + value: o.value, watermark: o.watermark, element: this, itemsCreator: BI.bind(this._itemsCreator, this), diff --git a/src/component/treevaluechooser/combo.treevaluechooser.js b/src/component/treevaluechooser/combo.treevaluechooser.js index 84b93f876..662f22385 100644 --- a/src/component/treevaluechooser/combo.treevaluechooser.js +++ b/src/component/treevaluechooser/combo.treevaluechooser.js @@ -26,6 +26,7 @@ BI.TreeValueChooserCombo = BI.inherit(BI.AbstractTreeValueChooser, { this.combo = BI.createWidget({ type: "bi.multi_tree_combo", text: o.text, + value: o.value, watermark: o.watermark, element: this, itemsCreator: BI.bind(this._itemsCreator, this), diff --git a/src/component/valuechooser/combo.valuechooser.insert.js b/src/component/valuechooser/combo.valuechooser.insert.js index 0c155ea1a..c1f290c3a 100644 --- a/src/component/valuechooser/combo.valuechooser.insert.js +++ b/src/component/valuechooser/combo.valuechooser.insert.js @@ -25,6 +25,7 @@ BI.ValueChooserInsertCombo = BI.inherit(BI.AbstractValueChooser, { type: "bi.multi_select_insert_combo", element: this, text: o.text, + value: o.value, itemsCreator: BI.bind(this._itemsCreator, this), valueFormatter: BI.bind(this._valueFormatter, this), width: o.width, diff --git a/src/component/valuechooser/combo.valuechooser.js b/src/component/valuechooser/combo.valuechooser.js index d8c3454da..312f4c0e4 100644 --- a/src/component/valuechooser/combo.valuechooser.js +++ b/src/component/valuechooser/combo.valuechooser.js @@ -29,6 +29,7 @@ BI.ValueChooserCombo = BI.inherit(BI.AbstractValueChooser, { type: "bi.multi_select_combo", element: this, text: o.text, + value: o.value, itemsCreator: BI.bind(this._itemsCreator, this), valueFormatter: BI.bind(this._valueFormatter, this), width: o.width, diff --git a/src/component/valuechooser/pane.valuechooser.js b/src/component/valuechooser/pane.valuechooser.js index 9e7a9e096..143f8f8c9 100644 --- a/src/component/valuechooser/pane.valuechooser.js +++ b/src/component/valuechooser/pane.valuechooser.js @@ -23,6 +23,7 @@ BI.ValueChooserPane = BI.inherit(BI.AbstractValueChooser, { this.list = BI.createWidget({ type: "bi.multi_select_list", element: this, + value: o.value, itemsCreator: BI.bind(this._itemsCreator, this), valueFormatter: BI.bind(this._valueFormatter, this) }); diff --git a/src/widget/datepane/__test__/datepane.test.js b/src/widget/datepane/__test__/datepane.test.js new file mode 100644 index 000000000..0c56324a4 --- /dev/null +++ b/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(); + }) + }); + }); +}); diff --git a/src/widget/datetimepane/__test__/datetimepane.test.js b/src/widget/datetimepane/__test__/datetimepane.test.js new file mode 100644 index 000000000..69e076578 --- /dev/null +++ b/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(); + }) + }); + }); +}); diff --git a/src/widget/dynamicdatetime/dynamicdatetime.timeselect.js b/src/widget/dynamicdatetime/dynamicdatetime.timeselect.js index 84f54abcf..dde68f6d9 100644 --- a/src/widget/dynamicdatetime/dynamicdatetime.timeselect.js +++ b/src/widget/dynamicdatetime/dynamicdatetime.timeselect.js @@ -36,7 +36,7 @@ BI.DynamicDateTimeSelect = BI.inherit(BI.Widget, { }, { eventName: BI.SignEditor.EVENT_CHANGE, action: function () { - var value = self._autoSwitch(this.getLastChangedValue(), BI.DynamicDateTimeSelect.HOUR); + var value = self._autoSwitch(this.getValue(), BI.DynamicDateTimeSelect.HOUR); this.setValue(value); } }], diff --git a/src/widget/multilayerselecttree/multilayerselecttree.trigger.js b/src/widget/multilayerselecttree/multilayerselecttree.trigger.js index 90cab85f4..f9312e384 100644 --- a/src/widget/multilayerselecttree/multilayerselecttree.trigger.js +++ b/src/widget/multilayerselecttree/multilayerselecttree.trigger.js @@ -130,11 +130,16 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, { _getSearchItems: function(keyword) { var o = this.options; - var findingText = BI.Func.getSearchResult(this.nodes, keyword, "text"); - var findingValue = o.allowSearchValue ? BI.Func.getSearchResult(this.nodes, keyword, "value") : {find: [], match: []}; - var textItems = findingText.find.concat(findingText.match); - var valueItems = findingValue.find.concat(findingValue.match); - return this._fillTreeStructure4Search(BI.uniqBy(textItems.concat(valueItems), "id")); + // 把数组搜索换成用BI.tree搜索节点, 搜到了就不再往下搜索 + var items = []; + this.tree.traverse(function (node) { + var find = BI.Func.getSearchResult([node.text || (o.allowSearchValue && node.value) || ""], keyword); + if(find.find.length > 0 || find.match.length > 0) { + items.push(node); + return true; + } + }); + return this._fillTreeStructure4Search(items, "id"); }, _createJson: function(node, open) { diff --git a/src/widget/multilayersingletree/multilayersingletree.trigger.js b/src/widget/multilayersingletree/multilayersingletree.trigger.js index 4ff540e96..819986c59 100644 --- a/src/widget/multilayersingletree/multilayersingletree.trigger.js +++ b/src/widget/multilayersingletree/multilayersingletree.trigger.js @@ -130,11 +130,16 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, { _getSearchItems: function(keyword) { var o = this.options; - var findingText = BI.Func.getSearchResult(this.nodes, keyword, "text"); - var findingValue = o.allowSearchValue ? BI.Func.getSearchResult(this.nodes, keyword, "value") : {find: [], match: []}; - var textItems = findingText.find.concat(findingText.match); - var valueItems = findingValue.find.concat(findingValue.match); - return this._fillTreeStructure4Search(BI.uniqBy(textItems.concat(valueItems), "id")); + // 把数组搜索换成用BI.tree搜索节点, 搜到了就不再往下搜索 + var items = []; + this.tree.traverse(function (node) { + var find = BI.Func.getSearchResult([node.text || (o.allowSearchValue && node.value) || ""], keyword); + if(find.find.length > 0 || find.match.length > 0) { + items.push(node); + return true; + } + }); + return this._fillTreeStructure4Search(items, "id"); }, _createJson: function(node, open) { diff --git a/src/widget/numbereditor/number.editor.js b/src/widget/numbereditor/number.editor.js index fd8f4171f..05292867d 100644 --- a/src/widget/numbereditor/number.editor.js +++ b/src/widget/numbereditor/number.editor.js @@ -33,8 +33,13 @@ BI.NumberEditor = BI.inherit(BI.Widget, { this.editor.on(BI.TextEditor.EVENT_CHANGE, function () { 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()); + }); + this.editor.on(BI.TextEditor.EVENT_CONFIRM, function () { self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); }); this.topBtn = BI.createWidget({