feat:add comments

This commit is contained in:
pengfei.zhou 2021-04-30 14:47:34 +08:00 committed by osborn
parent 6da8d5658b
commit 5fc770f62a
11 changed files with 117 additions and 77 deletions

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

@ -589,40 +589,43 @@ declare module 'doric/lib/src/widget/list' {
import { BridgeContext } from "doric/lib/src/runtime/global"; import { BridgeContext } from "doric/lib/src/runtime/global";
import { Color } from "doric/lib/src/util/color"; import { Color } from "doric/lib/src/util/color";
export class ListItem extends Stack { export class ListItem extends Stack {
/** /**
* Set to reuse native view * Set to reuse native view
*/ */
identifier?: string; identifier?: string;
actions?: { actions?: {
title: string; title: string;
backgroundColor?: Color; backgroundColor?: Color;
callback: () => void; callback: () => void;
}[]; }[];
} }
export class List extends Superview { export class List extends Superview {
allSubviews(): IterableIterator<ListItem> | ListItem[]; allSubviews(): IterableIterator<ListItem> | ListItem[];
itemCount: number; itemCount: number;
renderItem: (index: number) => ListItem; renderItem: (index: number) => ListItem;
batchCount: number; batchCount: number;
onLoadMore?: () => void; onLoadMore?: () => void;
loadMore?: boolean; loadMore?: boolean;
loadMoreView?: ListItem; loadMoreView?: ListItem;
onScroll?: (offset: { onScroll?: (offset: {
x: number; x: number;
y: number; y: number;
}) => void; }) => void;
onScrollEnd?: (offset: { onScrollEnd?: (offset: {
x: number; x: number;
y: number; y: number;
}) => void; }) => void;
scrolledPosition?: number; scrolledPosition?: number;
scrollable?: boolean; scrollable?: boolean;
bounces?: boolean; /**
scrollToItem(context: BridgeContext, index: number, config?: { * Take effect only on iOS
animated?: boolean; */
}): Promise<any>; bounces?: boolean;
reset(): void; scrollToItem(context: BridgeContext, index: number, config?: {
toModel(): NativeViewModel; animated?: boolean;
}): Promise<any>;
reset(): void;
toModel(): NativeViewModel;
} }
export function list(config: Partial<List>): List; export function list(config: Partial<List>): List;
export function listItem(item: View | View[], config?: Partial<ListItem>): ListItem; export function listItem(item: View | View[], config?: Partial<ListItem>): ListItem;
@ -633,22 +636,25 @@ declare module 'doric/lib/src/widget/slider' {
import { Stack } from "doric/lib/src/widget/layouts"; import { Stack } from "doric/lib/src/widget/layouts";
import { BridgeContext } from "doric/lib/src/runtime/global"; import { BridgeContext } from "doric/lib/src/runtime/global";
export class SlideItem extends Stack { export class SlideItem extends Stack {
/** /**
* Set to reuse native view * Set to reuse native view
*/ */
identifier?: string; identifier?: string;
} }
export class Slider extends Superview { export class Slider extends Superview {
allSubviews(): IterableIterator<SlideItem>; allSubviews(): IterableIterator<SlideItem>;
itemCount: number; itemCount: number;
renderPage: (index: number) => SlideItem; renderPage: (index: number) => SlideItem;
batchCount: number; batchCount: number;
onPageSlided?: (index: number) => void; onPageSlided?: (index: number) => void;
loop?: boolean; loop?: boolean;
scrollable?: boolean; scrollable?: boolean;
bounces?: boolean; /**
slidePage(context: BridgeContext, page: number, smooth?: boolean): Promise<any>; * Take effect only on iOS
getSlidedPage(context: BridgeContext): Promise<number>; */
bounces?: boolean;
slidePage(context: BridgeContext, page: number, smooth?: boolean): Promise<any>;
getSlidedPage(context: BridgeContext): Promise<number>;
} }
export function slider(config: Partial<Slider>): Slider; export function slider(config: Partial<Slider>): Slider;
export function slideItem(item: View | View[], config?: Partial<SlideItem>): SlideItem; export function slideItem(item: View | View[], config?: Partial<SlideItem>): SlideItem;
@ -673,6 +679,9 @@ declare module 'doric/lib/src/widget/scroller' {
y: number; y: number;
}) => void; }) => void;
scrollable?: boolean; scrollable?: boolean;
/**
* Take effect only on iOS
*/
bounces?: boolean; bounces?: boolean;
allSubviews(): View[]; allSubviews(): View[];
toModel(): NativeViewModel; toModel(): NativeViewModel;
@ -714,34 +723,37 @@ declare module 'doric/lib/src/widget/flowlayout' {
import { Stack } from 'doric/lib/src/widget/layouts'; import { Stack } from 'doric/lib/src/widget/layouts';
import { Superview, View, NativeViewModel } from 'doric/lib/src/ui/view'; import { Superview, View, NativeViewModel } from 'doric/lib/src/ui/view';
export class FlowLayoutItem extends Stack { export class FlowLayoutItem extends Stack {
/** /**
* Set to reuse native view * Set to reuse native view
*/ */
identifier?: string; identifier?: string;
} }
export class FlowLayout extends Superview { export class FlowLayout extends Superview {
allSubviews(): IterableIterator<FlowLayoutItem> | FlowLayoutItem[]; allSubviews(): IterableIterator<FlowLayoutItem> | FlowLayoutItem[];
columnCount: number; columnCount: number;
columnSpace?: number; columnSpace?: number;
rowSpace?: number; rowSpace?: number;
itemCount: number; itemCount: number;
renderItem: (index: number) => FlowLayoutItem; renderItem: (index: number) => FlowLayoutItem;
batchCount: number; batchCount: number;
onLoadMore?: () => void; onLoadMore?: () => void;
loadMore?: boolean; loadMore?: boolean;
loadMoreView?: FlowLayoutItem; loadMoreView?: FlowLayoutItem;
onScroll?: (offset: { onScroll?: (offset: {
x: number; x: number;
y: number; y: number;
}) => void; }) => void;
onScrollEnd?: (offset: { onScrollEnd?: (offset: {
x: number; x: number;
y: number; y: number;
}) => void; }) => void;
scrollable?: boolean; scrollable?: boolean;
bounces?: boolean; /**
reset(): void; * Take effect only on iOS
toModel(): NativeViewModel; */
bounces?: boolean;
reset(): void;
toModel(): NativeViewModel;
} }
export function flowlayout(config: Partial<FlowLayout>): FlowLayout; export function flowlayout(config: Partial<FlowLayout>): FlowLayout;
export function flowItem(item: View | View[], config?: Partial<FlowLayoutItem>): FlowLayoutItem; export function flowItem(item: View | View[], config?: Partial<FlowLayoutItem>): FlowLayoutItem;
@ -786,6 +798,9 @@ declare module 'doric/lib/src/widget/nestedSlider' {
export class NestedSlider extends Group { export class NestedSlider extends Group {
onPageSlided?: (index: number) => void; onPageSlided?: (index: number) => void;
scrollable?: boolean; scrollable?: boolean;
/**
* Take effect only on iOS
*/
bounces?: boolean; bounces?: boolean;
addSlideItem(view: View): void; addSlideItem(view: View): void;
slidePage(context: BridgeContext, page: number, smooth?: boolean): Promise<any>; slidePage(context: BridgeContext, page: number, smooth?: boolean): Promise<any>;

View File

@ -27,6 +27,9 @@ export declare class FlowLayout extends Superview {
y: number; y: number;
}) => void; }) => void;
scrollable?: boolean; scrollable?: boolean;
/**
* Take effect only on iOS
*/
bounces?: boolean; bounces?: boolean;
reset(): void; reset(): void;
private getItem; private getItem;

View File

@ -32,6 +32,9 @@ export declare class List extends Superview {
}) => void; }) => void;
scrolledPosition?: number; scrolledPosition?: number;
scrollable?: boolean; scrollable?: boolean;
/**
* Take effect only on iOS
*/
bounces?: boolean; bounces?: boolean;
scrollToItem(context: BridgeContext, index: number, config?: { scrollToItem(context: BridgeContext, index: number, config?: {
animated?: boolean; animated?: boolean;

View File

@ -3,6 +3,9 @@ import { BridgeContext } from '../runtime/global';
export declare class NestedSlider extends Group { export declare class NestedSlider extends Group {
onPageSlided?: (index: number) => void; onPageSlided?: (index: number) => void;
scrollable?: boolean; scrollable?: boolean;
/**
* Take effect only on iOS
*/
bounces?: boolean; bounces?: boolean;
addSlideItem(view: View): void; addSlideItem(view: View): void;
slidePage(context: BridgeContext, page: number, smooth?: boolean): Promise<any>; slidePage(context: BridgeContext, page: number, smooth?: boolean): Promise<any>;

View File

@ -16,6 +16,9 @@ export declare class Scroller extends Superview {
y: number; y: number;
}) => void; }) => void;
scrollable?: boolean; scrollable?: boolean;
/**
* Take effect only on iOS
*/
bounces?: boolean; bounces?: boolean;
allSubviews(): View[]; allSubviews(): View[];
toModel(): NativeViewModel; toModel(): NativeViewModel;

View File

@ -16,6 +16,9 @@ export declare class Slider extends Superview {
onPageSlided?: (index: number) => void; onPageSlided?: (index: number) => void;
loop?: boolean; loop?: boolean;
scrollable?: boolean; scrollable?: boolean;
/**
* Take effect only on iOS
*/
bounces?: boolean; bounces?: boolean;
private getItem; private getItem;
private renderBunchedItems; private renderBunchedItems;

View File

@ -71,7 +71,9 @@ export class FlowLayout extends Superview {
@Property @Property
scrollable?: boolean scrollable?: boolean
/**
* Take effect only on iOS
*/
@Property @Property
bounces?: boolean bounces?: boolean

View File

@ -75,7 +75,9 @@ export class List extends Superview {
@Property @Property
scrollable?: boolean scrollable?: boolean
/**
* Take effect only on iOS
*/
@Property @Property
bounces?: boolean bounces?: boolean

View File

@ -23,7 +23,9 @@ export class NestedSlider extends Group {
@Property @Property
scrollable?: boolean scrollable?: boolean
/**
* Take effect only on iOS
*/
@Property @Property
bounces?: boolean bounces?: boolean

View File

@ -44,7 +44,9 @@ export class Scroller extends Superview {
@Property @Property
scrollable?: boolean scrollable?: boolean
/**
* Take effect only on iOS
*/
@Property @Property
bounces?: boolean bounces?: boolean

View File

@ -51,7 +51,9 @@ export class Slider extends Superview {
@Property @Property
scrollable?: boolean scrollable?: boolean
/**
* Take effect only on iOS
*/
@Property @Property
bounces?: boolean bounces?: boolean