seperate layout class

This commit is contained in:
pengfei.zhou 2019-11-12 15:54:13 +08:00
parent e14f4d04cd
commit ece0883fed
5 changed files with 56 additions and 3 deletions

View File

@ -14,6 +14,7 @@
* limitations under the License.
*/
export * from "./src/ui/view"
export * from "./src/ui/layout"
export * from "./src/ui/listview"
export * from "./src/ui/panel"
export * from "./src/ui/declarative"

View File

@ -1,4 +1,5 @@
import { Text, Image, HLayout, VLayout, Stack, LayoutConfig, View, IText, IImage } from './view'
import { Text, Image, LayoutConfig, View, IText, IImage } from './view'
import { Stack, HLayout, VLayout } from './layout'
export function text(config: IText) {
const ret = new Text

View File

@ -0,0 +1,49 @@
import { LayoutConfig, Group, Property, IView } from "./view";
import { Gravity } from "../util/gravity";
export interface StackConfig extends LayoutConfig {
}
export interface LinearConfig extends LayoutConfig {
weight?: number
}
export interface IStack extends IView {
gravity?: Gravity
}
export class Stack extends Group implements IStack {
@Property
gravity?: Gravity
}
export class Root extends Stack {
}
class LinearLayout extends Group {
@Property
space?: number
@Property
gravity?: Gravity
}
export interface IVLayout extends IView {
space?: number
gravity?: Gravity
}
export class VLayout extends LinearLayout implements VLayout {
}
export interface IHLayout extends IView {
space?: number
gravity?: Gravity
}
export class HLayout extends LinearLayout implements IHLayout {
}

View File

@ -1,6 +1,7 @@
import { View, Stack, Property, SuperView, Group, LayoutSpec } from "./view";
import { View, Property, SuperView, Group, LayoutSpec } from "./view";
import { Model } from "../util/types";
import { O_TRUNC } from "constants";
import { Stack } from "./layout";
/*
* Copyright [2019] [Doric.Pub]

View File

@ -14,9 +14,10 @@
* limitations under the License.
*/
import './../runtime/global'
import { View, Group, Root } from "./view";
import { View, Group } from "./view";
import { loge, log } from '../util/log';
import { Model } from '../util/types';
import { Root } from './layout';
export function NativeCall(target: Panel, propertyKey: string, descriptor: PropertyDescriptor) {