@egjs/ngx-infinitegrid 3.3.0 → 4.1.2-beta.1
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/README.md +111 -178
- package/bundles/egjs-ngx-infinitegrid.umd.js +586 -750
- package/bundles/egjs-ngx-infinitegrid.umd.js.map +1 -1
- package/bundles/egjs-ngx-infinitegrid.umd.min.js +12 -12
- package/bundles/egjs-ngx-infinitegrid.umd.min.js.map +1 -1
- package/egjs-ngx-infinitegrid.d.ts +5 -1
- package/egjs-ngx-infinitegrid.metadata.json +1 -1
- package/esm2015/egjs-ngx-infinitegrid.js +7 -7
- package/esm2015/lib/consts.js +20 -23
- package/esm2015/lib/grids/ngx-frame-infinitegrid.component.js +19 -0
- package/esm2015/lib/grids/ngx-justified-infinitegrid.component.js +21 -0
- package/esm2015/lib/grids/ngx-masonry-infinitegrid.component.js +20 -0
- package/esm2015/lib/grids/ngx-packing-infinitegrid.component.js +20 -0
- package/esm2015/lib/ngx-infinitegrid.component.js +134 -311
- package/esm2015/lib/ngx-infinitegrid.interface.js +10 -18
- package/esm2015/lib/ngx-infinitegrid.module.js +14 -21
- package/esm2015/lib/ngx-infinitegrid.service.js +5 -10
- package/esm2015/lib/types.js +2 -5
- package/esm2015/public-api.js +5 -13
- package/fesm2015/egjs-ngx-infinitegrid.js +214 -475
- package/fesm2015/egjs-ngx-infinitegrid.js.map +1 -1
- package/lib/consts.d.ts +1 -1
- package/lib/grids/ngx-frame-infinitegrid.component.d.ts +8 -0
- package/lib/grids/ngx-justified-infinitegrid.component.d.ts +10 -0
- package/lib/grids/ngx-masonry-infinitegrid.component.d.ts +9 -0
- package/lib/grids/ngx-packing-infinitegrid.component.d.ts +9 -0
- package/lib/ngx-infinitegrid.component.d.ts +57 -37
- package/lib/ngx-infinitegrid.interface.d.ts +9 -5
- package/lib/ngx-infinitegrid.service.d.ts +1 -1
- package/lib/types.d.ts +18 -4
- package/package.json +19 -16
- package/public-api.d.ts +1 -5
- package/esm2015/lib/ngx-framelayout.component.js +0 -28
- package/esm2015/lib/ngx-gridlayout.component.js +0 -28
- package/esm2015/lib/ngx-justifiedlayout.component.js +0 -28
- package/esm2015/lib/ngx-packinglayout.component.js +0 -28
- package/esm2015/lib/ngx-squarelayout.component.js +0 -28
- package/esm5/egjs-ngx-infinitegrid.js +0 -10
- package/esm5/lib/consts.js +0 -8
- package/esm5/lib/ngx-framelayout.component.js +0 -33
- package/esm5/lib/ngx-gridlayout.component.js +0 -33
- package/esm5/lib/ngx-infinitegrid.component.js +0 -385
- package/esm5/lib/ngx-infinitegrid.interface.js +0 -25
- package/esm5/lib/ngx-infinitegrid.module.js +0 -42
- package/esm5/lib/ngx-infinitegrid.service.js +0 -21
- package/esm5/lib/ngx-justifiedlayout.component.js +0 -33
- package/esm5/lib/ngx-packinglayout.component.js +0 -33
- package/esm5/lib/ngx-squarelayout.component.js +0 -33
- package/esm5/lib/types.js +0 -5
- package/esm5/public-api.js +0 -16
- package/fesm5/egjs-ngx-infinitegrid.js +0 -611
- package/fesm5/egjs-ngx-infinitegrid.js.map +0 -1
- package/lib/ngx-framelayout.component.d.ts +0 -5
- package/lib/ngx-gridlayout.component.d.ts +0 -5
- package/lib/ngx-justifiedlayout.component.d.ts +0 -5
- package/lib/ngx-packinglayout.component.d.ts +0 -5
- package/lib/ngx-squarelayout.component.d.ts +0 -5
package/README.md
CHANGED
|
@@ -1,234 +1,163 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
<h1 align="center">
|
|
2
|
+
<img width="256" alt="InfiniteGrid Logo" src="https://naver.github.io/egjs-infinitegrid/img/infinitegrid_logo.png"><br/>
|
|
3
|
+
@egjs/ngx-infinitegrid
|
|
4
|
+
</h1>
|
|
5
|
+
|
|
6
|
+
<p align="center">
|
|
7
|
+
<a href="https://www.npmjs.com/package/@egjs/ngx-infinitegrid" target="_blank">
|
|
8
|
+
<img src="https://img.shields.io/npm/v/@egjs/ngx-infinitegrid.svg?style=flat-square&color=dd0031&label=version&logo=NPM">
|
|
9
|
+
</a>
|
|
10
|
+
<a href="https://www.npmjs.com/package/@egjs/ngx-infinitegrid" target="_blank">
|
|
11
|
+
<img alt="npm bundle size (scoped)" src="https://img.shields.io/bundlephobia/minzip/@egjs/ngx-infinitegrid.svg?style=flat-square&label=%F0%9F%92%BE%20gzipped&color=007acc">
|
|
12
|
+
</a>
|
|
13
|
+
<a href="https://github.com/naver/egjs-infinitegrid/graphs/commit-activity">
|
|
14
|
+
<img alt="GitHub commit activity" src="https://img.shields.io/github/commit-activity/m/naver/egjs-infinitegrid.svg?style=flat-square&label=%E2%AC%86%20commits&color=08CE5D">
|
|
15
|
+
</a>
|
|
16
|
+
<a href="https://www.npmjs.com/package/@egjs/ngx-infinitegrid" target="_blank">
|
|
17
|
+
<img src="https://img.shields.io/npm/dm/@egjs/ngx-infinitegrid.svg?style=flat-square&label=%E2%AC%87%20downloads&color=08CE5D" alt="npm downloads per month">
|
|
18
|
+
</a>
|
|
19
|
+
<a href="https://github.com/naver/egjs-infinitegrid/graphs/contributors" target="_blank">
|
|
20
|
+
<img alt="GitHub contributors" src="https://img.shields.io/github/contributors/naver/egjs-infinitegrid.svg?label=%F0%9F%91%A5%20contributors&style=flat-square&color=08CE5D"></a>
|
|
21
|
+
<a href="https://github.com/naver/egjs-infinitegrid/blob/master/LICENSE" target="_blank">
|
|
22
|
+
<img alt="GitHub" src="https://img.shields.io/github/license/naver/egjs-infinitegrid.svg?style=flat-square&label=%F0%9F%93%9C%20license&color=08CE5D">
|
|
23
|
+
</a>
|
|
24
|
+
</p>
|
|
25
|
+
|
|
26
|
+
<p align="center">
|
|
27
|
+
An Angular component that can arrange items infinitely according to the type of grids
|
|
28
|
+
</p>
|
|
29
|
+
|
|
30
|
+
<p align="center">
|
|
31
|
+
<a href="https://naver.github.io/egjs-infinitegrid/">Demo</a> / <a href="https://naver.github.io/egjs-infinitegrid/docs/api/InfiniteGrid">Documentation</a> / <a href="https://naver.github.io/egjs/">Other components</a>
|
|
32
|
+
</p>
|
|
33
|
+
|
|
34
|
+
## ⚙️ Installation
|
|
35
|
+
```sh
|
|
36
|
+
npm install --save @egjs/ngx-infinitegrid
|
|
15
37
|
```
|
|
16
38
|
|
|
17
|
-
##
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
39
|
+
## 🏃 Quick Start
|
|
40
|
+
### Module definition
|
|
41
|
+
```diff
|
|
42
|
+
+import { NgxInfiniteGridModule } from '@egjs/ngx-infinitegrid';
|
|
21
43
|
import { BrowserModule } from '@angular/platform-browser';
|
|
22
44
|
import { NgModule } from '@angular/core';
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
import {
|
|
26
|
-
NgxInfiniteGridModule,
|
|
27
|
-
NgxInfiniteGridComponent,
|
|
28
|
-
NgxGridLayoutComponent,
|
|
29
|
-
NgxJustifiedLayoutComponent,
|
|
30
|
-
NgxSquareLayoutComponent,
|
|
31
|
-
NgxFrameLayoutComponent,
|
|
32
|
-
NgxPackingLayoutComponent,
|
|
33
|
-
} from '@egjs/ngx-infinitegrid';
|
|
34
|
-
|
|
45
|
+
|
|
35
46
|
@NgModule({
|
|
36
47
|
declarations: [
|
|
37
|
-
AppComponent
|
|
38
|
-
NgxGridLayoutComponent,
|
|
48
|
+
AppComponent
|
|
39
49
|
],
|
|
40
50
|
imports: [
|
|
41
51
|
BrowserModule,
|
|
42
|
-
|
|
52
|
+
+ NgxInfiniteGridModule /* Add in imports */
|
|
43
53
|
],
|
|
44
54
|
providers: [],
|
|
45
55
|
bootstrap: [AppComponent]
|
|
46
56
|
})
|
|
47
|
-
export class AppModule {}
|
|
57
|
+
export class AppModule { } /* Your app */
|
|
48
58
|
```
|
|
49
59
|
|
|
50
|
-
|
|
60
|
+
```html
|
|
61
|
+
<div NgxMasonryInfiniteGrid
|
|
62
|
+
class="container"
|
|
63
|
+
[gap]="5"
|
|
64
|
+
[items]="items"
|
|
65
|
+
[trackBy]="trackBy"
|
|
66
|
+
[groupBy]="groupBy"
|
|
67
|
+
(requestAppend)="onRequestAppend($event)"
|
|
68
|
+
*ngFor="let item of [0]; trackBy: randomTrackBy;"
|
|
69
|
+
#ig
|
|
70
|
+
>
|
|
71
|
+
<div class="item" *ngFor ="let item of ig.visibleItems; trackBy: trackBy;">
|
|
72
|
+
</div>
|
|
73
|
+
</div>
|
|
74
|
+
```
|
|
51
75
|
|
|
52
76
|
```ts
|
|
77
|
+
import { Component, Input } from '@angular/core';
|
|
78
|
+
import { OnRequestAppend } from '@egjs/infinitegrid';
|
|
79
|
+
|
|
53
80
|
@Component({
|
|
54
81
|
selector: 'app-root',
|
|
55
82
|
templateUrl: './app.component.html',
|
|
56
|
-
styleUrls: ['./app.component.css']
|
|
57
83
|
})
|
|
58
84
|
export class AppComponent {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
horizontal: false,
|
|
67
|
-
};
|
|
68
|
-
layoutOptions={
|
|
69
|
-
align: "justify",
|
|
70
|
-
};
|
|
71
|
-
start = 0;
|
|
72
|
-
items = [];
|
|
73
|
-
loadItems(groupKey: number, num: number) {
|
|
74
|
-
const items = this.items;
|
|
75
|
-
const start = this.start || 0;
|
|
76
|
-
|
|
77
|
-
for (let i = 0; i < num; ++i) {
|
|
78
|
-
items.push({
|
|
79
|
-
groupKey,
|
|
80
|
-
itemKey: start + i,
|
|
81
|
-
no: start + i,
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
this.items = [...items];
|
|
85
|
-
this.start += num;
|
|
86
|
-
}
|
|
87
|
-
onAppend({ currentTarget, groupKey, startLoading }) {
|
|
88
|
-
(window as any).a = this;
|
|
89
|
-
if (currentTarget.isLoading()) {
|
|
90
|
-
return;
|
|
91
|
-
}
|
|
92
|
-
startLoading();
|
|
93
|
-
this.loadItems(parseFloat(groupKey || 0) + 1, 5);
|
|
94
|
-
}
|
|
95
|
-
onLayoutComplete({ isAppend, isLayout, endLoading, fromCache }) {
|
|
96
|
-
if (!isLayout) {
|
|
97
|
-
endLoading();
|
|
85
|
+
items = this.getItems(0, 10);
|
|
86
|
+
getItems(nextGroupKey: number, count: number) {
|
|
87
|
+
const nextItems = [];
|
|
88
|
+
const nextKey = nextGroupKey * count;
|
|
89
|
+
|
|
90
|
+
for (let i = 0; i < count; ++i) {
|
|
91
|
+
nextItems.push({ groupKey: nextGroupKey, key: nextKey + i });
|
|
98
92
|
}
|
|
93
|
+
return nextItems;
|
|
99
94
|
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
this.items = [ ...this.items ];
|
|
103
|
-
}
|
|
104
|
-
onChange(e) {
|
|
105
|
-
console.log(e);
|
|
106
|
-
}
|
|
107
|
-
onPrepend(e) {
|
|
108
|
-
console.log(e);
|
|
95
|
+
groupBy(_: any, item: any) {
|
|
96
|
+
return item.groupKey;
|
|
109
97
|
}
|
|
110
|
-
trackBy(
|
|
111
|
-
return item.
|
|
98
|
+
trackBy(_: any, item: any) {
|
|
99
|
+
return item.key;
|
|
112
100
|
}
|
|
113
|
-
|
|
114
|
-
|
|
101
|
+
onRequestAppend(e: OnRequestAppend) {
|
|
102
|
+
const nextGroupKey = (+e.groupKey! || 0) + 1;
|
|
103
|
+
|
|
104
|
+
this.items = [
|
|
105
|
+
...this.items,
|
|
106
|
+
...this.getItems(nextGroupKey, 10),
|
|
107
|
+
];
|
|
115
108
|
}
|
|
116
109
|
}
|
|
117
|
-
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
### Template
|
|
121
|
-
```html
|
|
122
|
-
<ngx-gridlayout #ig
|
|
123
|
-
[loading]="loading"
|
|
124
|
-
[options]="options"
|
|
125
|
-
[layoutOptions]="layoutOptions"
|
|
126
|
-
[items]="items"
|
|
127
|
-
[trackBy]="trackBy"
|
|
128
|
-
[groupBy]="groupBy"
|
|
129
|
-
(append)="onAppend($event)"
|
|
130
|
-
(prepend)="onPrepend($event)"
|
|
131
|
-
(change)="onChange($event)"
|
|
132
|
-
(layoutComplete)="onLayoutComplete($event)"
|
|
133
|
-
(imageError)="onImageError($event)">
|
|
134
|
-
<div class="loading" #loading>LOADING?</div>
|
|
135
|
-
<div class="item" *ngFor ="let item of ig.visibleItems; trackBy: trackBy;">
|
|
136
|
-
egjs {{item.no}}
|
|
137
|
-
</div>
|
|
138
|
-
</ngx-gridlayout>
|
|
139
110
|
```
|
|
140
111
|
|
|
141
112
|
|
|
142
|
-
##
|
|
143
|
-
|
|
144
|
-
|name|type|default|description|
|
|
145
|
-
|---|---|---|---|
|
|
146
|
-
|trackBy|Function|get itemKey|Get a unique key that defines how to track changes for items in the iterable.|
|
|
147
|
-
|groupBy|Function|get groupKey or data-groupkey|Get a unique key to distinguish between groups.|
|
|
148
|
-
|useFirstRender|boolean|false|The useFirstRender option determines whether the markup will be shown on the first rendering or after loading is complete.|
|
|
149
|
-
|loading|HTMLElement||Specifies the Loading Bar to use for append or prepend items.|
|
|
150
|
-
|status|IInfiniteGridStatus|null|State object of the react-infinitegrid module|
|
|
151
|
-
|layoutType|Class|GridLayout|Specifies the Layout class to use.|
|
|
152
|
-
|options|IInfiniteGridOptions|{}|The option object of the eg.InfiniteGrid module|
|
|
153
|
-
|layoutOptions|IInfiniteGridOptions|{}|Options to apply to the Layout.|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
### Options
|
|
157
|
-
* [InfiniteGrid's options](https://naver.github.io/egjs-infinitegrid/release/latest/doc/eg.InfiniteGrid.html)
|
|
158
|
-
* [InfiniteGrid's events](https://naver.github.io/egjs-infinitegrid/release/latest/doc/eg.InfiniteGrid.html#event:append)
|
|
159
|
-
* [GridLayout's layoutOptions](https://naver.github.io/egjs-infinitegrid/release/latest/doc/eg.InfiniteGrid.GridLayout.html)
|
|
160
|
-
* [JustifiedLayout's layoutOptions](https://naver.github.io/egjs-infinitegrid/release/latest/doc/eg.InfiniteGrid.JustifiedLayout.html)
|
|
161
|
-
* [SquareLayout's layoutOptions](https://naver.github.io/egjs-infinitegrid/release/latest/doc/eg.InfiniteGrid.SquareLayout.html)
|
|
162
|
-
* [FrameLayout's layoutOptions](https://naver.github.io/egjs-infinitegrid/release/latest/doc/eg.InfiniteGrid.FrameLayout.html)
|
|
163
|
-
* [PackingLayout's layoutOptions](https://naver.github.io/egjs-infinitegrid/release/latest/doc/eg.InfiniteGrid.PackingLayout.html)
|
|
113
|
+
## 📖 More Options & Examples
|
|
114
|
+
[Options](https://naver.github.io/egjs-infinitegrid/Options) / [Demos](https://naver.github.io/egjs-infinitegrid/Demos)
|
|
164
115
|
|
|
116
|
+
## 🙌 Contributing
|
|
117
|
+
See [CONTRIBUTING.md](https://github.com/naver/egjs-infinitegrid/blob/master/CONTRIBUTING.md)
|
|
165
118
|
|
|
119
|
+
## 📝 Feedback
|
|
120
|
+
Please file an [Issue](https://github.com/naver/egjs-infinitegrid/issues) with label "Angular".
|
|
166
121
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
If you want to restore the state, use the status prop.
|
|
170
|
-
|
|
171
|
-
* Save Status
|
|
172
|
-
```html
|
|
173
|
-
<GridLayout #ig></GridLayout>
|
|
122
|
+
## Local development
|
|
123
|
+
### Project setup
|
|
174
124
|
```
|
|
175
|
-
|
|
176
|
-
import { NgxGridLayoutComponent } from "@egjs/ngx-infinitegrid";
|
|
177
|
-
|
|
178
|
-
@ViewChild('ig', { static: false }) ig: NgxGridLayoutComponent;
|
|
179
|
-
|
|
180
|
-
// Save Status
|
|
181
|
-
this.ig.getStatus();
|
|
125
|
+
npm install
|
|
182
126
|
```
|
|
183
127
|
|
|
184
|
-
|
|
185
|
-
```
|
|
186
|
-
|
|
187
|
-
<GridLayout
|
|
188
|
-
[status]="status"></GridLayout>
|
|
128
|
+
### Compiles and hot-reloads demo
|
|
129
|
+
```sh
|
|
130
|
+
npm run start
|
|
189
131
|
```
|
|
190
132
|
|
|
191
|
-
|
|
192
|
-
```
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
@ViewChild('ig', { static: false }) ig: NgxGridLayoutComponent;
|
|
196
|
-
|
|
197
|
-
this.ig.setStatus(status);
|
|
133
|
+
### Compiles and minifies for production
|
|
134
|
+
```
|
|
135
|
+
npm run build
|
|
198
136
|
```
|
|
199
137
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
## Development server
|
|
205
|
-
|
|
206
|
-
Run `npm run start(ng serve)` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
## Bug Report
|
|
211
|
-
|
|
212
|
-
If you find a bug, please report it to us using the [Issues](https://github.com/naver/egjs-infinitegrid/issues) page on GitHub.
|
|
213
|
-
|
|
138
|
+
### Run your tests
|
|
139
|
+
```
|
|
140
|
+
npm run test
|
|
141
|
+
```
|
|
214
142
|
|
|
215
|
-
|
|
216
|
-
|
|
143
|
+
### Lints and fixes files
|
|
144
|
+
```
|
|
145
|
+
npm run lint
|
|
146
|
+
```
|
|
217
147
|
|
|
148
|
+
## 📜 License
|
|
149
|
+
egjs-infinitegrid is released under the [MIT license](http://naver.github.io/egjs/license.txt).
|
|
218
150
|
|
|
219
151
|
```
|
|
220
|
-
Copyright (c)
|
|
221
|
-
|
|
152
|
+
Copyright (c) 2015-present NAVER Corp.
|
|
222
153
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
223
154
|
of this software and associated documentation files (the "Software"), to deal
|
|
224
155
|
in the Software without restriction, including without limitation the rights
|
|
225
156
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
226
157
|
copies of the Software, and to permit persons to whom the Software is
|
|
227
158
|
furnished to do so, subject to the following conditions:
|
|
228
|
-
|
|
229
159
|
The above copyright notice and this permission notice shall be included in
|
|
230
160
|
all copies or substantial portions of the Software.
|
|
231
|
-
|
|
232
161
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
233
162
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
234
163
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
@@ -238,3 +167,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
238
167
|
THE SOFTWARE.
|
|
239
168
|
```
|
|
240
169
|
|
|
170
|
+
<p align="center">
|
|
171
|
+
<a href="https://naver.github.io/egjs/"><img height="50" src="https://naver.github.io/egjs/img/logotype1_black.svg" ></a> <a href="https://github.com/naver"><img height="50" src="https://naver.github.io/OpenSourceGuide/book/assets/naver_logo.png" /></a>
|
|
172
|
+
</p>
|
|
173
|
+
|