rename add doric prefix
This commit is contained in:
parent
c2e3ef4f7e
commit
4b1a982e85
@ -13,7 +13,7 @@
|
|||||||
#import "DoricNativePlugin.h"
|
#import "DoricNativePlugin.h"
|
||||||
#import "DoricRootNode.h"
|
#import "DoricRootNode.h"
|
||||||
#import "DoricLocalServer.h"
|
#import "DoricLocalServer.h"
|
||||||
#import "DoricLinearLayout.h"
|
#import "DoricLayouts.h"
|
||||||
#import "DoricExtensions.h"
|
#import "DoricExtensions.h"
|
||||||
|
|
||||||
@interface ViewController ()
|
@interface ViewController ()
|
||||||
@ -29,8 +29,8 @@ - (void)viewDidLoad {
|
|||||||
NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"Snake" ofType:@"js"];
|
NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"Snake" ofType:@"js"];
|
||||||
NSString *jsContent = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil];
|
NSString *jsContent = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil];
|
||||||
self.doricContext = [[DoricContext alloc] initWithScript:jsContent source:@"test.js"];
|
self.doricContext = [[DoricContext alloc] initWithScript:jsContent source:@"test.js"];
|
||||||
[self.doricContext.rootNode setupRootView:[[Stack new] also:^(Stack *it) {
|
[self.doricContext.rootNode setupRootView:[[DoricStackView new] also:^(DoricStackView *it) {
|
||||||
it.layoutConfig = [[StackLayoutConfig alloc] initWithWidth:LayoutParamAtMost height:LayoutParamAtMost];
|
it.layoutConfig = [[DoricStackConfig alloc] initWithWidth:DoricLayoutAtMost height:DoricLayoutAtMost];
|
||||||
[self.view addSubview:it];
|
[self.view addSubview:it];
|
||||||
}]];
|
}]];
|
||||||
[self.doricContext initContextWithWidth:self.view.width height:self.view.height];
|
[self.doricContext initContextWithWidth:self.view.width height:self.view.height];
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
@interface DoricGroupNode <V:UIView *, P:LayoutConfig *> : DoricViewNode<V>
|
@interface DoricGroupNode <V:UIView *, P:DoricLayoutConfig *> : DoricViewNode<V>
|
||||||
|
|
||||||
@property(nonatomic, strong) NSMutableDictionary *children;
|
@property(nonatomic, strong) NSMutableDictionary *children;
|
||||||
@property(nonatomic, strong) NSMutableArray *indexedChildren;
|
@property(nonatomic, strong) NSMutableArray *indexedChildren;
|
||||||
|
@ -73,7 +73,7 @@ - (void)blendView:(UIView *)view forPropName:(NSString *)name propValue:(id)prop
|
|||||||
[tobeRemoved addObject:old];
|
[tobeRemoved addObject:old];
|
||||||
}
|
}
|
||||||
|
|
||||||
LayoutConfig *params = node.layoutConfig;
|
DoricLayoutConfig *params = node.layoutConfig;
|
||||||
if (params == nil) {
|
if (params == nil) {
|
||||||
params = [self generateDefaultLayoutParams];
|
params = [self generateDefaultLayoutParams];
|
||||||
node.layoutConfig = params;
|
node.layoutConfig = params;
|
||||||
@ -109,31 +109,31 @@ - (void)blendView:(UIView *)view forPropName:(NSString *)name propValue:(id)prop
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (LayoutConfig *)generateDefaultLayoutParams {
|
- (DoricLayoutConfig *)generateDefaultLayoutParams {
|
||||||
LayoutConfig *params = [[LayoutConfig alloc] init];
|
DoricLayoutConfig *params = [[DoricLayoutConfig alloc] init];
|
||||||
return params;
|
return params;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)blendChild:(DoricViewNode *)child layoutConfig:(NSDictionary *)layoutConfig {
|
- (void)blendChild:(DoricViewNode *)child layoutConfig:(NSDictionary *)layoutConfig {
|
||||||
LayoutConfig *params = child.layoutConfig;
|
DoricLayoutConfig *params = child.layoutConfig;
|
||||||
|
|
||||||
[layoutConfig[@"widthSpec"] also:^(NSNumber *it) {
|
[layoutConfig[@"widthSpec"] also:^(NSNumber *it) {
|
||||||
if (it) {
|
if (it) {
|
||||||
params.widthSpec = (LayoutParam) [it integerValue];
|
params.widthSpec = (DoricLayoutSpec) [it integerValue];
|
||||||
}
|
}
|
||||||
}];
|
}];
|
||||||
|
|
||||||
[layoutConfig[@"heightSpec"] also:^(NSNumber *it) {
|
[layoutConfig[@"heightSpec"] also:^(NSNumber *it) {
|
||||||
if (it) {
|
if (it) {
|
||||||
params.heightSpec = (LayoutParam) [it integerValue];
|
params.heightSpec = (DoricLayoutSpec) [it integerValue];
|
||||||
}
|
}
|
||||||
}];
|
}];
|
||||||
|
|
||||||
if ([params isKindOfClass:MarginLayoutConfig.class]) {
|
if ([params isKindOfClass:DoricMarginConfig.class]) {
|
||||||
MarginLayoutConfig *marginParams = (MarginLayoutConfig *) params;
|
DoricMarginConfig *marginParams = (DoricMarginConfig *) params;
|
||||||
NSDictionary *margin = layoutConfig[@"margin"];
|
NSDictionary *margin = layoutConfig[@"margin"];
|
||||||
if (margin) {
|
if (margin) {
|
||||||
marginParams.margin = MarginMake(
|
marginParams.margin = DoricMarginMake(
|
||||||
[(NSNumber *) margin[@"left"] floatValue],
|
[(NSNumber *) margin[@"left"] floatValue],
|
||||||
[(NSNumber *) margin[@"top"] floatValue],
|
[(NSNumber *) margin[@"top"] floatValue],
|
||||||
[(NSNumber *) margin[@"right"] floatValue],
|
[(NSNumber *) margin[@"right"] floatValue],
|
||||||
|
@ -22,5 +22,5 @@
|
|||||||
|
|
||||||
#import "DoricGroupNode.h"
|
#import "DoricGroupNode.h"
|
||||||
|
|
||||||
@interface DoricHLayoutNode : DoricGroupNode<HLayout *, LinearLayoutConfig *>
|
@interface DoricHLayoutNode : DoricGroupNode<HLayout *, DoricLinearConfig *>
|
||||||
@end
|
@end
|
||||||
|
@ -40,14 +40,14 @@ - (void)blendView:(HLayout *)view forPropName:(NSString *)name propValue:(id)pro
|
|||||||
|
|
||||||
- (void)blendChild:(DoricViewNode *)child layoutConfig:(NSDictionary *)layoutConfig {
|
- (void)blendChild:(DoricViewNode *)child layoutConfig:(NSDictionary *)layoutConfig {
|
||||||
[super blendChild:child layoutConfig:layoutConfig];
|
[super blendChild:child layoutConfig:layoutConfig];
|
||||||
if (![child.layoutConfig isKindOfClass:LinearLayoutConfig.class]) {
|
if (![child.layoutConfig isKindOfClass:DoricLinearConfig.class]) {
|
||||||
DoricLog(@"blend HLayout child error,layout params not match");
|
DoricLog(@"blend HLayout child error,layout params not match");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
LinearLayoutConfig *params = (LinearLayoutConfig *) child.layoutConfig;
|
DoricLinearConfig *params = (DoricLinearConfig *) child.layoutConfig;
|
||||||
NSDictionary *margin = layoutConfig[@"margin"];
|
NSDictionary *margin = layoutConfig[@"margin"];
|
||||||
if (margin) {
|
if (margin) {
|
||||||
params.margin = MarginMake(
|
params.margin = DoricMarginMake(
|
||||||
[(NSNumber *) margin[@"left"] floatValue],
|
[(NSNumber *) margin[@"left"] floatValue],
|
||||||
[(NSNumber *) margin[@"top"] floatValue],
|
[(NSNumber *) margin[@"top"] floatValue],
|
||||||
[(NSNumber *) margin[@"right"] floatValue],
|
[(NSNumber *) margin[@"right"] floatValue],
|
||||||
@ -59,7 +59,7 @@ - (void)blendChild:(DoricViewNode *)child layoutConfig:(NSDictionary *)layoutCon
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (LinearLayoutConfig *)generateDefaultLayoutParams {
|
- (DoricLinearConfig *)generateDefaultLayoutParams {
|
||||||
return [[LinearLayoutConfig alloc] init];
|
return [[DoricLinearConfig alloc] init];
|
||||||
}
|
}
|
||||||
@end
|
@end
|
||||||
|
@ -20,20 +20,20 @@
|
|||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
|
|
||||||
struct Margin {
|
struct DoricMargin {
|
||||||
CGFloat left;
|
CGFloat left;
|
||||||
CGFloat right;
|
CGFloat right;
|
||||||
CGFloat top;
|
CGFloat top;
|
||||||
CGFloat bottom;
|
CGFloat bottom;
|
||||||
};
|
};
|
||||||
typedef struct Margin Margin;
|
typedef struct DoricMargin DoricMargin;
|
||||||
|
|
||||||
Margin MarginMake(CGFloat left, CGFloat top, CGFloat right, CGFloat bottom);
|
DoricMargin DoricMarginMake(CGFloat left, CGFloat top, CGFloat right, CGFloat bottom);
|
||||||
|
|
||||||
typedef NS_ENUM(NSInteger, LayoutParam) {
|
typedef NS_ENUM(NSInteger, DoricLayoutSpec) {
|
||||||
LayoutParamExact,
|
DoricLayoutExact,
|
||||||
LayoutParamWrapContent,
|
DoricLayoutWrapContent,
|
||||||
LayoutParamAtMost,
|
DoricLayoutAtMost,
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef NS_ENUM(NSInteger, DoricGravity) {
|
typedef NS_ENUM(NSInteger, DoricGravity) {
|
||||||
@ -51,32 +51,32 @@ typedef NS_ENUM(NSInteger, DoricGravity) {
|
|||||||
CENTER = CENTER_X | CENTER_Y,
|
CENTER = CENTER_X | CENTER_Y,
|
||||||
};
|
};
|
||||||
|
|
||||||
@interface LayoutConfig : NSObject
|
@interface DoricLayoutConfig : NSObject
|
||||||
@property(nonatomic, assign) LayoutParam widthSpec;
|
@property(nonatomic, assign) DoricLayoutSpec widthSpec;
|
||||||
@property(nonatomic, assign) LayoutParam heightSpec;
|
@property(nonatomic, assign) DoricLayoutSpec heightSpec;
|
||||||
@property(nonatomic, assign) DoricGravity alignment;
|
@property(nonatomic, assign) DoricGravity alignment;
|
||||||
|
|
||||||
- (instancetype)init;
|
- (instancetype)init;
|
||||||
|
|
||||||
- (instancetype)initWithWidth:(LayoutParam)width height:(LayoutParam)height;
|
- (instancetype)initWithWidth:(DoricLayoutSpec)width height:(DoricLayoutSpec)height;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface StackLayoutConfig : LayoutConfig
|
@interface DoricStackConfig : DoricLayoutConfig
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface MarginLayoutConfig : LayoutConfig
|
@interface DoricMarginConfig : DoricLayoutConfig
|
||||||
@property(nonatomic) Margin margin;
|
@property(nonatomic) DoricMargin margin;
|
||||||
|
|
||||||
- (instancetype)initWithWidth:(LayoutParam)width height:(LayoutParam)height margin:(Margin)margin;
|
- (instancetype)initWithWidth:(DoricLayoutSpec)width height:(DoricLayoutSpec)height margin:(DoricMargin)margin;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface LinearLayoutConfig : MarginLayoutConfig
|
@interface DoricLinearConfig : DoricMarginConfig
|
||||||
@property(nonatomic, assign) NSUInteger weight;
|
@property(nonatomic, assign) NSUInteger weight;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
||||||
@interface LayoutContainer <T :LayoutConfig *> : UIView
|
@interface DoricLayoutContainer <T :DoricLayoutConfig *> : UIView
|
||||||
|
|
||||||
- (T)configForChild:(__kindof UIView *)child;
|
- (T)configForChild:(__kindof UIView *)child;
|
||||||
|
|
||||||
@ -85,11 +85,11 @@ typedef NS_ENUM(NSInteger, DoricGravity) {
|
|||||||
- (void)requestLayout;
|
- (void)requestLayout;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface Stack : LayoutContainer<StackLayoutConfig *>
|
@interface DoricStackView : DoricLayoutContainer<DoricStackConfig *>
|
||||||
@property(nonatomic, assign) DoricGravity gravity;
|
@property(nonatomic, assign) DoricGravity gravity;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface LinearLayout : LayoutContainer<LinearLayoutConfig *>
|
@interface LinearLayout : DoricLayoutContainer<DoricLinearConfig *>
|
||||||
@property(nonatomic, assign) DoricGravity gravity;
|
@property(nonatomic, assign) DoricGravity gravity;
|
||||||
@property(nonatomic, assign) CGFloat space;
|
@property(nonatomic, assign) CGFloat space;
|
||||||
@end
|
@end
|
||||||
@ -102,7 +102,7 @@ typedef NS_ENUM(NSInteger, DoricGravity) {
|
|||||||
@end
|
@end
|
||||||
|
|
||||||
@interface UIView (LayoutConfig)
|
@interface UIView (LayoutConfig)
|
||||||
@property(nonatomic, strong) LayoutConfig *layoutConfig;
|
@property(nonatomic, strong) DoricLayoutConfig *layoutConfig;
|
||||||
@property(nonatomic, copy) NSString *tagString;
|
@property(nonatomic, copy) NSString *tagString;
|
||||||
|
|
||||||
- (UIView *)viewWithTagString:(NSString *)tagString;
|
- (UIView *)viewWithTagString:(NSString *)tagString;
|
@ -17,12 +17,12 @@
|
|||||||
// Created by pengfei.zhou on 2019/10/23.
|
// Created by pengfei.zhou on 2019/10/23.
|
||||||
//
|
//
|
||||||
|
|
||||||
#import "DoricLinearLayout.h"
|
#import "DoricLayouts.h"
|
||||||
#import <objc/runtime.h>
|
#import <objc/runtime.h>
|
||||||
#import "UIView+Doric.h"
|
#import "UIView+Doric.h"
|
||||||
|
|
||||||
Margin MarginMake(CGFloat left, CGFloat top, CGFloat right, CGFloat bottom) {
|
DoricMargin DoricMarginMake(CGFloat left, CGFloat top, CGFloat right, CGFloat bottom) {
|
||||||
Margin margin;
|
DoricMargin margin;
|
||||||
margin.left = left;
|
margin.left = left;
|
||||||
margin.top = top;
|
margin.top = top;
|
||||||
margin.right = right;
|
margin.right = right;
|
||||||
@ -30,16 +30,16 @@ Margin MarginMake(CGFloat left, CGFloat top, CGFloat right, CGFloat bottom) {
|
|||||||
return margin;
|
return margin;
|
||||||
}
|
}
|
||||||
|
|
||||||
@implementation LayoutConfig
|
@implementation DoricLayoutConfig
|
||||||
- (instancetype)init {
|
- (instancetype)init {
|
||||||
if (self = [super init]) {
|
if (self = [super init]) {
|
||||||
_widthSpec = LayoutParamExact;
|
_widthSpec = DoricLayoutExact;
|
||||||
_heightSpec = LayoutParamExact;
|
_heightSpec = DoricLayoutExact;
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (instancetype)initWithWidth:(LayoutParam)width height:(LayoutParam)height {
|
- (instancetype)initWithWidth:(DoricLayoutSpec)width height:(DoricLayoutSpec)height {
|
||||||
if (self = [super init]) {
|
if (self = [super init]) {
|
||||||
_widthSpec = width;
|
_widthSpec = width;
|
||||||
_heightSpec = height;
|
_heightSpec = height;
|
||||||
@ -48,15 +48,15 @@ - (instancetype)initWithWidth:(LayoutParam)width height:(LayoutParam)height {
|
|||||||
}
|
}
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation MarginLayoutConfig
|
@implementation DoricMarginConfig
|
||||||
- (instancetype)init {
|
- (instancetype)init {
|
||||||
if (self = [super init]) {
|
if (self = [super init]) {
|
||||||
_margin = MarginMake(0, 0, 0, 0);
|
_margin = DoricMarginMake(0, 0, 0, 0);
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (instancetype)initWithWidth:(LayoutParam)width height:(LayoutParam)height margin:(Margin)margin {
|
- (instancetype)initWithWidth:(DoricLayoutSpec)width height:(DoricLayoutSpec)height margin:(DoricMargin)margin {
|
||||||
if (self = [super initWithWidth:width height:height]) {
|
if (self = [super initWithWidth:width height:height]) {
|
||||||
_margin = margin;
|
_margin = margin;
|
||||||
}
|
}
|
||||||
@ -64,18 +64,18 @@ - (instancetype)initWithWidth:(LayoutParam)width height:(LayoutParam)height marg
|
|||||||
}
|
}
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation StackLayoutConfig
|
@implementation DoricStackConfig
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation LinearLayoutConfig
|
@implementation DoricLinearConfig
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
||||||
@interface LayoutContainer ()
|
@interface DoricLayoutContainer ()
|
||||||
@property(nonatomic, assign) BOOL waitingLayout;
|
@property(nonatomic, assign) BOOL waitingLayout;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation LayoutContainer
|
@implementation DoricLayoutContainer
|
||||||
- (instancetype)init {
|
- (instancetype)init {
|
||||||
if (self = [super init]) {
|
if (self = [super init]) {
|
||||||
_waitingLayout = NO;
|
_waitingLayout = NO;
|
||||||
@ -98,10 +98,10 @@ - (instancetype)initWithCoder:(NSCoder *)coder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
- (LayoutConfig *)configForChild:(UIView *)child {
|
- (DoricLayoutConfig *)configForChild:(UIView *)child {
|
||||||
LayoutConfig *config = child.layoutConfig;
|
DoricLayoutConfig *config = child.layoutConfig;
|
||||||
if (!config) {
|
if (!config) {
|
||||||
config = [[LayoutConfig alloc] init];
|
config = [[DoricLayoutConfig alloc] init];
|
||||||
}
|
}
|
||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
@ -129,8 +129,8 @@ - (void)layoutSubviews {
|
|||||||
|
|
||||||
- (void)layout {
|
- (void)layout {
|
||||||
[self.subviews enumerateObjectsUsingBlock:^(__kindof UIView *child, NSUInteger idx, BOOL *stop) {
|
[self.subviews enumerateObjectsUsingBlock:^(__kindof UIView *child, NSUInteger idx, BOOL *stop) {
|
||||||
if ([child isKindOfClass:[LayoutContainer class]]) {
|
if ([child isKindOfClass:[DoricLayoutContainer class]]) {
|
||||||
[(LayoutContainer *) child layout];
|
[(DoricLayoutContainer *) child layout];
|
||||||
}
|
}
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
@ -138,47 +138,47 @@ - (void)layout {
|
|||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
||||||
@interface Stack ()
|
@interface DoricStackView ()
|
||||||
|
|
||||||
@property(nonatomic, assign) CGFloat contentWidth;
|
@property(nonatomic, assign) CGFloat contentWidth;
|
||||||
@property(nonatomic, assign) CGFloat contentHeight;
|
@property(nonatomic, assign) CGFloat contentHeight;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation Stack
|
@implementation DoricStackView
|
||||||
- (StackLayoutConfig *)configForChild:(UIView *)child {
|
- (DoricStackConfig *)configForChild:(UIView *)child {
|
||||||
StackLayoutConfig *config = (StackLayoutConfig *) child.layoutConfig;
|
DoricStackConfig *config = (DoricStackConfig *) child.layoutConfig;
|
||||||
if (!config) {
|
if (!config) {
|
||||||
config = [[StackLayoutConfig alloc] init];
|
config = [[DoricStackConfig alloc] init];
|
||||||
}
|
}
|
||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
- (void)sizeToFit {
|
- (void)sizeToFit {
|
||||||
LayoutConfig *config = self.layoutConfig;
|
DoricLayoutConfig *config = self.layoutConfig;
|
||||||
self.contentWidth = 0;
|
self.contentWidth = 0;
|
||||||
self.contentHeight = 0;
|
self.contentHeight = 0;
|
||||||
for (UIView *child in self.subviews) {
|
for (UIView *child in self.subviews) {
|
||||||
if (child.isHidden) {
|
if (child.isHidden) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
StackLayoutConfig *childConfig = [self configForChild:child];
|
DoricStackConfig *childConfig = [self configForChild:child];
|
||||||
if ([child isKindOfClass:[LayoutContainer class]]
|
if ([child isKindOfClass:[DoricLayoutContainer class]]
|
||||||
|| childConfig.widthSpec == LayoutParamWrapContent
|
|| childConfig.widthSpec == DoricLayoutWrapContent
|
||||||
|| childConfig.heightSpec == LayoutParamWrapContent) {
|
|| childConfig.heightSpec == DoricLayoutWrapContent) {
|
||||||
[child sizeToFit];
|
[child sizeToFit];
|
||||||
}
|
}
|
||||||
self.contentWidth = MAX(self.contentWidth, child.width);
|
self.contentWidth = MAX(self.contentWidth, child.width);
|
||||||
self.contentHeight = MAX(self.contentHeight, child.height);
|
self.contentHeight = MAX(self.contentHeight, child.height);
|
||||||
}
|
}
|
||||||
if (config.widthSpec == LayoutParamWrapContent) {
|
if (config.widthSpec == DoricLayoutWrapContent) {
|
||||||
self.width = self.contentWidth;
|
self.width = self.contentWidth;
|
||||||
} else if (config.widthSpec == LayoutParamAtMost) {
|
} else if (config.widthSpec == DoricLayoutAtMost) {
|
||||||
self.width = self.superview.width;
|
self.width = self.superview.width;
|
||||||
}
|
}
|
||||||
if (config.heightSpec == LayoutParamWrapContent) {
|
if (config.heightSpec == DoricLayoutWrapContent) {
|
||||||
self.height = self.contentHeight;
|
self.height = self.contentHeight;
|
||||||
} else if (config.heightSpec == LayoutParamAtMost) {
|
} else if (config.heightSpec == DoricLayoutAtMost) {
|
||||||
self.height = self.superview.height;
|
self.height = self.superview.height;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -188,7 +188,7 @@ - (void)layout {
|
|||||||
if (child.isHidden) {
|
if (child.isHidden) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
StackLayoutConfig *childConfig = [self configForChild:child];
|
DoricStackConfig *childConfig = [self configForChild:child];
|
||||||
DoricGravity gravity = childConfig.alignment | self.gravity;
|
DoricGravity gravity = childConfig.alignment | self.gravity;
|
||||||
if ((gravity & LEFT) == LEFT) {
|
if ((gravity & LEFT) == LEFT) {
|
||||||
child.left = 0;
|
child.left = 0;
|
||||||
@ -204,15 +204,15 @@ - (void)layout {
|
|||||||
} else if ((gravity & CENTER_Y) == CENTER_Y) {
|
} else if ((gravity & CENTER_Y) == CENTER_Y) {
|
||||||
child.centerY = self.height / 2;
|
child.centerY = self.height / 2;
|
||||||
}
|
}
|
||||||
if (childConfig.widthSpec == LayoutParamAtMost) {
|
if (childConfig.widthSpec == DoricLayoutAtMost) {
|
||||||
child.width = self.width;
|
child.width = self.width;
|
||||||
}
|
}
|
||||||
if (childConfig.heightSpec == LayoutParamAtMost) {
|
if (childConfig.heightSpec == DoricLayoutAtMost) {
|
||||||
child.height = self.height;
|
child.height = self.height;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ([child isKindOfClass:[LayoutContainer class]]) {
|
if ([child isKindOfClass:[DoricLayoutContainer class]]) {
|
||||||
[(LayoutContainer *) child layout];
|
[(DoricLayoutContainer *) child layout];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -225,10 +225,10 @@ @interface LinearLayout ()
|
|||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation LinearLayout
|
@implementation LinearLayout
|
||||||
- (LinearLayoutConfig *)configForChild:(UIView *)child {
|
- (DoricLinearConfig *)configForChild:(UIView *)child {
|
||||||
LinearLayoutConfig *config = (LinearLayoutConfig *) child.layoutConfig;
|
DoricLinearConfig *config = (DoricLinearConfig *) child.layoutConfig;
|
||||||
if (!config) {
|
if (!config) {
|
||||||
config = [[LinearLayoutConfig alloc] init];
|
config = [[DoricLinearConfig alloc] init];
|
||||||
}
|
}
|
||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
@ -237,7 +237,7 @@ - (LinearLayoutConfig *)configForChild:(UIView *)child {
|
|||||||
@implementation VLayout
|
@implementation VLayout
|
||||||
|
|
||||||
- (void)sizeToFit {
|
- (void)sizeToFit {
|
||||||
LayoutConfig *config = self.layoutConfig;
|
DoricLayoutConfig *config = self.layoutConfig;
|
||||||
self.contentWidth = 0;
|
self.contentWidth = 0;
|
||||||
self.contentHeight = 0;
|
self.contentHeight = 0;
|
||||||
self.contentWeight = 0;
|
self.contentWeight = 0;
|
||||||
@ -245,10 +245,10 @@ - (void)sizeToFit {
|
|||||||
if (child.isHidden) {
|
if (child.isHidden) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
LinearLayoutConfig *childConfig = [self configForChild:child];
|
DoricLinearConfig *childConfig = [self configForChild:child];
|
||||||
if ([child isKindOfClass:[LayoutContainer class]]
|
if ([child isKindOfClass:[DoricLayoutContainer class]]
|
||||||
|| childConfig.widthSpec == LayoutParamWrapContent
|
|| childConfig.widthSpec == DoricLayoutWrapContent
|
||||||
|| childConfig.heightSpec == LayoutParamWrapContent) {
|
|| childConfig.heightSpec == DoricLayoutWrapContent) {
|
||||||
[child sizeToFit];
|
[child sizeToFit];
|
||||||
}
|
}
|
||||||
self.contentWidth = MAX(self.contentWidth, child.width + childConfig.margin.left + childConfig.margin.right);
|
self.contentWidth = MAX(self.contentWidth, child.width + childConfig.margin.left + childConfig.margin.right);
|
||||||
@ -256,14 +256,14 @@ - (void)sizeToFit {
|
|||||||
self.contentWeight += childConfig.weight;
|
self.contentWeight += childConfig.weight;
|
||||||
}
|
}
|
||||||
self.contentHeight -= self.space;
|
self.contentHeight -= self.space;
|
||||||
if (config.widthSpec == LayoutParamWrapContent) {
|
if (config.widthSpec == DoricLayoutWrapContent) {
|
||||||
self.width = self.contentWidth;
|
self.width = self.contentWidth;
|
||||||
} else if (config.widthSpec == LayoutParamAtMost) {
|
} else if (config.widthSpec == DoricLayoutAtMost) {
|
||||||
self.width = self.superview.width;
|
self.width = self.superview.width;
|
||||||
}
|
}
|
||||||
if (config.heightSpec == LayoutParamWrapContent) {
|
if (config.heightSpec == DoricLayoutWrapContent) {
|
||||||
self.height = self.contentHeight;
|
self.height = self.contentHeight;
|
||||||
} else if (config.heightSpec == LayoutParamAtMost) {
|
} else if (config.heightSpec == DoricLayoutAtMost) {
|
||||||
self.height = self.superview.height;
|
self.height = self.superview.height;
|
||||||
}
|
}
|
||||||
if (self.contentWeight) {
|
if (self.contentWeight) {
|
||||||
@ -272,7 +272,7 @@ - (void)sizeToFit {
|
|||||||
if (child.isHidden) {
|
if (child.isHidden) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
LinearLayoutConfig *childConfig = [self configForChild:child];
|
DoricLinearConfig *childConfig = [self configForChild:child];
|
||||||
if (childConfig.weight) {
|
if (childConfig.weight) {
|
||||||
child.height += remain / self.contentWeight * childConfig.weight;
|
child.height += remain / self.contentWeight * childConfig.weight;
|
||||||
}
|
}
|
||||||
@ -294,7 +294,7 @@ - (void)layout {
|
|||||||
if (child.isHidden) {
|
if (child.isHidden) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
LinearLayoutConfig *childConfig = [self configForChild:child];
|
DoricLinearConfig *childConfig = [self configForChild:child];
|
||||||
DoricGravity gravity = childConfig.alignment | self.gravity;
|
DoricGravity gravity = childConfig.alignment | self.gravity;
|
||||||
if ((gravity & LEFT) == LEFT) {
|
if ((gravity & LEFT) == LEFT) {
|
||||||
child.left = 0;
|
child.left = 0;
|
||||||
@ -309,10 +309,10 @@ - (void)layout {
|
|||||||
child.right = self.width - childConfig.margin.right;
|
child.right = self.width - childConfig.margin.right;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (childConfig.widthSpec == LayoutParamAtMost) {
|
if (childConfig.widthSpec == DoricLayoutAtMost) {
|
||||||
child.width = self.width;
|
child.width = self.width;
|
||||||
}
|
}
|
||||||
if (childConfig.heightSpec == LayoutParamAtMost) {
|
if (childConfig.heightSpec == DoricLayoutAtMost) {
|
||||||
child.height = self.height - yStart - childConfig.margin.top - childConfig.margin.bottom - self.space;
|
child.height = self.height - yStart - childConfig.margin.top - childConfig.margin.bottom - self.space;
|
||||||
}
|
}
|
||||||
if (childConfig.margin.top) {
|
if (childConfig.margin.top) {
|
||||||
@ -323,8 +323,8 @@ - (void)layout {
|
|||||||
if (childConfig.margin.bottom) {
|
if (childConfig.margin.bottom) {
|
||||||
yStart += childConfig.margin.bottom;
|
yStart += childConfig.margin.bottom;
|
||||||
}
|
}
|
||||||
if ([child isKindOfClass:[LayoutContainer class]]) {
|
if ([child isKindOfClass:[DoricLayoutContainer class]]) {
|
||||||
[(LayoutContainer *) child layout];
|
[(DoricLayoutContainer *) child layout];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -332,13 +332,13 @@ - (void)layout {
|
|||||||
|
|
||||||
@implementation HLayout
|
@implementation HLayout
|
||||||
- (void)sizeToFit {
|
- (void)sizeToFit {
|
||||||
LinearLayoutConfig *config;
|
DoricLinearConfig *config;
|
||||||
if ([self.superview isKindOfClass:[LinearLayout class]]) {
|
if ([self.superview isKindOfClass:[LinearLayout class]]) {
|
||||||
config = [(LinearLayout *) self.superview configForChild:self];
|
config = [(LinearLayout *) self.superview configForChild:self];
|
||||||
} else {
|
} else {
|
||||||
config = (LinearLayoutConfig *) self.layoutConfig;
|
config = (DoricLinearConfig *) self.layoutConfig;
|
||||||
if (!config) {
|
if (!config) {
|
||||||
config = [[LinearLayoutConfig alloc] init];
|
config = [[DoricLinearConfig alloc] init];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
self.contentWidth = 0;
|
self.contentWidth = 0;
|
||||||
@ -348,10 +348,10 @@ - (void)sizeToFit {
|
|||||||
if (child.isHidden) {
|
if (child.isHidden) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
LinearLayoutConfig *childConfig = [self configForChild:child];
|
DoricLinearConfig *childConfig = [self configForChild:child];
|
||||||
if ([child isKindOfClass:[LayoutContainer class]]
|
if ([child isKindOfClass:[DoricLayoutContainer class]]
|
||||||
|| childConfig.widthSpec == LayoutParamWrapContent
|
|| childConfig.widthSpec == DoricLayoutWrapContent
|
||||||
|| childConfig.heightSpec == LayoutParamWrapContent) {
|
|| childConfig.heightSpec == DoricLayoutWrapContent) {
|
||||||
[child sizeToFit];
|
[child sizeToFit];
|
||||||
}
|
}
|
||||||
self.contentHeight = MAX(self.contentHeight, child.height + childConfig.margin.top + childConfig.margin.bottom);
|
self.contentHeight = MAX(self.contentHeight, child.height + childConfig.margin.top + childConfig.margin.bottom);
|
||||||
@ -359,14 +359,14 @@ - (void)sizeToFit {
|
|||||||
self.contentWeight += childConfig.weight;
|
self.contentWeight += childConfig.weight;
|
||||||
}
|
}
|
||||||
self.contentWidth -= self.space;
|
self.contentWidth -= self.space;
|
||||||
if (config.widthSpec == LayoutParamWrapContent) {
|
if (config.widthSpec == DoricLayoutWrapContent) {
|
||||||
self.width = self.contentWidth;
|
self.width = self.contentWidth;
|
||||||
} else if (config.widthSpec == LayoutParamAtMost) {
|
} else if (config.widthSpec == DoricLayoutAtMost) {
|
||||||
self.width = self.superview.width;
|
self.width = self.superview.width;
|
||||||
}
|
}
|
||||||
if (config.heightSpec == LayoutParamWrapContent) {
|
if (config.heightSpec == DoricLayoutWrapContent) {
|
||||||
self.height = self.contentHeight;
|
self.height = self.contentHeight;
|
||||||
} else if (config.heightSpec == LayoutParamAtMost) {
|
} else if (config.heightSpec == DoricLayoutAtMost) {
|
||||||
self.height = self.superview.height;
|
self.height = self.superview.height;
|
||||||
}
|
}
|
||||||
if (self.contentWeight) {
|
if (self.contentWeight) {
|
||||||
@ -375,7 +375,7 @@ - (void)sizeToFit {
|
|||||||
if (child.isHidden) {
|
if (child.isHidden) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
LinearLayoutConfig *childConfig = [self configForChild:child];
|
DoricLinearConfig *childConfig = [self configForChild:child];
|
||||||
if (childConfig.weight) {
|
if (childConfig.weight) {
|
||||||
child.width += remain / self.contentWeight * childConfig.weight;
|
child.width += remain / self.contentWeight * childConfig.weight;
|
||||||
}
|
}
|
||||||
@ -397,7 +397,7 @@ - (void)layout {
|
|||||||
if (child.isHidden) {
|
if (child.isHidden) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
LinearLayoutConfig *childConfig = [self configForChild:child];
|
DoricLinearConfig *childConfig = [self configForChild:child];
|
||||||
DoricGravity gravity = childConfig.alignment | self.gravity;
|
DoricGravity gravity = childConfig.alignment | self.gravity;
|
||||||
if ((gravity & TOP) == TOP) {
|
if ((gravity & TOP) == TOP) {
|
||||||
child.top = 0;
|
child.top = 0;
|
||||||
@ -413,10 +413,10 @@ - (void)layout {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (childConfig.heightSpec == LayoutParamAtMost) {
|
if (childConfig.heightSpec == DoricLayoutAtMost) {
|
||||||
child.height = self.height;
|
child.height = self.height;
|
||||||
}
|
}
|
||||||
if (childConfig.widthSpec == LayoutParamAtMost) {
|
if (childConfig.widthSpec == DoricLayoutAtMost) {
|
||||||
child.width = self.width - xStart - childConfig.margin.right - childConfig.margin.left - self.space;
|
child.width = self.width - xStart - childConfig.margin.right - childConfig.margin.left - self.space;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -428,8 +428,8 @@ - (void)layout {
|
|||||||
if (childConfig.margin.right) {
|
if (childConfig.margin.right) {
|
||||||
xStart += childConfig.margin.right;
|
xStart += childConfig.margin.right;
|
||||||
}
|
}
|
||||||
if ([child isKindOfClass:[LayoutContainer class]]) {
|
if ([child isKindOfClass:[DoricLayoutContainer class]]) {
|
||||||
[(LayoutContainer *) child layout];
|
[(DoricLayoutContainer *) child layout];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -441,11 +441,11 @@ - (void)layout {
|
|||||||
@implementation UIView (LayoutConfig)
|
@implementation UIView (LayoutConfig)
|
||||||
@dynamic layoutConfig;
|
@dynamic layoutConfig;
|
||||||
|
|
||||||
- (void)setLayoutConfig:(LayoutConfig *)layoutConfig {
|
- (void)setLayoutConfig:(DoricLayoutConfig *)layoutConfig {
|
||||||
objc_setAssociatedObject(self, kLayoutConfig, layoutConfig, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
|
objc_setAssociatedObject(self, kLayoutConfig, layoutConfig, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (LayoutConfig *)layoutConfig {
|
- (DoricLayoutConfig *)layoutConfig {
|
||||||
return objc_getAssociatedObject(self, kLayoutConfig);
|
return objc_getAssociatedObject(self, kLayoutConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -471,7 +471,7 @@ - (UIView *)viewWithTagString:(NSString *)tagString {
|
|||||||
for (__kindof UIView *uiView in views) {
|
for (__kindof UIView *uiView in views) {
|
||||||
[layout addSubview:uiView];
|
[layout addSubview:uiView];
|
||||||
}
|
}
|
||||||
layout.layoutConfig = [[LayoutConfig alloc] initWithWidth:LayoutParamWrapContent height:LayoutParamWrapContent];
|
layout.layoutConfig = [[DoricLayoutConfig alloc] initWithWidth:DoricLayoutWrapContent height:DoricLayoutWrapContent];
|
||||||
return layout;
|
return layout;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -480,7 +480,7 @@ - (UIView *)viewWithTagString:(NSString *)tagString {
|
|||||||
for (__kindof UIView *uiView in views) {
|
for (__kindof UIView *uiView in views) {
|
||||||
[layout addSubview:uiView];
|
[layout addSubview:uiView];
|
||||||
}
|
}
|
||||||
layout.layoutConfig = [[LayoutConfig alloc] initWithWidth:LayoutParamWrapContent height:LayoutParamWrapContent];
|
layout.layoutConfig = [[DoricLayoutConfig alloc] initWithWidth:DoricLayoutWrapContent height:DoricLayoutWrapContent];
|
||||||
return layout;
|
return layout;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -490,7 +490,7 @@ - (UIView *)viewWithTagString:(NSString *)tagString {
|
|||||||
for (block in blocks) {
|
for (block in blocks) {
|
||||||
[layout addSubview:block()];
|
[layout addSubview:block()];
|
||||||
}
|
}
|
||||||
layout.layoutConfig = [[LayoutConfig alloc] initWithWidth:LayoutParamWrapContent height:LayoutParamWrapContent];
|
layout.layoutConfig = [[DoricLayoutConfig alloc] initWithWidth:DoricLayoutWrapContent height:DoricLayoutWrapContent];
|
||||||
return layout;
|
return layout;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -500,6 +500,6 @@ - (UIView *)viewWithTagString:(NSString *)tagString {
|
|||||||
for (block in blocks) {
|
for (block in blocks) {
|
||||||
[layout addSubview:block()];
|
[layout addSubview:block()];
|
||||||
}
|
}
|
||||||
layout.layoutConfig = [[LayoutConfig alloc] initWithWidth:LayoutParamWrapContent height:LayoutParamWrapContent];
|
layout.layoutConfig = [[DoricLayoutConfig alloc] initWithWidth:DoricLayoutWrapContent height:DoricLayoutWrapContent];
|
||||||
return layout;
|
return layout;
|
||||||
}
|
}
|
@ -26,7 +26,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
|
|
||||||
@interface DoricRootNode : DoricStackNode
|
@interface DoricRootNode : DoricStackNode
|
||||||
|
|
||||||
- (void)setupRootView:(Stack *)view;
|
- (void)setupRootView:(DoricStackView *)view;
|
||||||
|
|
||||||
- (void)render:(NSDictionary *)props;
|
- (void)render:(NSDictionary *)props;
|
||||||
@end
|
@end
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
#import "DoricRootNode.h"
|
#import "DoricRootNode.h"
|
||||||
|
|
||||||
@implementation DoricRootNode
|
@implementation DoricRootNode
|
||||||
- (void)setupRootView:(Stack *)view {
|
- (void)setupRootView:(DoricStackView *)view {
|
||||||
self.view = view;
|
self.view = view;
|
||||||
self.layoutConfig = view.layoutConfig;
|
self.layoutConfig = view.layoutConfig;
|
||||||
}
|
}
|
||||||
|
@ -22,5 +22,5 @@
|
|||||||
|
|
||||||
#import "DoricGroupNode.h"
|
#import "DoricGroupNode.h"
|
||||||
|
|
||||||
@interface DoricStackNode : DoricGroupNode<Stack *, StackLayoutConfig *>
|
@interface DoricStackNode : DoricGroupNode<DoricStackView *, DoricStackConfig *>
|
||||||
@end
|
@end
|
||||||
|
@ -25,11 +25,11 @@
|
|||||||
|
|
||||||
@implementation DoricStackNode
|
@implementation DoricStackNode
|
||||||
|
|
||||||
- (Stack *)build:(NSDictionary *)props {
|
- (DoricStackView *)build:(NSDictionary *)props {
|
||||||
return [Stack new];
|
return [DoricStackView new];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)blendView:(Stack *)view forPropName:(NSString *)name propValue:(id)prop {
|
- (void)blendView:(DoricStackView *)view forPropName:(NSString *)name propValue:(id)prop {
|
||||||
if ([name isEqualToString:@"gravity"]) {
|
if ([name isEqualToString:@"gravity"]) {
|
||||||
view.gravity = (DoricGravity) [(NSNumber *) prop integerValue];
|
view.gravity = (DoricGravity) [(NSNumber *) prop integerValue];
|
||||||
} else {
|
} else {
|
||||||
@ -37,17 +37,17 @@ - (void)blendView:(Stack *)view forPropName:(NSString *)name propValue:(id)prop
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (StackLayoutConfig *)generateDefaultLayoutParams {
|
- (DoricStackConfig *)generateDefaultLayoutParams {
|
||||||
return [[StackLayoutConfig alloc] init];
|
return [[DoricStackConfig alloc] init];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)blendChild:(DoricViewNode *)child layoutConfig:(NSDictionary *)layoutConfig {
|
- (void)blendChild:(DoricViewNode *)child layoutConfig:(NSDictionary *)layoutConfig {
|
||||||
[super blendChild:child layoutConfig:layoutConfig];
|
[super blendChild:child layoutConfig:layoutConfig];
|
||||||
if (![child.layoutConfig isKindOfClass:StackLayoutConfig.class]) {
|
if (![child.layoutConfig isKindOfClass:DoricStackConfig.class]) {
|
||||||
DoricLog(@"blend HLayout child error,layout params not match");
|
DoricLog(@"blend HLayout child error,layout params not match");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
StackLayoutConfig *params = (StackLayoutConfig *) child.layoutConfig;
|
DoricStackConfig *params = (DoricStackConfig *) child.layoutConfig;
|
||||||
NSNumber *alignment = layoutConfig[@"alignment"];
|
NSNumber *alignment = layoutConfig[@"alignment"];
|
||||||
if (alignment) {
|
if (alignment) {
|
||||||
params.alignment = (DoricGravity) [alignment integerValue];
|
params.alignment = (DoricGravity) [alignment integerValue];
|
||||||
|
@ -22,5 +22,5 @@
|
|||||||
|
|
||||||
#import "DoricGroupNode.h"
|
#import "DoricGroupNode.h"
|
||||||
|
|
||||||
@interface DoricVLayoutNode : DoricGroupNode<VLayout *, LinearLayoutConfig *>
|
@interface DoricVLayoutNode : DoricGroupNode<VLayout *, DoricLinearConfig *>
|
||||||
@end
|
@end
|
||||||
|
@ -41,14 +41,14 @@ - (void)blendView:(VLayout *)view forPropName:(NSString *)name propValue:(id)pro
|
|||||||
|
|
||||||
- (void)blendChild:(DoricViewNode *)child layoutConfig:(NSDictionary *)layoutconfig {
|
- (void)blendChild:(DoricViewNode *)child layoutConfig:(NSDictionary *)layoutconfig {
|
||||||
[super blendChild:child layoutConfig:layoutconfig];
|
[super blendChild:child layoutConfig:layoutconfig];
|
||||||
if (![child.layoutConfig isKindOfClass:LinearLayoutConfig.class]) {
|
if (![child.layoutConfig isKindOfClass:DoricLinearConfig.class]) {
|
||||||
DoricLog(@"blend VLayout child error,layout params not match");
|
DoricLog(@"blend VLayout child error,layout params not match");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
LinearLayoutConfig *params = (LinearLayoutConfig *) child.layoutConfig;
|
DoricLinearConfig *params = (DoricLinearConfig *) child.layoutConfig;
|
||||||
NSDictionary *margin = layoutconfig[@"margin"];
|
NSDictionary *margin = layoutconfig[@"margin"];
|
||||||
if (margin) {
|
if (margin) {
|
||||||
params.margin = MarginMake(
|
params.margin = DoricMarginMake(
|
||||||
[(NSNumber *) margin[@"left"] floatValue],
|
[(NSNumber *) margin[@"left"] floatValue],
|
||||||
[(NSNumber *) margin[@"top"] floatValue],
|
[(NSNumber *) margin[@"top"] floatValue],
|
||||||
[(NSNumber *) margin[@"right"] floatValue],
|
[(NSNumber *) margin[@"right"] floatValue],
|
||||||
@ -60,7 +60,7 @@ - (void)blendChild:(DoricViewNode *)child layoutConfig:(NSDictionary *)layoutcon
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (LinearLayoutConfig *)generateDefaultLayoutParams {
|
- (DoricLinearConfig *)generateDefaultLayoutParams {
|
||||||
return [[LinearLayoutConfig alloc] init];
|
return [[DoricLinearConfig alloc] init];
|
||||||
}
|
}
|
||||||
@end
|
@end
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
#import "DoricContextHolder.h"
|
#import "DoricContextHolder.h"
|
||||||
#import "DoricLinearLayout.h"
|
#import "DoricLayouts.h"
|
||||||
#import "UIView+Doric.h"
|
#import "UIView+Doric.h"
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
@ -36,7 +36,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
|
|
||||||
@property(nonatomic, strong) NSString *viewId;
|
@property(nonatomic, strong) NSString *viewId;
|
||||||
|
|
||||||
@property(nonatomic, strong) LayoutConfig *layoutConfig;
|
@property(nonatomic, strong) DoricLayoutConfig *layoutConfig;
|
||||||
|
|
||||||
@property(nonatomic, strong, readonly) NSArray<NSString *> *idList;
|
@property(nonatomic, strong, readonly) NSArray<NSString *> *idList;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user