Browse Source

Merge pull request #181 in FUI/fineui from ~GUY/fineui:master to master

* commit '6ded75ad6882716204908e0c30b0f6d55338556b':
  getFreezeColLength
  update
  update Fix
  update
  update
  去掉神奇的代码
  update
  update
  editor高度改成24之后部分地方不适配
  日期tab输入框宽度60
  update
  update
  显示不下三个点
  vm不一定是一个VM对象也不一定有_watchers
  store直接使用model数据时无destroy方法
  update
es6
guy 7 years ago
parent
commit
0ab372c20d
  1. 13
      bi/base.js
  2. 3
      bi/case.js
  3. 75
      bi/widget.js
  4. 2
      demo/js/base/table/demo.grid_table.js
  5. 2
      demo/js/base/table/demo.resizable_table.js
  6. 2
      demo/js/case/demo.clipboard.js
  7. 2
      demo/js/case/pager/demo.direction_pager.js
  8. 2
      demo/js/case/table/demo.adaptive_table.js
  9. 16
      demo/js/category/customATree/demo.multilayerselecttree.leveltree.js
  10. 2
      demo/js/category/largeTable/cell.js
  11. 2
      demo/js/category/largeTable/header.js
  12. 2
      demo/js/category/largeTable/sequenceheadercell.normal.js
  13. 2
      demo/js/category/sortTree/demo.sortTree.js
  14. 2
      demo/js/component/demo.treevaluechooserpane.js
  15. 2
      demo/js/component/demo.valuechooserpane.js
  16. 7
      demo/js/config/fix.js
  17. 4
      demo/js/core/abstract/demo.button_group.js
  18. 2
      demo/js/core/abstract/demo.button_tree.js
  19. 2
      demo/js/core/abstract/demo.list_view.js
  20. 2
      demo/js/core/abstract/demo.virtual_list.js
  21. 2
      demo/js/core/layout/demo.center_adapt.js
  22. 8
      demo/js/face.js
  23. 3
      demo/js/fix-2.0/scene.js
  24. 49
      demo/js/fix-2.0/state.js
  25. 2
      demo/js/widget/downlist/demo.downlist.js
  26. 2
      demo/js/widget/relationview/demo.relationview.js
  27. 4
      demo/js/widget/table/demo.page_table.js
  28. 2
      demo/js/widget/table/demo.sequence_table.js
  29. 2
      demo/js/widget/yearquarter/demo.year_quarter_combo.js
  30. 13
      dist/base.js
  31. 91
      dist/bundle.js
  32. 50
      dist/bundle.min.js
  33. 3
      dist/case.js
  34. 130
      dist/demo.js
  35. 2
      dist/fix/fix.compact.js
  36. 268
      dist/fix/fix.js
  37. 75
      dist/widget.js
  38. 4
      src/base/single/editor/editor.code.js
  39. 3
      src/base/table/table.collection.js
  40. 3
      src/base/table/table.grid.js
  41. 3
      src/base/table/table.resizable.js
  42. 3
      src/case/table/table.adaptive.js
  43. 3
      src/widget/multidate/multidate.segment.js
  44. 32
      src/widget/multiselect/trigger/searcher.multiselect.js
  45. 2
      src/widget/multiselectlist/multiselectlist.insert.js
  46. 2
      src/widget/multiselectlist/multiselectlist.js
  47. 10
      src/widget/multitree/multi.tree.combo.js
  48. 26
      src/widget/multitree/trigger/searcher.multi.tree.js

13
bi/base.js

@ -19090,10 +19090,6 @@ BI.CodeEditor = BI.inherit(BI.Single, {
setStyle: function (style) { setStyle: function (style) {
this.style = style; this.style = style;
this.element.css(style); this.element.css(style);
var wrapperStyle = this.editor.getWrapperElement().style;
BI.extend(wrapperStyle, style, {
color: style.color || BI.DOM.getContrastColor(BI.DOM.isRGBColor(style.backgroundColor) ? BI.DOM.rgb2hex(style.backgroundColor) : style.backgroundColor)
});
}, },
getStyle: function () { getStyle: function () {
@ -30311,7 +30307,8 @@ BI.CollectionTable = BI.inherit(BI.Widget, {
}, },
_getFreezeColLength: function () { _getFreezeColLength: function () {
return this.options.isNeedFreeze ? this.options.freezeCols.length : 0; var o = this.options;
return o.isNeedFreeze === true ? BI.clamp(o.freezeCols.length, 0, o.columnSize.length) : 0;
}, },
_getFreezeHeaderHeight: function () { _getFreezeHeaderHeight: function () {
@ -31118,7 +31115,8 @@ BI.GridTable = BI.inherit(BI.Widget, {
}, },
_getFreezeColLength: function () { _getFreezeColLength: function () {
return this.options.isNeedFreeze ? this.options.freezeCols.length : 0; var o = this.options;
return o.isNeedFreeze === true ? BI.clamp(o.freezeCols.length, 0, o.columnSize.length) : 0;
}, },
_getFreezeHeaderHeight: function () { _getFreezeHeaderHeight: function () {
@ -33984,7 +33982,8 @@ BI.ResizableTable = BI.inherit(BI.Widget, {
}, },
_getFreezeColLength: function () { _getFreezeColLength: function () {
return this.options.freezeCols.length; var o = this.options;
return o.isNeedFreeze === true ? BI.clamp(o.freezeCols.length, 0, o.columnSize.length) : 0;
}, },
_getFreezeColumnSize: function () { _getFreezeColumnSize: function () {

3
bi/case.js

@ -9543,7 +9543,8 @@ BI.AdaptiveTable = BI.inherit(BI.Widget, {
}, },
_getFreezeColLength: function () { _getFreezeColLength: function () {
return this.options.isNeedFreeze === true ? this.options.freezeCols.length : 0; var o = this.options;
return o.isNeedFreeze === true ? BI.clamp(o.freezeCols.length, 0, o.columnSize.length) : 0;
}, },
_digest: function () { _digest: function () {

75
bi/widget.js

@ -7952,7 +7952,7 @@ BI.MultiDateSegment = BI.inherit(BI.Single, {
itemHeight: 24, itemHeight: 24,
maxGap: 15, maxGap: 15,
minGap: 10, minGap: 10,
textWidth: 30, textWidth: 60,
defaultEditorValue: "1" defaultEditorValue: "1"
}, },
@ -7960,7 +7960,6 @@ BI.MultiDateSegment = BI.inherit(BI.Single, {
return $.extend(BI.MultiDateSegment.superclass._defaultConfig.apply(this, arguments), { return $.extend(BI.MultiDateSegment.superclass._defaultConfig.apply(this, arguments), {
baseCls: 'bi-multidate-segment', baseCls: 'bi-multidate-segment',
text: "", text: "",
width: 130,
height: 30, height: 30,
isEditorExist: true, isEditorExist: true,
selected: false, selected: false,
@ -11349,16 +11348,36 @@ BI.MultiSelectSearcher = BI.inherit(BI.Widget, {
ob || (ob = {}); ob || (ob = {});
ob.value || (ob.value = []); ob.value || (ob.value = []);
if (ob.type === BI.Selection.All) { if (ob.type === BI.Selection.All) {
if (BI.size(ob.assist) === 1) { if (ob.value.length === 0) {
this.editor.setState(o.valueFormatter(ob.assist[0] + "") || (ob.assist[0] + "")); this.editor.setState(BI.Selection.All);
} else if (BI.size(ob.assist) <= 20) {
var state = "";
BI.each(ob.assist, function (i, v) {
if (i === 0) {
state += "" + (o.valueFormatter(v + "") || v);
} else {
state += "," + (o.valueFormatter(v + "") || v);
}
});
this.editor.setState(state);
} else { } else {
this.editor.setState(BI.size(ob.value) > 0 ? BI.Selection.Multi : BI.Selection.All); this.editor.setState(BI.Selection.Multi);
} }
} else { } else {
if (BI.size(ob.value) === 1) { if (ob.value.length === 0) {
this.editor.setState(o.valueFormatter(ob.value[0] + "") || (ob.value[0] + "")); this.editor.setState(BI.Selection.None);
} else if (BI.size(ob.value) <= 20) {
var state = "";
BI.each(ob.value, function (i, v) {
if (i === 0) {
state += "" + (o.valueFormatter(v + "") || v);
} else {
state += "," + (o.valueFormatter(v + "") || v);
}
});
this.editor.setState(state);
} else { } else {
this.editor.setState(BI.size(ob.value) > 0 ? BI.Selection.Multi : BI.Selection.None); this.editor.setState(BI.Selection.Multi);
} }
} }
}, },
@ -11640,7 +11659,7 @@ BI.MultiSelectInsertList = BI.inherit(BI.Widget, {
element: this, element: this,
items: [{ items: [{
el: this.trigger, el: this.trigger,
height: 30 height: 24
}, { }, {
el: this.adapter, el: this.adapter,
height: "fill" height: "fill"
@ -11954,7 +11973,7 @@ BI.MultiSelectList = BI.inherit(BI.Widget, {
element: this, element: this,
items: [{ items: [{
el: this.trigger, el: this.trigger,
height: 30 height: 24
}, { }, {
el: this.adapter, el: this.adapter,
height: "fill" height: "fill"
@ -12567,7 +12586,7 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, {
change = true; change = true;
var val = { var val = {
type: BI.Selection.Multi, type: BI.Selection.Multi,
value: this.hasChecked() ? {1: 1} : {} value: this.hasChecked() ? this.getValue() : {}
}; };
self.trigger.getSearcher().setState(val); self.trigger.getSearcher().setState(val);
self.trigger.getCounter().setButtonChecked(val); self.trigger.getCounter().setButtonChecked(val);
@ -12623,6 +12642,7 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, {
} }
}); });
}); });
function showCounter() { function showCounter() {
if (isSearching()) { if (isSearching()) {
self.storeValue = {value: self.trigger.getValue()}; self.storeValue = {value: self.trigger.getValue()};
@ -12651,11 +12671,12 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, {
}); });
this.trigger.on(BI.MultiSelectTrigger.EVENT_CHANGE, function () { this.trigger.on(BI.MultiSelectTrigger.EVENT_CHANGE, function () {
var checked = this.getSearcher().hasChecked();
var val = { var val = {
type: BI.Selection.Multi, type: BI.Selection.Multi,
value: this.getSearcher().hasChecked() ? {1: 1} : {} value: checked ? {1: 1} : {}
}; };
this.getSearcher().setState(val); this.getSearcher().setState(checked ? BI.Selection.Multi : BI.Selection.None);
this.getCounter().setButtonChecked(val); this.getCounter().setButtonChecked(val);
}); });
@ -12675,7 +12696,7 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, {
if (isSearching()) { if (isSearching()) {
self.trigger.stopEditing(); self.trigger.stopEditing();
self.fireEvent(BI.MultiTreeCombo.EVENT_CONFIRM); self.fireEvent(BI.MultiTreeCombo.EVENT_CONFIRM);
}else{ } else {
if (isPopupView()) { if (isPopupView()) {
self.trigger.stopEditing(); self.trigger.stopEditing();
self.storeValue = {value: self.combo.getValue()}; self.storeValue = {value: self.combo.getValue()};
@ -13086,11 +13107,29 @@ BI.MultiTreeSearcher = BI.inherit(BI.Widget, {
setState: function (ob) { setState: function (ob) {
ob || (ob = {}); ob || (ob = {});
ob.value || (ob.value = []); ob.value || (ob.value = {});
if (ob.type === BI.Selection.All) { if (BI.isNumber(ob)) {
this.editor.setState(BI.size(ob.value) > 0 ? BI.Selection.Multi : BI.Selection.All); this.editor.setState(ob);
} else if (BI.size(ob.value) === 0) {
this.editor.setState(BI.Selection.None);
} else { } else {
this.editor.setState(BI.size(ob.value) > 0 ? BI.Selection.Multi : BI.Selection.None); var text = "";
BI.each(ob.value, function (name, children) {
var childNodes = getChildrenNode(children);
text += name + (childNodes === "" ? "" : (":" + childNodes)) + "; ";
});
this.editor.setState(text);
}
function getChildrenNode(ob) {
var text = "";
var index = 0, size = BI.size(ob);
BI.each(ob, function (name, children) {
index++;
var childNodes = getChildrenNode(children);
text += name + (childNodes === "" ? "" : (":" + childNodes)) + (index === size ? "" : ",");
});
return text;
} }
}, },

2
demo/js/base/table/demo.grid_table.js

@ -29,7 +29,7 @@ Demo.Func = BI.inherit(BI.Widget, {
var table = BI.createWidget({ var table = BI.createWidget({
type: "bi.resizable_table", type: "bi.resizable_table",
el: { el: {
type: "bi.grid_table", type: "bi.grid_table"
}, },
width: 600, width: 600,
height: 500, height: 500,

2
demo/js/base/table/demo.resizable_table.js

@ -29,7 +29,7 @@ Demo.Func = BI.inherit(BI.Widget, {
var table = BI.createWidget({ var table = BI.createWidget({
type: "bi.resizable_table", type: "bi.resizable_table",
el: { el: {
type: "bi.grid_table", type: "bi.grid_table"
}, },
width: 600, width: 600,
height: 500, height: 500,

2
demo/js/case/demo.clipboard.js

@ -30,7 +30,7 @@ Demo.Func = BI.inherit(BI.Widget, {
items: [{ items: [{
el: editor, el: editor,
left: 100, left: 100,
top: 50, top: 50
}, { }, {
el: clipboard, el: clipboard,
left: 100, left: 100,

2
demo/js/case/pager/demo.direction_pager.js

@ -10,7 +10,7 @@ Demo.Func = BI.inherit(BI.Widget, {
vgap: 50, vgap: 50,
element: this, element: this,
items: [{ items: [{
type: "bi.direction_pager", type: "bi.direction_pager"
}] }]
}) })
} }

2
demo/js/case/table/demo.adaptive_table.js

@ -127,7 +127,7 @@ Demo.Func = BI.inherit(BI.Widget, {
el: { el: {
type: "bi.resizable_table", type: "bi.resizable_table",
el: { el: {
type: "bi.grid_table", type: "bi.grid_table"
} }
}, },
width: 600, width: 600,

16
demo/js/category/customATree/demo.multilayerselecttree.leveltree.js

@ -116,7 +116,7 @@ BI.DemoLevelTree = BI.inherit(BI.Widget, {
"text": "B", "text": "B",
value: 2, value: 2,
isParent: true, isParent: true,
open: true, open: true
}]) }])
} else { } else {
if (op.node.id == 1) { if (op.node.id == 1) {
@ -134,14 +134,14 @@ BI.DemoLevelTree = BI.inherit(BI.Widget, {
"pId": 1, "pId": 1,
"text": "test12", "text": "test12",
value: 12, value: 12,
layer: 1, layer: 1
}, },
{ {
"id": 13, "id": 13,
"pId": 1, "pId": 1,
"text": "test13", "text": "test13",
value: 13, value: 13,
layer: 1, layer: 1
}, },
{ {
"id": 14, "id": 14,
@ -156,14 +156,14 @@ BI.DemoLevelTree = BI.inherit(BI.Widget, {
"pId": 1, "pId": 1,
"text": "test15", "text": "test15",
value: 15, value: 15,
layer: 1, layer: 1
}, },
{ {
"id": 16, "id": 16,
"pId": 1, "pId": 1,
"text": "test16", "text": "test16",
value: 16, value: 16,
layer: 1, layer: 1
}, },
{"id": 17, "pId": 1, "text": "test17", layer: 1, value: 17} {"id": 17, "pId": 1, "text": "test17", layer: 1, value: 17}
]) ])
@ -173,14 +173,14 @@ BI.DemoLevelTree = BI.inherit(BI.Widget, {
"pId": 2, "pId": 2,
"text": "test21", "text": "test21",
value: 21, value: 21,
layer: 1, layer: 1
}, },
{ {
"id": 22, "id": 22,
"pId": 2, "pId": 2,
"text": "test22", "text": "test22",
value: 22, value: 22,
layer: 1, layer: 1
}]) }])
} else if (op.node.id == 11) { } else if (op.node.id == 11) {
callback([{ callback([{
@ -188,7 +188,7 @@ BI.DemoLevelTree = BI.inherit(BI.Widget, {
"pId": 11, "pId": 11,
"text": "test111", "text": "test111",
value: 111, value: 111,
layer: 2, layer: 2
}]) }])
} }
} }

2
demo/js/category/largeTable/cell.js

@ -42,6 +42,6 @@ BI.DetailTableCell = BI.inherit(BI.Widget, {
if (BI.isNotNull(o.styles) && BI.isObject(o.styles)) { if (BI.isNotNull(o.styles) && BI.isObject(o.styles)) {
this.element.css(o.styles); this.element.css(o.styles);
} }
}, }
}); });
BI.shortcut("bi.detail_table_cell", BI.DetailTableCell); BI.shortcut("bi.detail_table_cell", BI.DetailTableCell);

2
demo/js/category/largeTable/header.js

@ -33,6 +33,6 @@ BI.DetailTableHeader = BI.inherit(BI.Widget, {
if (BI.isNotNull(o.styles) && BI.isObject(o.styles)) { if (BI.isNotNull(o.styles) && BI.isObject(o.styles)) {
this.element.css(o.styles); this.element.css(o.styles);
} }
}, }
}); });
BI.shortcut("bi.detail_table_header", BI.DetailTableHeader); BI.shortcut("bi.detail_table_header", BI.DetailTableHeader);

2
demo/js/category/largeTable/sequenceheadercell.normal.js

@ -5,7 +5,7 @@
BI.NormalSequenceHeaderCell = BI.inherit(BI.Widget, { BI.NormalSequenceHeaderCell = BI.inherit(BI.Widget, {
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.NormalSequenceHeaderCell.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.NormalSequenceHeaderCell.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-normal-sequence-header-cell", baseCls: "bi-normal-sequence-header-cell"
}) })
}, },

2
demo/js/category/sortTree/demo.sortTree.js

@ -131,6 +131,6 @@ Demo.SortTree = BI.inherit(BI.Widget, {
} }
}); });
return nodes; return nodes;
}, }
}); });
BI.shortcut("demo.sort_tree", Demo.SortTree); BI.shortcut("demo.sort_tree", Demo.SortTree);

2
demo/js/component/demo.treevaluechooserpane.js

@ -6,7 +6,7 @@ Demo.TreeValueChooser = BI.inherit(BI.Widget, {
return { return {
type: "bi.tree_value_chooser_pane", type: "bi.tree_value_chooser_pane",
items: BI.deepClone(Demo.CONSTANTS.TREEITEMS), items: BI.deepClone(Demo.CONSTANTS.TREEITEMS)
// itemsCreator: function (op, callback) { // itemsCreator: function (op, callback) {
// callback(tree); // callback(tree);
// } // }

2
demo/js/component/demo.valuechooserpane.js

@ -5,7 +5,7 @@ Demo.ValueChooserPane = BI.inherit(BI.Widget, {
render: function () { render: function () {
return { return {
type: "bi.value_chooser_pane", type: "bi.value_chooser_pane",
items: BI.deepClone(Demo.CONSTANTS.ITEMS), items: BI.deepClone(Demo.CONSTANTS.ITEMS)
// itemsCreator: function (op, callback) { // itemsCreator: function (op, callback) {
// callback(BI.deepClone(Demo.CONSTANTS.ITEMS)); // callback(BI.deepClone(Demo.CONSTANTS.ITEMS));
// } // }

7
demo/js/config/fix.js

@ -29,7 +29,7 @@ var viewRouter = new (BI.inherit(BI.WRouter, {
"/tmp": "TmpView", "/tmp": "TmpView",
"/tmp/child": "TmpChildView", "/tmp/child": "TmpChildView",
"/tmp/child/child": "TmpChildChildView", "/tmp/child/child": "TmpChildChildView"
}, },
getSkipToView: function (v) { getSkipToView: function (v) {
@ -91,6 +91,11 @@ Demo.FIX_CONFIG = [{
}, { }, {
id: 72, id: 72,
pId: 7, pId: 7,
text: "state属性",
value: "demo.fix6"
}, {
id: 78,
pId: 7,
text: "计算属性", text: "计算属性",
value: "demo.fix2" value: "demo.fix2"
}, { }, {

4
demo/js/core/abstract/demo.button_group.js

@ -16,7 +16,7 @@ Demo.Func = BI.inherit(BI.Widget, {
type: "bi.vertical", type: "bi.vertical",
items: [{ items: [{
type: "bi.vtape", type: "bi.vtape",
height: 200, height: 200
}] }]
}], }],
items: [{ items: [{
@ -24,7 +24,7 @@ Demo.Func = BI.inherit(BI.Widget, {
type: "bi.label", type: "bi.label",
text: "button_group是一类具有相同属性或相似属性的抽象, 本案例实现的是布局的嵌套(vertical布局下内嵌center_adapt布局)" text: "button_group是一类具有相同属性或相似属性的抽象, 本案例实现的是布局的嵌套(vertical布局下内嵌center_adapt布局)"
}, },
height: 150, height: 150
}, { }, {
el: { el: {
type: "bi.button", type: "bi.button",

2
demo/js/core/abstract/demo.button_tree.js

@ -9,7 +9,7 @@ Demo.Func = BI.inherit(BI.Widget, {
layouts: [{ layouts: [{
type: "bi.vertical" type: "bi.vertical"
}, { }, {
type: "bi.center_adapt", type: "bi.center_adapt"
}], }],
items: [{ items: [{
type: "bi.label", type: "bi.label",

2
demo/js/core/abstract/demo.list_view.js

@ -13,7 +13,7 @@ Demo.Func = BI.inherit(BI.Widget, {
type: "bi.label", type: "bi.label",
width: 200, width: 200,
height: 200, height: 200,
text: (i + 1) + "." + item.text, text: (i + 1) + "." + item.text
}); });
}) })
} }

2
demo/js/core/abstract/demo.virtual_list.js

@ -9,7 +9,7 @@ Demo.Func = BI.inherit(BI.Widget, {
return BI.extend({}, item, { return BI.extend({}, item, {
type: "bi.label", type: "bi.label",
height: 30, height: 30,
text: (i + 1) + "." + item.text, text: (i + 1) + "." + item.text
}); });
}) })
} }

2
demo/js/core/layout/demo.center_adapt.js

@ -13,6 +13,6 @@ Demo.CenterAdapt = BI.inherit(BI.Widget, {
cls: "layout-bg1" cls: "layout-bg1"
}] }]
} }
}, }
}); });
BI.shortcut("demo.center_adapt", Demo.CenterAdapt); BI.shortcut("demo.center_adapt", Demo.CenterAdapt);

8
demo/js/face.js

@ -389,15 +389,15 @@ Demo.Face = BI.inherit(BI.Widget, {
}, { }, {
text: "column 1.222222222222222222222222222222222222", text: "column 1.222222222222222222222222222222222222",
cls: "dot-e-font", cls: "dot-e-font",
value: 22, value: 22
}, { }, {
text: "column 1.3", text: "column 1.3",
cls: "dot-e-font", cls: "dot-e-font",
value: 23, value: 23
}, { }, {
text: "column 1.4", text: "column 1.4",
cls: "dot-e-font", cls: "dot-e-font",
value: 24, value: 24
}, { }, {
text: "column 1.5", text: "column 1.5",
cls: "dot-e-font", cls: "dot-e-font",
@ -420,7 +420,7 @@ Demo.Face = BI.inherit(BI.Widget, {
height: 25, height: 25,
text: "column 2.1", text: "column 2.1",
value: 11 value: 11
}, {text: "column 2.2", value: 12, cls: "dot-e-font"}], }, {text: "column 2.2", value: 12, cls: "dot-e-font"}]
} }

3
demo/js/fix-2.0/scene.js

@ -139,6 +139,7 @@
return { return {
type: "bi.tab", type: "bi.tab",
defaultShowIndex: this.constant.TAB1, defaultShowIndex: this.constant.TAB1,
single: true,
tab: { tab: {
type: "bi.button_group", type: "bi.button_group",
items: BI.createItems([{ items: BI.createItems([{
@ -213,7 +214,7 @@
type: "bi.label", type: "bi.label",
cls: "layout-bg1", cls: "layout-bg1",
width: 150 width: 150
}), })
}, { }, {
type: "bi.vertical", type: "bi.vertical",

49
demo/js/fix-2.0/state.js

@ -0,0 +1,49 @@
;(function () {
var State = BI.inherit(Fix.VM, {
state: function () {
return {
name: "原始属性"
}
},
computed: {
b: function () {
return this.model.name + "-计算属性"
}
}
})
Demo.Fix = BI.inherit(BI.Widget, {
_store: function () {
return new State();
},
watch: {
b: function () {
this.button.setText(this.model.b)
}
},
render: function () {
var self = this;
return {
type: "bi.absolute",
items: [{
el: {
type: "bi.button",
ref: function () {
self.button = this;
},
handler: function () {
self.model.name = "这是改变后的属性"
},
text: this.model.b
}
}]
}
},
mounted: function () {
}
});
BI.shortcut("demo.fix6", Demo.Fix);
}());

2
demo/js/widget/downlist/demo.downlist.js

@ -43,7 +43,7 @@ Demo.Downlist = BI.inherit(BI.Widget, {
}, { }, {
text: "column 1.222222222222222222222222222222222222", text: "column 1.222222222222222222222222222222222222",
cls: "dot-e-font", cls: "dot-e-font",
value: 22, value: 22
}] }]
}], }],
[{ [{

2
demo/js/widget/relationview/demo.relationview.js

@ -50,7 +50,7 @@ Demo.RelationView = BI.inherit(BI.Widget, {
foreign: {region: "B", value: "b1", text: "b1字段"} foreign: {region: "B", value: "b1", text: "b1字段"}
}, },
{ {
primary: {region: "X33", value: "x233", text: "x233字段"}, primary: {region: "X33", value: "x233", text: "x233字段"}
} }
] ]
}); });

4
demo/js/widget/table/demo.page_table.js

@ -90,7 +90,7 @@ Demo.Func = BI.inherit(BI.Widget, {
type: "bi.page_table_cell", type: "bi.page_table_cell",
text: "node3", text: "node3",
values: [1, 2] values: [1, 2]
}], }]
//values: [1, 2] //values: [1, 2]
}]; }];
@ -109,7 +109,7 @@ Demo.Func = BI.inherit(BI.Widget, {
type: "bi.collection_table" type: "bi.collection_table"
} }
} }
}, }
}, },
sequence: { sequence: {
type: "bi.sequence_table_dynamic_number" type: "bi.sequence_table_dynamic_number"

2
demo/js/widget/table/demo.sequence_table.js

@ -110,7 +110,7 @@ Demo.Func = BI.inherit(BI.Widget, {
type: "bi.collection_table" type: "bi.collection_table"
} }
} }
}, }
}, },
sequence: { sequence: {
type: "bi.sequence_table_tree_number" type: "bi.sequence_table_tree_number"

2
demo/js/widget/yearquarter/demo.year_quarter_combo.js

@ -16,7 +16,7 @@ Demo.YearQuarterCombo = BI.inherit(BI.Widget, {
self.widget = _ref; self.widget = _ref;
}, },
yearBehaviors: {}, yearBehaviors: {},
quarterBehaviors: {}, quarterBehaviors: {}
}, { }, {
type: "bi.button", type: "bi.button",
text: "getValue", text: "getValue",

13
dist/base.js vendored

@ -19090,10 +19090,6 @@ BI.CodeEditor = BI.inherit(BI.Single, {
setStyle: function (style) { setStyle: function (style) {
this.style = style; this.style = style;
this.element.css(style); this.element.css(style);
var wrapperStyle = this.editor.getWrapperElement().style;
BI.extend(wrapperStyle, style, {
color: style.color || BI.DOM.getContrastColor(BI.DOM.isRGBColor(style.backgroundColor) ? BI.DOM.rgb2hex(style.backgroundColor) : style.backgroundColor)
});
}, },
getStyle: function () { getStyle: function () {
@ -30311,7 +30307,8 @@ BI.CollectionTable = BI.inherit(BI.Widget, {
}, },
_getFreezeColLength: function () { _getFreezeColLength: function () {
return this.options.isNeedFreeze ? this.options.freezeCols.length : 0; var o = this.options;
return o.isNeedFreeze === true ? BI.clamp(o.freezeCols.length, 0, o.columnSize.length) : 0;
}, },
_getFreezeHeaderHeight: function () { _getFreezeHeaderHeight: function () {
@ -31118,7 +31115,8 @@ BI.GridTable = BI.inherit(BI.Widget, {
}, },
_getFreezeColLength: function () { _getFreezeColLength: function () {
return this.options.isNeedFreeze ? this.options.freezeCols.length : 0; var o = this.options;
return o.isNeedFreeze === true ? BI.clamp(o.freezeCols.length, 0, o.columnSize.length) : 0;
}, },
_getFreezeHeaderHeight: function () { _getFreezeHeaderHeight: function () {
@ -33984,7 +33982,8 @@ BI.ResizableTable = BI.inherit(BI.Widget, {
}, },
_getFreezeColLength: function () { _getFreezeColLength: function () {
return this.options.freezeCols.length; var o = this.options;
return o.isNeedFreeze === true ? BI.clamp(o.freezeCols.length, 0, o.columnSize.length) : 0;
}, },
_getFreezeColumnSize: function () { _getFreezeColumnSize: function () {

91
dist/bundle.js vendored

@ -44833,10 +44833,6 @@ BI.CodeEditor = BI.inherit(BI.Single, {
setStyle: function (style) { setStyle: function (style) {
this.style = style; this.style = style;
this.element.css(style); this.element.css(style);
var wrapperStyle = this.editor.getWrapperElement().style;
BI.extend(wrapperStyle, style, {
color: style.color || BI.DOM.getContrastColor(BI.DOM.isRGBColor(style.backgroundColor) ? BI.DOM.rgb2hex(style.backgroundColor) : style.backgroundColor)
});
}, },
getStyle: function () { getStyle: function () {
@ -56054,7 +56050,8 @@ BI.CollectionTable = BI.inherit(BI.Widget, {
}, },
_getFreezeColLength: function () { _getFreezeColLength: function () {
return this.options.isNeedFreeze ? this.options.freezeCols.length : 0; var o = this.options;
return o.isNeedFreeze === true ? BI.clamp(o.freezeCols.length, 0, o.columnSize.length) : 0;
}, },
_getFreezeHeaderHeight: function () { _getFreezeHeaderHeight: function () {
@ -56861,7 +56858,8 @@ BI.GridTable = BI.inherit(BI.Widget, {
}, },
_getFreezeColLength: function () { _getFreezeColLength: function () {
return this.options.isNeedFreeze ? this.options.freezeCols.length : 0; var o = this.options;
return o.isNeedFreeze === true ? BI.clamp(o.freezeCols.length, 0, o.columnSize.length) : 0;
}, },
_getFreezeHeaderHeight: function () { _getFreezeHeaderHeight: function () {
@ -59727,7 +59725,8 @@ BI.ResizableTable = BI.inherit(BI.Widget, {
}, },
_getFreezeColLength: function () { _getFreezeColLength: function () {
return this.options.freezeCols.length; var o = this.options;
return o.isNeedFreeze === true ? BI.clamp(o.freezeCols.length, 0, o.columnSize.length) : 0;
}, },
_getFreezeColumnSize: function () { _getFreezeColumnSize: function () {
@ -71938,7 +71937,8 @@ BI.AdaptiveTable = BI.inherit(BI.Widget, {
}, },
_getFreezeColLength: function () { _getFreezeColLength: function () {
return this.options.isNeedFreeze === true ? this.options.freezeCols.length : 0; var o = this.options;
return o.isNeedFreeze === true ? BI.clamp(o.freezeCols.length, 0, o.columnSize.length) : 0;
}, },
_digest: function () { _digest: function () {
@ -82998,7 +82998,7 @@ BI.MultiDateSegment = BI.inherit(BI.Single, {
itemHeight: 24, itemHeight: 24,
maxGap: 15, maxGap: 15,
minGap: 10, minGap: 10,
textWidth: 30, textWidth: 60,
defaultEditorValue: "1" defaultEditorValue: "1"
}, },
@ -83006,7 +83006,6 @@ BI.MultiDateSegment = BI.inherit(BI.Single, {
return $.extend(BI.MultiDateSegment.superclass._defaultConfig.apply(this, arguments), { return $.extend(BI.MultiDateSegment.superclass._defaultConfig.apply(this, arguments), {
baseCls: 'bi-multidate-segment', baseCls: 'bi-multidate-segment',
text: "", text: "",
width: 130,
height: 30, height: 30,
isEditorExist: true, isEditorExist: true,
selected: false, selected: false,
@ -86395,16 +86394,36 @@ BI.MultiSelectSearcher = BI.inherit(BI.Widget, {
ob || (ob = {}); ob || (ob = {});
ob.value || (ob.value = []); ob.value || (ob.value = []);
if (ob.type === BI.Selection.All) { if (ob.type === BI.Selection.All) {
if (BI.size(ob.assist) === 1) { if (ob.value.length === 0) {
this.editor.setState(o.valueFormatter(ob.assist[0] + "") || (ob.assist[0] + "")); this.editor.setState(BI.Selection.All);
} else if (BI.size(ob.assist) <= 20) {
var state = "";
BI.each(ob.assist, function (i, v) {
if (i === 0) {
state += "" + (o.valueFormatter(v + "") || v);
} else {
state += "," + (o.valueFormatter(v + "") || v);
}
});
this.editor.setState(state);
} else { } else {
this.editor.setState(BI.size(ob.value) > 0 ? BI.Selection.Multi : BI.Selection.All); this.editor.setState(BI.Selection.Multi);
} }
} else { } else {
if (BI.size(ob.value) === 1) { if (ob.value.length === 0) {
this.editor.setState(o.valueFormatter(ob.value[0] + "") || (ob.value[0] + "")); this.editor.setState(BI.Selection.None);
} else if (BI.size(ob.value) <= 20) {
var state = "";
BI.each(ob.value, function (i, v) {
if (i === 0) {
state += "" + (o.valueFormatter(v + "") || v);
} else {
state += "," + (o.valueFormatter(v + "") || v);
}
});
this.editor.setState(state);
} else { } else {
this.editor.setState(BI.size(ob.value) > 0 ? BI.Selection.Multi : BI.Selection.None); this.editor.setState(BI.Selection.Multi);
} }
} }
}, },
@ -86686,7 +86705,7 @@ BI.MultiSelectInsertList = BI.inherit(BI.Widget, {
element: this, element: this,
items: [{ items: [{
el: this.trigger, el: this.trigger,
height: 30 height: 24
}, { }, {
el: this.adapter, el: this.adapter,
height: "fill" height: "fill"
@ -87000,7 +87019,7 @@ BI.MultiSelectList = BI.inherit(BI.Widget, {
element: this, element: this,
items: [{ items: [{
el: this.trigger, el: this.trigger,
height: 30 height: 24
}, { }, {
el: this.adapter, el: this.adapter,
height: "fill" height: "fill"
@ -87613,7 +87632,7 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, {
change = true; change = true;
var val = { var val = {
type: BI.Selection.Multi, type: BI.Selection.Multi,
value: this.hasChecked() ? {1: 1} : {} value: this.hasChecked() ? this.getValue() : {}
}; };
self.trigger.getSearcher().setState(val); self.trigger.getSearcher().setState(val);
self.trigger.getCounter().setButtonChecked(val); self.trigger.getCounter().setButtonChecked(val);
@ -87669,6 +87688,7 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, {
} }
}); });
}); });
function showCounter() { function showCounter() {
if (isSearching()) { if (isSearching()) {
self.storeValue = {value: self.trigger.getValue()}; self.storeValue = {value: self.trigger.getValue()};
@ -87697,11 +87717,12 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, {
}); });
this.trigger.on(BI.MultiSelectTrigger.EVENT_CHANGE, function () { this.trigger.on(BI.MultiSelectTrigger.EVENT_CHANGE, function () {
var checked = this.getSearcher().hasChecked();
var val = { var val = {
type: BI.Selection.Multi, type: BI.Selection.Multi,
value: this.getSearcher().hasChecked() ? {1: 1} : {} value: checked ? {1: 1} : {}
}; };
this.getSearcher().setState(val); this.getSearcher().setState(checked ? BI.Selection.Multi : BI.Selection.None);
this.getCounter().setButtonChecked(val); this.getCounter().setButtonChecked(val);
}); });
@ -87721,7 +87742,7 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, {
if (isSearching()) { if (isSearching()) {
self.trigger.stopEditing(); self.trigger.stopEditing();
self.fireEvent(BI.MultiTreeCombo.EVENT_CONFIRM); self.fireEvent(BI.MultiTreeCombo.EVENT_CONFIRM);
}else{ } else {
if (isPopupView()) { if (isPopupView()) {
self.trigger.stopEditing(); self.trigger.stopEditing();
self.storeValue = {value: self.combo.getValue()}; self.storeValue = {value: self.combo.getValue()};
@ -88132,11 +88153,29 @@ BI.MultiTreeSearcher = BI.inherit(BI.Widget, {
setState: function (ob) { setState: function (ob) {
ob || (ob = {}); ob || (ob = {});
ob.value || (ob.value = []); ob.value || (ob.value = {});
if (ob.type === BI.Selection.All) { if (BI.isNumber(ob)) {
this.editor.setState(BI.size(ob.value) > 0 ? BI.Selection.Multi : BI.Selection.All); this.editor.setState(ob);
} else if (BI.size(ob.value) === 0) {
this.editor.setState(BI.Selection.None);
} else { } else {
this.editor.setState(BI.size(ob.value) > 0 ? BI.Selection.Multi : BI.Selection.None); var text = "";
BI.each(ob.value, function (name, children) {
var childNodes = getChildrenNode(children);
text += name + (childNodes === "" ? "" : (":" + childNodes)) + "; ";
});
this.editor.setState(text);
}
function getChildrenNode(ob) {
var text = "";
var index = 0, size = BI.size(ob);
BI.each(ob, function (name, children) {
index++;
var childNodes = getChildrenNode(children);
text += name + (childNodes === "" ? "" : (":" + childNodes)) + (index === size ? "" : ",");
});
return text;
} }
}, },

50
dist/bundle.min.js vendored

File diff suppressed because one or more lines are too long

3
dist/case.js vendored

@ -9543,7 +9543,8 @@ BI.AdaptiveTable = BI.inherit(BI.Widget, {
}, },
_getFreezeColLength: function () { _getFreezeColLength: function () {
return this.options.isNeedFreeze === true ? this.options.freezeCols.length : 0; var o = this.options;
return o.isNeedFreeze === true ? BI.clamp(o.freezeCols.length, 0, o.columnSize.length) : 0;
}, },
_digest: function () { _digest: function () {

130
dist/demo.js vendored

@ -953,7 +953,7 @@ BI.shortcut("demo.collection_table", Demo.Func);Demo.Func = BI.inherit(BI.Widget
var table = BI.createWidget({ var table = BI.createWidget({
type: "bi.resizable_table", type: "bi.resizable_table",
el: { el: {
type: "bi.grid_table", type: "bi.grid_table"
}, },
width: 600, width: 600,
height: 500, height: 500,
@ -1009,7 +1009,7 @@ BI.shortcut("demo.grid_table", Demo.Func);Demo.Func = BI.inherit(BI.Widget, {
var table = BI.createWidget({ var table = BI.createWidget({
type: "bi.resizable_table", type: "bi.resizable_table",
el: { el: {
type: "bi.grid_table", type: "bi.grid_table"
}, },
width: 600, width: 600,
height: 500, height: 500,
@ -1972,7 +1972,7 @@ BI.shortcut("demo.calendar", Demo.Func);Demo.Func = BI.inherit(BI.Widget, {
items: [{ items: [{
el: editor, el: editor,
left: 100, left: 100,
top: 50, top: 50
}, { }, {
el: clipboard, el: clipboard,
left: 100, left: 100,
@ -2420,7 +2420,7 @@ BI.shortcut("demo.all_count_pager", Demo.Func);Demo.Func = BI.inherit(BI.Widget,
vgap: 50, vgap: 50,
element: this, element: this,
items: [{ items: [{
type: "bi.direction_pager", type: "bi.direction_pager"
}] }]
}) })
} }
@ -2690,7 +2690,7 @@ BI.shortcut("demo.popup_panel", Demo.Func);Demo.Func = BI.inherit(BI.Widget, {
el: { el: {
type: "bi.resizable_table", type: "bi.resizable_table",
el: { el: {
type: "bi.grid_table", type: "bi.grid_table"
} }
}, },
width: 600, width: 600,
@ -3923,7 +3923,7 @@ BI.DemoLevelTree = BI.inherit(BI.Widget, {
"text": "B", "text": "B",
value: 2, value: 2,
isParent: true, isParent: true,
open: true, open: true
}]) }])
} else { } else {
if (op.node.id == 1) { if (op.node.id == 1) {
@ -3941,14 +3941,14 @@ BI.DemoLevelTree = BI.inherit(BI.Widget, {
"pId": 1, "pId": 1,
"text": "test12", "text": "test12",
value: 12, value: 12,
layer: 1, layer: 1
}, },
{ {
"id": 13, "id": 13,
"pId": 1, "pId": 1,
"text": "test13", "text": "test13",
value: 13, value: 13,
layer: 1, layer: 1
}, },
{ {
"id": 14, "id": 14,
@ -3963,14 +3963,14 @@ BI.DemoLevelTree = BI.inherit(BI.Widget, {
"pId": 1, "pId": 1,
"text": "test15", "text": "test15",
value: 15, value: 15,
layer: 1, layer: 1
}, },
{ {
"id": 16, "id": 16,
"pId": 1, "pId": 1,
"text": "test16", "text": "test16",
value: 16, value: 16,
layer: 1, layer: 1
}, },
{"id": 17, "pId": 1, "text": "test17", layer: 1, value: 17} {"id": 17, "pId": 1, "text": "test17", layer: 1, value: 17}
]) ])
@ -3980,14 +3980,14 @@ BI.DemoLevelTree = BI.inherit(BI.Widget, {
"pId": 2, "pId": 2,
"text": "test21", "text": "test21",
value: 21, value: 21,
layer: 1, layer: 1
}, },
{ {
"id": 22, "id": 22,
"pId": 2, "pId": 2,
"text": "test22", "text": "test22",
value: 22, value: 22,
layer: 1, layer: 1
}]) }])
} else if (op.node.id == 11) { } else if (op.node.id == 11) {
callback([{ callback([{
@ -3995,7 +3995,7 @@ BI.DemoLevelTree = BI.inherit(BI.Widget, {
"pId": 11, "pId": 11,
"text": "test111", "text": "test111",
value: 111, value: 111,
layer: 2, layer: 2
}]) }])
} }
} }
@ -4063,7 +4063,7 @@ BI.DetailTableCell = BI.inherit(BI.Widget, {
if (BI.isNotNull(o.styles) && BI.isObject(o.styles)) { if (BI.isNotNull(o.styles) && BI.isObject(o.styles)) {
this.element.css(o.styles); this.element.css(o.styles);
} }
}, }
}); });
BI.shortcut("bi.detail_table_cell", BI.DetailTableCell);/** BI.shortcut("bi.detail_table_cell", BI.DetailTableCell);/**
* Created by Young's on 2016/4/15. * Created by Young's on 2016/4/15.
@ -4100,7 +4100,7 @@ BI.DetailTableHeader = BI.inherit(BI.Widget, {
if (BI.isNotNull(o.styles) && BI.isObject(o.styles)) { if (BI.isNotNull(o.styles) && BI.isObject(o.styles)) {
this.element.css(o.styles); this.element.css(o.styles);
} }
}, }
}); });
BI.shortcut("bi.detail_table_header", BI.DetailTableHeader);Demo.Face = BI.inherit(BI.Widget, { BI.shortcut("bi.detail_table_header", BI.DetailTableHeader);Demo.Face = BI.inherit(BI.Widget, {
props: { props: {
@ -4243,7 +4243,7 @@ BI.shortcut("demo.large_table", Demo.Face);/**
BI.NormalSequenceHeaderCell = BI.inherit(BI.Widget, { BI.NormalSequenceHeaderCell = BI.inherit(BI.Widget, {
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.NormalSequenceHeaderCell.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.NormalSequenceHeaderCell.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-normal-sequence-header-cell", baseCls: "bi-normal-sequence-header-cell"
}) })
}, },
@ -4409,7 +4409,7 @@ Demo.SortTree = BI.inherit(BI.Widget, {
} }
}); });
return nodes; return nodes;
}, }
}); });
BI.shortcut("demo.sort_tree", Demo.SortTree);Demo.Center = BI.inherit(BI.Widget, { BI.shortcut("demo.sort_tree", Demo.SortTree);Demo.Center = BI.inherit(BI.Widget, {
props: { props: {
@ -4537,7 +4537,7 @@ Demo.TreeValueChooser = BI.inherit(BI.Widget, {
return { return {
type: "bi.tree_value_chooser_pane", type: "bi.tree_value_chooser_pane",
items: BI.deepClone(Demo.CONSTANTS.TREEITEMS), items: BI.deepClone(Demo.CONSTANTS.TREEITEMS)
// itemsCreator: function (op, callback) { // itemsCreator: function (op, callback) {
// callback(tree); // callback(tree);
// } // }
@ -4571,7 +4571,7 @@ BI.shortcut("demo.value_chooser_combo", Demo.ValueChooserCombo);Demo.ValueChoose
render: function () { render: function () {
return { return {
type: "bi.value_chooser_pane", type: "bi.value_chooser_pane",
items: BI.deepClone(Demo.CONSTANTS.ITEMS), items: BI.deepClone(Demo.CONSTANTS.ITEMS)
// itemsCreator: function (op, callback) { // itemsCreator: function (op, callback) {
// callback(BI.deepClone(Demo.CONSTANTS.ITEMS)); // callback(BI.deepClone(Demo.CONSTANTS.ITEMS));
// } // }
@ -5195,7 +5195,7 @@ var viewRouter = new (BI.inherit(BI.WRouter, {
"/tmp": "TmpView", "/tmp": "TmpView",
"/tmp/child": "TmpChildView", "/tmp/child": "TmpChildView",
"/tmp/child/child": "TmpChildChildView", "/tmp/child/child": "TmpChildChildView"
}, },
getSkipToView: function (v) { getSkipToView: function (v) {
@ -5257,6 +5257,11 @@ Demo.FIX_CONFIG = [{
}, { }, {
id: 72, id: 72,
pId: 7, pId: 7,
text: "state属性",
value: "demo.fix6"
}, {
id: 78,
pId: 7,
text: "计算属性", text: "计算属性",
value: "demo.fix2" value: "demo.fix2"
}, { }, {
@ -6591,7 +6596,7 @@ BI.shortcut("demo.tab", Demo.Func);Demo.Func = BI.inherit(BI.Widget, {
type: "bi.vertical", type: "bi.vertical",
items: [{ items: [{
type: "bi.vtape", type: "bi.vtape",
height: 200, height: 200
}] }]
}], }],
items: [{ items: [{
@ -6599,7 +6604,7 @@ BI.shortcut("demo.tab", Demo.Func);Demo.Func = BI.inherit(BI.Widget, {
type: "bi.label", type: "bi.label",
text: "button_group是一类具有相同属性或相似属性的抽象, 本案例实现的是布局的嵌套(vertical布局下内嵌center_adapt布局)" text: "button_group是一类具有相同属性或相似属性的抽象, 本案例实现的是布局的嵌套(vertical布局下内嵌center_adapt布局)"
}, },
height: 150, height: 150
}, { }, {
el: { el: {
type: "bi.button", type: "bi.button",
@ -6645,7 +6650,7 @@ BI.shortcut("demo.button_group", Demo.Func);Demo.Func = BI.inherit(BI.Widget, {
layouts: [{ layouts: [{
type: "bi.vertical" type: "bi.vertical"
}, { }, {
type: "bi.center_adapt", type: "bi.center_adapt"
}], }],
items: [{ items: [{
type: "bi.label", type: "bi.label",
@ -7011,7 +7016,7 @@ BI.shortcut("demo.grid_view", Demo.Func);Demo.Func = BI.inherit(BI.Widget, {
type: "bi.label", type: "bi.label",
width: 200, width: 200,
height: 200, height: 200,
text: (i + 1) + "." + item.text, text: (i + 1) + "." + item.text
}); });
}) })
} }
@ -7138,7 +7143,7 @@ BI.shortcut("demo.virtual_group_item", Demo.Item);Demo.Func = BI.inherit(BI.Widg
return BI.extend({}, item, { return BI.extend({}, item, {
type: "bi.label", type: "bi.label",
height: 30, height: 30,
text: (i + 1) + "." + item.text, text: (i + 1) + "." + item.text
}); });
}) })
} }
@ -7276,7 +7281,7 @@ BI.shortcut("demo.border", Demo.BorderLayout);Demo.CenterAdapt = BI.inherit(BI.W
cls: "layout-bg1" cls: "layout-bg1"
}] }]
} }
}, }
}); });
BI.shortcut("demo.center_adapt", Demo.CenterAdapt);/** BI.shortcut("demo.center_adapt", Demo.CenterAdapt);/**
* Created by User on 2017/3/22. * Created by User on 2017/3/22.
@ -8505,15 +8510,15 @@ BI.shortcut("demo.vtape", Demo.VtapeLayout);Demo.Face = BI.inherit(BI.Widget, {
}, { }, {
text: "column 1.222222222222222222222222222222222222", text: "column 1.222222222222222222222222222222222222",
cls: "dot-e-font", cls: "dot-e-font",
value: 22, value: 22
}, { }, {
text: "column 1.3", text: "column 1.3",
cls: "dot-e-font", cls: "dot-e-font",
value: 23, value: 23
}, { }, {
text: "column 1.4", text: "column 1.4",
cls: "dot-e-font", cls: "dot-e-font",
value: 24, value: 24
}, { }, {
text: "column 1.5", text: "column 1.5",
cls: "dot-e-font", cls: "dot-e-font",
@ -8536,7 +8541,7 @@ BI.shortcut("demo.vtape", Demo.VtapeLayout);Demo.Face = BI.inherit(BI.Widget, {
height: 25, height: 25,
text: "column 2.1", text: "column 2.1",
value: 11 value: 11
}, {text: "column 2.2", value: 12, cls: "dot-e-font"}], }, {text: "column 2.2", value: 12, cls: "dot-e-font"}]
} }
@ -10337,6 +10342,7 @@ BI.shortcut("demo.tmp", Demo.Func);
return { return {
type: "bi.tab", type: "bi.tab",
defaultShowIndex: this.constant.TAB1, defaultShowIndex: this.constant.TAB1,
single: true,
tab: { tab: {
type: "bi.button_group", type: "bi.button_group",
items: BI.createItems([{ items: BI.createItems([{
@ -10411,7 +10417,7 @@ BI.shortcut("demo.tmp", Demo.Func);
type: "bi.label", type: "bi.label",
cls: "layout-bg1", cls: "layout-bg1",
width: 150 width: 150
}), })
}, { }, {
type: "bi.vertical", type: "bi.vertical",
@ -10639,7 +10645,55 @@ BI.shortcut("demo.tmp", Demo.Func);
}); });
BI.shortcut("demo.fix_scene_fine_index_update", Demo.FixSceneFineIndexUpdate); BI.shortcut("demo.fix_scene_fine_index_update", Demo.FixSceneFineIndexUpdate);
})();;(function(){ })();;(function () {
var State = BI.inherit(Fix.VM, {
state: function () {
return {
name: "原始属性"
}
},
computed: {
b: function () {
return this.model.name + "-计算属性"
}
}
})
Demo.Fix = BI.inherit(BI.Widget, {
_store: function () {
return new State();
},
watch: {
b: function () {
this.button.setText(this.model.b)
}
},
render: function () {
var self = this;
return {
type: "bi.absolute",
items: [{
el: {
type: "bi.button",
ref: function () {
self.button = this;
},
handler: function () {
self.model.name = "这是改变后的属性"
},
text: this.model.b
}
}]
}
},
mounted: function () {
}
});
BI.shortcut("demo.fix6", Demo.Fix);
}());;(function(){
var model = Fix.define({ var model = Fix.define({
name: "原始属性", name: "原始属性",
arr: [{ arr: [{
@ -11958,7 +12012,7 @@ BI.shortcut("demo.date_time", Demo.CustomDateTime);Demo.Downlist = BI.inherit(BI
}, { }, {
text: "column 1.222222222222222222222222222222222222", text: "column 1.222222222222222222222222222222222222",
cls: "dot-e-font", cls: "dot-e-font",
value: 22, value: 22
}] }]
}], }],
[{ [{
@ -12746,7 +12800,7 @@ Demo.RelationView = BI.inherit(BI.Widget, {
foreign: {region: "B", value: "b1", text: "b1字段"} foreign: {region: "B", value: "b1", text: "b1字段"}
}, },
{ {
primary: {region: "X33", value: "x233", text: "x233字段"}, primary: {region: "X33", value: "x233", text: "x233字段"}
} }
] ]
}); });
@ -13140,7 +13194,7 @@ BI.shortcut("demo.slider", Demo.Slider);Demo.Func = BI.inherit(BI.Widget, {
type: "bi.page_table_cell", type: "bi.page_table_cell",
text: "node3", text: "node3",
values: [1, 2] values: [1, 2]
}], }]
//values: [1, 2] //values: [1, 2]
}]; }];
@ -13159,7 +13213,7 @@ BI.shortcut("demo.slider", Demo.Slider);Demo.Func = BI.inherit(BI.Widget, {
type: "bi.collection_table" type: "bi.collection_table"
} }
} }
}, }
}, },
sequence: { sequence: {
type: "bi.sequence_table_dynamic_number" type: "bi.sequence_table_dynamic_number"
@ -13762,7 +13816,7 @@ BI.shortcut("demo.responsive_table", Demo.Func);Demo.Func = BI.inherit(BI.Widget
type: "bi.collection_table" type: "bi.collection_table"
} }
} }
}, }
}, },
sequence: { sequence: {
type: "bi.sequence_table_tree_number" type: "bi.sequence_table_tree_number"
@ -14171,7 +14225,7 @@ Demo.YearQuarterCombo = BI.inherit(BI.Widget, {
self.widget = _ref; self.widget = _ref;
}, },
yearBehaviors: {}, yearBehaviors: {},
quarterBehaviors: {}, quarterBehaviors: {}
}, { }, {
type: "bi.button", type: "bi.button",
text: "getValue", text: "getValue",

2
dist/fix/fix.compact.js vendored

@ -34,7 +34,7 @@
var unMount = BI.Widget.prototype._unMount; var unMount = BI.Widget.prototype._unMount;
BI.Widget.prototype._unMount = function () { BI.Widget.prototype._unMount = function () {
unMount.apply(this, arguments); unMount.apply(this, arguments);
this.store && this.store.destroy(); this.store && BI.isFunction(this.store.destroy) && this.store.destroy();
BI.each(this._watchers, function (i, unwatches) { BI.each(this._watchers, function (i, unwatches) {
unwatches = BI.isArray(unwatches) ? unwatches : [unwatches]; unwatches = BI.isArray(unwatches) ? unwatches : [unwatches];
BI.each(unwatches, function (j, unwatch) { BI.each(unwatches, function (j, unwatch) {

268
dist/fix/fix.js vendored

@ -48,7 +48,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
} }
function remove(arr, item) { function remove(arr, item) {
if (arr.length) { if (arr && arr.length) {
var _index = arr.indexOf(item); var _index = arr.indexOf(item);
if (_index > -1) { if (_index > -1) {
return arr.splice(_index, 1); return arr.splice(_index, 1);
@ -437,9 +437,87 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
return ob; return ob;
} }
function notify(model, key, dep) {
dep.notify();
//触发a.*绑定的依赖
_.each(model.__ob__._deps, function (dep) {
dep.notify();
});
//触发a.**绑定的依赖
var parent = model.__ob__,
root = model.__ob__,
route = key;
while (parent) {
_.each(parent._scopeDeps, function (dep) {
dep.notify();
});
if (parent.parentKey != null) {
route = parent.parentKey + '.' + route;
}
root = parent;
parent = parent.parent;
}
for (var _key2 in root._globalDeps) {
var reg = new RegExp(_key2);
if (reg.test(route)) {
root._globalDeps[_key2].notify();
}
}
}
function defineReactive(obj, observer, shallow) { function defineReactive(obj, observer, shallow) {
var props = {}; var props = {};
var model = void 0; var model = void 0;
if (typeof Proxy === 'function') {
var deps = {},
childObs = {},
cache = {};
_.each(obj, function (val, key) {
if (key in $$skipArray) {
return;
}
cache[key] = val;
var dep = deps[key] = observer && observer['__dep' + key] || new Dep();
observer && (observer['__dep' + key] = dep);
childObs[key] = !shallow && observe(val, observer, key);
});
return model = new Proxy(props, {
has: function has(target, key) {
return key in obj;
},
get: function get(target, key) {
if (key in $$skipArray) {
return target[key];
}
var value = cache[key];
if (Dep.target) {
deps[key].depend();
if (childObs[key]) {
childObs[key].dep.depend();
if (_.isArray(value)) {
dependArray(value);
}
}
}
return value;
},
set: function set(target, key, newVal) {
if (key in $$skipArray) {
return target[key] = newVal;
}
var value = cache[key],
dep = deps[key];
if (newVal === value || newVal !== newVal && value !== value) {
return newVal;
}
cache[key] = newVal;
childObs[key] = !shallow && observe(newVal, observer, key);
obj[key] = childObs[key] ? childObs[key].model : newVal;
notify(model, key, dep);
return obj[key];
}
});
}
_.each(obj, function (val, key) { _.each(obj, function (val, key) {
if (key in $$skipArray) { if (key in $$skipArray) {
return; return;
@ -471,31 +549,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
val = newVal; val = newVal;
childOb = !shallow && observe(newVal, observer, key); childOb = !shallow && observe(newVal, observer, key);
obj[key] = childOb ? childOb.model : newVal; obj[key] = childOb ? childOb.model : newVal;
dep.notify(); notify(model, key, dep);
//触发a.*绑定的依赖
_.each(model.__ob__._deps, function (dep) {
dep.notify();
});
//触发a.**绑定的依赖
var parent = model.__ob__,
root = model.__ob__,
route = key;
while (parent) {
_.each(parent._scopeDeps, function (dep) {
dep.notify();
});
if (parent.parentKey != null) {
route = parent.parentKey + '.' + route;
}
root = parent;
parent = parent.parent;
}
for (var _key2 in root._globalDeps) {
var reg = new RegExp(_key2);
if (reg.test(route)) {
root._globalDeps[_key2].notify();
}
}
} }
}; };
}); });
@ -820,6 +874,10 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
var computedWatcherOptions = { lazy: true }; var computedWatcherOptions = { lazy: true };
function initState(vm, state) {
vm.$$state = observe(state).model;
}
function initComputed(vm, computed) { function initComputed(vm, computed) {
var watchers = vm._computedWatchers = {}; var watchers = vm._computedWatchers = {};
@ -834,11 +892,21 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
} }
} }
function defineComputed(target, computed) { function defineComputed(vm, computed) {
var props = {}; var props = {};
if (typeof Proxy === 'function') {
return vm.$$computed = new Proxy(props, {
has: function has(target, key) {
return key in computed;
},
get: function get(target, key) {
return createComputedGetter(vm, key)();
}
});
}
var shouldCache = true; var shouldCache = true;
for (var key in computed) { for (var key in computed) {
if (!(key in target)) { if (!(key in vm)) {
var sharedPropertyDefinition = { var sharedPropertyDefinition = {
enumerable: true, enumerable: true,
configurable: true, configurable: true,
@ -847,7 +915,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
}; };
var userDef = computed[key]; var userDef = computed[key];
if (typeof userDef === 'function') { if (typeof userDef === 'function') {
sharedPropertyDefinition.get = createComputedGetter(target, key); sharedPropertyDefinition.get = createComputedGetter(vm, key);
sharedPropertyDefinition.set = noop; sharedPropertyDefinition.set = noop;
} else { } else {
sharedPropertyDefinition.get = userDef.get ? shouldCache && userDef.cache !== false ? createComputedGetter(key) : userDef.get : noop; sharedPropertyDefinition.get = userDef.get ? shouldCache && userDef.cache !== false ? createComputedGetter(key) : userDef.get : noop;
@ -857,7 +925,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
props[key] = sharedPropertyDefinition; props[key] = sharedPropertyDefinition;
} }
} }
target.$$computed = createViewModel$1({}, props); vm.$$computed = createViewModel$1({}, props);
} }
function createComputedGetter(vm, key) { function createComputedGetter(vm, key) {
@ -881,11 +949,76 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
} }
} }
function defineProps(vm, keys) {
var props = {};
if (typeof Proxy === 'function') {
return vm.model = new Proxy(props, {
has: function has(target, key) {
return keys.indexOf(key) > -1;
},
get: function get(target, key) {
if (key in $$skipArray) {
return props[key];
}
if (vm.$$computed && key in vm.$$computed) {
return vm.$$computed[key];
}
if (vm.$$state && key in vm.$$state) {
return vm.$$state[key];
}
return vm.$$model[key];
},
set: function set(target, key, val) {
if (key in $$skipArray) {
return props[key] = val;
}
if (vm.$$state && key in vm.$$state) {
return vm.$$state[key] = val;
}
if (vm.$$model && key in vm.$$model) {
return vm.$$model[key] = val;
}
}
});
}
var _loop = function _loop(i, len) {
var key = keys[i];
if (!(key in $$skipArray)) {
props[key] = {
enumerable: true,
configurable: true,
get: function get() {
if (vm.$$computed && key in vm.$$computed) {
return vm.$$computed[key];
}
if (vm.$$state && key in vm.$$state) {
return vm.$$state[key];
}
return vm.$$model[key];
},
set: function set(val) {
if (vm.$$state && key in vm.$$state) {
return vm.$$state[key] = val;
}
if (vm.$$model && key in vm.$$model) {
return vm.$$model[key] = val;
}
}
};
}
};
for (var i = 0, len = keys.length; i < len; i++) {
_loop(i, len);
}
vm.model = createViewModel$1({}, props);
}
var VM = function () { var VM = function () {
function VM(model) { function VM(model) {
_classCallCheck(this, VM); _classCallCheck(this, VM);
var vm = this;
if (model instanceof Observer || model instanceof VM) { if (model instanceof Observer || model instanceof VM) {
model = model.model; model = model.model;
} }
@ -894,33 +1027,11 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
} else { } else {
this.options = model || {}; this.options = model || {};
} }
var keys = _.keys(this.$$model).concat(_.keys(this.computed)); var state = this.state && this.state();
var props = {}; var keys = _.keys(this.$$model).concat(_.keys(state)).concat(_.keys(this.computed));
defineProps(this, keys);
var _loop = function _loop(i, len) {
var key = keys[i];
if (!(key in $$skipArray)) {
props[key] = {
enumerable: true,
configurable: true,
get: function get() {
return key in vm.$$computed ? vm.$$computed[key] : vm.$$model[key];
},
set: function set(val) {
if (!vm.$$model || !(key in vm.$$model)) {
return;
}
return vm.$$model[key] = val;
}
};
}
};
for (var i = 0, len = keys.length; i < len; i++) {
_loop(i, len);
}
this.model = createViewModel$1({}, props);
this.$$model && (this.model.__ob__ = this.$$model.__ob__); this.$$model && (this.model.__ob__ = this.$$model.__ob__);
state && initState(this, state);
initComputed(this, this.computed); initComputed(this, this.computed);
initMethods(this, this.actions); initMethods(this, this.actions);
this._init(); this._init();
@ -989,6 +1100,24 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
var fns = exps.slice(); var fns = exps.slice();
var complete = false, var complete = false,
running = false; running = false;
var callback = function callback(index) {
if (complete === true) {
return;
}
fns[index] = true;
if (runBinaryFunction(fns)) {
complete = true;
cb();
}
if (!running) {
running = true;
nextTick(function () {
complete = false;
running = false;
fns = exps.slice();
});
}
};
_.each(exps, function (exp, i) { _.each(exps, function (exp, i) {
if (_.has(operators, exp)) { if (_.has(operators, exp)) {
return; return;
@ -1014,7 +1143,9 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
var w = new Watcher(model, function () { var w = new Watcher(model, function () {
dep.depend(); dep.depend();
return NaN; return NaN;
}, cb); }, function () {
callback(i);
});
watchers.push(function unwatchFn() { watchers.push(function unwatchFn() {
w.teardown(); w.teardown();
v.__ob__._scopeDeps && remove(v.__ob__._scopeDeps, dep); v.__ob__._scopeDeps && remove(v.__ob__._scopeDeps, dep);
@ -1043,7 +1174,9 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
var _w = new Watcher(model, function () { var _w = new Watcher(model, function () {
_dep.depend(); _dep.depend();
return NaN; return NaN;
}, cb); }, function () {
callback(i);
});
watchers.push(function unwatchFn() { watchers.push(function unwatchFn() {
_w.teardown(); _w.teardown();
root._globalDeps && delete root._globalDeps[regStr]; root._globalDeps && delete root._globalDeps[regStr];
@ -1051,22 +1184,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
return; return;
} }
var watcher = new Watcher(model, exp, function () { var watcher = new Watcher(model, exp, function () {
if (complete === true) { callback(i);
return;
}
fns[i] = true;
if (runBinaryFunction(fns)) {
complete = true;
cb();
}
if (!running) {
running = true;
nextTick(function () {
complete = false;
running = false;
fns = exps.slice();
});
}
}, options); }, options);
watchers.push(function unwatchFn() { watchers.push(function unwatchFn() {
watcher.teardown(); watcher.teardown();

75
dist/widget.js vendored

@ -7952,7 +7952,7 @@ BI.MultiDateSegment = BI.inherit(BI.Single, {
itemHeight: 24, itemHeight: 24,
maxGap: 15, maxGap: 15,
minGap: 10, minGap: 10,
textWidth: 30, textWidth: 60,
defaultEditorValue: "1" defaultEditorValue: "1"
}, },
@ -7960,7 +7960,6 @@ BI.MultiDateSegment = BI.inherit(BI.Single, {
return $.extend(BI.MultiDateSegment.superclass._defaultConfig.apply(this, arguments), { return $.extend(BI.MultiDateSegment.superclass._defaultConfig.apply(this, arguments), {
baseCls: 'bi-multidate-segment', baseCls: 'bi-multidate-segment',
text: "", text: "",
width: 130,
height: 30, height: 30,
isEditorExist: true, isEditorExist: true,
selected: false, selected: false,
@ -11349,16 +11348,36 @@ BI.MultiSelectSearcher = BI.inherit(BI.Widget, {
ob || (ob = {}); ob || (ob = {});
ob.value || (ob.value = []); ob.value || (ob.value = []);
if (ob.type === BI.Selection.All) { if (ob.type === BI.Selection.All) {
if (BI.size(ob.assist) === 1) { if (ob.value.length === 0) {
this.editor.setState(o.valueFormatter(ob.assist[0] + "") || (ob.assist[0] + "")); this.editor.setState(BI.Selection.All);
} else if (BI.size(ob.assist) <= 20) {
var state = "";
BI.each(ob.assist, function (i, v) {
if (i === 0) {
state += "" + (o.valueFormatter(v + "") || v);
} else {
state += "," + (o.valueFormatter(v + "") || v);
}
});
this.editor.setState(state);
} else { } else {
this.editor.setState(BI.size(ob.value) > 0 ? BI.Selection.Multi : BI.Selection.All); this.editor.setState(BI.Selection.Multi);
} }
} else { } else {
if (BI.size(ob.value) === 1) { if (ob.value.length === 0) {
this.editor.setState(o.valueFormatter(ob.value[0] + "") || (ob.value[0] + "")); this.editor.setState(BI.Selection.None);
} else if (BI.size(ob.value) <= 20) {
var state = "";
BI.each(ob.value, function (i, v) {
if (i === 0) {
state += "" + (o.valueFormatter(v + "") || v);
} else {
state += "," + (o.valueFormatter(v + "") || v);
}
});
this.editor.setState(state);
} else { } else {
this.editor.setState(BI.size(ob.value) > 0 ? BI.Selection.Multi : BI.Selection.None); this.editor.setState(BI.Selection.Multi);
} }
} }
}, },
@ -11640,7 +11659,7 @@ BI.MultiSelectInsertList = BI.inherit(BI.Widget, {
element: this, element: this,
items: [{ items: [{
el: this.trigger, el: this.trigger,
height: 30 height: 24
}, { }, {
el: this.adapter, el: this.adapter,
height: "fill" height: "fill"
@ -11954,7 +11973,7 @@ BI.MultiSelectList = BI.inherit(BI.Widget, {
element: this, element: this,
items: [{ items: [{
el: this.trigger, el: this.trigger,
height: 30 height: 24
}, { }, {
el: this.adapter, el: this.adapter,
height: "fill" height: "fill"
@ -12567,7 +12586,7 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, {
change = true; change = true;
var val = { var val = {
type: BI.Selection.Multi, type: BI.Selection.Multi,
value: this.hasChecked() ? {1: 1} : {} value: this.hasChecked() ? this.getValue() : {}
}; };
self.trigger.getSearcher().setState(val); self.trigger.getSearcher().setState(val);
self.trigger.getCounter().setButtonChecked(val); self.trigger.getCounter().setButtonChecked(val);
@ -12623,6 +12642,7 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, {
} }
}); });
}); });
function showCounter() { function showCounter() {
if (isSearching()) { if (isSearching()) {
self.storeValue = {value: self.trigger.getValue()}; self.storeValue = {value: self.trigger.getValue()};
@ -12651,11 +12671,12 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, {
}); });
this.trigger.on(BI.MultiSelectTrigger.EVENT_CHANGE, function () { this.trigger.on(BI.MultiSelectTrigger.EVENT_CHANGE, function () {
var checked = this.getSearcher().hasChecked();
var val = { var val = {
type: BI.Selection.Multi, type: BI.Selection.Multi,
value: this.getSearcher().hasChecked() ? {1: 1} : {} value: checked ? {1: 1} : {}
}; };
this.getSearcher().setState(val); this.getSearcher().setState(checked ? BI.Selection.Multi : BI.Selection.None);
this.getCounter().setButtonChecked(val); this.getCounter().setButtonChecked(val);
}); });
@ -12675,7 +12696,7 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, {
if (isSearching()) { if (isSearching()) {
self.trigger.stopEditing(); self.trigger.stopEditing();
self.fireEvent(BI.MultiTreeCombo.EVENT_CONFIRM); self.fireEvent(BI.MultiTreeCombo.EVENT_CONFIRM);
}else{ } else {
if (isPopupView()) { if (isPopupView()) {
self.trigger.stopEditing(); self.trigger.stopEditing();
self.storeValue = {value: self.combo.getValue()}; self.storeValue = {value: self.combo.getValue()};
@ -13086,11 +13107,29 @@ BI.MultiTreeSearcher = BI.inherit(BI.Widget, {
setState: function (ob) { setState: function (ob) {
ob || (ob = {}); ob || (ob = {});
ob.value || (ob.value = []); ob.value || (ob.value = {});
if (ob.type === BI.Selection.All) { if (BI.isNumber(ob)) {
this.editor.setState(BI.size(ob.value) > 0 ? BI.Selection.Multi : BI.Selection.All); this.editor.setState(ob);
} else if (BI.size(ob.value) === 0) {
this.editor.setState(BI.Selection.None);
} else { } else {
this.editor.setState(BI.size(ob.value) > 0 ? BI.Selection.Multi : BI.Selection.None); var text = "";
BI.each(ob.value, function (name, children) {
var childNodes = getChildrenNode(children);
text += name + (childNodes === "" ? "" : (":" + childNodes)) + "; ";
});
this.editor.setState(text);
}
function getChildrenNode(ob) {
var text = "";
var index = 0, size = BI.size(ob);
BI.each(ob, function (name, children) {
index++;
var childNodes = getChildrenNode(children);
text += name + (childNodes === "" ? "" : (":" + childNodes)) + (index === size ? "" : ",");
});
return text;
} }
}, },

4
src/base/single/editor/editor.code.js

@ -185,10 +185,6 @@ BI.CodeEditor = BI.inherit(BI.Single, {
setStyle: function (style) { setStyle: function (style) {
this.style = style; this.style = style;
this.element.css(style); this.element.css(style);
var wrapperStyle = this.editor.getWrapperElement().style;
BI.extend(wrapperStyle, style, {
color: style.color || BI.DOM.getContrastColor(BI.DOM.isRGBColor(style.backgroundColor) ? BI.DOM.rgb2hex(style.backgroundColor) : style.backgroundColor)
});
}, },
getStyle: function () { getStyle: function () {

3
src/base/table/table.collection.js

@ -170,7 +170,8 @@ BI.CollectionTable = BI.inherit(BI.Widget, {
}, },
_getFreezeColLength: function () { _getFreezeColLength: function () {
return this.options.isNeedFreeze ? this.options.freezeCols.length : 0; var o = this.options;
return o.isNeedFreeze === true ? BI.clamp(o.freezeCols.length, 0, o.columnSize.length) : 0;
}, },
_getFreezeHeaderHeight: function () { _getFreezeHeaderHeight: function () {

3
src/base/table/table.grid.js

@ -173,7 +173,8 @@ BI.GridTable = BI.inherit(BI.Widget, {
}, },
_getFreezeColLength: function () { _getFreezeColLength: function () {
return this.options.isNeedFreeze ? this.options.freezeCols.length : 0; var o = this.options;
return o.isNeedFreeze === true ? BI.clamp(o.freezeCols.length, 0, o.columnSize.length) : 0;
}, },
_getFreezeHeaderHeight: function () { _getFreezeHeaderHeight: function () {

3
src/base/table/table.resizable.js

@ -181,7 +181,8 @@ BI.ResizableTable = BI.inherit(BI.Widget, {
}, },
_getFreezeColLength: function () { _getFreezeColLength: function () {
return this.options.freezeCols.length; var o = this.options;
return o.isNeedFreeze === true ? BI.clamp(o.freezeCols.length, 0, o.columnSize.length) : 0;
}, },
_getFreezeColumnSize: function () { _getFreezeColumnSize: function () {

3
src/case/table/table.adaptive.js

@ -95,7 +95,8 @@ BI.AdaptiveTable = BI.inherit(BI.Widget, {
}, },
_getFreezeColLength: function () { _getFreezeColLength: function () {
return this.options.isNeedFreeze === true ? this.options.freezeCols.length : 0; var o = this.options;
return o.isNeedFreeze === true ? BI.clamp(o.freezeCols.length, 0, o.columnSize.length) : 0;
}, },
_digest: function () { _digest: function () {

3
src/widget/multidate/multidate.segment.js

@ -9,7 +9,7 @@ BI.MultiDateSegment = BI.inherit(BI.Single, {
itemHeight: 24, itemHeight: 24,
maxGap: 15, maxGap: 15,
minGap: 10, minGap: 10,
textWidth: 30, textWidth: 60,
defaultEditorValue: "1" defaultEditorValue: "1"
}, },
@ -17,7 +17,6 @@ BI.MultiDateSegment = BI.inherit(BI.Single, {
return $.extend(BI.MultiDateSegment.superclass._defaultConfig.apply(this, arguments), { return $.extend(BI.MultiDateSegment.superclass._defaultConfig.apply(this, arguments), {
baseCls: 'bi-multidate-segment', baseCls: 'bi-multidate-segment',
text: "", text: "",
width: 130,
height: 30, height: 30,
isEditorExist: true, isEditorExist: true,
selected: false, selected: false,

32
src/widget/multiselect/trigger/searcher.multiselect.js

@ -107,16 +107,36 @@ BI.MultiSelectSearcher = BI.inherit(BI.Widget, {
ob || (ob = {}); ob || (ob = {});
ob.value || (ob.value = []); ob.value || (ob.value = []);
if (ob.type === BI.Selection.All) { if (ob.type === BI.Selection.All) {
if (BI.size(ob.assist) === 1) { if (ob.value.length === 0) {
this.editor.setState(o.valueFormatter(ob.assist[0] + "") || (ob.assist[0] + "")); this.editor.setState(BI.Selection.All);
} else if (BI.size(ob.assist) <= 20) {
var state = "";
BI.each(ob.assist, function (i, v) {
if (i === 0) {
state += "" + (o.valueFormatter(v + "") || v);
} else {
state += "," + (o.valueFormatter(v + "") || v);
}
});
this.editor.setState(state);
} else { } else {
this.editor.setState(BI.size(ob.value) > 0 ? BI.Selection.Multi : BI.Selection.All); this.editor.setState(BI.Selection.Multi);
} }
} else { } else {
if (BI.size(ob.value) === 1) { if (ob.value.length === 0) {
this.editor.setState(o.valueFormatter(ob.value[0] + "") || (ob.value[0] + "")); this.editor.setState(BI.Selection.None);
} else if (BI.size(ob.value) <= 20) {
var state = "";
BI.each(ob.value, function (i, v) {
if (i === 0) {
state += "" + (o.valueFormatter(v + "") || v);
} else {
state += "," + (o.valueFormatter(v + "") || v);
}
});
this.editor.setState(state);
} else { } else {
this.editor.setState(BI.size(ob.value) > 0 ? BI.Selection.Multi : BI.Selection.None); this.editor.setState(BI.Selection.Multi);
} }
} }
}, },

2
src/widget/multiselectlist/multiselectlist.insert.js

@ -154,7 +154,7 @@ BI.MultiSelectInsertList = BI.inherit(BI.Widget, {
element: this, element: this,
items: [{ items: [{
el: this.trigger, el: this.trigger,
height: 30 height: 24
}, { }, {
el: this.adapter, el: this.adapter,
height: "fill" height: "fill"

2
src/widget/multiselectlist/multiselectlist.js

@ -143,7 +143,7 @@ BI.MultiSelectList = BI.inherit(BI.Widget, {
element: this, element: this,
items: [{ items: [{
el: this.trigger, el: this.trigger,
height: 30 height: 24
}, { }, {
el: this.adapter, el: this.adapter,
height: "fill" height: "fill"

10
src/widget/multitree/multi.tree.combo.js

@ -80,7 +80,7 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, {
change = true; change = true;
var val = { var val = {
type: BI.Selection.Multi, type: BI.Selection.Multi,
value: this.hasChecked() ? {1: 1} : {} value: this.hasChecked() ? this.getValue() : {}
}; };
self.trigger.getSearcher().setState(val); self.trigger.getSearcher().setState(val);
self.trigger.getCounter().setButtonChecked(val); self.trigger.getCounter().setButtonChecked(val);
@ -136,6 +136,7 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, {
} }
}); });
}); });
function showCounter() { function showCounter() {
if (isSearching()) { if (isSearching()) {
self.storeValue = {value: self.trigger.getValue()}; self.storeValue = {value: self.trigger.getValue()};
@ -164,11 +165,12 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, {
}); });
this.trigger.on(BI.MultiSelectTrigger.EVENT_CHANGE, function () { this.trigger.on(BI.MultiSelectTrigger.EVENT_CHANGE, function () {
var checked = this.getSearcher().hasChecked();
var val = { var val = {
type: BI.Selection.Multi, type: BI.Selection.Multi,
value: this.getSearcher().hasChecked() ? {1: 1} : {} value: checked ? {1: 1} : {}
}; };
this.getSearcher().setState(val); this.getSearcher().setState(checked ? BI.Selection.Multi : BI.Selection.None);
this.getCounter().setButtonChecked(val); this.getCounter().setButtonChecked(val);
}); });
@ -188,7 +190,7 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, {
if (isSearching()) { if (isSearching()) {
self.trigger.stopEditing(); self.trigger.stopEditing();
self.fireEvent(BI.MultiTreeCombo.EVENT_CONFIRM); self.fireEvent(BI.MultiTreeCombo.EVENT_CONFIRM);
}else{ } else {
if (isPopupView()) { if (isPopupView()) {
self.trigger.stopEditing(); self.trigger.stopEditing();
self.storeValue = {value: self.combo.getValue()}; self.storeValue = {value: self.combo.getValue()};

26
src/widget/multitree/trigger/searcher.multi.tree.js

@ -102,11 +102,29 @@ BI.MultiTreeSearcher = BI.inherit(BI.Widget, {
setState: function (ob) { setState: function (ob) {
ob || (ob = {}); ob || (ob = {});
ob.value || (ob.value = []); ob.value || (ob.value = {});
if (ob.type === BI.Selection.All) { if (BI.isNumber(ob)) {
this.editor.setState(BI.size(ob.value) > 0 ? BI.Selection.Multi : BI.Selection.All); this.editor.setState(ob);
} else if (BI.size(ob.value) === 0) {
this.editor.setState(BI.Selection.None);
} else { } else {
this.editor.setState(BI.size(ob.value) > 0 ? BI.Selection.Multi : BI.Selection.None); var text = "";
BI.each(ob.value, function (name, children) {
var childNodes = getChildrenNode(children);
text += name + (childNodes === "" ? "" : (":" + childNodes)) + "; ";
});
this.editor.setState(text);
}
function getChildrenNode(ob) {
var text = "";
var index = 0, size = BI.size(ob);
BI.each(ob, function (name, children) {
index++;
var childNodes = getChildrenNode(children);
text += name + (childNodes === "" ? "" : (":" + childNodes)) + (index === size ? "" : ",");
});
return text;
} }
}, },

Loading…
Cancel
Save