|
|
|
@ -37,7 +37,7 @@ BI.Pager = BI.inherit(BI.Widget, {
|
|
|
|
|
return 1; |
|
|
|
|
}, |
|
|
|
|
hasPrev: BI.emptyFn, // pages不可用时有效
|
|
|
|
|
hasNext: BI.emptyFn // pages不可用时有效
|
|
|
|
|
hasNext: BI.emptyFn // pages不可用时有效
|
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
@ -83,9 +83,11 @@ BI.Pager = BI.inherit(BI.Widget, {
|
|
|
|
|
disabled: pages === false ? o.hasPrev(curr) === false : !(curr > 1 && prev !== false) |
|
|
|
|
}); |
|
|
|
|
} else { |
|
|
|
|
view.push(BI.extend({ |
|
|
|
|
disabled: pages === false ? o.hasPrev(curr) === false : !(curr > 1 && prev !== false) |
|
|
|
|
}, prev)); |
|
|
|
|
view.push({ |
|
|
|
|
el: BI.extend({ |
|
|
|
|
disabled: pages === false ? o.hasPrev(curr) === false : !(curr > 1 && prev !== false) |
|
|
|
|
}, prev) |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -110,6 +112,7 @@ BI.Pager = BI.inherit(BI.Widget, {
|
|
|
|
|
dict.start = dict.index > 1 ? curr - dict.poor : 1; |
|
|
|
|
dict.end = dict.index > 1 ? (function () { |
|
|
|
|
var max = curr + (groups - dict.poor - 1); |
|
|
|
|
|
|
|
|
|
return max > pages ? pages : max; |
|
|
|
|
}()) : groups; |
|
|
|
|
if (dict.end - dict.start < groups - 1) { // 最后一组状态
|
|
|
|
@ -157,29 +160,36 @@ BI.Pager = BI.inherit(BI.Widget, {
|
|
|
|
|
view.push((function () { |
|
|
|
|
if (BI.isKey(next)) { |
|
|
|
|
if (pages === false) { |
|
|
|
|
return {text: next, value: "next", disabled: o.hasNext(curr) === false}; |
|
|
|
|
return { text: next, value: "next", disabled: o.hasNext(curr) === false }; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return (dict.flow && curr === pages) |
|
|
|
|
? |
|
|
|
|
{text: next, value: "next", disabled: true} |
|
|
|
|
{ text: next, value: "next", disabled: true } |
|
|
|
|
: |
|
|
|
|
{text: next, value: "next", disabled: !(curr !== pages && next || dict.flow)}; |
|
|
|
|
{ text: next, value: "next", disabled: !(curr !== pages && next || dict.flow) }; |
|
|
|
|
} |
|
|
|
|
return BI.extend({ |
|
|
|
|
disabled: pages === false ? o.hasNext(curr) === false : !(curr !== pages && next || dict.flow) |
|
|
|
|
}, next); |
|
|
|
|
|
|
|
|
|
return { |
|
|
|
|
el: BI.extend({ |
|
|
|
|
disabled: pages === false ? o.hasNext(curr) === false : !(curr !== pages && next || dict.flow) |
|
|
|
|
}, next) |
|
|
|
|
}; |
|
|
|
|
}())); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
this.button_group = BI.createWidget({ |
|
|
|
|
type: "bi.button_group", |
|
|
|
|
element: this, |
|
|
|
|
items: BI.createItems(view, { |
|
|
|
|
cls: "bi-list-item-select bi-border-radius", |
|
|
|
|
height: 23, |
|
|
|
|
hgap: 10, |
|
|
|
|
stopPropagation: true |
|
|
|
|
items: BI.map(view, function (idx, v) { |
|
|
|
|
v = BI.extend({ |
|
|
|
|
cls: "bi-list-item-select bi-border-radius", |
|
|
|
|
height: 23, |
|
|
|
|
hgap: v.el ? 0 : 10, |
|
|
|
|
stopPropagation: true |
|
|
|
|
}, BI.stripEL(v)); |
|
|
|
|
|
|
|
|
|
return BI.formatEL(v); |
|
|
|
|
}), |
|
|
|
|
behaviors: o.behaviors, |
|
|
|
|
layouts: o.layouts |
|
|
|
@ -233,6 +243,7 @@ BI.Pager = BI.inherit(BI.Widget, {
|
|
|
|
|
v || (v = 1); |
|
|
|
|
var o = this.options; |
|
|
|
|
var pages = this.options.pages; |
|
|
|
|
|
|
|
|
|
return pages === false ? o.hasPrev(v) : v > 1; |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
@ -240,6 +251,7 @@ BI.Pager = BI.inherit(BI.Widget, {
|
|
|
|
|
v || (v = 1); |
|
|
|
|
var o = this.options; |
|
|
|
|
var pages = this.options.pages; |
|
|
|
|
|
|
|
|
|
return pages === false ? o.hasNext(v) : v < pages; |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
@ -268,7 +280,7 @@ BI.Pager = BI.inherit(BI.Widget, {
|
|
|
|
|
return BI.MIN; |
|
|
|
|
case "last": |
|
|
|
|
return BI.MAX; |
|
|
|
|
default : |
|
|
|
|
default: |
|
|
|
|
return val; |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|