diff --git a/demo/js/config/widget.js b/demo/js/config/widget.js index d2e1b1d5b..e48282492 100644 --- a/demo/js/config/widget.js +++ b/demo/js/config/widget.js @@ -192,7 +192,7 @@ Demo.WIDGET_CONFIG = [{ value: "demo.number_interval" }, { id: 420, - text: "滚动sliders", + text: "数值滑块sliders", value: "demo.slider" }, { pId: 4, @@ -202,4 +202,4 @@ Demo.WIDGET_CONFIG = [{ pId: 414, text: "bi.collapse", value: "demo.collapse" -}]; \ No newline at end of file +}]; diff --git a/demo/js/widget/multitree/demo.multi_tree_combo.js b/demo/js/widget/multitree/demo.multi_tree_combo.js index fcc9107cb..c3e0ffaa4 100644 --- a/demo/js/widget/multitree/demo.multi_tree_combo.js +++ b/demo/js/widget/multitree/demo.multi_tree_combo.js @@ -38,7 +38,15 @@ Demo.MultiTreeCombo = BI.inherit(BI.Widget, { width: 300, value: { "根目录": {} - } + }, + listeners: [ + { + eventName: "EVENT_CONFIRM", + action: function () { + console.log("EVENT_CONFIRM", this.getValue()); + } + } + ] }, { type: "bi.button", text: "getValue", @@ -52,4 +60,4 @@ Demo.MultiTreeCombo = BI.inherit(BI.Widget, { } }); -BI.shortcut("demo.multi_tree_combo", Demo.MultiTreeCombo); \ No newline at end of file +BI.shortcut("demo.multi_tree_combo", Demo.MultiTreeCombo); diff --git a/package.json b/package.json index e499e4361..d8d1135eb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fineui", - "version": "2.0.20221024153423", + "version": "2.0.20221101100519", "description": "fineui", "main": "dist/fineui_without_conflict.min.js", "types": "dist/lib/index.d.ts", diff --git a/src/base/collection/collection.js b/src/base/collection/collection.js index d7f83a0f5..f45437627 100644 --- a/src/base/collection/collection.js +++ b/src/base/collection/collection.js @@ -280,12 +280,44 @@ BI.CollectionView = BI.inherit(BI.Widget, { } }, + _isOverflowX: function () { + var o = this.options; + // 兼容一下 + var scrollable = o.scrollable, scrollx = o.scrollx; + if (o.overflowX === false) { + return false; + } + if (scrollx) { + return true; + } + if (scrollable === true || scrollable === "xy" || scrollable === "x") { + return true; + } + return false; + }, + + _isOverflowY: function () { + var o = this.options; + // 兼容一下 + var scrollable = o.scrollable, scrolly = o.scrolly; + if (o.overflowX === false) { + return false; + } + if (scrolly) { + return true; + } + if (scrollable === true || scrollable === "xy" || scrollable === "y") { + return true; + } + return false; + }, + _getMaxScrollLeft: function () { - return Math.max(0, this._width - this.options.width + (this.options.overflowX ? BI.DOM.getScrollWidth() : 0)); + return Math.max(0, this._width - this.options.width + (this._isOverflowX() ? BI.DOM.getScrollWidth() : 0)); }, _getMaxScrollTop: function () { - return Math.max(0, this._height - this.options.height + (this.options.overflowY ? BI.DOM.getScrollWidth() : 0)); + return Math.max(0, this._height - this.options.height + (this._isOverflowY() ? BI.DOM.getScrollWidth() : 0)); }, _populate: function (items) { diff --git a/src/base/combination/group.button.js b/src/base/combination/group.button.js index 184a6d146..02b044b17 100644 --- a/src/base/combination/group.button.js +++ b/src/base/combination/group.button.js @@ -42,11 +42,13 @@ BI.ButtonGroup = BI.inherit(BI.Widget, { }, _createBtns: function (items) { - BI.Widget.pushContext(this); - var btns = BI.createWidgets(BI.createItems(items, { - type: "bi.text_button", - })); - BI.Widget.popContext(); + var btns; + BI.Widget.execWithContext(this, function () { + btns = BI.createWidgets(BI.createItems(items, { + type: "bi.text_button", + })); + }); + return btns; }, diff --git a/src/base/combination/navigation.js b/src/base/combination/navigation.js index adc3e5ad4..1b347298e 100644 --- a/src/base/combination/navigation.js +++ b/src/base/combination/navigation.js @@ -43,11 +43,10 @@ BI.Navigation = BI.inherit(BI.Widget, { return self.showIndex + v; }, cardCreator: function (v) { - BI.Widget.pushContext(self); - var card = o.cardCreator(v); - BI.Widget.popContext(); - self.cardMap[v] = card; - return card; + BI.Widget.execWithContext(self, function () { + self.cardMap[v] = o.cardCreator(v); + }); + return self.cardMap[v]; }, afterCardCreated: BI.bind(this.afterCardCreated, this), afterCardShow: BI.bind(this.afterCardShow, this), @@ -104,12 +103,12 @@ BI.Navigation = BI.inherit(BI.Widget, { }, _assertCard: function (v) { + var self = this, o = this.options; if (!this.layout.isCardExisted(v)) { - BI.Widget.pushContext(this); - var card = this.options.cardCreator(v); - BI.Widget.popContext(); - this.cardMap[v] = card; - this.layout.addCardByName(v, card); + BI.Widget.execWithContext(self, function () { + self.cardMap[v] = o.cardCreator(v); + }); + this.layout.addCardByName(v, this.cardMap[v]); this.afterCardCreated(v); } }, diff --git a/src/base/combination/tab.js b/src/base/combination/tab.js index 85fca3483..933496004 100644 --- a/src/base/combination/tab.js +++ b/src/base/combination/tab.js @@ -43,10 +43,11 @@ BI.Tab = BI.inherit(BI.Widget, { eventObj: this.tab, cardLayout: this.layout, cardCreator: function (v) { - var card = o.cardCreator.apply(self, arguments); - self.cardMap[v] = card; + BI.Widget.execWithContext(self, function () { + self.cardMap[v] = o.cardCreator(v); + }); - return card; + return self.cardMap[v]; }, afterCardShow: function (v) { self._deleteOtherCards(v); @@ -71,12 +72,12 @@ BI.Tab = BI.inherit(BI.Widget, { }, _assertCard: function (v) { + var self = this, o = this.options; if (!this.layout.isCardExisted(v)) { - BI.Widget.pushContext(this); - var card = this.options.cardCreator(v); - BI.Widget.popContext(); - this.cardMap[v] = card; - this.layout.addCardByName(v, card); + BI.Widget.execWithContext(this, function () { + self.cardMap[v] = o.cardCreator(v); + }); + this.layout.addCardByName(v, this.cardMap[v]); } }, diff --git a/src/base/grid/grid.js b/src/base/grid/grid.js index d1385e4a1..944a82d4a 100644 --- a/src/base/grid/grid.js +++ b/src/base/grid/grid.js @@ -96,7 +96,7 @@ BI.GridView = BI.inherit(BI.Widget, { this.element.scrollLeft(o.scrollLeft); } }, - + destroyed: function () { BI.each(this.renderedCells, function(i, cell) { cell.el._destroy(); @@ -262,12 +262,44 @@ BI.GridView = BI.inherit(BI.Widget, { } }, + _isOverflowX: function () { + var o = this.options; + // 兼容一下 + var scrollable = o.scrollable, scrollx = o.scrollx; + if (o.overflowX === false) { + return false; + } + if (scrollx) { + return true; + } + if (scrollable === true || scrollable === "xy" || scrollable === "x") { + return true; + } + return false; + }, + + _isOverflowY: function () { + var o = this.options; + // 兼容一下 + var scrollable = o.scrollable, scrolly = o.scrolly; + if (o.overflowX === false) { + return false; + } + if (scrolly) { + return true; + } + if (scrollable === true || scrollable === "xy" || scrollable === "y") { + return true; + } + return false; + }, + _getMaxScrollLeft: function () { - return Math.max(0, this._getContainerWidth() - this.options.width + (this.options.overflowX ? BI.DOM.getScrollWidth() : 0)); + return Math.max(0, this._getContainerWidth() - this.options.width + (this._isOverflowX() ? BI.DOM.getScrollWidth() : 0)); }, _getMaxScrollTop: function () { - return Math.max(0, this._getContainerHeight() - this.options.height + (this.options.overflowY ? BI.DOM.getScrollWidth() : 0)); + return Math.max(0, this._getContainerHeight() - this.options.height + (this._isOverflowY() ? BI.DOM.getScrollWidth() : 0)); }, _getContainerWidth: function () { diff --git a/src/base/single/button/button.basic.js b/src/base/single/button/button.basic.js index 77bfd1036..64865de8b 100644 --- a/src/base/single/button/button.basic.js +++ b/src/base/single/button/button.basic.js @@ -184,7 +184,7 @@ BI.BasicButton = BI.inherit(BI.Single, { var mouseDown = false; var interval; hand.mousedown(function (e) { - BI.Widget._renderEngine.createElement(document).bind("mouseup." + self.getName(), function (e) { + BI.Widget._renderEngine.createElement(document).bind("mouseup." + self.getName(), function () { interval && clearInterval(interval); interval = null; mouseDown = false; @@ -193,13 +193,14 @@ BI.BasicButton = BI.inherit(BI.Single, { if (mouseDown === true) { return; } - if (!self.isEnabled() || (self.isOnce() && self.isSelected())) { + if (!self.isEnabled() || !self.isValid()) { + return; + } + if (self.isOnce() && self.isSelected()) { return; } interval = setInterval(function () { - if (self.isEnabled()) { - self.doClick(); - } + clk(e) }, 180); mouseDown = true; ev(e); @@ -239,7 +240,10 @@ BI.BasicButton = BI.inherit(BI.Single, { function clk(e) { ev(e); - if (!self.isEnabled() || (self.isOnce() && self.isSelected())) { + if (!self.isEnabled() || !self.isValid()) { + return; + } + if (self.isOnce() && self.isSelected()) { return; } if (BI.isKey(o.bubble) || BI.isFunction(o.bubble)) { @@ -335,16 +339,17 @@ BI.BasicButton = BI.inherit(BI.Single, { }, _doClick: function (e) { - if (this.isValid()) { - var isIntercepted = this.beforeClick(e); - // 如果事件已经被消费掉了,就不再触发点击事件 - if (isIntercepted) { - return; - } + if (!this.isEnabled() || !this.isValid()) { + return; + } + var isIntercepted = this.beforeClick(e); + // 如果事件已经被消费掉了,就不再触发点击事件 + if (isIntercepted) { + return; } this._trigger(e); - if (this.isValid()) { + if (this.isEnabled() && this.isValid()) { this.doClick(e); } }, diff --git a/src/base/single/instruction/instruction.js b/src/base/single/instruction/instruction.js new file mode 100644 index 000000000..71a61a6f3 --- /dev/null +++ b/src/base/single/instruction/instruction.js @@ -0,0 +1,76 @@ +BI.Instruction = BI.inherit(BI.Widget, { + _defaultConfig: function () { + var conf = BI.Link.superclass._defaultConfig.apply(this, arguments); + return BI.extend(conf, { + baseCls: (conf.baseCls || "") + " bi-instruction", + height: 20, + level: "error", + textAlign: "left", + whiteSpace: "nowrap", + hgap: 5 + }); + }, + + render: function () { + var self = this, o = this.options; + + return { + type: "bi.label", + ref: function (_ref) { + self.text = _ref; + }, + cls: "instruction-" + o.level, + textAlign: o.textAlign, + whiteSpace: o.whiteSpace, + textHeight: o.height, + height: o.height, + hgap: o.hgap, + rgap: o.rgap, + lgap: o.lgap, + vgap: o.vgap, + text: o.text, + keyword: o.keyword, + value: o.value, + py: o.py + }; + }, + + doRedMark: function () { + this.text.doRedMark.apply(this.text, arguments); + }, + + unRedMark: function () { + this.text.unRedMark.apply(this.text, arguments); + }, + + doHighLight: function () { + this.text.doHighLight.apply(this.text, arguments); + }, + + unHighLight: function () { + this.text.unHighLight.apply(this.text, arguments); + }, + + setText: function (v) { + this.options.text = v; + this.text.setText(v); + }, + + getText: function () { + return this.options.text; + }, + + setStyle: function (css) { + this.text.setStyle(css); + }, + + setValue: function (v) { + this.text.setValue(v); + }, + + getValue: function () { + this.text.getValue(); + } +}); + +BI.shortcut("bi.instruction", BI.Instruction); diff --git a/src/case/combo/searchtextvaluecombo/combo.searchtextvalue.js b/src/case/combo/searchtextvaluecombo/combo.searchtextvalue.js index 63f73944a..baa653207 100644 --- a/src/case/combo/searchtextvaluecombo/combo.searchtextvalue.js +++ b/src/case/combo/searchtextvaluecombo/combo.searchtextvalue.js @@ -91,6 +91,7 @@ BI.SearchTextValueCombo = BI.inherit(BI.Widget, { eventName: BI.Combo.EVENT_AFTER_HIDEVIEW, action: function () { self.trigger.stopEditing(); + self.fireEvent(BI.SearchTextValueCombo.EVENT_AFTER_HIDEVIEW); } }, { eventName: BI.Combo.EVENT_BEFORE_POPUPVIEW, @@ -148,4 +149,5 @@ BI.SearchTextValueCombo = BI.inherit(BI.Widget, { }); BI.SearchTextValueCombo.EVENT_CHANGE = "EVENT_CHANGE"; BI.SearchTextValueCombo.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW"; +BI.SearchTextValueCombo.EVENT_AFTER_HIDEVIEW = "EVENT_AFTER_HIDEVIEW" BI.shortcut("bi.search_text_value_combo", BI.SearchTextValueCombo); diff --git a/src/case/layer/panel.js b/src/case/layer/panel.js index 5c41e35d9..f73423789 100644 --- a/src/case/layer/panel.js +++ b/src/case/layer/panel.js @@ -11,22 +11,21 @@ BI.Panel = BI.inherit(BI.Widget, { titleHeight: 30, titleButtons: [], el: {}, - logic: { - dynamic: false - } + // logic: { + // dynamic: false + // } }); }, - _init: function () { + render: function () { BI.Panel.superclass._init.apply(this, arguments); var o = this.options; - BI.createWidget(BI.extend({ - element: this - }, BI.LogicFactory.createLogic("vertical", BI.extend(o.logic, { - items: BI.LogicFactory.createLogicItemsByDirection("top", this._createTitle() - , this.options.el) - })))); + return { + type: "bi.vertical_fill", + rowSize: ["", "fill"], + items: [this._createTitle(), this.options.el] + }; }, _createTitle: function () { @@ -56,18 +55,18 @@ BI.Panel = BI.inherit(BI.Widget, { }); return { - el: { - type: "bi.left_right_vertical_adapt", - cls: "panel-title bi-header-background bi-border-bottom", - height: BI.toPix(o.titleHeight, 1), - items: { - left: [this.text], - right: [this.button_group] - }, - lhgap: 10, - rhgap: 10 + // el: { + type: "bi.left_right_vertical_adapt", + cls: "panel-title bi-header-background bi-border-bottom", + height: BI.toPix(o.titleHeight, 1), + items: { + left: [this.text], + right: [this.button_group] }, - height: BI.toPix(o.titleHeight, 1) + lhgap: 10, + rhgap: 10 + // }, + // height: BI.toPix(o.titleHeight, 1) }; }, diff --git a/src/component/treevaluechooser/combo.treevaluechooser.js b/src/component/treevaluechooser/combo.treevaluechooser.js index 7b42f3d74..2c0709d67 100644 --- a/src/component/treevaluechooser/combo.treevaluechooser.js +++ b/src/component/treevaluechooser/combo.treevaluechooser.js @@ -73,6 +73,11 @@ BI.TreeValueChooserCombo = BI.inherit(BI.AbstractTreeValueChooser, { action: function () { self.fireEvent(BI.TreeValueChooserCombo.EVENT_BEFORE_POPUPVIEW); } + }, { + eventName: BI.MultiTreeCombo.EVENT_AFTER_HIDEVIEW, + action: function () { + self.fireEvent(BI.TreeValueChooserCombo.EVENT_AFTER_HIDEVIEW); + } }] }); }, @@ -128,4 +133,5 @@ BI.TreeValueChooserCombo.EVENT_BLUR = "EVENT_BLUR"; BI.TreeValueChooserCombo.EVENT_STOP = "EVENT_STOP"; BI.TreeValueChooserCombo.EVENT_CLICK_ITEM = "EVENT_CLICK_ITEM"; BI.TreeValueChooserCombo.EVENT_SEARCHING = "EVENT_SEARCHING"; +BI.TreeValueChooserCombo.EVENT_AFTER_HIDEVIEW = "EVENT_AFTER_HIDEVIEW"; BI.shortcut("bi.tree_value_chooser_combo", BI.TreeValueChooserCombo); diff --git a/src/core/2.base.js b/src/core/2.base.js index cc00f828c..d7007de52 100644 --- a/src/core/2.base.js +++ b/src/core/2.base.js @@ -486,7 +486,7 @@ if (typeof w === "number") { return w >= 0; } else if (typeof w === "string") { - return /^\d{1,3}(\.\d)?%$/.test(w) || w === "auto" || /^\d+px$/.test(w) || /^calc/.test(w); + return /^\d{1,3}(\.\d)?%$/.test(w) || w === "auto" || /^\d+(\.\d+)?px$/.test(w) || /^calc/.test(w); } }, diff --git a/src/core/4.widget.js b/src/core/4.widget.js index ab85900ff..3adf1f5f4 100644 --- a/src/core/4.widget.js +++ b/src/core/4.widget.js @@ -857,6 +857,17 @@ BI.Widget.context = context = contextStack.pop(); }; + BI.Widget.execWithContext = function (context, execFunc) { + BI.Widget.pushContext(context); + try { + execFunc(); + } catch (e) { + throw e; + } finally { + BI.Widget.popContext(); + } + }; + function pushTarget(_current) { if (current) currentStack.push(current); BI.Widget.current = current = _current; @@ -927,16 +938,6 @@ return vm; }; - BI.execWithContext = function (_context, fn) { - BI.Widget.pushContext(_context); - try { - fn(); - } catch (e) { - // nothing - } - BI.Widget.popContext(); - }; - BI.watch = function (vm, watch, handler) { // 必须要保证组件当前环境存在 if (BI.Widget.current) { diff --git a/src/core/platform/web/detectElementResize.js b/src/core/platform/web/detectElementResize.js index 357e938a7..3183a57c4 100644 --- a/src/core/platform/web/detectElementResize.js +++ b/src/core/platform/web/detectElementResize.js @@ -553,7 +553,7 @@ var ResizeObserver = window.ResizeObserver || ResizeObserverPolyfill.ResizeObser if (!element.__resizeObserver__) { var resizeObserver = new ResizeObserver(function () { element.__resizeListeners__.forEach(function (listener) { - listener(); + BI.$(element).is(":visible") && listener(); }); }); resizeObserver.observe(element); diff --git a/src/core/utils/events/mousemovetracker.js b/src/core/utils/events/mousemovetracker.js index 5bdac5f02..212072ebc 100644 --- a/src/core/utils/events/mousemovetracker.js +++ b/src/core/utils/events/mousemovetracker.js @@ -44,7 +44,7 @@ this._x = event.clientX; this._y = event.clientY; } - event.preventDefault ? event.preventDefault() : (event.returnValue = false); + // event.preventDefault ? event.preventDefault() : (event.returnValue = false); }, releaseMouseMoves: function () { @@ -104,4 +104,4 @@ this._onMoveEnd(); } }; -})(); \ No newline at end of file +})(); diff --git a/src/core/wrapper/layout/sticky/sticky.horizontal.js b/src/core/wrapper/layout/sticky/sticky.horizontal.js index a59dd6edf..afdf955aa 100644 --- a/src/core/wrapper/layout/sticky/sticky.horizontal.js +++ b/src/core/wrapper/layout/sticky/sticky.horizontal.js @@ -21,13 +21,29 @@ BI.HorizontalStickyLayout = BI.inherit(BI.FlexHorizontalLayout, { } } if (columnSize !== "fill") { - var firstItemFill = o.columnSize[0] === "fill" || o.items[0].width === "fill"; - w.element.css({ - position: "sticky", - zIndex: 1, - left: firstItemFill ? "" : 0, - right: firstItemFill ? 0 : "" + var fillIndex; + BI.count(0, o.items.length - 1, index => { + if (BI.isNotNull(fillIndex)) { + return; + } + if ((o.columnSize[index] === "fill" || o.items[index].width === "fill")) { + fillIndex = index; + } }); + + if (fillIndex > i) { + w.element.css({ + position: "sticky", + zIndex: 1, + left: 0, + }); + } else { + w.element.css({ + position: "sticky", + zIndex: 1, + right: 0 + }); + } } else { w.element.css({ overflow: "" diff --git a/src/core/wrapper/layout/sticky/sticky.vertical.js b/src/core/wrapper/layout/sticky/sticky.vertical.js index 970d84eef..beb0e9d43 100644 --- a/src/core/wrapper/layout/sticky/sticky.vertical.js +++ b/src/core/wrapper/layout/sticky/sticky.vertical.js @@ -21,13 +21,29 @@ BI.VerticalStickyLayout = BI.inherit(BI.FlexVerticalLayout, { } } if (rowSize !== "fill") { - var firstItemFill = o.rowSize[0] === "fill" || o.items[0].height === "fill"; - w.element.css({ - position: "sticky", - zIndex: 1, - top: firstItemFill ? "" : 0, - bottom: firstItemFill ? 0 : "" + var fillIndex; + BI.count(0, o.items.length - 1, index => { + if (BI.isNotNull(fillIndex)) { + return; + } + if ((o.rowSize[index] === "fill" || o.items[index].height === "fill")) { + fillIndex = index; + } }); + + if (fillIndex > i) { + w.element.css({ + position: "sticky", + zIndex: 1, + top: 0, + }); + } else { + w.element.css({ + position: "sticky", + zIndex: 1, + bottom: 0 + }); + } } else { w.element.css({ overflow: "" diff --git a/src/less/base/single/button/button.half.less b/src/less/base/single/button/button.half.less index b652328fb..c39b9d033 100644 --- a/src/less/base/single/button/button.half.less +++ b/src/less/base/single/button/button.half.less @@ -6,10 +6,13 @@ &:after { position: absolute; - left: 2px; - top: 2px; - width: 8px; - height: 8px; + .border-radius(2px); + display: table; + left: 50%; + top: 50%; + width: 70%; + height: 70%; + .transform(translate(-50%, -50%)); background-color: @color-bi-background-half-button-content; content: ''; } diff --git a/src/less/base/single/input/checkbox.less b/src/less/base/single/input/checkbox.less index 7141d75a9..50156c323 100644 --- a/src/less/base/single/input/checkbox.less +++ b/src/less/base/single/input/checkbox.less @@ -6,20 +6,21 @@ border: 1px solid @color-bi-border-checkbox; .box-sizing(border-box); .transition(all .1s); + &:after { position: absolute; display: table; - // 百分比会出现像素误差 - top: 6px; - left: 2px; + top: 45%; + left: 18%; border: 2px solid transparent; + border: calc(var(--css-scale, 1) * 2px) solid transparent; border-top: 0; border-left: 0; - width: 6px; - height: 9px; + width: 50%; + height: 75%; .box-sizing(border-box); .transform(rotate(45deg) scale(1) translate(-50%, -50%)); - @transition: all .1s cubic-bezier(.71,-.46,.88,.6),opacity .1s; + @transition: all .1s cubic-bezier(.71, -.46, .88, .6), opacity .1s; .transition(@transition); content: ''; } diff --git a/src/less/base/single/input/radio.less b/src/less/base/single/input/radio.less index 0a3345e42..a1aaa4071 100644 --- a/src/less/base/single/input/radio.less +++ b/src/less/base/single/input/radio.less @@ -2,13 +2,15 @@ .bi-radio { & .radio-content, &.radio-content { - .border-radius(8px); + .border-radius(50%); border: 1px solid @color-bi-border-radio; .box-sizing(border-box); .transition(all .1s); + &:after { content: ""; } + &.hover, &:hover { border-color: @color-bi-border-hover-active-radio; } @@ -18,16 +20,15 @@ border-color: @color-bi-border-hover-active-radio; background-color: @color-bi-background-active-radio; &:after { - width: 8px; - height: 8px; - display: table; + width: 50%; + height: 50%; position: absolute; top: 50%; left: 50%; - .border-radius(4px); + .border-radius(50%); background-color: @color-bi-background-active-radio-content; .transform(translate(-50%, -50%)); - @transition: all .1s cubic-bezier(.71,-.46,.88,.6),opacity .1s; + @transition: all .1s cubic-bezier(.71, -.46, .88, .6), opacity .1s; .transition(@transition); } } diff --git a/src/less/base/single/instruction.less b/src/less/base/single/instruction.less new file mode 100644 index 000000000..51b9b0af4 --- /dev/null +++ b/src/less/base/single/instruction.less @@ -0,0 +1,31 @@ +@import "../../index.less"; + +.bi-instruction { + .border-radius(2px); + + &.instruction-error{ + background: @color-bi-background-bubble-error; + color: @color-bi-text-failure; + } + + &.instruction-common{ + background: @color-bi-background-bubble-normal; + color: @color-bi-text-highlight; + } + + &.instruction-success{ + background: @color-bi-background-bubble-success; + color: @color-bi-text-success; + } + + &.instruction-warning{ + background: @color-bi-background-bubble-warning; + color: @color-bi-text-redmark; + } +} + +.bi-theme-dark { + .bi-instruction.instruction-error { + background: @color-bi-background-bubble-error-theme-dark; + } +} diff --git a/src/less/base/single/tip/tip.bubble.less b/src/less/base/single/tip/tip.bubble.less index e18e3ffc9..eb151aec4 100644 --- a/src/less/base/single/tip/tip.bubble.less +++ b/src/less/base/single/tip/tip.bubble.less @@ -9,10 +9,6 @@ color: @color-bi-text-failure; } - .bi-theme-dark &.bubble-error { - background: @color-bi-background-bubble-error-theme-dark; - } - &.bubble-common{ background: @color-bi-background-bubble-normal; color: @color-bi-text-highlight; @@ -28,3 +24,9 @@ color: @color-bi-text-redmark; } } + +.bi-theme-dark { + .bi-bubble.bubble-error { + background: @color-bi-background-bubble-error-theme-dark; + } +} diff --git a/src/less/base/tree/ztree.less b/src/less/base/tree/ztree.less index 1eb5896a6..a75904add 100644 --- a/src/less/base/tree/ztree.less +++ b/src/less/base/tree/ztree.less @@ -1,5 +1,10 @@ @import "../../index.less"; +.use-scale(@property, @pix) { + @{property} : @pix; //不支持css变量的浏览器 + @{property} : calc(var(--css-scale, 1) * @pix); +} + .ztree * { padding: 0; margin: 0; @@ -27,7 +32,7 @@ .ztree.solid li ul { margin: 0; - padding: 0 0 0 24px + .use-scale(padding-left, 24px); } // 此处不用2倍图,改用css画虚线 @@ -50,7 +55,7 @@ &:before { border-left: 1px solid @border-color-dark-gray-line; height: 100%; - left: 14px; + .use-scale(left, 14px); margin-top: 0; } } @@ -113,35 +118,8 @@ } .ztree.solid li a { - height: 30px; -} - -.ztree li a.curSelectedNode { -} - -.ztree li a.curSelectedNode_Edit { - padding-top: 0px; - background-color: #FFE6B0; - color: black; - height: 16px; - border: 1px #FFB951 solid; - opacity: 0.8; -} - -.ztree li a.tmpTargetNode_inner { - padding-top: 0px; - background-color: #316AC5; - color: white; - height: 16px; - border: 1px #316AC5 solid; - opacity: 0.8; - filter: alpha(opacity=80) -} - -.ztree li a.tmpTargetNode_prev { -} - -.ztree li a.tmpTargetNode_next { + //height: 30px; + .use-scale(height, 30px); } .ztree li a input.rename { @@ -163,7 +141,8 @@ } .ztree.solid li span { - line-height: 30px; + //line-height: 30px; + .use-scale(line-height, 30px); } .ztree li span.icon { @@ -183,10 +162,6 @@ vertical-align: middle; border: 0 none; cursor: pointer; - outline: none; - background-color: transparent; - background-repeat: no-repeat; - background-attachment: scroll; } .ztree li span.button.chk { @@ -215,57 +190,100 @@ } } - -.ztree li span.button.chk { +.ztree.solid li span.button.roots_docu { + background: none; position: relative; - width: 14px; - height: 14px; - margin: 0 3px 0 0; - cursor: auto -} -.ztree li span.button.chk.checkbox_false_disable { - background-position: 0 -56px -} + &:before { + position: absolute; + bottom: 0; + left: -1px; + width: 50%; + height: 50%; + border-right: 1px solid @border-color-dark-gray-line; + content: ''; + } -.ztree li span.button.chk.checkbox_true_disable { - background-position: -14px -56px + &:after { + position: absolute; + top: 0; + right: 0; + height: 50%; + width: 50%; + border-bottom: 1px solid @border-color-dark-gray-line; + content: ''; + } } -.ztree li span.button.chk.radio_false_full { - background-position: -28px 0 -} +.ztree.solid li span.button.center_docu { + background: none; + position: relative; -.ztree li span.button.chk.radio_false_full_focus { - background-position: -28px -14px -} + &:before { + position: absolute; + top: 0; + left: -1px; + width: 50%; + height: 100%; + border-right: 1px solid @border-color-dark-gray-line; + content: ''; + } -.ztree li span.button.chk.radio_false_part { - background-position: -28px -28px + &:after { + position: absolute; + top: 0; + right: 0; + height: 50%; + width: 50%; + border-bottom: 1px solid @border-color-dark-gray-line; + content: ''; + } } -.ztree li span.button.chk.radio_false_part_focus { - background-position: -28px -42px -} +.ztree.solid li span.button.bottom_docu { + background: none; + position: relative; -.ztree li span.button.chk.radio_false_disable { - background-position: -28px -56px -} + &:before { + position: absolute; + top: 0; + left: -1px; + width: 50%; + height: 50%; + border-right: 1px solid @border-color-dark-gray-line; + content: ''; + } -.ztree li span.button.chk.radio_true_full { - background-position: -42px 0 + &:after { + position: absolute; + top: 0; + right: 1px; + height: 50%; + width: 50%; + border-bottom: 1px solid @border-color-dark-gray-line; + content: ''; + } } -.ztree li span.button.chk.radio_true_full_focus { - background-position: -42px -14px; -} +.bi-theme-dark { + .ztree.solid li span.button.center_docu, .ztree.solid li span.button.bottom_docu { + &:before { + border-right: 1px solid @border-color-dark-gray-line-theme-dark; + } -.ztree li span.button.chk.radio_true_part { - background-position: -42px -28px + &:after { + border-bottom: 1px solid @border-color-dark-gray-line-theme-dark; + } + } } -.ztree li span.button.chk.radio_true_part_focus { - background-position: -42px -42px + +.ztree li span.button.chk { + position: relative; + .use-scale(width, 14px); + .use-scale(height, 14px); + margin: 0 3px 0 0; + cursor: auto } .ztree li span.button.chk.checkbox_true_full { @@ -292,73 +310,16 @@ } } -.ztree li span.button.chk.radio_true_disable { - background-position: -42px -56px -} - .ztree li span.button.switch { width: 24px; height: 24px } .ztree.solid li span.button.switch { - width: 30px; - height: 30px -} - -.ztree li span.button.switch.noline_open { - width: 0; -} - -.ztree li span.button.switch.noline_close { - width: 0; -} - -.ztree li span.button.noline_open { - background-position: -92px -72px -} - -.ztree li span.button.noline_close { - background-position: -74px -72px -} - -.ztree li span.button.root_docu { - background: none; -} - -.ztree li span.button.noline_docu { - background: none; - width: 0; -} - -.ztree li span.button.ico_open { - margin-right: 2px; - background-position: -110px -16px; - vertical-align: top; -} - -.ztree li span.button.ico_close { - margin-right: 2px; - background-position: -110px 0; - vertical-align: top; -} - -.ztree li span.button.ico_docu { - margin-right: 2px; - background-position: -110px -32px; - vertical-align: top; -} - -.ztree li span.button.edit { - margin-right: 2px; - background-position: -110px -48px; - vertical-align: top; -} - -.ztree li span.button.remove { - margin-right: 2px; - background-position: -110px -64px; - vertical-align: top; + .use-scale(width, 30px); + .use-scale(height, 30px); + //width: 30px; + //height: 30px; } .ztree li span.button.ico_loading { @@ -366,53 +327,3 @@ margin-right: 2px; vertical-align: top; } - -ul.tmpTargetzTree { - background-color: #FFE6B0; - opacity: 0.8; - filter: alpha(opacity=80) -} - -span.tmpzTreeMove_arrow { - width: 16px; - height: 16px; - display: inline-block; - padding: 0; - margin: 2px 0 0 1px; - border: 0 none; - position: absolute; - background-color: transparent; - background-repeat: no-repeat; - background-attachment: scroll; - background-position: -110px -80px; -} - -ul.ztree.zTreeDragUL { - margin: 0; - padding: 0; - position: absolute; - width: auto; - height: auto; - overflow: hidden; - background-color: #cfcfcf; - border: 1px #00B83F dotted; - opacity: 0.8; - filter: alpha(opacity=80) -} - -.zTreeMask { - z-index: 10000; - background-color: #cfcfcf; - opacity: 0.0; - filter: alpha(opacity=0); - position: absolute -} - -/* level style*/ -/*.ztree li span.button.level0 { - display:none; -} -.ztree li ul.level0 { - padding:0; - background:none; -}*/ diff --git a/src/less/case/tree/tree.item.less b/src/less/case/tree/tree.item.less index 3098f664a..2d2d7a9bc 100644 --- a/src/less/case/tree/tree.item.less +++ b/src/less/case/tree/tree.item.less @@ -1,6 +1,29 @@ @import "../../index.less"; -.tree-first-solid-line-conn-background, .tree-mid-solid-line-conn-background { +.tree-first-solid-line-conn-background { + &:before { + position: absolute; + bottom: 0; + left: -1px; + width: 50%; + height: 50%; + border-right: 1px solid @border-color-dark-gray-line; + content: ''; + } + + &:after { + position: absolute; + top: 0; + right: 0; + height: 50%; + width: 50%; + border-bottom: 1px solid @border-color-dark-gray-line; + content: ''; + } +} + + +.tree-mid-solid-line-conn-background { &:before { position: absolute; top: 0; diff --git a/src/less/core/utils/common.less b/src/less/core/utils/common.less index d4b0d3bcd..7e0d85ff0 100644 --- a/src/less/core/utils/common.less +++ b/src/less/core/utils/common.less @@ -74,9 +74,10 @@ border-color: @color-bi-border-highlight; } // ie下不支持focus-within, 和上面写在一起会导致ie下:hover不生效 - &:focus-within{ + &:focus-within { border-color: @color-bi-border-highlight; } + &.disabled { &:hover { border-color: @border-color-line; @@ -84,6 +85,14 @@ } } +.base-disabled { + .bi-focus-shadow { + &:hover { + border-color: @border-color-line; + } + } +} + .bi-theme-dark { .bi-focus-shadow { &.disabled { @@ -94,6 +103,16 @@ } } +.bi-theme-dark { + .base-disabled { + .bi-focus-shadow { + &:hover { + border-color: @border-color-line-theme-dark; + } + } + } +} + .clearfix { .clearfix(); } @@ -102,6 +121,7 @@ .bi-background { background-color: @color-bi-background-normal; color: @color-bi-text-background; + & .bi-input { color: @color-bi-text-background; } diff --git a/src/less/resource/background.less b/src/less/resource/background.less index 8aca40b17..c204e1653 100644 --- a/src/less/resource/background.less +++ b/src/less/resource/background.less @@ -43,6 +43,7 @@ .ztree li span.button.root_open { .image2xPath(@icon-tree-expand-type1-theme-dark); } + .ztree.solid li span.button.root_open { .image2xPath(@icon-tree-solid-expand-type1-theme-dark); } @@ -60,6 +61,7 @@ .ztree li span.button.root_close { .image2xPath(@icon-tree-collapse-type1-theme-dark); } + .ztree.solid li span.button.root_close { .image2xPath(@icon-tree-solid-collapse-type1-theme-dark); } @@ -70,15 +72,16 @@ } .ztree.solid li span.button.roots_open { - .image2xPath(@icon-tree-solid-expand-type2); + .image2xPath(@icon-tree-solid-expand-type1); } .bi-theme-dark { .ztree li span.button.roots_open { .image2xPath(@icon-tree-expand-type2-theme-dark); } + .ztree.solid li span.button.roots_open { - .image2xPath(@icon-tree-solid-expand-type2-theme-dark); + .image2xPath(@icon-tree-solid-expand-type1-theme-dark); } } @@ -87,15 +90,16 @@ } .ztree.solid li span.button.roots_close { - .image2xPath(@icon-tree-solid-collapse-type2); + .image2xPath(@icon-tree-solid-collapse-type1); } .bi-theme-dark { .ztree li span.button.roots_close { .image2xPath(@icon-tree-collapse-type2-theme-dark); } + .ztree.solid li span.button.roots_close { - .image2xPath(@icon-tree-solid-collapse-type2-theme-dark); + .image2xPath(@icon-tree-solid-collapse-type1-theme-dark); } } @@ -104,15 +108,16 @@ } .ztree.solid li span.button.center_open { - .image2xPath(@icon-tree-solid-expand-type3); + .image2xPath(@icon-tree-solid-expand-type1); } .bi-theme-dark { .ztree li span.button.center_open { .image2xPath(@icon-tree-expand-type3-theme-dark); } + .ztree.solid li span.button.center_open { - .image2xPath(@icon-tree-solid-expand-type3-theme-dark); + .image2xPath(@icon-tree-solid-expand-type1-theme-dark); } } @@ -121,15 +126,16 @@ } .ztree.solid li span.button.center_close { - .image2xPath(@icon-tree-solid-collapse-type3); + .image2xPath(@icon-tree-solid-collapse-type1); } .bi-theme-dark { .ztree li span.button.center_close { .image2xPath(@icon-tree-collapse-type3-theme-dark); } + .ztree.solid li span.button.center_close { - .image2xPath(@icon-tree-solid-collapse-type3-theme-dark); + .image2xPath(@icon-tree-solid-collapse-type1-theme-dark); } } @@ -138,15 +144,16 @@ } .ztree.solid li span.button.bottom_open { - .image2xPath(@icon-tree-solid-expand-type4); + .image2xPath(@icon-tree-solid-expand-type1); } .bi-theme-dark { .ztree li span.button.bottom_open { .image2xPath(@icon-tree-expand-type4-theme-dark); } + .ztree.solid li span.button.bottom_open { - .image2xPath(@icon-tree-solid-expand-type4-theme-dark); + .image2xPath(@icon-tree-solid-expand-type1-theme-dark); } } @@ -155,15 +162,16 @@ } .ztree.solid li span.button.bottom_close { - .image2xPath(@icon-tree-solid-collapse-type4); + .image2xPath(@icon-tree-solid-collapse-type1); } .bi-theme-dark { .ztree li span.button.bottom_close { .image2xPath(@icon-tree-collapse-type4-theme-dark); } + .ztree.solid li span.button.bottom_close { - .image2xPath(@icon-tree-solid-collapse-type4-theme-dark); + .image2xPath(@icon-tree-solid-collapse-type1-theme-dark); } } @@ -171,51 +179,31 @@ .image2xPath(@icon-tree-vertical-line-2); } -.ztree.solid li span.button.roots_docu { - .image2xPath(@icon-tree-solid-vertical-line-2); -} - .bi-theme-dark { .ztree li span.button.roots_docu { .image2xPath(@icon-tree-vertical-line-2-theme-dark); } - .ztree.solid li span.button.roots_docu { - .image2xPath(@icon-tree-solid-vertical-line-2-theme-dark); - } } .ztree li span.button.center_docu { .image2xPath(@icon-tree-vertical-line-3); } -.ztree.solid li span.button.center_docu { - .image2xPath(@icon-tree-solid-vertical-line-3); -} - .bi-theme-dark { .ztree li span.button.center_docu { .image2xPath(@icon-tree-vertical-line-3-theme-dark); } - .ztree.solid li span.button.center_docu { - .image2xPath(@icon-tree-solid-vertical-line-3-theme-dark); - } } .ztree li span.button.bottom_docu { .image2xPath(@icon-tree-vertical-line-4); } -.ztree.solid li span.button.bottom_docu { - .image2xPath(@icon-tree-solid-vertical-line-4); -} .bi-theme-dark { .ztree li span.button.bottom_docu { .image2xPath(@icon-tree-vertical-line-4-theme-dark); } - .ztree.solid li span.button.bottom_docu { - .image2xPath(@icon-tree-solid-vertical-line-4-theme-dark); - } } .ztree li span.button.ico_loading { @@ -335,43 +323,43 @@ } .auto-color-background { - &.hack{ + &.hack { .imagePath(@background-auto-color); } } .auto-color-normal-background { - &.hack{ + &.hack { .imagePath(@background-auto-color-normal); } } .auto-color-normal-disabled-background { - &.hack{ + &.hack { .imagePath(@background-auto-color-disabled); } } .auto-color-square-normal-background { - &.hack{ + &.hack { .imagePath(@background-auto-color-square-normal); } } .auto-color-no-square-normal-background { - &.hack{ + &.hack { .imagePath(@background-auto-color-no-square-normal); } } .trans-color-background { - &.hack{ + &.hack { .imagePath(@background-trans-color); } } .trans-color-disabled-background { - &.hack{ + &.hack { .imagePath(@background-trans-color-disabled); } } diff --git a/src/less/visual.less b/src/less/visual.less index 8e227fb8f..3c7601937 100644 --- a/src/less/visual.less +++ b/src/less/visual.less @@ -339,7 +339,7 @@ } .hover-visible(@cls) { - & .@{cls} { + & .@{cls}:not(.bi-combo-popup) { visibility: hidden; } &:hover { diff --git a/src/widget/intervalslider/intervalslider.js b/src/widget/intervalslider/intervalslider.js index 71351dd71..59b1e1676 100644 --- a/src/widget/intervalslider/intervalslider.js +++ b/src/widget/intervalslider/intervalslider.js @@ -26,7 +26,7 @@ BI.IntervalSlider = BI.inherit(BI.Single, { beforeMount: function () { const { value, min, max } = this.options; - this.setMinAndMax({ + this._setMinAndMax({ min, max, }); @@ -260,12 +260,12 @@ BI.IntervalSlider = BI.inherit(BI.Single, { items: [ { el: this.sliderOne, - top: 1, + top: 0, bottom: 0, left: 0 }, { el: this.sliderTwo, - top: 1, + top: 0, bottom: 0, left: "100%" } @@ -487,22 +487,23 @@ BI.IntervalSlider = BI.inherit(BI.Single, { }, - setMinAndMax: function (v) { + _setMinAndMax: function (v) { var minNumber = BI.parseFloat(v.min); var maxNumber = BI.parseFloat(v.max); - if ((!isNaN(minNumber)) && (!isNaN(maxNumber)) && (maxNumber >= minNumber )) { + if ((!isNaN(minNumber)) && (!isNaN(maxNumber)) && (maxNumber >= minNumber)) { this.min = minNumber; this.max = maxNumber; this.valueOne = minNumber; this.valueTwo = maxNumber; this.precision = this._getPrecision(); - this.setEnable(true); - } - if (maxNumber === minNumber) { - this.setEnable(false); } }, + setMinAndMax: function (v) { + this._setMinAndMax(v); + this.setEnable(v.min <= v.max); + }, + setValue: function (v) { var o = this.options; var valueOne = BI.parseFloat(v.min); diff --git a/src/widget/multilayersingletree/multilayersingletree.combo.js b/src/widget/multilayersingletree/multilayersingletree.combo.js index 74876e8d5..4e26c1a0c 100644 --- a/src/widget/multilayersingletree/multilayersingletree.combo.js +++ b/src/widget/multilayersingletree/multilayersingletree.combo.js @@ -49,6 +49,8 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, { } return BI.extend(baseConfig, { + width: BI.toPix(o.width, 2), + height: BI.toPix(o.height, 2), el: { type: "bi.single_tree_trigger", ref: function (_ref) { diff --git a/src/widget/multitree/multi.tree.combo.js b/src/widget/multitree/multi.tree.combo.js index d48e8d6db..bdf374f07 100644 --- a/src/widget/multitree/multi.tree.combo.js +++ b/src/widget/multitree/multi.tree.combo.js @@ -82,6 +82,7 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, { self.numberCounter.setButtonChecked(val); self.storeValue = { value: self.combo.getValue() }; self.fireEvent(BI.MultiTreeCombo.EVENT_CLICK_ITEM, self.combo.getValue()); + self._dataChange = true; } }, { eventName: BI.MultiTreePopup.EVENT_CLICK_CONFIRM, @@ -92,6 +93,7 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, { eventName: BI.MultiTreePopup.EVENT_CLICK_CLEAR, action: function () { clear = true; + self._dataChange = true; self.setValue(); self._defaultState(); } @@ -180,12 +182,16 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, { this.getSearcher().setState(checked ? BI.Selection.Multi : BI.Selection.None); self.numberCounter.setButtonChecked(val); self.fireEvent(BI.MultiTreeCombo.EVENT_CLICK_ITEM, self.combo.getValue()); + self._dataChange = true; }); this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () { if (isSearching()) { return; } + if (!this.isViewVisible()) { + self._dataChange = false; // 标记数据是否发生变化 + } if (change === true) { self.storeValue = { value: self.combo.getValue() }; change = false; @@ -198,7 +204,7 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, { this.combo.on(BI.Combo.EVENT_BEFORE_HIDEVIEW, function () { if (isSearching()) { self._stopEditing(); - self.fireEvent(BI.MultiTreeCombo.EVENT_CONFIRM); + self._dataChange && self.fireEvent(BI.MultiTreeCombo.EVENT_CONFIRM); } else { if (isPopupView()) { self._stopEditing(); @@ -206,12 +212,15 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, { if (clear === true) { self.storeValue = { value: {} }; } - self.fireEvent(BI.MultiTreeCombo.EVENT_CONFIRM); + self._dataChange && self.fireEvent(BI.MultiTreeCombo.EVENT_CONFIRM); } } clear = false; change = false; }); + this.combo.on(BI.Combo.EVENT_AFTER_HIDEVIEW, function () { + self.fireEvent(BI.MultiTreeCombo.EVENT_AFTER_HIDEVIEW); + }); var triggerBtn = BI.createWidget({ type: "bi.trigger_icon_button", @@ -367,5 +376,6 @@ BI.MultiTreeCombo.EVENT_SEARCHING = "EVENT_SEARCHING"; BI.MultiTreeCombo.EVENT_CLICK_ITEM = "EVENT_CLICK_ITEM"; BI.MultiTreeCombo.EVENT_CONFIRM = "EVENT_CONFIRM"; BI.MultiTreeCombo.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW"; +BI.MultiTreeCombo.EVENT_AFTER_HIDEVIEW = "EVENT_AFTER_HIDEVIEW"; BI.shortcut("bi.multi_tree_combo", BI.MultiTreeCombo); diff --git a/src/widget/multitree/multi.tree.insert.combo.js b/src/widget/multitree/multi.tree.insert.combo.js index c9ce5545f..6db34dc61 100644 --- a/src/widget/multitree/multi.tree.insert.combo.js +++ b/src/widget/multitree/multi.tree.insert.combo.js @@ -56,6 +56,7 @@ BI.MultiTreeInsertCombo = BI.inherit(BI.Single, { self.combo.setValue(self.storeValue); self.numberCounter.setValue(self.storeValue); self._stopEditing(); + self._dataChange = true; } }] } @@ -99,6 +100,7 @@ BI.MultiTreeInsertCombo = BI.inherit(BI.Single, { self.numberCounter.setButtonChecked(val); self.storeValue = { value: self.combo.getValue() }; self.fireEvent(BI.MultiTreeInsertCombo.EVENT_CLICK_ITEM, self.getValue()); + self._dataChange = true; } }, { eventName: BI.MultiTreePopup.EVENT_CLICK_CONFIRM, @@ -109,6 +111,7 @@ BI.MultiTreeInsertCombo = BI.inherit(BI.Single, { eventName: BI.MultiTreePopup.EVENT_CLICK_CLEAR, action: function () { clear = true; + self._dataChange = true; self.setValue(); self._defaultState(); } @@ -192,12 +195,16 @@ BI.MultiTreeInsertCombo = BI.inherit(BI.Single, { this.getSearcher().setState(checked ? BI.Selection.Multi : BI.Selection.None); self.numberCounter.setButtonChecked(val); self.fireEvent(BI.MultiTreeInsertCombo.EVENT_CLICK_ITEM, self.combo.getValue()); + self._dataChange = true; }); this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () { if (isSearching()) { return; } + if (!this.isViewVisible()) { + self._dataChange = false; // 标记数据是否发生变化 + } if (change === true) { self.storeValue = { value: self.combo.getValue() }; change = false; @@ -210,7 +217,7 @@ BI.MultiTreeInsertCombo = BI.inherit(BI.Single, { this.combo.on(BI.Combo.EVENT_BEFORE_HIDEVIEW, function () { if (isSearching()) { self._stopEditing(); - self.fireEvent(BI.MultiTreeInsertCombo.EVENT_CONFIRM); + self._dataChange && self.fireEvent(BI.MultiTreeInsertCombo.EVENT_CONFIRM); } else { if (isPopupView()) { self._stopEditing(); @@ -218,7 +225,7 @@ BI.MultiTreeInsertCombo = BI.inherit(BI.Single, { if (clear === true) { self.storeValue = { value: {} }; } - self.fireEvent(BI.MultiTreeInsertCombo.EVENT_CONFIRM); + self._dataChange && self.fireEvent(BI.MultiTreeInsertCombo.EVENT_CONFIRM); } } clear = false; diff --git a/src/widget/multitree/multi.tree.list.combo.js b/src/widget/multitree/multi.tree.list.combo.js index 9b82b8780..a3a016179 100644 --- a/src/widget/multitree/multi.tree.list.combo.js +++ b/src/widget/multitree/multi.tree.list.combo.js @@ -59,6 +59,7 @@ BI.MultiTreeListCombo = BI.inherit(BI.Single, { self.combo.setValue(self.storeValue); self.numberCounter.setValue(self.storeValue); self._stopEditing(); + self._dataChange = true; } }] } @@ -116,6 +117,7 @@ BI.MultiTreeListCombo = BI.inherit(BI.Single, { self.numberCounter.setButtonChecked(val); self.storeValue = { value: self.combo.getValue() }; self.fireEvent(BI.MultiTreeListCombo.EVENT_CLICK_ITEM, self.getValue()); + self._dataChange = true; } }, { eventName: BI.MultiTreePopup.EVENT_CLICK_CONFIRM, @@ -126,6 +128,7 @@ BI.MultiTreeListCombo = BI.inherit(BI.Single, { eventName: BI.MultiTreePopup.EVENT_CLICK_CLEAR, action: function () { clear = true; + self._dataChange = true; self.setValue(); self._defaultState(); } @@ -209,12 +212,16 @@ BI.MultiTreeListCombo = BI.inherit(BI.Single, { this.getSearcher().setState(checked ? BI.Selection.Multi : BI.Selection.None); self.numberCounter.setButtonChecked(val); self.fireEvent(BI.MultiTreeListCombo.EVENT_CLICK_ITEM, self.combo.getValue()); + self._dataChange = true; }); this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () { if (isSearching()) { return; } + if (!this.isViewVisible()) { + self._dataChange = false; // 标记数据是否发生变化 + } if (change === true) { self.storeValue = { value: self.combo.getValue() }; change = false; @@ -227,7 +234,7 @@ BI.MultiTreeListCombo = BI.inherit(BI.Single, { this.combo.on(BI.Combo.EVENT_BEFORE_HIDEVIEW, function () { if (isSearching()) { self.trigger.stopEditing(); - self.fireEvent(BI.MultiTreeListCombo.EVENT_CONFIRM); + self._dataChange && self.fireEvent(BI.MultiTreeListCombo.EVENT_CONFIRM); } else { if (isPopupView()) { self._stopEditing(); @@ -235,7 +242,7 @@ BI.MultiTreeListCombo = BI.inherit(BI.Single, { if (clear === true) { self.storeValue = { value: [] }; } - self.fireEvent(BI.MultiTreeListCombo.EVENT_CONFIRM); + self._dataChange && self.fireEvent(BI.MultiTreeListCombo.EVENT_CONFIRM); } } clear = false; diff --git a/typescript/index.ts b/typescript/index.ts index 3aaca1ead..a1b9831c9 100644 --- a/typescript/index.ts +++ b/typescript/index.ts @@ -145,6 +145,7 @@ import { ArrowTreeGroupNodeCheckbox } from "./case/checkbox/check.arrownode"; import { NumberInterval } from "./widget/numberinterval/numberinterval"; import { DynamicYearQuarterCombo } from "./widget/yearquarter/combo.yearquarter"; import { DynamicYearCombo } from "./widget/year/combo.year"; +import { DynamicYearPopup } from "./widget/year/popup.year"; import { IntervalSlider } from "./widget/intervalslider/intervalslider"; import { MultiSelectInsertList } from "./widget/multiselectlist/multiselectlist.insert"; import { YearMonthInterval } from "./widget/yearmonthinterval/yearmonthinterval"; @@ -350,6 +351,7 @@ export interface BI extends _func, _i18n, _base, _inject, _var, _web, _utils { NumberInterval: typeof NumberInterval; DynamicYearQuarterCombo: typeof DynamicYearQuarterCombo; DynamicYearCombo: typeof DynamicYearCombo; + DynamicYearPopup: typeof DynamicYearPopup; IntervalSlider: typeof IntervalSlider; MultiSelectInsertList: typeof MultiSelectInsertList; YearMonthInterval: typeof YearMonthInterval; @@ -546,6 +548,7 @@ export { NumberInterval, DynamicYearQuarterCombo, DynamicYearCombo, + DynamicYearPopup, IntervalSlider, MultiSelectInsertList, YearMonthInterval, diff --git a/typescript/widget/datepane/datepane.ts b/typescript/widget/datepane/datepane.ts index 6e3212bfc..3e62cf149 100644 --- a/typescript/widget/datepane/datepane.ts +++ b/typescript/widget/datepane/datepane.ts @@ -4,8 +4,8 @@ export declare class DynamicDatePane extends Widget { static xtype: string; static EVENT_CHANGE: string; static EVENT_BEFORE_YEAR_MONTH_POPUPVIEW: string; - static Static: 1; - static Dynamic: 2; + static Static: number; + static Dynamic: number; setMinDate(minDate: string): void; diff --git a/typescript/widget/dynamicdate/dynamicdate.combo.ts b/typescript/widget/dynamicdate/dynamicdate.combo.ts index 00921782f..305a71c4f 100644 --- a/typescript/widget/dynamicdate/dynamicdate.combo.ts +++ b/typescript/widget/dynamicdate/dynamicdate.combo.ts @@ -2,8 +2,8 @@ import { Single } from '../../base/single/single'; export declare class DynamicDateCombo extends Single { static xtype: string; - static Static: 1; - static Dynamic: 2; + static Static: number; + static Dynamic: number; static EVENT_KEY_DOWN: string; static EVENT_CONFIRM: string; diff --git a/typescript/widget/dynamicdatetime/dynamicdatetime.combo.ts b/typescript/widget/dynamicdatetime/dynamicdatetime.combo.ts index b4122ead8..268372758 100644 --- a/typescript/widget/dynamicdatetime/dynamicdatetime.combo.ts +++ b/typescript/widget/dynamicdatetime/dynamicdatetime.combo.ts @@ -11,8 +11,8 @@ export declare class DynamicDateTimeCombo extends Single { static EVENT_ERROR: string; static EVENT_BEFORE_POPUPVIEW: string; static EVENT_BEFORE_YEAR_MONTH_POPUPVIEW: string; - static Static: 1; - static Dynamic: 2; + static Static: number; + static Dynamic: number; props: { minDate?: string; maxDate?: string; diff --git a/typescript/widget/year/combo.year.ts b/typescript/widget/year/combo.year.ts index 809dc6c69..605f1700d 100644 --- a/typescript/widget/year/combo.year.ts +++ b/typescript/widget/year/combo.year.ts @@ -2,6 +2,8 @@ import { Widget } from "../../core/widget"; export declare class DynamicYearCombo extends Widget { static xtype: string; + static Static: number; + static Dynamic: number; static EVENT_CONFIRM: string; static EVENT_BEFORE_POPUPVIEW: string; diff --git a/typescript/widget/year/popup.year.ts b/typescript/widget/year/popup.year.ts new file mode 100644 index 000000000..16d61dc22 --- /dev/null +++ b/typescript/widget/year/popup.year.ts @@ -0,0 +1,13 @@ +import { Widget } from '../../core/widget'; + +export declare class DynamicYearPopup extends Widget { + static xtype: string; + static BUTTON_CLEAR_EVENT_CHANGE: string; + static BUTTON_lABEL_EVENT_CHANGE: string; + static BUTTON_OK_EVENT_CHANGE: string; + static EVENT_CHANGE: string; + + setMinDate(minDate?: string): void; + + setMaxDate(maxDate?: string): void; +}