Browse Source

Merge pull request #95987 in DEC/fineui from master to feature/x

* commit '018d8b93a3c637a42e123a34595e504fbab8f6f6':
  DESIGN-4216 feat: 容器组件提供一些滚动api
es6
superman 2 years ago
parent
commit
8a207852d1
  1. 11
      src/base/list/virtualgrouplist.js
  2. 11
      typescript/base/list/virtualgrouplist.ts
  3. 3
      typescript/index.ts

11
src/base/list/virtualgrouplist.js

@ -123,7 +123,7 @@ BI.VirtualGroupList = BI.inherit(BI.Widget, {
}
this.bottomBlank.setHeight(this.tree.sumTo(this.renderedIndex) - this.tree.sumTo(Math.min(end, this.renderedIndex)));
this.container.populate(items.map(function (item, i) {
return o.itemFormatter(item, (start < 0 ? 0 : start) * o.blockSize + i)
return o.itemFormatter(item, (start < 0 ? 0 : start) * o.blockSize + i);
}));
} else {
for (var i = (start < 0 ? 0 : start); i <= end; i++) {
@ -134,7 +134,7 @@ BI.VirtualGroupList = BI.inherit(BI.Widget, {
}
this.container.element.height(o.rowHeight * o.items.length - topHeight);
this.container.populate(items.map(function (item, i) {
return o.itemFormatter(item, (start < 0 ? 0 : start) * o.blockSize + i)
return o.itemFormatter(item, (start < 0 ? 0 : start) * o.blockSize + i);
}));
}
},
@ -162,6 +162,13 @@ BI.VirtualGroupList = BI.inherit(BI.Widget, {
this.bottomBlank.setHeight(0);
},
// 暂时只支持固定行高的场景
scrollTo: function (scrollTop) {
this.options.scrollTop = scrollTop;
this._calculateBlocksToRender();
this.element.scrollTop(scrollTop);
},
restore: function () {
this.options.scrollTop = 0;
this._restore();

11
typescript/base/list/virtualgrouplist.ts

@ -0,0 +1,11 @@
import { Widget } from "../../core/widget";
export declare class VirtualGroupList extends Widget {
static xtype: string;
restore(): void;
populate<T>(items: T[]): void;
scrollTo(scrollTop: number): void;
}

3
typescript/index.ts

@ -157,6 +157,7 @@ import { EditorIconCheckCombo } from "./case/combo/editoriconcheckcombo/combo.ed
import { IconTextValueCombo } from "./case/combo/icontextvaluecombo/combo.icontextvalue";
import { ListView } from "./base/list/listview";
import { VirtualList } from "./base/list/virtuallist";
import { VirtualGroupList } from "./base/list/virtualgrouplist";
import { FloatCenterLayout } from "./core/wrapper/layout/middle/middle.float.center";
import { _msg } from "./base/foundation/message";
import { _web } from "./core/platform/web";
@ -361,6 +362,7 @@ export interface BI extends _func, _i18n, _base, _inject, _var, _web, _utils {
IconTextValueCombo: typeof IconTextValueCombo;
ListView: typeof ListView;
VirtualList: typeof VirtualList;
VirtualGroupList: typeof VirtualGroupList;
FloatCenterLayout: typeof FloatCenterLayout;
Msg: _msg;
DynamicYearMonthPopup: typeof DynamicYearMonthPopup;
@ -556,6 +558,7 @@ export {
IconTextValueCombo,
ListView,
VirtualList,
VirtualGroupList,
FloatCenterLayout,
DynamicYearMonthPopup,
DateCalendarPopup,

Loading…
Cancel
Save