Browse Source

Pull request #2708: 无JIRA history.current 变成响应式

Merge in VISUAL/fineui from ~DAILER/fineui:master to master

* commit 'f00ecee1067ca07fc7a4f025e4bdfb67787a8f3e':
  JSY-17840 fix: clearButton 占满高度
  无JIRA history.current 变成响应式
es6
Dailer 3 years ago
parent
commit
5507a0d3c6
  1. 92
      dist/fix/fix.js
  2. 2
      src/case/combo/searchtextvaluecombo/combo.searchtextvalue.js
  3. 1
      src/case/combo/searchtextvaluecombo/trigger.searchtextvalue.js
  4. 2
      src/case/combo/textvaluecombo/combo.textvalue.js
  5. 1
      src/case/trigger/trigger.text.js
  6. 22
      src/less/base/combo/combo.searchtextvalue.less
  7. 1
      src/router/router.js

92
dist/fix/fix.js vendored

@ -788,53 +788,6 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
function defineReactive(obj, observer, shallow) { function defineReactive(obj, observer, shallow) {
var props = {}; var props = {};
var model = void 0; 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) { _.each(obj, function (val, key) {
if (key in $$skipArray) { if (key in $$skipArray) {
return; return;
@ -878,6 +831,50 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
return model = createViewModel$1(obj, props); 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 * Set a property on an object. Adds the new property and
* triggers change notification if the property doesn't * triggers change notification if the property doesn't
@ -1522,6 +1519,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
exports.observe = observe; exports.observe = observe;
exports.notify = notify; exports.notify = notify;
exports.defineReactive = defineReactive; exports.defineReactive = defineReactive;
exports.defineReactiveProperty = defineReactiveProperty;
exports.set = set; exports.set = set;
exports.freeze = freeze; exports.freeze = freeze;
exports.del = del; exports.del = del;

2
src/case/combo/searchtextvaluecombo/combo.searchtextvalue.js

@ -28,7 +28,7 @@ BI.SearchTextValueCombo = BI.inherit(BI.Widget, {
return { return {
type: "bi.combo", 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, container: o.container,
adjustLength: 2, adjustLength: 2,
height: height, height: height,

1
src/case/combo/searchtextvaluecombo/trigger.searchtextvalue.js

@ -86,6 +86,7 @@ BI.SearchTextValueTrigger = BI.inherit(BI.Trigger, {
stopPropagation: true, stopPropagation: true,
invisible: !BI.isNotEmptyString(stateText), invisible: !BI.isNotEmptyString(stateText),
width: o.height, width: o.height,
height: o.height,
handler: function () { handler: function () {
self.fireEvent(BI.SearchTextValueTrigger.EVENT_CLEAR); self.fireEvent(BI.SearchTextValueTrigger.EVENT_CLEAR);
}, },

2
src/case/combo/textvaluecombo/combo.textvalue.js

@ -7,7 +7,7 @@
BI.TextValueCombo = BI.inherit(BI.Widget, { BI.TextValueCombo = BI.inherit(BI.Widget, {
_defaultConfig: function (config) { _defaultConfig: function (config) {
return BI.extend(BI.TextValueCombo.superclass._defaultConfig.apply(this, arguments), { 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, height: 24,
chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE, chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE,
text: "", text: "",

1
src/case/trigger/trigger.text.js

@ -73,6 +73,7 @@ BI.TextTrigger = BI.inherit(BI.Trigger, {
cls: "close-h-font " + (o.allowClear ? "clear-button" : ""), cls: "close-h-font " + (o.allowClear ? "clear-button" : ""),
stopPropagation: true, stopPropagation: true,
width: o.triggerWidth || o.height, width: o.triggerWidth || o.height,
height: o.height,
invisible: !BI.isNotEmptyString(o.text), invisible: !BI.isNotEmptyString(o.text),
handler: function () { handler: function () {
self.fireEvent(BI.TextTrigger.EVENT_CLEAR); self.fireEvent(BI.TextTrigger.EVENT_CLEAR);

22
src/less/base/combo/combo.searchtextvalue.less

@ -1,33 +1,19 @@
@import "../../index.less"; @import "../../index.less";
@val: transform .3s ease;
.bi-search-text-value-combo { .bi-search-text-value-combo {
& .trigger-icon-button { & .trigger-icon-button {
font-size: 16px; font-size: 16px;
} }
& .search-text-value-trigger{
.border-radius(2px);
}
&.combo-error { &.combo-error {
& .bi-search-text-value-trigger { & .bi-search-text-value-trigger {
& .bi-text-button { & .bi-text-button {
color: @color-bi-text-error-hover-search-text-value-combo; 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; 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);
}
}
} }

1
src/router/router.js

@ -3130,6 +3130,7 @@
routes: this.options.routes, routes: this.options.routes,
base: this.options.base, base: this.options.base,
}); });
Fix.defineReactiveProperty(BI.Router.$router.history, "current");
this.$router.beforeEach(function (to, from, next) { this.$router.beforeEach(function (to, from, next) {
if (to.matched.length === 0) { if (to.matched.length === 0) {
//如果上级也未匹配到路由则跳转主页面,如果上级能匹配到则转上级路由 //如果上级也未匹配到路由则跳转主页面,如果上级能匹配到则转上级路由

Loading…
Cancel
Save