diff --git a/dist/fix/fix.js b/dist/fix/fix.js index 9a106ae7a..e87c7e51a 100644 --- a/dist/fix/fix.js +++ b/dist/fix/fix.js @@ -919,23 +919,27 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons return m; } : parsePath(exp); var v = getter.call(model, model); - var _dep = new Dep(); - if (isGlobal) { - (v.__ob__._scopeDeps || (v.__ob__._scopeDeps = [])).push(_dep); - } else { - (v.__ob__._deps || (v.__ob__._deps = [])).push(_dep); + + if (v.__ob__) { + var _dep = new Dep(); + if (isGlobal) { + (v.__ob__._scopeDeps || (v.__ob__._scopeDeps = [])).push(_dep); + } else { + (v.__ob__._deps || (v.__ob__._deps = [])).push(_dep); + } + var _w = new Watcher(model, function () { + _dep.depend(); + return NaN; + }, function (newValue, oldValue, attrs) { + callback(i, newValue, oldValue, BI._.extend({ index: i }, attrs)); + }, options); + watchers.push(function unwatchFn() { + _w.teardown(); + v.__ob__._scopeDeps && remove(v.__ob__._scopeDeps, _dep); + v.__ob__._deps && remove(v.__ob__._deps, _dep); + }); } - var _w = new Watcher(model, function () { - _dep.depend(); - return NaN; - }, function (newValue, oldValue, attrs) { - callback(i, newValue, oldValue, BI._.extend({ index: i }, attrs)); - }, options); - watchers.push(function unwatchFn() { - _w.teardown(); - v.__ob__._scopeDeps && remove(v.__ob__._scopeDeps, _dep); - v.__ob__._deps && remove(v.__ob__._deps, _dep); - }); + return; } // **.a.**的情况,场景:a.b.c, 如果用b.**监听, a被重新赋值b上的_scopeDes就不存在了 @@ -943,6 +947,11 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons //先获取到能获取到的对象 var _paths = exp.split("."); var _currentModel = model[_paths[1]]; + + if (!_currentModel.__ob__) { + return; + } + exp = _paths[1] + ".**"; //补全路径 var _parent = _currentModel.__ob__.parent, @@ -993,6 +1002,11 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons } currentModel = model[paths[_i]]; } + + if (!currentModel.__ob__) { + return; + } + exp = exp.substr(exp.indexOf("*")); //补全路径 var parent = currentModel.__ob__.parent, diff --git a/package.json b/package.json index 917ab54db..650135d75 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fineui", - "version": "2.0.20230413101426", + "version": "2.0.20230518101454", "description": "fineui", "main": "dist/fineui_without_conflict.min.js", "types": "dist/lib/index.d.ts", diff --git a/src/base/collection/collection.js b/src/base/collection/collection.js index a47a78ec3..cf561ab45 100644 --- a/src/base/collection/collection.js +++ b/src/base/collection/collection.js @@ -345,7 +345,7 @@ BI.CollectionView = BI.inherit(BI.Widget, { return; } this._scrollLock = true; - this.options.scrollLeft = BI.clamp(scrollLeft || 0, 0, this._getMaxScrollLeft()); + this.options.scrollLeft = BI.clamp(scrollLeft || 0, 0, this._getMaxScrollLeft() || scrollLeft); this._debounceRelease(); this.element.scrollLeft(this.options.scrollLeft); this._calculateChildrenToRender(); @@ -356,7 +356,7 @@ BI.CollectionView = BI.inherit(BI.Widget, { return; } this._scrollLock = true; - this.options.scrollTop = BI.clamp(scrollTop || 0, 0, this._getMaxScrollTop()); + this.options.scrollTop = BI.clamp(scrollTop || 0, 0, this._getMaxScrollTop() || scrollTop); this._debounceRelease(); this.element.scrollTop(this.options.scrollTop); this._calculateChildrenToRender(); diff --git a/src/case/combo/textvaluecombo/popup.textvalue.js b/src/case/combo/textvaluecombo/popup.textvalue.js index aed1b0979..9d3e3d004 100644 --- a/src/case/combo/textvaluecombo/popup.textvalue.js +++ b/src/case/combo/textvaluecombo/popup.textvalue.js @@ -1,4 +1,4 @@ -BI.TextValueComboPopup = BI.inherit(BI.Pane, { +BI.TextValueComboPopup = BI.inherit(BI.Widget, { _defaultConfig: function () { return BI.extend(BI.TextValueComboPopup.superclass._defaultConfig.apply(this, arguments), { baseCls: "bi-text-icon-popup", @@ -15,17 +15,20 @@ BI.TextValueComboPopup = BI.inherit(BI.Pane, { vgap: 5, items: [ { - type: "bi.button_group", + type: "bi.list_pane", ref: (_ref) => { this.popup = _ref; }, items: this._formatItems(o.items), - chooseType: o.chooseType, - layouts: [ - { - type: "bi.vertical" - } - ], + el: { + type: "bi.button_group", + chooseType: o.chooseType, + layouts: [ + { + type: "bi.vertical" + } + ], + }, value: o.value, listeners: [ { @@ -131,12 +134,6 @@ BI.TextValueComboPopup = BI.inherit(BI.Pane, { }; }, - beforeMount: function () { - if (this.options.chooseType !== BI.ButtonGroup.CHOOSE_TYPE_MULTI) { - this.check(); - } - }, - _formatItems: function (items) { var o = this.options; return BI.map(items, function (i, item) { @@ -150,7 +147,6 @@ BI.TextValueComboPopup = BI.inherit(BI.Pane, { }, populate: function (items) { - BI.TextValueComboPopup.superclass.populate.apply(this, arguments); this.popup.populate(this._formatItems(items)); }, diff --git a/src/core/platform/web/dom.js b/src/core/platform/web/dom.js index f7086bbc7..a74f1ff10 100644 --- a/src/core/platform/web/dom.js +++ b/src/core/platform/web/dom.js @@ -720,7 +720,7 @@ * 获取position:fixed相对定位的元素 */ getPositionRelativeContainingBlock: function (element) { - if (['html', 'body', '#document'].indexOf((element.nodeName || '').toLowerCase()) >= 0) { + if (BI.isIE() || ['html', 'body', '#document'].indexOf((element.nodeName || '').toLowerCase()) >= 0) { // $FlowFixMe[incompatible-return]: assume body is always available return element.ownerDocument.body; } diff --git a/src/widget/intervalslider/intervalslider.js b/src/widget/intervalslider/intervalslider.js index 59b1e1676..6c70c33a3 100644 --- a/src/widget/intervalslider/intervalslider.js +++ b/src/widget/intervalslider/intervalslider.js @@ -103,7 +103,7 @@ BI.IntervalSlider = BI.inherit(BI.Single, { var oldValueTwo = self.valueTwo; var v = BI.parseFloat(this.getValue()); self.valueTwo = v; - var percent = self._getPercentByValue(v); + var percent = self._getPercentByValue(v, true); var significantPercent = BI.parseFloat(percent.toFixed(1)); self._setSliderTwoPosition(significantPercent); self._setBlueTrack(); @@ -381,7 +381,7 @@ BI.IntervalSlider = BI.inherit(BI.Single, { _setBlueTrack: function () { var percentOne = this._getPercentByValue(this.labelOne.getValue()); - var percentTwo = this._getPercentByValue(this.labelTwo.getValue()); + var percentTwo = this._getPercentByValue(this.labelTwo.getValue(), true); if (percentOne <= percentTwo) { this._setBlueTrackLeft(percentOne); this._setBlueTrackWidth(percentTwo - percentOne); @@ -435,7 +435,11 @@ BI.IntervalSlider = BI.inherit(BI.Single, { }, - _getPercentByValue: function (v) { + _getPercentByValue: function (v, isLast) { + if (this.max === this.min) { + return isLast ? 100 : 0; + } + return (v - this.min) * 100 / (this.max - this.min); }, @@ -545,7 +549,7 @@ BI.IntervalSlider = BI.inherit(BI.Single, { if ((BI.isNumeric(this.valueOne) || BI.isNotEmptyString(this.valueOne)) && (BI.isNumeric(this.valueTwo) || BI.isNotEmptyString(this.valueTwo))) { this.labelOne.setValue(o.digit === false ? this.valueOne : BI.parseFloat(this.valueOne).toFixed(o.digit)); this.labelTwo.setValue(o.digit === false ? this.valueTwo : BI.parseFloat(this.valueTwo).toFixed(o.digit)); - this._setAllPosition(this._getPercentByValue(this.valueOne), this._getPercentByValue(this.valueTwo)); + this._setAllPosition(this._getPercentByValue(this.valueOne), this._getPercentByValue(this.valueTwo, true)); } else { this.labelOne.setValue(this.min); this.labelTwo.setValue(this.max);