@nativescript-community/ui-collectionview 5.3.40 → 5.3.41
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 +4 -0
- package/package.json +2 -2
- package/vue3/component.js +10 -18
- package/vue3/component.js.map +1 -1
package/CHANGELOG.md
CHANGED
@@ -3,6 +3,10 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
5
5
|
|
6
|
+
## [5.3.41](https://github.com/nativescript-community/ui-collectionview/compare/v5.3.40...v5.3.41) (2024-09-30)
|
7
|
+
|
8
|
+
**Note:** Version bump only for package @nativescript-community/ui-collectionview
|
9
|
+
|
6
10
|
## [5.3.40](https://github.com/nativescript-community/ui-collectionview/compare/v5.3.39...v5.3.40) (2024-08-22)
|
7
11
|
|
8
12
|
**Note:** Version bump only for package @nativescript-community/ui-collectionview
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@nativescript-community/ui-collectionview",
|
3
|
-
"version": "5.3.
|
3
|
+
"version": "5.3.41",
|
4
4
|
"description": "Allows you to easily add a collection view (grid list view) to your projects. Supports vertical and horizontal modes, templating, and more.",
|
5
5
|
"main": "./index",
|
6
6
|
"sideEffects": false,
|
@@ -57,5 +57,5 @@
|
|
57
57
|
},
|
58
58
|
"license": "Apache-2.0",
|
59
59
|
"readmeFilename": "README.md",
|
60
|
-
"gitHead": "
|
60
|
+
"gitHead": "1ecdb994c94f818d9381338441d76b31e5a439b7"
|
61
61
|
}
|
package/vue3/component.js
CHANGED
@@ -11,6 +11,14 @@ function getItemCtx(item, index, itemAlias, indexAlias) {
|
|
11
11
|
odd: index % 2 !== 0
|
12
12
|
};
|
13
13
|
}
|
14
|
+
function propagateAppContext(vnode, appContext) {
|
15
|
+
if (!vnode || !appContext)
|
16
|
+
return;
|
17
|
+
vnode.appContext = appContext;
|
18
|
+
if (Array.isArray(vnode.children)) {
|
19
|
+
vnode.children.forEach((child) => propagateAppContext(child, appContext));
|
20
|
+
}
|
21
|
+
}
|
14
22
|
export const CollectionView = defineComponent({
|
15
23
|
props: {
|
16
24
|
items: {
|
@@ -48,7 +56,7 @@ export const CollectionView = defineComponent({
|
|
48
56
|
function onItemLoading(event) {
|
49
57
|
const index = event.index;
|
50
58
|
const id = event.view?.[LIST_CELL_ID] ?? `${cellId++}`;
|
51
|
-
const item = defineComponent(event.bindingContext
|
59
|
+
const item = defineComponent(event.bindingContext);
|
52
60
|
const itemCtx = getItemCtx(item, index, props.alias, props.itemIdGenerator);
|
53
61
|
// const itemCtx: ListItem = getItemCtx(props.items instanceof ObservableArray ? props.items.getItem(index) : props.items[index], index, props.alias, props.itemIdGenerator);
|
54
62
|
// update the cell data with the current row
|
@@ -62,6 +70,7 @@ export const CollectionView = defineComponent({
|
|
62
70
|
// find the vnode rendering this cell
|
63
71
|
const container = event.view?.[LIST_CELL_CONTAINER] ?? new NSVRoot();
|
64
72
|
const vnode = ctx.slots[slotName]?.(itemCtx)[0];
|
73
|
+
propagateAppContext(vnode, vm?.appContext);
|
65
74
|
if (event.view) {
|
66
75
|
event.view._batchUpdate(() => {
|
67
76
|
// todo: handle the case where the slot is not found
|
@@ -77,23 +86,6 @@ export const CollectionView = defineComponent({
|
|
77
86
|
cellEl[LIST_CELL_CONTAINER] = container;
|
78
87
|
event.view = cellEl;
|
79
88
|
}
|
80
|
-
// render all realized templates as children
|
81
|
-
// const cellVNODES = () =>
|
82
|
-
// Object.entries(cells.value).map(([id, entry]) => {
|
83
|
-
// const vnodes: VNode[] = ctx.slots[entry.slotName]?.(entry.itemCtx) ?? [
|
84
|
-
// // default template is just a label
|
85
|
-
// h('Label', {
|
86
|
-
// text: entry.itemCtx[props.alias]
|
87
|
-
// })
|
88
|
-
// ];
|
89
|
-
// if (vnodes.length > 1) {
|
90
|
-
// warn(`ListView template must contain a single root element. Found: ${vnodes.length}. Only the first one will be used.`);
|
91
|
-
// }
|
92
|
-
// const vnode: VNode = vnodes[0];
|
93
|
-
// // set the key to the list cell id, so we can find this cell later...
|
94
|
-
// vnode.key = id;
|
95
|
-
// return vnode;
|
96
|
-
// });
|
97
89
|
return () => h('NativeCollectionView', {
|
98
90
|
ref: collectionView,
|
99
91
|
items: props.items,
|
package/vue3/component.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"component.js","sourceRoot":"","sources":["../../../src/collectionview/vue3/component.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"component.js","sourceRoot":"","sources":["../../../src/collectionview/vue3/component.ts"],"names":[],"mappings":"AAEA,OAAO,EAAiB,UAAU,EAAmB,MAAM,oBAAoB,CAAC;AAChF,OAAO,EAAE,OAAO,EAAmB,eAAe,EAAE,kBAAkB,EAAc,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAc3I,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,SAAS,mBAAmB,CAAC,KAAY,EAAE,UAAuB;IAC9D,IAAI,CAAC,KAAK,IAAI,CAAC,UAAU;QAAE,OAAO;IAElC,KAAK,CAAC,UAAU,GAAG,UAAU,CAAC;IAC9B,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC;QAChC,KAAK,CAAC,QA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