ngx-repeat 0.0.3 → 1.0.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/README.md +9 -2
- package/esm2020/lib/ngx-repeat.directive.mjs +53 -0
- package/esm2020/lib/ngx-repeat.module.mjs +16 -0
- package/{esm2015/ngx-repeat.js → esm2020/ngx-repeat.mjs} +0 -0
- package/{esm2015/public-api.js → esm2020/public-api.mjs} +0 -0
- package/fesm2015/ngx-repeat.mjs +77 -0
- package/fesm2015/ngx-repeat.mjs.map +1 -0
- package/fesm2020/ngx-repeat.mjs +77 -0
- package/fesm2020/ngx-repeat.mjs.map +1 -0
- package/lib/ngx-repeat.directive.d.ts +3 -0
- package/lib/ngx-repeat.module.d.ts +5 -0
- package/ngx-repeat.d.ts +1 -0
- package/package.json +20 -8
- package/bundles/ngx-repeat.umd.js +0 -113
- package/bundles/ngx-repeat.umd.js.map +0 -1
- package/bundles/ngx-repeat.umd.min.js +0 -2
- package/bundles/ngx-repeat.umd.min.js.map +0 -1
- package/esm2015/lib/ngx-repeat.directive.js +0 -54
- package/esm2015/lib/ngx-repeat.module.js +0 -11
- package/fesm2015/ngx-repeat.js +0 -74
- package/fesm2015/ngx-repeat.js.map +0 -1
- package/ngx-repeat.metadata.json +0 -1
package/README.md
CHANGED
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
|
|
15
15
|
> Angular directive for repeating HTML element by count
|
|
16
16
|
|
|
17
|
-
> ✓ _Angular
|
|
17
|
+
> ✓ _Angular 13, Ivy and SSR compatible_
|
|
18
18
|
|
|
19
|
-
Here's the [demo](http://celtian.github.io/ngx-repeat/) or [stackblitz live preview](https://stackblitz.com/edit/ngx-repeat)
|
|
19
|
+
Here's the [demo](http://celtian.github.io/ngx-repeat/) or [stackblitz live preview](https://stackblitz.com/edit/ngx-repeat) or [codesandbox live preview](https://codesandbox.io/s/ngx-repeat-bew8f)
|
|
20
20
|
|
|
21
21
|
- Lightweight
|
|
22
22
|
- No dependencies!
|
|
@@ -44,6 +44,13 @@ yarn add ngx-repeat
|
|
|
44
44
|
})
|
|
45
45
|
```
|
|
46
46
|
|
|
47
|
+
## Compatibility
|
|
48
|
+
|
|
49
|
+
| Angular | ngx-repeat | Install |
|
|
50
|
+
| --------- | ---------- | ----------------------- |
|
|
51
|
+
| >= 12 | 1.x | `yarn add ngx-repeat` |
|
|
52
|
+
| >= 5 < 13 | 0.x | `yarn add ngx-repeat@0` |
|
|
53
|
+
|
|
47
54
|
## Quick start
|
|
48
55
|
|
|
49
56
|
### Example code
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { Directive, Input } from '@angular/core';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
/**
|
|
4
|
+
* @publicApi
|
|
5
|
+
*/
|
|
6
|
+
export class RepeatDirectiveContext {
|
|
7
|
+
constructor($implicit, count) {
|
|
8
|
+
this.$implicit = $implicit;
|
|
9
|
+
this.count = count;
|
|
10
|
+
}
|
|
11
|
+
get index() {
|
|
12
|
+
return this.$implicit;
|
|
13
|
+
}
|
|
14
|
+
get first() {
|
|
15
|
+
return this.$implicit === 0;
|
|
16
|
+
}
|
|
17
|
+
get last() {
|
|
18
|
+
return this.index === this.count - 1;
|
|
19
|
+
}
|
|
20
|
+
get even() {
|
|
21
|
+
return this.$implicit % 2 === 0;
|
|
22
|
+
}
|
|
23
|
+
get odd() {
|
|
24
|
+
return this.$implicit % 2 === 1;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
export class NgxRepeatDirective {
|
|
28
|
+
constructor(templateRef, viewContainer) {
|
|
29
|
+
this.templateRef = templateRef;
|
|
30
|
+
this.viewContainer = viewContainer;
|
|
31
|
+
}
|
|
32
|
+
set ngxRepeat(count) {
|
|
33
|
+
for (let i = this.viewContainer.length; i > count; i--)
|
|
34
|
+
this.viewContainer.remove(i - 1);
|
|
35
|
+
for (let i = this.viewContainer.length; i < count; i++)
|
|
36
|
+
this.viewContainer.createEmbeddedView(this.templateRef, new RepeatDirectiveContext(i, count));
|
|
37
|
+
for (let i = 0; i < this.viewContainer.length; i++) {
|
|
38
|
+
const viewRef = this.viewContainer.get(i);
|
|
39
|
+
viewRef.context.count = count;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
NgxRepeatDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: NgxRepeatDirective, deps: [{ token: i0.TemplateRef }, { token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
44
|
+
NgxRepeatDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.0.3", type: NgxRepeatDirective, selector: "[ngxRepeat]", inputs: { ngxRepeat: "ngxRepeat" }, ngImport: i0 });
|
|
45
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: NgxRepeatDirective, decorators: [{
|
|
46
|
+
type: Directive,
|
|
47
|
+
args: [{
|
|
48
|
+
selector: '[ngxRepeat]'
|
|
49
|
+
}]
|
|
50
|
+
}], ctorParameters: function () { return [{ type: i0.TemplateRef }, { type: i0.ViewContainerRef }]; }, propDecorators: { ngxRepeat: [{
|
|
51
|
+
type: Input
|
|
52
|
+
}] } });
|
|
53
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibmd4LXJlcGVhdC5kaXJlY3RpdmUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9wcm9qZWN0cy9uZ3gtcmVwZWF0L3NyYy9saWIvbmd4LXJlcGVhdC5kaXJlY3RpdmUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFNBQVMsRUFBbUIsS0FBSyxFQUFpQyxNQUFNLGVBQWUsQ0FBQzs7QUFFakc7O0dBRUc7QUFDSCxNQUFNLE9BQU8s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ZXh0Pj50aGlzLnZpZXdDb250YWluZXIuZ2V0KGkpO1xuICAgICAgdmlld1JlZi5jb250ZXh0LmNvdW50ID0gY291bnQ7XG4gICAgfVxuICB9XG5cbiAgY29uc3RydWN0b3IocHJpdmF0ZSB0ZW1wbGF0ZVJlZjogVGVtcGxhdGVSZWY8UmVwZWF0RGlyZWN0aXZlQ29udGV4dD4sIHByaXZhdGUgdmlld0NvbnRhaW5lcjogVmlld0NvbnRhaW5lclJlZikge31cbn1cbiJdfQ==
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import { NgxRepeatDirective } from './ngx-repeat.directive';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export class NgxRepeatModule {
|
|
5
|
+
}
|
|
6
|
+
NgxRepeatModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: NgxRepeatModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
7
|
+
NgxRepeatModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: NgxRepeatModule, declarations: [NgxRepeatDirective], exports: [NgxRepeatDirective] });
|
|
8
|
+
NgxRepeatModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: NgxRepeatModule });
|
|
9
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: NgxRepeatModule, decorators: [{
|
|
10
|
+
type: NgModule,
|
|
11
|
+
args: [{
|
|
12
|
+
declarations: [NgxRepeatDirective],
|
|
13
|
+
exports: [NgxRepeatDirective]
|
|
14
|
+
}]
|
|
15
|
+
}] });
|
|
16
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibmd4LXJlcGVhdC5tb2R1bGUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9wcm9qZWN0cy9uZ3gtcmVwZWF0L3NyYy9saWIvbmd4LXJlcGVhdC5tb2R1bGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFFBQVEsRUFBRSxNQUFNLGVBQWUsQ0FBQztBQUN6QyxPQUFPLEVBQUUsa0JBQWtCLEVBQUUsTUFBTSx3QkFBd0IsQ0FBQzs7QUFNNUQsTUFBTSxPQUFPLGVBQWU7OzRHQUFmLGVBQWU7NkdBQWYsZUFBZSxpQkFIWCxrQkFBa0IsYUFDdkIsa0JBQWtCOzZHQUVqQixlQUFlOzJGQUFmLGVBQWU7a0JBSjNCLFFBQVE7bUJBQUM7b0JBQ1IsWUFBWSxFQUFFLENBQUMsa0JBQWtCLENBQUM7b0JBQ2xDLE9BQU8sRUFBRSxDQUFDLGtCQUFrQixDQUFDO2lCQUM5QiIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IE5nTW9kdWxlIH0gZnJvbSAnQGFuZ3VsYXIvY29yZSc7XG5pbXBvcnQgeyBOZ3hSZXBlYXREaXJlY3RpdmUgfSBmcm9tICcuL25neC1yZXBlYXQuZGlyZWN0aXZlJztcblxuQE5nTW9kdWxlKHtcbiAgZGVjbGFyYXRpb25zOiBbTmd4UmVwZWF0RGlyZWN0aXZlXSxcbiAgZXhwb3J0czogW05neFJlcGVhdERpcmVjdGl2ZV1cbn0pXG5leHBvcnQgY2xhc3MgTmd4UmVwZWF0TW9kdWxlIHt9XG4iXX0=
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Directive, Input, NgModule } from '@angular/core';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @publicApi
|
|
6
|
+
*/
|
|
7
|
+
class RepeatDirectiveContext {
|
|
8
|
+
constructor($implicit, count) {
|
|
9
|
+
this.$implicit = $implicit;
|
|
10
|
+
this.count = count;
|
|
11
|
+
}
|
|
12
|
+
get index() {
|
|
13
|
+
return this.$implicit;
|
|
14
|
+
}
|
|
15
|
+
get first() {
|
|
16
|
+
return this.$implicit === 0;
|
|
17
|
+
}
|
|
18
|
+
get last() {
|
|
19
|
+
return this.index === this.count - 1;
|
|
20
|
+
}
|
|
21
|
+
get even() {
|
|
22
|
+
return this.$implicit % 2 === 0;
|
|
23
|
+
}
|
|
24
|
+
get odd() {
|
|
25
|
+
return this.$implicit % 2 === 1;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
class NgxRepeatDirective {
|
|
29
|
+
constructor(templateRef, viewContainer) {
|
|
30
|
+
this.templateRef = templateRef;
|
|
31
|
+
this.viewContainer = viewContainer;
|
|
32
|
+
}
|
|
33
|
+
set ngxRepeat(count) {
|
|
34
|
+
for (let i = this.viewContainer.length; i > count; i--)
|
|
35
|
+
this.viewContainer.remove(i - 1);
|
|
36
|
+
for (let i = this.viewContainer.length; i < count; i++)
|
|
37
|
+
this.viewContainer.createEmbeddedView(this.templateRef, new RepeatDirectiveContext(i, count));
|
|
38
|
+
for (let i = 0; i < this.viewContainer.length; i++) {
|
|
39
|
+
const viewRef = this.viewContainer.get(i);
|
|
40
|
+
viewRef.context.count = count;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
NgxRepeatDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: NgxRepeatDirective, deps: [{ token: i0.TemplateRef }, { token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
45
|
+
NgxRepeatDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.0.3", type: NgxRepeatDirective, selector: "[ngxRepeat]", inputs: { ngxRepeat: "ngxRepeat" }, ngImport: i0 });
|
|
46
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: NgxRepeatDirective, decorators: [{
|
|
47
|
+
type: Directive,
|
|
48
|
+
args: [{
|
|
49
|
+
selector: '[ngxRepeat]'
|
|
50
|
+
}]
|
|
51
|
+
}], ctorParameters: function () { return [{ type: i0.TemplateRef }, { type: i0.ViewContainerRef }]; }, propDecorators: { ngxRepeat: [{
|
|
52
|
+
type: Input
|
|
53
|
+
}] } });
|
|
54
|
+
|
|
55
|
+
class NgxRepeatModule {
|
|
56
|
+
}
|
|
57
|
+
NgxRepeatModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: NgxRepeatModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
58
|
+
NgxRepeatModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: NgxRepeatModule, declarations: [NgxRepeatDirective], exports: [NgxRepeatDirective] });
|
|
59
|
+
NgxRepeatModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: NgxRepeatModule });
|
|
60
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: NgxRepeatModule, decorators: [{
|
|
61
|
+
type: NgModule,
|
|
62
|
+
args: [{
|
|
63
|
+
declarations: [NgxRepeatDirective],
|
|
64
|
+
exports: [NgxRepeatDirective]
|
|
65
|
+
}]
|
|
66
|
+
}] });
|
|
67
|
+
|
|
68
|
+
/*
|
|
69
|
+
* Public API Surface of ngx-repeat
|
|
70
|
+
*/
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Generated bundle index. Do not edit.
|
|
74
|
+
*/
|
|
75
|
+
|
|
76
|
+
export { NgxRepeatDirective, NgxRepeatModule, RepeatDirectiveContext };
|
|
77
|
+
//# sourceMappingURL=ngx-repeat.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ngx-repeat.mjs","sources":["../../../projects/ngx-repeat/src/lib/ngx-repeat.directive.ts","../../../projects/ngx-repeat/src/lib/ngx-repeat.module.ts","../../../projects/ngx-repeat/src/public-api.ts","../../../projects/ngx-repeat/src/ngx-repeat.ts"],"sourcesContent":["import { Directive, EmbeddedViewRef, Input, TemplateRef, ViewContainerRef } from '@angular/core';\n\n/**\n * @publicApi\n */\nexport class RepeatDirectiveContext {\n constructor(public $implicit: number, public count: number) {}\n\n public get index(): number {\n return this.$implicit;\n }\n\n public get first(): boolean {\n return this.$implicit === 0;\n }\n\n public get last(): boolean {\n return this.index === this.count - 1;\n }\n\n public get even(): boolean {\n return this.$implicit % 2 === 0;\n }\n\n public get odd(): boolean {\n return this.$implicit % 2 === 1;\n }\n}\n\n@Directive({\n selector: '[ngxRepeat]'\n})\nexport class NgxRepeatDirective {\n @Input() public set ngxRepeat(count: number) {\n for (let i = this.viewContainer.length; i > count; i--) this.viewContainer.remove(i - 1);\n\n for (let i = this.viewContainer.length; i < count; i++)\n this.viewContainer.createEmbeddedView(this.templateRef, new RepeatDirectiveContext(i, count));\n\n for (let i = 0; i < this.viewContainer.length; i++) {\n const viewRef = <EmbeddedViewRef<RepeatDirectiveContext>>this.viewContainer.get(i);\n viewRef.context.count = count;\n }\n }\n\n constructor(private templateRef: TemplateRef<RepeatDirectiveContext>, private viewContainer: ViewContainerRef) {}\n}\n","import { NgModule } from '@angular/core';\nimport { NgxRepeatDirective } from './ngx-repeat.directive';\n\n@NgModule({\n declarations: [NgxRepeatDirective],\n exports: [NgxRepeatDirective]\n})\nexport class NgxRepeatModule {}\n","/*\n * Public API Surface of ngx-repeat\n */\n\nexport * from './lib/ngx-repeat.directive';\nexport * from './lib/ngx-repeat.module';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;AAEA;;;MAGa,sBAAsB;IACjC,YAAmB,SAAiB,EAAS,KAAa;QAAvC,cAAS,GAAT,SAAS,CAAQ;QAAS,UAAK,GAAL,KAA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BAAkB;mGAAlB,kBAAkB;2FAAlB,kBAAkB;kBAH9B,SAAS;mBAAC;oBACT,QAAQ,EAAE,aAAa;iBACxB;iIAEqB,SAAS;sBAA5B,KAAK;;;MC1BK,eAAe;;4GAAf,eAAe;6GAAf,eAAe,iBAHX,kBAAkB,aACvB,kBAAkB;6GAEjB,eAAe;2FAAf,eAAe;kBAJ3B,QAAQ;mBAAC;oBACR,YAAY,EAAE,CAAC,kBAAkB,CAAC;oBAClC,OAAO,EAAE,CAAC,kBAAkB,CAAC;iBAC9B;;;ACND;;;;ACAA;;;;;;"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Directive, Input, NgModule } from '@angular/core';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @publicApi
|
|
6
|
+
*/
|
|
7
|
+
class RepeatDirectiveContext {
|
|
8
|
+
constructor($implicit, count) {
|
|
9
|
+
this.$implicit = $implicit;
|
|
10
|
+
this.count = count;
|
|
11
|
+
}
|
|
12
|
+
get index() {
|
|
13
|
+
return this.$implicit;
|
|
14
|
+
}
|
|
15
|
+
get first() {
|
|
16
|
+
return this.$implicit === 0;
|
|
17
|
+
}
|
|
18
|
+
get last() {
|
|
19
|
+
return this.index === this.count - 1;
|
|
20
|
+
}
|
|
21
|
+
get even() {
|
|
22
|
+
return this.$implicit % 2 === 0;
|
|
23
|
+
}
|
|
24
|
+
get odd() {
|
|
25
|
+
return this.$implicit % 2 === 1;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
class NgxRepeatDirective {
|
|
29
|
+
constructor(templateRef, viewContainer) {
|
|
30
|
+
this.templateRef = templateRef;
|
|
31
|
+
this.viewContainer = viewContainer;
|
|
32
|
+
}
|
|
33
|
+
set ngxRepeat(count) {
|
|
34
|
+
for (let i = this.viewContainer.length; i > count; i--)
|
|
35
|
+
this.viewContainer.remove(i - 1);
|
|
36
|
+
for (let i = this.viewContainer.length; i < count; i++)
|
|
37
|
+
this.viewContainer.createEmbeddedView(this.templateRef, new RepeatDirectiveContext(i, count));
|
|
38
|
+
for (let i = 0; i < this.viewContainer.length; i++) {
|
|
39
|
+
const viewRef = this.viewContainer.get(i);
|
|
40
|
+
viewRef.context.count = count;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
NgxRepeatDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: NgxRepeatDirective, deps: [{ token: i0.TemplateRef }, { token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
45
|
+
NgxRepeatDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.0.3", type: NgxRepeatDirective, selector: "[ngxRepeat]", inputs: { ngxRepeat: "ngxRepeat" }, ngImport: i0 });
|
|
46
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: NgxRepeatDirective, decorators: [{
|
|
47
|
+
type: Directive,
|
|
48
|
+
args: [{
|
|
49
|
+
selector: '[ngxRepeat]'
|
|
50
|
+
}]
|
|
51
|
+
}], ctorParameters: function () { return [{ type: i0.TemplateRef }, { type: i0.ViewContainerRef }]; }, propDecorators: { ngxRepeat: [{
|
|
52
|
+
type: Input
|
|
53
|
+
}] } });
|
|
54
|
+
|
|
55
|
+
class NgxRepeatModule {
|
|
56
|
+
}
|
|
57
|
+
NgxRepeatModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: NgxRepeatModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
58
|
+
NgxRepeatModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: NgxRepeatModule, declarations: [NgxRepeatDirective], exports: [NgxRepeatDirective] });
|
|
59
|
+
NgxRepeatModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: NgxRepeatModule });
|
|
60
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: NgxRepeatModule, decorators: [{
|
|
61
|
+
type: NgModule,
|
|
62
|
+
args: [{
|
|
63
|
+
declarations: [NgxRepeatDirective],
|
|
64
|
+
exports: [NgxRepeatDirective]
|
|
65
|
+
}]
|
|
66
|
+
}] });
|
|
67
|
+
|
|
68
|
+
/*
|
|
69
|
+
* Public API Surface of ngx-repeat
|
|
70
|
+
*/
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Generated bundle index. Do not edit.
|
|
74
|
+
*/
|
|
75
|
+
|
|
76
|
+
export { NgxRepeatDirective, NgxRepeatModule, RepeatDirectiveContext };
|
|
77
|
+
//# sourceMappingURL=ngx-repeat.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ngx-repeat.mjs","sources":["../../../projects/ngx-repeat/src/lib/ngx-repeat.directive.ts","../../../projects/ngx-repeat/src/lib/ngx-repeat.module.ts","../../../projects/ngx-repeat/src/public-api.ts","../../../projects/ngx-repeat/src/ngx-repeat.ts"],"sourcesContent":["import { Directive, EmbeddedViewRef, Input, TemplateRef, ViewContainerRef } from '@angular/core';\n\n/**\n * @publicApi\n */\nexport class RepeatDirectiveContext {\n constructor(public $implicit: number, public count: number) {}\n\n public get index(): number {\n return this.$implicit;\n }\n\n public get first(): boolean {\n return this.$implicit === 0;\n }\n\n public get last(): boolean {\n return this.index === this.count - 1;\n }\n\n public get even(): boolean {\n return this.$implicit % 2 === 0;\n }\n\n public get odd(): boolean {\n return this.$implicit % 2 === 1;\n }\n}\n\n@Directive({\n selector: '[ngxRepeat]'\n})\nexport class NgxRepeatDirective {\n @Input() public set ngxRepeat(count: number) {\n for (let i = this.viewContainer.length; i > count; i--) this.viewContainer.remove(i - 1);\n\n for (let i = this.viewContainer.length; i < count; i++)\n this.viewContainer.createEmbeddedView(this.templateRef, new RepeatDirectiveContext(i, count));\n\n for (let i = 0; i < this.viewContainer.length; i++) {\n const viewRef = <EmbeddedViewRef<RepeatDirectiveContext>>this.viewContainer.get(i);\n viewRef.context.count = count;\n }\n }\n\n constructor(private templateRef: TemplateRef<RepeatDirectiveContext>, private viewContainer: ViewContainerRef) {}\n}\n","import { NgModule } from '@angular/core';\nimport { NgxRepeatDirective } from './ngx-repeat.directive';\n\n@NgModule({\n declarations: [NgxRepeatDirective],\n exports: [NgxRepeatDirective]\n})\nexport class NgxRepeatModule {}\n","/*\n * Public API Surface of ngx-repeat\n */\n\nexport * from './lib/ngx-repeat.directive';\nexport * from './lib/ngx-repeat.module';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;AAEA;;;MAGa,sBAAsB;IACjC,YAAmB,SAAiB,EAAS,KAAa;QAAvC,cAAS,GAAT,SAAS,CAAQ;QAAS,UAAK,GAAL,KAAK,CAAQ;KAAI;IAE9D,IAAW,KAAK;QACd,OAAO,IAAI,CAAC,SAAS,CAAC;KACvB;IAED,IAAW,KAAK;QACd,OAAO,IAAI,CAAC,SAAS,KAAK,CAAC,CAAC;KAC7B;IAED,IAAW,IAAI;QACb,OAAO,IAAI,CAAC,KAAK,KAAK,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC;KACtC;IAED,IAAW,IAAI;QACb,OAAO,IAAI,CAAC,SAAS,GAAG,CAAC,KAAK,CAAC,CAAC;KACjC;IAED,IAAW,GAAG;QACZ,OAAO,IAAI,CAAC,SAAS,GAAG,CAAC,KAAK,CAAC,CAAC;KACjC;CACF;MAKY,kBAAkB;IAa7B,YAAoB,WAAgD,EAAU,aAA+B;QAAzF,gBAAW,GAAX,WAAW,CAAqC;QAAU,kBAAa,GAAb,aAAa,CAAkB;KAAI;IAZjH,IAAoB,SAAS,CAAC,KAAa;QACzC,KAAK,IAAI,CAAC,GAAG,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,CAAC,GAAG,KAAK,EAAE,CAAC,EAAE;YAAE,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;QAEzF,KAAK,IAAI,CAAC,GAAG,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,CAAC,GAAG,KAAK,EAAE,CAAC,EAAE;YACpD,IAAI,CAAC,aAAa,CAAC,kBAAkB,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,sBAAsB,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;QAEhG,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YAClD,MAAM,OAAO,GAA4C,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;YACnF,OAAO,CAAC,OAAO,CAAC,KAAK,GAAG,KAAK,CAAC;SAC/B;KACF;;+GAXU,kBAAkB;mGAAlB,kBAAkB;2FAAlB,kBAAkB;kBAH9B,SAAS;mBAAC;oBACT,QAAQ,EAAE,aAAa;iBACxB;iIAEqB,SAAS;sBAA5B,KAAK;;;MC1BK,eAAe;;4GAAf,eAAe;6GAAf,eAAe,iBAHX,kBAAkB,aACvB,kBAAkB;6GAEjB,eAAe;2FAAf,eAAe;kBAJ3B,QAAQ;mBAAC;oBACR,YAAY,EAAE,CAAC,kBAAkB,CAAC;oBAClC,OAAO,EAAE,CAAC,kBAAkB,CAAC;iBAC9B;;;ACND;;;;ACAA;;;;;;"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { TemplateRef, ViewContainerRef } from '@angular/core';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
2
3
|
/**
|
|
3
4
|
* @publicApi
|
|
4
5
|
*/
|
|
@@ -17,4 +18,6 @@ export declare class NgxRepeatDirective {
|
|
|
17
18
|
private viewContainer;
|
|
18
19
|
set ngxRepeat(count: number);
|
|
19
20
|
constructor(templateRef: TemplateRef<RepeatDirectiveContext>, viewContainer: ViewContainerRef);
|
|
21
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NgxRepeatDirective, never>;
|
|
22
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<NgxRepeatDirective, "[ngxRepeat]", never, { "ngxRepeat": "ngxRepeat"; }, {}, never>;
|
|
20
23
|
}
|
|
@@ -1,2 +1,7 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import * as i1 from "./ngx-repeat.directive";
|
|
1
3
|
export declare class NgxRepeatModule {
|
|
4
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NgxRepeatModule, never>;
|
|
5
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<NgxRepeatModule, [typeof i1.NgxRepeatDirective], never, [typeof i1.NgxRepeatDirective]>;
|
|
6
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<NgxRepeatModule>;
|
|
2
7
|
}
|
package/ngx-repeat.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ngx-repeat",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"author": {
|
|
5
5
|
"name": "Dominik Hladík",
|
|
6
6
|
"email": "dominik.hladik@seznam.cz",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"description": "Angular directive for repeating HTML element by count",
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"tslib": "^2.
|
|
13
|
+
"tslib": "^2.2.0"
|
|
14
14
|
},
|
|
15
15
|
"publishConfig": {
|
|
16
16
|
"registry": "https://registry.npmjs.org"
|
|
@@ -32,12 +32,24 @@
|
|
|
32
32
|
"engines": {
|
|
33
33
|
"node": ">=10"
|
|
34
34
|
},
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"fesm2015": "fesm2015/ngx-repeat.
|
|
35
|
+
"module": "fesm2015/ngx-repeat.mjs",
|
|
36
|
+
"es2020": "fesm2020/ngx-repeat.mjs",
|
|
37
|
+
"esm2020": "esm2020/ngx-repeat.mjs",
|
|
38
|
+
"fesm2020": "fesm2020/ngx-repeat.mjs",
|
|
39
|
+
"fesm2015": "fesm2015/ngx-repeat.mjs",
|
|
40
40
|
"typings": "ngx-repeat.d.ts",
|
|
41
|
-
"
|
|
41
|
+
"exports": {
|
|
42
|
+
"./package.json": {
|
|
43
|
+
"default": "./package.json"
|
|
44
|
+
},
|
|
45
|
+
".": {
|
|
46
|
+
"types": "./ngx-repeat.d.ts",
|
|
47
|
+
"esm2020": "./esm2020/ngx-repeat.mjs",
|
|
48
|
+
"es2020": "./fesm2020/ngx-repeat.mjs",
|
|
49
|
+
"es2015": "./fesm2015/ngx-repeat.mjs",
|
|
50
|
+
"node": "./fesm2015/ngx-repeat.mjs",
|
|
51
|
+
"default": "./fesm2020/ngx-repeat.mjs"
|
|
52
|
+
}
|
|
53
|
+
},
|
|
42
54
|
"sideEffects": false
|
|
43
55
|
}
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define('ngx-repeat', ['exports', '@angular/core'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global['ngx-repeat'] = {}, global.ng.core));
|
|
5
|
-
}(this, (function (exports, core) { 'use strict';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* @publicApi
|
|
9
|
-
*/
|
|
10
|
-
var RepeatDirectiveContext = /** @class */ (function () {
|
|
11
|
-
function RepeatDirectiveContext($implicit, count) {
|
|
12
|
-
this.$implicit = $implicit;
|
|
13
|
-
this.count = count;
|
|
14
|
-
}
|
|
15
|
-
Object.defineProperty(RepeatDirectiveContext.prototype, "index", {
|
|
16
|
-
get: function () {
|
|
17
|
-
return this.$implicit;
|
|
18
|
-
},
|
|
19
|
-
enumerable: false,
|
|
20
|
-
configurable: true
|
|
21
|
-
});
|
|
22
|
-
Object.defineProperty(RepeatDirectiveContext.prototype, "first", {
|
|
23
|
-
get: function () {
|
|
24
|
-
return this.$implicit === 0;
|
|
25
|
-
},
|
|
26
|
-
enumerable: false,
|
|
27
|
-
configurable: true
|
|
28
|
-
});
|
|
29
|
-
Object.defineProperty(RepeatDirectiveContext.prototype, "last", {
|
|
30
|
-
get: function () {
|
|
31
|
-
return this.index === this.count - 1;
|
|
32
|
-
},
|
|
33
|
-
enumerable: false,
|
|
34
|
-
configurable: true
|
|
35
|
-
});
|
|
36
|
-
Object.defineProperty(RepeatDirectiveContext.prototype, "even", {
|
|
37
|
-
get: function () {
|
|
38
|
-
return this.$implicit % 2 === 0;
|
|
39
|
-
},
|
|
40
|
-
enumerable: false,
|
|
41
|
-
configurable: true
|
|
42
|
-
});
|
|
43
|
-
Object.defineProperty(RepeatDirectiveContext.prototype, "odd", {
|
|
44
|
-
get: function () {
|
|
45
|
-
return this.$implicit % 2 === 1;
|
|
46
|
-
},
|
|
47
|
-
enumerable: false,
|
|
48
|
-
configurable: true
|
|
49
|
-
});
|
|
50
|
-
return RepeatDirectiveContext;
|
|
51
|
-
}());
|
|
52
|
-
var NgxRepeatDirective = /** @class */ (function () {
|
|
53
|
-
function NgxRepeatDirective(templateRef, viewContainer) {
|
|
54
|
-
this.templateRef = templateRef;
|
|
55
|
-
this.viewContainer = viewContainer;
|
|
56
|
-
}
|
|
57
|
-
Object.defineProperty(NgxRepeatDirective.prototype, "ngxRepeat", {
|
|
58
|
-
set: function (count) {
|
|
59
|
-
for (var i = this.viewContainer.length; i > count; i--)
|
|
60
|
-
this.viewContainer.remove(i - 1);
|
|
61
|
-
for (var i = this.viewContainer.length; i < count; i++)
|
|
62
|
-
this.viewContainer.createEmbeddedView(this.templateRef, new RepeatDirectiveContext(i, count));
|
|
63
|
-
for (var i = 0; i < this.viewContainer.length; i++) {
|
|
64
|
-
var viewRef = this.viewContainer.get(i);
|
|
65
|
-
viewRef.context.count = count;
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
enumerable: false,
|
|
69
|
-
configurable: true
|
|
70
|
-
});
|
|
71
|
-
return NgxRepeatDirective;
|
|
72
|
-
}());
|
|
73
|
-
NgxRepeatDirective.decorators = [
|
|
74
|
-
{ type: core.Directive, args: [{
|
|
75
|
-
selector: '[ngxRepeat]'
|
|
76
|
-
},] }
|
|
77
|
-
];
|
|
78
|
-
NgxRepeatDirective.ctorParameters = function () { return [
|
|
79
|
-
{ type: core.TemplateRef },
|
|
80
|
-
{ type: core.ViewContainerRef }
|
|
81
|
-
]; };
|
|
82
|
-
NgxRepeatDirective.propDecorators = {
|
|
83
|
-
ngxRepeat: [{ type: core.Input }]
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
var NgxRepeatModule = /** @class */ (function () {
|
|
87
|
-
function NgxRepeatModule() {
|
|
88
|
-
}
|
|
89
|
-
return NgxRepeatModule;
|
|
90
|
-
}());
|
|
91
|
-
NgxRepeatModule.decorators = [
|
|
92
|
-
{ type: core.NgModule, args: [{
|
|
93
|
-
declarations: [NgxRepeatDirective],
|
|
94
|
-
exports: [NgxRepeatDirective]
|
|
95
|
-
},] }
|
|
96
|
-
];
|
|
97
|
-
|
|
98
|
-
/*
|
|
99
|
-
* Public API Surface of ngx-repeat
|
|
100
|
-
*/
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* Generated bundle index. Do not edit.
|
|
104
|
-
*/
|
|
105
|
-
|
|
106
|
-
exports.NgxRepeatDirective = NgxRepeatDirective;
|
|
107
|
-
exports.NgxRepeatModule = NgxRepeatModule;
|
|
108
|
-
exports.RepeatDirectiveContext = RepeatDirectiveContext;
|
|
109
|
-
|
|
110
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
111
|
-
|
|
112
|
-
})));
|
|
113
|
-
//# sourceMappingURL=ngx-repeat.umd.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ngx-repeat.umd.js","sources":["../../../projects/ngx-repeat/src/lib/ngx-repeat.directive.ts","../../../projects/ngx-repeat/src/lib/ngx-repeat.module.ts","../../../projects/ngx-repeat/src/public-api.ts","../../../projects/ngx-repeat/src/ngx-repeat.ts"],"sourcesContent":["import { Directive, EmbeddedViewRef, Input, TemplateRef, ViewContainerRef } from '@angular/core';\n\n/**\n * @publicApi\n */\nexport class RepeatDirectiveContext {\n constructor(public $implicit: number, public count: number) {}\n\n public get index(): number {\n return this.$implicit;\n }\n\n public get first(): boolean {\n return this.$implicit === 0;\n }\n\n public get last(): boolean {\n return this.index === this.count - 1;\n }\n\n public get even(): boolean {\n return this.$implicit % 2 === 0;\n }\n\n public get odd(): boolean {\n return this.$implicit % 2 === 1;\n }\n}\n\n@Directive({\n selector: '[ngxRepeat]'\n})\nexport class NgxRepeatDirective {\n @Input() public set ngxRepeat(count: number) {\n for (let i = this.viewContainer.length; i > count; i--) this.viewContainer.remove(i - 1);\n\n for (let i = this.viewContainer.length; i < count; i++)\n this.viewContainer.createEmbeddedView(this.templateRef, new RepeatDirectiveContext(i, count));\n\n for (let i = 0; i < this.viewContainer.length; i++) {\n const viewRef = <EmbeddedViewRef<RepeatDirectiveContext>>this.viewContainer.get(i);\n viewRef.context.count = count;\n }\n }\n\n constructor(private templateRef: TemplateRef<RepeatDirectiveContext>, private viewContainer: ViewContainerRef) {}\n}\n","import { NgModule } from '@angular/core';\nimport { NgxRepeatDirective } from './ngx-repeat.directive';\n\n@NgModule({\n declarations: [NgxRepeatDirective],\n exports: [NgxRepeatDirective]\n})\nexport class NgxRepeatModule {}\n","/*\n * Public API Surface of ngx-repeat\n */\n\nexport * from './lib/ngx-repeat.directive';\nexport * from './lib/ngx-repeat.module';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["Directive","TemplateRef","ViewContainerRef","Input","NgModule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C,EAAE,CAAC,GAAG,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;oBAClD,IAAM,OAAO,GAA4C,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;oBACnF,OAAO,CAAC,OAAO,CAAC,KAAK,GAAG,KAAK,CAAC;iBAC/B;aACF;;;WAAA;;;;gBAdFA,cAAS,SAAC;oBACT,QAAQ,EAAE,aAAa;iBACxB;;;gBA/B2CC,gBAAW;gBAAEC,qBAAgB;;;4BAiCtEC,UAAK;;;;QC1BR;;;;;gBAJCC,aAAQ,SAAC;oBACR,YAAY,EAAE,CAAC,kBAAkB,CAAC;oBAClC,OAAO,EAAE,CAAC,kBAAkB,CAAC;iBAC9B;;;ICND;;;;ICAA;;;;;;;;;;;;;;"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core")):"function"==typeof define&&define.amd?define("ngx-repeat",["exports","@angular/core"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["ngx-repeat"]={},e.ng.core)}(this,(function(e,t){"use strict";var n=function(){function e(e,t){this.$implicit=e,this.count=t}return Object.defineProperty(e.prototype,"index",{get:function(){return this.$implicit},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"first",{get:function(){return 0===this.$implicit},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"last",{get:function(){return this.index===this.count-1},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"even",{get:function(){return this.$implicit%2==0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"odd",{get:function(){return this.$implicit%2==1},enumerable:!1,configurable:!0}),e}(),i=function(){function e(e,t){this.templateRef=e,this.viewContainer=t}return Object.defineProperty(e.prototype,"ngxRepeat",{set:function(e){for(var t=this.viewContainer.length;t>e;t--)this.viewContainer.remove(t-1);for(t=this.viewContainer.length;t<e;t++)this.viewContainer.createEmbeddedView(this.templateRef,new n(t,e));for(t=0;t<this.viewContainer.length;t++){this.viewContainer.get(t).context.count=e}},enumerable:!1,configurable:!0}),e}();i.decorators=[{type:t.Directive,args:[{selector:"[ngxRepeat]"}]}],i.ctorParameters=function(){return[{type:t.TemplateRef},{type:t.ViewContainerRef}]},i.propDecorators={ngxRepeat:[{type:t.Input}]};var r=function(){};r.decorators=[{type:t.NgModule,args:[{declarations:[i],exports:[i]}]}],e.NgxRepeatDirective=i,e.NgxRepeatModule=r,e.RepeatDirectiveContext=n,Object.defineProperty(e,"__esModule",{value:!0})}));
|
|
2
|
-
//# sourceMappingURL=ngx-repeat.umd.min.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../projects/ngx-repeat/src/lib/ngx-repeat.directive.ts","../../../projects/ngx-repeat/src/lib/ngx-repeat.module.ts"],"names":["RepeatDirectiveContext","$implicit","count","this","Object","defineProperty","prototype","index","NgxRepeatDirective","templateRef","viewContainer","i","length","remove","createEmbeddedView","get","context","Directive","args","selector","TemplateRef","ViewContainerRef","Input","NgModule","declarations","exports"],"mappings":"wUAME,SAAAA,EAAmBC,EAA0BC,GAA1BC,KAAAF,UAAAA,EAA0BE,KAAAD,MAAAA,SAE7CE,OAAAC,eAAWL,EAAAM,UAAA,QAAK,KAAhB,WACE,OAAOH,KAAKF,2CAGdG,OAAAC,eAAWL,EAAAM,UAAA,QAAK,KAAhB,WACE,OAA0B,IAAnBH,KAAKF,2CAGdG,OAAAC,eAAWL,EAAAM,UAAA,OAAI,KAAf,WACE,OAAOH,KAAKI,QAAUJ,KAAKD,MAAQ,mCAGrCE,OAAAC,eAAWL,EAAAM,UAAA,OAAI,KAAf,WACE,OAAOH,KAAKF,UAAY,GAAM,mCAGhCG,OAAAC,eAAWL,EAAAM,UAAA,MAAG,KAAd,WACE,OAAOH,KAAKF,UAAY,GAAM,qDAoBhC,SAAAO,EAAoBC,EAA0DC,GAA1DP,KAAAM,YAAAA,EAA0DN,KAAAO,cAAAA,SAZ9EN,OAAAC,eAAoBG,EAAAF,UAAA,YAAS,KAA7B,SAA8BJ,GAC5B,IAAK,IAAIS,EAAIR,KAAKO,cAAcE,OAAQD,EAAIT,EAAOS,IAAKR,KAAKO,cAAcG,OAAOF,EAAI,GAEtF,IAASA,EAAIR,KAAKO,cAAcE,OAAQD,EAAIT,EAAOS,IACjDR,KAAKO,cAAcI,mBAAmBX,KAAKM,YAAa,IAAIT,EAAuBW,EAAGT,IAExF,IAASS,EAAI,EAAGA,EAAIR,KAAKO,cAAcE,OAAQD,IAAK,CACOR,KAAKO,cAAcK,IAAIJ,GACxEK,QAAQd,MAAQA,6DAZ7Be,EAAAA,UAASC,KAAA,CAAC,CACTC,SAAU,2DA9BgCC,EAAAA,mBAAaC,EAAAA,uDAiCtDC,EAAAA,eC1BH,iCAJCC,EAAAA,SAAQL,KAAA,CAAC,CACRM,aAAc,CAAChB,GACfiB,QAAS,CAACjB","sourcesContent":["import { Directive, EmbeddedViewRef, Input, TemplateRef, ViewContainerRef } from '@angular/core';\n\n/**\n * @publicApi\n */\nexport class RepeatDirectiveContext {\n constructor(public $implicit: number, public count: number) {}\n\n public get index(): number {\n return this.$implicit;\n }\n\n public get first(): boolean {\n return this.$implicit === 0;\n }\n\n public get last(): boolean {\n return this.index === this.count - 1;\n }\n\n public get even(): boolean {\n return this.$implicit % 2 === 0;\n }\n\n public get odd(): boolean {\n return this.$implicit % 2 === 1;\n }\n}\n\n@Directive({\n selector: '[ngxRepeat]'\n})\nexport class NgxRepeatDirective {\n @Input() public set ngxRepeat(count: number) {\n for (let i = this.viewContainer.length; i > count; i--) this.viewContainer.remove(i - 1);\n\n for (let i = this.viewContainer.length; i < count; i++)\n this.viewContainer.createEmbeddedView(this.templateRef, new RepeatDirectiveContext(i, count));\n\n for (let i = 0; i < this.viewContainer.length; i++) {\n const viewRef = <EmbeddedViewRef<RepeatDirectiveContext>>this.viewContainer.get(i);\n viewRef.context.count = count;\n }\n }\n\n constructor(private templateRef: TemplateRef<RepeatDirectiveContext>, private viewContainer: ViewContainerRef) {}\n}\n","import { NgModule } from '@angular/core';\nimport { NgxRepeatDirective } from './ngx-repeat.directive';\n\n@NgModule({\n declarations: [NgxRepeatDirective],\n exports: [NgxRepeatDirective]\n})\nexport class NgxRepeatModule {}\n"]}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { Directive, Input, TemplateRef, ViewContainerRef } from '@angular/core';
|
|
2
|
-
/**
|
|
3
|
-
* @publicApi
|
|
4
|
-
*/
|
|
5
|
-
export class RepeatDirectiveContext {
|
|
6
|
-
constructor($implicit, count) {
|
|
7
|
-
this.$implicit = $implicit;
|
|
8
|
-
this.count = count;
|
|
9
|
-
}
|
|
10
|
-
get index() {
|
|
11
|
-
return this.$implicit;
|
|
12
|
-
}
|
|
13
|
-
get first() {
|
|
14
|
-
return this.$implicit === 0;
|
|
15
|
-
}
|
|
16
|
-
get last() {
|
|
17
|
-
return this.index === this.count - 1;
|
|
18
|
-
}
|
|
19
|
-
get even() {
|
|
20
|
-
return this.$implicit % 2 === 0;
|
|
21
|
-
}
|
|
22
|
-
get odd() {
|
|
23
|
-
return this.$implicit % 2 === 1;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
export class NgxRepeatDirective {
|
|
27
|
-
constructor(templateRef, viewContainer) {
|
|
28
|
-
this.templateRef = templateRef;
|
|
29
|
-
this.viewContainer = viewContainer;
|
|
30
|
-
}
|
|
31
|
-
set ngxRepeat(count) {
|
|
32
|
-
for (let i = this.viewContainer.length; i > count; i--)
|
|
33
|
-
this.viewContainer.remove(i - 1);
|
|
34
|
-
for (let i = this.viewContainer.length; i < count; i++)
|
|
35
|
-
this.viewContainer.createEmbeddedView(this.templateRef, new RepeatDirectiveContext(i, count));
|
|
36
|
-
for (let i = 0; i < this.viewContainer.length; i++) {
|
|
37
|
-
const viewRef = this.viewContainer.get(i);
|
|
38
|
-
viewRef.context.count = count;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
NgxRepeatDirective.decorators = [
|
|
43
|
-
{ type: Directive, args: [{
|
|
44
|
-
selector: '[ngxRepeat]'
|
|
45
|
-
},] }
|
|
46
|
-
];
|
|
47
|
-
NgxRepeatDirective.ctorParameters = () => [
|
|
48
|
-
{ type: TemplateRef },
|
|
49
|
-
{ type: ViewContainerRef }
|
|
50
|
-
];
|
|
51
|
-
NgxRepeatDirective.propDecorators = {
|
|
52
|
-
ngxRepeat: [{ type: Input }]
|
|
53
|
-
};
|
|
54
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibmd4LXJlcGVhdC5kaXJlY3RpdmUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9wcm9qZWN0cy9uZ3gtcmVwZWF0L3NyYy9saWIvbmd4LXJlcGVhdC5kaXJlY3RpdmUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFNBQVMsRUFBbUIsS0FBSyxFQUFFLFdBQVcsRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLGVBQWUsQ0FBQztBQUVqRzs7R0FFRztBQUNILE1BQU0sT0FBTyxzQkFBc0I7SUFDakMsWUFBbUIsU0FBaUIsRUFBUyxLQUFhO1FBQXZDLGNBQVMsR0FBVCxTQUFTLENBQVE7UUFBUyxVQUFLLEdBQUwsS0FBSyxDQUFRO0lBQUcsQ0FBQztJQUU5RCxJQUFXLEtBQUs7UUFDZCxPQUFPLElBQUksQ0FBQyxTQUFTLENBQUM7SUFDeEIsQ0FBQztJQUVELElBQVcsS0FBSztRQUNkLE9BQU8sSUFBSSxDQUFDLFNBQVMsS0FBSyxDQUFDLENBQUM7SUFDOUIsQ0FBQztJQUVELElBQVcsSUFBSTtRQUNiLE9BQU8sSUFBSSxDQUFDLEtBQUssS0FBSyxJQUFJLENBQUMsS0FBSyxHQUFHLENBQUMsQ0FBQztJQUN2QyxD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1cblxuQERpcmVjdGl2ZSh7XG4gIHNlbGVjdG9yOiAnW25neFJlcGVhdF0nXG59KVxuZXhwb3J0IGNsYXNzIE5neFJlcGVhdERpcmVjdGl2ZSB7XG4gIEBJbnB1dCgpIHB1YmxpYyBzZXQgbmd4UmVwZWF0KGNvdW50OiBudW1iZXIpIHtcbiAgICBmb3IgKGxldCBpID0gdGhpcy52aWV3Q29udGFpbmVyLmxlbmd0aDsgaSA+IGNvdW50OyBpLS0pIHRoaXMudmlld0NvbnRhaW5lci5yZW1vdmUoaSAtIDEpO1xuXG4gICAgZm9yIChsZXQgaSA9IHRoaXMudmlld0NvbnRhaW5lci5sZW5ndGg7IGkgPCBjb3VudDsgaSsrKVxuICAgICAgdGhpcy52aWV3Q29udGFpbmVyLmNyZWF0ZUVtYmVkZGVkVmlldyh0aGlzLnRlbXBsYXRlUmVmLCBuZXcgUmVwZWF0RGlyZWN0aXZlQ29udGV4dChpLCBjb3VudCkpO1xuXG4gICAgZm9yIChsZXQgaSA9IDA7IGkgPCB0aGlzLnZpZXdDb250YWluZXIubGVuZ3RoOyBpKyspIHtcbiAgICAgIGNvbnN0IHZpZXdSZWYgPSA8RW1iZWRkZWRWaWV3UmVmPFJlcGVhdERpcmVjdGl2ZUNvbnRleHQ+PnRoaXMudmlld0NvbnRhaW5lci5nZXQoaSk7XG4gICAgICB2aWV3UmVmLmNvbnRleHQuY291bnQgPSBjb3VudDtcbiAgICB9XG4gIH1cblxuICBjb25zdHJ1Y3Rvcihwcml2YXRlIHRlbXBsYXRlUmVmOiBUZW1wbGF0ZVJlZjxSZXBlYXREaXJlY3RpdmVDb250ZXh0PiwgcHJpdmF0ZSB2aWV3Q29udGFpbmVyOiBWaWV3Q29udGFpbmVyUmVmKSB7fVxufVxuIl19
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { NgModule } from '@angular/core';
|
|
2
|
-
import { NgxRepeatDirective } from './ngx-repeat.directive';
|
|
3
|
-
export class NgxRepeatModule {
|
|
4
|
-
}
|
|
5
|
-
NgxRepeatModule.decorators = [
|
|
6
|
-
{ type: NgModule, args: [{
|
|
7
|
-
declarations: [NgxRepeatDirective],
|
|
8
|
-
exports: [NgxRepeatDirective]
|
|
9
|
-
},] }
|
|
10
|
-
];
|
|
11
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibmd4LXJlcGVhdC5tb2R1bGUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9wcm9qZWN0cy9uZ3gtcmVwZWF0L3NyYy9saWIvbmd4LXJlcGVhdC5tb2R1bGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFFBQVEsRUFBRSxNQUFNLGVBQWUsQ0FBQztBQUN6QyxPQUFPLEVBQUUsa0JBQWtCLEVBQUUsTUFBTSx3QkFBd0IsQ0FBQztBQU01RCxNQUFNLE9BQU8sZUFBZTs7O1lBSjNCLFFBQVEsU0FBQztnQkFDUixZQUFZLEVBQUUsQ0FBQyxrQkFBa0IsQ0FBQztnQkFDbEMsT0FBTyxFQUFFLENBQUMsa0JBQWtCLENBQUM7YUFDOUIiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBOZ01vZHVsZSB9IGZyb20gJ0Bhbmd1bGFyL2NvcmUnO1xuaW1wb3J0IHsgTmd4UmVwZWF0RGlyZWN0aXZlIH0gZnJvbSAnLi9uZ3gtcmVwZWF0LmRpcmVjdGl2ZSc7XG5cbkBOZ01vZHVsZSh7XG4gIGRlY2xhcmF0aW9uczogW05neFJlcGVhdERpcmVjdGl2ZV0sXG4gIGV4cG9ydHM6IFtOZ3hSZXBlYXREaXJlY3RpdmVdXG59KVxuZXhwb3J0IGNsYXNzIE5neFJlcGVhdE1vZHVsZSB7fVxuIl19
|
package/fesm2015/ngx-repeat.js
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { Directive, TemplateRef, ViewContainerRef, Input, NgModule } from '@angular/core';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @publicApi
|
|
5
|
-
*/
|
|
6
|
-
class RepeatDirectiveContext {
|
|
7
|
-
constructor($implicit, count) {
|
|
8
|
-
this.$implicit = $implicit;
|
|
9
|
-
this.count = count;
|
|
10
|
-
}
|
|
11
|
-
get index() {
|
|
12
|
-
return this.$implicit;
|
|
13
|
-
}
|
|
14
|
-
get first() {
|
|
15
|
-
return this.$implicit === 0;
|
|
16
|
-
}
|
|
17
|
-
get last() {
|
|
18
|
-
return this.index === this.count - 1;
|
|
19
|
-
}
|
|
20
|
-
get even() {
|
|
21
|
-
return this.$implicit % 2 === 0;
|
|
22
|
-
}
|
|
23
|
-
get odd() {
|
|
24
|
-
return this.$implicit % 2 === 1;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
class NgxRepeatDirective {
|
|
28
|
-
constructor(templateRef, viewContainer) {
|
|
29
|
-
this.templateRef = templateRef;
|
|
30
|
-
this.viewContainer = viewContainer;
|
|
31
|
-
}
|
|
32
|
-
set ngxRepeat(count) {
|
|
33
|
-
for (let i = this.viewContainer.length; i > count; i--)
|
|
34
|
-
this.viewContainer.remove(i - 1);
|
|
35
|
-
for (let i = this.viewContainer.length; i < count; i++)
|
|
36
|
-
this.viewContainer.createEmbeddedView(this.templateRef, new RepeatDirectiveContext(i, count));
|
|
37
|
-
for (let i = 0; i < this.viewContainer.length; i++) {
|
|
38
|
-
const viewRef = this.viewContainer.get(i);
|
|
39
|
-
viewRef.context.count = count;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
NgxRepeatDirective.decorators = [
|
|
44
|
-
{ type: Directive, args: [{
|
|
45
|
-
selector: '[ngxRepeat]'
|
|
46
|
-
},] }
|
|
47
|
-
];
|
|
48
|
-
NgxRepeatDirective.ctorParameters = () => [
|
|
49
|
-
{ type: TemplateRef },
|
|
50
|
-
{ type: ViewContainerRef }
|
|
51
|
-
];
|
|
52
|
-
NgxRepeatDirective.propDecorators = {
|
|
53
|
-
ngxRepeat: [{ type: Input }]
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
class NgxRepeatModule {
|
|
57
|
-
}
|
|
58
|
-
NgxRepeatModule.decorators = [
|
|
59
|
-
{ type: NgModule, args: [{
|
|
60
|
-
declarations: [NgxRepeatDirective],
|
|
61
|
-
exports: [NgxRepeatDirective]
|
|
62
|
-
},] }
|
|
63
|
-
];
|
|
64
|
-
|
|
65
|
-
/*
|
|
66
|
-
* Public API Surface of ngx-repeat
|
|
67
|
-
*/
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Generated bundle index. Do not edit.
|
|
71
|
-
*/
|
|
72
|
-
|
|
73
|
-
export { NgxRepeatDirective, NgxRepeatModule, RepeatDirectiveContext };
|
|
74
|
-
//# sourceMappingURL=ngx-repeat.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ngx-repeat.js","sources":["../../../projects/ngx-repeat/src/lib/ngx-repeat.directive.ts","../../../projects/ngx-repeat/src/lib/ngx-repeat.module.ts","../../../projects/ngx-repeat/src/public-api.ts","../../../projects/ngx-repeat/src/ngx-repeat.ts"],"sourcesContent":["import { Directive, EmbeddedViewRef, Input, TemplateRef, ViewContainerRef } from '@angular/core';\n\n/**\n * @publicApi\n */\nexport class RepeatDirectiveContext {\n constructor(public $implicit: number, public count: number) {}\n\n public get index(): number {\n return this.$implicit;\n }\n\n public get first(): boolean {\n return this.$implicit === 0;\n }\n\n public get last(): boolean {\n return this.index === this.count - 1;\n }\n\n public get even(): boolean {\n return this.$implicit % 2 === 0;\n }\n\n public get odd(): boolean {\n return this.$implicit % 2 === 1;\n }\n}\n\n@Directive({\n selector: '[ngxRepeat]'\n})\nexport class NgxRepeatDirective {\n @Input() public set ngxRepeat(count: number) {\n for (let i = this.viewContainer.length; i > count; i--) this.viewContainer.remove(i - 1);\n\n for (let i = this.viewContainer.length; i < count; i++)\n this.viewContainer.createEmbeddedView(this.templateRef, new RepeatDirectiveContext(i, count));\n\n for (let i = 0; i < this.viewContainer.length; i++) {\n const viewRef = <EmbeddedViewRef<RepeatDirectiveContext>>this.viewContainer.get(i);\n viewRef.context.count = count;\n }\n }\n\n constructor(private templateRef: TemplateRef<RepeatDirectiveContext>, private viewContainer: ViewContainerRef) {}\n}\n","import { NgModule } from '@angular/core';\nimport { NgxRepeatDirective } from './ngx-repeat.directive';\n\n@NgModule({\n declarations: [NgxRepeatDirective],\n exports: [NgxRepeatDirective]\n})\nexport class NgxRepeatModule {}\n","/*\n * Public API Surface of ngx-repeat\n */\n\nexport * from './lib/ngx-repeat.directive';\nexport * from './lib/ngx-repeat.module';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;AAEA;;;MAGa,sBAAsB;IACjC,YAAmB,SAAiB,EAAS,KAAa;QAAvC,cAAS,GAAT,SAAS,CAAQ;QAAS,UAAK,GAAL,KAAK,CAAQ;KAAI;IAE9D,IAAW,KAAK;QACd,OAAO,IAAI,CAAC,SAAS,CAAC;KACvB;IAED,IAAW,KAAK;QACd,OAAO,IAAI,CAAC,SAAS,KAAK,CAAC,CAAC;KAC7B;IAED,IAAW,IAAI;QACb,OAAO,IAAI,CAAC,KAAK,KAAK,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC;KACtC;IAED,IAAW,IAAI;QACb,OAAO,IAAI,CAAC,SAAS,GAAG,CAAC,KAAK,CAAC,CAAC;KACjC;IAED,IAAW,GAAG;QACZ,OAAO,IAAI,CAAC,SAAS,GAAG,CAAC,KAAK,CAAC,CAAC;KACjC;CACF;MAKY,kBAAkB;IAa7B,YAAoB,WAAgD,EAAU,aAA+B;QAAzF,gBAAW,GAAX,WAAW,CAAqC;QAAU,kBAAa,GAAb,aAAa,CAAkB;KAAI;IAZjH,IAAoB,SAAS,CAAC,KAAa;QACzC,KAAK,IAAI,CAAC,GAAG,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,CAAC,GAAG,KAAK,EAAE,CAAC,EAAE;YAAE,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;QAEzF,KAAK,IAAI,CAAC,GAAG,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,CAAC,GAAG,KAAK,EAAE,CAAC,EAAE;YACpD,IAAI,CAAC,aAAa,CAAC,kBAAkB,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,sBAAsB,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;QAEhG,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YAClD,MAAM,OAAO,GAA4C,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;YACnF,OAAO,CAAC,OAAO,CAAC,KAAK,GAAG,KAAK,CAAC;SAC/B;KACF;;;YAdF,SAAS,SAAC;gBACT,QAAQ,EAAE,aAAa;aACxB;;;YA/B2C,WAAW;YAAE,gBAAgB;;;wBAiCtE,KAAK;;;MC1BK,eAAe;;;YAJ3B,QAAQ,SAAC;gBACR,YAAY,EAAE,CAAC,kBAAkB,CAAC;gBAClC,OAAO,EAAE,CAAC,kBAAkB,CAAC;aAC9B;;;ACND;;;;ACAA;;;;;;"}
|
package/ngx-repeat.metadata.json
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"__symbolic":"module","version":4,"metadata":{"RepeatDirectiveContext":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"number"},{"__symbolic":"reference","name":"number"}]}]}},"NgxRepeatDirective":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive","line":29,"character":1},"arguments":[{"selector":"[ngxRepeat]"}]}],"members":{"ngxRepeat":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":33,"character":3}}]}],"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"TemplateRef","module":"@angular/core","arguments":[{"__symbolic":"reference","name":"RepeatDirectiveContext"}]},{"__symbolic":"reference","module":"@angular/core","name":"ViewContainerRef","line":45,"character":95}]}]}},"NgxRepeatModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":3,"character":1},"arguments":[{"declarations":[{"__symbolic":"reference","name":"NgxRepeatDirective"}],"exports":[{"__symbolic":"reference","name":"NgxRepeatDirective"}]}]}],"members":{}}},"origins":{"RepeatDirectiveContext":"./lib/ngx-repeat.directive","NgxRepeatDirective":"./lib/ngx-repeat.directive","NgxRepeatModule":"./lib/ngx-repeat.module"},"importAs":"ngx-repeat"}
|