libey-ng-component-library 0.0.29 → 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.
- package/README.md +24 -24
- package/bundles/libey-ng-component-library.umd.js +248 -5
- package/bundles/libey-ng-component-library.umd.js.map +1 -1
- package/esm2015/lib/cpm-indicator/libey-ng-cpm-indicator.component.js +181 -0
- package/esm2015/lib/cpm-indicator/libey-ng-cpm-indicator.module.js +26 -0
- package/esm2015/lib/libey-ng-component-library.component.js +9 -9
- package/esm2015/lib/libey-ng-component-library.module.js +13 -6
- package/esm2015/lib/libey-ng-component-library.service.js +1 -1
- package/esm2015/public-api.js +4 -1
- package/esm2015/utils/CpmIndicator/cpm-indicator-types.js +25 -0
- package/fesm2015/libey-ng-component-library.js +244 -14
- package/fesm2015/libey-ng-component-library.js.map +1 -1
- package/lib/cpm-indicator/libey-ng-cpm-indicator.component.d.ts +64 -0
- package/lib/cpm-indicator/libey-ng-cpm-indicator.module.d.ts +8 -0
- package/lib/libey-ng-component-library.module.d.ts +2 -1
- package/package.json +3 -2
- package/public-api.d.ts +3 -0
- package/utils/CpmIndicator/cpm-indicator-types.d.ts +34 -0
package/README.md
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
# LibeyNgComponentLibrary
|
|
2
|
-
|
|
3
|
-
This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 12.2.0.
|
|
4
|
-
|
|
5
|
-
## Code scaffolding
|
|
6
|
-
|
|
7
|
-
Run `ng generate component component-name --project libey-ngComponent-library` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project libey-ngComponent-library`.
|
|
8
|
-
> Note: Don't forget to add `--project libey-ngComponent-library` or else it will be added to the default project in your `angular.json` file.
|
|
9
|
-
|
|
10
|
-
## Build
|
|
11
|
-
|
|
12
|
-
Run `ng build libey-ngComponent-library` to build the project. The build artifacts will be stored in the `dist/` directory.
|
|
13
|
-
|
|
14
|
-
## Publishing
|
|
15
|
-
|
|
16
|
-
After building your library with `ng build libey-ngComponent-library`, go to the dist folder `cd dist/libey-ng-component-library` and run `npm publish`.
|
|
17
|
-
|
|
18
|
-
## Running unit tests
|
|
19
|
-
|
|
20
|
-
Run `ng test libey-ngComponent-library` to execute the unit tests via [Karma](https://karma-runner.github.io).
|
|
21
|
-
|
|
22
|
-
## Further help
|
|
23
|
-
|
|
24
|
-
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.
|
|
1
|
+
# LibeyNgComponentLibrary
|
|
2
|
+
|
|
3
|
+
This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 12.2.0.
|
|
4
|
+
|
|
5
|
+
## Code scaffolding
|
|
6
|
+
|
|
7
|
+
Run `ng generate component component-name --project libey-ngComponent-library` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project libey-ngComponent-library`.
|
|
8
|
+
> Note: Don't forget to add `--project libey-ngComponent-library` or else it will be added to the default project in your `angular.json` file.
|
|
9
|
+
|
|
10
|
+
## Build
|
|
11
|
+
|
|
12
|
+
Run `ng build libey-ngComponent-library` to build the project. The build artifacts will be stored in the `dist/` directory.
|
|
13
|
+
|
|
14
|
+
## Publishing
|
|
15
|
+
|
|
16
|
+
After building your library with `ng build libey-ngComponent-library`, go to the dist folder `cd dist/libey-ng-component-library` and run `npm publish`.
|
|
17
|
+
|
|
18
|
+
## Running unit tests
|
|
19
|
+
|
|
20
|
+
Run `ng test libey-ngComponent-library` to execute the unit tests via [Karma](https://karma-runner.github.io).
|
|
21
|
+
|
|
22
|
+
## Further help
|
|
23
|
+
|
|
24
|
+
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.
|
|
@@ -2146,6 +2146,239 @@
|
|
|
2146
2146
|
}]
|
|
2147
2147
|
}] });
|
|
2148
2148
|
|
|
2149
|
+
// Modos de visualización del indicador
|
|
2150
|
+
exports.CpmIndicatorMode = void 0;
|
|
2151
|
+
(function (CpmIndicatorMode) {
|
|
2152
|
+
CpmIndicatorMode["Cpm"] = "cpm";
|
|
2153
|
+
CpmIndicatorMode["Gauge"] = "gauge";
|
|
2154
|
+
})(exports.CpmIndicatorMode || (exports.CpmIndicatorMode = {}));
|
|
2155
|
+
// Tipo de ítem: gasto ya consumido (Base) o estimado (Projected)
|
|
2156
|
+
exports.CpmItemType = void 0;
|
|
2157
|
+
(function (CpmItemType) {
|
|
2158
|
+
CpmItemType["Base"] = "base";
|
|
2159
|
+
CpmItemType["Projected"] = "projected";
|
|
2160
|
+
})(exports.CpmItemType || (exports.CpmItemType = {}));
|
|
2161
|
+
// Tercios por defecto si no se proporcionan thresholds
|
|
2162
|
+
var DEFAULT_THRESHOLDS = {
|
|
2163
|
+
zone1Max: 1 / 3,
|
|
2164
|
+
zone2Max: 2 / 3,
|
|
2165
|
+
zone3Max: 1.0,
|
|
2166
|
+
};
|
|
2167
|
+
var ZONE_COLORS = {
|
|
2168
|
+
zone1: { dark: '#16a34a', light: '#86efac' },
|
|
2169
|
+
zone2: { dark: '#ca8a04', light: '#fde68a' },
|
|
2170
|
+
zone3: { dark: '#ea580c', light: '#fdba74' },
|
|
2171
|
+
zone4: { dark: '#dc2626', light: '#fca5a5' }, // Rojo
|
|
2172
|
+
};
|
|
2173
|
+
|
|
2174
|
+
var LibeyNgCpmIndicatorComponent = /** @class */ (function () {
|
|
2175
|
+
function LibeyNgCpmIndicatorComponent() {
|
|
2176
|
+
/** Tope máximo del contrato. */
|
|
2177
|
+
this.limit = 250;
|
|
2178
|
+
/**
|
|
2179
|
+
* Ítems de gasto. El padre es responsable de:
|
|
2180
|
+
* - Excluir ítems que no aplican al CPM
|
|
2181
|
+
* - Marcar cada uno con CpmItemType.Base o CpmItemType.Projected
|
|
2182
|
+
* - Actualizar el array al agregar o eliminar
|
|
2183
|
+
*/
|
|
2184
|
+
this.items = [];
|
|
2185
|
+
/** Símbolo de moneda. Por defecto 's/' (sol peruano). */
|
|
2186
|
+
this.currency = 's/';
|
|
2187
|
+
/** Modo de visualización: CPM (solo gauge) o Gauge (montos + leyenda). */
|
|
2188
|
+
this.mode = exports.CpmIndicatorMode.Cpm;
|
|
2189
|
+
/** Activa sliders de prueba. Solo para desarrollo, nunca en producción. */
|
|
2190
|
+
this.devMode = false;
|
|
2191
|
+
// ── Outputs ──
|
|
2192
|
+
/** Emite el resumen de montos en cada recalculo. Usar para persistir en BD. */
|
|
2193
|
+
this.cpmChange = new i0.EventEmitter();
|
|
2194
|
+
/** Emite true cuando la proyección supera el límite. */
|
|
2195
|
+
this.limitExceeded = new i0.EventEmitter();
|
|
2196
|
+
// ── Propiedades del template ──
|
|
2197
|
+
this.baseAmount = 0;
|
|
2198
|
+
this.projectedAmount = 0;
|
|
2199
|
+
this.totalAmount = 0;
|
|
2200
|
+
this.excess = 0;
|
|
2201
|
+
this.activeColors = ZONE_COLORS['zone1'];
|
|
2202
|
+
this.trackArcPath = '';
|
|
2203
|
+
this.baseArcPath = '';
|
|
2204
|
+
this.totalArcPath = '';
|
|
2205
|
+
this.dotBasePos = { x: 0, y: 0 };
|
|
2206
|
+
this.dotTotalPos = { x: 0, y: 0 };
|
|
2207
|
+
this.dotTotalVisible = false;
|
|
2208
|
+
this.limitTextPos = { x: 0, y: 0 };
|
|
2209
|
+
// ── devMode ──
|
|
2210
|
+
this.sliderBase = 0;
|
|
2211
|
+
this.sliderProjected = 0;
|
|
2212
|
+
// Necesario para usar el enum en el template
|
|
2213
|
+
this.CpmIndicatorMode = exports.CpmIndicatorMode;
|
|
2214
|
+
// Geometría del SVG (coordenadas internas del viewBox 220x130)
|
|
2215
|
+
this.CX = 110;
|
|
2216
|
+
this.CY = 115;
|
|
2217
|
+
this.R = 90;
|
|
2218
|
+
this.ANGLE_START = Math.PI;
|
|
2219
|
+
this.ANGLE_END = 0;
|
|
2220
|
+
this.EXCESS_TOLERANCE = 0.005;
|
|
2221
|
+
}
|
|
2222
|
+
Object.defineProperty(LibeyNgCpmIndicatorComponent.prototype, "sliderMax", {
|
|
2223
|
+
get: function () {
|
|
2224
|
+
return this.limit * 1.5;
|
|
2225
|
+
},
|
|
2226
|
+
enumerable: false,
|
|
2227
|
+
configurable: true
|
|
2228
|
+
});
|
|
2229
|
+
LibeyNgCpmIndicatorComponent.prototype.ngOnInit = function () {
|
|
2230
|
+
this.recalculate();
|
|
2231
|
+
};
|
|
2232
|
+
LibeyNgCpmIndicatorComponent.prototype.ngOnChanges = function (changes) {
|
|
2233
|
+
if (changes['items'] || changes['limit'] || changes['thresholds']) {
|
|
2234
|
+
this.recalculate();
|
|
2235
|
+
}
|
|
2236
|
+
};
|
|
2237
|
+
LibeyNgCpmIndicatorComponent.prototype.onDevBaseChange = function (event) {
|
|
2238
|
+
this.sliderBase = parseFloat(event.target.value);
|
|
2239
|
+
if (this.sliderBase > this.sliderProjected) {
|
|
2240
|
+
this.sliderProjected = this.sliderBase;
|
|
2241
|
+
}
|
|
2242
|
+
this.recalculateFromSliders();
|
|
2243
|
+
};
|
|
2244
|
+
LibeyNgCpmIndicatorComponent.prototype.onDevProjectedChange = function (event) {
|
|
2245
|
+
this.sliderProjected = parseFloat(event.target.value);
|
|
2246
|
+
if (this.sliderProjected < this.sliderBase) {
|
|
2247
|
+
this.sliderProjected = this.sliderBase;
|
|
2248
|
+
}
|
|
2249
|
+
this.recalculateFromSliders();
|
|
2250
|
+
};
|
|
2251
|
+
// Flujo de producción: calcula a partir del array de items
|
|
2252
|
+
LibeyNgCpmIndicatorComponent.prototype.recalculate = function () {
|
|
2253
|
+
this.baseAmount = this.items
|
|
2254
|
+
.filter(function (i) { return i.type === exports.CpmItemType.Base; })
|
|
2255
|
+
.reduce(function (acc, i) { return acc + i.amount; }, 0);
|
|
2256
|
+
this.projectedAmount = this.items
|
|
2257
|
+
.filter(function (i) { return i.type === exports.CpmItemType.Projected; })
|
|
2258
|
+
.reduce(function (acc, i) { return acc + i.amount; }, 0);
|
|
2259
|
+
this.totalAmount = this.baseAmount + this.projectedAmount;
|
|
2260
|
+
// Sincroniza sliders por si se activa devMode
|
|
2261
|
+
this.sliderBase = this.baseAmount;
|
|
2262
|
+
this.sliderProjected = this.totalAmount;
|
|
2263
|
+
this.updateGauge();
|
|
2264
|
+
this.emitSummary();
|
|
2265
|
+
};
|
|
2266
|
+
// Flujo de devMode: calcula a partir de los sliders
|
|
2267
|
+
LibeyNgCpmIndicatorComponent.prototype.recalculateFromSliders = function () {
|
|
2268
|
+
this.baseAmount = this.sliderBase;
|
|
2269
|
+
this.projectedAmount = this.sliderProjected - this.sliderBase;
|
|
2270
|
+
this.totalAmount = this.sliderProjected;
|
|
2271
|
+
this.updateGauge();
|
|
2272
|
+
this.emitSummary();
|
|
2273
|
+
};
|
|
2274
|
+
LibeyNgCpmIndicatorComponent.prototype.updateGauge = function () {
|
|
2275
|
+
var _a;
|
|
2276
|
+
var thresholds = (_a = this.thresholds) !== null && _a !== void 0 ? _a : DEFAULT_THRESHOLDS;
|
|
2277
|
+
this.activeColors = this.getZoneColors(this.totalAmount, thresholds);
|
|
2278
|
+
this.trackArcPath = this.buildArcPath(this.ANGLE_START, this.ANGLE_END);
|
|
2279
|
+
this.totalArcPath = this.buildArcPath(this.ANGLE_START, this.valueToAngle(this.totalAmount));
|
|
2280
|
+
this.baseArcPath = this.buildArcPath(this.ANGLE_START, this.valueToAngle(this.baseAmount));
|
|
2281
|
+
this.dotBasePos = this.polar(this.valueToAngle(this.baseAmount));
|
|
2282
|
+
this.dotTotalPos = this.polar(this.valueToAngle(this.totalAmount));
|
|
2283
|
+
// El punto de proyección solo aparece si va delante del real y no llegó al borde
|
|
2284
|
+
this.dotTotalVisible = this.totalAmount > this.baseAmount && this.totalAmount < this.limit;
|
|
2285
|
+
this.limitTextPos = this.polar(this.ANGLE_END, this.R + 20);
|
|
2286
|
+
this.excess = Math.max(0, this.totalAmount - this.limit);
|
|
2287
|
+
this.limitExceeded.emit(this.excess > this.EXCESS_TOLERANCE);
|
|
2288
|
+
};
|
|
2289
|
+
LibeyNgCpmIndicatorComponent.prototype.emitSummary = function () {
|
|
2290
|
+
this.cpmChange.emit({
|
|
2291
|
+
baseAmount: this.baseAmount,
|
|
2292
|
+
projectedAmount: this.projectedAmount,
|
|
2293
|
+
totalAmount: this.totalAmount,
|
|
2294
|
+
limit: this.limit,
|
|
2295
|
+
});
|
|
2296
|
+
};
|
|
2297
|
+
// Clampea el valor al límite para que el arco no desborde visualmente
|
|
2298
|
+
LibeyNgCpmIndicatorComponent.prototype.valueToAngle = function (value) {
|
|
2299
|
+
var clamped = Math.min(value, this.limit);
|
|
2300
|
+
return Math.PI - (clamped / this.limit) * Math.PI;
|
|
2301
|
+
};
|
|
2302
|
+
LibeyNgCpmIndicatorComponent.prototype.polar = function (angle, radius) {
|
|
2303
|
+
if (radius === void 0) { radius = this.R; }
|
|
2304
|
+
return {
|
|
2305
|
+
x: this.CX + radius * Math.cos(angle),
|
|
2306
|
+
y: this.CY - radius * Math.sin(angle),
|
|
2307
|
+
};
|
|
2308
|
+
};
|
|
2309
|
+
LibeyNgCpmIndicatorComponent.prototype.buildArcPath = function (a1, a2) {
|
|
2310
|
+
var start = this.polar(a1);
|
|
2311
|
+
var end = this.polar(a2);
|
|
2312
|
+
var large = (a1 - a2) > Math.PI ? 1 : 0;
|
|
2313
|
+
return "M " + start.x + " " + start.y + " A " + this.R + " " + this.R + " 0 " + large + " 1 " + end.x + " " + end.y;
|
|
2314
|
+
};
|
|
2315
|
+
LibeyNgCpmIndicatorComponent.prototype.getZoneColors = function (value, t) {
|
|
2316
|
+
var pct = value / this.limit;
|
|
2317
|
+
if (pct < t.zone1Max)
|
|
2318
|
+
return ZONE_COLORS['zone1'];
|
|
2319
|
+
if (pct < t.zone2Max)
|
|
2320
|
+
return ZONE_COLORS['zone2'];
|
|
2321
|
+
if (pct < t.zone3Max)
|
|
2322
|
+
return ZONE_COLORS['zone3'];
|
|
2323
|
+
return ZONE_COLORS['zone4'];
|
|
2324
|
+
};
|
|
2325
|
+
return LibeyNgCpmIndicatorComponent;
|
|
2326
|
+
}());
|
|
2327
|
+
LibeyNgCpmIndicatorComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: LibeyNgCpmIndicatorComponent, deps: [], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
2328
|
+
LibeyNgCpmIndicatorComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: LibeyNgCpmIndicatorComponent, selector: "lib-libey-ng-cpm-indicator", inputs: { limit: "limit", items: "items", currency: "currency", thresholds: "thresholds", mode: "mode", devMode: "devMode" }, outputs: { cpmChange: "cpmChange", limitExceeded: "limitExceeded" }, viewQueries: [{ propertyName: "cpmLegend", first: true, predicate: ["cpmLegend"], descendants: true }], usesOnChanges: true, ngImport: i0__namespace, template: "<!-- Modo CPM: solo el gauge con \"CPM\" en el centro -->\r\n<ng-container *ngIf=\"mode === CpmIndicatorMode.Cpm\">\r\n <div class=\"gauge-wrap\">\r\n <svg class=\"gauge-svg\" viewBox=\"0 0 220 130\" xmlns=\"http://www.w3.org/2000/svg\">\r\n <defs>\r\n <filter id=\"dotShadowCpm\" x=\"-60%\" y=\"-60%\" width=\"220%\" height=\"220%\">\r\n <feDropShadow dx=\"0\" dy=\"1\" stdDeviation=\"2\" flood-color=\"rgba(0,0,0,0.22)\"/>\r\n </filter>\r\n </defs>\r\n\r\n <path [attr.d]=\"trackArcPath\" fill=\"none\" stroke=\"#e8ecf5\" stroke-width=\"14\" stroke-linecap=\"round\"/>\r\n\r\n <!-- Proyecci\u00F3n debajo, real encima -->\r\n <path\r\n [style.display]=\"totalAmount > 0 ? '' : 'none'\"\r\n [attr.d]=\"totalArcPath\"\r\n [attr.stroke]=\"activeColors.light\"\r\n fill=\"none\" stroke-width=\"14\" stroke-linecap=\"round\"/>\r\n\r\n <path\r\n [style.display]=\"baseAmount > 0 ? '' : 'none'\"\r\n [attr.d]=\"baseArcPath\"\r\n [attr.stroke]=\"activeColors.dark\"\r\n fill=\"none\" stroke-width=\"14\" stroke-linecap=\"round\"/>\r\n\r\n <circle\r\n [style.display]=\"baseAmount > 0 ? '' : 'none'\"\r\n [attr.cx]=\"dotBasePos.x\" [attr.cy]=\"dotBasePos.y\"\r\n r=\"7\" [attr.fill]=\"activeColors.dark\"\r\n stroke=\"#ffffff\" stroke-width=\"2.5\"\r\n filter=\"url(#dotShadowCpm)\"/>\r\n\r\n <!-- Solo visible si la proyecci\u00F3n va por delante del real -->\r\n <circle\r\n [style.display]=\"dotTotalVisible ? '' : 'none'\"\r\n [attr.cx]=\"dotTotalPos.x\" [attr.cy]=\"dotTotalPos.y\"\r\n r=\"6\" [attr.fill]=\"activeColors.light\"\r\n stroke=\"#ffffff\" stroke-width=\"2.5\"\r\n filter=\"url(#dotShadowCpm)\"/>\r\n </svg>\r\n\r\n <div class=\"gauge-center gauge-center--cpm\">\r\n <div class=\"main-value\">CPM</div>\r\n </div>\r\n </div>\r\n</ng-container>\r\n\r\n\r\n<!-- Modo Gauge: gauge completo con montos, leyenda y alerta -->\r\n<ng-container *ngIf=\"mode === CpmIndicatorMode.Gauge\">\r\n <div class=\"gauge-wrap\">\r\n <svg class=\"gauge-svg\" viewBox=\"0 0 220 130\" xmlns=\"http://www.w3.org/2000/svg\">\r\n <defs>\r\n <filter id=\"dotShadowGauge\" x=\"-60%\" y=\"-60%\" width=\"220%\" height=\"220%\">\r\n <feDropShadow dx=\"0\" dy=\"1\" stdDeviation=\"2\" flood-color=\"rgba(0,0,0,0.22)\"/>\r\n </filter>\r\n </defs>\r\n\r\n <path [attr.d]=\"trackArcPath\" fill=\"none\" stroke=\"#e8ecf5\" stroke-width=\"14\" stroke-linecap=\"round\"/>\r\n\r\n <!-- Proyecci\u00F3n debajo, real encima -->\r\n <path\r\n [style.display]=\"totalAmount > 0 ? '' : 'none'\"\r\n [attr.d]=\"totalArcPath\"\r\n [attr.stroke]=\"activeColors.light\"\r\n fill=\"none\" stroke-width=\"14\" stroke-linecap=\"round\"/>\r\n\r\n <path\r\n [style.display]=\"baseAmount > 0 ? '' : 'none'\"\r\n [attr.d]=\"baseArcPath\"\r\n [attr.stroke]=\"activeColors.dark\"\r\n fill=\"none\" stroke-width=\"14\" stroke-linecap=\"round\"/>\r\n\r\n <circle\r\n [style.display]=\"baseAmount > 0 ? '' : 'none'\"\r\n [attr.cx]=\"dotBasePos.x\" [attr.cy]=\"dotBasePos.y\"\r\n r=\"7\" [attr.fill]=\"activeColors.dark\"\r\n stroke=\"#ffffff\" stroke-width=\"2.5\"\r\n filter=\"url(#dotShadowGauge)\"/>\r\n\r\n <circle\r\n [style.display]=\"dotTotalVisible ? '' : 'none'\"\r\n [attr.cx]=\"dotTotalPos.x\" [attr.cy]=\"dotTotalPos.y\"\r\n r=\"6\" [attr.fill]=\"activeColors.light\"\r\n stroke=\"#ffffff\" stroke-width=\"2.5\"\r\n filter=\"url(#dotShadowGauge)\"/>\r\n\r\n <!-- <text\r\n [attr.x]=\"limitTextPos.x\" [attr.y]=\"limitTextPos.y\"\r\n font-family=\"DM Mono,monospace\" font-size=\"9\" font-weight=\"600\"\r\n fill=\"#8a8fa8\" text-anchor=\"middle\">\r\n {{ currency }}{{ limit }}\r\n </text> -->\r\n </svg>\r\n\r\n <!-- El color del monto cambia a rojo si supera el l\u00EDmite -->\r\n <div class=\"gauge-center gauge-center--gauge\">\r\n <div class=\"main-value\" [style.color]=\"totalAmount > limit ? activeColors.dark : '#1a1a2e'\">\r\n CPM <br>\r\n {{ currency }}{{ totalAmount | number:'1.2-2' }}\r\n </div>\r\n <div class=\"limit-label\">de {{ currency }}{{ limit | number:'1.2-2' }}</div>\r\n </div>\r\n </div>\r\n\r\n <div class=\"legend\">\r\n <div class=\"legend-item\">\r\n <span class=\"dot\" [style.background]=\"activeColors.dark\"></span>\r\n Real\r\n </div>\r\n <div class=\"legend-item\">\r\n <span class=\"dot\"\r\n [style.background]=\"activeColors.light\"\r\n [style.border]=\"'1.5px solid ' + activeColors.dark\">\r\n </span>\r\n Proyecci\u00F3n\r\n </div>\r\n <div class=\"legend-item\">\r\n <span class=\"dot\" style=\"background:#e8ecf5; border:1px solid #ccc\"></span>\r\n Disponible\r\n </div>\r\n </div>\r\n\r\n <!-- Sliders de prueba \u2014 solo en devMode -->\r\n <ng-container *ngIf=\"devMode\">\r\n <div class=\"divider\"></div>\r\n <div class=\"dev-badge\">Dev Mode</div>\r\n <div class=\"controls\">\r\n\r\n <div class=\"ctrl-row\">\r\n <div class=\"ctrl-header\">\r\n <span class=\"ctrl-label\">\r\n <span class=\"ctrl-label-dot\" [style.background]=\"activeColors.dark\"></span>\r\n Gasto real (consumido)\r\n </span>\r\n <span class=\"ctrl-val\" [style.color]=\"activeColors.dark\">\r\n {{ currency }}{{ sliderBase | number:'1.2-2' }}\r\n </span>\r\n </div>\r\n <div class=\"zones-bar\">\r\n <div style=\"background:#16a34a\"></div>\r\n <div style=\"background:#ca8a04\"></div>\r\n <div style=\"background:#ea580c\"></div>\r\n <div style=\"background:#dc2626\"></div>\r\n </div>\r\n <input type=\"range\" [min]=\"0\" [max]=\"sliderMax\" step=\"0.5\"\r\n [value]=\"sliderBase\" (input)=\"onDevBaseChange($event)\">\r\n </div>\r\n\r\n <div class=\"ctrl-row\">\r\n <div class=\"ctrl-header\">\r\n <span class=\"ctrl-label\">\r\n <span class=\"ctrl-label-dot\"\r\n [style.background]=\"activeColors.light\"\r\n [style.border]=\"'1px solid ' + activeColors.dark\"\r\n style=\"border-radius:50%\">\r\n </span>\r\n Proyecci\u00F3n (presupuesto)\r\n </span>\r\n <span class=\"ctrl-val\" [style.color]=\"activeColors.dark\">\r\n {{ currency }}{{ sliderProjected | number:'1.2-2' }}\r\n </span>\r\n </div>\r\n <div class=\"zones-bar\">\r\n <div style=\"background:#16a34a\"></div>\r\n <div style=\"background:#ca8a04\"></div>\r\n <div style=\"background:#ea580c\"></div>\r\n <div style=\"background:#dc2626\"></div>\r\n </div>\r\n <input type=\"range\" [min]=\"0\" [max]=\"sliderMax\" step=\"0.5\"\r\n [value]=\"sliderProjected\" (input)=\"onDevProjectedChange($event)\">\r\n </div>\r\n\r\n </div>\r\n </ng-container>\r\n</ng-container>\r\n\r\n<ng-template #cpmLegend>\r\n <div class=\"legend-tooltip\">\r\n <div class=\"legend-tooltip__item\">\r\n <span class=\"dot\" [style.background]=\"activeColors.dark\"></span>\r\n Real<span *ngIf=\"mode === CpmIndicatorMode.Gauge\">: {{ currency }}{{ baseAmount | number:'1.2-2' }}</span>\r\n </div>\r\n <div class=\"legend-tooltip__item\">\r\n <span class=\"dot\" [style.background]=\"activeColors.light\"></span>\r\n Proyecci\u00F3n<span *ngIf=\"mode === CpmIndicatorMode.Gauge\">: {{ currency }}{{ projectedAmount | number:'1.2-2' }}</span>\r\n </div>\r\n <div class=\"legend-tooltip__item\">\r\n <span class=\"dot\" style=\"background:#e8ecf5\"></span>\r\n Disponible<span *ngIf=\"mode === CpmIndicatorMode.Gauge\">: {{ currency }}{{ (limit - totalAmount) | number:'1.2-2' }}</span>\r\n </div>\r\n </div>\r\n</ng-template>", styles: [":host{display:inline-flex;flex-direction:column;align-items:center;font-family:\"DM Sans\",sans-serif}.card{background:#ffffff;border-radius:20px;padding:36px 40px 28px;width:340px;box-shadow:0 4px 32px #0000001a,0 1px 4px #0000000f;display:flex;flex-direction:column;align-items:center}.gauge-wrap{position:relative;width:220px;height:120px;overflow:visible}.gauge-svg{width:220px;height:135px;overflow:visible}.gauge-center{position:absolute;left:50%;transform:translate(-50%);text-align:center;pointer-events:none;white-space:nowrap}.gauge-center--cpm{bottom:15px}.gauge-center--gauge{bottom:-10px}.main-value{font-size:26px;font-weight:700;font-family:\"DM Mono\",monospace;letter-spacing:-.5px;color:#1a1a2e;line-height:1;transition:color .3s ease}.limit-label{font-size:12px;color:#8a8fa8;font-weight:400;margin-top:3px;font-family:\"DM Mono\",monospace}.legend{display:flex;grid-gap:14px;gap:14px;margin-top:22px;margin-bottom:6px;flex-wrap:wrap;justify-content:center}.legend-item{display:flex;align-items:center;grid-gap:6px;gap:6px;font-size:12px;color:#555;font-weight:500}.dot{width:9px;height:9px;border-radius:50%;flex-shrink:0}.divider{width:100%;height:1px;background:#f0f2f5;margin:14px 0 4px}.dev-badge{font-size:11px;font-weight:700;color:#7c3aed;background:#ede9fe;border-radius:6px;padding:3px 10px;margin-bottom:8px;letter-spacing:.3px}.controls{width:100%;display:flex;flex-direction:column;grid-gap:16px;gap:16px}.ctrl-row{display:flex;flex-direction:column;grid-gap:5px;gap:5px}.ctrl-header{display:flex;justify-content:space-between;align-items:center}.ctrl-label{font-size:12px;color:#8a8fa8;font-weight:500;display:flex;align-items:center;grid-gap:5px;gap:5px}.ctrl-label-dot{width:8px;height:8px;border-radius:50%;display:inline-block;flex-shrink:0}.ctrl-val{font-size:12px;font-family:\"DM Mono\",monospace;font-weight:600;color:#1a1a2e}.zones-bar{display:flex;border-radius:4px;overflow:hidden;height:3px;width:100%;margin-bottom:3px}.zones-bar div{flex:1}input[type=range]{appearance:none;width:100%;height:5px;border-radius:99px;background:#e2e6ef;outline:none;cursor:pointer}input[type=range]::-webkit-slider-thumb{-webkit-appearance:none;width:18px;height:18px;border-radius:50%;background:#16a34a;border:2.5px solid #fff;box-shadow:0 1px 8px #0003;cursor:grab;-webkit-transition:background .3s,transform .15s;transition:background .3s,transform .15s}input[type=range]::-webkit-slider-thumb:active{transform:scale(1.2);cursor:grabbing}input[type=range]::-moz-range-thumb{width:18px;height:18px;border-radius:50%;background:#16a34a;border:2.5px solid #fff;cursor:grab}\n"], directives: [{ type: i1__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "number": i1__namespace.DecimalPipe } });
|
|
2329
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: LibeyNgCpmIndicatorComponent, decorators: [{
|
|
2330
|
+
type: i0.Component,
|
|
2331
|
+
args: [{
|
|
2332
|
+
selector: 'lib-libey-ng-cpm-indicator',
|
|
2333
|
+
templateUrl: './libey-ng-cpm-indicator.component.html',
|
|
2334
|
+
styleUrls: ['./libey-ng-cpm-indicator.component.css']
|
|
2335
|
+
}]
|
|
2336
|
+
}], ctorParameters: function () { return []; }, propDecorators: { limit: [{
|
|
2337
|
+
type: i0.Input
|
|
2338
|
+
}], items: [{
|
|
2339
|
+
type: i0.Input
|
|
2340
|
+
}], currency: [{
|
|
2341
|
+
type: i0.Input
|
|
2342
|
+
}], thresholds: [{
|
|
2343
|
+
type: i0.Input
|
|
2344
|
+
}], mode: [{
|
|
2345
|
+
type: i0.Input
|
|
2346
|
+
}], devMode: [{
|
|
2347
|
+
type: i0.Input
|
|
2348
|
+
}], cpmChange: [{
|
|
2349
|
+
type: i0.Output
|
|
2350
|
+
}], limitExceeded: [{
|
|
2351
|
+
type: i0.Output
|
|
2352
|
+
}], cpmLegend: [{
|
|
2353
|
+
type: i0.ViewChild,
|
|
2354
|
+
args: ['cpmLegend']
|
|
2355
|
+
}] } });
|
|
2356
|
+
|
|
2357
|
+
var LibeyNgCpmIndicatorModule = /** @class */ (function () {
|
|
2358
|
+
function LibeyNgCpmIndicatorModule() {
|
|
2359
|
+
}
|
|
2360
|
+
return LibeyNgCpmIndicatorModule;
|
|
2361
|
+
}());
|
|
2362
|
+
LibeyNgCpmIndicatorModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: LibeyNgCpmIndicatorModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
|
|
2363
|
+
LibeyNgCpmIndicatorModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: LibeyNgCpmIndicatorModule, declarations: [LibeyNgCpmIndicatorComponent], imports: [i1$1.CommonModule], exports: [LibeyNgCpmIndicatorComponent] });
|
|
2364
|
+
LibeyNgCpmIndicatorModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: LibeyNgCpmIndicatorModule, imports: [[
|
|
2365
|
+
i1$1.CommonModule
|
|
2366
|
+
]] });
|
|
2367
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: LibeyNgCpmIndicatorModule, decorators: [{
|
|
2368
|
+
type: i0.NgModule,
|
|
2369
|
+
args: [{
|
|
2370
|
+
declarations: [
|
|
2371
|
+
LibeyNgCpmIndicatorComponent
|
|
2372
|
+
],
|
|
2373
|
+
imports: [
|
|
2374
|
+
i1$1.CommonModule
|
|
2375
|
+
],
|
|
2376
|
+
exports: [
|
|
2377
|
+
LibeyNgCpmIndicatorComponent
|
|
2378
|
+
]
|
|
2379
|
+
}]
|
|
2380
|
+
}] });
|
|
2381
|
+
|
|
2149
2382
|
var LibeyNgComponentLibraryModule = /** @class */ (function () {
|
|
2150
2383
|
function LibeyNgComponentLibraryModule() {
|
|
2151
2384
|
}
|
|
@@ -2157,21 +2390,25 @@
|
|
|
2157
2390
|
LibeyNgTableModule,
|
|
2158
2391
|
LibeyNgSignatureModule,
|
|
2159
2392
|
i2.SignaturePadModule,
|
|
2160
|
-
IconsModule
|
|
2393
|
+
IconsModule,
|
|
2394
|
+
LibeyNgCpmIndicatorModule], exports: [LibeyNgTableModule,
|
|
2161
2395
|
LibeyNgSignatureModule,
|
|
2162
2396
|
i2.SignaturePadModule,
|
|
2163
|
-
IconsModule
|
|
2397
|
+
IconsModule,
|
|
2398
|
+
LibeyNgCpmIndicatorModule] });
|
|
2164
2399
|
LibeyNgComponentLibraryModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: LibeyNgComponentLibraryModule, providers: [i1$1.DatePipe], imports: [[
|
|
2165
2400
|
i1$1.CommonModule,
|
|
2166
2401
|
i3.FormsModule,
|
|
2167
2402
|
LibeyNgTableModule,
|
|
2168
2403
|
LibeyNgSignatureModule,
|
|
2169
2404
|
i2.SignaturePadModule,
|
|
2170
|
-
IconsModule
|
|
2405
|
+
IconsModule,
|
|
2406
|
+
LibeyNgCpmIndicatorModule,
|
|
2171
2407
|
], LibeyNgTableModule,
|
|
2172
2408
|
LibeyNgSignatureModule,
|
|
2173
2409
|
i2.SignaturePadModule,
|
|
2174
|
-
IconsModule
|
|
2410
|
+
IconsModule,
|
|
2411
|
+
LibeyNgCpmIndicatorModule] });
|
|
2175
2412
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: LibeyNgComponentLibraryModule, decorators: [{
|
|
2176
2413
|
type: i0.NgModule,
|
|
2177
2414
|
args: [{
|
|
@@ -2182,13 +2419,15 @@
|
|
|
2182
2419
|
LibeyNgTableModule,
|
|
2183
2420
|
LibeyNgSignatureModule,
|
|
2184
2421
|
i2.SignaturePadModule,
|
|
2185
|
-
IconsModule
|
|
2422
|
+
IconsModule,
|
|
2423
|
+
LibeyNgCpmIndicatorModule,
|
|
2186
2424
|
],
|
|
2187
2425
|
exports: [
|
|
2188
2426
|
LibeyNgTableModule,
|
|
2189
2427
|
LibeyNgSignatureModule,
|
|
2190
2428
|
i2.SignaturePadModule,
|
|
2191
2429
|
IconsModule,
|
|
2430
|
+
LibeyNgCpmIndicatorModule
|
|
2192
2431
|
],
|
|
2193
2432
|
providers: [i1$1.DatePipe]
|
|
2194
2433
|
}]
|
|
@@ -2218,17 +2457,21 @@
|
|
|
2218
2457
|
enumerable: true,
|
|
2219
2458
|
get: function () { return ngBootstrap.NgbModule; }
|
|
2220
2459
|
});
|
|
2460
|
+
exports.DEFAULT_THRESHOLDS = DEFAULT_THRESHOLDS;
|
|
2221
2461
|
exports.IconsModule = IconsModule;
|
|
2222
2462
|
exports.LibeyColumnDirective = LibeyColumnDirective;
|
|
2223
2463
|
exports.LibeyNgComponentLibraryComponent = LibeyNgComponentLibraryComponent;
|
|
2224
2464
|
exports.LibeyNgComponentLibraryModule = LibeyNgComponentLibraryModule;
|
|
2225
2465
|
exports.LibeyNgComponentLibraryService = LibeyNgComponentLibraryService;
|
|
2466
|
+
exports.LibeyNgCpmIndicatorComponent = LibeyNgCpmIndicatorComponent;
|
|
2467
|
+
exports.LibeyNgCpmIndicatorModule = LibeyNgCpmIndicatorModule;
|
|
2226
2468
|
exports.LibeyNgIconsComponent = LibeyNgIconsComponent;
|
|
2227
2469
|
exports.LibeyNgSignatureComponent = LibeyNgSignatureComponent;
|
|
2228
2470
|
exports.LibeyNgSignatureModule = LibeyNgSignatureModule;
|
|
2229
2471
|
exports.LibeyNgTableComponent = LibeyNgTableComponent;
|
|
2230
2472
|
exports.LibeyNgTableModule = LibeyNgTableModule;
|
|
2231
2473
|
exports.SigWebTablet = SigWebTablet;
|
|
2474
|
+
exports.ZONE_COLORS = ZONE_COLORS;
|
|
2232
2475
|
Object.keys(core).forEach(function (k) {
|
|
2233
2476
|
if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, {
|
|
2234
2477
|
enumerable: true,
|