seperate layout class
This commit is contained in:
		| @@ -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" | ||||
|   | ||||
| @@ -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 | ||||
|   | ||||
							
								
								
									
										49
									
								
								js-framework/src/ui/layout.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										49
									
								
								js-framework/src/ui/layout.ts
									
									
									
									
									
										Normal 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 { | ||||
| } | ||||
| @@ -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] | ||||
|   | ||||
| @@ -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) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user