2020-01-03 15:28:33 +08:00
|
|
|
|
// Generated by dts-bundle v0.7.3
|
|
|
|
|
// Dependencies for this module:
|
|
|
|
|
// reflect-metadata
|
|
|
|
|
|
|
|
|
|
declare module 'doric' {
|
|
|
|
|
export * from 'doric/lib/src/runtime/global';
|
|
|
|
|
export * from 'doric/lib/src/ui/index.ui';
|
|
|
|
|
export * from "doric/lib/src/widget/index.widget";
|
|
|
|
|
export * from 'doric/lib/src/native/index.native';
|
|
|
|
|
export * from "doric/lib/src/util/index.util";
|
|
|
|
|
export * from "doric/lib/src/pattern/index.pattern";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
declare module 'doric/lib/src/runtime/global' {
|
|
|
|
|
export * from 'reflect-metadata';
|
|
|
|
|
export type BridgeContext = {
|
2020-01-17 16:51:17 +08:00
|
|
|
|
/**
|
|
|
|
|
* The identify of current context
|
|
|
|
|
*/
|
|
|
|
|
id: string;
|
|
|
|
|
/**
|
|
|
|
|
* In this case,It's current panel
|
|
|
|
|
*/
|
|
|
|
|
entity: any;
|
|
|
|
|
/**
|
|
|
|
|
* call native plugin
|
|
|
|
|
* @param namespace
|
|
|
|
|
* @param method
|
|
|
|
|
* @param args
|
|
|
|
|
*/
|
|
|
|
|
callNative(namespace: string, method: string, args?: any): Promise<any>;
|
|
|
|
|
/**
|
|
|
|
|
* Transform function to functionId as string
|
|
|
|
|
* @param func
|
|
|
|
|
*/
|
|
|
|
|
function2Id(func: Function): string;
|
|
|
|
|
/**
|
|
|
|
|
* Remove transformed functions
|
|
|
|
|
* @param funcId
|
|
|
|
|
*/
|
|
|
|
|
removeFuncById(funcId: string): void;
|
2020-01-03 15:28:33 +08:00
|
|
|
|
};
|
|
|
|
|
global {
|
2020-01-17 16:51:17 +08:00
|
|
|
|
const context: BridgeContext;
|
|
|
|
|
const Environment: {
|
|
|
|
|
platform: "Android" | "iOS" | "Qt" | "web";
|
|
|
|
|
platformVersion: string;
|
|
|
|
|
appName: string;
|
|
|
|
|
appVersion: string;
|
|
|
|
|
libVersion: string;
|
|
|
|
|
screenWidth: number;
|
|
|
|
|
screenHeight: number;
|
2020-01-21 15:31:26 +08:00
|
|
|
|
statusBarHeight: number;
|
2020-03-19 11:51:32 +08:00
|
|
|
|
hasNotch: boolean;
|
2020-03-14 10:57:04 +08:00
|
|
|
|
/**
|
|
|
|
|
* ex:Apple or Google
|
|
|
|
|
*/
|
2020-03-14 10:54:13 +08:00
|
|
|
|
deviceBrand: string;
|
2020-03-14 10:57:04 +08:00
|
|
|
|
/**
|
|
|
|
|
* ex: iPhone12,5 or pixel 3
|
|
|
|
|
*/
|
2020-03-14 10:54:13 +08:00
|
|
|
|
deviceModel: string;
|
2020-01-17 16:51:17 +08:00
|
|
|
|
[index: string]: number | string | boolean | object | undefined;
|
|
|
|
|
};
|
|
|
|
|
function Entry(constructor: {
|
|
|
|
|
new (...args: any[]): {};
|
|
|
|
|
}): any;
|
2020-01-03 15:28:33 +08:00
|
|
|
|
}
|
2020-01-10 16:19:53 +08:00
|
|
|
|
export {};
|
2020-01-03 15:28:33 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
declare module 'doric/lib/src/ui/index.ui' {
|
|
|
|
|
export * from 'doric/lib/src/ui/view';
|
|
|
|
|
export * from 'doric/lib/src/ui/panel';
|
|
|
|
|
export * from 'doric/lib/src/ui/animation';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
declare module 'doric/lib/src/widget/index.widget' {
|
|
|
|
|
export * from 'doric/lib/src/widget/layouts';
|
|
|
|
|
export * from 'doric/lib/src/widget/text';
|
|
|
|
|
export * from 'doric/lib/src/widget/image';
|
|
|
|
|
export * from 'doric/lib/src/widget/list';
|
|
|
|
|
export * from 'doric/lib/src/widget/slider';
|
|
|
|
|
export * from 'doric/lib/src/widget/scroller';
|
|
|
|
|
export * from 'doric/lib/src/widget/refreshable';
|
|
|
|
|
export * from 'doric/lib/src/widget/flowlayout';
|
|
|
|
|
export * from 'doric/lib/src/widget/input';
|
|
|
|
|
export * from 'doric/lib/src/widget/nestedSlider';
|
2020-01-03 19:02:41 +08:00
|
|
|
|
export * from 'doric/lib/src/widget/draggable';
|
2020-03-13 13:01:21 +08:00
|
|
|
|
export * from 'doric/lib/src/widget/switch';
|
2020-01-03 15:28:33 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
declare module 'doric/lib/src/native/index.native' {
|
|
|
|
|
export * from 'doric/lib/src/native/modal';
|
|
|
|
|
export * from 'doric/lib/src/native/navbar';
|
|
|
|
|
export * from 'doric/lib/src/native/navigator';
|
|
|
|
|
export * from 'doric/lib/src/native/network';
|
|
|
|
|
export * from 'doric/lib/src/native/storage';
|
|
|
|
|
export * from 'doric/lib/src/native/popover';
|
|
|
|
|
export * from 'doric/lib/src/native/animate';
|
2020-01-08 20:18:19 +08:00
|
|
|
|
export * from 'doric/lib/src/native/notification';
|
2020-01-14 10:59:42 +08:00
|
|
|
|
export * from 'doric/lib/src/native/statusbar';
|
2020-02-13 20:26:58 +08:00
|
|
|
|
export * from 'doric/lib/src/native/coordinator';
|
2020-03-19 14:32:42 +08:00
|
|
|
|
export * from 'doric/lib/src/native/notch';
|
2020-01-03 15:28:33 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
declare module 'doric/lib/src/util/index.util' {
|
|
|
|
|
export * from 'doric/lib/src/util/color';
|
|
|
|
|
export * from 'doric/lib/src/util/gravity';
|
|
|
|
|
export * from 'doric/lib/src/util/layoutconfig';
|
|
|
|
|
export * from 'doric/lib/src/util/log';
|
|
|
|
|
export * from 'doric/lib/src/util/types';
|
|
|
|
|
export * from 'doric/lib/src/util/uniqueId';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
declare module 'doric/lib/src/pattern/index.pattern' {
|
|
|
|
|
export * from 'doric/lib/src/pattern/candies';
|
|
|
|
|
export * from 'doric/lib/src/pattern/provider';
|
|
|
|
|
export * from 'doric/lib/src/pattern/mvvm';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
declare module 'doric/lib/src/ui/view' {
|
|
|
|
|
import { Color, GradientColor } from "doric/lib/src/util/color";
|
|
|
|
|
import { Modeling, Model } from "doric/lib/src/util/types";
|
|
|
|
|
import { BridgeContext } from "doric/lib/src/runtime/global";
|
|
|
|
|
import { LayoutConfig } from 'doric/lib/src/util/layoutconfig';
|
|
|
|
|
import { IAnimation } from "doric/lib/src/ui/animation";
|
|
|
|
|
export function Property(target: Object, propKey: string): void;
|
|
|
|
|
export interface IView {
|
2020-01-10 16:19:53 +08:00
|
|
|
|
width?: number;
|
|
|
|
|
height?: number;
|
|
|
|
|
backgroundColor?: Color | GradientColor;
|
|
|
|
|
corners?: number | {
|
|
|
|
|
leftTop?: number;
|
|
|
|
|
rightTop?: number;
|
|
|
|
|
leftBottom?: number;
|
|
|
|
|
rightBottom?: number;
|
|
|
|
|
};
|
|
|
|
|
border?: {
|
|
|
|
|
width: number;
|
|
|
|
|
color: Color;
|
|
|
|
|
};
|
|
|
|
|
shadow?: {
|
|
|
|
|
color: Color;
|
|
|
|
|
opacity: number;
|
|
|
|
|
radius: number;
|
|
|
|
|
offsetX: number;
|
|
|
|
|
offsetY: number;
|
|
|
|
|
};
|
|
|
|
|
/**
|
|
|
|
|
* float [0,..1]
|
|
|
|
|
*/
|
|
|
|
|
alpha?: number;
|
|
|
|
|
hidden?: boolean;
|
|
|
|
|
padding?: {
|
|
|
|
|
left?: number;
|
|
|
|
|
right?: number;
|
|
|
|
|
top?: number;
|
|
|
|
|
bottom?: number;
|
|
|
|
|
};
|
|
|
|
|
layoutConfig?: LayoutConfig;
|
|
|
|
|
onClick?: Function;
|
|
|
|
|
identifier?: string;
|
|
|
|
|
/**++++++++++transform++++++++++*/
|
|
|
|
|
translationX?: number;
|
|
|
|
|
translationY?: number;
|
|
|
|
|
scaleX?: number;
|
|
|
|
|
scaleY?: number;
|
|
|
|
|
/**
|
|
|
|
|
* float [0,..1]
|
|
|
|
|
*/
|
|
|
|
|
pivotX?: number;
|
|
|
|
|
/**
|
|
|
|
|
* float [0,..1]
|
|
|
|
|
*/
|
|
|
|
|
pivotY?: number;
|
|
|
|
|
/**
|
|
|
|
|
* rotation*PI
|
|
|
|
|
*/
|
|
|
|
|
rotation?: number;
|
2020-01-03 15:28:33 +08:00
|
|
|
|
}
|
2020-01-03 16:35:04 +08:00
|
|
|
|
export type NativeViewModel = {
|
2020-01-10 16:19:53 +08:00
|
|
|
|
id: string;
|
|
|
|
|
type: string;
|
|
|
|
|
props: {
|
|
|
|
|
[index: string]: Model;
|
|
|
|
|
};
|
2020-01-03 16:35:04 +08:00
|
|
|
|
};
|
2020-01-03 15:28:33 +08:00
|
|
|
|
export abstract class View implements Modeling, IView {
|
|
|
|
|
width: number;
|
2020-01-10 16:19:53 +08:00
|
|
|
|
height: number;
|
2020-01-03 15:28:33 +08:00
|
|
|
|
x: number;
|
|
|
|
|
y: number;
|
2020-01-10 16:19:53 +08:00
|
|
|
|
backgroundColor?: Color | GradientColor;
|
|
|
|
|
corners?: number | {
|
|
|
|
|
leftTop?: number;
|
|
|
|
|
rightTop?: number;
|
|
|
|
|
leftBottom?: number;
|
|
|
|
|
rightBottom?: number;
|
|
|
|
|
};
|
|
|
|
|
border?: {
|
|
|
|
|
width: number;
|
|
|
|
|
color: Color;
|
|
|
|
|
};
|
|
|
|
|
shadow?: {
|
|
|
|
|
color: Color;
|
|
|
|
|
opacity: number;
|
|
|
|
|
radius: number;
|
|
|
|
|
offsetX: number;
|
|
|
|
|
offsetY: number;
|
|
|
|
|
};
|
|
|
|
|
alpha?: number;
|
|
|
|
|
hidden?: boolean;
|
|
|
|
|
viewId: string;
|
|
|
|
|
padding?: {
|
|
|
|
|
left?: number;
|
|
|
|
|
right?: number;
|
|
|
|
|
top?: number;
|
|
|
|
|
bottom?: number;
|
|
|
|
|
};
|
|
|
|
|
layoutConfig?: LayoutConfig;
|
|
|
|
|
onClick?: Function;
|
|
|
|
|
superview?: Superview;
|
|
|
|
|
callbacks: Map<String, Function>;
|
|
|
|
|
constructor();
|
|
|
|
|
/** Anchor start*/
|
|
|
|
|
get left(): number;
|
|
|
|
|
set left(v: number);
|
|
|
|
|
get right(): number;
|
|
|
|
|
set right(v: number);
|
|
|
|
|
get top(): number;
|
|
|
|
|
set top(v: number);
|
|
|
|
|
get bottom(): number;
|
|
|
|
|
set bottom(v: number);
|
|
|
|
|
get centerX(): number;
|
|
|
|
|
get centerY(): number;
|
|
|
|
|
set centerX(v: number);
|
|
|
|
|
set centerY(v: number);
|
|
|
|
|
get dirtyProps(): {
|
|
|
|
|
[index: string]: Model;
|
|
|
|
|
};
|
|
|
|
|
nativeViewModel: NativeViewModel;
|
|
|
|
|
onPropertyChanged(propKey: string, oldV: Model, newV: Model): void;
|
|
|
|
|
clean(): void;
|
|
|
|
|
isDirty(): boolean;
|
|
|
|
|
responseCallback(id: string, ...args: any): any;
|
|
|
|
|
toModel(): NativeViewModel;
|
|
|
|
|
let(block: (it: this) => void): void;
|
|
|
|
|
also(block: (it: this) => void): this;
|
|
|
|
|
apply(config: IView): this;
|
|
|
|
|
in(group: Group): this;
|
2020-01-17 16:51:17 +08:00
|
|
|
|
nativeChannel(context: BridgeContext, name: string): (args?: any) => Promise<any>;
|
2020-01-10 16:19:53 +08:00
|
|
|
|
getWidth(context: BridgeContext): Promise<number>;
|
|
|
|
|
getHeight(context: BridgeContext): Promise<number>;
|
2020-03-03 14:43:49 +08:00
|
|
|
|
getX(context: BridgeContext): Promise<number>;
|
|
|
|
|
getY(context: BridgeContext): Promise<number>;
|
2020-01-10 16:19:53 +08:00
|
|
|
|
getLocationOnScreen(context: BridgeContext): Promise<{
|
|
|
|
|
x: number;
|
|
|
|
|
y: number;
|
|
|
|
|
}>;
|
|
|
|
|
/**++++++++++transform++++++++++*/
|
|
|
|
|
translationX?: number;
|
|
|
|
|
translationY?: number;
|
|
|
|
|
scaleX?: number;
|
|
|
|
|
scaleY?: number;
|
|
|
|
|
pivotX?: number;
|
|
|
|
|
pivotY?: number;
|
|
|
|
|
rotation?: number;
|
|
|
|
|
/**----------transform----------*/
|
|
|
|
|
doAnimation(context: BridgeContext, animation: IAnimation): Promise<void>;
|
2020-01-03 15:28:33 +08:00
|
|
|
|
}
|
|
|
|
|
export abstract class Superview extends View {
|
2020-01-10 16:19:53 +08:00
|
|
|
|
subviewById(id: string): View | undefined;
|
|
|
|
|
abstract allSubviews(): Iterable<View>;
|
|
|
|
|
isDirty(): boolean;
|
|
|
|
|
clean(): void;
|
|
|
|
|
toModel(): NativeViewModel;
|
2020-01-03 15:28:33 +08:00
|
|
|
|
}
|
|
|
|
|
export abstract class Group extends Superview {
|
2020-01-10 16:19:53 +08:00
|
|
|
|
readonly children: View[];
|
|
|
|
|
allSubviews(): View[];
|
|
|
|
|
addChild(view: View): void;
|
2020-01-03 15:28:33 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
declare module 'doric/lib/src/ui/panel' {
|
|
|
|
|
import { View, Group } from "doric/lib/src/ui/view";
|
|
|
|
|
import { Root } from 'doric/lib/src/widget/layouts';
|
|
|
|
|
import { BridgeContext } from 'doric/lib/src/runtime/global';
|
|
|
|
|
export function NativeCall(target: Panel, propertyKey: string, descriptor: PropertyDescriptor): PropertyDescriptor;
|
|
|
|
|
export abstract class Panel {
|
|
|
|
|
context: BridgeContext;
|
|
|
|
|
onCreate(): void;
|
|
|
|
|
onDestroy(): void;
|
|
|
|
|
onShow(): void;
|
|
|
|
|
onHidden(): void;
|
|
|
|
|
abstract build(rootView: Group): void;
|
2020-01-09 11:17:44 +08:00
|
|
|
|
addHeadView(type: string, v: View): void;
|
|
|
|
|
allHeadViews(): IterableIterator<Map<string, View>>;
|
|
|
|
|
removeHeadView(type: string, v: View | string): void;
|
|
|
|
|
clearHeadViews(type: string): void;
|
2020-01-03 15:28:33 +08:00
|
|
|
|
getRootView(): Root;
|
|
|
|
|
getInitData(): object | undefined;
|
2020-03-10 19:18:33 +08:00
|
|
|
|
addOnRenderFinishedCallback(cb: () => void): void;
|
2020-01-03 15:28:33 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
declare module 'doric/lib/src/ui/animation' {
|
|
|
|
|
import { Modeling, Model } from "doric/lib/src/util/types";
|
|
|
|
|
export type AnimatedKey = "translationX" | "translationY" | "scaleX" | "scaleY" | "rotation" | "pivotX" | "pivotY";
|
|
|
|
|
export enum RepeatMode {
|
2020-01-10 16:19:53 +08:00
|
|
|
|
RESTART = 1,
|
|
|
|
|
REVERSE = 2
|
2020-01-03 15:28:33 +08:00
|
|
|
|
}
|
|
|
|
|
export interface IAnimation extends Modeling {
|
2020-01-10 16:19:53 +08:00
|
|
|
|
duration: number;
|
|
|
|
|
delay?: number;
|
2020-01-03 15:28:33 +08:00
|
|
|
|
}
|
|
|
|
|
export interface Changeable {
|
2020-01-10 16:19:53 +08:00
|
|
|
|
fromValue: number;
|
|
|
|
|
toValue: number;
|
|
|
|
|
key: AnimatedKey;
|
|
|
|
|
repeatCount?: number;
|
|
|
|
|
repeatMode?: RepeatMode;
|
2020-01-03 15:28:33 +08:00
|
|
|
|
}
|
|
|
|
|
export enum FillMode {
|
2020-01-10 16:19:53 +08:00
|
|
|
|
/**
|
|
|
|
|
* The receiver is removed from the presentation when the animation is completed.
|
|
|
|
|
*/
|
|
|
|
|
Removed = 0,
|
|
|
|
|
/**
|
|
|
|
|
* The receiver remains visible in its final state when the animation is completed.
|
|
|
|
|
*/
|
|
|
|
|
Forward = 1,
|
|
|
|
|
/**
|
|
|
|
|
* The receiver clamps values before zero to zero when the animation is completed.
|
|
|
|
|
*/
|
|
|
|
|
Backward = 2,
|
|
|
|
|
/**
|
|
|
|
|
* The receiver clamps values at both ends of the object’s time space
|
|
|
|
|
*/
|
|
|
|
|
Both = 3
|
2020-01-03 15:28:33 +08:00
|
|
|
|
}
|
|
|
|
|
export enum TimingFunction {
|
2020-01-10 16:19:53 +08:00
|
|
|
|
/**
|
|
|
|
|
* The system default timing function. Use this function to ensure that the timing of your animations matches that of most system animations.
|
|
|
|
|
*/
|
|
|
|
|
Default = 0,
|
|
|
|
|
/**
|
|
|
|
|
* Linear pacing, which causes an animation to occur evenly over its duration.
|
|
|
|
|
*/
|
|
|
|
|
Linear = 1,
|
|
|
|
|
/**
|
|
|
|
|
* Ease-in pacing, which causes an animation to begin slowly and then speed up as it progresses.
|
|
|
|
|
*/
|
|
|
|
|
EaseIn = 2,
|
|
|
|
|
/**
|
|
|
|
|
* Ease-out pacing, which causes an animation to begin quickly and then slow as it progresses.
|
|
|
|
|
*/
|
|
|
|
|
EaseOut = 3,
|
|
|
|
|
/**
|
|
|
|
|
* Ease-in-ease-out pacing, which causes an animation to begin slowly, accelerate through the middle of its duration, and then slow again before completing.
|
|
|
|
|
*/
|
|
|
|
|
EaseInEaseOut = 4
|
2020-01-03 15:28:33 +08:00
|
|
|
|
}
|
|
|
|
|
abstract class Animation implements IAnimation {
|
2020-01-10 16:19:53 +08:00
|
|
|
|
changeables: Map<AnimatedKey, Changeable>;
|
2020-01-03 15:28:33 +08:00
|
|
|
|
duration: number;
|
2020-01-10 16:19:53 +08:00
|
|
|
|
repeatCount?: number;
|
|
|
|
|
repeatMode?: RepeatMode;
|
|
|
|
|
delay?: number;
|
2020-01-03 15:28:33 +08:00
|
|
|
|
fillMode: FillMode;
|
2020-01-10 16:19:53 +08:00
|
|
|
|
timingFunction?: TimingFunction;
|
|
|
|
|
toModel(): {
|
|
|
|
|
type: string;
|
|
|
|
|
delay: number | undefined;
|
|
|
|
|
duration: number;
|
|
|
|
|
changeables: {
|
|
|
|
|
key: AnimatedKey;
|
|
|
|
|
fromValue: number;
|
|
|
|
|
toValue: number;
|
|
|
|
|
}[];
|
|
|
|
|
repeatCount: number | undefined;
|
|
|
|
|
repeatMode: RepeatMode | undefined;
|
|
|
|
|
fillMode: FillMode;
|
|
|
|
|
timingFunction: TimingFunction | undefined;
|
|
|
|
|
};
|
2020-01-03 15:28:33 +08:00
|
|
|
|
}
|
|
|
|
|
export class ScaleAnimation extends Animation {
|
2020-01-10 16:19:53 +08:00
|
|
|
|
constructor();
|
|
|
|
|
set fromScaleX(v: number);
|
|
|
|
|
get fromScaleX(): number;
|
|
|
|
|
set toScaleX(v: number);
|
|
|
|
|
get toScaleX(): number;
|
|
|
|
|
set fromScaleY(v: number);
|
|
|
|
|
get fromScaleY(): number;
|
|
|
|
|
set toScaleY(v: number);
|
|
|
|
|
get toScaleY(): number;
|
2020-01-03 15:28:33 +08:00
|
|
|
|
}
|
|
|
|
|
export class TranslationAnimation extends Animation {
|
2020-01-10 16:19:53 +08:00
|
|
|
|
constructor();
|
|
|
|
|
set fromTranslationX(v: number);
|
|
|
|
|
get fromTranslationX(): number;
|
|
|
|
|
set toTranslationX(v: number);
|
|
|
|
|
get toTranslationX(): number;
|
|
|
|
|
set fromTranslationY(v: number);
|
|
|
|
|
get fromTranslationY(): number;
|
|
|
|
|
set toTranslationY(v: number);
|
|
|
|
|
get toTranslationY(): number;
|
2020-01-03 15:28:33 +08:00
|
|
|
|
}
|
|
|
|
|
export class RotationAnimation extends Animation {
|
2020-01-10 16:19:53 +08:00
|
|
|
|
constructor();
|
|
|
|
|
set fromRotation(v: number);
|
|
|
|
|
get fromRotation(): number;
|
|
|
|
|
set toRotation(v: number);
|
|
|
|
|
get toRotation(): number;
|
2020-01-03 15:28:33 +08:00
|
|
|
|
}
|
|
|
|
|
export class AnimationSet implements IAnimation {
|
2020-01-10 16:19:53 +08:00
|
|
|
|
_duration: number;
|
|
|
|
|
delay?: number;
|
|
|
|
|
addAnimation(anim: IAnimation): void;
|
|
|
|
|
get duration(): number;
|
|
|
|
|
set duration(v: number);
|
|
|
|
|
toModel(): {
|
|
|
|
|
animations: Model;
|
|
|
|
|
delay: number | undefined;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
export {};
|
2020-01-03 15:28:33 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
declare module 'doric/lib/src/widget/layouts' {
|
|
|
|
|
import { Group, IView, View } from "doric/lib/src/ui/view";
|
|
|
|
|
import { Gravity } from "doric/lib/src/util/gravity";
|
|
|
|
|
export interface IStack extends IView {
|
|
|
|
|
}
|
|
|
|
|
export class Stack extends Group implements IStack {
|
|
|
|
|
}
|
|
|
|
|
export class Root extends Stack {
|
|
|
|
|
}
|
|
|
|
|
class LinearLayout extends Group {
|
|
|
|
|
space?: number;
|
|
|
|
|
gravity?: Gravity;
|
|
|
|
|
}
|
|
|
|
|
export interface IVLayout extends IView {
|
|
|
|
|
space?: number;
|
|
|
|
|
gravity?: Gravity;
|
|
|
|
|
}
|
2020-03-19 13:35:04 +08:00
|
|
|
|
export class VLayout extends LinearLayout implements IVLayout {
|
2020-01-03 15:28:33 +08:00
|
|
|
|
}
|
|
|
|
|
export interface IHLayout extends IView {
|
|
|
|
|
space?: number;
|
|
|
|
|
gravity?: Gravity;
|
|
|
|
|
}
|
|
|
|
|
export class HLayout extends LinearLayout implements IHLayout {
|
|
|
|
|
}
|
2020-01-04 19:13:15 +08:00
|
|
|
|
export function stack(views: View[], config?: IStack): Stack;
|
|
|
|
|
export function hlayout(views: View[], config?: IHLayout): HLayout;
|
|
|
|
|
export function vlayout(views: View[], config?: IVLayout): VLayout;
|
2020-01-10 16:19:53 +08:00
|
|
|
|
export {};
|
2020-01-03 15:28:33 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
declare module 'doric/lib/src/widget/text' {
|
|
|
|
|
import { IView, View } from "doric/lib/src/ui/view";
|
|
|
|
|
import { Color } from "doric/lib/src/util/color";
|
|
|
|
|
import { Gravity } from "doric/lib/src/util/gravity";
|
|
|
|
|
export interface IText extends IView {
|
|
|
|
|
text?: string;
|
|
|
|
|
textColor?: Color;
|
|
|
|
|
textSize?: number;
|
|
|
|
|
maxLines?: number;
|
|
|
|
|
textAlignment?: Gravity;
|
2020-01-14 19:50:32 +08:00
|
|
|
|
fontStyle?: "normal" | "bold" | "italic" | "bold_italic";
|
2020-03-13 14:22:46 +08:00
|
|
|
|
font?: string;
|
2020-03-23 16:23:41 +08:00
|
|
|
|
maxWidth?: number;
|
|
|
|
|
maxHeight?: number;
|
2020-03-24 11:06:30 +08:00
|
|
|
|
lineSpacing?: number;
|
2020-01-03 15:28:33 +08:00
|
|
|
|
}
|
|
|
|
|
export class Text extends View implements IText {
|
|
|
|
|
text?: string;
|
|
|
|
|
textColor?: Color;
|
|
|
|
|
textSize?: number;
|
|
|
|
|
maxLines?: number;
|
|
|
|
|
textAlignment?: Gravity;
|
2020-01-14 19:50:32 +08:00
|
|
|
|
fontStyle?: "normal" | "bold" | "italic" | "bold_italic";
|
2020-03-13 14:22:46 +08:00
|
|
|
|
font?: string;
|
2020-03-23 16:23:41 +08:00
|
|
|
|
maxWidth?: number;
|
|
|
|
|
maxHeight?: number;
|
2020-03-24 11:06:30 +08:00
|
|
|
|
lineSpacing?: number;
|
2020-01-03 15:28:33 +08:00
|
|
|
|
}
|
|
|
|
|
export function text(config: IText): Text;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
declare module 'doric/lib/src/widget/image' {
|
|
|
|
|
import { IView, View } from "doric/lib/src/ui/view";
|
2020-03-05 11:01:10 +08:00
|
|
|
|
import { Color } from "doric/lib/src/util/color";
|
2020-01-03 15:28:33 +08:00
|
|
|
|
export enum ScaleType {
|
2020-03-05 11:01:10 +08:00
|
|
|
|
ScaleToFill = 0,
|
|
|
|
|
ScaleAspectFit = 1,
|
|
|
|
|
ScaleAspectFill = 2
|
2020-01-03 15:28:33 +08:00
|
|
|
|
}
|
|
|
|
|
export interface IImage extends IView {
|
2020-03-05 11:01:10 +08:00
|
|
|
|
imageUrl?: string;
|
2020-03-12 19:56:47 +08:00
|
|
|
|
/**
|
|
|
|
|
* Read image from local path
|
|
|
|
|
* For android,it based on assets dir.
|
|
|
|
|
* For iOS,it based on main bundle dir.
|
|
|
|
|
*/
|
|
|
|
|
imagePath?: string;
|
|
|
|
|
/**
|
|
|
|
|
* Read image from resource
|
|
|
|
|
* For android,it will try to read from drawable.
|
|
|
|
|
* For iOS,it will try to read from Image.Assets.
|
|
|
|
|
*/
|
|
|
|
|
imageRes?: string;
|
2020-03-05 11:01:10 +08:00
|
|
|
|
imageBase64?: string;
|
|
|
|
|
scaleType?: ScaleType;
|
|
|
|
|
isBlur?: boolean;
|
|
|
|
|
/**
|
|
|
|
|
* Display while image is loading
|
|
|
|
|
* Local file name
|
|
|
|
|
*/
|
|
|
|
|
placeHolderImage?: string;
|
|
|
|
|
/**
|
|
|
|
|
* Display while image is loading
|
|
|
|
|
* Color
|
|
|
|
|
* This priority is lower than placeHolderImage
|
|
|
|
|
*/
|
|
|
|
|
placeHolderColor?: Color;
|
|
|
|
|
/**
|
|
|
|
|
* Display while image is failed to load
|
|
|
|
|
* It can be file name in local path
|
|
|
|
|
*/
|
|
|
|
|
errorImage?: string;
|
|
|
|
|
/**
|
|
|
|
|
* Display while image is failed to load
|
|
|
|
|
* Color
|
|
|
|
|
* This priority is lower than errorImage
|
|
|
|
|
*/
|
|
|
|
|
errorColor?: Color;
|
|
|
|
|
loadCallback?: (image: {
|
|
|
|
|
width: number;
|
|
|
|
|
height: number;
|
|
|
|
|
} | undefined) => void;
|
2020-01-03 15:28:33 +08:00
|
|
|
|
}
|
2020-03-13 13:01:21 +08:00
|
|
|
|
export class Image extends View implements IImage {
|
|
|
|
|
imageUrl?: string;
|
|
|
|
|
imagePath?: string;
|
|
|
|
|
imageRes?: string;
|
2020-03-13 18:37:26 +08:00
|
|
|
|
imageBase64?: string;
|
2020-03-13 13:01:21 +08:00
|
|
|
|
scaleType?: ScaleType;
|
|
|
|
|
isBlur?: boolean;
|
|
|
|
|
placeHolderImage?: string;
|
|
|
|
|
placeHolderColor?: Color;
|
|
|
|
|
errorImage?: string;
|
|
|
|
|
errorColor?: Color;
|
|
|
|
|
loadCallback?: (image: {
|
|
|
|
|
width: number;
|
|
|
|
|
height: number;
|
|
|
|
|
} | undefined) => void;
|
|
|
|
|
}
|
2020-01-03 15:28:33 +08:00
|
|
|
|
export function image(config: IImage): Image;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
declare module 'doric/lib/src/widget/list' {
|
2020-01-03 16:35:04 +08:00
|
|
|
|
import { View, Superview, IView, NativeViewModel } from "doric/lib/src/ui/view";
|
2020-01-04 19:13:15 +08:00
|
|
|
|
import { Stack, IStack } from "doric/lib/src/widget/layouts";
|
|
|
|
|
export interface IListItem extends IStack {
|
|
|
|
|
identifier?: string;
|
|
|
|
|
}
|
|
|
|
|
export class ListItem extends Stack implements IListItem {
|
2020-01-03 15:28:33 +08:00
|
|
|
|
/**
|
|
|
|
|
* Set to reuse native view
|
|
|
|
|
*/
|
|
|
|
|
identifier?: string;
|
|
|
|
|
}
|
|
|
|
|
export interface IList extends IView {
|
|
|
|
|
renderItem: (index: number) => ListItem;
|
|
|
|
|
itemCount: number;
|
|
|
|
|
batchCount?: number;
|
2020-01-06 10:43:18 +08:00
|
|
|
|
onLoadMore?: () => void;
|
|
|
|
|
loadMore?: boolean;
|
|
|
|
|
loadMoreView?: ListItem;
|
2020-03-11 13:41:22 +08:00
|
|
|
|
onScroll?: (offset: {
|
|
|
|
|
x: number;
|
|
|
|
|
y: number;
|
|
|
|
|
}) => void;
|
|
|
|
|
onScrollEnd?: (offset: {
|
|
|
|
|
x: number;
|
|
|
|
|
y: number;
|
|
|
|
|
}) => void;
|
2020-01-03 15:28:33 +08:00
|
|
|
|
}
|
|
|
|
|
export class List extends Superview implements IList {
|
|
|
|
|
allSubviews(): IterableIterator<ListItem> | ListItem[];
|
|
|
|
|
itemCount: number;
|
|
|
|
|
renderItem: (index: number) => ListItem;
|
|
|
|
|
batchCount: number;
|
|
|
|
|
onLoadMore?: () => void;
|
|
|
|
|
loadMore?: boolean;
|
|
|
|
|
loadMoreView?: ListItem;
|
2020-03-11 13:41:22 +08:00
|
|
|
|
onScroll?: (offset: {
|
|
|
|
|
x: number;
|
|
|
|
|
y: number;
|
|
|
|
|
}) => void;
|
|
|
|
|
onScrollEnd?: (offset: {
|
|
|
|
|
x: number;
|
|
|
|
|
y: number;
|
|
|
|
|
}) => void;
|
2020-01-03 15:28:33 +08:00
|
|
|
|
reset(): void;
|
|
|
|
|
isDirty(): boolean;
|
2020-01-03 16:35:04 +08:00
|
|
|
|
toModel(): NativeViewModel;
|
2020-01-03 15:28:33 +08:00
|
|
|
|
}
|
|
|
|
|
export function list(config: IList): List;
|
2020-01-04 19:13:15 +08:00
|
|
|
|
export function listItem(item: View | View[], config?: IListItem): ListItem;
|
2020-01-03 15:28:33 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
declare module 'doric/lib/src/widget/slider' {
|
|
|
|
|
import { Superview, View, IView } from "doric/lib/src/ui/view";
|
2020-01-04 19:13:15 +08:00
|
|
|
|
import { Stack, IStack } from "doric/lib/src/widget/layouts";
|
2020-01-03 15:28:33 +08:00
|
|
|
|
import { BridgeContext } from "doric/lib/src/runtime/global";
|
2020-01-04 19:13:15 +08:00
|
|
|
|
export interface ISlideItem extends IStack {
|
|
|
|
|
identifier?: string;
|
|
|
|
|
}
|
|
|
|
|
export class SlideItem extends Stack implements ISlideItem {
|
2020-01-03 15:28:33 +08:00
|
|
|
|
/**
|
|
|
|
|
* Set to reuse native view
|
|
|
|
|
*/
|
|
|
|
|
identifier?: string;
|
|
|
|
|
}
|
|
|
|
|
export interface ISlider extends IView {
|
|
|
|
|
renderPage: (index: number) => SlideItem;
|
|
|
|
|
itemCount: number;
|
|
|
|
|
batchCount?: number;
|
|
|
|
|
onPageSlided?: (index: number) => void;
|
|
|
|
|
}
|
|
|
|
|
export class Slider extends Superview implements ISlider {
|
|
|
|
|
allSubviews(): IterableIterator<SlideItem>;
|
|
|
|
|
itemCount: number;
|
|
|
|
|
renderPage: (index: number) => SlideItem;
|
|
|
|
|
batchCount: number;
|
|
|
|
|
onPageSlided?: (index: number) => void;
|
|
|
|
|
isDirty(): boolean;
|
|
|
|
|
slidePage(context: BridgeContext, page: number, smooth?: boolean): Promise<any>;
|
|
|
|
|
getSlidedPage(context: BridgeContext): Promise<number>;
|
|
|
|
|
}
|
|
|
|
|
export function slider(config: ISlider): Slider;
|
2020-01-04 19:13:15 +08:00
|
|
|
|
export function slideItem(item: View | View[], config?: ISlideItem): SlideItem;
|
2020-01-03 15:28:33 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
declare module 'doric/lib/src/widget/scroller' {
|
2020-01-03 16:35:04 +08:00
|
|
|
|
import { Superview, View, IView, NativeViewModel } from 'doric/lib/src/ui/view';
|
2020-03-03 13:10:35 +08:00
|
|
|
|
import { BridgeContext } from 'doric/lib/src/runtime/global';
|
2020-01-06 10:43:18 +08:00
|
|
|
|
export function scroller(content: View, config?: IScroller): Scroller;
|
2020-01-03 15:28:33 +08:00
|
|
|
|
export interface IScroller extends IView {
|
2020-01-06 10:43:18 +08:00
|
|
|
|
content?: View;
|
2020-03-03 13:23:06 +08:00
|
|
|
|
contentOffset?: {
|
|
|
|
|
x: number;
|
|
|
|
|
y: number;
|
|
|
|
|
};
|
2020-01-03 15:28:33 +08:00
|
|
|
|
}
|
|
|
|
|
export class Scroller extends Superview implements IScroller {
|
|
|
|
|
content: View;
|
2020-03-03 13:23:06 +08:00
|
|
|
|
contentOffset?: {
|
|
|
|
|
x: number;
|
|
|
|
|
y: number;
|
|
|
|
|
};
|
2020-03-03 15:51:20 +08:00
|
|
|
|
onScroll?: (offset: {
|
|
|
|
|
x: number;
|
|
|
|
|
y: number;
|
|
|
|
|
}) => void;
|
|
|
|
|
onScrollEnd?: (offset: {
|
|
|
|
|
x: number;
|
|
|
|
|
y: number;
|
|
|
|
|
}) => void;
|
2020-01-03 15:28:33 +08:00
|
|
|
|
allSubviews(): View[];
|
2020-01-03 16:35:04 +08:00
|
|
|
|
toModel(): NativeViewModel;
|
2020-03-03 13:10:35 +08:00
|
|
|
|
scrollTo(context: BridgeContext, offset: {
|
|
|
|
|
x: number;
|
|
|
|
|
y: number;
|
|
|
|
|
}, animated?: boolean): Promise<any>;
|
2020-03-03 13:54:36 +08:00
|
|
|
|
scrollBy(context: BridgeContext, offset: {
|
|
|
|
|
x: number;
|
|
|
|
|
y: number;
|
|
|
|
|
}, animated?: boolean): Promise<any>;
|
2020-01-03 15:28:33 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
declare module 'doric/lib/src/widget/refreshable' {
|
2020-01-03 16:35:04 +08:00
|
|
|
|
import { View, Superview, IView, NativeViewModel } from "doric/lib/src/ui/view";
|
2020-01-03 15:28:33 +08:00
|
|
|
|
import { List } from "doric/lib/src/widget/list";
|
|
|
|
|
import { Scroller } from "doric/lib/src/widget/scroller";
|
|
|
|
|
import { BridgeContext } from "doric/lib/src/runtime/global";
|
|
|
|
|
export interface IRefreshable extends IView {
|
|
|
|
|
content: View;
|
|
|
|
|
header?: View;
|
|
|
|
|
onRefresh?: () => void;
|
|
|
|
|
}
|
|
|
|
|
export class Refreshable extends Superview implements IRefreshable {
|
|
|
|
|
content: List | Scroller;
|
|
|
|
|
header?: View;
|
|
|
|
|
onRefresh?: () => void;
|
|
|
|
|
allSubviews(): View[];
|
|
|
|
|
setRefreshable(context: BridgeContext, refreshable: boolean): Promise<any>;
|
|
|
|
|
setRefreshing(context: BridgeContext, refreshing: boolean): Promise<any>;
|
|
|
|
|
isRefreshable(context: BridgeContext): Promise<boolean>;
|
|
|
|
|
isRefreshing(context: BridgeContext): Promise<boolean>;
|
2020-01-03 16:35:04 +08:00
|
|
|
|
toModel(): NativeViewModel;
|
2020-01-03 15:28:33 +08:00
|
|
|
|
}
|
|
|
|
|
export function refreshable(config: IRefreshable): Refreshable;
|
|
|
|
|
export interface IPullable {
|
|
|
|
|
startAnimation(): void;
|
|
|
|
|
stopAnimation(): void;
|
|
|
|
|
setPullingDistance(distance: number): void;
|
|
|
|
|
}
|
|
|
|
|
export function pullable(v: View, config: IPullable): View;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
declare module 'doric/lib/src/widget/flowlayout' {
|
2020-01-04 19:13:15 +08:00
|
|
|
|
import { Stack, IStack } from 'doric/lib/src/widget/layouts';
|
2020-01-03 16:35:04 +08:00
|
|
|
|
import { IView, Superview, View, NativeViewModel } from 'doric/lib/src/ui/view';
|
2020-01-04 19:13:15 +08:00
|
|
|
|
export interface IFlowLayoutItem extends IStack {
|
|
|
|
|
identifier?: string;
|
|
|
|
|
}
|
|
|
|
|
export class FlowLayoutItem extends Stack implements IFlowLayoutItem {
|
2020-01-03 15:28:33 +08:00
|
|
|
|
/**
|
|
|
|
|
* Set to reuse native view
|
|
|
|
|
*/
|
|
|
|
|
identifier?: string;
|
|
|
|
|
}
|
|
|
|
|
export interface IFlowLayout extends IView {
|
|
|
|
|
renderItem: (index: number) => FlowLayoutItem;
|
|
|
|
|
itemCount: number;
|
|
|
|
|
batchCount?: number;
|
|
|
|
|
columnCount?: number;
|
|
|
|
|
columnSpace?: number;
|
|
|
|
|
rowSpace?: number;
|
2020-01-06 10:43:18 +08:00
|
|
|
|
loadMore?: boolean;
|
|
|
|
|
onLoadMore?: () => void;
|
|
|
|
|
loadMoreView?: FlowLayoutItem;
|
2020-03-11 13:41:22 +08:00
|
|
|
|
onScroll?: (offset: {
|
|
|
|
|
x: number;
|
|
|
|
|
y: number;
|
|
|
|
|
}) => void;
|
|
|
|
|
onScrollEnd?: (offset: {
|
|
|
|
|
x: number;
|
|
|
|
|
y: number;
|
|
|
|
|
}) => void;
|
2020-01-03 15:28:33 +08:00
|
|
|
|
}
|
|
|
|
|
export class FlowLayout extends Superview implements IFlowLayout {
|
|
|
|
|
allSubviews(): IterableIterator<FlowLayoutItem> | FlowLayoutItem[];
|
|
|
|
|
columnCount: number;
|
|
|
|
|
columnSpace?: number;
|
|
|
|
|
rowSpace?: number;
|
|
|
|
|
itemCount: number;
|
|
|
|
|
renderItem: (index: number) => FlowLayoutItem;
|
|
|
|
|
batchCount: number;
|
|
|
|
|
onLoadMore?: () => void;
|
|
|
|
|
loadMore?: boolean;
|
|
|
|
|
loadMoreView?: FlowLayoutItem;
|
2020-03-11 13:41:22 +08:00
|
|
|
|
onScroll?: (offset: {
|
|
|
|
|
x: number;
|
|
|
|
|
y: number;
|
|
|
|
|
}) => void;
|
|
|
|
|
onScrollEnd?: (offset: {
|
|
|
|
|
x: number;
|
|
|
|
|
y: number;
|
|
|
|
|
}) => void;
|
2020-01-03 15:28:33 +08:00
|
|
|
|
reset(): void;
|
|
|
|
|
isDirty(): boolean;
|
2020-01-03 16:35:04 +08:00
|
|
|
|
toModel(): NativeViewModel;
|
2020-01-03 15:28:33 +08:00
|
|
|
|
}
|
|
|
|
|
export function flowlayout(config: IFlowLayout): FlowLayout;
|
2020-01-04 19:13:15 +08:00
|
|
|
|
export function flowItem(item: View | View[], config?: IFlowLayoutItem): FlowLayoutItem;
|
2020-01-03 15:28:33 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
declare module 'doric/lib/src/widget/input' {
|
|
|
|
|
import { View, IView } from "doric/lib/src/ui/view";
|
|
|
|
|
import { Color } from "doric/lib/src/util/color";
|
|
|
|
|
import { Gravity } from "doric/lib/src/util/gravity";
|
|
|
|
|
import { BridgeContext } from "doric/lib/src/runtime/global";
|
|
|
|
|
export interface IInput extends IView {
|
|
|
|
|
text?: string;
|
|
|
|
|
textColor?: Color;
|
|
|
|
|
textSize?: number;
|
|
|
|
|
hintText?: string;
|
|
|
|
|
hintTextColor?: Color;
|
|
|
|
|
multilines?: boolean;
|
|
|
|
|
textAlignment?: Gravity;
|
|
|
|
|
onTextChange?: (text: string) => void;
|
|
|
|
|
onFocusChange?: (focused: boolean) => void;
|
|
|
|
|
}
|
|
|
|
|
export class Input extends View implements IInput {
|
|
|
|
|
text?: string;
|
|
|
|
|
textColor?: Color;
|
|
|
|
|
textSize?: number;
|
|
|
|
|
hintText?: string;
|
|
|
|
|
hintTextColor?: Color;
|
|
|
|
|
multiline?: boolean;
|
|
|
|
|
textAlignment?: Gravity;
|
|
|
|
|
onTextChange?: (text: string) => void;
|
|
|
|
|
onFocusChange?: (focused: boolean) => void;
|
|
|
|
|
getText(context: BridgeContext): Promise<string>;
|
|
|
|
|
setSelection(context: BridgeContext, start: number, end?: number): Promise<string>;
|
|
|
|
|
requestFocus(context: BridgeContext): Promise<any>;
|
|
|
|
|
releaseFocus(context: BridgeContext): Promise<any>;
|
|
|
|
|
}
|
|
|
|
|
export function input(config: IInput): Input;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
declare module 'doric/lib/src/widget/nestedSlider' {
|
|
|
|
|
import { Group, View } from 'doric/lib/src/ui/view';
|
|
|
|
|
import { BridgeContext } from 'doric/lib/src/runtime/global';
|
|
|
|
|
export class NestedSlider extends Group {
|
|
|
|
|
onPageSlided?: (index: number) => void;
|
|
|
|
|
addSlideItem(view: View): void;
|
|
|
|
|
slidePage(context: BridgeContext, page: number, smooth?: boolean): Promise<any>;
|
|
|
|
|
getSlidedPage(context: BridgeContext): Promise<number>;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-01-03 19:02:41 +08:00
|
|
|
|
declare module 'doric/lib/src/widget/draggable' {
|
|
|
|
|
import { View } from "doric/lib/src/ui/view";
|
|
|
|
|
import { IStack, Stack } from "doric/lib/src/widget/layouts";
|
|
|
|
|
export interface IDraggable extends IStack {
|
|
|
|
|
onDrag?: (x: number, y: number) => void;
|
|
|
|
|
}
|
|
|
|
|
export class Draggable extends Stack implements IDraggable {
|
|
|
|
|
onDrag?: (x: number, y: number) => void;
|
|
|
|
|
}
|
2020-01-04 19:13:15 +08:00
|
|
|
|
export function draggable(views: View | View[], config?: IDraggable): Draggable;
|
2020-01-03 19:02:41 +08:00
|
|
|
|
}
|
|
|
|
|
|
2020-03-13 13:01:21 +08:00
|
|
|
|
declare module 'doric/lib/src/widget/switch' {
|
|
|
|
|
import { View, IView } from "doric/lib/src/ui/view";
|
|
|
|
|
import { Color } from "doric/lib/src/util/color";
|
|
|
|
|
export interface ISwitch extends IView {
|
|
|
|
|
/**
|
|
|
|
|
* True is on ,false is off,defalut is off.
|
|
|
|
|
*/
|
|
|
|
|
state?: boolean;
|
|
|
|
|
/**
|
|
|
|
|
* Switch change callback
|
|
|
|
|
*/
|
|
|
|
|
onSwitch?: (state: boolean) => void;
|
|
|
|
|
onTintColor?: Color;
|
|
|
|
|
offTintColor?: Color;
|
|
|
|
|
thumbTintColor?: Color;
|
|
|
|
|
}
|
|
|
|
|
export class Switch extends View {
|
|
|
|
|
/**
|
|
|
|
|
* True is on ,false is off,defalut is off.
|
|
|
|
|
*/
|
|
|
|
|
state?: boolean;
|
|
|
|
|
onSwitch?: (state: boolean) => void;
|
|
|
|
|
offTintColor?: Color;
|
|
|
|
|
onTintColor?: Color;
|
|
|
|
|
thumbTintColor?: Color;
|
|
|
|
|
}
|
|
|
|
|
export function switchView(config: ISwitch): Switch;
|
|
|
|
|
}
|
|
|
|
|
|
2020-01-03 15:28:33 +08:00
|
|
|
|
declare module 'doric/lib/src/native/modal' {
|
|
|
|
|
import { BridgeContext } from "doric/lib/src/runtime/global";
|
|
|
|
|
import { Gravity } from "doric/lib/src/util/gravity";
|
|
|
|
|
export function modal(context: BridgeContext): {
|
|
|
|
|
toast: (msg: string, gravity?: Gravity) => void;
|
|
|
|
|
alert: (arg: string | {
|
|
|
|
|
title: string;
|
|
|
|
|
msg: string;
|
|
|
|
|
okLabel?: string | undefined;
|
|
|
|
|
}) => Promise<any>;
|
|
|
|
|
confirm: (arg: string | {
|
|
|
|
|
title: string;
|
|
|
|
|
msg: string;
|
|
|
|
|
okLabel?: string | undefined;
|
|
|
|
|
cancelLabel?: string | undefined;
|
|
|
|
|
}) => Promise<any>;
|
|
|
|
|
prompt: (arg: {
|
|
|
|
|
title?: string | undefined;
|
|
|
|
|
msg?: string | undefined;
|
|
|
|
|
okLabel?: string | undefined;
|
|
|
|
|
cancelLabel?: string | undefined;
|
|
|
|
|
text?: string | undefined;
|
|
|
|
|
defaultText?: string | undefined;
|
|
|
|
|
}) => Promise<string>;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
declare module 'doric/lib/src/native/navbar' {
|
|
|
|
|
import { BridgeContext } from "doric/lib/src/runtime/global";
|
|
|
|
|
import { Color } from "doric/lib/src/util/color";
|
2020-01-10 15:55:47 +08:00
|
|
|
|
import { View } from "doric/lib/src/ui/view";
|
2020-01-03 15:28:33 +08:00
|
|
|
|
export function navbar(context: BridgeContext): {
|
|
|
|
|
isHidden: () => Promise<boolean>;
|
|
|
|
|
setHidden: (hidden: boolean) => Promise<any>;
|
|
|
|
|
setTitle: (title: string) => Promise<any>;
|
|
|
|
|
setBgColor: (color: Color) => Promise<any>;
|
2020-01-10 15:55:47 +08:00
|
|
|
|
setLeft: (view: View) => Promise<any>;
|
|
|
|
|
setRight: (view: View) => Promise<any>;
|
2020-01-03 15:28:33 +08:00
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
declare module 'doric/lib/src/native/navigator' {
|
|
|
|
|
import { BridgeContext } from "doric/lib/src/runtime/global";
|
|
|
|
|
export function navigator(context: BridgeContext): {
|
2020-02-17 21:23:02 +08:00
|
|
|
|
push: (source: string, config?: {
|
2020-01-03 15:28:33 +08:00
|
|
|
|
alias?: string | undefined;
|
|
|
|
|
animated?: boolean | undefined;
|
|
|
|
|
extra?: object | undefined;
|
|
|
|
|
} | undefined) => Promise<any>;
|
|
|
|
|
pop: (animated?: boolean) => Promise<any>;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
declare module 'doric/lib/src/native/network' {
|
|
|
|
|
import { BridgeContext } from "doric/lib/src/runtime/global";
|
|
|
|
|
export interface IRequest {
|
|
|
|
|
url?: string;
|
|
|
|
|
method?: "get" | "post" | "put" | "delete";
|
|
|
|
|
headers?: {
|
|
|
|
|
[index: string]: string;
|
|
|
|
|
};
|
|
|
|
|
params?: {
|
|
|
|
|
[index: string]: string;
|
|
|
|
|
};
|
|
|
|
|
data?: object | string;
|
|
|
|
|
timeout?: number;
|
|
|
|
|
}
|
|
|
|
|
export interface IResponse {
|
|
|
|
|
data: any;
|
|
|
|
|
status: number;
|
|
|
|
|
headers?: {
|
|
|
|
|
[index: string]: string;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
export function network(context: BridgeContext): {
|
|
|
|
|
request: (config: IRequest) => Promise<IResponse>;
|
|
|
|
|
get: (url: string, config?: IRequest | undefined) => Promise<IResponse>;
|
|
|
|
|
post: (url: string, data?: string | object | undefined, config?: IRequest | undefined) => Promise<IResponse>;
|
|
|
|
|
put: (url: string, data?: string | object | undefined, config?: IRequest | undefined) => Promise<IResponse>;
|
|
|
|
|
delete: (url: string, data?: string | object | undefined, config?: IRequest | undefined) => Promise<IResponse>;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
declare module 'doric/lib/src/native/storage' {
|
|
|
|
|
import { BridgeContext } from "doric/lib/src/runtime/global";
|
|
|
|
|
export function storage(context: BridgeContext): {
|
|
|
|
|
setItem: (key: string, value: string, zone?: string | undefined) => Promise<any>;
|
|
|
|
|
getItem: (key: string, zone?: string | undefined) => Promise<string>;
|
|
|
|
|
remove: (key: string, zone?: string | undefined) => Promise<any>;
|
|
|
|
|
clear: (zone: string) => Promise<any>;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
declare module 'doric/lib/src/native/popover' {
|
|
|
|
|
import { BridgeContext } from "doric/lib/src/runtime/global";
|
|
|
|
|
import { View } from "doric/lib/src/ui/view";
|
|
|
|
|
export function popover(context: BridgeContext): {
|
|
|
|
|
show: (view: View) => Promise<any>;
|
|
|
|
|
dismiss: (view?: View | undefined) => Promise<any>;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
declare module 'doric/lib/src/native/animate' {
|
|
|
|
|
import { BridgeContext } from "doric/lib/src/runtime/global";
|
|
|
|
|
/**
|
|
|
|
|
* Only supports x,y,width,height,corner(just for four corners),rotation,bgColor,
|
|
|
|
|
* @param panel @see Panel
|
|
|
|
|
*/
|
|
|
|
|
export function animate(context: BridgeContext): (args: {
|
|
|
|
|
animations: () => void;
|
|
|
|
|
duration: number;
|
2020-01-17 16:51:17 +08:00
|
|
|
|
}) => Promise<unknown>;
|
2020-01-03 15:28:33 +08:00
|
|
|
|
}
|
|
|
|
|
|
2020-01-08 20:18:19 +08:00
|
|
|
|
declare module 'doric/lib/src/native/notification' {
|
|
|
|
|
import { BridgeContext } from "doric/lib/src/runtime/global";
|
|
|
|
|
export function notification(context: BridgeContext): {
|
|
|
|
|
publish: (args: {
|
2020-01-09 09:54:08 +08:00
|
|
|
|
biz?: string | undefined;
|
2020-01-08 20:18:19 +08:00
|
|
|
|
name: string;
|
|
|
|
|
data?: object | undefined;
|
|
|
|
|
androidSystem?: boolean | undefined;
|
|
|
|
|
}) => Promise<any>;
|
|
|
|
|
subscribe: (args: {
|
2020-01-09 09:54:08 +08:00
|
|
|
|
biz?: string | undefined;
|
2020-01-08 20:18:19 +08:00
|
|
|
|
name: string;
|
|
|
|
|
callback: (data?: any) => void;
|
|
|
|
|
androidSystem?: boolean | undefined;
|
|
|
|
|
}) => Promise<string>;
|
|
|
|
|
unsubscribe: (subscribeId: string) => Promise<any>;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
2020-01-14 10:59:42 +08:00
|
|
|
|
declare module 'doric/lib/src/native/statusbar' {
|
|
|
|
|
import { BridgeContext } from "doric/lib/src/runtime/global";
|
|
|
|
|
import { Color } from "doric/lib/src/util/color";
|
|
|
|
|
export enum StatusBarMode {
|
|
|
|
|
LIGHT = 0,
|
|
|
|
|
DARK = 1
|
|
|
|
|
}
|
|
|
|
|
export function statusbar(context: BridgeContext): {
|
|
|
|
|
setHidden: (hidden: boolean) => Promise<any>;
|
|
|
|
|
setMode: (mode: StatusBarMode) => Promise<any>;
|
|
|
|
|
setColor: (color: Color) => Promise<any>;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
2020-02-13 20:26:58 +08:00
|
|
|
|
declare module 'doric/lib/src/native/coordinator' {
|
|
|
|
|
import { BridgeContext } from "doric/lib/src/runtime/global";
|
|
|
|
|
import { Scroller } from "doric/lib/src/widget/scroller";
|
|
|
|
|
import { List } from "doric/lib/src/widget/list";
|
|
|
|
|
import { FlowLayout } from "doric/lib/src/widget/flowlayout";
|
|
|
|
|
import { View } from "doric/lib/src/ui/view";
|
|
|
|
|
import { Color } from "doric/lib/src/util/color";
|
|
|
|
|
export function coordinator(context: BridgeContext): {
|
|
|
|
|
verticalScrolling: (argument: {
|
|
|
|
|
scrollable: List | Scroller | FlowLayout;
|
|
|
|
|
scrollRange: {
|
|
|
|
|
start: number;
|
|
|
|
|
end: number;
|
|
|
|
|
};
|
|
|
|
|
target: View | "NavBar";
|
|
|
|
|
changing: {
|
2020-03-11 11:30:49 +08:00
|
|
|
|
name: "width" | "height" | "x" | "y" | "backgroundColor" | "alpha";
|
2020-02-13 20:26:58 +08:00
|
|
|
|
start: number | Color;
|
|
|
|
|
end: number | Color;
|
|
|
|
|
};
|
2020-03-10 18:51:53 +08:00
|
|
|
|
}) => void;
|
2020-02-13 20:26:58 +08:00
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-19 14:32:42 +08:00
|
|
|
|
declare module 'doric/lib/src/native/notch' {
|
|
|
|
|
import { BridgeContext } from "doric/lib/src/runtime/global";
|
|
|
|
|
export function notch(context: BridgeContext): {
|
|
|
|
|
inset: () => Promise<{
|
|
|
|
|
top: number;
|
|
|
|
|
left: number;
|
|
|
|
|
bottom: number;
|
|
|
|
|
right: number;
|
|
|
|
|
}>;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
2020-01-03 15:28:33 +08:00
|
|
|
|
declare module 'doric/lib/src/util/color' {
|
|
|
|
|
import { Modeling } from "doric/lib/src/util/types";
|
|
|
|
|
/**
|
|
|
|
|
* Store color as format AARRGGBB or RRGGBB
|
|
|
|
|
*/
|
|
|
|
|
export class Color implements Modeling {
|
|
|
|
|
static BLACK: Color;
|
|
|
|
|
static DKGRAY: Color;
|
|
|
|
|
static GRAY: Color;
|
|
|
|
|
static LTGRAY: Color;
|
|
|
|
|
static WHITE: Color;
|
|
|
|
|
static RED: Color;
|
|
|
|
|
static GREEN: Color;
|
|
|
|
|
static BLUE: Color;
|
|
|
|
|
static YELLOW: Color;
|
|
|
|
|
static CYAN: Color;
|
|
|
|
|
static MAGENTA: Color;
|
|
|
|
|
static TRANSPARENT: Color;
|
|
|
|
|
_value: number;
|
|
|
|
|
constructor(v: number);
|
|
|
|
|
static parse(str: string): Color;
|
|
|
|
|
static safeParse(str: string, defVal?: Color): Color;
|
|
|
|
|
alpha(v: number): Color;
|
|
|
|
|
toModel(): number;
|
|
|
|
|
}
|
|
|
|
|
export enum GradientOrientation {
|
|
|
|
|
/** draw the gradient from the top to the bottom */
|
|
|
|
|
TOP_BOTTOM = 0,
|
|
|
|
|
/** draw the gradient from the top-right to the bottom-left */
|
|
|
|
|
TR_BL = 1,
|
|
|
|
|
/** draw the gradient from the right to the left */
|
|
|
|
|
RIGHT_LEFT = 2,
|
|
|
|
|
/** draw the gradient from the bottom-right to the top-left */
|
|
|
|
|
BR_TL = 3,
|
|
|
|
|
/** draw the gradient from the bottom to the top */
|
|
|
|
|
BOTTOM_TOP = 4,
|
|
|
|
|
/** draw the gradient from the bottom-left to the top-right */
|
|
|
|
|
BL_TR = 5,
|
|
|
|
|
/** draw the gradient from the left to the right */
|
|
|
|
|
LEFT_RIGHT = 6,
|
|
|
|
|
/** draw the gradient from the top-left to the bottom-right */
|
|
|
|
|
TL_BR = 7
|
|
|
|
|
}
|
|
|
|
|
export interface GradientColor {
|
|
|
|
|
start: Color;
|
|
|
|
|
end: Color;
|
|
|
|
|
orientation: GradientOrientation;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
declare module 'doric/lib/src/util/gravity' {
|
|
|
|
|
import { Modeling } from "doric/lib/src/util/types";
|
|
|
|
|
export const LEFT: number;
|
|
|
|
|
export const RIGHT: number;
|
|
|
|
|
export const TOP: number;
|
|
|
|
|
export const BOTTOM: number;
|
|
|
|
|
export const CENTER_X: number;
|
|
|
|
|
export const CENTER_Y: number;
|
|
|
|
|
export const CENTER: number;
|
|
|
|
|
export class Gravity implements Modeling {
|
|
|
|
|
val: number;
|
|
|
|
|
left(): Gravity;
|
|
|
|
|
right(): Gravity;
|
|
|
|
|
top(): Gravity;
|
|
|
|
|
bottom(): Gravity;
|
|
|
|
|
center(): Gravity;
|
|
|
|
|
centerX(): Gravity;
|
|
|
|
|
centerY(): Gravity;
|
|
|
|
|
toModel(): number;
|
|
|
|
|
static Center: Gravity;
|
2020-01-14 19:50:32 +08:00
|
|
|
|
static CenterX: Gravity;
|
|
|
|
|
static CenterY: Gravity;
|
2020-01-03 15:28:33 +08:00
|
|
|
|
static Left: Gravity;
|
|
|
|
|
static Right: Gravity;
|
|
|
|
|
static Top: Gravity;
|
|
|
|
|
static Bottom: Gravity;
|
|
|
|
|
}
|
|
|
|
|
export function gravity(): Gravity;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
declare module 'doric/lib/src/util/layoutconfig' {
|
|
|
|
|
import { Gravity } from "doric/lib/src/util/gravity";
|
|
|
|
|
import { Modeling } from "doric/lib/src/util/types";
|
|
|
|
|
export enum LayoutSpec {
|
2020-01-10 16:19:53 +08:00
|
|
|
|
/**
|
|
|
|
|
* Depends on what's been set on width or height.
|
|
|
|
|
*/
|
|
|
|
|
JUST = 0,
|
|
|
|
|
/**
|
|
|
|
|
* Depends on it's content.
|
|
|
|
|
*/
|
|
|
|
|
FIT = 1,
|
|
|
|
|
/**
|
|
|
|
|
* Extend as much as parent let it take.
|
|
|
|
|
*/
|
|
|
|
|
MOST = 2
|
2020-01-03 15:28:33 +08:00
|
|
|
|
}
|
|
|
|
|
export interface LayoutConfig {
|
2020-01-10 16:19:53 +08:00
|
|
|
|
widthSpec?: LayoutSpec;
|
|
|
|
|
heightSpec?: LayoutSpec;
|
|
|
|
|
margin?: {
|
|
|
|
|
left?: number;
|
|
|
|
|
right?: number;
|
|
|
|
|
top?: number;
|
|
|
|
|
bottom?: number;
|
|
|
|
|
};
|
|
|
|
|
alignment?: Gravity;
|
|
|
|
|
weight?: number;
|
2020-01-03 15:28:33 +08:00
|
|
|
|
}
|
|
|
|
|
export class LayoutConfigImpl implements LayoutConfig, Modeling {
|
2020-01-10 16:19:53 +08:00
|
|
|
|
widthSpec?: LayoutSpec;
|
|
|
|
|
heightSpec?: LayoutSpec;
|
|
|
|
|
margin?: {
|
|
|
|
|
left?: number;
|
|
|
|
|
right?: number;
|
|
|
|
|
top?: number;
|
|
|
|
|
bottom?: number;
|
|
|
|
|
};
|
|
|
|
|
alignment?: Gravity;
|
|
|
|
|
weight?: number;
|
|
|
|
|
fit(): this;
|
|
|
|
|
most(): this;
|
|
|
|
|
just(): this;
|
|
|
|
|
configWidth(w: LayoutSpec): this;
|
|
|
|
|
configHeight(h: LayoutSpec): this;
|
|
|
|
|
configMargin(m: {
|
|
|
|
|
left?: number;
|
|
|
|
|
right?: number;
|
|
|
|
|
top?: number;
|
|
|
|
|
bottom?: number;
|
|
|
|
|
}): this;
|
|
|
|
|
configAlignment(a: Gravity): this;
|
|
|
|
|
configWeight(w: number): this;
|
|
|
|
|
toModel(): {
|
|
|
|
|
widthSpec: LayoutSpec | undefined;
|
|
|
|
|
heightSpec: LayoutSpec | undefined;
|
|
|
|
|
margin: {
|
|
|
|
|
left?: number | undefined;
|
|
|
|
|
right?: number | undefined;
|
|
|
|
|
top?: number | undefined;
|
|
|
|
|
bottom?: number | undefined;
|
|
|
|
|
} | undefined;
|
|
|
|
|
alignment: number | undefined;
|
|
|
|
|
weight: number | undefined;
|
|
|
|
|
};
|
2020-01-03 15:28:33 +08:00
|
|
|
|
}
|
|
|
|
|
export function layoutConfig(): LayoutConfigImpl;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
declare module 'doric/lib/src/util/log' {
|
|
|
|
|
export function log(...args: any): void;
|
|
|
|
|
export function loge(...message: any): void;
|
|
|
|
|
export function logw(...message: any): void;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
declare module 'doric/lib/src/util/types' {
|
|
|
|
|
export interface Modeling {
|
|
|
|
|
toModel(): Model;
|
|
|
|
|
}
|
|
|
|
|
export function obj2Model(obj: Model): Model;
|
|
|
|
|
type _M = string | number | boolean | Modeling | {
|
|
|
|
|
[index: string]: Model;
|
|
|
|
|
} | undefined;
|
|
|
|
|
export type Model = _M | Array<_M>;
|
|
|
|
|
export type Binder<T> = (v: T) => void;
|
|
|
|
|
export class Mutable<T> {
|
|
|
|
|
get: () => T;
|
|
|
|
|
set: (v: T) => void;
|
|
|
|
|
bind(binder: Binder<T>): void;
|
|
|
|
|
static of<E>(v: E): Mutable<E>;
|
|
|
|
|
}
|
2020-01-10 16:19:53 +08:00
|
|
|
|
export {};
|
2020-01-03 15:28:33 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
declare module 'doric/lib/src/util/uniqueId' {
|
|
|
|
|
export function uniqueId(prefix: string): string;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
declare module 'doric/lib/src/pattern/candies' {
|
|
|
|
|
export function take<T>(target: T): (block: (p: T) => void) => void;
|
|
|
|
|
export function takeNonNull<T, R>(target?: T): (block: (p: T) => R) => R | undefined;
|
|
|
|
|
export function takeNull<T, R>(target?: T): (block: () => R) => R | undefined;
|
|
|
|
|
export function takeLet<T, R>(target: T): (block: (p: T) => R | undefined) => R | undefined;
|
|
|
|
|
export function takeAlso<T>(target: T): (block: (p: T) => void) => T;
|
|
|
|
|
export function takeIf<T>(target: T): (predicate: (t: T) => boolean) => T | undefined;
|
|
|
|
|
export function takeUnless<T>(target: T): (predicate: (t: T) => boolean) => T | undefined;
|
|
|
|
|
export function repeat(action: (count: number) => void): (times: number) => void;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
declare module 'doric/lib/src/pattern/provider' {
|
|
|
|
|
export type Observer<T> = (v: T) => void;
|
|
|
|
|
export type Updater<T> = (v: T) => T;
|
|
|
|
|
export interface IObservable<T> {
|
|
|
|
|
addObserver(observer: Observer<T | undefined>): void;
|
|
|
|
|
removeObserver(observer: Observer<T | undefined>): void;
|
|
|
|
|
update(updater: Updater<T | undefined>): void;
|
|
|
|
|
}
|
|
|
|
|
export class Observable<M> implements IObservable<M> {
|
|
|
|
|
constructor(provider: IProvider, clz: {
|
2020-01-10 16:19:53 +08:00
|
|
|
|
new (...args: any[]): M;
|
2020-01-03 15:28:33 +08:00
|
|
|
|
});
|
|
|
|
|
addObserver(observer: Observer<M | undefined>): void;
|
|
|
|
|
removeObserver(observer: Observer<M | undefined>): void;
|
|
|
|
|
update(updater: Updater<M | undefined>): void;
|
|
|
|
|
}
|
|
|
|
|
export interface IProvider {
|
|
|
|
|
provide(obj: Object): void;
|
|
|
|
|
acquire<T>(clz: {
|
2020-01-10 16:19:53 +08:00
|
|
|
|
new (...args: any[]): T;
|
2020-01-03 15:28:33 +08:00
|
|
|
|
}): T | undefined;
|
|
|
|
|
remove<T>(clz: {
|
2020-01-10 16:19:53 +08:00
|
|
|
|
new (...args: any[]): T;
|
2020-01-03 15:28:33 +08:00
|
|
|
|
}): void;
|
|
|
|
|
clear(): void;
|
|
|
|
|
observe<T>(clz: {
|
2020-01-10 16:19:53 +08:00
|
|
|
|
new (...args: any[]): T;
|
2020-01-03 15:28:33 +08:00
|
|
|
|
}): Observable<T>;
|
|
|
|
|
}
|
|
|
|
|
export class Provider implements IProvider {
|
|
|
|
|
provide(obj: Object): void;
|
|
|
|
|
acquire<T>(clz: {
|
2020-01-10 16:19:53 +08:00
|
|
|
|
new (...args: any[]): T;
|
2020-01-03 15:28:33 +08:00
|
|
|
|
}): T | undefined;
|
|
|
|
|
remove<T>(clz: new (...args: any[]) => T): void;
|
|
|
|
|
clear(): void;
|
|
|
|
|
observe<T>(clz: new (...args: any[]) => T): Observable<T>;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
declare module 'doric/lib/src/pattern/mvvm' {
|
|
|
|
|
import { Group } from "doric/lib/src/ui/view";
|
|
|
|
|
import { Panel } from "doric/lib/src/ui/panel";
|
|
|
|
|
export abstract class ViewHolder {
|
|
|
|
|
abstract build(root: Group): void;
|
|
|
|
|
}
|
|
|
|
|
export type Setter<M> = (state: M) => void;
|
|
|
|
|
export abstract class ViewModel<M extends Object, V extends ViewHolder> {
|
|
|
|
|
constructor(obj: M, v: V);
|
|
|
|
|
getState(): M;
|
2020-03-03 15:51:20 +08:00
|
|
|
|
getViewHolder(): V;
|
2020-01-03 15:28:33 +08:00
|
|
|
|
updateState(setter: Setter<M>): void;
|
|
|
|
|
attach(view: Group): void;
|
|
|
|
|
abstract onAttached(state: M, vh: V): void;
|
|
|
|
|
abstract onBind(state: M, vh: V): void;
|
|
|
|
|
}
|
|
|
|
|
export type ViewModelClass<M, V extends ViewHolder> = new (m: M, v: V) => ViewModel<M, V>;
|
|
|
|
|
export type ViewHolderClass<V> = new () => V;
|
|
|
|
|
export abstract class VMPanel<M extends Object, V extends ViewHolder> extends Panel {
|
|
|
|
|
abstract getViewModelClass(): ViewModelClass<M, V>;
|
|
|
|
|
abstract getState(): M;
|
|
|
|
|
abstract getViewHolderClass(): ViewHolderClass<V>;
|
|
|
|
|
getViewModel(): ViewModel<M, V> | undefined;
|
|
|
|
|
build(root: Group): void;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|