@rolatech/angular-common 17.1.1 → 17.2.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.
@@ -4,11 +4,11 @@ import { FormsModule, ReactiveFormsModule } from '@angular/forms';
4
4
  import { RouterLink, RouterLinkActive, RouterOutlet } from '@angular/router';
5
5
  import * as i0 from "@angular/core";
6
6
  export class AngularCommonModule {
7
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.1", ngImport: i0, type: AngularCommonModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
8
- static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.1.1", ngImport: i0, type: AngularCommonModule, imports: [CommonModule, RouterLink, RouterLinkActive, RouterOutlet, FormsModule, ReactiveFormsModule], exports: [CommonModule, RouterLink, RouterLinkActive, RouterOutlet, FormsModule, ReactiveFormsModule] });
9
- static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.1.1", ngImport: i0, type: AngularCommonModule, imports: [CommonModule, FormsModule, ReactiveFormsModule, CommonModule, FormsModule, ReactiveFormsModule] });
7
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.0", ngImport: i0, type: AngularCommonModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
8
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.0", ngImport: i0, type: AngularCommonModule, imports: [CommonModule, RouterLink, RouterLinkActive, RouterOutlet, FormsModule, ReactiveFormsModule], exports: [CommonModule, RouterLink, RouterLinkActive, RouterOutlet, FormsModule, ReactiveFormsModule] });
9
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.0", ngImport: i0, type: AngularCommonModule, imports: [CommonModule, FormsModule, ReactiveFormsModule, CommonModule, FormsModule, ReactiveFormsModule] });
10
10
  }
11
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.1", ngImport: i0, type: AngularCommonModule, decorators: [{
11
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.0", ngImport: i0, type: AngularCommonModule, decorators: [{
12
12
  type: NgModule,
13
13
  args: [{
14
14
  imports: [CommonModule, RouterLink, RouterLinkActive, RouterOutlet, FormsModule, ReactiveFormsModule],
@@ -22,10 +22,10 @@ export class DecimalDirective {
22
22
  event.preventDefault();
23
23
  }
24
24
  }
25
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.1", ngImport: i0, type: DecimalDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
26
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.1.1", type: DecimalDirective, isStandalone: true, selector: "[rolatechDecimal]", host: { listeners: { "keydown": "onKeyDown($event)" } }, ngImport: i0 });
25
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.0", ngImport: i0, type: DecimalDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
26
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.3.0", type: DecimalDirective, isStandalone: true, selector: "[rolatechDecimal]", host: { listeners: { "keydown": "onKeyDown($event)" } }, ngImport: i0 });
27
27
  }
28
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.1", ngImport: i0, type: DecimalDirective, decorators: [{
28
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.0", ngImport: i0, type: DecimalDirective, decorators: [{
29
29
  type: Directive,
30
30
  args: [{
31
31
  selector: '[rolatechDecimal]',
@@ -0,0 +1,35 @@
1
+ import { Pipe } from '@angular/core';
2
+ import * as i0 from "@angular/core";
3
+ export class DurationPipe {
4
+ transform(value) {
5
+ if (!value || isNaN(value) || value < 0) {
6
+ return '00:00';
7
+ }
8
+ const hours = Math.floor(value / 3600);
9
+ const minutes = Math.floor((value % 3600) / 60);
10
+ const seconds = Math.floor(value % 60);
11
+ const formattedHours = this.padNumber(hours);
12
+ const formattedMinutes = this.padNumber(minutes);
13
+ const formattedSeconds = this.padNumber(seconds);
14
+ if (formattedHours === '00') {
15
+ return `${formattedMinutes}:${formattedSeconds}`;
16
+ }
17
+ else {
18
+ return `${formattedHours}:${formattedMinutes}:${formattedSeconds}`;
19
+ }
20
+ }
21
+ padNumber(num) {
22
+ return num < 10 ? `0${num}` : `${num}`;
23
+ // return num !== undefined && num !== null && num >= 0 && num < 10 ? `0${num}` : `${num}`;
24
+ }
25
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.0", ngImport: i0, type: DurationPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
26
+ static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "17.3.0", ngImport: i0, type: DurationPipe, isStandalone: true, name: "duration" });
27
+ }
28
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.0", ngImport: i0, type: DurationPipe, decorators: [{
29
+ type: Pipe,
30
+ args: [{
31
+ standalone: true,
32
+ name: 'duration',
33
+ }]
34
+ }] });
35
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZHVyYXRpb24ucGlwZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL2xpYnMvYW5ndWxhci1jb21tb24vc3JjL2xpYi9waXBlcy9kdXJhdGlvbi5waXBlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxJQUFJLEVBQWlCLE1BQU0sZUFBZSxDQUFDOztBQU1wRCxNQUFNLE9BQU8sWUFBWTtJQUN2QixTQUFTLENBQUMsS0FBYTtRQUNyQixJQUFJLENBQUMsS0FBSyxJQUFJLE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GVsc2Uge1xuICAgICAgcmV0dXJuIGAke2Zvcm1hdHRlZEhvdXJzfToke2Zvcm1hdHRlZE1pbnV0ZXN9OiR7Zm9ybWF0dGVkU2Vjb25kc31gO1xuICAgIH1cbiAgfVxuICBwcml2YXRlIHBhZE51bWJlcihudW06IG51bWJlcik6IHN0cmluZyB7XG4gICAgcmV0dXJuIG51bSA8IDEwID8gYDAke251bX1gIDogYCR7bnVtfWA7XG4gICAgLy8gcmV0dXJuIG51bSAhPT0gdW5kZWZpbmVkICYmIG51bSAhPT0gbnVsbCAmJiBudW0gPj0gMCAmJiBudW0gPCAxMCA/IGAwJHtudW19YCA6IGAke251bX1gO1xuICB9XG59XG4iXX0=
@@ -1,5 +1,6 @@
1
1
  import { PrettyjsonPipe } from './prettyjson.pipe';
2
2
  import { TimePipe } from '../pipes/time.pipe';
3
- export { PrettyjsonPipe, TimePipe };
4
- export const COMMON_PIPES = [PrettyjsonPipe, TimePipe];
5
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9saWJzL2FuZ3VsYXItY29tbW9uL3NyYy9saWIvcGlwZXMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLGNBQWMsRUFBRSxNQUFNLG1CQUFtQixDQUFDO0FBQ25ELE9BQU8sRUFBRSxRQUFRLEVBQUUsTUFBTSxvQkFBb0IsQ0FBQztBQUU5QyxPQUFPLEVBQUUsY0FBYyxFQUFFLFFBQVEsRUFBRSxDQUFDO0FBRXBDLE1BQU0sQ0FBQyxNQUFNLFlBQVksR0FBRyxDQUFDLGNBQWMsRUFBRSxRQUFRLENBQUMsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IFByZXR0eWpzb25QaXBlIH0gZnJvbSAnLi9wcmV0dHlqc29uLnBpcGUnO1xuaW1wb3J0IHsgVGltZVBpcGUgfSBmcm9tICcuLi9waXBlcy90aW1lLnBpcGUnO1xuXG5leHBvcnQgeyBQcmV0dHlqc29uUGlwZSwgVGltZVBpcGUgfTtcblxuZXhwb3J0IGNvbnN0IENPTU1PTl9QSVBFUyA9IFtQcmV0dHlqc29uUGlwZSwgVGltZVBpcGVdO1xuIl19
3
+ import { DurationPipe } from './duration.pipe';
4
+ export { PrettyjsonPipe, TimePipe, DurationPipe };
5
+ export const COMMON_PIPES = [PrettyjsonPipe, TimePipe, DurationPipe];
6
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9saWJzL2FuZ3VsYXItY29tbW9uL3NyYy9saWIvcGlwZXMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLGNBQWMsRUFBRSxNQUFNLG1CQUFtQixDQUFDO0FBQ25ELE9BQU8sRUFBRSxRQUFRLEVBQUUsTUFBTSxvQkFBb0IsQ0FBQztBQUM5QyxPQUFPLEVBQUUsWUFBWSxFQUFFLE1BQU0saUJBQWlCLENBQUM7QUFDL0MsT0FBTyxFQUFFLGNBQWMsRUFBRSxRQUFRLEVBQUUsWUFBWSxFQUFFLENBQUM7QUFDbEQsTUFBTSxDQUFDLE1BQU0sWUFBWSxHQUFHLENBQUMsY0FBYyxFQUFFLFFBQVEsRUFBRSxZQUFZLENBQUMsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IFByZXR0eWpzb25QaXBlIH0gZnJvbSAnLi9wcmV0dHlqc29uLnBpcGUnO1xuaW1wb3J0IHsgVGltZVBpcGUgfSBmcm9tICcuLi9waXBlcy90aW1lLnBpcGUnO1xuaW1wb3J0IHsgRHVyYXRpb25QaXBlIH0gZnJvbSAnLi9kdXJhdGlvbi5waXBlJztcbmV4cG9ydCB7IFByZXR0eWpzb25QaXBlLCBUaW1lUGlwZSwgRHVyYXRpb25QaXBlIH07XG5leHBvcnQgY29uc3QgQ09NTU9OX1BJUEVTID0gW1ByZXR0eWpzb25QaXBlLCBUaW1lUGlwZSwgRHVyYXRpb25QaXBlXTtcbiJdfQ==
@@ -9,10 +9,10 @@ export class PrettyjsonPipe {
9
9
  return '{}';
10
10
  }
11
11
  }
12
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.1", ngImport: i0, type: PrettyjsonPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
13
- static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "17.1.1", ngImport: i0, type: PrettyjsonPipe, isStandalone: true, name: "prettyjson" });
12
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.0", ngImport: i0, type: PrettyjsonPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
13
+ static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "17.3.0", ngImport: i0, type: PrettyjsonPipe, isStandalone: true, name: "prettyjson" });
14
14
  }
15
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.1", ngImport: i0, type: PrettyjsonPipe, decorators: [{
15
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.0", ngImport: i0, type: PrettyjsonPipe, decorators: [{
16
16
  type: Pipe,
17
17
  args: [{
18
18
  name: 'prettyjson',
@@ -8,10 +8,10 @@ export class TimePipe {
8
8
  format(date) {
9
9
  return moment(date).fromNow();
10
10
  }
11
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.1", ngImport: i0, type: TimePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
12
- static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "17.1.1", ngImport: i0, type: TimePipe, isStandalone: true, name: "time", pure: false });
11
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.0", ngImport: i0, type: TimePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
12
+ static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "17.3.0", ngImport: i0, type: TimePipe, isStandalone: true, name: "time", pure: false });
13
13
  }
14
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.1", ngImport: i0, type: TimePipe, decorators: [{
14
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.0", ngImport: i0, type: TimePipe, decorators: [{
15
15
  type: Pipe,
16
16
  args: [{ name: 'time', pure: false, standalone: true }]
17
17
  }] });
@@ -7,11 +7,11 @@ import moment from 'moment';
7
7
  import { MAT_SNACK_BAR_DEFAULT_OPTIONS } from '@angular/material/snack-bar';
8
8
 
9
9
  class AngularCommonModule {
10
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.1", ngImport: i0, type: AngularCommonModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
11
- static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.1.1", ngImport: i0, type: AngularCommonModule, imports: [CommonModule, RouterLink, RouterLinkActive, RouterOutlet, FormsModule, ReactiveFormsModule], exports: [CommonModule, RouterLink, RouterLinkActive, RouterOutlet, FormsModule, ReactiveFormsModule] });
12
- static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.1.1", ngImport: i0, type: AngularCommonModule, imports: [CommonModule, FormsModule, ReactiveFormsModule, CommonModule, FormsModule, ReactiveFormsModule] });
10
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.0", ngImport: i0, type: AngularCommonModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
11
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.0", ngImport: i0, type: AngularCommonModule, imports: [CommonModule, RouterLink, RouterLinkActive, RouterOutlet, FormsModule, ReactiveFormsModule], exports: [CommonModule, RouterLink, RouterLinkActive, RouterOutlet, FormsModule, ReactiveFormsModule] });
12
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.0", ngImport: i0, type: AngularCommonModule, imports: [CommonModule, FormsModule, ReactiveFormsModule, CommonModule, FormsModule, ReactiveFormsModule] });
13
13
  }
14
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.1", ngImport: i0, type: AngularCommonModule, decorators: [{
14
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.0", ngImport: i0, type: AngularCommonModule, decorators: [{
15
15
  type: NgModule,
16
16
  args: [{
17
17
  imports: [CommonModule, RouterLink, RouterLinkActive, RouterOutlet, FormsModule, ReactiveFormsModule],
@@ -35,10 +35,10 @@ class PrettyjsonPipe {
35
35
  return '{}';
36
36
  }
37
37
  }
38
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.1", ngImport: i0, type: PrettyjsonPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
39
- static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "17.1.1", ngImport: i0, type: PrettyjsonPipe, isStandalone: true, name: "prettyjson" });
38
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.0", ngImport: i0, type: PrettyjsonPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
39
+ static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "17.3.0", ngImport: i0, type: PrettyjsonPipe, isStandalone: true, name: "prettyjson" });
40
40
  }
41
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.1", ngImport: i0, type: PrettyjsonPipe, decorators: [{
41
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.0", ngImport: i0, type: PrettyjsonPipe, decorators: [{
42
42
  type: Pipe,
43
43
  args: [{
44
44
  name: 'prettyjson',
@@ -53,15 +53,48 @@ class TimePipe {
53
53
  format(date) {
54
54
  return moment(date).fromNow();
55
55
  }
56
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.1", ngImport: i0, type: TimePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
57
- static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "17.1.1", ngImport: i0, type: TimePipe, isStandalone: true, name: "time", pure: false });
56
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.0", ngImport: i0, type: TimePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
57
+ static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "17.3.0", ngImport: i0, type: TimePipe, isStandalone: true, name: "time", pure: false });
58
58
  }
59
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.1", ngImport: i0, type: TimePipe, decorators: [{
59
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.0", ngImport: i0, type: TimePipe, decorators: [{
60
60
  type: Pipe,
61
61
  args: [{ name: 'time', pure: false, standalone: true }]
62
62
  }] });
63
63
 
64
- const COMMON_PIPES = [PrettyjsonPipe, TimePipe];
64
+ class DurationPipe {
65
+ transform(value) {
66
+ if (!value || isNaN(value) || value < 0) {
67
+ return '00:00';
68
+ }
69
+ const hours = Math.floor(value / 3600);
70
+ const minutes = Math.floor((value % 3600) / 60);
71
+ const seconds = Math.floor(value % 60);
72
+ const formattedHours = this.padNumber(hours);
73
+ const formattedMinutes = this.padNumber(minutes);
74
+ const formattedSeconds = this.padNumber(seconds);
75
+ if (formattedHours === '00') {
76
+ return `${formattedMinutes}:${formattedSeconds}`;
77
+ }
78
+ else {
79
+ return `${formattedHours}:${formattedMinutes}:${formattedSeconds}`;
80
+ }
81
+ }
82
+ padNumber(num) {
83
+ return num < 10 ? `0${num}` : `${num}`;
84
+ // return num !== undefined && num !== null && num >= 0 && num < 10 ? `0${num}` : `${num}`;
85
+ }
86
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.0", ngImport: i0, type: DurationPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
87
+ static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "17.3.0", ngImport: i0, type: DurationPipe, isStandalone: true, name: "duration" });
88
+ }
89
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.0", ngImport: i0, type: DurationPipe, decorators: [{
90
+ type: Pipe,
91
+ args: [{
92
+ standalone: true,
93
+ name: 'duration',
94
+ }]
95
+ }] });
96
+
97
+ const COMMON_PIPES = [PrettyjsonPipe, TimePipe, DurationPipe];
65
98
 
66
99
  class DecimalDirective {
67
100
  el;
@@ -85,10 +118,10 @@ class DecimalDirective {
85
118
  event.preventDefault();
86
119
  }
87
120
  }
88
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.1", ngImport: i0, type: DecimalDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
89
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.1.1", type: DecimalDirective, isStandalone: true, selector: "[rolatechDecimal]", host: { listeners: { "keydown": "onKeyDown($event)" } }, ngImport: i0 });
121
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.0", ngImport: i0, type: DecimalDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
122
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.3.0", type: DecimalDirective, isStandalone: true, selector: "[rolatechDecimal]", host: { listeners: { "keydown": "onKeyDown($event)" } }, ngImport: i0 });
90
123
  }
91
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.1", ngImport: i0, type: DecimalDirective, decorators: [{
124
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.0", ngImport: i0, type: DecimalDirective, decorators: [{
92
125
  type: Directive,
93
126
  args: [{
94
127
  selector: '[rolatechDecimal]',
@@ -146,5 +179,5 @@ function provideAngularCommon(environment) {
146
179
  * Generated bundle index. Do not edit.
147
180
  */
148
181
 
149
- export { APP_CONFIG, AngularCommonModule, AppConfig, COMMON_DIRECTIVES, COMMON_PIPES, DecimalDirective, PrettyjsonPipe, REQUEST, RESPONSE, TimePipe, UserStatus, WINDOW, provideAngularCommon };
182
+ export { APP_CONFIG, AngularCommonModule, AppConfig, COMMON_DIRECTIVES, COMMON_PIPES, DecimalDirective, DurationPipe, PrettyjsonPipe, REQUEST, RESPONSE, TimePipe, UserStatus, WINDOW, provideAngularCommon };
150
183
  //# sourceMappingURL=rolatech-angular-common.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"rolatech-angular-common.mjs","sources":["../../../../libs/angular-common/src/lib/angular-common.module.ts","../../../../libs/angular-common/src/lib/interfaces/auth.interface.ts","../../../../libs/angular-common/src/lib/pipes/prettyjson.pipe.ts","../../../../libs/angular-common/src/lib/pipes/time.pipe.ts","../../../../libs/angular-common/src/lib/pipes/index.ts","../../../../libs/angular-common/src/lib/directive/decimal.directive.ts","../../../../libs/angular-common/src/lib/directive/index.ts","../../../../libs/angular-common/src/lib/tokens.ts","../../../../libs/angular-common/src/provider.ts","../../../../libs/angular-common/src/rolatech-angular-common.ts"],"sourcesContent":["import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { FormsModule, ReactiveFormsModule } from '@angular/forms';\nimport { RouterLink, RouterLinkActive, RouterOutlet } from '@angular/router';\n\n@NgModule({\n imports: [CommonModule, RouterLink, RouterLinkActive, RouterOutlet, FormsModule, ReactiveFormsModule],\n exports: [CommonModule, RouterLink, RouterLinkActive, RouterOutlet, FormsModule, ReactiveFormsModule],\n})\nexport class AngularCommonModule {}\n","export interface User {\n id?: string;\n username?: string;\n roles: [];\n}\nexport interface PasswordChange {\n oldPassword: string;\n newPassword: string;\n ne2Password: string;\n}\nexport enum UserStatus {\n ACTIVE = '正常',\n AWAITING = '审核中',\n DELETED = '已删除',\n}\n","import { Pipe, PipeTransform } from '@angular/core';\n\n@Pipe({\n name: 'prettyjson',\n standalone: true,\n})\nexport class PrettyjsonPipe implements PipeTransform {\n transform(value: any, ...args: any[]): any {\n if (value) {\n return JSON.stringify(value, null, 4).replace(/ /g, '&nbsp;').replace(/\\n/g, '<br/>');\n } else {\n return '{}';\n }\n }\n}\n","import { Pipe, PipeTransform } from '@angular/core';\nimport moment from 'moment';\n\n@Pipe({ name: 'time', pure: false, standalone: true })\nexport class TimePipe implements PipeTransform {\n transform(date: string): string {\n return this.format(Date.parse(date));\n }\n\n format(date: number) {\n return moment(date).fromNow();\n }\n}\n","import { PrettyjsonPipe } from './prettyjson.pipe';\nimport { TimePipe } from '../pipes/time.pipe';\n\nexport { PrettyjsonPipe, TimePipe };\n\nexport const COMMON_PIPES = [PrettyjsonPipe, TimePipe];\n","import { Directive, ElementRef, HostListener } from '@angular/core';\n\n@Directive({\n selector: '[rolatechDecimal]',\n standalone: true,\n})\nexport class DecimalDirective {\n private regex = new RegExp(/^\\d*\\.?\\d{0,2}$/g);\n\n // Allow decimal numbers and negative values\n // Allow key codes for special events. Reflect :\n // Backspace, tab, end, home\n private specialKeys: Array<string> = ['Backspace', 'Tab', 'End', 'Home', 'ArrowLeft', 'ArrowRight', 'Del', 'Delete'];\n\n constructor(private el: ElementRef) {}\n @HostListener('keydown', ['$event'])\n onKeyDown(event: KeyboardEvent) {\n // Allow Backspace, tab, end, and home keys\n if (this.specialKeys.indexOf(event.key) !== -1) {\n return;\n }\n const current: string = this.el.nativeElement.value;\n const position = this.el.nativeElement.selectionStart;\n const next: string = [current.slice(0, position), event.key == 'Decimal' ? '.' : event.key, current.slice(position)].join(\n ''\n );\n if (next && !String(next).match(this.regex)) {\n event.preventDefault();\n }\n }\n}\n","import { Provider } from '@angular/core';\nimport { DecimalDirective } from './decimal.directive';\n\nexport { DecimalDirective };\n\nexport const COMMON_DIRECTIVES: Provider[] = [DecimalDirective];\n","import { InjectionToken, PLATFORM_ID, inject } from '@angular/core';\nimport { Request, Response } from 'express';\nexport class AppConfig {\n baseUrl = '';\n clientId = '';\n cookieName = 'SID';\n accountsUrl = 'http://localhost:9101';\n myaccountUrl = 'http://localhost:9301';\n www = '';\n}\nexport const APP_CONFIG = new InjectionToken<AppConfig | any>('@rolatech/angular-common config');\n\nexport const REQUEST = new InjectionToken<Request>('REQUEST');\nexport const RESPONSE = new InjectionToken<Response>('RESPONSE');\n\nexport const WINDOW = new InjectionToken<Window>('@rolatech/angular-common global Window object', {\n providedIn: 'root',\n factory: () => {\n const platform = inject(PLATFORM_ID);\n return platform === 'browser' ? window : ({} as Window);\n },\n});\n","import { APP_ID, EnvironmentProviders, Provider, importProvidersFrom, makeEnvironmentProviders } from '@angular/core';\nimport { MAT_SNACK_BAR_DEFAULT_OPTIONS } from '@angular/material/snack-bar';\nimport { APP_CONFIG } from './lib/tokens';\nimport { FormsModule, ReactiveFormsModule } from '@angular/forms';\nimport { COMMON_PIPES } from './lib/pipes';\nimport { COMMON_DIRECTIVES } from './lib/directive';\nimport { CommonModule, IMAGE_CONFIG } from '@angular/common';\nimport { RouterModule } from '@angular/router';\n\nexport function provideAngularCommon(environment?: any): EnvironmentProviders {\n const providers: (Provider | EnvironmentProviders)[] = [\n ...COMMON_PIPES,\n ...COMMON_DIRECTIVES,\n {\n provide: APP_CONFIG,\n useValue: environment,\n },\n {\n provide: IMAGE_CONFIG,\n useValue: {\n disableImageSizeWarning: true,\n disableImageLazyLoadWarning: true,\n },\n },\n { provide: APP_ID, useValue: 'serverApp' },\n { provide: MAT_SNACK_BAR_DEFAULT_OPTIONS, useValue: { duration: 2000 } },\n importProvidersFrom(CommonModule, ReactiveFormsModule, FormsModule, RouterModule),\n ];\n return makeEnvironmentProviders(providers);\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;MASa,mBAAmB,CAAA;uGAAnB,mBAAmB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;wGAAnB,mBAAmB,EAAA,OAAA,EAAA,CAHpB,YAAY,EAAE,UAAU,EAAE,gBAAgB,EAAE,YAAY,EAAE,WAAW,EAAE,mBAAmB,CAC1F,EAAA,OAAA,EAAA,CAAA,YAAY,EAAE,UAAU,EAAE,gBAAgB,EAAE,YAAY,EAAE,WAAW,EAAE,mBAAmB,CAAA,EAAA,CAAA,CAAA;wGAEzF,mBAAmB,EAAA,OAAA,EAAA,CAHpB,YAAY,EAA8C,WAAW,EAAE,mBAAmB,EAC1F,YAAY,EAA8C,WAAW,EAAE,mBAAmB,CAAA,EAAA,CAAA,CAAA;;2FAEzF,mBAAmB,EAAA,UAAA,EAAA,CAAA;kBAJ/B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,OAAO,EAAE,CAAC,YAAY,EAAE,UAAU,EAAE,gBAAgB,EAAE,YAAY,EAAE,WAAW,EAAE,mBAAmB,CAAC;AACrG,oBAAA,OAAO,EAAE,CAAC,YAAY,EAAE,UAAU,EAAE,gBAAgB,EAAE,YAAY,EAAE,WAAW,EAAE,mBAAmB,CAAC;AACtG,iBAAA,CAAA;;;ICEW,WAIX;AAJD,CAAA,UAAY,UAAU,EAAA;AACpB,IAAA,UAAA,CAAA,QAAA,CAAA,GAAA,cAAa,CAAA;AACb,IAAA,UAAA,CAAA,UAAA,CAAA,GAAA,oBAAgB,CAAA;AAChB,IAAA,UAAA,CAAA,SAAA,CAAA,GAAA,oBAAe,CAAA;AACjB,CAAC,EAJW,UAAU,KAAV,UAAU,GAIrB,EAAA,CAAA,CAA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Y;AACf,QAAA,GAAG,iBAAiB;AACpB,QAAA;AACE,YAAA,OAAO,EAAE,UAAU;AACnB,YAAA,QAAQ,EAAE,WAAW;AACtB,SAAA;AACD,QAAA;AACE,YAAA,OAAO,EAAE,YAAY;AACrB,YAAA,QAAQ,EAAE;AACR,gBAAA,uBAAuB,EAAE,IAAI;AAC7B,gBAAA,2BAA2B,EAAE,IAAI;AAClC,aAAA;AACF,SAAA;AACD,QAAA,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE;QAC1C,EAAE,OAAO,EAAE,6BAA6B,EAAE,QAAQ,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE;QACxE,mBAAmB,CAAC,YAAY,EAAE,mBAAmB,EAAE,WAAW,EAAE,YAAY,CAAC;KAClF,CAAC;AACF,IAAA,OAAO,wBAAwB,CAAC,SAAS,CAAC,CAAC;AAC7C;;AC7BA;;AAEG;;;;"}
1
+ {"version":3,"file":"rolatech-angular-common.mjs","sources":["../../../../libs/angular-common/src/lib/angular-common.module.ts","../../../../libs/angular-common/src/lib/interfaces/auth.interface.ts","../../../../libs/angular-common/src/lib/pipes/prettyjson.pipe.ts","../../../../libs/angular-common/src/lib/pipes/time.pipe.ts","../../../../libs/angular-common/src/lib/pipes/duration.pipe.ts","../../../../libs/angular-common/src/lib/pipes/index.ts","../../../../libs/angular-common/src/lib/directive/decimal.directive.ts","../../../../libs/angular-common/src/lib/directive/index.ts","../../../../libs/angular-common/src/lib/tokens.ts","../../../../libs/angular-common/src/provider.ts","../../../../libs/angular-common/src/rolatech-angular-common.ts"],"sourcesContent":["import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { FormsModule, ReactiveFormsModule } from '@angular/forms';\nimport { RouterLink, RouterLinkActive, RouterOutlet } from '@angular/router';\n\n@NgModule({\n imports: [CommonModule, RouterLink, RouterLinkActive, RouterOutlet, FormsModule, ReactiveFormsModule],\n exports: [CommonModule, RouterLink, RouterLinkActive, RouterOutlet, FormsModule, ReactiveFormsModule],\n})\nexport class AngularCommonModule {}\n","export interface User {\n id?: string;\n username?: string;\n roles: [];\n}\nexport interface PasswordChange {\n oldPassword: string;\n newPassword: string;\n ne2Password: string;\n}\nexport enum UserStatus {\n ACTIVE = '正常',\n AWAITING = '审核中',\n DELETED = '已删除',\n}\n","import { Pipe, PipeTransform } from '@angular/core';\n\n@Pipe({\n name: 'prettyjson',\n standalone: true,\n})\nexport class PrettyjsonPipe implements PipeTransform {\n transform(value: any, ...args: any[]): any {\n if (value) {\n return JSON.stringify(value, null, 4).replace(/ /g, '&nbsp;').replace(/\\n/g, '<br/>');\n } else {\n return '{}';\n }\n }\n}\n","import { Pipe, PipeTransform } from '@angular/core';\nimport moment from 'moment';\n\n@Pipe({ name: 'time', pure: false, standalone: true })\nexport class TimePipe implements PipeTransform {\n transform(date: string): string {\n return this.format(Date.parse(date));\n }\n\n format(date: number) {\n return moment(date).fromNow();\n }\n}\n","import { Pipe, PipeTransform } from '@angular/core';\n\n@Pipe({\n standalone: true,\n name: 'duration',\n})\nexport class DurationPipe implements PipeTransform {\n transform(value: number): string {\n if (!value || isNaN(value) || value < 0) {\n return '00:00';\n }\n const hours = Math.floor(value / 3600);\n const minutes = Math.floor((value % 3600) / 60);\n const seconds = Math.floor(value % 60);\n\n const formattedHours = this.padNumber(hours);\n const formattedMinutes = this.padNumber(minutes);\n const formattedSeconds = this.padNumber(seconds);\n if (formattedHours === '00') {\n return `${formattedMinutes}:${formattedSeconds}`;\n } else {\n return `${formattedHours}:${formattedMinutes}:${formattedSeconds}`;\n }\n }\n private padNumber(num: number): string {\n return num < 10 ? `0${num}` : `${num}`;\n // return num !== undefined && num !== null && num >= 0 && num < 10 ? `0${num}` : `${num}`;\n }\n}\n","import { PrettyjsonPipe } from './prettyjson.pipe';\nimport { TimePipe } from '../pipes/time.pipe';\nimport { DurationPipe } from './duration.pipe';\nexport { PrettyjsonPipe, TimePipe, DurationPipe };\nexport const COMMON_PIPES = [PrettyjsonPipe, TimePipe, DurationPipe];\n","import { Directive, ElementRef, HostListener } from '@angular/core';\n\n@Directive({\n selector: '[rolatechDecimal]',\n standalone: true,\n})\nexport class DecimalDirective {\n private regex = new RegExp(/^\\d*\\.?\\d{0,2}$/g);\n\n // Allow decimal numbers and negative values\n // Allow key codes for special events. Reflect :\n // Backspace, tab, end, home\n private specialKeys: Array<string> = ['Backspace', 'Tab', 'End', 'Home', 'ArrowLeft', 'ArrowRight', 'Del', 'Delete'];\n\n constructor(private el: ElementRef) {}\n @HostListener('keydown', ['$event'])\n onKeyDown(event: KeyboardEvent) {\n // Allow Backspace, tab, end, and home keys\n if (this.specialKeys.indexOf(event.key) !== -1) {\n return;\n }\n const current: string = this.el.nativeElement.value;\n const position = this.el.nativeElement.selectionStart;\n const next: string = [current.slice(0, position), event.key == 'Decimal' ? '.' : event.key, current.slice(position)].join(\n ''\n );\n if (next && !String(next).match(this.regex)) {\n event.preventDefault();\n }\n }\n}\n","import { Provider } from '@angular/core';\nimport { DecimalDirective } from './decimal.directive';\n\nexport { DecimalDirective };\n\nexport const COMMON_DIRECTIVES: Provider[] = [DecimalDirective];\n","import { InjectionToken, PLATFORM_ID, inject } from '@angular/core';\nimport { Request, Response } from 'express';\nexport class AppConfig {\n baseUrl = '';\n clientId = '';\n cookieName = 'SID';\n accountsUrl = 'http://localhost:9101';\n myaccountUrl = 'http://localhost:9301';\n www = '';\n}\nexport const APP_CONFIG = new InjectionToken<AppConfig | any>('@rolatech/angular-common config');\n\nexport const REQUEST = new InjectionToken<Request>('REQUEST');\nexport const RESPONSE = new InjectionToken<Response>('RESPONSE');\n\nexport const WINDOW = new InjectionToken<Window>('@rolatech/angular-common global Window object', {\n providedIn: 'root',\n factory: () => {\n const platform = inject(PLATFORM_ID);\n return platform === 'browser' ? window : ({} as Window);\n },\n});\n","import { APP_ID, EnvironmentProviders, Provider, importProvidersFrom, makeEnvironmentProviders } from '@angular/core';\nimport { MAT_SNACK_BAR_DEFAULT_OPTIONS } from '@angular/material/snack-bar';\nimport { APP_CONFIG } from './lib/tokens';\nimport { FormsModule, ReactiveFormsModule } from '@angular/forms';\nimport { COMMON_PIPES } from './lib/pipes';\nimport { COMMON_DIRECTIVES } from './lib/directive';\nimport { CommonModule, IMAGE_CONFIG } from '@angular/common';\nimport { RouterModule } from '@angular/router';\n\nexport function provideAngularCommon(environment?: any): EnvironmentProviders {\n const providers: (Provider | EnvironmentProviders)[] = [\n ...COMMON_PIPES,\n ...COMMON_DIRECTIVES,\n {\n provide: APP_CONFIG,\n useValue: environment,\n },\n {\n provide: IMAGE_CONFIG,\n useValue: {\n disableImageSizeWarning: true,\n disableImageLazyLoadWarning: true,\n },\n },\n { provide: APP_ID, useValue: 'serverApp' },\n { provide: MAT_SNACK_BAR_DEFAULT_OPTIONS, useValue: { duration: 2000 } },\n importProvidersFrom(CommonModule, ReactiveFormsModule, FormsModule, RouterModule),\n ];\n return makeEnvironmentProviders(providers);\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;MASa,mBAAmB,CAAA;uGAAnB,mBAAmB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;wGAAnB,mBAAmB,EAAA,OAAA,EAAA,CAHpB,YAAY,EAAE,UAAU,EAAE,gBAAgB,EAAE,YAAY,EAAE,WAAW,EAAE,mBAAmB,CAC1F,EAAA,OAAA,EAAA,CAAA,YAAY,EAAE,UAAU,EAAE,gBAAgB,EAAE,YAAY,EAAE,WAAW,EAAE,mBAAmB,CAAA,EAAA,CAAA,CAAA;wGAEzF,mBAAmB,EAAA,OAAA,EAAA,CAHpB,YAAY,EAA8C,WAAW,EAAE,mBAAmB,EAC1F,YAAY,EAA8C,WAAW,EAAE,mBAAmB,CAAA,EAAA,CAAA,CAAA;;2FAEzF,mBAAmB,EAAA,UAAA,EAAA,CAAA;kBAJ/B,QAAQ;AAA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BAAwB,CAAC,SAAS,CAAC,CAAC;AAC7C;;AC7BA;;AAEG;;;;"}
@@ -0,0 +1,8 @@
1
+ import { PipeTransform } from '@angular/core';
2
+ import * as i0 from "@angular/core";
3
+ export declare class DurationPipe implements PipeTransform {
4
+ transform(value: number): string;
5
+ private padNumber;
6
+ static ɵfac: i0.ɵɵFactoryDeclaration<DurationPipe, never>;
7
+ static ɵpipe: i0.ɵɵPipeDeclaration<DurationPipe, "duration", true>;
8
+ }
@@ -1,4 +1,5 @@
1
1
  import { PrettyjsonPipe } from './prettyjson.pipe';
2
2
  import { TimePipe } from '../pipes/time.pipe';
3
- export { PrettyjsonPipe, TimePipe };
3
+ import { DurationPipe } from './duration.pipe';
4
+ export { PrettyjsonPipe, TimePipe, DurationPipe };
4
5
  export declare const COMMON_PIPES: (typeof PrettyjsonPipe)[];
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@rolatech/angular-common",
3
- "version": "17.1.1",
3
+ "version": "17.2.1",
4
4
  "peerDependencies": {
5
- "@angular/common": "^17.0.0",
6
- "@angular/core": "^17.0.0"
5
+ "@angular/common": "^17.2.0",
6
+ "@angular/core": "^17.2.0"
7
7
  },
8
8
  "dependencies": {
9
9
  "tslib": "^2.5.0"