libey-ng-component-library 0.0.28 → 0.0.30

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.
@@ -0,0 +1,64 @@
1
+ import { OnInit, OnChanges, SimpleChanges, EventEmitter, TemplateRef } from '@angular/core';
2
+ import { CpmIndicatorMode, CpmItem, CpmThresholds, CpmSummary, ZoneColor, SvgPoint } from '../../utils/CpmIndicator/cpm-indicator-types';
3
+ import * as i0 from "@angular/core";
4
+ export declare class LibeyNgCpmIndicatorComponent implements OnInit, OnChanges {
5
+ /** Tope máximo del contrato. */
6
+ limit: number;
7
+ /**
8
+ * Ítems de gasto. El padre es responsable de:
9
+ * - Excluir ítems que no aplican al CPM
10
+ * - Marcar cada uno con CpmItemType.Base o CpmItemType.Projected
11
+ * - Actualizar el array al agregar o eliminar
12
+ */
13
+ items: CpmItem[];
14
+ /** Símbolo de moneda. Por defecto 's/' (sol peruano). */
15
+ currency: string;
16
+ /** Umbrales de zonas como porcentaje del límite (0.0 → 1.0). Usa tercios si no se proporciona. */
17
+ thresholds?: CpmThresholds;
18
+ /** Modo de visualización: CPM (solo gauge) o Gauge (montos + leyenda). */
19
+ mode: CpmIndicatorMode;
20
+ /** Activa sliders de prueba. Solo para desarrollo, nunca en producción. */
21
+ devMode: boolean;
22
+ /** Emite el resumen de montos en cada recalculo. Usar para persistir en BD. */
23
+ cpmChange: EventEmitter<CpmSummary>;
24
+ /** Emite true cuando la proyección supera el límite. */
25
+ limitExceeded: EventEmitter<boolean>;
26
+ cpmLegend: TemplateRef<any>;
27
+ baseAmount: number;
28
+ projectedAmount: number;
29
+ totalAmount: number;
30
+ excess: number;
31
+ activeColors: ZoneColor;
32
+ trackArcPath: string;
33
+ baseArcPath: string;
34
+ totalArcPath: string;
35
+ dotBasePos: SvgPoint;
36
+ dotTotalPos: SvgPoint;
37
+ dotTotalVisible: boolean;
38
+ limitTextPos: SvgPoint;
39
+ sliderBase: number;
40
+ sliderProjected: number;
41
+ get sliderMax(): number;
42
+ readonly CpmIndicatorMode: typeof CpmIndicatorMode;
43
+ private readonly CX;
44
+ private readonly CY;
45
+ private readonly R;
46
+ private readonly ANGLE_START;
47
+ private readonly ANGLE_END;
48
+ private readonly EXCESS_TOLERANCE;
49
+ constructor();
50
+ ngOnInit(): void;
51
+ ngOnChanges(changes: SimpleChanges): void;
52
+ onDevBaseChange(event: Event): void;
53
+ onDevProjectedChange(event: Event): void;
54
+ private recalculate;
55
+ private recalculateFromSliders;
56
+ private updateGauge;
57
+ private emitSummary;
58
+ private valueToAngle;
59
+ private polar;
60
+ private buildArcPath;
61
+ private getZoneColors;
62
+ static ɵfac: i0.ɵɵFactoryDeclaration<LibeyNgCpmIndicatorComponent, never>;
63
+ static ɵcmp: i0.ɵɵComponentDeclaration<LibeyNgCpmIndicatorComponent, "lib-libey-ng-cpm-indicator", never, { "limit": "limit"; "items": "items"; "currency": "currency"; "thresholds": "thresholds"; "mode": "mode"; "devMode": "devMode"; }, { "cpmChange": "cpmChange"; "limitExceeded": "limitExceeded"; }, never, never>;
64
+ }
@@ -0,0 +1,8 @@
1
+ import * as i0 from "@angular/core";
2
+ import * as i1 from "./libey-ng-cpm-indicator.component";
3
+ import * as i2 from "@angular/common";
4
+ export declare class LibeyNgCpmIndicatorModule {
5
+ static ɵfac: i0.ɵɵFactoryDeclaration<LibeyNgCpmIndicatorModule, never>;
6
+ static ɵmod: i0.ɵɵNgModuleDeclaration<LibeyNgCpmIndicatorModule, [typeof i1.LibeyNgCpmIndicatorComponent], [typeof i2.CommonModule], [typeof i1.LibeyNgCpmIndicatorComponent]>;
7
+ static ɵinj: i0.ɵɵInjectorDeclaration<LibeyNgCpmIndicatorModule>;
8
+ }
@@ -5,8 +5,9 @@ import * as i3 from "./table/libey-ng-table.module";
5
5
  import * as i4 from "./signature/libey-ng-signature.module";
6
6
  import * as i5 from "angular2-signaturepad";
7
7
  import * as i6 from "./icons/icons.module";
8
+ import * as i7 from "./cpm-indicator/libey-ng-cpm-indicator.module";
8
9
  export declare class LibeyNgComponentLibraryModule {
9
10
  static ɵfac: i0.ɵɵFactoryDeclaration<LibeyNgComponentLibraryModule, never>;
10
- static ɵmod: i0.ɵɵNgModuleDeclaration<LibeyNgComponentLibraryModule, never, [typeof i1.CommonModule, typeof i2.FormsModule, typeof i3.LibeyNgTableModule, typeof i4.LibeyNgSignatureModule, typeof i5.SignaturePadModule, typeof i6.IconsModule], [typeof i3.LibeyNgTableModule, typeof i4.LibeyNgSignatureModule, typeof i5.SignaturePadModule, typeof i6.IconsModule]>;
11
+ static ɵmod: i0.ɵɵNgModuleDeclaration<LibeyNgComponentLibraryModule, never, [typeof i1.CommonModule, typeof i2.FormsModule, typeof i3.LibeyNgTableModule, typeof i4.LibeyNgSignatureModule, typeof i5.SignaturePadModule, typeof i6.IconsModule, typeof i7.LibeyNgCpmIndicatorModule], [typeof i3.LibeyNgTableModule, typeof i4.LibeyNgSignatureModule, typeof i5.SignaturePadModule, typeof i6.IconsModule, typeof i7.LibeyNgCpmIndicatorModule]>;
11
12
  static ɵinj: i0.ɵɵInjectorDeclaration<LibeyNgComponentLibraryModule>;
12
13
  }
package/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "libey-ng-component-library",
3
- "version": "0.0.28",
3
+ "version": "0.0.30",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^12.2.0",
6
6
  "@angular/core": "^12.2.0",
7
- "@angular/forms": "^12.2.0"
7
+ "@angular/forms": "^12.2.0",
8
+ "@ng-bootstrap/ng-bootstrap": "^12.1.2"
8
9
  },
9
10
  "dependencies": {
10
11
  "@ng-bootstrap/ng-bootstrap": "^12.1.1",
package/public-api.d.ts CHANGED
@@ -7,8 +7,11 @@ export * from './lib/table/directives/libey-column.directive';
7
7
  export * from './lib/signature/libey-ng-signature.module';
8
8
  export * from './lib/signature/libey-ng-signature/libey-ng-signature.component';
9
9
  export * from './utils/SigWeb/SigWeb';
10
+ export * from './utils/CpmIndicator/cpm-indicator-types';
10
11
  export * from './lib/icons/icons.module';
11
12
  export * from './lib/icons/libey-ng-icons/libey-ng-icons.component';
13
+ export * from './lib/cpm-indicator/libey-ng-cpm-indicator.module';
14
+ export * from './lib/cpm-indicator/libey-ng-cpm-indicator.component';
12
15
  import { SignaturePadModule, SignaturePad } from 'angular2-signaturepad';
13
16
  export { SignaturePadModule, SignaturePad };
14
17
  export { NgSelectModule } from '@ng-select/ng-select';
@@ -0,0 +1,34 @@
1
+ export declare enum CpmIndicatorMode {
2
+ Cpm = "cpm",
3
+ Gauge = "gauge"
4
+ }
5
+ export declare enum CpmItemType {
6
+ Base = "base",
7
+ Projected = "projected"
8
+ }
9
+ export interface CpmItem {
10
+ id: string | number;
11
+ amount: number;
12
+ type: CpmItemType;
13
+ }
14
+ export interface CpmThresholds {
15
+ zone1Max: number;
16
+ zone2Max: number;
17
+ zone3Max: number;
18
+ }
19
+ export interface CpmSummary {
20
+ baseAmount: number;
21
+ projectedAmount: number;
22
+ totalAmount: number;
23
+ limit: number;
24
+ }
25
+ export interface ZoneColor {
26
+ dark: string;
27
+ light: string;
28
+ }
29
+ export interface SvgPoint {
30
+ x: number;
31
+ y: number;
32
+ }
33
+ export declare const DEFAULT_THRESHOLDS: CpmThresholds;
34
+ export declare const ZONE_COLORS: Record<string, ZoneColor>;