From b0522e57ee98aab55e1034064cbf73f4fa21fa9c Mon Sep 17 00:00:00 2001 From: guy Date: Thu, 23 Mar 2017 17:43:58 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B4=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- demo/css/main.css | 3 - demo/js/base/demo.pager.js | 120 +++++++++++ demo/js/case/tree/demo.branch_relation.js | 149 ++++++++++++++ demo/js/config/case.js | 4 + demo/less/main.less | 3 - dist/base.js | 19 +- src/base/pager/pager.js | 18 +- src/base/svg/svg.js | 1 + src/css/normalize.css | 230 --------------------- src/css/reset.css | 128 ++++++++++++ src/less/normalize.less | 231 ---------------------- src/less/reset.less | 48 +++++ 12 files changed, 469 insertions(+), 485 deletions(-) create mode 100644 demo/js/base/demo.pager.js create mode 100644 demo/js/case/tree/demo.branch_relation.js delete mode 100644 src/css/normalize.css create mode 100644 src/css/reset.css delete mode 100644 src/less/normalize.less create mode 100644 src/less/reset.less diff --git a/demo/css/main.css b/demo/css/main.css index 7a34fff76..039fce052 100644 --- a/demo/css/main.css +++ b/demo/css/main.css @@ -1,6 +1,3 @@ -* { - font-family: 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif; -} .layout-bg-white { background-color: #ffffff; } diff --git a/demo/js/base/demo.pager.js b/demo/js/base/demo.pager.js new file mode 100644 index 000000000..a131fbce1 --- /dev/null +++ b/demo/js/base/demo.pager.js @@ -0,0 +1,120 @@ +Demo.Func = BI.inherit(BI.Widget, { + props: { + baseCls: "demo-func" + }, + render: function () { + return { + type: "bi.vertical", + items: [{ + type: "bi.label", + height: 30, + text: "默认的分页" + }, { + type: "bi.pager", + height: 50, + pages: 18, + groups: 5, + curr: 6, + first: "首页", + last: "尾页" + }, { + type: "bi.label", + height: 30, + text: "显示上一页、下一页、首页、尾页" + }, { + type: "bi.pager", + dynamicShow: false, + height: 50, + pages: 18, + groups: 5, + curr: 1, + first: "首页>", + last: "<尾页" + }, { + type: "bi.label", + height: 30, + text: "显示上一页、下一页" + }, { + type: "bi.pager", + dynamicShow: false, + dynamicShowFirstLast: true, + height: 50, + pages: 18, + groups: 5, + curr: 1, + first: "首页>", + last: "<尾页" + }, { + type: "bi.label", + height: 30, + text: "自定义上一页、下一页" + }, { + type: "bi.pager", + dynamicShow: false, + height: 50, + pages: 18, + groups: 5, + curr: 6, + prev: { + type: "bi.button", + cls: "", + text: "上一页", + value: "prev", + once: false, + height: 30, + handler: function () { + + } + }, + next: { + type: "bi.button", + cls: "", + text: "下一页", + value: "next", + once: false, + handler: function () { + + } + } + }, { + type: "bi.label", + height: 30, + text: "不知道总页数的情况(测试条件 1<=page<=3)" + }, { + type: "bi.pager", + dynamicShow: false, + height: 50, + pages: false, + curr: 1, + prev: { + type: "bi.button", + cls: "", + text: "上一页", + value: "prev", + once: false, + height: 30, + handler: function () { + + } + }, + next: { + type: "bi.button", + cls: "", + text: "下一页", + value: "next", + once: false, + handler: function () { + + } + }, + hasPrev: function (v) { + return v > 1; + }, + hasNext: function (v) { + return v < 3; + } + }] + } + } +}); +$.shortcut("demo.pager", Demo.Func); \ No newline at end of file diff --git a/demo/js/case/tree/demo.branch_relation.js b/demo/js/case/tree/demo.branch_relation.js new file mode 100644 index 000000000..af7036280 --- /dev/null +++ b/demo/js/case/tree/demo.branch_relation.js @@ -0,0 +1,149 @@ +Demo.Func = BI.inherit(BI.Widget, { + props: { + baseCls: "demo-func" + }, + + render: function () { + var relation = BI.createWidget({ + type: "bi.branch_relation", + items: [ + { + id: -1, + value: "根目录", + type: "bi.text_button", + cls: "layout-bg2", + width: 180, + height: 100 + }, + { + id: 1, + pId: -1, + value: "第一级目录1", + type: "bi.text_button", + cls: "layout-bg2", + width: 180, + height: 100 + }, + { + id: 11, + pId: 1, + value: "第二级文件1", + type: "bi.text_button", + cls: "layout-bg2", + width: 180, + height: 100 + }, + { + id: 12, + pId: 1, + value: "第二级目录1", + type: "bi.text_button", + cls: "layout-bg2", + width: 180, + height: 100 + }, + { + id: 121, + pId: 12, + value: "第三级目录1", + type: "bi.text_button", + cls: "layout-bg2", + width: 180, + height: 100 + }, + { + id: 122, + pId: 12, + value: "第三级文件1", + type: "bi.text_button", + cls: "layout-bg2", + width: 180, + height: 100 + }, + { + id: 1211, + pId: 121, + value: "第四级目录", + type: "bi.text_button", + cls: "layout-bg2", + width: 180, + height: 100 + }, + { + id: 12111, + pId: 1211, + value: "第五级文件1", + type: "bi.text_button", + cls: "layout-bg2", + width: 180, + height: 100 + }, + { + id: 2, + pId: -1, + value: "第一级目录2", + type: "bi.text_button", + cls: "layout-bg2", + width: 180, + height: 100 + }, + { + id: 21, + pId: 2, + value: "第二级目录2", + type: "bi.text_button", + cls: "layout-bg2", + width: 180, + height: 100 + }, + { + id: 22, + pId: 2, + value: "第二级文件2", + type: "bi.text_button", + cls: "layout-bg2", + width: 180, + height: 100 + }, + { + id: 211, + pId: 21, + value: "第三级目录2", + type: "bi.text_button", + cls: "layout-bg2", + width: 180, + height: 100 + }, + { + id: 212, + pId: 21, + value: "第三级文件2", + type: "bi.text_button", + cls: "layout-bg2", + width: 180, + height: 100 + }, + { + id: 2111, + pId: 211, + value: "第四级文件2", + type: "bi.text_button", + cls: "layout-bg2", + width: 180, + height: 100 + } + ], + + direction: BI.Direction.Right, + align: BI.HorizontalAlign.Right, + + centerOffset: -50 + }); + BI.createWidget({ + type: "bi.adaptive", + element: this, + items: [relation] + }) + } +}); +$.shortcut("demo.branch_relation", Demo.Func); \ No newline at end of file diff --git a/demo/js/config/case.js b/demo/js/config/case.js index 062049d7b..be8bedf97 100644 --- a/demo/js/config/case.js +++ b/demo/js/config/case.js @@ -54,6 +54,10 @@ Demo.CASE_CONFIG = [{ pId: 303, text: "bi.level_tree", value: "demo.level_tree" +}, { + pId: 303, + text: "bi.branch_relation", + value: "demo.branch_relation" }, { pId: 3, id: 304, diff --git a/demo/less/main.less b/demo/less/main.less index 02d570723..3d7de426a 100644 --- a/demo/less/main.less +++ b/demo/less/main.less @@ -1,6 +1,3 @@ -* { - font-family: 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif; -} .layout-bg-white { background-color: #ffffff; diff --git a/dist/base.js b/dist/base.js index f47bfd398..66653a559 100644 --- a/dist/base.js +++ b/dist/base.js @@ -15479,10 +15479,10 @@ BI.Pager = BI.inherit(BI.Widget, { var self = this; this.currPage = BI.result(this.options, "curr"); //翻页太灵敏 - this._lock = false; - this._debouce = BI.debounce(function () { - self._lock = false; - }, 300); + // this._lock = false; + // this._debouce = BI.debounce(function () { + // self._lock = false; + // }, 300); this._populate(); }, @@ -15618,11 +15618,11 @@ BI.Pager = BI.inherit(BI.Widget, { layouts: o.layouts }); this.button_group.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) { - if (self._lock === true) { - return; - } - self._lock = true; - self._debouce(); + // if (self._lock === true) { + // return; + // } + // self._lock = true; + // self._debouce(); if (type === BI.Events.CLICK) { var v = self.button_group.getValue()[0]; switch (v) { @@ -28233,6 +28233,7 @@ BI.Svg = BI.inherit(BI.Widget, { BI.Svg.superclass._init.apply(this, arguments); this.paper = Raphael(this.element[0]); + this.element.css("overflow", "hidden"); $(this.paper.canvas).width("100%").height("100%").css({"left": "0", "top": "0"}).appendTo(this.element); this.top = this.paper.top; diff --git a/src/base/pager/pager.js b/src/base/pager/pager.js index f4128c0fa..6dcf6ca02 100644 --- a/src/base/pager/pager.js +++ b/src/base/pager/pager.js @@ -45,10 +45,10 @@ BI.Pager = BI.inherit(BI.Widget, { var self = this; this.currPage = BI.result(this.options, "curr"); //翻页太灵敏 - this._lock = false; - this._debouce = BI.debounce(function () { - self._lock = false; - }, 300); + // this._lock = false; + // this._debouce = BI.debounce(function () { + // self._lock = false; + // }, 300); this._populate(); }, @@ -184,11 +184,11 @@ BI.Pager = BI.inherit(BI.Widget, { layouts: o.layouts }); this.button_group.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) { - if (self._lock === true) { - return; - } - self._lock = true; - self._debouce(); + // if (self._lock === true) { + // return; + // } + // self._lock = true; + // self._debouce(); if (type === BI.Events.CLICK) { var v = self.button_group.getValue()[0]; switch (v) { diff --git a/src/base/svg/svg.js b/src/base/svg/svg.js index adb3f3ab7..83b0e769a 100644 --- a/src/base/svg/svg.js +++ b/src/base/svg/svg.js @@ -17,6 +17,7 @@ BI.Svg = BI.inherit(BI.Widget, { BI.Svg.superclass._init.apply(this, arguments); this.paper = Raphael(this.element[0]); + this.element.css("overflow", "hidden"); $(this.paper.canvas).width("100%").height("100%").css({"left": "0", "top": "0"}).appendTo(this.element); this.top = this.paper.top; diff --git a/src/css/normalize.css b/src/css/normalize.css deleted file mode 100644 index 65b0635b2..000000000 --- a/src/css/normalize.css +++ /dev/null @@ -1,230 +0,0 @@ -/*! 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; -} diff --git a/src/css/reset.css b/src/css/reset.css new file mode 100644 index 000000000..0007ead9b --- /dev/null +++ b/src/css/reset.css @@ -0,0 +1,128 @@ +/* http://meyerweb.com/eric/tools/css/reset/ + v2.0 | 20110126 + License: none (public domain) +*/ +html, +body, +div, +span, +applet, +object, +iframe, +h1, +h2, +h3, +h4, +h5, +h6, +p, +blockquote, +pre, +a, +abbr, +acronym, +address, +big, +cite, +code, +del, +dfn, +em, +img, +ins, +kbd, +q, +s, +samp, +small, +strike, +strong, +sub, +sup, +tt, +var, +b, +u, +i, +center, +dl, +dt, +dd, +ol, +ul, +li, +fieldset, +form, +label, +legend, +table, +caption, +tbody, +tfoot, +thead, +tr, +th, +td, +article, +aside, +canvas, +details, +embed, +figure, +figcaption, +footer, +header, +hgroup, +menu, +nav, +output, +ruby, +section, +summary, +time, +mark, +audio, +video { + margin: 0; + padding: 0; + border: 0; + font-size: 100%; + font: inherit; + vertical-align: baseline; +} +/* HTML5 display-role reset for older browsers */ +article, +aside, +details, +figcaption, +figure, +footer, +header, +hgroup, +menu, +nav, +section { + display: block; +} +body { + line-height: 1; +} +ol, +ul { + list-style: none; +} +blockquote, +q { + quotes: none; +} +blockquote:before, +blockquote:after, +q:before, +q:after { + content: ''; + content: none; +} +table { + border-collapse: collapse; + border-spacing: 0; +} diff --git a/src/less/normalize.less b/src/less/normalize.less deleted file mode 100644 index baf3cb1df..000000000 --- a/src/less/normalize.less +++ /dev/null @@ -1,231 +0,0 @@ -/*! 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 -} \ No newline at end of file diff --git a/src/less/reset.less b/src/less/reset.less new file mode 100644 index 000000000..3df61e8d9 --- /dev/null +++ b/src/less/reset.less @@ -0,0 +1,48 @@ +/* http://meyerweb.com/eric/tools/css/reset/ + v2.0 | 20110126 + License: none (public domain) +*/ + +html, body, div, span, applet, object, iframe, +h1, h2, h3, h4, h5, h6, p, blockquote, pre, +a, abbr, acronym, address, big, cite, code, +del, dfn, em, img, ins, kbd, q, s, samp, +small, strike, strong, sub, sup, tt, var, +b, u, i, center, +dl, dt, dd, ol, ul, li, +fieldset, form, label, legend, +table, caption, tbody, tfoot, thead, tr, th, td, +article, aside, canvas, details, embed, +figure, figcaption, footer, header, hgroup, +menu, nav, output, ruby, section, summary, +time, mark, audio, video { + margin: 0; + padding: 0; + border: 0; + font-size: 100%; + font: inherit; + vertical-align: baseline; +} +/* HTML5 display-role reset for older browsers */ +article, aside, details, figcaption, figure, +footer, header, hgroup, menu, nav, section { + display: block; +} +body { + line-height: 1; +} +ol, ul { + list-style: none; +} +blockquote, q { + quotes: none; +} +blockquote:before, blockquote:after, +q:before, q:after { + content: ''; + content: none; +} +table { + border-collapse: collapse; + border-spacing: 0; +} \ No newline at end of file