libey-ng-component-library 0.0.32 → 0.0.34
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/karma.conf.js +44 -0
- package/ng-package.json +13 -0
- package/package.json +17 -24
- package/src/lib/cpm-indicator/libey-ng-cpm-indicator.component.css +216 -0
- package/src/lib/cpm-indicator/libey-ng-cpm-indicator.component.html +201 -0
- package/src/lib/cpm-indicator/libey-ng-cpm-indicator.component.spec.ts +25 -0
- package/src/lib/cpm-indicator/libey-ng-cpm-indicator.component.ts +203 -0
- package/src/lib/cpm-indicator/libey-ng-cpm-indicator.module.ts +19 -0
- package/src/lib/icons/icons.component.css +9 -0
- package/src/lib/icons/icons.module.ts +16 -0
- package/src/lib/icons/libey-ng-icons/libey-ng-icons.component.html +1831 -0
- package/src/lib/icons/libey-ng-icons/libey-ng-icons.component.ts +36 -0
- package/src/lib/libey-ng-component-library.component.spec.ts +25 -0
- package/src/lib/libey-ng-component-library.component.ts +20 -0
- package/src/lib/libey-ng-component-library.module.ts +32 -0
- package/src/lib/libey-ng-component-library.service.spec.ts +16 -0
- package/src/lib/libey-ng-component-library.service.ts +9 -0
- package/src/lib/signature/libey-ng-signature/libey-ng-signature.component.css +7 -0
- package/src/lib/signature/libey-ng-signature/libey-ng-signature.component.html +41 -0
- package/src/lib/signature/libey-ng-signature/libey-ng-signature.component.spec.ts +25 -0
- package/src/lib/signature/libey-ng-signature/libey-ng-signature.component.ts +214 -0
- package/src/lib/signature/libey-ng-signature.module.ts +30 -0
- package/src/lib/table/directives/libey-column.directive.ts +29 -0
- package/src/lib/table/libey-ng-table.component.css +249 -0
- package/src/lib/table/libey-ng-table.component.html +122 -0
- package/src/lib/table/libey-ng-table.component.ts +234 -0
- package/src/lib/table/libey-ng-table.module.ts +13 -0
- package/{public-api.d.ts → src/public-api.ts} +4 -0
- package/src/test.ts +28 -0
- package/src/utils/CpmIndicator/cpm-indicator-types.ts +63 -0
- package/src/utils/SigWeb/SigWeb.ts +1906 -0
- package/tsconfig.lib.json +20 -0
- package/tsconfig.lib.prod.json +10 -0
- package/tsconfig.spec.json +17 -0
- package/bundles/libey-ng-component-library.umd.js +0 -2497
- package/bundles/libey-ng-component-library.umd.js.map +0 -1
- package/esm2015/lib/cpm-indicator/libey-ng-cpm-indicator.component.js +0 -193
- package/esm2015/lib/cpm-indicator/libey-ng-cpm-indicator.module.js +0 -26
- package/esm2015/lib/icons/icons.module.js +0 -26
- package/esm2015/lib/icons/libey-ng-icons/libey-ng-icons.component.js +0 -52
- package/esm2015/lib/libey-ng-component-library.component.js +0 -26
- package/esm2015/lib/libey-ng-component-library.module.js +0 -60
- package/esm2015/lib/libey-ng-component-library.service.js +0 -14
- package/esm2015/lib/signature/libey-ng-signature/libey-ng-signature.component.js +0 -197
- package/esm2015/lib/signature/libey-ng-signature.module.js +0 -57
- package/esm2015/lib/table/directives/libey-column.directive.js +0 -56
- package/esm2015/lib/table/libey-ng-table.component.js +0 -229
- package/esm2015/lib/table/libey-ng-table.module.js +0 -21
- package/esm2015/libey-ng-component-library.js +0 -5
- package/esm2015/public-api.js +0 -23
- package/esm2015/utils/CpmIndicator/cpm-indicator-types.js +0 -25
- package/esm2015/utils/SigWeb/SigWeb.js +0 -1442
- package/fesm2015/libey-ng-component-library.js +0 -2393
- package/fesm2015/libey-ng-component-library.js.map +0 -1
- package/lib/cpm-indicator/libey-ng-cpm-indicator.component.d.ts +0 -66
- package/lib/cpm-indicator/libey-ng-cpm-indicator.module.d.ts +0 -8
- package/lib/icons/icons.module.d.ts +0 -8
- package/lib/icons/libey-ng-icons/libey-ng-icons.component.d.ts +0 -19
- package/lib/libey-ng-component-library.component.d.ts +0 -8
- package/lib/libey-ng-component-library.module.d.ts +0 -13
- package/lib/libey-ng-component-library.service.d.ts +0 -6
- package/lib/signature/libey-ng-signature/libey-ng-signature.component.d.ts +0 -40
- package/lib/signature/libey-ng-signature.module.d.ts +0 -13
- package/lib/table/directives/libey-column.directive.d.ts +0 -23
- package/lib/table/libey-ng-table.component.d.ts +0 -63
- package/lib/table/libey-ng-table.module.d.ts +0 -10
- package/libey-ng-component-library.d.ts +0 -5
- package/utils/CpmIndicator/cpm-indicator-types.d.ts +0 -40
- package/utils/SigWeb/SigWeb.d.ts +0 -219
package/karma.conf.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// Karma configuration file, see link for more information
|
|
2
|
+
// https://karma-runner.github.io/1.0/config/configuration-file.html
|
|
3
|
+
|
|
4
|
+
module.exports = function (config) {
|
|
5
|
+
config.set({
|
|
6
|
+
basePath: '',
|
|
7
|
+
frameworks: ['jasmine', '@angular-devkit/build-angular'],
|
|
8
|
+
plugins: [
|
|
9
|
+
require('karma-jasmine'),
|
|
10
|
+
require('karma-chrome-launcher'),
|
|
11
|
+
require('karma-jasmine-html-reporter'),
|
|
12
|
+
require('karma-coverage'),
|
|
13
|
+
require('@angular-devkit/build-angular/plugins/karma')
|
|
14
|
+
],
|
|
15
|
+
client: {
|
|
16
|
+
jasmine: {
|
|
17
|
+
// you can add configuration options for Jasmine here
|
|
18
|
+
// the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html
|
|
19
|
+
// for example, you can disable the random execution with `random: false`
|
|
20
|
+
// or set a specific seed with `seed: 4321`
|
|
21
|
+
},
|
|
22
|
+
clearContext: false // leave Jasmine Spec Runner output visible in browser
|
|
23
|
+
},
|
|
24
|
+
jasmineHtmlReporter: {
|
|
25
|
+
suppressAll: true // removes the duplicated traces
|
|
26
|
+
},
|
|
27
|
+
coverageReporter: {
|
|
28
|
+
dir: require('path').join(__dirname, '../../coverage/libey-ng-component-library'),
|
|
29
|
+
subdir: '.',
|
|
30
|
+
reporters: [
|
|
31
|
+
{ type: 'html' },
|
|
32
|
+
{ type: 'text-summary' }
|
|
33
|
+
]
|
|
34
|
+
},
|
|
35
|
+
reporters: ['progress', 'kjhtml'],
|
|
36
|
+
port: 9876,
|
|
37
|
+
colors: true,
|
|
38
|
+
logLevel: config.LOG_INFO,
|
|
39
|
+
autoWatch: true,
|
|
40
|
+
browsers: ['Chrome'],
|
|
41
|
+
singleRun: false,
|
|
42
|
+
restartOnFileChange: true
|
|
43
|
+
});
|
|
44
|
+
};
|
package/ng-package.json
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
|
|
3
|
+
"dest": "../../dist/libey-ng-component-library",
|
|
4
|
+
"lib": {
|
|
5
|
+
"entryFile": "src/public-api.ts"
|
|
6
|
+
},
|
|
7
|
+
"whitelistedNonPeerDependencies": [
|
|
8
|
+
"angular2-signaturepad",
|
|
9
|
+
"@ng-select/ng-select",
|
|
10
|
+
"@ng-bootstrap/ng-bootstrap",
|
|
11
|
+
"@popperjs/core"
|
|
12
|
+
]
|
|
13
|
+
}
|
package/package.json
CHANGED
|
@@ -1,24 +1,17 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "libey-ng-component-library",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"peerDependencies": {
|
|
5
|
-
"@angular/common": "^12.2.0",
|
|
6
|
-
"@angular/core": "^12.2.0",
|
|
7
|
-
"@angular/forms": "^12.2.0",
|
|
8
|
-
"@ng-bootstrap/ng-bootstrap": "^12.1.2"
|
|
9
|
-
},
|
|
10
|
-
"dependencies": {
|
|
11
|
-
"@ng-bootstrap/ng-bootstrap": "^12.1.1",
|
|
12
|
-
"@ng-select/ng-select": "^8.3.0",
|
|
13
|
-
"@popperjs/core": "^2.11.5",
|
|
14
|
-
"angular2-signaturepad": "^4.0.2",
|
|
15
|
-
"tslib": "^2.3.0"
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
"module": "fesm2015/libey-ng-component-library.js",
|
|
19
|
-
"es2015": "fesm2015/libey-ng-component-library.js",
|
|
20
|
-
"esm2015": "esm2015/libey-ng-component-library.js",
|
|
21
|
-
"fesm2015": "fesm2015/libey-ng-component-library.js",
|
|
22
|
-
"typings": "libey-ng-component-library.d.ts",
|
|
23
|
-
"sideEffects": false
|
|
24
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "libey-ng-component-library",
|
|
3
|
+
"version": "0.0.34",
|
|
4
|
+
"peerDependencies": {
|
|
5
|
+
"@angular/common": "^12.2.0",
|
|
6
|
+
"@angular/core": "^12.2.0",
|
|
7
|
+
"@angular/forms": "^12.2.0",
|
|
8
|
+
"@ng-bootstrap/ng-bootstrap": "^12.1.2"
|
|
9
|
+
},
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"@ng-bootstrap/ng-bootstrap": "^12.1.1",
|
|
12
|
+
"@ng-select/ng-select": "^8.3.0",
|
|
13
|
+
"@popperjs/core": "^2.11.5",
|
|
14
|
+
"angular2-signaturepad": "^4.0.2",
|
|
15
|
+
"tslib": "^2.3.0"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
|
|
2
|
+
/* ── Host ── */
|
|
3
|
+
:host {
|
|
4
|
+
display: inline-flex;
|
|
5
|
+
flex-direction: column; /* ← agregar */
|
|
6
|
+
align-items: center; /* ← agregar */
|
|
7
|
+
font-family: 'DM Sans', sans-serif;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/* ═══════════════════════════════════════════════════════════
|
|
11
|
+
GAUGE — compartido entre modo CPM y modo Gauge
|
|
12
|
+
El modo CPM reutiliza todas estas clases, solo cambia
|
|
13
|
+
el texto central ("CPM" en lugar del monto)
|
|
14
|
+
═══════════════════════════════════════════════════════════ */
|
|
15
|
+
|
|
16
|
+
/* ── Tarjeta (solo modo Gauge) ── */
|
|
17
|
+
.card {
|
|
18
|
+
background: #ffffff;
|
|
19
|
+
border-radius: 20px;
|
|
20
|
+
padding: 36px 40px 28px;
|
|
21
|
+
width: 340px;
|
|
22
|
+
box-shadow:
|
|
23
|
+
0 4px 32px rgba(0, 0, 0, 0.10),
|
|
24
|
+
0 1px 4px rgba(0, 0, 0, 0.06);
|
|
25
|
+
display: flex;
|
|
26
|
+
flex-direction: column;
|
|
27
|
+
align-items: center;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/* ── Gauge SVG ── */
|
|
31
|
+
.gauge-wrap {
|
|
32
|
+
position: relative;
|
|
33
|
+
overflow: visible;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.gauge-svg {
|
|
37
|
+
overflow: visible;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/* ── Valor central ── */
|
|
41
|
+
.gauge-center {
|
|
42
|
+
position: absolute;
|
|
43
|
+
left: 50%;
|
|
44
|
+
transform: translateX(-50%);
|
|
45
|
+
text-align: center;
|
|
46
|
+
pointer-events: none;
|
|
47
|
+
white-space: nowrap;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/* CPM — una sola línea, necesita más espacio */
|
|
51
|
+
.gauge-center--cpm {
|
|
52
|
+
bottom: 15px;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/* Gauge — dos líneas (monto + límite) */
|
|
56
|
+
.gauge-center--gauge {
|
|
57
|
+
bottom: -10px;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.main-value {
|
|
61
|
+
font-size: 26px;
|
|
62
|
+
font-weight: 700;
|
|
63
|
+
font-family: 'DM Mono', monospace;
|
|
64
|
+
letter-spacing: -0.5px;
|
|
65
|
+
color: #1a1a2e;
|
|
66
|
+
line-height: 1;
|
|
67
|
+
transition: color 0.3s ease;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.limit-label {
|
|
71
|
+
font-size: 12px;
|
|
72
|
+
color: #8a8fa8;
|
|
73
|
+
font-weight: 400;
|
|
74
|
+
margin-top: 3px;
|
|
75
|
+
font-family: 'DM Mono', monospace;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/* ── Leyenda ── */
|
|
79
|
+
.legend {
|
|
80
|
+
display: flex;
|
|
81
|
+
gap: 14px;
|
|
82
|
+
margin-top: 22px;
|
|
83
|
+
margin-bottom: 6px;
|
|
84
|
+
flex-wrap: wrap;
|
|
85
|
+
justify-content: center;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.legend-item {
|
|
89
|
+
display: flex;
|
|
90
|
+
align-items: center;
|
|
91
|
+
gap: 6px;
|
|
92
|
+
font-size: 12px;
|
|
93
|
+
color: #555;
|
|
94
|
+
font-weight: 500;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/* ── Punto de leyenda ── */
|
|
98
|
+
.dot {
|
|
99
|
+
width: 9px;
|
|
100
|
+
height: 9px;
|
|
101
|
+
border-radius: 50%;
|
|
102
|
+
flex-shrink: 0;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/* ── Separador ── */
|
|
106
|
+
.divider {
|
|
107
|
+
width: 100%;
|
|
108
|
+
height: 1px;
|
|
109
|
+
background: #f0f2f5;
|
|
110
|
+
margin: 14px 0 4px;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/* ── Badge dev mode ── */
|
|
114
|
+
.dev-badge {
|
|
115
|
+
font-size: 11px;
|
|
116
|
+
font-weight: 700;
|
|
117
|
+
color: #7c3aed;
|
|
118
|
+
background: #ede9fe;
|
|
119
|
+
border-radius: 6px;
|
|
120
|
+
padding: 3px 10px;
|
|
121
|
+
margin-bottom: 8px;
|
|
122
|
+
letter-spacing: 0.3px;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/* ── Controles devMode ── */
|
|
126
|
+
.controls {
|
|
127
|
+
width: 100%;
|
|
128
|
+
display: flex;
|
|
129
|
+
flex-direction: column;
|
|
130
|
+
gap: 16px;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.ctrl-row {
|
|
134
|
+
display: flex;
|
|
135
|
+
flex-direction: column;
|
|
136
|
+
gap: 5px;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.ctrl-header {
|
|
140
|
+
display: flex;
|
|
141
|
+
justify-content: space-between;
|
|
142
|
+
align-items: center;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.ctrl-label {
|
|
146
|
+
font-size: 12px;
|
|
147
|
+
color: #8a8fa8;
|
|
148
|
+
font-weight: 500;
|
|
149
|
+
display: flex;
|
|
150
|
+
align-items: center;
|
|
151
|
+
gap: 5px;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.ctrl-label-dot {
|
|
155
|
+
width: 8px;
|
|
156
|
+
height: 8px;
|
|
157
|
+
border-radius: 50%;
|
|
158
|
+
display: inline-block;
|
|
159
|
+
flex-shrink: 0;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.ctrl-val {
|
|
163
|
+
font-size: 12px;
|
|
164
|
+
font-family: 'DM Mono', monospace;
|
|
165
|
+
font-weight: 600;
|
|
166
|
+
color: #1a1a2e;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
.zones-bar {
|
|
170
|
+
display: flex;
|
|
171
|
+
border-radius: 4px;
|
|
172
|
+
overflow: hidden;
|
|
173
|
+
height: 3px;
|
|
174
|
+
width: 100%;
|
|
175
|
+
margin-bottom: 3px;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.zones-bar div { flex: 1; }
|
|
179
|
+
|
|
180
|
+
/* ── Slider ── */
|
|
181
|
+
input[type='range'] {
|
|
182
|
+
-webkit-appearance: none;
|
|
183
|
+
appearance: none;
|
|
184
|
+
width: 100%;
|
|
185
|
+
height: 5px;
|
|
186
|
+
border-radius: 99px;
|
|
187
|
+
background: #e2e6ef;
|
|
188
|
+
outline: none;
|
|
189
|
+
cursor: pointer;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
input[type='range']::-webkit-slider-thumb {
|
|
193
|
+
-webkit-appearance: none;
|
|
194
|
+
width: 18px;
|
|
195
|
+
height: 18px;
|
|
196
|
+
border-radius: 50%;
|
|
197
|
+
background: #16a34a;
|
|
198
|
+
border: 2.5px solid #fff;
|
|
199
|
+
box-shadow: 0 1px 8px rgba(0, 0, 0, 0.2);
|
|
200
|
+
cursor: grab;
|
|
201
|
+
transition: background 0.3s, transform 0.15s;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
input[type='range']::-webkit-slider-thumb:active {
|
|
205
|
+
transform: scale(1.2);
|
|
206
|
+
cursor: grabbing;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
input[type='range']::-moz-range-thumb {
|
|
210
|
+
width: 18px;
|
|
211
|
+
height: 18px;
|
|
212
|
+
border-radius: 50%;
|
|
213
|
+
background: #16a34a;
|
|
214
|
+
border: 2.5px solid #fff;
|
|
215
|
+
cursor: grab;
|
|
216
|
+
}
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
<!-- Modo CPM: solo el gauge con "CPM" en el centro -->
|
|
2
|
+
<ng-container *ngIf="mode === CpmIndicatorMode.Cpm">
|
|
3
|
+
<div class="gauge-wrap" [style.width.px]="220 * scale" [style.height.px]="120 * scale">
|
|
4
|
+
<svg class="gauge-svg" viewBox="0 0 220 130" xmlns="http://www.w3.org/2000/svg"
|
|
5
|
+
[style.width.px]="220 * scale"
|
|
6
|
+
[style.height.px]="135 * scale">
|
|
7
|
+
<defs>
|
|
8
|
+
<filter id="dotShadowCpm" x="-60%" y="-60%" width="220%" height="220%">
|
|
9
|
+
<feDropShadow dx="0" dy="1" stdDeviation="2" flood-color="rgba(0,0,0,0.22)"/>
|
|
10
|
+
</filter>
|
|
11
|
+
</defs>
|
|
12
|
+
|
|
13
|
+
<path [attr.d]="trackArcPath" fill="none" stroke="#E8EAEF" stroke-width="14" stroke-linecap="round"/>
|
|
14
|
+
|
|
15
|
+
<!-- Proyección debajo, real encima -->
|
|
16
|
+
<path
|
|
17
|
+
[style.display]="totalAmount > 0 ? '' : 'none'"
|
|
18
|
+
[attr.d]="totalArcPath"
|
|
19
|
+
[attr.stroke]="activeColors.light"
|
|
20
|
+
fill="none" stroke-width="14" stroke-linecap="round"/>
|
|
21
|
+
|
|
22
|
+
<path
|
|
23
|
+
[style.display]="baseAmount > 0 ? '' : 'none'"
|
|
24
|
+
[attr.d]="baseArcPath"
|
|
25
|
+
[attr.stroke]="activeColors.dark"
|
|
26
|
+
fill="none" stroke-width="14" stroke-linecap="round"/>
|
|
27
|
+
|
|
28
|
+
<circle
|
|
29
|
+
[style.display]="baseAmount > 0 ? '' : 'none'"
|
|
30
|
+
[attr.cx]="dotBasePos.x" [attr.cy]="dotBasePos.y"
|
|
31
|
+
r="7" [attr.fill]="activeColors.dark"
|
|
32
|
+
stroke="#ffffff" stroke-width="2.5"
|
|
33
|
+
filter="url(#dotShadowCpm)"/>
|
|
34
|
+
|
|
35
|
+
<!-- Solo visible si la proyección va por delante del real -->
|
|
36
|
+
<circle
|
|
37
|
+
[style.display]="dotTotalVisible ? '' : 'none'"
|
|
38
|
+
[attr.cx]="dotTotalPos.x" [attr.cy]="dotTotalPos.y"
|
|
39
|
+
r="6" [attr.fill]="activeColors.light"
|
|
40
|
+
stroke="#ffffff" stroke-width="2.5"
|
|
41
|
+
filter="url(#dotShadowCpm)"/>
|
|
42
|
+
</svg>
|
|
43
|
+
|
|
44
|
+
<div class="gauge-center gauge-center--cpm" [style.bottom.px]="15 * scale">
|
|
45
|
+
<div class="main-value" [style.font-size.px]="26 * scale">CPM</div>
|
|
46
|
+
</div>
|
|
47
|
+
</div>
|
|
48
|
+
</ng-container>
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
<!-- Modo Gauge: gauge completo con montos, leyenda y alerta -->
|
|
52
|
+
<ng-container *ngIf="mode === CpmIndicatorMode.Gauge">
|
|
53
|
+
<div class="gauge-wrap" [style.width.px]="220 * scale" [style.height.px]="120 * scale">
|
|
54
|
+
<svg class="gauge-svg" viewBox="0 0 220 130" xmlns="http://www.w3.org/2000/svg"
|
|
55
|
+
[style.width.px]="220 * scale"
|
|
56
|
+
[style.height.px]="135 * scale">
|
|
57
|
+
<defs>
|
|
58
|
+
<filter id="dotShadowGauge" x="-60%" y="-60%" width="220%" height="220%">
|
|
59
|
+
<feDropShadow dx="0" dy="1" stdDeviation="2" flood-color="rgba(0,0,0,0.22)"/>
|
|
60
|
+
</filter>
|
|
61
|
+
</defs>
|
|
62
|
+
|
|
63
|
+
<path [attr.d]="trackArcPath" fill="none" stroke="#E8EAEF" stroke-width="14" stroke-linecap="round"/>
|
|
64
|
+
|
|
65
|
+
<!-- Proyección debajo, real encima -->
|
|
66
|
+
<path
|
|
67
|
+
[style.display]="totalAmount > 0 ? '' : 'none'"
|
|
68
|
+
[attr.d]="totalArcPath"
|
|
69
|
+
[attr.stroke]="activeColors.light"
|
|
70
|
+
fill="none" stroke-width="14" stroke-linecap="round"/>
|
|
71
|
+
|
|
72
|
+
<path
|
|
73
|
+
[style.display]="baseAmount > 0 ? '' : 'none'"
|
|
74
|
+
[attr.d]="baseArcPath"
|
|
75
|
+
[attr.stroke]="activeColors.dark"
|
|
76
|
+
fill="none" stroke-width="14" stroke-linecap="round"/>
|
|
77
|
+
|
|
78
|
+
<circle
|
|
79
|
+
[style.display]="baseAmount > 0 ? '' : 'none'"
|
|
80
|
+
[attr.cx]="dotBasePos.x" [attr.cy]="dotBasePos.y"
|
|
81
|
+
r="7" [attr.fill]="activeColors.dark"
|
|
82
|
+
stroke="#ffffff" stroke-width="2.5"
|
|
83
|
+
filter="url(#dotShadowGauge)"/>
|
|
84
|
+
|
|
85
|
+
<circle
|
|
86
|
+
[style.display]="dotTotalVisible ? '' : 'none'"
|
|
87
|
+
[attr.cx]="dotTotalPos.x" [attr.cy]="dotTotalPos.y"
|
|
88
|
+
r="6" [attr.fill]="activeColors.light"
|
|
89
|
+
stroke="#ffffff" stroke-width="2.5"
|
|
90
|
+
filter="url(#dotShadowGauge)"/>
|
|
91
|
+
|
|
92
|
+
<!-- <text
|
|
93
|
+
[attr.x]="limitTextPos.x" [attr.y]="limitTextPos.y"
|
|
94
|
+
font-family="DM Mono,monospace" font-size="9" font-weight="600"
|
|
95
|
+
fill="#8a8fa8" text-anchor="middle">
|
|
96
|
+
{{ currency }}{{ limit }}
|
|
97
|
+
</text> -->
|
|
98
|
+
</svg>
|
|
99
|
+
|
|
100
|
+
<!-- El color del monto cambia a rojo si supera el límite -->
|
|
101
|
+
<div class="gauge-center gauge-center--gauge" [style.bottom.px]="-10 * scale">
|
|
102
|
+
<div class="main-value"
|
|
103
|
+
[style.font-size.px]="26 * scale"
|
|
104
|
+
[style.color]="totalAmount > limit ? activeColors.dark : '#1a1a2e'">
|
|
105
|
+
CPM<br>
|
|
106
|
+
{{ currency }}{{ totalAmount | number:'1.2-2' }}
|
|
107
|
+
</div>
|
|
108
|
+
<div class="limit-label" [style.font-size.px]="16 * scale">
|
|
109
|
+
de {{ currency }}{{ limit | number:'1.2-2' }}
|
|
110
|
+
</div>
|
|
111
|
+
</div>
|
|
112
|
+
</div>
|
|
113
|
+
|
|
114
|
+
<div class="legend">
|
|
115
|
+
<div class="legend-item">
|
|
116
|
+
<span class="dot" [style.background]="activeColors.dark"></span>
|
|
117
|
+
Real
|
|
118
|
+
</div>
|
|
119
|
+
<div class="legend-item">
|
|
120
|
+
<span class="dot"
|
|
121
|
+
[style.background]="activeColors.light"
|
|
122
|
+
[style.border]="'1.5px solid ' + activeColors.dark">
|
|
123
|
+
</span>
|
|
124
|
+
Proyección
|
|
125
|
+
</div>
|
|
126
|
+
<div class="legend-item">
|
|
127
|
+
<span class="dot" style="background:#e8ecf5; border:1px solid #ccc"></span>
|
|
128
|
+
Disponible
|
|
129
|
+
</div>
|
|
130
|
+
</div>
|
|
131
|
+
|
|
132
|
+
<!-- Sliders de prueba — solo en devMode -->
|
|
133
|
+
<ng-container *ngIf="devMode">
|
|
134
|
+
<div class="divider"></div>
|
|
135
|
+
<div class="dev-badge">Dev Mode</div>
|
|
136
|
+
<div class="controls">
|
|
137
|
+
|
|
138
|
+
<div class="ctrl-row">
|
|
139
|
+
<div class="ctrl-header">
|
|
140
|
+
<span class="ctrl-label">
|
|
141
|
+
<span class="ctrl-label-dot" [style.background]="activeColors.dark"></span>
|
|
142
|
+
Gasto real (consumido)
|
|
143
|
+
</span>
|
|
144
|
+
<span class="ctrl-val" [style.color]="activeColors.dark">
|
|
145
|
+
{{ currency }}{{ sliderBase | number:'1.2-2' }}
|
|
146
|
+
</span>
|
|
147
|
+
</div>
|
|
148
|
+
<div class="zones-bar">
|
|
149
|
+
<div style="background:#16a34a"></div>
|
|
150
|
+
<div style="background:#ca8a04"></div>
|
|
151
|
+
<div style="background:#ea580c"></div>
|
|
152
|
+
<div style="background:#dc2626"></div>
|
|
153
|
+
</div>
|
|
154
|
+
<input type="range" [min]="0" [max]="sliderMax" step="0.5"
|
|
155
|
+
[value]="sliderBase" (input)="onDevBaseChange($event)">
|
|
156
|
+
</div>
|
|
157
|
+
|
|
158
|
+
<div class="ctrl-row">
|
|
159
|
+
<div class="ctrl-header">
|
|
160
|
+
<span class="ctrl-label">
|
|
161
|
+
<span class="ctrl-label-dot"
|
|
162
|
+
[style.background]="activeColors.light"
|
|
163
|
+
[style.border]="'1px solid ' + activeColors.dark"
|
|
164
|
+
style="border-radius:50%">
|
|
165
|
+
</span>
|
|
166
|
+
Proyección (presupuesto)
|
|
167
|
+
</span>
|
|
168
|
+
<span class="ctrl-val" [style.color]="activeColors.dark">
|
|
169
|
+
{{ currency }}{{ sliderProjected | number:'1.2-2' }}
|
|
170
|
+
</span>
|
|
171
|
+
</div>
|
|
172
|
+
<div class="zones-bar">
|
|
173
|
+
<div style="background:#16a34a"></div>
|
|
174
|
+
<div style="background:#ca8a04"></div>
|
|
175
|
+
<div style="background:#ea580c"></div>
|
|
176
|
+
<div style="background:#dc2626"></div>
|
|
177
|
+
</div>
|
|
178
|
+
<input type="range" [min]="0" [max]="sliderMax" step="0.5"
|
|
179
|
+
[value]="sliderProjected" (input)="onDevProjectedChange($event)">
|
|
180
|
+
</div>
|
|
181
|
+
|
|
182
|
+
</div>
|
|
183
|
+
</ng-container>
|
|
184
|
+
</ng-container>
|
|
185
|
+
|
|
186
|
+
<ng-template #cpmLegend>
|
|
187
|
+
<div class="legend-tooltip">
|
|
188
|
+
<div class="legend-tooltip__item">
|
|
189
|
+
<span class="dot" [style.background]="activeColors.dark"></span>
|
|
190
|
+
Real<span *ngIf="mode === CpmIndicatorMode.Gauge">: {{ currency }}{{ baseAmount | number:'1.2-2' }}</span>
|
|
191
|
+
</div>
|
|
192
|
+
<div class="legend-tooltip__item">
|
|
193
|
+
<span class="dot" [style.background]="activeColors.light"></span>
|
|
194
|
+
Proyección<span *ngIf="mode === CpmIndicatorMode.Gauge">: {{ currency }}{{ projectedAmount | number:'1.2-2' }}</span>
|
|
195
|
+
</div>
|
|
196
|
+
<div class="legend-tooltip__item">
|
|
197
|
+
<span class="dot" style="background:#e8ecf5"></span>
|
|
198
|
+
Disponible<span *ngIf="mode === CpmIndicatorMode.Gauge">: {{ currency }}{{ (limit - totalAmount) | number:'1.2-2' }}</span>
|
|
199
|
+
</div>
|
|
200
|
+
</div>
|
|
201
|
+
</ng-template>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { LibeyNgCpmIndicatorComponent } from './libey-ng-cpm-indicator.component';
|
|
4
|
+
|
|
5
|
+
describe('LibeyNgCpmIndicatorComponent', () => {
|
|
6
|
+
let component: LibeyNgCpmIndicatorComponent;
|
|
7
|
+
let fixture: ComponentFixture<LibeyNgCpmIndicatorComponent>;
|
|
8
|
+
|
|
9
|
+
beforeEach(async () => {
|
|
10
|
+
await TestBed.configureTestingModule({
|
|
11
|
+
declarations: [ LibeyNgCpmIndicatorComponent ]
|
|
12
|
+
})
|
|
13
|
+
.compileComponents();
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
beforeEach(() => {
|
|
17
|
+
fixture = TestBed.createComponent(LibeyNgCpmIndicatorComponent);
|
|
18
|
+
component = fixture.componentInstance;
|
|
19
|
+
fixture.detectChanges();
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it('should create', () => {
|
|
23
|
+
expect(component).toBeTruthy();
|
|
24
|
+
});
|
|
25
|
+
});
|