Remove header and footer support,this is unnecessary
This commit is contained in:
parent
8fd2477c81
commit
738c072ee4
@ -40,8 +40,6 @@ import pub.doric.shader.ViewNode;
|
|||||||
*/
|
*/
|
||||||
class FlowAdapter extends RecyclerView.Adapter<FlowAdapter.DoricViewHolder> {
|
class FlowAdapter extends RecyclerView.Adapter<FlowAdapter.DoricViewHolder> {
|
||||||
private static final int TYPE_LOAD_MORE = -1;
|
private static final int TYPE_LOAD_MORE = -1;
|
||||||
private static final int TYPE_HEADER = -2;
|
|
||||||
private static final int TYPE_FOOTER = -3;
|
|
||||||
private final FlowLayoutNode flowLayoutNode;
|
private final FlowLayoutNode flowLayoutNode;
|
||||||
String renderItemFuncId;
|
String renderItemFuncId;
|
||||||
int itemCount = 0;
|
int itemCount = 0;
|
||||||
@ -70,10 +68,8 @@ class FlowAdapter extends RecyclerView.Adapter<FlowAdapter.DoricViewHolder> {
|
|||||||
holder.flowLayoutItemNode.blend(jsObject.getProperty("props").asObject());
|
holder.flowLayoutItemNode.blend(jsObject.getProperty("props").asObject());
|
||||||
}
|
}
|
||||||
if (holder.flowLayoutItemNode.fullSpan
|
if (holder.flowLayoutItemNode.fullSpan
|
||||||
|| (this.flowLayoutNode.hasHeader() && position == 0)
|
|
||||||
|| (this.flowLayoutNode.hasFooter() && position == this.getItemCount() - 1)
|
|
||||||
|| this.flowLayoutNode.loadMore
|
|| this.flowLayoutNode.loadMore
|
||||||
&& position == this.itemCount + (this.flowLayoutNode.hasHeader() ? 1 : 0)) {
|
&& position >= this.itemCount) {
|
||||||
StaggeredGridLayoutManager.LayoutParams layoutParams = new StaggeredGridLayoutManager.LayoutParams(
|
StaggeredGridLayoutManager.LayoutParams layoutParams = new StaggeredGridLayoutManager.LayoutParams(
|
||||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||||
holder.itemView.getLayoutParams().height
|
holder.itemView.getLayoutParams().height
|
||||||
@ -82,7 +78,7 @@ class FlowAdapter extends RecyclerView.Adapter<FlowAdapter.DoricViewHolder> {
|
|||||||
holder.itemView.setLayoutParams(layoutParams);
|
holder.itemView.setLayoutParams(layoutParams);
|
||||||
}
|
}
|
||||||
if (this.flowLayoutNode.loadMore
|
if (this.flowLayoutNode.loadMore
|
||||||
&& position == this.itemCount + (this.flowLayoutNode.hasHeader() ? 1 : 0)
|
&& position >= this.itemCount
|
||||||
&& !TextUtils.isEmpty(this.flowLayoutNode.onLoadMoreFuncId)) {
|
&& !TextUtils.isEmpty(this.flowLayoutNode.onLoadMoreFuncId)) {
|
||||||
callLoadMore();
|
callLoadMore();
|
||||||
}
|
}
|
||||||
@ -90,23 +86,12 @@ class FlowAdapter extends RecyclerView.Adapter<FlowAdapter.DoricViewHolder> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getItemCount() {
|
public int getItemCount() {
|
||||||
return this.itemCount
|
return this.itemCount + (this.flowLayoutNode.loadMore ? 1 : 0);
|
||||||
+ (this.flowLayoutNode.loadMore ? 1 : 0)
|
|
||||||
+ (this.flowLayoutNode.hasHeader() ? 1 : 0)
|
|
||||||
+ (this.flowLayoutNode.hasFooter() ? 1 : 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getItemViewType(int position) {
|
public int getItemViewType(int position) {
|
||||||
if (this.flowLayoutNode.hasHeader() && position == 0) {
|
if (position >= this.itemCount) {
|
||||||
return TYPE_HEADER;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.flowLayoutNode.hasFooter() && position == this.getItemCount() - 1) {
|
|
||||||
return TYPE_FOOTER;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (position >= this.itemCount + (this.flowLayoutNode.hasHeader() ? 1 : 0)) {
|
|
||||||
return TYPE_LOAD_MORE;
|
return TYPE_LOAD_MORE;
|
||||||
}
|
}
|
||||||
JSValue value = getItemModel(position);
|
JSValue value = getItemModel(position);
|
||||||
@ -119,20 +104,9 @@ class FlowAdapter extends RecyclerView.Adapter<FlowAdapter.DoricViewHolder> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private JSValue getItemModel(int position) {
|
private JSValue getItemModel(int position) {
|
||||||
if (this.flowLayoutNode.hasHeader() && position == 0) {
|
if (position >= this.itemCount) {
|
||||||
return this.flowLayoutNode.getSubModel(this.flowLayoutNode.headerViewId);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.flowLayoutNode.hasFooter() && position == this.getItemCount() - 1) {
|
|
||||||
return this.flowLayoutNode.getSubModel(this.flowLayoutNode.footerViewId);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (position >= this.itemCount + (this.flowLayoutNode.hasHeader() ? 1 : 0)) {
|
|
||||||
return this.flowLayoutNode.getSubModel(this.flowLayoutNode.loadMoreViewId);
|
return this.flowLayoutNode.getSubModel(this.flowLayoutNode.loadMoreViewId);
|
||||||
}
|
}
|
||||||
if (this.flowLayoutNode.hasHeader()) {
|
|
||||||
position--;
|
|
||||||
}
|
|
||||||
String id = itemValues.get(position);
|
String id = itemValues.get(position);
|
||||||
if (TextUtils.isEmpty(id)) {
|
if (TextUtils.isEmpty(id)) {
|
||||||
AsyncResult<JSDecoder> asyncResult = flowLayoutNode.pureCallJSResponse(
|
AsyncResult<JSDecoder> asyncResult = flowLayoutNode.pureCallJSResponse(
|
||||||
|
@ -332,21 +332,6 @@ public class FlowLayoutNode extends SuperNode<RecyclerView> implements IDoricScr
|
|||||||
}
|
}
|
||||||
|
|
||||||
private int calibratePosition(int position) {
|
private int calibratePosition(int position) {
|
||||||
if (hasHeader() && position == 0) {
|
|
||||||
return -11;
|
|
||||||
}
|
|
||||||
if (hasFooter() && position == this.itemCount
|
|
||||||
+ (this.loadMore ? 1 : 0)
|
|
||||||
+ (this.hasHeader() ? 1 : 0)
|
|
||||||
+ (this.hasFooter() ? 1 : 0) - 1) {
|
|
||||||
return -12;
|
|
||||||
}
|
|
||||||
if (position >= this.itemCount + (this.hasHeader() ? 1 : 0)) {
|
|
||||||
return -10;
|
|
||||||
}
|
|
||||||
if (this.hasHeader()) {
|
|
||||||
return position - 1;
|
|
||||||
}
|
|
||||||
return position;
|
return position;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -377,12 +362,4 @@ public class FlowLayoutNode extends SuperNode<RecyclerView> implements IDoricScr
|
|||||||
}
|
}
|
||||||
return jsonArray;
|
return jsonArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean hasHeader() {
|
|
||||||
return !TextUtils.isEmpty(this.headerViewId);
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean hasFooter() {
|
|
||||||
return !TextUtils.isEmpty(this.footerViewId);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -40,8 +40,6 @@ import pub.doric.shader.ViewNode;
|
|||||||
*/
|
*/
|
||||||
class ListAdapter extends RecyclerView.Adapter<ListAdapter.DoricViewHolder> {
|
class ListAdapter extends RecyclerView.Adapter<ListAdapter.DoricViewHolder> {
|
||||||
private static final int TYPE_LOAD_MORE = -1;
|
private static final int TYPE_LOAD_MORE = -1;
|
||||||
private static final int TYPE_HEADER = -2;
|
|
||||||
private static final int TYPE_FOOTER = -3;
|
|
||||||
private final ListNode listNode;
|
private final ListNode listNode;
|
||||||
|
|
||||||
ListAdapter(ListNode listNode) {
|
ListAdapter(ListNode listNode) {
|
||||||
@ -68,7 +66,7 @@ class ListAdapter extends RecyclerView.Adapter<ListAdapter.DoricViewHolder> {
|
|||||||
holder.listItemNode.blend(jsObject.getProperty("props").asObject());
|
holder.listItemNode.blend(jsObject.getProperty("props").asObject());
|
||||||
}
|
}
|
||||||
if (this.listNode.loadMore
|
if (this.listNode.loadMore
|
||||||
&& position == this.itemCount + (this.listNode.hasHeader() ? 1 : 0)
|
&& position >= this.itemCount
|
||||||
&& !TextUtils.isEmpty(this.listNode.onLoadMoreFuncId)) {
|
&& !TextUtils.isEmpty(this.listNode.onLoadMoreFuncId)) {
|
||||||
callLoadMore();
|
callLoadMore();
|
||||||
}
|
}
|
||||||
@ -76,23 +74,12 @@ class ListAdapter extends RecyclerView.Adapter<ListAdapter.DoricViewHolder> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getItemCount() {
|
public int getItemCount() {
|
||||||
return this.itemCount
|
return this.itemCount + (this.listNode.loadMore ? 1 : 0);
|
||||||
+ (this.listNode.loadMore ? 1 : 0)
|
|
||||||
+ (this.listNode.hasHeader() ? 1 : 0)
|
|
||||||
+ (this.listNode.hasFooter() ? 1 : 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getItemViewType(int position) {
|
public int getItemViewType(int position) {
|
||||||
if (this.listNode.hasHeader() && position == 0) {
|
if (position >= this.itemCount) {
|
||||||
return TYPE_HEADER;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.listNode.hasFooter() && position == this.getItemCount() - 1) {
|
|
||||||
return TYPE_FOOTER;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (position >= this.itemCount + (this.listNode.hasHeader() ? 1 : 0)) {
|
|
||||||
return TYPE_LOAD_MORE;
|
return TYPE_LOAD_MORE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -106,20 +93,9 @@ class ListAdapter extends RecyclerView.Adapter<ListAdapter.DoricViewHolder> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private JSValue getItemModel(int position) {
|
private JSValue getItemModel(int position) {
|
||||||
if (this.listNode.hasHeader() && position == 0) {
|
if (position >= this.itemCount) {
|
||||||
return this.listNode.getSubModel(this.listNode.headerViewId);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.listNode.hasFooter() && position == this.getItemCount() - 1) {
|
|
||||||
return this.listNode.getSubModel(this.listNode.footerViewId);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (position >= this.itemCount + (this.listNode.hasHeader() ? 1 : 0)) {
|
|
||||||
return this.listNode.getSubModel(this.listNode.loadMoreViewId);
|
return this.listNode.getSubModel(this.listNode.loadMoreViewId);
|
||||||
}
|
}
|
||||||
if (this.listNode.hasHeader()) {
|
|
||||||
position--;
|
|
||||||
}
|
|
||||||
String id = listNode.itemValues.get(position);
|
String id = listNode.itemValues.get(position);
|
||||||
if (TextUtils.isEmpty(id)) {
|
if (TextUtils.isEmpty(id)) {
|
||||||
int batchCount = listNode.batchCount;
|
int batchCount = listNode.batchCount;
|
||||||
|
@ -65,8 +65,6 @@ public class ListNode extends SuperNode<RecyclerView> implements IDoricScrollabl
|
|||||||
SparseArray<String> itemValues = new SparseArray<>();
|
SparseArray<String> itemValues = new SparseArray<>();
|
||||||
boolean loadMore = false;
|
boolean loadMore = false;
|
||||||
String loadMoreViewId;
|
String loadMoreViewId;
|
||||||
String headerViewId;
|
|
||||||
String footerViewId;
|
|
||||||
private final Set<DoricScrollChangeListener> listeners = new HashSet<>();
|
private final Set<DoricScrollChangeListener> listeners = new HashSet<>();
|
||||||
private String onScrollFuncId;
|
private String onScrollFuncId;
|
||||||
private String onScrollEndFuncId;
|
private String onScrollEndFuncId;
|
||||||
@ -247,12 +245,6 @@ public class ListNode extends SuperNode<RecyclerView> implements IDoricScrollabl
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case "header":
|
|
||||||
this.headerViewId = prop.asString().value();
|
|
||||||
break;
|
|
||||||
case "footer":
|
|
||||||
this.footerViewId = prop.asString().value();
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
super.blend(view, name, prop);
|
super.blend(view, name, prop);
|
||||||
break;
|
break;
|
||||||
@ -304,21 +296,6 @@ public class ListNode extends SuperNode<RecyclerView> implements IDoricScrollabl
|
|||||||
}
|
}
|
||||||
|
|
||||||
private int calibratePosition(int position) {
|
private int calibratePosition(int position) {
|
||||||
if (hasHeader() && position == 0) {
|
|
||||||
return -11;
|
|
||||||
}
|
|
||||||
if (hasFooter() && position == this.itemCount
|
|
||||||
+ (this.loadMore ? 1 : 0)
|
|
||||||
+ (this.hasHeader() ? 1 : 0)
|
|
||||||
+ (this.hasFooter() ? 1 : 0) - 1) {
|
|
||||||
return -12;
|
|
||||||
}
|
|
||||||
if (position >= this.itemCount + (this.hasHeader() ? 1 : 0)) {
|
|
||||||
return -10;
|
|
||||||
}
|
|
||||||
if (this.hasHeader()) {
|
|
||||||
return position - 1;
|
|
||||||
}
|
|
||||||
return position;
|
return position;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -370,12 +347,4 @@ public class ListNode extends SuperNode<RecyclerView> implements IDoricScrollabl
|
|||||||
mView.scrollToPosition(pos);
|
mView.scrollToPosition(pos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean hasHeader() {
|
|
||||||
return !TextUtils.isEmpty(this.headerViewId);
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean hasFooter() {
|
|
||||||
return !TextUtils.isEmpty(this.footerViewId);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -21,14 +21,6 @@ class FlowDemo extends Panel {
|
|||||||
columnCount: 3,
|
columnCount: 3,
|
||||||
columnSpace: 10,
|
columnSpace: 10,
|
||||||
rowSpace: 10,
|
rowSpace: 10,
|
||||||
header: flowItem(image({
|
|
||||||
layoutConfig: layoutConfig().mostWidth().fitHeight(),
|
|
||||||
imageUrl: imageUrls[0]
|
|
||||||
})),
|
|
||||||
footer: flowItem(image({
|
|
||||||
layoutConfig: layoutConfig().mostWidth().fitHeight(),
|
|
||||||
imageUrl: imageUrls[1]
|
|
||||||
})),
|
|
||||||
renderItem: (idx) => {
|
renderItem: (idx) => {
|
||||||
return flowItem(
|
return flowItem(
|
||||||
text({
|
text({
|
||||||
|
@ -47,12 +47,6 @@ class ListVH extends ViewHolder {
|
|||||||
height: 50,
|
height: 50,
|
||||||
}),
|
}),
|
||||||
this.list = list({
|
this.list = list({
|
||||||
header: listItem(text({
|
|
||||||
text: "This is header",
|
|
||||||
})),
|
|
||||||
footer: listItem(text({
|
|
||||||
text: "This is footer",
|
|
||||||
})),
|
|
||||||
itemCount: 0,
|
itemCount: 0,
|
||||||
layoutConfig: {
|
layoutConfig: {
|
||||||
widthSpec: LayoutSpec.MOST,
|
widthSpec: LayoutSpec.MOST,
|
||||||
|
@ -167,8 +167,6 @@ @interface DoricFlowLayoutNode () <UICollectionViewDataSource, UICollectionViewD
|
|||||||
|
|
||||||
@property(nonatomic, copy) NSString *onLoadMoreFuncId;
|
@property(nonatomic, copy) NSString *onLoadMoreFuncId;
|
||||||
@property(nonatomic, copy) NSString *loadMoreViewId;
|
@property(nonatomic, copy) NSString *loadMoreViewId;
|
||||||
@property(nonatomic, copy) NSString *headerViewId;
|
|
||||||
@property(nonatomic, copy) NSString *footerViewId;
|
|
||||||
@property(nonatomic, assign) BOOL loadMore;
|
@property(nonatomic, assign) BOOL loadMore;
|
||||||
@property(nonatomic, strong) NSMutableSet <DoricDidScrollBlock> *didScrollBlocks;
|
@property(nonatomic, strong) NSMutableSet <DoricDidScrollBlock> *didScrollBlocks;
|
||||||
@property(nonatomic, copy) NSString *onScrollFuncId;
|
@property(nonatomic, copy) NSString *onScrollFuncId;
|
||||||
@ -207,14 +205,6 @@ - (UICollectionView *)build {
|
|||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)hasHeader {
|
|
||||||
return self.headerViewId && self.headerViewId.length > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (BOOL)hasFooter {
|
|
||||||
return self.footerViewId && self.footerViewId.length > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)blendView:(UICollectionView *)view forPropName:(NSString *)name propValue:(id)prop {
|
- (void)blendView:(UICollectionView *)view forPropName:(NSString *)name propValue:(id)prop {
|
||||||
if ([@"scrollable" isEqualToString:name]) {
|
if ([@"scrollable" isEqualToString:name]) {
|
||||||
self.view.scrollEnabled = [prop boolValue];
|
self.view.scrollEnabled = [prop boolValue];
|
||||||
@ -254,36 +244,19 @@ - (void)blendView:(UICollectionView *)view forPropName:(NSString *)name propValu
|
|||||||
self.onScrollFuncId = prop;
|
self.onScrollFuncId = prop;
|
||||||
} else if ([@"onScrollEnd" isEqualToString:name]) {
|
} else if ([@"onScrollEnd" isEqualToString:name]) {
|
||||||
self.onScrollEndFuncId = prop;
|
self.onScrollEndFuncId = prop;
|
||||||
} else if ([@"header" isEqualToString:name]) {
|
|
||||||
self.headerViewId = prop;
|
|
||||||
} else if ([@"footer" isEqualToString:name]) {
|
|
||||||
self.footerViewId = prop;
|
|
||||||
} else {
|
} else {
|
||||||
[super blendView:view forPropName:name propValue:prop];
|
[super blendView:view forPropName:name propValue:prop];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSDictionary *)itemModelAt:(NSUInteger)position {
|
- (NSDictionary *)itemModelAt:(NSUInteger)position {
|
||||||
if (self.hasHeader && position == 0) {
|
if (self.loadMore && position >= self.itemCount) {
|
||||||
return [self subModelOf:self.headerViewId];
|
|
||||||
}
|
|
||||||
if (self.hasFooter && position == self.itemCount
|
|
||||||
+ (self.loadMore ? 1 : 0)
|
|
||||||
+ (self.hasHeader ? 1 : 0)
|
|
||||||
+ (self.hasFooter ? 1 : 0)
|
|
||||||
- 1) {
|
|
||||||
return [self subModelOf:self.footerViewId];
|
|
||||||
}
|
|
||||||
if (self.loadMore && position >= self.itemCount + (self.hasHeader ? 1 : 0)) {
|
|
||||||
if (self.loadMoreViewId && self.loadMoreViewId.length > 0) {
|
if (self.loadMoreViewId && self.loadMoreViewId.length > 0) {
|
||||||
return [self subModelOf:self.loadMoreViewId];
|
return [self subModelOf:self.loadMoreViewId];
|
||||||
} else {
|
} else {
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (self.hasHeader) {
|
|
||||||
position--;
|
|
||||||
}
|
|
||||||
NSString *viewId = self.itemViewIds[@(position)];
|
NSString *viewId = self.itemViewIds[@(position)];
|
||||||
if (viewId && viewId.length > 0) {
|
if (viewId && viewId.length > 0) {
|
||||||
return [self subModelOf:viewId];
|
return [self subModelOf:viewId];
|
||||||
@ -366,7 +339,7 @@ - (void)callLoadMore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
|
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
|
||||||
return self.itemCount + (self.loadMore ? 1 : 0) + (self.hasHeader ? 1 : 0) + (self.hasFooter ? 1 : 0);
|
return self.itemCount + (self.loadMore ? 1 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
|
- (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
|
||||||
@ -374,17 +347,8 @@ - (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collection
|
|||||||
NSDictionary *model = [self itemModelAt:position];
|
NSDictionary *model = [self itemModelAt:position];
|
||||||
NSDictionary *props = model[@"props"];
|
NSDictionary *props = model[@"props"];
|
||||||
NSString *identifier = props[@"identifier"] ?: @"doricCell";
|
NSString *identifier = props[@"identifier"] ?: @"doricCell";
|
||||||
if (self.hasHeader && position == 0) {
|
if (self.loadMore
|
||||||
identifier = @"doricHeaderCell";
|
&& position >= self.itemCount
|
||||||
} else if (self.hasFooter
|
|
||||||
&& position == self.itemCount
|
|
||||||
+ (self.loadMore ? 1 : 0)
|
|
||||||
+ (self.hasHeader ? 1 : 0)
|
|
||||||
+ (self.hasFooter ? 1 : 0)
|
|
||||||
- 1) {
|
|
||||||
identifier = @"doricFooterCell";
|
|
||||||
} else if (self.loadMore
|
|
||||||
&& position == self.itemCount + (self.hasHeader ? 1 : 0)
|
|
||||||
&& self.onLoadMoreFuncId) {
|
&& self.onLoadMoreFuncId) {
|
||||||
identifier = @"doricLoadMoreCell";
|
identifier = @"doricLoadMoreCell";
|
||||||
[self callLoadMore];
|
[self callLoadMore];
|
||||||
@ -402,15 +366,7 @@ - (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collection
|
|||||||
node.viewId = model[@"id"];
|
node.viewId = model[@"id"];
|
||||||
[node blend:props];
|
[node blend:props];
|
||||||
BOOL fillWidth = [props[@"fullSpan"] boolValue]
|
BOOL fillWidth = [props[@"fullSpan"] boolValue]
|
||||||
|| (self.hasHeader && position == 0)
|
|| (self.loadMore && position >= self.itemCount);
|
||||||
|| (self.hasFooter
|
|
||||||
&& position == self.itemCount
|
|
||||||
+ (self.loadMore ? 1 : 0)
|
|
||||||
+ (self.hasHeader ? 1 : 0)
|
|
||||||
+ (self.hasFooter ? 1 : 0)
|
|
||||||
- 1)
|
|
||||||
|| (self.loadMore
|
|
||||||
&& position == self.itemCount + (self.hasHeader ? 1 : 0));
|
|
||||||
if (fillWidth) {
|
if (fillWidth) {
|
||||||
node.view.width = collectionView.width;
|
node.view.width = collectionView.width;
|
||||||
} else {
|
} else {
|
||||||
@ -457,15 +413,7 @@ - (NSInteger)doricFlowLayoutColumnCount {
|
|||||||
|
|
||||||
- (BOOL)doricFlowLayoutItemFullSpan:(NSIndexPath *)indexPath {
|
- (BOOL)doricFlowLayoutItemFullSpan:(NSIndexPath *)indexPath {
|
||||||
NSUInteger position = (NSUInteger) indexPath.row;
|
NSUInteger position = (NSUInteger) indexPath.row;
|
||||||
if ((self.hasHeader && position == 0)
|
if (self.loadMore && position >= self.itemCount) {
|
||||||
|| (self.hasFooter
|
|
||||||
&& position == self.itemCount
|
|
||||||
+ (self.loadMore ? 1 : 0)
|
|
||||||
+ (self.hasHeader ? 1 : 0)
|
|
||||||
+ (self.hasFooter ? 1 : 0)
|
|
||||||
- 1)
|
|
||||||
|| (self.loadMore
|
|
||||||
&& position == self.itemCount + (self.hasHeader ? 1 : 0))) {
|
|
||||||
return YES;
|
return YES;
|
||||||
} else {
|
} else {
|
||||||
NSDictionary *model = [self itemModelAt:position];
|
NSDictionary *model = [self itemModelAt:position];
|
||||||
|
@ -53,8 +53,6 @@ @interface DoricListNode () <UITableViewDataSource, UITableViewDelegate>
|
|||||||
@property(nonatomic, copy) NSString *onLoadMoreFuncId;
|
@property(nonatomic, copy) NSString *onLoadMoreFuncId;
|
||||||
@property(nonatomic, copy) NSString *renderItemFuncId;
|
@property(nonatomic, copy) NSString *renderItemFuncId;
|
||||||
@property(nonatomic, copy) NSString *loadMoreViewId;
|
@property(nonatomic, copy) NSString *loadMoreViewId;
|
||||||
@property(nonatomic, copy) NSString *headerViewId;
|
|
||||||
@property(nonatomic, copy) NSString *footerViewId;
|
|
||||||
@property(nonatomic, assign) BOOL loadMore;
|
@property(nonatomic, assign) BOOL loadMore;
|
||||||
@property(nonatomic, assign) NSUInteger loadAnchor;
|
@property(nonatomic, assign) NSUInteger loadAnchor;
|
||||||
@property(nonatomic, strong) NSMutableSet <DoricDidScrollBlock> *didScrollBlocks;
|
@property(nonatomic, strong) NSMutableSet <DoricDidScrollBlock> *didScrollBlocks;
|
||||||
@ -95,14 +93,6 @@ - (UITableView *)build {
|
|||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)hasHeader {
|
|
||||||
return self.headerViewId && self.headerViewId.length > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (BOOL)hasFooter {
|
|
||||||
return self.footerViewId && self.footerViewId.length > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)blendView:(UITableView *)view forPropName:(NSString *)name propValue:(id)prop {
|
- (void)blendView:(UITableView *)view forPropName:(NSString *)name propValue:(id)prop {
|
||||||
if ([@"scrollable" isEqualToString:name]) {
|
if ([@"scrollable" isEqualToString:name]) {
|
||||||
self.view.scrollEnabled = [prop boolValue];
|
self.view.scrollEnabled = [prop boolValue];
|
||||||
@ -136,17 +126,13 @@ - (void)blendView:(UITableView *)view forPropName:(NSString *)name propValue:(id
|
|||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
[view scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:[prop unsignedIntegerValue] inSection:0] atScrollPosition:UITableViewScrollPositionTop animated:NO];
|
[view scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:[prop unsignedIntegerValue] inSection:0] atScrollPosition:UITableViewScrollPositionTop animated:NO];
|
||||||
});
|
});
|
||||||
} else if ([@"header" isEqualToString:name]) {
|
|
||||||
self.headerViewId = prop;
|
|
||||||
} else if ([@"footer" isEqualToString:name]) {
|
|
||||||
self.footerViewId = prop;
|
|
||||||
} else {
|
} else {
|
||||||
[super blendView:view forPropName:name propValue:prop];
|
[super blendView:view forPropName:name propValue:prop];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
|
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
|
||||||
return self.itemCount + (self.loadMore ? 1 : 0) + (self.hasHeader ? 1 : 0) + (self.hasFooter ? 1 : 0);
|
return self.itemCount + (self.loadMore ? 1 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)callLoadMore {
|
- (void)callLoadMore {
|
||||||
@ -162,17 +148,8 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
|
|||||||
NSDictionary *props = model[@"props"];
|
NSDictionary *props = model[@"props"];
|
||||||
NSString *reuseId = props[@"identifier"];
|
NSString *reuseId = props[@"identifier"];
|
||||||
self.itemActions[@(position)] = props[@"actions"];
|
self.itemActions[@(position)] = props[@"actions"];
|
||||||
if (self.hasHeader && position == 0) {
|
if (self.loadMore
|
||||||
reuseId = @"doricHeaderCell";
|
&& position >= self.itemCount
|
||||||
} else if (self.hasFooter
|
|
||||||
&& position == self.itemCount
|
|
||||||
+ (self.loadMore ? 1 : 0)
|
|
||||||
+ (self.hasHeader ? 1 : 0)
|
|
||||||
+ (self.hasFooter ? 1 : 0)
|
|
||||||
- 1) {
|
|
||||||
reuseId = @"doricFooterCell";
|
|
||||||
} else if (self.loadMore
|
|
||||||
&& position == self.itemCount + (self.hasHeader ? 1 : 0)
|
|
||||||
&& self.onLoadMoreFuncId) {
|
&& self.onLoadMoreFuncId) {
|
||||||
reuseId = @"doricLoadMoreCell";
|
reuseId = @"doricLoadMoreCell";
|
||||||
[self callLoadMore];
|
[self callLoadMore];
|
||||||
@ -260,26 +237,13 @@ - (nullable UISwipeActionsConfiguration *)tableView:(UITableView *)tableView tra
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (NSDictionary *)itemModelAt:(NSUInteger)position {
|
- (NSDictionary *)itemModelAt:(NSUInteger)position {
|
||||||
if (self.hasHeader && position == 0) {
|
if (self.loadMore && position >= self.itemCount) {
|
||||||
return [self subModelOf:self.headerViewId];
|
|
||||||
}
|
|
||||||
if (self.hasFooter && position == self.itemCount
|
|
||||||
+ (self.loadMore ? 1 : 0)
|
|
||||||
+ (self.hasHeader ? 1 : 0)
|
|
||||||
+ (self.hasFooter ? 1 : 0)
|
|
||||||
- 1) {
|
|
||||||
return [self subModelOf:self.footerViewId];
|
|
||||||
}
|
|
||||||
if (self.loadMore && position >= self.itemCount + (self.hasHeader ? 1 : 0)) {
|
|
||||||
if (self.loadMoreViewId && self.loadMoreViewId.length > 0) {
|
if (self.loadMoreViewId && self.loadMoreViewId.length > 0) {
|
||||||
return [self subModelOf:self.loadMoreViewId];
|
return [self subModelOf:self.loadMoreViewId];
|
||||||
} else {
|
} else {
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (self.hasHeader) {
|
|
||||||
position--;
|
|
||||||
}
|
|
||||||
NSString *viewId = self.itemViewIds[@(position)];
|
NSString *viewId = self.itemViewIds[@(position)];
|
||||||
if (viewId && viewId.length > 0) {
|
if (viewId && viewId.length > 0) {
|
||||||
return [self subModelOf:viewId];
|
return [self subModelOf:viewId];
|
||||||
|
@ -2316,6 +2316,12 @@ var ListItem = /** @class */ (function (_super) {
|
|||||||
], ListItem.prototype, "actions", void 0);
|
], ListItem.prototype, "actions", void 0);
|
||||||
return ListItem;
|
return ListItem;
|
||||||
}(Stack));
|
}(Stack));
|
||||||
|
exports.OtherItems = void 0;
|
||||||
|
(function (OtherItems) {
|
||||||
|
OtherItems[OtherItems["LoadMore"] = -10] = "LoadMore";
|
||||||
|
OtherItems[OtherItems["Header"] = -11] = "Header";
|
||||||
|
OtherItems[OtherItems["Footer"] = -12] = "Footer";
|
||||||
|
})(exports.OtherItems || (exports.OtherItems = {}));
|
||||||
var List = /** @class */ (function (_super) {
|
var List = /** @class */ (function (_super) {
|
||||||
__extends$c(List, _super);
|
__extends$c(List, _super);
|
||||||
function List() {
|
function List() {
|
||||||
@ -2330,18 +2336,26 @@ var List = /** @class */ (function (_super) {
|
|||||||
if (this.loadMoreView) {
|
if (this.loadMoreView) {
|
||||||
ret.push(this.loadMoreView);
|
ret.push(this.loadMoreView);
|
||||||
}
|
}
|
||||||
if (this.header) {
|
|
||||||
ret.push(this.header);
|
|
||||||
}
|
|
||||||
if (this.footer) {
|
|
||||||
ret.push(this.footer);
|
|
||||||
}
|
|
||||||
return ret;
|
return ret;
|
||||||
};
|
};
|
||||||
List.prototype.scrollToItem = function (context, index, config) {
|
List.prototype.scrollToItem = function (context, index, config) {
|
||||||
var animated = config === null || config === void 0 ? void 0 : config.animated;
|
var animated = config === null || config === void 0 ? void 0 : config.animated;
|
||||||
return this.nativeChannel(context, 'scrollToItem')({ index: index, animated: animated, });
|
return this.nativeChannel(context, 'scrollToItem')({ index: index, animated: animated, });
|
||||||
};
|
};
|
||||||
|
/**
|
||||||
|
* @param context
|
||||||
|
* @returns Returns the range of the visible views.
|
||||||
|
*/
|
||||||
|
List.prototype.findVisibleItems = function (context) {
|
||||||
|
return this.nativeChannel(context, 'findVisibleItems')();
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* @param context
|
||||||
|
* @returns Returns the range of the completely visible views.
|
||||||
|
*/
|
||||||
|
List.prototype.findCompletelyVisibleItems = function (context) {
|
||||||
|
return this.nativeChannel(context, 'findCompletelyVisibleItems')();
|
||||||
|
};
|
||||||
List.prototype.reset = function () {
|
List.prototype.reset = function () {
|
||||||
this.cachedViews.clear();
|
this.cachedViews.clear();
|
||||||
this.itemCount = 0;
|
this.itemCount = 0;
|
||||||
@ -2363,12 +2377,6 @@ var List = /** @class */ (function (_super) {
|
|||||||
if (this.loadMoreView) {
|
if (this.loadMoreView) {
|
||||||
this.dirtyProps['loadMoreView'] = this.loadMoreView.viewId;
|
this.dirtyProps['loadMoreView'] = this.loadMoreView.viewId;
|
||||||
}
|
}
|
||||||
if (this.header) {
|
|
||||||
this.dirtyProps['header'] = this.header.viewId;
|
|
||||||
}
|
|
||||||
if (this.footer) {
|
|
||||||
this.dirtyProps['footer'] = this.footer.viewId;
|
|
||||||
}
|
|
||||||
return _super.prototype.toModel.call(this);
|
return _super.prototype.toModel.call(this);
|
||||||
};
|
};
|
||||||
__decorate$9([
|
__decorate$9([
|
||||||
@ -2415,14 +2423,6 @@ var List = /** @class */ (function (_super) {
|
|||||||
Property,
|
Property,
|
||||||
__metadata$9("design:type", Boolean)
|
__metadata$9("design:type", Boolean)
|
||||||
], List.prototype, "bounces", void 0);
|
], List.prototype, "bounces", void 0);
|
||||||
__decorate$9([
|
|
||||||
Property,
|
|
||||||
__metadata$9("design:type", ListItem)
|
|
||||||
], List.prototype, "header", void 0);
|
|
||||||
__decorate$9([
|
|
||||||
Property,
|
|
||||||
__metadata$9("design:type", ListItem)
|
|
||||||
], List.prototype, "footer", void 0);
|
|
||||||
return List;
|
return List;
|
||||||
}(Superview));
|
}(Superview));
|
||||||
function list(config) {
|
function list(config) {
|
||||||
@ -2952,14 +2952,22 @@ var FlowLayout = /** @class */ (function (_super) {
|
|||||||
if (this.loadMoreView) {
|
if (this.loadMoreView) {
|
||||||
ret.push(this.loadMoreView);
|
ret.push(this.loadMoreView);
|
||||||
}
|
}
|
||||||
if (this.header) {
|
|
||||||
ret.push(this.header);
|
|
||||||
}
|
|
||||||
if (this.footer) {
|
|
||||||
ret.push(this.footer);
|
|
||||||
}
|
|
||||||
return ret;
|
return ret;
|
||||||
};
|
};
|
||||||
|
/**
|
||||||
|
* @param context
|
||||||
|
* @returns Returns the range of the visible views for each column.
|
||||||
|
*/
|
||||||
|
FlowLayout.prototype.findVisibleItems = function (context) {
|
||||||
|
return this.nativeChannel(context, 'findVisibleItems')();
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* @param context
|
||||||
|
* @returns Returns the range of the completely visible views for each column.
|
||||||
|
*/
|
||||||
|
FlowLayout.prototype.findCompletelyVisibleItems = function (context) {
|
||||||
|
return this.nativeChannel(context, 'findCompletelyVisibleItems')();
|
||||||
|
};
|
||||||
FlowLayout.prototype.reset = function () {
|
FlowLayout.prototype.reset = function () {
|
||||||
this.cachedViews.clear();
|
this.cachedViews.clear();
|
||||||
this.itemCount = 0;
|
this.itemCount = 0;
|
||||||
@ -2981,12 +2989,6 @@ var FlowLayout = /** @class */ (function (_super) {
|
|||||||
if (this.loadMoreView) {
|
if (this.loadMoreView) {
|
||||||
this.dirtyProps['loadMoreView'] = this.loadMoreView.viewId;
|
this.dirtyProps['loadMoreView'] = this.loadMoreView.viewId;
|
||||||
}
|
}
|
||||||
if (this.header) {
|
|
||||||
this.dirtyProps['header'] = this.header.viewId;
|
|
||||||
}
|
|
||||||
if (this.footer) {
|
|
||||||
this.dirtyProps['footer'] = this.footer.viewId;
|
|
||||||
}
|
|
||||||
return _super.prototype.toModel.call(this);
|
return _super.prototype.toModel.call(this);
|
||||||
};
|
};
|
||||||
__decorate$5([
|
__decorate$5([
|
||||||
@ -3041,14 +3043,6 @@ var FlowLayout = /** @class */ (function (_super) {
|
|||||||
Property,
|
Property,
|
||||||
__metadata$5("design:type", Boolean)
|
__metadata$5("design:type", Boolean)
|
||||||
], FlowLayout.prototype, "bounces", void 0);
|
], FlowLayout.prototype, "bounces", void 0);
|
||||||
__decorate$5([
|
|
||||||
Property,
|
|
||||||
__metadata$5("design:type", FlowLayoutItem)
|
|
||||||
], FlowLayout.prototype, "header", void 0);
|
|
||||||
__decorate$5([
|
|
||||||
Property,
|
|
||||||
__metadata$5("design:type", FlowLayoutItem)
|
|
||||||
], FlowLayout.prototype, "footer", void 0);
|
|
||||||
return FlowLayout;
|
return FlowLayout;
|
||||||
}(Superview));
|
}(Superview));
|
||||||
function flowlayout(config) {
|
function flowlayout(config) {
|
||||||
|
@ -1739,6 +1739,12 @@ __decorate$9([
|
|||||||
Property,
|
Property,
|
||||||
__metadata$9("design:type", Array)
|
__metadata$9("design:type", Array)
|
||||||
], ListItem.prototype, "actions", void 0);
|
], ListItem.prototype, "actions", void 0);
|
||||||
|
exports.OtherItems = void 0;
|
||||||
|
(function (OtherItems) {
|
||||||
|
OtherItems[OtherItems["LoadMore"] = -10] = "LoadMore";
|
||||||
|
OtherItems[OtherItems["Header"] = -11] = "Header";
|
||||||
|
OtherItems[OtherItems["Footer"] = -12] = "Footer";
|
||||||
|
})(exports.OtherItems || (exports.OtherItems = {}));
|
||||||
class List extends Superview {
|
class List extends Superview {
|
||||||
constructor() {
|
constructor() {
|
||||||
super(...arguments);
|
super(...arguments);
|
||||||
@ -1751,18 +1757,26 @@ class List extends Superview {
|
|||||||
if (this.loadMoreView) {
|
if (this.loadMoreView) {
|
||||||
ret.push(this.loadMoreView);
|
ret.push(this.loadMoreView);
|
||||||
}
|
}
|
||||||
if (this.header) {
|
|
||||||
ret.push(this.header);
|
|
||||||
}
|
|
||||||
if (this.footer) {
|
|
||||||
ret.push(this.footer);
|
|
||||||
}
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
scrollToItem(context, index, config) {
|
scrollToItem(context, index, config) {
|
||||||
const animated = config === null || config === void 0 ? void 0 : config.animated;
|
const animated = config === null || config === void 0 ? void 0 : config.animated;
|
||||||
return this.nativeChannel(context, 'scrollToItem')({ index, animated, });
|
return this.nativeChannel(context, 'scrollToItem')({ index, animated, });
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* @param context
|
||||||
|
* @returns Returns the range of the visible views.
|
||||||
|
*/
|
||||||
|
findVisibleItems(context) {
|
||||||
|
return this.nativeChannel(context, 'findVisibleItems')();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @param context
|
||||||
|
* @returns Returns the range of the completely visible views.
|
||||||
|
*/
|
||||||
|
findCompletelyVisibleItems(context) {
|
||||||
|
return this.nativeChannel(context, 'findCompletelyVisibleItems')();
|
||||||
|
}
|
||||||
reset() {
|
reset() {
|
||||||
this.cachedViews.clear();
|
this.cachedViews.clear();
|
||||||
this.itemCount = 0;
|
this.itemCount = 0;
|
||||||
@ -1783,12 +1797,6 @@ class List extends Superview {
|
|||||||
if (this.loadMoreView) {
|
if (this.loadMoreView) {
|
||||||
this.dirtyProps['loadMoreView'] = this.loadMoreView.viewId;
|
this.dirtyProps['loadMoreView'] = this.loadMoreView.viewId;
|
||||||
}
|
}
|
||||||
if (this.header) {
|
|
||||||
this.dirtyProps['header'] = this.header.viewId;
|
|
||||||
}
|
|
||||||
if (this.footer) {
|
|
||||||
this.dirtyProps['footer'] = this.footer.viewId;
|
|
||||||
}
|
|
||||||
return super.toModel();
|
return super.toModel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1836,14 +1844,6 @@ __decorate$9([
|
|||||||
Property,
|
Property,
|
||||||
__metadata$9("design:type", Boolean)
|
__metadata$9("design:type", Boolean)
|
||||||
], List.prototype, "bounces", void 0);
|
], List.prototype, "bounces", void 0);
|
||||||
__decorate$9([
|
|
||||||
Property,
|
|
||||||
__metadata$9("design:type", ListItem)
|
|
||||||
], List.prototype, "header", void 0);
|
|
||||||
__decorate$9([
|
|
||||||
Property,
|
|
||||||
__metadata$9("design:type", ListItem)
|
|
||||||
], List.prototype, "footer", void 0);
|
|
||||||
function list(config) {
|
function list(config) {
|
||||||
const ret = new List;
|
const ret = new List;
|
||||||
ret.apply(config);
|
ret.apply(config);
|
||||||
@ -2228,14 +2228,22 @@ class FlowLayout extends Superview {
|
|||||||
if (this.loadMoreView) {
|
if (this.loadMoreView) {
|
||||||
ret.push(this.loadMoreView);
|
ret.push(this.loadMoreView);
|
||||||
}
|
}
|
||||||
if (this.header) {
|
|
||||||
ret.push(this.header);
|
|
||||||
}
|
|
||||||
if (this.footer) {
|
|
||||||
ret.push(this.footer);
|
|
||||||
}
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* @param context
|
||||||
|
* @returns Returns the range of the visible views for each column.
|
||||||
|
*/
|
||||||
|
findVisibleItems(context) {
|
||||||
|
return this.nativeChannel(context, 'findVisibleItems')();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @param context
|
||||||
|
* @returns Returns the range of the completely visible views for each column.
|
||||||
|
*/
|
||||||
|
findCompletelyVisibleItems(context) {
|
||||||
|
return this.nativeChannel(context, 'findCompletelyVisibleItems')();
|
||||||
|
}
|
||||||
reset() {
|
reset() {
|
||||||
this.cachedViews.clear();
|
this.cachedViews.clear();
|
||||||
this.itemCount = 0;
|
this.itemCount = 0;
|
||||||
@ -2256,12 +2264,6 @@ class FlowLayout extends Superview {
|
|||||||
if (this.loadMoreView) {
|
if (this.loadMoreView) {
|
||||||
this.dirtyProps['loadMoreView'] = this.loadMoreView.viewId;
|
this.dirtyProps['loadMoreView'] = this.loadMoreView.viewId;
|
||||||
}
|
}
|
||||||
if (this.header) {
|
|
||||||
this.dirtyProps['header'] = this.header.viewId;
|
|
||||||
}
|
|
||||||
if (this.footer) {
|
|
||||||
this.dirtyProps['footer'] = this.footer.viewId;
|
|
||||||
}
|
|
||||||
return super.toModel();
|
return super.toModel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2317,14 +2319,6 @@ __decorate$5([
|
|||||||
Property,
|
Property,
|
||||||
__metadata$5("design:type", Boolean)
|
__metadata$5("design:type", Boolean)
|
||||||
], FlowLayout.prototype, "bounces", void 0);
|
], FlowLayout.prototype, "bounces", void 0);
|
||||||
__decorate$5([
|
|
||||||
Property,
|
|
||||||
__metadata$5("design:type", FlowLayoutItem)
|
|
||||||
], FlowLayout.prototype, "header", void 0);
|
|
||||||
__decorate$5([
|
|
||||||
Property,
|
|
||||||
__metadata$5("design:type", FlowLayoutItem)
|
|
||||||
], FlowLayout.prototype, "footer", void 0);
|
|
||||||
function flowlayout(config) {
|
function flowlayout(config) {
|
||||||
const ret = new FlowLayout;
|
const ret = new FlowLayout;
|
||||||
for (let key in config) {
|
for (let key in config) {
|
||||||
|
@ -3260,6 +3260,12 @@ __decorate$9([
|
|||||||
Property,
|
Property,
|
||||||
__metadata$9("design:type", Array)
|
__metadata$9("design:type", Array)
|
||||||
], ListItem.prototype, "actions", void 0);
|
], ListItem.prototype, "actions", void 0);
|
||||||
|
exports.OtherItems = void 0;
|
||||||
|
(function (OtherItems) {
|
||||||
|
OtherItems[OtherItems["LoadMore"] = -10] = "LoadMore";
|
||||||
|
OtherItems[OtherItems["Header"] = -11] = "Header";
|
||||||
|
OtherItems[OtherItems["Footer"] = -12] = "Footer";
|
||||||
|
})(exports.OtherItems || (exports.OtherItems = {}));
|
||||||
class List extends Superview {
|
class List extends Superview {
|
||||||
constructor() {
|
constructor() {
|
||||||
super(...arguments);
|
super(...arguments);
|
||||||
@ -3272,18 +3278,26 @@ class List extends Superview {
|
|||||||
if (this.loadMoreView) {
|
if (this.loadMoreView) {
|
||||||
ret.push(this.loadMoreView);
|
ret.push(this.loadMoreView);
|
||||||
}
|
}
|
||||||
if (this.header) {
|
|
||||||
ret.push(this.header);
|
|
||||||
}
|
|
||||||
if (this.footer) {
|
|
||||||
ret.push(this.footer);
|
|
||||||
}
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
scrollToItem(context, index, config) {
|
scrollToItem(context, index, config) {
|
||||||
const animated = config === null || config === void 0 ? void 0 : config.animated;
|
const animated = config === null || config === void 0 ? void 0 : config.animated;
|
||||||
return this.nativeChannel(context, 'scrollToItem')({ index, animated, });
|
return this.nativeChannel(context, 'scrollToItem')({ index, animated, });
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* @param context
|
||||||
|
* @returns Returns the range of the visible views.
|
||||||
|
*/
|
||||||
|
findVisibleItems(context) {
|
||||||
|
return this.nativeChannel(context, 'findVisibleItems')();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @param context
|
||||||
|
* @returns Returns the range of the completely visible views.
|
||||||
|
*/
|
||||||
|
findCompletelyVisibleItems(context) {
|
||||||
|
return this.nativeChannel(context, 'findCompletelyVisibleItems')();
|
||||||
|
}
|
||||||
reset() {
|
reset() {
|
||||||
this.cachedViews.clear();
|
this.cachedViews.clear();
|
||||||
this.itemCount = 0;
|
this.itemCount = 0;
|
||||||
@ -3304,12 +3318,6 @@ class List extends Superview {
|
|||||||
if (this.loadMoreView) {
|
if (this.loadMoreView) {
|
||||||
this.dirtyProps['loadMoreView'] = this.loadMoreView.viewId;
|
this.dirtyProps['loadMoreView'] = this.loadMoreView.viewId;
|
||||||
}
|
}
|
||||||
if (this.header) {
|
|
||||||
this.dirtyProps['header'] = this.header.viewId;
|
|
||||||
}
|
|
||||||
if (this.footer) {
|
|
||||||
this.dirtyProps['footer'] = this.footer.viewId;
|
|
||||||
}
|
|
||||||
return super.toModel();
|
return super.toModel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3357,14 +3365,6 @@ __decorate$9([
|
|||||||
Property,
|
Property,
|
||||||
__metadata$9("design:type", Boolean)
|
__metadata$9("design:type", Boolean)
|
||||||
], List.prototype, "bounces", void 0);
|
], List.prototype, "bounces", void 0);
|
||||||
__decorate$9([
|
|
||||||
Property,
|
|
||||||
__metadata$9("design:type", ListItem)
|
|
||||||
], List.prototype, "header", void 0);
|
|
||||||
__decorate$9([
|
|
||||||
Property,
|
|
||||||
__metadata$9("design:type", ListItem)
|
|
||||||
], List.prototype, "footer", void 0);
|
|
||||||
function list(config) {
|
function list(config) {
|
||||||
const ret = new List;
|
const ret = new List;
|
||||||
ret.apply(config);
|
ret.apply(config);
|
||||||
@ -3749,14 +3749,22 @@ class FlowLayout extends Superview {
|
|||||||
if (this.loadMoreView) {
|
if (this.loadMoreView) {
|
||||||
ret.push(this.loadMoreView);
|
ret.push(this.loadMoreView);
|
||||||
}
|
}
|
||||||
if (this.header) {
|
|
||||||
ret.push(this.header);
|
|
||||||
}
|
|
||||||
if (this.footer) {
|
|
||||||
ret.push(this.footer);
|
|
||||||
}
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* @param context
|
||||||
|
* @returns Returns the range of the visible views for each column.
|
||||||
|
*/
|
||||||
|
findVisibleItems(context) {
|
||||||
|
return this.nativeChannel(context, 'findVisibleItems')();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @param context
|
||||||
|
* @returns Returns the range of the completely visible views for each column.
|
||||||
|
*/
|
||||||
|
findCompletelyVisibleItems(context) {
|
||||||
|
return this.nativeChannel(context, 'findCompletelyVisibleItems')();
|
||||||
|
}
|
||||||
reset() {
|
reset() {
|
||||||
this.cachedViews.clear();
|
this.cachedViews.clear();
|
||||||
this.itemCount = 0;
|
this.itemCount = 0;
|
||||||
@ -3777,12 +3785,6 @@ class FlowLayout extends Superview {
|
|||||||
if (this.loadMoreView) {
|
if (this.loadMoreView) {
|
||||||
this.dirtyProps['loadMoreView'] = this.loadMoreView.viewId;
|
this.dirtyProps['loadMoreView'] = this.loadMoreView.viewId;
|
||||||
}
|
}
|
||||||
if (this.header) {
|
|
||||||
this.dirtyProps['header'] = this.header.viewId;
|
|
||||||
}
|
|
||||||
if (this.footer) {
|
|
||||||
this.dirtyProps['footer'] = this.footer.viewId;
|
|
||||||
}
|
|
||||||
return super.toModel();
|
return super.toModel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3838,14 +3840,6 @@ __decorate$5([
|
|||||||
Property,
|
Property,
|
||||||
__metadata$5("design:type", Boolean)
|
__metadata$5("design:type", Boolean)
|
||||||
], FlowLayout.prototype, "bounces", void 0);
|
], FlowLayout.prototype, "bounces", void 0);
|
||||||
__decorate$5([
|
|
||||||
Property,
|
|
||||||
__metadata$5("design:type", FlowLayoutItem)
|
|
||||||
], FlowLayout.prototype, "header", void 0);
|
|
||||||
__decorate$5([
|
|
||||||
Property,
|
|
||||||
__metadata$5("design:type", FlowLayoutItem)
|
|
||||||
], FlowLayout.prototype, "footer", void 0);
|
|
||||||
function flowlayout(config) {
|
function flowlayout(config) {
|
||||||
const ret = new FlowLayout;
|
const ret = new FlowLayout;
|
||||||
for (let key in config) {
|
for (let key in config) {
|
||||||
|
43
doric-js/index.d.ts
vendored
43
doric-js/index.d.ts
vendored
@ -703,6 +703,11 @@ declare module 'doric/lib/src/widget/list' {
|
|||||||
callback: () => void;
|
callback: () => void;
|
||||||
}[];
|
}[];
|
||||||
}
|
}
|
||||||
|
export enum OtherItems {
|
||||||
|
LoadMore = -10,
|
||||||
|
Header = -11,
|
||||||
|
Footer = -12
|
||||||
|
}
|
||||||
export class List extends Superview {
|
export class List extends Superview {
|
||||||
allSubviews(): ListItem[];
|
allSubviews(): ListItem[];
|
||||||
itemCount: number;
|
itemCount: number;
|
||||||
@ -725,11 +730,25 @@ declare module 'doric/lib/src/widget/list' {
|
|||||||
* Take effect only on iOS
|
* Take effect only on iOS
|
||||||
*/
|
*/
|
||||||
bounces?: boolean;
|
bounces?: boolean;
|
||||||
header?: ListItem;
|
|
||||||
footer?: ListItem;
|
|
||||||
scrollToItem(context: BridgeContext, index: number, config?: {
|
scrollToItem(context: BridgeContext, index: number, config?: {
|
||||||
animated?: boolean;
|
animated?: boolean;
|
||||||
}): Promise<any>;
|
}): Promise<any>;
|
||||||
|
/**
|
||||||
|
* @param context
|
||||||
|
* @returns Returns the range of the visible views.
|
||||||
|
*/
|
||||||
|
findVisibleItems(context: BridgeContext): Promise<{
|
||||||
|
first: number;
|
||||||
|
last: number;
|
||||||
|
}>;
|
||||||
|
/**
|
||||||
|
* @param context
|
||||||
|
* @returns Returns the range of the completely visible views.
|
||||||
|
*/
|
||||||
|
findCompletelyVisibleItems(context: BridgeContext): Promise<{
|
||||||
|
first: number;
|
||||||
|
last: number;
|
||||||
|
}>;
|
||||||
reset(): void;
|
reset(): void;
|
||||||
toModel(): NativeViewModel;
|
toModel(): NativeViewModel;
|
||||||
}
|
}
|
||||||
@ -830,6 +849,7 @@ declare module 'doric/lib/src/widget/refreshable' {
|
|||||||
declare module 'doric/lib/src/widget/flowlayout' {
|
declare module 'doric/lib/src/widget/flowlayout' {
|
||||||
import { Stack } from 'doric/lib/src/widget/layouts';
|
import { Stack } from 'doric/lib/src/widget/layouts';
|
||||||
import { Superview, View, NativeViewModel } from 'doric/lib/src/ui/view';
|
import { Superview, View, NativeViewModel } from 'doric/lib/src/ui/view';
|
||||||
|
import { BridgeContext } from "doric/lib/src/runtime/global";
|
||||||
export class FlowLayoutItem extends Stack {
|
export class FlowLayoutItem extends Stack {
|
||||||
/**
|
/**
|
||||||
* Set to reuse native view
|
* Set to reuse native view
|
||||||
@ -837,6 +857,7 @@ declare module 'doric/lib/src/widget/flowlayout' {
|
|||||||
identifier?: string;
|
identifier?: string;
|
||||||
/**
|
/**
|
||||||
* When set to true, the item will layout using all span area.
|
* When set to true, the item will layout using all span area.
|
||||||
|
* HeaderView, footerView or loadMoreView is always true by default.
|
||||||
*/
|
*/
|
||||||
fullSpan?: boolean;
|
fullSpan?: boolean;
|
||||||
}
|
}
|
||||||
@ -864,8 +885,22 @@ declare module 'doric/lib/src/widget/flowlayout' {
|
|||||||
* Take effect only on iOS
|
* Take effect only on iOS
|
||||||
*/
|
*/
|
||||||
bounces?: boolean;
|
bounces?: boolean;
|
||||||
header?: FlowLayoutItem;
|
/**
|
||||||
footer?: FlowLayoutItem;
|
* @param context
|
||||||
|
* @returns Returns the range of the visible views for each column.
|
||||||
|
*/
|
||||||
|
findVisibleItems(context: BridgeContext): Promise<{
|
||||||
|
first: number;
|
||||||
|
last: number;
|
||||||
|
}[]>;
|
||||||
|
/**
|
||||||
|
* @param context
|
||||||
|
* @returns Returns the range of the completely visible views for each column.
|
||||||
|
*/
|
||||||
|
findCompletelyVisibleItems(context: BridgeContext): Promise<{
|
||||||
|
first: number;
|
||||||
|
last: number;
|
||||||
|
}[]>;
|
||||||
reset(): void;
|
reset(): void;
|
||||||
toModel(): NativeViewModel;
|
toModel(): NativeViewModel;
|
||||||
}
|
}
|
||||||
|
20
doric-js/lib/src/widget/flowlayout.d.ts
vendored
20
doric-js/lib/src/widget/flowlayout.d.ts
vendored
@ -1,5 +1,6 @@
|
|||||||
import { Stack } from './layouts';
|
import { Stack } from './layouts';
|
||||||
import { Superview, View, NativeViewModel } from '../ui/view';
|
import { Superview, View, NativeViewModel } from '../ui/view';
|
||||||
|
import { BridgeContext } from "../runtime/global";
|
||||||
export declare class FlowLayoutItem extends Stack {
|
export declare class FlowLayoutItem extends Stack {
|
||||||
/**
|
/**
|
||||||
* Set to reuse native view
|
* Set to reuse native view
|
||||||
@ -7,6 +8,7 @@ export declare class FlowLayoutItem extends Stack {
|
|||||||
identifier?: string;
|
identifier?: string;
|
||||||
/**
|
/**
|
||||||
* When set to true, the item will layout using all span area.
|
* When set to true, the item will layout using all span area.
|
||||||
|
* HeaderView, footerView or loadMoreView is always true by default.
|
||||||
*/
|
*/
|
||||||
fullSpan?: boolean;
|
fullSpan?: boolean;
|
||||||
}
|
}
|
||||||
@ -35,8 +37,22 @@ export declare class FlowLayout extends Superview {
|
|||||||
* Take effect only on iOS
|
* Take effect only on iOS
|
||||||
*/
|
*/
|
||||||
bounces?: boolean;
|
bounces?: boolean;
|
||||||
header?: FlowLayoutItem;
|
/**
|
||||||
footer?: FlowLayoutItem;
|
* @param context
|
||||||
|
* @returns Returns the range of the visible views for each column.
|
||||||
|
*/
|
||||||
|
findVisibleItems(context: BridgeContext): Promise<{
|
||||||
|
first: number;
|
||||||
|
last: number;
|
||||||
|
}[]>;
|
||||||
|
/**
|
||||||
|
* @param context
|
||||||
|
* @returns Returns the range of the completely visible views for each column.
|
||||||
|
*/
|
||||||
|
findCompletelyVisibleItems(context: BridgeContext): Promise<{
|
||||||
|
first: number;
|
||||||
|
last: number;
|
||||||
|
}[]>;
|
||||||
reset(): void;
|
reset(): void;
|
||||||
private getItem;
|
private getItem;
|
||||||
private renderBunchedItems;
|
private renderBunchedItems;
|
||||||
|
@ -48,14 +48,22 @@ export class FlowLayout extends Superview {
|
|||||||
if (this.loadMoreView) {
|
if (this.loadMoreView) {
|
||||||
ret.push(this.loadMoreView);
|
ret.push(this.loadMoreView);
|
||||||
}
|
}
|
||||||
if (this.header) {
|
|
||||||
ret.push(this.header);
|
|
||||||
}
|
|
||||||
if (this.footer) {
|
|
||||||
ret.push(this.footer);
|
|
||||||
}
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* @param context
|
||||||
|
* @returns Returns the range of the visible views for each column.
|
||||||
|
*/
|
||||||
|
findVisibleItems(context) {
|
||||||
|
return this.nativeChannel(context, 'findVisibleItems')();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @param context
|
||||||
|
* @returns Returns the range of the completely visible views for each column.
|
||||||
|
*/
|
||||||
|
findCompletelyVisibleItems(context) {
|
||||||
|
return this.nativeChannel(context, 'findCompletelyVisibleItems')();
|
||||||
|
}
|
||||||
reset() {
|
reset() {
|
||||||
this.cachedViews.clear();
|
this.cachedViews.clear();
|
||||||
this.itemCount = 0;
|
this.itemCount = 0;
|
||||||
@ -76,12 +84,6 @@ export class FlowLayout extends Superview {
|
|||||||
if (this.loadMoreView) {
|
if (this.loadMoreView) {
|
||||||
this.dirtyProps['loadMoreView'] = this.loadMoreView.viewId;
|
this.dirtyProps['loadMoreView'] = this.loadMoreView.viewId;
|
||||||
}
|
}
|
||||||
if (this.header) {
|
|
||||||
this.dirtyProps['header'] = this.header.viewId;
|
|
||||||
}
|
|
||||||
if (this.footer) {
|
|
||||||
this.dirtyProps['footer'] = this.footer.viewId;
|
|
||||||
}
|
|
||||||
return super.toModel();
|
return super.toModel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -137,14 +139,6 @@ __decorate([
|
|||||||
Property,
|
Property,
|
||||||
__metadata("design:type", Boolean)
|
__metadata("design:type", Boolean)
|
||||||
], FlowLayout.prototype, "bounces", void 0);
|
], FlowLayout.prototype, "bounces", void 0);
|
||||||
__decorate([
|
|
||||||
Property,
|
|
||||||
__metadata("design:type", FlowLayoutItem)
|
|
||||||
], FlowLayout.prototype, "header", void 0);
|
|
||||||
__decorate([
|
|
||||||
Property,
|
|
||||||
__metadata("design:type", FlowLayoutItem)
|
|
||||||
], FlowLayout.prototype, "footer", void 0);
|
|
||||||
export function flowlayout(config) {
|
export function flowlayout(config) {
|
||||||
const ret = new FlowLayout;
|
const ret = new FlowLayout;
|
||||||
for (let key in config) {
|
for (let key in config) {
|
||||||
|
23
doric-js/lib/src/widget/list.d.ts
vendored
23
doric-js/lib/src/widget/list.d.ts
vendored
@ -13,6 +13,11 @@ export declare class ListItem extends Stack {
|
|||||||
callback: () => void;
|
callback: () => void;
|
||||||
}[];
|
}[];
|
||||||
}
|
}
|
||||||
|
export declare enum OtherItems {
|
||||||
|
LoadMore = -10,
|
||||||
|
Header = -11,
|
||||||
|
Footer = -12
|
||||||
|
}
|
||||||
export declare class List extends Superview {
|
export declare class List extends Superview {
|
||||||
private cachedViews;
|
private cachedViews;
|
||||||
allSubviews(): ListItem[];
|
allSubviews(): ListItem[];
|
||||||
@ -36,11 +41,25 @@ export declare class List extends Superview {
|
|||||||
* Take effect only on iOS
|
* Take effect only on iOS
|
||||||
*/
|
*/
|
||||||
bounces?: boolean;
|
bounces?: boolean;
|
||||||
header?: ListItem;
|
|
||||||
footer?: ListItem;
|
|
||||||
scrollToItem(context: BridgeContext, index: number, config?: {
|
scrollToItem(context: BridgeContext, index: number, config?: {
|
||||||
animated?: boolean;
|
animated?: boolean;
|
||||||
}): Promise<any>;
|
}): Promise<any>;
|
||||||
|
/**
|
||||||
|
* @param context
|
||||||
|
* @returns Returns the range of the visible views.
|
||||||
|
*/
|
||||||
|
findVisibleItems(context: BridgeContext): Promise<{
|
||||||
|
first: number;
|
||||||
|
last: number;
|
||||||
|
}>;
|
||||||
|
/**
|
||||||
|
* @param context
|
||||||
|
* @returns Returns the range of the completely visible views.
|
||||||
|
*/
|
||||||
|
findCompletelyVisibleItems(context: BridgeContext): Promise<{
|
||||||
|
first: number;
|
||||||
|
last: number;
|
||||||
|
}>;
|
||||||
reset(): void;
|
reset(): void;
|
||||||
private getItem;
|
private getItem;
|
||||||
private renderBunchedItems;
|
private renderBunchedItems;
|
||||||
|
@ -35,6 +35,12 @@ __decorate([
|
|||||||
Property,
|
Property,
|
||||||
__metadata("design:type", Array)
|
__metadata("design:type", Array)
|
||||||
], ListItem.prototype, "actions", void 0);
|
], ListItem.prototype, "actions", void 0);
|
||||||
|
export var OtherItems;
|
||||||
|
(function (OtherItems) {
|
||||||
|
OtherItems[OtherItems["LoadMore"] = -10] = "LoadMore";
|
||||||
|
OtherItems[OtherItems["Header"] = -11] = "Header";
|
||||||
|
OtherItems[OtherItems["Footer"] = -12] = "Footer";
|
||||||
|
})(OtherItems || (OtherItems = {}));
|
||||||
export class List extends Superview {
|
export class List extends Superview {
|
||||||
constructor() {
|
constructor() {
|
||||||
super(...arguments);
|
super(...arguments);
|
||||||
@ -47,18 +53,26 @@ export class List extends Superview {
|
|||||||
if (this.loadMoreView) {
|
if (this.loadMoreView) {
|
||||||
ret.push(this.loadMoreView);
|
ret.push(this.loadMoreView);
|
||||||
}
|
}
|
||||||
if (this.header) {
|
|
||||||
ret.push(this.header);
|
|
||||||
}
|
|
||||||
if (this.footer) {
|
|
||||||
ret.push(this.footer);
|
|
||||||
}
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
scrollToItem(context, index, config) {
|
scrollToItem(context, index, config) {
|
||||||
const animated = config === null || config === void 0 ? void 0 : config.animated;
|
const animated = config === null || config === void 0 ? void 0 : config.animated;
|
||||||
return this.nativeChannel(context, 'scrollToItem')({ index, animated, });
|
return this.nativeChannel(context, 'scrollToItem')({ index, animated, });
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* @param context
|
||||||
|
* @returns Returns the range of the visible views.
|
||||||
|
*/
|
||||||
|
findVisibleItems(context) {
|
||||||
|
return this.nativeChannel(context, 'findVisibleItems')();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @param context
|
||||||
|
* @returns Returns the range of the completely visible views.
|
||||||
|
*/
|
||||||
|
findCompletelyVisibleItems(context) {
|
||||||
|
return this.nativeChannel(context, 'findCompletelyVisibleItems')();
|
||||||
|
}
|
||||||
reset() {
|
reset() {
|
||||||
this.cachedViews.clear();
|
this.cachedViews.clear();
|
||||||
this.itemCount = 0;
|
this.itemCount = 0;
|
||||||
@ -79,12 +93,6 @@ export class List extends Superview {
|
|||||||
if (this.loadMoreView) {
|
if (this.loadMoreView) {
|
||||||
this.dirtyProps['loadMoreView'] = this.loadMoreView.viewId;
|
this.dirtyProps['loadMoreView'] = this.loadMoreView.viewId;
|
||||||
}
|
}
|
||||||
if (this.header) {
|
|
||||||
this.dirtyProps['header'] = this.header.viewId;
|
|
||||||
}
|
|
||||||
if (this.footer) {
|
|
||||||
this.dirtyProps['footer'] = this.footer.viewId;
|
|
||||||
}
|
|
||||||
return super.toModel();
|
return super.toModel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -132,14 +140,6 @@ __decorate([
|
|||||||
Property,
|
Property,
|
||||||
__metadata("design:type", Boolean)
|
__metadata("design:type", Boolean)
|
||||||
], List.prototype, "bounces", void 0);
|
], List.prototype, "bounces", void 0);
|
||||||
__decorate([
|
|
||||||
Property,
|
|
||||||
__metadata("design:type", ListItem)
|
|
||||||
], List.prototype, "header", void 0);
|
|
||||||
__decorate([
|
|
||||||
Property,
|
|
||||||
__metadata("design:type", ListItem)
|
|
||||||
], List.prototype, "footer", void 0);
|
|
||||||
export function list(config) {
|
export function list(config) {
|
||||||
const ret = new List;
|
const ret = new List;
|
||||||
ret.apply(config);
|
ret.apply(config);
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
import { Stack } from './layouts'
|
import { Stack } from './layouts'
|
||||||
import { Property, Superview, View, NativeViewModel } from '../ui/view'
|
import { Property, Superview, View, NativeViewModel } from '../ui/view'
|
||||||
import { layoutConfig } from '../util/index.util'
|
import { layoutConfig } from '../util/index.util'
|
||||||
import { BridgeContext } from '../..'
|
import { BridgeContext } from "../runtime/global";
|
||||||
|
|
||||||
export class FlowLayoutItem extends Stack {
|
export class FlowLayoutItem extends Stack {
|
||||||
/**
|
/**
|
||||||
@ -26,7 +26,7 @@ export class FlowLayoutItem extends Stack {
|
|||||||
identifier?: string
|
identifier?: string
|
||||||
/**
|
/**
|
||||||
* When set to true, the item will layout using all span area.
|
* When set to true, the item will layout using all span area.
|
||||||
* HeaderView, footerView or loadMoreView is always true by default.
|
* LoadMoreView is default to true.
|
||||||
*/
|
*/
|
||||||
@Property
|
@Property
|
||||||
fullSpan?: boolean
|
fullSpan?: boolean
|
||||||
@ -40,12 +40,6 @@ export class FlowLayout extends Superview {
|
|||||||
if (this.loadMoreView) {
|
if (this.loadMoreView) {
|
||||||
ret.push(this.loadMoreView)
|
ret.push(this.loadMoreView)
|
||||||
}
|
}
|
||||||
if (this.header) {
|
|
||||||
ret.push(this.header)
|
|
||||||
}
|
|
||||||
if (this.footer) {
|
|
||||||
ret.push(this.footer)
|
|
||||||
}
|
|
||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -90,11 +84,6 @@ export class FlowLayout extends Superview {
|
|||||||
@Property
|
@Property
|
||||||
bounces?: boolean
|
bounces?: boolean
|
||||||
|
|
||||||
@Property
|
|
||||||
header?: FlowLayoutItem
|
|
||||||
|
|
||||||
@Property
|
|
||||||
footer?: FlowLayoutItem
|
|
||||||
/**
|
/**
|
||||||
* @param context
|
* @param context
|
||||||
* @returns Returns the range of the visible views for each column.
|
* @returns Returns the range of the visible views for each column.
|
||||||
@ -132,12 +121,6 @@ export class FlowLayout extends Superview {
|
|||||||
if (this.loadMoreView) {
|
if (this.loadMoreView) {
|
||||||
this.dirtyProps['loadMoreView'] = this.loadMoreView.viewId
|
this.dirtyProps['loadMoreView'] = this.loadMoreView.viewId
|
||||||
}
|
}
|
||||||
if (this.header) {
|
|
||||||
this.dirtyProps['header'] = this.header.viewId
|
|
||||||
}
|
|
||||||
if (this.footer) {
|
|
||||||
this.dirtyProps['footer'] = this.footer.viewId
|
|
||||||
}
|
|
||||||
return super.toModel()
|
return super.toModel()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -49,12 +49,6 @@ export class List extends Superview {
|
|||||||
if (this.loadMoreView) {
|
if (this.loadMoreView) {
|
||||||
ret.push(this.loadMoreView)
|
ret.push(this.loadMoreView)
|
||||||
}
|
}
|
||||||
if (this.header) {
|
|
||||||
ret.push(this.header)
|
|
||||||
}
|
|
||||||
if (this.footer) {
|
|
||||||
ret.push(this.footer)
|
|
||||||
}
|
|
||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,12 +87,6 @@ export class List extends Superview {
|
|||||||
@Property
|
@Property
|
||||||
bounces?: boolean
|
bounces?: boolean
|
||||||
|
|
||||||
@Property
|
|
||||||
header?: ListItem
|
|
||||||
|
|
||||||
@Property
|
|
||||||
footer?: ListItem
|
|
||||||
|
|
||||||
scrollToItem(context: BridgeContext, index: number, config?: { animated?: boolean, }) {
|
scrollToItem(context: BridgeContext, index: number, config?: { animated?: boolean, }) {
|
||||||
const animated = config?.animated
|
const animated = config?.animated
|
||||||
return this.nativeChannel(context, 'scrollToItem')({ index, animated, }) as Promise<any>
|
return this.nativeChannel(context, 'scrollToItem')({ index, animated, }) as Promise<any>
|
||||||
@ -140,12 +128,6 @@ export class List extends Superview {
|
|||||||
if (this.loadMoreView) {
|
if (this.loadMoreView) {
|
||||||
this.dirtyProps['loadMoreView'] = this.loadMoreView.viewId
|
this.dirtyProps['loadMoreView'] = this.loadMoreView.viewId
|
||||||
}
|
}
|
||||||
if (this.header) {
|
|
||||||
this.dirtyProps['header'] = this.header.viewId
|
|
||||||
}
|
|
||||||
if (this.footer) {
|
|
||||||
this.dirtyProps['footer'] = this.footer.viewId
|
|
||||||
}
|
|
||||||
return super.toModel()
|
return super.toModel()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
74
doric-web/dist/index.js
vendored
74
doric-web/dist/index.js
vendored
@ -3314,6 +3314,12 @@ __decorate$9([
|
|||||||
Property,
|
Property,
|
||||||
__metadata$9("design:type", Array)
|
__metadata$9("design:type", Array)
|
||||||
], ListItem.prototype, "actions", void 0);
|
], ListItem.prototype, "actions", void 0);
|
||||||
|
exports.OtherItems = void 0;
|
||||||
|
(function (OtherItems) {
|
||||||
|
OtherItems[OtherItems["LoadMore"] = -10] = "LoadMore";
|
||||||
|
OtherItems[OtherItems["Header"] = -11] = "Header";
|
||||||
|
OtherItems[OtherItems["Footer"] = -12] = "Footer";
|
||||||
|
})(exports.OtherItems || (exports.OtherItems = {}));
|
||||||
class List extends Superview {
|
class List extends Superview {
|
||||||
constructor() {
|
constructor() {
|
||||||
super(...arguments);
|
super(...arguments);
|
||||||
@ -3326,18 +3332,26 @@ class List extends Superview {
|
|||||||
if (this.loadMoreView) {
|
if (this.loadMoreView) {
|
||||||
ret.push(this.loadMoreView);
|
ret.push(this.loadMoreView);
|
||||||
}
|
}
|
||||||
if (this.header) {
|
|
||||||
ret.push(this.header);
|
|
||||||
}
|
|
||||||
if (this.footer) {
|
|
||||||
ret.push(this.footer);
|
|
||||||
}
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
scrollToItem(context, index, config) {
|
scrollToItem(context, index, config) {
|
||||||
const animated = config === null || config === void 0 ? void 0 : config.animated;
|
const animated = config === null || config === void 0 ? void 0 : config.animated;
|
||||||
return this.nativeChannel(context, 'scrollToItem')({ index, animated, });
|
return this.nativeChannel(context, 'scrollToItem')({ index, animated, });
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* @param context
|
||||||
|
* @returns Returns the range of the visible views.
|
||||||
|
*/
|
||||||
|
findVisibleItems(context) {
|
||||||
|
return this.nativeChannel(context, 'findVisibleItems')();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @param context
|
||||||
|
* @returns Returns the range of the completely visible views.
|
||||||
|
*/
|
||||||
|
findCompletelyVisibleItems(context) {
|
||||||
|
return this.nativeChannel(context, 'findCompletelyVisibleItems')();
|
||||||
|
}
|
||||||
reset() {
|
reset() {
|
||||||
this.cachedViews.clear();
|
this.cachedViews.clear();
|
||||||
this.itemCount = 0;
|
this.itemCount = 0;
|
||||||
@ -3358,12 +3372,6 @@ class List extends Superview {
|
|||||||
if (this.loadMoreView) {
|
if (this.loadMoreView) {
|
||||||
this.dirtyProps['loadMoreView'] = this.loadMoreView.viewId;
|
this.dirtyProps['loadMoreView'] = this.loadMoreView.viewId;
|
||||||
}
|
}
|
||||||
if (this.header) {
|
|
||||||
this.dirtyProps['header'] = this.header.viewId;
|
|
||||||
}
|
|
||||||
if (this.footer) {
|
|
||||||
this.dirtyProps['footer'] = this.footer.viewId;
|
|
||||||
}
|
|
||||||
return super.toModel();
|
return super.toModel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3411,14 +3419,6 @@ __decorate$9([
|
|||||||
Property,
|
Property,
|
||||||
__metadata$9("design:type", Boolean)
|
__metadata$9("design:type", Boolean)
|
||||||
], List.prototype, "bounces", void 0);
|
], List.prototype, "bounces", void 0);
|
||||||
__decorate$9([
|
|
||||||
Property,
|
|
||||||
__metadata$9("design:type", ListItem)
|
|
||||||
], List.prototype, "header", void 0);
|
|
||||||
__decorate$9([
|
|
||||||
Property,
|
|
||||||
__metadata$9("design:type", ListItem)
|
|
||||||
], List.prototype, "footer", void 0);
|
|
||||||
function list(config) {
|
function list(config) {
|
||||||
const ret = new List;
|
const ret = new List;
|
||||||
ret.apply(config);
|
ret.apply(config);
|
||||||
@ -3803,14 +3803,22 @@ class FlowLayout extends Superview {
|
|||||||
if (this.loadMoreView) {
|
if (this.loadMoreView) {
|
||||||
ret.push(this.loadMoreView);
|
ret.push(this.loadMoreView);
|
||||||
}
|
}
|
||||||
if (this.header) {
|
|
||||||
ret.push(this.header);
|
|
||||||
}
|
|
||||||
if (this.footer) {
|
|
||||||
ret.push(this.footer);
|
|
||||||
}
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* @param context
|
||||||
|
* @returns Returns the range of the visible views for each column.
|
||||||
|
*/
|
||||||
|
findVisibleItems(context) {
|
||||||
|
return this.nativeChannel(context, 'findVisibleItems')();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @param context
|
||||||
|
* @returns Returns the range of the completely visible views for each column.
|
||||||
|
*/
|
||||||
|
findCompletelyVisibleItems(context) {
|
||||||
|
return this.nativeChannel(context, 'findCompletelyVisibleItems')();
|
||||||
|
}
|
||||||
reset() {
|
reset() {
|
||||||
this.cachedViews.clear();
|
this.cachedViews.clear();
|
||||||
this.itemCount = 0;
|
this.itemCount = 0;
|
||||||
@ -3831,12 +3839,6 @@ class FlowLayout extends Superview {
|
|||||||
if (this.loadMoreView) {
|
if (this.loadMoreView) {
|
||||||
this.dirtyProps['loadMoreView'] = this.loadMoreView.viewId;
|
this.dirtyProps['loadMoreView'] = this.loadMoreView.viewId;
|
||||||
}
|
}
|
||||||
if (this.header) {
|
|
||||||
this.dirtyProps['header'] = this.header.viewId;
|
|
||||||
}
|
|
||||||
if (this.footer) {
|
|
||||||
this.dirtyProps['footer'] = this.footer.viewId;
|
|
||||||
}
|
|
||||||
return super.toModel();
|
return super.toModel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3892,14 +3894,6 @@ __decorate$5([
|
|||||||
Property,
|
Property,
|
||||||
__metadata$5("design:type", Boolean)
|
__metadata$5("design:type", Boolean)
|
||||||
], FlowLayout.prototype, "bounces", void 0);
|
], FlowLayout.prototype, "bounces", void 0);
|
||||||
__decorate$5([
|
|
||||||
Property,
|
|
||||||
__metadata$5("design:type", FlowLayoutItem)
|
|
||||||
], FlowLayout.prototype, "header", void 0);
|
|
||||||
__decorate$5([
|
|
||||||
Property,
|
|
||||||
__metadata$5("design:type", FlowLayoutItem)
|
|
||||||
], FlowLayout.prototype, "footer", void 0);
|
|
||||||
function flowlayout(config) {
|
function flowlayout(config) {
|
||||||
const ret = new FlowLayout;
|
const ret = new FlowLayout;
|
||||||
for (let key in config) {
|
for (let key in config) {
|
||||||
|
2
doric-web/dist/index.js.map
vendored
2
doric-web/dist/index.js.map
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user