feat:add onScroll and onScrollEnd for list and flowlayout

This commit is contained in:
pengfei.zhou
2020-03-11 13:41:22 +08:00
committed by osborn
parent 8db0e8e9f9
commit 7b371ca58b
16 changed files with 316 additions and 5 deletions

View File

@@ -1859,6 +1859,14 @@ var List = /** @class */ (function (_super) {
Property,
__metadata$5("design:type", ListItem)
], List.prototype, "loadMoreView", void 0);
__decorate$5([
Property,
__metadata$5("design:type", Function)
], List.prototype, "onScroll", void 0);
__decorate$5([
Property,
__metadata$5("design:type", Function)
], List.prototype, "onScrollEnd", void 0);
return List;
}(Superview));
function list(config) {
@@ -2289,6 +2297,14 @@ var FlowLayout = /** @class */ (function (_super) {
Property,
__metadata$9("design:type", FlowLayoutItem)
], FlowLayout.prototype, "loadMoreView", void 0);
__decorate$9([
Property,
__metadata$9("design:type", Function)
], FlowLayout.prototype, "onScroll", void 0);
__decorate$9([
Property,
__metadata$9("design:type", Function)
], FlowLayout.prototype, "onScrollEnd", void 0);
return FlowLayout;
}(Superview));
function flowlayout(config) {

View File

@@ -1381,6 +1381,14 @@ __decorate$5([
Property,
__metadata$5("design:type", ListItem)
], List.prototype, "loadMoreView", void 0);
__decorate$5([
Property,
__metadata$5("design:type", Function)
], List.prototype, "onScroll", void 0);
__decorate$5([
Property,
__metadata$5("design:type", Function)
], List.prototype, "onScrollEnd", void 0);
function list(config) {
const ret = new List;
for (let key in config) {
@@ -1708,6 +1716,14 @@ __decorate$9([
Property,
__metadata$9("design:type", FlowLayoutItem)
], FlowLayout.prototype, "loadMoreView", void 0);
__decorate$9([
Property,
__metadata$9("design:type", Function)
], FlowLayout.prototype, "onScroll", void 0);
__decorate$9([
Property,
__metadata$9("design:type", Function)
], FlowLayout.prototype, "onScrollEnd", void 0);
function flowlayout(config) {
const ret = new FlowLayout;
for (let key in config) {

View File

@@ -2840,6 +2840,14 @@ __decorate$5([
Property,
__metadata$5("design:type", ListItem)
], List.prototype, "loadMoreView", void 0);
__decorate$5([
Property,
__metadata$5("design:type", Function)
], List.prototype, "onScroll", void 0);
__decorate$5([
Property,
__metadata$5("design:type", Function)
], List.prototype, "onScrollEnd", void 0);
function list(config) {
const ret = new List;
for (let key in config) {
@@ -3167,6 +3175,14 @@ __decorate$9([
Property,
__metadata$9("design:type", FlowLayoutItem)
], FlowLayout.prototype, "loadMoreView", void 0);
__decorate$9([
Property,
__metadata$9("design:type", Function)
], FlowLayout.prototype, "onScroll", void 0);
__decorate$9([
Property,
__metadata$9("design:type", Function)
], FlowLayout.prototype, "onScrollEnd", void 0);
function flowlayout(config) {
const ret = new FlowLayout;
for (let key in config) {

32
doric-js/index.d.ts vendored
View File

@@ -549,6 +549,14 @@ declare module 'doric/lib/src/widget/list' {
onLoadMore?: () => void;
loadMore?: boolean;
loadMoreView?: ListItem;
onScroll?: (offset: {
x: number;
y: number;
}) => void;
onScrollEnd?: (offset: {
x: number;
y: number;
}) => void;
}
export class List extends Superview implements IList {
allSubviews(): IterableIterator<ListItem> | ListItem[];
@@ -558,6 +566,14 @@ declare module 'doric/lib/src/widget/list' {
onLoadMore?: () => void;
loadMore?: boolean;
loadMoreView?: ListItem;
onScroll?: (offset: {
x: number;
y: number;
}) => void;
onScrollEnd?: (offset: {
x: number;
y: number;
}) => void;
reset(): void;
isDirty(): boolean;
toModel(): NativeViewModel;
@@ -689,6 +705,14 @@ declare module 'doric/lib/src/widget/flowlayout' {
loadMore?: boolean;
onLoadMore?: () => void;
loadMoreView?: FlowLayoutItem;
onScroll?: (offset: {
x: number;
y: number;
}) => void;
onScrollEnd?: (offset: {
x: number;
y: number;
}) => void;
}
export class FlowLayout extends Superview implements IFlowLayout {
allSubviews(): IterableIterator<FlowLayoutItem> | FlowLayoutItem[];
@@ -701,6 +725,14 @@ declare module 'doric/lib/src/widget/flowlayout' {
onLoadMore?: () => void;
loadMore?: boolean;
loadMoreView?: FlowLayoutItem;
onScroll?: (offset: {
x: number;
y: number;
}) => void;
onScrollEnd?: (offset: {
x: number;
y: number;
}) => void;
reset(): void;
isDirty(): boolean;
toModel(): NativeViewModel;

View File

@@ -19,6 +19,14 @@ export interface IFlowLayout extends IView {
loadMore?: boolean;
onLoadMore?: () => void;
loadMoreView?: FlowLayoutItem;
onScroll?: (offset: {
x: number;
y: number;
}) => void;
onScrollEnd?: (offset: {
x: number;
y: number;
}) => void;
}
export declare class FlowLayout extends Superview implements IFlowLayout {
private cachedViews;
@@ -33,6 +41,14 @@ export declare class FlowLayout extends Superview implements IFlowLayout {
onLoadMore?: () => void;
loadMore?: boolean;
loadMoreView?: FlowLayoutItem;
onScroll?: (offset: {
x: number;
y: number;
}) => void;
onScrollEnd?: (offset: {
x: number;
y: number;
}) => void;
reset(): void;
private getItem;
isDirty(): boolean;

View File

@@ -116,6 +116,14 @@ __decorate([
Property,
__metadata("design:type", FlowLayoutItem)
], FlowLayout.prototype, "loadMoreView", void 0);
__decorate([
Property,
__metadata("design:type", Function)
], FlowLayout.prototype, "onScroll", void 0);
__decorate([
Property,
__metadata("design:type", Function)
], FlowLayout.prototype, "onScrollEnd", void 0);
export function flowlayout(config) {
const ret = new FlowLayout;
for (let key in config) {

View File

@@ -16,6 +16,14 @@ export interface IList extends IView {
onLoadMore?: () => void;
loadMore?: boolean;
loadMoreView?: ListItem;
onScroll?: (offset: {
x: number;
y: number;
}) => void;
onScrollEnd?: (offset: {
x: number;
y: number;
}) => void;
}
export declare class List extends Superview implements IList {
private cachedViews;
@@ -27,6 +35,14 @@ export declare class List extends Superview implements IList {
onLoadMore?: () => void;
loadMore?: boolean;
loadMoreView?: ListItem;
onScroll?: (offset: {
x: number;
y: number;
}) => void;
onScrollEnd?: (offset: {
x: number;
y: number;
}) => void;
reset(): void;
private getItem;
isDirty(): boolean;

View File

@@ -106,6 +106,14 @@ __decorate([
Property,
__metadata("design:type", ListItem)
], List.prototype, "loadMoreView", void 0);
__decorate([
Property,
__metadata("design:type", Function)
], List.prototype, "onScroll", void 0);
__decorate([
Property,
__metadata("design:type", Function)
], List.prototype, "onScrollEnd", void 0);
export function list(config) {
const ret = new List;
for (let key in config) {

View File

@@ -48,6 +48,10 @@ export interface IFlowLayout extends IView {
onLoadMore?: () => void
loadMoreView?: FlowLayoutItem
onScroll?: (offset: { x: number, y: number }) => void
onScrollEnd?: (offset: { x: number, y: number }) => void
}
export class FlowLayout extends Superview implements IFlowLayout {
@@ -89,6 +93,12 @@ export class FlowLayout extends Superview implements IFlowLayout {
@Property
loadMoreView?: FlowLayoutItem
@Property
onScroll?: (offset: { x: number, y: number }) => void
@Property
onScrollEnd?: (offset: { x: number, y: number }) => void
reset() {
this.cachedViews.clear()
this.itemCount = 0

View File

@@ -32,11 +32,20 @@ export class ListItem extends Stack implements IListItem {
export interface IList extends IView {
renderItem: (index: number) => ListItem
itemCount: number
batchCount?: number
onLoadMore?: () => void
loadMore?: boolean
loadMoreView?: ListItem
onScroll?: (offset: { x: number, y: number }) => void
onScrollEnd?: (offset: { x: number, y: number }) => void
}
export class List extends Superview implements IList {
@@ -69,6 +78,12 @@ export class List extends Superview implements IList {
@Property
loadMoreView?: ListItem
@Property
onScroll?: (offset: { x: number, y: number }) => void
@Property
onScrollEnd?: (offset: { x: number, y: number }) => void
reset() {
this.cachedViews.clear()
this.itemCount = 0