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
|
@@ -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,230 @@ 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
|
+
// ── Propiedades del template ──
|
|
2145
|
+
this.baseAmount = 0;
|
|
2146
|
+
this.projectedAmount = 0;
|
|
2147
|
+
this.totalAmount = 0;
|
|
2148
|
+
this.excess = 0;
|
|
2149
|
+
this.activeColors = ZONE_COLORS['zone1'];
|
|
2150
|
+
this.trackArcPath = '';
|
|
2151
|
+
this.baseArcPath = '';
|
|
2152
|
+
this.totalArcPath = '';
|
|
2153
|
+
this.dotBasePos = { x: 0, y: 0 };
|
|
2154
|
+
this.dotTotalPos = { x: 0, y: 0 };
|
|
2155
|
+
this.dotTotalVisible = false;
|
|
2156
|
+
this.limitTextPos = { x: 0, y: 0 };
|
|
2157
|
+
// ── devMode ──
|
|
2158
|
+
this.sliderBase = 0;
|
|
2159
|
+
this.sliderProjected = 0;
|
|
2160
|
+
// Necesario para usar el enum en el template
|
|
2161
|
+
this.CpmIndicatorMode = CpmIndicatorMode;
|
|
2162
|
+
// Geometría del SVG (coordenadas internas del viewBox 220x130)
|
|
2163
|
+
this.CX = 110;
|
|
2164
|
+
this.CY = 115;
|
|
2165
|
+
this.R = 90;
|
|
2166
|
+
this.ANGLE_START = Math.PI;
|
|
2167
|
+
this.ANGLE_END = 0;
|
|
2168
|
+
this.EXCESS_TOLERANCE = 0.005;
|
|
2169
|
+
}
|
|
2170
|
+
get sliderMax() {
|
|
2171
|
+
return this.limit * 1.5;
|
|
2172
|
+
}
|
|
2173
|
+
ngOnInit() {
|
|
2174
|
+
this.recalculate();
|
|
2175
|
+
}
|
|
2176
|
+
ngOnChanges(changes) {
|
|
2177
|
+
if (changes['items'] || changes['limit'] || changes['thresholds']) {
|
|
2178
|
+
this.recalculate();
|
|
2179
|
+
}
|
|
2180
|
+
}
|
|
2181
|
+
onDevBaseChange(event) {
|
|
2182
|
+
this.sliderBase = parseFloat(event.target.value);
|
|
2183
|
+
if (this.sliderBase > this.sliderProjected) {
|
|
2184
|
+
this.sliderProjected = this.sliderBase;
|
|
2185
|
+
}
|
|
2186
|
+
this.recalculateFromSliders();
|
|
2187
|
+
}
|
|
2188
|
+
onDevProjectedChange(event) {
|
|
2189
|
+
this.sliderProjected = parseFloat(event.target.value);
|
|
2190
|
+
if (this.sliderProjected < this.sliderBase) {
|
|
2191
|
+
this.sliderProjected = this.sliderBase;
|
|
2192
|
+
}
|
|
2193
|
+
this.recalculateFromSliders();
|
|
2194
|
+
}
|
|
2195
|
+
// Flujo de producción: calcula a partir del array de items
|
|
2196
|
+
recalculate() {
|
|
2197
|
+
this.baseAmount = this.items
|
|
2198
|
+
.filter(i => i.type === CpmItemType.Base)
|
|
2199
|
+
.reduce((acc, i) => acc + i.amount, 0);
|
|
2200
|
+
this.projectedAmount = this.items
|
|
2201
|
+
.filter(i => i.type === CpmItemType.Projected)
|
|
2202
|
+
.reduce((acc, i) => acc + i.amount, 0);
|
|
2203
|
+
this.totalAmount = this.baseAmount + this.projectedAmount;
|
|
2204
|
+
// Sincroniza sliders por si se activa devMode
|
|
2205
|
+
this.sliderBase = this.baseAmount;
|
|
2206
|
+
this.sliderProjected = this.totalAmount;
|
|
2207
|
+
this.updateGauge();
|
|
2208
|
+
this.emitSummary();
|
|
2209
|
+
}
|
|
2210
|
+
// Flujo de devMode: calcula a partir de los sliders
|
|
2211
|
+
recalculateFromSliders() {
|
|
2212
|
+
this.baseAmount = this.sliderBase;
|
|
2213
|
+
this.projectedAmount = this.sliderProjected - this.sliderBase;
|
|
2214
|
+
this.totalAmount = this.sliderProjected;
|
|
2215
|
+
this.updateGauge();
|
|
2216
|
+
this.emitSummary();
|
|
2217
|
+
}
|
|
2218
|
+
updateGauge() {
|
|
2219
|
+
var _a;
|
|
2220
|
+
const thresholds = (_a = this.thresholds) !== null && _a !== void 0 ? _a : DEFAULT_THRESHOLDS;
|
|
2221
|
+
this.activeColors = this.getZoneColors(this.totalAmount, thresholds);
|
|
2222
|
+
this.trackArcPath = this.buildArcPath(this.ANGLE_START, this.ANGLE_END);
|
|
2223
|
+
this.totalArcPath = this.buildArcPath(this.ANGLE_START, this.valueToAngle(this.totalAmount));
|
|
2224
|
+
this.baseArcPath = this.buildArcPath(this.ANGLE_START, this.valueToAngle(this.baseAmount));
|
|
2225
|
+
this.dotBasePos = this.polar(this.valueToAngle(this.baseAmount));
|
|
2226
|
+
this.dotTotalPos = this.polar(this.valueToAngle(this.totalAmount));
|
|
2227
|
+
// El punto de proyección solo aparece si va delante del real y no llegó al borde
|
|
2228
|
+
this.dotTotalVisible = this.totalAmount > this.baseAmount && this.totalAmount < this.limit;
|
|
2229
|
+
this.limitTextPos = this.polar(this.ANGLE_END, this.R + 20);
|
|
2230
|
+
this.excess = Math.max(0, this.totalAmount - this.limit);
|
|
2231
|
+
this.limitExceeded.emit(this.excess > this.EXCESS_TOLERANCE);
|
|
2232
|
+
}
|
|
2233
|
+
emitSummary() {
|
|
2234
|
+
this.cpmChange.emit({
|
|
2235
|
+
baseAmount: this.baseAmount,
|
|
2236
|
+
projectedAmount: this.projectedAmount,
|
|
2237
|
+
totalAmount: this.totalAmount,
|
|
2238
|
+
limit: this.limit,
|
|
2239
|
+
});
|
|
2240
|
+
}
|
|
2241
|
+
// Clampea el valor al límite para que el arco no desborde visualmente
|
|
2242
|
+
valueToAngle(value) {
|
|
2243
|
+
const clamped = Math.min(value, this.limit);
|
|
2244
|
+
return Math.PI - (clamped / this.limit) * Math.PI;
|
|
2245
|
+
}
|
|
2246
|
+
polar(angle, radius = this.R) {
|
|
2247
|
+
return {
|
|
2248
|
+
x: this.CX + radius * Math.cos(angle),
|
|
2249
|
+
y: this.CY - radius * Math.sin(angle),
|
|
2250
|
+
};
|
|
2251
|
+
}
|
|
2252
|
+
buildArcPath(a1, a2) {
|
|
2253
|
+
const start = this.polar(a1);
|
|
2254
|
+
const end = this.polar(a2);
|
|
2255
|
+
const large = (a1 - a2) > Math.PI ? 1 : 0;
|
|
2256
|
+
return `M ${start.x} ${start.y} A ${this.R} ${this.R} 0 ${large} 1 ${end.x} ${end.y}`;
|
|
2257
|
+
}
|
|
2258
|
+
getZoneColors(value, t) {
|
|
2259
|
+
const pct = value / this.limit;
|
|
2260
|
+
if (pct < t.zone1Max)
|
|
2261
|
+
return ZONE_COLORS['zone1'];
|
|
2262
|
+
if (pct < t.zone2Max)
|
|
2263
|
+
return ZONE_COLORS['zone2'];
|
|
2264
|
+
if (pct < t.zone3Max)
|
|
2265
|
+
return ZONE_COLORS['zone3'];
|
|
2266
|
+
return ZONE_COLORS['zone4'];
|
|
2267
|
+
}
|
|
2268
|
+
}
|
|
2269
|
+
LibeyNgCpmIndicatorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: LibeyNgCpmIndicatorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2270
|
+
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" }, 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\">\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.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "number": i1.DecimalPipe } });
|
|
2271
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: LibeyNgCpmIndicatorComponent, decorators: [{
|
|
2272
|
+
type: Component,
|
|
2273
|
+
args: [{
|
|
2274
|
+
selector: 'lib-libey-ng-cpm-indicator',
|
|
2275
|
+
templateUrl: './libey-ng-cpm-indicator.component.html',
|
|
2276
|
+
styleUrls: ['./libey-ng-cpm-indicator.component.css']
|
|
2277
|
+
}]
|
|
2278
|
+
}], ctorParameters: function () { return []; }, propDecorators: { limit: [{
|
|
2279
|
+
type: Input
|
|
2280
|
+
}], items: [{
|
|
2281
|
+
type: Input
|
|
2282
|
+
}], currency: [{
|
|
2283
|
+
type: Input
|
|
2284
|
+
}], thresholds: [{
|
|
2285
|
+
type: Input
|
|
2286
|
+
}], mode: [{
|
|
2287
|
+
type: Input
|
|
2288
|
+
}], devMode: [{
|
|
2289
|
+
type: Input
|
|
2290
|
+
}], cpmChange: [{
|
|
2291
|
+
type: Output
|
|
2292
|
+
}], limitExceeded: [{
|
|
2293
|
+
type: Output
|
|
2294
|
+
}], cpmLegend: [{
|
|
2295
|
+
type: ViewChild,
|
|
2296
|
+
args: ['cpmLegend']
|
|
2297
|
+
}] } });
|
|
2298
|
+
|
|
2299
|
+
class LibeyNgCpmIndicatorModule {
|
|
2300
|
+
}
|
|
2301
|
+
LibeyNgCpmIndicatorModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: LibeyNgCpmIndicatorModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
2302
|
+
LibeyNgCpmIndicatorModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: LibeyNgCpmIndicatorModule, declarations: [LibeyNgCpmIndicatorComponent], imports: [CommonModule], exports: [LibeyNgCpmIndicatorComponent] });
|
|
2303
|
+
LibeyNgCpmIndicatorModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: LibeyNgCpmIndicatorModule, imports: [[
|
|
2304
|
+
CommonModule
|
|
2305
|
+
]] });
|
|
2306
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: LibeyNgCpmIndicatorModule, decorators: [{
|
|
2307
|
+
type: NgModule,
|
|
2308
|
+
args: [{
|
|
2309
|
+
declarations: [
|
|
2310
|
+
LibeyNgCpmIndicatorComponent
|
|
2311
|
+
],
|
|
2312
|
+
imports: [
|
|
2313
|
+
CommonModule
|
|
2314
|
+
],
|
|
2315
|
+
exports: [
|
|
2316
|
+
LibeyNgCpmIndicatorComponent
|
|
2317
|
+
]
|
|
2318
|
+
}]
|
|
2319
|
+
}] });
|
|
2320
|
+
|
|
2097
2321
|
class LibeyNgComponentLibraryModule {
|
|
2098
2322
|
}
|
|
2099
2323
|
LibeyNgComponentLibraryModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: LibeyNgComponentLibraryModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
@@ -2102,21 +2326,25 @@ LibeyNgComponentLibraryModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12
|
|
|
2102
2326
|
LibeyNgTableModule,
|
|
2103
2327
|
LibeyNgSignatureModule,
|
|
2104
2328
|
SignaturePadModule,
|
|
2105
|
-
IconsModule
|
|
2329
|
+
IconsModule,
|
|
2330
|
+
LibeyNgCpmIndicatorModule], exports: [LibeyNgTableModule,
|
|
2106
2331
|
LibeyNgSignatureModule,
|
|
2107
2332
|
SignaturePadModule,
|
|
2108
|
-
IconsModule
|
|
2333
|
+
IconsModule,
|
|
2334
|
+
LibeyNgCpmIndicatorModule] });
|
|
2109
2335
|
LibeyNgComponentLibraryModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: LibeyNgComponentLibraryModule, providers: [DatePipe], imports: [[
|
|
2110
2336
|
CommonModule,
|
|
2111
2337
|
FormsModule,
|
|
2112
2338
|
LibeyNgTableModule,
|
|
2113
2339
|
LibeyNgSignatureModule,
|
|
2114
2340
|
SignaturePadModule,
|
|
2115
|
-
IconsModule
|
|
2341
|
+
IconsModule,
|
|
2342
|
+
LibeyNgCpmIndicatorModule,
|
|
2116
2343
|
], LibeyNgTableModule,
|
|
2117
2344
|
LibeyNgSignatureModule,
|
|
2118
2345
|
SignaturePadModule,
|
|
2119
|
-
IconsModule
|
|
2346
|
+
IconsModule,
|
|
2347
|
+
LibeyNgCpmIndicatorModule] });
|
|
2120
2348
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: LibeyNgComponentLibraryModule, decorators: [{
|
|
2121
2349
|
type: NgModule,
|
|
2122
2350
|
args: [{
|
|
@@ -2127,13 +2355,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImpo
|
|
|
2127
2355
|
LibeyNgTableModule,
|
|
2128
2356
|
LibeyNgSignatureModule,
|
|
2129
2357
|
SignaturePadModule,
|
|
2130
|
-
IconsModule
|
|
2358
|
+
IconsModule,
|
|
2359
|
+
LibeyNgCpmIndicatorModule,
|
|
2131
2360
|
],
|
|
2132
2361
|
exports: [
|
|
2133
2362
|
LibeyNgTableModule,
|
|
2134
2363
|
LibeyNgSignatureModule,
|
|
2135
2364
|
SignaturePadModule,
|
|
2136
2365
|
IconsModule,
|
|
2366
|
+
LibeyNgCpmIndicatorModule
|
|
2137
2367
|
],
|
|
2138
2368
|
providers: [DatePipe]
|
|
2139
2369
|
}]
|
|
@@ -2147,5 +2377,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImpo
|
|
|
2147
2377
|
* Generated bundle index. Do not edit.
|
|
2148
2378
|
*/
|
|
2149
2379
|
|
|
2150
|
-
export { IconsModule, LibeyColumnDirective, LibeyNgComponentLibraryComponent, LibeyNgComponentLibraryModule, LibeyNgComponentLibraryService, LibeyNgIconsComponent, LibeyNgSignatureComponent, LibeyNgSignatureModule, LibeyNgTableComponent, LibeyNgTableModule, SigWebTablet };
|
|
2380
|
+
export { CpmIndicatorMode, CpmItemType, DEFAULT_THRESHOLDS, IconsModule, LibeyColumnDirective, LibeyNgComponentLibraryComponent, LibeyNgComponentLibraryModule, LibeyNgComponentLibraryService, LibeyNgCpmIndicatorComponent, LibeyNgCpmIndicatorModule, LibeyNgIconsComponent, LibeyNgSignatureComponent, LibeyNgSignatureModule, LibeyNgTableComponent, LibeyNgTableModule, SigWebTablet, ZONE_COLORS };
|
|
2151
2381
|
//# sourceMappingURL=libey-ng-component-library.js.map
|