|
|
@ -19586,7 +19586,7 @@ _.extend(BI, { |
|
|
|
if(!_global.navigator) { |
|
|
|
if(!_global.navigator) { |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
return /safari/i.test(navigator.userAgent.toLowerCase()); |
|
|
|
return /safari/i.test(navigator.userAgent.toLowerCase()) && !/chrome/i.test(navigator.userAgent.toLowerCase()); |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
isKhtml: function () { |
|
|
|
isKhtml: function () { |
|
|
@ -31244,6 +31244,105 @@ BI.InlineVerticalAdaptLayout = BI.inherit(BI.Layout, { |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
BI.shortcut("bi.inline_vertical_adapt", BI.InlineVerticalAdaptLayout);/** |
|
|
|
BI.shortcut("bi.inline_vertical_adapt", BI.InlineVerticalAdaptLayout);/** |
|
|
|
|
|
|
|
* 自适应水平和垂直方向都居中容器 |
|
|
|
|
|
|
|
* @class BI.TableCenterAdaptLayout |
|
|
|
|
|
|
|
* @extends BI.Layout |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
BI.TableCenterAdaptLayout = BI.inherit(BI.Layout, { |
|
|
|
|
|
|
|
props: function () { |
|
|
|
|
|
|
|
return BI.extend(BI.TableCenterAdaptLayout.superclass.props.apply(this, arguments), { |
|
|
|
|
|
|
|
baseCls: "bi-table-center-adapt-layout", |
|
|
|
|
|
|
|
columnSize: [], |
|
|
|
|
|
|
|
hgap: 0, |
|
|
|
|
|
|
|
vgap: 0, |
|
|
|
|
|
|
|
lgap: 0, |
|
|
|
|
|
|
|
rgap: 0, |
|
|
|
|
|
|
|
tgap: 0, |
|
|
|
|
|
|
|
bgap: 0 |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
render: function () { |
|
|
|
|
|
|
|
BI.TableCenterAdaptLayout.superclass.render.apply(this, arguments); |
|
|
|
|
|
|
|
this.$table = BI.Widget._renderEngine.createElement("<div>").css({ |
|
|
|
|
|
|
|
position: "relative", |
|
|
|
|
|
|
|
display: "table", |
|
|
|
|
|
|
|
width: "100%", |
|
|
|
|
|
|
|
height: "100%", |
|
|
|
|
|
|
|
"white-space": "nowrap" |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
this.populate(this.options.items); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_addElement: function (i, item) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var o = this.options; |
|
|
|
|
|
|
|
var td; |
|
|
|
|
|
|
|
var width = o.columnSize[i] <= 1 ? (o.columnSize[i] * 100 + "%") : o.columnSize[i]; |
|
|
|
|
|
|
|
if (!this.hasWidget(this._getChildName(i))) { |
|
|
|
|
|
|
|
var w = BI.createWidget(item); |
|
|
|
|
|
|
|
w.element.css({position: "relative", top: "0", left: "0", margin: "0px auto"}); |
|
|
|
|
|
|
|
td = BI.createWidget({ |
|
|
|
|
|
|
|
type: "bi.default", |
|
|
|
|
|
|
|
attributes: { |
|
|
|
|
|
|
|
width: width |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
items: [w] |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
this.addWidget(this._getChildName(i), td); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
td = this.getWidgetByName(this._getChildName(i)); |
|
|
|
|
|
|
|
td.element.attr("width", width); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
td.element.css({"max-width": o.columnSize[i]}); |
|
|
|
|
|
|
|
if (i === 0) { |
|
|
|
|
|
|
|
td.element.addClass("first-element"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
td.element.css({ |
|
|
|
|
|
|
|
position: "relative", |
|
|
|
|
|
|
|
display: "table-cell", |
|
|
|
|
|
|
|
"vertical-align": "middle", |
|
|
|
|
|
|
|
margin: "0", |
|
|
|
|
|
|
|
padding: "0", |
|
|
|
|
|
|
|
height: "100%" |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) { |
|
|
|
|
|
|
|
w.element.css({ |
|
|
|
|
|
|
|
"margin-top": o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) + "px" |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (o.hgap + o.lgap + (item.lgap || 0) + (item.hgap || 0) !== 0) { |
|
|
|
|
|
|
|
w.element.css({ |
|
|
|
|
|
|
|
"margin-left": (i === 0 ? o.hgap : 0) + o.lgap + (item.lgap || 0) + (item.hgap || 0) + "px" |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0) !== 0) { |
|
|
|
|
|
|
|
w.element.css({ |
|
|
|
|
|
|
|
"margin-right": o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0) + "px" |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0) !== 0) { |
|
|
|
|
|
|
|
w.element.css({ |
|
|
|
|
|
|
|
"margin-bottom": o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0) + "px" |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return td; |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
appendFragment: function (frag) { |
|
|
|
|
|
|
|
this.$table.append(frag); |
|
|
|
|
|
|
|
this.element.append(this.$table); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
resize: function () { |
|
|
|
|
|
|
|
// console.log("center_adapt布局不需要resize");
|
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
populate: function (items) { |
|
|
|
|
|
|
|
BI.TableCenterAdaptLayout.superclass.populate.apply(this, arguments); |
|
|
|
|
|
|
|
this._mount(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
BI.shortcut("bi.table_center_adapt", BI.TableCenterAdaptLayout);/** |
|
|
|
*自适应水平和垂直方向都居中容器 |
|
|
|
*自适应水平和垂直方向都居中容器 |
|
|
|
* Created by GUY on 2016/12/2. |
|
|
|
* Created by GUY on 2016/12/2. |
|
|
|
* |
|
|
|
* |
|
|
@ -34006,6 +34105,45 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons |
|
|
|
|
|
|
|
|
|
|
|
_$1 = 'default' in _$1 ? _$1['default'] : _$1; |
|
|
|
_$1 = 'default' in _$1 ? _$1['default'] : _$1; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var falsy = void 0; |
|
|
|
|
|
|
|
var $$skipArray = { |
|
|
|
|
|
|
|
$accessors: falsy, |
|
|
|
|
|
|
|
$vbthis: falsy, |
|
|
|
|
|
|
|
$vbsetter: falsy, |
|
|
|
|
|
|
|
$vm: falsy |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var originalMethods = []; |
|
|
|
|
|
|
|
_$1.each(['slice', 'splice'], function (method) { |
|
|
|
|
|
|
|
originalMethods[method] = Array.prototype[method]; |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Array.prototype.slice = function (...args) {
|
|
|
|
|
|
|
|
// let array = originalMethods["slice"].apply(this, args);
|
|
|
|
|
|
|
|
// // let result = [];
|
|
|
|
|
|
|
|
// // for (let i = 0; i < array.length; i++) {
|
|
|
|
|
|
|
|
// // if (Object.prototype.toString.call(array[i]) === "[object Array]") result[i] = [...array[i]];
|
|
|
|
|
|
|
|
// // if (Object.prototype.toString.call(array[i]) === "[object Object]") result[i] = _.extend({}, array[i]);
|
|
|
|
|
|
|
|
// // result[i] = array[i];
|
|
|
|
|
|
|
|
// // }
|
|
|
|
|
|
|
|
// this.__ref__ = makeHashCode();
|
|
|
|
|
|
|
|
// return array;
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Array.prototype.splice = function () { |
|
|
|
|
|
|
|
// for (let i = 0; i < this.length; i++) {
|
|
|
|
|
|
|
|
// if (Object.prototype.toString.call(this[i]) === "[object Array]") this[i] = [...this[i]];
|
|
|
|
|
|
|
|
// if (Object.prototype.toString.call(this[i]) === "[object Object]") this[i] = _.extend({}, this[i]);
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
this.__ref__ = makeHashCode(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { |
|
|
|
|
|
|
|
args[_key] = arguments[_key]; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return originalMethods["splice"].apply(this, args); |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
function noop(a, b, c) {} |
|
|
|
function noop(a, b, c) {} |
|
|
|
|
|
|
|
|
|
|
|
function isNative(Ctor) { |
|
|
|
function isNative(Ctor) { |
|
|
@ -34078,14 +34216,36 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons |
|
|
|
}; |
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function toJSON(model) { |
|
|
|
|
|
|
|
var result = void 0; |
|
|
|
|
|
|
|
if (_$1.isArray(model)) { |
|
|
|
|
|
|
|
result = []; |
|
|
|
|
|
|
|
for (var i = 0, len = model.length; i < len; i++) { |
|
|
|
|
|
|
|
result[i] = toJSON(model[i]); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else if (model && isPlainObject(model)) { |
|
|
|
|
|
|
|
result = {}; |
|
|
|
|
|
|
|
for (var key in model) { |
|
|
|
|
|
|
|
if (!_$1.has($$skipArray, key)) { |
|
|
|
|
|
|
|
result[key] = toJSON(model[key]); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
result = model; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return result; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function cloneShadow(obj) { |
|
|
|
function cloneShadow(obj) { |
|
|
|
if (obj === null) return null; |
|
|
|
if (obj === null) return null; |
|
|
|
|
|
|
|
|
|
|
|
if (Array.isArray(obj)) { |
|
|
|
if (Array.isArray(obj)) { |
|
|
|
return [].concat(obj); |
|
|
|
var result = [].concat(obj); |
|
|
|
|
|
|
|
if (obj.__ref__ !== undefined) result.__ref__ = obj.__ref__; |
|
|
|
|
|
|
|
return result; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return lodash.cloneDeep(obj); |
|
|
|
return toJSON(obj); |
|
|
|
|
|
|
|
|
|
|
|
// const type = typeof obj;
|
|
|
|
// const type = typeof obj;
|
|
|
|
//
|
|
|
|
//
|
|
|
@ -34173,19 +34333,11 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons |
|
|
|
}; |
|
|
|
}; |
|
|
|
}(); |
|
|
|
}(); |
|
|
|
|
|
|
|
|
|
|
|
var falsy = void 0; |
|
|
|
|
|
|
|
var $$skipArray = { |
|
|
|
|
|
|
|
$accessors: falsy, |
|
|
|
|
|
|
|
$vbthis: falsy, |
|
|
|
|
|
|
|
$vbsetter: falsy, |
|
|
|
|
|
|
|
$vm: falsy |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function inherit(sb, sp, overrides) { |
|
|
|
function inherit(sb, sp, overrides) { |
|
|
|
if (typeof sp === "object") { |
|
|
|
if (typeof sp === "object") { |
|
|
|
overrides = sp; |
|
|
|
overrides = sp; |
|
|
|
sp = sb; |
|
|
|
sp = sb; |
|
|
|
sb = function sb() { |
|
|
|
sb = function temp() { |
|
|
|
return sp.apply(this, arguments); |
|
|
|
return sp.apply(this, arguments); |
|
|
|
}; |
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
@ -34200,6 +34352,156 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons |
|
|
|
return sb; |
|
|
|
return sb; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var SymbolProto = typeof Symbol !== 'undefined' ? Symbol.prototype : null; |
|
|
|
|
|
|
|
var ObjProto = Object.prototype; |
|
|
|
|
|
|
|
var toString = ObjProto.toString; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Internal recursive comparison function for `isEqual`.
|
|
|
|
|
|
|
|
/* eslint no-param-reassign: ['off'] */ |
|
|
|
|
|
|
|
/* eslint no-use-before-define: ["off"] */ |
|
|
|
|
|
|
|
var deepEq = function deepEq(a, b, aStack, bStack) { |
|
|
|
|
|
|
|
// Unwrap any wrapped objects.
|
|
|
|
|
|
|
|
if (a instanceof _$1) a = a._wrapped; |
|
|
|
|
|
|
|
if (b instanceof _$1) b = b._wrapped; |
|
|
|
|
|
|
|
// Compare `[[Class]]` names.
|
|
|
|
|
|
|
|
var className = toString.call(a); |
|
|
|
|
|
|
|
if (className !== toString.call(b)) return false; |
|
|
|
|
|
|
|
switch (className) { |
|
|
|
|
|
|
|
// Strings, numbers, regular expressions, dates, and booleans are compared by value.
|
|
|
|
|
|
|
|
case '[object RegExp]': |
|
|
|
|
|
|
|
case '[object String]': |
|
|
|
|
|
|
|
// RegExps are coerced to strings for comparison (Note: '' + /a/i === '/a/i')
|
|
|
|
|
|
|
|
// Primitives and their corresponding object wrappers are equivalent; thus, `"5"` is
|
|
|
|
|
|
|
|
// equivalent to `new String("5")`.
|
|
|
|
|
|
|
|
return '' + a === '' + b; |
|
|
|
|
|
|
|
case '[object Number]': |
|
|
|
|
|
|
|
// `NaN`s are equivalent, but non-reflexive.
|
|
|
|
|
|
|
|
// Object(NaN) is equivalent to NaN.
|
|
|
|
|
|
|
|
if (+a !== +a) return +b !== +b; |
|
|
|
|
|
|
|
// An `egal` comparison is performed for other numeric values.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return +a === 0 ? 1 / +a === 1 / b : +a === +b; |
|
|
|
|
|
|
|
case '[object Date]': |
|
|
|
|
|
|
|
case '[object Boolean]': |
|
|
|
|
|
|
|
// Coerce dates and booleans to numeric primitive values. Dates are compared by their
|
|
|
|
|
|
|
|
// millisecond representations. Note that invalid dates with millisecond representations
|
|
|
|
|
|
|
|
// of `NaN` are not equivalent.
|
|
|
|
|
|
|
|
return +a === +b; |
|
|
|
|
|
|
|
case '[object Symbol]': |
|
|
|
|
|
|
|
return SymbolProto.valueOf.call(a) === SymbolProto.valueOf.call(b); |
|
|
|
|
|
|
|
default: |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var areArrays = className === '[object Array]'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!areArrays) { |
|
|
|
|
|
|
|
if (typeof a != 'object' || typeof b != 'object') return false; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Objects with different constructors are not equivalent, but `Object`s or `Array`s
|
|
|
|
|
|
|
|
// from different frames are.
|
|
|
|
|
|
|
|
var aCtor = a.constructor, |
|
|
|
|
|
|
|
bCtor = b.constructor; |
|
|
|
|
|
|
|
if (aCtor !== bCtor && !(_$1.isFunction(aCtor) && aCtor instanceof aCtor && _$1.isFunction(bCtor) && bCtor instanceof bCtor) && 'constructor' in a && 'constructor' in b) { |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// Assume equality for cyclic structures. The algorithm for detecting cyclic
|
|
|
|
|
|
|
|
// structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Initializing stack of traversed objects.
|
|
|
|
|
|
|
|
// It's done here since we only need them for objects and arrays comparison.
|
|
|
|
|
|
|
|
aStack = aStack || []; |
|
|
|
|
|
|
|
bStack = bStack || []; |
|
|
|
|
|
|
|
var length = aStack.length; |
|
|
|
|
|
|
|
while (length--) { |
|
|
|
|
|
|
|
// Linear search. Performance is inversely proportional to the number of
|
|
|
|
|
|
|
|
// unique nested structures.
|
|
|
|
|
|
|
|
if (aStack[length] === a) return bStack[length] === b; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Add the first object to the stack of traversed objects.
|
|
|
|
|
|
|
|
aStack.push(a); |
|
|
|
|
|
|
|
bStack.push(b); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Recursively compare objects and arrays.
|
|
|
|
|
|
|
|
if (areArrays) { |
|
|
|
|
|
|
|
// Compare array lengths to determine if a deep comparison is necessary.
|
|
|
|
|
|
|
|
length = a.length; |
|
|
|
|
|
|
|
if (length !== b.length) return false; |
|
|
|
|
|
|
|
// Deep compare the contents, ignoring non-numeric properties.
|
|
|
|
|
|
|
|
while (length--) { |
|
|
|
|
|
|
|
if (!eq(a[length], b[length], aStack, bStack)) return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
// Deep compare objects.
|
|
|
|
|
|
|
|
var keys = _$1.keys(a);var key = void 0; |
|
|
|
|
|
|
|
length = keys.length; |
|
|
|
|
|
|
|
// Ensure that both objects contain the same number of properties before comparing deep equality.
|
|
|
|
|
|
|
|
if (_$1.keys(b).length !== length) return false; |
|
|
|
|
|
|
|
while (length--) { |
|
|
|
|
|
|
|
// Deep compare each member
|
|
|
|
|
|
|
|
key = keys[length]; |
|
|
|
|
|
|
|
if (!(_$1.has(b, key) && eq(a[key], b[key], aStack, bStack))) return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// Remove the first object from the stack of traversed objects.
|
|
|
|
|
|
|
|
aStack.pop(); |
|
|
|
|
|
|
|
bStack.pop(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var eq = function eq(a, b, aStack, bStack) { |
|
|
|
|
|
|
|
// Identical objects are equal. `0 === -0`, but they aren't identical.
|
|
|
|
|
|
|
|
// See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal).
|
|
|
|
|
|
|
|
if (a === b) return a !== 0 || 1 / a === 1 / b; |
|
|
|
|
|
|
|
// `null` or `undefined` only equal to itself (strict comparison).
|
|
|
|
|
|
|
|
if (a == null || b == null) return false; |
|
|
|
|
|
|
|
// `NaN`s are equivalent, but non-reflexive.
|
|
|
|
|
|
|
|
if (a !== a) return b !== b; |
|
|
|
|
|
|
|
// Exhaust primitive checks
|
|
|
|
|
|
|
|
var type = typeof a; |
|
|
|
|
|
|
|
if (type !== 'function' && type !== 'object' && typeof b != 'object') return false; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// skip function
|
|
|
|
|
|
|
|
if (type === 'function') return true; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return deepEq(a, b, aStack, bStack); |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var shadowEq = function shadowEq(a, b, aStack, bStack) { |
|
|
|
|
|
|
|
// Identical objects are equal. `0 === -0`, but they aren't identical.
|
|
|
|
|
|
|
|
// See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal).
|
|
|
|
|
|
|
|
if (a === b) return a !== 0 || 1 / a === 1 / b; |
|
|
|
|
|
|
|
// `null` or `undefined` only equal to itself (strict comparison).
|
|
|
|
|
|
|
|
if (a == null || b == null) return false; |
|
|
|
|
|
|
|
// `NaN`s are equivalent, but non-reflexive.
|
|
|
|
|
|
|
|
if (a !== a) return b !== b; |
|
|
|
|
|
|
|
// Exhaust primitive checks
|
|
|
|
|
|
|
|
var type = typeof a; |
|
|
|
|
|
|
|
if (type !== 'function' && type !== 'object' && typeof b != 'object') return false; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// skip function
|
|
|
|
|
|
|
|
if (type === 'function') return true; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (Array.isArray(a) && Array.isArray(b) && (a.__ref__ || b.__ref__)) { |
|
|
|
|
|
|
|
if (a.length !== b.length) return false; |
|
|
|
|
|
|
|
// for (let i = 0; i < a.length; i++) {
|
|
|
|
|
|
|
|
// if (a[i] !== b[i]) {
|
|
|
|
|
|
|
|
// return false;
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return a.__ref__ === b.__ref__; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return deepEq(a, b, aStack, bStack); |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function isShadowEqual(a, b) { |
|
|
|
|
|
|
|
return shadowEq(a, b); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var mixinInjection = {}; |
|
|
|
var mixinInjection = {}; |
|
|
|
|
|
|
|
|
|
|
|
function getMixins(type) { |
|
|
|
function getMixins(type) { |
|
|
@ -34362,129 +34664,10 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons |
|
|
|
return watchers; |
|
|
|
return watchers; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var SymbolProto = typeof Symbol !== 'undefined' ? Symbol.prototype : null; |
|
|
|
|
|
|
|
var ObjProto = Object.prototype; |
|
|
|
|
|
|
|
var toString = ObjProto.toString; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Internal recursive comparison function for `isEqual`.
|
|
|
|
|
|
|
|
/* eslint no-param-reassign: ['off'] */ |
|
|
|
|
|
|
|
/* eslint no-use-before-define: ["off"] */ |
|
|
|
|
|
|
|
var deepEq = function deepEq(a, b, aStack, bStack) { |
|
|
|
|
|
|
|
// Unwrap any wrapped objects.
|
|
|
|
|
|
|
|
if (a instanceof _$1) a = a._wrapped; |
|
|
|
|
|
|
|
if (b instanceof _$1) b = b._wrapped; |
|
|
|
|
|
|
|
// Compare `[[Class]]` names.
|
|
|
|
|
|
|
|
var className = toString.call(a); |
|
|
|
|
|
|
|
if (className !== toString.call(b)) return false; |
|
|
|
|
|
|
|
switch (className) { |
|
|
|
|
|
|
|
// Strings, numbers, regular expressions, dates, and booleans are compared by value.
|
|
|
|
|
|
|
|
case '[object RegExp]': |
|
|
|
|
|
|
|
case '[object String]': |
|
|
|
|
|
|
|
// RegExps are coerced to strings for comparison (Note: '' + /a/i === '/a/i')
|
|
|
|
|
|
|
|
// Primitives and their corresponding object wrappers are equivalent; thus, `"5"` is
|
|
|
|
|
|
|
|
// equivalent to `new String("5")`.
|
|
|
|
|
|
|
|
return '' + a === '' + b; |
|
|
|
|
|
|
|
case '[object Number]': |
|
|
|
|
|
|
|
// `NaN`s are equivalent, but non-reflexive.
|
|
|
|
|
|
|
|
// Object(NaN) is equivalent to NaN.
|
|
|
|
|
|
|
|
if (+a !== +a) return +b !== +b; |
|
|
|
|
|
|
|
// An `egal` comparison is performed for other numeric values.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return +a === 0 ? 1 / +a === 1 / b : +a === +b; |
|
|
|
|
|
|
|
case '[object Date]': |
|
|
|
|
|
|
|
case '[object Boolean]': |
|
|
|
|
|
|
|
// Coerce dates and booleans to numeric primitive values. Dates are compared by their
|
|
|
|
|
|
|
|
// millisecond representations. Note that invalid dates with millisecond representations
|
|
|
|
|
|
|
|
// of `NaN` are not equivalent.
|
|
|
|
|
|
|
|
return +a === +b; |
|
|
|
|
|
|
|
case '[object Symbol]': |
|
|
|
|
|
|
|
return SymbolProto.valueOf.call(a) === SymbolProto.valueOf.call(b); |
|
|
|
|
|
|
|
default: |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var areArrays = className === '[object Array]'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!areArrays) { |
|
|
|
|
|
|
|
if (typeof a != 'object' || typeof b != 'object') return false; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Objects with different constructors are not equivalent, but `Object`s or `Array`s
|
|
|
|
|
|
|
|
// from different frames are.
|
|
|
|
|
|
|
|
var aCtor = a.constructor, |
|
|
|
|
|
|
|
bCtor = b.constructor; |
|
|
|
|
|
|
|
if (aCtor !== bCtor && !(_$1.isFunction(aCtor) && aCtor instanceof aCtor && _$1.isFunction(bCtor) && bCtor instanceof bCtor) && 'constructor' in a && 'constructor' in b) { |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// Assume equality for cyclic structures. The algorithm for detecting cyclic
|
|
|
|
|
|
|
|
// structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Initializing stack of traversed objects.
|
|
|
|
|
|
|
|
// It's done here since we only need them for objects and arrays comparison.
|
|
|
|
|
|
|
|
aStack = aStack || []; |
|
|
|
|
|
|
|
bStack = bStack || []; |
|
|
|
|
|
|
|
var length = aStack.length; |
|
|
|
|
|
|
|
while (length--) { |
|
|
|
|
|
|
|
// Linear search. Performance is inversely proportional to the number of
|
|
|
|
|
|
|
|
// unique nested structures.
|
|
|
|
|
|
|
|
if (aStack[length] === a) return bStack[length] === b; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Add the first object to the stack of traversed objects.
|
|
|
|
|
|
|
|
aStack.push(a); |
|
|
|
|
|
|
|
bStack.push(b); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Recursively compare objects and arrays.
|
|
|
|
|
|
|
|
if (areArrays) { |
|
|
|
|
|
|
|
// Compare array lengths to determine if a deep comparison is necessary.
|
|
|
|
|
|
|
|
length = a.length; |
|
|
|
|
|
|
|
if (length !== b.length) return false; |
|
|
|
|
|
|
|
// Deep compare the contents, ignoring non-numeric properties.
|
|
|
|
|
|
|
|
while (length--) { |
|
|
|
|
|
|
|
if (!eq(a[length], b[length], aStack, bStack)) return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
// Deep compare objects.
|
|
|
|
|
|
|
|
var keys = _$1.keys(a);var key = void 0; |
|
|
|
|
|
|
|
length = keys.length; |
|
|
|
|
|
|
|
// Ensure that both objects contain the same number of properties before comparing deep equality.
|
|
|
|
|
|
|
|
if (_$1.keys(b).length !== length) return false; |
|
|
|
|
|
|
|
while (length--) { |
|
|
|
|
|
|
|
// Deep compare each member
|
|
|
|
|
|
|
|
key = keys[length]; |
|
|
|
|
|
|
|
if (!(_$1.has(b, key) && eq(a[key], b[key], aStack, bStack))) return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// Remove the first object from the stack of traversed objects.
|
|
|
|
|
|
|
|
aStack.pop(); |
|
|
|
|
|
|
|
bStack.pop(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var eq = function eq(a, b, aStack, bStack) { |
|
|
|
|
|
|
|
// Identical objects are equal. `0 === -0`, but they aren't identical.
|
|
|
|
|
|
|
|
// See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal).
|
|
|
|
|
|
|
|
if (a === b) return a !== 0 || 1 / a === 1 / b; |
|
|
|
|
|
|
|
// `null` or `undefined` only equal to itself (strict comparison).
|
|
|
|
|
|
|
|
if (a == null || b == null) return false; |
|
|
|
|
|
|
|
// `NaN`s are equivalent, but non-reflexive.
|
|
|
|
|
|
|
|
if (a !== a) return b !== b; |
|
|
|
|
|
|
|
// Exhaust primitive checks
|
|
|
|
|
|
|
|
var type = typeof a; |
|
|
|
|
|
|
|
if (type !== 'function' && type !== 'object' && typeof b != 'object') return false; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// skip function
|
|
|
|
|
|
|
|
if (type === 'function') return true; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return deepEq(a, b, aStack, bStack); |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function isEqual(a, b) { |
|
|
|
|
|
|
|
return eq(a, b); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var allModelInstances = {}; |
|
|
|
var allModelInstances = {}; |
|
|
|
|
|
|
|
var allDefineModelInstances = {}; |
|
|
|
var emptyFn = function emptyFn() {}; |
|
|
|
var emptyFn = function emptyFn() {}; |
|
|
|
|
|
|
|
var TTL = 10; |
|
|
|
|
|
|
|
|
|
|
|
var Watcher = function () { |
|
|
|
var Watcher = function () { |
|
|
|
function Watcher(_ref) { |
|
|
|
function Watcher(_ref) { |
|
|
@ -34492,16 +34675,19 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons |
|
|
|
last = _ref.last, |
|
|
|
last = _ref.last, |
|
|
|
listener = _ref.listener, |
|
|
|
listener = _ref.listener, |
|
|
|
sync = _ref.sync, |
|
|
|
sync = _ref.sync, |
|
|
|
deep = _ref.deep; |
|
|
|
deep = _ref.deep, |
|
|
|
|
|
|
|
id = _ref.id; |
|
|
|
|
|
|
|
|
|
|
|
_classCallCheck(this, Watcher); |
|
|
|
_classCallCheck(this, Watcher); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.id = id; |
|
|
|
this.get = get; |
|
|
|
this.get = get; |
|
|
|
this.last = cloneShadow(last); |
|
|
|
this.last = cloneShadow(last); |
|
|
|
this.listener = listener || emptyFn; |
|
|
|
this.listener = listener || emptyFn; |
|
|
|
this.sync = sync || false; |
|
|
|
this.sync = sync || false; |
|
|
|
|
|
|
|
|
|
|
|
return { |
|
|
|
return { |
|
|
|
|
|
|
|
id: this.id, |
|
|
|
get: this.get, |
|
|
|
get: this.get, |
|
|
|
last: this.last, |
|
|
|
last: this.last, |
|
|
|
listener: this.listener |
|
|
|
listener: this.listener |
|
|
@ -34525,20 +34711,21 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons |
|
|
|
} |
|
|
|
} |
|
|
|
// state暂不支持func和context
|
|
|
|
// state暂不支持func和context
|
|
|
|
|
|
|
|
|
|
|
|
var _loop2 = function _loop2(_key) { |
|
|
|
var _loop2 = function _loop2(_key2) { |
|
|
|
var userDef = state[_key]; |
|
|
|
var userDef = state[_key2]; |
|
|
|
|
|
|
|
|
|
|
|
watchers[_key] = new Watcher({ |
|
|
|
watchers[_key2] = new Watcher({ |
|
|
|
|
|
|
|
id: vm._modelHashId + '-' + _key2, |
|
|
|
get: function get() { |
|
|
|
get: function get() { |
|
|
|
return vm.model[_key]; |
|
|
|
return vm.model[_key2]; |
|
|
|
}, |
|
|
|
}, |
|
|
|
last: userDef, |
|
|
|
last: userDef, |
|
|
|
listener: vm.options.defaultCallback || emptyFn |
|
|
|
listener: vm.options.defaultCallback || emptyFn |
|
|
|
}); |
|
|
|
}); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
for (var _key in state) { |
|
|
|
for (var _key2 in state) { |
|
|
|
_loop2(_key); |
|
|
|
_loop2(_key2); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -34553,6 +34740,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons |
|
|
|
order.push(key); |
|
|
|
order.push(key); |
|
|
|
|
|
|
|
|
|
|
|
watchers[key] = new Watcher({ |
|
|
|
watchers[key] = new Watcher({ |
|
|
|
|
|
|
|
id: vm._modelHashId + '-' + key, |
|
|
|
get: _$1.bind(userDef, context), |
|
|
|
get: _$1.bind(userDef, context), |
|
|
|
last: undefined, |
|
|
|
last: undefined, |
|
|
|
listener: emptyFn |
|
|
|
listener: emptyFn |
|
|
@ -34594,7 +34782,8 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons |
|
|
|
listener: _$1.bind(cb, vm), |
|
|
|
listener: _$1.bind(cb, vm), |
|
|
|
last: getter(), |
|
|
|
last: getter(), |
|
|
|
sync: options.sync, |
|
|
|
sync: options.sync, |
|
|
|
deep: options.deep |
|
|
|
deep: options.deep, |
|
|
|
|
|
|
|
id: options.id |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -34639,10 +34828,12 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons |
|
|
|
while (p) { |
|
|
|
while (p) { |
|
|
|
if (p.childContext && p.childContext.indexOf(key) > -1) { |
|
|
|
if (p.childContext && p.childContext.indexOf(key) > -1) { |
|
|
|
p.$watch(key, function (cur, last, p) { |
|
|
|
p.$watch(key, function (cur, last, p) { |
|
|
|
if (!vm.alive) return; |
|
|
|
if (!vm._contextWatchers[key]) return; |
|
|
|
vm.model[key] = cur; |
|
|
|
vm.model[key] = cur; |
|
|
|
vm._contextWatchers[key].last = cloneShadow(cur); // 避免重复调用(可以改成给watch添加一个参数保证下次比较一定相同)
|
|
|
|
vm._contextWatchers[key].last = cloneShadow(cur); // 避免重复调用(可以改成给watch添加一个参数保证下次比较一定相同)
|
|
|
|
vm.$digest(); |
|
|
|
vm.$digest(); |
|
|
|
|
|
|
|
}, { |
|
|
|
|
|
|
|
id: vm._modelHashId + '-' + key |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
return { |
|
|
|
return { |
|
|
@ -34659,6 +34850,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons |
|
|
|
if (!context) return; |
|
|
|
if (!context) return; |
|
|
|
vm.model[key] = context.p ? context.p.model[key] : undefined; |
|
|
|
vm.model[key] = context.p ? context.p.model[key] : undefined; |
|
|
|
watchers[key] = new Watcher({ |
|
|
|
watchers[key] = new Watcher({ |
|
|
|
|
|
|
|
id: context.p._modelHashId + '-' + key, |
|
|
|
get: function get() { |
|
|
|
get: function get() { |
|
|
|
return vm.model[key]; |
|
|
|
return vm.model[key]; |
|
|
|
}, |
|
|
|
}, |
|
|
@ -34672,7 +34864,10 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function addToListenerQueue(vm, watcher, cur, last) { |
|
|
|
function addToListenerQueue(vm, watcher, cur, last) { |
|
|
|
var listener = _$1.bind(watcher.listener, vm, cur, last, vm); |
|
|
|
var listener = { |
|
|
|
|
|
|
|
id: watcher.id, |
|
|
|
|
|
|
|
cb: _$1.bind(watcher.listener, vm, cur, last, vm) |
|
|
|
|
|
|
|
}; |
|
|
|
watcher.sync === true ? vm.syncListeners.push(listener) : vm.asyncListeners.push(listener); |
|
|
|
watcher.sync === true ? vm.syncListeners.push(listener) : vm.asyncListeners.push(listener); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -34681,7 +34876,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons |
|
|
|
_$1.each(vm._stateWatchers, function (watcher, key) { |
|
|
|
_$1.each(vm._stateWatchers, function (watcher, key) { |
|
|
|
var cur = watcher.get(); |
|
|
|
var cur = watcher.get(); |
|
|
|
var last = watcher.last; |
|
|
|
var last = watcher.last; |
|
|
|
if (!isEqual(cur, last)) { |
|
|
|
if (!isShadowEqual(cur, last)) { |
|
|
|
addToListenerQueue(vm, watcher, cur, last); |
|
|
|
addToListenerQueue(vm, watcher, cur, last); |
|
|
|
vm.model[key] = cur; |
|
|
|
vm.model[key] = cur; |
|
|
|
dirty = true; |
|
|
|
dirty = true; |
|
|
@ -34703,7 +34898,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons |
|
|
|
try { |
|
|
|
try { |
|
|
|
var cur = watcher.get(); |
|
|
|
var cur = watcher.get(); |
|
|
|
var last = watcher.last; |
|
|
|
var last = watcher.last; |
|
|
|
if (!isEqual(cur, last)) { |
|
|
|
if (!isShadowEqual(cur, last)) { |
|
|
|
addToListenerQueue(vm, watcher, cur, last); |
|
|
|
addToListenerQueue(vm, watcher, cur, last); |
|
|
|
vm.model[key] = cur; |
|
|
|
vm.model[key] = cur; |
|
|
|
dirty = true; |
|
|
|
dirty = true; |
|
|
@ -34728,8 +34923,11 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons |
|
|
|
_$1.each(vm._contextWatchers, function (watcher, key) { |
|
|
|
_$1.each(vm._contextWatchers, function (watcher, key) { |
|
|
|
var cur = watcher.get(); |
|
|
|
var cur = watcher.get(); |
|
|
|
var last = watcher.last; |
|
|
|
var last = watcher.last; |
|
|
|
if (!isEqual(cur, last)) { |
|
|
|
if (!isShadowEqual(cur, last)) { |
|
|
|
var listener = _$1.bind(watcher.listener, vm, cur, last, vm); |
|
|
|
var listener = { |
|
|
|
|
|
|
|
id: watcher.id, |
|
|
|
|
|
|
|
cb: _$1.bind(watcher.listener, vm, cur, last, vm) |
|
|
|
|
|
|
|
}; |
|
|
|
vm.contextListeners.push(listener); |
|
|
|
vm.contextListeners.push(listener); |
|
|
|
vm.model[key] = cur; |
|
|
|
vm.model[key] = cur; |
|
|
|
dirty = true; |
|
|
|
dirty = true; |
|
|
@ -34741,12 +34939,36 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function digest(vm) { |
|
|
|
function digest(vm) { |
|
|
|
var ttl = 10, |
|
|
|
var stateDirty = true, |
|
|
|
dirty = true; |
|
|
|
contextDirty = true, |
|
|
|
do { |
|
|
|
computedDirty = true; |
|
|
|
dirty = digestState(vm) || digestContext(vm) || digestComputed(vm); |
|
|
|
for (var ttl = TTL; stateDirty && ttl > 0; ttl--) { |
|
|
|
} while (dirty && ttl-- >= 0); |
|
|
|
stateDirty = digestState(vm); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
for (var _ttl = TTL; contextDirty && _ttl > 0; _ttl--) { |
|
|
|
|
|
|
|
contextDirty = digestContext(vm); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
for (var _ttl2 = TTL; computedDirty && _ttl2 > 0; _ttl2--) { |
|
|
|
|
|
|
|
computedDirty = digestComputed(vm); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var nextListener = function () { |
|
|
|
|
|
|
|
var callbackMap = {}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return function queueNextListener(listener, ctx) { |
|
|
|
|
|
|
|
var id = listener.id; |
|
|
|
|
|
|
|
var cb = listener.cb; |
|
|
|
|
|
|
|
if (id && callbackMap[id]) { |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
nextTick(function () { |
|
|
|
|
|
|
|
cb(); |
|
|
|
|
|
|
|
callbackMap[id] = false; |
|
|
|
|
|
|
|
}, ctx); |
|
|
|
|
|
|
|
callbackMap[id] = true; |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
}(); |
|
|
|
|
|
|
|
|
|
|
|
function executeWatchListeners(vm) { |
|
|
|
function executeWatchListeners(vm) { |
|
|
|
var syncListeners = [].concat(vm.syncListeners || []); |
|
|
|
var syncListeners = [].concat(vm.syncListeners || []); |
|
|
@ -34763,9 +34985,12 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons |
|
|
|
var cur = watcher.get(); |
|
|
|
var cur = watcher.get(); |
|
|
|
var last = watcher.last; |
|
|
|
var last = watcher.last; |
|
|
|
|
|
|
|
|
|
|
|
if (_$1.isEqual(cur, last)) return; |
|
|
|
if (isShadowEqual(cur, last)) return; |
|
|
|
|
|
|
|
|
|
|
|
var listner = _$1.bind(watcher.listener, vm, cur, last, vm); |
|
|
|
var listner = { |
|
|
|
|
|
|
|
id: watcher.id, |
|
|
|
|
|
|
|
cb: _$1.bind(watcher.listener, vm, cur, last, vm) |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
watcher.sync === true ? syncListeners.push(listner) : asyncListeners.push(listner); |
|
|
|
watcher.sync === true ? syncListeners.push(listner) : asyncListeners.push(listner); |
|
|
|
|
|
|
|
|
|
|
@ -34773,21 +34998,25 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
_$1.each(syncListeners, function (listener) { |
|
|
|
_$1.each(syncListeners, function (listener) { |
|
|
|
listener(); |
|
|
|
listener.cb(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
nextTick(function () { |
|
|
|
nextTick(function () { |
|
|
|
_$1.each(contextListeners, function (listener) { |
|
|
|
_$1.each(contextListeners, function (listener) { |
|
|
|
listener(); |
|
|
|
listener.cb(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
_$1.each(asyncListeners, function (listener) { |
|
|
|
_$1.each(asyncListeners, function (listener) { |
|
|
|
if (!vm.alive) return; |
|
|
|
listener.cb(); |
|
|
|
listener(); |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function refreshAllDefineModel() { |
|
|
|
|
|
|
|
_$1.each(allDefineModelInstances, function (insta) { |
|
|
|
|
|
|
|
insta && insta.$digest && insta.$digest(); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var Model = function () { |
|
|
|
var Model = function () { |
|
|
|
function Model(model) { |
|
|
|
function Model(model) { |
|
|
|
_classCallCheck(this, Model); |
|
|
|
_classCallCheck(this, Model); |
|
|
@ -34827,11 +35056,6 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons |
|
|
|
|
|
|
|
|
|
|
|
Model.prototype._init = function _init() {}; |
|
|
|
Model.prototype._init = function _init() {}; |
|
|
|
|
|
|
|
|
|
|
|
Model.prototype.$watch = function $watch(expOrFn, cb, options) { |
|
|
|
|
|
|
|
var watcher = createWatcher(this, expOrFn, cb, options); |
|
|
|
|
|
|
|
this._watchers.push(watcher); |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Model.prototype.destroy = function destroy() { |
|
|
|
Model.prototype.destroy = function destroy() { |
|
|
|
this.alive = false; |
|
|
|
this.alive = false; |
|
|
|
allModelInstances[this._modelHashId] = null; |
|
|
|
allModelInstances[this._modelHashId] = null; |
|
|
@ -34842,10 +35066,24 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons |
|
|
|
this.destroyed && this.destroyed(); |
|
|
|
this.destroyed && this.destroyed(); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Model.prototype.$watch = function $watch(expOrFn, cb, options) { |
|
|
|
|
|
|
|
var watcher = createWatcher(this, expOrFn, cb, options); |
|
|
|
|
|
|
|
this._watchers.push(watcher); |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
Model.prototype.$digest = function $digest() { |
|
|
|
Model.prototype.$digest = function $digest() { |
|
|
|
digest(this); |
|
|
|
digest(this); |
|
|
|
|
|
|
|
|
|
|
|
executeWatchListeners(this); |
|
|
|
executeWatchListeners(this); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 非define创建的model$digest触发所有define定义的model的$digest(未来需要平台去除这些写法))
|
|
|
|
|
|
|
|
if (!this.options.define) { |
|
|
|
|
|
|
|
refreshAllDefineModel(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Model.prototype.getModelID = function getModelID() { |
|
|
|
|
|
|
|
return this._modelHashId; |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
return Model; |
|
|
|
return Model; |
|
|
@ -34861,24 +35099,18 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function toJSON(model) { |
|
|
|
function define(model) { |
|
|
|
var result = void 0; |
|
|
|
var OB = inherit(Model, { |
|
|
|
if (_.isArray(model)) { |
|
|
|
state: function state() { |
|
|
|
result = []; |
|
|
|
return model; |
|
|
|
for (var i = 0, len = model.length; i < len; i++) { |
|
|
|
|
|
|
|
result[i] = toJSON(model[i]); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} else if (model && isPlainObject(model)) { |
|
|
|
}); |
|
|
|
result = {}; |
|
|
|
var ob = new OB({ |
|
|
|
for (var key in model) { |
|
|
|
define: true |
|
|
|
if (!_.has($$skipArray, key)) { |
|
|
|
}); |
|
|
|
result[key] = toJSON(model[key]); |
|
|
|
allDefineModelInstances[ob.getModelID()] = ob; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
return ob.model; |
|
|
|
} else { |
|
|
|
|
|
|
|
result = model; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return result; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var version = '2.0'; |
|
|
|
var version = '2.0'; |
|
|
@ -34886,12 +35118,14 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons |
|
|
|
exports.version = version; |
|
|
|
exports.version = version; |
|
|
|
exports.$$skipArray = $$skipArray; |
|
|
|
exports.$$skipArray = $$skipArray; |
|
|
|
exports.mixin = mixin; |
|
|
|
exports.mixin = mixin; |
|
|
|
|
|
|
|
exports.toJSON = toJSON; |
|
|
|
|
|
|
|
exports.nextListener = nextListener; |
|
|
|
exports.Model = Model; |
|
|
|
exports.Model = Model; |
|
|
|
exports.getAllModelInstances = getAllModelInstances; |
|
|
|
exports.getAllModelInstances = getAllModelInstances; |
|
|
|
exports.refreshAll = refreshAll; |
|
|
|
exports.refreshAll = refreshAll; |
|
|
|
|
|
|
|
exports.define = define; |
|
|
|
exports.inherit = inherit; |
|
|
|
exports.inherit = inherit; |
|
|
|
exports.watch = watch; |
|
|
|
exports.watch = watch; |
|
|
|
exports.toJSON = toJSON; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
exports.__esModule = true; |
|
|
|
exports.__esModule = true; |
|
|
|
});/* ! |
|
|
|
});/* ! |
|
|
@ -40604,6 +40838,9 @@ BI.Popover = BI.inherit(BI.Widget, { |
|
|
|
// width: 600,
|
|
|
|
// width: 600,
|
|
|
|
// height: 500,
|
|
|
|
// height: 500,
|
|
|
|
size: "normal", // small, normal, big
|
|
|
|
size: "normal", // small, normal, big
|
|
|
|
|
|
|
|
logic: { |
|
|
|
|
|
|
|
dynamic: false |
|
|
|
|
|
|
|
}, |
|
|
|
header: null, |
|
|
|
header: null, |
|
|
|
body: null, |
|
|
|
body: null, |
|
|
|
footer: null |
|
|
|
footer: null |
|
|
@ -40619,16 +40856,15 @@ BI.Popover = BI.inherit(BI.Widget, { |
|
|
|
self.startX += deltaX; |
|
|
|
self.startX += deltaX; |
|
|
|
self.startY += deltaY; |
|
|
|
self.startY += deltaY; |
|
|
|
self.element.css({ |
|
|
|
self.element.css({ |
|
|
|
left: BI.clamp(self.startX, 0, W - size.width) + "px", |
|
|
|
left: BI.clamp(self.startX, 0, W - self.element.width()) + "px", |
|
|
|
top: BI.clamp(self.startY, 0, H - size.height) + "px" |
|
|
|
top: BI.clamp(self.startY, 0, H - self.element.height()) + "px" |
|
|
|
}); |
|
|
|
}); |
|
|
|
// BI-12134 没有什么特别好的方法
|
|
|
|
// BI-12134 没有什么特别好的方法
|
|
|
|
BI.Resizers._resize(); |
|
|
|
BI.Resizers._resize(); |
|
|
|
}, function () { |
|
|
|
}, function () { |
|
|
|
self.tracker.releaseMouseMoves(); |
|
|
|
self.tracker.releaseMouseMoves(); |
|
|
|
}, _global); |
|
|
|
}, _global); |
|
|
|
var items = { |
|
|
|
var items = [{ |
|
|
|
north: { |
|
|
|
|
|
|
|
el: { |
|
|
|
el: { |
|
|
|
type: "bi.htape", |
|
|
|
type: "bi.htape", |
|
|
|
cls: "bi-message-title bi-header-background", |
|
|
|
cls: "bi-message-title bi-header-background", |
|
|
@ -40662,12 +40898,23 @@ BI.Popover = BI.inherit(BI.Widget, { |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
width: 56 |
|
|
|
width: 56 |
|
|
|
}] |
|
|
|
}], |
|
|
|
|
|
|
|
height: this._constant.HEADER_HEIGHT |
|
|
|
}, |
|
|
|
}, |
|
|
|
height: this._constant.HEADER_HEIGHT |
|
|
|
height: this._constant.HEADER_HEIGHT |
|
|
|
|
|
|
|
}, { |
|
|
|
|
|
|
|
el: o.logic.dynamic ? { |
|
|
|
|
|
|
|
type: "bi.vertical", |
|
|
|
|
|
|
|
cls: "popover-body", |
|
|
|
|
|
|
|
ref: function () { |
|
|
|
|
|
|
|
self.body = this; |
|
|
|
}, |
|
|
|
}, |
|
|
|
center: { |
|
|
|
hgap: 20, |
|
|
|
el: { |
|
|
|
tgap: 10, |
|
|
|
|
|
|
|
items: [{ |
|
|
|
|
|
|
|
el: BI.createWidget(o.body) |
|
|
|
|
|
|
|
}] |
|
|
|
|
|
|
|
} : { |
|
|
|
type: "bi.absolute", |
|
|
|
type: "bi.absolute", |
|
|
|
items: [{ |
|
|
|
items: [{ |
|
|
|
el: BI.createWidget(o.body), |
|
|
|
el: BI.createWidget(o.body), |
|
|
@ -40677,10 +40924,9 @@ BI.Popover = BI.inherit(BI.Widget, { |
|
|
|
bottom: 0 |
|
|
|
bottom: 0 |
|
|
|
}] |
|
|
|
}] |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}]; |
|
|
|
}; |
|
|
|
|
|
|
|
if (o.footer) { |
|
|
|
if (o.footer) { |
|
|
|
items.south = { |
|
|
|
items.push({ |
|
|
|
el: { |
|
|
|
el: { |
|
|
|
type: "bi.absolute", |
|
|
|
type: "bi.absolute", |
|
|
|
items: [{ |
|
|
|
items: [{ |
|
|
@ -40689,30 +40935,41 @@ BI.Popover = BI.inherit(BI.Widget, { |
|
|
|
top: 0, |
|
|
|
top: 0, |
|
|
|
right: 20, |
|
|
|
right: 20, |
|
|
|
bottom: 0 |
|
|
|
bottom: 0 |
|
|
|
}] |
|
|
|
}], |
|
|
|
|
|
|
|
height: 44 |
|
|
|
}, |
|
|
|
}, |
|
|
|
height: 44 |
|
|
|
height: 44 |
|
|
|
}; |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var size = this._calculateSize(); |
|
|
|
var size = this._calculateSize(); |
|
|
|
|
|
|
|
|
|
|
|
return { |
|
|
|
return BI.extend({ |
|
|
|
type: "bi.border", |
|
|
|
type: o.logic.dynamic ? "bi.vertical" : "bi.vtape", |
|
|
|
items: items, |
|
|
|
items: items, |
|
|
|
width: size.width, |
|
|
|
width: size.width |
|
|
|
|
|
|
|
}, o.logic.dynamic ? { |
|
|
|
|
|
|
|
type: "bi.vertical", |
|
|
|
|
|
|
|
scrolly: false |
|
|
|
|
|
|
|
} : { |
|
|
|
|
|
|
|
type: "bi.vtape", |
|
|
|
height: size.height |
|
|
|
height: size.height |
|
|
|
}; |
|
|
|
}); |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
mounted: function () { |
|
|
|
mounted: function () { |
|
|
|
var self = this; |
|
|
|
var self = this, o = this.options; |
|
|
|
this.dragger.element.mousedown(function (e) { |
|
|
|
this.dragger.element.mousedown(function (e) { |
|
|
|
var pos = self.element.offset(); |
|
|
|
var pos = self.element.offset(); |
|
|
|
self.startX = pos.left; |
|
|
|
self.startX = pos.left; |
|
|
|
self.startY = pos.top; |
|
|
|
self.startY = pos.top; |
|
|
|
self.tracker.captureMouseMoves(e); |
|
|
|
self.tracker.captureMouseMoves(e); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
if (o.logic.dynamic) { |
|
|
|
|
|
|
|
var height = this.element.height(); |
|
|
|
|
|
|
|
var compareHeight = BI.clamp(height, 200, 600) - (o.footer ? 84 : 44); |
|
|
|
|
|
|
|
this.body.element.height(compareHeight); |
|
|
|
|
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
_calculateSize: function () { |
|
|
|
_calculateSize: function () { |
|
|
@ -81819,14 +82076,22 @@ BI.shortcut("bi.value_chooser_pane", BI.ValueChooserPane);;(function () { |
|
|
|
navigate.apply(this, arguments); |
|
|
|
navigate.apply(this, arguments); |
|
|
|
BI.defer(function () { |
|
|
|
BI.defer(function () { |
|
|
|
additionFunc(); |
|
|
|
additionFunc(); |
|
|
|
}, 110); |
|
|
|
}, 200); |
|
|
|
} |
|
|
|
} |
|
|
|
var back = window.history.back; |
|
|
|
var back = window.history.back; |
|
|
|
window.history.back = function () { |
|
|
|
window.history.back = function () { |
|
|
|
back.apply(this, arguments); |
|
|
|
back.apply(this, arguments); |
|
|
|
BI.defer(function () { |
|
|
|
BI.defer(function () { |
|
|
|
additionFunc(); |
|
|
|
additionFunc(); |
|
|
|
}, 110); |
|
|
|
}, 200); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (BI.Router) { |
|
|
|
|
|
|
|
var execute = BI.Router.prototype.execute; |
|
|
|
|
|
|
|
BI.Router.prototype.execute = function () { |
|
|
|
|
|
|
|
execute.apply(this, arguments); |
|
|
|
|
|
|
|
additionFunc(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -81896,16 +82161,6 @@ BI.shortcut("bi.value_chooser_pane", BI.ValueChooserPane);;(function () { |
|
|
|
return Fix.toJSON(ob); |
|
|
|
return Fix.toJSON(ob); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
Fix.define = function (model) { |
|
|
|
|
|
|
|
var OB = BI.inherit(Fix.Model, { |
|
|
|
|
|
|
|
state: function () { |
|
|
|
|
|
|
|
return model |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
return new OB({ |
|
|
|
|
|
|
|
defaultCallback: additionFunc |
|
|
|
|
|
|
|
}).model; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
Fix.set = function (obj, k, v) { |
|
|
|
Fix.set = function (obj, k, v) { |
|
|
|
try { |
|
|
|
try { |
|
|
|
if(obj) { |
|
|
|
if(obj) { |
|
|
@ -81919,9 +82174,7 @@ BI.shortcut("bi.value_chooser_pane", BI.ValueChooserPane);;(function () { |
|
|
|
} |
|
|
|
} |
|
|
|
Fix.del = function (obj, k) { |
|
|
|
Fix.del = function (obj, k) { |
|
|
|
try { |
|
|
|
try { |
|
|
|
if(obj) { |
|
|
|
delete obj[k]; |
|
|
|
obj[k] = undefined; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} catch (e) { |
|
|
|
} catch (e) { |
|
|
|
|
|
|
|
|
|
|
|
} finally { |
|
|
|
} finally { |
|
|
|