diff --git a/dist/fix/fix.js b/dist/fix/fix.js index 6e1d60013..7a68bb52c 100644 --- a/dist/fix/fix.js +++ b/dist/fix/fix.js @@ -135,8 +135,8 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons setImmediate(nextTickHandler); }; } else if (typeof MessageChannel !== 'undefined' && (isNative(MessageChannel) || - // PhantomJS - MessageChannel.toString() === '[object MessageChannelConstructor]')) { + // PhantomJS + MessageChannel.toString() === '[object MessageChannelConstructor]')) { var channel = new MessageChannel(); var port = channel.port2; channel.port1.onmessage = nextTickHandler; @@ -145,18 +145,18 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons }; } else /* istanbul ignore next */ - if (typeof Promise !== 'undefined' && isNative(Promise)) { - // use microtask in non-DOM environments, e.g. Weex - var p = Promise.resolve(); - timerFunc = function timerFunc() { - p.then(nextTickHandler); - }; - } else { - // fallback to setTimeout - timerFunc = function timerFunc() { - setTimeout(nextTickHandler, 0); - }; - } + if (typeof Promise !== 'undefined' && isNative(Promise)) { + // use microtask in non-DOM environments, e.g. Weex + var p = Promise.resolve(); + timerFunc = function timerFunc() { + p.then(nextTickHandler); + }; + } else { + // fallback to setTimeout + timerFunc = function timerFunc() { + setTimeout(nextTickHandler, 0); + }; + } return function queueNextTick(cb, ctx) { var _resolve = void 0; @@ -295,7 +295,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons if (isIE9Below) { var VBClassPool = {}; window.execScript([// jshint ignore:line - 'Function parseVB(code)', '\tExecuteGlobal(code)', 'End Function' //转换一段文本为VB代码 + 'Function parseVB(code)', '\tExecuteGlobal(code)', 'End Function' //转换一段文本为VB代码 ].join('\n'), 'VBScript'); var VBMediator = function VBMediator(instance, accessors, name, value) { @@ -311,7 +311,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons // jshint ignore:line var buffer = []; buffer.push('\tPrivate [$vbsetter]', '\tPublic [$accessors]', '\tPublic Default Function [$vbthis](ac' + timeBucket + ', s' + timeBucket + ')', '\t\tSet [$accessors] = ac' + timeBucket + ': set [$vbsetter] = s' + timeBucket, '\t\tSet [$vbthis] = Me', //链式调用 - '\tEnd Function'); + '\tEnd Function'); //添加普通属性,因为VBScript对象不能像JS那样随意增删属性,必须在这里预先定义好 var uniq = { $vbthis: true, @@ -331,12 +331,12 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons } uniq[name] = true; buffer.push( - //由于不知对方会传入什么,因此set, let都用上 - '\tPublic Property Let [' + name + '](val' + timeBucket + ')', //setter - '\t\tCall [$vbsetter](Me, [$accessors], "' + name + '", val' + timeBucket + ')', '\tEnd Property', '\tPublic Property Set [' + name + '](val' + timeBucket + ')', //setter - '\t\tCall [$vbsetter](Me, [$accessors], "' + name + '", val' + timeBucket + ')', '\tEnd Property', '\tPublic Property Get [' + name + ']', //getter - '\tOn Error Resume Next', //必须优先使用set语句,否则它会误将数组当字符串返回 - '\t\tSet[' + name + '] = [$vbsetter](Me, [$accessors],"' + name + '")', '\tIf Err.Number <> 0 Then', '\t\t[' + name + '] = [$vbsetter](Me, [$accessors],"' + name + '")', '\tEnd If', '\tOn Error Goto 0', '\tEnd Property'); + //由于不知对方会传入什么,因此set, let都用上 + '\tPublic Property Let [' + name + '](val' + timeBucket + ')', //setter + '\t\tCall [$vbsetter](Me, [$accessors], "' + name + '", val' + timeBucket + ')', '\tEnd Property', '\tPublic Property Set [' + name + '](val' + timeBucket + ')', //setter + '\t\tCall [$vbsetter](Me, [$accessors], "' + name + '", val' + timeBucket + ')', '\tEnd Property', '\tPublic Property Get [' + name + ']', //getter + '\tOn Error Resume Next', //必须优先使用set语句,否则它会误将数组当字符串返回 + '\t\tSet[' + name + '] = [$vbsetter](Me, [$accessors],"' + name + '")', '\tIf Err.Number <> 0 Then', '\t\t[' + name + '] = [$vbsetter](Me, [$accessors],"' + name + '")', '\tEnd If', '\tOn Error Goto 0', '\tEnd Property'); } for (name in properties) { @@ -354,7 +354,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons className = makeHashCode('VBClass'); window.parseVB('Class ' + className + body); window.parseVB(['Function ' + className + 'Factory(acc, vbm)', //创建实例并传入两个关键的参数 - '\tDim o', '\tSet o = (New ' + className + ')(acc, vbm)', '\tSet ' + className + 'Factory = o', 'End Function'].join('\r\n')); + '\tDim o', '\tSet o = (New ' + className + ')(acc, vbm)', '\tSet ' + className + 'Factory = o', 'End Function'].join('\r\n')); VBClassPool[body] = className; } var ret = window[className + 'Factory'](accessors, VBMediator); //得到其产品 @@ -538,10 +538,10 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons if (this.active) { var value = this.get(); if (value !== this.value || - // Deep watchers and watchers on Object/Arrays should fire even - // when the value is the same, because the value may - // have mutated. - _.isObject(value) && options && options.refresh || this.deep) { + // Deep watchers and watchers on Object/Arrays should fire even + // when the value is the same, because the value may + // have mutated. + _.isObject(value) && options && options.refresh || this.deep) { // set new value var oldValue = this.value; this.value = value; @@ -788,53 +788,6 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons function defineReactive(obj, observer, shallow) { var props = {}; var model = void 0; - // if (typeof Proxy === 'function') { - // const deps = {}, childObs = {}, cache = {} - // _.each(obj, function (val, key) { - // if (key in $$skipArray) { - // return - // } - // cache[key] = val - // const dep = deps[key] = (observer && observer['__dep' + key]) || new Dep() - // observer && (observer['__dep' + key] = dep) - // childObs[key] = !shallow && observe(val, observer, key) - // }) - // return model = new Proxy(props, { - // has: function (target, key) { - // return key in obj; - // }, - // get: function (target, key) { - // if (key in $$skipArray) { - // return target[key] - // } - // const value = cache[key] - // if (Dep.target) { - // deps[key].depend() - // if (childObs[key]) { - // childObs[key].dep.depend() - // if (_.isArray(value)) { - // dependArray(value) - // } - // } - // } - // return value - // }, - // set: function (target, key, newVal) { - // if (key in $$skipArray) { - // return target[key] = newVal - // } - // const value = cache[key], dep = deps[key] - // if (newVal === value || (newVal !== newVal && value !== value)) { - // return newVal - // } - // cache[key] = newVal - // childObs[key] = !shallow && observe(newVal, observer, key) - // obj[key] = childObs[key] ? childObs[key].model : newVal - // notify(model, key, dep) - // return obj[key] - // } - // }) - // } _.each(obj, function (val, key) { if (key in $$skipArray) { return; @@ -878,6 +831,50 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons return model = createViewModel$1(obj, props); } + function defineReactiveProperty(obj, key, val, shallow) { + + var dep = new Dep(); + + var configurable = isConfigurable(obj, key); + if (!configurable) { + return; + } + + if (arguments.length === 2) { + val = obj[key]; + } + + var childOb = !shallow && observe(val); + Object.defineProperty(obj, key, { + enumerable: true, + configurable: true, + get: function reactiveGetter() { + var value = childOb ? childOb.model : val; + if (Dep.target) { + dep.depend(); + if (childOb) { + childOb.dep.depend(); + if (_.isArray(value)) { + dependArray(value); + } + } + } + return value; + }, + set: function reactiveSetter(newVal) { + var value = childOb ? childOb.model : val; + if (newVal === value || newVal !== newVal && value !== value) { + return; + } + + childOb = configurable && !shallow && observe(newVal); + val = newVal; + obj[key] = childOb ? childOb.model : newVal; + dep.notify(); + } + }); + } + /** * Set a property on an object. Adds the new property and * triggers change notification if the property doesn't @@ -1522,6 +1519,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons exports.observe = observe; exports.notify = notify; exports.defineReactive = defineReactive; + exports.defineReactiveProperty = defineReactiveProperty; exports.set = set; exports.freeze = freeze; exports.del = del; diff --git a/src/case/combo/searchtextvaluecombo/combo.searchtextvalue.js b/src/case/combo/searchtextvaluecombo/combo.searchtextvalue.js index 8eec27e80..331661afa 100644 --- a/src/case/combo/searchtextvaluecombo/combo.searchtextvalue.js +++ b/src/case/combo/searchtextvaluecombo/combo.searchtextvalue.js @@ -28,7 +28,7 @@ BI.SearchTextValueCombo = BI.inherit(BI.Widget, { return { type: "bi.combo", - cls: (o.simple ? "bi-border-bottom" : "bi-border") + " bi-focus-shadow", + cls: (o.simple ? "bi-border-bottom" : "bi-border") + " bi-border-radius bi-focus-shadow", container: o.container, adjustLength: 2, height: height, diff --git a/src/case/combo/searchtextvaluecombo/trigger.searchtextvalue.js b/src/case/combo/searchtextvaluecombo/trigger.searchtextvalue.js index 2dd67933a..820c44213 100644 --- a/src/case/combo/searchtextvaluecombo/trigger.searchtextvalue.js +++ b/src/case/combo/searchtextvaluecombo/trigger.searchtextvalue.js @@ -86,6 +86,7 @@ BI.SearchTextValueTrigger = BI.inherit(BI.Trigger, { stopPropagation: true, invisible: !BI.isNotEmptyString(stateText), width: o.height, + height: o.height, handler: function () { self.fireEvent(BI.SearchTextValueTrigger.EVENT_CLEAR); }, diff --git a/src/case/combo/textvaluecombo/combo.textvalue.js b/src/case/combo/textvaluecombo/combo.textvalue.js index c49785126..7c8d90f62 100644 --- a/src/case/combo/textvaluecombo/combo.textvalue.js +++ b/src/case/combo/textvaluecombo/combo.textvalue.js @@ -7,7 +7,7 @@ BI.TextValueCombo = BI.inherit(BI.Widget, { _defaultConfig: function (config) { return BI.extend(BI.TextValueCombo.superclass._defaultConfig.apply(this, arguments), { - baseCls: "bi-text-value-combo " + (config.simple ? "bi-border-bottom" : "bi-border"), + baseCls: "bi-text-value-combo bi-border-radius " + (config.simple ? "bi-border-bottom" : "bi-border"), height: 24, chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE, text: "", diff --git a/src/case/trigger/trigger.text.js b/src/case/trigger/trigger.text.js index 52da67200..8acee1c78 100644 --- a/src/case/trigger/trigger.text.js +++ b/src/case/trigger/trigger.text.js @@ -73,6 +73,7 @@ BI.TextTrigger = BI.inherit(BI.Trigger, { cls: "close-h-font " + (o.allowClear ? "clear-button" : ""), stopPropagation: true, width: o.triggerWidth || o.height, + height: o.height, invisible: !BI.isNotEmptyString(o.text), handler: function () { self.fireEvent(BI.TextTrigger.EVENT_CLEAR); diff --git a/src/less/base/combo/combo.searchtextvalue.less b/src/less/base/combo/combo.searchtextvalue.less index 5d5a5524c..6ae0eca15 100644 --- a/src/less/base/combo/combo.searchtextvalue.less +++ b/src/less/base/combo/combo.searchtextvalue.less @@ -1,33 +1,19 @@ @import "../../index.less"; -@val: transform .3s ease; -.bi-search-text-value-combo{ - & .trigger-icon-button{ + +.bi-search-text-value-combo { + & .trigger-icon-button { font-size: 16px; } - & .search-text-value-trigger{ - .border-radius(2px); - } + &.combo-error { - & .bi-search-text-value-trigger{ + & .bi-search-text-value-trigger { & .bi-text-button { color: @color-bi-text-error-hover-search-text-value-combo; } } - &>.bi-border, &>.bi-border-bottom { + + &.bi-border, &.bi-border-bottom { border-color: @border-color-negative; } } - // 此combo的trigger_button是absolute上去的,与bi-combo在同一层级,独立写一下 - & .bi-combo.bi-combo-popup + .bi-trigger-icon-button { - & .x-icon { - .rotate(180deg); - .transition(@val); - } - } - & .bi-combo + .bi-trigger-icon-button { - & .x-icon { - .rotate(0deg); - .transition(@val); - } - } } diff --git a/src/router/router.js b/src/router/router.js index 25dbabc44..3a90bfbce 100644 --- a/src/router/router.js +++ b/src/router/router.js @@ -3130,6 +3130,7 @@ routes: this.options.routes, base: this.options.base, }); + Fix.defineReactiveProperty(BI.Router.$router.history, "current"); this.$router.beforeEach(function (to, from, next) { if (to.matched.length === 0) { //如果上级也未匹配到路由则跳转主页面,如果上级能匹配到则转上级路由