newportsite 1.1.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.
Files changed (131) hide show
  1. package/newportsite-1.1.3.tgz +0 -0
  2. package/ng-package.json +7 -0
  3. package/obfuscate.js +70 -0
  4. package/package.json +15 -0
  5. package/src/lib/app.component.ts +47 -0
  6. package/src/lib/app.routing.ts +38 -0
  7. package/src/lib/auth/alert.component.html +5 -0
  8. package/src/lib/auth/alert.component.ts +24 -0
  9. package/src/lib/auth/auth.component.html +1 -0
  10. package/src/lib/auth/auth.component.ts +10 -0
  11. package/src/lib/auth/auth.routes.ts +16 -0
  12. package/src/lib/auth/index.ts +4 -0
  13. package/src/lib/auth/login.component.html +87 -0
  14. package/src/lib/auth/login.component.ts +158 -0
  15. package/src/lib/auth/models/index.ts +1 -0
  16. package/src/lib/auth/models/user.ts +25 -0
  17. package/src/lib/auth/register.component.html +157 -0
  18. package/src/lib/auth/register.component.ts +219 -0
  19. package/src/lib/auth/services/alert.service.ts +47 -0
  20. package/src/lib/auth/services/auth.service.ts +28 -0
  21. package/src/lib/auth/services/index.ts +3 -0
  22. package/src/lib/auth/services/user.service.spec.ts +112 -0
  23. package/src/lib/auth/services/user.service.ts +47 -0
  24. package/src/lib/common/card.component.html +72 -0
  25. package/src/lib/common/card.component.ts +102 -0
  26. package/src/lib/common/commands.component.html +8 -0
  27. package/src/lib/common/commands.component.ts +42 -0
  28. package/src/lib/common/context.component.html +9 -0
  29. package/src/lib/common/context.component.ts +38 -0
  30. package/src/lib/common/grid.component.html +20 -0
  31. package/src/lib/common/grid.component.ts +747 -0
  32. package/src/lib/common/index.ts +9 -0
  33. package/src/lib/common/loader.component.html +5 -0
  34. package/src/lib/common/loader.component.ts +27 -0
  35. package/src/lib/common/lookup.component.html +29 -0
  36. package/src/lib/common/lookup.component.ts +115 -0
  37. package/src/lib/common/messagebox.component.html +39 -0
  38. package/src/lib/common/messagebox.component.ts +74 -0
  39. package/src/lib/common/theme-toggle.component.ts +139 -0
  40. package/src/lib/config.ts +62 -0
  41. package/src/lib/containers/default-layout/default-layout.component.html +191 -0
  42. package/src/lib/containers/default-layout/default-layout.component.ts +158 -0
  43. package/src/lib/containers/default-layout/index.ts +1 -0
  44. package/src/lib/containers/index.ts +1 -0
  45. package/src/lib/directives/component.draggable.ts +80 -0
  46. package/src/lib/directives/index.ts +2 -0
  47. package/src/lib/directives/input.directive.spec.ts +158 -0
  48. package/src/lib/directives/input.directive.ts +210 -0
  49. package/src/lib/home/dashboard/dashboard.component.html +38 -0
  50. package/src/lib/home/dashboard/dashboard.component.ts +50 -0
  51. package/src/lib/home/dashboard/index.ts +1 -0
  52. package/src/lib/home/index.component.html +1 -0
  53. package/src/lib/home/index.component.ts +10 -0
  54. package/src/lib/home/index.routes.ts +29 -0
  55. package/src/lib/home/index.ts +1 -0
  56. package/src/lib/home/info/index.ts +1 -0
  57. package/src/lib/home/info/info.component.css +476 -0
  58. package/src/lib/home/info/info.component.html +174 -0
  59. package/src/lib/home/info/info.component.ts +287 -0
  60. package/src/lib/home/model/article.component.html +10 -0
  61. package/src/lib/home/model/article.component.ts +50 -0
  62. package/src/lib/home/model/barchart.component.html +8 -0
  63. package/src/lib/home/model/barchart.component.ts +59 -0
  64. package/src/lib/home/model/index.ts +7 -0
  65. package/src/lib/home/model/itemdetail.component.html +25 -0
  66. package/src/lib/home/model/itemdetail.component.ts +93 -0
  67. package/src/lib/home/model/itemtab.component.html +25 -0
  68. package/src/lib/home/model/itemtab.component.ts +105 -0
  69. package/src/lib/home/model/model.component.html +121 -0
  70. package/src/lib/home/model/model.component.ts +510 -0
  71. package/src/lib/home/model/modeltoolbar.component.html +111 -0
  72. package/src/lib/home/model/modeltoolbar.component.ts +157 -0
  73. package/src/lib/home/model/navigation.component.html +86 -0
  74. package/src/lib/home/model/navigation.component.ts +247 -0
  75. package/src/lib/home/model/services/index.ts +1 -0
  76. package/src/lib/home/model/services/model.service.spec.ts +423 -0
  77. package/src/lib/home/model/services/model.service.ts +319 -0
  78. package/src/lib/home/modelsearch/index.ts +1 -0
  79. package/src/lib/home/modelsearch/modelsearch.component.html +124 -0
  80. package/src/lib/home/modelsearch/modelsearch.component.ts +453 -0
  81. package/src/lib/interfaces/data.interface.ts +131 -0
  82. package/src/lib/interfaces/index.ts +2 -0
  83. package/src/lib/interfaces/item.interface.ts +438 -0
  84. package/src/lib/players/lookup/lookup.directive.ts +6 -0
  85. package/src/lib/players/lookup/lookup.item.component.ts +37 -0
  86. package/src/lib/players/lookup/lookup.item.ts +9 -0
  87. package/src/lib/players/lookup/lookup.player.component.ts +59 -0
  88. package/src/lib/players/lookup/lookup.selector.component.ts +41 -0
  89. package/src/lib/players/model/model.directive.ts +6 -0
  90. package/src/lib/players/model/model.item.component.spec.ts +311 -0
  91. package/src/lib/players/model/model.item.component.ts +3457 -0
  92. package/src/lib/players/model/model.item.ts +9 -0
  93. package/src/lib/players/model/model.player.component.ts +109 -0
  94. package/src/lib/players/model/model.selector.component.ts +59 -0
  95. package/src/lib/scheduler/scheduler.component.html +13 -0
  96. package/src/lib/scheduler/scheduler.component.scss +6 -0
  97. package/src/lib/scheduler/scheduler.component.ts +296 -0
  98. package/src/lib/scheduler/scheduler.routes.ts +15 -0
  99. package/src/lib/scheduler/schedulerdialog.component.html +72 -0
  100. package/src/lib/scheduler/schedulerdialog.component.ts +208 -0
  101. package/src/lib/scheduler/services/scheduler.service.ts +133 -0
  102. package/src/lib/services/auth-state.service.ts +129 -0
  103. package/src/lib/services/auth.interceptor.spec.ts +144 -0
  104. package/src/lib/services/auth.interceptor.ts +44 -0
  105. package/src/lib/services/cache.service.spec.ts +143 -0
  106. package/src/lib/services/cache.service.ts +71 -0
  107. package/src/lib/services/global-error-handler.spec.ts +39 -0
  108. package/src/lib/services/global-error-handler.ts +28 -0
  109. package/src/lib/services/global.service.spec.ts +801 -0
  110. package/src/lib/services/global.service.ts +724 -0
  111. package/src/lib/services/message.service.ts +556 -0
  112. package/src/lib/services/theme.service.ts +96 -0
  113. package/src/lib/template/authtemplate.component.html +6 -0
  114. package/src/lib/template/authtemplate.component.ts +13 -0
  115. package/src/lib/template/basetemplate.component.html +7 -0
  116. package/src/lib/template/basetemplate.component.ts +13 -0
  117. package/src/lib/template/index.ts +3 -0
  118. package/src/lib/template/modeltemplate.component.html +7 -0
  119. package/src/lib/template/modeltemplate.component.ts +21 -0
  120. package/src/lib/utils/piva.spec.ts +56 -0
  121. package/src/lib/utils/piva.ts +29 -0
  122. package/src/lib/validators/email.validator.spec.ts +57 -0
  123. package/src/lib/validators/email.validator.ts +17 -0
  124. package/src/lib/validators/equalPasswords.validator.spec.ts +54 -0
  125. package/src/lib/validators/equalPasswords.validator.ts +17 -0
  126. package/src/lib/validators/index.ts +2 -0
  127. package/src/lib/version.ts +1 -0
  128. package/src/public-api.ts +64 -0
  129. package/src/typings.d.ts +2 -0
  130. package/tsconfig.lib.json +18 -0
  131. package/tsconfig.lib.prod.json +9 -0
@@ -0,0 +1,3 @@
1
+ export * from './authtemplate.component';
2
+ export * from './basetemplate.component';
3
+ export * from './modeltemplate.component';
@@ -0,0 +1,7 @@
1
+ <!-- modeltemplate.component -->
2
+ <!-- <div class="d-flex align-items-center justify-content-center"> -->
3
+ <ng-content></ng-content>
4
+ <loader></loader>
5
+ <!-- </div> -->
6
+ <!-- <footer></footer> -->
7
+ <!-- fine modeltemplate.component -->
@@ -0,0 +1,21 @@
1
+ import { Component, ChangeDetectionStrategy, inject } from '@angular/core';
2
+
3
+ import { GlobalService } from '../services/global.service';
4
+
5
+ import { LoaderComponent } from '../common/loader.component';
6
+
7
+ @Component({
8
+ selector: 'modeltemplate',
9
+ templateUrl: 'modeltemplate.component.html',
10
+ changeDetection: ChangeDetectionStrategy.OnPush,
11
+ imports: [LoaderComponent],
12
+ })
13
+ export class ModelTemplateComponent {
14
+ private gsv = inject(GlobalService);
15
+
16
+ private project!: string;
17
+ /** Caches the current project ID at construction time. */
18
+ constructor() {
19
+ this.project = this.gsv.getProject().project;
20
+ }
21
+ }
@@ -0,0 +1,56 @@
1
+ import { PartitaIVA } from './piva';
2
+
3
+ describe('PartitaIVA.Check()', () => {
4
+ // ── Empty input ───────────────────────────────────────────────────────────
5
+
6
+ it('returns empty string for an empty input (no-op shortcut)', () => {
7
+ expect(new PartitaIVA('').Check()).toBe('');
8
+ });
9
+
10
+ // ── Format validation ─────────────────────────────────────────────────────
11
+
12
+ it('returns an error for a string shorter than 11 digits', () => {
13
+ expect(new PartitaIVA('1234567').Check()).not.toBe('');
14
+ });
15
+
16
+ it('returns an error for a string longer than 11 digits', () => {
17
+ expect(new PartitaIVA('123456789012').Check()).not.toBe('');
18
+ });
19
+
20
+ it('returns an error when the string contains letters', () => {
21
+ expect(new PartitaIVA('ABC45670017').Check()).not.toBe('');
22
+ });
23
+
24
+ it('returns an error when the string contains spaces', () => {
25
+ expect(new PartitaIVA('1234 670017').Check()).not.toBe('');
26
+ });
27
+
28
+ // ── Check digit validation ────────────────────────────────────────────────
29
+
30
+ it('returns empty string for a valid PIVA (01234560157)', () => {
31
+ // manually verified: Luhn-like sum = 23, check digit = 7 → d[10] = 7 ✓
32
+ expect(new PartitaIVA('01234560157').Check()).toBe('');
33
+ });
34
+
35
+ it('returns empty string for a valid PIVA (12345670017)', () => {
36
+ // manually verified: sum = 33, check digit = 7 → d[10] = 7 ✓
37
+ expect(new PartitaIVA('12345670017').Check()).toBe('');
38
+ });
39
+
40
+ it('returns an error when the check digit is wrong by one', () => {
41
+ // same digits as above but last digit = 8 instead of 7
42
+ expect(new PartitaIVA('12345670018').Check()).not.toBe('');
43
+ });
44
+
45
+ it('returns an error for all-zeros except check digit mismatch', () => {
46
+ // 00000000001: sum=0, expected check=0 but d[10]=1
47
+ expect(new PartitaIVA('00000000001').Check()).not.toBe('');
48
+ });
49
+
50
+ // ── Reduction rule: doubled digit > 9 is reduced by 9 ───────────────────
51
+
52
+ it('handles the digit-doubling reduction rule correctly', () => {
53
+ // 01234560157 exercises this path: d[5]=5, 2*5=10 → reduced to 1
54
+ expect(new PartitaIVA('01234560157').Check()).toBe('');
55
+ });
56
+ });
@@ -0,0 +1,29 @@
1
+ export class PartitaIVA {
2
+ constructor(private pi: string) {}
3
+
4
+ /** Validates the Italian VAT number (Partita IVA); returns an empty string if valid, or an error message. */
5
+ public Check(): string {
6
+ if (this.pi === '') {
7
+ return '';
8
+ }
9
+ if (!/^[0-9]{11}$/.test(this.pi)) {
10
+ return 'La partita IVA deve contenere 11 cifre.';
11
+ }
12
+ let s: number = 0;
13
+ for (let i = 0; i <= 9; i += 2) {
14
+ s += this.pi.charCodeAt(i) - '0'.charCodeAt(0);
15
+ }
16
+ for (let i = 1; i <= 9; i += 2) {
17
+ let c = 2 * (this.pi.charCodeAt(i) - '0'.charCodeAt(0));
18
+ if (c > 9) {
19
+ c = c - 9;
20
+ }
21
+ s += c;
22
+ }
23
+ const atteso = (10 - (s % 10)) % 10;
24
+ if (atteso !== this.pi.charCodeAt(10) - '0'.charCodeAt(0)) {
25
+ return 'La partita IVA non è valida:\nil codice di controllo non corrisponde.\n';
26
+ }
27
+ return '';
28
+ }
29
+ }
@@ -0,0 +1,57 @@
1
+ import { AbstractControl } from '@angular/forms';
2
+ import { EmailValidator } from './email.validator';
3
+
4
+ const ctrl = (value: string): AbstractControl =>
5
+ ({ value } as unknown as AbstractControl);
6
+
7
+ const ERROR = { validateEmail: { valid: false } };
8
+
9
+ describe('EmailValidator.validate()', () => {
10
+ // ── Valid addresses ───────────────────────────────────────────────────────
11
+
12
+ it('returns null for a standard address', () => {
13
+ expect(EmailValidator.validate(ctrl('user@example.com'))).toBeNull();
14
+ });
15
+
16
+ it('returns null for a subdomain address', () => {
17
+ expect(EmailValidator.validate(ctrl('user@mail.example.co.uk'))).toBeNull();
18
+ });
19
+
20
+ it('returns null for an address with a plus sign', () => {
21
+ expect(EmailValidator.validate(ctrl('user+tag@example.com'))).toBeNull();
22
+ });
23
+
24
+ it('returns null for an address with dots in the local part', () => {
25
+ expect(EmailValidator.validate(ctrl('first.last@example.com'))).toBeNull();
26
+ });
27
+
28
+ it('returns null for an address with a numeric TLD', () => {
29
+ expect(EmailValidator.validate(ctrl('user@[192.168.1.1]'))).toBeNull();
30
+ });
31
+
32
+ // ── Invalid addresses ─────────────────────────────────────────────────────
33
+
34
+ it('returns an error for empty string', () => {
35
+ expect(EmailValidator.validate(ctrl(''))).toEqual(ERROR);
36
+ });
37
+
38
+ it('returns an error when @ is missing', () => {
39
+ expect(EmailValidator.validate(ctrl('userexample.com'))).toEqual(ERROR);
40
+ });
41
+
42
+ it('returns an error when local part is missing', () => {
43
+ expect(EmailValidator.validate(ctrl('@example.com'))).toEqual(ERROR);
44
+ });
45
+
46
+ it('returns an error when domain is missing', () => {
47
+ expect(EmailValidator.validate(ctrl('user@'))).toEqual(ERROR);
48
+ });
49
+
50
+ it('returns an error when TLD is missing', () => {
51
+ expect(EmailValidator.validate(ctrl('user@example'))).toEqual(ERROR);
52
+ });
53
+
54
+ it('returns an error for multiple @ symbols', () => {
55
+ expect(EmailValidator.validate(ctrl('user@@example.com'))).toEqual(ERROR);
56
+ });
57
+ });
@@ -0,0 +1,17 @@
1
+ import { AbstractControl } from '@angular/forms';
2
+
3
+ export class EmailValidator {
4
+ /** Returns null if the control value is a valid e-mail address, or a validation error object otherwise. */
5
+ public static validate(c: AbstractControl) {
6
+ let EMAIL_REGEXP =
7
+ /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
8
+
9
+ return EMAIL_REGEXP.test(c.value)
10
+ ? null
11
+ : {
12
+ validateEmail: {
13
+ valid: false,
14
+ },
15
+ };
16
+ }
17
+ }
@@ -0,0 +1,54 @@
1
+ import { FormBuilder, FormGroup } from '@angular/forms';
2
+ import { EqualPasswordsValidator } from './equalPasswords.validator';
3
+
4
+ const ERROR = { passwordsEqual: { valid: false } };
5
+
6
+ describe('EqualPasswordsValidator.validate()', () => {
7
+ let fg: FormGroup;
8
+ const fb = new FormBuilder();
9
+
10
+ beforeEach(() => {
11
+ fg = fb.group({ password: [''], confirmpassword: [''] });
12
+ });
13
+
14
+ const validator = EqualPasswordsValidator.validate('password', 'confirmpassword');
15
+
16
+ // ── Matching values ───────────────────────────────────────────────────────
17
+
18
+ it('returns null when both fields are empty (both equal)', () => {
19
+ expect(validator(fg)).toBeNull();
20
+ });
21
+
22
+ it('returns null when both fields have the same non-empty value', () => {
23
+ fg.patchValue({ password: 'Secret1!', confirmpassword: 'Secret1!' });
24
+ expect(validator(fg)).toBeNull();
25
+ });
26
+
27
+ it('returns null for matching values that include special characters', () => {
28
+ const v = '!@#$%^&*()';
29
+ fg.patchValue({ password: v, confirmpassword: v });
30
+ expect(validator(fg)).toBeNull();
31
+ });
32
+
33
+ // ── Mismatching values ────────────────────────────────────────────────────
34
+
35
+ it('returns an error when the fields differ', () => {
36
+ fg.patchValue({ password: 'Secret1!', confirmpassword: 'Different!' });
37
+ expect(validator(fg)).toEqual(ERROR);
38
+ });
39
+
40
+ it('returns an error when confirmpassword is empty and password is not', () => {
41
+ fg.patchValue({ password: 'Secret1!', confirmpassword: '' });
42
+ expect(validator(fg)).toEqual(ERROR);
43
+ });
44
+
45
+ it('returns an error when the difference is only in casing', () => {
46
+ fg.patchValue({ password: 'secret', confirmpassword: 'Secret' });
47
+ expect(validator(fg)).toEqual(ERROR);
48
+ });
49
+
50
+ it('returns an error when values differ only by a trailing space', () => {
51
+ fg.patchValue({ password: 'secret', confirmpassword: 'secret ' });
52
+ expect(validator(fg)).toEqual(ERROR);
53
+ });
54
+ });
@@ -0,0 +1,17 @@
1
+ import { FormGroup } from '@angular/forms';
2
+
3
+ export class EqualPasswordsValidator {
4
+ /** Returns a validator that checks whether two named fields in a FormGroup have the same value. */
5
+ public static validate(firstField: string, secondField: string) {
6
+ return (c: FormGroup) => {
7
+ return c.controls &&
8
+ c.controls[firstField].value === c.controls[secondField].value
9
+ ? null
10
+ : {
11
+ passwordsEqual: {
12
+ valid: false,
13
+ },
14
+ };
15
+ };
16
+ }
17
+ }
@@ -0,0 +1,2 @@
1
+ export * from './email.validator';
2
+ export * from './equalPasswords.validator';
@@ -0,0 +1 @@
1
+ export const PACKAGE_VERSION = '1.1.3';
@@ -0,0 +1,64 @@
1
+
2
+ /// <reference path="./typings.d.ts" />
3
+ // Config & bootstrap
4
+ export { NewportConfig, NEWPORT_CONFIG, provideNewport } from './lib/config';
5
+
6
+ // Root component & routing
7
+ export { AppComponent } from './lib/app.component';
8
+ export { APP_ROUTES } from './lib/app.routing';
9
+
10
+ // Services
11
+ export { GlobalService, Languages } from './lib/services/global.service';
12
+ export { AuthStateService } from './lib/services/auth-state.service';
13
+ export { CacheService } from './lib/services/cache.service';
14
+ export { AppMessageService } from './lib/services/message.service';
15
+ export { ThemeService } from './lib/services/theme.service';
16
+ export { GlobalErrorHandler } from './lib/services/global-error-handler';
17
+ export { authInterceptor } from './lib/services/auth.interceptor';
18
+
19
+ // Auth
20
+ export { LoginComponent } from './lib/auth/login.component';
21
+ export { RegisterComponent } from './lib/auth/register.component';
22
+ export { authGuard, AuthGuard } from './lib/auth/services/auth.service';
23
+ export { UserService } from './lib/auth/services/user.service';
24
+ export { AlertService } from './lib/auth/services/alert.service';
25
+ export { User } from './lib/auth/models/user';
26
+
27
+ // Interfaces
28
+ export * from './lib/interfaces/index';
29
+
30
+ // Common components
31
+ export { GridComponent } from './lib/common/grid.component';
32
+ export { LookupComponent } from './lib/common/lookup.component';
33
+ export { CardComponent } from './lib/common/card.component';
34
+ export { MessageBoxComponent } from './lib/common/messagebox.component';
35
+ export { LoaderComponent } from './lib/common/loader.component';
36
+ export { ThemeToggleComponent } from './lib/common/theme-toggle.component';
37
+ export { CommandsComponent } from './lib/common/commands.component';
38
+ export { ContextComponent } from './lib/common/context.component';
39
+
40
+ // Home
41
+ export { IndexComponent } from './lib/home/index.component';
42
+ export { DashboardComponent } from './lib/home/dashboard/dashboard.component';
43
+ export { ModelComponent } from './lib/home/model/model.component';
44
+ export { NavigationComponent } from './lib/home/model/navigation.component';
45
+ export { ModelSearchComponent } from './lib/home/modelsearch/modelsearch.component';
46
+ export { ManagmentService } from './lib/home/model/services';
47
+
48
+ // Scheduler
49
+ export { SchedulerComponent } from './lib/scheduler/scheduler.component';
50
+ export { SchedulerService } from './lib/scheduler/services/scheduler.service';
51
+
52
+ // Template
53
+ export { AuthTemplateComponent } from './lib/template/authtemplate.component';
54
+ export { BaseTemplateComponent } from './lib/template/basetemplate.component';
55
+ export { ModelTemplateComponent } from './lib/template/modeltemplate.component';
56
+
57
+ // Containers
58
+ export { DefaultLayoutComponent } from './lib/containers/default-layout/default-layout.component';
59
+
60
+ // Directives & validators
61
+ export { InputDirective } from './lib/directives/input.directive';
62
+ export { NgxModalDraggableDirective } from './lib/directives/component.draggable';
63
+ export { EmailValidator } from './lib/validators/email.validator';
64
+ export { EqualPasswordsValidator } from './lib/validators/equalPasswords.validator';
@@ -0,0 +1,2 @@
1
+ declare module 'pdfmake/build/pdfmake';
2
+ declare module 'pdfmake/build/vfs_fonts';
@@ -0,0 +1,18 @@
1
+ {
2
+ "extends": "../../tsconfig.json",
3
+ "compilerOptions": {
4
+ "outDir": "../../out-tsc/lib",
5
+ "declaration": true,
6
+ "declarationMap": true,
7
+ "inlineSources": true,
8
+ "types": [],
9
+ "typeRoots": [
10
+ "./src",
11
+ "../../node_modules/@types"
12
+ ]
13
+ },
14
+ "exclude": [
15
+ "src/test.ts",
16
+ "**/*.spec.ts"
17
+ ]
18
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "extends": "./tsconfig.lib.json",
3
+ "compilerOptions": {
4
+ "declarationMap": false
5
+ },
6
+ "angularCompilerOptions": {
7
+ "compilationMode": "partial"
8
+ }
9
+ }