Browse Source

BI-34242 弹窗提供可自适应body高度的配置

master
windy 6 years ago
parent
commit
c7333a7242
  1. 83
      demo/js/core/popup/demo.popover.js
  2. 60
      dist/base.js
  3. 683
      dist/bundle.ie.js
  4. 68
      dist/bundle.ie.min.js
  5. 160
      dist/bundle.js
  6. 68
      dist/bundle.min.js
  7. 98
      dist/core.js
  8. 83
      dist/demo.js
  9. 683
      dist/fineui.ie.js
  10. 68
      dist/fineui.ie.min.js
  11. 158
      dist/fineui.js
  12. 60
      dist/fineui.min.js
  13. 158
      dist/fineui_without_jquery_polyfill.js
  14. 2
      dist/utils.min.js
  15. 62
      src/base/layer/layer.popover.js

83
demo/js/core/popup/demo.popover.js

@ -7,18 +7,19 @@ Demo.Func = BI.inherit(BI.Widget, {
},
render: function () {
var id = BI.UUID();
var body;
return {
type: "bi.vertical",
vgap: 10,
items: [{
type: "bi.text_button",
text: "点击弹出Popover(normal size)",
text: "点击弹出Popover(normal size & fixed)",
height: 30,
handler: function () {
BI.Popovers.remove(id);
BI.Popovers.create(id, {
type: "bi.bar_popover",
size: "big",
size: "normal",
header: {
type: "bi.label",
text: "这个是header"
@ -31,7 +32,7 @@ Demo.Func = BI.inherit(BI.Widget, {
}
}, {
type: "bi.text_button",
text: "点击弹出Popover(small size)",
text: "点击弹出Popover(small size & fixed)",
height: 30,
handler: function () {
BI.Popovers.remove(id);
@ -50,7 +51,7 @@ Demo.Func = BI.inherit(BI.Widget, {
}
}, {
type: "bi.text_button",
text: "点击弹出Popover(big size)",
text: "点击弹出Popover(big size & fixed)",
height: 30,
handler: function () {
BI.Popovers.remove(id);
@ -67,6 +68,80 @@ Demo.Func = BI.inherit(BI.Widget, {
}
}).open(id);
}
}, {
type: "bi.text_button",
text: "点击弹出Popover(normal size & adapt body区域高度是300)",
height: 30,
handler: function () {
BI.Popovers.remove(id);
BI.Popovers.create(id, {
type: "bi.bar_popover",
size: "normal",
logic: {
dynamic: true
},
header: {
type: "bi.label",
text: "这个是header"
},
body: {
type: "bi.vertical",
items: [{
type: "bi.button_group",
ref: function () {
body = this;
},
items: BI.map(BI.range(0, 10), function () {
return {
type: "bi.label",
text: "1",
height: 30
};
}),
layouts: [{
type: "bi.vertical"
}]
}]
}
}).open(id);
}
}, {
type: "bi.text_button",
text: "点击弹出Popover(small size & adapt body区域高度是900)",
height: 30,
handler: function () {
BI.Popovers.remove(id);
BI.Popovers.create(id, {
type: "bi.bar_popover",
size: "small",
logic: {
dynamic: true
},
header: {
type: "bi.label",
text: "这个是header"
},
body: {
type: "bi.vertical",
items: [{
type: "bi.button_group",
ref: function () {
body = this;
},
items: BI.map(BI.range(0, 30), function () {
return {
type: "bi.label",
text: "1",
height: 30
};
}),
layouts: [{
type: "bi.vertical"
}]
}]
}
}).open(id);
}
}, {
type: "bi.text_button",
text: "点击弹出Popover(custom)",

60
dist/base.js vendored

@ -5708,6 +5708,9 @@ BI.Popover = BI.inherit(BI.Widget, {
// width: 600,
// height: 500,
size: "normal", // small, normal, big
logic: {
dynamic: false
},
header: null,
body: null,
footer: null
@ -5723,16 +5726,15 @@ BI.Popover = BI.inherit(BI.Widget, {
self.startX += deltaX;
self.startY += deltaY;
self.element.css({
left: BI.clamp(self.startX, 0, W - size.width) + "px",
top: BI.clamp(self.startY, 0, H - size.height) + "px"
left: BI.clamp(self.startX, 0, W - self.element.width()) + "px",
top: BI.clamp(self.startY, 0, H - self.element.height()) + "px"
});
// BI-12134 没有什么特别好的方法
BI.Resizers._resize();
}, function () {
self.tracker.releaseMouseMoves();
}, _global);
var items = {
north: {
var items = [{
el: {
type: "bi.htape",
cls: "bi-message-title bi-header-background",
@ -5766,12 +5768,23 @@ BI.Popover = BI.inherit(BI.Widget, {
}
},
width: 56
}]
}],
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: {
el: {
hgap: 20,
tgap: 10,
items: [{
el: BI.createWidget(o.body)
}]
} : {
type: "bi.absolute",
items: [{
el: BI.createWidget(o.body),
@ -5781,10 +5794,9 @@ BI.Popover = BI.inherit(BI.Widget, {
bottom: 0
}]
}
}
};
}];
if (o.footer) {
items.south = {
items.push({
el: {
type: "bi.absolute",
items: [{
@ -5793,30 +5805,44 @@ BI.Popover = BI.inherit(BI.Widget, {
top: 0,
right: 20,
bottom: 0
}]
}],
height: 44
},
height: 44
};
});
}
var size = this._calculateSize();
return {
type: "bi.border",
return BI.extend({
type: o.logic.dynamic ? "bi.vertical" : "bi.vtape",
items: items,
width: size.width,
width: size.width
}, o.logic.dynamic ? {
type: "bi.vertical",
scrolly: false
} : {
type: "bi.vtape",
height: size.height
};
});
},
mounted: function () {
var self = this;
var self = this, o = this.options;
this.dragger.element.mousedown(function (e) {
var pos = self.element.offset();
self.startX = pos.left;
self.startY = pos.top;
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.css({
"min-height": compareHeight,
"max-height": compareHeight
});
}
},
_calculateSize: function () {

683
dist/bundle.ie.js vendored

@ -19586,7 +19586,7 @@ _.extend(BI, {
if(!_global.navigator) {
return false;
}
return /safari/i.test(navigator.userAgent.toLowerCase());
return /safari/i.test(navigator.userAgent.toLowerCase()) && !/chrome/i.test(navigator.userAgent.toLowerCase());
},
isKhtml: function () {
@ -31244,6 +31244,104 @@ BI.InlineVerticalAdaptLayout = BI.inherit(BI.Layout, {
}
});
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.
*
@ -34006,6 +34104,45 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
_$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 isNative(Ctor) {
@ -34078,14 +34215,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) {
if (obj === null) return null;
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;
//
@ -34173,19 +34332,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) {
if (typeof sp === "object") {
overrides = sp;
sp = sb;
sb = function sb() {
sb = function temp() {
return sp.apply(this, arguments);
};
}
@ -34200,6 +34351,156 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
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 = {};
function getMixins(type) {
@ -34362,129 +34663,10 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
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 allDefineModelInstances = {};
var emptyFn = function emptyFn() {};
var TTL = 10;
var Watcher = function () {
function Watcher(_ref) {
@ -34492,16 +34674,19 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
last = _ref.last,
listener = _ref.listener,
sync = _ref.sync,
deep = _ref.deep;
deep = _ref.deep,
id = _ref.id;
_classCallCheck(this, Watcher);
this.id = id;
this.get = get;
this.last = cloneShadow(last);
this.listener = listener || emptyFn;
this.sync = sync || false;
return {
id: this.id,
get: this.get,
last: this.last,
listener: this.listener
@ -34525,20 +34710,21 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
}
// state暂不支持func和context
var _loop2 = function _loop2(_key) {
var userDef = state[_key];
var _loop2 = function _loop2(_key2) {
var userDef = state[_key2];
watchers[_key] = new Watcher({
watchers[_key2] = new Watcher({
id: vm._modelHashId + '-' + _key2,
get: function get() {
return vm.model[_key];
return vm.model[_key2];
},
last: userDef,
listener: vm.options.defaultCallback || emptyFn
});
};
for (var _key in state) {
_loop2(_key);
for (var _key2 in state) {
_loop2(_key2);
}
}
@ -34553,6 +34739,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
order.push(key);
watchers[key] = new Watcher({
id: vm._modelHashId + '-' + key,
get: _$1.bind(userDef, context),
last: undefined,
listener: emptyFn
@ -34594,7 +34781,8 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
listener: _$1.bind(cb, vm),
last: getter(),
sync: options.sync,
deep: options.deep
deep: options.deep,
id: options.id
});
}
@ -34639,10 +34827,12 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
while (p) {
if (p.childContext && p.childContext.indexOf(key) > -1) {
p.$watch(key, function (cur, last, p) {
if (!vm.alive) return;
if (!vm._contextWatchers[key]) return;
vm.model[key] = cur;
vm._contextWatchers[key].last = cloneShadow(cur); // 避免重复调用(可以改成给watch添加一个参数保证下次比较一定相同)
vm.$digest();
}, {
id: vm._modelHashId + '-' + key
});
return {
@ -34659,6 +34849,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
if (!context) return;
vm.model[key] = context.p ? context.p.model[key] : undefined;
watchers[key] = new Watcher({
id: context.p._modelHashId + '-' + key,
get: function get() {
return vm.model[key];
},
@ -34672,7 +34863,10 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
}
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);
}
@ -34681,7 +34875,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
_$1.each(vm._stateWatchers, function (watcher, key) {
var cur = watcher.get();
var last = watcher.last;
if (!isEqual(cur, last)) {
if (!isShadowEqual(cur, last)) {
addToListenerQueue(vm, watcher, cur, last);
vm.model[key] = cur;
dirty = true;
@ -34703,7 +34897,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
try {
var cur = watcher.get();
var last = watcher.last;
if (!isEqual(cur, last)) {
if (!isShadowEqual(cur, last)) {
addToListenerQueue(vm, watcher, cur, last);
vm.model[key] = cur;
dirty = true;
@ -34728,8 +34922,11 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
_$1.each(vm._contextWatchers, function (watcher, key) {
var cur = watcher.get();
var last = watcher.last;
if (!isEqual(cur, last)) {
var listener = _$1.bind(watcher.listener, vm, cur, last, vm);
if (!isShadowEqual(cur, last)) {
var listener = {
id: watcher.id,
cb: _$1.bind(watcher.listener, vm, cur, last, vm)
};
vm.contextListeners.push(listener);
vm.model[key] = cur;
dirty = true;
@ -34741,12 +34938,36 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
}
function digest(vm) {
var ttl = 10,
dirty = true;
do {
dirty = digestState(vm) || digestContext(vm) || digestComputed(vm);
} while (dirty && ttl-- >= 0);
var stateDirty = true,
contextDirty = true,
computedDirty = true;
for (var ttl = TTL; stateDirty && ttl > 0; ttl--) {
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) {
var syncListeners = [].concat(vm.syncListeners || []);
@ -34763,9 +34984,12 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
var cur = watcher.get();
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);
@ -34773,21 +34997,25 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
});
_$1.each(syncListeners, function (listener) {
listener();
listener.cb();
});
nextTick(function () {
_$1.each(contextListeners, function (listener) {
listener();
listener.cb();
});
_$1.each(asyncListeners, function (listener) {
if (!vm.alive) return;
listener();
listener.cb();
});
});
}
function refreshAllDefineModel() {
_$1.each(allDefineModelInstances, function (insta) {
insta && insta.$digest && insta.$digest();
});
}
var Model = function () {
function Model(model) {
_classCallCheck(this, Model);
@ -34827,11 +35055,6 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
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() {
this.alive = false;
allModelInstances[this._modelHashId] = null;
@ -34842,10 +35065,24 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
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() {
digest(this);
executeWatchListeners(this);
// 非define创建的model$digest触发所有define定义的model的$digest(未来需要平台去除这些写法))
if (!this.options.define) {
refreshAllDefineModel();
}
};
Model.prototype.getModelID = function getModelID() {
return this._modelHashId;
};
return Model;
@ -34861,24 +35098,18 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
});
}
function toJSON(model) {
var result = void 0;
if (_.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 (!_.has($$skipArray, key)) {
result[key] = toJSON(model[key]);
}
}
} else {
result = model;
function define(model) {
var OB = inherit(Model, {
state: function state() {
return model;
}
return result;
});
var ob = new OB({
define: true
});
allDefineModelInstances[ob.getModelID()] = ob;
return ob.model;
}
var version = '2.0';
@ -34886,12 +35117,14 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
exports.version = version;
exports.$$skipArray = $$skipArray;
exports.mixin = mixin;
exports.toJSON = toJSON;
exports.nextListener = nextListener;
exports.Model = Model;
exports.getAllModelInstances = getAllModelInstances;
exports.refreshAll = refreshAll;
exports.define = define;
exports.inherit = inherit;
exports.watch = watch;
exports.toJSON = toJSON;
exports.__esModule = true;
});/* !
@ -40604,6 +40837,9 @@ BI.Popover = BI.inherit(BI.Widget, {
// width: 600,
// height: 500,
size: "normal", // small, normal, big
logic: {
dynamic: false
},
header: null,
body: null,
footer: null
@ -40619,16 +40855,15 @@ BI.Popover = BI.inherit(BI.Widget, {
self.startX += deltaX;
self.startY += deltaY;
self.element.css({
left: BI.clamp(self.startX, 0, W - size.width) + "px",
top: BI.clamp(self.startY, 0, H - size.height) + "px"
left: BI.clamp(self.startX, 0, W - self.element.width()) + "px",
top: BI.clamp(self.startY, 0, H - self.element.height()) + "px"
});
// BI-12134 没有什么特别好的方法
BI.Resizers._resize();
}, function () {
self.tracker.releaseMouseMoves();
}, _global);
var items = {
north: {
var items = [{
el: {
type: "bi.htape",
cls: "bi-message-title bi-header-background",
@ -40662,12 +40897,23 @@ BI.Popover = BI.inherit(BI.Widget, {
}
},
width: 56
}]
}],
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: {
el: {
hgap: 20,
tgap: 10,
items: [{
el: BI.createWidget(o.body)
}]
} : {
type: "bi.absolute",
items: [{
el: BI.createWidget(o.body),
@ -40677,10 +40923,9 @@ BI.Popover = BI.inherit(BI.Widget, {
bottom: 0
}]
}
}
};
}];
if (o.footer) {
items.south = {
items.push({
el: {
type: "bi.absolute",
items: [{
@ -40689,30 +40934,44 @@ BI.Popover = BI.inherit(BI.Widget, {
top: 0,
right: 20,
bottom: 0
}]
}],
height: 44
},
height: 44
};
});
}
var size = this._calculateSize();
return {
type: "bi.border",
return BI.extend({
type: o.logic.dynamic ? "bi.vertical" : "bi.vtape",
items: items,
width: size.width,
width: size.width
}, o.logic.dynamic ? {
type: "bi.vertical",
scrolly: false
} : {
type: "bi.vtape",
height: size.height
};
});
},
mounted: function () {
var self = this;
var self = this, o = this.options;
this.dragger.element.mousedown(function (e) {
var pos = self.element.offset();
self.startX = pos.left;
self.startY = pos.top;
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.css({
"min-height": compareHeight,
"max-height": compareHeight
});
}
},
_calculateSize: function () {
@ -81819,14 +82078,22 @@ BI.shortcut("bi.value_chooser_pane", BI.ValueChooserPane);;(function () {
navigate.apply(this, arguments);
BI.defer(function () {
additionFunc();
}, 110);
}, 200);
}
var back = window.history.back;
window.history.back = function () {
back.apply(this, arguments);
BI.defer(function () {
additionFunc();
}, 110);
}, 200);
}
}
if (BI.Router) {
var execute = BI.Router.prototype.execute;
BI.Router.prototype.execute = function () {
execute.apply(this, arguments);
additionFunc();
}
}
@ -81896,16 +82163,6 @@ BI.shortcut("bi.value_chooser_pane", BI.ValueChooserPane);;(function () {
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) {
try {
if(obj) {
@ -81919,9 +82176,7 @@ BI.shortcut("bi.value_chooser_pane", BI.ValueChooserPane);;(function () {
}
Fix.del = function (obj, k) {
try {
if(obj) {
obj[k] = undefined;
}
delete obj[k];
} catch (e) {
} finally {

68
dist/bundle.ie.min.js vendored

File diff suppressed because one or more lines are too long

160
dist/bundle.js vendored

@ -19586,7 +19586,7 @@ _.extend(BI, {
if(!_global.navigator) {
return false;
}
return /safari/i.test(navigator.userAgent.toLowerCase());
return /safari/i.test(navigator.userAgent.toLowerCase()) && !/chrome/i.test(navigator.userAgent.toLowerCase());
},
isKhtml: function () {
@ -31244,6 +31244,104 @@ BI.InlineVerticalAdaptLayout = BI.inherit(BI.Layout, {
}
});
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.
*
@ -41143,6 +41241,9 @@ BI.Popover = BI.inherit(BI.Widget, {
// width: 600,
// height: 500,
size: "normal", // small, normal, big
logic: {
dynamic: false
},
header: null,
body: null,
footer: null
@ -41158,16 +41259,15 @@ BI.Popover = BI.inherit(BI.Widget, {
self.startX += deltaX;
self.startY += deltaY;
self.element.css({
left: BI.clamp(self.startX, 0, W - size.width) + "px",
top: BI.clamp(self.startY, 0, H - size.height) + "px"
left: BI.clamp(self.startX, 0, W - self.element.width()) + "px",
top: BI.clamp(self.startY, 0, H - self.element.height()) + "px"
});
// BI-12134 没有什么特别好的方法
BI.Resizers._resize();
}, function () {
self.tracker.releaseMouseMoves();
}, _global);
var items = {
north: {
var items = [{
el: {
type: "bi.htape",
cls: "bi-message-title bi-header-background",
@ -41201,12 +41301,23 @@ BI.Popover = BI.inherit(BI.Widget, {
}
},
width: 56
}]
}],
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: {
el: {
hgap: 20,
tgap: 10,
items: [{
el: BI.createWidget(o.body)
}]
} : {
type: "bi.absolute",
items: [{
el: BI.createWidget(o.body),
@ -41216,10 +41327,9 @@ BI.Popover = BI.inherit(BI.Widget, {
bottom: 0
}]
}
}
};
}];
if (o.footer) {
items.south = {
items.push({
el: {
type: "bi.absolute",
items: [{
@ -41228,30 +41338,44 @@ BI.Popover = BI.inherit(BI.Widget, {
top: 0,
right: 20,
bottom: 0
}]
}],
height: 44
},
height: 44
};
});
}
var size = this._calculateSize();
return {
type: "bi.border",
return BI.extend({
type: o.logic.dynamic ? "bi.vertical" : "bi.vtape",
items: items,
width: size.width,
width: size.width
}, o.logic.dynamic ? {
type: "bi.vertical",
scrolly: false
} : {
type: "bi.vtape",
height: size.height
};
});
},
mounted: function () {
var self = this;
var self = this, o = this.options;
this.dragger.element.mousedown(function (e) {
var pos = self.element.offset();
self.startX = pos.left;
self.startY = pos.top;
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.css({
"min-height": compareHeight,
"max-height": compareHeight
});
}
},
_calculateSize: function () {

68
dist/bundle.min.js vendored

File diff suppressed because one or more lines are too long

98
dist/core.js vendored

@ -31244,6 +31244,104 @@ BI.InlineVerticalAdaptLayout = BI.inherit(BI.Layout, {
}
});
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.
*

83
dist/demo.js vendored

@ -6508,18 +6508,19 @@ Demo.Func = BI.inherit(BI.Widget, {
},
render: function () {
var id = BI.UUID();
var body;
return {
type: "bi.vertical",
vgap: 10,
items: [{
type: "bi.text_button",
text: "点击弹出Popover(normal size)",
text: "点击弹出Popover(normal size & fixed)",
height: 30,
handler: function () {
BI.Popovers.remove(id);
BI.Popovers.create(id, {
type: "bi.bar_popover",
size: "big",
size: "normal",
header: {
type: "bi.label",
text: "这个是header"
@ -6532,7 +6533,7 @@ Demo.Func = BI.inherit(BI.Widget, {
}
}, {
type: "bi.text_button",
text: "点击弹出Popover(small size)",
text: "点击弹出Popover(small size & fixed)",
height: 30,
handler: function () {
BI.Popovers.remove(id);
@ -6551,7 +6552,7 @@ Demo.Func = BI.inherit(BI.Widget, {
}
}, {
type: "bi.text_button",
text: "点击弹出Popover(big size)",
text: "点击弹出Popover(big size & fixed)",
height: 30,
handler: function () {
BI.Popovers.remove(id);
@ -6568,6 +6569,80 @@ Demo.Func = BI.inherit(BI.Widget, {
}
}).open(id);
}
}, {
type: "bi.text_button",
text: "点击弹出Popover(normal size & adapt body区域高度是300)",
height: 30,
handler: function () {
BI.Popovers.remove(id);
BI.Popovers.create(id, {
type: "bi.bar_popover",
size: "normal",
logic: {
dynamic: true
},
header: {
type: "bi.label",
text: "这个是header"
},
body: {
type: "bi.vertical",
items: [{
type: "bi.button_group",
ref: function () {
body = this;
},
items: BI.map(BI.range(0, 10), function () {
return {
type: "bi.label",
text: "1",
height: 30
};
}),
layouts: [{
type: "bi.vertical"
}]
}]
}
}).open(id);
}
}, {
type: "bi.text_button",
text: "点击弹出Popover(small size & adapt body区域高度是900)",
height: 30,
handler: function () {
BI.Popovers.remove(id);
BI.Popovers.create(id, {
type: "bi.bar_popover",
size: "small",
logic: {
dynamic: true
},
header: {
type: "bi.label",
text: "这个是header"
},
body: {
type: "bi.vertical",
items: [{
type: "bi.button_group",
ref: function () {
body = this;
},
items: BI.map(BI.range(0, 30), function () {
return {
type: "bi.label",
text: "1",
height: 30
};
}),
layouts: [{
type: "bi.vertical"
}]
}]
}
}).open(id);
}
}, {
type: "bi.text_button",
text: "点击弹出Popover(custom)",

683
dist/fineui.ie.js vendored

@ -19828,7 +19828,7 @@ _.extend(BI, {
if(!_global.navigator) {
return false;
}
return /safari/i.test(navigator.userAgent.toLowerCase());
return /safari/i.test(navigator.userAgent.toLowerCase()) && !/chrome/i.test(navigator.userAgent.toLowerCase());
},
isKhtml: function () {
@ -31486,6 +31486,104 @@ BI.InlineVerticalAdaptLayout = BI.inherit(BI.Layout, {
}
});
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.
*
@ -34248,6 +34346,45 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
_$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 isNative(Ctor) {
@ -34320,14 +34457,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) {
if (obj === null) return null;
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;
//
@ -34415,19 +34574,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) {
if (typeof sp === "object") {
overrides = sp;
sp = sb;
sb = function sb() {
sb = function temp() {
return sp.apply(this, arguments);
};
}
@ -34442,6 +34593,156 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
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 = {};
function getMixins(type) {
@ -34604,129 +34905,10 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
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 allDefineModelInstances = {};
var emptyFn = function emptyFn() {};
var TTL = 10;
var Watcher = function () {
function Watcher(_ref) {
@ -34734,16 +34916,19 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
last = _ref.last,
listener = _ref.listener,
sync = _ref.sync,
deep = _ref.deep;
deep = _ref.deep,
id = _ref.id;
_classCallCheck(this, Watcher);
this.id = id;
this.get = get;
this.last = cloneShadow(last);
this.listener = listener || emptyFn;
this.sync = sync || false;
return {
id: this.id,
get: this.get,
last: this.last,
listener: this.listener
@ -34767,20 +34952,21 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
}
// state暂不支持func和context
var _loop2 = function _loop2(_key) {
var userDef = state[_key];
var _loop2 = function _loop2(_key2) {
var userDef = state[_key2];
watchers[_key] = new Watcher({
watchers[_key2] = new Watcher({
id: vm._modelHashId + '-' + _key2,
get: function get() {
return vm.model[_key];
return vm.model[_key2];
},
last: userDef,
listener: vm.options.defaultCallback || emptyFn
});
};
for (var _key in state) {
_loop2(_key);
for (var _key2 in state) {
_loop2(_key2);
}
}
@ -34795,6 +34981,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
order.push(key);
watchers[key] = new Watcher({
id: vm._modelHashId + '-' + key,
get: _$1.bind(userDef, context),
last: undefined,
listener: emptyFn
@ -34836,7 +35023,8 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
listener: _$1.bind(cb, vm),
last: getter(),
sync: options.sync,
deep: options.deep
deep: options.deep,
id: options.id
});
}
@ -34881,10 +35069,12 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
while (p) {
if (p.childContext && p.childContext.indexOf(key) > -1) {
p.$watch(key, function (cur, last, p) {
if (!vm.alive) return;
if (!vm._contextWatchers[key]) return;
vm.model[key] = cur;
vm._contextWatchers[key].last = cloneShadow(cur); // 避免重复调用(可以改成给watch添加一个参数保证下次比较一定相同)
vm.$digest();
}, {
id: vm._modelHashId + '-' + key
});
return {
@ -34901,6 +35091,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
if (!context) return;
vm.model[key] = context.p ? context.p.model[key] : undefined;
watchers[key] = new Watcher({
id: context.p._modelHashId + '-' + key,
get: function get() {
return vm.model[key];
},
@ -34914,7 +35105,10 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
}
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);
}
@ -34923,7 +35117,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
_$1.each(vm._stateWatchers, function (watcher, key) {
var cur = watcher.get();
var last = watcher.last;
if (!isEqual(cur, last)) {
if (!isShadowEqual(cur, last)) {
addToListenerQueue(vm, watcher, cur, last);
vm.model[key] = cur;
dirty = true;
@ -34945,7 +35139,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
try {
var cur = watcher.get();
var last = watcher.last;
if (!isEqual(cur, last)) {
if (!isShadowEqual(cur, last)) {
addToListenerQueue(vm, watcher, cur, last);
vm.model[key] = cur;
dirty = true;
@ -34970,8 +35164,11 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
_$1.each(vm._contextWatchers, function (watcher, key) {
var cur = watcher.get();
var last = watcher.last;
if (!isEqual(cur, last)) {
var listener = _$1.bind(watcher.listener, vm, cur, last, vm);
if (!isShadowEqual(cur, last)) {
var listener = {
id: watcher.id,
cb: _$1.bind(watcher.listener, vm, cur, last, vm)
};
vm.contextListeners.push(listener);
vm.model[key] = cur;
dirty = true;
@ -34983,12 +35180,36 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
}
function digest(vm) {
var ttl = 10,
dirty = true;
do {
dirty = digestState(vm) || digestContext(vm) || digestComputed(vm);
} while (dirty && ttl-- >= 0);
var stateDirty = true,
contextDirty = true,
computedDirty = true;
for (var ttl = TTL; stateDirty && ttl > 0; ttl--) {
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) {
var syncListeners = [].concat(vm.syncListeners || []);
@ -35005,9 +35226,12 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
var cur = watcher.get();
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);
@ -35015,21 +35239,25 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
});
_$1.each(syncListeners, function (listener) {
listener();
listener.cb();
});
nextTick(function () {
_$1.each(contextListeners, function (listener) {
listener();
listener.cb();
});
_$1.each(asyncListeners, function (listener) {
if (!vm.alive) return;
listener();
listener.cb();
});
});
}
function refreshAllDefineModel() {
_$1.each(allDefineModelInstances, function (insta) {
insta && insta.$digest && insta.$digest();
});
}
var Model = function () {
function Model(model) {
_classCallCheck(this, Model);
@ -35069,11 +35297,6 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
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() {
this.alive = false;
allModelInstances[this._modelHashId] = null;
@ -35084,10 +35307,24 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
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() {
digest(this);
executeWatchListeners(this);
// 非define创建的model$digest触发所有define定义的model的$digest(未来需要平台去除这些写法))
if (!this.options.define) {
refreshAllDefineModel();
}
};
Model.prototype.getModelID = function getModelID() {
return this._modelHashId;
};
return Model;
@ -35103,24 +35340,18 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
});
}
function toJSON(model) {
var result = void 0;
if (_.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 (!_.has($$skipArray, key)) {
result[key] = toJSON(model[key]);
}
}
} else {
result = model;
function define(model) {
var OB = inherit(Model, {
state: function state() {
return model;
}
return result;
});
var ob = new OB({
define: true
});
allDefineModelInstances[ob.getModelID()] = ob;
return ob.model;
}
var version = '2.0';
@ -35128,12 +35359,14 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
exports.version = version;
exports.$$skipArray = $$skipArray;
exports.mixin = mixin;
exports.toJSON = toJSON;
exports.nextListener = nextListener;
exports.Model = Model;
exports.getAllModelInstances = getAllModelInstances;
exports.refreshAll = refreshAll;
exports.define = define;
exports.inherit = inherit;
exports.watch = watch;
exports.toJSON = toJSON;
exports.__esModule = true;
});/* !
@ -40846,6 +41079,9 @@ BI.Popover = BI.inherit(BI.Widget, {
// width: 600,
// height: 500,
size: "normal", // small, normal, big
logic: {
dynamic: false
},
header: null,
body: null,
footer: null
@ -40861,16 +41097,15 @@ BI.Popover = BI.inherit(BI.Widget, {
self.startX += deltaX;
self.startY += deltaY;
self.element.css({
left: BI.clamp(self.startX, 0, W - size.width) + "px",
top: BI.clamp(self.startY, 0, H - size.height) + "px"
left: BI.clamp(self.startX, 0, W - self.element.width()) + "px",
top: BI.clamp(self.startY, 0, H - self.element.height()) + "px"
});
// BI-12134 没有什么特别好的方法
BI.Resizers._resize();
}, function () {
self.tracker.releaseMouseMoves();
}, _global);
var items = {
north: {
var items = [{
el: {
type: "bi.htape",
cls: "bi-message-title bi-header-background",
@ -40904,12 +41139,23 @@ BI.Popover = BI.inherit(BI.Widget, {
}
},
width: 56
}]
}],
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: {
el: {
hgap: 20,
tgap: 10,
items: [{
el: BI.createWidget(o.body)
}]
} : {
type: "bi.absolute",
items: [{
el: BI.createWidget(o.body),
@ -40919,10 +41165,9 @@ BI.Popover = BI.inherit(BI.Widget, {
bottom: 0
}]
}
}
};
}];
if (o.footer) {
items.south = {
items.push({
el: {
type: "bi.absolute",
items: [{
@ -40931,30 +41176,44 @@ BI.Popover = BI.inherit(BI.Widget, {
top: 0,
right: 20,
bottom: 0
}]
}],
height: 44
},
height: 44
};
});
}
var size = this._calculateSize();
return {
type: "bi.border",
return BI.extend({
type: o.logic.dynamic ? "bi.vertical" : "bi.vtape",
items: items,
width: size.width,
width: size.width
}, o.logic.dynamic ? {
type: "bi.vertical",
scrolly: false
} : {
type: "bi.vtape",
height: size.height
};
});
},
mounted: function () {
var self = this;
var self = this, o = this.options;
this.dragger.element.mousedown(function (e) {
var pos = self.element.offset();
self.startX = pos.left;
self.startY = pos.top;
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.css({
"min-height": compareHeight,
"max-height": compareHeight
});
}
},
_calculateSize: function () {
@ -82645,14 +82904,22 @@ BI.shortcut("bi.value_chooser_pane", BI.ValueChooserPane);(function () {
navigate.apply(this, arguments);
BI.defer(function () {
additionFunc();
}, 110);
}, 200);
}
var back = window.history.back;
window.history.back = function () {
back.apply(this, arguments);
BI.defer(function () {
additionFunc();
}, 110);
}, 200);
}
}
if (BI.Router) {
var execute = BI.Router.prototype.execute;
BI.Router.prototype.execute = function () {
execute.apply(this, arguments);
additionFunc();
}
}
@ -82722,16 +82989,6 @@ BI.shortcut("bi.value_chooser_pane", BI.ValueChooserPane);(function () {
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) {
try {
if(obj) {
@ -82745,9 +83002,7 @@ BI.shortcut("bi.value_chooser_pane", BI.ValueChooserPane);(function () {
}
Fix.del = function (obj, k) {
try {
if(obj) {
obj[k] = undefined;
}
delete obj[k];
} catch (e) {
} finally {

68
dist/fineui.ie.min.js vendored

File diff suppressed because one or more lines are too long

158
dist/fineui.js vendored

@ -31486,6 +31486,104 @@ BI.InlineVerticalAdaptLayout = BI.inherit(BI.Layout, {
}
});
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.
*
@ -41385,6 +41483,9 @@ BI.Popover = BI.inherit(BI.Widget, {
// width: 600,
// height: 500,
size: "normal", // small, normal, big
logic: {
dynamic: false
},
header: null,
body: null,
footer: null
@ -41400,16 +41501,15 @@ BI.Popover = BI.inherit(BI.Widget, {
self.startX += deltaX;
self.startY += deltaY;
self.element.css({
left: BI.clamp(self.startX, 0, W - size.width) + "px",
top: BI.clamp(self.startY, 0, H - size.height) + "px"
left: BI.clamp(self.startX, 0, W - self.element.width()) + "px",
top: BI.clamp(self.startY, 0, H - self.element.height()) + "px"
});
// BI-12134 没有什么特别好的方法
BI.Resizers._resize();
}, function () {
self.tracker.releaseMouseMoves();
}, _global);
var items = {
north: {
var items = [{
el: {
type: "bi.htape",
cls: "bi-message-title bi-header-background",
@ -41443,12 +41543,23 @@ BI.Popover = BI.inherit(BI.Widget, {
}
},
width: 56
}]
}],
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: {
el: {
hgap: 20,
tgap: 10,
items: [{
el: BI.createWidget(o.body)
}]
} : {
type: "bi.absolute",
items: [{
el: BI.createWidget(o.body),
@ -41458,10 +41569,9 @@ BI.Popover = BI.inherit(BI.Widget, {
bottom: 0
}]
}
}
};
}];
if (o.footer) {
items.south = {
items.push({
el: {
type: "bi.absolute",
items: [{
@ -41470,30 +41580,44 @@ BI.Popover = BI.inherit(BI.Widget, {
top: 0,
right: 20,
bottom: 0
}]
}],
height: 44
},
height: 44
};
});
}
var size = this._calculateSize();
return {
type: "bi.border",
return BI.extend({
type: o.logic.dynamic ? "bi.vertical" : "bi.vtape",
items: items,
width: size.width,
width: size.width
}, o.logic.dynamic ? {
type: "bi.vertical",
scrolly: false
} : {
type: "bi.vtape",
height: size.height
};
});
},
mounted: function () {
var self = this;
var self = this, o = this.options;
this.dragger.element.mousedown(function (e) {
var pos = self.element.offset();
self.startX = pos.left;
self.startY = pos.top;
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.css({
"min-height": compareHeight,
"max-height": compareHeight
});
}
},
_calculateSize: function () {

60
dist/fineui.min.js vendored

File diff suppressed because one or more lines are too long

158
dist/fineui_without_jquery_polyfill.js vendored

@ -20255,6 +20255,104 @@ BI.InlineVerticalAdaptLayout = BI.inherit(BI.Layout, {
}
});
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.
*
@ -29052,6 +29150,9 @@ BI.Popover = BI.inherit(BI.Widget, {
// width: 600,
// height: 500,
size: "normal", // small, normal, big
logic: {
dynamic: false
},
header: null,
body: null,
footer: null
@ -29067,16 +29168,15 @@ BI.Popover = BI.inherit(BI.Widget, {
self.startX += deltaX;
self.startY += deltaY;
self.element.css({
left: BI.clamp(self.startX, 0, W - size.width) + "px",
top: BI.clamp(self.startY, 0, H - size.height) + "px"
left: BI.clamp(self.startX, 0, W - self.element.width()) + "px",
top: BI.clamp(self.startY, 0, H - self.element.height()) + "px"
});
// BI-12134 没有什么特别好的方法
BI.Resizers._resize();
}, function () {
self.tracker.releaseMouseMoves();
}, _global);
var items = {
north: {
var items = [{
el: {
type: "bi.htape",
cls: "bi-message-title bi-header-background",
@ -29110,12 +29210,23 @@ BI.Popover = BI.inherit(BI.Widget, {
}
},
width: 56
}]
}],
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: {
el: {
hgap: 20,
tgap: 10,
items: [{
el: BI.createWidget(o.body)
}]
} : {
type: "bi.absolute",
items: [{
el: BI.createWidget(o.body),
@ -29125,10 +29236,9 @@ BI.Popover = BI.inherit(BI.Widget, {
bottom: 0
}]
}
}
};
}];
if (o.footer) {
items.south = {
items.push({
el: {
type: "bi.absolute",
items: [{
@ -29137,30 +29247,44 @@ BI.Popover = BI.inherit(BI.Widget, {
top: 0,
right: 20,
bottom: 0
}]
}],
height: 44
},
height: 44
};
});
}
var size = this._calculateSize();
return {
type: "bi.border",
return BI.extend({
type: o.logic.dynamic ? "bi.vertical" : "bi.vtape",
items: items,
width: size.width,
width: size.width
}, o.logic.dynamic ? {
type: "bi.vertical",
scrolly: false
} : {
type: "bi.vtape",
height: size.height
};
});
},
mounted: function () {
var self = this;
var self = this, o = this.options;
this.dragger.element.mousedown(function (e) {
var pos = self.element.offset();
self.startX = pos.left;
self.startY = pos.top;
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.css({
"min-height": compareHeight,
"max-height": compareHeight
});
}
},
_calculateSize: function () {

2
dist/utils.min.js vendored

File diff suppressed because one or more lines are too long

62
src/base/layer/layer.popover.js

@ -19,6 +19,9 @@ BI.Popover = BI.inherit(BI.Widget, {
// width: 600,
// height: 500,
size: "normal", // small, normal, big
logic: {
dynamic: false
},
header: null,
body: null,
footer: null
@ -34,16 +37,15 @@ BI.Popover = BI.inherit(BI.Widget, {
self.startX += deltaX;
self.startY += deltaY;
self.element.css({
left: BI.clamp(self.startX, 0, W - size.width) + "px",
top: BI.clamp(self.startY, 0, H - size.height) + "px"
left: BI.clamp(self.startX, 0, W - self.element.width()) + "px",
top: BI.clamp(self.startY, 0, H - self.element.height()) + "px"
});
// BI-12134 没有什么特别好的方法
BI.Resizers._resize();
}, function () {
self.tracker.releaseMouseMoves();
}, _global);
var items = {
north: {
var items = [{
el: {
type: "bi.htape",
cls: "bi-message-title bi-header-background",
@ -77,12 +79,23 @@ BI.Popover = BI.inherit(BI.Widget, {
}
},
width: 56
}]
},
}],
height: this._constant.HEADER_HEIGHT
},
center: {
el: {
height: this._constant.HEADER_HEIGHT
}, {
el: o.logic.dynamic ? {
type: "bi.vertical",
cls: "popover-body",
ref: function () {
self.body = this;
},
hgap: 20,
tgap: 10,
items: [{
el: BI.createWidget(o.body)
}]
} : {
type: "bi.absolute",
items: [{
el: BI.createWidget(o.body),
@ -92,10 +105,9 @@ BI.Popover = BI.inherit(BI.Widget, {
bottom: 0
}]
}
}
};
}];
if (o.footer) {
items.south = {
items.push({
el: {
type: "bi.absolute",
items: [{
@ -104,30 +116,44 @@ BI.Popover = BI.inherit(BI.Widget, {
top: 0,
right: 20,
bottom: 0
}]
}],
height: 44
},
height: 44
};
});
}
var size = this._calculateSize();
return {
type: "bi.border",
return BI.extend({
type: o.logic.dynamic ? "bi.vertical" : "bi.vtape",
items: items,
width: size.width,
width: size.width
}, o.logic.dynamic ? {
type: "bi.vertical",
scrolly: false
} : {
type: "bi.vtape",
height: size.height
};
});
},
mounted: function () {
var self = this;
var self = this, o = this.options;
this.dragger.element.mousedown(function (e) {
var pos = self.element.offset();
self.startX = pos.left;
self.startY = pos.top;
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.css({
"min-height": compareHeight,
"max-height": compareHeight
});
}
},
_calculateSize: function () {

Loading…
Cancel
Save