BBASMUIPluginUtilProtocol.h 3.77 KB
//
//  BBASMUIPluginUtilProtocol.h
//  SWAN
//
//  Created by baidu on 2018/10/29.
//  Copyright © 2018 baidu. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <Pyramid/Pyramid.h>
#import "BBASMComponent.h"

AliasService(BBASMUIPluginUtilProtocol, bba_MNPUIPluginUtil)

@class BBASchemeDispatcher;
@protocol BBASMUIPluginUtilProtocol <NSObject>


/**
 * @brief 创建并添加组件到组件管理
 *
 * @param dispatcher 协议
 * @param componentView 组件
 * @param compIdKey 组件id
 * @param compName 组件名称
 * @param item 组件Item class
 * @param view 从外面传入的组件父视图
 * @return  组件Item
 */
+ (BBASMComponent)addComponent:(BBASchemeDispatcher *)dispatcher
                         view:(UIView *)componentView
                        idKey:(NSString *)compIdKey
                         name:(NSString *)compName
                         item:(BBASMComponent)item
                       toView:(UIView *)view;
/**
 * @brief 根据componentView 移除组件
 *
 * @param componentView 组件
 */
+ (void)removeComponentForView:(UIView *)componentView;

/**
 根据 调起协议移除组件
 
 @param dispatcher 调起协议
 @param compIdKey 组件ID key
 */
+ (void)removeComponent:(BBASchemeDispatcher *)dispatcher
                  idKey:(NSString *)compIdKey;

/**
 * @brief 更新组件
 *
 * @param componentView 组件
 * @param dispatcher 协议
 */
+ (void)updateComponentView:(UIView *)componentView
             withDispatcher:(BBASchemeDispatcher *)dispatcher;

/**
 * @brief 更新组件
 *
 * @param componentView 组件
 * @param dispatcher 协议
 * @param check 是否检查父视图的变化
 */
+ (void)updateComponentView:(UIView *)componentView
             withDispatcher:(BBASchemeDispatcher *)dispatcher
      checkParentViewChange:(BOOL)check;

/**
 * @brief 通过componentID获取组件
 *
 * @param dispatcher 协议
 * @param componentID 组件id
 * @return 组件的componentView
 */
+ (UIView *)componentViewWithDispatcher:(BBASchemeDispatcher *)dispatcher
                            componentID:(NSString *)componentID;

/**
 * @brief 获取组件
 *
 * @param dispatcher 调起协议
 * @param compIdKey 组件id key
 * @return 组件
 */
+ (BBASMComponent)componentWithDispatcher:(BBASchemeDispatcher *)dispatcher
                                   idKey:(NSString *)compIdKey;

/**
 * @brief 获取组件
 *
 * @param dispatcher 调起协议
 * @param componentID 组件id
 * @return 组件
 */
+ (BBASMComponent )componentWithDispatcher:(BBASchemeDispatcher *)dispatcher
                             componentID:(NSString *)componentID;

/**
 * @brief 获取组件容器
 *
 * @param info 组件模型对象
 * @return 组件容器
 */
+(UIViewController<BBASMComponentManagerProtocol, BBASMRenderBaseViewControllerProtocol, BBASMRenderBaseControllerUIProtocol> *)containerWithInfo:(id<BBASMComponentInfoProtocol>)info;

/**
 * @brief 获取stackViewController
 *
 * @param dispatcher 协议
 */
+ (UIViewController *)getPageStackWithDispatcher:(BBASchemeDispatcher *)dispatcher;

/**
 * @brief 获取stackViewController
 *
 * @param appId appId
 * @return stackViewController
 */
+ (UIViewController *)getPageStackWithAppId:(NSString *)appId;

/**
 * @brief 更新组件的 position参数
 *
 * @param dispatcher BBASchemeDispatcher
 * @return 返回更新过position的所有参数 NSDictionary
 */
+ (NSDictionary *)updateComponentPositionParam:(BBASchemeDispatcher *)dispatcher;

/**
 * @brief 检查组件的父视图 如果发生变化则更新
 *
 * @param item 组件
 * @param dispatcher dispatcher
 */
+ (void)updateSuperViewIfNeeded:(BBASMComponent)item
                     dispatcher:(BBASchemeDispatcher *)dispatcher;

/**
 * @brief div  class属性 是否会生成layer.name
 *
 * @return YES 生成
 */
+ (BOOL)webKitConvertDivClassToLayerName;

@end