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
|
@@ -33,19 +33,19 @@ class LibeyNgComponentLibraryComponent {
|
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
LibeyNgComponentLibraryComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: LibeyNgComponentLibraryComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
36
|
-
LibeyNgComponentLibraryComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: LibeyNgComponentLibraryComponent, selector: "lib-libey-ngComponent-library", ngImport: i0, template: `
|
|
37
|
-
<p>
|
|
38
|
-
libey-ng-component-library works!
|
|
39
|
-
</p>
|
|
36
|
+
LibeyNgComponentLibraryComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: LibeyNgComponentLibraryComponent, selector: "lib-libey-ngComponent-library", ngImport: i0, template: `
|
|
37
|
+
<p>
|
|
38
|
+
libey-ng-component-library works!
|
|
39
|
+
</p>
|
|
40
40
|
`, isInline: true });
|
|
41
41
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: LibeyNgComponentLibraryComponent, decorators: [{
|
|
42
42
|
type: Component,
|
|
43
43
|
args: [{
|
|
44
44
|
selector: 'lib-libey-ngComponent-library',
|
|
45
|
-
template: `
|
|
46
|
-
<p>
|
|
47
|
-
libey-ng-component-library works!
|
|
48
|
-
</p>
|
|
45
|
+
template: `
|
|
46
|
+
<p>
|
|
47
|
+
libey-ng-component-library works!
|
|
48
|
+
</p>
|
|
49
49
|
`,
|
|
50
50
|
styles: []
|
|
51
51
|
}]
|
|
@@ -2094,6 +2094,233 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImpo
|
|
|
2094
2094
|
}]
|
|
2095
2095
|
}] });
|
|
2096
2096
|
|
|
2097
|
+
// Modos de visualización del indicador
|
|
2098
|
+
var CpmIndicatorMode;
|
|
2099
|
+
(function (CpmIndicatorMode) {
|
|
2100
|
+
CpmIndicatorMode["Cpm"] = "cpm";
|
|
2101
|
+
CpmIndicatorMode["Gauge"] = "gauge";
|
|
2102
|
+
})(CpmIndicatorMode || (CpmIndicatorMode = {}));
|
|
2103
|
+
// Tipo de ítem: gasto ya consumido (Base) o estimado (Projected)
|
|
2104
|
+
var CpmItemType;
|
|
2105
|
+
(function (CpmItemType) {
|
|
2106
|
+
CpmItemType["Base"] = "base";
|
|
2107
|
+
CpmItemType["Projected"] = "projected";
|
|
2108
|
+
})(CpmItemType || (CpmItemType = {}));
|
|
2109
|
+
// Tercios por defecto si no se proporcionan thresholds
|
|
2110
|
+
const DEFAULT_THRESHOLDS = {
|
|
2111
|
+
zone1Max: 1 / 3,
|
|
2112
|
+
zone2Max: 2 / 3,
|
|
2113
|
+
zone3Max: 1.0,
|
|
2114
|
+
};
|
|
2115
|
+
const ZONE_COLORS = {
|
|
2116
|
+
zone1: { dark: '#16a34a', light: '#86efac' },
|
|
2117
|
+
zone2: { dark: '#ca8a04', light: '#fde68a' },
|
|
2118
|
+
zone3: { dark: '#ea580c', light: '#fdba74' },
|
|
2119
|
+
zone4: { dark: '#dc2626', light: '#fca5a5' }, // Rojo
|
|
2120
|
+
};
|
|
2121
|
+
|
|
2122
|
+
class LibeyNgCpmIndicatorComponent {
|
|
2123
|
+
constructor() {
|
|
2124
|
+
/** Tope máximo del contrato. */
|
|
2125
|
+
this.limit = 250;
|
|
2126
|
+
/**
|
|
2127
|
+
* Ítems de gasto. El padre es responsable de:
|
|
2128
|
+
* - Excluir ítems que no aplican al CPM
|
|
2129
|
+
* - Marcar cada uno con CpmItemType.Base o CpmItemType.Projected
|
|
2130
|
+
* - Actualizar el array al agregar o eliminar
|
|
2131
|
+
*/
|
|
2132
|
+
this.items = [];
|
|
2133
|
+
/** Símbolo de moneda. Por defecto 's/' (sol peruano). */
|
|
2134
|
+
this.currency = 's/';
|
|
2135
|
+
/** Modo de visualización: CPM (solo gauge) o Gauge (montos + leyenda). */
|
|
2136
|
+
this.mode = CpmIndicatorMode.Cpm;
|
|
2137
|
+
/** Activa sliders de prueba. Solo para desarrollo, nunca en producción. */
|
|
2138
|
+
this.devMode = false;
|
|
2139
|
+
// ── Outputs ──
|
|
2140
|
+
/** Emite el resumen de montos en cada recalculo. Usar para persistir en BD. */
|
|
2141
|
+
this.cpmChange = new EventEmitter();
|
|
2142
|
+
/** Emite true cuando la proyección supera el límite. */
|
|
2143
|
+
this.limitExceeded = new EventEmitter();
|
|
2144
|
+
this.scale = 1;
|
|
2145
|
+
// ── Propiedades del template ──
|
|
2146
|
+
this.baseAmount = 0;
|
|
2147
|
+
this.projectedAmount = 0;
|
|
2148
|
+
this.totalAmount = 0;
|
|
2149
|
+
this.excess = 0;
|
|
2150
|
+
this.activeColors = ZONE_COLORS['zone1'];
|
|
2151
|
+
this.trackArcPath = '';
|
|
2152
|
+
this.baseArcPath = '';
|
|
2153
|
+
this.totalArcPath = '';
|
|
2154
|
+
this.dotBasePos = { x: 0, y: 0 };
|
|
2155
|
+
this.dotTotalPos = { x: 0, y: 0 };
|
|
2156
|
+
this.dotTotalVisible = false;
|
|
2157
|
+
this.limitTextPos = { x: 0, y: 0 };
|
|
2158
|
+
// ── devMode ──
|
|
2159
|
+
this.sliderBase = 0;
|
|
2160
|
+
this.sliderProjected = 0;
|
|
2161
|
+
// Necesario para usar el enum en el template
|
|
2162
|
+
this.CpmIndicatorMode = CpmIndicatorMode;
|
|
2163
|
+
// Geometría del SVG (coordenadas internas del viewBox 220x130)
|
|
2164
|
+
this.CX = 110;
|
|
2165
|
+
this.CY = 115;
|
|
2166
|
+
this.R = 90;
|
|
2167
|
+
this.ANGLE_START = Math.PI;
|
|
2168
|
+
this.ANGLE_END = 0;
|
|
2169
|
+
this.EXCESS_TOLERANCE = 0.005;
|
|
2170
|
+
}
|
|
2171
|
+
get sliderMax() {
|
|
2172
|
+
return this.limit * 1.5;
|
|
2173
|
+
}
|
|
2174
|
+
ngOnInit() {
|
|
2175
|
+
this.recalculate();
|
|
2176
|
+
}
|
|
2177
|
+
ngOnChanges(changes) {
|
|
2178
|
+
if (changes['items'] || changes['limit'] || changes['thresholds']) {
|
|
2179
|
+
this.recalculate();
|
|
2180
|
+
}
|
|
2181
|
+
}
|
|
2182
|
+
onDevBaseChange(event) {
|
|
2183
|
+
this.sliderBase = parseFloat(event.target.value);
|
|
2184
|
+
if (this.sliderBase > this.sliderProjected) {
|
|
2185
|
+
this.sliderProjected = this.sliderBase;
|
|
2186
|
+
}
|
|
2187
|
+
this.recalculateFromSliders();
|
|
2188
|
+
}
|
|
2189
|
+
onDevProjectedChange(event) {
|
|
2190
|
+
this.sliderProjected = parseFloat(event.target.value);
|
|
2191
|
+
if (this.sliderProjected < this.sliderBase) {
|
|
2192
|
+
this.sliderProjected = this.sliderBase;
|
|
2193
|
+
}
|
|
2194
|
+
this.recalculateFromSliders();
|
|
2195
|
+
}
|
|
2196
|
+
// Flujo de producción: calcula a partir del array de items
|
|
2197
|
+
recalculate() {
|
|
2198
|
+
this.baseAmount = this.items
|
|
2199
|
+
.filter(i => i.type === CpmItemType.Base)
|
|
2200
|
+
.reduce((acc, i) => acc + i.amount, 0);
|
|
2201
|
+
this.projectedAmount = this.items
|
|
2202
|
+
.filter(i => i.type === CpmItemType.Projected)
|
|
2203
|
+
.reduce((acc, i) => acc + i.amount, 0);
|
|
2204
|
+
this.totalAmount = this.baseAmount + this.projectedAmount;
|
|
2205
|
+
// Sincroniza sliders por si se activa devMode
|
|
2206
|
+
this.sliderBase = this.baseAmount;
|
|
2207
|
+
this.sliderProjected = this.totalAmount;
|
|
2208
|
+
this.updateGauge();
|
|
2209
|
+
this.emitSummary();
|
|
2210
|
+
}
|
|
2211
|
+
// Flujo de devMode: calcula a partir de los sliders
|
|
2212
|
+
recalculateFromSliders() {
|
|
2213
|
+
this.baseAmount = this.sliderBase;
|
|
2214
|
+
this.projectedAmount = this.sliderProjected - this.sliderBase;
|
|
2215
|
+
this.totalAmount = this.sliderProjected;
|
|
2216
|
+
this.updateGauge();
|
|
2217
|
+
this.emitSummary();
|
|
2218
|
+
}
|
|
2219
|
+
updateGauge() {
|
|
2220
|
+
var _a;
|
|
2221
|
+
const thresholds = (_a = this.thresholds) !== null && _a !== void 0 ? _a : DEFAULT_THRESHOLDS;
|
|
2222
|
+
this.activeColors = this.getZoneColors(this.totalAmount, thresholds);
|
|
2223
|
+
this.trackArcPath = this.buildArcPath(this.ANGLE_START, this.ANGLE_END);
|
|
2224
|
+
this.totalArcPath = this.buildArcPath(this.ANGLE_START, this.valueToAngle(this.totalAmount));
|
|
2225
|
+
this.baseArcPath = this.buildArcPath(this.ANGLE_START, this.valueToAngle(this.baseAmount));
|
|
2226
|
+
this.dotBasePos = this.polar(this.valueToAngle(this.baseAmount));
|
|
2227
|
+
this.dotTotalPos = this.polar(this.valueToAngle(this.totalAmount));
|
|
2228
|
+
// El punto de proyección solo aparece si va delante del real y no llegó al borde
|
|
2229
|
+
this.dotTotalVisible = this.totalAmount > this.baseAmount && this.totalAmount < this.limit;
|
|
2230
|
+
this.limitTextPos = this.polar(this.ANGLE_END, this.R + 20);
|
|
2231
|
+
this.excess = Math.max(0, this.totalAmount - this.limit);
|
|
2232
|
+
this.limitExceeded.emit(this.excess > this.EXCESS_TOLERANCE);
|
|
2233
|
+
}
|
|
2234
|
+
emitSummary() {
|
|
2235
|
+
this.cpmChange.emit({
|
|
2236
|
+
baseAmount: this.baseAmount,
|
|
2237
|
+
projectedAmount: this.projectedAmount,
|
|
2238
|
+
totalAmount: this.totalAmount,
|
|
2239
|
+
limit: this.limit,
|
|
2240
|
+
});
|
|
2241
|
+
}
|
|
2242
|
+
// Clampea el valor al límite para que el arco no desborde visualmente
|
|
2243
|
+
valueToAngle(value) {
|
|
2244
|
+
const clamped = Math.min(value, this.limit);
|
|
2245
|
+
return Math.PI - (clamped / this.limit) * Math.PI;
|
|
2246
|
+
}
|
|
2247
|
+
polar(angle, radius = this.R) {
|
|
2248
|
+
return {
|
|
2249
|
+
x: this.CX + radius * Math.cos(angle),
|
|
2250
|
+
y: this.CY - radius * Math.sin(angle),
|
|
2251
|
+
};
|
|
2252
|
+
}
|
|
2253
|
+
buildArcPath(a1, a2) {
|
|
2254
|
+
const start = this.polar(a1);
|
|
2255
|
+
const end = this.polar(a2);
|
|
2256
|
+
const large = (a1 - a2) > Math.PI ? 1 : 0;
|
|
2257
|
+
return `M ${start.x} ${start.y} A ${this.R} ${this.R} 0 ${large} 1 ${end.x} ${end.y}`;
|
|
2258
|
+
}
|
|
2259
|
+
getZoneColors(value, t) {
|
|
2260
|
+
const pct = value / this.limit;
|
|
2261
|
+
if (pct < t.zone1Max)
|
|
2262
|
+
return ZONE_COLORS['zone1'];
|
|
2263
|
+
if (pct < t.zone2Max)
|
|
2264
|
+
return ZONE_COLORS['zone2'];
|
|
2265
|
+
if (pct < t.zone3Max)
|
|
2266
|
+
return ZONE_COLORS['zone3'];
|
|
2267
|
+
return ZONE_COLORS['zone4'];
|
|
2268
|
+
}
|
|
2269
|
+
}
|
|
2270
|
+
LibeyNgCpmIndicatorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: LibeyNgCpmIndicatorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2271
|
+
LibeyNgCpmIndicatorComponent.ɵcmp = i0.ɵɵ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, 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.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "number": i1.DecimalPipe } });
|
|
2272
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: LibeyNgCpmIndicatorComponent, decorators: [{
|
|
2273
|
+
type: Component,
|
|
2274
|
+
args: [{
|
|
2275
|
+
selector: 'lib-libey-ng-cpm-indicator',
|
|
2276
|
+
templateUrl: './libey-ng-cpm-indicator.component.html',
|
|
2277
|
+
styleUrls: ['./libey-ng-cpm-indicator.component.css']
|
|
2278
|
+
}]
|
|
2279
|
+
}], ctorParameters: function () { return []; }, propDecorators: { limit: [{
|
|
2280
|
+
type: Input
|
|
2281
|
+
}], items: [{
|
|
2282
|
+
type: Input
|
|
2283
|
+
}], currency: [{
|
|
2284
|
+
type: Input
|
|
2285
|
+
}], thresholds: [{
|
|
2286
|
+
type: Input
|
|
2287
|
+
}], mode: [{
|
|
2288
|
+
type: Input
|
|
2289
|
+
}], devMode: [{
|
|
2290
|
+
type: Input
|
|
2291
|
+
}], cpmChange: [{
|
|
2292
|
+
type: Output
|
|
2293
|
+
}], limitExceeded: [{
|
|
2294
|
+
type: Output
|
|
2295
|
+
}], cpmLegend: [{
|
|
2296
|
+
type: ViewChild,
|
|
2297
|
+
args: ['cpmLegend']
|
|
2298
|
+
}], scale: [{
|
|
2299
|
+
type: Input
|
|
2300
|
+
}] } });
|
|
2301
|
+
|
|
2302
|
+
class LibeyNgCpmIndicatorModule {
|
|
2303
|
+
}
|
|
2304
|
+
LibeyNgCpmIndicatorModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: LibeyNgCpmIndicatorModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
2305
|
+
LibeyNgCpmIndicatorModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: LibeyNgCpmIndicatorModule, declarations: [LibeyNgCpmIndicatorComponent], imports: [CommonModule], exports: [LibeyNgCpmIndicatorComponent] });
|
|
2306
|
+
LibeyNgCpmIndicatorModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: LibeyNgCpmIndicatorModule, imports: [[
|
|
2307
|
+
CommonModule
|
|
2308
|
+
]] });
|
|
2309
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: LibeyNgCpmIndicatorModule, decorators: [{
|
|
2310
|
+
type: NgModule,
|
|
2311
|
+
args: [{
|
|
2312
|
+
declarations: [
|
|
2313
|
+
LibeyNgCpmIndicatorComponent
|
|
2314
|
+
],
|
|
2315
|
+
imports: [
|
|
2316
|
+
CommonModule
|
|
2317
|
+
],
|
|
2318
|
+
exports: [
|
|
2319
|
+
LibeyNgCpmIndicatorComponent
|
|
2320
|
+
]
|
|
2321
|
+
}]
|
|
2322
|
+
}] });
|
|
2323
|
+
|
|
2097
2324
|
class LibeyNgComponentLibraryModule {
|
|
2098
2325
|
}
|
|
2099
2326
|
LibeyNgComponentLibraryModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: LibeyNgComponentLibraryModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
@@ -2102,21 +2329,25 @@ LibeyNgComponentLibraryModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12
|
|
|
2102
2329
|
LibeyNgTableModule,
|
|
2103
2330
|
LibeyNgSignatureModule,
|
|
2104
2331
|
SignaturePadModule,
|
|
2105
|
-
IconsModule
|
|
2332
|
+
IconsModule,
|
|
2333
|
+
LibeyNgCpmIndicatorModule], exports: [LibeyNgTableModule,
|
|
2106
2334
|
LibeyNgSignatureModule,
|
|
2107
2335
|
SignaturePadModule,
|
|
2108
|
-
IconsModule
|
|
2336
|
+
IconsModule,
|
|
2337
|
+
LibeyNgCpmIndicatorModule] });
|
|
2109
2338
|
LibeyNgComponentLibraryModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: LibeyNgComponentLibraryModule, providers: [DatePipe], imports: [[
|
|
2110
2339
|
CommonModule,
|
|
2111
2340
|
FormsModule,
|
|
2112
2341
|
LibeyNgTableModule,
|
|
2113
2342
|
LibeyNgSignatureModule,
|
|
2114
2343
|
SignaturePadModule,
|
|
2115
|
-
IconsModule
|
|
2344
|
+
IconsModule,
|
|
2345
|
+
LibeyNgCpmIndicatorModule,
|
|
2116
2346
|
], LibeyNgTableModule,
|
|
2117
2347
|
LibeyNgSignatureModule,
|
|
2118
2348
|
SignaturePadModule,
|
|
2119
|
-
IconsModule
|
|
2349
|
+
IconsModule,
|
|
2350
|
+
LibeyNgCpmIndicatorModule] });
|
|
2120
2351
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: LibeyNgComponentLibraryModule, decorators: [{
|
|
2121
2352
|
type: NgModule,
|
|
2122
2353
|
args: [{
|
|
@@ -2127,13 +2358,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImpo
|
|
|
2127
2358
|
LibeyNgTableModule,
|
|
2128
2359
|
LibeyNgSignatureModule,
|
|
2129
2360
|
SignaturePadModule,
|
|
2130
|
-
IconsModule
|
|
2361
|
+
IconsModule,
|
|
2362
|
+
LibeyNgCpmIndicatorModule,
|
|
2131
2363
|
],
|
|
2132
2364
|
exports: [
|
|
2133
2365
|
LibeyNgTableModule,
|
|
2134
2366
|
LibeyNgSignatureModule,
|
|
2135
2367
|
SignaturePadModule,
|
|
2136
2368
|
IconsModule,
|
|
2369
|
+
LibeyNgCpmIndicatorModule
|
|
2137
2370
|
],
|
|
2138
2371
|
providers: [DatePipe]
|
|
2139
2372
|
}]
|
|
@@ -2147,5 +2380,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImpo
|
|
|
2147
2380
|
* Generated bundle index. Do not edit.
|
|
2148
2381
|
*/
|
|
2149
2382
|
|
|
2150
|
-
export { IconsModule, LibeyColumnDirective, LibeyNgComponentLibraryComponent, LibeyNgComponentLibraryModule, LibeyNgComponentLibraryService, LibeyNgIconsComponent, LibeyNgSignatureComponent, LibeyNgSignatureModule, LibeyNgTableComponent, LibeyNgTableModule, SigWebTablet };
|
|
2383
|
+
export { CpmIndicatorMode, CpmItemType, DEFAULT_THRESHOLDS, IconsModule, LibeyColumnDirective, LibeyNgComponentLibraryComponent, LibeyNgComponentLibraryModule, LibeyNgComponentLibraryService, LibeyNgCpmIndicatorComponent, LibeyNgCpmIndicatorModule, LibeyNgIconsComponent, LibeyNgSignatureComponent, LibeyNgSignatureModule, LibeyNgTableComponent, LibeyNgTableModule, SigWebTablet, ZONE_COLORS };
|
|
2151
2384
|
//# sourceMappingURL=libey-ng-component-library.js.map
|