feat:List add header and footer
This commit is contained in:
@@ -2326,12 +2326,17 @@ var List = /** @class */ (function (_super) {
|
||||
return _this;
|
||||
}
|
||||
List.prototype.allSubviews = function () {
|
||||
var ret = __spreadArray$1([], __read$1(this.cachedViews.values()));
|
||||
if (this.loadMoreView) {
|
||||
return __spreadArray$1(__spreadArray$1([], __read$1(this.cachedViews.values())), [this.loadMoreView]);
|
||||
ret.push(this.loadMoreView);
|
||||
}
|
||||
else {
|
||||
return this.cachedViews.values();
|
||||
if (this.header) {
|
||||
ret.push(this.header);
|
||||
}
|
||||
if (this.footer) {
|
||||
ret.push(this.footer);
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
List.prototype.scrollToItem = function (context, index, config) {
|
||||
var animated = config === null || config === void 0 ? void 0 : config.animated;
|
||||
@@ -2358,6 +2363,12 @@ var List = /** @class */ (function (_super) {
|
||||
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.prototype.toModel.call(this);
|
||||
};
|
||||
__decorate$9([
|
||||
@@ -2404,6 +2415,14 @@ var List = /** @class */ (function (_super) {
|
||||
Property,
|
||||
__metadata$9("design:type", Boolean)
|
||||
], List.prototype, "bounces", void 0);
|
||||
__decorate$9([
|
||||
Property,
|
||||
__metadata$9("design:type", ListItem)
|
||||
], List.prototype, "header", void 0);
|
||||
__decorate$9([
|
||||
Property,
|
||||
__metadata$9("design:type", ListItem)
|
||||
], List.prototype, "footer", void 0);
|
||||
return List;
|
||||
}(Superview));
|
||||
function list(config) {
|
||||
|
@@ -1747,12 +1747,17 @@ class List extends Superview {
|
||||
this.batchCount = 15;
|
||||
}
|
||||
allSubviews() {
|
||||
const ret = [...this.cachedViews.values()];
|
||||
if (this.loadMoreView) {
|
||||
return [...this.cachedViews.values(), this.loadMoreView];
|
||||
ret.push(this.loadMoreView);
|
||||
}
|
||||
else {
|
||||
return this.cachedViews.values();
|
||||
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;
|
||||
@@ -1778,6 +1783,12 @@ 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();
|
||||
}
|
||||
}
|
||||
@@ -1825,6 +1836,14 @@ __decorate$9([
|
||||
Property,
|
||||
__metadata$9("design:type", Boolean)
|
||||
], List.prototype, "bounces", void 0);
|
||||
__decorate$9([
|
||||
Property,
|
||||
__metadata$9("design:type", ListItem)
|
||||
], List.prototype, "header", void 0);
|
||||
__decorate$9([
|
||||
Property,
|
||||
__metadata$9("design:type", ListItem)
|
||||
], List.prototype, "footer", void 0);
|
||||
function list(config) {
|
||||
const ret = new List;
|
||||
ret.apply(config);
|
||||
|
@@ -3268,12 +3268,17 @@ class List extends Superview {
|
||||
this.batchCount = 15;
|
||||
}
|
||||
allSubviews() {
|
||||
const ret = [...this.cachedViews.values()];
|
||||
if (this.loadMoreView) {
|
||||
return [...this.cachedViews.values(), this.loadMoreView];
|
||||
ret.push(this.loadMoreView);
|
||||
}
|
||||
else {
|
||||
return this.cachedViews.values();
|
||||
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;
|
||||
@@ -3299,6 +3304,12 @@ 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();
|
||||
}
|
||||
}
|
||||
@@ -3346,6 +3357,14 @@ __decorate$9([
|
||||
Property,
|
||||
__metadata$9("design:type", Boolean)
|
||||
], List.prototype, "bounces", void 0);
|
||||
__decorate$9([
|
||||
Property,
|
||||
__metadata$9("design:type", ListItem)
|
||||
], List.prototype, "header", void 0);
|
||||
__decorate$9([
|
||||
Property,
|
||||
__metadata$9("design:type", ListItem)
|
||||
], List.prototype, "footer", void 0);
|
||||
function list(config) {
|
||||
const ret = new List;
|
||||
ret.apply(config);
|
||||
|
4
doric-js/index.d.ts
vendored
4
doric-js/index.d.ts
vendored
@@ -699,7 +699,7 @@ declare module 'doric/lib/src/widget/list' {
|
||||
}[];
|
||||
}
|
||||
export class List extends Superview {
|
||||
allSubviews(): IterableIterator<ListItem> | ListItem[];
|
||||
allSubviews(): ListItem[];
|
||||
itemCount: number;
|
||||
renderItem: (index: number) => ListItem;
|
||||
batchCount: number;
|
||||
@@ -720,6 +720,8 @@ declare module 'doric/lib/src/widget/list' {
|
||||
* Take effect only on iOS
|
||||
*/
|
||||
bounces?: boolean;
|
||||
header?: ListItem;
|
||||
footer?: ListItem;
|
||||
scrollToItem(context: BridgeContext, index: number, config?: {
|
||||
animated?: boolean;
|
||||
}): Promise<any>;
|
||||
|
4
doric-js/lib/src/widget/list.d.ts
vendored
4
doric-js/lib/src/widget/list.d.ts
vendored
@@ -15,7 +15,7 @@ export declare class ListItem extends Stack {
|
||||
}
|
||||
export declare class List extends Superview {
|
||||
private cachedViews;
|
||||
allSubviews(): IterableIterator<ListItem> | ListItem[];
|
||||
allSubviews(): ListItem[];
|
||||
itemCount: number;
|
||||
renderItem: (index: number) => ListItem;
|
||||
batchCount: number;
|
||||
@@ -36,6 +36,8 @@ 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>;
|
||||
|
@@ -43,12 +43,17 @@ export class List extends Superview {
|
||||
this.batchCount = 15;
|
||||
}
|
||||
allSubviews() {
|
||||
const ret = [...this.cachedViews.values()];
|
||||
if (this.loadMoreView) {
|
||||
return [...this.cachedViews.values(), this.loadMoreView];
|
||||
ret.push(this.loadMoreView);
|
||||
}
|
||||
else {
|
||||
return this.cachedViews.values();
|
||||
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;
|
||||
@@ -74,6 +79,12 @@ 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();
|
||||
}
|
||||
}
|
||||
@@ -121,6 +132,14 @@ __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);
|
||||
|
@@ -39,11 +39,17 @@ export class List extends Superview {
|
||||
private cachedViews: Map<string, ListItem> = new Map
|
||||
|
||||
allSubviews() {
|
||||
const ret = [...this.cachedViews.values()]
|
||||
if (this.loadMoreView) {
|
||||
return [...this.cachedViews.values(), this.loadMoreView]
|
||||
} else {
|
||||
return this.cachedViews.values()
|
||||
ret.push(this.loadMoreView)
|
||||
}
|
||||
if (this.header) {
|
||||
ret.push(this.header)
|
||||
}
|
||||
if (this.footer) {
|
||||
ret.push(this.footer)
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
@Property
|
||||
@@ -81,6 +87,12 @@ export class List extends Superview {
|
||||
@Property
|
||||
bounces?: boolean
|
||||
|
||||
@Property
|
||||
header?: ListItem
|
||||
|
||||
@Property
|
||||
footer?: ListItem
|
||||
|
||||
scrollToItem(context: BridgeContext, index: number, config?: { animated?: boolean, }) {
|
||||
const animated = config?.animated
|
||||
return this.nativeChannel(context, 'scrollToItem')({ index, animated, }) as Promise<any>
|
||||
@@ -108,6 +120,12 @@ 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()
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user