@nativescript-community/ui-collectionview-alignedflowlayout 5.3.44
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 +461 -0
- package/LICENSE +201 -0
- package/README.md +173 -0
- package/index.android.d.ts +1 -0
- package/index.android.js +2 -0
- package/index.android.js.map +1 -0
- package/index.d.ts +1 -0
- package/index.ios.d.ts +1 -0
- package/index.ios.js +84 -0
- package/index.ios.js.map +1 -0
- package/package.json +45 -0
- package/platforms/ios/src/AlignedCollectionViewFlowLayout.swift +494 -0
- package/typings/objc!AlignedCollectionViewFlowLayout.d.ts +37 -0
package/README.md
ADDED
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
<!-- ⚠️ This README has been generated from the file(s) "blueprint.md" ⚠️-->
|
|
2
|
+
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
3
|
+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
4
|
+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
5
|
+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
6
|
+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
7
|
+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
8
|
+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
9
|
+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
10
|
+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
11
|
+
DO NOT EDIT THIS READEME DIRECTLY! Edit "bluesprint.md" instead.
|
|
12
|
+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
13
|
+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
14
|
+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
15
|
+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
16
|
+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
17
|
+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
18
|
+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
19
|
+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
20
|
+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
|
21
|
+
<h1 align="center">@nativescript-community/ui-collectionview-alignedflowlayout</h1>
|
|
22
|
+
<p align="center">
|
|
23
|
+
<a href="https://npmcharts.com/compare/@nativescript-community/ui-collectionview-alignedflowlayout?minimal=true"><img alt="Downloads per month" src="https://img.shields.io/npm/dm/@nativescript-community/ui-collectionview-alignedflowlayout.svg" height="20"/></a>
|
|
24
|
+
<a href="https://www.npmjs.com/package/@nativescript-community/ui-collectionview-alignedflowlayout"><img alt="NPM Version" src="https://img.shields.io/npm/v/@nativescript-community/ui-collectionview-alignedflowlayout.svg" height="20"/></a>
|
|
25
|
+
</p>
|
|
26
|
+
|
|
27
|
+
<p align="center">
|
|
28
|
+
<b>A NativeScript CollectionView For Custom aligned Layout Plugin.</b></br>
|
|
29
|
+
<sub><sub>
|
|
30
|
+
</p>
|
|
31
|
+
|
|
32
|
+
<br />
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
[](#table-of-contents)
|
|
37
|
+
|
|
38
|
+
## Table of Contents
|
|
39
|
+
|
|
40
|
+
* [Installation](#installation)
|
|
41
|
+
* [Configuration](#configuration)
|
|
42
|
+
* [Demos and Development](#demos-and-development)
|
|
43
|
+
* [Repo Setup](#repo-setup)
|
|
44
|
+
* [Build](#build)
|
|
45
|
+
* [Demos](#demos)
|
|
46
|
+
* [Contributing](#contributing)
|
|
47
|
+
* [Update repo ](#update-repo-)
|
|
48
|
+
* [Update readme ](#update-readme-)
|
|
49
|
+
* [Update doc ](#update-doc-)
|
|
50
|
+
* [Publish](#publish)
|
|
51
|
+
* [modifying submodules](#modifying-submodules)
|
|
52
|
+
* [Questions](#questions)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
[](#installation)
|
|
56
|
+
|
|
57
|
+
## Installation
|
|
58
|
+
Run the following command from the root of your project:
|
|
59
|
+
|
|
60
|
+
`ns plugin add @nativescript-community/ui-collectionview-alignedflowlayout`
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
[](#configuration)
|
|
64
|
+
|
|
65
|
+
## Configuration
|
|
66
|
+
|
|
67
|
+
To install the plugin run:
|
|
68
|
+
```typescript
|
|
69
|
+
import install from '@nativescript-community/ui-collectionview-alignedflowlayout';
|
|
70
|
+
install();
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
then simply use the `layoutStyle="align"` as a collectionview property
|
|
74
|
+
You can then use `layoutHorizontalAlignment`(left, right, justified) and `verticalHorizontalAlignment` (top, bottom, center)
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
[](#demos-and-development)
|
|
78
|
+
|
|
79
|
+
## Demos and Development
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
### Repo Setup
|
|
83
|
+
|
|
84
|
+
The repo uses submodules. If you did not clone with ` --recursive` then you need to call
|
|
85
|
+
```
|
|
86
|
+
git submodule update --init
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
The package manager used to install and link dependencies must be `pnpm` or `yarn`. `npm` wont work.
|
|
90
|
+
|
|
91
|
+
To develop and test:
|
|
92
|
+
if you use `yarn` then run `yarn`
|
|
93
|
+
if you use `pnpm` then run `pnpm i`
|
|
94
|
+
|
|
95
|
+
**Interactive Menu:**
|
|
96
|
+
|
|
97
|
+
To start the interactive menu, run `npm start` (or `yarn start` or `pnpm start`). This will list all of the commonly used scripts.
|
|
98
|
+
|
|
99
|
+
### Build
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
npm run build.all
|
|
103
|
+
```
|
|
104
|
+
WARNING: it seems `yarn build.all` wont always work (not finding binaries in `node_modules/.bin`) which is why the doc explicitly uses `npm run`
|
|
105
|
+
|
|
106
|
+
### Demos
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
npm run demo.[ng|react|svelte|vue].[ios|android]
|
|
110
|
+
|
|
111
|
+
npm run demo.svelte.ios # Example
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Demo setup is a bit special in the sense that if you want to modify/add demos you dont work directly in `demo-[ng|react|svelte|vue]`
|
|
115
|
+
Instead you work in `demo-snippets/[ng|react|svelte|vue]`
|
|
116
|
+
You can start from the `install.ts` of each flavor to see how to register new demos
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
[](#contributing)
|
|
120
|
+
|
|
121
|
+
## Contributing
|
|
122
|
+
|
|
123
|
+
### Update repo
|
|
124
|
+
|
|
125
|
+
You can update the repo files quite easily
|
|
126
|
+
|
|
127
|
+
First update the submodules
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
npm run update
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
Then commit the changes
|
|
134
|
+
Then update common files
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
npm run sync
|
|
138
|
+
```
|
|
139
|
+
Then you can run `yarn|pnpm`, commit changed files if any
|
|
140
|
+
|
|
141
|
+
### Update readme
|
|
142
|
+
```bash
|
|
143
|
+
npm run readme
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### Update doc
|
|
147
|
+
```bash
|
|
148
|
+
npm run doc
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### Publish
|
|
152
|
+
|
|
153
|
+
The publishing is completely handled by `lerna` (you can add `-- --bump major` to force a major release)
|
|
154
|
+
Simply run
|
|
155
|
+
```shell
|
|
156
|
+
npm run publish
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### modifying submodules
|
|
160
|
+
|
|
161
|
+
The repo uses https:// for submodules which means you won't be able to push directly into the submodules.
|
|
162
|
+
One easy solution is t modify `~/.gitconfig` and add
|
|
163
|
+
```
|
|
164
|
+
[url "ssh://git@github.com/"]
|
|
165
|
+
pushInsteadOf = https://github.com/
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
[](#questions)
|
|
170
|
+
|
|
171
|
+
## Questions
|
|
172
|
+
|
|
173
|
+
If you have any questions/issues/comments please feel free to create an issue or start a conversation in the [NativeScript Community Discord](https://nativescript.org/discord).
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function install(): void;
|
package/index.android.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.android.js","sourceRoot":"","sources":["../../src/alignedflowlayout/index.android.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,UAAU,OAAO,KAAI,CAAC"}
|
package/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function install();
|
package/index.ios.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function install(): void;
|
package/index.ios.js
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { Length, Utils } from '@nativescript/core';
|
|
2
|
+
import { CollectionView } from '@nativescript-community/ui-collectionview';
|
|
3
|
+
var AlignedCollectionViewFlowLayoutImpl = /** @class */ (function (_super) {
|
|
4
|
+
__extends(AlignedCollectionViewFlowLayoutImpl, _super);
|
|
5
|
+
function AlignedCollectionViewFlowLayoutImpl() {
|
|
6
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
7
|
+
}
|
|
8
|
+
AlignedCollectionViewFlowLayoutImpl.initWithOwner = function (owner) {
|
|
9
|
+
var layout = AlignedCollectionViewFlowLayoutImpl.new();
|
|
10
|
+
layout._owner = new WeakRef(owner);
|
|
11
|
+
return layout;
|
|
12
|
+
};
|
|
13
|
+
AlignedCollectionViewFlowLayoutImpl.prototype.invalidationContextForInteractivelyMovingItemsWithTargetPositionPreviousIndexPathsPreviousPosition = function (targetIndexPaths, targetPosition, previousIndexPaths, previousPosition) {
|
|
14
|
+
var _a;
|
|
15
|
+
var owner = (_a = this._owner) === null || _a === void 0 ? void 0 : _a.get();
|
|
16
|
+
if (owner && targetIndexPaths.count) {
|
|
17
|
+
owner.clearCachedSize(targetIndexPaths.objectAtIndex(0).row, previousIndexPaths.objectAtIndex(0).row);
|
|
18
|
+
}
|
|
19
|
+
return _super.prototype.invalidationContextForInteractivelyMovingItemsWithTargetPositionPreviousIndexPathsPreviousPosition.call(this, targetIndexPaths, targetPosition, previousIndexPaths, previousPosition);
|
|
20
|
+
};
|
|
21
|
+
AlignedCollectionViewFlowLayoutImpl.prototype.layoutAttributesForElementsInRect = function (rect) {
|
|
22
|
+
var _a;
|
|
23
|
+
var attributesArray = _super.prototype.layoutAttributesForElementsInRect.call(this, rect);
|
|
24
|
+
var owner = (_a = this._owner) === null || _a === void 0 ? void 0 : _a.get();
|
|
25
|
+
if (owner === null || owner === void 0 ? void 0 : owner.itemOverlap) {
|
|
26
|
+
var itemOverlap = owner.itemOverlap;
|
|
27
|
+
for (var index = 0; index < attributesArray.count; index++) {
|
|
28
|
+
var attributes = attributesArray.objectAtIndex(index);
|
|
29
|
+
if (attributes.representedElementCategory === UICollectionElementCategory.Cell) {
|
|
30
|
+
var xPosition = attributes.center.x + Utils.layout.toDeviceIndependentPixels(Length.toDevicePixels(itemOverlap[1], 0) + Length.toDevicePixels(itemOverlap[2], 0)) * attributes.indexPath.row;
|
|
31
|
+
var yPosition = attributes.center.y + Utils.layout.toDeviceIndependentPixels(Length.toDevicePixels(itemOverlap[0], 0) + Length.toDevicePixels(itemOverlap[2], 0)) * attributes.indexPath.row;
|
|
32
|
+
attributes.center = CGPointMake(xPosition, yPosition);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return attributesArray;
|
|
37
|
+
};
|
|
38
|
+
AlignedCollectionViewFlowLayoutImpl.prototype.shouldInvalidateLayoutForBoundsChange = function (newBounds) {
|
|
39
|
+
var _a;
|
|
40
|
+
var owner = (_a = this._owner) === null || _a === void 0 ? void 0 : _a.get();
|
|
41
|
+
if (owner === null || owner === void 0 ? void 0 : owner.itemOverlap) {
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
return _super.prototype.shouldInvalidateLayoutForBoundsChange.call(this, newBounds);
|
|
45
|
+
};
|
|
46
|
+
return AlignedCollectionViewFlowLayoutImpl;
|
|
47
|
+
}(AlignedCollectionViewFlowLayout));
|
|
48
|
+
export default function install() {
|
|
49
|
+
CollectionView.registerLayoutStyle('align', {
|
|
50
|
+
createLayout: (collectionview) => {
|
|
51
|
+
const layout = AlignedCollectionViewFlowLayoutImpl.new();
|
|
52
|
+
switch (collectionview['layoutHorizontalAlignment']) {
|
|
53
|
+
case 'left':
|
|
54
|
+
layout.horizontalAlignment = 0 /* HorizontalAlignment.Left */;
|
|
55
|
+
break;
|
|
56
|
+
case 'right':
|
|
57
|
+
layout.horizontalAlignment = 1 /* HorizontalAlignment.Right */;
|
|
58
|
+
break;
|
|
59
|
+
case 'justified':
|
|
60
|
+
layout.horizontalAlignment = 4 /* HorizontalAlignment.Justified */;
|
|
61
|
+
break;
|
|
62
|
+
case 'leading':
|
|
63
|
+
layout.horizontalAlignment = 2 /* HorizontalAlignment.Leading */;
|
|
64
|
+
break;
|
|
65
|
+
case 'trailing':
|
|
66
|
+
layout.horizontalAlignment = 3 /* HorizontalAlignment.Trailing */;
|
|
67
|
+
break;
|
|
68
|
+
}
|
|
69
|
+
switch (collectionview['layoutVerticalAlignment']) {
|
|
70
|
+
case 'top':
|
|
71
|
+
layout.verticalAlignment = 0 /* VerticalAlignment.Top */;
|
|
72
|
+
break;
|
|
73
|
+
case 'bottom':
|
|
74
|
+
layout.verticalAlignment = 2 /* VerticalAlignment.Bottom */;
|
|
75
|
+
break;
|
|
76
|
+
case 'center':
|
|
77
|
+
layout.verticalAlignment = 1 /* VerticalAlignment.Center */;
|
|
78
|
+
break;
|
|
79
|
+
}
|
|
80
|
+
return layout;
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=index.ios.js.map
|
package/index.ios.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.ios.js","sourceRoot":"","sources":["../../src/alignedflowlayout/index.ios.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuD3E,MAAM,CAAC,OAAO,UAAU,OAAO;IAC3B,cAAc,CAAC,mBAAmB,CAAC,OAAO,EAAE;QACxC,YAAY,EAAE,CAAC,cAA8B,EAAE,EAAE;YAC7C,MAAM,MAAM,GAAG,mCAAmC,CAAC,GAAG,EAAE,CAAC;YACzD,QAAQ,cAAc,CAAC,2BAA2B,CAAC,EAAE,CAAC;gBAClD,KAAK,MAAM;oBACP,MAAM,CAAC,mBAAmB,mCAA2B,CAAC;oBACtD,MAAM;gBACV,KAAK,OAAO;oBACR,MAAM,CAAC,mBAAmB,oCAA4B,CAAC;oBACvD,MAAM;gBACV,KAAK,WAAW;oBACZ,MAAM,CAAC,mBAAmB,wCAAgC,CAAC;oBAC3D,MAAM;gBACV,KAAK,SAAS;oBACV,MAAM,CAAC,mBAAmB,sCAA8B,CAAC;oBACzD,MAAM;gBACV,KAAK,UAAU;oBACX,MAAM,CAAC,mBAAmB,uCAA+B,CAAC;oBAC1D,MAAM;YACd,CAAC;YACD,QAAQ,cAAc,CAAC,yBAAyB,CAAC,EAAE,CAAC;gBAChD,KAAK,KAAK;oBACN,MAAM,CAAC,iBAAiB,gCAAwB,CAAC;oBACjD,MAAM;gBACV,KAAK,QAAQ;oBACT,MAAM,CAAC,iBAAiB,mCAA2B,CAAC;oBACpD,MAAM;gBACV,KAAK,QAAQ;oBACT,MAAM,CAAC,iBAAiB,mCAA2B,CAAC;oBACpD,MAAM;YACd,CAAC;YACD,OAAO,MAAM,CAAC;QAClB,CAAC;KACJ,CAAC,CAAC;AACP,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@nativescript-community/ui-collectionview-alignedflowlayout",
|
|
3
|
+
"version": "5.3.44",
|
|
4
|
+
"description": "A NativeScript CollectionView For Custom aligned Layout Plugin.",
|
|
5
|
+
"main": "./index",
|
|
6
|
+
"funding": "https://github.com/sponsors/farfromrefug",
|
|
7
|
+
"sideEffects": false,
|
|
8
|
+
"typings": "./index.d.ts",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/nativescript-community/ui-collectionview.git"
|
|
12
|
+
},
|
|
13
|
+
"scripts": {
|
|
14
|
+
"build": "npm run tsc && npm run readme",
|
|
15
|
+
"build.all": "npm run build",
|
|
16
|
+
"readme": "readme generate -c ../../tools/readme/blueprint.json",
|
|
17
|
+
"tsc": "cpy '**/*.d.ts' '../../packages/alignedflowlayout' --parents --cwd=../../src/alignedflowlayout && tsc -skipLibCheck -d",
|
|
18
|
+
"clean": "rimraf ./*.d.ts ./*.js ./*.js.map"
|
|
19
|
+
},
|
|
20
|
+
"nativescript": {
|
|
21
|
+
"platforms": {
|
|
22
|
+
"android": "6.1.0",
|
|
23
|
+
"ios": "6.1.0"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"keywords": [
|
|
27
|
+
"NativeScript",
|
|
28
|
+
"JavaScript",
|
|
29
|
+
"Android",
|
|
30
|
+
"iOS"
|
|
31
|
+
],
|
|
32
|
+
"author": {
|
|
33
|
+
"name": "Martin Guillon",
|
|
34
|
+
"email": "martin@akylas.fr"
|
|
35
|
+
},
|
|
36
|
+
"license": "ISC",
|
|
37
|
+
"bugs": {
|
|
38
|
+
"url": "https://github.com/nativescript-community/ui-collectionview/issues"
|
|
39
|
+
},
|
|
40
|
+
"homepage": "https://github.com/nativescript-community/ui-collectionview#readme",
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"@nativescript-community/ui-collectionview": "^5.3.44"
|
|
43
|
+
},
|
|
44
|
+
"gitHead": "1a56f35f828640583caacd593d9b8b6386b32afc"
|
|
45
|
+
}
|