Browse Source

Merge remote-tracking branch 'origin/master'

es6
Young 6 years ago
parent
commit
5f065371a8
  1. 12
      dist/base.js
  2. 112
      dist/bundle.js
  3. 78
      dist/bundle.min.js
  4. 2
      dist/case.js
  5. 63
      dist/core.js
  6. 115
      dist/fineui.js
  7. 78
      dist/fineui.min.js
  8. 104
      dist/fineui_without_jquery_polyfill.js
  9. 4
      dist/fix/fix.compact.js
  10. 31
      dist/fix/fix.js
  11. 3
      dist/polyfill.js
  12. 12
      dist/utils.js
  13. 8
      dist/utils.min.js
  14. 2
      src/base/layer/layer.popover.js
  15. 2
      src/base/list/virtuallist.js
  16. 2
      src/base/single/editor/editor.textarea.js
  17. 2
      src/base/single/icon/icon.js
  18. 4
      src/base/tree/treeview.js
  19. 2
      src/case/colorchooser/colorchooser.trigger.js
  20. 5
      src/core/alias.js
  21. 2
      src/core/controller/controller.resizer.js
  22. 3
      src/core/foundation.js
  23. 2
      src/core/platform/dom/dom.js
  24. 4
      src/core/utils/aspect.js
  25. 41
      src/core/widget.js
  26. 6
      src/core/wrapper/layout.js

12
dist/base.js vendored

@ -1636,10 +1636,10 @@ BI.TreeView = BI.inherit(BI.Pane, {
element: this, element: this,
items: [this.tip] items: [this.tip]
}); });
if(BI.isNotNull(o.value)){ if(BI.isNotNull(o.value)) {
this.setSelectedValue(o.value); this.setSelectedValue(o.value);
} }
if (BI.isIE9Below()) { if (BI.isIE9Below && BI.isIE9Below()) {
this.element.addClass("hack"); this.element.addClass("hack");
} }
}, },
@ -5673,7 +5673,7 @@ BI.Popover = BI.inherit(BI.Widget, {
BI.Resizers._resize(); BI.Resizers._resize();
}, function () { }, function () {
self.tracker.releaseMouseMoves(); self.tracker.releaseMouseMoves();
}, window); }, _global);
var items = { var items = {
north: { north: {
el: { el: {
@ -6390,7 +6390,7 @@ BI.VirtualList = BI.inherit(BI.Widget, {
this.cache[i].destroyed = true; this.cache[i].destroyed = true;
} }
} }
var firstFragment = document.createDocumentFragment(), lastFragment = document.createDocumentFragment(); var firstFragment = BI.Widget._renderEngine.createFragment(), lastFragment = BI.Widget._renderEngine.createFragment();
var currentFragment = firstFragment; var currentFragment = firstFragment;
for (var i = (start < 0 ? 0 : start); i <= end && i <= this.renderedIndex; i++) { for (var i = (start < 0 ? 0 : start); i <= end && i <= this.renderedIndex; i++) {
var index = this.cache[i].index; var index = this.cache[i].index;
@ -8793,7 +8793,7 @@ BI.TextAreaEditor = BI.inherit(BI.Single, {
}, },
left: 0, left: 0,
right: 3, right: 3,
top: 0, top: 6,
bottom: 5 bottom: 5
}] }]
}); });
@ -8936,7 +8936,7 @@ BI.Icon = BI.inherit(BI.Single, {
}, },
_init: function () { _init: function () {
BI.Icon.superclass._init.apply(this, arguments); BI.Icon.superclass._init.apply(this, arguments);
if (BI.isIE9Below()) { if (BI.isIE9Below && BI.isIE9Below()) {
this.element.addClass("hack"); this.element.addClass("hack");
} }
} }

112
dist/bundle.js vendored

@ -16,7 +16,8 @@ if (typeof window !== "undefined") {
} }
if (_global.BI == null) { if (_global.BI == null) {
_global.BI = {prepares: []}; _global.BI = {prepares: []};
} else { }
if(_global.BI.prepares == null) {
_global.BI.prepares = []; _global.BI.prepares = [];
}/** }/**
* @license * @license
@ -11801,29 +11802,28 @@ _.extend(BI.OB.prototype, {
this._parent = parent; this._parent = parent;
}, },
_mount: function () { /**
*
* @param force 是否强制挂载子节点
* @param deep 子节点是否也是按照当前force处理
* @param lifeHook 生命周期钩子触不触发默认触发
* @returns {boolean}
* @private
*/
_mount: function (force, deep, lifeHook) {
var self = this; var self = this;
var isMounted = this._isMounted; if (!force && (this._isMounted || !this.isVisible() || this.__asking === true || !(this._isRoot === true || (this._parent && this._parent._isMounted === true)))) {
if (isMounted || !this.isVisible() || this.__asking === true) { return false;
return;
}
if (this._isRoot === true) {
isMounted = true;
} else if (this._parent && this._parent._isMounted === true) {
isMounted = true;
}
if (!isMounted) {
return;
} }
this.beforeMount && this.beforeMount(); lifeHook !== false && this.beforeMount && this.beforeMount();
this._isMounted = true; this._isMounted = true;
this._mountChildren && this._mountChildren(); this._mountChildren && this._mountChildren();
BI.each(this._children, function (i, widget) { BI.each(this._children, function (i, widget) {
!self.isEnabled() && widget._setEnable(false); !self.isEnabled() && widget._setEnable(false);
!self.isValid() && widget._setValid(false); !self.isValid() && widget._setValid(false);
widget._mount && widget._mount(); widget._mount && widget._mount(deep ? force : false, deep, lifeHook);
}); });
this.mounted && this.mounted(); lifeHook !== false && this.mounted && this.mounted();
return true; return true;
}, },
@ -12106,7 +12106,7 @@ _.extend(BI.OB.prototype, {
}; };
BI.Widget.registerRenderEngine({ BI.Widget.registerRenderEngine({
createElement: function (widget) { createElement: function (widget) {
if(BI.isWidget(widget)) { if (BI.isWidget(widget)) {
var o = widget.options; var o = widget.options;
if (o.element) { if (o.element) {
return $(o.element); return $(o.element);
@ -12114,8 +12114,18 @@ _.extend(BI.OB.prototype, {
return $(document.createElement(o.tagName)); return $(document.createElement(o.tagName));
} }
return $(widget); return $(widget);
},
createFragment: function () {
return document.createDocumentFragment();
} }
}); });
BI.mount = function (widget, container) {
if (container) {
BI.Widget._renderEngine.createElement(container).append(widget.element);
}
return widget._mount(true, false, false);
};
})();(function () { })();(function () {
var kv = {}; var kv = {};
BI.shortcut = function (xtype, cls) { BI.shortcut = function (xtype, cls) {
@ -12172,7 +12182,7 @@ _.extend(BI.OB.prototype, {
throw new Error("无法根据item创建组件"); throw new Error("无法根据item创建组件");
}; };
})();(function (window, undefined) { })();!(function () {
function aspect (type) { function aspect (type) {
return function (target, methodName, advice) { return function (target, methodName, advice) {
var exist = target[methodName], var exist = target[methodName],
@ -12234,7 +12244,7 @@ _.extend(BI.OB.prototype, {
return BI.aspect; return BI.aspect;
})(window); })();
!(function () { !(function () {
var _keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; var _keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
@ -14700,7 +14710,7 @@ BI.Layout = BI.inherit(BI.Widget, {
_mountChildren: function () { _mountChildren: function () {
var self = this; var self = this;
var frag = document.createDocumentFragment(); var frag = BI.Widget._renderEngine.createFragment();
var hasChild = false; var hasChild = false;
BI.each(this._children, function (i, widget) { BI.each(this._children, function (i, widget) {
if (widget.element !== self.element) { if (widget.element !== self.element) {
@ -14929,7 +14939,7 @@ BI.Layout = BI.inherit(BI.Widget, {
addItems: function (items) { addItems: function (items) {
var self = this, o = this.options; var self = this, o = this.options;
var fragment = document.createDocumentFragment(); var fragment = BI.Widget._renderEngine.createFragment();
var added = []; var added = [];
BI.each(items, function (i, item) { BI.each(items, function (i, item) {
var w = self._addElement(o.items.length, item); var w = self._addElement(o.items.length, item);
@ -14947,7 +14957,7 @@ BI.Layout = BI.inherit(BI.Widget, {
prependItems: function (items) { prependItems: function (items) {
var self = this; var self = this;
items = items || []; items = items || [];
var fragment = document.createDocumentFragment(); var fragment = BI.Widget._renderEngine.createFragment();
var added = []; var added = [];
for (var i = items.length - 1; i >= 0; i--) { for (var i = items.length - 1; i >= 0; i--) {
this._addItemAt(0, items[i]); this._addItemAt(0, items[i]);
@ -15941,7 +15951,12 @@ BI.ShowAction = BI.inherit(BI.Action, {
BI.specialCharsMap = BI.specialCharsMap || {}; BI.specialCharsMap = BI.specialCharsMap || {};
url = url || ""; url = url || "";
url = url.replaceAll(BI.keys(BI.specialCharsMap || []).join("|"), function (str) { url = url.replaceAll(BI.keys(BI.specialCharsMap || []).join("|"), function (str) {
switch (str) {
case "\\":
return BI.specialCharsMap["\\\\"] || str;
default:
return BI.specialCharsMap[str] || str; return BI.specialCharsMap[str] || str;
}
}); });
return _global.encodeURIComponent(url); return _global.encodeURIComponent(url);
}; };
@ -16966,7 +16981,7 @@ BI.ResizeController = BI.inherit(BI.Controller, {
self._resize(ev); self._resize(ev);
// } // }
}, 30); }, 30);
BI.Widget._renderEngine.createElement(window).resize(fn); BI.Widget._renderEngine.createElement(_global).resize(fn);
}, },
_resize: function (ev) { _resize: function (ev) {
@ -18491,7 +18506,7 @@ BI.extend(BI.DOM, {
if (BI.isEmpty(doms)) { if (BI.isEmpty(doms)) {
return; return;
} }
var frag = document.createDocumentFragment(); var frag = BI.Widget._renderEngine.createFragment();
BI.each(doms, function (i, dom) { BI.each(doms, function (i, dom) {
dom instanceof BI.Widget && (dom = dom.element); dom instanceof BI.Widget && (dom = dom.element);
dom instanceof $ && dom[0] && frag.appendChild(dom[0]); dom instanceof $ && dom[0] && frag.appendChild(dom[0]);
@ -34938,6 +34953,16 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
return watchers; return watchers;
} }
var mixinInjection = {};
function getMixins(type) {
return mixinInjection[type];
}
function mixin(xtype, cls) {
mixinInjection[xtype] = _.cloneDeep(cls);
}
var computedWatcherOptions = { lazy: true }; var computedWatcherOptions = { lazy: true };
function initState(vm, state) { function initState(vm, state) {
@ -35042,6 +35067,22 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
} }
} }
function initMixins(vm, mixins) {
mixins = mixins || [];
_.each(mixins.reverse(), function (mixinType) {
var mixin$$1 = getMixins(mixinType);
for (var key in mixin$$1) {
if (typeof mixin$$1[key] !== "function") continue;
if (_.has(vm, key)) continue;
vm[key] = _.bind(mixin$$1[key], vm.$$model ? vm.model : vm);
}
});
}
function defineProps(vm, keys) { function defineProps(vm, keys) {
var props = {}; var props = {};
// if (typeof Proxy === 'function') { // if (typeof Proxy === 'function') {
@ -35169,14 +35210,16 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
var watch$$1 = this.watch; var watch$$1 = this.watch;
var actions = this.actions; var actions = this.actions;
var keys = _.keys(this.$$model).concat(_.keys(state)).concat(_.keys(computed)).concat(context || []); var keys = _.keys(this.$$model).concat(_.keys(state)).concat(_.keys(computed)).concat(context || []);
var mixins = this.mixins;
defineProps(this, keys); defineProps(this, keys);
childContext && defineContext(this, childContext); childContext && defineContext(this, childContext);
this.$$model && (this.model.__ob__ = this.$$model.__ob__); this.$$model && (this.model.__ob__ = this.$$model.__ob__);
this._init(); this._init();
initState(this, state); initState(this, state);
initMixins(this, mixins);
initMethods(this, actions);
initComputed(this, computed); initComputed(this, computed);
initWatch(this, watch$$1); initWatch(this, watch$$1);
initMethods(this, actions);
this.created && this.created(); this.created && this.created();
if (this.$$model) { if (this.$$model) {
return this.model; return this.model;
@ -35233,6 +35276,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
exports.define = define; exports.define = define;
exports.version = version; exports.version = version;
exports.$$skipArray = $$skipArray; exports.$$skipArray = $$skipArray;
exports.mixin = mixin;
exports.Model = Model; exports.Model = Model;
exports.observerState = observerState; exports.observerState = observerState;
exports.Observer = Observer; exports.Observer = Observer;
@ -36886,10 +36930,10 @@ BI.TreeView = BI.inherit(BI.Pane, {
element: this, element: this,
items: [this.tip] items: [this.tip]
}); });
if(BI.isNotNull(o.value)){ if(BI.isNotNull(o.value)) {
this.setSelectedValue(o.value); this.setSelectedValue(o.value);
} }
if (BI.isIE9Below()) { if (BI.isIE9Below && BI.isIE9Below()) {
this.element.addClass("hack"); this.element.addClass("hack");
} }
}, },
@ -40923,7 +40967,7 @@ BI.Popover = BI.inherit(BI.Widget, {
BI.Resizers._resize(); BI.Resizers._resize();
}, function () { }, function () {
self.tracker.releaseMouseMoves(); self.tracker.releaseMouseMoves();
}, window); }, _global);
var items = { var items = {
north: { north: {
el: { el: {
@ -41640,7 +41684,7 @@ BI.VirtualList = BI.inherit(BI.Widget, {
this.cache[i].destroyed = true; this.cache[i].destroyed = true;
} }
} }
var firstFragment = document.createDocumentFragment(), lastFragment = document.createDocumentFragment(); var firstFragment = BI.Widget._renderEngine.createFragment(), lastFragment = BI.Widget._renderEngine.createFragment();
var currentFragment = firstFragment; var currentFragment = firstFragment;
for (var i = (start < 0 ? 0 : start); i <= end && i <= this.renderedIndex; i++) { for (var i = (start < 0 ? 0 : start); i <= end && i <= this.renderedIndex; i++) {
var index = this.cache[i].index; var index = this.cache[i].index;
@ -44043,7 +44087,7 @@ BI.TextAreaEditor = BI.inherit(BI.Single, {
}, },
left: 0, left: 0,
right: 3, right: 3,
top: 0, top: 6,
bottom: 5 bottom: 5
}] }]
}); });
@ -44186,7 +44230,7 @@ BI.Icon = BI.inherit(BI.Single, {
}, },
_init: function () { _init: function () {
BI.Icon.superclass._init.apply(this, arguments); BI.Icon.superclass._init.apply(this, arguments);
if (BI.isIE9Below()) { if (BI.isIE9Below && BI.isIE9Below()) {
this.element.addClass("hack"); this.element.addClass("hack");
} }
} }
@ -51267,7 +51311,7 @@ BI.ColorChooserTrigger = BI.inherit(BI.Trigger, {
BI.ColorChooserTrigger.superclass._init.apply(this, arguments); BI.ColorChooserTrigger.superclass._init.apply(this, arguments);
this.colorContainer = BI.createWidget({ this.colorContainer = BI.createWidget({
type: "bi.layout", type: "bi.layout",
cls: "color-chooser-trigger-content" + (BI.isIE9Below() ? " hack" : "") cls: "color-chooser-trigger-content" + (BI.isIE9Below && BI.isIE9Below() ? " hack" : "")
}); });
var down = BI.createWidget({ var down = BI.createWidget({
@ -81490,7 +81534,7 @@ BI.shortcut("bi.value_chooser_pane", BI.ValueChooserPane);;(function () {
function createStore() { function createStore() {
var needPop = false; var needPop = false;
if (window.Fix && this._store) { if (_global.Fix && this._store) {
var store = findStore(this.options.context || this.options.element); var store = findStore(this.options.context || this.options.element);
if (store) { if (store) {
pushTarget(store); pushTarget(store);
@ -81522,7 +81566,7 @@ BI.shortcut("bi.value_chooser_pane", BI.ValueChooserPane);;(function () {
var _render = BI.Widget.prototype._render; var _render = BI.Widget.prototype._render;
BI.Widget.prototype._render = function () { BI.Widget.prototype._render = function () {
var needPop = false; var needPop = false;
if (window.Fix && this._store) { if (_global.Fix && this._store) {
needPop = true; needPop = true;
pushTarget(this.store); pushTarget(this.store);
initWatch(this, this.watch); initWatch(this, this.watch);

78
dist/bundle.min.js vendored

File diff suppressed because one or more lines are too long

2
dist/case.js vendored

@ -2655,7 +2655,7 @@ BI.ColorChooserTrigger = BI.inherit(BI.Trigger, {
BI.ColorChooserTrigger.superclass._init.apply(this, arguments); BI.ColorChooserTrigger.superclass._init.apply(this, arguments);
this.colorContainer = BI.createWidget({ this.colorContainer = BI.createWidget({
type: "bi.layout", type: "bi.layout",
cls: "color-chooser-trigger-content" + (BI.isIE9Below() ? " hack" : "") cls: "color-chooser-trigger-content" + (BI.isIE9Below && BI.isIE9Below() ? " hack" : "")
}); });
var down = BI.createWidget({ var down = BI.createWidget({

63
dist/core.js vendored

@ -16,7 +16,8 @@ if (typeof window !== "undefined") {
} }
if (_global.BI == null) { if (_global.BI == null) {
_global.BI = {prepares: []}; _global.BI = {prepares: []};
} else { }
if(_global.BI.prepares == null) {
_global.BI.prepares = []; _global.BI.prepares = [];
}/** }/**
* @license * @license
@ -11801,29 +11802,28 @@ _.extend(BI.OB.prototype, {
this._parent = parent; this._parent = parent;
}, },
_mount: function () { /**
*
* @param force 是否强制挂载子节点
* @param deep 子节点是否也是按照当前force处理
* @param lifeHook 生命周期钩子触不触发默认触发
* @returns {boolean}
* @private
*/
_mount: function (force, deep, lifeHook) {
var self = this; var self = this;
var isMounted = this._isMounted; if (!force && (this._isMounted || !this.isVisible() || this.__asking === true || !(this._isRoot === true || (this._parent && this._parent._isMounted === true)))) {
if (isMounted || !this.isVisible() || this.__asking === true) { return false;
return;
}
if (this._isRoot === true) {
isMounted = true;
} else if (this._parent && this._parent._isMounted === true) {
isMounted = true;
}
if (!isMounted) {
return;
} }
this.beforeMount && this.beforeMount(); lifeHook !== false && this.beforeMount && this.beforeMount();
this._isMounted = true; this._isMounted = true;
this._mountChildren && this._mountChildren(); this._mountChildren && this._mountChildren();
BI.each(this._children, function (i, widget) { BI.each(this._children, function (i, widget) {
!self.isEnabled() && widget._setEnable(false); !self.isEnabled() && widget._setEnable(false);
!self.isValid() && widget._setValid(false); !self.isValid() && widget._setValid(false);
widget._mount && widget._mount(); widget._mount && widget._mount(deep ? force : false, deep, lifeHook);
}); });
this.mounted && this.mounted(); lifeHook !== false && this.mounted && this.mounted();
return true; return true;
}, },
@ -12106,7 +12106,7 @@ _.extend(BI.OB.prototype, {
}; };
BI.Widget.registerRenderEngine({ BI.Widget.registerRenderEngine({
createElement: function (widget) { createElement: function (widget) {
if(BI.isWidget(widget)) { if (BI.isWidget(widget)) {
var o = widget.options; var o = widget.options;
if (o.element) { if (o.element) {
return $(o.element); return $(o.element);
@ -12114,8 +12114,18 @@ _.extend(BI.OB.prototype, {
return $(document.createElement(o.tagName)); return $(document.createElement(o.tagName));
} }
return $(widget); return $(widget);
},
createFragment: function () {
return document.createDocumentFragment();
} }
}); });
BI.mount = function (widget, container) {
if (container) {
BI.Widget._renderEngine.createElement(container).append(widget.element);
}
return widget._mount(true, false, false);
};
})();(function () { })();(function () {
var kv = {}; var kv = {};
BI.shortcut = function (xtype, cls) { BI.shortcut = function (xtype, cls) {
@ -12172,7 +12182,7 @@ _.extend(BI.OB.prototype, {
throw new Error("无法根据item创建组件"); throw new Error("无法根据item创建组件");
}; };
})();(function (window, undefined) { })();!(function () {
function aspect (type) { function aspect (type) {
return function (target, methodName, advice) { return function (target, methodName, advice) {
var exist = target[methodName], var exist = target[methodName],
@ -12234,7 +12244,7 @@ _.extend(BI.OB.prototype, {
return BI.aspect; return BI.aspect;
})(window); })();
!(function () { !(function () {
var _keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; var _keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
@ -14700,7 +14710,7 @@ BI.Layout = BI.inherit(BI.Widget, {
_mountChildren: function () { _mountChildren: function () {
var self = this; var self = this;
var frag = document.createDocumentFragment(); var frag = BI.Widget._renderEngine.createFragment();
var hasChild = false; var hasChild = false;
BI.each(this._children, function (i, widget) { BI.each(this._children, function (i, widget) {
if (widget.element !== self.element) { if (widget.element !== self.element) {
@ -14929,7 +14939,7 @@ BI.Layout = BI.inherit(BI.Widget, {
addItems: function (items) { addItems: function (items) {
var self = this, o = this.options; var self = this, o = this.options;
var fragment = document.createDocumentFragment(); var fragment = BI.Widget._renderEngine.createFragment();
var added = []; var added = [];
BI.each(items, function (i, item) { BI.each(items, function (i, item) {
var w = self._addElement(o.items.length, item); var w = self._addElement(o.items.length, item);
@ -14947,7 +14957,7 @@ BI.Layout = BI.inherit(BI.Widget, {
prependItems: function (items) { prependItems: function (items) {
var self = this; var self = this;
items = items || []; items = items || [];
var fragment = document.createDocumentFragment(); var fragment = BI.Widget._renderEngine.createFragment();
var added = []; var added = [];
for (var i = items.length - 1; i >= 0; i--) { for (var i = items.length - 1; i >= 0; i--) {
this._addItemAt(0, items[i]); this._addItemAt(0, items[i]);
@ -15941,7 +15951,12 @@ BI.ShowAction = BI.inherit(BI.Action, {
BI.specialCharsMap = BI.specialCharsMap || {}; BI.specialCharsMap = BI.specialCharsMap || {};
url = url || ""; url = url || "";
url = url.replaceAll(BI.keys(BI.specialCharsMap || []).join("|"), function (str) { url = url.replaceAll(BI.keys(BI.specialCharsMap || []).join("|"), function (str) {
switch (str) {
case "\\":
return BI.specialCharsMap["\\\\"] || str;
default:
return BI.specialCharsMap[str] || str; return BI.specialCharsMap[str] || str;
}
}); });
return _global.encodeURIComponent(url); return _global.encodeURIComponent(url);
}; };
@ -16966,7 +16981,7 @@ BI.ResizeController = BI.inherit(BI.Controller, {
self._resize(ev); self._resize(ev);
// } // }
}, 30); }, 30);
BI.Widget._renderEngine.createElement(window).resize(fn); BI.Widget._renderEngine.createElement(_global).resize(fn);
}, },
_resize: function (ev) { _resize: function (ev) {
@ -18491,7 +18506,7 @@ BI.extend(BI.DOM, {
if (BI.isEmpty(doms)) { if (BI.isEmpty(doms)) {
return; return;
} }
var frag = document.createDocumentFragment(); var frag = BI.Widget._renderEngine.createFragment();
BI.each(doms, function (i, dom) { BI.each(doms, function (i, dom) {
dom instanceof BI.Widget && (dom = dom.element); dom instanceof BI.Widget && (dom = dom.element);
dom instanceof $ && dom[0] && frag.appendChild(dom[0]); dom instanceof $ && dom[0] && frag.appendChild(dom[0]);

115
dist/fineui.js vendored

@ -16,7 +16,8 @@ if (typeof window !== "undefined") {
} }
if (_global.BI == null) { if (_global.BI == null) {
_global.BI = {prepares: []}; _global.BI = {prepares: []};
} else { }
if(_global.BI.prepares == null) {
_global.BI.prepares = []; _global.BI.prepares = [];
}// Production steps of ECMA-262, Edition 5, 15.4.4.14 }// Production steps of ECMA-262, Edition 5, 15.4.4.14
// Reference: http://es5.github.io/#x15.4.4.14 // Reference: http://es5.github.io/#x15.4.4.14
@ -257,7 +258,8 @@ if (typeof window !== "undefined") {
} }
if (_global.BI == null) { if (_global.BI == null) {
_global.BI = {prepares: []}; _global.BI = {prepares: []};
} else { }
if(_global.BI.prepares == null) {
_global.BI.prepares = []; _global.BI.prepares = [];
}/** }/**
* @license * @license
@ -12042,29 +12044,28 @@ _.extend(BI.OB.prototype, {
this._parent = parent; this._parent = parent;
}, },
_mount: function () { /**
*
* @param force 是否强制挂载子节点
* @param deep 子节点是否也是按照当前force处理
* @param lifeHook 生命周期钩子触不触发默认触发
* @returns {boolean}
* @private
*/
_mount: function (force, deep, lifeHook) {
var self = this; var self = this;
var isMounted = this._isMounted; if (!force && (this._isMounted || !this.isVisible() || this.__asking === true || !(this._isRoot === true || (this._parent && this._parent._isMounted === true)))) {
if (isMounted || !this.isVisible() || this.__asking === true) { return false;
return;
}
if (this._isRoot === true) {
isMounted = true;
} else if (this._parent && this._parent._isMounted === true) {
isMounted = true;
}
if (!isMounted) {
return;
} }
this.beforeMount && this.beforeMount(); lifeHook !== false && this.beforeMount && this.beforeMount();
this._isMounted = true; this._isMounted = true;
this._mountChildren && this._mountChildren(); this._mountChildren && this._mountChildren();
BI.each(this._children, function (i, widget) { BI.each(this._children, function (i, widget) {
!self.isEnabled() && widget._setEnable(false); !self.isEnabled() && widget._setEnable(false);
!self.isValid() && widget._setValid(false); !self.isValid() && widget._setValid(false);
widget._mount && widget._mount(); widget._mount && widget._mount(deep ? force : false, deep, lifeHook);
}); });
this.mounted && this.mounted(); lifeHook !== false && this.mounted && this.mounted();
return true; return true;
}, },
@ -12347,7 +12348,7 @@ _.extend(BI.OB.prototype, {
}; };
BI.Widget.registerRenderEngine({ BI.Widget.registerRenderEngine({
createElement: function (widget) { createElement: function (widget) {
if(BI.isWidget(widget)) { if (BI.isWidget(widget)) {
var o = widget.options; var o = widget.options;
if (o.element) { if (o.element) {
return $(o.element); return $(o.element);
@ -12355,8 +12356,18 @@ _.extend(BI.OB.prototype, {
return $(document.createElement(o.tagName)); return $(document.createElement(o.tagName));
} }
return $(widget); return $(widget);
},
createFragment: function () {
return document.createDocumentFragment();
} }
}); });
BI.mount = function (widget, container) {
if (container) {
BI.Widget._renderEngine.createElement(container).append(widget.element);
}
return widget._mount(true, false, false);
};
})();(function () { })();(function () {
var kv = {}; var kv = {};
BI.shortcut = function (xtype, cls) { BI.shortcut = function (xtype, cls) {
@ -12413,7 +12424,7 @@ _.extend(BI.OB.prototype, {
throw new Error("无法根据item创建组件"); throw new Error("无法根据item创建组件");
}; };
})();(function (window, undefined) { })();!(function () {
function aspect (type) { function aspect (type) {
return function (target, methodName, advice) { return function (target, methodName, advice) {
var exist = target[methodName], var exist = target[methodName],
@ -12475,7 +12486,7 @@ _.extend(BI.OB.prototype, {
return BI.aspect; return BI.aspect;
})(window); })();
!(function () { !(function () {
var _keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; var _keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
@ -14941,7 +14952,7 @@ BI.Layout = BI.inherit(BI.Widget, {
_mountChildren: function () { _mountChildren: function () {
var self = this; var self = this;
var frag = document.createDocumentFragment(); var frag = BI.Widget._renderEngine.createFragment();
var hasChild = false; var hasChild = false;
BI.each(this._children, function (i, widget) { BI.each(this._children, function (i, widget) {
if (widget.element !== self.element) { if (widget.element !== self.element) {
@ -15170,7 +15181,7 @@ BI.Layout = BI.inherit(BI.Widget, {
addItems: function (items) { addItems: function (items) {
var self = this, o = this.options; var self = this, o = this.options;
var fragment = document.createDocumentFragment(); var fragment = BI.Widget._renderEngine.createFragment();
var added = []; var added = [];
BI.each(items, function (i, item) { BI.each(items, function (i, item) {
var w = self._addElement(o.items.length, item); var w = self._addElement(o.items.length, item);
@ -15188,7 +15199,7 @@ BI.Layout = BI.inherit(BI.Widget, {
prependItems: function (items) { prependItems: function (items) {
var self = this; var self = this;
items = items || []; items = items || [];
var fragment = document.createDocumentFragment(); var fragment = BI.Widget._renderEngine.createFragment();
var added = []; var added = [];
for (var i = items.length - 1; i >= 0; i--) { for (var i = items.length - 1; i >= 0; i--) {
this._addItemAt(0, items[i]); this._addItemAt(0, items[i]);
@ -16182,7 +16193,12 @@ BI.ShowAction = BI.inherit(BI.Action, {
BI.specialCharsMap = BI.specialCharsMap || {}; BI.specialCharsMap = BI.specialCharsMap || {};
url = url || ""; url = url || "";
url = url.replaceAll(BI.keys(BI.specialCharsMap || []).join("|"), function (str) { url = url.replaceAll(BI.keys(BI.specialCharsMap || []).join("|"), function (str) {
switch (str) {
case "\\":
return BI.specialCharsMap["\\\\"] || str;
default:
return BI.specialCharsMap[str] || str; return BI.specialCharsMap[str] || str;
}
}); });
return _global.encodeURIComponent(url); return _global.encodeURIComponent(url);
}; };
@ -17207,7 +17223,7 @@ BI.ResizeController = BI.inherit(BI.Controller, {
self._resize(ev); self._resize(ev);
// } // }
}, 30); }, 30);
BI.Widget._renderEngine.createElement(window).resize(fn); BI.Widget._renderEngine.createElement(_global).resize(fn);
}, },
_resize: function (ev) { _resize: function (ev) {
@ -18732,7 +18748,7 @@ BI.extend(BI.DOM, {
if (BI.isEmpty(doms)) { if (BI.isEmpty(doms)) {
return; return;
} }
var frag = document.createDocumentFragment(); var frag = BI.Widget._renderEngine.createFragment();
BI.each(doms, function (i, dom) { BI.each(doms, function (i, dom) {
dom instanceof BI.Widget && (dom = dom.element); dom instanceof BI.Widget && (dom = dom.element);
dom instanceof $ && dom[0] && frag.appendChild(dom[0]); dom instanceof $ && dom[0] && frag.appendChild(dom[0]);
@ -35179,6 +35195,16 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
return watchers; return watchers;
} }
var mixinInjection = {};
function getMixins(type) {
return mixinInjection[type];
}
function mixin(xtype, cls) {
mixinInjection[xtype] = _.cloneDeep(cls);
}
var computedWatcherOptions = { lazy: true }; var computedWatcherOptions = { lazy: true };
function initState(vm, state) { function initState(vm, state) {
@ -35283,6 +35309,22 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
} }
} }
function initMixins(vm, mixins) {
mixins = mixins || [];
_.each(mixins.reverse(), function (mixinType) {
var mixin$$1 = getMixins(mixinType);
for (var key in mixin$$1) {
if (typeof mixin$$1[key] !== "function") continue;
if (_.has(vm, key)) continue;
vm[key] = _.bind(mixin$$1[key], vm.$$model ? vm.model : vm);
}
});
}
function defineProps(vm, keys) { function defineProps(vm, keys) {
var props = {}; var props = {};
// if (typeof Proxy === 'function') { // if (typeof Proxy === 'function') {
@ -35410,14 +35452,16 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
var watch$$1 = this.watch; var watch$$1 = this.watch;
var actions = this.actions; var actions = this.actions;
var keys = _.keys(this.$$model).concat(_.keys(state)).concat(_.keys(computed)).concat(context || []); var keys = _.keys(this.$$model).concat(_.keys(state)).concat(_.keys(computed)).concat(context || []);
var mixins = this.mixins;
defineProps(this, keys); defineProps(this, keys);
childContext && defineContext(this, childContext); childContext && defineContext(this, childContext);
this.$$model && (this.model.__ob__ = this.$$model.__ob__); this.$$model && (this.model.__ob__ = this.$$model.__ob__);
this._init(); this._init();
initState(this, state); initState(this, state);
initMixins(this, mixins);
initMethods(this, actions);
initComputed(this, computed); initComputed(this, computed);
initWatch(this, watch$$1); initWatch(this, watch$$1);
initMethods(this, actions);
this.created && this.created(); this.created && this.created();
if (this.$$model) { if (this.$$model) {
return this.model; return this.model;
@ -35474,6 +35518,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
exports.define = define; exports.define = define;
exports.version = version; exports.version = version;
exports.$$skipArray = $$skipArray; exports.$$skipArray = $$skipArray;
exports.mixin = mixin;
exports.Model = Model; exports.Model = Model;
exports.observerState = observerState; exports.observerState = observerState;
exports.Observer = Observer; exports.Observer = Observer;
@ -37127,10 +37172,10 @@ BI.TreeView = BI.inherit(BI.Pane, {
element: this, element: this,
items: [this.tip] items: [this.tip]
}); });
if(BI.isNotNull(o.value)){ if(BI.isNotNull(o.value)) {
this.setSelectedValue(o.value); this.setSelectedValue(o.value);
} }
if (BI.isIE9Below()) { if (BI.isIE9Below && BI.isIE9Below()) {
this.element.addClass("hack"); this.element.addClass("hack");
} }
}, },
@ -41164,7 +41209,7 @@ BI.Popover = BI.inherit(BI.Widget, {
BI.Resizers._resize(); BI.Resizers._resize();
}, function () { }, function () {
self.tracker.releaseMouseMoves(); self.tracker.releaseMouseMoves();
}, window); }, _global);
var items = { var items = {
north: { north: {
el: { el: {
@ -41881,7 +41926,7 @@ BI.VirtualList = BI.inherit(BI.Widget, {
this.cache[i].destroyed = true; this.cache[i].destroyed = true;
} }
} }
var firstFragment = document.createDocumentFragment(), lastFragment = document.createDocumentFragment(); var firstFragment = BI.Widget._renderEngine.createFragment(), lastFragment = BI.Widget._renderEngine.createFragment();
var currentFragment = firstFragment; var currentFragment = firstFragment;
for (var i = (start < 0 ? 0 : start); i <= end && i <= this.renderedIndex; i++) { for (var i = (start < 0 ? 0 : start); i <= end && i <= this.renderedIndex; i++) {
var index = this.cache[i].index; var index = this.cache[i].index;
@ -44284,7 +44329,7 @@ BI.TextAreaEditor = BI.inherit(BI.Single, {
}, },
left: 0, left: 0,
right: 3, right: 3,
top: 0, top: 6,
bottom: 5 bottom: 5
}] }]
}); });
@ -44427,7 +44472,7 @@ BI.Icon = BI.inherit(BI.Single, {
}, },
_init: function () { _init: function () {
BI.Icon.superclass._init.apply(this, arguments); BI.Icon.superclass._init.apply(this, arguments);
if (BI.isIE9Below()) { if (BI.isIE9Below && BI.isIE9Below()) {
this.element.addClass("hack"); this.element.addClass("hack");
} }
} }
@ -51508,7 +51553,7 @@ BI.ColorChooserTrigger = BI.inherit(BI.Trigger, {
BI.ColorChooserTrigger.superclass._init.apply(this, arguments); BI.ColorChooserTrigger.superclass._init.apply(this, arguments);
this.colorContainer = BI.createWidget({ this.colorContainer = BI.createWidget({
type: "bi.layout", type: "bi.layout",
cls: "color-chooser-trigger-content" + (BI.isIE9Below() ? " hack" : "") cls: "color-chooser-trigger-content" + (BI.isIE9Below && BI.isIE9Below() ? " hack" : "")
}); });
var down = BI.createWidget({ var down = BI.createWidget({
@ -81731,7 +81776,7 @@ BI.shortcut("bi.value_chooser_pane", BI.ValueChooserPane);;(function () {
function createStore() { function createStore() {
var needPop = false; var needPop = false;
if (window.Fix && this._store) { if (_global.Fix && this._store) {
var store = findStore(this.options.context || this.options.element); var store = findStore(this.options.context || this.options.element);
if (store) { if (store) {
pushTarget(store); pushTarget(store);
@ -81763,7 +81808,7 @@ BI.shortcut("bi.value_chooser_pane", BI.ValueChooserPane);;(function () {
var _render = BI.Widget.prototype._render; var _render = BI.Widget.prototype._render;
BI.Widget.prototype._render = function () { BI.Widget.prototype._render = function () {
var needPop = false; var needPop = false;
if (window.Fix && this._store) { if (_global.Fix && this._store) {
needPop = true; needPop = true;
pushTarget(this.store); pushTarget(this.store);
initWatch(this, this.watch); initWatch(this, this.watch);

78
dist/fineui.min.js vendored

File diff suppressed because one or more lines are too long

104
dist/fineui_without_jquery_polyfill.js vendored

@ -16,7 +16,8 @@ if (typeof window !== "undefined") {
} }
if (_global.BI == null) { if (_global.BI == null) {
_global.BI = {prepares: []}; _global.BI = {prepares: []};
} else { }
if(_global.BI.prepares == null) {
_global.BI.prepares = []; _global.BI.prepares = [];
}/** }/**
* @license * @license
@ -11801,29 +11802,28 @@ _.extend(BI.OB.prototype, {
this._parent = parent; this._parent = parent;
}, },
_mount: function () { /**
*
* @param force 是否强制挂载子节点
* @param deep 子节点是否也是按照当前force处理
* @param lifeHook 生命周期钩子触不触发默认触发
* @returns {boolean}
* @private
*/
_mount: function (force, deep, lifeHook) {
var self = this; var self = this;
var isMounted = this._isMounted; if (!force && (this._isMounted || !this.isVisible() || this.__asking === true || !(this._isRoot === true || (this._parent && this._parent._isMounted === true)))) {
if (isMounted || !this.isVisible() || this.__asking === true) { return false;
return;
}
if (this._isRoot === true) {
isMounted = true;
} else if (this._parent && this._parent._isMounted === true) {
isMounted = true;
}
if (!isMounted) {
return;
} }
this.beforeMount && this.beforeMount(); lifeHook !== false && this.beforeMount && this.beforeMount();
this._isMounted = true; this._isMounted = true;
this._mountChildren && this._mountChildren(); this._mountChildren && this._mountChildren();
BI.each(this._children, function (i, widget) { BI.each(this._children, function (i, widget) {
!self.isEnabled() && widget._setEnable(false); !self.isEnabled() && widget._setEnable(false);
!self.isValid() && widget._setValid(false); !self.isValid() && widget._setValid(false);
widget._mount && widget._mount(); widget._mount && widget._mount(deep ? force : false, deep, lifeHook);
}); });
this.mounted && this.mounted(); lifeHook !== false && this.mounted && this.mounted();
return true; return true;
}, },
@ -12106,7 +12106,7 @@ _.extend(BI.OB.prototype, {
}; };
BI.Widget.registerRenderEngine({ BI.Widget.registerRenderEngine({
createElement: function (widget) { createElement: function (widget) {
if(BI.isWidget(widget)) { if (BI.isWidget(widget)) {
var o = widget.options; var o = widget.options;
if (o.element) { if (o.element) {
return $(o.element); return $(o.element);
@ -12114,8 +12114,18 @@ _.extend(BI.OB.prototype, {
return $(document.createElement(o.tagName)); return $(document.createElement(o.tagName));
} }
return $(widget); return $(widget);
},
createFragment: function () {
return document.createDocumentFragment();
} }
}); });
BI.mount = function (widget, container) {
if (container) {
BI.Widget._renderEngine.createElement(container).append(widget.element);
}
return widget._mount(true, false, false);
};
})();(function () { })();(function () {
var kv = {}; var kv = {};
BI.shortcut = function (xtype, cls) { BI.shortcut = function (xtype, cls) {
@ -12172,7 +12182,7 @@ _.extend(BI.OB.prototype, {
throw new Error("无法根据item创建组件"); throw new Error("无法根据item创建组件");
}; };
})();(function (window, undefined) { })();!(function () {
function aspect (type) { function aspect (type) {
return function (target, methodName, advice) { return function (target, methodName, advice) {
var exist = target[methodName], var exist = target[methodName],
@ -12234,7 +12244,7 @@ _.extend(BI.OB.prototype, {
return BI.aspect; return BI.aspect;
})(window); })();
!(function () { !(function () {
var _keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; var _keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
@ -14446,7 +14456,7 @@ BI.Layout = BI.inherit(BI.Widget, {
_mountChildren: function () { _mountChildren: function () {
var self = this; var self = this;
var frag = document.createDocumentFragment(); var frag = BI.Widget._renderEngine.createFragment();
var hasChild = false; var hasChild = false;
BI.each(this._children, function (i, widget) { BI.each(this._children, function (i, widget) {
if (widget.element !== self.element) { if (widget.element !== self.element) {
@ -14675,7 +14685,7 @@ BI.Layout = BI.inherit(BI.Widget, {
addItems: function (items) { addItems: function (items) {
var self = this, o = this.options; var self = this, o = this.options;
var fragment = document.createDocumentFragment(); var fragment = BI.Widget._renderEngine.createFragment();
var added = []; var added = [];
BI.each(items, function (i, item) { BI.each(items, function (i, item) {
var w = self._addElement(o.items.length, item); var w = self._addElement(o.items.length, item);
@ -14693,7 +14703,7 @@ BI.Layout = BI.inherit(BI.Widget, {
prependItems: function (items) { prependItems: function (items) {
var self = this; var self = this;
items = items || []; items = items || [];
var fragment = document.createDocumentFragment(); var fragment = BI.Widget._renderEngine.createFragment();
var added = []; var added = [];
for (var i = items.length - 1; i >= 0; i--) { for (var i = items.length - 1; i >= 0; i--) {
this._addItemAt(0, items[i]); this._addItemAt(0, items[i]);
@ -15687,7 +15697,12 @@ BI.ShowAction = BI.inherit(BI.Action, {
BI.specialCharsMap = BI.specialCharsMap || {}; BI.specialCharsMap = BI.specialCharsMap || {};
url = url || ""; url = url || "";
url = url.replaceAll(BI.keys(BI.specialCharsMap || []).join("|"), function (str) { url = url.replaceAll(BI.keys(BI.specialCharsMap || []).join("|"), function (str) {
switch (str) {
case "\\":
return BI.specialCharsMap["\\\\"] || str;
default:
return BI.specialCharsMap[str] || str; return BI.specialCharsMap[str] || str;
}
}); });
return _global.encodeURIComponent(url); return _global.encodeURIComponent(url);
}; };
@ -16712,7 +16727,7 @@ BI.ResizeController = BI.inherit(BI.Controller, {
self._resize(ev); self._resize(ev);
// } // }
}, 30); }, 30);
BI.Widget._renderEngine.createElement(window).resize(fn); BI.Widget._renderEngine.createElement(_global).resize(fn);
}, },
_resize: function (ev) { _resize: function (ev) {
@ -23971,6 +23986,16 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
return watchers; return watchers;
} }
var mixinInjection = {};
function getMixins(type) {
return mixinInjection[type];
}
function mixin(xtype, cls) {
mixinInjection[xtype] = _.cloneDeep(cls);
}
var computedWatcherOptions = { lazy: true }; var computedWatcherOptions = { lazy: true };
function initState(vm, state) { function initState(vm, state) {
@ -24075,6 +24100,22 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
} }
} }
function initMixins(vm, mixins) {
mixins = mixins || [];
_.each(mixins.reverse(), function (mixinType) {
var mixin$$1 = getMixins(mixinType);
for (var key in mixin$$1) {
if (typeof mixin$$1[key] !== "function") continue;
if (_.has(vm, key)) continue;
vm[key] = _.bind(mixin$$1[key], vm.$$model ? vm.model : vm);
}
});
}
function defineProps(vm, keys) { function defineProps(vm, keys) {
var props = {}; var props = {};
// if (typeof Proxy === 'function') { // if (typeof Proxy === 'function') {
@ -24202,14 +24243,16 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
var watch$$1 = this.watch; var watch$$1 = this.watch;
var actions = this.actions; var actions = this.actions;
var keys = _.keys(this.$$model).concat(_.keys(state)).concat(_.keys(computed)).concat(context || []); var keys = _.keys(this.$$model).concat(_.keys(state)).concat(_.keys(computed)).concat(context || []);
var mixins = this.mixins;
defineProps(this, keys); defineProps(this, keys);
childContext && defineContext(this, childContext); childContext && defineContext(this, childContext);
this.$$model && (this.model.__ob__ = this.$$model.__ob__); this.$$model && (this.model.__ob__ = this.$$model.__ob__);
this._init(); this._init();
initState(this, state); initState(this, state);
initMixins(this, mixins);
initMethods(this, actions);
initComputed(this, computed); initComputed(this, computed);
initWatch(this, watch$$1); initWatch(this, watch$$1);
initMethods(this, actions);
this.created && this.created(); this.created && this.created();
if (this.$$model) { if (this.$$model) {
return this.model; return this.model;
@ -24266,6 +24309,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
exports.define = define; exports.define = define;
exports.version = version; exports.version = version;
exports.$$skipArray = $$skipArray; exports.$$skipArray = $$skipArray;
exports.mixin = mixin;
exports.Model = Model; exports.Model = Model;
exports.observerState = observerState; exports.observerState = observerState;
exports.Observer = Observer; exports.Observer = Observer;
@ -28855,7 +28899,7 @@ BI.Popover = BI.inherit(BI.Widget, {
BI.Resizers._resize(); BI.Resizers._resize();
}, function () { }, function () {
self.tracker.releaseMouseMoves(); self.tracker.releaseMouseMoves();
}, window); }, _global);
var items = { var items = {
north: { north: {
el: { el: {
@ -29572,7 +29616,7 @@ BI.VirtualList = BI.inherit(BI.Widget, {
this.cache[i].destroyed = true; this.cache[i].destroyed = true;
} }
} }
var firstFragment = document.createDocumentFragment(), lastFragment = document.createDocumentFragment(); var firstFragment = BI.Widget._renderEngine.createFragment(), lastFragment = BI.Widget._renderEngine.createFragment();
var currentFragment = firstFragment; var currentFragment = firstFragment;
for (var i = (start < 0 ? 0 : start); i <= end && i <= this.renderedIndex; i++) { for (var i = (start < 0 ? 0 : start); i <= end && i <= this.renderedIndex; i++) {
var index = this.cache[i].index; var index = this.cache[i].index;
@ -31975,7 +32019,7 @@ BI.TextAreaEditor = BI.inherit(BI.Single, {
}, },
left: 0, left: 0,
right: 3, right: 3,
top: 0, top: 6,
bottom: 5 bottom: 5
}] }]
}); });
@ -32118,7 +32162,7 @@ BI.Icon = BI.inherit(BI.Single, {
}, },
_init: function () { _init: function () {
BI.Icon.superclass._init.apply(this, arguments); BI.Icon.superclass._init.apply(this, arguments);
if (BI.isIE9Below()) { if (BI.isIE9Below && BI.isIE9Below()) {
this.element.addClass("hack"); this.element.addClass("hack");
} }
} }
@ -64618,7 +64662,7 @@ BI.shortcut("bi.value_chooser_pane", BI.ValueChooserPane);;(function () {
function createStore() { function createStore() {
var needPop = false; var needPop = false;
if (window.Fix && this._store) { if (_global.Fix && this._store) {
var store = findStore(this.options.context || this.options.element); var store = findStore(this.options.context || this.options.element);
if (store) { if (store) {
pushTarget(store); pushTarget(store);
@ -64650,7 +64694,7 @@ BI.shortcut("bi.value_chooser_pane", BI.ValueChooserPane);;(function () {
var _render = BI.Widget.prototype._render; var _render = BI.Widget.prototype._render;
BI.Widget.prototype._render = function () { BI.Widget.prototype._render = function () {
var needPop = false; var needPop = false;
if (window.Fix && this._store) { if (_global.Fix && this._store) {
needPop = true; needPop = true;
pushTarget(this.store); pushTarget(this.store);
initWatch(this, this.watch); initWatch(this, this.watch);

4
dist/fix/fix.compact.js vendored

@ -108,7 +108,7 @@
function createStore() { function createStore() {
var needPop = false; var needPop = false;
if (window.Fix && this._store) { if (_global.Fix && this._store) {
var store = findStore(this.options.context || this.options.element); var store = findStore(this.options.context || this.options.element);
if (store) { if (store) {
pushTarget(store); pushTarget(store);
@ -140,7 +140,7 @@
var _render = BI.Widget.prototype._render; var _render = BI.Widget.prototype._render;
BI.Widget.prototype._render = function () { BI.Widget.prototype._render = function () {
var needPop = false; var needPop = false;
if (window.Fix && this._store) { if (_global.Fix && this._store) {
needPop = true; needPop = true;
pushTarget(this.store); pushTarget(this.store);
initWatch(this, this.watch); initWatch(this, this.watch);

31
dist/fix/fix.js vendored

@ -1069,6 +1069,16 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
return watchers; return watchers;
} }
var mixinInjection = {};
function getMixins(type) {
return mixinInjection[type];
}
function mixin(xtype, cls) {
mixinInjection[xtype] = _.cloneDeep(cls);
}
var computedWatcherOptions = { lazy: true }; var computedWatcherOptions = { lazy: true };
function initState(vm, state) { function initState(vm, state) {
@ -1173,6 +1183,22 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
} }
} }
function initMixins(vm, mixins) {
mixins = mixins || [];
_.each(mixins.reverse(), function (mixinType) {
var mixin$$1 = getMixins(mixinType);
for (var key in mixin$$1) {
if (typeof mixin$$1[key] !== "function") continue;
if (_.has(vm, key)) continue;
vm[key] = _.bind(mixin$$1[key], vm.$$model ? vm.model : vm);
}
});
}
function defineProps(vm, keys) { function defineProps(vm, keys) {
var props = {}; var props = {};
// if (typeof Proxy === 'function') { // if (typeof Proxy === 'function') {
@ -1300,14 +1326,16 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
var watch$$1 = this.watch; var watch$$1 = this.watch;
var actions = this.actions; var actions = this.actions;
var keys = _.keys(this.$$model).concat(_.keys(state)).concat(_.keys(computed)).concat(context || []); var keys = _.keys(this.$$model).concat(_.keys(state)).concat(_.keys(computed)).concat(context || []);
var mixins = this.mixins;
defineProps(this, keys); defineProps(this, keys);
childContext && defineContext(this, childContext); childContext && defineContext(this, childContext);
this.$$model && (this.model.__ob__ = this.$$model.__ob__); this.$$model && (this.model.__ob__ = this.$$model.__ob__);
this._init(); this._init();
initState(this, state); initState(this, state);
initMixins(this, mixins);
initMethods(this, actions);
initComputed(this, computed); initComputed(this, computed);
initWatch(this, watch$$1); initWatch(this, watch$$1);
initMethods(this, actions);
this.created && this.created(); this.created && this.created();
if (this.$$model) { if (this.$$model) {
return this.model; return this.model;
@ -1364,6 +1392,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
exports.define = define; exports.define = define;
exports.version = version; exports.version = version;
exports.$$skipArray = $$skipArray; exports.$$skipArray = $$skipArray;
exports.mixin = mixin;
exports.Model = Model; exports.Model = Model;
exports.observerState = observerState; exports.observerState = observerState;
exports.Observer = Observer; exports.Observer = Observer;

3
dist/polyfill.js vendored

@ -16,7 +16,8 @@ if (typeof window !== "undefined") {
} }
if (_global.BI == null) { if (_global.BI == null) {
_global.BI = {prepares: []}; _global.BI = {prepares: []};
} else { }
if(_global.BI.prepares == null) {
_global.BI.prepares = []; _global.BI.prepares = [];
}// Production steps of ECMA-262, Edition 5, 15.4.4.14 }// Production steps of ECMA-262, Edition 5, 15.4.4.14
// Reference: http://es5.github.io/#x15.4.4.14 // Reference: http://es5.github.io/#x15.4.4.14

12
dist/utils.js vendored

@ -16,7 +16,8 @@ if (typeof window !== "undefined") {
} }
if (_global.BI == null) { if (_global.BI == null) {
_global.BI = {prepares: []}; _global.BI = {prepares: []};
} else { }
if(_global.BI.prepares == null) {
_global.BI.prepares = []; _global.BI.prepares = [];
}/** }/**
* @license * @license
@ -13038,7 +13039,12 @@ _.extend(BI.OB.prototype, {
BI.specialCharsMap = BI.specialCharsMap || {}; BI.specialCharsMap = BI.specialCharsMap || {};
url = url || ""; url = url || "";
url = url.replaceAll(BI.keys(BI.specialCharsMap || []).join("|"), function (str) { url = url.replaceAll(BI.keys(BI.specialCharsMap || []).join("|"), function (str) {
switch (str) {
case "\\":
return BI.specialCharsMap["\\\\"] || str;
default:
return BI.specialCharsMap[str] || str; return BI.specialCharsMap[str] || str;
}
}); });
return _global.encodeURIComponent(url); return _global.encodeURIComponent(url);
}; };
@ -13538,7 +13544,7 @@ _.extend(BI.OB.prototype, {
} }
}; };
})(); })();
(function (window, undefined) { !(function () {
function aspect (type) { function aspect (type) {
return function (target, methodName, advice) { return function (target, methodName, advice) {
var exist = target[methodName], var exist = target[methodName],
@ -13600,7 +13606,7 @@ _.extend(BI.OB.prototype, {
return BI.aspect; return BI.aspect;
})(window); })();
!(function () { !(function () {
var _keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; var _keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";

8
dist/utils.min.js vendored

File diff suppressed because one or more lines are too long

2
src/base/layer/layer.popover.js

@ -41,7 +41,7 @@ BI.Popover = BI.inherit(BI.Widget, {
BI.Resizers._resize(); BI.Resizers._resize();
}, function () { }, function () {
self.tracker.releaseMouseMoves(); self.tracker.releaseMouseMoves();
}, window); }, _global);
var items = { var items = {
north: { north: {
el: { el: {

2
src/base/list/virtuallist.js

@ -114,7 +114,7 @@ BI.VirtualList = BI.inherit(BI.Widget, {
this.cache[i].destroyed = true; this.cache[i].destroyed = true;
} }
} }
var firstFragment = document.createDocumentFragment(), lastFragment = document.createDocumentFragment(); var firstFragment = BI.Widget._renderEngine.createFragment(), lastFragment = BI.Widget._renderEngine.createFragment();
var currentFragment = firstFragment; var currentFragment = firstFragment;
for (var i = (start < 0 ? 0 : start); i <= end && i <= this.renderedIndex; i++) { for (var i = (start < 0 ? 0 : start); i <= end && i <= this.renderedIndex; i++) {
var index = this.cache[i].index; var index = this.cache[i].index;

2
src/base/single/editor/editor.textarea.js

@ -32,7 +32,7 @@ BI.TextAreaEditor = BI.inherit(BI.Single, {
}, },
left: 0, left: 0,
right: 3, right: 3,
top: 0, top: 6,
bottom: 5 bottom: 5
}] }]
}); });

2
src/base/single/icon/icon.js

@ -13,7 +13,7 @@ BI.Icon = BI.inherit(BI.Single, {
}, },
_init: function () { _init: function () {
BI.Icon.superclass._init.apply(this, arguments); BI.Icon.superclass._init.apply(this, arguments);
if (BI.isIE9Below()) { if (BI.isIE9Below && BI.isIE9Below()) {
this.element.addClass("hack"); this.element.addClass("hack");
} }
} }

4
src/base/tree/treeview.js

@ -30,10 +30,10 @@ BI.TreeView = BI.inherit(BI.Pane, {
element: this, element: this,
items: [this.tip] items: [this.tip]
}); });
if(BI.isNotNull(o.value)){ if(BI.isNotNull(o.value)) {
this.setSelectedValue(o.value); this.setSelectedValue(o.value);
} }
if (BI.isIE9Below()) { if (BI.isIE9Below && BI.isIE9Below()) {
this.element.addClass("hack"); this.element.addClass("hack");
} }
}, },

2
src/case/colorchooser/colorchooser.trigger.js

@ -19,7 +19,7 @@ BI.ColorChooserTrigger = BI.inherit(BI.Trigger, {
BI.ColorChooserTrigger.superclass._init.apply(this, arguments); BI.ColorChooserTrigger.superclass._init.apply(this, arguments);
this.colorContainer = BI.createWidget({ this.colorContainer = BI.createWidget({
type: "bi.layout", type: "bi.layout",
cls: "color-chooser-trigger-content" + (BI.isIE9Below() ? " hack" : "") cls: "color-chooser-trigger-content" + (BI.isIE9Below && BI.isIE9Below() ? " hack" : "")
}); });
var down = BI.createWidget({ var down = BI.createWidget({

5
src/core/alias.js

@ -589,7 +589,12 @@
BI.specialCharsMap = BI.specialCharsMap || {}; BI.specialCharsMap = BI.specialCharsMap || {};
url = url || ""; url = url || "";
url = url.replaceAll(BI.keys(BI.specialCharsMap || []).join("|"), function (str) { url = url.replaceAll(BI.keys(BI.specialCharsMap || []).join("|"), function (str) {
switch (str) {
case "\\":
return BI.specialCharsMap["\\\\"] || str;
default:
return BI.specialCharsMap[str] || str; return BI.specialCharsMap[str] || str;
}
}); });
return _global.encodeURIComponent(url); return _global.encodeURIComponent(url);
}; };

2
src/core/controller/controller.resizer.js

@ -18,7 +18,7 @@ BI.ResizeController = BI.inherit(BI.Controller, {
self._resize(ev); self._resize(ev);
// } // }
}, 30); }, 30);
BI.Widget._renderEngine.createElement(window).resize(fn); BI.Widget._renderEngine.createElement(_global).resize(fn);
}, },
_resize: function (ev) { _resize: function (ev) {

3
src/core/foundation.js vendored

@ -16,6 +16,7 @@ if (typeof window !== "undefined") {
} }
if (_global.BI == null) { if (_global.BI == null) {
_global.BI = {prepares: []}; _global.BI = {prepares: []};
} else { }
if(_global.BI.prepares == null) {
_global.BI.prepares = []; _global.BI.prepares = [];
} }

2
src/core/platform/dom/dom.js

@ -13,7 +13,7 @@ BI.extend(BI.DOM, {
if (BI.isEmpty(doms)) { if (BI.isEmpty(doms)) {
return; return;
} }
var frag = document.createDocumentFragment(); var frag = BI.Widget._renderEngine.createFragment();
BI.each(doms, function (i, dom) { BI.each(doms, function (i, dom) {
dom instanceof BI.Widget && (dom = dom.element); dom instanceof BI.Widget && (dom = dom.element);
dom instanceof $ && dom[0] && frag.appendChild(dom[0]); dom instanceof $ && dom[0] && frag.appendChild(dom[0]);

4
src/core/utils/aspect.js

@ -1,4 +1,4 @@
(function (window, undefined) { !(function () {
function aspect (type) { function aspect (type) {
return function (target, methodName, advice) { return function (target, methodName, advice) {
var exist = target[methodName], var exist = target[methodName],
@ -60,4 +60,4 @@
return BI.aspect; return BI.aspect;
})(window); })();

41
src/core/widget.js

@ -171,29 +171,28 @@
this._parent = parent; this._parent = parent;
}, },
_mount: function () { /**
*
* @param force 是否强制挂载子节点
* @param deep 子节点是否也是按照当前force处理
* @param lifeHook 生命周期钩子触不触发默认触发
* @returns {boolean}
* @private
*/
_mount: function (force, deep, lifeHook) {
var self = this; var self = this;
var isMounted = this._isMounted; if (!force && (this._isMounted || !this.isVisible() || this.__asking === true || !(this._isRoot === true || (this._parent && this._parent._isMounted === true)))) {
if (isMounted || !this.isVisible() || this.__asking === true) { return false;
return;
}
if (this._isRoot === true) {
isMounted = true;
} else if (this._parent && this._parent._isMounted === true) {
isMounted = true;
} }
if (!isMounted) { lifeHook !== false && this.beforeMount && this.beforeMount();
return;
}
this.beforeMount && this.beforeMount();
this._isMounted = true; this._isMounted = true;
this._mountChildren && this._mountChildren(); this._mountChildren && this._mountChildren();
BI.each(this._children, function (i, widget) { BI.each(this._children, function (i, widget) {
!self.isEnabled() && widget._setEnable(false); !self.isEnabled() && widget._setEnable(false);
!self.isValid() && widget._setValid(false); !self.isValid() && widget._setValid(false);
widget._mount && widget._mount(); widget._mount && widget._mount(deep ? force : false, deep, lifeHook);
}); });
this.mounted && this.mounted(); lifeHook !== false && this.mounted && this.mounted();
return true; return true;
}, },
@ -476,7 +475,7 @@
}; };
BI.Widget.registerRenderEngine({ BI.Widget.registerRenderEngine({
createElement: function (widget) { createElement: function (widget) {
if(BI.isWidget(widget)) { if (BI.isWidget(widget)) {
var o = widget.options; var o = widget.options;
if (o.element) { if (o.element) {
return $(o.element); return $(o.element);
@ -484,6 +483,16 @@
return $(document.createElement(o.tagName)); return $(document.createElement(o.tagName));
} }
return $(widget); return $(widget);
},
createFragment: function () {
return document.createDocumentFragment();
} }
}); });
BI.mount = function (widget, container) {
if (container) {
BI.Widget._renderEngine.createElement(container).append(widget.element);
}
return widget._mount(true, false, false);
};
})(); })();

6
src/core/wrapper/layout.js

@ -69,7 +69,7 @@ BI.Layout = BI.inherit(BI.Widget, {
_mountChildren: function () { _mountChildren: function () {
var self = this; var self = this;
var frag = document.createDocumentFragment(); var frag = BI.Widget._renderEngine.createFragment();
var hasChild = false; var hasChild = false;
BI.each(this._children, function (i, widget) { BI.each(this._children, function (i, widget) {
if (widget.element !== self.element) { if (widget.element !== self.element) {
@ -298,7 +298,7 @@ BI.Layout = BI.inherit(BI.Widget, {
addItems: function (items) { addItems: function (items) {
var self = this, o = this.options; var self = this, o = this.options;
var fragment = document.createDocumentFragment(); var fragment = BI.Widget._renderEngine.createFragment();
var added = []; var added = [];
BI.each(items, function (i, item) { BI.each(items, function (i, item) {
var w = self._addElement(o.items.length, item); var w = self._addElement(o.items.length, item);
@ -316,7 +316,7 @@ BI.Layout = BI.inherit(BI.Widget, {
prependItems: function (items) { prependItems: function (items) {
var self = this; var self = this;
items = items || []; items = items || [];
var fragment = document.createDocumentFragment(); var fragment = BI.Widget._renderEngine.createFragment();
var added = []; var added = [];
for (var i = items.length - 1; i >= 0; i--) { for (var i = items.length - 1; i >= 0; i--) {
this._addItemAt(0, items[i]); this._addItemAt(0, items[i]);

Loading…
Cancel
Save