libey-ng-component-library 0.0.29 → 0.0.31
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 +251 -5
- package/bundles/libey-ng-component-library.umd.js.map +1 -1
- package/esm2015/lib/cpm-indicator/libey-ng-cpm-indicator.component.js +184 -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 +247 -14
- package/fesm2015/libey-ng-component-library.js.map +1 -1
- package/lib/cpm-indicator/libey-ng-cpm-indicator.component.d.ts +65 -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,242 @@
|
|
|
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
|
+
this.scale = 1;
|
|
2197
|
+
// ── Propiedades del template ──
|
|
2198
|
+
this.baseAmount = 0;
|
|
2199
|
+
this.projectedAmount = 0;
|
|
2200
|
+
this.totalAmount = 0;
|
|
2201
|
+
this.excess = 0;
|
|
2202
|
+
this.activeColors = ZONE_COLORS['zone1'];
|
|
2203
|
+
this.trackArcPath = '';
|
|
2204
|
+
this.baseArcPath = '';
|
|
2205
|
+
this.totalArcPath = '';
|
|
2206
|
+
this.dotBasePos = { x: 0, y: 0 };
|
|
2207
|
+
this.dotTotalPos = { x: 0, y: 0 };
|
|
2208
|
+
this.dotTotalVisible = false;
|
|
2209
|
+
this.limitTextPos = { x: 0, y: 0 };
|
|
2210
|
+
// ── devMode ──
|
|
2211
|
+
this.sliderBase = 0;
|
|
2212
|
+
this.sliderProjected = 0;
|
|
2213
|
+
// Necesario para usar el enum en el template
|
|
2214
|
+
this.CpmIndicatorMode = exports.CpmIndicatorMode;
|
|
2215
|
+
// Geometría del SVG (coordenadas internas del viewBox 220x130)
|
|
2216
|
+
this.CX = 110;
|
|
2217
|
+
this.CY = 115;
|
|
2218
|
+
this.R = 90;
|
|
2219
|
+
this.ANGLE_START = Math.PI;
|
|
2220
|
+
this.ANGLE_END = 0;
|
|
2221
|
+
this.EXCESS_TOLERANCE = 0.005;
|
|
2222
|
+
}
|
|
2223
|
+
Object.defineProperty(LibeyNgCpmIndicatorComponent.prototype, "sliderMax", {
|
|
2224
|
+
get: function () {
|
|
2225
|
+
return this.limit * 1.5;
|
|
2226
|
+
},
|
|
2227
|
+
enumerable: false,
|
|
2228
|
+
configurable: true
|
|
2229
|
+
});
|
|
2230
|
+
LibeyNgCpmIndicatorComponent.prototype.ngOnInit = function () {
|
|
2231
|
+
this.recalculate();
|
|
2232
|
+
};
|
|
2233
|
+
LibeyNgCpmIndicatorComponent.prototype.ngOnChanges = function (changes) {
|
|
2234
|
+
if (changes['items'] || changes['limit'] || changes['thresholds']) {
|
|
2235
|
+
this.recalculate();
|
|
2236
|
+
}
|
|
2237
|
+
};
|
|
2238
|
+
LibeyNgCpmIndicatorComponent.prototype.onDevBaseChange = function (event) {
|
|
2239
|
+
this.sliderBase = parseFloat(event.target.value);
|
|
2240
|
+
if (this.sliderBase > this.sliderProjected) {
|
|
2241
|
+
this.sliderProjected = this.sliderBase;
|
|
2242
|
+
}
|
|
2243
|
+
this.recalculateFromSliders();
|
|
2244
|
+
};
|
|
2245
|
+
LibeyNgCpmIndicatorComponent.prototype.onDevProjectedChange = function (event) {
|
|
2246
|
+
this.sliderProjected = parseFloat(event.target.value);
|
|
2247
|
+
if (this.sliderProjected < this.sliderBase) {
|
|
2248
|
+
this.sliderProjected = this.sliderBase;
|
|
2249
|
+
}
|
|
2250
|
+
this.recalculateFromSliders();
|
|
2251
|
+
};
|
|
2252
|
+
// Flujo de producción: calcula a partir del array de items
|
|
2253
|
+
LibeyNgCpmIndicatorComponent.prototype.recalculate = function () {
|
|
2254
|
+
this.baseAmount = this.items
|
|
2255
|
+
.filter(function (i) { return i.type === exports.CpmItemType.Base; })
|
|
2256
|
+
.reduce(function (acc, i) { return acc + i.amount; }, 0);
|
|
2257
|
+
this.projectedAmount = this.items
|
|
2258
|
+
.filter(function (i) { return i.type === exports.CpmItemType.Projected; })
|
|
2259
|
+
.reduce(function (acc, i) { return acc + i.amount; }, 0);
|
|
2260
|
+
this.totalAmount = this.baseAmount + this.projectedAmount;
|
|
2261
|
+
// Sincroniza sliders por si se activa devMode
|
|
2262
|
+
this.sliderBase = this.baseAmount;
|
|
2263
|
+
this.sliderProjected = this.totalAmount;
|
|
2264
|
+
this.updateGauge();
|
|
2265
|
+
this.emitSummary();
|
|
2266
|
+
};
|
|
2267
|
+
// Flujo de devMode: calcula a partir de los sliders
|
|
2268
|
+
LibeyNgCpmIndicatorComponent.prototype.recalculateFromSliders = function () {
|
|
2269
|
+
this.baseAmount = this.sliderBase;
|
|
2270
|
+
this.projectedAmount = this.sliderProjected - this.sliderBase;
|
|
2271
|
+
this.totalAmount = this.sliderProjected;
|
|
2272
|
+
this.updateGauge();
|
|
2273
|
+
this.emitSummary();
|
|
2274
|
+
};
|
|
2275
|
+
LibeyNgCpmIndicatorComponent.prototype.updateGauge = function () {
|
|
2276
|
+
var _a;
|
|
2277
|
+
var thresholds = (_a = this.thresholds) !== null && _a !== void 0 ? _a : DEFAULT_THRESHOLDS;
|
|
2278
|
+
this.activeColors = this.getZoneColors(this.totalAmount, thresholds);
|
|
2279
|
+
this.trackArcPath = this.buildArcPath(this.ANGLE_START, this.ANGLE_END);
|
|
2280
|
+
this.totalArcPath = this.buildArcPath(this.ANGLE_START, this.valueToAngle(this.totalAmount));
|
|
2281
|
+
this.baseArcPath = this.buildArcPath(this.ANGLE_START, this.valueToAngle(this.baseAmount));
|
|
2282
|
+
this.dotBasePos = this.polar(this.valueToAngle(this.baseAmount));
|
|
2283
|
+
this.dotTotalPos = this.polar(this.valueToAngle(this.totalAmount));
|
|
2284
|
+
// El punto de proyección solo aparece si va delante del real y no llegó al borde
|
|
2285
|
+
this.dotTotalVisible = this.totalAmount > this.baseAmount && this.totalAmount < this.limit;
|
|
2286
|
+
this.limitTextPos = this.polar(this.ANGLE_END, this.R + 20);
|
|
2287
|
+
this.excess = Math.max(0, this.totalAmount - this.limit);
|
|
2288
|
+
this.limitExceeded.emit(this.excess > this.EXCESS_TOLERANCE);
|
|
2289
|
+
};
|
|
2290
|
+
LibeyNgCpmIndicatorComponent.prototype.emitSummary = function () {
|
|
2291
|
+
this.cpmChange.emit({
|
|
2292
|
+
baseAmount: this.baseAmount,
|
|
2293
|
+
projectedAmount: this.projectedAmount,
|
|
2294
|
+
totalAmount: this.totalAmount,
|
|
2295
|
+
limit: this.limit,
|
|
2296
|
+
});
|
|
2297
|
+
};
|
|
2298
|
+
// Clampea el valor al límite para que el arco no desborde visualmente
|
|
2299
|
+
LibeyNgCpmIndicatorComponent.prototype.valueToAngle = function (value) {
|
|
2300
|
+
var clamped = Math.min(value, this.limit);
|
|
2301
|
+
return Math.PI - (clamped / this.limit) * Math.PI;
|
|
2302
|
+
};
|
|
2303
|
+
LibeyNgCpmIndicatorComponent.prototype.polar = function (angle, radius) {
|
|
2304
|
+
if (radius === void 0) { radius = this.R; }
|
|
2305
|
+
return {
|
|
2306
|
+
x: this.CX + radius * Math.cos(angle),
|
|
2307
|
+
y: this.CY - radius * Math.sin(angle),
|
|
2308
|
+
};
|
|
2309
|
+
};
|
|
2310
|
+
LibeyNgCpmIndicatorComponent.prototype.buildArcPath = function (a1, a2) {
|
|
2311
|
+
var start = this.polar(a1);
|
|
2312
|
+
var end = this.polar(a2);
|
|
2313
|
+
var large = (a1 - a2) > Math.PI ? 1 : 0;
|
|
2314
|
+
return "M " + start.x + " " + start.y + " A " + this.R + " " + this.R + " 0 " + large + " 1 " + end.x + " " + end.y;
|
|
2315
|
+
};
|
|
2316
|
+
LibeyNgCpmIndicatorComponent.prototype.getZoneColors = function (value, t) {
|
|
2317
|
+
var pct = value / this.limit;
|
|
2318
|
+
if (pct < t.zone1Max)
|
|
2319
|
+
return ZONE_COLORS['zone1'];
|
|
2320
|
+
if (pct < t.zone2Max)
|
|
2321
|
+
return ZONE_COLORS['zone2'];
|
|
2322
|
+
if (pct < t.zone3Max)
|
|
2323
|
+
return ZONE_COLORS['zone3'];
|
|
2324
|
+
return ZONE_COLORS['zone4'];
|
|
2325
|
+
};
|
|
2326
|
+
return LibeyNgCpmIndicatorComponent;
|
|
2327
|
+
}());
|
|
2328
|
+
LibeyNgCpmIndicatorComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: LibeyNgCpmIndicatorComponent, deps: [], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
2329
|
+
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", scale: "scale" }, 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\" [style.width.px]=\"220 * scale\" [style.height.px]=\"120 * scale\">\r\n <svg class=\"gauge-svg\" viewBox=\"0 0 220 130\" xmlns=\"http://www.w3.org/2000/svg\"\r\n [style.width.px]=\"220 * scale\"\r\n [style.height.px]=\"135 * scale\">\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\" [style.bottom.px]=\"15 * scale\">\r\n <div class=\"main-value\" [style.font-size.px]=\"26 * scale\">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\" [style.width.px]=\"220 * scale\" [style.height.px]=\"120 * scale\">\r\n <svg class=\"gauge-svg\" viewBox=\"0 0 220 130\" xmlns=\"http://www.w3.org/2000/svg\"\r\n [style.width.px]=\"220 * scale\"\r\n [style.height.px]=\"135 * scale\">\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\" [style.bottom.px]=\"-10 * scale\">\r\n <div class=\"main-value\"\r\n [style.font-size.px]=\"26 * scale\"\r\n [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\" [style.font-size.px]=\"16 * scale\">\r\n de {{ currency }}{{ limit | number:'1.2-2' }}\r\n </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;overflow:visible}.gauge-svg{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 } });
|
|
2330
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: LibeyNgCpmIndicatorComponent, decorators: [{
|
|
2331
|
+
type: i0.Component,
|
|
2332
|
+
args: [{
|
|
2333
|
+
selector: 'lib-libey-ng-cpm-indicator',
|
|
2334
|
+
templateUrl: './libey-ng-cpm-indicator.component.html',
|
|
2335
|
+
styleUrls: ['./libey-ng-cpm-indicator.component.css']
|
|
2336
|
+
}]
|
|
2337
|
+
}], ctorParameters: function () { return []; }, propDecorators: { limit: [{
|
|
2338
|
+
type: i0.Input
|
|
2339
|
+
}], items: [{
|
|
2340
|
+
type: i0.Input
|
|
2341
|
+
}], currency: [{
|
|
2342
|
+
type: i0.Input
|
|
2343
|
+
}], thresholds: [{
|
|
2344
|
+
type: i0.Input
|
|
2345
|
+
}], mode: [{
|
|
2346
|
+
type: i0.Input
|
|
2347
|
+
}], devMode: [{
|
|
2348
|
+
type: i0.Input
|
|
2349
|
+
}], cpmChange: [{
|
|
2350
|
+
type: i0.Output
|
|
2351
|
+
}], limitExceeded: [{
|
|
2352
|
+
type: i0.Output
|
|
2353
|
+
}], cpmLegend: [{
|
|
2354
|
+
type: i0.ViewChild,
|
|
2355
|
+
args: ['cpmLegend']
|
|
2356
|
+
}], scale: [{
|
|
2357
|
+
type: i0.Input
|
|
2358
|
+
}] } });
|
|
2359
|
+
|
|
2360
|
+
var LibeyNgCpmIndicatorModule = /** @class */ (function () {
|
|
2361
|
+
function LibeyNgCpmIndicatorModule() {
|
|
2362
|
+
}
|
|
2363
|
+
return LibeyNgCpmIndicatorModule;
|
|
2364
|
+
}());
|
|
2365
|
+
LibeyNgCpmIndicatorModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: LibeyNgCpmIndicatorModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
|
|
2366
|
+
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] });
|
|
2367
|
+
LibeyNgCpmIndicatorModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: LibeyNgCpmIndicatorModule, imports: [[
|
|
2368
|
+
i1$1.CommonModule
|
|
2369
|
+
]] });
|
|
2370
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: LibeyNgCpmIndicatorModule, decorators: [{
|
|
2371
|
+
type: i0.NgModule,
|
|
2372
|
+
args: [{
|
|
2373
|
+
declarations: [
|
|
2374
|
+
LibeyNgCpmIndicatorComponent
|
|
2375
|
+
],
|
|
2376
|
+
imports: [
|
|
2377
|
+
i1$1.CommonModule
|
|
2378
|
+
],
|
|
2379
|
+
exports: [
|
|
2380
|
+
LibeyNgCpmIndicatorComponent
|
|
2381
|
+
]
|
|
2382
|
+
}]
|
|
2383
|
+
}] });
|
|
2384
|
+
|
|
2149
2385
|
var LibeyNgComponentLibraryModule = /** @class */ (function () {
|
|
2150
2386
|
function LibeyNgComponentLibraryModule() {
|
|
2151
2387
|
}
|
|
@@ -2157,21 +2393,25 @@
|
|
|
2157
2393
|
LibeyNgTableModule,
|
|
2158
2394
|
LibeyNgSignatureModule,
|
|
2159
2395
|
i2.SignaturePadModule,
|
|
2160
|
-
IconsModule
|
|
2396
|
+
IconsModule,
|
|
2397
|
+
LibeyNgCpmIndicatorModule], exports: [LibeyNgTableModule,
|
|
2161
2398
|
LibeyNgSignatureModule,
|
|
2162
2399
|
i2.SignaturePadModule,
|
|
2163
|
-
IconsModule
|
|
2400
|
+
IconsModule,
|
|
2401
|
+
LibeyNgCpmIndicatorModule] });
|
|
2164
2402
|
LibeyNgComponentLibraryModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: LibeyNgComponentLibraryModule, providers: [i1$1.DatePipe], imports: [[
|
|
2165
2403
|
i1$1.CommonModule,
|
|
2166
2404
|
i3.FormsModule,
|
|
2167
2405
|
LibeyNgTableModule,
|
|
2168
2406
|
LibeyNgSignatureModule,
|
|
2169
2407
|
i2.SignaturePadModule,
|
|
2170
|
-
IconsModule
|
|
2408
|
+
IconsModule,
|
|
2409
|
+
LibeyNgCpmIndicatorModule,
|
|
2171
2410
|
], LibeyNgTableModule,
|
|
2172
2411
|
LibeyNgSignatureModule,
|
|
2173
2412
|
i2.SignaturePadModule,
|
|
2174
|
-
IconsModule
|
|
2413
|
+
IconsModule,
|
|
2414
|
+
LibeyNgCpmIndicatorModule] });
|
|
2175
2415
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: LibeyNgComponentLibraryModule, decorators: [{
|
|
2176
2416
|
type: i0.NgModule,
|
|
2177
2417
|
args: [{
|
|
@@ -2182,13 +2422,15 @@
|
|
|
2182
2422
|
LibeyNgTableModule,
|
|
2183
2423
|
LibeyNgSignatureModule,
|
|
2184
2424
|
i2.SignaturePadModule,
|
|
2185
|
-
IconsModule
|
|
2425
|
+
IconsModule,
|
|
2426
|
+
LibeyNgCpmIndicatorModule,
|
|
2186
2427
|
],
|
|
2187
2428
|
exports: [
|
|
2188
2429
|
LibeyNgTableModule,
|
|
2189
2430
|
LibeyNgSignatureModule,
|
|
2190
2431
|
i2.SignaturePadModule,
|
|
2191
2432
|
IconsModule,
|
|
2433
|
+
LibeyNgCpmIndicatorModule
|
|
2192
2434
|
],
|
|
2193
2435
|
providers: [i1$1.DatePipe]
|
|
2194
2436
|
}]
|
|
@@ -2218,17 +2460,21 @@
|
|
|
2218
2460
|
enumerable: true,
|
|
2219
2461
|
get: function () { return ngBootstrap.NgbModule; }
|
|
2220
2462
|
});
|
|
2463
|
+
exports.DEFAULT_THRESHOLDS = DEFAULT_THRESHOLDS;
|
|
2221
2464
|
exports.IconsModule = IconsModule;
|
|
2222
2465
|
exports.LibeyColumnDirective = LibeyColumnDirective;
|
|
2223
2466
|
exports.LibeyNgComponentLibraryComponent = LibeyNgComponentLibraryComponent;
|
|
2224
2467
|
exports.LibeyNgComponentLibraryModule = LibeyNgComponentLibraryModule;
|
|
2225
2468
|
exports.LibeyNgComponentLibraryService = LibeyNgComponentLibraryService;
|
|
2469
|
+
exports.LibeyNgCpmIndicatorComponent = LibeyNgCpmIndicatorComponent;
|
|
2470
|
+
exports.LibeyNgCpmIndicatorModule = LibeyNgCpmIndicatorModule;
|
|
2226
2471
|
exports.LibeyNgIconsComponent = LibeyNgIconsComponent;
|
|
2227
2472
|
exports.LibeyNgSignatureComponent = LibeyNgSignatureComponent;
|
|
2228
2473
|
exports.LibeyNgSignatureModule = LibeyNgSignatureModule;
|
|
2229
2474
|
exports.LibeyNgTableComponent = LibeyNgTableComponent;
|
|
2230
2475
|
exports.LibeyNgTableModule = LibeyNgTableModule;
|
|
2231
2476
|
exports.SigWebTablet = SigWebTablet;
|
|
2477
|
+
exports.ZONE_COLORS = ZONE_COLORS;
|
|
2232
2478
|
Object.keys(core).forEach(function (k) {
|
|
2233
2479
|
if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, {
|
|
2234
2480
|
enumerable: true,
|