Remove header and footer support,this is unnecessary

This commit is contained in:
pengfei.zhou
2021-10-11 18:10:59 +08:00
committed by osborn
parent 8fd2477c81
commit 738c072ee4
20 changed files with 270 additions and 471 deletions

View File

@@ -1,5 +1,6 @@
import { Stack } from './layouts';
import { Superview, View, NativeViewModel } from '../ui/view';
import { BridgeContext } from "../runtime/global";
export declare class FlowLayoutItem extends Stack {
/**
* Set to reuse native view
@@ -7,6 +8,7 @@ export declare class FlowLayoutItem extends Stack {
identifier?: string;
/**
* When set to true, the item will layout using all span area.
* HeaderView, footerView or loadMoreView is always true by default.
*/
fullSpan?: boolean;
}
@@ -35,8 +37,22 @@ export declare class FlowLayout extends Superview {
* Take effect only on iOS
*/
bounces?: boolean;
header?: FlowLayoutItem;
footer?: FlowLayoutItem;
/**
* @param context
* @returns Returns the range of the visible views for each column.
*/
findVisibleItems(context: BridgeContext): Promise<{
first: number;
last: number;
}[]>;
/**
* @param context
* @returns Returns the range of the completely visible views for each column.
*/
findCompletelyVisibleItems(context: BridgeContext): Promise<{
first: number;
last: number;
}[]>;
reset(): void;
private getItem;
private renderBunchedItems;

View File

@@ -48,14 +48,22 @@ export class FlowLayout extends Superview {
if (this.loadMoreView) {
ret.push(this.loadMoreView);
}
if (this.header) {
ret.push(this.header);
}
if (this.footer) {
ret.push(this.footer);
}
return ret;
}
/**
* @param context
* @returns Returns the range of the visible views for each column.
*/
findVisibleItems(context) {
return this.nativeChannel(context, 'findVisibleItems')();
}
/**
* @param context
* @returns Returns the range of the completely visible views for each column.
*/
findCompletelyVisibleItems(context) {
return this.nativeChannel(context, 'findCompletelyVisibleItems')();
}
reset() {
this.cachedViews.clear();
this.itemCount = 0;
@@ -76,12 +84,6 @@ export class FlowLayout extends Superview {
if (this.loadMoreView) {
this.dirtyProps['loadMoreView'] = this.loadMoreView.viewId;
}
if (this.header) {
this.dirtyProps['header'] = this.header.viewId;
}
if (this.footer) {
this.dirtyProps['footer'] = this.footer.viewId;
}
return super.toModel();
}
}
@@ -137,14 +139,6 @@ __decorate([
Property,
__metadata("design:type", Boolean)
], FlowLayout.prototype, "bounces", void 0);
__decorate([
Property,
__metadata("design:type", FlowLayoutItem)
], FlowLayout.prototype, "header", void 0);
__decorate([
Property,
__metadata("design:type", FlowLayoutItem)
], FlowLayout.prototype, "footer", void 0);
export function flowlayout(config) {
const ret = new FlowLayout;
for (let key in config) {

View File

@@ -13,6 +13,11 @@ export declare class ListItem extends Stack {
callback: () => void;
}[];
}
export declare enum OtherItems {
LoadMore = -10,
Header = -11,
Footer = -12
}
export declare class List extends Superview {
private cachedViews;
allSubviews(): ListItem[];
@@ -36,11 +41,25 @@ export declare class List extends Superview {
* Take effect only on iOS
*/
bounces?: boolean;
header?: ListItem;
footer?: ListItem;
scrollToItem(context: BridgeContext, index: number, config?: {
animated?: boolean;
}): Promise<any>;
/**
* @param context
* @returns Returns the range of the visible views.
*/
findVisibleItems(context: BridgeContext): Promise<{
first: number;
last: number;
}>;
/**
* @param context
* @returns Returns the range of the completely visible views.
*/
findCompletelyVisibleItems(context: BridgeContext): Promise<{
first: number;
last: number;
}>;
reset(): void;
private getItem;
private renderBunchedItems;

View File

@@ -35,6 +35,12 @@ __decorate([
Property,
__metadata("design:type", Array)
], ListItem.prototype, "actions", void 0);
export var OtherItems;
(function (OtherItems) {
OtherItems[OtherItems["LoadMore"] = -10] = "LoadMore";
OtherItems[OtherItems["Header"] = -11] = "Header";
OtherItems[OtherItems["Footer"] = -12] = "Footer";
})(OtherItems || (OtherItems = {}));
export class List extends Superview {
constructor() {
super(...arguments);
@@ -47,18 +53,26 @@ export class List extends Superview {
if (this.loadMoreView) {
ret.push(this.loadMoreView);
}
if (this.header) {
ret.push(this.header);
}
if (this.footer) {
ret.push(this.footer);
}
return ret;
}
scrollToItem(context, index, config) {
const animated = config === null || config === void 0 ? void 0 : config.animated;
return this.nativeChannel(context, 'scrollToItem')({ index, animated, });
}
/**
* @param context
* @returns Returns the range of the visible views.
*/
findVisibleItems(context) {
return this.nativeChannel(context, 'findVisibleItems')();
}
/**
* @param context
* @returns Returns the range of the completely visible views.
*/
findCompletelyVisibleItems(context) {
return this.nativeChannel(context, 'findCompletelyVisibleItems')();
}
reset() {
this.cachedViews.clear();
this.itemCount = 0;
@@ -79,12 +93,6 @@ export class List extends Superview {
if (this.loadMoreView) {
this.dirtyProps['loadMoreView'] = this.loadMoreView.viewId;
}
if (this.header) {
this.dirtyProps['header'] = this.header.viewId;
}
if (this.footer) {
this.dirtyProps['footer'] = this.footer.viewId;
}
return super.toModel();
}
}
@@ -132,14 +140,6 @@ __decorate([
Property,
__metadata("design:type", Boolean)
], List.prototype, "bounces", void 0);
__decorate([
Property,
__metadata("design:type", ListItem)
], List.prototype, "header", void 0);
__decorate([
Property,
__metadata("design:type", ListItem)
], List.prototype, "footer", void 0);
export function list(config) {
const ret = new List;
ret.apply(config);