diff --git a/bi.lessconfig.json b/bi.lessconfig.json index 975ecf6b6..e1e853591 100644 --- a/bi.lessconfig.json +++ b/bi.lessconfig.json @@ -7,7 +7,7 @@ "@color-black": "#000A19", "@color-light-gray": "#ECEEF3", "@color-light-gray-theme-dark": "#292F45", - "@color-dim-gray": "#2E3A4D", + "@border-color-dark-line": "#2E3A4D", "@color-sliver-theme-dark": "363E55", "@border-color-disabled": "#E7E8EB", @@ -16,5 +16,16 @@ "@color-bi-background-disabled-active-radio-content": "#D0D4DA", "@color-bi-background-disabled-active-radio-content-theme-dark": "#606479", "@color-bi-background-disabled-active-checkbox-content": "#D0D4DA", - "@color-bi-background-disabled-active-checkbox-content-theme-dark": "#606479" + "@color-bi-background-disabled-active-checkbox-content-theme-dark": "#606479", + "@color-bi-background-tooltip-success": "#2E3A4D", + "@color-bi-border-tooltip-success": "#2E3A4D", + "@color-bi-background-toast-success": "#FFFFFF", + "@color-bi-background-toast-warning": "#FFFFFF", + "@color-bi-background-toast-error": "#FFFFFF", + "@color-bi-background-toast-normal": "#FFFFFF", + "@color-bi-color-toast-success": "#3FC47B", + "@color-bi-color-toast-warning": "#FAAA39", + "@color-bi-color-toast-error": "#E65251", + "@color-bi-color-toast-normal": "#2C60DB", + "@color-bi-color-toast-text": "#000A19" } diff --git a/demo/js/base/tip/demo.toast.js b/demo/js/base/tip/demo.toast.js index 9d0352a6f..fcb845964 100644 --- a/demo/js/base/tip/demo.toast.js +++ b/demo/js/base/tip/demo.toast.js @@ -10,7 +10,9 @@ Demo.Toast = BI.inherit(BI.Widget, { text: "简单Toast测试(success)", height: 30, handler: function () { - BI.Msg.toast("这是一条简单的数据"); + BI.Msg.toast("这是一条简单的数据", { + level: "success" + }); } } }, { @@ -20,7 +22,7 @@ Demo.Toast = BI.inherit(BI.Widget, { height: 30, handler: function () { BI.Msg.toast("这是一条很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长的数据", { - level: "normal" + }); } } diff --git a/dist/fix/fix.js b/dist/fix/fix.js index e16bdf99f..63ebd6374 100644 --- a/dist/fix/fix.js +++ b/dist/fix/fix.js @@ -904,6 +904,10 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons return target; } + function freeze() { + return Object.freeze.apply(null, arguments); + } + /** * Delete a property and trigger change if necessary. */ @@ -1519,6 +1523,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons exports.notify = notify; exports.defineReactive = defineReactive; exports.set = set; + exports.freeze = freeze; exports.del = del; exports.Watcher = Watcher; exports.pushTarget = pushTarget; diff --git a/dist/fix/fix.proxy.js b/dist/fix/fix.proxy.js index f332da88b..19eca6178 100644 --- a/dist/fix/fix.proxy.js +++ b/dist/fix/fix.proxy.js @@ -1838,6 +1838,7 @@ if (!runner.effect.active) { return; } + if (cb) { // watch(source, cb) var newValue = runner(); @@ -2404,6 +2405,15 @@ } target[key] = val; + return target; + } + function freeze(value) { + Object.defineProperty(value, '__v_skip', { + configurable: true, + enumerable: false, + value: value + }); + return value; } function del(target, key) { if (_.isArray(target)) { @@ -2456,6 +2466,7 @@ exports.config = config; exports.define = define; exports.del = del; + exports.freeze = freeze; exports.mixin = mixin; exports.set = set; exports.toJSON = toJSON; diff --git a/jsy.lessconfig.json b/jsy.lessconfig.json index 8e2974193..9efbfa906 100644 --- a/jsy.lessconfig.json +++ b/jsy.lessconfig.json @@ -1,4 +1,5 @@ { + "@background-color-card-primary": "#003D4D", "@color-primary": "#00acbe", "font-color-normal": "#0d1540", "font-color-light-gray": "#0d1540", @@ -17,4 +18,4 @@ "border-color-disabled": "#e8eaed", "border-color-success": "#28b668", "border-color-negative": "#e65251" -} \ No newline at end of file +} diff --git a/package.json b/package.json index 741693633..f52cc05b8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fineui", - "version": "2.0.20220120115227", + "version": "2.0.20220208111230", "description": "fineui", "main": "dist/fineui.min.js", "types": "dist/lib/index.d.ts", diff --git a/src/base/combination/bubble.js b/src/base/combination/bubble.js index cf0548fb1..47c067e20 100644 --- a/src/base/combination/bubble.js +++ b/src/base/combination/bubble.js @@ -223,17 +223,6 @@ this.combo = BI.createWidget(this.options.el, { value: this.options.value }); - - if (this.options.showArrow) { - this.arrow = BI.createWidget({ - type: "bi.absolute", - cls: "bi-bubble-arrow", - items: [{ - type: "bi.layout", - cls: "bubble-arrow" - }] - }); - } }, _assertPopupView: function () { @@ -241,17 +230,9 @@ if (this.popupView == null) { this.popupView = BI.createWidget(this.options.popup, { type: "bi.bubble_popup_view", + showArrow: o.showArrow, value: o.value }, this); - if (this.options.showArrow) { - BI.createWidget({ - type: "bi.absolute", - element: this.popupView, - items: [{ - el: this.arrow - }] - }); - } this.popupView.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) { if (type === BI.Events.CLICK) { self.combo.setValue(self.getValue()); @@ -340,7 +321,7 @@ this._assertPopupViewRender(); this.fireEvent(BI.Bubble.EVENT_BEFORE_POPUPVIEW); // popupVisible是为了获取其宽高, 放到可视范围之外以防止在IE下闪一下 - this.popupView.css({left: -999999999, top: -99999999}); + // this.popupView.css({left: -999999999, top: -99999999}); this.popupView.visible(); this.adjustWidth(e); @@ -360,7 +341,7 @@ name: "arrow", options: { padding: 5, - element: this.arrow.element[0] + element: this.popupView.arrow.element[0] } }); } diff --git a/src/base/combination/combo.js b/src/base/combination/combo.js index 58f1b23cd..de401bdd6 100644 --- a/src/base/combination/combo.js +++ b/src/base/combination/combo.js @@ -6,8 +6,11 @@ * @extends BI.Widget */ BI.Combo = BI.inherit(BI.Bubble, { + _const: { + TRIANGLE_LENGTH: 9 + }, _defaultConfig: function () { - var conf = BI.Bubble.superclass._defaultConfig.apply(this, arguments); + var conf = BI.Combo.superclass._defaultConfig.apply(this, arguments); return BI.extend(conf, { baseCls: (conf.baseCls || "") + " bi-combo" + (BI.isIE() ? " hack" : ""), attributes: { @@ -25,6 +28,7 @@ hideWhenBlur: true, hideWhenAnotherComboOpen: false, hideWhenClickOutside: true, + showArrow: false, isNeedAdjustHeight: true, // 是否需要高度调整 isNeedAdjustWidth: true, stopEvent: false, @@ -96,29 +100,24 @@ }, this)); }, - _initCombo: function () { - this.combo = BI.createWidget(this.options.el, { - value: this.options.value - }); - }, - _assertPopupView: function () { var self = this, o = this.options; if (this.popupView == null) { this.popupView = BI.createWidget(this.options.popup, { type: "bi.popup_view", + showArrow: o.showArrow, value: o.value }, this); this.popupView.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) { if (type === BI.Events.CLICK) { self.combo.setValue(self.getValue()); - self.fireEvent(BI.Combo.EVENT_CHANGE, value, obj); + self.fireEvent(BI.Bubble.EVENT_CHANGE, value, obj); } self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); }); this.popupView.setVisible(false); BI.nextTick(function () { - self.fireEvent(BI.Combo.EVENT_AFTER_INIT); + self.fireEvent(BI.Bubble.EVENT_AFTER_INIT); }); } }, @@ -144,7 +143,7 @@ delete needHideWhenAnotherComboOpen[this.getName()]; delete currentOpenedCombos[this.getName()]; - BI.Widget._renderEngine.createElement(document).unbind("mousedown." + this.getName()).unbind("mousewheel." + this.getName()); + o.hideWhenClickOutside && BI.Widget._renderEngine.createElement(document).unbind("mousedown." + this.getName()).unbind("mousewheel." + this.getName()); BI.EVENT_BLUR && o.hideWhenBlur && BI.Widget._renderEngine.createElement(window).unbind("blur." + this.getName()); this.fireEvent(BI.Combo.EVENT_AFTER_HIDEVIEW); }, @@ -170,11 +169,11 @@ this.element.addClass(this.options.comboClass); o.hideWhenClickOutside && BI.Widget._renderEngine.createElement(document).unbind("mousedown." + this.getName()).unbind("mousewheel." + this.getName()); - BI.Widget._renderEngine.createElement(document).unbind("mousewheel." + this.getName()); + o.hideWhenClickOutside && BI.Widget._renderEngine.createElement(document).unbind("mousewheel." + this.getName()); BI.EVENT_BLUR && o.hideWhenBlur && BI.Widget._renderEngine.createElement(window).unbind("blur." + this.getName()); o.hideWhenClickOutside && BI.Widget._renderEngine.createElement(document).bind("mousedown." + this.getName(), BI.bind(this._hideIf, this)).bind("mousewheel." + this.getName(), BI.bind(this._hideIf, this)); - BI.Widget._renderEngine.createElement(document).bind("mousewheel." + this.getName(), BI.bind(this._hideIf, this)); + o.hideWhenClickOutside && BI.Widget._renderEngine.createElement(document).bind("mousewheel." + this.getName(), BI.bind(this._hideIf, this)); BI.EVENT_BLUR && o.hideWhenBlur && BI.Widget._renderEngine.createElement(window).bind("blur." + this.getName(), BI.bind(this._hideIf, this)); this.fireEvent(BI.Combo.EVENT_AFTER_POPUPVIEW); }, @@ -214,69 +213,83 @@ switch (o.direction) { case "bottom": case "bottom,right": - p = BI.DOM.getComboPosition(combo, this.popupView, o.adjustXOffset, o.adjustYOffset || o.adjustLength, o.isNeedAdjustHeight, ["bottom", "top", "right", "left"], o.offsetStyle); + p = BI.DOM.getComboPosition(combo, this.popupView, o.adjustXOffset, (o.adjustYOffset || o.adjustLength) + (o.showArrow ? this._const.TRIANGLE_LENGTH : 0), o.isNeedAdjustHeight, ["bottom", "top", "right", "left"], o.offsetStyle); break; case "top": case "top,right": - p = BI.DOM.getComboPosition(combo, this.popupView, o.adjustXOffset, o.adjustYOffset || o.adjustLength, o.isNeedAdjustHeight, ["top", "bottom", "right", "left"], o.offsetStyle); + p = BI.DOM.getComboPosition(combo, this.popupView, o.adjustXOffset, (o.adjustYOffset || o.adjustLength) + (o.showArrow ? this._const.TRIANGLE_LENGTH : 0), o.isNeedAdjustHeight, ["top", "bottom", "right", "left"], o.offsetStyle); break; case "left": case "left,bottom": - p = BI.DOM.getComboPosition(combo, this.popupView, o.adjustXOffset || o.adjustLength, o.adjustYOffset, o.isNeedAdjustHeight, ["left", "right", "bottom", "top"], o.offsetStyle); + p = BI.DOM.getComboPosition(combo, this.popupView, (o.adjustXOffset || o.adjustLength) + (o.showArrow ? this._const.TRIANGLE_LENGTH : 0), o.adjustYOffset, o.isNeedAdjustHeight, ["left", "right", "bottom", "top"], o.offsetStyle); break; case "right": case "right,bottom": - p = BI.DOM.getComboPosition(combo, this.popupView, o.adjustXOffset || o.adjustLength, o.adjustYOffset, o.isNeedAdjustHeight, ["right", "left", "bottom", "top"], o.offsetStyle); + p = BI.DOM.getComboPosition(combo, this.popupView, (o.adjustXOffset || o.adjustLength) + (o.showArrow ? this._const.TRIANGLE_LENGTH : 0), o.adjustYOffset, o.isNeedAdjustHeight, ["right", "left", "bottom", "top"], o.offsetStyle); break; case "top,left": - p = BI.DOM.getComboPosition(combo, this.popupView, o.adjustXOffset, o.adjustYOffset || o.adjustLength, o.isNeedAdjustHeight, ["top", "bottom", "left", "right"], o.offsetStyle); + p = BI.DOM.getComboPosition(combo, this.popupView, o.adjustXOffset, (o.adjustYOffset || o.adjustLength) + (o.showArrow ? this._const.TRIANGLE_LENGTH : 0), o.isNeedAdjustHeight, ["top", "bottom", "left", "right"], o.offsetStyle); break; case "bottom,left": - p = BI.DOM.getComboPosition(combo, this.popupView, o.adjustXOffset, o.adjustYOffset || o.adjustLength, o.isNeedAdjustHeight, ["bottom", "top", "left", "right"], o.offsetStyle); + p = BI.DOM.getComboPosition(combo, this.popupView, o.adjustXOffset, (o.adjustYOffset || o.adjustLength) + (o.showArrow ? this._const.TRIANGLE_LENGTH : 0), o.isNeedAdjustHeight, ["bottom", "top", "left", "right"], o.offsetStyle); break; case "left,top": - p = BI.DOM.getComboPosition(combo, this.popupView, o.adjustXOffset || o.adjustLength, o.adjustYOffset, o.isNeedAdjustHeight, ["left", "right", "top", "bottom"], o.offsetStyle); + p = BI.DOM.getComboPosition(combo, this.popupView, (o.adjustXOffset || o.adjustLength) + (o.showArrow ? this._const.TRIANGLE_LENGTH : 0), o.adjustYOffset, o.isNeedAdjustHeight, ["left", "right", "top", "bottom"], o.offsetStyle); break; case "right,top": - p = BI.DOM.getComboPosition(combo, this.popupView, o.adjustXOffset || o.adjustLength, o.adjustYOffset, o.isNeedAdjustHeight, ["right", "left", "top", "bottom"], o.offsetStyle); + p = BI.DOM.getComboPosition(combo, this.popupView, (o.adjustXOffset || o.adjustLength) + (o.showArrow ? this._const.TRIANGLE_LENGTH : 0), o.adjustYOffset, o.isNeedAdjustHeight, ["right", "left", "top", "bottom"], o.offsetStyle); break; case "right,innerRight": - p = BI.DOM.getComboPosition(combo, this.popupView, o.adjustXOffset || o.adjustLength, o.adjustYOffset, o.isNeedAdjustHeight, ["right", "left", "innerRight", "innerLeft", "bottom", "top"], o.offsetStyle); + p = BI.DOM.getComboPosition(combo, this.popupView, (o.adjustXOffset || o.adjustLength) + (o.showArrow ? this._const.TRIANGLE_LENGTH : 0), o.adjustYOffset, o.isNeedAdjustHeight, ["right", "left", "innerRight", "innerLeft", "bottom", "top"], o.offsetStyle); break; case "right,innerLeft": - p = BI.DOM.getComboPosition(combo, this.popupView, o.adjustXOffset || o.adjustLength, o.adjustYOffset, o.isNeedAdjustHeight, ["right", "left", "innerLeft", "innerRight", "bottom", "top"], o.offsetStyle); + p = BI.DOM.getComboPosition(combo, this.popupView, (o.adjustXOffset || o.adjustLength) + (o.showArrow ? this._const.TRIANGLE_LENGTH : 0), o.adjustYOffset, o.isNeedAdjustHeight, ["right", "left", "innerLeft", "innerRight", "bottom", "top"], o.offsetStyle); break; case "innerRight": - p = BI.DOM.getComboPosition(combo, this.popupView, o.adjustXOffset || o.adjustLength, o.adjustYOffset, o.isNeedAdjustHeight, ["innerRight", "innerLeft", "right", "left", "bottom", "top"], o.offsetStyle); + p = BI.DOM.getComboPosition(combo, this.popupView, (o.adjustXOffset || o.adjustLength) + (o.showArrow ? this._const.TRIANGLE_LENGTH : 0), o.adjustYOffset, o.isNeedAdjustHeight, ["innerRight", "innerLeft", "right", "left", "bottom", "top"], o.offsetStyle); break; case "innerLeft": - p = BI.DOM.getComboPosition(combo, this.popupView, o.adjustXOffset || o.adjustLength, o.adjustYOffset, o.isNeedAdjustHeight, ["innerLeft", "innerRight", "left", "right", "bottom", "top"], o.offsetStyle); + p = BI.DOM.getComboPosition(combo, this.popupView, (o.adjustXOffset || o.adjustLength) + (o.showArrow ? this._const.TRIANGLE_LENGTH : 0), o.adjustYOffset, o.isNeedAdjustHeight, ["innerLeft", "innerRight", "left", "right", "bottom", "top"], o.offsetStyle); break; case "top,custom": case "custom,top": - p = BI.DOM.getTopAdaptPosition(combo, this.popupView, o.adjustYOffset || o.adjustLength, o.isNeedAdjustHeight); + p = BI.DOM.getTopAdaptPosition(combo, this.popupView, (o.adjustYOffset || o.adjustLength) + (o.showArrow ? this._const.TRIANGLE_LENGTH : 0), o.isNeedAdjustHeight); + p.dir = "top"; break; case "custom,bottom": case "bottom,custom": - p = BI.DOM.getBottomAdaptPosition(combo, this.popupView, o.adjustYOffset || o.adjustLength, o.isNeedAdjustHeight); + p = BI.DOM.getBottomAdaptPosition(combo, this.popupView, (o.adjustYOffset || o.adjustLength) + (o.showArrow ? this._const.TRIANGLE_LENGTH : 0), o.isNeedAdjustHeight); + p.dir = "bottom"; break; case "left,custom": case "custom,left": - p = BI.DOM.getLeftAdaptPosition(combo, this.popupView, o.adjustXOffset || o.adjustLength); + p = BI.DOM.getLeftAdaptPosition(combo, this.popupView, (o.adjustXOffset || o.adjustLength) + (o.showArrow ? this._const.TRIANGLE_LENGTH : 0)); delete p.top; delete p.adaptHeight; + p.dir = "left"; break; case "custom,right": case "right,custom": - p = BI.DOM.getRightAdaptPosition(combo, this.popupView, o.adjustXOffset || o.adjustLength); + p = BI.DOM.getRightAdaptPosition(combo, this.popupView, (o.adjustXOffset || o.adjustLength) + (o.showArrow ? this._const.TRIANGLE_LENGTH : 0)); delete p.top; delete p.adaptHeight; + p.dir = "right"; break; } if ("adaptHeight" in p) { this.resetListHeight(p["adaptHeight"]); } + var width = this.combo.element.outerWidth(); + var height = this.combo.element.outerHeight(); + this.popupView.setDirection && this.popupView.setDirection(p.dir, { + width: width, + height: height, + offsetStyle: o.offsetStyle, + adjustXOffset: o.adjustXOffset, + adjustYOffset: o.adjustYOffset, + offset: this.combo.element.offset() + }); if ("left" in p) { this.popupView.element.css({ left: p.left diff --git a/src/base/combination/searcher.js b/src/base/combination/searcher.js index 7da8689c2..e7d16c53e 100644 --- a/src/base/combination/searcher.js +++ b/src/base/combination/searcher.js @@ -307,6 +307,14 @@ BI.Searcher = BI.inherit(BI.Widget, { destroyed: function () { BI.Maskers.remove(this.getName()); + }, + + focus: function () { + this.editor.focus(); + }, + + blur: function () { + this.editor.blur(); } }); BI.Searcher.EVENT_CHANGE = "EVENT_CHANGE"; diff --git a/src/base/foundation/message.js b/src/base/foundation/message.js index 9653995c3..860449ab4 100644 --- a/src/base/foundation/message.js +++ b/src/base/foundation/message.js @@ -133,6 +133,31 @@ BI.Msg = function () { items: [ { type: "bi.border", + attributes: { + tabIndex: 1 + }, + mounted: function () { + this.element.keyup(function (e) { + if (e.keyCode === BI.KeyCode.ENTER) { + close(); + if (BI.isFunction(callback)) { + callback.apply(null, [true]); + } + } else if (e.keyCode === BI.KeyCode.ESCAPE) { + close(); + if (hasCancel === true) { + if (BI.isFunction(callback)) { + callback.apply(null, [false]); + } + } + } + }); + try { + this.element.focus(); + } catch (e) { + + } + }, cls: "bi-card", items: { north: { diff --git a/src/base/layer/layer.popup.js b/src/base/layer/layer.popup.js index 53c8e17d1..a0d8220f8 100644 --- a/src/base/layer/layer.popup.js +++ b/src/base/layer/layer.popup.js @@ -4,9 +4,12 @@ * @extends BI.Widget */ BI.PopupView = BI.inherit(BI.Widget, { - _defaultConfig: function () { + _const: { + TRIANGLE_LENGTH: 9 + }, + _defaultConfig: function (props) { return BI.extend(BI.PopupView.superclass._defaultConfig.apply(this, arguments), { - _baseCls: "bi-popup-view", + _baseCls: "bi-popup-view" + (props.primary ? " bi-primary" : ""), // 品牌色 primary: false, maxWidth: "auto", @@ -21,6 +24,7 @@ BI.PopupView = BI.inherit(BI.Widget, { hgap: 0, innerVGap: 0, innerHGap: 0, + showArrow: false, direction: BI.Direction.Top, // 工具栏的方向 stopEvent: false, // 是否停止mousedown、mouseup事件 stopPropagation: false, // 是否停止mousedown、mouseup向上冒泡 @@ -56,12 +60,12 @@ BI.PopupView = BI.inherit(BI.Widget, { "z-index": BI.zIndex_popup, "min-width": BI.isNumeric(o.minWidth) ? (o.minWidth / BI.pixRatio + BI.pixUnit) : o.minWidth, "max-width": BI.isNumeric(o.maxWidth) ? (o.maxWidth / BI.pixRatio + BI.pixUnit) : o.maxWidth - }).bind({ click: fn }); + }).bind({click: fn}); this.element.bind("mousewheel", fn); - o.stopPropagation && this.element.bind({ mousedown: fn, mouseup: fn, mouseover: fn }); - o.stopEvent && this.element.bind({ mousedown: stop, mouseup: stop, mouseover: stop }); + o.stopPropagation && this.element.bind({mousedown: fn, mouseup: fn, mouseover: fn}); + o.stopEvent && this.element.bind({mousedown: stop, mouseup: stop, mouseover: stop}); this.tool = this._createTool(); this.tab = this._createTab(); this.view = this._createView(); @@ -84,25 +88,47 @@ BI.PopupView = BI.inherit(BI.Widget, { bgap: o.bgap, vgap: o.vgap, hgap: o.hgap, - items: BI.LogicFactory.createLogicItemsByDirection(o.direction, - BI.extend({ + items: BI.LogicFactory.createLogicItemsByDirection(o.direction, BI.extend({ cls: "list-view-outer bi-card list-view-shadow" + (o.primary ? " bi-primary" : "") }, BI.LogicFactory.createLogic(BI.LogicFactory.createLogicTypeByDirection(o.direction), BI.extend({}, o.logic, { items: BI.LogicFactory.createLogicItemsByDirection(o.direction, this.tool, this.tab, this.view, this.toolbar) }))) ) })))); + if (o.showArrow) { + this.arrow = BI.createWidget({ + type: "bi.absolute", + cls: "bi-bubble-arrow", + items: [{ + type: "bi.layout", + cls: "bubble-arrow" + }] + }); + // 因为三角符号的原因位置变大了,需要占位 + this.placeholder = BI.createWidget({ + type: "bi.layout" + }); + BI.createWidget({ + type: "bi.absolute", + element: this, + items: [{ + el: this.arrow + }, { + el: this.placeholder + }] + }); + } }, _createView: function () { var o = this.options; - this.button_group = BI.createWidget(o.el, { type: "bi.button_group", value: o.value }); + this.button_group = BI.createWidget(o.el, {type: "bi.button_group", value: o.value}); this.button_group.element.css({ "min-height": BI.isNumeric(o.minHeight) ? (o.minHeight / BI.pixRatio + BI.pixUnit) : o.minHeight, "padding-top": o.innerVGap / BI.pixRatio + BI.pixUnit, "padding-bottom": o.innerVGap / BI.pixRatio + BI.pixUnit, "padding-left": o.innerHGap / BI.pixRatio + BI.pixUnit, - "padding-right": o.innerHGap / BI.pixRatio + BI.pixUnit, + "padding-right": o.innerHGap / BI.pixRatio + BI.pixUnit }); return this.button_group; }, @@ -147,6 +173,154 @@ BI.PopupView = BI.inherit(BI.Widget, { }); }, + setDirection: function (direction, position) { + if (this.options.showArrow) { + var style, placeholderStyle; + var adjustXOffset = position.adjustXOffset || 0; + var adjustYOffset = position.adjustYOffset || 0; + var bodyBounds = BI.Widget._renderEngine.createElement("body").bounds(); + var bodyWidth = bodyBounds.width; + var bodyHeight = bodyBounds.height; + var popupWidth = this.element.outerWidth(); + var popupHeight = this.element.outerHeight(); + var offset = position.offset; + var offsetStyle = position.offsetStyle; + var middle = offsetStyle === "center" || offsetStyle === "middle"; + + var minLeft = Math.max(5, offset.left + 5 + popupWidth - bodyWidth); + var minRight = Math.max(5, popupWidth - (offset.left + 5)); + var minTop = Math.max(5, offset.top + 5 + popupHeight - bodyHeight); + var minBottom = Math.max(5, popupHeight - (offset.top + 5)); + + var maxLeft = Math.min(popupWidth - 12 - 5, offset.left + position.width - 12 - 5); + var maxRight = Math.min(popupWidth - 12 - 5, bodyWidth - (offset.left + position.width - 12 - 5)); + var maxTop = Math.min(popupHeight - 12 - 5, offset.top + position.height - 12 - 5); + var maxBottom = Math.min(popupHeight - 12 - 5, bodyHeight - (offset.top + position.height - 12 - 5)); + switch (direction) { + case "bottom": + case "bottom,right": + direction = "bottom"; + style = { + // 5表示留出一定的空间 + left: BI.clamp(((middle ? popupWidth : position.width) - adjustXOffset) / 2 - 6, minLeft, maxLeft) + }; + placeholderStyle = { + left: 0, + right: 0, + height: this._const.TRIANGLE_LENGTH, + top: -this._const.TRIANGLE_LENGTH, + bottom: "" + }; + break; + case "bottom,left": + direction = "bottom"; + style = { + right: BI.clamp(((middle ? popupWidth : position.width) + adjustXOffset) / 2 - 6, minRight, maxRight) + }; + placeholderStyle = { + left: 0, + right: 0, + height: this._const.TRIANGLE_LENGTH, + top: -this._const.TRIANGLE_LENGTH, + bottom: "" + }; + break; + case "top": + case "top,right": + direction = "top"; + style = { + left: BI.clamp(((middle ? popupWidth : position.width) - adjustXOffset) / 2 - 6, minLeft, maxLeft) + }; + placeholderStyle = { + left: 0, + right: 0, + height: this._const.TRIANGLE_LENGTH, + top: "", + bottom: -this._const.TRIANGLE_LENGTH + }; + break; + case "top,left": + direction = "top"; + style = { + right: BI.clamp(((middle ? popupWidth : position.width) + adjustXOffset) / 2 - 6, minRight, maxRight) + }; + placeholderStyle = { + left: 0, + right: 0, + height: this._const.TRIANGLE_LENGTH, + top: "", + bottom: -this._const.TRIANGLE_LENGTH + }; + break; + case "left": + case "left,bottom": + direction = "left"; + style = { + top: BI.clamp(((middle ? popupHeight : position.height) - adjustYOffset) / 2 - 6, minTop, maxTop) + }; + placeholderStyle = { + top: 0, + bottom: 0, + width: this._const.TRIANGLE_LENGTH, + right: -this._const.TRIANGLE_LENGTH, + left: "" + }; + break; + case "left,top": + direction = "left"; + style = { + bottom: BI.clamp(((middle ? popupHeight : position.height) + adjustYOffset) / 2 - 6, minBottom, maxBottom) + }; + placeholderStyle = { + top: 0, + bottom: 0, + width: this._const.TRIANGLE_LENGTH, + right: -this._const.TRIANGLE_LENGTH, + left: "" + }; + break; + case "right": + case "right,bottom": + direction = "right"; + style = { + top: BI.clamp(((middle ? popupHeight : position.height) - adjustYOffset) / 2 - 6, minTop, maxTop) + }; + placeholderStyle = { + top: 0, + bottom: 0, + width: this._const.TRIANGLE_LENGTH, + left: -this._const.TRIANGLE_LENGTH, + right: "" + }; + break; + case "right,top": + direction = "right"; + style = { + bottom: BI.clamp(((middle ? popupHeight : position.height) + adjustYOffset) / 2 - 6, minBottom, maxBottom) + }; + placeholderStyle = { + top: 0, + bottom: 0, + width: this._const.TRIANGLE_LENGTH, + left: -this._const.TRIANGLE_LENGTH, + right: "" + }; + break; + case "right,innerRight": + break; + case "right,innerLeft": + break; + case "innerRight": + break; + case "innerLeft": + break; + } + this.element.removeClass("left").removeClass("right").removeClass("top").removeClass("bottom").addClass(direction); + this.arrow.element.css(style); + this.placeholder.element.css(placeholderStyle); + } + }, + getView: function () { return this.view; }, @@ -166,7 +340,7 @@ BI.PopupView = BI.inherit(BI.Widget, { toolHeight = ((this.tool && this.tool.attr("height")) || 24) * ((this.tool && this.tool.isVisible()) ? 1 : 0); var resetHeight = h - tbHeight - tabHeight - toolHeight - 2 * this.options.innerVGap; this.view.resetHeight ? this.view.resetHeight(resetHeight) : - this.view.element.css({ "max-height": resetHeight / BI.pixRatio + BI.pixUnit }); + this.view.element.css({"max-height": resetHeight / BI.pixRatio + BI.pixUnit}); }, setValue: function (selectedValues) { diff --git a/src/base/single/button/button.basic.js b/src/base/single/button/button.basic.js index d975bdb81..e3d8a1493 100644 --- a/src/base/single/button/button.basic.js +++ b/src/base/single/button/button.basic.js @@ -204,6 +204,12 @@ BI.BasicButton = BI.inherit(BI.Single, { }); } hand.click(clk); + // enter键等同于点击 + hand.keyup(function (e) { + if (e.keyCode === BI.KeyCode.ENTER) { + clk(e); + } + }); break; } }); diff --git a/src/base/single/button/buttons/button.js b/src/base/single/button/buttons/button.js index 4337a9540..0863d0935 100644 --- a/src/base/single/button/buttons/button.js +++ b/src/base/single/button/buttons/button.js @@ -16,6 +16,9 @@ BI.Button = BI.inherit(BI.BasicButton, { var conf = BI.Button.superclass._defaultConfig.apply(this, arguments); return BI.extend(conf, { baseCls: (conf.baseCls || "") + " bi-button" + ((BI.isIE() && BI.isIE9Below()) ? " hack" : ""), + attributes: { + tabIndex: 1 + }, minWidth: (props.block === true || props.clear === true) ? 0 : 80, height: 24, shadow: props.clear !== true, @@ -125,6 +128,15 @@ BI.Button = BI.inherit(BI.BasicButton, { } }, + _setEnable: function (enable) { + BI.Button.superclass._setEnable.apply(this, arguments); + if (enable === true) { + this.element.attr("tabIndex", 1); + } else if (enable === false) { + this.element.removeAttr("tabIndex"); + } + }, + setText: function (text) { BI.Button.superclass.setText.apply(this, arguments); this.text.setText(text); diff --git a/src/base/single/button/listitem/icontextitem.js b/src/base/single/button/listitem/icontextitem.js index 648b98381..44f83f376 100644 --- a/src/base/single/button/listitem/icontextitem.js +++ b/src/base/single/button/listitem/icontextitem.js @@ -57,6 +57,13 @@ BI.IconTextItem = BI.inherit(BI.BasicButton, { })))); }, + doClick: function () { + BI.IconTextItem.superclass.doClick.apply(this, arguments); + if (this.isValid()) { + this.fireEvent(BI.IconTextItem.EVENT_CHANGE, this.getValue(), this); + } + }, + setValue: function () { if (!this.isReadOnly()) { this.text.setValue.apply(this.text, arguments); @@ -75,13 +82,6 @@ BI.IconTextItem = BI.inherit(BI.BasicButton, { return this.text.getText(); }, - doClick: function () { - BI.IconTextItem.superclass.doClick.apply(this, arguments); - if (this.isValid()) { - this.fireEvent(BI.IconTextItem.EVENT_CHANGE, this.getValue(), this); - } - }, - doRedMark: function () { this.text.doRedMark.apply(this.text, arguments); }, diff --git a/src/base/single/button/node/icontextnode.js b/src/base/single/button/node/icontextnode.js index 35e5757b8..deb2c73be 100644 --- a/src/base/single/button/node/icontextnode.js +++ b/src/base/single/button/node/icontextnode.js @@ -53,6 +53,13 @@ BI.IconTextNode = BI.inherit(BI.NodeButton, { })))); }, + doClick: function () { + BI.IconTextNode.superclass.doClick.apply(this, arguments); + if (this.isValid()) { + this.fireEvent(BI.IconTextNode.EVENT_CHANGE, this.getValue(), this); + } + }, + setValue: function () { if (!this.isReadOnly()) { this.text.setValue.apply(this.text, arguments); @@ -71,13 +78,6 @@ BI.IconTextNode = BI.inherit(BI.NodeButton, { return this.text.getText(); }, - doClick: function () { - BI.IconTextNode.superclass.doClick.apply(this, arguments); - if (this.isValid()) { - this.fireEvent(BI.IconTextNode.EVENT_CHANGE, this.getValue(), this); - } - }, - doRedMark: function () { this.text.doRedMark.apply(this.text, arguments); }, diff --git a/src/base/single/tip/tip.toast.js b/src/base/single/tip/tip.toast.js index f853d8659..cf2a61476 100644 --- a/src/base/single/tip/tip.toast.js +++ b/src/base/single/tip/tip.toast.js @@ -93,6 +93,7 @@ BI.Toast = BI.inherit(BI.Tip, { this.text = BI.createWidget({ type: "bi.horizontal", horizontalAlign: BI.HorizontalAlign.Stretch, + verticalAlign: BI.VerticalAlign.Middle, element: this, items: items, vgap: 7, diff --git a/src/case/button/item.multiselect.js b/src/case/button/item.multiselect.js index 965363418..8a082a16b 100644 --- a/src/case/button/item.multiselect.js +++ b/src/case/button/item.multiselect.js @@ -7,6 +7,9 @@ BI.MultiSelectItem = BI.inherit(BI.BasicButton, { _defaultConfig: function () { return BI.extend(BI.MultiSelectItem.superclass._defaultConfig.apply(this, arguments), { extraCls: "bi-multi-select-item", + attributes: { + tabIndex: 1 + }, height: 24, logic: { dynamic: false @@ -55,6 +58,15 @@ BI.MultiSelectItem = BI.inherit(BI.BasicButton, { })))); }, + _setEnable: function (enable) { + BI.MultiSelectItem.superclass._setEnable.apply(this, arguments); + if (enable === true) { + this.element.attr("tabIndex", 1); + } else if (enable === false) { + this.element.removeAttr("tabIndex"); + } + }, + doRedMark: function () { this.text.doRedMark.apply(this.text, arguments); }, diff --git a/src/case/button/item.singleselect.icontext.js b/src/case/button/item.singleselect.icontext.js index 1a70d4c01..e1a3e4f05 100644 --- a/src/case/button/item.singleselect.icontext.js +++ b/src/case/button/item.singleselect.icontext.js @@ -8,6 +8,9 @@ BI.SingleSelectIconTextItem = BI.inherit(BI.Single, { _defaultConfig: function () { return BI.extend(BI.SingleSelectIconTextItem.superclass._defaultConfig.apply(this, arguments), { extraCls: "bi-single-select-icon-text-item bi-list-item-active", + attributes: { + tabIndex: 1 + }, iconCls: "", height: 24 }); @@ -35,6 +38,15 @@ BI.SingleSelectIconTextItem = BI.inherit(BI.Single, { }); }, + _setEnable: function (enable) { + BI.SingleSelectIconTextItem.superclass._setEnable.apply(this, arguments); + if (enable === true) { + this.element.attr("tabIndex", 1); + } else if (enable === false) { + this.element.removeAttr("tabIndex"); + } + }, + isSelected: function () { return this.text.isSelected(); }, @@ -49,11 +61,7 @@ BI.SingleSelectIconTextItem = BI.inherit(BI.Single, { unRedMark: function () { this.text.unRedMark.apply(this.text, arguments); - }, - - doClick: function () { - BI.SingleSelectIconTextItem.superclass.doClick.apply(this, arguments); } }); -BI.shortcut("bi.single_select_icon_text_item", BI.SingleSelectIconTextItem); \ No newline at end of file +BI.shortcut("bi.single_select_icon_text_item", BI.SingleSelectIconTextItem); diff --git a/src/case/button/item.singleselect.js b/src/case/button/item.singleselect.js index 8c5931f15..030dcff8f 100644 --- a/src/case/button/item.singleselect.js +++ b/src/case/button/item.singleselect.js @@ -2,6 +2,9 @@ BI.SingleSelectItem = BI.inherit(BI.BasicButton, { _defaultConfig: function () { return BI.extend(BI.SingleSelectItem.superclass._defaultConfig.apply(this, arguments), { extraCls: "bi-single-select-item bi-list-item-active", + attributes: { + tabIndex: 1 + }, hgap: 10, height: 24, textAlign: "left" @@ -25,6 +28,15 @@ BI.SingleSelectItem = BI.inherit(BI.BasicButton, { }); }, + _setEnable: function (enable) { + BI.SingleSelectItem.superclass._setEnable.apply(this, arguments); + if (enable === true) { + this.element.attr("tabIndex", 1); + } else if (enable === false) { + this.element.removeAttr("tabIndex"); + } + }, + doRedMark: function () { this.text.doRedMark.apply(this.text, arguments); }, diff --git a/src/case/button/item.singleselect.radio.js b/src/case/button/item.singleselect.radio.js index 0c6a55d3e..42c628247 100644 --- a/src/case/button/item.singleselect.radio.js +++ b/src/case/button/item.singleselect.radio.js @@ -7,6 +7,9 @@ BI.SingleSelectRadioItem = BI.inherit(BI.BasicButton, { _defaultConfig: function () { return BI.extend(BI.SingleSelectRadioItem.superclass._defaultConfig.apply(this, arguments), { extraCls: "bi-single-select-radio-item", + attributes: { + tabIndex: 1 + }, logic: { dynamic: false }, @@ -51,6 +54,15 @@ BI.SingleSelectRadioItem = BI.inherit(BI.BasicButton, { })))); }, + _setEnable: function (enable) { + BI.SingleSelectRadioItem.superclass._setEnable.apply(this, arguments); + if (enable === true) { + this.element.attr("tabIndex", 1); + } else if (enable === false) { + this.element.removeAttr("tabIndex"); + } + }, + doRedMark: function () { this.text.doRedMark.apply(this.text, arguments); }, diff --git a/src/case/button/switch.js b/src/case/button/switch.js index 2fcbf2c8f..e88360266 100644 --- a/src/case/button/switch.js +++ b/src/case/button/switch.js @@ -9,6 +9,9 @@ BI.Switch = BI.inherit(BI.BasicButton, { props: { extraCls: "bi-switch", + attributes: { + tabIndex: 1 + }, height: 20, width: 44, logic: { @@ -58,6 +61,15 @@ BI.Switch = BI.inherit(BI.BasicButton, { }; }, + _setEnable: function (enable) { + BI.Switch.superclass._setEnable.apply(this, arguments); + if (enable === true) { + this.element.attr("tabIndex", 1); + } else if (enable === false) { + this.element.removeAttr("tabIndex"); + } + }, + setSelected: function (v) { BI.Switch.superclass.setSelected.apply(this, arguments); this.layout.attr("items")[0].left = v ? 28 : 4; diff --git a/src/case/combo/bubblecombo/combo.bubble.js b/src/case/combo/bubblecombo/combo.bubble.js index dbd42e84d..b6b6b0f47 100644 --- a/src/case/combo/bubblecombo/combo.bubble.js +++ b/src/case/combo/bubblecombo/combo.bubble.js @@ -5,9 +5,6 @@ * @extends BI.Widget */ BI.BubbleCombo = BI.inherit(BI.Widget, { - _const: { - TRIANGLE_LENGTH: 9 - }, _defaultConfig: function () { return BI.extend(BI.BubbleCombo.superclass._defaultConfig.apply(this, arguments), { baseCls: "bi-bubble-combo", @@ -17,6 +14,7 @@ BI.BubbleCombo = BI.inherit(BI.Widget, { direction: "bottom,left", // top||bottom||left||right||top,left||top,right||bottom,left||bottom,right isDefaultInit: false, destroyWhenHide: false, + hideWhenClickOutside: true, hideWhenBlur: true, isNeedAdjustHeight: true, // 是否需要高度调整 isNeedAdjustWidth: true, @@ -43,16 +41,17 @@ BI.BubbleCombo = BI.inherit(BI.Widget, { direction: o.direction, isDefaultInit: o.isDefaultInit, hideWhenBlur: o.hideWhenBlur, + hideWhenClickOutside: o.hideWhenClickOutside, destroyWhenHide: o.destroyWhenHide, hideWhenAnotherComboOpen: o.hideWhenAnotherComboOpen, isNeedAdjustHeight: o.isNeedAdjustHeight, isNeedAdjustWidth: o.isNeedAdjustWidth, - adjustLength: this._getAdjustLength(), stopPropagation: o.stopPropagation, adjustXOffset: 0, adjustYOffset: 0, hideChecker: o.hideChecker, offsetStyle: o.offsetStyle, + showArrow: true, el: o.el, popup: BI.extend({ type: "bi.bubble_popup_view", @@ -80,11 +79,9 @@ BI.BubbleCombo = BI.inherit(BI.Widget, { self.fireEvent(BI.BubbleCombo.EVENT_BEFORE_POPUPVIEW, arguments); }); this.combo.on(BI.Combo.EVENT_AFTER_POPUPVIEW, function () { - self._showTriangle(); self.fireEvent(BI.BubbleCombo.EVENT_AFTER_POPUPVIEW, arguments); }); this.combo.on(BI.Combo.EVENT_BEFORE_HIDEVIEW, function () { - self._hideTriangle(); self.fireEvent(BI.BubbleCombo.EVENT_BEFORE_HIDEVIEW, arguments); }); this.combo.on(BI.Combo.EVENT_AFTER_HIDEVIEW, function () { @@ -92,115 +89,7 @@ BI.BubbleCombo = BI.inherit(BI.Widget, { }); }, - _getAdjustLength: function () { - return this._const.TRIANGLE_LENGTH + this.options.adjustLength; - }, - - _createTriangle: function (direction) { - var o = this.options, pos = {}, op = {}; - var adjustLength = this.options.adjustLength; - var offset = this.element.offset(); - var left = offset.left, right = offset.left + this.element.outerWidth(); - var top = offset.top, bottom = offset.top + this.element.outerHeight(); - switch (direction) { - case "left": - pos = { - top: top, - height: this.element.outerHeight(), - left: left - adjustLength - this._const.TRIANGLE_LENGTH - }; - op = {width: this._const.TRIANGLE_LENGTH}; - break; - case "right": - pos = { - top: top, - height: this.element.outerHeight(), - left: right + adjustLength - }; - op = {width: this._const.TRIANGLE_LENGTH}; - break; - case "top": - pos = { - left: left, - width: this.element.outerWidth(), - top: top - adjustLength - this._const.TRIANGLE_LENGTH - }; - op = {height: this._const.TRIANGLE_LENGTH}; - break; - case "bottom": - pos = { - left: left, - width: this.element.outerWidth(), - top: bottom + adjustLength - }; - op = {height: this._const.TRIANGLE_LENGTH}; - break; - default: - break; - } - this.triangle && this.triangle.destroy(); - this.triangle = BI.createWidget(op, { - type: "bi.center_adapt", - scrollable: false, - cls: "button-combo-triangle-wrapper", - items: [{ - type: "bi.layout", - cls: "bubble-combo-triangle-" + direction + (o.primary ? " bi-primary": "") - }] - }); - pos.el = this.triangle; - BI.createWidget({ - type: "bi.absolute", - element: this, - items: [pos] - }); - }, - - _createLeftTriangle: function () { - this._createTriangle("left"); - }, - - _createRightTriangle: function () { - this._createTriangle("right"); - }, - - _createTopTriangle: function () { - this._createTriangle("top"); - }, - - _createBottomTriangle: function () { - this._createTriangle("bottom"); - }, - - _showTriangle: function () { - var pos = this.combo.getPopupPosition(); - switch (pos.dir) { - case "left,top": - case "left,bottom": - this._createLeftTriangle(); - break; - case "right,top": - case "right,bottom": - this._createRightTriangle(); - break; - case "top,left": - case "top,right": - this._createTopTriangle(); - break; - case "bottom,left": - case "bottom,right": - this._createBottomTriangle(); - break; - } - }, - - _hideTriangle: function () { - this.triangle && this.triangle.destroy(); - this.triangle = null; - }, - hideView: function () { - this._hideTriangle(); this.combo && this.combo.hideView(); }, diff --git a/src/case/combo/bubblecombo/popup.bubble.js b/src/case/combo/bubblecombo/popup.bubble.js index cbb15070a..92311b725 100644 --- a/src/case/combo/bubblecombo/popup.bubble.js +++ b/src/case/combo/bubblecombo/popup.bubble.js @@ -13,7 +13,7 @@ BI.BubblePopupView = BI.inherit(BI.PopupView, { maxWidth: 300, minHeight: 50 }); - }, + } }); BI.shortcut("bi.bubble_popup_view", BI.BubblePopupView); @@ -47,33 +47,36 @@ BI.BubblePopupBarView = BI.inherit(BI.BubblePopupView, { var items = []; BI.each(o.buttons, function (i, buttonOpt) { if (BI.isWidget(buttonOpt)) { - items.push(buttonOpt); + items.push({ + el: buttonOpt, + lgap: i === 0 ? 20 : 15, + rgap: i === o.buttons.length - 1 ? 20 : 0 + }); } else { - items.push(BI.extend({ - type: "bi.button", - height: 24, - handler: function (v) { - self.fireEvent(BI.BubblePopupBarView.EVENT_CLICK_TOOLBAR_BUTTON, v); - } - }, buttonOpt)); + items.push({ + el: BI.extend({ + type: "bi.button", + height: 24, + handler: function (v) { + self.fireEvent(BI.BubblePopupBarView.EVENT_CLICK_TOOLBAR_BUTTON, v); + } + }, buttonOpt), + lgap: i === 0 ? 20 : 15, + rgap: i === o.buttons.length - 1 ? 20 : 0 + }); } }); return BI.createWidget({ - type: "bi.center", + type: "bi.right_vertical_adapt", height: 54, - rgap: 20, - items: [{ - type: "bi.right_vertical_adapt", - lgap: 15, - items: items - }] + items: items }); }, _createView: function () { var o = this.options; - var button = BI.createWidget({ + var button = BI.createWidget({ type: "bi.button_group", items: [o.el], layouts: [{ @@ -135,6 +138,7 @@ BI.TextBubblePopupBarView = BI.inherit(BI.Widget, { return { type: "bi.bubble_bar_popup_view", primary: o.primary, + showArrow: o.showArrow, minWidth: o.minWidth, maxWidth: o.maxWidth, minHeight: o.minHeight, @@ -154,9 +158,12 @@ BI.TextBubblePopupBarView = BI.inherit(BI.Widget, { }; }, + setDirection: function (direction, position) { + this.popup.setDirection(direction, position); + }, populate: function (v) { this.text.setText(v || this.options.text); - }, + } }); BI.TextBubblePopupBarView.EVENT_CHANGE = "EVENT_CLICK_TOOLBAR_BUTTON"; BI.shortcut("bi.text_bubble_bar_popup_view", BI.TextBubblePopupBarView); diff --git a/src/case/combo/searchtextvaluecombo/combo.searchtextvalue.js b/src/case/combo/searchtextvaluecombo/combo.searchtextvalue.js index 4095cb09e..e86bec863 100644 --- a/src/case/combo/searchtextvaluecombo/combo.searchtextvalue.js +++ b/src/case/combo/searchtextvaluecombo/combo.searchtextvalue.js @@ -35,7 +35,7 @@ BI.SearchTextValueCombo = BI.inherit(BI.Widget, { self.trigger = this; }, items: o.items, - height: o.height - 2, + height: o.height - (o.simple ? 1 : 2), text: o.text, defaultText: o.defaultText, value: o.value, diff --git a/src/component/allvaluechooser/abstract.allvaluechooser.js b/src/component/allvaluechooser/abstract.allvaluechooser.js index 1f30e8de8..90cd4afd0 100644 --- a/src/component/allvaluechooser/abstract.allvaluechooser.js +++ b/src/component/allvaluechooser/abstract.allvaluechooser.js @@ -24,6 +24,9 @@ BI.AbstractAllValueChooser = BI.inherit(BI.Widget, { _valueFormatter: function (v) { var text = v; + if (this.options.valueFormatter) { + return this.options.valueFormatter(v); + } if (BI.isNotNull(this.items)) { BI.some(this.items, function (i, item) { // 把value都换成字符串 diff --git a/src/component/treevaluechooser/abstract.treevaluechooser.js b/src/component/treevaluechooser/abstract.treevaluechooser.js index cf00c985b..6288cc4dc 100644 --- a/src/component/treevaluechooser/abstract.treevaluechooser.js +++ b/src/component/treevaluechooser/abstract.treevaluechooser.js @@ -14,6 +14,9 @@ BI.AbstractTreeValueChooser = BI.inherit(BI.Widget, { _valueFormatter: function (v) { var text = v; + if (this.options.valueFormatter) { + return this.options.valueFormatter(v); + } if (BI.isNotNull(this.items)) { BI.some(this.items, function (i, item) { if (item.value === v || item.value + "" === v) { diff --git a/src/component/treevaluechooser/combo.listtreevaluechooser.js b/src/component/treevaluechooser/combo.listtreevaluechooser.js index a90c6a4b9..e6bebe3d6 100644 --- a/src/component/treevaluechooser/combo.listtreevaluechooser.js +++ b/src/component/treevaluechooser/combo.listtreevaluechooser.js @@ -102,6 +102,14 @@ BI.ListTreeValueChooserInsertCombo = BI.inherit(BI.AbstractListTreeValueChooser, this._initData(items); } this.combo.populate(); + }, + + focus: function () { + this.combo.focus(); + }, + + blur: function () { + this.combo.blur(); } }); diff --git a/src/component/treevaluechooser/combo.treevaluechooser.insert.js b/src/component/treevaluechooser/combo.treevaluechooser.insert.js index b01fe2e0f..d506dfe8b 100644 --- a/src/component/treevaluechooser/combo.treevaluechooser.insert.js +++ b/src/component/treevaluechooser/combo.treevaluechooser.insert.js @@ -101,6 +101,14 @@ BI.TreeValueChooserInsertCombo = BI.inherit(BI.AbstractTreeValueChooser, { this._initData(items); } this.combo.populate(); + }, + + focus: function () { + this.combo.focus(); + }, + + blur: function () { + this.combo.blur(); } }); diff --git a/src/component/treevaluechooser/combo.treevaluechooser.js b/src/component/treevaluechooser/combo.treevaluechooser.js index fbff4000a..f47b3f84b 100644 --- a/src/component/treevaluechooser/combo.treevaluechooser.js +++ b/src/component/treevaluechooser/combo.treevaluechooser.js @@ -105,6 +105,14 @@ BI.TreeValueChooserCombo = BI.inherit(BI.AbstractTreeValueChooser, { this._initData(items); } this.combo.populate(); + }, + + focus: function () { + this.combo.focus(); + }, + + blur: function () { + this.combo.blur(); } }); diff --git a/src/component/valuechooser/abstract.valuechooser.js b/src/component/valuechooser/abstract.valuechooser.js index bd1ab309c..a97434a84 100644 --- a/src/component/valuechooser/abstract.valuechooser.js +++ b/src/component/valuechooser/abstract.valuechooser.js @@ -22,6 +22,9 @@ BI.AbstractValueChooser = BI.inherit(BI.Widget, { _valueFormatter: function (v) { var text = v; + if (this.options.valueFormatter) { + return this.options.valueFormatter(v); + } if (BI.isNotNull(this.items)) { BI.some(this.items, function (i, item) { // 把value都换成字符串 diff --git a/src/less/base/combo/combo.bubble.less b/src/less/base/combo/combo.bubble.less index 16f9f6e9f..e5a59b0cb 100644 --- a/src/less/base/combo/combo.bubble.less +++ b/src/less/base/combo/combo.bubble.less @@ -30,7 +30,7 @@ background-color: @color-bi-background-bubble-combo-triangle; } &.bi-primary:before { - background-color: @background-color-primary; + background-color: @background-color-card-primary; } } } diff --git a/src/less/base/single/button/button.less b/src/less/base/single/button/button.less index a4657294c..d8f511c01 100644 --- a/src/less/base/single/button/button.less +++ b/src/less/base/single/button/button.less @@ -7,6 +7,7 @@ body .bi-button, #body .bi-button { .border-radius(0px); } .border-radius(2px); + outline: 0; border: 1px solid @color-bi-border-button; background-color: @color-bi-background-button; .box-sizing(border-box); @@ -22,7 +23,7 @@ body .bi-button, #body .bi-button { font-size: inherit; border-width: 0; background-color: transparent; - &:hover { + &:hover, &:focus { .opacity(0.8); } &:active { @@ -47,7 +48,7 @@ body .bi-button, #body .bi-button { &, & .b-font:before { color: @color-bi-text-common-ghost-button; } - &:hover { + &:hover, &:focus { color: @color-bi-text; background-color: @color-bi-background-hover-common-ghost-button; } @@ -73,7 +74,7 @@ body .bi-button, #body .bi-button { border-width: 0; } &.ghost { - &:hover { + &:hover, &:focus { border-color: @color-bi-border-ignore-button; &, & .b-font:before { color: @color-bi-text-ignore-button; @@ -103,7 +104,7 @@ body .bi-button, #body .bi-button { color: @color-bi-text-success-ghost-button; } background-color: transparent; - &:hover { + &:hover, &:focus { color: @color-bi-text; background-color: @color-bi-background-success-button; } @@ -132,7 +133,7 @@ body .bi-button, #body .bi-button { color: @color-bi-text-warning-ghost-button; } background-color: transparent; - &:hover { + &:hover, &:focus { color: @color-bi-text; background-color: @color-bi-background-warning-button; } @@ -161,7 +162,7 @@ body .bi-button, #body .bi-button { color: @color-bi-text-error-ghost-button; } background-color: transparent; - &:hover { + &:hover, &:focus { color: @color-bi-text; background-color: @color-bi-background-error-button; } @@ -208,7 +209,7 @@ body .bi-button, #body .bi-button { } background: transparent !important; border-width: 0 !important; - &:hover, &:active { + &:hover, &:focus, &:active { .opacity(1); } } @@ -285,7 +286,7 @@ body .bi-button, #body .bi-button { .opacity(0.1); .transition(@activeStopVal) } - &:hover{ + &:hover, &:focus { & .bi-button-mask { .opacity(0.1); background-color: @color-bi-background-hover-button-mask; @@ -317,7 +318,7 @@ body .bi-button, #body .bi-button { .opacity(0.1); .transition(@activeStopVal) } - &:hover { + &:hover, &:focus { &:not(.clear, .ghost) { background-color: @color-bi-background-hover-ignore-button-mask; } @@ -333,10 +334,10 @@ body .bi-button, #body .bi-button { .bi-button, #body .bi-button { &.button-ignore { background-color: @color-bi-background-ignore-button-theme-dark; - &:hover{ + &:hover, &:focus { background-color: @color-bi-background-hover-ignore-button-theme-dark; } - &:active{ + &:active { background-color: @color-bi-background-active-ignore-button-theme-dark; } &.clear { diff --git a/src/less/base/single/button/switch.less b/src/less/base/single/button/switch.less index 9fbab0e73..22ba538c9 100644 --- a/src/less/base/single/button/switch.less +++ b/src/less/base/single/button/switch.less @@ -1,6 +1,7 @@ @import "../../../index"; -.bi-switch{ +.bi-switch { + font-size: @font-size-12; .border-radius(40px 40px 40px 40px); background-color: @color-bi-background-switch; .transition(all .2s); diff --git a/src/less/base/single/tip/tip.toast.less b/src/less/base/single/tip/tip.toast.less index 6ac76d4a6..7f7838f29 100644 --- a/src/less/base/single/tip/tip.toast.less +++ b/src/less/base/single/tip/tip.toast.less @@ -1,7 +1,7 @@ @import "../../../index"; .bi-toast{ - color: @color-bi-text; + color: @color-bi-color-toast-text; max-width: 400px; min-width: 150px; line-height: @font-size-16; diff --git a/src/less/base/view/popupview.less b/src/less/base/view/popupview.less index efa864778..cc8387fb7 100644 --- a/src/less/base/view/popupview.less +++ b/src/less/base/view/popupview.less @@ -27,50 +27,50 @@ } } -.bi-popup-view[data-popper-placement^='top'] { +.bi-popup-view[data-popper-placement^='top'], .bi-popup-view.top { > .bi-bubble-arrow { - bottom: -10px; + bottom: -12px; > .bubble-arrow { - bottom: 6px; + bottom: 8px; } } } -.bi-popup-view[data-popper-placement^='bottom'] { +.bi-popup-view[data-popper-placement^='bottom'], .bi-popup-view.bottom { > .bi-bubble-arrow { - top: -10px; + top: -12px; > .bubble-arrow { - top: 6px; + top: 8px; } } } -.bi-popup-view[data-popper-placement^='left'] { +.bi-popup-view[data-popper-placement^='left'], .bi-popup-view.left { > .bi-bubble-arrow { - right: -10px; + right: -12px; > .bubble-arrow { - right: 6px; + right: 8px; } } } -.bi-popup-view[data-popper-placement^='right'] { +.bi-popup-view[data-popper-placement^='right'], .bi-popup-view.right { > .bi-bubble-arrow { - left: -10px; + left: -12px; > .bubble-arrow { - left: 6px; + left: 8px; } } } .bi-bubble-arrow { - width: 10px; - height: 10px; + width: 12px; + height: 12px; overflow: hidden; .bubble-arrow { - width: 10px; - height: 10px; + width: 12px; + height: 12px; position: absolute; &:before { - width: 10px; - height: 10px; + width: 12px; + height: 12px; position: absolute; content: ""; background: @color-bi-background-default; @@ -85,6 +85,17 @@ } } +.bi-popup-view.bi-primary { + .bi-bubble-arrow { + .bubble-arrow { + &:before { + background-color: @background-color-card-primary; + color: @color-card-primary; + } + } + } +} + .bi-theme-dark { .bubble-arrow:before { background: @color-bi-background-default-theme-dark; @@ -102,4 +113,4 @@ & .list-view-shadow { .box-shadow(0 1px 5px 0, fade(@background-color-normal-theme-dark, 80)); } -} \ No newline at end of file +} diff --git a/src/less/core/utils/common.less b/src/less/core/utils/common.less index 0dfefd2af..5d9b11c3e 100644 --- a/src/less/core/utils/common.less +++ b/src/less/core/utils/common.less @@ -123,7 +123,7 @@ color: @color-bi-text-card; } &.bi-primary { - background-color: @background-color-primary; + background-color: @background-color-card-primary; color: @color-card-primary; } } diff --git a/src/less/lib/constant.less b/src/less/lib/constant.less index 6029c7ef9..5236ce2cb 100644 --- a/src/less/lib/constant.less +++ b/src/less/lib/constant.less @@ -24,7 +24,7 @@ // 品牌 @color-primary: #3685f2; @color-card-primary: @color-white; -@background-color-primary: #1e4092; +@background-color-card-primary: #1e4092; //green @color-green-100: #13cd66; diff --git a/src/less/lib/theme.less b/src/less/lib/theme.less index 9575a2ae1..d83ef3789 100644 --- a/src/less/lib/theme.less +++ b/src/less/lib/theme.less @@ -27,6 +27,11 @@ @color-bi-background-toast-warning: @color-bi-background-warning; @color-bi-background-toast-error: @color-bi-background-failure; @color-bi-background-toast-normal: @color-bi-background-highlight; +@color-bi-color-toast-success: @color-bi-text; +@color-bi-color-toast-warning: @color-bi-text; +@color-bi-color-toast-error: @color-bi-text; +@color-bi-color-toast-normal: @color-bi-text; +@color-bi-color-toast-text: @color-bi-text; //bubble @color-bi-background-bubble-success: @color-bi-background-light-success; diff --git a/src/less/resource/font.less b/src/less/resource/font.less index d1a6b6354..6c7b3994d 100644 --- a/src/less/resource/font.less +++ b/src/less/resource/font.less @@ -1,5 +1,6 @@ @import "../lib/font"; @import "../lib/colors"; +@import "../lib/theme"; @import "../image"; .addFontRes(); @@ -81,10 +82,10 @@ .font-hover-active(pull-down-ha-font, @font-down-triangle, @color-bi-text-light-gray); //toast -.font(toast-error-font, @font-tip-error); -.font(toast-success-font, @font-tip-success); -.font(toast-warning-font, @font-tip-warning); -.font(toast-message-font, @font-tip-message); +.font(toast-error-font, @font-tip-error, @color-bi-color-toast-error); +.font(toast-success-font, @font-tip-success, @color-bi-color-toast-error); +.font(toast-warning-font, @font-tip-warning, @color-bi-color-toast-warning); +.font(toast-message-font, @font-tip-message, @color-bi-color-toast-normal); //数值区间 .font(less-font, @font-less); diff --git a/src/less/widget/interactivearrangement/interactivearrangement.less b/src/less/widget/interactivearrangement/interactivearrangement.less deleted file mode 100644 index c368c3b96..000000000 --- a/src/less/widget/interactivearrangement/interactivearrangement.less +++ /dev/null @@ -1,11 +0,0 @@ -@import "../../index"; - -.bi-interactive-arrangement { - & .interactive-arrangement-dragtag-line { - z-index: @zIndex-tip; - background-color: @color-bi-background-interactive-arrangement-dragtag-line; - } - & .interactive-arrangement-dragtag-icon { - z-index: @zIndex-tip; - } -} \ No newline at end of file diff --git a/src/widget/dynamicdate/dynamicdate.combo.js b/src/widget/dynamicdate/dynamicdate.combo.js index 81fb7faa0..997211275 100644 --- a/src/widget/dynamicdate/dynamicdate.combo.js +++ b/src/widget/dynamicdate/dynamicdate.combo.js @@ -298,6 +298,18 @@ BI.DynamicDateCombo = BI.inherit(BI.Single, { }, hidePopupView: function () { this.combo.hideView(); + }, + + focus: function () { + this.trigger.focus(); + }, + + blur: function () { + this.trigger.blur(); + }, + + setWaterMark: function (v) { + this.trigger.setWaterMark(v); } }); diff --git a/src/widget/dynamicdate/dynamicdate.trigger.js b/src/widget/dynamicdate/dynamicdate.trigger.js index 06bdb10ff..48e8a4601 100644 --- a/src/widget/dynamicdate/dynamicdate.trigger.js +++ b/src/widget/dynamicdate/dynamicdate.trigger.js @@ -308,8 +308,19 @@ BI.DynamicDateTrigger = BI.inherit(BI.Trigger, { }, getValue: function () { return this.storeValue; - } + }, + + focus: function () { + this.editor.focus(); + }, + blur: function () { + this.editor.blur(); + }, + + setWaterMark: function (v) { + this.editor.setWaterMark(v); + } }); BI.DynamicDateTrigger.EVENT_BLUR = "EVENT_BLUR"; diff --git a/src/widget/dynamicdatetime/dynamicdatetime.combo.js b/src/widget/dynamicdatetime/dynamicdatetime.combo.js index 6565f9943..37655791d 100644 --- a/src/widget/dynamicdatetime/dynamicdatetime.combo.js +++ b/src/widget/dynamicdatetime/dynamicdatetime.combo.js @@ -306,6 +306,18 @@ BI.DynamicDateTimeCombo = BI.inherit(BI.Single, { isValid: function () { return this.trigger.isValid(); + }, + + focus: function () { + this.trigger.focus(); + }, + + blur: function () { + this.trigger.blur(); + }, + + setWaterMark: function (v) { + this.trigger.setWaterMark(v); } }); diff --git a/src/widget/dynamicdatetime/dynamicdatetime.trigger.js b/src/widget/dynamicdatetime/dynamicdatetime.trigger.js index 6a1d4d5de..e58cd99f5 100644 --- a/src/widget/dynamicdatetime/dynamicdatetime.trigger.js +++ b/src/widget/dynamicdatetime/dynamicdatetime.trigger.js @@ -379,8 +379,19 @@ BI.DynamicDateTimeTrigger = BI.inherit(BI.Trigger, { isValid: function () { return this.editor.isValid(); - } + }, + + focus: function () { + this.editor.focus(); + }, + blur: function () { + this.editor.blur(); + }, + + setWaterMark: function (v) { + this.editor.setWaterMark(v); + } }); BI.DynamicDateTimeTrigger.EVENT_BLUR = "EVENT_BLUR"; diff --git a/src/widget/multilayerselecttree/multilayerselecttree.combo.js b/src/widget/multilayerselecttree/multilayerselecttree.combo.js index a0a2d6366..ea846f08d 100644 --- a/src/widget/multilayerselecttree/multilayerselecttree.combo.js +++ b/src/widget/multilayerselecttree/multilayerselecttree.combo.js @@ -139,7 +139,7 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, { itemsCreator: o.itemsCreator, valueFormatter: o.valueFormatter, watermark: o.watermark, - height: o.height - 2, + height: o.height - (o.simple ? 1 : 2), text: o.text, value: o.value, tipType: o.tipType, @@ -174,6 +174,7 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, { var value = self.trigger.getSearcher().getKeyword(); self.combo.setValue([value]); self.combo.hideView(); + self.fireEvent(BI.MultiLayerSelectTreeCombo.EVENT_CHANGE); } }] }, @@ -237,6 +238,14 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, { populate: function (items) { this.combo.populate(items); + }, + + focus: function () { + this.trigger.focus(); + }, + + blur: function () { + this.trigger.blur(); } }); @@ -246,4 +255,4 @@ BI.MultiLayerSelectTreeCombo.EVENT_FOCUS = "EVENT_FOCUS"; BI.MultiLayerSelectTreeCombo.EVENT_CHANGE = "EVENT_CHANGE"; BI.MultiLayerSelectTreeCombo.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW"; BI.MultiLayerSelectTreeCombo.EVENT_CLICK_ITEM = "EVENT_CLICK_ITEM"; -BI.shortcut("bi.multilayer_select_tree_combo", BI.MultiLayerSelectTreeCombo); \ No newline at end of file +BI.shortcut("bi.multilayer_select_tree_combo", BI.MultiLayerSelectTreeCombo); diff --git a/src/widget/multilayerselecttree/multilayerselecttree.trigger.js b/src/widget/multilayerselecttree/multilayerselecttree.trigger.js index 7203378ba..2fd1c96ec 100644 --- a/src/widget/multilayerselecttree/multilayerselecttree.trigger.js +++ b/src/widget/multilayerselecttree/multilayerselecttree.trigger.js @@ -237,6 +237,14 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, { getValue: function () { return this.searcher.getValue(); + }, + + focus: function () { + this.searcher.focus(); + }, + + blur: function () { + this.searcher.blur(); } }); diff --git a/src/widget/multilayersingletree/multilayersingletree.combo.js b/src/widget/multilayersingletree/multilayersingletree.combo.js index a161c3c27..7f2765a16 100644 --- a/src/widget/multilayersingletree/multilayersingletree.combo.js +++ b/src/widget/multilayersingletree/multilayersingletree.combo.js @@ -142,7 +142,7 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, { items: o.items, itemsCreator: o.itemsCreator, valueFormatter: o.valueFormatter, - height: o.height - 2, + height: o.height - (o.simple ? 1 : 2), text: o.text, value: o.value, tipType: o.tipType, @@ -176,6 +176,7 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, { var value = self.trigger.getSearcher().getKeyword(); self.combo.setValue([value]); self.combo.hideView(); + self.fireEvent(BI.MultiLayerSingleTreeCombo.EVENT_CHANGE); } }] }, @@ -238,6 +239,14 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, { populate: function (items) { this.combo.populate(items); + }, + + focus: function () { + this.trigger.focus(); + }, + + blur: function () { + this.trigger.blur(); } }); @@ -246,4 +255,4 @@ BI.MultiLayerSingleTreeCombo.EVENT_BLUR = "EVENT_BLUR"; BI.MultiLayerSingleTreeCombo.EVENT_FOCUS = "EVENT_FOCUS"; BI.MultiLayerSingleTreeCombo.EVENT_CHANGE = "EVENT_CHANGE"; BI.MultiLayerSingleTreeCombo.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW"; -BI.shortcut("bi.multilayer_single_tree_combo", BI.MultiLayerSingleTreeCombo); \ No newline at end of file +BI.shortcut("bi.multilayer_single_tree_combo", BI.MultiLayerSingleTreeCombo); diff --git a/src/widget/multilayersingletree/multilayersingletree.trigger.js b/src/widget/multilayersingletree/multilayersingletree.trigger.js index 20e47af0d..0812c8029 100644 --- a/src/widget/multilayersingletree/multilayersingletree.trigger.js +++ b/src/widget/multilayersingletree/multilayersingletree.trigger.js @@ -239,6 +239,14 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, { getValue: function () { return this.searcher.getValue(); + }, + + focus: function () { + this.searcher.focus(); + }, + + blur: function () { + this.searcher.blur(); } }); BI.MultiLayerSingleTreeTrigger.EVENT_FOCUS = "EVENT_FOCUS"; diff --git a/src/widget/multiselect/multiselect.combo.js b/src/widget/multiselect/multiselect.combo.js index d5047405f..09c06b6a3 100644 --- a/src/widget/multiselect/multiselect.combo.js +++ b/src/widget/multiselect/multiselect.combo.js @@ -44,7 +44,7 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, { this.trigger = BI.createWidget({ type: "bi.multi_select_trigger", allowEdit: o.allowEdit, - height: o.height - 2, + height: o.height - (o.simple ? 1 : 2), text: o.text, // adapter: this.popup, masker: { diff --git a/src/widget/multiselect/multiselect.combo.nobar.js b/src/widget/multiselect/multiselect.combo.nobar.js index 4cdc69560..b4fe04154 100644 --- a/src/widget/multiselect/multiselect.combo.nobar.js +++ b/src/widget/multiselect/multiselect.combo.nobar.js @@ -41,7 +41,7 @@ BI.MultiSelectNoBarCombo = BI.inherit(BI.Single, { this.trigger = BI.createWidget({ type: "bi.multi_select_trigger", - height: o.height - 2, + height: o.height - (o.simple ? 1 : 2), text: o.text, // adapter: this.popup, masker: { diff --git a/src/widget/multiselect/multiselect.insert.combo.js b/src/widget/multiselect/multiselect.insert.combo.js index 3ba055f46..0cedaf020 100644 --- a/src/widget/multiselect/multiselect.insert.combo.js +++ b/src/widget/multiselect/multiselect.insert.combo.js @@ -40,7 +40,7 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, { this.trigger = BI.createWidget({ type: "bi.multi_select_insert_trigger", allowEdit: o.allowEdit, - height: o.height - 2, + height: o.height - (o.simple ? 1 : 2), text: o.text, watermark: o.watermark, // adapter: this.popup, diff --git a/src/widget/multiselect/multiselect.insert.combo.nobar.js b/src/widget/multiselect/multiselect.insert.combo.nobar.js index 3c33de408..39099bbde 100644 --- a/src/widget/multiselect/multiselect.insert.combo.nobar.js +++ b/src/widget/multiselect/multiselect.insert.combo.nobar.js @@ -41,7 +41,7 @@ BI.MultiSelectInsertNoBarCombo = BI.inherit(BI.Single, { this.trigger = BI.createWidget({ type: "bi.multi_select_insert_trigger", - height: o.height - 2, + height: o.height - (o.simple ? 1 : 2), text: o.text, // adapter: this.popup, masker: { diff --git a/src/widget/multiselect/multiselect.popup.view.js b/src/widget/multiselect/multiselect.popup.view.js index 53e6209c4..cefe9f0b2 100644 --- a/src/widget/multiselect/multiselect.popup.view.js +++ b/src/widget/multiselect/multiselect.popup.view.js @@ -84,7 +84,11 @@ BI.MultiSelectPopupView = BI.inherit(BI.Widget, { resetWidth: function (w) { this.popupView.resetWidth(w); - } + }, + + setDirection: function (direction, position) { + this.popupView.setDirection(direction, position); + }, }); BI.MultiSelectPopupView.EVENT_CHANGE = "EVENT_CHANGE"; diff --git a/src/widget/multiselect/multiselect.popup.view.nobar.js b/src/widget/multiselect/multiselect.popup.view.nobar.js index 26325a94e..9132ae5ee 100644 --- a/src/widget/multiselect/multiselect.popup.view.nobar.js +++ b/src/widget/multiselect/multiselect.popup.view.nobar.js @@ -80,7 +80,11 @@ BI.MultiSelectNoBarPopupView = BI.inherit(BI.Widget, { resetWidth: function (w) { this.popupView.resetWidth(w); - } + }, + + setDirection: function (direction, position) { + this.popupView.setDirection(direction, position); + }, }); BI.MultiSelectNoBarPopupView.EVENT_CHANGE = "EVENT_CHANGE"; diff --git a/src/widget/multiselect/multiselect.trigger.js b/src/widget/multiselect/multiselect.trigger.js index d24d9c23a..d829fa740 100644 --- a/src/widget/multiselect/multiselect.trigger.js +++ b/src/widget/multiselect/multiselect.trigger.js @@ -136,6 +136,14 @@ BI.MultiSelectTrigger = BI.inherit(BI.Trigger, { getValue: function () { return this.searcher.getValue(); + }, + + focus: function () { + this.searcher.focus(); + }, + + blur: function () { + this.searcher.blur(); } }); diff --git a/src/widget/multiselect/trigger/searcher.multiselect.js b/src/widget/multiselect/trigger/searcher.multiselect.js index ec26eccca..ab2688eb4 100644 --- a/src/widget/multiselect/trigger/searcher.multiselect.js +++ b/src/widget/multiselect/trigger/searcher.multiselect.js @@ -94,6 +94,14 @@ BI.MultiSelectSearcher = BI.inherit(BI.Widget, { } }, + focus: function () { + this.editor.focus(); + }, + + blur: function () { + this.editor.blur(); + }, + adjustView: function () { this.searcher.adjustView(); }, diff --git a/src/widget/multitree/multi.tree.combo.js b/src/widget/multitree/multi.tree.combo.js index 5c6e177a7..908b7002f 100644 --- a/src/widget/multitree/multi.tree.combo.js +++ b/src/widget/multitree/multi.tree.combo.js @@ -27,7 +27,7 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, { this.trigger = BI.createWidget({ type: "bi.multi_select_trigger", allowEdit: o.allowEdit, - height: o.height - 2, + height: o.height - (o.simple ? 1 : 2), valueFormatter: o.valueFormatter, text: o.text, watermark: o.watermark, @@ -344,6 +344,14 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, { populate: function () { this.combo.populate(); + }, + + focus: function () { + this.trigger.focus(); + }, + + blur: function () { + this.trigger.blur(); } }); diff --git a/src/widget/multitree/multi.tree.insert.combo.js b/src/widget/multitree/multi.tree.insert.combo.js index b82d27f3f..532f76fe8 100644 --- a/src/widget/multitree/multi.tree.insert.combo.js +++ b/src/widget/multitree/multi.tree.insert.combo.js @@ -28,7 +28,7 @@ BI.MultiTreeInsertCombo = BI.inherit(BI.Single, { this.trigger = BI.createWidget({ type: "bi.multi_select_trigger", allowEdit: o.allowEdit, - height: o.height - 2, + height: o.height - (o.simple ? 1 : 2), valueFormatter: o.valueFormatter, // adapter: this.popup, masker: { @@ -360,6 +360,14 @@ BI.MultiTreeInsertCombo = BI.inherit(BI.Single, { populate: function () { this.combo.populate(); + }, + + focus: function () { + this.trigger.focus(); + }, + + blur: function () { + this.trigger.blur(); } }); diff --git a/src/widget/multitree/multi.tree.list.combo.js b/src/widget/multitree/multi.tree.list.combo.js index 018f7f74b..21b27687c 100644 --- a/src/widget/multitree/multi.tree.list.combo.js +++ b/src/widget/multitree/multi.tree.list.combo.js @@ -30,7 +30,7 @@ BI.MultiTreeListCombo = BI.inherit(BI.Single, { allowEdit: o.allowEdit, text: o.text, watermark: o.watermark, - height: o.height - 2, + height: o.height - (o.simple ? 1 : 2), valueFormatter: o.valueFormatter, // adapter: this.popup, masker: { @@ -378,6 +378,14 @@ BI.MultiTreeListCombo = BI.inherit(BI.Single, { populate: function () { this.combo.populate(); + }, + + focus: function () { + this.trigger.focus(); + }, + + blur: function () { + this.trigger.blur(); } }); diff --git a/src/widget/multitree/multi.tree.popup.js b/src/widget/multitree/multi.tree.popup.js index 3032e34cf..970c76cc6 100644 --- a/src/widget/multitree/multi.tree.popup.js +++ b/src/widget/multitree/multi.tree.popup.js @@ -84,6 +84,10 @@ BI.MultiTreePopup = BI.inherit(BI.Pane, { return this.tree.hasChecked(); }, + setDirection: function (direction, position) { + this.popupView.setDirection(direction, position); + }, + resetHeight: function (h) { this.popupView.resetHeight(h); }, diff --git a/src/widget/multitree/trigger/searcher.list.multi.tree.js b/src/widget/multitree/trigger/searcher.list.multi.tree.js index 2a8d9f4c5..3b126a5a5 100644 --- a/src/widget/multitree/trigger/searcher.list.multi.tree.js +++ b/src/widget/multitree/trigger/searcher.list.multi.tree.js @@ -153,6 +153,14 @@ BI.MultiListTreeSearcher = BI.inherit(BI.Widget, { populate: function (items) { this.searcher.populate.apply(this.searcher, arguments); + }, + + focus: function () { + this.editor.focus(); + }, + + blur: function () { + this.editor.blur(); } }); diff --git a/src/widget/multitree/trigger/searcher.multi.tree.js b/src/widget/multitree/trigger/searcher.multi.tree.js index 6790e2c23..ffece8cb9 100644 --- a/src/widget/multitree/trigger/searcher.multi.tree.js +++ b/src/widget/multitree/trigger/searcher.multi.tree.js @@ -184,6 +184,14 @@ BI.MultiTreeSearcher = BI.inherit(BI.Widget, { populate: function (items) { this.searcher.populate.apply(this.searcher, arguments); + }, + + focus: function () { + this.editor.focus(); + }, + + blur: function () { + this.editor.blur(); } }); diff --git a/src/widget/searchmultitextvaluecombo/multitextvalue.popup.view.search.js b/src/widget/searchmultitextvaluecombo/multitextvalue.popup.view.search.js index f1e6d7231..cb8027f0c 100644 --- a/src/widget/searchmultitextvaluecombo/multitextvalue.popup.view.search.js +++ b/src/widget/searchmultitextvaluecombo/multitextvalue.popup.view.search.js @@ -77,7 +77,11 @@ BI.SearchMultiSelectPopupView = BI.inherit(BI.Widget, { resetWidth: function (w) { this.popupView.resetWidth(w); - } + }, + + setDirection: function (direction, position) { + this.popupView.setDirection(direction, position); + }, }); BI.SearchMultiSelectPopupView.EVENT_CHANGE = "EVENT_CHANGE"; diff --git a/src/widget/singleselect/singleselect.combo.js b/src/widget/singleselect/singleselect.combo.js index 0cfb9cc48..fb873438f 100644 --- a/src/widget/singleselect/singleselect.combo.js +++ b/src/widget/singleselect/singleselect.combo.js @@ -30,7 +30,7 @@ BI.SingleSelectCombo = BI.inherit(BI.Single, { this.trigger = BI.createWidget({ type: "bi.single_select_trigger", - height: o.height - 2, + height: o.height - (o.simple ? 1 : 2), // adapter: this.popup, allowNoSelect: o.allowNoSelect, allowEdit: o.allowEdit, diff --git a/src/widget/singleselect/singleselect.insert.combo.js b/src/widget/singleselect/singleselect.insert.combo.js index 66bdb0c47..b8b21cd09 100644 --- a/src/widget/singleselect/singleselect.insert.combo.js +++ b/src/widget/singleselect/singleselect.insert.combo.js @@ -31,7 +31,7 @@ BI.SingleSelectInsertCombo = BI.inherit(BI.Single, { this.trigger = BI.createWidget({ type: "bi.single_select_trigger", watermark: o.watermark, - height: o.height - 2, + height: o.height - (o.simple ? 1 : 2), allowNoSelect: o.allowNoSelect, allowEdit: o.allowEdit, // adapter: this.popup, diff --git a/src/widget/singleselect/singleselect.popup.view.js b/src/widget/singleselect/singleselect.popup.view.js index 8c22afbd3..4e33c004f 100644 --- a/src/widget/singleselect/singleselect.popup.view.js +++ b/src/widget/singleselect/singleselect.popup.view.js @@ -69,10 +69,14 @@ BI.SingleSelectPopupView = BI.inherit(BI.Widget, { resetWidth: function (w) { this.popupView.resetWidth(w); - } + }, + + setDirection: function (direction, position) { + this.popupView.setDirection(direction, position); + }, }); BI.SingleSelectPopupView.EVENT_CHANGE = "EVENT_CHANGE"; -BI.shortcut("bi.single_select_popup_view", BI.SingleSelectPopupView); \ No newline at end of file +BI.shortcut("bi.single_select_popup_view", BI.SingleSelectPopupView); diff --git a/src/widget/time/time.combo.js b/src/widget/time/time.combo.js index e816b8fa6..d69443bc7 100644 --- a/src/widget/time/time.combo.js +++ b/src/widget/time/time.combo.js @@ -222,6 +222,18 @@ this.setValue(nowTome); this.hidePopupView(); this.fireEvent(BI.TimeCombo.EVENT_CONFIRM); + }, + + focus: function () { + this.trigger.focus(); + }, + + blur: function () { + this.trigger.blur(); + }, + + setWaterMark: function (v) { + this.trigger.setWaterMark(v); } }); diff --git a/src/widget/time/time.trigger.js b/src/widget/time/time.trigger.js index 037a03888..cd8e25cd4 100644 --- a/src/widget/time/time.trigger.js +++ b/src/widget/time/time.trigger.js @@ -180,8 +180,19 @@ getValue: function () { return this.storeValue; - } + }, + + focus: function () { + this.editor.focus(); + }, + + blur: function () { + this.editor.blur(); + }, + setWaterMark: function (v) { + this.editor.setWaterMark(v); + } }); BI.shortcut("bi.time_trigger", BI.TimeTrigger); })(); \ No newline at end of file diff --git a/typescript/base/combination/combo.ts b/typescript/base/combination/combo.ts index 38191df7a..bec2a7b75 100644 --- a/typescript/base/combination/combo.ts +++ b/typescript/base/combination/combo.ts @@ -11,6 +11,7 @@ export declare class Combo extends Widget { static EVENT_AFTER_POPUPVIEW: string; static EVENT_BEFORE_HIDEVIEW: string; static EVENT_AFTER_HIDEVIEW: string; + static closeAll: Function; props: { trigger?: 'click' | 'hover' | 'click-hover' | ''; diff --git a/typescript/base/single/button/button.basic.ts b/typescript/base/single/button/button.basic.ts index 1c91110c4..3cd921b93 100644 --- a/typescript/base/single/button/button.basic.ts +++ b/typescript/base/single/button/button.basic.ts @@ -52,7 +52,7 @@ export declare class BasicButton extends Single { beforeClick(): void; - doClick(): void; + doClick(e?: Event): void; handle(): BasicButton; diff --git a/typescript/component/treevaluechooser/combo.listtreevaluechooser.ts b/typescript/component/treevaluechooser/combo.listtreevaluechooser.ts index bc47f39f3..6709fd8e3 100644 --- a/typescript/component/treevaluechooser/combo.listtreevaluechooser.ts +++ b/typescript/component/treevaluechooser/combo.listtreevaluechooser.ts @@ -23,4 +23,8 @@ export declare class ListTreeValueChooserInsertCombo extends AbstractListTreeVal populate(items: T[]): void; getSearcher(): Widget; + + focus(): void; + + blur(): void; } diff --git a/typescript/component/treevaluechooser/combo.treevaluechooser.insert.ts b/typescript/component/treevaluechooser/combo.treevaluechooser.insert.ts index 41b785b18..971f44022 100644 --- a/typescript/component/treevaluechooser/combo.treevaluechooser.insert.ts +++ b/typescript/component/treevaluechooser/combo.treevaluechooser.insert.ts @@ -22,4 +22,8 @@ export declare class TreeValueChooserInsertCombo extends AbstractTreeValueChoose populate(items: T[]): void; getSearcher(): Widget; + + focus(): void; + + blur(): void; } diff --git a/typescript/component/treevaluechooser/combo.treevaluechooser.ts b/typescript/component/treevaluechooser/combo.treevaluechooser.ts index be535af4a..859480ce6 100644 --- a/typescript/component/treevaluechooser/combo.treevaluechooser.ts +++ b/typescript/component/treevaluechooser/combo.treevaluechooser.ts @@ -24,4 +24,8 @@ export declare class TreeValueChooserCombo extends AbstractTreeValueChooser { populate(items: T[]): void; getSearcher(): Widget; + + focus(): void; + + blur(): void; } diff --git a/typescript/core/widget.ts b/typescript/core/widget.ts index 4c360b400..0a1b63246 100644 --- a/typescript/core/widget.ts +++ b/typescript/core/widget.ts @@ -671,6 +671,7 @@ export declare class Widget extends OB { /** * 新增子元素 */ + addWidget(widget: _Widget): _Widget; addWidget(_name: any, _widget: _Widget): _Widget; /** diff --git a/typescript/widget/dynamicdate/dynamicdate.combo.ts b/typescript/widget/dynamicdate/dynamicdate.combo.ts index a7ead70cf..00921782f 100644 --- a/typescript/widget/dynamicdate/dynamicdate.combo.ts +++ b/typescript/widget/dynamicdate/dynamicdate.combo.ts @@ -36,6 +36,12 @@ export declare class DynamicDateCombo extends Single { hidePopupView(): void; getValue(): DynamicDataComboValue; + + focus(): void; + + blur(): void; + + setWaterMark(v: string): void; } export interface DynamicDataComboValue { diff --git a/typescript/widget/dynamicdatetime/dynamicdatetime.combo.ts b/typescript/widget/dynamicdatetime/dynamicdatetime.combo.ts index b6593b2a7..b4122ead8 100644 --- a/typescript/widget/dynamicdatetime/dynamicdatetime.combo.ts +++ b/typescript/widget/dynamicdatetime/dynamicdatetime.combo.ts @@ -32,4 +32,10 @@ export declare class DynamicDateTimeCombo extends Single { getKey(): string; hidePopupView(): void; + + focus(): void; + + blur(): void; + + setWaterMark(v: string): void } diff --git a/typescript/widget/multilayerselecttree/multilayerselecttree.combo.ts b/typescript/widget/multilayerselecttree/multilayerselecttree.combo.ts index 489186e72..a6625bebf 100644 --- a/typescript/widget/multilayerselecttree/multilayerselecttree.combo.ts +++ b/typescript/widget/multilayerselecttree/multilayerselecttree.combo.ts @@ -15,4 +15,8 @@ export declare class MultiLayerSelectTreeCombo extends Widget { populate(items: T[]): void; getSearcher(): Widget; + + focus(): void; + + blur(): void; } diff --git a/typescript/widget/multilayersingletree/multilayersingletree.combo.ts b/typescript/widget/multilayersingletree/multilayersingletree.combo.ts index 19150a8f6..706d3445f 100644 --- a/typescript/widget/multilayersingletree/multilayersingletree.combo.ts +++ b/typescript/widget/multilayersingletree/multilayersingletree.combo.ts @@ -15,4 +15,8 @@ export declare class MultiLayerSingleTreeCombo extends Widget { populate(items: T[]): void; getSearcher(): Widget; + + focus(): void; + + blur(): void; } diff --git a/typescript/widget/multitree/multi.tree.combo.ts b/typescript/widget/multitree/multi.tree.combo.ts index d8b546441..e96ed9808 100644 --- a/typescript/widget/multitree/multi.tree.combo.ts +++ b/typescript/widget/multitree/multi.tree.combo.ts @@ -15,4 +15,8 @@ export declare class MultiTreeCombo extends Single { hideView(): void; getSearcher(): Widget; + + focus(): void; + + blur(): void; } diff --git a/typescript/widget/multitree/multi.tree.insert.combo.ts b/typescript/widget/multitree/multi.tree.insert.combo.ts index b701f580b..55f2bbdf6 100644 --- a/typescript/widget/multitree/multi.tree.insert.combo.ts +++ b/typescript/widget/multitree/multi.tree.insert.combo.ts @@ -23,4 +23,8 @@ export declare class MultiTreeInsertCombo extends Single { populate(): void; getSearcher(): Widget; + + focus(): void; + + blur(): void; } diff --git a/typescript/widget/multitree/multi.tree.list.combo.ts b/typescript/widget/multitree/multi.tree.list.combo.ts index 375d1f5e1..202b8b9b0 100644 --- a/typescript/widget/multitree/multi.tree.list.combo.ts +++ b/typescript/widget/multitree/multi.tree.list.combo.ts @@ -22,4 +22,8 @@ export declare class MultiTreeListCombo extends Single { populate(): void; getSearcher(): Widget; + + focus(): void; + + blur(): void; } diff --git a/typescript/widget/time/time.combo.ts b/typescript/widget/time/time.combo.ts index fa14d017f..9b52d1fd1 100644 --- a/typescript/widget/time/time.combo.ts +++ b/typescript/widget/time/time.combo.ts @@ -10,4 +10,10 @@ export declare class TimeCombo extends Single { static EVENT_BEFORE_POPUPVIEW: string; hidePopupView(): void; + + focus(): void; + + blur(): void; + + setWaterMark(v: string): void; }