ngx-repeat 5.0.2 → 5.0.3

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.
@@ -1,64 +1,89 @@
1
- import * as i0 from '@angular/core';
2
- import { inject, TemplateRef, ViewContainerRef, input, effect, Directive } from '@angular/core';
3
-
4
- /**
5
- * @publicApi
6
- */
7
- class RepeatDirectiveContext {
8
- $implicit;
9
- count;
10
- constructor($implicit, count) {
11
- this.$implicit = $implicit;
12
- this.count = count;
13
- }
14
- get index() {
15
- return this.$implicit;
16
- }
17
- get first() {
18
- return this.$implicit === 0;
19
- }
20
- get last() {
21
- return this.index === this.count - 1;
22
- }
23
- get even() {
24
- return this.$implicit % 2 === 0;
25
- }
26
- get odd() {
27
- return this.$implicit % 2 === 1;
28
- }
29
- }
30
- class NgxRepeatDirective {
31
- templateRef = inject(TemplateRef);
32
- viewContainer = inject(ViewContainerRef);
33
- count = input.required({ ...(ngDevMode ? { debugName: "count" } : /* istanbul ignore next */ {}), alias: 'ngxRepeat' });
34
- constructor() {
35
- effect(() => {
36
- const count = this.count();
37
- for (let i = this.viewContainer.length; i > count; i--)
38
- this.viewContainer.remove(i - 1);
39
- for (let i = this.viewContainer.length; i < count; i++)
40
- this.viewContainer.createEmbeddedView(this.templateRef, new RepeatDirectiveContext(i, count));
41
- for (let i = 0; i < this.viewContainer.length; i++) {
42
- const viewRef = this.viewContainer.get(i);
43
- viewRef.context.count = count;
44
- }
45
- });
46
- }
47
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: NgxRepeatDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
48
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.8", type: NgxRepeatDirective, isStandalone: true, selector: "[ngxRepeat]", inputs: { count: { classPropertyName: "count", publicName: "ngxRepeat", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0 });
49
- }
50
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: NgxRepeatDirective, decorators: [{
51
- type: Directive,
52
- args: [{ selector: '[ngxRepeat]' }]
53
- }], ctorParameters: () => [], propDecorators: { count: [{ type: i0.Input, args: [{ isSignal: true, alias: "ngxRepeat", required: true }] }] } });
54
-
55
- /*
56
- * Public API Surface of ngx-repeat
57
- */
58
-
59
- /**
60
- * Generated bundle index. Do not edit.
61
- */
62
-
1
+ import * as i0 from "@angular/core";
2
+ import { Directive, TemplateRef, ViewContainerRef, effect, inject, input } from "@angular/core";
3
+ var RepeatDirectiveContext = class {
4
+ $implicit;
5
+ count;
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
+ var NgxRepeatDirective = class NgxRepeatDirective {
27
+ templateRef = inject(TemplateRef);
28
+ viewContainer = inject(ViewContainerRef);
29
+ count = input.required({
30
+ ...ngDevMode ? { debugName: "count" } : /* istanbul ignore next */ {},
31
+ alias: "ngxRepeat"
32
+ });
33
+ constructor() {
34
+ effect(() => {
35
+ const count = this.count();
36
+ for (let i = this.viewContainer.length; i > count; i--) this.viewContainer.remove(i - 1);
37
+ for (let i = this.viewContainer.length; i < count; i++) 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
+ static ɵfac = i0.ɵɵngDeclareFactory({
45
+ minVersion: "12.0.0",
46
+ version: "22.2.5",
47
+ ngImport: i0,
48
+ type: NgxRepeatDirective,
49
+ deps: [],
50
+ target: i0.ɵɵFactoryTarget.Directive
51
+ });
52
+ static ɵdir = i0.ɵɵngDeclareDirective({
53
+ minVersion: "17.1.0",
54
+ version: "22.2.5",
55
+ type: NgxRepeatDirective,
56
+ isStandalone: true,
57
+ selector: "[ngxRepeat]",
58
+ inputs: { count: {
59
+ classPropertyName: "count",
60
+ publicName: "ngxRepeat",
61
+ isSignal: true,
62
+ isRequired: true,
63
+ transformFunction: null
64
+ } },
65
+ ngImport: i0
66
+ });
67
+ };
68
+ i0.ɵɵngDeclareClassMetadata({
69
+ minVersion: "12.0.0",
70
+ version: "22.2.5",
71
+ ngImport: i0,
72
+ type: NgxRepeatDirective,
73
+ decorators: [{
74
+ type: Directive,
75
+ args: [{ selector: "[ngxRepeat]" }]
76
+ }],
77
+ ctorParameters: () => [],
78
+ propDecorators: { count: [{
79
+ type: i0.Input,
80
+ args: [{
81
+ isSignal: true,
82
+ alias: "ngxRepeat",
83
+ required: true
84
+ }]
85
+ }] }
86
+ });
63
87
  export { NgxRepeatDirective, RepeatDirectiveContext };
64
- //# sourceMappingURL=ngx-repeat.mjs.map
88
+
89
+ //# sourceMappingURL=ngx-repeat.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"ngx-repeat.mjs","sources":["../../../projects/ngx-repeat/src/lib/ngx-repeat.directive.ts","../../../projects/ngx-repeat/src/public-api.ts","../../../projects/ngx-repeat/src/ngx-repeat.ts"],"sourcesContent":["import { Directive, EmbeddedViewRef, TemplateRef, ViewContainerRef, effect, inject, input } from '@angular/core';\n\n/**\n * @publicApi\n */\nexport class RepeatDirectiveContext {\n constructor(\n public $implicit: number,\n public count: number\n ) {}\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({ selector: '[ngxRepeat]' })\nexport class NgxRepeatDirective {\n private readonly templateRef = inject<TemplateRef<RepeatDirectiveContext>>(TemplateRef);\n private readonly viewContainer = inject(ViewContainerRef);\n public readonly count = input.required<number>({ alias: 'ngxRepeat' });\n\n constructor() {\n effect(() => {\n const count = this.count();\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 = this.viewContainer.get(i) as EmbeddedViewRef<RepeatDirectiveContext>;\n viewRef.context.count = count;\n }\n });\n }\n}\n","/*\n * Public API Surface of ngx-repeat\n */\n\nexport * from './lib/ngx-repeat.directive';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;AAEA;;AAEG;MACU,sBAAsB,CAAA;AAExB,IAAA,SAAA;AACA,IAAA,KAAA;IAFT,WAAA,CACS,SAAiB,EACjB,KAAa,EAAA;QADb,IAAA,CAAA,SAAS,GAAT,SAAS;QACT,IAAA,CAAA,KAAK,GAAL,KAAK;IACX;AAEH,IAAA,IAAW,KAAK,GAAA;QACd,OAAO,IAAI,CAAC,SAAS;IACvB;AAEA,IAAA,IAAW,KAAK,GAAA;AACd,QAAA,OAAO,IAAI,CAAC,SAAS,KAAK,CAAC;IAC7B;AAEA,IAAA,IAAW,IAAI,GAAA;QACb,OAAO,IAAI,CAAC,KAAK,KAAK,IAAI,CAAC,KAAK,GAAG,CAAC;IACtC;AAEA,IAAA,IAAW,IAAI,GAAA;AACb,QAAA,OAAO,IAAI,CAAC,SAAS,GAAG,CAAC,KAAK,CAAC;IACjC;AAEA,IAAA,IAAW,GAAG,GAAA;AACZ,QAAA,OAAO,IAAI,CAAC,SAAS,GAAG,CAAC,KAAK,CAAC;IACjC;AACD;MAGY,kBAAkB,CAAA;AACZ,IAAA,WAAW,GAAG,M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AAA,IAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA;;2FAAlB,kBAAkB,EAAA,UAAA,EAAA,CAAA;kBAD9B,SAAS;mBAAC,EAAE,QAAQ,EAAE,aAAa,EAAE;;;AChCtC;;AAEG;;ACFH;;AAEG;;;;"}
1
+ {"version":3,"file":"ngx-repeat.mjs","names":[],"sources":["../../../projects/ngx-repeat/src/lib/ngx-repeat.directive.ts"],"sourcesContent":["import { Directive, EmbeddedViewRef, TemplateRef, ViewContainerRef, effect, inject, input } from '@angular/core';\n\n/**\n * @publicApi\n */\nexport class RepeatDirectiveContext {\n constructor(\n public $implicit: number,\n public count: number\n ) {}\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({ selector: '[ngxRepeat]' })\nexport class NgxRepeatDirective {\n private readonly templateRef = inject<TemplateRef<RepeatDirectiveContext>>(TemplateRef);\n private readonly viewContainer = inject(ViewContainerRef);\n public readonly count = input.required<number>({ alias: 'ngxRepeat' });\n\n constructor() {\n effect(() => {\n const count = this.count();\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 = this.viewContainer.get(i) as EmbeddedViewRef<RepeatDirectiveContext>;\n viewRef.context.count = count;\n }\n });\n }\n}\n"],"mappings":";;AAKA,IAAa,yBAAb,MAAmC;CAExB;CACA;CAFT,YACS,WACA,OAAa;EADb,KAAA,YAAA;EACA,KAAA,QAAA;CACN;CAEH,IAAW,QAAK;EACd,OAAO,KAAK;CACd;CAEA,I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A,UAAA;CAAA,MAAA;CAAkB,YAAA,CAAA;EAD9B,MAAA;EAAU,MAAA,CAAA,EAAE,UAAU,cAAa,CAAE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ngx-repeat",
3
- "version": "5.0.2",
3
+ "version": "5.0.3",
4
4
  "author": {
5
5
  "name": "Dominik Hladík",
6
6
  "email": "dominik.hladik@seznam.cz",
@@ -1,25 +1,28 @@
1
- import * as i0 from '@angular/core';
2
-
1
+ import * as i0 from "@angular/core";
3
2
  /**
4
3
  * @publicApi
5
4
  */
6
- declare class RepeatDirectiveContext {
7
- $implicit: number;
8
- count: number;
9
- constructor($implicit: number, count: number);
10
- get index(): number;
11
- get first(): boolean;
12
- get last(): boolean;
13
- get even(): boolean;
14
- get odd(): boolean;
5
+ export declare class RepeatDirectiveContext {
6
+ $implicit: number;
7
+ count: number;
8
+ constructor($implicit: number, count: number);
9
+ get index(): number;
10
+ get first(): boolean;
11
+ get last(): boolean;
12
+ get even(): boolean;
13
+ get odd(): boolean;
15
14
  }
16
- declare class NgxRepeatDirective {
17
- private readonly templateRef;
18
- private readonly viewContainer;
19
- readonly count: i0.InputSignal<number>;
20
- constructor();
21
- static ɵfac: i0.ɵɵFactoryDeclaration<NgxRepeatDirective, never>;
22
- static ɵdir: i0.ɵɵDirectiveDeclaration<NgxRepeatDirective, "[ngxRepeat]", never, { "count": { "alias": "ngxRepeat"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
23
- }
24
-
25
- export { NgxRepeatDirective, RepeatDirectiveContext };
15
+ export declare class NgxRepeatDirective {
16
+ private readonly templateRef;
17
+ private readonly viewContainer;
18
+ readonly count: import("@angular/core").InputSignal<number>;
19
+ constructor();
20
+ static ɵfac: i0.ɵɵFactoryDeclaration<NgxRepeatDirective, never>;
21
+ static ɵdir: i0.ɵɵDirectiveDeclaration<NgxRepeatDirective, "[ngxRepeat]", never, {
22
+ "count": {
23
+ "alias": "ngxRepeat";
24
+ "required": true;
25
+ "isSignal": true;
26
+ };
27
+ }, {}, never, never, true, never>;
28
+ }