Browse Source

整理

master
guy 8 years ago
parent
commit
b0522e57ee
  1. 3
      demo/css/main.css
  2. 120
      demo/js/base/demo.pager.js
  3. 149
      demo/js/case/tree/demo.branch_relation.js
  4. 4
      demo/js/config/case.js
  5. 3
      demo/less/main.less
  6. 19
      dist/base.js
  7. 18
      src/base/pager/pager.js
  8. 1
      src/base/svg/svg.js
  9. 230
      src/css/normalize.css
  10. 128
      src/css/reset.css
  11. 231
      src/less/normalize.less
  12. 48
      src/less/reset.less

3
demo/css/main.css

@ -1,6 +1,3 @@
* {
font-family: 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif;
}
.layout-bg-white { .layout-bg-white {
background-color: #ffffff; background-color: #ffffff;
} }

120
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);

149
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);

4
demo/js/config/case.js

@ -54,6 +54,10 @@ Demo.CASE_CONFIG = [{
pId: 303, pId: 303,
text: "bi.level_tree", text: "bi.level_tree",
value: "demo.level_tree" value: "demo.level_tree"
}, {
pId: 303,
text: "bi.branch_relation",
value: "demo.branch_relation"
}, { }, {
pId: 3, pId: 3,
id: 304, id: 304,

3
demo/less/main.less

@ -1,6 +1,3 @@
* {
font-family: 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif;
}
.layout-bg-white { .layout-bg-white {
background-color: #ffffff; background-color: #ffffff;

19
dist/base.js vendored

@ -15479,10 +15479,10 @@ BI.Pager = BI.inherit(BI.Widget, {
var self = this; var self = this;
this.currPage = BI.result(this.options, "curr"); this.currPage = BI.result(this.options, "curr");
//翻页太灵敏 //翻页太灵敏
this._lock = false; // this._lock = false;
this._debouce = BI.debounce(function () { // this._debouce = BI.debounce(function () {
self._lock = false; // self._lock = false;
}, 300); // }, 300);
this._populate(); this._populate();
}, },
@ -15618,11 +15618,11 @@ BI.Pager = BI.inherit(BI.Widget, {
layouts: o.layouts layouts: o.layouts
}); });
this.button_group.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) { this.button_group.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) {
if (self._lock === true) { // if (self._lock === true) {
return; // return;
} // }
self._lock = true; // self._lock = true;
self._debouce(); // self._debouce();
if (type === BI.Events.CLICK) { if (type === BI.Events.CLICK) {
var v = self.button_group.getValue()[0]; var v = self.button_group.getValue()[0];
switch (v) { switch (v) {
@ -28233,6 +28233,7 @@ BI.Svg = BI.inherit(BI.Widget, {
BI.Svg.superclass._init.apply(this, arguments); BI.Svg.superclass._init.apply(this, arguments);
this.paper = Raphael(this.element[0]); 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.paper.canvas).width("100%").height("100%").css({"left": "0", "top": "0"}).appendTo(this.element);
this.top = this.paper.top; this.top = this.paper.top;

18
src/base/pager/pager.js

@ -45,10 +45,10 @@ BI.Pager = BI.inherit(BI.Widget, {
var self = this; var self = this;
this.currPage = BI.result(this.options, "curr"); this.currPage = BI.result(this.options, "curr");
//翻页太灵敏 //翻页太灵敏
this._lock = false; // this._lock = false;
this._debouce = BI.debounce(function () { // this._debouce = BI.debounce(function () {
self._lock = false; // self._lock = false;
}, 300); // }, 300);
this._populate(); this._populate();
}, },
@ -184,11 +184,11 @@ BI.Pager = BI.inherit(BI.Widget, {
layouts: o.layouts layouts: o.layouts
}); });
this.button_group.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) { this.button_group.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) {
if (self._lock === true) { // if (self._lock === true) {
return; // return;
} // }
self._lock = true; // self._lock = true;
self._debouce(); // self._debouce();
if (type === BI.Events.CLICK) { if (type === BI.Events.CLICK) {
var v = self.button_group.getValue()[0]; var v = self.button_group.getValue()[0];
switch (v) { switch (v) {

1
src/base/svg/svg.js

@ -17,6 +17,7 @@ BI.Svg = BI.inherit(BI.Widget, {
BI.Svg.superclass._init.apply(this, arguments); BI.Svg.superclass._init.apply(this, arguments);
this.paper = Raphael(this.element[0]); 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.paper.canvas).width("100%").height("100%").css({"left": "0", "top": "0"}).appendTo(this.element);
this.top = this.paper.top; this.top = this.paper.top;

230
src/css/normalize.css vendored

@ -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;
}

128
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;
}

231
src/less/normalize.less vendored

@ -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
}

48
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;
}
Loading…
Cancel
Save