Browse Source

Merge remote-tracking branch 'origin/master' into bugfix

es6
iapyang 3 years ago
parent
commit
58a760e40d
  1. 7
      changelog.md
  2. 4
      dist/2.0/fineui.css
  3. 4
      dist/2.0/fineui.ie.min.js
  4. 2
      dist/2.0/fineui.ie.min.js.map
  5. 4135
      dist/2.0/fineui.js
  6. 2
      dist/2.0/fineui.js.map
  7. 4
      dist/2.0/fineui.min.css
  8. 4
      dist/2.0/fineui.min.js
  9. 2
      dist/2.0/fineui.min.js.map
  10. 4
      dist/2.0/fineui_without_normalize.css
  11. 4
      dist/2.0/fineui_without_normalize.min.css
  12. 4
      dist/core.css
  13. 4095
      dist/core.js
  14. 2
      dist/core.js.map
  15. 4
      dist/demo.css
  16. 4473
      dist/demo.js
  17. 2
      dist/demo.js.map
  18. 4
      dist/fineui.css
  19. 4
      dist/fineui.ie.min.js
  20. 2
      dist/fineui.ie.min.js.map
  21. 4143
      dist/fineui.js
  22. 2
      dist/fineui.js.map
  23. 4
      dist/fineui.min.css
  24. 4
      dist/fineui.min.js
  25. 2
      dist/fineui.min.js.map
  26. 3074
      dist/fineui_without_jquery_polyfill.js
  27. 2
      dist/fineui_without_jquery_polyfill.js.map
  28. 92
      dist/fix/fix.compact.ie.js
  29. 29
      dist/fix/fix.compact.js
  30. 2
      dist/font.css
  31. BIN
      dist/font/iconfont.eot
  32. 6
      dist/font/iconfont.svg
  33. BIN
      dist/font/iconfont.ttf
  34. BIN
      dist/font/iconfont.woff
  35. BIN
      dist/font/iconfont.woff2
  36. 8
      dist/lib/base/combination/loader.d.ts
  37. 1
      dist/lib/base/single/button/button.basic.d.ts
  38. 7
      dist/lib/index.d.ts
  39. 29
      dist/lib/router/router.d.ts
  40. 9
      dist/lib/widget/datetime/datetime.combo.d.ts
  41. 2
      dist/resource.css
  42. 63
      dist/utils.js
  43. 2
      dist/utils.js.map
  44. 4
      dist/utils.min.js
  45. 2
      dist/utils.min.js.map
  46. 2
      examples/demo.worker.js
  47. 15
      examples/dev.html
  48. 4
      examples/hooks.html
  49. 118
      examples/tab-context.html
  50. 8
      examples/worker.html
  51. 4
      package.json
  52. 1
      src/base/collection/collection.js
  53. 2
      src/base/combination/combo.js
  54. 2
      src/base/combination/expander.js
  55. 4
      src/base/combination/navigation.js
  56. 2
      src/base/combination/switcher.js
  57. 4
      src/base/combination/tab.js
  58. 1
      src/base/grid/grid.js
  59. 1
      src/base/layer/layer.popover.js
  60. 5
      src/base/layer/layer.popup.js
  61. 1
      src/base/list/listview.js
  62. 1
      src/base/list/virtuallist.js
  63. 4
      src/base/single/button/buttons/button.js
  64. 4
      src/base/single/editor/editor.textarea.js
  65. 4
      src/base/single/label/abstract.label.js
  66. 16
      src/base/single/single.js
  67. 10
      src/base/single/text.js
  68. 2
      src/base/single/trigger/trigger.js
  69. 8
      src/case/button/item.multiselect.js
  70. 11
      src/case/button/item.singleselect.radio.js
  71. 3
      src/case/button/treeitem/item.icon.treeleaf.js
  72. 8
      src/case/colorchooser/colorchooser.js
  73. 3
      src/case/colorchooser/colorchooser.popup.hex.js
  74. 3
      src/case/colorchooser/colorchooser.popup.js
  75. 4
      src/case/colorchooser/colorchooser.trigger.js
  76. 2
      src/case/colorchooser/colorchooser.trigger.long.js
  77. 7
      src/case/colorchooser/farbtastic/farbtastic.js
  78. 3
      src/case/combo/bubblecombo/combo.bubble.js
  79. 2
      src/case/combo/searchtextvaluecombo/combo.searchtextvalue.js
  80. 3
      src/case/combo/searchtextvaluecombo/popup.searchtextvalue.js
  81. 16
      src/core/base.js
  82. 12
      src/core/func/function.js
  83. 111
      src/core/platform/web/config.js
  84. 4
      src/core/platform/web/dom.js
  85. 4
      src/core/plugin.js
  86. 39
      src/core/shortcut.js
  87. 116
      src/core/widget.js
  88. 15
      src/core/wrapper/layout.js
  89. 2
      src/core/wrapper/layout/adapt/adapt.table.js
  90. 76
      src/core/wrapper/layout/adapt/inline.center.js
  91. 76
      src/core/wrapper/layout/adapt/inline.horizontal.js
  92. 63
      src/core/wrapper/layout/adapt/inline.vertical.js
  93. 23
      src/core/wrapper/layout/flex/flex.horizontal.js
  94. 102
      src/core/wrapper/layout/flex/flex.leftrightvertical.center.js
  95. 23
      src/core/wrapper/layout/flex/flex.vertical.js
  96. 18
      src/core/wrapper/layout/flex/wrapper/flex.wrapper.horizontal.js
  97. 18
      src/core/wrapper/layout/flex/wrapper/flex.wrapper.vertical.js
  98. 2
      src/core/wrapper/layout/layout.border.js
  99. 46
      src/core/wrapper/layout/layout.flow.js
  100. 2
      src/core/wrapper/layout/layout.horizontal.js
  101. Some files were not shown because too many files have changed in this diff Show More

7
changelog.md

@ -1,6 +1,13 @@
# 更新日志
2.0(2021-03)
- 优化left_right_vertical_adapt布局,去掉float属性只使用flex
- inline布局支持用calc计算fill列宽度
- 时间类型控件无翻页限制
- 时间类型控件优化动态时间面板的交互
2.0(2021-02)
- 增加updateModel属性,可以配置自动模式,自动watch属性并响应变化
- 增加beforeRender生命周期函数
2.0(2021-01)
- 修改了日期下拉面板中的当前时间按钮的交互效果

4
dist/2.0/fineui.css vendored

File diff suppressed because one or more lines are too long

4
dist/2.0/fineui.ie.min.js vendored

File diff suppressed because one or more lines are too long

2
dist/2.0/fineui.ie.min.js.map vendored

File diff suppressed because one or more lines are too long

4135
dist/2.0/fineui.js vendored

File diff suppressed because it is too large Load Diff

2
dist/2.0/fineui.js.map vendored

File diff suppressed because one or more lines are too long

4
dist/2.0/fineui.min.css vendored

File diff suppressed because one or more lines are too long

4
dist/2.0/fineui.min.js vendored

File diff suppressed because one or more lines are too long

2
dist/2.0/fineui.min.js.map vendored

File diff suppressed because one or more lines are too long

4
dist/2.0/fineui_without_normalize.css vendored

File diff suppressed because one or more lines are too long

4
dist/2.0/fineui_without_normalize.min.css vendored

File diff suppressed because one or more lines are too long

4
dist/core.css vendored

File diff suppressed because one or more lines are too long

4095
dist/core.js vendored

File diff suppressed because it is too large Load Diff

2
dist/core.js.map vendored

File diff suppressed because one or more lines are too long

4
dist/demo.css vendored

File diff suppressed because one or more lines are too long

4473
dist/demo.js vendored

File diff suppressed because it is too large Load Diff

2
dist/demo.js.map vendored

File diff suppressed because one or more lines are too long

4
dist/fineui.css vendored

File diff suppressed because one or more lines are too long

4
dist/fineui.ie.min.js vendored

File diff suppressed because one or more lines are too long

2
dist/fineui.ie.min.js.map vendored

File diff suppressed because one or more lines are too long

4143
dist/fineui.js vendored

File diff suppressed because it is too large Load Diff

2
dist/fineui.js.map vendored

File diff suppressed because one or more lines are too long

4
dist/fineui.min.css vendored

File diff suppressed because one or more lines are too long

4
dist/fineui.min.js vendored

File diff suppressed because one or more lines are too long

2
dist/fineui.min.js.map vendored

File diff suppressed because one or more lines are too long

3074
dist/fineui_without_jquery_polyfill.js vendored

File diff suppressed because it is too large Load Diff

2
dist/fineui_without_jquery_polyfill.js.map vendored

File diff suppressed because one or more lines are too long

92
dist/fix/fix.compact.ie.js vendored

@ -82,7 +82,7 @@
if (p instanceof Fix.Model || p.store || p.__cacheStore) {
break;
}
p = p._parent || (p.options && p.options.element);
p = p._parent || (p.options && p.options.element) || p._context;
}
if (p) {
if (p instanceof Fix.Model) {
@ -93,21 +93,6 @@
}
}
// var _create = BI.createWidget;
// BI.createWidget = function (item, options, context) {
// var pushed = false;
// if (BI.isWidget(options)) {
// pushContext(options);
// pushed = true;
// } else if (context != null) {
// pushContext(context);
// pushed = true;
// }
// var result = _create.apply(this, arguments);
// pushed && popContext();
// return result;
// };
_.each(["populate", "addItems", "prependItems"], function (name) {
var old = BI.Loader.prototype[name];
BI.Loader.prototype[name] = function () {
@ -121,7 +106,7 @@
function createStore () {
var needPop = false;
if (_global.Fix && this._store) {
var store = findStore(this.options.context || this._parent || this.options.element);
var store = findStore(this.options.context || this._parent || this.options.element || this._context);
if (store) {
pushTarget(store);
needPop = true;
@ -178,6 +163,77 @@
needPop && popTarget();
};
BI.Widget.prototype._initElement = function () {
var self = this;
var render = BI.isFunction(this.options.render) ? this.options.render : this.render;
var els;
if (this.options.updateMode === "auto" && this._store) {
// 自动更新模式
var childComponents = {};
var rendered = false;
this._watchers.push(Fix.watch(this.model, function () {
if (rendered) {
var newEls = render && render.call(this);
BI.each(childComponents, function (i, childComponent) {
if (childComponent.component instanceof BI.Layout) {
return; // 布局的过滤掉
}
var nextProps = BI.get([newEls], childComponent.path);
if (nextProps) {
var shouldUpdate = childComponent.component.shouldUpdate && childComponent.component.shouldUpdate(nextProps);
childComponent.component._update(nextProps, shouldUpdate);
childComponent.props = BI.extend(childComponent.props, nextProps);
}
});
} else {
els = render && render.call(this);
function traverse (parent, path) {
BI.each(parent, function (i, child) {
var childPath = path.concat(i);
if (BI.isArray(child)) {
traverse(child, childPath);
} else if (BI.isPlainObject(child)) {
if (child.type) {
child.__ref = function (_ref) {
if (_ref) {
var comp = childComponents[this.getName()] = {};
comp.component = _ref;
comp.props = child;
comp.path = childPath;
} else {
delete childComponents[this.getName()];
}
};
}
traverse(child, childPath);
}
});
}
traverse([els], []);
rendered = true;
}
}));
} else {
els = render && render.call(this);
}
if (BI.isPlainObject(els)) {
els = [els];
}
if (BI.isArray(els)) {
BI.each(els, function (i, el) {
if (el) {
BI._lazyCreateWidget(el, {
element: self
});
}
});
}
// if (this._isRoot === true || !(this instanceof BI.Layout)) {
this._mount();
};
var unMount = BI.Widget.prototype.__d;
BI.Widget.prototype.__d = function () {
unMount.apply(this, arguments);
@ -197,7 +253,7 @@
delete this.__cacheStore;
};
_.each(["_mount"], function (name) {
_.each(["_mount", "__afterMount"], function (name) {
var old = BI.Widget.prototype[name];
old && (BI.Widget.prototype[name] = function () {
this.store && pushTarget(this.store);

29
dist/fix/fix.compact.js vendored

@ -86,7 +86,7 @@
if (p instanceof Fix.Model || p.store || p.__cacheStore) {
break;
}
p = p._parent || (p.options && p.options.element);
p = p._parent || (p.options && p.options.element) || p._context;
}
if (p) {
if (p instanceof Fix.Model) {
@ -97,26 +97,6 @@
}
}
// var _create = BI.createWidget;
// BI.createWidget = function (item, options, context) {
// var pushed = false;
// if (BI.isWidget(options)) {
// pushContext(options);
// pushed = true;
// } else if (context != null) {
// pushContext(context);
// pushed = true;
// }
// var result = _create.apply(this, arguments);
// // try {
// // var result = _create.apply(this, arguments);
// // } catch (e) {
// // console.error(e);
// // }
// pushed && popContext();
// return result;
// };
_.each(["populate", "addItems", "prependItems"], function (name) {
var old = BI.Loader.prototype[name];
BI.Loader.prototype[name] = function () {
@ -134,7 +114,7 @@
function createStore () {
var needPop = false;
if (_global.Fix && this._store) {
var store = findStore(this.options.context || this._parent || this.options.element);
var store = findStore(this.options.context || this._parent || this.options.element || this._context);
if (store) {
pushTarget(store);
needPop = true;
@ -195,6 +175,9 @@
if (rendered) {
var newEls = render && render.call(this);
BI.each(childComponents, function (i, childComponent) {
if (childComponent.component instanceof BI.Layout) {
return; // 布局的过滤掉
}
var nextProps = BI.get([newEls], childComponent.path);
if (nextProps) {
var shouldUpdate = childComponent.component.shouldUpdate && childComponent.component.shouldUpdate(nextProps);
@ -274,7 +257,7 @@
delete this.__cacheStore;
};
_.each(["_mount"], function (name) {
_.each(["_mount", "__afterMount"], function (name) {
var old = BI.Widget.prototype[name];
old && (BI.Widget.prototype[name] = function () {
this.store && pushTarget(this.store);

2
dist/font.css vendored

File diff suppressed because one or more lines are too long

BIN
dist/font/iconfont.eot vendored

Binary file not shown.

6
dist/font/iconfont.svg vendored

@ -20,6 +20,12 @@ Created by iconfont
/>
<missing-glyph />
<glyph glyph-name="dangjichuli" unicode="&#59466;" d="M169.923333 838.358271l186.257984-186.189757-11.666709-100.906798-100.906798-11.666709-186.257984 186.257984-20.740815-43.596649a375.381475 375.381475 0 0 1 73.343345-427.097061l12.417199-11.871388a375.108569 375.108569 0 0 1 340.244895-87.807336l11.803162 3.20664 172.817389-172.817389a185.712173 185.712173 0 0 1 262.671515 0l8.664749 9.278786a185.712173 185.712173 0 0 1-8.664749 253.392729L737.089127 421.222259l3.138413 11.803162A375.381475 375.381475 0 0 1 213.519982 859.23554l-43.528423-20.809043z m422.457668-100.770345a307.018654 307.018654 0 0 0 73.889157-315.205818l-6.754411-19.990326 202.154727-202.086501a117.485805 117.485805 0 0 0-166.199431-166.199432L493.384542 236.19235l-20.058552-6.686184a307.018654 307.018654 0 0 0-315.205819 73.889156l-10.711539 11.325578a307.155107 307.155107 0 0 0-69.932027 280.751502l2.933734 10.847993 138.363073-138.363074 187.281379 21.832438 21.764212 187.213153-138.363074 138.363073 10.916219 2.933734a307.155107 307.155107 0 0 0 292.008853-80.711793z" horiz-adv-x="1024" />
<glyph glyph-name="xingnengfankui" unicode="&#59465;" d="M128 352V128h160a30.72 30.72 0 0 0 17.408-5.888l0.512 0.768L448 27.52V96a32 32 0 0 0 32 32H896V352h64V128a64 64 0 0 0-64-64H512v-96c0-17.92-14.08-32-32-32-4.48 0-8.96 0.64-12.8 2.56a34.368 34.368 0 0 0-10.24 6.4L277.824 64H128a64 64 0 0 0-64 64V352h64z m336.512 306.112l1.536-5.44 60.288-302.08 95.36 171.072a32 32 0 0 0 54.208 2.688l2.88-5.12 60.16-133.12 68.48 82.432a32 32 0 0 0 18.944 11.072L832 480.128h128a32 32 0 0 0 5.76-63.488l-5.76-0.512h-113.024l-91.456-110.272a32 32 0 0 0-50.944 2.176l-2.816 5.056-55.168 121.984-106.624-191.552a32 32 0 0 0-57.728 3.776l-1.6 5.504-61.184 306.304-106.88-177.728a32 32 0 0 0-52.8-3.008l-3.2 5.248-41.792 83.776-29.312-38.656a32 32 0 0 0-19.584-12.096l-5.888-0.512H64a32 32 0 0 0-5.76 63.488L64 480.128h80.064l50.944 66.944a32 32 0 0 0 51.136-0.192l3.008-4.928 38.656-77.568 119.424 198.464a32 32 0 0 0 57.28-4.736zM896 832a64 64 0 0 0 64-64v-224h-64V768H128v-224H64V768a64 64 0 0 0 64 64h768z" horiz-adv-x="1024" />
<glyph glyph-name="beizhu" unicode="&#59463;" d="M809.152 800H214.848A119.232 119.232 0 0 1 96 681.152v-475.456c0-65.344 53.504-118.848 118.848-118.848h54.848l124.8-112.896c5.952-5.952 11.904-5.952 17.856-5.952 17.792 0 35.648 11.904 35.648 35.648v83.2h361.152a119.232 119.232 0 0 1 118.848 118.848V681.152A119.232 119.232 0 0 1 809.152 800z m59.392-594.304c0-35.648-23.744-59.392-59.392-59.392H448a53.952 53.952 0 0 1-41.6-17.856 53.952 53.952 0 0 1-17.856-41.6v-29.696l-77.248 71.296a64.192 64.192 0 0 1-41.6 17.856h-54.848c-35.648 0-59.392 23.744-59.392 59.392V681.152c0 35.648 23.744 59.392 59.392 59.392h594.304c35.648 0 59.392-23.744 59.392-59.392v-475.456zM720 562.304h-416c-17.856 0-29.696-11.904-29.696-29.76 0-17.792 11.84-29.696 29.696-29.696h416c17.856 0 29.696 11.904 29.696 29.696 0 17.856-11.84 29.76-29.696 29.76z m0-178.304h-416c-17.856 0-29.696-11.904-29.696-29.696 0-17.856 11.84-29.76 29.696-29.76h416c17.856 0 29.696 11.904 29.696 29.76 0 17.792-11.84 29.696-29.696 29.696z" horiz-adv-x="1024" />

Before

Width:  |  Height:  |  Size: 379 KiB

After

Width:  |  Height:  |  Size: 381 KiB

BIN
dist/font/iconfont.ttf vendored

Binary file not shown.

BIN
dist/font/iconfont.woff vendored

Binary file not shown.

BIN
dist/font/iconfont.woff2 vendored

Binary file not shown.

8
dist/lib/base/combination/loader.d.ts vendored

@ -2,7 +2,13 @@ import { Widget } from "../../core/widget";
export declare class Loader extends Widget {
static xtype: string;
static EVENT_CHANGE: string;
populate<T>(items: T[]): void;
_prevLoad(): void;
_nextLoad(): void;
hasPrev(): boolean;
hasNext(): boolean;
prependItems<T>(items: T[]): void;
addItems<T>(items: T[]): void;
populate(...args: any[]): void;
setNotSelectedValue(...args: any[]): void;
getNotSelectedValue<T>(): T;
getAllButtons<T>(): T[];

1
dist/lib/base/single/button/button.basic.d.ts vendored

@ -1,6 +1,7 @@
import { Single } from "../single";
export declare class BasicButton extends Single {
static EVENT_CHANGE: string;
static xtype: string;
_createShadow(): void;
bindEvent(): void;
_trigger(e: Event): void;

7
dist/lib/index.d.ts vendored

@ -152,6 +152,8 @@ import { Tree, Node } from "./core/utils/tree";
import { TextNode } from "./base/single/button/node/textnode";
import { TextValueCheckComboPopup } from "./case/combo/textvaluecheckcombo/popup.textvaluecheck";
import { ImageButton } from './base/single/button/buttons/button.image';
import { History, Router } from "./router/router";
import { DateTimeCombo } from './widget/datetime/datetime.combo';
export interface BI extends _func, _i18n, _base, _inject, _var, _web, _utils {
OB: typeof OB;
Plugin: _Plugin;
@ -307,9 +309,12 @@ export interface BI extends _func, _i18n, _base, _inject, _var, _web, _utils {
TextNode: typeof TextNode;
TextValueCheckComboPopup: typeof TextValueCheckComboPopup;
ImageButton: typeof ImageButton;
Router: typeof Router;
history: History;
DateTimeCombo: typeof DateTimeCombo;
}
declare const _default: {
Decorators: typeof decorator;
};
export default _default;
export { OB, Widget, Single, BasicButton, Checkbox, Icon, LeftVerticalAdaptLayout, LeftRightVerticalAdaptLayout, SearchTextValueCombo, Input, IconTextItem, AllValueMultiTextValueCombo, IconTextIconItem, Layout, HorizontalAutoLayout, InlineVerticalAdaptLayout, RightVerticalAdaptLayout, TableAdaptLayout, AbsoluteCenterLayout, HorizontalAdaptLayout, FloatLeftLayout, FloatRightLayout, VerticalLayout, AbsoluteLayout, DefaultLayout, HTapeLayout, CenterAdaptLayout, VTapeLayout, VerticalAdaptLayout, IconButton, Trigger, TriggerIconButton, Action, ActionFactory, ShowAction, Controller, LayerController, Behavior, BehaviorFactory, RedMarkBehavior, HighlightBehavior, LoadingPane, Searcher, AbstractLabel, Label, TextButton, DownListCombo, IconChangeButton, Button, TextEditor, A, Html, Switcher, BubbleCombo, Loader, ListPane, MultiSelectBar, SelectList, TextValueCombo, Editor, IconLabel, Popover, BarPopover, Tab, AbstractTreeValueChooser, AbstractListTreeValueChooser, ListTreeValueChooserInsertCombo, TreeValueChooserCombo, TreeValueChooserInsertCombo, MultiLayerSelectTreePopup, MultiLayerSingleTreePopup, TreeView, ListTreeView, ListAsyncTree, AsyncTree, MultiLayerSingleTreeCombo, MultiLayerSelectTreeCombo, MultiTreeListCombo, MultiTreeInsertCombo, Combo, IconCombo, DynamicDateCombo, Radio, MultiSelectItem, CustomTree, ButtonGroup, ButtonTree, NodeButton, IconArrowNode, MidTreeLeafItem, FirstTreeLeafItem, LastTreeLeafItem, SmallTextEditor, MultifileEditor, SignEditor, MultiSelectInsertCombo, MultiSelectCombo, SearchEditor, Text, Pane, MultiLayerSingleLevelTree, SimpleColorChooser, AbstractAllValueChooser, AllValueChooserCombo, TextAreaEditor, SingleSelectItem, DynamicDateTimeCombo, MultiTreeCombo, CenterLayout, VirtualGroup, GridLayout, MultiTreePopup, SingleSelectRadioItem, SingleSelectInsertCombo, SingleSelectCombo, CardLayout, DynamicYearMonthCombo, TimeCombo, Iframe, TextValueDownListCombo, Switch, HorizontalLayout, ShelterEditor, SelectTextTrigger, DateInterval, DynamicDatePane, AllCountPager, PopupView, BubblePopupView, BubblePopupBarView, TextBubblePopupBarView, ArrowTreeGroupNodeCheckbox, NumberInterval, DynamicYearQuarterCombo, DynamicYearCombo, IntervalSlider, MultiSelectInsertList, YearMonthInterval, TextValueCheckCombo, NumberEditor, LinearSegment, Img, EditorIconCheckCombo, IconTextValueCombo, ListView, FloatCenterLayout, DynamicYearMonthPopup, DateCalendarPopup, Tree, Node, TextNode, TextValueCheckComboPopup, ImageButton, };
export { OB, Widget, Single, BasicButton, Checkbox, Icon, LeftVerticalAdaptLayout, LeftRightVerticalAdaptLayout, SearchTextValueCombo, Input, IconTextItem, AllValueMultiTextValueCombo, IconTextIconItem, Layout, HorizontalAutoLayout, InlineVerticalAdaptLayout, RightVerticalAdaptLayout, TableAdaptLayout, AbsoluteCenterLayout, HorizontalAdaptLayout, FloatLeftLayout, FloatRightLayout, VerticalLayout, AbsoluteLayout, DefaultLayout, HTapeLayout, CenterAdaptLayout, VTapeLayout, VerticalAdaptLayout, IconButton, Trigger, TriggerIconButton, Action, ActionFactory, ShowAction, Controller, LayerController, Behavior, BehaviorFactory, RedMarkBehavior, HighlightBehavior, LoadingPane, Searcher, AbstractLabel, Label, TextButton, DownListCombo, IconChangeButton, Button, TextEditor, A, Html, Switcher, BubbleCombo, Loader, ListPane, MultiSelectBar, SelectList, TextValueCombo, Editor, IconLabel, Popover, BarPopover, Tab, AbstractTreeValueChooser, AbstractListTreeValueChooser, ListTreeValueChooserInsertCombo, TreeValueChooserCombo, TreeValueChooserInsertCombo, MultiLayerSelectTreePopup, MultiLayerSingleTreePopup, TreeView, ListTreeView, ListAsyncTree, AsyncTree, MultiLayerSingleTreeCombo, MultiLayerSelectTreeCombo, MultiTreeListCombo, MultiTreeInsertCombo, Combo, IconCombo, DynamicDateCombo, Radio, MultiSelectItem, CustomTree, ButtonGroup, ButtonTree, NodeButton, IconArrowNode, MidTreeLeafItem, FirstTreeLeafItem, LastTreeLeafItem, SmallTextEditor, MultifileEditor, SignEditor, MultiSelectInsertCombo, MultiSelectCombo, SearchEditor, Text, Pane, MultiLayerSingleLevelTree, SimpleColorChooser, AbstractAllValueChooser, AllValueChooserCombo, TextAreaEditor, SingleSelectItem, DynamicDateTimeCombo, MultiTreeCombo, CenterLayout, VirtualGroup, GridLayout, MultiTreePopup, SingleSelectRadioItem, SingleSelectInsertCombo, SingleSelectCombo, CardLayout, DynamicYearMonthCombo, TimeCombo, Iframe, TextValueDownListCombo, Switch, HorizontalLayout, ShelterEditor, SelectTextTrigger, DateInterval, DynamicDatePane, AllCountPager, PopupView, BubblePopupView, BubblePopupBarView, TextBubblePopupBarView, ArrowTreeGroupNodeCheckbox, NumberInterval, DynamicYearQuarterCombo, DynamicYearCombo, IntervalSlider, MultiSelectInsertList, YearMonthInterval, TextValueCheckCombo, NumberEditor, LinearSegment, Img, EditorIconCheckCombo, IconTextValueCombo, ListView, FloatCenterLayout, DynamicYearMonthPopup, DateCalendarPopup, Tree, Node, TextNode, TextValueCheckComboPopup, ImageButton, Router, History, DateTimeCombo, };

29
dist/lib/router/router.d.ts vendored

@ -0,0 +1,29 @@
export declare class Router {
constructor(op: {
[key: string]: any;
});
route(route: string, callback: Function): this;
route(route: string, name: string, callback?: Function): this;
execute(callback?: Function, args?: any[]): void;
navigate(fragment: string, options?: {
[key: string]: any;
} | boolean): this;
}
export declare class History {
atRoot(): boolean;
getSearch(): string;
getHash(window?: Window): string;
getPath(): string;
getFragment(fragment?: string): string;
start(op?: {
[key: string]: any;
}): void;
stop(): void;
route(route: string, callback: Function): void;
unRoute(route: string): void;
checkUrl(e?: Event): void;
loadUrl(fragment: string): boolean;
navigate(fragment: string, options?: {
[key: string]: any;
} | boolean): void;
}

9
dist/lib/widget/datetime/datetime.combo.d.ts vendored

@ -0,0 +1,9 @@
import { Single } from '../../base/single/single';
export declare class DateTimeCombo extends Single {
static xtype: string;
static EVENT_CANCEL: string;
static EVENT_CONFIRM: string;
static EVENT_CHANGE: string;
static EVENT_BEFORE_POPUPVIEW: string;
hidePopupView: () => void;
}

2
dist/resource.css vendored

File diff suppressed because one or more lines are too long

63
dist/utils.js vendored

@ -1,4 +1,4 @@
/*! time: 2021-3-1 14:10:42 */
/*! time: 2021-3-29 18:50:32 */
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
@ -82,12 +82,12 @@
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 1238);
/******/ return __webpack_require__(__webpack_require__.s = 1243);
/******/ })
/************************************************************************/
/******/ ({
/***/ 1099:
/***/ 1104:
/***/ (function(module, exports) {
BI.i18n = {
@ -320,7 +320,14 @@ if(_global.BI.prepares == null) {
/***/ }),
/***/ 1238:
/***/ 124:
/***/ (function(module, exports, __webpack_require__) {
__webpack_require__(125)(__webpack_require__(126))
/***/ }),
/***/ 1243:
/***/ (function(module, exports, __webpack_require__) {
__webpack_require__(123);
@ -350,8 +357,8 @@ __webpack_require__(140);
__webpack_require__(141);
__webpack_require__(142);
__webpack_require__(143);
__webpack_require__(1099);
__webpack_require__(1239);
__webpack_require__(1104);
__webpack_require__(1244);
__webpack_require__(153);
__webpack_require__(154);
module.exports = __webpack_require__(155);
@ -359,7 +366,7 @@ module.exports = __webpack_require__(155);
/***/ }),
/***/ 1239:
/***/ 1244:
/***/ (function(module, exports) {
/**
@ -431,13 +438,6 @@ BI.Date._MD = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
BI.Date._OFFSET = [0, -1, -2, -3, -4, -5, -6];
/***/ }),
/***/ 124:
/***/ (function(module, exports, __webpack_require__) {
__webpack_require__(125)(__webpack_require__(126))
/***/ }),
/***/ 125:
@ -556,7 +556,7 @@ if (!_global.BI) {
},
isWidget: function (widget) {
return widget instanceof BI.Widget || (BI.View && widget instanceof BI.View);
return widget instanceof BI.Widget;
},
createWidgets: function (items, options, context) {
@ -593,7 +593,7 @@ if (!_global.BI) {
el: innerAttr.shift()
});
}
if (item.el instanceof BI.Widget || (BI.View && item.el instanceof BI.View)) {
if (item.el instanceof BI.Widget) {
innerAttr.shift();
return BI.extend({}, outerAttr.shift(), { type: null }, item);
}
@ -923,14 +923,10 @@ if (!_global.BI) {
});
_.extend(BI, {
inherit: function (sb, sp, overrides) {
if (typeof sp === "object") {
overrides = sp;
sp = sb;
sb = function () {
return sp.apply(this, arguments);
};
}
inherit: function (sp, overrides) {
var sb = function () {
return sp.apply(this, arguments);
};
var F = function () {
}, spp = sp.prototype;
F.prototype = spp;
@ -2085,6 +2081,9 @@ if (!_global.BI) {
// 获得一个当前对象的引用
_initRef: function () {
if (this.options.__ref) {
this.options.__ref.call(this, this);
}
if (this.options.ref) {
this.options.ref.call(this, this);
}
@ -2092,6 +2091,10 @@ if (!_global.BI) {
//释放当前对象
_purgeRef: function () {
if (this.options.__ref) {
this.options.__ref.call(null);
this.options.__ref = null;
}
if (this.options.ref) {
this.options.ref.call(null);
this.options.ref = null;
@ -8074,8 +8077,8 @@ _.extend(BI.Func, {
name = name || "";
while (true) {
if (BI.every(array, function (i, item) {
return BI.isKey(item) ? item !== name : item.name !== name;
})) {
return BI.isKey(item) ? item !== name : item.name !== name;
})) {
break;
}
name = src + (idx++);
@ -8099,14 +8102,16 @@ _.extend(BI.Func, {
* @param items
* @param keyword
* @param param 搜索哪个属性
* @param clone 是否需要deepClone
*/
getSearchResult: function (items, keyword, param) {
getSearchResult: function (items, keyword, param, clone) {
var isArray = BI.isArray(items);
items = isArray ? BI.flatten(items) : items;
param || (param = "text");
BI.isNull(clone) && (clone = true);
if (!BI.isKey(keyword)) {
return {
find: BI.deepClone(items),
find: clone ? BI.deepClone(items) : items,
match: isArray ? [] : {}
};
}
@ -8118,7 +8123,7 @@ _.extend(BI.Func, {
if (BI.isNull(item)) {
return;
}
item = BI.deepClone(item);
clone && (item = BI.deepClone(item));
t = BI.stripEL(item);
text = BI.find([t[param], t.text, t.value, t.name, t], function (index, val) {
return BI.isNotNull(val);

2
dist/utils.js.map vendored

File diff suppressed because one or more lines are too long

4
dist/utils.min.js vendored

File diff suppressed because one or more lines are too long

2
dist/utils.min.js.map vendored

File diff suppressed because one or more lines are too long

2
demo.worker.js → examples/demo.worker.js

@ -1,5 +1,5 @@
if (this.importScripts) {
importScripts("./dist/fineui_without_jquery_polyfill.js");
importScripts("../dist/fineui_without_jquery_polyfill.js");
BI.initWorker();
}
var Model = BI.inherit(Fix.Model, {

15
dev.html → examples/dev.html

@ -2,7 +2,8 @@
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" type="text/css" href="http://fanruan.design/fineui/2.0/fineui.min.css"/>
<link rel="stylesheet" type="text/css" href="../dist/2.0/fineui.css"/>
<!-- <script src="../dist/2.0/fineui.js"></script>-->
<script src="http://localhost:9001/fineui.js"></script>
</head>
<body>
@ -37,9 +38,6 @@
BI.model("demo.child_model", ChildModel);
var Child = BI.inherit(BI.Widget, {
props: {
updateMode: "auto"
},
setup: function () {
var store = BI.useStore(function () {
return BI.Models.getModel("demo.child_model");
@ -67,18 +65,25 @@
updateMode: "auto"
},
setup: function () {
var child;
var store = BI.useStore(function () {
return BI.Models.getModel("demo.model");
});
setInterval(function () {
store.toggle();
}, 1000);
BI.watch("text", function () {
child.reset();
});
return function () {
return {
type: "bi.vertical",
vgap: 20,
items: [{
type: "demo.child"
type: "demo.child",
ref: function (_ref) {
child = _ref;
}
}, {
type: "demo.child"
}]

4
hooks.html → examples/hooks.html

@ -2,8 +2,8 @@
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" type="text/css" href="http://fanruan.design/fineui/2.0/fineui.min.css"/>
<script src="./dist/fineui.js"></script>
<link rel="stylesheet" type="text/css" href="../dist/2.0/fineui.css"/>
<script src="../dist/2.0/fineui.js"></script>
</head>
<body>
<div id="wrapper"></div>

118
examples/tab-context.html

@ -0,0 +1,118 @@
<html>
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" type="text/css" href="../dist/2.0/fineui.css"/>
<script src="../dist/2.0/fineui.js"></script>
</head>
<body>
<div id="wrapper"></div>
<script>
// tab上下文环境测试
var Model = BI.inherit(Fix.Model, {
state: function () {
return {
expand: false
};
},
childContext: ["text"],
computed: {
text: function () {
return this.model.expand ? "text-yes" : "text-not";
}
},
actions: {
toggle: function () {
this.model.expand = !this.model.expand;
}
}
});
BI.model("demo.model", Model);
var ChildModel = BI.inherit(Fix.Model, {
context: ["text"]
});
BI.model("demo.child_model", ChildModel);
var Child = BI.inherit(BI.Widget, {
setup: function () {
var store = BI.useStore(function () {
return BI.Models.getModel("demo.child_model");
});
return {
render: function () {
return {
type: "bi.label",
text: store.model.text
};
}
};
}
});
BI.shortcut("demo.child", Child);
var Widget = BI.inherit(BI.Widget, {
props: {
updateMode: "auto"
},
setup: function () {
var child;
var store = BI.useStore(function () {
return BI.Models.getModel("demo.model");
});
setInterval(function () {
store.toggle();
}, 1000);
BI.watch("text", function () {
// child.reset();
});
return function () {
return {
type: "bi.vertical",
vgap: 20,
items: [{
type: "demo.child",
ref: function (_ref) {
child = _ref;
}
}, {
type: "bi.combo",
el: {
type: "bi.button",
text: "点击"
},
popup: {
el: {
type: "bi.tab",
height: 100,
showIndex: 0,
cardCreator: function () {
return {
type: "demo.child"
};
}
}
}
}]
};
};
}
});
BI.shortcut("demo.parent", Widget);
BI.createWidget({
type: "bi.absolute",
items: [{
el: {
type: "demo.parent"
},
top: 100,
left: 100
}],
element: "#wrapper"
});
</script>
</body>
</html>

8
worker.html → examples/worker.html

@ -2,11 +2,9 @@
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" type="text/css" href="http://fanruan.design/fineui/2.0/fineui.min.css"/>
<!-- 下面是不包含normalize.css的css -->
<!-- <link rel="stylesheet" type="text/css" href="http://fanruan.design/fineui/2.0/fineui_without_normalize.min.css" /> -->
<script src="./dist/fineui.js"></script>
<script src="./dist/fix/worker.compact.js"></script>
<link rel="stylesheet" type="text/css" href="../dist/2.0/fineui.css"/>
<script src="../dist/2.0/fineui.js"></script>
<script src="../dist/fix/worker.compact.js"></script>
<script src="demo.worker.js"></script>
</head>
<body>

4
package.json

@ -1,6 +1,6 @@
{
"name": "fineui",
"version": "2.0.20210301141220",
"version": "2.0.20210329185204",
"description": "fineui",
"main": "dist/fineui.min.js",
"types": "dist/lib/index.d.ts",
@ -77,4 +77,4 @@
},
"author": "fanruan",
"license": "MIT"
}
}

1
src/base/collection/collection.js

@ -61,6 +61,7 @@ BI.CollectionView = BI.inherit(BI.Widget, {
}
},
// mounted之后绑定事件
mounted: function () {
var o = this.options;
if (o.scrollLeft !== 0 || o.scrollTop !== 0) {

2
src/base/combination/combo.js

@ -515,7 +515,7 @@
populate: function (items) {
this._assertPopupView();
this.popupView.populate.apply(this.popupView, arguments);
this.combo.populate.apply(this.combo, arguments);
this.combo.populate && this.combo.populate.apply(this.combo, arguments);
},
_setEnable: function (arg) {

2
src/base/combination/expander.js

@ -197,7 +197,7 @@ BI.Expander = BI.inherit(BI.Widget, {
populate: function (items) {
// this._assertPopupView();
this.popupView && this.popupView.populate.apply(this.popupView, arguments);
this.expander.populate.apply(this.expander, arguments);
this.expander.populate && this.expander.populate.apply(this.expander, arguments);
},
_setEnable: function (arg) {

4
src/base/combination/navigation.js

@ -52,7 +52,7 @@ BI.Navigation = BI.inherit(BI.Widget, {
});
},
mounted: function () {
created: function () {
var o = this.options;
if (o.showIndex !== false) {
this.setSelect(o.showIndex);
@ -159,4 +159,4 @@ BI.Navigation = BI.inherit(BI.Widget, {
});
BI.Navigation.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.navigation", BI.Navigation);
BI.shortcut("bi.navigation", BI.Navigation);

2
src/base/combination/switcher.js

@ -194,7 +194,7 @@ BI.Switcher = BI.inherit(BI.Widget, {
populate: function (items) {
this._assertPopupView();
this.popupView.populate.apply(this.popupView, arguments);
this.switcher.populate.apply(this.switcher, arguments);
this.switcher.populate && this.switcher.populate.apply(this.switcher, arguments);
},
_setEnable: function (arg) {

4
src/base/combination/tab.js

@ -76,7 +76,7 @@ BI.Tab = BI.inherit(BI.Widget, {
}
},
mounted: function () {
created: function () {
var o = this.options;
if (o.showIndex !== false) {
this.setSelect(o.showIndex);
@ -150,4 +150,4 @@ BI.Tab = BI.inherit(BI.Widget, {
});
BI.Tab.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.tab", BI.Tab);
BI.shortcut("bi.tab", BI.Tab);

1
src/base/grid/grid.js

@ -63,6 +63,7 @@ BI.GridView = BI.inherit(BI.Widget, {
}
},
// mounted之后绑定事件
mounted: function () {
var o = this.options;
if (o.scrollLeft !== 0 || o.scrollTop !== 0) {

1
src/base/layer/layer.popover.js

@ -152,6 +152,7 @@ BI.Popover = BI.inherit(BI.Widget, {
});
},
// mounted之后绑定事件
mounted: function () {
var self = this; var o = this.options;
this.dragger.element.mousedown(function (e) {

5
src/base/layer/layer.popup.js

@ -18,6 +18,7 @@ BI.PopupView = BI.inherit(BI.Widget, {
vgap: 0,
hgap: 0,
innerVGap: 0,
innerHGap: 0,
direction: BI.Direction.Top, // 工具栏的方向
stopEvent: false, // 是否停止mousedown、mouseup事件
stopPropagation: false, // 是否停止mousedown、mouseup向上冒泡
@ -98,7 +99,9 @@ BI.PopupView = BI.inherit(BI.Widget, {
this.button_group.element.css({
"min-height": BI.isNumeric(o.minHeight) ? (o.minHeight / BI.pixRatio + BI.pixUnit) : o.minHeight,
"padding-top": o.innerVGap / BI.pixRatio + BI.pixUnit,
"padding-bottom": o.innerVGap / BI.pixRatio + BI.pixUnit
"padding-bottom": o.innerVGap / BI.pixRatio + BI.pixUnit,
"padding-left": o.innerHGap / BI.pixRatio + BI.pixUnit,
"padding-right": o.innerHGap / BI.pixRatio + BI.pixUnit,
});
return this.button_group;
},

1
src/base/list/listview.js

@ -38,6 +38,7 @@ BI.ListView = BI.inherit(BI.Widget, {
};
},
// mounted之后绑定事件
mounted: function () {
var self = this, o = this.options;
this._populate();

1
src/base/list/virtuallist.js

@ -47,6 +47,7 @@ BI.VirtualList = BI.inherit(BI.Widget, {
};
},
// mounted之后绑定事件
mounted: function () {
var self = this, o = this.options;
this._populate();

4
src/base/single/button/buttons/button.js

@ -145,10 +145,6 @@ BI.Button = BI.inherit(BI.BasicButton, {
unHighLight: function () {
this.text.unHighLight.apply(this.text, arguments);
},
destroy: function () {
BI.Button.superclass.destroy.apply(this, arguments);
}
});
BI.shortcut("bi.button", BI.Button);

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

@ -39,8 +39,8 @@ BI.TextAreaEditor = BI.inherit(BI.Single, {
},
left: 4,
right: 4,
top: 4,
bottom: 4
top: 2,
bottom: 2
}]
});

4
src/base/single/label/abstract.label.js

@ -381,10 +381,6 @@
if (!this.isReadOnly()) {
this.text.setValue(v);
}
},
populate: function () {
BI.AbstractLabel.superclass.populate.apply(this, arguments);
}
});
}());

16
src/base/single/single.js

@ -138,10 +138,6 @@ BI.Single = BI.inherit(BI.Widget, {
this._hoverBinded = false;
},
populate: function (items) {
this.items = items || [];
},
// opt: {container: '', belowMouse: false}
setTitle: function (title, opt) {
this.options.title = title;
@ -200,18 +196,6 @@ BI.Single = BI.inherit(BI.Widget, {
return this.options.value;
},
update: function (props, shouldUpdate) {
if (BI.isObject(shouldUpdate)) {
props = shouldUpdate;
}
if ("value" in props) {
this.setValue(props.value);
}
if ("text" in props) {
this.setText && this.setText(props.text);
}
},
destroyed: function () {
if (BI.isNotNull(this.showTimeout)) {
clearTimeout(this.showTimeout);

10
src/base/single/text.js

@ -44,14 +44,14 @@
"padding-bottom": (o.vgap + o.bgap) / BI.pixRatio + BI.pixUnit
});
}
if (BI.isNumber(o.height)) {
this.element.css({lineHeight: o.height / BI.pixRatio + BI.pixUnit});
if (BI.isWidthOrHeight(o.height)) {
this.element.css({ lineHeight: BI.isNumber(o.height) ? (o.height / BI.pixRatio + BI.pixUnit) : o.height });
}
if (BI.isNumber(o.lineHeight)) {
this.element.css({lineHeight: o.lineHeight / BI.pixRatio + BI.pixUnit});
if (BI.isWidthOrHeight(o.lineHeight)) {
this.element.css({ lineHeight: BI.isNumber(o.lineHeight) ? (o.lineHeight / BI.pixRatio + BI.pixUnit) : o.lineHeight });
}
if (BI.isWidthOrHeight(o.maxWidth)) {
this.element.css({maxWidth: o.maxWidth / BI.pixRatio + BI.pixUnit});
this.element.css({ maxWidth: BI.isNumber(o.maxWidth) ? (o.maxWidth / BI.pixRatio + BI.pixUnit) : o.maxWidth });
}
this.element.css({
textAlign: o.textAlign,

2
src/base/single/trigger/trigger.js

@ -23,5 +23,5 @@ BI.Trigger = BI.inherit(BI.Single, {
getKey: function () {
}
},
});

8
src/case/button/item.multiselect.js

@ -11,7 +11,10 @@ BI.MultiSelectItem = BI.inherit(BI.BasicButton, {
logic: {
dynamic: false
},
iconWrapperWidth: 26
iconWrapperWidth: 26,
textHgap: 0,
textLgap: 0,
textRgap: 0
});
},
_init: function () {
@ -29,6 +32,7 @@ BI.MultiSelectItem = BI.inherit(BI.BasicButton, {
height: o.height,
hgap: o.hgap,
rgap: o.rgap,
lgap: o.textLgap,
text: o.text,
keyword: o.keyword,
value: o.value,
@ -73,4 +77,4 @@ BI.MultiSelectItem = BI.inherit(BI.BasicButton, {
}
});
BI.MultiSelectItem.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.multi_select_item", BI.MultiSelectItem);
BI.shortcut("bi.multi_select_item", BI.MultiSelectItem);

11
src/case/button/item.singleselect.radio.js

@ -10,7 +10,12 @@ BI.SingleSelectRadioItem = BI.inherit(BI.BasicButton, {
logic: {
dynamic: false
},
height: 24
height: 24,
iconWrapperWidth: 16,
hgap: 10,
textHgap: 0,
textLgap: 0,
textRgap: 0
});
},
_init: function () {
@ -27,6 +32,8 @@ BI.SingleSelectRadioItem = BI.inherit(BI.BasicButton, {
textHeight: o.height,
height: o.height,
hgap: o.hgap,
rgap: o.textRgap,
lgap: o.textLgap,
text: o.text,
keyword: o.keyword,
value: o.value,
@ -39,7 +46,7 @@ BI.SingleSelectRadioItem = BI.inherit(BI.BasicButton, {
items: BI.LogicFactory.createLogicItemsByDirection("left", {
type: "bi.center_adapt",
items: [this.radio],
width: 16
width: o.iconWrapperWidth
}, this.text)
}))));
},

3
src/case/button/treeitem/item.icon.treeleaf.js

@ -36,7 +36,8 @@ BI.IconTreeLeafItem = BI.inherit(BI.BasicButton, {
hgap: o.hgap,
text: o.text,
value: o.value,
py: o.py
py: o.py,
keyword: o.keyword
});
var type = BI.LogicFactory.createLogicTypeByDirection(BI.Direction.Left);
var items = BI.LogicFactory.createLogicItemsByDirection(BI.Direction.Left, {

8
src/case/colorchooser/colorchooser.js

@ -9,7 +9,7 @@ BI.ColorChooser = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.ColorChooser.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-color-chooser bi-border",
baseCls: "bi-color-chooser",
value: "",
height: 24,
el: {},
@ -18,8 +18,6 @@ BI.ColorChooser = BI.inherit(BI.Widget, {
_init: function () {
var self = this, o = this.options;
o.height -= 2;
BI.isNumeric(o.width) && (o.width -= 2);
BI.ColorChooser.superclass._init.apply(this, arguments);
o.value = o.value || "";
this.combo = BI.createWidget({
@ -34,8 +32,8 @@ BI.ColorChooser = BI.inherit(BI.Widget, {
ref: function (_ref) {
self.trigger = _ref;
},
width: o.width,
height: o.height
width: o.el.type ? o.width : o.width - 2,
height: o.el.type ? o.height : o.height - 2
}, o.el),
popup: {
el: BI.extend({

3
src/case/colorchooser/colorchooser.popup.hex.js

@ -177,6 +177,7 @@ BI.HexColorChooserPopup = BI.inherit(BI.Widget, {
};
},
// 这里就实现的不好了,setValue里面有个editor,editor的setValue会检测错误然后出bubble提示
mounted: function () {
var self = this;
var o = this.options;
@ -249,4 +250,4 @@ BI.HexColorChooserPopup = BI.inherit(BI.Widget, {
});
BI.HexColorChooserPopup.EVENT_VALUE_CHANGE = "EVENT_VALUE_CHANGE";
BI.HexColorChooserPopup.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.hex_color_chooser_popup", BI.HexColorChooserPopup);
BI.shortcut("bi.hex_color_chooser_popup", BI.HexColorChooserPopup);

3
src/case/colorchooser/colorchooser.popup.js

@ -161,6 +161,7 @@ BI.ColorChooserPopup = BI.inherit(BI.Widget, {
};
},
// 这里就实现的不好了,setValue里面有个editor,editor的setValue会检测错误然后出bubble提示
mounted: function () {
var self = this;
var o = this.options;
@ -233,4 +234,4 @@ BI.ColorChooserPopup = BI.inherit(BI.Widget, {
});
BI.ColorChooserPopup.EVENT_VALUE_CHANGE = "EVENT_VALUE_CHANGE";
BI.ColorChooserPopup.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.color_chooser_popup", BI.ColorChooserPopup);
BI.shortcut("bi.color_chooser_popup", BI.ColorChooserPopup);

4
src/case/colorchooser/colorchooser.trigger.js

@ -10,8 +10,8 @@ BI.ColorChooserTrigger = BI.inherit(BI.Trigger, {
_defaultConfig: function () {
var conf = BI.ColorChooserTrigger.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-color-chooser-trigger",
height: 24
baseCls: (conf.baseCls || "") + " bi-color-chooser-trigger bi-border bi-focus-shadow",
height: 22
});
},

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

@ -10,7 +10,7 @@ BI.LongColorChooserTrigger = BI.inherit(BI.Trigger, {
_defaultConfig: function () {
var conf = BI.LongColorChooserTrigger.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-color-chooser-trigger",
baseCls: (conf.baseCls || "") + " bi-color-chooser-trigger bi-border bi-focus-shadow",
height: 24
});
},

7
src/case/colorchooser/farbtastic/farbtastic.js

@ -80,7 +80,7 @@ BI.Farbtastic = BI.inherit(BI.BasicButton, {
};
},
mounted: function () {
created: function () {
var o = this.options;
if (BI.isKey(o.value)) {
this.setValue(o.value);
@ -179,8 +179,6 @@ BI.Farbtastic = BI.inherit(BI.BasicButton, {
// Saturation/Luminance gradient
this.colorWrapper.element.css("backgroundColor", this._pack(this._HSLToRGB([this.hsl[0], 1, 0.5])));
this.fireEvent(BI.Farbtastic.EVENT_CHANGE, this.getValue(), this);
},
_absolutePosition: function (el) {
@ -257,6 +255,7 @@ BI.Farbtastic = BI.inherit(BI.BasicButton, {
var lum = Math.max(0, Math.min(1, -(pos.y / this.constants.SQUARE) + .5));
this._setHSL([this.hsl[0], sat, lum]);
}
this.fireEvent(BI.Farbtastic.EVENT_CHANGE, this.getValue(), this);
},
doClick: function (event) {
@ -277,4 +276,4 @@ BI.Farbtastic = BI.inherit(BI.BasicButton, {
}
});
BI.Farbtastic.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.farbtastic", BI.Farbtastic);
BI.shortcut("bi.farbtastic", BI.Farbtastic);

3
src/case/combo/bubblecombo/combo.bubble.js

@ -40,6 +40,7 @@ BI.BubbleCombo = BI.inherit(BI.Widget, {
direction: o.direction,
isDefaultInit: o.isDefaultInit,
destroyWhenHide: o.destroyWhenHide,
hideWhenAnotherComboOpen: o.hideWhenAnotherComboOpen,
isNeedAdjustHeight: o.isNeedAdjustHeight,
isNeedAdjustWidth: o.isNeedAdjustWidth,
adjustLength: this._getAdjustLength(),
@ -215,4 +216,4 @@ BI.BubbleCombo.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW";
BI.BubbleCombo.EVENT_AFTER_POPUPVIEW = "EVENT_AFTER_POPUPVIEW";
BI.BubbleCombo.EVENT_BEFORE_HIDEVIEW = "EVENT_BEFORE_HIDEVIEW";
BI.BubbleCombo.EVENT_AFTER_HIDEVIEW = "EVENT_AFTER_HIDEVIEW";
BI.shortcut("bi.bubble_combo", BI.BubbleCombo);
BI.shortcut("bi.bubble_combo", BI.BubbleCombo);

2
src/case/combo/searchtextvaluecombo/combo.searchtextvalue.js

@ -115,7 +115,7 @@ BI.SearchTextValueCombo = BI.inherit(BI.Widget, {
};
},
mounted: function () {
created: function () {
var o = this.options;
if(BI.isKey(o.value)) {
this._checkError(o.value);

3
src/case/combo/searchtextvaluecombo/popup.searchtextvalue.js

@ -45,6 +45,7 @@ BI.SearchTextValueComboPopup = BI.inherit(BI.Pane, {
};
},
// mounted之后做check
mounted: function() {
this.check();
},
@ -69,4 +70,4 @@ BI.SearchTextValueComboPopup = BI.inherit(BI.Pane, {
});
BI.SearchTextValueComboPopup.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.search_text_value_combo_popup", BI.SearchTextValueComboPopup);
BI.shortcut("bi.search_text_value_combo_popup", BI.SearchTextValueComboPopup);

16
src/core/base.js

@ -70,7 +70,7 @@ if (!_global.BI) {
},
isWidget: function (widget) {
return widget instanceof BI.Widget || (BI.View && widget instanceof BI.View);
return widget instanceof BI.Widget;
},
createWidgets: function (items, options, context) {
@ -107,7 +107,7 @@ if (!_global.BI) {
el: innerAttr.shift()
});
}
if (item.el instanceof BI.Widget || (BI.View && item.el instanceof BI.View)) {
if (item.el instanceof BI.Widget) {
innerAttr.shift();
return BI.extend({}, outerAttr.shift(), { type: null }, item);
}
@ -437,14 +437,10 @@ if (!_global.BI) {
});
_.extend(BI, {
inherit: function (sb, sp, overrides) {
if (typeof sp === "object") {
overrides = sp;
sp = sb;
sb = function () {
return sp.apply(this, arguments);
};
}
inherit: function (sp, overrides) {
var sb = function () {
return sp.apply(this, arguments);
};
var F = function () {
}, spp = sp.prototype;
F.prototype = spp;

12
src/core/func/function.js

@ -15,8 +15,8 @@ _.extend(BI.Func, {
name = name || "";
while (true) {
if (BI.every(array, function (i, item) {
return BI.isKey(item) ? item !== name : item.name !== name;
})) {
return BI.isKey(item) ? item !== name : item.name !== name;
})) {
break;
}
name = src + (idx++);
@ -40,14 +40,16 @@ _.extend(BI.Func, {
* @param items
* @param keyword
* @param param 搜索哪个属性
* @param clone 是否需要deepClone
*/
getSearchResult: function (items, keyword, param) {
getSearchResult: function (items, keyword, param, clone) {
var isArray = BI.isArray(items);
items = isArray ? BI.flatten(items) : items;
param || (param = "text");
BI.isNull(clone) && (clone = true);
if (!BI.isKey(keyword)) {
return {
find: BI.deepClone(items),
find: clone ? BI.deepClone(items) : items,
match: isArray ? [] : {}
};
}
@ -59,7 +61,7 @@ _.extend(BI.Func, {
if (BI.isNull(item)) {
return;
}
item = BI.deepClone(item);
clone && (item = BI.deepClone(item));
t = BI.stripEL(item);
text = BI.find([t[param], t.text, t.value, t.name, t], function (index, val) {
return BI.isNotNull(val);

111
src/core/platform/web/config.js

@ -21,40 +21,73 @@ BI.prepares.push(function () {
// 在横向自适应场景下我们需要使用table的自适应撑出滚动条的特性(flex处理不了这种情况)
// 主要出现在center_adapt或者horizontal_adapt的场景,或者主动设置horizontalAlign的场景
if (ob.horizontalAlign === BI.HorizontalAlign.Center || ob.horizontalAlign === BI.HorizontalAlign.Stretch) {
// 虽然有两个元素以上的时候,有场景是控制一个显示一个隐藏的效果,还无法通过flex来实现
// var justOneItem = (ob.items && ob.items.length <= 1);
// // 在这种情况下,也可以通过flex支持该布局
// if (supportFlex) {
// // IE下其实也是可以使用flex布局的,只要排除掉出现滚动条的情况
// // if (!isIE || (ob.scrollable !== true && ob.scrolly !== true)) {
// return BI.extend({}, ob, {
// type: "bi.flex_horizontal",
// horizontalAlign: !justOneItem && ob.horizontalAlign === BI.HorizontalAlign.Center
// ? BI.HorizontalAlign.Left : ob.horizontalAlign
// });
// // }
// }
// // IE9以上可以使用calc计算布局
// if (!isIE || BI.getIEVersion() > 8) {
// return BI.extend({}, ob, {
// type: "bi.inline",
// horizontalAlign: !justOneItem && ob.horizontalAlign === BI.HorizontalAlign.Center
// ? BI.HorizontalAlign.Left : ob.horizontalAlign
// });
// }
return BI.extend({}, ob, {type: "bi.table_adapt"});
}
if (!isIE && supportFlex) {
if (supportFlex) {
// IE下其实也是可以使用flex布局的,只要排除掉出现滚动条的情况
// if (!isIE || (ob.scrollable !== true && ob.scrolly !== true)) {
return BI.extend({}, ob, {type: "bi.flex_horizontal"});
// }
}
// // 解决使用inline_vertical_adapt的顺序问题
// // 从右往左放置时,为了兼容,我们统一采用从右到左的放置方式
// if (ob.horizontalAlign === BI.HorizontalAlign.Right) {
// return BI.extend({verticalAlign: BI.VerticalAlign.Top}, ob, {
// type: "bi.inline_vertical_adapt",
// items: ob.items && ob.items.reverse()
// // IE9以上采用inline
// if (!isIE || BI.getIEVersion() > 8) {
// return BI.extend({}, ob, {
// type: "bi.inline"
// });
// }
// 否则采用table,不过horizontalAlign的right就不支持了。
return BI.extend({}, ob, {type: "bi.table_adapt"});
});
BI.Plugin.configWidget("bi.center_adapt", function (ob) {
var isIE = BI.isIE(), supportFlex = isSupportFlex(), justOneItem = (ob.items && ob.items.length <= 1);
var supportFlex = isSupportFlex(), justOneItem = (ob.items && ob.items.length <= 1);
var isAdapt = !ob.horizontalAlign || ob.horizontalAlign === BI.HorizontalAlign.Center || ob.horizontalAlign === BI.HorizontalAlign.Stretch;
if (!isAdapt || justOneItem) {
if (!isIE && supportFlex) {
if (supportFlex) {
// IE下其实也是可以使用flex布局的,只要排除掉出现滚动条的情况
// if (!isIE || (ob.scrollable !== true && ob.scrollx !== true && ob.scrolly !== true)) {
return BI.extend({}, ob, {type: "bi.flex_center_adapt"});
// }
}
if (!BI.isIE() || BI.getIEVersion() > 8) {
return BI.extend({}, ob, {type: "bi.inline_center_adapt"});
}
return BI.extend({}, ob, {type: "bi.inline_center_adapt"});
}
return ob;
});
BI.Plugin.configWidget("bi.vertical_adapt", function (ob) {
var isIE = BI.isIE(), supportFlex = isSupportFlex(), justOneItem = (ob.items && ob.items.length <= 1);
var supportFlex = isSupportFlex(), justOneItem = (ob.items && ob.items.length <= 1);
var isAdapt = ob.horizontalAlign === BI.HorizontalAlign.Center || ob.horizontalAlign === BI.HorizontalAlign.Stretch;
if (!isAdapt || justOneItem) {
if (!isIE && supportFlex) {
return BI.extend({}, ob, {type: "bi.flex_vertical_center_adapt"});
if (supportFlex) {
// IE下其实也是可以使用flex布局的,只要排除掉出现滚动条的情况
// if (!isIE || (ob.scrollable !== true && ob.scrolly !== true)) {
return BI.extend({}, ob, {type: "bi.flex_vertical_adapt"});
// }
}
if (!BI.isIE() || BI.getIEVersion() > 8) {
return BI.extend({}, ob, {type: "bi.inline_vertical_adapt"});
}
return BI.extend({}, ob, {type: "bi.inline_vertical_adapt"});
}
return ob;
});
@ -68,45 +101,35 @@ BI.prepares.push(function () {
return ob;
});
BI.Plugin.configWidget("bi.horizontal_float", function (ob) {
if (!BI.isIE() && isSupportFlex()) {
if (isSupportFlex()) {
// IE下其实也是可以使用flex布局的,只要排除掉出现滚动条的情况
// if (!BI.isIE() || (ob.scrollable !== true && ob.scrollx !== true)) {
return BI.extend({}, ob, {type: "bi.flex_horizontal_adapt"});
// }
}
return BI.extend({}, ob, {type: "bi.inline_horizontal_adapt"});
});
BI.Plugin.configWidget("bi.flex_horizontal", function (ob) {
if (ob.scrollable === true || ob.scrolly === true) {
return BI.extend({}, ob, {type: "bi.flex_scrollable_horizontal"});
}
});
BI.Plugin.configWidget("bi.flex_vertical", function (ob) {
if (ob.scrollable === true || ob.scrollx === true) {
return BI.extend({}, ob, {type: "bi.flex_scrollable_vertical"});
}
});
BI.Plugin.configWidget("bi.flex_horizontal_adapt", function (ob) {
if (ob.scrollable === true || ob.scrollx === true) {
return BI.extend({}, ob, {type: "bi.flex_scrollable_horizontal_adapt"});
BI.Plugin.configWidget("bi.left_right_vertical_adapt", function (ob) {
if (isSupportFlex()) {
// IE下其实也是可以使用flex布局的,只要排除掉出现滚动条的情况
// if (!BI.isIE() || (ob.scrollable !== true && ob.scrolly !== true)) {
return BI.extend({}, ob, {type: "bi.flex_left_right_vertical_adapt"});
// }
}
return ob;
});
BI.Plugin.configWidget("bi.flex_vertical_adapt", function (ob) {
if (ob.scrollable === true || ob.scrolly === true) {
return BI.extend({}, ob, {type: "bi.flex_scrollable_vertical_adapt"});
BI.Plugin.configWidget("bi.flex_horizontal", function (ob) {
if (ob.scrollable === true || ob.scrollx !== false) {
if (ob.hgap > 0 || ob.rgap > 0) {// flex中最后一个margin-right不生效
return BI.extend({}, ob, {type: "bi.flex_scrollable_horizontal"});
}
}
});
BI.Plugin.configWidget("bi.flex_horizontal_center_adapt", function (ob) {
BI.Plugin.configWidget("bi.flex_vertical", function (ob) {
if (ob.scrollable === true || ob.scrollx === true) {
return BI.extend({}, ob, {type: "bi.flex_scrollable_horizontal_adapt"});
}
});
BI.Plugin.configWidget("bi.flex_vertical_center_adapt", function (ob) {
if (ob.scrollable === true || ob.scrolly === true) {
return BI.extend({}, ob, {type: "bi.flex_scrollable_vertical_adapt"});
}
});
BI.Plugin.configWidget("bi.flex_center_adapt", function (ob) {
if (ob.scrollable === true || ob.scrolly === true || ob.scrollx === true) {
return BI.extend({}, ob, {type: "bi.flex_scrollable_center_adapt"});
if (ob.hgap > 0 || ob.rgap > 0) {// flex中最后一个margin-right不生效
return BI.extend({}, ob, {type: "bi.flex_scrollable_vertical"});
}
}
});

4
src/core/platform/web/dom.js

@ -127,11 +127,11 @@
BI.Widget._renderEngine.createElement("body").append(canvas);
var ctx = canvas.getContext("2d");
ctx.font = "12px Georgia";
ctx.font = "12px Helvetica Neue,Arial,PingFang SC,Hiragino Sans GB,Microsoft YaHei,微软雅黑,Heiti,黑体,sans-serif";
var w = ctx.measureText(param).width + 4;
canvas.width = w * ratio;
canvas.height = 16 * ratio;
ctx.font = 12 * ratio + "px Georgia";
ctx.font = 12 * ratio + "px Helvetica Neue,Arial,PingFang SC,Hiragino Sans GB,Microsoft YaHei,微软雅黑,Heiti,黑体,sans-serif";
ctx.fillStyle = fillStyle || "#3685f2";
ctx.textBaseline = "middle";
// ctx.fillStyle = "#EAF2FD";

4
src/core/plugin.js

@ -81,6 +81,10 @@ BI.Plugin = BI.Plugin || {};
return res || object;
},
hasObject: function (type) {
return __GlobalObjectConfigFns.length > 0 || !!_ObjectPlugin[type];
},
registerObject: function (type, fn) {
if (!_ObjectPlugin[type]) {
_ObjectPlugin[type] = [];

39
src/core/shortcut.js

@ -18,11 +18,12 @@
throw new Error("组件" + config.type + "未定义");
}
var pushed = false;
if (context) {
var widget = new cls();
widget._context = BI.Widget.context || context;
if (!BI.Widget.context && context) {
pushed = true;
BI.Widget.pushContext(context);
}
var widget = new cls();
widget._initProps(config);
widget._constructed();
widget._initRoot();
@ -55,24 +56,34 @@
if (item.type || options.type) {
el = BI.extend({}, options, item);
w = BI.Plugin.getWidget(el.type, el);
w.listeners = (w.listeners || []).concat([{
eventName: BI.Events.MOUNT,
action: function () {
BI.Plugin.getObject(el.type, this);
if (w.type === el.type) {
if (BI.Plugin.hasObject(el.type)) {
w.listeners = (w.listeners || []).concat([{
eventName: BI.Events.MOUNT,
action: function () {
BI.Plugin.getObject(el.type, this);
}
}]);
}
}]);
return w.type === el.type ? createWidget(w, context, lazy) : BI.createWidget(BI.extend({/**important**/}, el, {type: w.type}), options, context, lazy);
return createWidget(w, context, lazy);
}
return BI.createWidget(w, options, context, lazy);
}
if (item.el && (item.el.type || options.type)) {
el = BI.extend({}, options, item.el);
w = BI.Plugin.getWidget(el.type, el);
w.listeners = (w.listeners || []).concat([{
eventName: BI.Events.MOUNT,
action: function () {
BI.Plugin.getObject(el.type, this);
if (w.type === el.type) {
if (BI.Plugin.hasObject(el.type)) {
w.listeners = (w.listeners || []).concat([{
eventName: BI.Events.MOUNT,
action: function () {
BI.Plugin.getObject(el.type, this);
}
}]);
}
}]);
return w.type === el.type ? createWidget(w, context, lazy) : BI.createWidget(BI.extend({/**important**/}, el, {type: w.type}), options, context, lazy);
return createWidget(w, context, lazy);
}
return BI.createWidget(w, options, context, lazy);
}
if (BI.isWidget(item.el)) {
return item.el;

116
src/core/widget.js

@ -7,7 +7,7 @@
*/
!(function () {
function callLifeHook (self, life) {
function callLifeHook(self, life) {
var hook = self.options[life] || self[life];
if (hook) {
var hooks = BI.isArray(hook) ? hook : [hook];
@ -59,9 +59,11 @@
}
},
// 生命周期函数
beforeInit: null,
// 生命周期函数
beforeRender: null,
beforeCreate: null,
created: null,
@ -94,14 +96,24 @@
},
_initRender: function () {
var self = this;
function render() {
if (self.options.beforeRender || self.beforeRender) {
(self.options.beforeRender || self.beforeRender).call(self, BI.bind(self._render, self));
} else {
self._render();
}
}
if (this.options.beforeInit || this.beforeInit) {
this.__asking = true;
(this.options.beforeInit || this.beforeInit).call(this, BI.bind(this._render, this));
(this.options.beforeInit || this.beforeInit).call(this, render);
if (this.__asking === true) {
this.__async = true;
}
} else {
this._render();
render();
}
},
@ -113,6 +125,22 @@
callLifeHook(this, "created");
},
_initCurrent: function () {
var o = this.options;
if (o._baseCls || o.baseCls || o.extraCls || o.cls) {
this.element.addClass((o._baseCls || "") + " " + (o.baseCls || "") + " " + (o.extraCls || "") + " " + (o.cls || ""));
}
if (o.attributes) {
this.element.attr(o.attributes);
}
if (o.data) {
this.element.data(o.data);
}
if (o.css) {
this.element.css(o.css);
}
},
/**
* 初始化根节点
* @private
@ -124,34 +152,16 @@
this._children = {};
if (BI.isWidget(o.element)) {
this.element = this.options.element.element;
if (o.element instanceof BI.Widget) {
this._parent = o.element;
this._parent.addWidget(this.widgetName, this);
} else {
this._isRoot = true;
}
this._parent = o.element;
this._parent.addWidget(this.widgetName, this);
} else if (o.element) {
// if (o.root !== true) {
// throw new Error("root is a required property");
// }
this.element = BI.Widget._renderEngine.createElement(this);
this._isRoot = true;
} else {
this.element = BI.Widget._renderEngine.createElement(this);
}
this.element._isWidget = true;
if (o._baseCls || o.baseCls || o.extraCls || o.cls) {
this.element.addClass((o._baseCls || "") + " " + (o.baseCls || "") + " " + (o.extraCls || "") + " " + (o.cls || ""));
}
if (o.attributes) {
this.element.attr(o.attributes);
}
if (o.data) {
this.element.data(o.data);
}
if (o.css) {
this.element.css(o.css);
}
this._initCurrent();
},
_initElementWidth: function () {
@ -226,37 +236,40 @@
* @returns {boolean}
* @private
*/
_mount: function (force, deep, lifeHook, predicate) {
if (this.__beforeMount(force, deep, lifeHook, predicate)) {
this.__afterMount(lifeHook, predicate);
return true;
}
return false;
},
__beforeMount: function (force, deep, lifeHook, predicate) {
_mount: function (force, deep, lifeHook, predicate, layer) {
var self = this;
if (!force && (this._isMounted || !this.isVisible() || this.__asking === true || !(this._isRoot === true || (this._parent && this._parent._isMounted === true)))) {
return false;
}
layer = layer || 0;
lifeHook !== false && callLifeHook(this, "beforeMount");
this._isMounted = true;
BI.each(this._children, function (i, widget) {
!self.isEnabled() && widget._setEnable(false);
!self.isValid() && widget._setValid(false);
widget.__beforeMount && widget.__beforeMount(deep ? force : false, deep, lifeHook, predicate);
});
for (var key in this._children) {
var child = this._children[key];
!self.isEnabled() && child._setEnable(false);
!self.isValid() && child._setValid(false);
child._mount && child._mount(deep ? force : false, deep, lifeHook, predicate, layer + 1);
}
this._mountChildren && this._mountChildren();
if (layer === 0) {
// mounted里面会执行scrollTo之类的方法,如果放宏任务里会闪
// setTimeout(function () {
self.__afterMount(lifeHook, predicate);
// }, 0);
}
return true;
},
__afterMount: function (lifeHook, predicate) {
BI.each(this._children, function (i, widget) {
widget.__afterMount && widget.__afterMount(lifeHook, predicate);
});
lifeHook !== false && callLifeHook(this, "mounted");
this.fireEvent(BI.Events.MOUNT);
predicate && predicate(this);
if (this._isMounted) {
for (var key in this._children) {
var child = this._children[key];
child.__afterMount && child.__afterMount(lifeHook, predicate);
}
lifeHook !== false && callLifeHook(this, "mounted");
this.fireEvent(BI.Events.MOUNT);
predicate && predicate(this);
}
},
_mountChildren: null,
@ -544,6 +557,15 @@
this.element.empty();
},
// 默认的populate方法就是干掉重来
reset: function () {
this.purgeListeners();
this.empty();
this._initCurrent();
this._init();
this._initRef();
},
_destroy: function () {
this.__d();
this.element.destroy();
@ -571,12 +593,12 @@
BI.Widget.context = context = contextStack.pop();
};
function pushTarget (_current) {
function pushTarget(_current) {
if (current) currentStack.push(current);
BI.Widget.current = current = _current;
}
function popTarget () {
function popTarget() {
BI.Widget.current = current = currentStack.pop();
}

15
src/core/wrapper/layout.js

@ -71,12 +71,13 @@ BI.Layout = BI.inherit(BI.Widget, {
var self = this;
var frag = BI.Widget._renderEngine.createFragment();
var hasChild = false;
BI.each(this._children, function (i, widget) {
if (widget.element !== self.element) {
frag.appendChild(widget.element[0]);
for (var key in this._children) {
var child = this._children[key];
if (child.element !== self.element) {
frag.appendChild(child.element[0]);
hasChild = true;
}
});
}
if (hasChild === true) {
this.appendFragment(frag);
}
@ -366,9 +367,9 @@ BI.Layout = BI.inherit(BI.Widget, {
return child._update(this._getOptions(vnode), shouldUpdate);
}
if (shouldUpdate === null && !this._compare(oldVnode, vnode)) {
if (child.update) {
return child.update(this._getOptions(vnode));
}
// if (child.update) {
// return child.update(this._getOptions(vnode));
// }
return this.updateItemAt(index, vnode);
}
},

2
src/core/wrapper/layout/adapt/adapt.table.js

@ -35,7 +35,7 @@ BI.TableAdaptLayout = BI.inherit(BI.Layout, {
_addElement: function (i, item) {
var o = this.options;
var td;
var width = o.columnSize[i] <= 1 ? ((o.columnSize[i] * 100).toFixed(1) + "%") : o.columnSize[i];
var width = o.columnSize[i] === "" ? "" : (o.columnSize[i] <= 1 ? ((o.columnSize[i] * 100).toFixed(1) + "%") : (i === 0 ? o.hgap : 0) + o.hgap + o.lgap + o.rgap + o.columnSize[i]);
if (!this.hasWidget(this._getChildName(i))) {
var w = BI._lazyCreateWidget(item);
w.element.css({position: "relative", top: "0", left: "0", margin: "0px auto"});

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

@ -25,67 +25,27 @@ BI.InlineCenterAdaptLayout = BI.inherit(BI.Layout, {
},
render: function () {
BI.InlineCenterAdaptLayout.superclass.render.apply(this, arguments);
var o = this.options;
this.element.css({
whiteSpace: "nowrap",
textAlign: o.horizontalAlign
});
this.populate(o.items);
},
_addElement: function (i, item, length) {
var o = this.options;
var w = BI.InlineCenterAdaptLayout.superclass._addElement.apply(this, arguments);
w.element.css({
width: o.columnSize[i] <= 1 ? ((o.columnSize[i] * 100).toFixed(1) + "%") : (o.columnSize[i] / BI.pixRatio + BI.pixUnit),
position: "relative",
"vertical-align": o.verticalAlign
});
w.element.addClass("i-c-a-item");
if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) {
w.element.css({
"margin-top": (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0)) / BI.pixRatio + BI.pixUnit
});
}
if (o.hgap + o.lgap + (item.lgap || 0) + (item.hgap || 0) !== 0) {
w.element.css({
"margin-left": ((i === 0 ? o.hgap : 0) + o.lgap + (item.lgap || 0) + (item.hgap || 0)) / BI.pixRatio + BI.pixUnit
});
}
if (o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0) !== 0) {
w.element.css({
"margin-right": (o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0)) / BI.pixRatio + BI.pixUnit
});
}
if (o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0) !== 0) {
w.element.css({
"margin-bottom": (o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0))
});
}
return w;
},
resize: function () {
this.stroke(this.options.items);
},
addItem: function (item) {
throw new Error("不能添加元素");
},
stroke: function (items) {
var self = this;
BI.each(items, function (i, item) {
if (item) {
self._addElement(i, item, items.length);
}
});
var self = this, o = this.options;
return {
type: "bi.inline",
ref: function (_ref) {
self.layout = _ref;
},
items: o.items,
horizontalAlign: o.horizontalAlign,
verticalAlign: o.verticalAlign,
columnSize: o.columnSize,
hgap: o.hgap,
vgap: o.vgap,
lgap: o.lgap,
rgap: o.rgap,
tgap: o.tgap,
bgap: o.bgap
};
},
populate: function (items) {
BI.InlineCenterAdaptLayout.superclass.populate.apply(this, arguments);
this._mount();
this.layout.populate.apply(this.layout, arguments);
}
});
BI.shortcut("bi.inline_center_adapt", BI.InlineCenterAdaptLayout);

76
src/core/wrapper/layout/adapt/inline.horizontal.js

@ -25,67 +25,27 @@ BI.InlineHorizontalAdaptLayout = BI.inherit(BI.Layout, {
},
render: function () {
BI.InlineHorizontalAdaptLayout.superclass.render.apply(this, arguments);
var o = this.options;
this.element.css({
whiteSpace: "nowrap",
textAlign: o.horizontalAlign
});
this.populate(o.items);
},
_addElement: function (i, item, length) {
var o = this.options;
var w = BI.InlineHorizontalAdaptLayout.superclass._addElement.apply(this, arguments);
w.element.css({
width: o.columnSize[i] <= 1 ? ((o.columnSize[i] * 100).toFixed(1) + "%") : (o.columnSize[i] / BI.pixRatio + BI.pixUnit),
position: "relative",
"vertical-align": o.verticalAlign
});
w.element.addClass("i-h-a-item");
if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) {
w.element.css({
"margin-top": (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0)) / BI.pixRatio + BI.pixUnit
});
}
if (o.hgap + o.lgap + (item.lgap || 0) + (item.hgap || 0) !== 0) {
w.element.css({
"margin-left": ((i === 0 ? o.hgap : 0) + o.lgap + (item.lgap || 0) + (item.hgap || 0)) / BI.pixRatio + BI.pixUnit
});
}
if (o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0) !== 0) {
w.element.css({
"margin-right": (o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0)) / BI.pixRatio + BI.pixUnit
});
}
if (o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0) !== 0) {
w.element.css({
"margin-bottom": (o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0)) / BI.pixRatio + BI.pixUnit
});
}
return w;
},
resize: function () {
this.stroke(this.options.items);
},
addItem: function (item) {
throw new Error("不能添加元素");
},
stroke: function (items) {
var self = this;
BI.each(items, function (i, item) {
if (item) {
self._addElement(i, item, items.length);
}
});
var self = this, o = this.options;
return {
type: "bi.inline",
ref: function (_ref) {
self.layout = _ref;
},
items: o.items,
horizontalAlign: o.horizontalAlign,
verticalAlign: o.verticalAlign,
columnSize: o.columnSize,
hgap: o.hgap,
vgap: o.vgap,
lgap: o.lgap,
rgap: o.rgap,
tgap: o.tgap,
bgap: o.bgap
};
},
populate: function (items) {
BI.InlineHorizontalAdaptLayout.superclass.populate.apply(this, arguments);
this._mount();
this.layout.populate.apply(this.layout, arguments);
}
});
BI.shortcut("bi.inline_horizontal_adapt", BI.InlineHorizontalAdaptLayout);

63
src/core/wrapper/layout/adapt/inline.vertical.js

@ -25,54 +25,27 @@ BI.InlineVerticalAdaptLayout = BI.inherit(BI.Layout, {
},
render: function () {
BI.InlineVerticalAdaptLayout.superclass.render.apply(this, arguments);
var o = this.options;
this.element.css({
whiteSpace: "nowrap",
textAlign: o.horizontalAlign
});
this.populate(o.items);
},
_addElement: function (i, item) {
var o = this.options;
var w = BI.InlineVerticalAdaptLayout.superclass._addElement.apply(this, arguments);
w.element.css({
width: o.columnSize[i] <= 1 ? ((o.columnSize[i] * 100).toFixed(1) + "%") : (o.columnSize[i] / BI.pixRatio + BI.pixUnit),
position: "relative",
"vertical-align": o.verticalAlign
});
w.element.addClass("i-v-a-item");
if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) {
w.element.css({
"margin-top": (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0)) / BI.pixRatio + BI.pixUnit
});
}
if (o.hgap + o.lgap + (item.lgap || 0) + (item.hgap || 0) !== 0) {
w.element.css({
"margin-left": ((i === 0 ? o.hgap : 0) + o.lgap + (item.lgap || 0) + (item.hgap || 0)) / BI.pixRatio + BI.pixUnit
});
}
if (o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0) !== 0) {
w.element.css({
"margin-right": (o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0)) / BI.pixRatio + BI.pixUnit
});
}
if (o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0) !== 0) {
w.element.css({
"margin-bottom": (o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0)) / BI.pixRatio + BI.pixUnit
});
}
return w;
},
resize: function () {
this.stroke(this.options.items);
var self = this, o = this.options;
return {
type: "bi.inline",
ref: function (_ref) {
self.layout = _ref;
},
items: o.items,
horizontalAlign: o.horizontalAlign,
verticalAlign: o.verticalAlign,
columnSize: o.columnSize,
hgap: o.hgap,
vgap: o.vgap,
lgap: o.lgap,
rgap: o.rgap,
tgap: o.tgap,
bgap: o.bgap
};
},
populate: function (items) {
BI.InlineVerticalAdaptLayout.superclass.populate.apply(this, arguments);
this._mount();
this.layout.populate.apply(this.layout, arguments);
}
});
BI.shortcut("bi.inline_vertical_adapt", BI.InlineVerticalAdaptLayout);

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

@ -25,6 +25,12 @@ BI.FlexHorizontalLayout = BI.inherit(BI.Layout, {
BI.FlexHorizontalLayout.superclass.render.apply(this, arguments);
var o = this.options;
this.element.addClass("v-" + o.verticalAlign).addClass("h-" + o.horizontalAlign);
if (o.scrollable === true || o.scrollx === true) {
this.element.addClass("f-scroll-x");
}
if (o.scrollable === true || o.scrolly === true) {
this.element.addClass("f-scroll-y");
}
this.populate(this.options.items);
},
@ -35,17 +41,24 @@ BI.FlexHorizontalLayout = BI.inherit(BI.Layout, {
position: "relative"
});
if (o.columnSize[i] !== "auto") {
if (o.horizontalAlign === BI.HorizontalAlign.Stretch && o.columnSize[i] !== "") {
w.element.addClass("fill");
if (o.horizontalAlign === BI.HorizontalAlign.Stretch && o.columnSize[i] === "fill") {
w.element.addClass("f-f");
} else {
w.element.addClass("shrink-none");
w.element.addClass("f-s-n");
}
}
if (o.columnSize[i] > 0) {
w.element.width(o.columnSize[i] <= 1 ? ((o.columnSize[i] * 100).toFixed(1) + "%") : (o.columnSize[i] / BI.pixRatio + BI.pixUnit));
w.element.width(o.columnSize[i] === "" ? "" : (o.columnSize[i] <= 1 ? ((o.columnSize[i] * 100).toFixed(1) + "%") : (o.columnSize[i] / BI.pixRatio + BI.pixUnit)));
}
if (o.columnSize[i] === "fill") {
w.element.addClass("fill");
w.element.addClass("f-f");
}
w.element.addClass("c-e");
if (i === 0) {
w.element.addClass("f-c");
}
if (i === o.items.length - 1) {
w.element.addClass("l-c");
}
if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) {
w.element.css({

102
src/core/wrapper/layout/flex/flex.leftrightvertical.center.js

@ -0,0 +1,102 @@
BI.FlexLeftRightVerticalAdaptLayout = BI.inherit(BI.Layout, {
props: function () {
return BI.extend(BI.FlexLeftRightVerticalAdaptLayout.superclass.props.apply(this, arguments), {
baseCls: "bi-f-lr-v-c",
items: {},
llgap: 0,
lrgap: 0,
lhgap: 0,
ltgap: 0,
lbgap: 0,
lvgap: 0,
rlgap: 0,
rrgap: 0,
rhgap: 0,
rtgap: 0,
rbgap: 0,
rvgap: 0
});
},
render: function () {
var o = this.options, self = this;
BI.FlexLeftRightVerticalAdaptLayout.superclass.render.apply(this, arguments);
return {
type: "bi.flex_vertical_adapt",
ref: function (_ref) {
self.layout = _ref;
},
items: this._formatItems(),
scrollx: o.scrollx,
scrolly: o.scrolly,
scrollable: o.scrollable
};
},
_formatItems: function () {
var o = this.options;
var leftItems = o.items.left || [];
var rightItems = o.items.right || [];
leftItems = BI.map(leftItems, function (i, item) {
var json = {
el: BI.stripEL(item)
};
if (o.lvgap + o.ltgap + (item.tgap || 0) + (item.vgap || 0) !== 0) {
json.tgap = o.lvgap + o.ltgap + (item.tgap || 0) + (item.vgap || 0);
}
if (o.lhgap + o.llgap + (item.lgap || 0) + (item.hgap || 0) !== 0) {
json.lgap = (i === 0 ? o.lhgap : 0) + o.llgap + (item.lgap || 0) + (item.hgap || 0);
}
if (o.lhgap + o.lrgap + (item.rgap || 0) + (item.hgap || 0) !== 0) {
json.rgap = o.lhgap + o.lrgap + (item.rgap || 0) + (item.hgap || 0);
}
if (o.lvgap + o.lbgap + (item.bgap || 0) + (item.vgap || 0) !== 0) {
json.bgap = o.lvgap + o.lbgap + (item.bgap || 0) + (item.vgap || 0);
}
return json;
});
rightItems = BI.map(rightItems, function (i, item) {
if (i === 0) {
if (BI.isWidget(item)) {
item.element.addClass("flex-left-auto");
} else {
var t = BI.stripEL(item);
t.cls = (t.cls || "") + " flex-left-auto";
}
}
var json = {
el: BI.stripEL(item)
};
if (o.rvgap + o.rtgap + (item.tgap || 0) + (item.vgap || 0) !== 0) {
json.tgap = o.rvgap + o.rtgap + (item.tgap || 0) + (item.vgap || 0);
}
if (o.rhgap + o.rlgap + (item.lgap || 0) + (item.hgap || 0) !== 0) {
if (i > 0) {
json.lgap = o.rlgap + (item.lgap || 0) + (item.hgap || 0);
}
}
if (o.rhgap + o.rrgap + (item.rgap || 0) + (item.hgap || 0) !== 0) {
json.rgap = o.rhgap + o.rrgap + (item.rgap || 0) + (item.hgap || 0);
}
if (o.rvgap + o.rbgap + (item.bgap || 0) + (item.vgap || 0) !== 0) {
json.bgap = o.rvgap + o.rbgap + (item.bgap || 0) + (item.vgap || 0);
}
return json;
});
return leftItems.concat(rightItems);
},
resize: function () {
// console.log("left_right_vertical_adapt布局不需要resize");
},
addItem: function () {
// do nothing
throw new Error("cannot be added");
},
populate: function (items) {
this.options.items = items;
this.layout.populate(this._formatItems());
}
});
BI.shortcut("bi.flex_left_right_vertical_adapt", BI.FlexLeftRightVerticalAdaptLayout);

23
src/core/wrapper/layout/flex/flex.vertical.js

@ -24,6 +24,12 @@ BI.FlexVerticalLayout = BI.inherit(BI.Layout, {
BI.FlexVerticalLayout.superclass.render.apply(this, arguments);
var o = this.options;
this.element.addClass("h-" + o.horizontalAlign).addClass("v-" + o.verticalAlign);
if (o.scrollable === true || o.scrollx === true) {
this.element.addClass("f-scroll-x");
}
if (o.scrollable === true || o.scrolly === true) {
this.element.addClass("f-scroll-y");
}
this.populate(this.options.items);
},
@ -34,17 +40,24 @@ BI.FlexVerticalLayout = BI.inherit(BI.Layout, {
position: "relative"
});
if (o.rowSize[i] !== "auto") {
if (o.verticalAlign === BI.VerticalAlign.Stretch && o.rowSize[i] !== "") {
w.element.addClass("fill");
if (o.verticalAlign === BI.VerticalAlign.Stretch && o.rowSize[i] === "fill") {
w.element.addClass("f-f");
} else {
w.element.addClass("shrink-none");
w.element.addClass("f-s-n");
}
}
if (o.rowSize[i] > 0) {
w.element.height(o.rowSize[i] <= 1 ? ((o.rowSize[i] * 100).toFixed(1) + "%") : (o.rowSize[i] / BI.pixRatio + BI.pixUnit));
w.element.height(o.rowSize[i] === "" ? "" : (o.rowSize[i] <= 1 ? ((o.rowSize[i] * 100).toFixed(1) + "%") : (o.rowSize[i] / BI.pixRatio + BI.pixUnit)));
}
if (o.rowSize[i] === "fill") {
w.element.addClass("fill");
w.element.addClass("f-f");
}
w.element.addClass("c-e");
if (i === 0) {
w.element.addClass("f-c");
}
if (i === o.items.length - 1) {
w.element.addClass("l-c");
}
if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) {
w.element.css({

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

@ -8,7 +8,7 @@
BI.FlexWrapperHorizontalLayout = BI.inherit(BI.Layout, {
props: function () {
return BI.extend(BI.FlexWrapperHorizontalLayout.superclass.props.apply(this, arguments), {
baseCls: "bi-f-s-h clearfix",
baseCls: "bi-f-s-h",
verticalAlign: BI.VerticalAlign.Top,
horizontalAlign: BI.HorizontalAlign.Left,
columnSize: [],
@ -25,6 +25,7 @@ BI.FlexWrapperHorizontalLayout = BI.inherit(BI.Layout, {
render: function () {
BI.FlexWrapperHorizontalLayout.superclass.render.apply(this, arguments);
var o = this.options;
this.element.addClass("v-" + o.verticalAlign).addClass("h-" + o.horizontalAlign);
this.$wrapper = BI.Widget._renderEngine.createElement("<div>").addClass("f-s-h-w v-" + o.verticalAlign).addClass("h-" + o.horizontalAlign);
this.populate(this.options.items);
},
@ -37,16 +38,23 @@ BI.FlexWrapperHorizontalLayout = BI.inherit(BI.Layout, {
});
if (o.columnSize[i] !== "auto") {
if (o.horizontalAlign === BI.HorizontalAlign.Stretch && o.columnSize[i] !== "") {
w.element.addClass("fill");
w.element.addClass("f-f");
} else {
w.element.addClass("shrink-none");
w.element.addClass("f-s-n");
}
}
if (o.columnSize[i] > 0) {
w.element.width(o.columnSize[i] <= 1 ? ((o.columnSize[i] * 100).toFixed(1) + "%") : (o.columnSize[i] / BI.pixRatio + BI.pixUnit));
w.element.width(o.columnSize[i] === "" ? "" : (o.columnSize[i] <= 1 ? ((o.columnSize[i] * 100).toFixed(1) + "%") : (o.columnSize[i] / BI.pixRatio + BI.pixUnit)));
}
if (o.columnSize[i] === "fill") {
w.element.addClass("fill");
w.element.addClass("f-f");
}
w.element.addClass("c-e");
if (i === 0) {
w.element.addClass("f-c");
}
if (i === o.items.length - 1) {
w.element.addClass("l-c");
}
if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) {
w.element.css({

18
src/core/wrapper/layout/flex/wrapper/flex.wrapper.vertical.js

@ -8,7 +8,7 @@
BI.FlexWrapperVerticalLayout = BI.inherit(BI.Layout, {
props: function () {
return BI.extend(BI.FlexWrapperVerticalLayout.superclass.props.apply(this, arguments), {
baseCls: "bi-f-s-v clearfix",
baseCls: "bi-f-s-v",
horizontalAlign: BI.HorizontalAlign.Left,
verticalAlign: BI.VerticalAlign.Top,
rowSize: [],
@ -25,6 +25,7 @@ BI.FlexWrapperVerticalLayout = BI.inherit(BI.Layout, {
render: function () {
BI.FlexWrapperVerticalLayout.superclass.render.apply(this, arguments);
var o = this.options;
this.element.addClass("v-" + o.verticalAlign).addClass("h-" + o.horizontalAlign);
this.$wrapper = BI.Widget._renderEngine.createElement("<div>").addClass("f-s-v-w h-" + o.horizontalAlign).addClass("v-" + o.verticalAlign);
this.populate(this.options.items);
},
@ -37,16 +38,23 @@ BI.FlexWrapperVerticalLayout = BI.inherit(BI.Layout, {
});
if (o.rowSize[i] !== "auto") {
if (o.verticalAlign === BI.VerticalAlign.Stretch && o.rowSize[i] !== "") {
w.element.addClass("fill");
w.element.addClass("f-f");
} else {
w.element.addClass("shrink-none");
w.element.addClass("f-s-n");
}
}
if (o.rowSize[i] > 0) {
w.element.height(o.rowSize[i] <= 1 ? ((o.rowSize[i] * 100).toFixed(1) + "%") : (o.rowSize[i] / BI.pixRatio + BI.pixUnit));
w.element.height(o.rowSize[i] === "" ? "" : (o.rowSize[i] <= 1 ? ((o.rowSize[i] * 100).toFixed(1) + "%") : (o.rowSize[i] / BI.pixRatio + BI.pixUnit)));
}
if (o.rowSize[i] === "fill") {
w.element.addClass("fill");
w.element.addClass("f-f");
}
w.element.addClass("c-e");
if (i === 0) {
w.element.addClass("f-c");
}
if (i === o.items.length - 1) {
w.element.addClass("l-c");
}
if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) {
w.element.css({

2
src/core/wrapper/layout/layout.border.js

@ -7,7 +7,7 @@
BI.BorderLayout = BI.inherit(BI.Layout, {
props: function () {
return BI.extend(BI.BorderLayout.superclass.props.apply(this, arguments), {
baseCls: "bi-border",
baseCls: "bi-border-layout",
items: {}
});
},

46
src/core/wrapper/layout/layout.flow.js

@ -10,7 +10,7 @@
BI.FloatLeftLayout = BI.inherit(BI.Layout, {
props: function () {
return BI.extend(BI.FloatLeftLayout.superclass.props.apply(this, arguments), {
baseCls: "bi-left clearfix",
baseCls: "bi-left clearfix border-sizing",
hgap: 0,
vgap: 0,
lgap: 0,
@ -21,6 +21,19 @@ BI.FloatLeftLayout = BI.inherit(BI.Layout, {
},
render: function () {
BI.FloatLeftLayout.superclass.render.apply(this, arguments);
var o = this.options;
if (o.hgap > 0) {
this.element.css({
"padding-left": o.hgap / 2 / BI.pixRatio + BI.pixUnit,
"padding-right": o.hgap / 2 / BI.pixRatio + BI.pixUnit
});
}
if (o.vgap > 0) {
this.element.css({
"padding-top": o.vgap / 2 / BI.pixRatio + BI.pixUnit,
"padding-bottom": o.vgap / 2 / BI.pixRatio + BI.pixUnit
});
}
this.populate(this.options.items);
},
@ -42,22 +55,22 @@ BI.FloatLeftLayout = BI.inherit(BI.Layout, {
}
if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) {
w.element.css({
"margin-top": (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0)) / BI.pixRatio + BI.pixUnit
"margin-top": (o.vgap / 2 + o.tgap + (item.tgap || 0) + (item.vgap || 0)) / BI.pixRatio + BI.pixUnit
});
}
if (o.hgap + o.lgap + (item.lgap || 0) + (item.hgap || 0) !== 0) {
w.element.css({
"margin-left": ((i === 0 ? o.hgap : 0) + o.lgap + (item.lgap || 0) + (item.hgap || 0)) / BI.pixRatio + BI.pixUnit
"margin-left": (o.hgap / 2 + o.lgap + (item.lgap || 0) + (item.hgap || 0)) / BI.pixRatio + BI.pixUnit
});
}
if (o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0) !== 0) {
w.element.css({
"margin-right": (o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0)) / BI.pixRatio + BI.pixUnit
"margin-right": (o.hgap / 2 + o.rgap + (item.rgap || 0) + (item.hgap || 0)) / BI.pixRatio + BI.pixUnit
});
}
if (o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0) !== 0) {
w.element.css({
"margin-bottom": (o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0)) / BI.pixRatio + BI.pixUnit
"margin-bottom": (o.vgap / 2 + o.bgap + (item.bgap || 0) + (item.vgap || 0)) / BI.pixRatio + BI.pixUnit
});
}
return w;
@ -86,7 +99,7 @@ BI.shortcut("bi.left", BI.FloatLeftLayout);
BI.FloatRightLayout = BI.inherit(BI.Layout, {
props: function () {
return BI.extend(BI.FloatRightLayout.superclass.props.apply(this, arguments), {
baseCls: "bi-right clearfix",
baseCls: "bi-right clearfix border-sizing",
hgap: 0,
vgap: 0,
lgap: 0,
@ -97,6 +110,19 @@ BI.FloatRightLayout = BI.inherit(BI.Layout, {
},
render: function () {
BI.FloatRightLayout.superclass.render.apply(this, arguments);
var o = this.options;
if (o.hgap > 0) {
this.element.css({
"padding-left": o.hgap / 2 / BI.pixRatio + BI.pixUnit,
"padding-right": o.hgap / 2 / BI.pixRatio + BI.pixUnit
});
}
if (o.vgap > 0) {
this.element.css({
"padding-top": o.vgap / 2 / BI.pixRatio + BI.pixUnit,
"padding-bottom": o.vgap / 2 / BI.pixRatio + BI.pixUnit
});
}
this.populate(this.options.items);
},
@ -118,22 +144,22 @@ BI.FloatRightLayout = BI.inherit(BI.Layout, {
}
if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) {
w.element.css({
"margin-top": (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0)) / BI.pixRatio + BI.pixUnit
"margin-top": (o.vgap / 2 + o.tgap + (item.tgap || 0) + (item.vgap || 0)) / BI.pixRatio + BI.pixUnit
});
}
if (o.hgap + o.lgap + (item.lgap || 0) + (item.hgap || 0) !== 0) {
w.element.css({
"margin-left": (o.hgap + o.lgap + (item.lgap || 0) + (item.hgap || 0)) / BI.pixRatio + BI.pixUnit
"margin-left": (o.hgap / 2 + o.lgap + (item.lgap || 0) + (item.hgap || 0)) / BI.pixRatio + BI.pixUnit
});
}
if (o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0) !== 0) {
w.element.css({
"margin-right": ((i === 0 ? o.hgap : 0) + o.rgap + (item.rgap || 0) + (item.hgap || 0)) / BI.pixRatio + BI.pixUnit
"margin-right": (o.hgap / 2 + o.rgap + (item.rgap || 0) + (item.hgap || 0)) / BI.pixRatio + BI.pixUnit
});
}
if (o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0) !== 0) {
w.element.css({
"margin-bottom": (o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0)) / BI.pixRatio + BI.pixUnit
"margin-bottom": (o.vgap / 2 + o.bgap + (item.bgap || 0) + (item.vgap || 0)) / BI.pixRatio + BI.pixUnit
});
}
return w;

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

@ -39,7 +39,7 @@ BI.HorizontalLayout = BI.inherit(BI.Layout, {
_addElement: function (i, item) {
var o = this.options;
var td;
var width = o.columnSize[i] <= 1 ? ((o.columnSize[i] * 100).toFixed(1) + "%") : o.columnSize[i];
var width = o.columnSize[i] === "" ? "" : (o.columnSize[i] <= 1 ? ((o.columnSize[i] * 100).toFixed(1) + "%") : (i === 0 ? o.hgap : 0) + o.hgap + o.lgap + o.rgap + o.columnSize[i]);
if (!this.hasWidget(this._getChildName(i))) {
var w = BI._lazyCreateWidget(item);
w.element.css({position: "relative", margin: "0px auto"});

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save