Browse Source

Merging in latest from upstream (VISUAL/fineui:refs/heads/master)

* commit '598e6529c2a5eb217be1d65cdf48a087a3bb3c67': (44 commits)
  auto upgrade version to 2.0.20210821090116
  整理代码
  路由
  auto upgrade version to 2.0.20210820185216
  整理代码
  整理代码
  整理代码
  auto upgrade version to 2.0.20210820175128
  下个版本再改
  auto upgrade version to 2.0.20210819233200
  整理代码
  整理代码
  整理代码
  auto upgrade version to 2.0.20210819231136
  整理代码
  整理代码
  整理代码
  inline布局可以用在virtualgroup中
  auto upgrade version to 2.0.20210819205125
  整理代码
  ...
es6
Guyi 3 years ago
parent
commit
b08db5b611
  1. 1
      changelog.md
  2. 16
      demo/app.js
  3. 4
      dist/2.0/fineui.css
  4. 4
      dist/2.0/fineui.ie.min.js
  5. 2
      dist/2.0/fineui.ie.min.js.map
  6. 713
      dist/2.0/fineui.js
  7. 2
      dist/2.0/fineui.js.map
  8. 4
      dist/2.0/fineui.min.css
  9. 4
      dist/2.0/fineui.min.js
  10. 2
      dist/2.0/fineui.min.js.map
  11. 4
      dist/2.0/fineui_without_normalize.css
  12. 4
      dist/2.0/fineui_without_normalize.min.css
  13. 4
      dist/core.css
  14. 713
      dist/core.js
  15. 2
      dist/core.js.map
  16. 4
      dist/demo.css
  17. 728
      dist/demo.js
  18. 2
      dist/demo.js.map
  19. 4
      dist/fineui.css
  20. 4
      dist/fineui.ie.min.js
  21. 2
      dist/fineui.ie.min.js.map
  22. 713
      dist/fineui.js
  23. 2
      dist/fineui.js.map
  24. 4
      dist/fineui.min.css
  25. 4
      dist/fineui.min.js
  26. 2
      dist/fineui.min.js.map
  27. 4
      dist/fineui.proxy.css
  28. 713
      dist/fineui.proxy.js
  29. 2
      dist/fineui.proxy.js.map
  30. 4
      dist/fineui.proxy.min.css
  31. 4
      dist/fineui.proxy.min.js
  32. 2
      dist/fineui.proxy.min.js.map
  33. 709
      dist/fineui_without_jquery_polyfill.js
  34. 2
      dist/fineui_without_jquery_polyfill.js.map
  35. 2
      dist/font.css
  36. BIN
      dist/font/iconfont.eot
  37. 10
      dist/font/iconfont.svg
  38. BIN
      dist/font/iconfont.ttf
  39. BIN
      dist/font/iconfont.woff
  40. BIN
      dist/font/iconfont.woff2
  41. 2
      dist/lib/base/tree/customtree.d.ts
  42. 2
      dist/resource.css
  43. 72
      dist/router.js
  44. 2
      dist/utils.js
  45. 2
      dist/utils.min.js
  46. 119
      examples/dev.html
  47. 142
      examples/插件设计.html
  48. 2
      package.json
  49. 121
      src/case/colorchooser/colorpicker/editor.colorpicker.hex.js
  50. 4
      src/core/platform/web/dom.js
  51. 130
      src/core/wrapper/layout.js
  52. 4
      src/core/wrapper/layout/adapt/absolute.center.js
  53. 2
      src/core/wrapper/layout/adapt/absolute.horizontal.js
  54. 6
      src/core/wrapper/layout/adapt/absolute.leftrightvertical.js
  55. 2
      src/core/wrapper/layout/adapt/absolute.vertical.js
  56. 2
      src/core/wrapper/layout/adapt/adapt.center.js
  57. 7
      src/core/wrapper/layout/adapt/adapt.leftrightvertical.js
  58. 30
      src/core/wrapper/layout/adapt/adapt.table.js
  59. 2
      src/core/wrapper/layout/adapt/adapt.vertical.js
  60. 4
      src/core/wrapper/layout/adapt/auto.horizontal.js
  61. 4
      src/core/wrapper/layout/adapt/inline.center.js
  62. 4
      src/core/wrapper/layout/adapt/inline.horizontal.js
  63. 4
      src/core/wrapper/layout/adapt/inline.vertical.js
  64. 17
      src/core/wrapper/layout/fill/float.fill.horizontal.js
  65. 10
      src/core/wrapper/layout/flex/flex.center.js
  66. 10
      src/core/wrapper/layout/flex/flex.horizontal.center.js
  67. 4
      src/core/wrapper/layout/flex/flex.horizontal.js
  68. 13
      src/core/wrapper/layout/flex/flex.leftrightvertical.center.js
  69. 10
      src/core/wrapper/layout/flex/flex.vertical.center.js
  70. 4
      src/core/wrapper/layout/flex/flex.vertical.js
  71. 8
      src/core/wrapper/layout/flex/wrapper/flex.wrapper.center.js
  72. 8
      src/core/wrapper/layout/flex/wrapper/flex.wrapper.horizontal.center.js
  73. 4
      src/core/wrapper/layout/flex/wrapper/flex.wrapper.horizontal.js
  74. 8
      src/core/wrapper/layout/flex/wrapper/flex.wrapper.vertical.center.js
  75. 4
      src/core/wrapper/layout/flex/wrapper/flex.wrapper.vertical.js
  76. 4
      src/core/wrapper/layout/float/float.absolute.center.js
  77. 19
      src/core/wrapper/layout/float/float.absolute.horizontal.js
  78. 17
      src/core/wrapper/layout/float/float.absolute.leftrightvertical.js
  79. 13
      src/core/wrapper/layout/float/float.absolute.vertical.js
  80. 4
      src/core/wrapper/layout/layout.absolute.js
  81. 4
      src/core/wrapper/layout/layout.adaptive.js
  82. 5
      src/core/wrapper/layout/layout.border.js
  83. 11
      src/core/wrapper/layout/layout.card.js
  84. 4
      src/core/wrapper/layout/layout.default.js
  85. 30
      src/core/wrapper/layout/layout.division.js
  86. 8
      src/core/wrapper/layout/layout.flow.js
  87. 28
      src/core/wrapper/layout/layout.grid.js
  88. 37
      src/core/wrapper/layout/layout.inline.js
  89. 16
      src/core/wrapper/layout/layout.lattice.js
  90. 10
      src/core/wrapper/layout/layout.table.js
  91. 18
      src/core/wrapper/layout/layout.tape.js
  92. 10
      src/core/wrapper/layout/layout.td.js
  93. 4
      src/core/wrapper/layout/layout.vertical.js
  94. 11
      src/core/wrapper/layout/layout.window.js
  95. 8
      src/core/wrapper/layout/middle/middle.center.js
  96. 8
      src/core/wrapper/layout/middle/middle.float.center.js
  97. 8
      src/core/wrapper/layout/middle/middle.horizontal.js
  98. 8
      src/core/wrapper/layout/middle/middle.vertical.js
  99. 12
      src/less/core/wrapper/float.absolute.less
  100. 2
      template/index.html
  101. Some files were not shown because too many files have changed in this diff Show More

1
changelog.md

@ -1,5 +1,6 @@
# 更新日志
2.0(2021-07)
- layout支持forceUpdate刷新方式
- width属性支持calc()
- 修改了颜色选择器交互
- 新增bi.horizontal_fill、bi.vertical_fill布局

16
demo/app.js

@ -9,8 +9,8 @@ BI.$(function () {
});
var tree = BI.Tree.transformToTreeFormat(Demo.CONFIG);
var routes = [{
path: '/',
var routes = [{
path: '/',
component: function(){
return Promise.resolve({
type: "demo.face"
@ -20,13 +20,13 @@ BI.$(function () {
BI.Tree.traversal(tree, function (index, node) {
if (!node.children || BI.isEmptyArray(node.children)) {
routes.push({
path: '/' + node.text,
routes.push({
path: '/' + node.text,
component: function(){
return Promise.resolve({
type: node.value
})
}
}
});
}
});
@ -38,7 +38,7 @@ BI.$(function () {
BI.createWidget({
type: "bi.router",
ref: function (_ref) {
BI.router = _ref._router;
BI.$router = _ref.$router;
},
element: "#wrapper",
routes: routes,
@ -50,6 +50,6 @@ BI.$(function () {
ref = _ref;
}
}
}
}
});
});
});

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

713
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

713
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

728
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

713
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

4
dist/fineui.proxy.css vendored

File diff suppressed because one or more lines are too long

713
dist/fineui.proxy.js vendored

File diff suppressed because it is too large Load Diff

2
dist/fineui.proxy.js.map vendored

File diff suppressed because one or more lines are too long

4
dist/fineui.proxy.min.css vendored

File diff suppressed because one or more lines are too long

4
dist/fineui.proxy.min.js vendored

File diff suppressed because one or more lines are too long

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

File diff suppressed because one or more lines are too long

709
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

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.

10
dist/font/iconfont.svg vendored

@ -14,6 +14,8 @@
/>
<missing-glyph />
<glyph glyph-name="zhongxinxuanze" unicode="&#59498;" d="M896 832a64 64 0 0 0 64-64v-512c-4.992-15.616-15.04-23.424-30.336-23.424a32.896 32.896 0 0 0-29.888 17.216l-3.2 6.208H896V768H128v-768h512v-1.6c16.576-4.032 24.832-14.272 24.832-30.72 0-14.4-6.4-24.32-19.008-29.632L640-64H128a64 64 0 0 0-64 64V768a64 64 0 0 0 64 64h768zM452.288 526.72v-82.048H628.48c14.848 0 28.992-7.04 37.952-18.88l128.64-342.464 118.08-0.256c26.304-0.064 37.504-17.92 37.504-38.336 0-20.352-11.328-37.632-37.632-37.632l-141.76 0.384a42.24 42.24 0 0 0-41.6 28.864c-27.84 73.856-69.44 184.64-124.928 332.352H452.288v-74.048c0-25.6-27.264-40-46.08-24.32l-60.928 50.944-77.888 65.024a32.32 32.32 0 0 0 0 48.64l77.888 65.088 60.928 50.944c18.816 15.68 46.08 1.28 46.08-24.32z" horiz-adv-x="1024" />
<glyph glyph-name="yunhangzhong" unicode="&#59497;" d="M729.088 586.496a24 24 0 0 0 33.472-1.792c58.432-62.08 95.872-179.2 84.864-268.928a23.68 23.68 0 1 0-47.104 5.76c9.344 75.968-22.848 175.68-73.024 231.488a23.68 23.68 0 0 0 1.792 33.472zM810.368 318.08a142.336 142.336 0 1 0-54.272-279.488 142.336 142.336 0 0 0 54.272 279.424z m-12.16-62.912a78.336 78.336 0 1 1-29.952-153.728 78.336 78.336 0 0 1 29.888 153.728zM601.792 67.2a23.68 23.68 0 0 0-15.808-29.632c-84.736-25.856-169.6-18.24-246.272 29.632a23.68 23.68 0 1 0 25.088 40.192c64.896-40.512 135.616-46.336 207.36-24.448a23.68 23.68 0 0 0 29.632-15.744zM352.32 92.864a142.336 142.336 0 1 1-230.272 167.36 142.336 142.336 0 0 1 230.272-167.36z m-51.776 37.632a78.336 78.336 0 1 0-126.72 92.096 78.336 78.336 0 0 0 126.72-92.096zM194.88 415.232a23.68 23.68 0 0 0-16.704 29.056 307.648 307.648 0 0 0 162.624 197.248 23.68 23.68 0 0 0 20.8-42.624A260.224 260.224 0 0 1 224 432a23.68 23.68 0 0 0-29.12-16.768zM355.904 617.216A142.336 142.336 0 1 1 619.84 723.84 142.336 142.336 0 0 1 355.84 617.216z m59.328 23.936a78.336 78.336 0 1 0 145.28 58.688 78.336 78.336 0 0 0-145.28-58.688z" horiz-adv-x="1024" />
<glyph glyph-name="renwuyunwei" unicode="&#59496;" d="M782.464 753.92h-61.504v5.76c0 39.872-33.088 72.32-73.728 72.32H376.704c-40.64 0-73.728-32.448-73.728-72.32v-5.76h-61.504C178.88 753.92 128 704 128 642.56v-531.136C128 49.984 178.88 0 241.472 0h540.992c62.592 0 113.536 49.984 113.536 111.424V642.56c0 61.44-50.944 111.488-113.536 111.488z m-410.432 13.44h281.024c1.6 0 2.816-1.28 2.816-2.816v-96.128c0-1.536-1.28-2.816-2.816-2.816H372.032a2.88 2.88 0 0 0-1.984 0.832 2.752 2.752 0 0 0-0.832 1.984V764.544c0 1.536 1.28 2.752 2.816 2.752zM832 105.472c0-23.04-19.2-41.856-42.624-41.856H234.688a42.24 42.24 0 0 0-42.56 41.856v536.96a42.24 42.24 0 0 0 42.56 41.856h68.288v-9.408c0-39.936 33.088-72.32 73.728-72.32h270.528c40.64 0 73.728 32.384 73.728 72.32v9.408h68.416c23.488 0 42.624-18.752 42.624-41.856v-536.96zM481.92 207.488a35.84 35.84 0 0 0-24.96 10.112L332.8 337.92a35.84 35.84 0 1 0 49.92 51.456L481.472 293.76l169.856 170.88a35.84 35.84 0 1 0 50.816-50.496l-194.752-196.032a35.712 35.712 0 0 0-25.472-10.624z" horiz-adv-x="1024" />
@ -88,9 +90,9 @@
<glyph glyph-name="normal122" unicode="&#59462;" d="M446.976 801.28l118.336-131.392H825.6c74.24 0 134.4-58.816 134.4-131.328v-175.168h-64v62.592H128v-330.048c0-32 26.688-57.856 59.584-57.856L576 38.144v-68.864H198.4c-74.24 0-134.4 58.816-134.4 131.392V801.28h382.976z m334.976-497.408l4.992-3.968 136-132.992 0.512-0.512a30.912 30.912 0 0 0-0.32-44.032L787.2-10.496a32 32 0 0 0-44.8 0l-0.192 0.256a30.912 30.912 0 0 0-0.512 43.776l0.512 0.512 81.024 79.232H607.296a31.296 31.296 0 1 0 0 62.528h216.128l-81.472 79.68-0.256 0.192a31.04 31.04 0 0 0-3.392 39.744l3.648 4.288 0.256 0.256a32 32 0 0 0 39.744 3.968z m-373.12 434.88H128v-250.24h768V545.92c0 31.936-26.688 57.792-59.584 57.792H531.2l-122.368 135.04z" horiz-adv-x="1024" />
<glyph glyph-name="bupaixu" unicode="&#59461;" d="M750.4 63.04a32 32 0 0 0 32-32v-10.624a32 32 0 0 0-32-32H533.568a32 32 0 0 0-32 32v10.624a32 32 0 0 0 32 32h216.832z m-493.44 654.08a25.6 25.6 0 0 0 0.512-0.576l137.472-141.632a25.6 25.6 0 0 0-18.432-43.392H277.568v-318.4h98.944a25.6 25.6 0 0 0 14.016-4.224l3.84-3.072a25.6 25.6 0 0 0 0.576-36.16l-137.472-141.696a25.6 25.6 0 0 0-36.736 0L83.2 169.664a25.6 25.6 0 0 0 18.368 43.392h101.312V531.584H101.632a25.6 25.6 0 0 0-18.368 43.392L220.8 716.544a25.6 25.6 0 0 0 36.16 0.576z m655.36-430.144a32 32 0 0 0 32-32v-10.624a32 32 0 0 0-32-32H533.632a32 32 0 0 0-32 32v10.624a32 32 0 0 0 32 32h378.816z m-161.152 223.872a32 32 0 0 0 32-32v-10.624a32 32 0 0 0-32-32h-217.6a32 32 0 0 0-32 32v10.624a32 32 0 0 0 32 32h217.6z m166.208 223.936a32 32 0 0 0 32-32v-10.624a32 32 0 0 0-32-32H533.568a32 32 0 0 0-32 32V702.72a32 32 0 0 0 32 32h383.808z" horiz-adv-x="1024" />
<glyph glyph-name="bupaixu" unicode="&#59461;" d="M313.6 38.39999999999998c17.664 0 32-16.768 32-37.44 0-20.672-14.336-37.44-32-37.44h-192c-17.664 0-32 16.768-32 37.44 0 20.672 14.336 37.44 32 37.44h192z m480.896 665.92a25.6 25.6 0 0 0 0.576-0.576l137.472-141.632a25.6 25.6 0 0 0-18.432-43.392h-98.88v-318.4h98.88a25.6 25.6 0 0 0 14.016-4.224l3.84-3.072a25.6 25.6 0 0 0 0.576-36.16l-137.472-141.696-0.576-0.512a25.6 25.6 0 0 0-36.16 0.512L620.8 156.86400000000003a25.6 25.6 0 0 0 18.368 43.392l101.376 0.064V518.72H639.232a25.6 25.6 0 0 0-18.368 43.392l137.472 141.632a25.6 25.6 0 0 0 36.16 0.576zM505.6 294.4c17.664 0 32-16.768 32-37.44 0-20.672-14.336-37.44-32-37.44h-384c-17.664 0-32 16.768-32 37.44 0 20.672 14.336 37.44 32 37.44h384z m-157.568 256c17.664 0 32-16.768 32-37.44 0-20.672-14.336-37.44-32-37.44H121.6c-17.664 0-32 16.768-32 37.44 0 20.672 14.336 37.44 32 37.44h226.432z m158.976 256c19.136 0 34.688-16.768 34.688-37.44 0-20.672-15.552-37.44-34.688-37.44h-382.72c-19.2 0-34.688 16.768-34.688 37.44 0 20.672 15.552 37.44 34.688 37.44h382.72z" horiz-adv-x="1024" />
<glyph glyph-name="anleixingpaixu" unicode="&#59460;" d="M370.368 333.632v-54.592h-114.56v-278.656h-62.208V279.04h-106.88v54.592h283.648zM627.072 76.8a32 32 0 0 0 32-32v-10.88a32 32 0 0 0-32-32H510.272a32 32 0 0 0-32 32v10.88a32 32 0 0 0 32 32h116.8z m60.288 217.216a32 32 0 0 0 32-32v-10.88a32 32 0 0 0-32-32H510.272a32 32 0 0 0-32 32v10.88a32 32 0 0 0 32 32h177.088zM250.88 755.52l-15.872-57.92h102.656l14.912 57.92h52.928l-13.952-57.92h56.768v-43.584h-63.744l-26.88-109.888h76.672v-46.08H351.68l-15.936-68.288H282.88l15.936 68.224H192.192l-17.92-68.224h-54.784l17.92 68.224h-50.624v46.08h57.6l29.888 109.952H103.68V697.6h76.544l15.936 57.92h54.784z m556.992-244.416a32 32 0 0 0 32-32v-10.88a32 32 0 0 0-32-32h-297.6a32 32 0 0 0-32 32v10.88a32 32 0 0 0 32 32h297.6zM332.672 654.08H230.016l-30.848-109.888h105.6l27.904 109.888z m595.712 74.24a32 32 0 0 0 32-32v-10.88a32 32 0 0 0-32-32H510.272a32 32 0 0 0-32 32v10.88a32 32 0 0 0 32 32h418.112z" horiz-adv-x="1024" />
<glyph glyph-name="anleixingpaixu" unicode="&#59460;" d="M256 38.39999999999998c17.664 0 32-16.768 32-37.44 0-20.672-14.336-37.44-32-37.44H96c-17.664 0-32 16.768-32 37.44 0 20.672 14.336 37.44 32 37.44H256z m360.192 435.52a32 32 0 0 0 30.784-40.448l-13.248-48.256h157.184l16.64 64.64a32 32 0 0 0 31.04 24.064h15.68a31.872 31.872 0 0 0 30.976-39.36l-11.84-49.28h54.912a32 32 0 0 0 32-32v-2.752a32 32 0 0 0-32-32H862.72l-41.152-168.32h85.376a32 32 0 0 0 32-32v-6.528a32 32 0 0 0-32-32h-94.528l-18.624-79.808a32 32 0 0 0-31.168-24.704h-15.232a32 32 0 0 0-31.168 39.232l15.232 65.28H568.128l-21.12-80.64a32 32 0 0 0-30.976-23.872h-17.728a32 32 0 0 0-30.912 40.128l16.896 64.384h-45.504a32 32 0 0 0-32 32v6.528a32 32 0 0 0 32 32h56.192l45.696 168.32H464.704a32 32 0 0 0-32 32v2.688a32 32 0 0 0 32 32h85.12l17.92 65.216a32 32 0 0 0 30.912 23.488h17.536z m167.04-155.392H626.176l-47.296-168.32h161.792l42.688 168.32zM288 294.4c17.664 0 32-16.768 32-37.44 0-20.672-14.336-37.44-32-37.44h-192c-17.664 0-32 16.768-32 37.44 0 20.672 14.336 37.44 32 37.44h192z m160 256c17.664 0 32-16.768 32-37.44 0-20.672-14.336-37.44-32-37.44H96c-17.664 0-32 16.768-32 37.44 0 20.672 14.336 37.44 32 37.44H448z m352 256c17.664 0 32-16.768 32-37.44 0-20.672-14.336-37.44-32-37.44h-704c-17.664 0-32 16.768-32 37.44 0 20.672 14.336 37.44 32 37.44h704z" horiz-adv-x="1024" />
<glyph glyph-name="ziduanshezhi" unicode="&#59459;" d="M992 768a32 32 0 0 0 32-32v-704a32 32 0 0 0-32-32H32a32 32 0 0 0-32 32v704A32 32 0 0 0 32 768h960zM960 704H64v-640h896V704zM576 603.776h64v-137.024h153.472c51.84 0 92.8-42.56 92.8-93.888v-123.52c0-51.264-40.96-93.824-92.8-93.824H668.8c-51.84 0-92.8 42.56-92.8 93.888V603.776z m-199.872-4.928c28.672-9.6 51.2-32.064 60.672-60.8l127.488-382.336H496.96l-42.752 128.064H237.312l-42.56-127.872H127.296l127.36 382.208a96 96 0 0 0 121.472 60.736zM640 249.408c0-16.512 12.864-29.888 28.8-29.888h124.672c15.936 0 28.8 13.44 28.8 29.888V372.864a29.376 29.376 0 0 1-28.8 29.824H668.8a29.376 29.376 0 0 1-28.8-29.824v-123.52zM315.392 517.888l-56.704-170.112h174.144l-56.704 170.112a32 32 0 0 1-60.736 0z" horiz-adv-x="1024" />
@ -946,9 +948,9 @@
<glyph glyph-name="guanlianshitu" unicode="&#59184;" d="M384 253.69600000000003l256 305.088V768a64 64 0 0 0 64 64h192a64 64 0 0 0 64-64v-512a64 64 0 0 0-64-64h-192a64 64 0 0 0-64 64V459.2l-256-305.088V0a64 64 0 0 0-64-64H128a64 64 0 0 0-64 64V512a64 64 0 0 0 64 64h192a64 64 0 0 0 64-64v-258.304zM128 512v-512h192V512H128z m576 256v-512h192V768h-192z" horiz-adv-x="1024" />
<glyph glyph-name="shijian1" unicode="&#59185;" d="M96 819.2h704a32 32 0 1 0 0-64h-704a32 32 0 0 0 0 64z m0-256H448a32 32 0 0 0 0-64H96a32 32 0 0 0 0 64z m0-256h192a32 32 0 0 0 0-64h-192a32 32 0 0 0 0 64z m0-256H256a32 32 0 1 0 0-64H96a32 32 0 1 0 0 64z m576 477.76c158.784 0 288-129.28 288-288 0-158.848-129.216-288-288-288a288.32 288.32 0 0 0-288 288c0 158.72 129.216 288 288 288z m0-512c123.52 0 224 100.48 224 224s-100.48 224-224 224-224-100.48-224-224 100.48-224 224-224z m0 352v-132.928l76.16-65.28a32 32 0 0 0-41.728-48.64L619.136 197.12a32 32 0 0 0-11.136 24.32V368.89599999999996a32 32 0 1 0 64 0z" horiz-adv-x="1024" />
<glyph glyph-name="shijian1" unicode="&#59185;" d="M672 528.96c158.784 0 288-129.28 288-288 0-158.848-129.216-288-288-288a288.32 288.32 0 0 0-288 288c0 158.72 129.216 288 288 288zM256 38.39999999999998c17.664 0 32-16.768 32-37.44 0-20.672-14.336-37.44-32-37.44H96c-17.664 0-32 16.768-32 37.44 0 20.672 14.336 37.44 32 37.44H256z m416 426.56c-123.52 0-224-100.48-224-224s100.48-224 224-224 224 100.48 224 224-100.48 224-224 224z m-32-64a32 32 0 0 0 32-32v-132.928l76.16-65.28a32 32 0 0 0-41.728-48.64L619.136 197.12a32 32 0 0 0-11.136 24.32V368.89599999999996a32 32 0 0 0 32 32zM288 294.4c17.664 0 32-16.768 32-37.44 0-20.672-14.336-37.44-32-37.44h-192c-17.664 0-32 16.768-32 37.44 0 20.672 14.336 37.44 32 37.44h192z m160 256c17.664 0 32-16.768 32-37.44 0-20.672-14.336-37.44-32-37.44H96c-17.664 0-32 16.768-32 37.44 0 20.672 14.336 37.44 32 37.44H448z m352 256c17.664 0 32-16.768 32-37.44 0-20.672-14.336-37.44-32-37.44h-704c-17.664 0-32 16.768-32 37.44 0 20.672 14.336 37.44 32 37.44h704z" horiz-adv-x="1024" />
<glyph glyph-name="zimu" unicode="&#59186;" d="M207.616 795.328h64.768L416 458.368h-61.12L320 545.28H159.552l-34.944-86.848H64l143.616 336.96z m-30.784-207.616h125.824l-61.632 152.448h-2.048l-62.144-152.448zM94.656 330.88h290.432v-43.008l-229.12-263.936h242.304v-46.016h-320v42.56l229.76 264.448H94.592V330.88zM511.872 800h448a32 32 0 1 0 0-64h-448a32 32 0 0 0 0 64z m0-256h320a32 32 0 1 0 0-64h-320a32 32 0 0 0 0 64z m0-256h192a32 32 0 1 0 0-64h-192a32 32 0 1 0 0 64z m0-256h128a32 32 0 1 0 0-64h-128a32 32 0 1 0 0 64z" horiz-adv-x="1024" />
<glyph glyph-name="zimu" unicode="&#59186;" d="M256 38.39999999999998c17.664 0 32-16.768 32-37.44 0-20.672-14.336-37.44-32-37.44H96c-17.664 0-32 16.768-32 37.44 0 20.672 14.336 37.44 32 37.44H256z m458.24 462.528a32 32 0 0 0 29.44-19.456l197.568-463.424a31.552 31.552 0 0 0-28.992-43.968h-26.24a32 32 0 0 0-29.632 20.032l-38.592 95.68a32 32 0 0 1-29.632 20.032H580.672a32 32 0 0 1-29.696-20.032l-38.592-95.68a32 32 0 0 0-29.632-20.032H456.96a31.296 31.296 0 0 0-28.8 43.52l197.76 463.872a32 32 0 0 0 29.44 19.456h58.88z m-27.776-86.336h-3.328l-97.152-238.336h196.8l-96.32 238.336zM288 294.4c17.664 0 32-16.768 32-37.44 0-20.672-14.336-37.44-32-37.44h-192c-17.664 0-32 16.768-32 37.44 0 20.672 14.336 37.44 32 37.44h192z m160 256c17.664 0 32-16.768 32-37.44 0-20.672-14.336-37.44-32-37.44H96c-17.664 0-32 16.768-32 37.44 0 20.672 14.336 37.44 32 37.44H448z m352 256c17.664 0 32-16.768 32-37.44 0-20.672-14.336-37.44-32-37.44h-704c-17.664 0-32 16.768-32 37.44 0 20.672 14.336 37.44 32 37.44h704z" horiz-adv-x="1024" />
<glyph glyph-name="normal92" unicode="&#59187;" d="M704 768h192a64 64 0 0 0 64-64v-704a64 64 0 0 0-64-64H128a64 64 0 0 0-64 64V704a64 64 0 0 0 64 64h192v32a32 32 0 0 0 64 0V768h256v32a32 32 0 1 0 64 0V768z m0-64v-32a32 32 0 1 0-64 0V704H384v-32a32 32 0 0 0-64 0V704H128v-704h768V704h-192zM256 384h128v-128H256V384z m0-192h128v-128H256v128z m192 192h128v-128H448V384z m0 192h128v-128H448V576z m0-384h128v-128H448v128z m192 192h128v-128h-128V384z m0 192h128v-128h-128V576z" horiz-adv-x="1024" />

Before

Width:  |  Height:  |  Size: 414 KiB

After

Width:  |  Height:  |  Size: 416 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.

2
dist/lib/base/tree/customtree.d.ts vendored

@ -4,7 +4,7 @@ export declare class CustomTree extends Widget {
static EVENT_CHANGE: string;
initTree(nodes: any, ...args: any[]): void;
stroke(...args: any[]): void;
populate(nodes: any, ...args: any[]): void;
populate(nodes?: any, ...args: any[]): void;
getAllButtons<T>(): T[];
getAllLeaves<T>(): T[];
getNodeById(id: any): any;

2
dist/resource.css vendored

File diff suppressed because one or more lines are too long

72
dist/router.js vendored

@ -1242,39 +1242,39 @@
// }
// };
// function guardEvent (e) {
// // don't redirect with control keys
// if (e.metaKey || e.altKey || e.ctrlKey || e.shiftKey) { return }
// // don't redirect when preventDefault called
// if (e.defaultPrevented) { return }
// // don't redirect on right click
// if (e.button !== undefined && e.button !== 0) { return }
// // don't redirect if `target="_blank"`
// if (e.currentTarget && e.currentTarget.getAttribute) {
// var target = e.currentTarget.getAttribute('target');
// if (/\b_blank\b/i.test(target)) { return }
// }
// // this may be a Weex event which doesn't have this method
// if (e.preventDefault) {
// e.preventDefault();
// }
// return true
// }
function guardEvent (e) {
// don't redirect with control keys
if (e.metaKey || e.altKey || e.ctrlKey || e.shiftKey) { return }
// don't redirect when preventDefault called
if (e.defaultPrevented) { return }
// don't redirect on right click
if (e.button !== undefined && e.button !== 0) { return }
// don't redirect if `target="_blank"`
if (e.currentTarget && e.currentTarget.getAttribute) {
var target = e.currentTarget.getAttribute('target');
if (/\b_blank\b/i.test(target)) { return }
}
// this may be a Weex event which doesn't have this method
if (e.preventDefault) {
e.preventDefault();
}
return true
}
// function findAnchor (children) {
// if (children) {
// var child;
// for (var i = 0; i < children.length; i++) {
// child = children[i];
// if (child.tag === 'a') {
// return child
// }
// if (child.children && (child = findAnchor(child.children))) {
// return child
// }
// }
// }
// }
function findAnchor (children) {
if (children) {
var child;
for (var i = 0; i < children.length; i++) {
child = children[i];
if (child.tag === 'a') {
return child
}
if (child.children && (child = findAnchor(child.children))) {
return child
}
}
}
}
// var _Vue;
@ -3125,13 +3125,13 @@
var $router, cbs = [];
var RouterWidget = BI.inherit(BI.Widget, {
init: function () {
this._router = $router = new VueRouter({
this.$router = BI.Router.$router = $router = new VueRouter({
routes: this.options.routes
});
this._router.afterEach(function () {
this.$router.afterEach(function () {
cbs.forEach(function (cb) {cb();});
});
this._router.init(this);
this.$router.init(this);
}
});
BI.shortcut("bi.router", RouterWidget);
@ -3169,6 +3169,8 @@
});
BI.shortcut("bi.router_view", RouterView);
BI.Router = VueRouter;
BI.Router.isSameRoute = isSameRoute;
return VueRouter;
})));

2
dist/utils.js vendored

@ -1,4 +1,4 @@
/*! time: 2021-8-12 21:32:20 */
/*! time: 2021-8-21 9:00:30 */
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};

2
dist/utils.min.js vendored

File diff suppressed because one or more lines are too long

119
examples/dev.html

@ -9,85 +9,6 @@
<body>
<div id="wrapper"></div>
<script>
BI.config("demo.parent", function (config){
console.log("123");
return config;
}, {
version: "1.0"
});
BI.module("my.module", {
// version不设置的话默认就用接口的version作为判断条件
version: "1.0",
components: {
"demo.parent": "1.0"
}
})
// 主线代码里加这个
BI.config("bi.provider.system", function (provider) {
provider.addDependencies({
"my.module": {
minVersion: "2.0",
maxVersion: "4.0"
}
})
})
</script>
<script>
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.vertical",
items: [{
type: "bi.button",
text: store.model.text,
handler: function () {
console.log("click");
}
}, {
type: "bi.label",
text: store.model.text
}]
};
}
};
}
});
BI.shortcut("demo.child", Child);
var Widget = BI.inherit(BI.Widget, {
props: {
@ -99,27 +20,35 @@
}
},
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();
// });
var layout;
return function () {
return {
type: "bi.vertical",
vgap: store.model.expand ? 20 : 30,
type: "bi.left",
items: [{
type: "demo.child",
ref: function (_ref) {
child = _ref;
type: "bi.button",
text: "点击",
handler: function () {
layout.populate([{
type: "bi.label",
key: "1",
text: 1
}, {
type: "bi.label",
key: "2",
text: 2
}])
}
}, {
type: "demo.child"
type: "bi.left",
lgap: 10,
items: [{
type: "bi.label",
key: "123",
text: "start"
}],
ref: function (_ref) {
layout = _ref;
}
}]
};
};

142
examples/插件设计.html

@ -0,0 +1,142 @@
<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>-->
<script src="http://localhost:9001/fineui.js"></script>
</head>
<body>
<div id="wrapper"></div>
<script>
BI.config("demo.parent", function (config){
console.log("123");
return config;
}, {
version: "1.0"
});
BI.module("my.module", {
// version不设置的话默认就用接口的version作为判断条件
version: "1.0",
components: {
"demo.parent": "1.0"
}
})
// 主线代码里加这个
BI.config("bi.provider.system", function (provider) {
provider.addDependencies({
"my.module": {
minVersion: "2.0",
maxVersion: "4.0"
}
})
})
</script>
<script>
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.vertical",
items: [{
type: "bi.button",
text: store.model.text,
handler: function () {
console.log("click");
}
}, {
type: "bi.label",
text: store.model.text
}]
};
}
};
}
});
BI.shortcut("demo.child", Child);
var Widget = BI.inherit(BI.Widget, {
props: {
vdom: true
},
watch: {
text: function () {
this.reset();
}
},
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: store.model.expand ? 20 : 30,
items: [{
type: "demo.child",
ref: function (_ref) {
child = _ref;
}
}, {
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>

2
package.json

@ -1,6 +1,6 @@
{
"name": "fineui",
"version": "2.0.20210812213502",
"version": "2.0.20210821090116",
"description": "fineui",
"main": "dist/fineui.min.js",
"types": "dist/lib/index.d.ts",

121
src/case/colorchooser/colorpicker/editor.colorpicker.hex.js

@ -120,67 +120,72 @@ BI.HexColorPickerEditor = BI.inherit(BI.Widget, {
lgap: 10,
}]
}, {
type: "bi.vertical_adapt",
rgap: 5,
items: [{
el: {
type: "bi.layout",
cls: "color-picker-editor-display bi-card bi-border",
height: 16,
width: 16,
ref: function (_ref) {
self.colorShow = _ref;
}
},
width: 16
}, {
type: "bi.label",
text: "#",
width: 10
}, {
type: "bi.small_text_editor",
ref: function (_ref) {
self.hexEditor = _ref;
},
cls: "color-picker-editor-input",
validationChecker: this._hexChecker,
allowBlank: true,
errorText: BI.i18nText("BI-Color_Picker_Error_Text_Hex"),
width: c.HEX_WIDTH,
height: 20,
listeners: [{
eventName: "EVENT_CHANGE",
action: function () {
self._checkHexEditor();
if (checker(self.storeValue.r) && checker(self.storeValue.g) && checker(self.storeValue.b)) {
self.colorShow.element.css("background-color", self.getValue());
self.fireEvent(BI.ColorPickerEditor.EVENT_CHANGE);
el: {
type: "bi.vertical_adapt",
columnSize: [16, 10, 'fill', 12, c.RGB_WIDTH, 12, c.RGB_WIDTH, 12, c.RGB_WIDTH],
rgap: 5,
items: [{
el: {
type: "bi.layout",
cls: "color-picker-editor-display bi-card bi-border",
height: 16,
width: 16,
ref: function (_ref) {
self.colorShow = _ref;
}
},
width: 16
}, {
type: "bi.label",
text: "#",
width: 10
}, {
type: "bi.small_text_editor",
ref: function (_ref) {
self.hexEditor = _ref;
},
cls: "color-picker-editor-input",
validationChecker: this._hexChecker,
allowBlank: true,
errorText: BI.i18nText("BI-Color_Picker_Error_Text_Hex"),
width: c.HEX_WIDTH,
height: 20,
listeners: [{
eventName: "EVENT_CHANGE",
action: function () {
self._checkHexEditor();
if (checker(self.storeValue.r) && checker(self.storeValue.g) && checker(self.storeValue.b)) {
self.colorShow.element.css("background-color", self.getValue());
self.fireEvent(BI.ColorPickerEditor.EVENT_CHANGE);
}
}
}
}]
}, RGB[0], {
el: BI.extend(Ws[0], {
ref: function (_ref) {
self.R = _ref
}
}),
width: c.RGB_WIDTH
}, RGB[1], {
el: BI.extend(Ws[1], {
ref: function (_ref) {
self.G = _ref
}
}),
width: c.RGB_WIDTH
}, RGB[2], {
el: BI.extend(Ws[2], {
ref: function (_ref) {
self.B = _ref
}
}),
rgap: -5,
width: c.RGB_WIDTH
}]
}, RGB[0], {
el: BI.extend(Ws[0], {
ref: function (_ref) {
self.R = _ref
}
}),
width: c.RGB_WIDTH
}, RGB[1], {
el: BI.extend(Ws[1], {
ref: function (_ref) {
self.G = _ref
}
}),
width: c.RGB_WIDTH
}, RGB[2], {
el: BI.extend(Ws[2], {
ref: function (_ref) {
self.B = _ref
}
}),
width: c.RGB_WIDTH
}]
}
}]
},
left: 0,

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

@ -186,9 +186,9 @@
return "";
}
if (this.isDarkColor(color)) {
return "#ffffff";
return "#FFFFFF";
}
return "#1a1a1a";
return "#3D4D66";
},
rgb2hex: function (rgbColour) {

130
src/core/wrapper/layout.js

@ -198,6 +198,21 @@ BI.Layout = BI.inherit(BI.Widget, {
return this.element;
},
// 不依赖于this.options.items进行更新
_updateItemAt: function (oldIndex, newIndex, item) {
var del = this._children[this._getChildName(oldIndex)];
delete this._children[this._getChildName(oldIndex)];
var w = this._addElement(newIndex, item);
this._children[this._getChildName(newIndex)] = w;
if (oldIndex > 0) {
this._children[this._getChildName(oldIndex - 1)].element.after(w.element);
} else {
w.element.prependTo(this._getWrapper());
}
del._destroy();
w._mount();
},
_addItemAt: function (index, item) {
for (var i = this.options.items.length; i > index; i--) {
this._children[this._getChildName(i)] = this._children[this._getChildName(i - 1)];
@ -286,35 +301,13 @@ BI.Layout = BI.inherit(BI.Widget, {
},
shouldUpdateItem: function (index, item) {
if (index < 0 || index > this.options.items.length - 1) {
return false;
}
var child = this._children[this._getChildName(index)];
if (!child.shouldUpdate) {
if (!child || !child.shouldUpdate) {
return null;
}
return child.shouldUpdate(this._getOptions(item));
},
updateItemAt: function (index, item) {
if (index < 0 || index > this.options.items.length - 1) {
return;
}
var del = this._children[this._getChildName(index)];
delete this._children[this._getChildName(index)];
this.options.items.splice(index, 1);
var w = this._addElement(index, item);
this.options.items.splice(index, 0, item);
this._children[this._getChildName(index)] = w;
if (index > 0) {
this._children[this._getChildName(index - 1)].element.after(w.element);
} else {
w.element.prependTo(this._getWrapper());
}
del._destroy();
w._mount();
},
addItems: function (items, context) {
var self = this, o = this.options;
var fragment = BI.Widget._renderEngine.createFragment();
@ -384,9 +377,9 @@ BI.Layout = BI.inherit(BI.Widget, {
});
},
patchItem: function (oldVnode, vnode, index) {
var shouldUpdate = this.shouldUpdateItem(index, vnode);
var child = this._children[this._getChildName(index)];
patchItem: function (oldVnode, vnode, oldIndex, newIndex) {
var shouldUpdate = this.shouldUpdateItem(oldIndex, vnode);
var child = this._children[this._getChildName(oldIndex)];
if (shouldUpdate) {
return child._update(this._getOptions(vnode), shouldUpdate);
}
@ -394,7 +387,7 @@ BI.Layout = BI.inherit(BI.Widget, {
// if (child.update) {
// return child.update(this._getOptions(vnode));
// }
return this.updateItemAt(index, vnode);
return this._updateItemAt(oldIndex, newIndex, vnode);
}
},
@ -424,44 +417,44 @@ BI.Layout = BI.inherit(BI.Widget, {
} else if (BI.isNull(oldEndVnode)) {
oldEndVnode = oldCh[--oldEndIdx];
} else if (sameVnode(oldStartVnode, newStartVnode, oldStartIdx, newStartIdx)) {
updated = this.patchItem(oldStartVnode, newStartVnode, oldStartIdx) || updated;
updated = this.patchItem(oldStartVnode, newStartVnode, oldStartIdx, newStartIdx) || updated;
children[oldStartVnode.key == null ? oldStartIdx : oldStartVnode.key] = this._children[this._getChildName(oldStartIdx)];
oldStartVnode = oldCh[++oldStartIdx];
newStartVnode = newCh[++newStartIdx];
} else if (sameVnode(oldEndVnode, newEndVnode, oldEndIdx, newEndIdx)) {
updated = this.patchItem(oldEndVnode, newEndVnode, oldEndIdx) || updated;
updated = this.patchItem(oldEndVnode, newEndVnode, oldEndIdx, newEndIdx) || updated;
children[oldEndVnode.key == null ? oldEndIdx : oldEndVnode.key] = this._children[this._getChildName(oldEndIdx)];
oldEndVnode = oldCh[--oldEndIdx];
newEndVnode = newCh[--newEndIdx];
} else if (sameVnode(oldStartVnode, newEndVnode)) {
updated = this.patchItem(oldStartVnode, newEndVnode, oldStartIdx) || updated;
updated = this.patchItem(oldStartVnode, newEndVnode, oldStartIdx, newStartIdx) || updated;
children[oldStartVnode.key == null ? oldStartIdx : oldStartVnode.key] = this._children[this._getChildName(oldStartIdx)];
insertBefore(oldStartVnode, oldEndVnode, true);
oldStartVnode = oldCh[++oldStartIdx];
newEndVnode = newCh[--newEndIdx];
} else if (sameVnode(oldEndVnode, newStartVnode)) {
updated = this.patchItem(oldEndVnode, newStartVnode, oldEndIdx) || updated;
updated = this.patchItem(oldEndVnode, newStartVnode, oldEndIdx, newEndIdx) || updated;
children[oldEndVnode.key == null ? oldEndIdx : oldEndVnode.key] = this._children[this._getChildName(oldEndIdx)];
insertBefore(oldEndVnode, oldStartVnode);
oldEndVnode = oldCh[--oldEndIdx];
newStartVnode = newCh[++newStartIdx];
} else {
var sameOldVnode = findOldVnode(oldCh, newStartVnode, oldStartIdx, oldEndIdx);
if (BI.isNull(sameOldVnode)) { // 不存在就把新的放到左边
var node = addNode(newStartVnode);
if (BI.isNull(sameOldVnode[0])) { // 不存在就把新的放到左边
delete self._children[self._getChildName(newStartIdx)];
var node = addNode(newStartVnode, newStartIdx);
insertBefore(node, oldStartVnode);
newStartVnode = newCh[++newStartIdx];
} else { // 如果新节点在就旧节点区间中存在就复用一下
BI.each(oldCh, function (index, child) {
if (child && sameVnode(child, newStartVnode)) {
updated = self.patchItem(sameOldVnode, newStartVnode, index) || updated;
children[sameOldVnode.key == null ? index : sameOldVnode.key] = self._children[self._getChildName(index)];
oldCh[index] = undefined;
insertBefore(sameOldVnode, oldStartVnode);
}
});
newStartVnode = newCh[++newStartIdx];
} else { // 如果新节点在旧节点区间中存在就复用一下
var sameOldIndex = sameOldVnode[1];
updated = self.patchItem(sameOldVnode[0], newStartVnode, sameOldIndex, newStartIdx) || updated;
children[sameOldVnode[0].key == null ? newStartIdx : sameOldVnode[0].key] = self._children[self._getChildName(newStartIdx)] = self._children[self._getChildName(sameOldIndex)];
if (newStartIdx !== sameOldIndex) {
delete self._children[self._getChildName(sameOldIndex)];
}
oldCh[sameOldIndex] = undefined;
insertBefore(sameOldVnode[0], oldStartVnode);
}
newStartVnode = newCh[++newStartIdx];
}
}
if (oldStartIdx > oldEndIdx) {
@ -493,7 +486,7 @@ BI.Layout = BI.inherit(BI.Widget, {
function addNode (vnode, index) {
var opt = self._getOptions(vnode);
var key = opt.key == null ? index : opt.key;
return children[key] = self._addElement(key, vnode);
return children[key] = self._addElement(index, vnode);
}
function addVnodes (before, vnodes, startIdx, endIdx) {
@ -509,7 +502,7 @@ BI.Layout = BI.inherit(BI.Widget, {
if (BI.isNotNull(ch)) {
var node = self._getOptions(ch);
var key = node.key == null ? startIdx : node.key;
delete self._children[self._getChildName(key)];
delete self._children[self._getChildName(startIdx)];
children[key]._destroy();
}
}
@ -538,46 +531,36 @@ BI.Layout = BI.inherit(BI.Widget, {
}
function findOldVnode (vnodes, vNode, beginIdx, endIdx) {
var i, found;
var i, found, findIndex;
for (i = beginIdx; i <= endIdx; ++i) {
if (vnodes[i] && sameVnode(vnodes[i], vNode)) {
found = vnodes[i];
findIndex = i;
}
}
return found;
return [found, findIndex];
}
return updated;
},
forceUpdate: function (opt) {
if (this._isMounted) {
BI.each(this._children, function (i, c) {
c.destroy();
});
this._children = {};
}
this.options.items = opt.items;
this.stroke(opt.items);
},
update: function (opt) {
var o = this.options;
var items = opt.items || [];
var updated = this.updateChildren(o.items, items);
var oldItems = o.items;
this.options.items = items;
return updated;
// var updated, i, len;
// for (i = 0, len = Math.min(o.items.length, items.length); i < len; i++) {
// if (!this._compare(o.items[i], items[i])) {
// updated = this.updateItemAt(i, items[i]) || updated;
// }
// }
// if (o.items.length > items.length) {
// var deleted = [];
// for (i = items.length; i < o.items.length; i++) {
// deleted.push(this._children[this._getChildName(i)]);
// delete this._children[this._getChildName(i)];
// }
// o.items.splice(items.length);
// BI.each(deleted, function (i, w) {
// w._destroy();
// })
// } else if (items.length > o.items.length) {
// for (i = o.items.length; i < items.length; i++) {
// this.addItemAt(i, items[i]);
// }
// }
// return updated;
return this.updateChildren(oldItems, items);
},
stroke: function (items) {
@ -616,7 +599,6 @@ BI.Layout = BI.inherit(BI.Widget, {
},
populate: function (items) {
var self = this, o = this.options;
items = items || [];
if (this._isMounted) {
this.update({items: items});
@ -627,7 +609,7 @@ BI.Layout = BI.inherit(BI.Widget, {
},
resize: function () {
this.stroke(this.options.items);
}
});
BI.shortcut("bi.layout", BI.Layout);

4
src/core/wrapper/layout/adapt/absolute.center.js

@ -35,10 +35,6 @@ BI.AbsoluteCenterLayout = BI.inherit(BI.Layout, {
return w;
},
resize: function () {
// console.log("absolute_center_adapt布局不需要resize");
},
populate: function (items) {
BI.AbsoluteCenterLayout.superclass.populate.apply(this, arguments);
this._mount();

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

@ -42,7 +42,7 @@ BI.AbsoluteHorizontalLayout = BI.inherit(BI.Layout, {
},
resize: function () {
// console.log("absolute_horizontal_adapt布局不需要resize");
this.layout.resize();
},
populate: function (items) {

6
src/core/wrapper/layout/adapt/absolute.leftrightvertical.js

@ -80,7 +80,7 @@ BI.AbsoluteLeftRightVerticalAdaptLayout = BI.inherit(BI.Layout, {
},
resize: function () {
// console.log("absolute_left_right_vertical_adapt布局不需要resize");
this.layout.stroke(this._formatItems())
},
addItem: function () {
@ -132,7 +132,7 @@ BI.AbsoluteRightVerticalAdaptLayout = BI.inherit(BI.Layout, {
},
resize: function () {
this.layout.stroke([{}].concat(this.options.items))
},
addItem: function () {
@ -141,7 +141,7 @@ BI.AbsoluteRightVerticalAdaptLayout = BI.inherit(BI.Layout, {
},
populate: function (items) {
this.layout.populate(items);
this.layout.populate([{}].concat(items));
}
});
BI.shortcut("bi.absolute_right_vertical_adapt", BI.AbsoluteRightVerticalAdaptLayout);

2
src/core/wrapper/layout/adapt/absolute.vertical.js

@ -42,7 +42,7 @@ BI.AbsoluteVerticalLayout = BI.inherit(BI.Layout, {
},
resize: function () {
// console.log("absolute_vertical_adapt布局不需要resize");
this.layout.resize();
},
populate: function (items) {

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

@ -43,7 +43,7 @@ BI.CenterAdaptLayout = BI.inherit(BI.Layout, {
},
resize: function () {
// console.log("center_adapt布局不需要resize");
this.layout.resize();
},
populate: function (items) {

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

@ -76,7 +76,8 @@ BI.LeftRightVerticalAdaptLayout = BI.inherit(BI.Layout, {
},
resize: function () {
// console.log("left_right_vertical_adapt布局不需要resize");
this.left.stroke(this.options.items.left);
this.right.stroke(this.options.items.right);
},
addItem: function () {
@ -129,7 +130,7 @@ BI.LeftVerticalAdaptLayout = BI.inherit(BI.Layout, {
},
resize: function () {
// console.log("left_vertical_adapt布局不需要resize");
this.layout.resize();
},
addItem: function () {
@ -181,7 +182,7 @@ BI.RightVerticalAdaptLayout = BI.inherit(BI.Layout, {
},
resize: function () {
this.layout.resize();
},
addItem: function () {

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

@ -24,13 +24,25 @@ BI.TableAdaptLayout = BI.inherit(BI.Layout, {
this.$table = BI.Widget._renderEngine.createElement("<div>").css({
position: "relative",
display: "table",
width: (o.horizontalAlign === BI.HorizontalAlign.Center || o.horizontalAlign === BI.HorizontalAlign.Stretch) ? "100%" : "auto",
width: (o.horizontalAlign === BI.HorizontalAlign.Center || o.horizontalAlign === BI.HorizontalAlign.Stretch || this._hasFill()) ? "100%" : "auto",
height: (o.verticalAlign !== BI.VerticalAlign.Top) ? "100%" : "auto",
"white-space": "nowrap"
});
this.populate(this.options.items);
},
_hasFill: function () {
var o = this.options;
if (o.columnSize.length > 0) {
return o.columnSize.indexOf("fill") >= 0;
}
return BI.some(o.items, function (i, item) {
if (item.width === "fill") {
return true;
}
});
},
_addElement: function (i, item) {
var o = this.options;
var td, width = "";
@ -40,17 +52,7 @@ BI.TableAdaptLayout = BI.inherit(BI.Layout, {
((columnSize * 100).toFixed(1) + "%")
: (columnSize + (i === 0 ? o.hgap : 0) + o.hgap + o.lgap + o.rgap);
}
function hasFill() {
if (o.columnSize.length > 0) {
return o.columnSize.indexOf("fill") >= 0;
}
return BI.some(o.items, function (i, item) {
if (item.width === "fill") {
return true;
}
});
}
if ((BI.isNull(columnSize) || columnSize === "") && hasFill()) {
if ((BI.isNull(columnSize) || columnSize === "") && this._hasFill()) {
width = 2;
}
if (!this.hasWidget(this._getChildName(i))) {
@ -100,10 +102,6 @@ BI.TableAdaptLayout = BI.inherit(BI.Layout, {
this.element.append(this.$table);
},
resize: function () {
// console.log("center_adapt布局不需要resize");
},
populate: function (items) {
BI.TableAdaptLayout.superclass.populate.apply(this, arguments);
this._mount();

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

@ -43,7 +43,7 @@ BI.VerticalAdaptLayout = BI.inherit(BI.Layout, {
},
resize: function () {
// console.log("vertical_adapt布局不需要resize");
this.layout.resize();
},
populate: function (items) {

4
src/core/wrapper/layout/adapt/auto.horizontal.js

@ -32,10 +32,6 @@ BI.HorizontalAutoLayout = BI.inherit(BI.Layout, {
return w;
},
resize: function () {
// console.log("horizontal_adapt布局不需要resize");
},
populate: function (items) {
BI.HorizontalAutoLayout.superclass.populate.apply(this, arguments);
this._mount();

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

@ -44,6 +44,10 @@ BI.InlineCenterAdaptLayout = BI.inherit(BI.Layout, {
};
},
resize: function () {
this.layout.resize();
},
populate: function (items) {
this.layout.populate.apply(this.layout, arguments);
}

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

@ -44,6 +44,10 @@ BI.InlineHorizontalAdaptLayout = BI.inherit(BI.Layout, {
};
},
resize: function () {
this.layout.resize();
},
populate: function (items) {
this.layout.populate.apply(this.layout, arguments);
}

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

@ -44,6 +44,10 @@ BI.InlineVerticalAdaptLayout = BI.inherit(BI.Layout, {
};
},
resize: function () {
this.layout.resize();
},
populate: function (items) {
this.layout.populate.apply(this.layout, arguments);
}

17
src/core/wrapper/layout/fill/float.fill.horizontal.js

@ -19,9 +19,6 @@ BI.FloatHorizontalFillLayout = BI.inherit(BI.Layout, {
this.populate(this.options.items);
},
resize: function () {
// console.log("填充布局不需要resize");
},
addItem: function (item) {
// do nothing
throw new Error("不能添加子组件");
@ -79,8 +76,12 @@ BI.FloatHorizontalFillLayout = BI.inherit(BI.Layout, {
}
var top = o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0),
bottom = o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0);
if (o.verticalAlign === BI.VerticalAlign.Stretch && BI.isNull(item.height)) {
w.element.css({
height: "calc(100% - " + ((top + bottom) / BI.pixRatio + BI.pixUnit) + ")"
});
}
w.element.css({
height: "calc(100% - " + ((top + bottom) / BI.pixRatio + BI.pixUnit) + ")",
position: "relative"
});
return w;
@ -123,6 +124,14 @@ BI.FloatHorizontalFillLayout = BI.inherit(BI.Layout, {
});
},
resize: function () {
// console.log("填充布局不需要resize");
},
update: function (opt) {
return this.forceUpdate(opt);
},
populate: function (items) {
BI.FloatHorizontalFillLayout.superclass.populate.apply(this, arguments);
this._mount();

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

@ -24,7 +24,7 @@ BI.FlexCenterLayout = BI.inherit(BI.Layout, {
return {
type: "bi.flex_horizontal",
ref: function (_ref) {
self.wrapper = _ref;
self.layout = _ref;
},
horizontalAlign: o.horizontalAlign,
verticalAlign: o.verticalAlign,
@ -42,15 +42,11 @@ BI.FlexCenterLayout = BI.inherit(BI.Layout, {
},
resize: function () {
// console.log("flex_center_adapt布局不需要resize");
},
update: function (opt) {
return this.wrapper.update(opt);
this.layout.resize();
},
populate: function (items) {
this.wrapper.populate(items);
this.layout.populate(items);
}
});
BI.shortcut("bi.flex_center_adapt", BI.FlexCenterLayout);

10
src/core/wrapper/layout/flex/flex.horizontal.center.js

@ -25,7 +25,7 @@ BI.FlexHorizontalCenter = BI.inherit(BI.Layout, {
return {
type: "bi.flex_vertical",
ref: function (_ref) {
self.wrapper = _ref;
self.layout = _ref;
},
horizontalAlign: o.horizontalAlign,
verticalAlign: o.verticalAlign,
@ -43,15 +43,11 @@ BI.FlexHorizontalCenter = BI.inherit(BI.Layout, {
},
resize: function () {
// console.log("flex_vertical_center_adapt布局不需要resize");
},
update: function (opt) {
return this.wrapper.update(opt);
this.layout.resize();
},
populate: function (items) {
this.wrapper.populate(items);
this.layout.populate(items);
}
});
BI.shortcut("bi.flex_horizontal_adapt", BI.FlexHorizontalCenter);

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

@ -78,10 +78,6 @@ BI.FlexHorizontalLayout = BI.inherit(BI.Layout, {
return w;
},
resize: function () {
// console.log("flex_horizontal布局不需要resize");
},
populate: function (items) {
BI.FlexHorizontalLayout.superclass.populate.apply(this, arguments);
this._mount();

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

@ -25,17 +25,17 @@ BI.FlexLeftRightVerticalAdaptLayout = BI.inherit(BI.Layout, {
ref: function (_ref) {
self.layout = _ref;
},
items: this._formatItems(),
items: this._formatItems(o.items),
scrollx: o.scrollx,
scrolly: o.scrolly,
scrollable: o.scrollable
};
},
_formatItems: function () {
_formatItems: function (items) {
var o = this.options;
var leftItems = o.items.left || [];
var rightItems = o.items.right || [];
var leftItems = items.left || [];
var rightItems = items.right || [];
leftItems = BI.map(leftItems, function (i, item) {
var json = {
el: BI.stripEL(item)
@ -72,7 +72,7 @@ BI.FlexLeftRightVerticalAdaptLayout = BI.inherit(BI.Layout, {
},
resize: function () {
// console.log("left_right_vertical_adapt布局不需要resize");
this.layout.stroke(this._formatItems(this.options.items));
},
addItem: function () {
@ -81,8 +81,7 @@ BI.FlexLeftRightVerticalAdaptLayout = BI.inherit(BI.Layout, {
},
populate: function (items) {
this.options.items = items;
this.layout.populate(this._formatItems());
this.layout.populate(this._formatItems(items));
}
});
BI.shortcut("bi.flex_left_right_vertical_adapt", BI.FlexLeftRightVerticalAdaptLayout);

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

@ -26,7 +26,7 @@ BI.FlexVerticalCenter = BI.inherit(BI.Layout, {
return {
type: "bi.flex_horizontal",
ref: function (_ref) {
self.wrapper = _ref;
self.layout = _ref;
},
verticalAlign: o.verticalAlign,
horizontalAlign: o.horizontalAlign,
@ -44,15 +44,11 @@ BI.FlexVerticalCenter = BI.inherit(BI.Layout, {
},
resize: function () {
// console.log("flex_vertical_center_adapt布局不需要resize");
},
update: function (opt) {
return this.wrapper.update(opt);
this.layout.resize();
},
populate: function (items) {
this.wrapper.populate(items);
this.layout.populate(items);
}
});
BI.shortcut("bi.flex_vertical_adapt", BI.FlexVerticalCenter);

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

@ -77,10 +77,6 @@ BI.FlexVerticalLayout = BI.inherit(BI.Layout, {
return w;
},
resize: function () {
// console.log("flex_vertical布局不需要resize");
},
populate: function (items) {
BI.FlexVerticalLayout.superclass.populate.apply(this, arguments);
this._mount();

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

@ -27,7 +27,7 @@ BI.FlexWrapperCenterLayout = BI.inherit(BI.Layout, {
return {
type: "bi.flex_scrollable_horizontal",
ref: function (_ref) {
self.wrapper = _ref;
self.layout = _ref;
},
horizontalAlign: o.horizontalAlign,
verticalAlign: o.verticalAlign,
@ -44,12 +44,12 @@ BI.FlexWrapperCenterLayout = BI.inherit(BI.Layout, {
};
},
update: function (opt) {
return this.wrapper.update(opt);
resize: function () {
this.layout.resize();
},
populate: function (items) {
this.wrapper.populate(items);
this.layout.populate(items);
}
});
BI.shortcut("bi.flex_scrollable_center_adapt", BI.FlexWrapperCenterLayout);

8
src/core/wrapper/layout/flex/wrapper/flex.wrapper.horizontal.center.js

@ -27,7 +27,7 @@ BI.FlexWrapperHorizontalCenter = BI.inherit(BI.Layout, {
return {
type: "bi.flex_scrollable_vertical",
ref: function (_ref) {
self.wrapper = _ref;
self.layout = _ref;
},
horizontalAlign: o.horizontalAlign,
verticalAlign: o.verticalAlign,
@ -44,12 +44,12 @@ BI.FlexWrapperHorizontalCenter = BI.inherit(BI.Layout, {
};
},
update: function (opt) {
return this.wrapper.update(opt);
resize: function () {
this.layout.resize();
},
populate: function (items) {
this.wrapper.populate(items);
this.layout.populate(items);
}
});
BI.shortcut("bi.flex_scrollable_horizontal_adapt", BI.FlexWrapperHorizontalCenter);

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

@ -84,10 +84,6 @@ BI.FlexWrapperHorizontalLayout = BI.inherit(BI.Layout, {
return this.$wrapper;
},
resize: function () {
// console.log("flex_wrapper_horizontal布局不需要resize");
},
populate: function (items) {
BI.FlexWrapperHorizontalLayout.superclass.populate.apply(this, arguments);
this._mount();

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

@ -27,7 +27,7 @@ BI.FlexWrapperVerticalCenter = BI.inherit(BI.Layout, {
return {
type: "bi.flex_scrollable_horizontal",
ref: function (_ref) {
self.wrapper = _ref;
self.layout = _ref;
},
verticalAlign: o.verticalAlign,
horizontalAlign: o.horizontalAlign,
@ -44,12 +44,12 @@ BI.FlexWrapperVerticalCenter = BI.inherit(BI.Layout, {
};
},
update: function (opt) {
return this.wrapper.update(opt);
resize: function () {
this.layout.resize();
},
populate: function (items) {
this.wrapper.populate(items);
this.layout.populate(items);
}
});
BI.shortcut("bi.flex_scrollable_vertical_adapt", BI.FlexWrapperVerticalCenter);

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

@ -84,10 +84,6 @@ BI.FlexWrapperVerticalLayout = BI.inherit(BI.Layout, {
return this.$wrapper;
},
resize: function () {
// console.log("flex_wrapper_vertical布局不需要resize");
},
populate: function (items) {
BI.FlexWrapperVerticalLayout.superclass.populate.apply(this, arguments);
this._mount();

4
src/core/wrapper/layout/float/float.absolute.center.js

@ -24,10 +24,6 @@ BI.FloatAbsoluteCenterLayout = BI.inherit(BI.Layout, {
return w;
},
resize: function () {
// console.log("float_absolute_center_adapt布局不需要resize");
},
populate: function (items) {
BI.FloatAbsoluteCenterLayout.superclass.populate.apply(this, arguments);
this._mount();

19
src/core/wrapper/layout/float/float.absolute.horizontal.js

@ -31,37 +31,40 @@ BI.FloatAbsoluteHorizontalLayout = BI.inherit(BI.Layout, {
},
hgap: "50%",
vgap: o.vgap,
lgap: o.lgap,
rgap: o.rgap,
tgap: o.tgap,
bgap: o.bgap
bgap: o.bgap,
// lgap和rgap不传的话内部不会设置left和right
lgap: o.lgap,
rgap: o.rgap
};
},
_formatItems: function (items) {
if (this.options.horizontalAlign !== BI.HorizontalAlign.Center) {
var o = this.options;
if (o.horizontalAlign === BI.HorizontalAlign.Left) {
return items;
}
var cls = o.horizontalAlign === BI.HorizontalAlign.Right ? "bi-abs-r-x-item" : "bi-abs-c-x-item";
return BI.map(items, function (i, item) {
if (!item || BI.isEmptyObject(item)) {
return item;
}
var el = BI.stripEL(item);
if (BI.isWidget(el)) {
el.element.addClass("bi-abs-c-x-item");
el.element.addClass(cls);
} else {
el.cls = (el.cls || "") + "bi-abs-c-x-item";
el.cls = (el.cls || "") + cls;
}
return item;
});
},
resize: function () {
// console.log("float_absolute_horizontal_adapt布局不需要resize");
this.layout.stroke(this._formatItems(this.options.items));
},
populate: function (items) {
this.layout.populate.apply(this, arguments);
this.layout.populate(this._formatItems(items));
}
});
BI.shortcut("bi.absolute_horizontal_float", BI.FloatAbsoluteHorizontalLayout);

17
src/core/wrapper/layout/float/float.absolute.leftrightvertical.js

@ -27,7 +27,7 @@ BI.FloatAbsoluteLeftRightVerticalAdaptLayout = BI.inherit(BI.Layout, {
self.layout = _ref;
},
verticalAlign: o.verticalAlign,
items: this._formatItems(),
items: this._formatItems(o.items),
vgap: "50%",
scrollx: o.scrollx,
scrolly: o.scrolly,
@ -35,10 +35,10 @@ BI.FloatAbsoluteLeftRightVerticalAdaptLayout = BI.inherit(BI.Layout, {
};
},
_formatItems: function () {
_formatItems: function (items) {
var o = this.options;
var leftItems = o.items.left || [];
var rightItems = o.items.right || [];
var leftItems = items.left || [];
var rightItems = items.right || [];
leftItems = BI.map(leftItems, function (i, item) {
var el = BI.stripEL(item);
if (o.verticalAlign === BI.VerticalAlign.Middle) {
@ -97,7 +97,7 @@ BI.FloatAbsoluteLeftRightVerticalAdaptLayout = BI.inherit(BI.Layout, {
},
resize: function () {
// console.log("absolute_left_right_vertical_adapt布局不需要resize");
this.layout.stroke(this._formatItems(this.options.items));
},
addItem: function () {
@ -106,8 +106,7 @@ BI.FloatAbsoluteLeftRightVerticalAdaptLayout = BI.inherit(BI.Layout, {
},
populate: function (items) {
this.options.items = items;
this.layout.populate(this._formatItems());
this.layout.populate(this._formatItems(items));
}
});
BI.shortcut("bi.absolute_left_right_vertical_float", BI.FloatAbsoluteLeftRightVerticalAdaptLayout);
@ -162,7 +161,7 @@ BI.FloatAbsoluteRightVerticalAdaptLayout = BI.inherit(BI.Layout, {
},
resize: function () {
this.layout.stroke([{}].concat(this._formatItems(this.options.items)));
},
addItem: function () {
@ -171,7 +170,7 @@ BI.FloatAbsoluteRightVerticalAdaptLayout = BI.inherit(BI.Layout, {
},
populate: function (items) {
this.layout.populate(items);
this.layout.populate([{}].concat(this._formatItems(items)));
}
});
BI.shortcut("bi.absolute_right_vertical_float", BI.FloatAbsoluteRightVerticalAdaptLayout);

13
src/core/wrapper/layout/float/float.absolute.vertical.js

@ -33,35 +33,38 @@ BI.FloatAbsoluteVerticalLayout = BI.inherit(BI.Layout, {
hgap: o.hgap,
lgap: o.lgap,
rgap: o.rgap,
// tgap和bgap不传的话内部不会设置top和bottom
tgap: o.tgap,
bgap: o.bgap
};
},
_formatItems: function (items) {
if (this.options.verticalAlign !== BI.VerticalAlign.Middle) {
var o = this.options;
if (o.verticalAlign === BI.VerticalAlign.Top) {
return items;
}
var cls = o.verticalAlign === BI.VerticalAlign.Bottom ? "bi-abs-b-y-item" : "bi-abs-c-y-item";
return BI.map(items, function (i, item) {
if (!item || BI.isEmptyObject(item)) {
return item;
}
var el = BI.stripEL(item);
if (BI.isWidget(el)) {
el.element.addClass("bi-abs-c-y-item");
el.element.addClass(cls);
} else {
el.cls = (el.cls || "") + "bi-abs-c-y-item";
el.cls = (el.cls || "") + cls;
}
return item;
});
},
resize: function () {
// console.log("float_absolute_vertical_adapt布局不需要resize");
this.layout.stroke(this._formatItems(this.options.items));
},
populate: function (items) {
this.layout.populate.apply(this, arguments);
this.layout.populate(this._formatItems(items));
}
});
BI.shortcut("bi.absolute_vertical_float", BI.FloatAbsoluteVerticalLayout);

4
src/core/wrapper/layout/layout.absolute.js

@ -81,10 +81,6 @@ BI.AbsoluteLayout = BI.inherit(BI.Layout, {
return w;
},
resize: function () {
this.stroke(this.options.items);
},
populate: function (items) {
BI.AbsoluteLayout.superclass.populate.apply(this, arguments);
this._mount();

4
src/core/wrapper/layout/layout.adaptive.js

@ -51,10 +51,6 @@ BI.AdaptiveLayout = BI.inherit(BI.Layout, {
return w;
},
resize: function () {
this.stroke(this.options.items);
},
populate: function (items) {
BI.AbsoluteLayout.superclass.populate.apply(this, arguments);
this._mount();

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

@ -16,10 +16,6 @@ BI.BorderLayout = BI.inherit(BI.Layout, {
this.populate(this.options.items);
},
resize: function () {
this.stroke(this.options.items);
},
addItem: function (item) {
// do nothing
throw new Error("不能添加子组件");
@ -131,6 +127,7 @@ BI.BorderLayout = BI.inherit(BI.Layout, {
},
update: function (opt) {
return this.forceUpdate(opt);
},
populate: function (items) {

11
src/core/wrapper/layout/layout.card.js

@ -19,10 +19,6 @@ BI.CardLayout = BI.inherit(BI.Layout, {
this.populate(this.options.items);
},
resize: function () {
// console.log("default布局不需要resize");
},
stroke: function (items) {
var self = this, o = this.options;
this.showIndex = void 0;
@ -48,7 +44,12 @@ BI.CardLayout = BI.inherit(BI.Layout, {
});
},
update: function () {
resize: function () {
// console.log("Card布局不需要resize");
},
update: function (opt) {
return this.forceUpdate(opt);
},
empty: function () {

4
src/core/wrapper/layout/layout.default.js

@ -27,10 +27,6 @@ BI.DefaultLayout = BI.inherit(BI.Layout, {
return w;
},
resize: function () {
// console.log("default布局不需要resize")
},
populate: function (items) {
BI.DefaultLayout.superclass.populate.apply(this, arguments);
this._mount();

30
src/core/wrapper/layout/layout.division.js

@ -11,29 +11,6 @@ BI.DivisionLayout = BI.inherit(BI.Layout, {
columns: null,
rows: null,
items: []
// [
// {
// column: 0,
// row: 0,
// width: 0.25,
// height: 0.33,
// el: {type: 'bi.button', text: 'button1'}
// },
// {
// column: 1,
// row: 1,
// width: 0.25,
// height: 0.33,
// el: {type: 'bi.button', text: 'button2'}
// },
// {
// column: 3,
// row: 2,
// width: 0.25,
// height: 0.33,
// el: {type: 'bi.button', text: 'button3'}
// }
// ]
});
},
render: function () {
@ -41,10 +18,6 @@ BI.DivisionLayout = BI.inherit(BI.Layout, {
this.populate(this.options.items);
},
resize: function () {
this.stroke(this.opitons.items);
},
addItem: function (item) {
// do nothing
throw new Error("不能添加子组件");
@ -151,7 +124,8 @@ BI.DivisionLayout = BI.inherit(BI.Layout, {
}
},
update: function () {
update: function (opt) {
return this.forceUpdate(opt);
},
populate: function (items) {

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

@ -64,10 +64,6 @@ BI.FloatLeftLayout = BI.inherit(BI.Layout, {
return w;
},
resize: function () {
this.stroke(this.options.items);
},
populate: function (items) {
BI.FloatLeftLayout.superclass.populate.apply(this, arguments);
this._mount();
@ -141,10 +137,6 @@ BI.FloatRightLayout = BI.inherit(BI.Layout, {
return w;
},
resize: function () {
this.stroke(this.options.items);
},
populate: function (items) {
BI.FloatRightLayout.superclass.populate.apply(this, arguments);
this._mount();

28
src/core/wrapper/layout/layout.grid.js

@ -11,23 +11,6 @@ BI.GridLayout = BI.inherit(BI.Layout, {
columns: null,
rows: null,
items: []
/* [
{
column: 0,
row: 0,
el: {type: 'bi.button', text: 'button1'}
},
{
column: 1,
row: 1,
el: {type: 'bi.button', text: 'button2'}
},
{
column: 3,
row: 2,
el: {type: 'bi.button', text: 'button3'}
}
]*/
});
},
render: function () {
@ -35,10 +18,6 @@ BI.GridLayout = BI.inherit(BI.Layout, {
this.populate(this.options.items);
},
resize: function () {
// console.log("grid布局不需要resize")
},
addItem: function () {
// do nothing
throw new Error("不能添加子组件");
@ -119,7 +98,12 @@ BI.GridLayout = BI.inherit(BI.Layout, {
}
},
update: function () {
resize: function () {
// console.log("grid布局不需要resize")
},
update: function (opt) {
return this.forceUpdate(opt);
},
populate: function (items) {

37
src/core/wrapper/layout/layout.inline.js

@ -52,23 +52,32 @@ BI.InlineLayout = BI.inherit(BI.Layout, {
});
w.element.addClass("i-item");
if (columnSize === "fill" || columnSize === "") {
var left = o.hgap + o.lgap + (item.lgap || 0) + (item.hgap || 0),
right = o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0);
for (var k = 0; k < i; k++) {
left += o.hgap + o.lgap + o.rgap + (o.items[k].lgap || 0) + (o.items[k].rgap || 0) + (o.items[k].hgap || 0) + (o.columnSize[k] || o.items[k].width);
}
for (var k = i + 1, len = o.columnSize.length || o.items.length; k < len; k++) {
right += o.hgap + o.lgap + o.rgap + (o.items[k].lgap || 0) + (o.items[k].rgap || 0) + (o.items[k].hgap || 0) + (o.columnSize[k] || o.items[k].width);
var length = o.hgap;
var fillCount = 0, autoCount = 0;
for (var k = 0, len = o.columnSize.length || o.items.length; k < len; k++) {
var cz = o.columnSize.length > 0 ? o.columnSize[k] : o.items[k].width;
if (cz === "fill") {
fillCount++;
cz = 0;
} else if (cz === "" || BI.isNull(cz)) {
autoCount++;
cz = 0;
}
length += o.hgap + o.lgap + o.rgap + (o.items[k].lgap || 0) + (o.items[k].rgap || 0) + (o.items[k].hgap || 0) + cz;
}
if (columnSize === "fill") {
w.element.css("min-width", "calc(100% - " + ((left + right) / BI.pixRatio + BI.pixUnit) + ")");
w.element.css("min-width", "calc((100% - " + (length / BI.pixRatio + BI.pixUnit) + ")" + (fillCount > 1 ? "/" + fillCount : "") + ")");
}
if (o.horizontalAlign === BI.HorizontalAlign.Stretch || !(o.scrollable === true || o.scrollx === true)) {
w.element.css("max-width", "calc(100% - " + ((left + right) / BI.pixRatio + BI.pixUnit) + ")");
if (columnSize === "fill") {
w.element.css("max-width", "calc((100% - " + (length / BI.pixRatio + BI.pixUnit) + ")" + (fillCount > 1 ? "/" + fillCount : "") + ")");
} else {
w.element.css("max-width", "calc((100% - " + (length / BI.pixRatio + BI.pixUnit) + ")" + (autoCount > 1 ? "/" + autoCount : "") + ")");
}
}
}
this._handleGap(w, item, i);
if (o.verticalAlign === BI.VerticalAlign.Stretch) {
if (o.verticalAlign === BI.VerticalAlign.Stretch && BI.isNull(item.height)) {
var top = o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0),
bottom = o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0);
w.element.css("height", "calc(100% - " + ((top + bottom) / BI.pixRatio + BI.pixUnit) + ")");
@ -76,14 +85,6 @@ BI.InlineLayout = BI.inherit(BI.Layout, {
return w;
},
resize: function () {
this.stroke(this.options.items);
},
addItem: function (item) {
throw new Error("不能添加子组件");
},
populate: function (items) {
BI.InlineLayout.superclass.populate.apply(this, arguments);
this._mount();

16
src/core/wrapper/layout/layout.lattice.js

@ -31,22 +31,6 @@ BI.LatticeLayout = BI.inherit(BI.Layout, {
return w;
},
addItem: function (item) {
var w = BI.LatticeLayout.superclass.addItem.apply(this, arguments);
this.resize();
return w;
},
addItemAt: function (item) {
var w = BI.LatticeLayout.superclass.addItemAt.apply(this, arguments);
this.resize();
return w;
},
resize: function () {
this.stroke(this.options.items);
},
populate: function (items) {
BI.LatticeLayout.superclass.populate.apply(this, arguments);
this._mount();

10
src/core/wrapper/layout/layout.table.js

@ -121,14 +121,8 @@ BI.TableLayout = BI.inherit(BI.Layout, {
// console.log("table布局不需要resize");
},
addItem: function (arr) {
if (!BI.isArray(arr)) {
throw new Error("必须是数组", arr);
}
return BI.TableLayout.superclass.addItem.apply(this, arguments);
},
update: function () {
update: function (opt) {
return this.forceUpdate(opt);
},
populate: function (items) {

18
src/core/wrapper/layout/layout.tape.js

@ -23,9 +23,6 @@ BI.HTapeLayout = BI.inherit(BI.Layout, {
this.populate(this.options.items);
},
resize: function () {
this.stroke(this.options.items);
},
addItem: function (item) {
// do nothing
throw new Error("不能添加子组件");
@ -122,12 +119,8 @@ BI.HTapeLayout = BI.inherit(BI.Layout, {
});
},
update: function () {
var updated;
BI.each(this._children, function (i, child) {
updated = child.update() || updated;
});
return updated;
update: function (opt) {
return this.forceUpdate(opt);
},
populate: function (items) {
@ -162,10 +155,6 @@ BI.VTapeLayout = BI.inherit(BI.Layout, {
this.populate(this.options.items);
},
resize: function () {
this.stroke(this.options.items);
},
addItem: function (item) {
// do nothing
throw new Error("不能添加子组件");
@ -262,7 +251,8 @@ BI.VTapeLayout = BI.inherit(BI.Layout, {
});
},
update: function () {
update: function (opt) {
return this.forceUpdate(opt);
},
populate: function (items) {

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

@ -176,14 +176,8 @@ BI.TdLayout = BI.inherit(BI.Layout, {
// console.log("td布局不需要resize");
},
addItem: function (arr) {
if (!BI.isArray(arr)) {
throw new Error("必须是数组", arr);
}
return BI.TdLayout.superclass.addItem.apply(this, arguments);
},
update: function () {
update: function (opt) {
return this.forceUpdate(opt);
},
populate: function (items) {

4
src/core/wrapper/layout/layout.vertical.js

@ -42,10 +42,6 @@ BI.VerticalLayout = BI.inherit(BI.Layout, {
return w;
},
resize: function () {
this.stroke(this.options.items);
},
populate: function (items) {
BI.VerticalLayout.superclass.populate.apply(this, arguments);
this._mount();

11
src/core/wrapper/layout/layout.window.js

@ -25,10 +25,6 @@ BI.WindowLayout = BI.inherit(BI.Layout, {
this.populate(this.options.items);
},
resize: function () {
this.stroke(this.options.items);
},
addItem: function (item) {
// do nothing
throw new Error("不能添加子组件");
@ -171,7 +167,12 @@ BI.WindowLayout = BI.inherit(BI.Layout, {
}
},
update: function () {
resize: function () {
// console.log("window布局不需要resize");
},
update: function (opt) {
return this.forceUpdate(opt);
},
populate: function (items) {

8
src/core/wrapper/layout/middle/middle.center.js

@ -48,7 +48,7 @@ BI.CenterLayout = BI.inherit(BI.Layout, {
return {
type: "bi.grid",
ref: function (_ref) {
self.wrapper = _ref;
self.layout = _ref;
},
columns: list.length,
rows: 1,
@ -65,12 +65,8 @@ BI.CenterLayout = BI.inherit(BI.Layout, {
throw new Error("不能添加子组件");
},
update: function (opt) {
return this.wrapper.update(opt);
},
populate: function (items) {
this.wrapper.populate.apply(this.wrapper, arguments);
this.layout.populate.apply(this.layout, arguments);
}
});
BI.shortcut("bi.center", BI.CenterLayout);

8
src/core/wrapper/layout/middle/middle.float.center.js

@ -49,7 +49,7 @@ BI.FloatCenterLayout = BI.inherit(BI.Layout, {
return {
type: "bi.left",
ref: function (_ref) {
self.wrapper = _ref;
self.layout = _ref;
},
items: list
};
@ -64,12 +64,8 @@ BI.FloatCenterLayout = BI.inherit(BI.Layout, {
throw new Error("不能添加子组件");
},
update: function (opt) {
return this.wrapper.update(opt);
},
populate: function (items) {
this.wrapper.populate.apply(this.wrapper, arguments);
this.layout.populate.apply(this.layout, arguments);
}
});
BI.shortcut("bi.float_center", BI.FloatCenterLayout);

8
src/core/wrapper/layout/middle/middle.horizontal.js

@ -46,7 +46,7 @@ BI.HorizontalCenterLayout = BI.inherit(BI.Layout, {
return {
type: "bi.grid",
ref: function (_ref) {
self.wrapper = _ref;
self.layout = _ref;
},
columns: list.length,
rows: 1,
@ -63,12 +63,8 @@ BI.HorizontalCenterLayout = BI.inherit(BI.Layout, {
throw new Error("不能添加子组件");
},
update: function (opt) {
return this.wrapper.update(opt);
},
populate: function (items) {
this.wrapper.populate.apply(this.wrapper, arguments);
this.layout.populate.apply(this.layout, arguments);
}
});
BI.shortcut("bi.horizontal_center", BI.HorizontalCenterLayout);

8
src/core/wrapper/layout/middle/middle.vertical.js

@ -47,7 +47,7 @@ BI.VerticalCenterLayout = BI.inherit(BI.Layout, {
return {
type: "bi.grid",
ref: function (_ref) {
self.wrapper = _ref;
self.layout = _ref;
},
columns: 1,
rows: list.length,
@ -64,12 +64,8 @@ BI.VerticalCenterLayout = BI.inherit(BI.Layout, {
throw new Error("不能添加子组件");
},
update: function (opt) {
return this.wrapper.update(opt);
},
populate: function (items) {
this.wrapper.populate.apply(this.wrapper, arguments);
this.layout.populate.apply(this.layout, arguments);
}
});
BI.shortcut("bi.vertical_center", BI.VerticalCenterLayout);

12
src/less/core/wrapper/float.absolute.less

@ -24,4 +24,14 @@
-webkit-transform: translate(-50%, -50%); /* Safari 和 Chrome */
-o-transform: translate(-50%, -50%); /* Opera */
transform: translate(-50%, -50%);
}
}
.bi-abs-b-y-item {
bottom: 0;
margin-top: auto;
}
.bi-abs-r-x-item {
right: 0;
margin-left: auto;
}

2
template/index.html

@ -10,6 +10,8 @@
</head>
<body>
<div id="wrapper"></div>
</body>
<script src="../dist/router.js"></script>
</html>

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

Loading…
Cancel
Save