@rolatech/angular-common 17.2.1 → 17.2.2
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/esm2022/index.mjs +2 -2
- package/esm2022/lib/angular-common.module.mjs +4 -4
- package/esm2022/lib/directive/decimal.directive.mjs +3 -3
- package/esm2022/lib/pipes/duration.pipe.mjs +3 -3
- package/esm2022/lib/pipes/prettyjson.pipe.mjs +3 -3
- package/esm2022/lib/pipes/time.pipe.mjs +3 -3
- package/esm2022/lib/tokens.mjs +1 -9
- package/fesm2022/rolatech-angular-common.mjs +17 -25
- package/fesm2022/rolatech-angular-common.mjs.map +1 -1
- package/lib/tokens.d.ts +6 -1
- package/package.json +4 -4
package/esm2022/index.mjs
CHANGED
|
@@ -4,5 +4,5 @@ export * from './lib/interfaces/media.interface';
|
|
|
4
4
|
export * from './lib/pipes/index';
|
|
5
5
|
export * from './lib/directive/index';
|
|
6
6
|
export * from './provider';
|
|
7
|
-
export {
|
|
8
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
7
|
+
export { APP_CONFIG, REQUEST, RESPONSE, WINDOW } from './lib/tokens';
|
|
8
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9saWJzL2FuZ3VsYXItY29tbW9uL3NyYy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxjQUFjLDZCQUE2QixDQUFDO0FBQzVDLGNBQWMsaUNBQWlDLENBQUM7QUFDaEQsY0FBYyxrQ0FBa0MsQ0FBQztBQUNqRCxjQUFjLG1CQUFtQixDQUFDO0FBQ2xDLGNBQWMsdUJBQXVCLENBQUM7QUFDdEMsY0FBYyxZQUFZLENBQUM7QUFDM0IsT0FBTyxFQUFhLFVBQVUsRUFBRSxPQUFPLEVBQUUsUUFBUSxFQUFFLE1BQU0sRUFBRSxNQUFNLGNBQWMsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCAqIGZyb20gJy4vbGliL2FuZ3VsYXItY29tbW9uLm1vZHVsZSc7XG5leHBvcnQgKiBmcm9tICcuL2xpYi9pbnRlcmZhY2VzL2F1dGguaW50ZXJmYWNlJztcbmV4cG9ydCAqIGZyb20gJy4vbGliL2ludGVyZmFjZXMvbWVkaWEuaW50ZXJmYWNlJztcbmV4cG9ydCAqIGZyb20gJy4vbGliL3BpcGVzL2luZGV4JztcbmV4cG9ydCAqIGZyb20gJy4vbGliL2RpcmVjdGl2ZS9pbmRleCc7XG5leHBvcnQgKiBmcm9tICcuL3Byb3ZpZGVyJztcbmV4cG9ydCB7IEFwcENvbmZpZywgQVBQX0NPTkZJRywgUkVRVUVTVCwgUkVTUE9OU0UsIFdJTkRPVyB9IGZyb20gJy4vbGliL3Rva2Vucyc7XG4iXX0=
|
|
@@ -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: "
|
|
8
|
-
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "
|
|
9
|
-
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
|
|
7
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: AngularCommonModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
8
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.0.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: "18.0.1", ngImport: i0, type: AngularCommonModule, imports: [CommonModule, FormsModule, ReactiveFormsModule, CommonModule, FormsModule, ReactiveFormsModule] });
|
|
10
10
|
}
|
|
11
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
11
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.1", 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: "
|
|
26
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
25
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: DecimalDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
26
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.0.1", type: DecimalDirective, isStandalone: true, selector: "[rolatechDecimal]", host: { listeners: { "keydown": "onKeyDown($event)" } }, ngImport: i0 });
|
|
27
27
|
}
|
|
28
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
28
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: DecimalDirective, decorators: [{
|
|
29
29
|
type: Directive,
|
|
30
30
|
args: [{
|
|
31
31
|
selector: '[rolatechDecimal]',
|
|
@@ -22,10 +22,10 @@ export class DurationPipe {
|
|
|
22
22
|
return num < 10 ? `0${num}` : `${num}`;
|
|
23
23
|
// return num !== undefined && num !== null && num >= 0 && num < 10 ? `0${num}` : `${num}`;
|
|
24
24
|
}
|
|
25
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
26
|
-
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "
|
|
25
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: DurationPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
26
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.0.1", ngImport: i0, type: DurationPipe, isStandalone: true, name: "duration" });
|
|
27
27
|
}
|
|
28
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
28
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: DurationPipe, decorators: [{
|
|
29
29
|
type: Pipe,
|
|
30
30
|
args: [{
|
|
31
31
|
standalone: true,
|
|
@@ -9,10 +9,10 @@ export class PrettyjsonPipe {
|
|
|
9
9
|
return '{}';
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
13
|
-
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "
|
|
12
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: PrettyjsonPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
13
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.0.1", ngImport: i0, type: PrettyjsonPipe, isStandalone: true, name: "prettyjson" });
|
|
14
14
|
}
|
|
15
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
15
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.1", 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: "
|
|
12
|
-
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "
|
|
11
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: TimePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
12
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.0.1", ngImport: i0, type: TimePipe, isStandalone: true, name: "time", pure: false });
|
|
13
13
|
}
|
|
14
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
14
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: TimePipe, decorators: [{
|
|
15
15
|
type: Pipe,
|
|
16
16
|
args: [{ name: 'time', pure: false, standalone: true }]
|
|
17
17
|
}] });
|
package/esm2022/lib/tokens.mjs
CHANGED
|
@@ -1,12 +1,4 @@
|
|
|
1
1
|
import { InjectionToken, PLATFORM_ID, inject } from '@angular/core';
|
|
2
|
-
export class AppConfig {
|
|
3
|
-
baseUrl = '';
|
|
4
|
-
clientId = '';
|
|
5
|
-
cookieName = 'SID';
|
|
6
|
-
accountsUrl = 'http://localhost:9101';
|
|
7
|
-
myaccountUrl = 'http://localhost:9301';
|
|
8
|
-
www = '';
|
|
9
|
-
}
|
|
10
2
|
export const APP_CONFIG = new InjectionToken('@rolatech/angular-common config');
|
|
11
3
|
export const REQUEST = new InjectionToken('REQUEST');
|
|
12
4
|
export const RESPONSE = new InjectionToken('RESPONSE');
|
|
@@ -17,4 +9,4 @@ export const WINDOW = new InjectionToken('@rolatech/angular-common global Window
|
|
|
17
9
|
return platform === 'browser' ? window : {};
|
|
18
10
|
},
|
|
19
11
|
});
|
|
20
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
12
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidG9rZW5zLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vbGlicy9hbmd1bGFyLWNvbW1vbi9zcmMvbGliL3Rva2Vucy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsY0FBYyxFQUFFLFdBQVcsRUFBRSxNQUFNLEVBQUUsTUFBTSxlQUFlLENBQUM7QUFlcEUsTUFBTSxDQUFDLE1BQU0sVUFBVSxHQUFHLElBQUksY0FBYyxDQUFrQixpQ0FBaUMsQ0FBQyxDQUFDO0FBRWpHLE1BQU0sQ0FBQyxNQUFNLE9BQU8sR0FBRyxJQUFJLGNBQWMsQ0FBVSxTQUFTLENBQUMsQ0FBQztBQUM5RCxNQUFNLENBQUMsTUFBTSxRQUFRLEdBQUcsSUFBSSxjQUFjLENBQVcsVUFBVSxDQUFDLENBQUM7QUFFakUsTUFBTSxDQUFDLE1BQU0sTUFBTSxHQUFHLElBQUksY0FBYyxDQUFTLCtDQUErQyxFQUFFO0lBQ2hHLFVBQVUsRUFBRSxNQUFNO0lBQ2xCLE9BQU8sRUFBRSxHQUFHLEVBQUU7UUFDWixNQUFNLFFBQVEsR0FBRyxNQUFNLENBQUMsV0FBVyxDQUFDLENBQUM7UUFDckMsT0FBTyxRQUFRLEtBQUssU0FBUyxDQUFDLENBQUMsQ0FBQyxNQUFNLENBQUMsQ0FBQyxDQUFFLEVBQWEsQ0FBQztJQUMxRCxDQUFDO0N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dCBwbGF0Zm9ybSA9IGluamVjdChQTEFURk9STV9JRCk7XG4gICAgcmV0dXJuIHBsYXRmb3JtID09PSAnYnJvd3NlcicgPyB3aW5kb3cgOiAoe30gYXMgV2luZG93KTtcbiAgfSxcbn0pO1xuIl19
|
|
@@ -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: "
|
|
11
|
-
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "
|
|
12
|
-
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
|
|
10
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: AngularCommonModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
11
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.0.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: "18.0.1", ngImport: i0, type: AngularCommonModule, imports: [CommonModule, FormsModule, ReactiveFormsModule, CommonModule, FormsModule, ReactiveFormsModule] });
|
|
13
13
|
}
|
|
14
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
14
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.1", 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: "
|
|
39
|
-
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "
|
|
38
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: PrettyjsonPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
39
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.0.1", ngImport: i0, type: PrettyjsonPipe, isStandalone: true, name: "prettyjson" });
|
|
40
40
|
}
|
|
41
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
41
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: PrettyjsonPipe, decorators: [{
|
|
42
42
|
type: Pipe,
|
|
43
43
|
args: [{
|
|
44
44
|
name: 'prettyjson',
|
|
@@ -53,10 +53,10 @@ class TimePipe {
|
|
|
53
53
|
format(date) {
|
|
54
54
|
return moment(date).fromNow();
|
|
55
55
|
}
|
|
56
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
57
|
-
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "
|
|
56
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: TimePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
57
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.0.1", ngImport: i0, type: TimePipe, isStandalone: true, name: "time", pure: false });
|
|
58
58
|
}
|
|
59
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
59
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: TimePipe, decorators: [{
|
|
60
60
|
type: Pipe,
|
|
61
61
|
args: [{ name: 'time', pure: false, standalone: true }]
|
|
62
62
|
}] });
|
|
@@ -83,10 +83,10 @@ class DurationPipe {
|
|
|
83
83
|
return num < 10 ? `0${num}` : `${num}`;
|
|
84
84
|
// return num !== undefined && num !== null && num >= 0 && num < 10 ? `0${num}` : `${num}`;
|
|
85
85
|
}
|
|
86
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
87
|
-
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "
|
|
86
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: DurationPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
87
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.0.1", ngImport: i0, type: DurationPipe, isStandalone: true, name: "duration" });
|
|
88
88
|
}
|
|
89
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
89
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: DurationPipe, decorators: [{
|
|
90
90
|
type: Pipe,
|
|
91
91
|
args: [{
|
|
92
92
|
standalone: true,
|
|
@@ -118,10 +118,10 @@ class DecimalDirective {
|
|
|
118
118
|
event.preventDefault();
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
122
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
121
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: DecimalDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
122
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.0.1", type: DecimalDirective, isStandalone: true, selector: "[rolatechDecimal]", host: { listeners: { "keydown": "onKeyDown($event)" } }, ngImport: i0 });
|
|
123
123
|
}
|
|
124
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
124
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: DecimalDirective, decorators: [{
|
|
125
125
|
type: Directive,
|
|
126
126
|
args: [{
|
|
127
127
|
selector: '[rolatechDecimal]',
|
|
@@ -134,14 +134,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.0", ngImpor
|
|
|
134
134
|
|
|
135
135
|
const COMMON_DIRECTIVES = [DecimalDirective];
|
|
136
136
|
|
|
137
|
-
class AppConfig {
|
|
138
|
-
baseUrl = '';
|
|
139
|
-
clientId = '';
|
|
140
|
-
cookieName = 'SID';
|
|
141
|
-
accountsUrl = 'http://localhost:9101';
|
|
142
|
-
myaccountUrl = 'http://localhost:9301';
|
|
143
|
-
www = '';
|
|
144
|
-
}
|
|
145
137
|
const APP_CONFIG = new InjectionToken('@rolatech/angular-common config');
|
|
146
138
|
const REQUEST = new InjectionToken('REQUEST');
|
|
147
139
|
const RESPONSE = new InjectionToken('RESPONSE');
|
|
@@ -179,5 +171,5 @@ function provideAngularCommon(environment) {
|
|
|
179
171
|
* Generated bundle index. Do not edit.
|
|
180
172
|
*/
|
|
181
173
|
|
|
182
|
-
export { APP_CONFIG, AngularCommonModule,
|
|
174
|
+
export { APP_CONFIG, AngularCommonModule, COMMON_DIRECTIVES, COMMON_PIPES, DecimalDirective, DurationPipe, PrettyjsonPipe, REQUEST, RESPONSE, TimePipe, UserStatus, WINDOW, provideAngularCommon };
|
|
183
175
|
//# 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/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, ' ').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 makeE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AM,GAAI,EAAa,CAAC;KACzD;AACF,CAAA;;ACZK,SAAU,oBAAoB,CAAC,WAAiB,EAAA;AACpD,IAAA,MAAM,SAAS,GAAwC;AACrD,QAAA,GAAG,YAAY;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, ' ').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 interface AppConfig {\n baseUrl: string;\n clientId: string;\n cookieName: string;\n accountsUrl: string;\n myaccountUrl: string;\n www: string;\n endpoint?: EndpointBasicAuth;\n}\nexport interface EndpointBasicAuth {\n username: string;\n password: string;\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,EA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;AC7BA;;AAEG;;;;"}
|
package/lib/tokens.d.ts
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
import { InjectionToken } from '@angular/core';
|
|
2
2
|
import { Request, Response } from 'express';
|
|
3
|
-
export
|
|
3
|
+
export interface AppConfig {
|
|
4
4
|
baseUrl: string;
|
|
5
5
|
clientId: string;
|
|
6
6
|
cookieName: string;
|
|
7
7
|
accountsUrl: string;
|
|
8
8
|
myaccountUrl: string;
|
|
9
9
|
www: string;
|
|
10
|
+
endpoint?: EndpointBasicAuth;
|
|
11
|
+
}
|
|
12
|
+
export interface EndpointBasicAuth {
|
|
13
|
+
username: string;
|
|
14
|
+
password: string;
|
|
10
15
|
}
|
|
11
16
|
export declare const APP_CONFIG: InjectionToken<any>;
|
|
12
17
|
export declare const REQUEST: InjectionToken<Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>>;
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rolatech/angular-common",
|
|
3
|
-
"version": "17.2.
|
|
3
|
+
"version": "17.2.2",
|
|
4
4
|
"peerDependencies": {
|
|
5
|
-
"@angular/common": "^
|
|
6
|
-
"@angular/core": "^
|
|
5
|
+
"@angular/common": "^18.0.0",
|
|
6
|
+
"@angular/core": "^18.0.0"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
9
|
"tslib": "^2.5.0"
|
|
@@ -27,4 +27,4 @@
|
|
|
27
27
|
}
|
|
28
28
|
},
|
|
29
29
|
"sideEffects": false
|
|
30
|
-
}
|
|
30
|
+
}
|