diff --git a/.eslintrc b/.eslintrc index 56c26d0b0..c435e6b66 100644 --- a/.eslintrc +++ b/.eslintrc @@ -29,6 +29,8 @@ "files": ["src/*.js","src/**/*.js", "demo/*.js", "demo/**/*.js", "i18n/**/*.js", "i18n/*.js", "test/**/*.js", "test/*.js"], "extends": "plugin:@fui/es5", "rules": { + "no-param-reassign": "off", + "quotes": [2, "double"], "comma-dangle": ["error", "never"] // 多行对象字面量中要求拖尾逗号 } }, { diff --git a/demo/js/config/demo.pane.js b/demo/js/config/demo.pane.js index 30b2415a7..e6cb35c62 100644 --- a/demo/js/config/demo.pane.js +++ b/demo/js/config/demo.pane.js @@ -4,11 +4,15 @@ * description: */ !(function () { - var Pane = BI.inherit(BI.LoadingPane, { + var Pane = BI.inherit(BI.Pane, { props: { }, + mounted: function () { + console.log('loading pane mounted'); + }, + render: function () { return { type: "bi.center_adapt", @@ -19,11 +23,14 @@ }; }, - beforeInit: function (callback) { + beforeRender: function (callback) { + var self = this; + this.loading(); setTimeout(function () { + self.loaded(); callback(); }, 3000); } }); BI.shortcut("demo.pane", Pane); -})(); \ No newline at end of file +})(); diff --git a/dist/fix/fix.compact.js b/dist/fix/fix.compact.js index c57c525ec..69a0a3196 100644 --- a/dist/fix/fix.compact.js +++ b/dist/fix/fix.compact.js @@ -183,7 +183,7 @@ delete this.__cacheStore; }; - _.each(["_rendered", "_mount", "__afterMount"], function (name) { + _.each(["__afterRender", "_mount", "__afterMount"], function (name) { var old = BI.Widget.prototype[name]; old && (BI.Widget.prototype[name] = function () { this.store && pushTarget(this.store); diff --git a/dist/font/iconfont.eot b/dist/font/iconfont.eot index 41ca8a698..9db044108 100644 Binary files a/dist/font/iconfont.eot and b/dist/font/iconfont.eot differ diff --git a/dist/font/iconfont.svg b/dist/font/iconfont.svg index 262f6e512..5a40b7253 100644 --- a/dist/font/iconfont.svg +++ b/dist/font/iconfont.svg @@ -14,6 +14,14 @@ /> + + + + + + + + diff --git a/dist/font/iconfont.ttf b/dist/font/iconfont.ttf index 345b018f1..2200c297f 100644 Binary files a/dist/font/iconfont.ttf and b/dist/font/iconfont.ttf differ diff --git a/dist/font/iconfont.woff b/dist/font/iconfont.woff index ea769ef1c..dfeba9b00 100644 Binary files a/dist/font/iconfont.woff and b/dist/font/iconfont.woff differ diff --git a/dist/font/iconfont.woff2 b/dist/font/iconfont.woff2 index 2397b02be..d85feabbd 100644 Binary files a/dist/font/iconfont.woff2 and b/dist/font/iconfont.woff2 differ diff --git a/karma.conf.js b/karma.conf.js index 8b5bca997..1152ccb6a 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -35,7 +35,6 @@ module.exports = function (config) { exclude: [ "src/base/single/input/file.js", - "src/case/loading/loading_pane.js", "src/case/ztree/**/*.js", "src/widget/multitree/**/*.js", "src/widget/multiselecttree/**/*.js", diff --git a/package.json b/package.json index c10d30b5c..0d3cd947b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fineui", - "version": "2.0.20211020184222", + "version": "2.0.20211108153147", "description": "fineui", "main": "dist/fineui.min.js", "types": "dist/lib/index.d.ts", diff --git a/src/base/combination/combo.js b/src/base/combination/combo.js index 881480a84..64192fe29 100644 --- a/src/base/combination/combo.js +++ b/src/base/combination/combo.js @@ -21,6 +21,7 @@ container: null, // popupview放置的容器,默认为this.element isDefaultInit: false, destroyWhenHide: false, + hideWhenBlur: true, hideWhenAnotherComboOpen: false, isNeedAdjustHeight: true, // 是否需要高度调整 isNeedAdjustWidth: true, @@ -291,6 +292,7 @@ }, _hideView: function (e) { + var o = this.options; this.fireEvent(BI.Combo.EVENT_BEFORE_HIDEVIEW); if (this.options.destroyWhenHide === true) { this.popupView && this.popupView.destroy(); @@ -310,12 +312,12 @@ delete needHideWhenAnotherComboOpen[this.getName()]; BI.Widget._renderEngine.createElement(document).unbind("mousedown." + this.getName()).unbind("mousewheel." + this.getName()); - BI.Widget._renderEngine.createElement(window).unbind("blur." + this.getName()); + BI.EVENT_BLUR && o.hideWhenBlur && BI.Widget._renderEngine.createElement(window).unbind("blur." + this.getName()); this.fireEvent(BI.Combo.EVENT_AFTER_HIDEVIEW); }, _popupView: function (e) { - var self = this; + var self = this, o = this.options; this._assertPopupViewRender(); this.fireEvent(BI.Combo.EVENT_BEFORE_POPUPVIEW); // popupVisible是为了获取其宽高, 放到可视范围之外以防止在IE下闪一下 @@ -334,10 +336,10 @@ this.element.addClass(this.options.comboClass); BI.Widget._renderEngine.createElement(document).unbind("mousedown." + this.getName()).unbind("mousewheel." + this.getName()); - BI.Widget._renderEngine.createElement(window).unbind("blur." + this.getName()); + BI.EVENT_BLUR && o.hideWhenBlur && BI.Widget._renderEngine.createElement(window).unbind("blur." + this.getName()); 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(window).bind("blur." + 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); }, diff --git a/src/base/list/virtualgrouplist.js b/src/base/list/virtualgrouplist.js index 56dd68bb1..95ed647e0 100644 --- a/src/base/list/virtualgrouplist.js +++ b/src/base/list/virtualgrouplist.js @@ -55,8 +55,16 @@ BI.VirtualGroupList = BI.inherit(BI.Widget, { mounted: function () { var self = this, o = this.options; this._populate(); + this._debounceRelease = BI.debounce(function () { + self._scrollLock = false; + }, 30); this.element.scroll(function (e) { + if (self._scrollLock === true) { + return; + } + self._scrollLock = true; o.scrollTop = self.element.scrollTop(); + self._debounceRelease(); self._calculateBlocksToRender(); }); BI.ResizeDetector.addResizeListener(this, function () { diff --git a/src/base/single/input/input.js b/src/base/single/input/input.js index 837d6d205..31c1ea296 100644 --- a/src/base/single/input/input.js +++ b/src/base/single/input/input.js @@ -24,7 +24,7 @@ BI.Input = BI.inherit(BI.Single, { var _keydown = BI.debounce(function (keyCode) { self.onKeyDown(keyCode, ctrlKey); self._keydown_ = false; - }, 300); + }, BI.EVENT_RESPONSE_TIME); var _clk = BI.debounce(BI.bind(this._click, this), BI.EVENT_RESPONSE_TIME, { "leading": true, "trailing": false @@ -95,11 +95,7 @@ BI.Input = BI.inherit(BI.Single, { _blur: function () { var self = this; - if (self._keydown_ === true) { - BI.delay(blur, 300); - } else { - blur(); - } + blur(); function blur () { if (!self.isValid() && self.options.quitChecker.apply(self, [BI.trim(self.getValue())]) !== false) { diff --git a/src/base/single/label/abstract.label.js b/src/base/single/label/abstract.label.js index c9a6eb608..8bbfbee15 100644 --- a/src/base/single/label/abstract.label.js +++ b/src/base/single/label/abstract.label.js @@ -29,6 +29,7 @@ textAlign: o.textAlign, whiteSpace: o.whiteSpace, lineHeight: o.textHeight, + maxWidth: "100%", text: o.text, value: o.value, py: o.py, @@ -185,17 +186,13 @@ })); return; } - BI.extend(json, { + this.text = BI.createWidget(BI.extend(json, { hgap: o.hgap, vgap: o.vgap, lgap: o.lgap, rgap: o.rgap, tgap: o.tgap, bgap: o.bgap - }); - - this.text = BI.createWidget(BI.extend(json, { - maxWidth: "100%" })); BI.createWidget({ type: "bi.center_adapt", @@ -211,7 +208,7 @@ var json = this._createJson(); if (BI.isNumber(o.width) && o.width > 0) { if (BI.isNumber(o.textWidth) && o.textWidth > 0) { - json.width = o.textWidth; + json.maxWidth = o.textWidth; if (BI.isNumber(o.height) && o.height > 0) { // 2.1 BI.createWidget({ type: adaptLayout, @@ -249,6 +246,11 @@ return; } if (BI.isNumber(o.height) && o.height > 0) { // 2.3 + if (o.whiteSpace !== "normal") { + this.element.css({ + "line-height": (o.height - (o.vgap * 2)) / BI.pixRatio + BI.pixUnit + }); + } this.text = BI.createWidget(BI.extend(json, { element: this, hgap: o.hgap, @@ -258,14 +260,9 @@ tgap: o.tgap, bgap: o.bgap })); - if (o.whiteSpace !== "normal") { - this.element.css({ - "line-height": (o.height - (o.vgap * 2)) / BI.pixRatio + BI.pixUnit - }); - } return; } - json.width = o.width - 2 * o.hgap - o.lgap - o.rgap; + json.maxWidth = o.width - 2 * o.hgap - o.lgap - o.rgap; BI.createWidget({ // 2.4 type: adaptLayout, horizontalAlign: o.textAlign, @@ -285,7 +282,7 @@ return; } if (BI.isNumber(o.textWidth) && o.textWidth > 0) { - json.width = o.textWidth; + json.maxWidth = o.textWidth; BI.createWidget({ // 2.5 type: adaptLayout, horizontalAlign: o.textAlign, @@ -323,17 +320,13 @@ })); return; } - BI.extend(json, { + this.text = BI.createWidget(BI.extend(json, { hgap: o.hgap, vgap: o.vgap, lgap: o.lgap, rgap: o.rgap, tgap: o.tgap, bgap: o.bgap - }); - - this.text = BI.createWidget(BI.extend(json, { - maxWidth: "100%" })); BI.createWidget({ type: adaptLayout, diff --git a/src/case/calendar/calendar.date.item.js b/src/case/calendar/calendar.date.item.js index b8ee105c6..9da26c663 100644 --- a/src/case/calendar/calendar.date.item.js +++ b/src/case/calendar/calendar.date.item.js @@ -21,8 +21,8 @@ BI.CalendarDateItem = BI.inherit(BI.BasicButton, { }, left: o.lgap, right: o.rgap, - top: 0, - bottom: 0 + top: o.tgap, + bottom: o.rgap }] }; }, @@ -50,4 +50,4 @@ BI.CalendarDateItem = BI.inherit(BI.BasicButton, { return this.text.getValue(); } }); -BI.shortcut("bi.calendar_date_item", BI.CalendarDateItem); \ No newline at end of file +BI.shortcut("bi.calendar_date_item", BI.CalendarDateItem); diff --git a/src/case/calendar/calendar.js b/src/case/calendar/calendar.js index fb762da7e..ddc12c071 100644 --- a/src/case/calendar/calendar.js +++ b/src/case/calendar/calendar.js @@ -100,8 +100,7 @@ BI.Calendar = BI.inherit(BI.Widget, { columns: 7, rows: 6, columnSize: [1 / 7, 1 / 7, 1 / 7, 1 / 7, 1 / 7, 1 / 7, 1 / 7], - rowSize: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT, - vgap: 10 + rowSize: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT + 10 }))] }); this.days.on(BI.Controller.EVENT_CHANGE, function () { @@ -111,7 +110,10 @@ BI.Calendar = BI.inherit(BI.Widget, { element: this }, BI.LogicFactory.createLogic("vertical", BI.extend({}, o.logic, { - items: BI.LogicFactory.createLogicItemsByDirection("top", title, this.days) + items: BI.LogicFactory.createLogicItemsByDirection("top", title, { + el: this.days, + tgap: -5 + }) })))); }, @@ -159,11 +161,13 @@ BI.Calendar = BI.inherit(BI.Widget, { whiteSpace: "normal", once: false, forceSelected: true, - height: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT, + height: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT + 10, value: o.year + "-" + month + "-" + td.text, disabled: td.lastMonth || td.nextMonth || td.disabled, lgap: 5, - rgap: 5 + rgap: 5, + tgap: 5, + bgap: 5 // selected: td.currentDay }); }); @@ -231,4 +235,4 @@ BI.extend(BI.Calendar, { } }); -BI.shortcut("bi.calendar", BI.Calendar); \ No newline at end of file +BI.shortcut("bi.calendar", BI.Calendar); diff --git a/src/case/colorchooser/colorpicker/editor.colorpicker.hex.js b/src/case/colorchooser/colorpicker/editor.colorpicker.hex.js index 6aa07afe8..83b7b9462 100644 --- a/src/case/colorchooser/colorpicker/editor.colorpicker.hex.js +++ b/src/case/colorchooser/colorpicker/editor.colorpicker.hex.js @@ -72,20 +72,9 @@ BI.HexColorPickerEditor = BI.inherit(BI.Widget, { listeners: [{ eventName: BI.ColorChooserShowButton.EVENT_CHANGE, action: function () { - if (this.isSelected()) { - self.lastColor = self.getValue(); - self.setValue("transparent"); - } else { - if (self.lastColor === "transparent") { - self.lastColor = ""; - } - self.setValue(self.lastColor || "#ffffff"); - } - if ((self.R.isValid() && self.G.isValid() && self.B.isValid()) || - self._isEmptyRGB()) { - self.colorShow.element.css("background-color", self.getValue()); - self.fireEvent(BI.ColorPickerEditor.EVENT_CHANGE); - } + var value = self.getValue(); + self.setValue("transparent"); + (value !== "transparent") && self.fireEvent(BI.ColorPickerEditor.EVENT_CHANGE); } }], ref: function (_ref) { @@ -101,16 +90,9 @@ BI.HexColorPickerEditor = BI.inherit(BI.Widget, { listeners: [{ eventName: BI.ColorChooserShowButton.EVENT_CHANGE, action: function () { - if (this.isSelected()) { - self.lastColor = self.getValue(); - self.setValue(""); - } else { - self.setValue(self.lastColor || "#ffffff"); - } - if ((self.R.isValid() && self.G.isValid() && self.B.isValid()) || self._isEmptyRGB()) { - self.colorShow.element.css("background-color", self.getValue()); - self.fireEvent(BI.ColorPickerEditor.EVENT_CHANGE); - } + var value = self.getValue(); + self.setValue(""); + (value !== "") && self.fireEvent(BI.ColorPickerEditor.EVENT_CHANGE); } }], ref: function (_ref) { diff --git a/src/case/colorchooser/colorpicker/editor.colorpicker.js b/src/case/colorchooser/colorpicker/editor.colorpicker.js index 4be3375a4..9d0dbbca0 100644 --- a/src/case/colorchooser/colorpicker/editor.colorpicker.js +++ b/src/case/colorchooser/colorpicker/editor.colorpicker.js @@ -72,16 +72,9 @@ BI.ColorPickerEditor = BI.inherit(BI.Widget, { title: BI.i18nText("BI-Basic_Auto") }); this.none.on(BI.IconButton.EVENT_CHANGE, function () { - if (this.isSelected()) { - self.lastColor = self.getValue(); - self.setValue(""); - } else { - self.setValue(self.lastColor || "#ffffff"); - } - if ((self.R.isValid() && self.G.isValid() && self.B.isValid()) || self._isEmptyRGB()) { - self.colorShow.element.css("background-color", self.getValue()); - self.fireEvent(BI.ColorPickerEditor.EVENT_CHANGE); - } + var value = self.getValue(); + self.setValue(""); + (value !== "") && self.fireEvent(BI.ColorPickerEditor.EVENT_CHANGE); }); this.transparent = BI.createWidget({ @@ -94,20 +87,9 @@ BI.ColorPickerEditor = BI.inherit(BI.Widget, { title: BI.i18nText("BI-Transparent_Color") }); this.transparent.on(BI.IconButton.EVENT_CHANGE, function () { - if (this.isSelected()) { - self.lastColor = self.getValue(); - self.setValue("transparent"); - } else { - if (self.lastColor === "transparent") { - self.lastColor = ""; - } - self.setValue(self.lastColor || "#ffffff"); - } - if ((self.R.isValid() && self.G.isValid() && self.B.isValid()) || - self._isEmptyRGB()) { - self.colorShow.element.css("background-color", self.getValue()); - self.fireEvent(BI.ColorPickerEditor.EVENT_CHANGE); - } + var value = self.getValue(); + self.setValue("transparent"); + (value !== "transparent") && self.fireEvent(BI.ColorPickerEditor.EVENT_CHANGE); }); BI.createWidget({ diff --git a/src/case/combo/bubblecombo/combo.bubble.js b/src/case/combo/bubblecombo/combo.bubble.js index dcf6f62e0..8a0af89b3 100644 --- a/src/case/combo/bubblecombo/combo.bubble.js +++ b/src/case/combo/bubblecombo/combo.bubble.js @@ -16,6 +16,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, + hideWhenBlur: true, isNeedAdjustHeight: true, // 是否需要高度调整 isNeedAdjustWidth: true, stopPropagation: false, @@ -40,6 +41,7 @@ BI.BubbleCombo = BI.inherit(BI.Widget, { container: o.container, direction: o.direction, isDefaultInit: o.isDefaultInit, + hideWhenBlur: o.hideWhenBlur, destroyWhenHide: o.destroyWhenHide, hideWhenAnotherComboOpen: o.hideWhenAnotherComboOpen, isNeedAdjustHeight: o.isNeedAdjustHeight, diff --git a/src/case/combo/editoriconcheckcombo/combo.editiconcheck.js b/src/case/combo/editoriconcheckcombo/combo.editiconcheck.js index 8ab27cf1a..28c57a2e9 100644 --- a/src/case/combo/editoriconcheckcombo/combo.editiconcheck.js +++ b/src/case/combo/editoriconcheckcombo/combo.editiconcheck.js @@ -64,6 +64,7 @@ BI.EditorIconCheckCombo = BI.inherit(BI.Widget, { this.editorIconCheckCombo = BI.createWidget({ type: "bi.combo", container: o.container, + direction: o.direction, element: this, adjustLength: 2, el: this.trigger, diff --git a/src/case/combo/icontextvaluecombo/combo.icontextvalue.js b/src/case/combo/icontextvaluecombo/combo.icontextvalue.js index d114dddee..118138779 100644 --- a/src/case/combo/icontextvaluecombo/combo.icontextvalue.js +++ b/src/case/combo/icontextvaluecombo/combo.icontextvalue.js @@ -52,6 +52,7 @@ BI.IconTextValueCombo = BI.inherit(BI.Widget, { type: "bi.combo", element: this, container: o.container, + direction: o.direction, adjustLength: 2, el: this.trigger, popup: { diff --git a/src/case/combo/textvaluecheckcombo/combo.textvaluecheck.js b/src/case/combo/textvaluecheckcombo/combo.textvaluecheck.js index 996e7adf6..530cc2a01 100644 --- a/src/case/combo/textvaluecheckcombo/combo.textvaluecheck.js +++ b/src/case/combo/textvaluecheckcombo/combo.textvaluecheck.js @@ -44,6 +44,7 @@ BI.TextValueCheckCombo = BI.inherit(BI.Widget, { this.textIconCheckCombo = BI.createWidget({ type: "bi.combo", container: o.container, + direction: o.direction, element: this, adjustLength: 2, el: this.trigger, @@ -82,4 +83,4 @@ BI.TextValueCheckCombo = BI.inherit(BI.Widget, { } }); BI.TextValueCheckCombo.EVENT_CHANGE = "EVENT_CHANGE"; -BI.shortcut("bi.text_value_check_combo", BI.TextValueCheckCombo); \ No newline at end of file +BI.shortcut("bi.text_value_check_combo", BI.TextValueCheckCombo); diff --git a/src/case/combo/textvaluecombo/combo.textvalue.js b/src/case/combo/textvaluecombo/combo.textvalue.js index b0ff081b7..b0242a64d 100644 --- a/src/case/combo/textvaluecombo/combo.textvalue.js +++ b/src/case/combo/textvaluecombo/combo.textvalue.js @@ -46,6 +46,7 @@ BI.TextValueCombo = BI.inherit(BI.Widget, { this.textIconCombo = BI.createWidget({ type: "bi.combo", container: o.container, + direction: o.direction, element: this, adjustLength: 2, el: this.trigger, diff --git a/src/case/loading/loading_pane.js b/src/case/loading/loading_pane.js deleted file mode 100644 index 2218685c5..000000000 --- a/src/case/loading/loading_pane.js +++ /dev/null @@ -1,31 +0,0 @@ -/** - * author: young - * createdDate: 2018/12/18 - * description: - */ -BI.LoadingPane = BI.inherit(BI.Pane, { - _mount: function () { - var isMounted = BI.Pane.superclass._mount.apply(this, arguments); - if (isMounted) { - if (this.beforeInit) { - this.__asking = true; - this.loading(); - this.beforeInit(BI.bind(this.__loaded, this)); - } - } - }, - - _initRender: function () { - if (this.beforeInit) { - this.__async = true; - } else { - this._render(); - } - }, - - __loaded: function () { - this.__asking = false; - this.loaded(); - this._render(); - } -}); \ No newline at end of file diff --git a/src/core/4.widget.js b/src/core/4.widget.js index 00029c375..c3d1e0bc5 100644 --- a/src/core/4.widget.js +++ b/src/core/4.widget.js @@ -128,8 +128,7 @@ } renderCallbackCalled = true; self._render(); - self._rendered(); - self.__async = false; + self.__afterRender(); } if (self.options.beforeRender || self.beforeRender) { @@ -137,7 +136,7 @@ (self.options.beforeRender || self.beforeRender).call(self, render); } else { self._render(); - self._rendered(); + self.__afterRender(); } } @@ -149,13 +148,17 @@ } }, - _rendered: function () { + __afterRender: function () { pushTarget(this); - this.__async === true && this._isMounted && callLifeHook(this, "beforeMount"); - this._mount(); - if (this.__async === true && this._isMounted) { + var async = this.__async; + this.__async = false; + if (async && this._isMounted) { + callLifeHook(this, "beforeMount"); + this._mount(); callLifeHook(this, "mounted"); this.fireEvent(BI.Events.MOUNT); + } else { + this._mount(); } popTarget(); }, @@ -330,49 +333,6 @@ } }, - // _initVNode: function () { - // if (this.options.vdom) { - // var div = document.createElement("div"); - // var element = this.element; - // element.append(div); - // this.vnode = this._renderVNode(); - // BI.patchVNode(div, this.vnode); - // // 去除这个临时的div - // BI.DOM.hang([div]); - // element.attr("style", this.vnode.elm.getAttribute("style")); - // element.addClass(this.vnode.elm.getAttribute("class")); - // element.empty(); - // BI.each(BI.jQuery(this.vnode.elm).children(), function (i, node) { - // element.append(node); - // }); - // return true; - // } - // return false; - // }, - - // _renderVNode: function () { - // var self = this; - // var render = BI.isFunction(this.options.render) ? this.options.render : this.render; - // var els = render && render.call(this); - // els = BI.Plugin.getRender(this.options.type, els); - // if (BI.isPlainObject(els)) { - // els = [els]; - // } - // if (BI.isArray(els)) { - // var container = document.createElement("div"); - // this._children = {}; - // BI.each(els, function (i, el) { - // if (el) { - // var w = BI._lazyCreateWidget(el, { - // element: container - // }); - // self.addWidget(w); - // } - // }); - // } - // return BI.Element2Vnode(container); - // }, - _setParent: function (parent) { this._parent = parent; }, @@ -806,7 +766,7 @@ BI.onBeforeMount = function (beforeMount) { if (current) { - if(current.__isMounting){ + if (current.__isMounting) { beforeMount(); return; } @@ -820,7 +780,7 @@ }; BI.onMounted = function (mounted) { if (current) { - if(current._isMounted && !this.__async){ + if (current._isMounted && !this.__async) { mounted(); return; } diff --git a/src/core/6.inject.js b/src/core/6.inject.js index b60093e31..ed4d1165b 100644 --- a/src/core/6.inject.js +++ b/src/core/6.inject.js @@ -397,7 +397,7 @@ if (!providers[type]) { providers[type] = new providerInjection[type](); } - if (!providerInstance[type]) { + if (!providerInstance[type] && providers[type].$get) { providerInstance[type] = new (providers[type].$get())(config); } return providerInstance[type]; diff --git a/src/core/9.popper.js b/src/core/8.popper.js similarity index 100% rename from src/core/9.popper.js rename to src/core/8.popper.js diff --git a/src/core/10.worker.js b/src/core/9.worker.js similarity index 100% rename from src/core/10.worker.js rename to src/core/9.worker.js diff --git a/src/core/constant/var.js b/src/core/constant/var.js index a5bad8f77..cc767737b 100644 --- a/src/core/constant/var.js +++ b/src/core/constant/var.js @@ -6,6 +6,7 @@ _.extend(BI, { MAX: 0xfffffffffffffff, MIN: -0xfffffffffffffff, EVENT_RESPONSE_TIME: 200, + EVENT_BLUR: true, zIndex_layer: 1e5, zIndex_popover: 1e6, zIndex_popup: 1e7, diff --git a/src/core/wrapper/layout.js b/src/core/wrapper/layout.js index 01ff69be8..bc48cd3f4 100644 --- a/src/core/wrapper/layout.js +++ b/src/core/wrapper/layout.js @@ -240,7 +240,7 @@ BI.Layout = BI.inherit(BI.Widget, { var w = this._newElement(newIndex, item); // 需要有个地方临时存一下新建的组件,否则如果直接使用newIndex的话,newIndex位置的元素可能会被用到 this._children[this._getChildName(newIndex) + "-temp"] = w; - var nextSibling = del.element[0].nextSibling; + var nextSibling = del.element.next(); if (nextSibling) { BI.Widget._renderEngine.createElement(nextSibling).before(w.element); } else { @@ -420,6 +420,7 @@ BI.Layout = BI.inherit(BI.Widget, { var shouldUpdate = this.shouldUpdateItem(oldIndex, vnode); var child = this._children[this._getChildName(oldIndex)]; if (shouldUpdate) { + this._children[this._getChildName(newIndex) + "-temp"] = child; return child._update(this._getOptions(vnode), shouldUpdate); } if (shouldUpdate === null && !this._compare(oldVnode, vnode)) { diff --git a/src/less/base/segment/button.segment.less b/src/less/base/segment/button.segment.less index fa24f8331..4a5597ce6 100644 --- a/src/less/base/segment/button.segment.less +++ b/src/less/base/segment/button.segment.less @@ -2,14 +2,14 @@ .bi-segment-button { color: @color-bi-text-highlight; - &.active { - &:active { - color: @color-bi-text; - background-color: @color-bi-background-highlight; - } - } - &:active { - color: @color-bi-text-highlight; - .background-color(@color-bi-background-highlight, 10%); - } -} \ No newline at end of file + //&.active { + // &:active { + // color: @color-bi-text; + // background-color: @color-bi-background-highlight; + // } + //} + //&:active { + // color: @color-bi-text-highlight; + // .background-color(@color-bi-background-highlight, 10%); + //} +} diff --git a/src/less/core/utils/list-item.less b/src/less/core/utils/list-item.less index f6e1a4549..8964830cd 100644 --- a/src/less/core/utils/list-item.less +++ b/src/less/core/utils/list-item.less @@ -337,13 +337,69 @@ } } +// hover的时候背景变化 -- 变灰 +// active的时候文字高亮背景变化 -- 变灰 +.bi-list-item-active3, .bi-list-item-select3 { + &:hover, &.hover { + background-color: @color-bi-background-normal; + } + &:active, &.active { + color: @color-bi-text-highlight; + & .bi-input { + color: @color-bi-text-highlight; + } + & .bi-textarea { + color: @color-bi-text-highlight; + } + background-color: @color-bi-background-normal; + } + &.disabled { + &:hover, &.hover, &:active, &.active { + background-color: @color-bi-background-default !important; + } + } +} + +.bi-theme-dark { + .bi-list-item-active3, .bi-list-item-select3 { + &:hover, &.hover { + background-color: @color-bi-background-normal-theme-dark; + } + &:active, &.active { + color: @color-bi-text-highlight; + & .bi-input { + color: @color-bi-text-highlight; + } + & .bi-textarea { + color: @color-bi-text-highlight; + } + background-color: @color-bi-background-normal-theme-dark; + } + &.disabled { + &:hover, &.hover, &:active, &.active { + background-color: @color-bi-background-default-theme-dark !important; + } + } + } +} + // hover的时候背景变化 // active的时候背景高亮 .bi-list-item-select { &:hover, &.hover { .background-color(@color-bi-background-highlight, 10%); } - &:active, &.active { + &:active { + color: @color-bi-text-highlight; + & .bi-input { + color: @color-bi-text-highlight; + } + & .bi-textarea { + color: @color-bi-text-highlight; + } + .background-color(@color-bi-background-highlight, 15%); + } + &.active { color: @color-bi-text; & .bi-input { color: @color-bi-text; @@ -471,7 +527,17 @@ } .background-color(@color-bi-background-default, 5%); } - &:active, &.active { + &:active { + color: @color-bi-text; + & .bi-input { + color: @color-bi-text; + } + & .bi-textarea { + color: @color-bi-text; + } + .background-color(@color-bi-background-default, 5%); + } + &.active { color: @color-bi-text; & .bi-input { color: @color-bi-text; @@ -600,52 +666,6 @@ } } -// hover的时候背景变化 -- 变灰 -// active的时候文字高亮背景变化 -- 变灰 -.bi-list-item-select3 { - &:hover, &.hover { - background-color: @color-bi-background-normal; - } - &:active, &.active { - color: @color-bi-text-highlight; - & .bi-input { - color: @color-bi-text-highlight; - } - & .bi-textarea { - color: @color-bi-text-highlight; - } - background-color: @color-bi-background-normal; - } - &.disabled { - &:hover, &.hover, &:active, &.active { - background-color: @color-bi-background-default !important; - } - } -} - -.bi-theme-dark { - .bi-list-item-select3 { - &:hover, &.hover { - background-color: @color-bi-background-normal-theme-dark; - } - &:active, &.active { - color: @color-bi-text-highlight; - & .bi-input { - color: @color-bi-text-highlight; - } - & .bi-textarea { - color: @color-bi-text-highlight; - } - background-color: @color-bi-background-normal-theme-dark; - } - &.disabled { - &:hover, &.hover, &:active, &.active { - background-color: @color-bi-background-default-theme-dark !important; - } - } - } -} - // 去掉list-item效果 .bi-list-item-none { &:hover, &.hover { diff --git a/src/less/lib/background.less b/src/less/lib/background.less index 8d9221621..1f291a5fe 100644 --- a/src/less/lib/background.less +++ b/src/less/lib/background.less @@ -7,7 +7,7 @@ @background-trans-color: "background/trans_normal.png"; @background-trans-color-disabled: "background/trans_disable.png"; @background-auto-color-square-normal: "icon/auto_square_normal.png"; -@background-auto-color-no-square-normal: "icon/auto_no_square_normal"; +@background-auto-color-no-square-normal: "icon/auto_no_square_normal.png"; @background-farbtastic-wheel:"background/wheel.png"; @background-farbtastic-overlay:"background/mask.png"; diff --git a/src/widget/date/calendar/picker.date.js b/src/widget/date/calendar/picker.date.js index 458da3d7d..369982dfa 100644 --- a/src/widget/date/calendar/picker.date.js +++ b/src/widget/date/calendar/picker.date.js @@ -11,31 +11,32 @@ BI.DatePicker = BI.inherit(BI.Widget, { baseCls: "bi-date-picker", height: 40, min: "1900-01-01", // 最小日期 - max: "2099-12-31", // 最大日期 + max: "2099-12-31" // 最大日期 }); }, _init: function () { BI.DatePicker.superclass._init.apply(this, arguments); - var self = this; var o = this.options; + var self = this; + var o = this.options; this._year = BI.getDate().getFullYear(); this._month = BI.getDate().getMonth() + 1; this.left = BI.createWidget({ type: "bi.icon_button", cls: "pre-page-h-font", width: 24, - height: 24, + height: 24 }); this.left.on(BI.IconButton.EVENT_CHANGE, function () { if (self._month === 1) { self.setValue({ year: (self.year.getValue() - 1) || (BI.getDate().getFullYear() - 1), - month: 12, + month: 12 }); } else { self.setValue({ year: self.year.getValue() || BI.getDate().getFullYear(), - month: (self.month.getValue() - 1) || BI.getDate().getMonth(), + month: (self.month.getValue() - 1) || BI.getDate().getMonth() }); } self.fireEvent(BI.DatePicker.EVENT_CHANGE); @@ -47,19 +48,19 @@ BI.DatePicker = BI.inherit(BI.Widget, { type: "bi.icon_button", cls: "next-page-h-font", width: 24, - height: 24, + height: 24 }); this.right.on(BI.IconButton.EVENT_CHANGE, function () { if (self._month === 12) { self.setValue({ year: (self.year.getValue() + 1) || (BI.getDate().getFullYear() + 1), - month: 1, + month: 1 }); } else { self.setValue({ year: self.year.getValue() || BI.getDate().getFullYear(), - month: (self.month.getValue() + 1) || (BI.getDate().getMonth() + 2), + month: (self.month.getValue() + 1) || (BI.getDate().getMonth() + 2) }); } self.fireEvent(BI.DatePicker.EVENT_CHANGE); @@ -71,7 +72,7 @@ BI.DatePicker = BI.inherit(BI.Widget, { type: "bi.year_date_combo", behaviors: o.behaviors, min: o.min, - max: o.max, + max: o.max }); this.year.on(BI.YearDateCombo.EVENT_CHANGE, function () { self.setValue({ @@ -91,7 +92,7 @@ BI.DatePicker = BI.inherit(BI.Widget, { this.month.on(BI.MonthDateCombo.EVENT_CHANGE, function () { self.setValue({ year: self.year.getValue() || self._year, - month: self.month.getValue(), + month: self.month.getValue() }); self.fireEvent(BI.DatePicker.EVENT_CHANGE); }); @@ -105,33 +106,26 @@ BI.DatePicker = BI.inherit(BI.Widget, { items: [{ el: { type: "bi.center_adapt", - items: [this.left], + items: [this.left] }, - width: 24, + width: 24 }, { - type: "bi.center_adapt", - items: [{ - el: { - type: "bi.horizontal", - width: 120, - rgap: 10, - items: [{ - el: this.year, - lgap: 10, - }, this.month], - }, - }], + el: { + type: "bi.center_adapt", + hgap: 10, + items: [this.year, this.month] + } }, { el: { type: "bi.center_adapt", - items: [this.right], + items: [this.right] }, - width: 24, - }], + width: 24 + }] }); this.setValue({ year: this._year, - month: this._month, + month: this._month }); }, @@ -177,7 +171,7 @@ BI.DatePicker = BI.inherit(BI.Widget, { return valid; }, - _getCheckMinMaxDate: function() { + _getCheckMinMaxDate: function () { var o = this.options; var minDate = BI.parseDateTime(o.min, "%Y-%X-%d"); var maxDate = BI.parseDateTime(o.max, "%Y-%X-%d"); @@ -219,9 +213,9 @@ BI.DatePicker = BI.inherit(BI.Widget, { getValue: function () { return { year: this.year.getValue(), - month: this.month.getValue(), + month: this.month.getValue() }; - }, + } }); BI.DatePicker.EVENT_CHANGE = "EVENT_CHANGE"; BI.DatePicker.EVENT_BEFORE_YEAR_MONTH_POPUPVIEW = "EVENT_BEFORE_YEAR_MONTH_POPUPVIEW"; diff --git a/src/widget/date/calendar/popup.calendar.date.js b/src/widget/date/calendar/popup.calendar.date.js index 9ddf99649..1a353afef 100644 --- a/src/widget/date/calendar/popup.calendar.date.js +++ b/src/widget/date/calendar/popup.calendar.date.js @@ -88,7 +88,7 @@ BI.DateCalendarPopup = BI.inherit(BI.Widget, { items: [{ el: this.calendar, hgap: 5, - bgap: 12 + bgap: 7 }] }, { type: "bi.absolute", @@ -148,4 +148,4 @@ BI.DateCalendarPopup = BI.inherit(BI.Widget, { }); BI.DateCalendarPopup.EVENT_CHANGE = "EVENT_CHANGE"; BI.DateCalendarPopup.EVENT_BEFORE_YEAR_MONTH_POPUPVIEW = "EVENT_BEFORE_YEAR_MONTH_POPUPVIEW"; -BI.shortcut("bi.date_calendar_popup", BI.DateCalendarPopup); \ No newline at end of file +BI.shortcut("bi.date_calendar_popup", BI.DateCalendarPopup); diff --git a/src/widget/dynamicdate/dynamicdate.combo.js b/src/widget/dynamicdate/dynamicdate.combo.js index ef010b87f..c587425cb 100644 --- a/src/widget/dynamicdate/dynamicdate.combo.js +++ b/src/widget/dynamicdate/dynamicdate.combo.js @@ -30,7 +30,7 @@ BI.DynamicDateCombo = BI.inherit(BI.Single, { this.storeTriggerValue = ""; var date = BI.getDate(); this.storeValue = opts.value; - + return { type: "bi.absolute", items: [{ @@ -250,10 +250,10 @@ BI.DynamicDateCombo = BI.inherit(BI.Single, { self.comboWrapper = _ref; } }, - top: 1, - left: 1, - right: 1, - bottom: 1 + top: 0, + left: 0, + right: 0, + bottom: 0 }] }; }, @@ -289,7 +289,7 @@ BI.DynamicDateCombo = BI.inherit(BI.Single, { return BI.isNotEmptyObject(v.value); case BI.DynamicDateCombo.Static: var value = v.value || {}; - + return !BI.checkDateVoid(value.year, value.month, value.day, o.minDate, o.maxDate)[0]; default: return true; diff --git a/src/widget/dynamicdatetime/dynamicdatetime.combo.js b/src/widget/dynamicdatetime/dynamicdatetime.combo.js index bc0f71c44..ae201b041 100644 --- a/src/widget/dynamicdatetime/dynamicdatetime.combo.js +++ b/src/widget/dynamicdatetime/dynamicdatetime.combo.js @@ -30,7 +30,7 @@ BI.DynamicDateTimeCombo = BI.inherit(BI.Single, { this.storeTriggerValue = ""; var date = BI.getDate(); this.storeValue = opts.value; - + return { type: "bi.absolute", items: [{ @@ -259,10 +259,10 @@ BI.DynamicDateTimeCombo = BI.inherit(BI.Single, { self.comboWrapper = _ref; } }, - top: 1, - left: 1, - right: 1, - bottom: 1 + top: 0, + left: 0, + right: 0, + bottom: 0 }] }; }, diff --git a/src/widget/multilayerdownlist/popup.downlist.js b/src/widget/multilayerdownlist/popup.downlist.js index 7fb5c1d16..0f66afcc7 100644 --- a/src/widget/multilayerdownlist/popup.downlist.js +++ b/src/widget/multilayerdownlist/popup.downlist.js @@ -107,7 +107,8 @@ BI.MultiLayerDownListPopup = BI.inherit(BI.Pane, { }] }, - innerVGap: 5 + innerVGap: 5, + maxHeight: 378, }; self._createChildren(item); } else { @@ -319,4 +320,4 @@ BI.MultiLayerDownListPopup = BI.inherit(BI.Pane, { BI.MultiLayerDownListPopup.EVENT_CHANGE = "EVENT_CHANGE"; BI.MultiLayerDownListPopup.EVENT_SON_VALUE_CHANGE = "EVENT_SON_VALUE_CHANGE"; -BI.shortcut("bi.multi_layer_down_list_popup", BI.MultiLayerDownListPopup); \ No newline at end of file +BI.shortcut("bi.multi_layer_down_list_popup", BI.MultiLayerDownListPopup); diff --git a/src/widget/multiselect/check/multiselect.check.pane.js b/src/widget/multiselect/check/multiselect.check.pane.js index d9b2b8b9c..958375876 100644 --- a/src/widget/multiselect/check/multiselect.check.pane.js +++ b/src/widget/multiselect/check/multiselect.check.pane.js @@ -39,6 +39,7 @@ BI.MultiSelectCheckPane = BI.inherit(BI.Widget, { callback({ items: BI.map(self.storeValue.value, function (i, v) { var txt = opts.valueFormatter(v) || v; + return { text: txt, value: v, @@ -46,6 +47,7 @@ BI.MultiSelectCheckPane = BI.inherit(BI.Widget, { }; }) }); + return; } opts.itemsCreator(op, callback); @@ -54,6 +56,7 @@ BI.MultiSelectCheckPane = BI.inherit(BI.Widget, { this.continueSelect = BI.createWidget({ type: "bi.text_button", + title: BI.i18nText("BI-Continue_Select"), text: BI.i18nText("BI-Continue_Select"), cls: "multi-select-check-selected bi-high-light" }); @@ -69,18 +72,20 @@ BI.MultiSelectCheckPane = BI.inherit(BI.Widget, { height: this.constants.height, el: { type: "bi.vertical_adapt", + columnSize: ["auto", "auto"], cls: "multi-select-continue-select", items: [ { el: { type: "bi.label", + title: BI.i18nText("BI-Selected_Data"), text: BI.i18nText("BI-Selected_Data") }, lgap: this.constants.lgap }, { el: this.continueSelect, - lgap: this.constants.lgap + hgap: this.constants.lgap }] }, tgap: this.constants.tgap @@ -105,4 +110,4 @@ BI.MultiSelectCheckPane = BI.inherit(BI.Widget, { } }); -BI.shortcut("bi.multi_select_check_pane", BI.MultiSelectCheckPane); \ No newline at end of file +BI.shortcut("bi.multi_select_check_pane", BI.MultiSelectCheckPane); diff --git a/src/widget/multiselect/multiselect.insert.combo.nobar.js b/src/widget/multiselect/multiselect.insert.combo.nobar.js index 226cc5260..fe1293a5c 100644 --- a/src/widget/multiselect/multiselect.insert.combo.nobar.js +++ b/src/widget/multiselect/multiselect.insert.combo.nobar.js @@ -401,7 +401,7 @@ BI.MultiSelectInsertNoBarCombo = BI.inherit(BI.Single, { callback(); function adjust () { if (self.wants2Quit === true) { - self.fireEvent(BI.MultiSelectInsertNoBarCombo.EVENT_CONFIRM); + self._dataChange && self.fireEvent(BI.MultiSelectInsertNoBarCombo.EVENT_CONFIRM); self.wants2Quit = false; } self.requesting = false; diff --git a/src/widget/multitree/check/multi.tree.check.pane.js b/src/widget/multitree/check/multi.tree.check.pane.js index b73f8d1ec..598a19f21 100644 --- a/src/widget/multitree/check/multi.tree.check.pane.js +++ b/src/widget/multitree/check/multi.tree.check.pane.js @@ -30,6 +30,7 @@ BI.MultiTreeCheckPane = BI.inherit(BI.Pane, { var continueSelect = BI.createWidget({ type: "bi.text_button", + title: BI.i18nText("BI-Continue_Select"), text: BI.i18nText("BI-Continue_Select"), cls: "multi-tree-check-selected" }); @@ -41,12 +42,14 @@ BI.MultiTreeCheckPane = BI.inherit(BI.Pane, { }); var backToPopup = BI.createWidget({ - type: "bi.left", + type: "bi.vertical_adapt", + columnSize: ["auto", "auto"], cls: "multi-tree-continue-select", items: [ { el: { type: "bi.label", + title: BI.i18nText("BI-Selected_Data"), text: BI.i18nText("BI-Selected_Data") }, lgap: this.constants.lgap, @@ -54,7 +57,7 @@ BI.MultiTreeCheckPane = BI.inherit(BI.Pane, { }, { el: continueSelect, - lgap: this.constants.lgap, + hgap: this.constants.lgap, tgap: this.constants.tgap }] }); @@ -92,7 +95,6 @@ BI.MultiTreeCheckPane = BI.inherit(BI.Pane, { el: this.display }] }); - }, empty: function () { @@ -116,4 +118,4 @@ BI.MultiTreeCheckPane = BI.inherit(BI.Pane, { BI.MultiTreeCheckPane.EVENT_CONTINUE_CLICK = "EVENT_CONTINUE_CLICK"; -BI.shortcut("bi.multi_tree_check_pane", BI.MultiTreeCheckPane); \ No newline at end of file +BI.shortcut("bi.multi_tree_check_pane", BI.MultiTreeCheckPane); diff --git a/src/widget/searchmultitextvaluecombo/multitextvalue.combo.search.js b/src/widget/searchmultitextvaluecombo/multitextvalue.combo.search.js index def624c1b..cb7fddf9a 100644 --- a/src/widget/searchmultitextvaluecombo/multitextvalue.combo.search.js +++ b/src/widget/searchmultitextvaluecombo/multitextvalue.combo.search.js @@ -333,7 +333,7 @@ BI.SearchMultiTextValueCombo = BI.inherit(BI.Single, { self._updateAllValue(); self._checkError(); if (self.wants2Quit === true) { - self.fireEvent(BI.SearchMultiTextValueCombo.EVENT_CONFIRM); + self._dataChange && self.fireEvent(BI.SearchMultiTextValueCombo.EVENT_CONFIRM); self.wants2Quit = false; } self.requesting = false; diff --git a/src/widget/singleselect/singleselect.combo.js b/src/widget/singleselect/singleselect.combo.js index 00f3ec366..729b666ef 100644 --- a/src/widget/singleselect/singleselect.combo.js +++ b/src/widget/singleselect/singleselect.combo.js @@ -64,6 +64,7 @@ BI.SingleSelectCombo = BI.inherit(BI.Single, { self.fireEvent(BI.SingleSelectCombo.EVENT_STOP); }); this.trigger.on(BI.SingleSelectTrigger.EVENT_SEARCHING, function () { + self._dataChange = true; self.fireEvent(BI.SingleSelectCombo.EVENT_SEARCHING); }); @@ -71,6 +72,7 @@ BI.SingleSelectCombo = BI.inherit(BI.Single, { self.storeValue = this.getValue(); assertShowValue(); self._defaultState(); + self._dataChange = true; }); this.trigger.on(BI.SingleSelectTrigger.EVENT_COUNTER_CLICK, function () { if (!self.combo.isViewVisible()) { @@ -95,6 +97,7 @@ BI.SingleSelectCombo = BI.inherit(BI.Single, { listeners: [{ eventName: BI.SingleSelectPopupView.EVENT_CHANGE, action: function () { + self._dataChange = true; self.storeValue = this.getValue(); self._adjust(function () { assertShowValue(); @@ -120,6 +123,9 @@ BI.SingleSelectCombo = BI.inherit(BI.Single, { }); this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () { + if (!this.isViewVisible()) { + self._dataChange = false;// 标记数据是否发生变化 + } this.setValue(self.storeValue); BI.nextTick(function () { self.populate(); @@ -133,7 +139,7 @@ BI.SingleSelectCombo = BI.inherit(BI.Single, { if (self.requesting === true) { self.wants2Quit = true; } else { - self.fireEvent(BI.SingleSelectCombo.EVENT_CONFIRM); + self._dataChange && self.fireEvent(BI.SingleSelectCombo.EVENT_CONFIRM); } }); @@ -173,7 +179,8 @@ BI.SingleSelectCombo = BI.inherit(BI.Single, { this.combo.hideView(); }, - _assertValue: function (val) {}, + _assertValue: function (val) { + }, _makeMap: function (values) { return BI.makeObject(values || []); @@ -220,7 +227,7 @@ BI.SingleSelectCombo = BI.inherit(BI.Single, { function adjust () { if (self.wants2Quit === true) { - self.fireEvent(BI.SingleSelectCombo.EVENT_CONFIRM); + self._dataChange && self.fireEvent(BI.SingleSelectCombo.EVENT_CONFIRM); self.wants2Quit = false; } self.requesting = false; diff --git a/src/widget/singleselect/singleselect.insert.combo.js b/src/widget/singleselect/singleselect.insert.combo.js index d94f97197..fc5d7db7a 100644 --- a/src/widget/singleselect/singleselect.insert.combo.js +++ b/src/widget/singleselect/singleselect.insert.combo.js @@ -75,6 +75,7 @@ BI.SingleSelectInsertCombo = BI.inherit(BI.Single, { self._defaultState(); }); this.trigger.on(BI.SingleSelectTrigger.EVENT_SEARCHING, function () { + self._dataChange = true; self.fireEvent(BI.SingleSelectInsertCombo.EVENT_SEARCHING); }); @@ -82,6 +83,7 @@ BI.SingleSelectInsertCombo = BI.inherit(BI.Single, { self.storeValue = this.getValue(); assertShowValue(); self._defaultState(); + self._dataChange = true; }); this.trigger.on(BI.SingleSelectTrigger.EVENT_COUNTER_CLICK, function () { if (!self.combo.isViewVisible()) { @@ -106,6 +108,7 @@ BI.SingleSelectInsertCombo = BI.inherit(BI.Single, { listeners: [{ eventName: BI.SingleSelectPopupView.EVENT_CHANGE, action: function () { + self._dataChange = true; self.storeValue = this.getValue(); self._adjust(function () { assertShowValue(); @@ -131,6 +134,9 @@ BI.SingleSelectInsertCombo = BI.inherit(BI.Single, { }); this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () { + if (!this.isViewVisible()) { + self._dataChange = false;// 标记数据是否发生变化 + } this.setValue(self.storeValue); BI.nextTick(function () { self.populate(); @@ -144,7 +150,7 @@ BI.SingleSelectInsertCombo = BI.inherit(BI.Single, { if (self.requesting === true) { self.wants2Quit = true; } else { - self.fireEvent(BI.SingleSelectInsertCombo.EVENT_CONFIRM); + self._dataChange && self.fireEvent(BI.SingleSelectInsertCombo.EVENT_CONFIRM); } }); @@ -198,7 +204,7 @@ BI.SingleSelectInsertCombo = BI.inherit(BI.Single, { function adjust () { if (self.wants2Quit === true) { - self.fireEvent(BI.SingleSelectInsertCombo.EVENT_CONFIRM); + self._dataChange && self.fireEvent(BI.SingleSelectInsertCombo.EVENT_CONFIRM); self.wants2Quit = false; } self.requesting = false; @@ -237,4 +243,4 @@ BI.SingleSelectInsertCombo.EVENT_SEARCHING = "EVENT_SEARCHING"; BI.SingleSelectInsertCombo.EVENT_CLICK_ITEM = "EVENT_CLICK_ITEM"; BI.SingleSelectInsertCombo.EVENT_CONFIRM = "EVENT_CONFIRM"; -BI.shortcut("bi.single_select_insert_combo", BI.SingleSelectInsertCombo); \ No newline at end of file +BI.shortcut("bi.single_select_insert_combo", BI.SingleSelectInsertCombo); diff --git a/src/widget/timeinterval/dateinterval.js b/src/widget/timeinterval/dateinterval.js index 69a5b9c87..ca6895301 100644 --- a/src/widget/timeinterval/dateinterval.js +++ b/src/widget/timeinterval/dateinterval.js @@ -73,6 +73,7 @@ BI.DateInterval = BI.inherit(BI.Single, { minDate: o.minDate, maxDate: o.maxDate, behaviors: o.behaviors, + watermark: o.watermark, value: v, height: o.height, listeners: [{ diff --git a/src/widget/timeinterval/timeinterval.js b/src/widget/timeinterval/timeinterval.js index 14367889f..56a9df8fb 100644 --- a/src/widget/timeinterval/timeinterval.js +++ b/src/widget/timeinterval/timeinterval.js @@ -73,6 +73,7 @@ BI.TimeInterval = BI.inherit(BI.Single, { minDate: o.minDate, maxDate: o.maxDate, behaviors: o.behaviors, + watermark: o.watermark, value: v, height: o.height, }); diff --git a/src/widget/year/combo.year.js b/src/widget/year/combo.year.js index b23b660e4..eb94f34b9 100644 --- a/src/widget/year/combo.year.js +++ b/src/widget/year/combo.year.js @@ -141,10 +141,10 @@ BI.DynamicYearCombo = BI.inherit(BI.Widget, { width: o.height - 2 }, this.combo] }, - top: 1, - left: 1, - right: 1, - bottom: 1 + top: 0, + left: 0, + right: 0, + bottom: 0 }] }); this._checkDynamicValue(o.value); diff --git a/src/widget/yearmonth/combo.yearmonth.js b/src/widget/yearmonth/combo.yearmonth.js index 761760e1a..4986f7928 100644 --- a/src/widget/yearmonth/combo.yearmonth.js +++ b/src/widget/yearmonth/combo.yearmonth.js @@ -145,10 +145,10 @@ BI.DynamicYearMonthCombo = BI.inherit(BI.Single, { width: o.height - 2 }, this.combo] }, - top: 1, - left: 1, - right: 1, - bottom: 1 + top: 0, + left: 0, + right: 0, + bottom: 0 }] }); this._checkDynamicValue(o.value); diff --git a/src/widget/yearquarter/combo.yearquarter.js b/src/widget/yearquarter/combo.yearquarter.js index 83c973702..85f093e69 100644 --- a/src/widget/yearquarter/combo.yearquarter.js +++ b/src/widget/yearquarter/combo.yearquarter.js @@ -145,10 +145,10 @@ BI.DynamicYearQuarterCombo = BI.inherit(BI.Widget, { width: o.height - 2 }, this.combo] }, - top: 1, - left: 1, - right: 1, - bottom: 1 + top: 0, + left: 0, + right: 0, + bottom: 0 }] }); this._checkDynamicValue(o.value); diff --git a/typescript/base/a/a.ts b/typescript/base/a/a.ts index 91e778dfd..08b76a5f9 100644 --- a/typescript/base/a/a.ts +++ b/typescript/base/a/a.ts @@ -4,5 +4,6 @@ export declare class A extends Text { static xtype: string; props: { href: string; + el: Obj; } & Text['props']; } diff --git a/typescript/case/loading/loading_pane.ts b/typescript/case/loading/loading_pane.ts deleted file mode 100644 index 362c8f1b4..000000000 --- a/typescript/case/loading/loading_pane.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { Pane } from "../../base/pane"; - -export declare class LoadingPane extends Pane { - __loaded: (...args: any[]) => void; -} diff --git a/typescript/index.ts b/typescript/index.ts index fdbae2aa0..6e6131a7d 100644 --- a/typescript/index.ts +++ b/typescript/index.ts @@ -24,7 +24,6 @@ import { SmallTextValueCombo } from './case/combo/combo.textvaluesmall'; import { SearchTextValueCombo } from "./case/combo/searchtextvaluecombo/combo.searchtextvalue"; import { SignEditor } from "./case/editor/editor.sign"; import { StateEditor } from './case/editor/editor.state'; -import { LoadingPane } from "./case/loading/loading_pane"; import { AllValueMultiTextValueCombo } from "./component/allvaluemultitextvaluecombo/allvalue.multitextvalue.combo"; import { AbstractTreeValueChooser } from "./component/treevaluechooser/abstract.treevaluechooser"; import { AbstractListTreeValueChooser } from "./component/treevaluechooser/abstract.treevaluechooser.list"; @@ -205,7 +204,6 @@ export interface BI extends _func, _i18n, _base, _inject, _var, _web, _utils { HighlightBehavior: typeof HighlightBehavior; RedMarkBehavior: typeof RedMarkBehavior; Pane: typeof Pane; - LoadingPane: typeof LoadingPane; Tab: typeof Tab; ButtonGroup: typeof ButtonGroup; Combo: typeof Combo; @@ -411,7 +409,6 @@ export { BehaviorFactory, RedMarkBehavior, HighlightBehavior, - LoadingPane, Searcher, AbstractLabel, Label, diff --git a/typescript/shims-tsx.ts b/typescript/shims-tsx.ts index fcafdf807..aa76c2e9d 100644 --- a/typescript/shims-tsx.ts +++ b/typescript/shims-tsx.ts @@ -19,6 +19,8 @@ interface UIProps { interface AdditionalProps { column: number; row: number; + innerVGap: number; + innerHGap: number; } interface ElementClassProps extends UIProps { diff --git a/typescript/widget/dynamicdate/dynamicdate.combo.ts b/typescript/widget/dynamicdate/dynamicdate.combo.ts index 3f19c3386..a7ead70cf 100644 --- a/typescript/widget/dynamicdate/dynamicdate.combo.ts +++ b/typescript/widget/dynamicdate/dynamicdate.combo.ts @@ -15,6 +15,18 @@ export declare class DynamicDateCombo extends Single { static EVENT_BEFORE_POPUPVIEW: string; static EVENT_BEFORE_YEAR_MONTH_POPUPVIEW: string; + props: { + minDate?: string; + maxDate?: string; + format?: string; + allowEdit?: boolean; + supportDynamic?: boolean; + attributes?: { + tabIndex?: number; + }; + watermark?: string; + } & Single['props'] + setMinDate(minDate: string): void; setMaxDate(maxDate: string): void; diff --git a/typescript/widget/dynamicdatetime/dynamicdatetime.combo.ts b/typescript/widget/dynamicdatetime/dynamicdatetime.combo.ts index 6236950c5..b6593b2a7 100644 --- a/typescript/widget/dynamicdatetime/dynamicdatetime.combo.ts +++ b/typescript/widget/dynamicdatetime/dynamicdatetime.combo.ts @@ -22,6 +22,7 @@ export declare class DynamicDateTimeCombo extends Single { attributes?: { tabIndex?: number; }; + watermark?: string; } & Single['props']; setMinDate(minDate: string): void; diff --git a/typescript/widget/singleselect/singleselect.insert.combo.ts b/typescript/widget/singleselect/singleselect.insert.combo.ts index 1924e5e8b..5c9f5d934 100644 --- a/typescript/widget/singleselect/singleselect.insert.combo.ts +++ b/typescript/widget/singleselect/singleselect.insert.combo.ts @@ -8,4 +8,13 @@ export declare class SingleSelectInsertCombo extends Single { static EVENT_SEARCHING: string; static EVENT_CLICK_ITEM: string; static EVENT_CONFIRM: string; + + props: { + text?: string, + allowNoSelect?: boolean, + itemsCreator?: Function, + valueFormatter?: Function, + allowEdit?: boolean, + watermark?: string, + } & Single['props'] } diff --git a/typescript/widget/timeinterval/dateinterval.ts b/typescript/widget/timeinterval/dateinterval.ts index bae50b238..31001fe6a 100644 --- a/typescript/widget/timeinterval/dateinterval.ts +++ b/typescript/widget/timeinterval/dateinterval.ts @@ -8,6 +8,13 @@ export declare class DateInterval extends Single { static EVENT_ERROR: string; static EVENT_BEFORE_YEAR_MONTH_POPUPVIEW: string; + props: { + minDate?: string; + maxDate?: string; + supportDynamic?: boolean; + watermark?: string; + } & Single['props'] + getValue(): { start: DynamicDataComboValue; end: DynamicDataComboValue; diff --git a/typescript/widget/timeinterval/timeinterval.ts b/typescript/widget/timeinterval/timeinterval.ts index 475ba688b..3f57695a4 100644 --- a/typescript/widget/timeinterval/timeinterval.ts +++ b/typescript/widget/timeinterval/timeinterval.ts @@ -7,6 +7,13 @@ export declare class TimeInterval extends Single { static EVENT_VALID: string; static EVENT_ERROR: string; + props: { + minDate?: string; + maxDate?: string; + supportDynamic?: boolean; + watermark?: string; + } & Single['props'] + getValue(): { start: DynamicDataComboValue; end: DynamicDataComboValue; diff --git a/webpack/attachments.js b/webpack/attachments.js index faacd3d7a..b463f5ee9 100644 --- a/webpack/attachments.js +++ b/webpack/attachments.js @@ -161,7 +161,7 @@ const fineuiProxy = [].concat( const fineuiWithoutJqueryAndPolyfillJs = [].concat( sync([ - "src/core/foundation.js", + "src/core/0.foundation.js", lodashJs, "src/core/**/*.js", "src/data/**/*.js",