guy 8 years ago
parent
commit
fba54699af
  1. 6
      Gruntfile.js
  2. 4
      demo.css
  3. 115
      demo.js
  4. 98
      demo/app.js
  5. 3
      demo/css/main.css
  6. 18
      demo/js/main.js
  7. 5
      demo/less/main.less
  8. 3
      demo/version.js
  9. 36
      dist/base.js
  10. 374
      dist/case.js
  11. 207
      dist/core.js
  12. 4
      src/base/collection/collection.js
  13. 4
      src/base/combination/combo.js
  14. 4
      src/base/combination/expander.js
  15. 4
      src/base/combination/group.button.js
  16. 4
      src/base/combination/loader.js
  17. 4
      src/base/combination/navigation.js
  18. 4
      src/base/combination/searcher.js
  19. 4
      src/base/combination/switcher.js
  20. 4
      src/base/combination/tab.js
  21. 140
      src/config.js
  22. 36
      src/core/widget.js
  23. 6
      src/core/wrapper/layout.js
  24. 6
      src/core/wrapper/layout/adapt/adapt.center.js
  25. 6
      src/core/wrapper/layout/adapt/adapt.horizontal.js
  26. 1
      src/core/wrapper/layout/adapt/adapt.leftrightvertical.js
  27. 6
      src/core/wrapper/layout/adapt/adapt.vertical.js
  28. 6
      src/core/wrapper/layout/adapt/inline.center.js

6
Gruntfile.js

@ -61,8 +61,12 @@ module.exports = function (grunt) {
},
demoJs: {
src: ['demo/**/*.js'],
src: ['demo/version.js', 'demo/**/*.js'],
dest: 'demo.js'
},
demoCss: {
src: ['demo/css/**/*.css'],
dest: 'demo.css'
}
},

4
demo.css

@ -1,3 +1,3 @@
.bg1{
background: #00B83F;
.demo-main .bg1 {
background-color: #178cdf;
}

115
demo.js

@ -1,104 +1,31 @@
$(function () {
Demo = {
version: 1.0
};$(function () {
var ref;
var w = BI.createWidget({
type: "bi.float_center_adapt",
items: [{
el: {
type: "bi.layout",
cls: 'bg1',
width: 100,
height: 100
BI.createWidget({
type: "demo.main",
ref: function (_ref) {
console.log(_ref);
ref = _ref;
},
left: 0,
top: 0
}]
element: '#wrapper'
});
var Widget = BI.inherit(BI.Widget, {
// ref.destroy();
});Demo.Main = BI.inherit(BI.Widget, {
props: {
a: {}
},
init: function () {
console.log("init");
},
beforeCreated: function () {
console.log("beforeCreated");
baseCls: "demo-main"
},
render: function () {
console.log("render");
var items = [], header = [], columnSize = [];
var rowCount = 100, columnCount = 100;
for (var i = 0; i < 1; i++) {
header[i] = [];
for (var j = 0; j < columnCount; j++) {
header[i][j] = {
type: "bi.label",
text: "表头" + i + "-" + j
}
columnSize[j] = 100;
}
}
for (var i = 0; i < rowCount; i++) {
items[i] = [];
for (var j = 0; j < columnCount; j++) {
items[i][j] = {
type: "bi.label",
text: (i < 3 ? 0 : i) + "-" + j
}
}
}
var table = BI.createWidget({
type: "bi.resizable_table",
el: {
type: "bi.collection_table",
isNeedMerge: true,
mergeCols: [0, 1],
mergeRule: function (col1, col2) {
return BI.isEqual(col1, col2);
}
},
width: 600,
height: 500,
isResizeAdapt: true,
isNeedResize: true,
isNeedMerge: true,
isNeedFreeze: true,
freezeCols: [0, 1],
columnSize: columnSize,
items: items,
header: header
});
BI.createWidget({
type: "bi.absolute",
element: this,
return {
type: "bi.button_group",
layouts: [{
type: "bi.vertical"
}],
items: [{
el: table,
left: 10,
right: 10,
top: 10,
bottom: 10
type: "bi.button",
text: 1
}]
})
},
created: function () {
console.log("created");
},
mounted: function () {
console.log("mounted");
},
destroyed: function () {
console.log("destroyed")
}
}
});
$.shortcut("t", Widget);
BI.createWidget({
type: "t",
ref: function (_ref) {
console.log(_ref);
ref = _ref;
},
element: '#wrapper'
})
// ref.destroy();
})
$.shortcut("demo.main", Demo.Main);

98
demo/app.js

@ -1,104 +1,12 @@
$(function () {
var ref;
var w = BI.createWidget({
type: "bi.float_center_adapt",
items: [{
el: {
type: "bi.layout",
cls: 'bg1',
width: 100,
height: 100
},
left: 0,
top: 0
}]
});
var Widget = BI.inherit(BI.Widget, {
props: {
a: {}
},
init: function () {
console.log("init");
},
beforeCreated: function () {
console.log("beforeCreated");
},
render: function () {
console.log("render");
var items = [], header = [], columnSize = [];
var rowCount = 100, columnCount = 100;
for (var i = 0; i < 1; i++) {
header[i] = [];
for (var j = 0; j < columnCount; j++) {
header[i][j] = {
type: "bi.label",
text: "表头" + i + "-" + j
}
columnSize[j] = 100;
}
}
for (var i = 0; i < rowCount; i++) {
items[i] = [];
for (var j = 0; j < columnCount; j++) {
items[i][j] = {
type: "bi.label",
text: (i < 3 ? 0 : i) + "-" + j
}
}
}
var table = BI.createWidget({
type: "bi.resizable_table",
el: {
type: "bi.collection_table",
isNeedMerge: true,
mergeCols: [0, 1],
mergeRule: function (col1, col2) {
return BI.isEqual(col1, col2);
}
},
width: 600,
height: 500,
isResizeAdapt: true,
isNeedResize: true,
isNeedMerge: true,
isNeedFreeze: true,
freezeCols: [0, 1],
columnSize: columnSize,
items: items,
header: header
});
BI.createWidget({
type: "bi.absolute",
element: this,
items: [{
el: table,
left: 10,
right: 10,
top: 10,
bottom: 10
}]
})
},
created: function () {
console.log("created");
},
mounted: function () {
console.log("mounted");
},
destroyed: function () {
console.log("destroyed")
}
});
$.shortcut("t", Widget);
BI.createWidget({
type: "t",
type: "demo.main",
ref: function (_ref) {
console.log(_ref);
ref = _ref;
},
element: '#wrapper'
})
});
// ref.destroy();
})
});

3
demo/css/main.css

@ -0,0 +1,3 @@
.demo-main .bg1 {
background-color: #178cdf;
}

18
demo/js/main.js

@ -0,0 +1,18 @@
Demo.Main = BI.inherit(BI.Widget, {
props: {
baseCls: "demo-main"
},
render: function () {
return {
type: "bi.button_group",
layouts: [{
type: "bi.vertical"
}],
items: [{
type: "bi.button",
text: 1
}]
}
}
});
$.shortcut("demo.main", Demo.Main);

5
demo/less/main.less

@ -0,0 +1,5 @@
.demo-main {
& .bg1 {
background-color: #178cdf;
}
}

3
demo/version.js

@ -0,0 +1,3 @@
Demo = {
version: 1.0
};

36
dist/base.js vendored

@ -21435,6 +21435,10 @@ BI.Collection = BI.inherit(BI.Widget, {
}
},
destroyed: function () {
this._debounceRelease = null;
},
_calculateSizeAndPositionData: function () {
var o = this.options;
var cellMetadata = [];
@ -22020,14 +22024,14 @@ BI.Combo = BI.inherit(BI.Widget, {
this._toggle();
},
destroy: function () {
destroyed: function () {
$(document).unbind("mousedown." + this.getName())
.unbind("mousewheel." + this.getName())
.unbind("mouseenter." + this.getName())
.unbind("mousemove." + this.getName())
.unbind("mouseleave." + this.getName());
this.popupView && this.popupView.destroy();
BI.Resizers.remove(this.getName());
BI.Combo.superclass.destroy.apply(this, arguments);
}
});
BI.Combo.EVENT_TRIGGER_CHANGE = "EVENT_TRIGGER_CHANGE";
@ -22298,8 +22302,8 @@ BI.Expander = BI.inherit(BI.Widget, {
return this.popupView && this.popupView.getNodeByValue(value);
},
destroy: function () {
BI.Expander.superclass.destroy.apply(this, arguments);
destroyed: function () {
this.popupView && this.popupView.destroy();
}
});
BI.Expander.EVENT_EXPAND = "EVENT_EXPAND";
@ -22614,10 +22618,6 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
}
});
return node;
},
destroy: function () {
BI.ButtonGroup.superclass.destroy.apply(this, arguments);
}
});
BI.extend(BI.ButtonGroup, {
@ -22984,10 +22984,6 @@ BI.Loader = BI.inherit(BI.Widget, {
BI.each([this.prev, this.next], function (i, ob) {
ob && ob.setVisible(false);
});
},
destroy: function () {
BI.Loader.superclass.destroy.apply(this, arguments);
}
});
BI.Loader.EVENT_CHANGE = "EVENT_CHANGE";
@ -23120,10 +23116,6 @@ BI.Navigation = BI.inherit(BI.Widget, {
empty: function(){
this.layout.deleteAllCard();
this.cardMap = {};
},
destroy: function(){
BI.Navigation.superclass.destroy.apply(this, arguments);
}
});
BI.Navigation.EVENT_CHANGE = "EVENT_CHANGE";
@ -23413,9 +23405,9 @@ BI.Searcher = BI.inherit(BI.Widget, {
this.popupView && this.popupView.empty();
},
destroy: function () {
destroyed: function () {
this.popupView && this.popupView.destroy();
BI.Maskers.remove(this.getName());
BI.Searcher.superclass.destroy.apply(this, arguments);
}
});
BI.Searcher.EVENT_CHANGE = "EVENT_CHANGE";
@ -23685,8 +23677,8 @@ BI.Switcher = BI.inherit(BI.Widget, {
this.popupView && this.popupView.empty();
},
destroy: function () {
BI.Switcher.superclass.destroy.apply(this, arguments);
destroyed: function () {
this.popupView && this.popupView.destroy();
}
});
BI.Switcher.EVENT_EXPAND = "EVENT_EXPAND";
@ -23817,9 +23809,9 @@ BI.Tab = BI.inherit(BI.Widget, {
this.cardMap = {};
},
destroy: function () {
destroyed: function () {
this.layout.deleteAllCard();
this.cardMap = {};
BI.Tab.superclass.destroy.apply(this, arguments);
}
});
BI.Tab.EVENT_CHANGE = "EVENT_CHANGE";

374
dist/case.js vendored

@ -2027,380 +2027,6 @@ BI.ComplexCanvas = BI.inherit(BI.Widget, {
});
$.shortcut("bi.complex_canvas", BI.ComplexCanvas);/**
* 图表控件
* @class BI.CombineChart
* @extends BI.Widget
*/
BI.CombineChart = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.CombineChart.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-combine-chart",
items: [],
xAxis: [{type: "category"}],
yAxis: [{type: "value"}],
types: [[], []],
formatConfig: function(config){return config;}
})
},
_init: function () {
BI.CombineChart.superclass._init.apply(this, arguments);
var self = this, o = this.options;
//图可配置属性
this.CombineChart = BI.createWidget({
type: "bi.chart",
element: this
});
this.CombineChart.on(BI.Chart.EVENT_CHANGE, function (obj) {
self.fireEvent(BI.CombineChart.EVENT_CHANGE, obj);
});
if (BI.isNotEmptyArray(o.items)) {
this.populate(o.items);
}
},
_formatItems: function (items) {
var result = [], self = this, o = this.options;
var yAxisIndex = 0;
BI.each(items, function (i, belongAxisItems) {
var combineItems = BI.ChartCombineFormatItemFactory.combineItems(o.types[i], belongAxisItems);
BI.each(combineItems, function (j, axisItems) {
if (BI.isArray(axisItems)) {
result = BI.concat(result, axisItems);
} else {
result.push(BI.extend(axisItems, {"yAxis": yAxisIndex}));
}
});
if (BI.isNotEmptyArray(combineItems)) {
yAxisIndex++;
}
});
var config = BI.ChartCombineFormatItemFactory.combineConfig();
config.plotOptions.click = function () {
self.fireEvent(BI.CombineChart.EVENT_CHANGE, this.pointOption);
};
return [result, config];
},
setTypes: function (types) {
this.options.types = types || [[]];
},
populate: function (items, types) {
var o = this.options;
if (BI.isNotNull(types)) {
this.setTypes(types);
}
var opts = this._formatItems(items);
BI.extend(opts[1], {
xAxis: o.xAxis,
yAxis: o.yAxis
});
var result = o.formatConfig(opts[1], opts[0]);
this.CombineChart.populate(result[0], result[1]);
},
resize: function () {
this.CombineChart.resize();
},
magnify: function(){
this.CombineChart.magnify();
}
});
BI.CombineChart.EVENT_CHANGE = "EVENT_CHANGE";
$.shortcut('bi.combine_chart', BI.CombineChart);BI.ChartCombineFormatItemFactory = {
combineItems: function (types, items) {
var calItems = BI.values(items);
return BI.map(calItems, function (idx, item) {
return BI.ChartCombineFormatItemFactory.formatItems(types[idx], item);
});
},
formatItems: function (type, items) {
var item = {};
switch (type) {
case BICst.WIDGET.BAR:
case BICst.WIDGET.ACCUMULATE_BAR:
case BICst.WIDGET.COMPARE_BAR:
item = BI.extend({"type": "bar"}, items);
break;
case BICst.WIDGET.BUBBLE:
case BICst.WIDGET.FORCE_BUBBLE:
item = BI.extend({"type": "bubble"}, items);
break;
case BICst.WIDGET.SCATTER:
item = BI.extend({"type": "scatter"}, items);
break;
case BICst.WIDGET.AXIS:
case BICst.WIDGET.ACCUMULATE_AXIS:
case BICst.WIDGET.PERCENT_ACCUMULATE_AXIS:
case BICst.WIDGET.COMPARE_AXIS:
case BICst.WIDGET.FALL_AXIS:
item = BI.extend({"type": "column"}, items);
break;
case BICst.WIDGET.LINE:
item = BI.extend({"type": "line"}, items);
break;
case BICst.WIDGET.AREA:
case BICst.WIDGET.ACCUMULATE_AREA:
case BICst.WIDGET.COMPARE_AREA:
case BICst.WIDGET.RANGE_AREA:
case BICst.WIDGET.PERCENT_ACCUMULATE_AREA:
item = BI.extend({"type": "area"}, items);
break;
case BICst.WIDGET.DONUT:
item = BI.extend({"type": "pie"}, items);
break;
case BICst.WIDGET.RADAR:
case BICst.WIDGET.ACCUMULATE_RADAR:
item = BI.extend({"type": "radar"}, items);
break;
case BICst.WIDGET.PIE:
item = BI.extend({"type": "pie"}, items);
break;
case BICst.WIDGET.DASHBOARD:
item = BI.extend({"type": "gauge"}, items);
break;
case BICst.WIDGET.MAP:
item = BI.extend({"type": "areaMap"}, items);
break;
case BICst.WIDGET.GIS_MAP:
item = BI.extend({"type": "pointMap"}, items);
break;
default:
item = BI.extend({"type": "column"}, items);
break;
}
return item;
},
combineConfig: function () {
return {
"plotOptions": {
"rotatable": false,
"startAngle": 0,
"borderRadius": 0,
"endAngle": 360,
"innerRadius": "0.0%",
"layout": "horizontal",
"hinge": "rgb(101,107,109)",
"dataLabels": {
"style": {fontFamily: "inherit", color: "#808080", fontSize: "12px"},
"formatter": {
"identifier": "${VALUE}",
"valueFormat": this._contentFormat2Decimal,
"seriesFormat": this._contentFormat,
"percentFormat": this._contentFormatPercentage,
"categoryFormat": this._contentFormat,
"XFormat": this._contentFormat2Decimal,
"YFormat": this._contentFormat2Decimal,
"sizeFormat": this._contentFormat2Decimal
},
"align": "outside",
"enabled": false
},
"percentageLabel": {
"formatter": {
"identifier": "${PERCENT}",
"valueFormat": this._contentFormat2Decimal,
"seriesFormat": this._contentFormat,
"percentFormat": this._contentFormatPercentage,
"categoryFormat": this._contentFormat
},
"style": {
"fontFamily": "Microsoft YaHei, Hiragino Sans GB W3", "color": "#808080", "fontSize": "12px"
},
"align": "bottom",
"enabled": true
},
"valueLabel": {
"formatter": {
"identifier": "${SERIES}${VALUE}",
"valueFormat": this._contentFormat2Decimal,
"seriesFormat": this._contentFormat,
"percentFormat": this._contentFormatPercentage,
"categoryFormat": this._contentFormat
},
"backgroundColor": "rgb(255,255,0)",
"style": {
"fontFamily": "Microsoft YaHei, Hiragino Sans GB W3", "color": "#808080", "fontSize": "12px"
},
"align": "inside",
"enabled": true
},
"hingeBackgroundColor": "rgb(220,242,249)",
"seriesLabel": {
"formatter": {
"identifier": "${CATEGORY}",
"valueFormat": this._contentFormat2Decimal,
"seriesFormat": this._contentFormat,
"percentFormat": this._contentFormatPercentage,
"categoryFormat": this._contentFormat
},
"style": {
"fontFamily": "Microsoft YaHei, Hiragino Sans GB W3", "color": "#808080", "fontSize": "12px"
},
"align": "bottom",
"enabled": true
},
"style": "pointer",
"paneBackgroundColor": "rgb(252,252,252)",
"needle": "rgb(229,113,90)",
"large": false,
"connectNulls": false,
"shadow": true,
"curve": false,
"sizeBy": "area",
"tooltip": {
"formatter": {
"identifier": "${SERIES}${X}${Y}${SIZE}{CATEGORY}${SERIES}${VALUE}",
"valueFormat": "function(){return window.FR ? FR.contentFormat(arguments[0], '#.##') : arguments[0];}",
"seriesFormat": this._contentFormat,
"percentFormat": this._contentFormatPercentage,
"categoryFormat": this._contentFormat,
"XFormat": this._contentFormat2Decimal,
"sizeFormat": this._contentFormat2Decimal,
"YFormat": this._contentFormat2Decimal
},
"shared": false,
"padding": 5,
"backgroundColor": "rgba(0,0,0,0.4980392156862745)",
"borderColor": "rgb(0,0,0)",
"shadow": false,
"borderRadius": 2,
"borderWidth": 0,
"follow": false,
"enabled": true,
"animation": true,
style: {
"fontFamily": "Microsoft YaHei, Hiragino Sans GB W3",
"color": "#c4c6c6",
"fontSize": "12px",
"fontWeight": ""
}
},
"maxSize": 80,
"fillColorOpacity": 1.0,
"step": false,
"force": false,
"minSize": 15,
"displayNegative": true,
"categoryGap": "16.0%",
"borderColor": "rgb(255,255,255)",
"borderWidth": 1,
"gap": "22.0%",
"animation": true,
"lineWidth": 2,
bubble: {
"large": false,
"connectNulls": false,
"shadow": true,
"curve": false,
"sizeBy": "area",
"maxSize": 80,
"minSize": 15,
"lineWidth": 0,
"animation": true,
"fillColorOpacity": 0.699999988079071,
"marker": {
"symbol": "circle",
"radius": 28.39695010101295,
"enabled": true
}
}
},
dTools: {
enabled: false,
style: {
fontFamily: "Microsoft YaHei, Hiragino Sans GB W3",
color: "#1a1a1a",
fontSize: "12px"
},
backgroundColor: 'white'
},
dataSheet: {
enabled: false,
"borderColor": "rgb(0,0,0)",
"borderWidth": 1,
"formatter": this._contentFormat2Decimal,
style: {
"fontFamily": "Microsoft YaHei, Hiragino Sans GB W3", "color": "#808080", "fontSize": "12px"
}
},
"borderColor": "rgb(238,238,238)",
"shadow": false,
"legend": {
"borderColor": "rgb(204,204,204)",
"borderRadius": 0,
"shadow": false,
"borderWidth": 0,
"visible": true,
"style": {
"fontFamily": "Microsoft YaHei, Hiragino Sans GB W3", "color": "#1a1a1a", "fontSize": "12px"
},
"position": "right",
"enabled": false
},
"rangeLegend": {
"range": {
"min": 0,
"color": [
[
0,
"rgb(182,226,255)"
],
[
0.5,
"rgb(109,196,255)"
],
[
1,
"rgb(36,167,255)"
]
],
"max": 266393
},
"enabled": false
},
"zoom": {"zoomType": "xy", "zoomTool": {"visible": false, "resize": true, "from": "", "to": ""}},
"plotBorderColor": "rgba(255,255,255,0)",
"tools": {
"hidden": true,
"toImage": {"enabled": true},
"sort": {"enabled": true},
"enabled": false,
"fullScreen": {"enabled": true}
},
"plotBorderWidth": 0,
"colors": ["rgb(99,178,238)", "rgb(118,218,145)"],
"borderRadius": 0,
"borderWidth": 0,
"style": "normal",
"plotShadow": false,
"plotBorderRadius": 0
};
},
_contentFormat: function () {
return BI.contentFormat(arguments[0], '')
},
_contentFormat2Decimal: function () {
return BI.contentFormat(arguments[0], '#.##')
},
_contentFormatPercentage: function () {
return BI.contentFormat(arguments[0], '#.##%')
}
};/**
* Created by roy on 15/10/16.
* 上箭头与下箭头切换的树节点
*/

207
dist/core.js vendored

@ -14205,7 +14205,7 @@ BI.Widget = BI.inherit(BI.OB, {
this._parent = o.element;
this._parent.addWidget(this.widgetName, this);
this.element = this.options.element.element;
} else if (BI.isString(o.element)) {
} else if (o.element) {
this.element = $(o.element);
this._isRoot = true;
} else {
@ -14321,7 +14321,7 @@ BI.Widget = BI.inherit(BI.OB, {
BI.each(this._children, function (i, widget) {
widget._unMount();
});
this._children = [];
this._children = {};
this._parent = null;
this._isMounted = false;
this.destroyed();
@ -14467,6 +14467,38 @@ BI.Widget = BI.inherit(BI.OB, {
return !this.options.invisible;
},
disable: function () {
this.setEnable(false);
},
enable: function () {
this.setEnable(true);
},
valid: function () {
this.setValid(true);
},
invalid: function () {
this.setValid(false);
},
invisible: function () {
this.setVisible(false);
},
visible: function () {
this.setVisible(true);
},
empty: function () {
BI.each(this._children, function (i, widget) {
widget._unMount();
});
this._children = {};
this.element.empty();
},
destroy: function () {
this._unMount();
this.element.destroy();
@ -19122,11 +19154,11 @@ BI.Layout = BI.inherit(BI.Widget, {
_addElement: function (i, item) {
var o = this.options;
var w;
if (!this.hasWidget(this.getName() + i)) {
if (!this.hasWidget(this.getName() + "-" + i)) {
w = BI.createWidget(item);
this.addWidget(this.getName() + i, w);
this.addWidget(this.getName() + "-" + i, w);
} else {
w = this.getWidgetByName(this.getName() + i);
w = this.getWidgetByName(this.getName() + "-" + i);
}
return w;
},
@ -24147,7 +24179,7 @@ BI.CenterAdaptLayout = BI.inherit(BI.Layout, {
var o = this.options;
var td;
var width = o.columnSize[i] <= 1 ? (o.columnSize[i] * 100 + "%") : o.columnSize[i];
if (!this.hasWidget(this.getName() + i)) {
if (!this.hasWidget(this.getName() + "-" + i)) {
var w = BI.createWidget(item);
w.element.css({"position": "relative", "top": "0", "left": "0", "margin": "0px auto"});
td = BI.createWidget({
@ -24158,9 +24190,9 @@ BI.CenterAdaptLayout = BI.inherit(BI.Layout, {
},
items: [w]
});
this.addWidget(this.getName() + i, td);
this.addWidget(this.getName() + "-" + i, td);
} else {
td = this.getWidgetByName(this.getName() + i);
td = this.getWidgetByName(this.getName() + "-" + i);
td.element.attr("width", width);
}
td.element.css({"max-width": o.columnSize[i]});
@ -24269,7 +24301,7 @@ BI.HorizontalAdaptLayout = BI.inherit(BI.Layout, {
var o = this.options;
var td;
var width = o.columnSize[i] <= 1 ? (o.columnSize[i] * 100 + "%") : o.columnSize[i];
if (!this.hasWidget(this.getName() + i)) {
if (!this.hasWidget(this.getName() + "-" + i)) {
var w = BI.createWidget(item);
w.element.css({"position": "relative", "top": "0", "left": "0", "margin": "0px auto"});
td = BI.createWidget({
@ -24280,9 +24312,9 @@ BI.HorizontalAdaptLayout = BI.inherit(BI.Layout, {
},
items: [w]
});
this.addWidget(this.getName() + i, td);
this.addWidget(this.getName() + "-" + i, td);
} else {
td = this.getWidgetByName(this.getName() + i);
td = this.getWidgetByName(this.getName() + "-" + i);
td.element.attr("width", width);
}
td.element.css({"max-width": o.columnSize[i] + "px"});
@ -24424,6 +24456,7 @@ BI.LeftRightVerticalAdaptLayout = BI.inherit(BI.Layout, {
populate: function (items) {
BI.LeftRightVerticalAdaptLayout.superclass.populate.apply(this, arguments);
this._mount();
}
});
$.shortcut('bi.left_right_vertical_adapt', BI.LeftRightVerticalAdaptLayout);
@ -24554,7 +24587,7 @@ BI.VerticalAdaptLayout = BI.inherit(BI.Layout, {
var o = this.options;
var td;
var width = o.columnSize[i] <= 1 ? (o.columnSize[i] * 100 + "%") : o.columnSize[i];
if (!this.hasWidget(this.getName() + i)) {
if (!this.hasWidget(this.getName() + "-" + i)) {
var w = BI.createWidget(item);
w.element.css({"position": "relative", "top": "0", "left": "0", "margin": "0px auto"});
td = BI.createWidget({
@ -24565,9 +24598,9 @@ BI.VerticalAdaptLayout = BI.inherit(BI.Layout, {
},
items: [w]
});
this.addWidget(this.getName() + i, td);
this.addWidget(this.getName() + "-" + i, td);
} else {
td = this.getWidgetByName(this.getName() + i);
td = this.getWidgetByName(this.getName() + "-" + i);
td.element.attr("width", width);
}
@ -24863,7 +24896,7 @@ BI.InlineCenterAdaptLayout = BI.inherit(BI.Layout, {
_addElement: function (i, item, length) {
var o = this.options;
if (!this.hasWidget(this.getName() + i)) {
if (!this.hasWidget(this.getName() + "-" + i)) {
var t = BI.createWidget(item);
t.element.css({
"position": "relative"
@ -24872,9 +24905,9 @@ BI.InlineCenterAdaptLayout = BI.inherit(BI.Layout, {
type: "bi.horizontal_auto",
items: [t]
});
this.addWidget(this.getName() + i, w);
this.addWidget(this.getName() + "-" + i, w);
} else {
var w = this.getWidgetByName(this.getName() + i);
var w = this.getWidgetByName(this.getName() + "-" + i);
}
w.element.css({
"position": "relative",
@ -27753,74 +27786,74 @@ Data.Source = BISource = {
$(function () {
//注册布局
var isSupportFlex = BI.isSupportCss3("flex");
// BI.Plugin.registerWidget("bi.horizontal", function (ob) {
// if (isSupportFlex) {
// return BI.extend(ob, {type: "bi.flex_horizontal"});
// } else {
// return ob;
// }
// });
// BI.Plugin.registerWidget("bi.center_adapt", function (ob) {
// if (isSupportFlex && ob.items && ob.items.length <= 1) {
// //有滚动条的情况下需要用到flex_wrapper_center布局
// if (ob.scrollable === true || ob.scrollx === true || ob.scrolly === true) {
// //不是IE用flex_wrapper_center布局
// if (!BI.isIE()) {
// return BI.extend(ob, {type: "bi.flex_wrapper_center"});
// }
// return ob;
// }
// return BI.extend(ob, {type: "bi.flex_center"});
// } else {
// return ob;
// }
// });
// BI.Plugin.registerWidget("bi.vertical_adapt", function (ob) {
// if (isSupportFlex) {
// //有滚动条的情况下需要用到flex_wrapper_center布局
// if (ob.scrollable === true || ob.scrollx === true || ob.scrolly === true) {
// //不是IE用flex_wrapper_center布局
// if (!BI.isIE()) {
// return BI.extend({}, ob, {type: "bi.flex_wrapper_vertical_center"});
// }
// return ob;
// }
// return BI.extend(ob, {type: "bi.flex_vertical_center"});
// } else {
// return ob;
// }
// });
// BI.Plugin.registerWidget("bi.float_center_adapt", function (ob) {
// if (isSupportFlex) {
// //有滚动条的情况下需要用到flex_wrapper_center布局
// if (ob.scrollable === true || ob.scrollx === true || ob.scrolly === true) {
// //不是IE用flex_wrapper_center布局
// if (!BI.isIE()) {
// return BI.extend({}, ob, {type: "bi.flex_wrapper_center"});
// }
// return ob;
// }
// return BI.extend(ob, {type: "bi.flex_center"});
// } else {
// return ob;
// }
// });
//
// //注册控件
// BI.Plugin.registerWidget("bi.grid_table", function (ob) {
// //IE下滚动条滑动效果不好,禁止掉
// if (BI.isIE() || BI.isFireFox()) {
// return BI.extend(ob, {type: "bi.quick_grid_table"});
// } else {
// return ob;
// }
// });
// BI.Plugin.registerWidget("bi.collection_table", function (ob) {
// //IE下滚动条滑动效果不好,禁止掉
// if (BI.isIE() || BI.isFireFox()) {
// return BI.extend(ob, {type: "bi.quick_collection_table"});
// } else {
// return ob;
// }
// });
BI.Plugin.registerWidget("bi.horizontal", function (ob) {
if (isSupportFlex) {
return BI.extend(ob, {type: "bi.flex_horizontal"});
} else {
return ob;
}
});
BI.Plugin.registerWidget("bi.center_adapt", function (ob) {
if (isSupportFlex && ob.items && ob.items.length <= 1) {
//有滚动条的情况下需要用到flex_wrapper_center布局
if (ob.scrollable === true || ob.scrollx === true || ob.scrolly === true) {
//不是IE用flex_wrapper_center布局
if (!BI.isIE()) {
return BI.extend(ob, {type: "bi.flex_wrapper_center"});
}
return ob;
}
return BI.extend(ob, {type: "bi.flex_center"});
} else {
return ob;
}
});
BI.Plugin.registerWidget("bi.vertical_adapt", function (ob) {
if (isSupportFlex) {
//有滚动条的情况下需要用到flex_wrapper_center布局
if (ob.scrollable === true || ob.scrollx === true || ob.scrolly === true) {
//不是IE用flex_wrapper_center布局
if (!BI.isIE()) {
return BI.extend({}, ob, {type: "bi.flex_wrapper_vertical_center"});
}
return ob;
}
return BI.extend(ob, {type: "bi.flex_vertical_center"});
} else {
return ob;
}
});
BI.Plugin.registerWidget("bi.float_center_adapt", function (ob) {
if (isSupportFlex) {
//有滚动条的情况下需要用到flex_wrapper_center布局
if (ob.scrollable === true || ob.scrollx === true || ob.scrolly === true) {
//不是IE用flex_wrapper_center布局
if (!BI.isIE()) {
return BI.extend({}, ob, {type: "bi.flex_wrapper_center"});
}
return ob;
}
return BI.extend(ob, {type: "bi.flex_center"});
} else {
return ob;
}
});
//注册控件
BI.Plugin.registerWidget("bi.grid_table", function (ob) {
//IE下滚动条滑动效果不好,禁止掉
if (BI.isIE() || BI.isFireFox()) {
return BI.extend(ob, {type: "bi.quick_grid_table"});
} else {
return ob;
}
});
BI.Plugin.registerWidget("bi.collection_table", function (ob) {
//IE下滚动条滑动效果不好,禁止掉
if (BI.isIE() || BI.isFireFox()) {
return BI.extend(ob, {type: "bi.quick_collection_table"});
} else {
return ob;
}
});
});

4
src/base/collection/collection.js

@ -68,6 +68,10 @@ BI.Collection = BI.inherit(BI.Widget, {
}
},
destroyed: function () {
this._debounceRelease = null;
},
_calculateSizeAndPositionData: function () {
var o = this.options;
var cellMetadata = [];

4
src/base/combination/combo.js

@ -356,14 +356,14 @@ BI.Combo = BI.inherit(BI.Widget, {
this._toggle();
},
destroy: function () {
destroyed: function () {
$(document).unbind("mousedown." + this.getName())
.unbind("mousewheel." + this.getName())
.unbind("mouseenter." + this.getName())
.unbind("mousemove." + this.getName())
.unbind("mouseleave." + this.getName());
this.popupView && this.popupView.destroy();
BI.Resizers.remove(this.getName());
BI.Combo.superclass.destroy.apply(this, arguments);
}
});
BI.Combo.EVENT_TRIGGER_CHANGE = "EVENT_TRIGGER_CHANGE";

4
src/base/combination/expander.js

@ -254,8 +254,8 @@ BI.Expander = BI.inherit(BI.Widget, {
return this.popupView && this.popupView.getNodeByValue(value);
},
destroy: function () {
BI.Expander.superclass.destroy.apply(this, arguments);
destroyed: function () {
this.popupView && this.popupView.destroy();
}
});
BI.Expander.EVENT_EXPAND = "EVENT_EXPAND";

4
src/base/combination/group.button.js

@ -298,10 +298,6 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
}
});
return node;
},
destroy: function () {
BI.ButtonGroup.superclass.destroy.apply(this, arguments);
}
});
BI.extend(BI.ButtonGroup, {

4
src/base/combination/loader.js

@ -252,10 +252,6 @@ BI.Loader = BI.inherit(BI.Widget, {
BI.each([this.prev, this.next], function (i, ob) {
ob && ob.setVisible(false);
});
},
destroy: function () {
BI.Loader.superclass.destroy.apply(this, arguments);
}
});
BI.Loader.EVENT_CHANGE = "EVENT_CHANGE";

4
src/base/combination/navigation.js

@ -127,10 +127,6 @@ BI.Navigation = BI.inherit(BI.Widget, {
empty: function(){
this.layout.deleteAllCard();
this.cardMap = {};
},
destroy: function(){
BI.Navigation.superclass.destroy.apply(this, arguments);
}
});
BI.Navigation.EVENT_CHANGE = "EVENT_CHANGE";

4
src/base/combination/searcher.js

@ -283,9 +283,9 @@ BI.Searcher = BI.inherit(BI.Widget, {
this.popupView && this.popupView.empty();
},
destroy: function () {
destroyed: function () {
this.popupView && this.popupView.destroy();
BI.Maskers.remove(this.getName());
BI.Searcher.superclass.destroy.apply(this, arguments);
}
});
BI.Searcher.EVENT_CHANGE = "EVENT_CHANGE";

4
src/base/combination/switcher.js

@ -258,8 +258,8 @@ BI.Switcher = BI.inherit(BI.Widget, {
this.popupView && this.popupView.empty();
},
destroy: function () {
BI.Switcher.superclass.destroy.apply(this, arguments);
destroyed: function () {
this.popupView && this.popupView.destroy();
}
});
BI.Switcher.EVENT_EXPAND = "EVENT_EXPAND";

4
src/base/combination/tab.js

@ -114,9 +114,9 @@ BI.Tab = BI.inherit(BI.Widget, {
this.cardMap = {};
},
destroy: function () {
destroyed: function () {
this.layout.deleteAllCard();
this.cardMap = {};
BI.Tab.superclass.destroy.apply(this, arguments);
}
});
BI.Tab.EVENT_CHANGE = "EVENT_CHANGE";

140
src/config.js

@ -2,74 +2,74 @@
$(function () {
//注册布局
var isSupportFlex = BI.isSupportCss3("flex");
// BI.Plugin.registerWidget("bi.horizontal", function (ob) {
// if (isSupportFlex) {
// return BI.extend(ob, {type: "bi.flex_horizontal"});
// } else {
// return ob;
// }
// });
// BI.Plugin.registerWidget("bi.center_adapt", function (ob) {
// if (isSupportFlex && ob.items && ob.items.length <= 1) {
// //有滚动条的情况下需要用到flex_wrapper_center布局
// if (ob.scrollable === true || ob.scrollx === true || ob.scrolly === true) {
// //不是IE用flex_wrapper_center布局
// if (!BI.isIE()) {
// return BI.extend(ob, {type: "bi.flex_wrapper_center"});
// }
// return ob;
// }
// return BI.extend(ob, {type: "bi.flex_center"});
// } else {
// return ob;
// }
// });
// BI.Plugin.registerWidget("bi.vertical_adapt", function (ob) {
// if (isSupportFlex) {
// //有滚动条的情况下需要用到flex_wrapper_center布局
// if (ob.scrollable === true || ob.scrollx === true || ob.scrolly === true) {
// //不是IE用flex_wrapper_center布局
// if (!BI.isIE()) {
// return BI.extend({}, ob, {type: "bi.flex_wrapper_vertical_center"});
// }
// return ob;
// }
// return BI.extend(ob, {type: "bi.flex_vertical_center"});
// } else {
// return ob;
// }
// });
// BI.Plugin.registerWidget("bi.float_center_adapt", function (ob) {
// if (isSupportFlex) {
// //有滚动条的情况下需要用到flex_wrapper_center布局
// if (ob.scrollable === true || ob.scrollx === true || ob.scrolly === true) {
// //不是IE用flex_wrapper_center布局
// if (!BI.isIE()) {
// return BI.extend({}, ob, {type: "bi.flex_wrapper_center"});
// }
// return ob;
// }
// return BI.extend(ob, {type: "bi.flex_center"});
// } else {
// return ob;
// }
// });
//
// //注册控件
// BI.Plugin.registerWidget("bi.grid_table", function (ob) {
// //IE下滚动条滑动效果不好,禁止掉
// if (BI.isIE() || BI.isFireFox()) {
// return BI.extend(ob, {type: "bi.quick_grid_table"});
// } else {
// return ob;
// }
// });
// BI.Plugin.registerWidget("bi.collection_table", function (ob) {
// //IE下滚动条滑动效果不好,禁止掉
// if (BI.isIE() || BI.isFireFox()) {
// return BI.extend(ob, {type: "bi.quick_collection_table"});
// } else {
// return ob;
// }
// });
BI.Plugin.registerWidget("bi.horizontal", function (ob) {
if (isSupportFlex) {
return BI.extend(ob, {type: "bi.flex_horizontal"});
} else {
return ob;
}
});
BI.Plugin.registerWidget("bi.center_adapt", function (ob) {
if (isSupportFlex && ob.items && ob.items.length <= 1) {
//有滚动条的情况下需要用到flex_wrapper_center布局
if (ob.scrollable === true || ob.scrollx === true || ob.scrolly === true) {
//不是IE用flex_wrapper_center布局
if (!BI.isIE()) {
return BI.extend(ob, {type: "bi.flex_wrapper_center"});
}
return ob;
}
return BI.extend(ob, {type: "bi.flex_center"});
} else {
return ob;
}
});
BI.Plugin.registerWidget("bi.vertical_adapt", function (ob) {
if (isSupportFlex) {
//有滚动条的情况下需要用到flex_wrapper_center布局
if (ob.scrollable === true || ob.scrollx === true || ob.scrolly === true) {
//不是IE用flex_wrapper_center布局
if (!BI.isIE()) {
return BI.extend({}, ob, {type: "bi.flex_wrapper_vertical_center"});
}
return ob;
}
return BI.extend(ob, {type: "bi.flex_vertical_center"});
} else {
return ob;
}
});
BI.Plugin.registerWidget("bi.float_center_adapt", function (ob) {
if (isSupportFlex) {
//有滚动条的情况下需要用到flex_wrapper_center布局
if (ob.scrollable === true || ob.scrollx === true || ob.scrolly === true) {
//不是IE用flex_wrapper_center布局
if (!BI.isIE()) {
return BI.extend({}, ob, {type: "bi.flex_wrapper_center"});
}
return ob;
}
return BI.extend(ob, {type: "bi.flex_center"});
} else {
return ob;
}
});
//注册控件
BI.Plugin.registerWidget("bi.grid_table", function (ob) {
//IE下滚动条滑动效果不好,禁止掉
if (BI.isIE() || BI.isFireFox()) {
return BI.extend(ob, {type: "bi.quick_grid_table"});
} else {
return ob;
}
});
BI.Plugin.registerWidget("bi.collection_table", function (ob) {
//IE下滚动条滑动效果不好,禁止掉
if (BI.isIE() || BI.isFireFox()) {
return BI.extend(ob, {type: "bi.quick_collection_table"});
} else {
return ob;
}
});
});

36
src/core/widget.js

@ -68,7 +68,7 @@ BI.Widget = BI.inherit(BI.OB, {
this._parent = o.element;
this._parent.addWidget(this.widgetName, this);
this.element = this.options.element.element;
} else if (BI.isString(o.element)) {
} else if (o.element) {
this.element = $(o.element);
this._isRoot = true;
} else {
@ -184,7 +184,7 @@ BI.Widget = BI.inherit(BI.OB, {
BI.each(this._children, function (i, widget) {
widget._unMount();
});
this._children = [];
this._children = {};
this._parent = null;
this._isMounted = false;
this.destroyed();
@ -330,6 +330,38 @@ BI.Widget = BI.inherit(BI.OB, {
return !this.options.invisible;
},
disable: function () {
this.setEnable(false);
},
enable: function () {
this.setEnable(true);
},
valid: function () {
this.setValid(true);
},
invalid: function () {
this.setValid(false);
},
invisible: function () {
this.setVisible(false);
},
visible: function () {
this.setVisible(true);
},
empty: function () {
BI.each(this._children, function (i, widget) {
widget._unMount();
});
this._children = {};
this.element.empty();
},
destroy: function () {
this._unMount();
this.element.destroy();

6
src/core/wrapper/layout.js

@ -66,11 +66,11 @@ BI.Layout = BI.inherit(BI.Widget, {
_addElement: function (i, item) {
var o = this.options;
var w;
if (!this.hasWidget(this.getName() + i)) {
if (!this.hasWidget(this.getName() + "-" + i)) {
w = BI.createWidget(item);
this.addWidget(this.getName() + i, w);
this.addWidget(this.getName() + "-" + i, w);
} else {
w = this.getWidgetByName(this.getName() + i);
w = this.getWidgetByName(this.getName() + "-" + i);
}
return w;
},

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

@ -36,7 +36,7 @@ BI.CenterAdaptLayout = BI.inherit(BI.Layout, {
var o = this.options;
var td;
var width = o.columnSize[i] <= 1 ? (o.columnSize[i] * 100 + "%") : o.columnSize[i];
if (!this.hasWidget(this.getName() + i)) {
if (!this.hasWidget(this.getName() + "-" + i)) {
var w = BI.createWidget(item);
w.element.css({"position": "relative", "top": "0", "left": "0", "margin": "0px auto"});
td = BI.createWidget({
@ -47,9 +47,9 @@ BI.CenterAdaptLayout = BI.inherit(BI.Layout, {
},
items: [w]
});
this.addWidget(this.getName() + i, td);
this.addWidget(this.getName() + "-" + i, td);
} else {
td = this.getWidgetByName(this.getName() + i);
td = this.getWidgetByName(this.getName() + "-" + i);
td.element.attr("width", width);
}
td.element.css({"max-width": o.columnSize[i]});

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

@ -36,7 +36,7 @@ BI.HorizontalAdaptLayout = BI.inherit(BI.Layout, {
var o = this.options;
var td;
var width = o.columnSize[i] <= 1 ? (o.columnSize[i] * 100 + "%") : o.columnSize[i];
if (!this.hasWidget(this.getName() + i)) {
if (!this.hasWidget(this.getName() + "-" + i)) {
var w = BI.createWidget(item);
w.element.css({"position": "relative", "top": "0", "left": "0", "margin": "0px auto"});
td = BI.createWidget({
@ -47,9 +47,9 @@ BI.HorizontalAdaptLayout = BI.inherit(BI.Layout, {
},
items: [w]
});
this.addWidget(this.getName() + i, td);
this.addWidget(this.getName() + "-" + i, td);
} else {
td = this.getWidgetByName(this.getName() + i);
td = this.getWidgetByName(this.getName() + "-" + i);
td.element.attr("width", width);
}
td.element.css({"max-width": o.columnSize[i] + "px"});

1
src/core/wrapper/layout/adapt/adapt.leftrightvertical.js

@ -70,6 +70,7 @@ BI.LeftRightVerticalAdaptLayout = BI.inherit(BI.Layout, {
populate: function (items) {
BI.LeftRightVerticalAdaptLayout.superclass.populate.apply(this, arguments);
this._mount();
}
});
$.shortcut('bi.left_right_vertical_adapt', BI.LeftRightVerticalAdaptLayout);

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

@ -35,7 +35,7 @@ BI.VerticalAdaptLayout = BI.inherit(BI.Layout, {
var o = this.options;
var td;
var width = o.columnSize[i] <= 1 ? (o.columnSize[i] * 100 + "%") : o.columnSize[i];
if (!this.hasWidget(this.getName() + i)) {
if (!this.hasWidget(this.getName() + "-" + i)) {
var w = BI.createWidget(item);
w.element.css({"position": "relative", "top": "0", "left": "0", "margin": "0px auto"});
td = BI.createWidget({
@ -46,9 +46,9 @@ BI.VerticalAdaptLayout = BI.inherit(BI.Layout, {
},
items: [w]
});
this.addWidget(this.getName() + i, td);
this.addWidget(this.getName() + "-" + i, td);
} else {
td = this.getWidgetByName(this.getName() + i);
td = this.getWidgetByName(this.getName() + "-" + i);
td.element.attr("width", width);
}

6
src/core/wrapper/layout/adapt/inline.center.js

@ -29,7 +29,7 @@ BI.InlineCenterAdaptLayout = BI.inherit(BI.Layout, {
_addElement: function (i, item, length) {
var o = this.options;
if (!this.hasWidget(this.getName() + i)) {
if (!this.hasWidget(this.getName() + "-" + i)) {
var t = BI.createWidget(item);
t.element.css({
"position": "relative"
@ -38,9 +38,9 @@ BI.InlineCenterAdaptLayout = BI.inherit(BI.Layout, {
type: "bi.horizontal_auto",
items: [t]
});
this.addWidget(this.getName() + i, w);
this.addWidget(this.getName() + "-" + i, w);
} else {
var w = this.getWidgetByName(this.getName() + i);
var w = this.getWidgetByName(this.getName() + "-" + i);
}
w.element.css({
"position": "relative",

Loading…
Cancel
Save