Browse Source

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

* commit '802e9f5b15d4526e423b20cbdbbe08cd758a1285':
  add
  normalize
  floatbox
  布局
  布局
  布局
  删除自适应布局
es6
guy 7 years ago
parent
commit
d33dc6c0bc
  1. 70812
      bi/base.js
  2. 25238
      bi/case.js
  3. 15094
      bi/chart.js
  4. 230
      bi/core.css
  5. 35028
      bi/core.js
  6. 184
      bi/polyfill.js
  7. 132
      bi/widget.css
  8. 34338
      bi/widget.js
  9. 374
      demo/js/config/core.js
  10. 4
      demo/js/config/widget.js
  11. 13
      demo/js/widget/demo.interactivearrangement.js
  12. 70812
      docs/base.js
  13. 25238
      docs/case.js
  14. 15094
      docs/chart.js
  15. 230
      docs/core.css
  16. 38120
      docs/core.js
  17. 14224
      docs/demo.js
  18. 184
      docs/polyfill.js
  19. 132
      docs/widget.css
  20. 34338
      docs/widget.js
  21. 14
      src/core/controller/router.floatbox.js
  22. 230
      src/css/core/normalize.css
  23. 0
      src/css/core/normalize2.css
  24. 2
      src/css/lib/colors.css
  25. 231
      src/less/core/normalize.less
  26. 88
      src/less/core/normalize2.less
  27. 507
      src/widget/adaptivearrangement/adaptivearrangement.js
  28. 6
      src/widget/arrangement/arrangement.block.js
  29. 6
      src/widget/arrangement/arrangement.droppable.js
  30. 2158
      src/widget/arrangement/arrangement.js
  31. 43
      src/widget/interactivearrangement/interactivearrangement.js

70812
bi/base.js

File diff suppressed because it is too large Load Diff

25238
bi/case.js

File diff suppressed because it is too large Load Diff

15094
bi/chart.js

File diff suppressed because it is too large Load Diff

230
bi/core.css

@ -1,3 +1,233 @@
/*! normalize.css v1.0.0 | MIT License | git.io/normalize */
article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
nav,
section,
summary {
display: block;
}
audio,
canvas,
video {
display: inline-block;
*display: inline;
*zoom: 1;
}
audio:not([controls]) {
display: none;
height: 0;
}
[hidden] {
display: none;
}
html {
font-size: 100%;
-webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%;
}
html,
button,
input,
select,
textarea {
font-family: sans-serif;
}
body {
margin: 0;
}
a:focus {
outline: thin dotted;
}
a:active,
a:hover {
outline: 0;
}
h1 {
font-size: 2em;
margin: 0.67em 0;
}
h2 {
font-size: 1.5em;
margin: 0.83em 0;
}
h3 {
font-size: 1.17em;
margin: 1em 0;
}
h4 {
font-size: 1em;
margin: 1.33em 0;
}
h5 {
font-size: .83em;
margin: 1.67em 0;
}
h6 {
font-size: .75em;
margin: 2.33em 0;
}
abbr[title] {
border-bottom: 1px dotted;
}
b,
strong {
font-weight: bold;
}
blockquote {
margin: 1em 40px;
}
dfn {
font-style: italic;
}
mark {
background: #ff0;
color: #000000;
}
p,
pre {
margin: 1em 0;
}
code,
kbd,
pre,
samp {
font-family: monospace, serif;
_font-family: 'courier new', monospace;
font-size: 1em;
}
pre {
white-space: pre;
white-space: pre-wrap;
word-wrap: break-word;
}
q {
quotes: none;
}
q:before,
q:after {
content: '';
content: none;
}
small {
font-size: 75%;
}
sub,
sup {
font-size: 75%;
line-height: 0;
position: relative;
vertical-align: baseline;
}
sup {
top: -0.5em;
}
sub {
bottom: -0.25em;
}
dl,
menu,
ol,
ul {
margin: 1em 0;
}
dd {
margin: 0 0 0 40px;
}
menu,
ol,
ul {
padding: 0 0 0 40px;
}
nav ul,
nav ol {
list-style: none;
list-style-image: none;
}
img {
border: 0;
-ms-interpolation-mode: bicubic;
}
svg:not(:root) {
overflow: hidden;
}
figure {
margin: 0;
}
form {
margin: 0;
}
fieldset {
border: 1px solid #c0c0c0;
margin: 0 2px;
padding: 0.35em 0.625em 0.75em;
}
legend {
border: 0;
padding: 0;
white-space: normal;
*margin-left: -7px;
}
button,
input,
select,
textarea {
font-size: 100%;
margin: 0;
vertical-align: baseline;
*vertical-align: middle;
}
button,
input {
line-height: normal;
}
button,
html input[type="button"],
input[type="reset"],
input[type="submit"] {
-webkit-appearance: button;
cursor: pointer;
*overflow: visible;
}
button[disabled],
input[disabled] {
cursor: default;
}
input[type="checkbox"],
input[type="radio"] {
box-sizing: border-box;
padding: 0;
*height: 13px;
*width: 13px;
}
input[type="search"] {
-webkit-appearance: textfield;
-moz-box-sizing: content-box;
-webkit-box-sizing: content-box;
box-sizing: content-box;
}
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-decoration {
-webkit-appearance: none;
}
button::-moz-focus-inner,
input::-moz-focus-inner {
border: 0;
padding: 0;
}
textarea {
overflow: auto;
vertical-align: top;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
html,
body,
div,

35028
bi/core.js

File diff suppressed because it is too large Load Diff

184
bi/polyfill.js

@ -1,93 +1,93 @@
if(![].indexOf){
/**
* 检查指定的值是否在数组中
* @param {Object} o 要检查的值
* @return {Number} o在数组中的索引如果不在数组中则返回-1
*/
Array.prototype.indexOf = function (o) {
for (var i = 0, len = this.length; i < len; i++) {
if (_.isEqual(o, this[i])) {
return i;
}
}
return -1;
}
}
if(![].lastIndexOf){
/**
* 检查指定的值是否在数组中
* ie67不支持数组的这个方法
* @param {Object} o 要检查的值
* @return {Number} o在数组中的索引如果不在数组中则返回-1
*/
Array.prototype.lastIndexOf = function (o) {
for (var len = this.length, i = len - 1; i >= 0; i--) {
if (_.isEqual(o, this[i])) {
return i;
}
}
return -1;
}
}/**
* 特殊情况
* Created by wang on 15/6/23.
*/
//解决console未定义问题 guy
window.console = window.console || (function () {
var c = {};
c.log = c.warn = c.debug = c.info = c.error = c.time = c.dir = c.profile
= c.clear = c.exception = c.trace = c.assert = function () {
};
return c;
})();
/*
* 前端缓存
*/
window.localStorage || (window.localStorage = {
items: {},
setItem: function (k, v) {
BI.Cache.addCookie(k, v);
},
getItem: function (k) {
return BI.Cache.getCookie(k);
},
removeItem: function (k) {
BI.Cache.deleteCookie(k);
},
key: function () {
},
clear: function () {
this.items = {};
}
});//修复ie9下sort方法的bug
!function (window) {
var ua = window.navigator.userAgent.toLowerCase(),
reg = /msie|applewebkit.+safari/;
if (reg.test(ua)) {
var _sort = Array.prototype.sort;
Array.prototype.sort = function (fn) {
if (!!fn && typeof fn === 'function') {
if (this.length < 2) {
return this;
}
var i = 0, j = i + 1, l = this.length, tmp, r = false, t = 0;
for (; i < l; i++) {
for (j = i + 1; j < l; j++) {
t = fn.call(this, this[i], this[j]);
r = (typeof t === 'number' ? t :
!!t ? 1 : 0) > 0;
if (r === true) {
tmp = this[i];
this[i] = this[j];
this[j] = tmp;
}
}
}
return this;
} else {
return _sort.call(this);
}
};
}
if(![].indexOf){
/**
* 检查指定的值是否在数组中
* @param {Object} o 要检查的值
* @return {Number} o在数组中的索引如果不在数组中则返回-1
*/
Array.prototype.indexOf = function (o) {
for (var i = 0, len = this.length; i < len; i++) {
if (_.isEqual(o, this[i])) {
return i;
}
}
return -1;
}
}
if(![].lastIndexOf){
/**
* 检查指定的值是否在数组中
* ie67不支持数组的这个方法
* @param {Object} o 要检查的值
* @return {Number} o在数组中的索引如果不在数组中则返回-1
*/
Array.prototype.lastIndexOf = function (o) {
for (var len = this.length, i = len - 1; i >= 0; i--) {
if (_.isEqual(o, this[i])) {
return i;
}
}
return -1;
}
}/**
* 特殊情况
* Created by wang on 15/6/23.
*/
//解决console未定义问题 guy
window.console = window.console || (function () {
var c = {};
c.log = c.warn = c.debug = c.info = c.error = c.time = c.dir = c.profile
= c.clear = c.exception = c.trace = c.assert = function () {
};
return c;
})();
/*
* 前端缓存
*/
window.localStorage || (window.localStorage = {
items: {},
setItem: function (k, v) {
BI.Cache.addCookie(k, v);
},
getItem: function (k) {
return BI.Cache.getCookie(k);
},
removeItem: function (k) {
BI.Cache.deleteCookie(k);
},
key: function () {
},
clear: function () {
this.items = {};
}
});//修复ie9下sort方法的bug
!function (window) {
var ua = window.navigator.userAgent.toLowerCase(),
reg = /msie|applewebkit.+safari/;
if (reg.test(ua)) {
var _sort = Array.prototype.sort;
Array.prototype.sort = function (fn) {
if (!!fn && typeof fn === 'function') {
if (this.length < 2) {
return this;
}
var i = 0, j = i + 1, l = this.length, tmp, r = false, t = 0;
for (; i < l; i++) {
for (j = i + 1; j < l; j++) {
t = fn.call(this, this[i], this[j]);
r = (typeof t === 'number' ? t :
!!t ? 1 : 0) > 0;
if (r === true) {
tmp = this[i];
this[i] = this[j];
this[j] = tmp;
}
}
}
return this;
} else {
return _sort.call(this);
}
};
}
}(window);

132
bi/widget.css

@ -39,72 +39,72 @@
.bi-arrangement-droppable {
z-index: 100000;
}
/****添加计算宽度的--运算符直接需要space****/
/****** common color(常用颜色,可用于普遍场景) *****/
/**** custom color(自定义颜色,用于特定场景) ****/
.bi-adapt-editor .adapt-editor-text {
font-size: 14px;
}
/****添加计算宽度的--运算符直接需要space****/
/****** common color(常用颜色,可用于普遍场景) *****/
/**** custom color(自定义颜色,用于特定场景) ****/
/*************BI.SearchEditor******************/
.bi-search-editor {
border: 1px solid #d4dadd;
}
.bi-search-editor .close-font {
font-size: 20px;
}
.bi-search-editor .search-font {
font-size: 20px;
}
/****添加计算宽度的--运算符直接需要space****/
/****** common color(常用颜色,可用于普遍场景) *****/
/**** custom color(自定义颜色,用于特定场景) ****/
/*************BI.SearchEditor******************/
.bi-small-search-editor .bi-editor {
font-size: 12px;
}
.bi-small-search-editor .bi-editor .bi-input {
font-size: 12px;
}
.bi-small-search-editor .bi-editor .bi-label {
font-size: 12px;
}
.bi-small-search-editor .close-font {
font-size: 18px;
}
.bi-small-search-editor .search-font {
font-size: 18px;
}
/****添加计算宽度的--运算符直接需要space****/
/****** common color(常用颜色,可用于普遍场景) *****/
/**** custom color(自定义颜色,用于特定场景) ****/
.bi-sign-initial-editor .sign-initial-editor-text {
font-size: 14px;
}
/****添加计算宽度的--运算符直接需要space****/
/****** common color(常用颜色,可用于普遍场景) *****/
/**** custom color(自定义颜色,用于特定场景) ****/
.bi-sign-style-editor .sign-style-editor-text {
max-width: 100%;
font-size: 12px;
}
.bi-sign-style-editor .sign-style-editor-tip {
max-width: 100%;
font-size: 12px;
color: #808080;
}
/****添加计算宽度的--运算符直接需要space****/
/****** common color(常用颜色,可用于普遍场景) *****/
/**** custom color(自定义颜色,用于特定场景) ****/
.bi-text-editor {
border: 1px solid #d4dadd;
}
/****添加计算宽度的--运算符直接需要space****/
/****** common color(常用颜色,可用于普遍场景) *****/
/**** custom color(自定义颜色,用于特定场景) ****/
/*************BI.SearchEditor******************/
/****添加计算宽度的--运算符直接需要space****/
/****** common color(常用颜色,可用于普遍场景) *****/
/**** custom color(自定义颜色,用于特定场景) ****/
.bi-adapt-editor .adapt-editor-text {
font-size: 14px;
}
/****添加计算宽度的--运算符直接需要space****/
/****** common color(常用颜色,可用于普遍场景) *****/
/**** custom color(自定义颜色,用于特定场景) ****/
/*************BI.SearchEditor******************/
.bi-search-editor {
border: 1px solid #d4dadd;
}
.bi-search-editor .close-font {
font-size: 20px;
}
.bi-search-editor .search-font {
font-size: 20px;
}
/****添加计算宽度的--运算符直接需要space****/
/****** common color(常用颜色,可用于普遍场景) *****/
/**** custom color(自定义颜色,用于特定场景) ****/
/*************BI.SearchEditor******************/
.bi-small-search-editor .bi-editor {
font-size: 12px;
}
.bi-small-search-editor .bi-editor .bi-input {
font-size: 12px;
}
.bi-small-search-editor .bi-editor .bi-label {
font-size: 12px;
}
.bi-small-search-editor .close-font {
font-size: 18px;
}
.bi-small-search-editor .search-font {
font-size: 18px;
}
/****添加计算宽度的--运算符直接需要space****/
/****** common color(常用颜色,可用于普遍场景) *****/
/**** custom color(自定义颜色,用于特定场景) ****/
.bi-sign-initial-editor .sign-initial-editor-text {
font-size: 14px;
}
/****添加计算宽度的--运算符直接需要space****/
/****** common color(常用颜色,可用于普遍场景) *****/
/**** custom color(自定义颜色,用于特定场景) ****/
.bi-sign-style-editor .sign-style-editor-text {
max-width: 100%;
font-size: 12px;
}
.bi-sign-style-editor .sign-style-editor-tip {
max-width: 100%;
font-size: 12px;
color: #808080;
}
/****添加计算宽度的--运算符直接需要space****/
/****** common color(常用颜色,可用于普遍场景) *****/
/**** custom color(自定义颜色,用于特定场景) ****/
.bi-text-editor {
border: 1px solid #d4dadd;
}
/****添加计算宽度的--运算符直接需要space****/
/****** common color(常用颜色,可用于普遍场景) *****/
/**** custom color(自定义颜色,用于特定场景) ****/
/*************BI.SearchEditor******************/
/****** common color(常用颜色,可用于普遍场景) *****/
/**** custom color(自定义颜色,用于特定场景) ****/
.bi-date-trigger {

34338
bi/widget.js

File diff suppressed because it is too large Load Diff

374
demo/js/config/core.js

@ -1,188 +1,188 @@
Demo.CORE_CONFIG = [{
id: 1,
text: "核心控件",
}, {
id: 101,
pId: 1,
text: "布局"
}, {
pId: 101,
text: "bi.center_adapt",
value: "demo.center_adapt"
}, {
pId: 101,
text: "bi.vertical_adapt",
value: "demo.vertical_adapt"
}, {
pId: 101,
text: "bi.horizontal_adapt",
value: "demo.horizontal_adapt"
}, {
pId: 101,
text: "bi.horizontal_auto",
value: "demo.horizontal_auto"
}, {
pId: 101,
text: "bi.horizontal_float",
value: "demo.horizontal_float"
}, {
pId: 101,
text: "bi.left_right_vertical_adapt",
value: "demo.left_right_vertical_adapt"
}, {
pId: 101,
text: "bi.center",
value: "demo.center_layout"
}, {
pId: 101,
text: "bi.float_center",
value: "demo.float_center"
}, {
pId: 101,
text: "bi.vertical",
value: "demo.vertical"
}, {
pId: 101,
text: "bi.horizontal",
value: "demo.horizontal"
}, {
pId: 101,
text: "bi.border",
value: "demo.border"
}, {
pId: 101,
text: "bi.left, bi.right",
value: "demo.flow"
}, {
pId: 101,
text: "bi.inline",
value: "demo.inline"
}, {
pId: 101,
text: "bi.htape",
value: "demo.htape"
}, {
pId: 101,
text: "bi.vtape",
value: "demo.vtape"
}, {
pId: 101,
text: "bi.grid",
value: "demo.grid"
}, {
pId: 101,
text: "bi.table",
value: "demo.table_layout"
}, {
pId: 101,
text: "bi.td",
value: "demo.td"
}, {
pId: 1,
id: 102,
text: "抽象控件"
}, {
pId: 102,
text: "bi.button_group",
value: "demo.button_group"
}, {
pId: 102,
text: "bi.button_tree",
value: "demo.button_tree"
}, {
pId: 102,
text: "bi.virtual_group",
value: "demo.virtual_group"
}, {
pId: 102,
text: "bi.custom_tree",
value: "demo.custom_tree"
}, {
pId: 102,
text: "bi.grid_view",
value: "demo.grid_view"
}, {
pId: 102,
text: "bi.collection_view",
value: "demo.collection_view"
}, {
pId: 102,
text: "bi.list_view",
value: "demo.list_view"
}, {
pId: 102,
text: "bi.virtual_list",
value: "demo.virtual_list"
}, {
pId: 102,
id: 10201,
text: "组合控件"
}, {
pId: 10201,
text: "bi.combo",
value: "demo.combo"
}, {
pId: 10201,
text: "bi.expander",
value: "demo.expander"
}, {
pId: 10201,
text: "bi.group_combo",
value: "demo.group_combo"
}, {
pId: 10201,
text: "bi.loader",
value: "demo.loader"
}, {
pId: 10201,
text: "bi.navigation",
value: "demo.navigation"
}, {
pId: 10201,
text: "bi.searcher",
value: "demo.searcher"
}, {
pId: 10201,
text: "bi.switcher",
value: "demo.switcher"
}, {
pId: 10201,
text: "bi.tab",
value: "demo.tab"
}, {
pId: 102,
id: 10202,
text: "弹出层"
}, {
pId: 10202,
text: "bi.layer_float_box",
value: "demo.layer_float_box"
}, {
pId: 10202,
text: "bi.layer_popup",
value: "demo.layer_popup"
}, {
pId: 10202,
text: "bi.layer_searcher",
value: "demo.layer_searcher"
}, {
pId: 1,
text: "widget",
value: "demo.widget"
}, {
pId: 1,
text: "single",
value: "demo.single"
}, {
pId: 1,
text: "BasicButton",
value: "demo.basic_button"
}, {
pId: 1,
text: "NodeButton",
value: "demo.node_button"
}, {
pId: 1,
text: "pane",
value: "demo.pane"
Demo.CORE_CONFIG = [{
id: 1,
text: "核心控件",
}, {
id: 101,
pId: 1,
text: "布局"
}, {
pId: 101,
text: "自适应居中bi.center_adapt",
value: "demo.center_adapt"
}, {
pId: 101,
text: "自适应垂直居中bi.vertical_adapt",
value: "demo.vertical_adapt"
}, {
pId: 101,
text: "自适应水平居中bi.horizontal_adapt",
value: "demo.horizontal_adapt"
}, {
pId: 101,
text: "margin-auto自适应水平居中bi.horizontal_auto",
value: "demo.horizontal_auto"
}, {
pId: 101,
text: "float水平居中bi.horizontal_float",
value: "demo.horizontal_float"
}, {
pId: 101,
text: "左右垂直居中bi.left_right_vertical_adapt",
value: "demo.left_right_vertical_adapt"
}, {
pId: 101,
text: "bi.center",
value: "demo.center_layout"
}, {
pId: 101,
text: "bi.float_center",
value: "demo.float_center"
}, {
pId: 101,
text: "垂直流式bi.vertical",
value: "demo.vertical"
}, {
pId: 101,
text: "水平流式bi.horizontal",
value: "demo.horizontal"
}, {
pId: 101,
text: "bi.border",
value: "demo.border"
}, {
pId: 101,
text: "bi.left, bi.right",
value: "demo.flow"
}, {
pId: 101,
text: "bi.inline",
value: "demo.inline"
}, {
pId: 101,
text: "bi.htape",
value: "demo.htape"
}, {
pId: 101,
text: "bi.vtape",
value: "demo.vtape"
}, {
pId: 101,
text: "bi.grid",
value: "demo.grid"
}, {
pId: 101,
text: "bi.table",
value: "demo.table_layout"
}, {
pId: 101,
text: "bi.td",
value: "demo.td"
}, {
pId: 1,
id: 102,
text: "抽象控件"
}, {
pId: 102,
text: "bi.button_group",
value: "demo.button_group"
}, {
pId: 102,
text: "bi.button_tree",
value: "demo.button_tree"
}, {
pId: 102,
text: "bi.virtual_group",
value: "demo.virtual_group"
}, {
pId: 102,
text: "bi.custom_tree",
value: "demo.custom_tree"
}, {
pId: 102,
text: "bi.grid_view",
value: "demo.grid_view"
}, {
pId: 102,
text: "bi.collection_view",
value: "demo.collection_view"
}, {
pId: 102,
text: "bi.list_view",
value: "demo.list_view"
}, {
pId: 102,
text: "bi.virtual_list",
value: "demo.virtual_list"
}, {
pId: 102,
id: 10201,
text: "组合控件"
}, {
pId: 10201,
text: "bi.combo",
value: "demo.combo"
}, {
pId: 10201,
text: "bi.expander",
value: "demo.expander"
}, {
pId: 10201,
text: "bi.group_combo",
value: "demo.group_combo"
}, {
pId: 10201,
text: "bi.loader",
value: "demo.loader"
}, {
pId: 10201,
text: "bi.navigation",
value: "demo.navigation"
}, {
pId: 10201,
text: "bi.searcher",
value: "demo.searcher"
}, {
pId: 10201,
text: "bi.switcher",
value: "demo.switcher"
}, {
pId: 10201,
text: "bi.tab",
value: "demo.tab"
}, {
pId: 102,
id: 10202,
text: "弹出层"
}, {
pId: 10202,
text: "bi.layer_float_box",
value: "demo.layer_float_box"
}, {
pId: 10202,
text: "bi.layer_popup",
value: "demo.layer_popup"
}, {
pId: 10202,
text: "bi.layer_searcher",
value: "demo.layer_searcher"
}, {
pId: 1,
text: "widget",
value: "demo.widget"
}, {
pId: 1,
text: "single",
value: "demo.single"
}, {
pId: 1,
text: "BasicButton",
value: "demo.basic_button"
}, {
pId: 1,
text: "NodeButton",
value: "demo.node_button"
}, {
pId: 1,
text: "pane",
value: "demo.pane"
}];

4
demo/js/config/widget.js

@ -41,4 +41,8 @@ Demo.WIDGET_CONFIG = [{
pId: 4,
text: "bi.relation_view",
value: "demo.relation_view"
}, {
pId: 4,
text: "bi.interactive_arrangement",
value: "demo.interactive_arrangement"
}];

13
demo/js/widget/demo.interactivearrangement.js

@ -0,0 +1,13 @@
/**
* Created by User on 2017/3/22.
*/
Demo.RelationView = BI.inherit(BI.Widget, {
props: {
},
render: function () {
return {
type: "bi.interactive_arrangement",
};
}
});
BI.shortcut("demo.interactive_arrangement", Demo.RelationView);

70812
docs/base.js

File diff suppressed because it is too large Load Diff

25238
docs/case.js

File diff suppressed because it is too large Load Diff

15094
docs/chart.js

File diff suppressed because it is too large Load Diff

230
docs/core.css

@ -1,3 +1,233 @@
/*! normalize.css v1.0.0 | MIT License | git.io/normalize */
article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
nav,
section,
summary {
display: block;
}
audio,
canvas,
video {
display: inline-block;
*display: inline;
*zoom: 1;
}
audio:not([controls]) {
display: none;
height: 0;
}
[hidden] {
display: none;
}
html {
font-size: 100%;
-webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%;
}
html,
button,
input,
select,
textarea {
font-family: sans-serif;
}
body {
margin: 0;
}
a:focus {
outline: thin dotted;
}
a:active,
a:hover {
outline: 0;
}
h1 {
font-size: 2em;
margin: 0.67em 0;
}
h2 {
font-size: 1.5em;
margin: 0.83em 0;
}
h3 {
font-size: 1.17em;
margin: 1em 0;
}
h4 {
font-size: 1em;
margin: 1.33em 0;
}
h5 {
font-size: .83em;
margin: 1.67em 0;
}
h6 {
font-size: .75em;
margin: 2.33em 0;
}
abbr[title] {
border-bottom: 1px dotted;
}
b,
strong {
font-weight: bold;
}
blockquote {
margin: 1em 40px;
}
dfn {
font-style: italic;
}
mark {
background: #ff0;
color: #000000;
}
p,
pre {
margin: 1em 0;
}
code,
kbd,
pre,
samp {
font-family: monospace, serif;
_font-family: 'courier new', monospace;
font-size: 1em;
}
pre {
white-space: pre;
white-space: pre-wrap;
word-wrap: break-word;
}
q {
quotes: none;
}
q:before,
q:after {
content: '';
content: none;
}
small {
font-size: 75%;
}
sub,
sup {
font-size: 75%;
line-height: 0;
position: relative;
vertical-align: baseline;
}
sup {
top: -0.5em;
}
sub {
bottom: -0.25em;
}
dl,
menu,
ol,
ul {
margin: 1em 0;
}
dd {
margin: 0 0 0 40px;
}
menu,
ol,
ul {
padding: 0 0 0 40px;
}
nav ul,
nav ol {
list-style: none;
list-style-image: none;
}
img {
border: 0;
-ms-interpolation-mode: bicubic;
}
svg:not(:root) {
overflow: hidden;
}
figure {
margin: 0;
}
form {
margin: 0;
}
fieldset {
border: 1px solid #c0c0c0;
margin: 0 2px;
padding: 0.35em 0.625em 0.75em;
}
legend {
border: 0;
padding: 0;
white-space: normal;
*margin-left: -7px;
}
button,
input,
select,
textarea {
font-size: 100%;
margin: 0;
vertical-align: baseline;
*vertical-align: middle;
}
button,
input {
line-height: normal;
}
button,
html input[type="button"],
input[type="reset"],
input[type="submit"] {
-webkit-appearance: button;
cursor: pointer;
*overflow: visible;
}
button[disabled],
input[disabled] {
cursor: default;
}
input[type="checkbox"],
input[type="radio"] {
box-sizing: border-box;
padding: 0;
*height: 13px;
*width: 13px;
}
input[type="search"] {
-webkit-appearance: textfield;
-moz-box-sizing: content-box;
-webkit-box-sizing: content-box;
box-sizing: content-box;
}
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-decoration {
-webkit-appearance: none;
}
button::-moz-focus-inner,
input::-moz-focus-inner {
border: 0;
padding: 0;
}
textarea {
overflow: auto;
vertical-align: top;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
html,
body,
div,

38120
docs/core.js

File diff suppressed because it is too large Load Diff

14224
docs/demo.js

File diff suppressed because one or more lines are too long

184
docs/polyfill.js

@ -1,93 +1,93 @@
if(![].indexOf){
/**
* 检查指定的值是否在数组中
* @param {Object} o 要检查的值
* @return {Number} o在数组中的索引如果不在数组中则返回-1
*/
Array.prototype.indexOf = function (o) {
for (var i = 0, len = this.length; i < len; i++) {
if (_.isEqual(o, this[i])) {
return i;
}
}
return -1;
}
}
if(![].lastIndexOf){
/**
* 检查指定的值是否在数组中
* ie67不支持数组的这个方法
* @param {Object} o 要检查的值
* @return {Number} o在数组中的索引如果不在数组中则返回-1
*/
Array.prototype.lastIndexOf = function (o) {
for (var len = this.length, i = len - 1; i >= 0; i--) {
if (_.isEqual(o, this[i])) {
return i;
}
}
return -1;
}
}/**
* 特殊情况
* Created by wang on 15/6/23.
*/
//解决console未定义问题 guy
window.console = window.console || (function () {
var c = {};
c.log = c.warn = c.debug = c.info = c.error = c.time = c.dir = c.profile
= c.clear = c.exception = c.trace = c.assert = function () {
};
return c;
})();
/*
* 前端缓存
*/
window.localStorage || (window.localStorage = {
items: {},
setItem: function (k, v) {
BI.Cache.addCookie(k, v);
},
getItem: function (k) {
return BI.Cache.getCookie(k);
},
removeItem: function (k) {
BI.Cache.deleteCookie(k);
},
key: function () {
},
clear: function () {
this.items = {};
}
});//修复ie9下sort方法的bug
!function (window) {
var ua = window.navigator.userAgent.toLowerCase(),
reg = /msie|applewebkit.+safari/;
if (reg.test(ua)) {
var _sort = Array.prototype.sort;
Array.prototype.sort = function (fn) {
if (!!fn && typeof fn === 'function') {
if (this.length < 2) {
return this;
}
var i = 0, j = i + 1, l = this.length, tmp, r = false, t = 0;
for (; i < l; i++) {
for (j = i + 1; j < l; j++) {
t = fn.call(this, this[i], this[j]);
r = (typeof t === 'number' ? t :
!!t ? 1 : 0) > 0;
if (r === true) {
tmp = this[i];
this[i] = this[j];
this[j] = tmp;
}
}
}
return this;
} else {
return _sort.call(this);
}
};
}
if(![].indexOf){
/**
* 检查指定的值是否在数组中
* @param {Object} o 要检查的值
* @return {Number} o在数组中的索引如果不在数组中则返回-1
*/
Array.prototype.indexOf = function (o) {
for (var i = 0, len = this.length; i < len; i++) {
if (_.isEqual(o, this[i])) {
return i;
}
}
return -1;
}
}
if(![].lastIndexOf){
/**
* 检查指定的值是否在数组中
* ie67不支持数组的这个方法
* @param {Object} o 要检查的值
* @return {Number} o在数组中的索引如果不在数组中则返回-1
*/
Array.prototype.lastIndexOf = function (o) {
for (var len = this.length, i = len - 1; i >= 0; i--) {
if (_.isEqual(o, this[i])) {
return i;
}
}
return -1;
}
}/**
* 特殊情况
* Created by wang on 15/6/23.
*/
//解决console未定义问题 guy
window.console = window.console || (function () {
var c = {};
c.log = c.warn = c.debug = c.info = c.error = c.time = c.dir = c.profile
= c.clear = c.exception = c.trace = c.assert = function () {
};
return c;
})();
/*
* 前端缓存
*/
window.localStorage || (window.localStorage = {
items: {},
setItem: function (k, v) {
BI.Cache.addCookie(k, v);
},
getItem: function (k) {
return BI.Cache.getCookie(k);
},
removeItem: function (k) {
BI.Cache.deleteCookie(k);
},
key: function () {
},
clear: function () {
this.items = {};
}
});//修复ie9下sort方法的bug
!function (window) {
var ua = window.navigator.userAgent.toLowerCase(),
reg = /msie|applewebkit.+safari/;
if (reg.test(ua)) {
var _sort = Array.prototype.sort;
Array.prototype.sort = function (fn) {
if (!!fn && typeof fn === 'function') {
if (this.length < 2) {
return this;
}
var i = 0, j = i + 1, l = this.length, tmp, r = false, t = 0;
for (; i < l; i++) {
for (j = i + 1; j < l; j++) {
t = fn.call(this, this[i], this[j]);
r = (typeof t === 'number' ? t :
!!t ? 1 : 0) > 0;
if (r === true) {
tmp = this[i];
this[i] = this[j];
this[j] = tmp;
}
}
}
return this;
} else {
return _sort.call(this);
}
};
}
}(window);

132
docs/widget.css

@ -39,72 +39,72 @@
.bi-arrangement-droppable {
z-index: 100000;
}
/****添加计算宽度的--运算符直接需要space****/
/****** common color(常用颜色,可用于普遍场景) *****/
/**** custom color(自定义颜色,用于特定场景) ****/
.bi-adapt-editor .adapt-editor-text {
font-size: 14px;
}
/****添加计算宽度的--运算符直接需要space****/
/****** common color(常用颜色,可用于普遍场景) *****/
/**** custom color(自定义颜色,用于特定场景) ****/
/*************BI.SearchEditor******************/
.bi-search-editor {
border: 1px solid #d4dadd;
}
.bi-search-editor .close-font {
font-size: 20px;
}
.bi-search-editor .search-font {
font-size: 20px;
}
/****添加计算宽度的--运算符直接需要space****/
/****** common color(常用颜色,可用于普遍场景) *****/
/**** custom color(自定义颜色,用于特定场景) ****/
/*************BI.SearchEditor******************/
.bi-small-search-editor .bi-editor {
font-size: 12px;
}
.bi-small-search-editor .bi-editor .bi-input {
font-size: 12px;
}
.bi-small-search-editor .bi-editor .bi-label {
font-size: 12px;
}
.bi-small-search-editor .close-font {
font-size: 18px;
}
.bi-small-search-editor .search-font {
font-size: 18px;
}
/****添加计算宽度的--运算符直接需要space****/
/****** common color(常用颜色,可用于普遍场景) *****/
/**** custom color(自定义颜色,用于特定场景) ****/
.bi-sign-initial-editor .sign-initial-editor-text {
font-size: 14px;
}
/****添加计算宽度的--运算符直接需要space****/
/****** common color(常用颜色,可用于普遍场景) *****/
/**** custom color(自定义颜色,用于特定场景) ****/
.bi-sign-style-editor .sign-style-editor-text {
max-width: 100%;
font-size: 12px;
}
.bi-sign-style-editor .sign-style-editor-tip {
max-width: 100%;
font-size: 12px;
color: #808080;
}
/****添加计算宽度的--运算符直接需要space****/
/****** common color(常用颜色,可用于普遍场景) *****/
/**** custom color(自定义颜色,用于特定场景) ****/
.bi-text-editor {
border: 1px solid #d4dadd;
}
/****添加计算宽度的--运算符直接需要space****/
/****** common color(常用颜色,可用于普遍场景) *****/
/**** custom color(自定义颜色,用于特定场景) ****/
/*************BI.SearchEditor******************/
/****添加计算宽度的--运算符直接需要space****/
/****** common color(常用颜色,可用于普遍场景) *****/
/**** custom color(自定义颜色,用于特定场景) ****/
.bi-adapt-editor .adapt-editor-text {
font-size: 14px;
}
/****添加计算宽度的--运算符直接需要space****/
/****** common color(常用颜色,可用于普遍场景) *****/
/**** custom color(自定义颜色,用于特定场景) ****/
/*************BI.SearchEditor******************/
.bi-search-editor {
border: 1px solid #d4dadd;
}
.bi-search-editor .close-font {
font-size: 20px;
}
.bi-search-editor .search-font {
font-size: 20px;
}
/****添加计算宽度的--运算符直接需要space****/
/****** common color(常用颜色,可用于普遍场景) *****/
/**** custom color(自定义颜色,用于特定场景) ****/
/*************BI.SearchEditor******************/
.bi-small-search-editor .bi-editor {
font-size: 12px;
}
.bi-small-search-editor .bi-editor .bi-input {
font-size: 12px;
}
.bi-small-search-editor .bi-editor .bi-label {
font-size: 12px;
}
.bi-small-search-editor .close-font {
font-size: 18px;
}
.bi-small-search-editor .search-font {
font-size: 18px;
}
/****添加计算宽度的--运算符直接需要space****/
/****** common color(常用颜色,可用于普遍场景) *****/
/**** custom color(自定义颜色,用于特定场景) ****/
.bi-sign-initial-editor .sign-initial-editor-text {
font-size: 14px;
}
/****添加计算宽度的--运算符直接需要space****/
/****** common color(常用颜色,可用于普遍场景) *****/
/**** custom color(自定义颜色,用于特定场景) ****/
.bi-sign-style-editor .sign-style-editor-text {
max-width: 100%;
font-size: 12px;
}
.bi-sign-style-editor .sign-style-editor-tip {
max-width: 100%;
font-size: 12px;
color: #808080;
}
/****添加计算宽度的--运算符直接需要space****/
/****** common color(常用颜色,可用于普遍场景) *****/
/**** custom color(自定义颜色,用于特定场景) ****/
.bi-text-editor {
border: 1px solid #d4dadd;
}
/****添加计算宽度的--运算符直接需要space****/
/****** common color(常用颜色,可用于普遍场景) *****/
/**** custom color(自定义颜色,用于特定场景) ****/
/*************BI.SearchEditor******************/
/****** common color(常用颜色,可用于普遍场景) *****/
/**** custom color(自定义颜色,用于特定场景) ****/
.bi-date-trigger {

34338
docs/widget.js

File diff suppressed because it is too large Load Diff

14
src/core/controller/router.floatbox.js

@ -57,19 +57,7 @@ BI.FloatBoxRouter = BI.inherit(BI.WRouter, {
BI.nextTick(function () {
self.close(url);
// view.end();
var t = void 0, isNew = false, keys;
if (isValid) {
keys = modelData.split('.');
BI.each(keys, function (i, k) {
if (i === 0) {
t = context.model.get(k) || (isNew = true);
} else {
t = t[k] || (isNew = true);
}
})
}
isNew && context.model.removeChild(modelData);
!isNew && (context.listenEnd.apply(context, isValid ? keys : [modelData]) !== false) && context.populate();
(context.listenEnd.apply(context, isValid ? modelData.split('.') : [modelData]) !== false) && context.populate();
}, 30)
}).on("change:" + view.cid, _.bind(context.notifyParent, context))
}

230
src/css/core/normalize.css vendored

@ -0,0 +1,230 @@
/*! normalize.css v1.0.0 | MIT License | git.io/normalize */
article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
nav,
section,
summary {
display: block;
}
audio,
canvas,
video {
display: inline-block;
*display: inline;
*zoom: 1;
}
audio:not([controls]) {
display: none;
height: 0;
}
[hidden] {
display: none;
}
html {
font-size: 100%;
-webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%;
}
html,
button,
input,
select,
textarea {
font-family: sans-serif;
}
body {
margin: 0;
}
a:focus {
outline: thin dotted;
}
a:active,
a:hover {
outline: 0;
}
h1 {
font-size: 2em;
margin: 0.67em 0;
}
h2 {
font-size: 1.5em;
margin: 0.83em 0;
}
h3 {
font-size: 1.17em;
margin: 1em 0;
}
h4 {
font-size: 1em;
margin: 1.33em 0;
}
h5 {
font-size: .83em;
margin: 1.67em 0;
}
h6 {
font-size: .75em;
margin: 2.33em 0;
}
abbr[title] {
border-bottom: 1px dotted;
}
b,
strong {
font-weight: bold;
}
blockquote {
margin: 1em 40px;
}
dfn {
font-style: italic;
}
mark {
background: #ff0;
color: #000000;
}
p,
pre {
margin: 1em 0;
}
code,
kbd,
pre,
samp {
font-family: monospace, serif;
_font-family: 'courier new', monospace;
font-size: 1em;
}
pre {
white-space: pre;
white-space: pre-wrap;
word-wrap: break-word;
}
q {
quotes: none;
}
q:before,
q:after {
content: '';
content: none;
}
small {
font-size: 75%;
}
sub,
sup {
font-size: 75%;
line-height: 0;
position: relative;
vertical-align: baseline;
}
sup {
top: -0.5em;
}
sub {
bottom: -0.25em;
}
dl,
menu,
ol,
ul {
margin: 1em 0;
}
dd {
margin: 0 0 0 40px;
}
menu,
ol,
ul {
padding: 0 0 0 40px;
}
nav ul,
nav ol {
list-style: none;
list-style-image: none;
}
img {
border: 0;
-ms-interpolation-mode: bicubic;
}
svg:not(:root) {
overflow: hidden;
}
figure {
margin: 0;
}
form {
margin: 0;
}
fieldset {
border: 1px solid #c0c0c0;
margin: 0 2px;
padding: 0.35em 0.625em 0.75em;
}
legend {
border: 0;
padding: 0;
white-space: normal;
*margin-left: -7px;
}
button,
input,
select,
textarea {
font-size: 100%;
margin: 0;
vertical-align: baseline;
*vertical-align: middle;
}
button,
input {
line-height: normal;
}
button,
html input[type="button"],
input[type="reset"],
input[type="submit"] {
-webkit-appearance: button;
cursor: pointer;
*overflow: visible;
}
button[disabled],
input[disabled] {
cursor: default;
}
input[type="checkbox"],
input[type="radio"] {
box-sizing: border-box;
padding: 0;
*height: 13px;
*width: 13px;
}
input[type="search"] {
-webkit-appearance: textfield;
-moz-box-sizing: content-box;
-webkit-box-sizing: content-box;
box-sizing: content-box;
}
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-decoration {
-webkit-appearance: none;
}
button::-moz-focus-inner,
input::-moz-focus-inner {
border: 0;
padding: 0;
}
textarea {
overflow: auto;
vertical-align: top;
}
table {
border-collapse: collapse;
border-spacing: 0;
}

0
src/css/core/normal.css → src/css/core/normalize2.css

2
src/css/lib/colors.css

@ -1,2 +0,0 @@
/****** common color(常用颜色,可用于普遍场景) *****/
/**** custom color(自定义颜色,用于特定场景) ****/

231
src/less/core/normalize.less vendored

@ -0,0 +1,231 @@
/*! normalize.css v1.0.0 | MIT License | git.io/normalize */
article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
nav,
section,
summary {
display: block
}
audio,
canvas,
video {
display: inline-block;
*display: inline;
*zoom: 1
}
audio:not([controls]) {
display: none;
height: 0
}
[hidden] {
display: none
}
html {
font-size: 100%;
-webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%
}
html,
button,
input,
select,
textarea {
font-family: sans-serif
}
body {
margin: 0
}
a:focus {
outline: thin dotted
}
a:active,
a:hover {
outline: 0
}
h1 {
font-size: 2em;
margin: .67em 0
}
h2 {
font-size: 1.5em;
margin: .83em 0
}
h3 {
font-size: 1.17em;
margin: 1em 0
}
h4 {
font-size: 1em;
margin: 1.33em 0
}
h5 {
font-size: .83em;
margin: 1.67em 0
}
h6 {
font-size: .75em;
margin: 2.33em 0
}
abbr[title] {
border-bottom: 1px dotted
}
b,
strong {
font-weight: bold
}
blockquote {
margin: 1em 40px
}
dfn {
font-style: italic
}
mark {
background: #ff0;
color: #000
}
p,
pre {
margin: 1em 0
}
code,
kbd,
pre,
samp {
font-family: monospace, serif;
_font-family: 'courier new', monospace;
font-size: 1em
}
pre {
white-space: pre;
white-space: pre-wrap;
word-wrap: break-word
}
q {
quotes: none
}
q:before,
q:after {
content: '';
content: none
}
small {
font-size: 75%
}
sub,
sup {
font-size: 75%;
line-height: 0;
position: relative;
vertical-align: baseline
}
sup {
top: -0.5em
}
sub {
bottom: -0.25em
}
dl,
menu,
ol,
ul {
margin: 1em 0
}
dd {
margin: 0 0 0 40px
}
menu,
ol,
ul {
padding: 0 0 0 40px
}
nav ul,
nav ol {
list-style: none;
list-style-image: none
}
img {
border: 0;
-ms-interpolation-mode: bicubic
}
svg:not(:root) {
overflow: hidden
}
figure {
margin: 0
}
form {
margin: 0
}
fieldset {
border: 1px solid #c0c0c0;
margin: 0 2px;
padding: .35em .625em .75em
}
legend {
border: 0;
padding: 0;
white-space: normal;
*margin-left: -7px
}
button,
input,
select,
textarea {
font-size: 100%;
margin: 0;
vertical-align: baseline;
*vertical-align: middle
}
button,
input {
line-height: normal
}
button,
html input[type="button"],
input[type="reset"],
input[type="submit"] {
-webkit-appearance: button;
cursor: pointer;
*overflow: visible
}
button[disabled],
input[disabled] {
cursor: default
}
input[type="checkbox"],
input[type="radio"] {
box-sizing: border-box;
padding: 0;
*height: 13px;
*width: 13px
}
input[type="search"] {
-webkit-appearance: textfield;
-moz-box-sizing: content-box;
-webkit-box-sizing: content-box;
box-sizing: content-box
}
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-decoration {
-webkit-appearance: none
}
button::-moz-focus-inner,
input::-moz-focus-inner {
border: 0;
padding: 0
}
textarea {
overflow: auto;
vertical-align: top
}
table {
border-collapse: collapse;
border-spacing: 0
}

88
src/less/core/normal.less → src/less/core/normalize2.less

@ -1,45 +1,45 @@
@import "../bibase";
html, body, div, ul, ol, li, img, a, span, p, * {
margin: 0;
padding: 0;
}
a {
outline: none;
text-decoration: none;
}
a:focus {
outline: 0;
}
input,
textarea {
margin: 0;
padding: 0;
outline: none;
border: 1px solid @color-bi-border-line;
}
.bi-theme-dark {
input,
textarea {
border: 1px solid @color-bi-border-line-theme-dark;
}
}
ul {
list-style: disc;
}
li {
list-style-type: none;
}
i {
font-style: normal;
-webkit-font-smoothing: antialiased;
-webkit-text-stroke-width: 0.2px;
-moz-osx-font-smoothing: grayscale;
@import "../bibase";
html, body, div, ul, ol, li, img, a, span, p, * {
margin: 0;
padding: 0;
}
a {
outline: none;
text-decoration: none;
}
a:focus {
outline: 0;
}
input,
textarea {
margin: 0;
padding: 0;
outline: none;
border: 1px solid @color-bi-border-line;
}
.bi-theme-dark {
input,
textarea {
border: 1px solid @color-bi-border-line-theme-dark;
}
}
ul {
list-style: disc;
}
li {
list-style-type: none;
}
i {
font-style: normal;
-webkit-font-smoothing: antialiased;
-webkit-text-stroke-width: 0.2px;
-moz-osx-font-smoothing: grayscale;
}

507
src/widget/adaptivearrangement/adaptivearrangement.js

@ -17,8 +17,6 @@ BI.AdaptiveArrangement = BI.inherit(BI.Widget, {
return BI.extend(BI.AdaptiveArrangement.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-adaptive-arrangement",
resizable: true,
isNeedReLayout: true,
isNeedResizeContainer: true,
layoutType: BI.Arrangement.LAYOUT_TYPE.FREE,
items: []
});
@ -30,75 +28,20 @@ BI.AdaptiveArrangement = BI.inherit(BI.Widget, {
this.arrangement = BI.createWidget({
type: "bi.arrangement",
element: this,
isNeedReLayout: o.isNeedReLayout,
layoutType: o.layoutType,
items: o.items
});
this.arrangement.on(BI.Arrangement.EVENT_SCROLL, function () {
self.fireEvent(BI.AdaptiveArrangement.EVENT_SCROLL, arguments);
});
if (o.isNeedResizeContainer) {
var isResizing = false;
var needEnd = false;
var height;
var interval;
var startSize;
var resize = function (e, ui) {
if (isResizing) {
return;
}
isResizing = true;
height = ui.size.height;
interval = setInterval(function () {
height += 40;
self.arrangement.setContainerSize({
width: ui.size.width,
height: height
});
self.arrangement.scrollTo({top: height});
}, 300);
};
this.arrangement.container.element.resizable({
handles: "s",
minWidth: 100,
minHeight: 20,
helper: "bi-resizer",
autoHide: true,
start: function (e, ui) {
startSize = BI.clone(ui.size);
},
resize: function (e, ui) {
if (ui.size.height >= startSize.height - 10) {
resize(e, ui);
} else {
interval && clearInterval(interval);
needEnd = true;
}
},
stop: function (e, ui) {
var size = ui.size;
if (isResizing && !needEnd) {
size.height = height;
}
self.arrangement.setContainerSize(ui.size);
needEnd = false;
isResizing = false;
startSize = null;
interval && clearInterval(interval);
self.fireEvent(BI.AdaptiveArrangement.EVENT_RESIZE);
}
});
this._setLayoutType(o.layoutType);
}
this.zIndex = 0;
BI.each(o.items, function (i, item) {
self._initResizable(item.el);
});
this.element.click(function (e) {
$(document).mousedown(function (e) {
BI.each(self.getAllRegions(), function (i, region) {
if (!region.el.element.__isMouseInBounds__(e)) {
if (region.el.element.find(e.target).length === 0) {
region.el.element.removeClass("selected");
}
});
@ -129,159 +72,65 @@ BI.AdaptiveArrangement = BI.inherit(BI.Widget, {
item.element.mousedown(function () {
self._setSelect(item)
});
o.resizable && item.element.resizable({
handles: "e, s, se",
minWidth: 20,
minHeight: 20,
autoHide: true,
helper: "bi-resizer",
start: function () {
item.element.css("zIndex", ++self.zIndex);
self.fireEvent(BI.AdaptiveArrangement.EVENT_ELEMENT_START_RESIZE);
},
resize: function (e, ui) {
// self._resize(item.attr("id"), ui.size);
self._resize(item.attr("id"), ui.size);
self.fireEvent(BI.AdaptiveArrangement.EVENT_ELEMENT_RESIZE, item.attr("id"), ui.size);
},
stop: function (e, ui) {
self._stopResize(item.attr("id"), ui.size);
self.fireEvent(BI.AdaptiveArrangement.EVENT_ELEMENT_STOP_RESIZE, item.attr("id"), ui.size);
self.fireEvent(BI.AdaptiveArrangement.EVENT_RESIZE);
}
});
// o.resizable && item.element.resizable({
// handles: "e, s, se",
// minWidth: 20,
// minHeight: 20,
// autoHide: true,
// helper: "bi-resizer",
// start: function () {
// item.element.css("zIndex", ++self.zIndex);
// self.fireEvent(BI.AdaptiveArrangement.EVENT_ELEMENT_START_RESIZE);
// },
// resize: function (e, ui) {
// // self._resize(item.attr("id"), ui.size);
// self._resize(item.attr("id"), e, ui.size, ui.position);
// },
// stop: function (e, ui) {
// self._stopResize(item.attr("id"), ui.size);
// self.fireEvent(BI.AdaptiveArrangement.EVENT_ELEMENT_STOP_RESIZE, item.attr("id"), ui.size);
// self.fireEvent(BI.AdaptiveArrangement.EVENT_RESIZE);
// }
// });
},
_resize: function (name, size) {
var self = this;
switch (this.getLayoutType()) {
case BI.Arrangement.LAYOUT_TYPE.ADAPTIVE:
break;
case BI.Arrangement.LAYOUT_TYPE.FREE:
break;
case BI.Arrangement.LAYOUT_TYPE.GRID:
this.setRegionSize(name, size);
break;
}
},
_stopResize: function (name, size) {
var self = this;
switch (this.getLayoutType()) {
case BI.Arrangement.LAYOUT_TYPE.ADAPTIVE:
this.setRegionSize(name, {
width: size.width,
height: size.height
});
break;
case BI.Arrangement.LAYOUT_TYPE.FREE:
this.setRegionSize(name, size);
break;
case BI.Arrangement.LAYOUT_TYPE.GRID:
this.setRegionSize(name, size);
break;
}
},
//检查宽高是否规范
_checkRegionSize: function (name, size) {
var self = this;
switch (this.getLayoutType()) {
case BI.Arrangement.LAYOUT_TYPE.ADAPTIVE:
var newSize = {};
var leftid, rightid, topid, bottomid;
var region = this.getRegionByName(name);
var rs = this.arrangement._getInDirectRelativeRegions(name, ["right"]).right;
var bs = this.arrangement._getInDirectRelativeRegions(name, ["bottom"]).bottom;
if (rs.left.length > 0) {
topid = BI.first(rs.left).id;
bottomid = BI.last(rs.left).id;
}
if (bs.top.length > 0) {
leftid = BI.first(bs.top).id;
rightid = BI.last(bs.top).id;
}
if (this.arrangement._isEqual(region.width, size.width)) {
topid = name;
bottomid = name;
}
if (this.arrangement._isEqual(region.height, size.height)) {
leftid = name;
rightid = name;
}
var tops = topid ? this.getDirectRelativeRegions(topid, ["top"]).top : [];
var bottoms = bottomid ? this.getDirectRelativeRegions(bottomid, ["bottom"]).bottom : [];
var lefts = leftid ? this.getDirectRelativeRegions(leftid, ["left"]).left : [];
var rights = rightid ? this.getDirectRelativeRegions(rightid, ["right"]).right : [];
if (region.width !== size.width) {
if (rights.length === 0) {//最右边的组件不能调整宽度
newSize.width = region.width;
} else {
var finded = BI.find(tops.concat(bottoms), function (i, r) {
r = self.getRegionByName(r.id);
return Math.abs(size.width + region.left - (r.left + r.width)) <= 3;
});
if (finded) {
finded = this.getRegionByName(finded.id);
newSize.width = finded.left + finded.width - region.left;
} else {
newSize.width = size.width;
}
}
} else {
newSize.width = size.width;
}
if (region.height !== size.height) {
if (bottoms.length === 0) {
newSize.height = region.height;
} else {
var finded = BI.find(lefts.concat(rights), function (i, r) {
r = self.getRegionByName(r.id);
return Math.abs(size.height + region.top - (r.top + r.height)) <= 3;
});
if (finded) {
finded = this.getRegionByName(finded.id);
newSize.height = finded.top + finded.height - region.top;
} else {
newSize.height = size.height;
}
}
} else {
newSize.height = size.height;
}
return newSize;
case BI.Arrangement.LAYOUT_TYPE.FREE:
return size;
case BI.Arrangement.LAYOUT_TYPE.GRID:
return size;
}
},
// _resize: function (name, e, size, position) {
// var self = this;
// this.scrollInterval(e, false, true, function (changedSize) {
// size.width += changedSize.offsetX;
// size.height += changedSize.offsetY;
// var containerWidth = self.arrangement.container.element.width();
// var containerHeight = self.arrangement.container.element.height();
// self.arrangement.container.element.width(containerWidth + changedSize.offsetX);
// self.arrangement.container.element.height(containerHeight + changedSize.offsetY);
// switch (self.getLayoutType()) {
// case BI.Arrangement.LAYOUT_TYPE.FREE:
// break;
// case BI.Arrangement.LAYOUT_TYPE.GRID:
// self.setRegionSize(name, size);
// break;
// }
// self.fireEvent(BI.AdaptiveArrangement.EVENT_ELEMENT_RESIZE, name, size);
// });
// },
//
// _stopResize: function (name, size) {
// var self = this;
// this.scrollEnd();
// switch (this.getLayoutType()) {
// case BI.Arrangement.LAYOUT_TYPE.FREE:
// this.setRegionSize(name, size);
// break;
// case BI.Arrangement.LAYOUT_TYPE.GRID:
// this.setRegionSize(name, size);
// break;
// }
// },
_getScrollOffset: function () {
return this.arrangement._getScrollOffset();
},
_setLayoutType: function (type) {
try {
//BI.nextTick(function () {
switch (type) {
case BI.Arrangement.LAYOUT_TYPE.ADAPTIVE:
$(">.ui-resizable-s", this.arrangement.container.element).css("zIndex", "");
break;
case BI.Arrangement.LAYOUT_TYPE.FREE:
$(">.ui-resizable-s", this.arrangement.container.element).css("zIndex", "-1");
break;
case BI.Arrangement.LAYOUT_TYPE.GRID:
$(">.ui-resizable-s", this.arrangement.container.element).css("zIndex", "-1");
break;
}
this.arrangement.container.element.resizable("option", "disabled", type === BI.Arrangement.LAYOUT_TYPE.FREE);
//});
} catch (e) {
}
},
getClientWidth: function () {
return this.arrangement.getClientWidth();
},
@ -290,97 +139,13 @@ BI.AdaptiveArrangement = BI.inherit(BI.Widget, {
return this.arrangement.getClientHeight();
},
getDirectRelativeRegions: function (name, direction) {
return this.arrangement.getDirectRelativeRegions(name, direction);
},
addRegion: function (region, position) {
this._initResizable(region.el);
this._setSelect(region.el);
var self = this, flag;
var old = this.arrangement.getAllRegions();
if (BI.isNotNull(this.position)) {
switch (this.getLayoutType()) {
case BI.Arrangement.LAYOUT_TYPE.ADAPTIVE:
var type = this.position.type;
var current = this.position.region;
switch (type) {
case "top-gap":
var t = this.arrangement._getEquivalentRelativeRegions(current.id, ["top"])[0];
current = this.getRegionByName(t.id);
break;
case "bottom-gap":
break;
}
var id = BI.UUID();
var insert = this.position.insert;
if (insert.height > 0) {
var clone = this.arrangement._cloneRegion();
//找到最下面的组件
var occupied = this.arrangement._getRegionOccupied();
var bottomRegions = [];
BI.each(clone, function (i, region) {
if (self.arrangement._isEqual(region.top + region.height, occupied.top + occupied.height)) {
bottomRegions.push(region);
}
});
var bs = this.arrangement._getInDirectRelativeRegions(current.id, ["bottom"]).bottom;
var seen = [current.id];
var bottoms = bs.bottom;
var occ = this.arrangement._getRegionOccupied(bottoms);
clone[id] = BI.extend({}, region, {
left: occ.left,
width: occ.width,
top: current.top + current.height,
height: insert.height
});
while (bottoms.length > 0) {
BI.each(bottoms, function (i, bottom) {
seen.push(bottom.id);
var r = self.getRegionByName(bottom.id);
BI.extend(clone[bottom.id], {
top: r.top + insert.height
});
});
var t = [];
BI.each(bottoms, function (i, bottom) {
var n = self.arrangement._getInDirectRelativeRegions(bottom.id, ["bottom"]).bottom;
BI.each(n.top, function (i, region) {
if (!seen.contains(region.id)) {
seen.push(region.id);
var r = self.getRegionByName(region.id);
BI.extend(clone[region.id], {
height: r.height + insert.height
});
}
});
t = t.concat(n.bottom);
});
t = BI.uniq(t, function (i, region) {
return region.id;
});
bottoms = t;
}
BI.each(bottomRegions, function (i, region) {
if (!seen.contains(region.id)) {
region.height = region.height + insert.height;
}
});
this.arrangement.populate(BI.toArray(clone));
this.arrangement.resize();
flag = true;
}
break;
case BI.Arrangement.LAYOUT_TYPE.FREE:
break;
case BI.Arrangement.LAYOUT_TYPE.GRID:
break;
}
this.position = null;
} else {
if (flag = this.arrangement.addRegion(region, position)) {
this._old = old;
}
if (flag = this.arrangement.addRegion(region, position)) {
this._old = old;
}
return flag;
},
@ -394,13 +159,12 @@ BI.AdaptiveArrangement = BI.inherit(BI.Widget, {
this._old = this.getAllRegions();
this.relayout();
}
return true;
return flag;
},
setRegionSize: function (name, size) {
var flag;
var old = this.getAllRegions();
size = this._checkRegionSize(name, size);
if (flag = this.arrangement.setRegionSize(name, size)) {
this._old = old;
}
@ -409,55 +173,114 @@ BI.AdaptiveArrangement = BI.inherit(BI.Widget, {
setPosition: function (position, size) {
var self = this;
var at = this.arrangement.setPosition(position, size);
this.position = null;
if (!at) {
switch (this.getLayoutType()) {
case BI.Arrangement.LAYOUT_TYPE.ADAPTIVE:
if (position.left < 0 || position.top < 0) {
return null;
return this.arrangement.setPosition(position, size);
},
setRegionPosition: function (name, position) {
var region = this.getRegionByName(name);
return this.arrangement.setRegionPosition(name, position);
},
setDropPosition: function (position, size) {
return this.arrangement.setDropPosition(position, size);
},
scrollInterval: function (e, isBorderScroll, isOverflowScroll, cb) {
var self = this;
var map = {
top: [-1, 0],
bottom: [1, 0],
left: [0, -1],
right: [0, 1]
};
var clientSize = this.element.bounds();
function scrollTo(direction, callback) {
if (direction === "") {
self.lastActiveRegion = "";
if (self._scrollInterval) {
clearInterval(self._scrollInterval);
self._scrollInterval = null;
}
return;
}
if (self.lastActiveRegion !== direction) {
self.lastActiveRegion = direction;
if (self._scrollInterval) {
clearInterval(self._scrollInterval);
self._scrollInterval = null;
}
self._scrollInterval = setInterval(function () {
var offset = self._getScrollOffset();
var t = offset.top + map[direction][0] * 40;
var l = offset.left + map[direction][1] * 40;
if (t < 0 || l < 0) {
return;
}
var offset = this.arrangement._getScrollOffset();
position = {
left: position.left + offset.left,
top: position.top + offset.top
};
BI.some(this.getAllRegions(), function (id, region) {
if (self.arrangement._isPositionInBounds(position, region)) {
var at = self.arrangement._positionAt(position, region);
if (at.type === "top-gap" || at.type === "bottom-gap") {
self.arrangement._setArrangeSize({
top: region.top - 8 + (at.type === "bottom-gap" ? region.height : 0),
left: region.left,
width: region.width,
height: 16
});
self.position = {
insert: {
height: (size || {}).height
},
type: at.type,
region: region
};
self.arrangement._start();
}
return true;
}
callback({
offsetX: map[direction][1] * 40,
offsetY: map[direction][0] * 40
});
self.scrollTo({
top: t,
left: l
});
break;
case BI.Arrangement.LAYOUT_TYPE.FREE:
break;
case BI.Arrangement.LAYOUT_TYPE.GRID:
break;
}, 300);
}
}
cb({
offsetX: 0,
offsetY: 0
});
var offset = this.element.offset();
var p = {
left: e.pageX - offset.left,
top: e.pageY - offset.top
};
//向上滚
if (isBorderScroll && p.top >= 0 && p.top <= 30) {
scrollTo("top", cb)
}
//向下滚
else if (isBorderScroll && p.top >= clientSize.height - 30 && p.top <= clientSize.height) {
scrollTo("bottom", cb)
}
//向左滚
else if (isBorderScroll && p.left >= 0 && p.left <= 30) {
scrollTo("left", cb)
}
//向右滚
else if (isBorderScroll && p.left >= clientSize.width - 30 && p.left <= clientSize.width) {
scrollTo("right", cb)
} else {
if (isOverflowScroll === true) {
if (p.top < 0) {
scrollTo("top", cb);
}
else if (p.top > clientSize.height) {
scrollTo("bottom", cb);
}
else if (p.left < 0) {
scrollTo("left", cb);
}
else if (p.left > clientSize.width) {
scrollTo("right", cb);
} else {
scrollTo("", cb);
}
} else {
scrollTo("", cb);
}
}
return this.position || at;
},
setRegionPosition: function (name, position) {
var region = this.getRegionByName(name);
region.el.element.css("zIndex", ++this.zIndex);
return this.arrangement.setRegionPosition(name, position);
scrollEnd: function () {
this.lastActiveRegion = "";
if (this._scrollInterval) {
clearInterval(this._scrollInterval);
this._scrollInterval = null;
}
},
scrollTo: function (scroll) {
@ -478,7 +301,6 @@ BI.AdaptiveArrangement = BI.inherit(BI.Widget, {
setLayoutType: function (type) {
var self = this;
this._setLayoutType(type);
this.arrangement.setLayoutType(type);
},
@ -514,17 +336,6 @@ BI.AdaptiveArrangement = BI.inherit(BI.Widget, {
self._initResizable(item.el);
});
this.arrangement.populate(items);
switch (this.getLayoutType()) {
case BI.Arrangement.LAYOUT_TYPE.ADAPTIVE:
BI.nextTick(function () {
self.arrangement.resize();
});
break;
case BI.Arrangement.LAYOUT_TYPE.FREE:
break;
case BI.Arrangement.LAYOUT_TYPE.GRID:
break;
}
}
});
BI.AdaptiveArrangement.EVENT_ELEMENT_START_RESIZE = "AdaptiveArrangement.EVENT_ELEMENT_START_RESIZE";

6
src/widget/arrangement/arrangement.block.js

@ -11,12 +11,6 @@ BI.ArrangementBlock = BI.inherit(BI.Widget, {
return BI.extend(BI.ArrangementBlock.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-arrangement-block bi-mask"
});
},
_init: function () {
BI.ArrangementBlock.superclass._init.apply(this, arguments);
var self = this, o = this.options;
}
});
BI.shortcut('bi.arrangement_block', BI.ArrangementBlock);

6
src/widget/arrangement/arrangement.droppable.js

@ -11,12 +11,6 @@ BI.ArrangementDroppable = BI.inherit(BI.Widget, {
return BI.extend(BI.ArrangementDroppable.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-arrangement-droppable bi-resizer"
});
},
_init: function () {
BI.ArrangementDroppable.superclass._init.apply(this, arguments);
var self = this, o = this.options;
}
});
BI.shortcut('bi.arrangement_droppable', BI.ArrangementDroppable);

2158
src/widget/arrangement/arrangement.js

File diff suppressed because it is too large Load Diff

43
src/widget/interactivearrangement/interactivearrangement.js

@ -12,9 +12,7 @@ BI.InteractiveArrangement = BI.inherit(BI.Widget, {
return BI.extend(BI.InteractiveArrangement.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-interactive-arrangement",
resizable: true,
isNeedReLayout: true,
isNeedResizeContainer: true,
layoutType: BI.Arrangement.LAYOUT_TYPE.FREE,
layoutType: BI.Arrangement.LAYOUT_TYPE.GRID,
items: []
});
},
@ -26,8 +24,6 @@ BI.InteractiveArrangement = BI.inherit(BI.Widget, {
type: "bi.adaptive_arrangement",
element: this,
resizable: o.resizable,
isNeedReLayout: o.isNeedReLayout,
isNeedResizeContainer: o.isNeedResizeContainer,
layoutType: o.layoutType,
items: o.items
});
@ -439,7 +435,6 @@ BI.InteractiveArrangement = BI.inherit(BI.Widget, {
var self = this;
this.stopDraw();
switch (this.getLayoutType()) {
case BI.Arrangement.LAYOUT_TYPE.ADAPTIVE:
case BI.Arrangement.LAYOUT_TYPE.FREE:
var other = this._getRegionExcept(name);
var left = this._leftAlign(position, size, other);
@ -473,10 +468,6 @@ BI.InteractiveArrangement = BI.inherit(BI.Widget, {
}
},
getDirectRelativeRegions: function (name, direction) {
return this.arrangement.getDirectRelativeRegions(name, direction);
},
addRegion: function (region, position) {
this.stopDraw();
return this.arrangement.addRegion(region, position);
@ -496,8 +487,6 @@ BI.InteractiveArrangement = BI.inherit(BI.Widget, {
this.stopDraw();
if (position.left > 0 && position.top > 0) {
switch (this.getLayoutType()) {
case BI.Arrangement.LAYOUT_TYPE.ADAPTIVE:
break;
case BI.Arrangement.LAYOUT_TYPE.FREE:
position = this.getPosition(null, position, size);
this.draw(position, size);
@ -513,8 +502,6 @@ BI.InteractiveArrangement = BI.inherit(BI.Widget, {
setRegionPosition: function (name, position) {
if (position.left > 0 && position.top > 0) {
switch (this.getLayoutType()) {
case BI.Arrangement.LAYOUT_TYPE.ADAPTIVE:
break;
case BI.Arrangement.LAYOUT_TYPE.FREE:
position = this.getPosition(name, position);
break;
@ -525,6 +512,34 @@ BI.InteractiveArrangement = BI.inherit(BI.Widget, {
return this.arrangement.setRegionPosition(name, position);
},
setDropPosition: function (position, size) {
var self = this;
this.stopDraw();
if (position.left > 0 && position.top > 0) {
switch (this.getLayoutType()) {
case BI.Arrangement.LAYOUT_TYPE.FREE:
position = this.getPosition(null, position, size);
this.draw(position, size);
break;
case BI.Arrangement.LAYOUT_TYPE.GRID:
break;
}
}
var callback = self.arrangement.setDropPosition(position, size);
return function () {
callback();
self.stopDraw();
}
},
scrollInterval: function () {
this.arrangement.scrollInterval.apply(this.arrangement, arguments);
},
scrollEnd: function () {
this.arrangement.scrollEnd.apply(this.arrangement, arguments);
},
scrollTo: function (scroll) {
this.arrangement.scrollTo(scroll);
},

Loading…
Cancel
Save