|
|
@ -26,7 +26,6 @@ export class VirtualGroupList extends Widget { |
|
|
|
|
|
|
|
|
|
|
|
init() { |
|
|
|
init() { |
|
|
|
this.renderedIndex = -1; |
|
|
|
this.renderedIndex = -1; |
|
|
|
this._initSummaryHeight(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static xtype = "bi.virtual_group_list"; |
|
|
|
static xtype = "bi.virtual_group_list"; |
|
|
@ -45,7 +44,7 @@ export class VirtualGroupList extends Widget { |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
type: VirtualGroup.xtype, |
|
|
|
type: VirtualGroup.xtype, |
|
|
|
height: this.summaryHeight, |
|
|
|
height: rowHeight * items.length, |
|
|
|
ref: (ref) => { |
|
|
|
ref: (ref) => { |
|
|
|
this.container = ref; |
|
|
|
this.container = ref; |
|
|
|
}, |
|
|
|
}, |
|
|
@ -84,10 +83,8 @@ export class VirtualGroupList extends Widget { |
|
|
|
o.scrollTop = this.element.scrollTop(); |
|
|
|
o.scrollTop = this.element.scrollTop(); |
|
|
|
if (!this.ticking) { |
|
|
|
if (!this.ticking) { |
|
|
|
requestAnimationFrame(() => { |
|
|
|
requestAnimationFrame(() => { |
|
|
|
const start = new Date().getTime(); |
|
|
|
|
|
|
|
this._calculateBlocksToRender(); |
|
|
|
this._calculateBlocksToRender(); |
|
|
|
this.ticking = false; |
|
|
|
this.ticking = false; |
|
|
|
console.log(new Date().getTime() - start); |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
this.ticking = true; |
|
|
|
this.ticking = true; |
|
|
|
} |
|
|
|
} |
|
|
@ -203,21 +200,16 @@ export class VirtualGroupList extends Widget { |
|
|
|
_restore() { |
|
|
|
_restore() { |
|
|
|
const o = this.options; |
|
|
|
const o = this.options; |
|
|
|
this.renderedIndex = -1; |
|
|
|
this.renderedIndex = -1; |
|
|
|
this._initSummaryHeight(); |
|
|
|
if (isFunction(o.rowHeight)) { |
|
|
|
|
|
|
|
this.summaryHeight = sum(o.items, o.rowHeight); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
this.summaryHeight = this._isAutoHeight() ? 0 : o.rowHeight * o.items.length; |
|
|
|
|
|
|
|
} |
|
|
|
// 依赖于cache的占位元素也要初始化
|
|
|
|
// 依赖于cache的占位元素也要初始化
|
|
|
|
this.topBlank.setHeight(0); |
|
|
|
this.topBlank.setHeight(0); |
|
|
|
this.bottomBlank.setHeight(0); |
|
|
|
this.bottomBlank.setHeight(0); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
_initSummaryHeight() { |
|
|
|
|
|
|
|
const { rowHeight, items } = this.options; |
|
|
|
|
|
|
|
if (isFunction(rowHeight)) { |
|
|
|
|
|
|
|
this.summaryHeight = sum(items, rowHeight); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
this.summaryHeight = this._isAutoHeight() ? 0 : rowHeight * items.length; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 暂时只支持固定行高的场景
|
|
|
|
// 暂时只支持固定行高的场景
|
|
|
|
scrollTo(scrollTop) { |
|
|
|
scrollTo(scrollTop) { |
|
|
|
this.options.scrollTop = scrollTop; |
|
|
|
this.options.scrollTop = scrollTop; |
|
|
|