From c407eb91cac2b8cffbd24fb279f6a86f862cafb3 Mon Sep 17 00:00:00 2001 From: guy Date: Wed, 22 Mar 2017 15:46:21 +0800 Subject: [PATCH 1/5] add --- demo.html | 2 + src/css/base/segment/segment.css | 1 + .../base/single/editor/editor.textarea.css | 1 + src/css/base/single/text.css | 1 + src/css/lib/animate.css | 4 +- src/css/utils/overflow.css | 1 + .../toolbar/toolbar.progress.processor.css | 1 + .../dynamicnumber.sequencetable.css | 1 + .../listnumber.sequencetable.css | 1 + .../treenumber.sequencetable.css | 1 + src/less/typographic.less | 3 + src/less/visual.less | 175 +++++++++++++++--- 12 files changed, 169 insertions(+), 23 deletions(-) diff --git a/demo.html b/demo.html index 20808e0f0..42110f141 100644 --- a/demo.html +++ b/demo.html @@ -8,6 +8,8 @@ href="./dist/core.css"/> + diff --git a/src/css/base/segment/segment.css b/src/css/base/segment/segment.css index f00f80ed6..11ddb87d9 100644 --- a/src/css/base/segment/segment.css +++ b/src/css/base/segment/segment.css @@ -2,6 +2,7 @@ /****** common color(常用颜色,可用于普遍场景) *****/ /**** custom color(自定义颜色,用于特定场景) ****/ .bi-segment > .center-element { + overflow: hidden; overflow-x: hidden; overflow-y: hidden; background: #ffffff; diff --git a/src/css/base/single/editor/editor.textarea.css b/src/css/base/single/editor/editor.textarea.css index 8544a6b47..150d4a224 100644 --- a/src/css/base/single/editor/editor.textarea.css +++ b/src/css/base/single/editor/editor.textarea.css @@ -2,6 +2,7 @@ /****** common color(常用颜色,可用于普遍场景) *****/ /**** custom color(自定义颜色,用于特定场景) ****/ .bi-textarea-editor { + overflow: hidden; overflow-x: hidden; overflow-y: hidden; } diff --git a/src/css/base/single/text.css b/src/css/base/single/text.css index 0128c7c7c..34613e8aa 100644 --- a/src/css/base/single/text.css +++ b/src/css/base/single/text.css @@ -4,6 +4,7 @@ .bi-text { text-overflow: ellipsis; overflow-x: hidden; + overflow-y: hidden; white-space: nowrap; word-break: break-all; } diff --git a/src/css/lib/animate.css b/src/css/lib/animate.css index 6f71778c1..05756ce92 100644 --- a/src/css/lib/animate.css +++ b/src/css/lib/animate.css @@ -2201,14 +2201,14 @@ } } @-webkit-keyframes zoomInUp { - from { + from { opacity: 0; -webkit-transform: scale3d(0.1, 0.1, 0.1) translate3d(0, 1000px, 0); transform: scale3d(0.1, 0.1, 0.1) translate3d(0, 1000px, 0); -webkit-animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); } - 60% { + 60% { opacity: 1; -webkit-transform: scale3d(0.475, 0.475, 0.475) translate3d(0, -60px, 0); transform: scale3d(0.475, 0.475, 0.475) translate3d(0, -60px, 0); diff --git a/src/css/utils/overflow.css b/src/css/utils/overflow.css index a8687e25f..c7feb6550 100644 --- a/src/css/utils/overflow.css +++ b/src/css/utils/overflow.css @@ -36,5 +36,6 @@ .overflow-dot { text-overflow: ellipsis; overflow-x: hidden; + overflow-y: hidden; white-space: nowrap; } diff --git a/src/css/widget/base/toolbar/toolbar.progress.processor.css b/src/css/widget/base/toolbar/toolbar.progress.processor.css index 552b25476..85df88113 100644 --- a/src/css/widget/base/toolbar/toolbar.progress.processor.css +++ b/src/css/widget/base/toolbar/toolbar.progress.processor.css @@ -6,6 +6,7 @@ -webkit-border-radius: 20px; -moz-border-radius: 20px; border-radius: 20px; + overflow: hidden; overflow-x: hidden; overflow-y: hidden; } diff --git a/src/css/widget/sequencetable/dynamicnumber.sequencetable.css b/src/css/widget/sequencetable/dynamicnumber.sequencetable.css index 059def484..fed0aa1c3 100644 --- a/src/css/widget/sequencetable/dynamicnumber.sequencetable.css +++ b/src/css/widget/sequencetable/dynamicnumber.sequencetable.css @@ -2,6 +2,7 @@ /****** common color(常用颜色,可用于普遍场景) *****/ /**** custom color(自定义颜色,用于特定场景) ****/ .bi-sequence-table-dynamic-number .sequence-table-title-cell { + overflow: hidden; overflow-x: hidden; overflow-y: hidden; -webkit-box-sizing: border-box; diff --git a/src/css/widget/sequencetable/listnumber.sequencetable.css b/src/css/widget/sequencetable/listnumber.sequencetable.css index bd987fced..dace5ccd1 100644 --- a/src/css/widget/sequencetable/listnumber.sequencetable.css +++ b/src/css/widget/sequencetable/listnumber.sequencetable.css @@ -2,6 +2,7 @@ /****** common color(常用颜色,可用于普遍场景) *****/ /**** custom color(自定义颜色,用于特定场景) ****/ .bi-sequence-table-list-number .sequence-table-title-cell { + overflow: hidden; overflow-x: hidden; overflow-y: hidden; -webkit-box-sizing: border-box; diff --git a/src/css/widget/sequencetable/treenumber.sequencetable.css b/src/css/widget/sequencetable/treenumber.sequencetable.css index 616a45cfc..be1c1be2a 100644 --- a/src/css/widget/sequencetable/treenumber.sequencetable.css +++ b/src/css/widget/sequencetable/treenumber.sequencetable.css @@ -2,6 +2,7 @@ /****** common color(常用颜色,可用于普遍场景) *****/ /**** custom color(自定义颜色,用于特定场景) ****/ .bi-sequence-table-tree-number .sequence-table-title-cell { + overflow: hidden; overflow-x: hidden; overflow-y: hidden; -webkit-box-sizing: border-box; diff --git a/src/less/typographic.less b/src/less/typographic.less index 4a2149c3f..f2cb38f7e 100644 --- a/src/less/typographic.less +++ b/src/less/typographic.less @@ -9,17 +9,20 @@ } .overflow-auto(){ + overflow: auto; overflow-x: auto; overflow-y: auto; } .overflow-hidden(){ + overflow: hidden; overflow-x: hidden; overflow-y: hidden; } .overflow-dot(){ text-overflow:ellipsis; overflow-x: hidden; + overflow-y: hidden; white-space:nowrap; } .user-select(@select){ diff --git a/src/less/visual.less b/src/less/visual.less index 0e943dc42..8865353bb 100644 --- a/src/less/visual.less +++ b/src/less/visual.less @@ -1,37 +1,49 @@ -.text-shadow(none){ +.text-shadow(none) { text-shadow: none; -moz-text-shadow: none; -webkit-text-shadow: none; } -.text-shadow(@x, @y, @blur, @color) when not (@x = none){ + +.text-shadow(@x, @y, @blur, @color) when not (@x = none) { text-shadow: @arguments; -moz-text-shadow: @arguments; -webkit-text-shadow: @arguments; } -.box-shadow(none){ + +.box-shadow(none) { box-shadow: none; -webkit-box-shadow: none; -moz-box-shadow: none; } + .box-shadow(@style, @c) when (iscolor(@c)) { -webkit-box-shadow: @style @c; -moz-box-shadow: @style @c; box-shadow: @style @c; } + .box-shadow(@x, @y, @blur, @spreed: 0px, @color, @inset: outset) when (iscolor(@color)) and (isnumber(unit(@spreed))){ box-shadow: @arguments; -webkit-box-shadow: @arguments; -moz-box-shadow: @arguments; } -.opacity(@opa){ +.opacity(@opa) { opacity: @opa; - @opa-ie:@opa*100; + @opa-ie: @opa*100; filter: ~'alpha(opacity=@{opa-ie})'; } + +.transition(@transition) { + -webkit-transition: @transition; + -moz-transition: @transition; + -o-transition: @transition; + transition: @transition; +} + //渐变 -.gradient(@start, @end){ - background: @start; //不支持的用这个 +.gradient(@start, @end) { + background: @start; //不支持的用这个 background: -webkit-gradient(linear, 0 0, 0 100%, from(@start) to(@end)); /*old webkit*/ background: -webkit-linear-gradient(@start, @end); /*new webkit*/ background: -moz-linear-gradient(@start, @end); /*gecko*/ @@ -40,49 +52,170 @@ background: linear-gradient(@start, @end); /*future CSS3 browsers*/ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='@{start}', endColorstr='@{end}', GradientType='0'); } -.border-radius(@radius: 5px){ + +.border-radius(@radius: 5px) { -webkit-border-radius: @radius; -moz-border-radius: @radius; border-radius: @radius; } -.border-corner-top-radius(@leftTop, @rightTop){ + +.border-corner-top-radius(@leftTop, @rightTop) { -moz-border-radius-topleft: @leftTop; -webkit-border-top-left-radius: @leftTop; -moz-border-radius-topright: @rightTop; -webkit-border-top-right-radius: @rightTop; - border-top-left-radius:@leftTop; - border-top-right-radius:@rightTop; + border-top-left-radius: @leftTop; + border-top-right-radius: @rightTop; } -.border-corner-bottom-radius(@leftBottom, @rightBottom){ + +.border-corner-bottom-radius(@leftBottom, @rightBottom) { -moz-border-radius-bottomleft: @rightBottom; -webkit-border-bottom-left-radius: @rightBottom; -moz-border-radius-bottomright: @leftBottom; -webkit-border-bottom-right-radius: @rightBottom; - border-bottom-right-radius:@rightBottom; - border-bottom-left-radius:@leftBottom; + border-bottom-right-radius: @rightBottom; + border-bottom-left-radius: @leftBottom; } -.border-corner-left-radius(@leftTop, @leftBottom){ + +.border-corner-left-radius(@leftTop, @leftBottom) { -moz-border-radius-topleft: @leftTop; -webkit-border-top-left-radius: @leftTop; -moz-border-radius-bottomleft: @leftBottom; -webkit-border-bottom-left-radius: @leftBottom; - border-top-left-radius:@leftTop; - border-bottom-left-radius:@leftBottom; + border-top-left-radius: @leftTop; + border-bottom-left-radius: @leftBottom; } -.border-corner-right-radius(@rightTop, @rightBottom){ + +.border-corner-right-radius(@rightTop, @rightBottom) { -moz-border-radius-topright: @rightTop; -webkit-border-top-right-radius: @rightTop; -moz-border-radius-bottomright: @rightBottom; -webkit-border-bottom-right-radius: @rightBottom; - border-top-right-radius:@rightTop; - border-bottom-right-radius:@rightBottom; + border-top-right-radius: @rightTop; + border-bottom-right-radius: @rightBottom; } -.border-corner-radius(@leftTop, @rightTop, @rightBottom, @leftBottom){ + +.border-corner-radius(@leftTop, @rightTop, @rightBottom, @leftBottom) { -webkit-border-radius: @arguments; -moz-border-radius: @arguments; border-radius: @arguments; +} + +@sideHeight: 6px; +@sideLength: 12px; +.solid-triangle-up(@color) { + width: 0; + height: 0; + border-left: (@sideLength/2) solid transparent; + border-right: (@sideLength/2) solid transparent; + border-bottom: @sideHeight solid @color; +} + +.solid-triangle-down(@color) { + width: 0; + height: 0; + border-left: (@sideLength/2) solid transparent; + border-right: (@sideLength/2) solid transparent; + border-top: @sideHeight solid @color; +} + +.solid-triangle-left(@color) { + width: 0; + height: 0; + border-top: (@sideLength/2) solid transparent; + border-right: @sideHeight solid @color; + border-bottom: (@sideLength/2) solid transparent; +} + +.solid-triangle-right(@color) { + width: 0; + height: 0; + border-top: (@sideLength/2) solid transparent; + border-left: @sideHeight solid @color; + border-bottom: (@sideLength/2) solid transparent; +} + +.solid-triangle-top-left(@color) { + width: 0; + height: 0; + border-top: @sideHeight solid @color; + border-right: @sideHeight solid transparent; +} + +.solid-triangle-top-right(@color) { + width: 0; + height: 0; + border-top: @sideHeight solid @color; + border-left: @sideHeight solid transparent; +} + +.solid-triangle-bottom-left(@color) { + width: 0; + height: 0; + border-bottom: @sideHeight solid @color; + border-right: @sideHeight solid transparent; +} + +.solid-triangle-bottom-right(@color) { + width: 0; + height: 0; + border-bottom: @sideHeight solid @color; + border-left: @sideHeight solid transparent; +} + +.triangle-top() { + position: absolute; + width: 16px; + height: 10px; + border-bottom: 1px solid #f5f5f5; + + &:before { + position: absolute; + top: 0px; + right: 0px; + bottom: 0px; + border-bottom: 10px solid #ccc; + border-left: 8px solid transparent; + border-right: 8px solid transparent; + content: ""; + } + &:after { + position: absolute; + right: 1px; + top: 1px; + bottom: 0px; + border-bottom: 9px solid #f5f5f5; + border-left: 7px solid transparent; + border-right: 7px solid transparent; + content: ""; + } +} + +.triangle-bottom() { + position: absolute; + width: 16px; + height: 10px; + border-top: 1px solid #f5f5f5; + + &:after { + position: absolute; + right: 1px; + top: -1px; + border-top: 9px solid #f5f5f5; + border-left: 7px solid transparent; + border-right: 7px solid transparent; + content: ""; + } + &:before { + position: absolute; + border-top: 10px solid #cccccc; + border-left: 8px solid transparent; + border-right: 8px solid transparent; + content: ""; + } + } \ No newline at end of file From e1ca98c4bb6bcf1f2e216ecab4fd7902abc0f0ae Mon Sep 17 00:00:00 2001 From: guy Date: Wed, 22 Mar 2017 15:47:39 +0800 Subject: [PATCH 2/5] add --- demo.html | 1 - dist/base.css | 34 ++++++++++++++++++++++++++++++++++ dist/core.css | 1 + dist/core.js | 4 ++-- dist/widget.css | 4 ++++ src/core/func/function.js | 4 ++-- 6 files changed, 43 insertions(+), 5 deletions(-) diff --git a/demo.html b/demo.html index 42110f141..ffc2d3dfb 100644 --- a/demo.html +++ b/demo.html @@ -21,7 +21,6 @@
-
diff --git a/dist/base.css b/dist/base.css index 867afd467..534ea1ebe 100644 --- a/dist/base.css +++ b/dist/base.css @@ -73,6 +73,37 @@ /****添加计算宽度的--运算符直接需要space****/ /****** common color(常用颜色,可用于普遍场景) *****/ /**** custom color(自定义颜色,用于特定场景) ****/ +.bi-bubble-combo .bubble-combo-triangle-left { + width: 0; + height: 0; + border-top: 6px solid transparent; + border-left: 6px solid #009de3; + border-bottom: 6px solid transparent; +} +.bi-bubble-combo .bubble-combo-triangle-right { + width: 0; + height: 0; + border-top: 6px solid transparent; + border-right: 6px solid #009de3; + border-bottom: 6px solid transparent; +} +.bi-bubble-combo .bubble-combo-triangle-top { + width: 0; + height: 0; + border-left: 6px solid transparent; + border-right: 6px solid transparent; + border-top: 6px solid #009de3; +} +.bi-bubble-combo .bubble-combo-triangle-bottom { + width: 0; + height: 0; + border-left: 6px solid transparent; + border-right: 6px solid transparent; + border-bottom: 6px solid #009de3; +} +/****添加计算宽度的--运算符直接需要space****/ +/****** common color(常用颜色,可用于普遍场景) *****/ +/**** custom color(自定义颜色,用于特定场景) ****/ .bi-bubble-popup-view { -webkit-box-shadow: 0 0 10px rgba(0, 0, 0, 0.2); -moz-box-shadow: 0 0 10px rgba(0, 0, 0, 0.2); @@ -736,6 +767,7 @@ li.CodeMirror-hint-active { /****** common color(常用颜色,可用于普遍场景) *****/ /**** custom color(自定义颜色,用于特定场景) ****/ .bi-segment > .center-element { + overflow: hidden; overflow-x: hidden; overflow-y: hidden; background: #ffffff; @@ -931,6 +963,7 @@ li.CodeMirror-hint-active { /****** common color(常用颜色,可用于普遍场景) *****/ /**** custom color(自定义颜色,用于特定场景) ****/ .bi-textarea-editor { + overflow: hidden; overflow-x: hidden; overflow-y: hidden; } @@ -982,6 +1015,7 @@ li.CodeMirror-hint-active { .bi-text { text-overflow: ellipsis; overflow-x: hidden; + overflow-y: hidden; white-space: nowrap; word-break: break-all; } diff --git a/dist/core.css b/dist/core.css index c533d6120..30b90d3c5 100644 --- a/dist/core.css +++ b/dist/core.css @@ -9745,6 +9745,7 @@ textarea::-webkit-scrollbar-thumb { .overflow-dot { text-overflow: ellipsis; overflow-x: hidden; + overflow-y: hidden; white-space: nowrap; } /****添加计算宽度的--运算符直接需要space****/ diff --git a/dist/core.js b/dist/core.js index 918dffeab..eeff4ed0b 100644 --- a/dist/core.js +++ b/dist/core.js @@ -22117,7 +22117,7 @@ $(function () { }, getTextSizeWidth: function (text, fontSize) { - var span = $("").addClass("text-width-span").appendTo($("#container")); + var span = $("").addClass("text-width-span").appendTo($("body")); if (fontSize == null) { fontSize = 12; @@ -22139,7 +22139,7 @@ $(function () { position: "absolute", top: "-9999px", overflow: "scroll" - }).appendTo($("#container")); + }).appendTo($("body")); this._scrollWidth = ul[0].offsetWidth - ul[0].clientWidth; ul.destroy(); } diff --git a/dist/widget.css b/dist/widget.css index e7217f5dc..e8ed9dbd0 100644 --- a/dist/widget.css +++ b/dist/widget.css @@ -205,6 +205,7 @@ -webkit-border-radius: 20px; -moz-border-radius: 20px; border-radius: 20px; + overflow: hidden; overflow-x: hidden; overflow-y: hidden; } @@ -1324,6 +1325,7 @@ /****** common color(常用颜色,可用于普遍场景) *****/ /**** custom color(自定义颜色,用于特定场景) ****/ .bi-sequence-table-dynamic-number .sequence-table-title-cell { + overflow: hidden; overflow-x: hidden; overflow-y: hidden; -webkit-box-sizing: border-box; @@ -1353,6 +1355,7 @@ /****** common color(常用颜色,可用于普遍场景) *****/ /**** custom color(自定义颜色,用于特定场景) ****/ .bi-sequence-table-list-number .sequence-table-title-cell { + overflow: hidden; overflow-x: hidden; overflow-y: hidden; -webkit-box-sizing: border-box; @@ -1385,6 +1388,7 @@ /****** common color(常用颜色,可用于普遍场景) *****/ /**** custom color(自定义颜色,用于特定场景) ****/ .bi-sequence-table-tree-number .sequence-table-title-cell { + overflow: hidden; overflow-x: hidden; overflow-y: hidden; -webkit-box-sizing: border-box; diff --git a/src/core/func/function.js b/src/core/func/function.js index 6fbcfa0e3..b59c8eb32 100644 --- a/src/core/func/function.js +++ b/src/core/func/function.js @@ -298,7 +298,7 @@ $(function () { }, getTextSizeWidth: function (text, fontSize) { - var span = $("").addClass("text-width-span").appendTo($("#container")); + var span = $("").addClass("text-width-span").appendTo($("body")); if (fontSize == null) { fontSize = 12; @@ -320,7 +320,7 @@ $(function () { position: "absolute", top: "-9999px", overflow: "scroll" - }).appendTo($("#container")); + }).appendTo($("body")); this._scrollWidth = ul[0].offsetWidth - ul[0].clientWidth; ul.destroy(); } From c223d6c178ac236832ac6cc8c8f565211e0d14f6 Mon Sep 17 00:00:00 2001 From: guy Date: Wed, 22 Mar 2017 15:47:53 +0800 Subject: [PATCH 3/5] add --- src/css/base/combo/combo.bubble.css | 31 +++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 src/css/base/combo/combo.bubble.css diff --git a/src/css/base/combo/combo.bubble.css b/src/css/base/combo/combo.bubble.css new file mode 100644 index 000000000..0c7ee8d0e --- /dev/null +++ b/src/css/base/combo/combo.bubble.css @@ -0,0 +1,31 @@ +/****添加计算宽度的--运算符直接需要space****/ +/****** common color(常用颜色,可用于普遍场景) *****/ +/**** custom color(自定义颜色,用于特定场景) ****/ +.bi-bubble-combo .bubble-combo-triangle-left { + width: 0; + height: 0; + border-top: 6px solid transparent; + border-left: 6px solid #009de3; + border-bottom: 6px solid transparent; +} +.bi-bubble-combo .bubble-combo-triangle-right { + width: 0; + height: 0; + border-top: 6px solid transparent; + border-right: 6px solid #009de3; + border-bottom: 6px solid transparent; +} +.bi-bubble-combo .bubble-combo-triangle-top { + width: 0; + height: 0; + border-left: 6px solid transparent; + border-right: 6px solid transparent; + border-top: 6px solid #009de3; +} +.bi-bubble-combo .bubble-combo-triangle-bottom { + width: 0; + height: 0; + border-left: 6px solid transparent; + border-right: 6px solid transparent; + border-bottom: 6px solid #009de3; +} From d927eb54a6333f82818e2dafebfc10dd39880627 Mon Sep 17 00:00:00 2001 From: guy Date: Wed, 22 Mar 2017 15:52:09 +0800 Subject: [PATCH 4/5] add --- dist/core.js | 127 ++-------------------------------------------- src/core/base.js | 28 +--------- src/core/cache.js | 98 ----------------------------------- 3 files changed, 5 insertions(+), 248 deletions(-) delete mode 100644 src/core/cache.js diff --git a/dist/core.js b/dist/core.js index eeff4ed0b..859c9f544 100644 --- a/dist/core.js +++ b/dist/core.js @@ -12883,7 +12883,7 @@ if (!window.BI) { ; !(function ($, undefined) { _.extend(BI, { - version: "4.0" + version: "2.0" }); var traverse = function (func, context) { return function (value, key, obj) { @@ -12906,7 +12906,7 @@ if (!window.BI) { //Utility _.extend(BI, { i18nText: function (key) { - var localeText = ""; + var localeText = (BI.i18n && BI.i18n[key]) || ""; if (!localeText) { localeText = key; } @@ -12954,30 +12954,6 @@ if (!window.BI) { return widget instanceof BI.Widget || (BI.View && widget instanceof BI.View); }, - createWidget: function (item, options) { - var el; - options || (options = {}); - if (BI.isEmpty(item) && BI.isEmpty(options)) { - return BI.Plugin.getObject("bi.layout", BI.createWidget({ - type: "bi.layout" - })); - } - if (BI.isWidget(item)) { - return item; - } - if (item && (item.type || options.type)) { - el = BI.extend({}, options, item); - return BI.Plugin.getObject(el.type, FR.createWidget(BI.Plugin.getWidget(el.type, el), true)); - } - if (item && item.el && (item.el.type || options.type)) { - el = BI.extend({}, options, item.el); - return BI.Plugin.getObject(el.type, FR.createWidget(BI.Plugin.getWidget(el.type, el), true)); - } - if (item && BI.isWidget(item.el)) { - return item.el; - } - }, - createWidgets: function (items, options) { if (!BI.isArray(items)) { throw new Error("cannot create Widgets") @@ -19726,104 +19702,7 @@ BI.RedMarkBehavior = BI.inherit(BI.Behavior, { } }) } -});/* - * 前端缓存 - */ -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 = {}; - } -}); -BI.Cache = { - _prefix: "bi", - setUsername: function (username) { - localStorage.setItem(BI.Cache._prefix + ".username", (username + "" || "").toUpperCase()); - }, - getUsername: function () { - return localStorage.getItem(BI.Cache._prefix + ".username") || ""; - }, - _getKeyPrefix: function () { - return BI.Cache.getUsername() + "." + BI.Cache._prefix + "."; - }, - _generateKey: function (key) { - return BI.Cache._getKeyPrefix() + (key || ""); - }, - getItem: function (key) { - return localStorage.getItem(BI.Cache._generateKey(key)); - }, - setItem: function (key, value) { - localStorage.setItem(BI.Cache._generateKey(key), value); - }, - removeItem: function (key) { - localStorage.removeItem(BI.Cache._generateKey(key)); - }, - clear: function () { - for (var i = localStorage.length; i >= 0; i--) { - var key = localStorage.key(i); - if (key) { - if (key.indexOf(BI.Cache._getKeyPrefix()) === 0) { - localStorage.removeItem(key); - } - } - } - }, - keys: function () { - var result = []; - for (var i = localStorage.length; i >= 0; i--) { - var key = localStorage.key(i); - if (key) { - var prefix = BI.Cache._getKeyPrefix(); - if (key.indexOf(prefix) === 0) { - result[result.length] = key.substring(prefix.length); - } - } - } - return result; - }, - - addCookie: function (name, value, path, expiresHours) { - var cookieString = name + "=" + escape(value); - // 判断是否设置过期时间 - if (expiresHours && expiresHours > 0) { - var date = new Date(); - date.setTime(date.getTime() + expiresHours * 3600 * 1000); - cookieString = cookieString + "; expires=" + date.toGMTString(); - } - if (path) { - cookieString = cookieString + "; path=" + path; - } - document.cookie = cookieString; - }, - getCookie: function (name) { - var arr, reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)"); - if (arr = document.cookie.match(reg)) - return unescape(arr[2]); - else - return null; - }, - deleteCookie: function (name, path) { - var date = new Date(); - date.setTime(date.getTime() - 10000); - var cookieString = name + "=v; expires=" + date.toGMTString(); - if (path) { - cookieString = cookieString + "; path=" + path; - } - document.cookie = cookieString; - } -};/** +});/** * guy * 控制器 * Controller层超类 diff --git a/src/core/base.js b/src/core/base.js index aa33e64a3..3b0656e96 100644 --- a/src/core/base.js +++ b/src/core/base.js @@ -10,7 +10,7 @@ if (!window.BI) { ; !(function ($, undefined) { _.extend(BI, { - version: "4.0" + version: "2.0" }); var traverse = function (func, context) { return function (value, key, obj) { @@ -33,7 +33,7 @@ if (!window.BI) { //Utility _.extend(BI, { i18nText: function (key) { - var localeText = ""; + var localeText = (BI.i18n && BI.i18n[key]) || ""; if (!localeText) { localeText = key; } @@ -81,30 +81,6 @@ if (!window.BI) { return widget instanceof BI.Widget || (BI.View && widget instanceof BI.View); }, - createWidget: function (item, options) { - var el; - options || (options = {}); - if (BI.isEmpty(item) && BI.isEmpty(options)) { - return BI.Plugin.getObject("bi.layout", BI.createWidget({ - type: "bi.layout" - })); - } - if (BI.isWidget(item)) { - return item; - } - if (item && (item.type || options.type)) { - el = BI.extend({}, options, item); - return BI.Plugin.getObject(el.type, FR.createWidget(BI.Plugin.getWidget(el.type, el), true)); - } - if (item && item.el && (item.el.type || options.type)) { - el = BI.extend({}, options, item.el); - return BI.Plugin.getObject(el.type, FR.createWidget(BI.Plugin.getWidget(el.type, el), true)); - } - if (item && BI.isWidget(item.el)) { - return item.el; - } - }, - createWidgets: function (items, options) { if (!BI.isArray(items)) { throw new Error("cannot create Widgets") diff --git a/src/core/cache.js b/src/core/cache.js deleted file mode 100644 index b529bfeee..000000000 --- a/src/core/cache.js +++ /dev/null @@ -1,98 +0,0 @@ -/* - * 前端缓存 - */ -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 = {}; - } -}); -BI.Cache = { - _prefix: "bi", - setUsername: function (username) { - localStorage.setItem(BI.Cache._prefix + ".username", (username + "" || "").toUpperCase()); - }, - getUsername: function () { - return localStorage.getItem(BI.Cache._prefix + ".username") || ""; - }, - _getKeyPrefix: function () { - return BI.Cache.getUsername() + "." + BI.Cache._prefix + "."; - }, - _generateKey: function (key) { - return BI.Cache._getKeyPrefix() + (key || ""); - }, - getItem: function (key) { - return localStorage.getItem(BI.Cache._generateKey(key)); - }, - setItem: function (key, value) { - localStorage.setItem(BI.Cache._generateKey(key), value); - }, - removeItem: function (key) { - localStorage.removeItem(BI.Cache._generateKey(key)); - }, - clear: function () { - for (var i = localStorage.length; i >= 0; i--) { - var key = localStorage.key(i); - if (key) { - if (key.indexOf(BI.Cache._getKeyPrefix()) === 0) { - localStorage.removeItem(key); - } - } - } - }, - keys: function () { - var result = []; - for (var i = localStorage.length; i >= 0; i--) { - var key = localStorage.key(i); - if (key) { - var prefix = BI.Cache._getKeyPrefix(); - if (key.indexOf(prefix) === 0) { - result[result.length] = key.substring(prefix.length); - } - } - } - return result; - }, - - addCookie: function (name, value, path, expiresHours) { - var cookieString = name + "=" + escape(value); - // 判断是否设置过期时间 - if (expiresHours && expiresHours > 0) { - var date = new Date(); - date.setTime(date.getTime() + expiresHours * 3600 * 1000); - cookieString = cookieString + "; expires=" + date.toGMTString(); - } - if (path) { - cookieString = cookieString + "; path=" + path; - } - document.cookie = cookieString; - }, - getCookie: function (name) { - var arr, reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)"); - if (arr = document.cookie.match(reg)) - return unescape(arr[2]); - else - return null; - }, - deleteCookie: function (name, path) { - var date = new Date(); - date.setTime(date.getTime() - 10000); - var cookieString = name + "=v; expires=" + date.toGMTString(); - if (path) { - cookieString = cookieString + "; path=" + path; - } - document.cookie = cookieString; - } -}; \ No newline at end of file From 208c832597ba594a325f34ac22d4d86c2964ee4b Mon Sep 17 00:00:00 2001 From: guy Date: Wed, 22 Mar 2017 16:06:48 +0800 Subject: [PATCH 5/5] add --- demo/js/widget/demo.multiselectcombo.js | 8 ++++++-- dist/core.js | 6 +++++- src/core/widget.js | 6 +++++- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/demo/js/widget/demo.multiselectcombo.js b/demo/js/widget/demo.multiselectcombo.js index f1441fa7b..e725573e5 100644 --- a/demo/js/widget/demo.multiselectcombo.js +++ b/demo/js/widget/demo.multiselectcombo.js @@ -45,10 +45,14 @@ Demo.MultiSelectCombo = BI.inherit(BI.Widget, { _itemsCreator: function (options, callback) { var self = this; var items = ITEMS; + var keywords = (options.keywords || []).slice(); if (options.keyword) { - var search = BI.Func.getSearchResult(items, options.keyword); - items = search.matched.concat(search.finded); + keywords.push(options.keyword); } + BI.each(keywords, function (i, kw) { + var search = BI.Func.getSearchResult(items, kw); + items = search.matched.concat(search.finded); + }); if (options.selected_values) {//过滤 var filter = BI.makeObject(options.selected_values, true); items = BI.filter(items, function (i, ob) { diff --git a/dist/core.js b/dist/core.js index 859c9f544..38b9bea06 100644 --- a/dist/core.js +++ b/dist/core.js @@ -14518,6 +14518,7 @@ BI.Widget = BI.inherit(BI.OB, { this.options.invisible = true; this.element.hide(); } + this.fireEvent(BI.Events.VIEW, visible); }, setValid: function (valid) { @@ -14663,7 +14664,10 @@ BI.Widget = BI.inherit(BI.OB, { }, destroy: function () { - this._unMount(); + this.empty(); + this._isMounted = false; + this._parent = null; + this.destroyed(); this.element.destroy(); this.fireEvent(BI.Events.DESTROY); } diff --git a/src/core/widget.js b/src/core/widget.js index 541c98699..54de57d74 100644 --- a/src/core/widget.js +++ b/src/core/widget.js @@ -220,6 +220,7 @@ BI.Widget = BI.inherit(BI.OB, { this.options.invisible = true; this.element.hide(); } + this.fireEvent(BI.Events.VIEW, visible); }, setValid: function (valid) { @@ -365,7 +366,10 @@ BI.Widget = BI.inherit(BI.OB, { }, destroy: function () { - this._unMount(); + this.empty(); + this._isMounted = false; + this._parent = null; + this.destroyed(); this.element.destroy(); this.fireEvent(BI.Events.DESTROY); }