@tsi-developpement/tsi-shared-ui 1.10.2 → 1.10.4

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.
@@ -3,4 +3,4 @@ import { FormStateService } from "../services/form/form-state.service";
3
3
  import { PresentationDesignerBaseService } from "../services/presentation-setting/presentation-designer-base.service";
4
4
  import { GenericValidationStateService } from "../services/validation/generic-validation-state.service";
5
5
  import { InputRegistryService } from "../services/validation/input-registry.service";
6
- export declare const appProviders: (typeof DynamicFormService | typeof PresentationDesignerBaseService | typeof InputRegistryService | typeof FormStateService | typeof GenericValidationStateService)[];
6
+ export declare const appProviders: (typeof GenericValidationStateService | typeof InputRegistryService | typeof PresentationDesignerBaseService | typeof DynamicFormService | typeof FormStateService)[];
@@ -1,3 +1,4 @@
1
1
  export * from './array.functions';
2
2
  export * from './library-initializer';
3
3
  export * from './common.functions';
4
+ export * from './number.functions';
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Numeric helpers that avoid IEEE 754 floating-point accumulation errors.
3
+ *
4
+ * JavaScript's `number` is an IEEE 754 double, so decimal fractions such as
5
+ * `0.1` or `0.2` have no exact binary representation. Summing them naively
6
+ * (`a + b + c ...`) lets each rounding error compound, producing artifacts like
7
+ * `0.1 + 0.2 === 0.30000000000000004`.
8
+ *
9
+ * These helpers use integer scaling: every value is scaled up to an integer by
10
+ * the largest number of decimal places present, the addition is performed in the
11
+ * (exact) integer domain, then the result is scaled back down. No third-party
12
+ * dependency is required.
13
+ *
14
+ * Boundary: integer scaling can exceed `Number.MAX_SAFE_INTEGER` when summing
15
+ * very large numbers at high decimal precision (e.g. 6-decimal values totalling
16
+ * into the billions). For currency (2 decimals) the safe headroom is ~9e13, so
17
+ * this is a non-issue in practice.
18
+ */
19
+ /**
20
+ * Sums an array of numbers without IEEE 754 accumulation error.
21
+ *
22
+ * Uses integer scaling for an exact decimal result. `null`, `undefined` and
23
+ * non-finite entries (`NaN`, `Infinity`) are ignored (contribute `0`) so a
24
+ * single missing/invalid cell cannot poison the whole total. An empty,
25
+ * `null` or `undefined` input returns `0`.
26
+ *
27
+ * @param values - The values to sum (may contain gaps).
28
+ * @returns The precise sum, or `0` when there is nothing to add.
29
+ *
30
+ * @example
31
+ * preciseSum([0.1, 0.2]); // 0.3 (not 0.30000000000000004)
32
+ * preciseSum([1.005, 2.5, 3]); // 6.505
33
+ * preciseSum([10, null, undefined]); // 10
34
+ * preciseSum([]); // 0
35
+ */
36
+ export declare function preciseSum(values: ReadonlyArray<number | null | undefined> | null | undefined): number;
37
+ /**
38
+ * Adds two numbers without IEEE 754 accumulation error.
39
+ *
40
+ * `null`, `undefined` and non-finite operands are treated as `0`.
41
+ *
42
+ * @param a - First operand.
43
+ * @param b - Second operand.
44
+ * @returns The precise sum of `a` and `b`.
45
+ *
46
+ * @example
47
+ * preciseAdd(0.1, 0.2); // 0.3 (not 0.30000000000000004)
48
+ */
49
+ export declare function preciseAdd(a: number | null | undefined, b: number | null | undefined): number;
@@ -1,3 +1,2 @@
1
- export * from './admin.guard';
2
1
  export * from './auth.guard';
3
2
  export * from './permission.guard';
@@ -2,7 +2,7 @@ import { DynamicDialogConfig, DynamicDialogRef } from "primeng/dynamicdialog";
2
2
  import { TabView } from "primeng/tabview";
3
3
  import { JwtHelperService } from "@auth0/angular-jwt";
4
4
  import { ConfirmationService, MessageService } from "primeng/api";
5
- export declare const SharedUiTsiProviders: (typeof TabView | typeof DynamicDialogRef | typeof DynamicDialogConfig | typeof JwtHelperService | typeof MessageService | typeof ConfirmationService | {
5
+ export declare const SharedUiTsiProviders: (typeof DynamicDialogRef | typeof DynamicDialogConfig | typeof JwtHelperService | typeof TabView | typeof MessageService | typeof ConfirmationService | {
6
6
  provide: import("@angular/core").InjectionToken<unknown>;
7
7
  useValue: import("@angular/core").InjectionToken<unknown>;
8
8
  })[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsi-developpement/tsi-shared-ui",
3
- "version": "1.10.2",
3
+ "version": "1.10.4",
4
4
  "author": "TSI",
5
5
  "license": "MIT",
6
6
  "peerDependencies": {
@@ -1,37 +0,0 @@
1
- import { Injectable } from '@angular/core';
2
- import { Segment } from '../end-points';
3
- import { IdentityRoutes } from '../routes/identity.routes';
4
- import * as i0 from "@angular/core";
5
- import * as i1 from "../services/authorization/identity-manager.service";
6
- import * as i2 from "@angular/router";
7
- import * as i3 from "../services/authorization/authorization.service";
8
- export class AdminGuard {
9
- constructor(_identityManagerService, _router, _authService) {
10
- this._identityManagerService = _identityManagerService;
11
- this._router = _router;
12
- this._authService = _authService;
13
- }
14
- canActivate(route, state) {
15
- if (this._authService.isAuthenticated() === false) {
16
- window.location.href = `${Segment.identityPlatformUrlFront}/${IdentityRoutes.login}?logout=true`;
17
- return false;
18
- }
19
- else {
20
- const user = this._identityManagerService.parseMyAuthToken();
21
- if (user && (user.isSaasAdmin === "True" || user.isTenantAdmin === "True")) {
22
- return true;
23
- }
24
- this._router.navigate(['/app/unauthorized']);
25
- return false;
26
- }
27
- }
28
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: AdminGuard, deps: [{ token: i1.IdentityManagerService }, { token: i2.Router }, { token: i3.AuthorizationService }], target: i0.ɵɵFactoryTarget.Injectable }); }
29
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: AdminGuard, providedIn: 'root' }); }
30
- }
31
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: AdminGuard, decorators: [{
32
- type: Injectable,
33
- args: [{
34
- providedIn: 'root'
35
- }]
36
- }], ctorParameters: () => [{ type: i1.IdentityManagerService }, { type: i2.Router }, { type: i3.AuthorizationService }] });
37
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYWRtaW4uZ3VhcmQuanMiLCJzb3VyY2VSb290IjoiIi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XMuX2lkZW50aXR5TWFuYWdlclNlcnZpY2UucGFyc2VNeUF1dGhUb2tlbigpO1xyXG4gICAgICAgICAgICBpZiAodXNlciAmJiAodXNlci5pc1NhYXNBZG1pbiA9PT0gXCJUcnVlXCIgfHwgdXNlci5pc1RlbmFudEFkbWluID09PSBcIlRydWVcIikpIHtcclxuICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIFxyXG4gICAgICAgICAgICB0aGlzLl9yb3V0ZXIubmF2aWdhdGUoWycvYXBwL3VuYXV0aG9yaXplZCddKTtcclxuICAgICAgICAgICAgcmV0dXJuIGZhbHNlO1xyXG4gICAgICAgIFxyXG4gICAgICAgICAgfSAgICAgXHJcbiAgfVxyXG5cclxuXHJcbiAgXHJcbn0iXX0=
@@ -1,14 +0,0 @@
1
- import { ActivatedRouteSnapshot, Router, RouterStateSnapshot, UrlTree } from '@angular/router';
2
- import { Observable } from 'rxjs';
3
- import { IdentityManagerService } from '../services/authorization/identity-manager.service';
4
- import { AuthorizationService } from '../services/authorization/authorization.service';
5
- import * as i0 from "@angular/core";
6
- export declare class AdminGuard {
7
- private _identityManagerService;
8
- private _router;
9
- private _authService;
10
- constructor(_identityManagerService: IdentityManagerService, _router: Router, _authService: AuthorizationService);
11
- canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree;
12
- static ɵfac: i0.ɵɵFactoryDeclaration<AdminGuard, never>;
13
- static ɵprov: i0.ɵɵInjectableDeclaration<AdminGuard>;
14
- }