guy 6 years ago
parent
commit
aba3261fbb
  1. 4
      Gruntfile.js
  2. 14
      demo/js/face.js
  3. 191
      dist/bundle.js
  4. 111
      dist/core.js
  5. 14
      dist/demo.js
  6. 191
      dist/fineui.js
  7. 13
      dist/widget.js
  8. 6
      src/core/wrapper/layout.js
  9. 13
      src/core/wrapper/layout/adapt/adapt.center.js
  10. 13
      src/core/wrapper/layout/adapt/adapt.horizontal.js
  11. 13
      src/core/wrapper/layout/adapt/adapt.vertical.js
  12. 13
      src/core/wrapper/layout/flex/wrapper/flex.wrapper.center.js
  13. 13
      src/core/wrapper/layout/flex/wrapper/flex.wrapper.horizontal.js
  14. 13
      src/core/wrapper/layout/flex/wrapper/flex.wrapper.vertical.center.js
  15. 14
      src/core/wrapper/layout/layout.horizontal.js
  16. 13
      src/core/wrapper/layout/layout.td.js

4
Gruntfile.js

@ -250,7 +250,7 @@ module.exports = function (grunt) {
}, },
watch: { watch: {
scripts: { scripts: {
files: ["src/**/*", "demo/js/**/*.js", "demo/version.js", "demo/config.js", "demo/less/**/*.less"], files: ["src/**/*.js", "src/**/*.less", "demo/js/**/*.js", "demo/version.js", "demo/config.js", "demo/less/**/*.less"],
tasks: ["less", "concat"], tasks: ["less", "concat"],
options: { options: {
spanw: true, spanw: true,
@ -291,7 +291,7 @@ module.exports = function (grunt) {
grunt.loadNpmTasks("grunt-contrib-connect"); grunt.loadNpmTasks("grunt-contrib-connect");
grunt.loadNpmTasks('grunt-contrib-clean'); grunt.loadNpmTasks('grunt-contrib-clean');
var defaultTask = ["clean", "less", "concat", "connect", "watch"]; var defaultTask = ["less", "concat", "connect", "watch"];
grunt.registerTask("default", defaultTask); grunt.registerTask("default", defaultTask);
grunt.registerTask("compile", function () { grunt.registerTask("compile", function () {
grunt.config.set("connect.options.open", false); grunt.config.set("connect.options.open", false);

14
demo/js/face.js

@ -548,20 +548,16 @@ Demo.Face = BI.inherit(BI.Widget, {
return { return {
type: "bi.grid", type: "bi.grid",
items: [[{ items: [[{
column: 0,
row: 0,
el: {
type: "bi.layout"
}
}, {
column: 1,
row: 0,
el: { el: {
type: "bi.vertical", type: "bi.vertical",
cls: "face-config bi-border-left", cls: "face-config bi-border-right",
items: [this._createBaseConfig(), items: [this._createBaseConfig(),
this._createCommonConfig()] this._createCommonConfig()]
} }
}, {
el: {
type: "bi.layout"
}
}]] }]]
}; };
}, },

191
dist/bundle.js vendored

@ -21344,7 +21344,14 @@ _.extend(BI.OB.prototype, {
* *
* @cfg {JSON} options 配置属性 * @cfg {JSON} options 配置属性
*/ */
BI.Widget = BI.inherit(BI.OB, {
!(function () {
var lazy = (typeof document !== "undefined" &&
typeof document.documentMode === "number") ||
(typeof navigator !== "undefined" &&
typeof navigator.userAgent === "string" &&
/\bEdge\/\d/.test(navigator.userAgent));
BI.Widget = BI.inherit(BI.OB, {
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.Widget.superclass._defaultConfig.apply(this), { return BI.extend(BI.Widget.superclass._defaultConfig.apply(this), {
root: false, root: false,
@ -21391,6 +21398,8 @@ BI.Widget = BI.inherit(BI.OB, {
this._initElementHeight(); this._initElementHeight();
this._initVisual(); this._initVisual();
this._initState(); this._initState();
if (this.isVisible()) {
this.rendered = true;
if (this.beforeInit) { if (this.beforeInit) {
this.__asking = true; this.__asking = true;
this.beforeInit(BI.bind(this._render, this)); this.beforeInit(BI.bind(this._render, this));
@ -21400,6 +21409,10 @@ BI.Widget = BI.inherit(BI.OB, {
} else { } else {
this._render(); this._render();
} }
}
if (this._isRoot) {
this._mount();
}
}, },
_render: function () { _render: function () {
@ -21511,7 +21524,7 @@ BI.Widget = BI.inherit(BI.OB, {
_mount: function () { _mount: function () {
var self = this; var self = this;
var isMounted = this._isMounted; var isMounted = this._isMounted;
if (isMounted || !this.isVisible() || this.__asking === true) { if (this._isMounting || isMounted || !this.isVisible() || this.__asking === true) {
return; return;
} }
if (this._isRoot === true) { if (this._isRoot === true) {
@ -21522,15 +21535,30 @@ BI.Widget = BI.inherit(BI.OB, {
if (!isMounted) { if (!isMounted) {
return; return;
} }
this._isMounting = true;
if (!this.rendered) {
if (this.beforeInit) {
this.__asking = true;
this.beforeInit(BI.bind(this._render, this));
if (this.__asking === true) {
this.__async = true;
}
} else {
this._render();
}
}
this.beforeMount && this.beforeMount(); this.beforeMount && this.beforeMount();
this._isMounted = true; this._isMounted = true;
this._mountChildren && this._mountChildren(); !lazy && 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();
}); });
lazy && this._mountChildren && this._mountChildren();
this.mounted && this.mounted(); this.mounted && this.mounted();
this._isMounting = false;
}, },
_mountChildren: null, _mountChildren: null,
@ -21806,7 +21834,9 @@ BI.Widget = BI.inherit(BI.OB, {
this._purgeRef(); this._purgeRef();
this.purgeListeners(); this.purgeListeners();
} }
});(function () { });
})();
(function () {
var kv = {}; var kv = {};
BI.shortcut = function (xtype, cls) { BI.shortcut = function (xtype, cls) {
if (kv[xtype] != null) { if (kv[xtype] != null) {
@ -24339,6 +24369,10 @@ BI.Layout = BI.inherit(BI.Widget, {
} }
}, },
appendFragment: function (frag) {
this.element.append(frag);
},
_mountChildren: function () { _mountChildren: function () {
var self = this; var self = this;
var frag = document.createDocumentFragment(); var frag = document.createDocumentFragment();
@ -24350,7 +24384,7 @@ BI.Layout = BI.inherit(BI.Widget, {
} }
}); });
if (hasChild === true) { if (hasChild === true) {
this.element.append(frag); this.appendFragment(frag);
} }
}, },
@ -30276,20 +30310,9 @@ BI.CenterAdaptLayout = BI.inherit(BI.Layout, {
return td; return td;
}, },
_mountChildren: function () { appendFragment: function (frag) {
var self = this;
var frag = document.createDocumentFragment();
var hasChild = false;
BI.each(this._children, function (i, widget) {
if (widget.element !== self.element) {
frag.appendChild(widget.element[0]);
hasChild = true;
}
});
if (hasChild === true) {
this.$tr.append(frag); this.$tr.append(frag);
this.element.append(this.$table); this.element.append(this.$table);
}
}, },
resize: function () { resize: function () {
@ -30393,20 +30416,9 @@ BI.HorizontalAdaptLayout = BI.inherit(BI.Layout, {
return td; return td;
}, },
_mountChildren: function () { appendFragment: function (frag) {
var self = this;
var frag = document.createDocumentFragment();
var hasChild = false;
BI.each(this._children, function (i, widget) {
if (widget.element !== self.element) {
frag.appendChild(widget.element[0]);
hasChild = true;
}
});
if (hasChild === true) {
this.$tr.append(frag); this.$tr.append(frag);
this.element.append(this.$table); this.element.append(this.$table);
}
}, },
resize: function () { resize: function () {
@ -30683,20 +30695,9 @@ BI.VerticalAdaptLayout = BI.inherit(BI.Layout, {
return td; return td;
}, },
_mountChildren: function () { appendFragment: function (frag) {
var self = this;
var frag = document.createDocumentFragment();
var hasChild = false;
BI.each(this._children, function (i, widget) {
if (widget.element !== self.element) {
frag.appendChild(widget.element[0]);
hasChild = true;
}
});
if (hasChild === true) {
this.$tr.append(frag); this.$tr.append(frag);
this.element.append(this.$table); this.element.append(this.$table);
}
}, },
_getWrapper: function () { _getWrapper: function () {
@ -31277,20 +31278,9 @@ BI.FlexCenterLayout = BI.inherit(BI.Layout, {
return w; return w;
}, },
_mountChildren: function () { appendFragment: function (frag) {
var self = this;
var frag = document.createDocumentFragment();
var hasChild = false;
BI.each(this._children, function (i, widget) {
if (widget.element !== self.element) {
frag.appendChild(widget.element[0]);
hasChild = true;
}
});
if (hasChild === true) {
this.$wrapper.append(frag); this.$wrapper.append(frag);
this.element.append(this.$wrapper); this.element.append(this.$wrapper);
}
}, },
_getWrapper: function () { _getWrapper: function () {
@ -31362,20 +31352,9 @@ BI.FlexHorizontalLayout = BI.inherit(BI.Layout, {
return w; return w;
}, },
_mountChildren: function () { appendFragment: function (frag) {
var self = this;
var frag = document.createDocumentFragment();
var hasChild = false;
BI.each(this._children, function (i, widget) {
if (widget.element !== self.element) {
frag.appendChild(widget.element[0]);
hasChild = true;
}
});
if (hasChild === true) {
this.$wrapper.append(frag); this.$wrapper.append(frag);
this.element.append(this.$wrapper); this.element.append(this.$wrapper);
}
}, },
_getWrapper: function () { _getWrapper: function () {
@ -31447,20 +31426,9 @@ BI.FlexVerticalCenter = BI.inherit(BI.Layout, {
return w; return w;
}, },
_mountChildren: function () { appendFragment: function (frag) {
var self = this;
var frag = document.createDocumentFragment();
var hasChild = false;
BI.each(this._children, function (i, widget) {
if (widget.element !== self.element) {
frag.appendChild(widget.element[0]);
hasChild = true;
}
});
if (hasChild === true) {
this.$wrapper.append(frag); this.$wrapper.append(frag);
this.element.append(this.$wrapper); this.element.append(this.$wrapper);
}
}, },
_getWrapper: function () { _getWrapper: function () {
@ -32590,23 +32558,11 @@ BI.HorizontalLayout = BI.inherit(BI.Layout, {
return td; return td;
}, },
_mountChildren: function () { appendFragment: function (frag) {
var self = this;
var frag = document.createDocumentFragment();
var hasChild = false;
BI.each(this._children, function (i, widget) {
if (widget.element !== self.element) {
frag.appendChild(widget.element[0]);
hasChild = true;
}
});
if (hasChild === true) {
this.$tr.append(frag); this.$tr.append(frag);
this.element.append(this.$table); this.element.append(this.$table);
}
}, },
resize: function () { resize: function () {
// console.log("horizontal layout do not need to resize"); // console.log("horizontal layout do not need to resize");
}, },
@ -33273,20 +33229,9 @@ BI.TdLayout = BI.inherit(BI.Layout, {
return tr; return tr;
}, },
_mountChildren: function () { appendFragment: function (frag) {
var self = this;
var frag = document.createDocumentFragment();
var hasChild = false;
BI.each(this._children, function (i, widget) {
if (widget.element !== self.element) {
frag.appendChild(widget.element[0]);
hasChild = true;
}
});
if (hasChild === true) {
this.$table.append(frag); this.$table.append(frag);
this.element.append(this.$table); this.element.append(this.$table);
}
}, },
resize: function () { resize: function () {
@ -67976,12 +67921,15 @@ BI.MultiSelectLoader = BI.inherit(BI.Widget, {
}, },
value: this.storeValue value: this.storeValue
}); });
BI.createWidget({
type: "bi.vertical", BI.createWidget(BI.extend({
element: this, element: this
items: [this.button_group], }, BI.LogicFactory.createLogic(BI.LogicFactory.createLogicTypeByDirection(BI.Direction.Top), BI.extend({
scrolly: true,
vgap: 5 vgap: 5
}); }, opts.logic, {
items: BI.LogicFactory.createLogicItemsByDirection(BI.Direction.Top, this.button_group)
}))));
this.button_group.on(BI.Controller.EVENT_CHANGE, function () { this.button_group.on(BI.Controller.EVENT_CHANGE, function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
}); });
@ -81324,7 +81272,7 @@ BI.ValueChooserPane = BI.inherit(BI.AbstractValueChooser, {
}); });
BI.ValueChooserPane.EVENT_CHANGE = "ValueChooserPane.EVENT_CHANGE"; BI.ValueChooserPane.EVENT_CHANGE = "ValueChooserPane.EVENT_CHANGE";
BI.shortcut("bi.value_chooser_pane", BI.ValueChooserPane);;(function () { BI.shortcut("bi.value_chooser_pane", BI.ValueChooserPane);;(function () {
function initWatch (vm, watch) { function initWatch(vm, watch) {
vm._watchers || (vm._watchers = []); vm._watchers || (vm._watchers = []);
for (var key in watch) { for (var key in watch) {
var handler = watch[key]; var handler = watch[key];
@ -81338,7 +81286,7 @@ BI.shortcut("bi.value_chooser_pane", BI.ValueChooserPane);;(function () {
} }
} }
function createWatcher (vm, keyOrFn, handler) { function createWatcher(vm, keyOrFn, handler) {
return Fix.watch(vm.model, keyOrFn, _.bind(handler, vm), { return Fix.watch(vm.model, keyOrFn, _.bind(handler, vm), {
store: vm.store store: vm.store
}); });
@ -81347,24 +81295,24 @@ BI.shortcut("bi.value_chooser_pane", BI.ValueChooserPane);;(function () {
var target = null; var target = null;
var targetStack = []; var targetStack = [];
function pushTarget (_target) { function pushTarget(_target) {
if (target) targetStack.push(target); if (target) targetStack.push(target);
Fix.Model.target = target = _target; Fix.Model.target = target = _target;
} }
function popTarget () { function popTarget() {
Fix.Model.target = target = targetStack.pop(); Fix.Model.target = target = targetStack.pop();
} }
var context = null; var context = null;
var contextStack = []; var contextStack = [];
function pushContext (_context) { function pushContext(_context) {
if (context) contextStack.push(context); if (context) contextStack.push(context);
Fix.Model.context = context = _context; Fix.Model.context = context = _context;
} }
function popContext () { function popContext() {
Fix.Model.context = context = contextStack.pop(); Fix.Model.context = context = contextStack.pop();
} }
@ -81385,7 +81333,7 @@ BI.shortcut("bi.value_chooser_pane", BI.ValueChooserPane);;(function () {
}, options); }, options);
}; };
function findStore (widget) { function findStore(widget) {
if (target != null) { if (target != null) {
return target; return target;
} }
@ -81431,12 +81379,11 @@ BI.shortcut("bi.value_chooser_pane", BI.ValueChooserPane);;(function () {
}; };
}); });
var _init = BI.Widget.prototype._init; function createStore() {
BI.Widget.prototype._init = function () {
var self = this;
var needPop = false; var needPop = false;
if (window.Fix && this._store) { if (!this._storeCreated && window.Fix && this._store && this.isVisible()) {
var store = findStore(this.options.context || this.options.element); var store = findStore(this.options.context || this.options.element);
this._storeCreated = true;
if (store) { if (store) {
pushTarget(store); pushTarget(store);
needPop = true; needPop = true;
@ -81453,6 +81400,13 @@ BI.shortcut("bi.value_chooser_pane", BI.ValueChooserPane);;(function () {
} }
needPop = true; needPop = true;
} }
return needPop;
}
var _init = BI.Widget.prototype._init;
BI.Widget.prototype._init = function () {
var self = this;
var needPop = createStore.call(this);
_init.apply(this, arguments); _init.apply(this, arguments);
needPop && popTarget(); needPop && popTarget();
}; };
@ -81491,6 +81445,7 @@ BI.shortcut("bi.value_chooser_pane", BI.ValueChooserPane);;(function () {
_.each(["_mount"], function (name) { _.each(["_mount"], function (name) {
var old = BI.Widget.prototype[name]; var old = BI.Widget.prototype[name];
old && (BI.Widget.prototype[name] = function () { old && (BI.Widget.prototype[name] = function () {
createStore.call(this);
this.store && pushTarget(this.store); this.store && pushTarget(this.store);
var res = old.apply(this, arguments); var res = old.apply(this, arguments);
this.store && popTarget(); this.store && popTarget();

111
dist/core.js vendored

@ -24339,6 +24339,10 @@ BI.Layout = BI.inherit(BI.Widget, {
} }
}, },
appendFragment: function (frag) {
this.element.append(frag);
},
_mountChildren: function () { _mountChildren: function () {
var self = this; var self = this;
var frag = document.createDocumentFragment(); var frag = document.createDocumentFragment();
@ -24350,7 +24354,7 @@ BI.Layout = BI.inherit(BI.Widget, {
} }
}); });
if (hasChild === true) { if (hasChild === true) {
this.element.append(frag); this.appendFragment(frag);
} }
}, },
@ -30276,20 +30280,9 @@ BI.CenterAdaptLayout = BI.inherit(BI.Layout, {
return td; return td;
}, },
_mountChildren: function () { appendFragment: function (frag) {
var self = this;
var frag = document.createDocumentFragment();
var hasChild = false;
BI.each(this._children, function (i, widget) {
if (widget.element !== self.element) {
frag.appendChild(widget.element[0]);
hasChild = true;
}
});
if (hasChild === true) {
this.$tr.append(frag); this.$tr.append(frag);
this.element.append(this.$table); this.element.append(this.$table);
}
}, },
resize: function () { resize: function () {
@ -30393,20 +30386,9 @@ BI.HorizontalAdaptLayout = BI.inherit(BI.Layout, {
return td; return td;
}, },
_mountChildren: function () { appendFragment: function (frag) {
var self = this;
var frag = document.createDocumentFragment();
var hasChild = false;
BI.each(this._children, function (i, widget) {
if (widget.element !== self.element) {
frag.appendChild(widget.element[0]);
hasChild = true;
}
});
if (hasChild === true) {
this.$tr.append(frag); this.$tr.append(frag);
this.element.append(this.$table); this.element.append(this.$table);
}
}, },
resize: function () { resize: function () {
@ -30683,20 +30665,9 @@ BI.VerticalAdaptLayout = BI.inherit(BI.Layout, {
return td; return td;
}, },
_mountChildren: function () { appendFragment: function (frag) {
var self = this;
var frag = document.createDocumentFragment();
var hasChild = false;
BI.each(this._children, function (i, widget) {
if (widget.element !== self.element) {
frag.appendChild(widget.element[0]);
hasChild = true;
}
});
if (hasChild === true) {
this.$tr.append(frag); this.$tr.append(frag);
this.element.append(this.$table); this.element.append(this.$table);
}
}, },
_getWrapper: function () { _getWrapper: function () {
@ -31277,20 +31248,9 @@ BI.FlexCenterLayout = BI.inherit(BI.Layout, {
return w; return w;
}, },
_mountChildren: function () { appendFragment: function (frag) {
var self = this;
var frag = document.createDocumentFragment();
var hasChild = false;
BI.each(this._children, function (i, widget) {
if (widget.element !== self.element) {
frag.appendChild(widget.element[0]);
hasChild = true;
}
});
if (hasChild === true) {
this.$wrapper.append(frag); this.$wrapper.append(frag);
this.element.append(this.$wrapper); this.element.append(this.$wrapper);
}
}, },
_getWrapper: function () { _getWrapper: function () {
@ -31362,20 +31322,9 @@ BI.FlexHorizontalLayout = BI.inherit(BI.Layout, {
return w; return w;
}, },
_mountChildren: function () { appendFragment: function (frag) {
var self = this;
var frag = document.createDocumentFragment();
var hasChild = false;
BI.each(this._children, function (i, widget) {
if (widget.element !== self.element) {
frag.appendChild(widget.element[0]);
hasChild = true;
}
});
if (hasChild === true) {
this.$wrapper.append(frag); this.$wrapper.append(frag);
this.element.append(this.$wrapper); this.element.append(this.$wrapper);
}
}, },
_getWrapper: function () { _getWrapper: function () {
@ -31447,20 +31396,9 @@ BI.FlexVerticalCenter = BI.inherit(BI.Layout, {
return w; return w;
}, },
_mountChildren: function () { appendFragment: function (frag) {
var self = this;
var frag = document.createDocumentFragment();
var hasChild = false;
BI.each(this._children, function (i, widget) {
if (widget.element !== self.element) {
frag.appendChild(widget.element[0]);
hasChild = true;
}
});
if (hasChild === true) {
this.$wrapper.append(frag); this.$wrapper.append(frag);
this.element.append(this.$wrapper); this.element.append(this.$wrapper);
}
}, },
_getWrapper: function () { _getWrapper: function () {
@ -32590,23 +32528,11 @@ BI.HorizontalLayout = BI.inherit(BI.Layout, {
return td; return td;
}, },
_mountChildren: function () { appendFragment: function (frag) {
var self = this;
var frag = document.createDocumentFragment();
var hasChild = false;
BI.each(this._children, function (i, widget) {
if (widget.element !== self.element) {
frag.appendChild(widget.element[0]);
hasChild = true;
}
});
if (hasChild === true) {
this.$tr.append(frag); this.$tr.append(frag);
this.element.append(this.$table); this.element.append(this.$table);
}
}, },
resize: function () { resize: function () {
// console.log("horizontal layout do not need to resize"); // console.log("horizontal layout do not need to resize");
}, },
@ -33273,20 +33199,9 @@ BI.TdLayout = BI.inherit(BI.Layout, {
return tr; return tr;
}, },
_mountChildren: function () { appendFragment: function (frag) {
var self = this;
var frag = document.createDocumentFragment();
var hasChild = false;
BI.each(this._children, function (i, widget) {
if (widget.element !== self.element) {
frag.appendChild(widget.element[0]);
hasChild = true;
}
});
if (hasChild === true) {
this.$table.append(frag); this.$table.append(frag);
this.element.append(this.$table); this.element.append(this.$table);
}
}, },
resize: function () { resize: function () {

14
dist/demo.js vendored

@ -7495,20 +7495,16 @@ BI.shortcut("demo.searcher_view", Demo.Func);Demo.Face = BI.inherit(BI.Widget, {
return { return {
type: "bi.grid", type: "bi.grid",
items: [[{ items: [[{
column: 0,
row: 0,
el: {
type: "bi.layout"
}
}, {
column: 1,
row: 0,
el: { el: {
type: "bi.vertical", type: "bi.vertical",
cls: "face-config bi-border-left", cls: "face-config bi-border-right",
items: [this._createBaseConfig(), items: [this._createBaseConfig(),
this._createCommonConfig()] this._createCommonConfig()]
} }
}, {
el: {
type: "bi.layout"
}
}]] }]]
}; };
}, },

191
dist/fineui.js vendored

@ -21565,7 +21565,14 @@ _.extend(BI.OB.prototype, {
* *
* @cfg {JSON} options 配置属性 * @cfg {JSON} options 配置属性
*/ */
BI.Widget = BI.inherit(BI.OB, {
!(function () {
var lazy = (typeof document !== "undefined" &&
typeof document.documentMode === "number") ||
(typeof navigator !== "undefined" &&
typeof navigator.userAgent === "string" &&
/\bEdge\/\d/.test(navigator.userAgent));
BI.Widget = BI.inherit(BI.OB, {
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.Widget.superclass._defaultConfig.apply(this), { return BI.extend(BI.Widget.superclass._defaultConfig.apply(this), {
root: false, root: false,
@ -21612,6 +21619,8 @@ BI.Widget = BI.inherit(BI.OB, {
this._initElementHeight(); this._initElementHeight();
this._initVisual(); this._initVisual();
this._initState(); this._initState();
if (this.isVisible()) {
this.rendered = true;
if (this.beforeInit) { if (this.beforeInit) {
this.__asking = true; this.__asking = true;
this.beforeInit(BI.bind(this._render, this)); this.beforeInit(BI.bind(this._render, this));
@ -21621,6 +21630,10 @@ BI.Widget = BI.inherit(BI.OB, {
} else { } else {
this._render(); this._render();
} }
}
if (this._isRoot) {
this._mount();
}
}, },
_render: function () { _render: function () {
@ -21732,7 +21745,7 @@ BI.Widget = BI.inherit(BI.OB, {
_mount: function () { _mount: function () {
var self = this; var self = this;
var isMounted = this._isMounted; var isMounted = this._isMounted;
if (isMounted || !this.isVisible() || this.__asking === true) { if (this._isMounting || isMounted || !this.isVisible() || this.__asking === true) {
return; return;
} }
if (this._isRoot === true) { if (this._isRoot === true) {
@ -21743,15 +21756,30 @@ BI.Widget = BI.inherit(BI.OB, {
if (!isMounted) { if (!isMounted) {
return; return;
} }
this._isMounting = true;
if (!this.rendered) {
if (this.beforeInit) {
this.__asking = true;
this.beforeInit(BI.bind(this._render, this));
if (this.__asking === true) {
this.__async = true;
}
} else {
this._render();
}
}
this.beforeMount && this.beforeMount(); this.beforeMount && this.beforeMount();
this._isMounted = true; this._isMounted = true;
this._mountChildren && this._mountChildren(); !lazy && 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();
}); });
lazy && this._mountChildren && this._mountChildren();
this.mounted && this.mounted(); this.mounted && this.mounted();
this._isMounting = false;
}, },
_mountChildren: null, _mountChildren: null,
@ -22027,7 +22055,9 @@ BI.Widget = BI.inherit(BI.OB, {
this._purgeRef(); this._purgeRef();
this.purgeListeners(); this.purgeListeners();
} }
});(function () { });
})();
(function () {
var kv = {}; var kv = {};
BI.shortcut = function (xtype, cls) { BI.shortcut = function (xtype, cls) {
if (kv[xtype] != null) { if (kv[xtype] != null) {
@ -24560,6 +24590,10 @@ BI.Layout = BI.inherit(BI.Widget, {
} }
}, },
appendFragment: function (frag) {
this.element.append(frag);
},
_mountChildren: function () { _mountChildren: function () {
var self = this; var self = this;
var frag = document.createDocumentFragment(); var frag = document.createDocumentFragment();
@ -24571,7 +24605,7 @@ BI.Layout = BI.inherit(BI.Widget, {
} }
}); });
if (hasChild === true) { if (hasChild === true) {
this.element.append(frag); this.appendFragment(frag);
} }
}, },
@ -30497,20 +30531,9 @@ BI.CenterAdaptLayout = BI.inherit(BI.Layout, {
return td; return td;
}, },
_mountChildren: function () { appendFragment: function (frag) {
var self = this;
var frag = document.createDocumentFragment();
var hasChild = false;
BI.each(this._children, function (i, widget) {
if (widget.element !== self.element) {
frag.appendChild(widget.element[0]);
hasChild = true;
}
});
if (hasChild === true) {
this.$tr.append(frag); this.$tr.append(frag);
this.element.append(this.$table); this.element.append(this.$table);
}
}, },
resize: function () { resize: function () {
@ -30614,20 +30637,9 @@ BI.HorizontalAdaptLayout = BI.inherit(BI.Layout, {
return td; return td;
}, },
_mountChildren: function () { appendFragment: function (frag) {
var self = this;
var frag = document.createDocumentFragment();
var hasChild = false;
BI.each(this._children, function (i, widget) {
if (widget.element !== self.element) {
frag.appendChild(widget.element[0]);
hasChild = true;
}
});
if (hasChild === true) {
this.$tr.append(frag); this.$tr.append(frag);
this.element.append(this.$table); this.element.append(this.$table);
}
}, },
resize: function () { resize: function () {
@ -30904,20 +30916,9 @@ BI.VerticalAdaptLayout = BI.inherit(BI.Layout, {
return td; return td;
}, },
_mountChildren: function () { appendFragment: function (frag) {
var self = this;
var frag = document.createDocumentFragment();
var hasChild = false;
BI.each(this._children, function (i, widget) {
if (widget.element !== self.element) {
frag.appendChild(widget.element[0]);
hasChild = true;
}
});
if (hasChild === true) {
this.$tr.append(frag); this.$tr.append(frag);
this.element.append(this.$table); this.element.append(this.$table);
}
}, },
_getWrapper: function () { _getWrapper: function () {
@ -31498,20 +31499,9 @@ BI.FlexCenterLayout = BI.inherit(BI.Layout, {
return w; return w;
}, },
_mountChildren: function () { appendFragment: function (frag) {
var self = this;
var frag = document.createDocumentFragment();
var hasChild = false;
BI.each(this._children, function (i, widget) {
if (widget.element !== self.element) {
frag.appendChild(widget.element[0]);
hasChild = true;
}
});
if (hasChild === true) {
this.$wrapper.append(frag); this.$wrapper.append(frag);
this.element.append(this.$wrapper); this.element.append(this.$wrapper);
}
}, },
_getWrapper: function () { _getWrapper: function () {
@ -31583,20 +31573,9 @@ BI.FlexHorizontalLayout = BI.inherit(BI.Layout, {
return w; return w;
}, },
_mountChildren: function () { appendFragment: function (frag) {
var self = this;
var frag = document.createDocumentFragment();
var hasChild = false;
BI.each(this._children, function (i, widget) {
if (widget.element !== self.element) {
frag.appendChild(widget.element[0]);
hasChild = true;
}
});
if (hasChild === true) {
this.$wrapper.append(frag); this.$wrapper.append(frag);
this.element.append(this.$wrapper); this.element.append(this.$wrapper);
}
}, },
_getWrapper: function () { _getWrapper: function () {
@ -31668,20 +31647,9 @@ BI.FlexVerticalCenter = BI.inherit(BI.Layout, {
return w; return w;
}, },
_mountChildren: function () { appendFragment: function (frag) {
var self = this;
var frag = document.createDocumentFragment();
var hasChild = false;
BI.each(this._children, function (i, widget) {
if (widget.element !== self.element) {
frag.appendChild(widget.element[0]);
hasChild = true;
}
});
if (hasChild === true) {
this.$wrapper.append(frag); this.$wrapper.append(frag);
this.element.append(this.$wrapper); this.element.append(this.$wrapper);
}
}, },
_getWrapper: function () { _getWrapper: function () {
@ -32811,23 +32779,11 @@ BI.HorizontalLayout = BI.inherit(BI.Layout, {
return td; return td;
}, },
_mountChildren: function () { appendFragment: function (frag) {
var self = this;
var frag = document.createDocumentFragment();
var hasChild = false;
BI.each(this._children, function (i, widget) {
if (widget.element !== self.element) {
frag.appendChild(widget.element[0]);
hasChild = true;
}
});
if (hasChild === true) {
this.$tr.append(frag); this.$tr.append(frag);
this.element.append(this.$table); this.element.append(this.$table);
}
}, },
resize: function () { resize: function () {
// console.log("horizontal layout do not need to resize"); // console.log("horizontal layout do not need to resize");
}, },
@ -33494,20 +33450,9 @@ BI.TdLayout = BI.inherit(BI.Layout, {
return tr; return tr;
}, },
_mountChildren: function () { appendFragment: function (frag) {
var self = this;
var frag = document.createDocumentFragment();
var hasChild = false;
BI.each(this._children, function (i, widget) {
if (widget.element !== self.element) {
frag.appendChild(widget.element[0]);
hasChild = true;
}
});
if (hasChild === true) {
this.$table.append(frag); this.$table.append(frag);
this.element.append(this.$table); this.element.append(this.$table);
}
}, },
resize: function () { resize: function () {
@ -68197,12 +68142,15 @@ BI.MultiSelectLoader = BI.inherit(BI.Widget, {
}, },
value: this.storeValue value: this.storeValue
}); });
BI.createWidget({
type: "bi.vertical", BI.createWidget(BI.extend({
element: this, element: this
items: [this.button_group], }, BI.LogicFactory.createLogic(BI.LogicFactory.createLogicTypeByDirection(BI.Direction.Top), BI.extend({
scrolly: true,
vgap: 5 vgap: 5
}); }, opts.logic, {
items: BI.LogicFactory.createLogicItemsByDirection(BI.Direction.Top, this.button_group)
}))));
this.button_group.on(BI.Controller.EVENT_CHANGE, function () { this.button_group.on(BI.Controller.EVENT_CHANGE, function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
}); });
@ -81545,7 +81493,7 @@ BI.ValueChooserPane = BI.inherit(BI.AbstractValueChooser, {
}); });
BI.ValueChooserPane.EVENT_CHANGE = "ValueChooserPane.EVENT_CHANGE"; BI.ValueChooserPane.EVENT_CHANGE = "ValueChooserPane.EVENT_CHANGE";
BI.shortcut("bi.value_chooser_pane", BI.ValueChooserPane);;(function () { BI.shortcut("bi.value_chooser_pane", BI.ValueChooserPane);;(function () {
function initWatch (vm, watch) { function initWatch(vm, watch) {
vm._watchers || (vm._watchers = []); vm._watchers || (vm._watchers = []);
for (var key in watch) { for (var key in watch) {
var handler = watch[key]; var handler = watch[key];
@ -81559,7 +81507,7 @@ BI.shortcut("bi.value_chooser_pane", BI.ValueChooserPane);;(function () {
} }
} }
function createWatcher (vm, keyOrFn, handler) { function createWatcher(vm, keyOrFn, handler) {
return Fix.watch(vm.model, keyOrFn, _.bind(handler, vm), { return Fix.watch(vm.model, keyOrFn, _.bind(handler, vm), {
store: vm.store store: vm.store
}); });
@ -81568,24 +81516,24 @@ BI.shortcut("bi.value_chooser_pane", BI.ValueChooserPane);;(function () {
var target = null; var target = null;
var targetStack = []; var targetStack = [];
function pushTarget (_target) { function pushTarget(_target) {
if (target) targetStack.push(target); if (target) targetStack.push(target);
Fix.Model.target = target = _target; Fix.Model.target = target = _target;
} }
function popTarget () { function popTarget() {
Fix.Model.target = target = targetStack.pop(); Fix.Model.target = target = targetStack.pop();
} }
var context = null; var context = null;
var contextStack = []; var contextStack = [];
function pushContext (_context) { function pushContext(_context) {
if (context) contextStack.push(context); if (context) contextStack.push(context);
Fix.Model.context = context = _context; Fix.Model.context = context = _context;
} }
function popContext () { function popContext() {
Fix.Model.context = context = contextStack.pop(); Fix.Model.context = context = contextStack.pop();
} }
@ -81606,7 +81554,7 @@ BI.shortcut("bi.value_chooser_pane", BI.ValueChooserPane);;(function () {
}, options); }, options);
}; };
function findStore (widget) { function findStore(widget) {
if (target != null) { if (target != null) {
return target; return target;
} }
@ -81652,12 +81600,11 @@ BI.shortcut("bi.value_chooser_pane", BI.ValueChooserPane);;(function () {
}; };
}); });
var _init = BI.Widget.prototype._init; function createStore() {
BI.Widget.prototype._init = function () {
var self = this;
var needPop = false; var needPop = false;
if (window.Fix && this._store) { if (!this._storeCreated && window.Fix && this._store && this.isVisible()) {
var store = findStore(this.options.context || this.options.element); var store = findStore(this.options.context || this.options.element);
this._storeCreated = true;
if (store) { if (store) {
pushTarget(store); pushTarget(store);
needPop = true; needPop = true;
@ -81674,6 +81621,13 @@ BI.shortcut("bi.value_chooser_pane", BI.ValueChooserPane);;(function () {
} }
needPop = true; needPop = true;
} }
return needPop;
}
var _init = BI.Widget.prototype._init;
BI.Widget.prototype._init = function () {
var self = this;
var needPop = createStore.call(this);
_init.apply(this, arguments); _init.apply(this, arguments);
needPop && popTarget(); needPop && popTarget();
}; };
@ -81712,6 +81666,7 @@ BI.shortcut("bi.value_chooser_pane", BI.ValueChooserPane);;(function () {
_.each(["_mount"], function (name) { _.each(["_mount"], function (name) {
var old = BI.Widget.prototype[name]; var old = BI.Widget.prototype[name];
old && (BI.Widget.prototype[name] = function () { old && (BI.Widget.prototype[name] = function () {
createStore.call(this);
this.store && pushTarget(this.store); this.store && pushTarget(this.store);
var res = old.apply(this, arguments); var res = old.apply(this, arguments);
this.store && popTarget(); this.store && popTarget();

13
dist/widget.js vendored

@ -9558,12 +9558,15 @@ BI.MultiSelectLoader = BI.inherit(BI.Widget, {
}, },
value: this.storeValue value: this.storeValue
}); });
BI.createWidget({
type: "bi.vertical", BI.createWidget(BI.extend({
element: this, element: this
items: [this.button_group], }, BI.LogicFactory.createLogic(BI.LogicFactory.createLogicTypeByDirection(BI.Direction.Top), BI.extend({
scrolly: true,
vgap: 5 vgap: 5
}); }, opts.logic, {
items: BI.LogicFactory.createLogicItemsByDirection(BI.Direction.Top, this.button_group)
}))));
this.button_group.on(BI.Controller.EVENT_CHANGE, function () { this.button_group.on(BI.Controller.EVENT_CHANGE, function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
}); });

6
src/core/wrapper/layout.js

@ -63,6 +63,10 @@ BI.Layout = BI.inherit(BI.Widget, {
} }
}, },
appendFragment: function (frag) {
this.element.append(frag);
},
_mountChildren: function () { _mountChildren: function () {
var self = this; var self = this;
var frag = document.createDocumentFragment(); var frag = document.createDocumentFragment();
@ -74,7 +78,7 @@ BI.Layout = BI.inherit(BI.Widget, {
} }
}); });
if (hasChild === true) { if (hasChild === true) {
this.element.append(frag); this.appendFragment(frag);
} }
}, },

13
src/core/wrapper/layout/adapt/adapt.center.js

@ -87,20 +87,9 @@ BI.CenterAdaptLayout = BI.inherit(BI.Layout, {
return td; return td;
}, },
_mountChildren: function () { appendFragment: function (frag) {
var self = this;
var frag = document.createDocumentFragment();
var hasChild = false;
BI.each(this._children, function (i, widget) {
if (widget.element !== self.element) {
frag.appendChild(widget.element[0]);
hasChild = true;
}
});
if (hasChild === true) {
this.$tr.append(frag); this.$tr.append(frag);
this.element.append(this.$table); this.element.append(this.$table);
}
}, },
resize: function () { resize: function () {

13
src/core/wrapper/layout/adapt/adapt.horizontal.js

@ -86,20 +86,9 @@ BI.HorizontalAdaptLayout = BI.inherit(BI.Layout, {
return td; return td;
}, },
_mountChildren: function () { appendFragment: function (frag) {
var self = this;
var frag = document.createDocumentFragment();
var hasChild = false;
BI.each(this._children, function (i, widget) {
if (widget.element !== self.element) {
frag.appendChild(widget.element[0]);
hasChild = true;
}
});
if (hasChild === true) {
this.$tr.append(frag); this.$tr.append(frag);
this.element.append(this.$table); this.element.append(this.$table);
}
}, },
resize: function () { resize: function () {

13
src/core/wrapper/layout/adapt/adapt.vertical.js

@ -87,20 +87,9 @@ BI.VerticalAdaptLayout = BI.inherit(BI.Layout, {
return td; return td;
}, },
_mountChildren: function () { appendFragment: function (frag) {
var self = this;
var frag = document.createDocumentFragment();
var hasChild = false;
BI.each(this._children, function (i, widget) {
if (widget.element !== self.element) {
frag.appendChild(widget.element[0]);
hasChild = true;
}
});
if (hasChild === true) {
this.$tr.append(frag); this.$tr.append(frag);
this.element.append(this.$table); this.element.append(this.$table);
}
}, },
_getWrapper: function () { _getWrapper: function () {

13
src/core/wrapper/layout/flex/wrapper/flex.wrapper.center.js

@ -24,20 +24,9 @@ BI.FlexCenterLayout = BI.inherit(BI.Layout, {
return w; return w;
}, },
_mountChildren: function () { appendFragment: function (frag) {
var self = this;
var frag = document.createDocumentFragment();
var hasChild = false;
BI.each(this._children, function (i, widget) {
if (widget.element !== self.element) {
frag.appendChild(widget.element[0]);
hasChild = true;
}
});
if (hasChild === true) {
this.$wrapper.append(frag); this.$wrapper.append(frag);
this.element.append(this.$wrapper); this.element.append(this.$wrapper);
}
}, },
_getWrapper: function () { _getWrapper: function () {

13
src/core/wrapper/layout/flex/wrapper/flex.wrapper.horizontal.js

@ -54,20 +54,9 @@ BI.FlexHorizontalLayout = BI.inherit(BI.Layout, {
return w; return w;
}, },
_mountChildren: function () { appendFragment: function (frag) {
var self = this;
var frag = document.createDocumentFragment();
var hasChild = false;
BI.each(this._children, function (i, widget) {
if (widget.element !== self.element) {
frag.appendChild(widget.element[0]);
hasChild = true;
}
});
if (hasChild === true) {
this.$wrapper.append(frag); this.$wrapper.append(frag);
this.element.append(this.$wrapper); this.element.append(this.$wrapper);
}
}, },
_getWrapper: function () { _getWrapper: function () {

13
src/core/wrapper/layout/flex/wrapper/flex.wrapper.vertical.center.js

@ -54,20 +54,9 @@ BI.FlexVerticalCenter = BI.inherit(BI.Layout, {
return w; return w;
}, },
_mountChildren: function () { appendFragment: function (frag) {
var self = this;
var frag = document.createDocumentFragment();
var hasChild = false;
BI.each(this._children, function (i, widget) {
if (widget.element !== self.element) {
frag.appendChild(widget.element[0]);
hasChild = true;
}
});
if (hasChild === true) {
this.$wrapper.append(frag); this.$wrapper.append(frag);
this.element.append(this.$wrapper); this.element.append(this.$wrapper);
}
}, },
_getWrapper: function () { _getWrapper: function () {

14
src/core/wrapper/layout/layout.horizontal.js

@ -87,23 +87,11 @@ BI.HorizontalLayout = BI.inherit(BI.Layout, {
return td; return td;
}, },
_mountChildren: function () { appendFragment: function (frag) {
var self = this;
var frag = document.createDocumentFragment();
var hasChild = false;
BI.each(this._children, function (i, widget) {
if (widget.element !== self.element) {
frag.appendChild(widget.element[0]);
hasChild = true;
}
});
if (hasChild === true) {
this.$tr.append(frag); this.$tr.append(frag);
this.element.append(this.$table); this.element.append(this.$table);
}
}, },
resize: function () { resize: function () {
// console.log("horizontal layout do not need to resize"); // console.log("horizontal layout do not need to resize");
}, },

13
src/core/wrapper/layout/layout.td.js

@ -119,20 +119,9 @@ BI.TdLayout = BI.inherit(BI.Layout, {
return tr; return tr;
}, },
_mountChildren: function () { appendFragment: function (frag) {
var self = this;
var frag = document.createDocumentFragment();
var hasChild = false;
BI.each(this._children, function (i, widget) {
if (widget.element !== self.element) {
frag.appendChild(widget.element[0]);
hasChild = true;
}
});
if (hasChild === true) {
this.$table.append(frag); this.$table.append(frag);
this.element.append(this.$table); this.element.append(this.$table);
}
}, },
resize: function () { resize: function () {

Loading…
Cancel
Save