@nativescript-community/ui-collectionview 5.2.0 → 5.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/index-common.d.ts +3 -5
- package/index-common.js +101 -24
- package/index-common.js.map +1 -1
- package/index.android.d.ts +11 -5
- package/index.android.js +198 -96
- package/index.android.js.map +1 -1
- package/index.ios.d.ts +1 -1
- package/package.json +2 -2
- package/platforms/android/AndroidManifest.xml +1 -1
- package/platforms/android/include.gradle +4 -3
- package/platforms/android/java/com/nativescript/collectionview/GridLayoutManager.java +9 -0
- package/platforms/android/java/com/nativescript/collectionview/OverlapDecoration.java +22 -0
- package/platforms/android/java/com/nativescript/collectionview/RecyclerView.java +21 -1
- package/platforms/android/java/com/nativescript/collectionview/SizeChangedListener.java +2 -1
- package/react/index.d.ts +5 -5
- package/svelte/index.d.ts +0 -1
- package/typings/android.d.ts +16 -2
- package/typings/android.wasabeef.d.ts +843 -0
- package/vue3/component.d.ts +1 -1
- package/vue3/component.js +16 -9
- package/vue3/component.js.map +1 -1
- package/angular/collectionview-comp.d.ts +0 -82
- package/angular/index.d.ts +0 -8
package/vue3/component.d.ts
CHANGED
package/vue3/component.js
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
import { CollectionView as NSCollectionView } from '..';
|
2
2
|
import { Observable, ObservableArray } from '@nativescript/core';
|
3
|
-
import { computed, defineComponent, getCurrentInstance, h, ref, toRaw, warn, watch } from 'nativescript-vue';
|
3
|
+
import { ELEMENT_REF, NSVElement, NSVRoot, computed, defineComponent, getCurrentInstance, h, ref, render, toRaw, warn, watch } from 'nativescript-vue';
|
4
4
|
const LIST_CELL_ID = Symbol('list_cell_id');
|
5
|
+
const LIST_CELL_CONTAINER = Symbol('list_cell_container');
|
5
6
|
function getItemCtx(item, index, itemAlias, indexAlias) {
|
6
7
|
return {
|
7
8
|
[itemAlias]: item,
|
@@ -51,24 +52,30 @@ export const CollectionView = defineComponent({
|
|
51
52
|
const itemCtx = getItemCtx(event.bindingContext, index, props.alias, props.itemIdGenerator);
|
52
53
|
// const itemCtx: ListItem = getItemCtx(props.items instanceof ObservableArray ? props.items.getItem(index) : props.items[index], index, props.alias, props.itemIdGenerator);
|
53
54
|
// update the cell data with the current row
|
55
|
+
const slotName = getSlotName(itemCtx, index, event.object.items);
|
54
56
|
cells.value[id] = {
|
55
57
|
itemCtx,
|
56
|
-
slotName
|
58
|
+
slotName
|
57
59
|
};
|
58
60
|
// trigger an update!
|
59
|
-
vm?.update();
|
61
|
+
// vm?.update();
|
60
62
|
// find the vnode rendering this cell
|
61
|
-
const
|
62
|
-
const
|
63
|
-
cellEl[LIST_CELL_ID] = id;
|
63
|
+
const container = event.view?.[LIST_CELL_CONTAINER] ?? new NSVRoot();
|
64
|
+
const vnode = ctx.slots[slotName]?.(itemCtx)[0];
|
64
65
|
if (event.view) {
|
65
66
|
event.view._batchUpdate(() => {
|
66
|
-
|
67
|
+
// todo: handle the case where the slot is not found
|
68
|
+
render(vnode, container);
|
67
69
|
});
|
68
70
|
}
|
69
71
|
else {
|
70
|
-
|
72
|
+
// todo: handle the case where the slot is not found
|
73
|
+
render(vnode, container);
|
71
74
|
}
|
75
|
+
const cellEl = toRaw(vnode?.el?.nativeView);
|
76
|
+
cellEl[LIST_CELL_ID] = id;
|
77
|
+
cellEl[LIST_CELL_CONTAINER] = container;
|
78
|
+
event.view = cellEl;
|
72
79
|
}
|
73
80
|
// render all realized templates as children
|
74
81
|
const cellVNODES = () => Object.entries(cells.value).map(([id, entry]) => {
|
@@ -91,7 +98,7 @@ export const CollectionView = defineComponent({
|
|
91
98
|
items: props.items,
|
92
99
|
itemTemplates,
|
93
100
|
onItemLoading
|
94
|
-
}
|
101
|
+
});
|
95
102
|
}
|
96
103
|
});
|
97
104
|
//# sourceMappingURL=component.js.map
|
package/vue3/component.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"component.js","sourceRoot":"../src/","sources":["vue3/component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,IAAI,gBAAgB,EAAE,MAAM,IAAI,CAAC;AACxD,OAAO,EAAiB,UAAU,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAChF,OAAO,EAAmB,QAAQ,EAAE,eAAe,EAAE,kBAAkB,EAAE,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;
|
1
|
+
{"version":3,"file":"component.js","sourceRoot":"../src/","sources":["vue3/component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,IAAI,gBAAgB,EAAE,MAAM,IAAI,CAAC;AACxD,OAAO,EAAiB,UAAU,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAChF,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,OAAO,EAAmB,QAAQ,EAAE,eAAe,EAAE,kBAAkB,EAAE,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAcxK,MAAM,YAAY,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC;AAC5C,MAAM,mBAAmB,GAAG,MAAM,CAAC,qBAAqB,CAAC,CAAC;AAE1D,SAAS,UAAU,CAAC,IAAS,EAAE,KAAa,EAAE,SAAiB,EAAE,UAAkB;IAC/E,OAAO;QACH,CAAC,SAAS,CAAC,EAAE,IAAI;QACjB,CAAC,UAAU,CAAC,EAAE,KAAK;QACnB,KAAK;QACL,IAAI,EAAE,KAAK,GAAG,CAAC,KAAK,CAAC;QACrB,GAAG,EAAE,KAAK,GAAG,CAAC,KAAK,CAAC;KACvB,CAAC;AACN,CAAC;AAED,MAAM,CAAC,MAAM,cAAc,GAAG,eAAe,CAAC;IAC1C,KAAK,EAAE;QACH,KAAK,EAAE;YACH,IAAI,EAAE,MAAgD;YACtD,QAAQ,EAAE,IAAI;SACjB;QACD,KAAK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AAE,EAAE,KAAK,CAAC,EAAE,EAAE;YAC5C,MAAM,MAAM,GAAY,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI;gBAClE,mCAAmC;gBACnC,CAAC,CAAC,OAAO,EAAE;oBACP,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC;iBACnC,CAAC;aACL,CAAC;YAEF,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE;gBACnB,IAAI,CAAC,gEAAgE,MAAM,CAAC,MAAM,oCAAoC,CAAC,CAAC;aAC3H;YAED,MAAM,KAAK,GAAU,MAAM,CAAC,CAAC,CAAC,CAAC;YAC/B,qEAAqE;YACrE,KAAK,CAAC,GAAG,GAAG,EAAE,CAAC;YAEf,OAAO,KAAK,CAAC;QACjB,CAAC,CAAC,CAAC;QAEP,OAAO,GAAG,EAAE,CACR,CAAC,CACG,sBAAsB,EACtB;YACI,GAAG,EAAE,cAAc;YACnB,KAAK,EAAE,KAAK,CAAC,KAAK;YAClB,aAAa;YACb,aAAa;SAChB,CAAC,CAAC;IACf,CAAC;CACJ,CAAC,CAAC"}
|
@@ -1,82 +0,0 @@
|
|
1
|
-
import { AfterContentInit, ComponentRef, DoCheck, ElementRef, EmbeddedViewRef, EventEmitter, IterableDiffers, NgZone, OnDestroy, TemplateRef, ViewContainerRef } from '@angular/core';
|
2
|
-
import { CollectionViewItemEventData } from '@nativescript-community/ui-collectionview';
|
3
|
-
import { DetachedLoader, NativeScriptRendererFactory } from '@nativescript/angular';
|
4
|
-
import { View } from '@nativescript/core';
|
5
|
-
import * as i0 from "@angular/core";
|
6
|
-
export declare class ItemContext {
|
7
|
-
$implicit?: any;
|
8
|
-
item?: any;
|
9
|
-
index?: number;
|
10
|
-
even?: boolean;
|
11
|
-
odd?: boolean;
|
12
|
-
constructor($implicit?: any, item?: any, index?: number, even?: boolean, odd?: boolean);
|
13
|
-
}
|
14
|
-
export interface SetupItemViewArgs {
|
15
|
-
view: EmbeddedViewRef<any>;
|
16
|
-
data: any;
|
17
|
-
index: number;
|
18
|
-
context: ItemContext;
|
19
|
-
}
|
20
|
-
export declare class CollectionViewComponent implements DoCheck, OnDestroy, AfterContentInit {
|
21
|
-
private _elementRef;
|
22
|
-
private _iterableDiffers;
|
23
|
-
private _renderer;
|
24
|
-
private _ngZone;
|
25
|
-
get nativeElement(): any;
|
26
|
-
get listView(): any;
|
27
|
-
loader: ViewContainerRef;
|
28
|
-
setupItemView: EventEmitter<SetupItemViewArgs>;
|
29
|
-
itemTemplateQuery: TemplateRef<ItemContext>;
|
30
|
-
autoReuseViews: boolean;
|
31
|
-
detachedLoaderFactory(): ComponentRef<DetachedLoader>;
|
32
|
-
get itemTemplate(): any;
|
33
|
-
set itemTemplate(value: any);
|
34
|
-
get items(): any;
|
35
|
-
set items(value: any);
|
36
|
-
private _collectionView;
|
37
|
-
private _items;
|
38
|
-
private _differ;
|
39
|
-
private _itemTemplate;
|
40
|
-
private _templateMap;
|
41
|
-
private _loaders;
|
42
|
-
constructor(_elementRef: ElementRef, _iterableDiffers: IterableDiffers, _renderer: NativeScriptRendererFactory, _ngZone: NgZone);
|
43
|
-
private itemViewLoader;
|
44
|
-
ngAfterContentInit(): void;
|
45
|
-
ngOnDestroy(): void;
|
46
|
-
ngDoCheck(): void;
|
47
|
-
registerTemplate(key: string, template: TemplateRef<ItemContext>): void;
|
48
|
-
onItemLoading(args: CollectionViewItemEventData): void;
|
49
|
-
onItemRecyclingInternal(args: any): void;
|
50
|
-
onItemDisposingInternal(args: any): void;
|
51
|
-
setupViewRef(view: EmbeddedViewRef<ItemContext>, data: any, index: number): void;
|
52
|
-
protected getItemTemplateViewFactory(template: TemplateRef<ItemContext>): () => View;
|
53
|
-
viewPool: Map<TemplateRef<ItemContext>, {
|
54
|
-
scrapSize: number;
|
55
|
-
scrapHead: Set<EmbeddedViewRef<ItemContext>>;
|
56
|
-
}>;
|
57
|
-
private storeViewRef;
|
58
|
-
viewToTemplate: WeakMap<EmbeddedViewRef<any>, TemplateRef<any>>;
|
59
|
-
viewToLoader: WeakMap<EmbeddedViewRef<any>, ComponentRef<DetachedLoader>>;
|
60
|
-
private getOrCreate;
|
61
|
-
private getView;
|
62
|
-
private getViewPool;
|
63
|
-
private setItemTemplates;
|
64
|
-
private detectChangesOnChild;
|
65
|
-
private refresh;
|
66
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<CollectionViewComponent, never>;
|
67
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<CollectionViewComponent, "CollectionView", never, { "autoReuseViews": "autoReuseViews"; "itemTemplate": "itemTemplate"; "items": "items"; }, { "setupItemView": "setupItemView"; }, ["itemTemplateQuery"], never, false, never>;
|
68
|
-
}
|
69
|
-
export interface ComponentView {
|
70
|
-
rootNodes: any[];
|
71
|
-
destroy(): void;
|
72
|
-
}
|
73
|
-
export declare type RootLocator = (nodes: any[], nestLevel: number) => View;
|
74
|
-
export declare function getItemViewRoot(viewRef: ComponentView, rootLocator?: RootLocator): View;
|
75
|
-
export declare class TemplateKeyDirective {
|
76
|
-
private templateRef;
|
77
|
-
private collectionView;
|
78
|
-
constructor(templateRef: TemplateRef<any>, collectionView: CollectionViewComponent);
|
79
|
-
set cvTemplateKey(value: any);
|
80
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<TemplateKeyDirective, [null, { host: true; }]>;
|
81
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<TemplateKeyDirective, "[cvTemplateKey]", never, { "cvTemplateKey": "cvTemplateKey"; }, {}, never, never, false, never>;
|
82
|
-
}
|
package/angular/index.d.ts
DELETED
@@ -1,8 +0,0 @@
|
|
1
|
-
import * as i0 from "@angular/core";
|
2
|
-
import * as i1 from "./collectionview-comp";
|
3
|
-
export { CollectionViewComponent, TemplateKeyDirective } from './collectionview-comp';
|
4
|
-
export declare class CollectionViewModule {
|
5
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<CollectionViewModule, never>;
|
6
|
-
static ɵmod: i0.ɵɵNgModuleDeclaration<CollectionViewModule, [typeof i1.CollectionViewComponent, typeof i1.TemplateKeyDirective], never, [typeof i1.CollectionViewComponent, typeof i1.TemplateKeyDirective]>;
|
7
|
-
static ɵinj: i0.ɵɵInjectorDeclaration<CollectionViewModule>;
|
8
|
-
}
|