@solercia/ui 0.4.0 → 0.6.0
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/CHANGELOG.md +223 -0
- package/README.md +3 -1
- package/fesm2022/solercia-ui-theme-studio.mjs +4136 -0
- package/fesm2022/solercia-ui-theme-studio.mjs.map +1 -0
- package/fesm2022/solercia-ui.mjs +2565 -157
- package/fesm2022/solercia-ui.mjs.map +1 -1
- package/package.json +5 -1
- package/schematics/ng-add/index.js +1 -1
- package/types/solercia-ui-theme-studio.d.ts +546 -0
- package/types/solercia-ui.d.ts +1457 -537
package/fesm2022/solercia-ui.mjs
CHANGED
|
@@ -120,6 +120,16 @@ class SolInputComponent {
|
|
|
120
120
|
*/
|
|
121
121
|
autocomplete = input(undefined, /* @ts-ignore */
|
|
122
122
|
...(ngDevMode ? [{ debugName: "autocomplete" }] : /* istanbul ignore next */ []));
|
|
123
|
+
/**
|
|
124
|
+
* Passthrough opcional al atributo `min` del `<input>` nativo (ola-09,
|
|
125
|
+
* P3b): fecha mínima seleccionable en `type="date"` — evita agendar al
|
|
126
|
+
* pasado desde el propio selector nativo. `undefined` por defecto — con
|
|
127
|
+
* `[attr.min]` Angular OMITE el atributo por completo, así que ningún
|
|
128
|
+
* consumidor existente cambia de comportamiento (mismo patrón aditivo de
|
|
129
|
+
* `autocomplete`, arriba).
|
|
130
|
+
*/
|
|
131
|
+
min = input(undefined, /* @ts-ignore */
|
|
132
|
+
...(ngDevMode ? [{ debugName: "min" }] : /* istanbul ignore next */ []));
|
|
123
133
|
/* --- Internal state --- */
|
|
124
134
|
value = signal('', /* @ts-ignore */
|
|
125
135
|
...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
@@ -147,7 +157,7 @@ class SolInputComponent {
|
|
|
147
157
|
this.isDisabled.set(isDisabled);
|
|
148
158
|
}
|
|
149
159
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: SolInputComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
150
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: SolInputComponent, isStandalone: true, selector: "sol-input", inputs: { type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, error: { classPropertyName: "error", publicName: "error", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, autocomplete: { classPropertyName: "autocomplete", publicName: "autocomplete", isSignal: true, isRequired: false, transformFunction: null } }, providers: [
|
|
160
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: SolInputComponent, isStandalone: true, selector: "sol-input", inputs: { type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, error: { classPropertyName: "error", publicName: "error", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, autocomplete: { classPropertyName: "autocomplete", publicName: "autocomplete", isSignal: true, isRequired: false, transformFunction: null }, min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null } }, providers: [
|
|
151
161
|
{
|
|
152
162
|
provide: NG_VALUE_ACCESSOR,
|
|
153
163
|
useExisting: forwardRef(() => SolInputComponent),
|
|
@@ -167,6 +177,7 @@ class SolInputComponent {
|
|
|
167
177
|
[disabled]="disabled() || isDisabled()"
|
|
168
178
|
[value]="value()"
|
|
169
179
|
[attr.autocomplete]="autocomplete()"
|
|
180
|
+
[attr.min]="min()"
|
|
170
181
|
(input)="onInputChange($event)"
|
|
171
182
|
(blur)="onTouched()"
|
|
172
183
|
/>
|
|
@@ -198,6 +209,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
198
209
|
[disabled]="disabled() || isDisabled()"
|
|
199
210
|
[value]="value()"
|
|
200
211
|
[attr.autocomplete]="autocomplete()"
|
|
212
|
+
[attr.min]="min()"
|
|
201
213
|
(input)="onInputChange($event)"
|
|
202
214
|
(blur)="onTouched()"
|
|
203
215
|
/>
|
|
@@ -206,7 +218,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
206
218
|
}
|
|
207
219
|
</div>
|
|
208
220
|
`, styles: [":host{display:block}.sol-input-wrapper{display:flex;flex-direction:column;gap:var(--sol-space-xs)}.sol-input-label{font-family:var(--sol-font-family);font-size:var(--sol-font-size-sm, 12px);font-weight:500;color:var(--sol-color-text-secondary, #64748B);text-transform:uppercase;letter-spacing:.05em;line-height:1}.sol-input{width:100%;height:var(--sol-size-input-height);padding:0 var(--sol-space-sm);font-family:var(--sol-font-family);font-size:var(--sol-font-size-base);color:var(--sol-color-text-primary);background:var(--sol-input-bg, var(--sol-bg-surface));border:var(--sol-input-border, var(--sol-border-width-default) solid var(--sol-border-color-default));border-radius:var(--sol-input-radius, var(--sol-border-radius-md));box-shadow:var(--sol-input-shadow, none);outline:none;box-sizing:border-box;transition:border-color var(--sol-dur-fast, .15s) var(--sol-ease, ease),box-shadow var(--sol-dur-fast, .15s) var(--sol-ease, ease)}.sol-input::placeholder{color:var(--sol-color-text-muted)}.sol-input:focus{border:var(--sol-input-focus-border, var(--sol-border-width-default) solid var(--sol-color-primary));box-shadow:var(--sol-input-focus-ring, 0 0 0 2px color-mix(in srgb, var(--sol-color-primary) 20%, transparent))}.sol-input--error{border-color:var(--sol-color-danger)}.sol-input--error:focus{border-color:var(--sol-color-danger);box-shadow:0 0 0 2px color-mix(in srgb,var(--sol-color-danger) 20%,transparent)}.sol-input--disabled{opacity:.5;cursor:not-allowed}.sol-input-error{font-family:var(--sol-font-family);font-size:var(--sol-font-size-sm, 12px);color:var(--sol-color-danger);line-height:1.3}@media(max-width:640px){.sol-input{font-size:16px}}\n"] }]
|
|
209
|
-
}], propDecorators: { type: [{ type: i0.Input, args: [{ isSignal: true, alias: "type", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], error: [{ type: i0.Input, args: [{ isSignal: true, alias: "error", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], autocomplete: [{ type: i0.Input, args: [{ isSignal: true, alias: "autocomplete", required: false }] }] } });
|
|
221
|
+
}], propDecorators: { type: [{ type: i0.Input, args: [{ isSignal: true, alias: "type", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], error: [{ type: i0.Input, args: [{ isSignal: true, alias: "error", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], autocomplete: [{ type: i0.Input, args: [{ isSignal: true, alias: "autocomplete", required: false }] }], min: [{ type: i0.Input, args: [{ isSignal: true, alias: "min", required: false }] }] } });
|
|
210
222
|
|
|
211
223
|
/**
|
|
212
224
|
* Icon Registry — inner SVG path content (without the <svg> wrapper).
|
|
@@ -593,6 +605,24 @@ const ICON_REGISTRY = {
|
|
|
593
605
|
outline: `<path stroke-linecap="round" stroke-linejoin="round" d="m11.25 11.25.041-.02a.75.75 0 0 1 1.063.852l-.708 2.836a.75.75 0 0 0 1.063.853l.041-.021M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9-3.75h.008v.008H12V8.25Z" />`,
|
|
594
606
|
fill: `<path fill-rule="evenodd" d="M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12Zm8.706-1.442c1.146-.573 2.437.463 2.126 1.706l-.709 2.836.042-.02a.75.75 0 0 1 .67 1.34l-.04.022c-1.147.573-2.438-.463-2.127-1.706l.71-2.836-.042.02a.75.75 0 1 1-.671-1.34l.041-.022ZM12 9a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5Z" clip-rule="evenodd" />`,
|
|
595
607
|
},
|
|
608
|
+
// ── Aportes de Solercia Command (0.5.0) — Heroicons v2, `d` copiados sin editar ──
|
|
609
|
+
// Los tres cierran el gap que Solercia Command documentó en su auditoría de UI
|
|
610
|
+
// (openspec, cambio 13, inventory.md: "Pendientes de aporte a la librería"), donde
|
|
611
|
+
// sobrevivían como SVG inline por no existir aquí.
|
|
612
|
+
// NOTA: `sitemap`, también pedido por esa auditoría, NO existe en Heroicons v2 y no se
|
|
613
|
+
// inventa path data (regla de la cabecera). Sigue pendiente como ícono propio.
|
|
614
|
+
'arrow-left': {
|
|
615
|
+
outline: `<path stroke-linecap="round" stroke-linejoin="round" d="M10.5 19.5 3 12m0 0 7.5-7.5M3 12h18" />`,
|
|
616
|
+
fill: `<path fill-rule="evenodd" d="M11.03 3.97a.75.75 0 0 1 0 1.06l-6.22 6.22H21a.75.75 0 0 1 0 1.5H4.81l6.22 6.22a.75.75 0 1 1-1.06 1.06l-7.5-7.5a.75.75 0 0 1 0-1.06l7.5-7.5a.75.75 0 0 1 1.06 0Z" clip-rule="evenodd" />`,
|
|
617
|
+
},
|
|
618
|
+
'arrow-right-on-rectangle': {
|
|
619
|
+
outline: `<path stroke-linecap="round" stroke-linejoin="round" d="M15.75 9V5.25A2.25 2.25 0 0 0 13.5 3h-6a2.25 2.25 0 0 0-2.25 2.25v13.5A2.25 2.25 0 0 0 7.5 21h6a2.25 2.25 0 0 0 2.25-2.25V15m3 0 3-3m0 0-3-3m3 3H9" />`,
|
|
620
|
+
fill: `<path fill-rule="evenodd" d="M7.5 3.75A1.5 1.5 0 0 0 6 5.25v13.5a1.5 1.5 0 0 0 1.5 1.5h6a1.5 1.5 0 0 0 1.5-1.5V15a.75.75 0 0 1 1.5 0v3.75a3 3 0 0 1-3 3h-6a3 3 0 0 1-3-3V5.25a3 3 0 0 1 3-3h6a3 3 0 0 1 3 3V9A.75.75 0 0 1 15 9V5.25a1.5 1.5 0 0 0-1.5-1.5h-6Zm10.72 4.72a.75.75 0 0 1 1.06 0l3 3a.75.75 0 0 1 0 1.06l-3 3a.75.75 0 1 1-1.06-1.06l1.72-1.72H9a.75.75 0 0 1 0-1.5h10.94l-1.72-1.72a.75.75 0 0 1 0-1.06Z" clip-rule="evenodd" />`,
|
|
621
|
+
},
|
|
622
|
+
flag: {
|
|
623
|
+
outline: `<path stroke-linecap="round" stroke-linejoin="round" d="M3 3v1.5M3 21v-6m0 0 2.77-.693a9 9 0 0 1 6.208.682l.108.054a9 9 0 0 0 6.086.71l3.114-.732a48.524 48.524 0 0 1-.005-10.499l-3.11.732a9 9 0 0 1-6.085-.711l-.108-.054a9 9 0 0 0-6.208-.682L3 4.5M3 15V4.5" />`,
|
|
624
|
+
fill: `<path fill-rule="evenodd" d="M3 2.25a.75.75 0 0 1 .75.75v.54l1.838-.46a9.75 9.75 0 0 1 6.725.738l.108.054A8.25 8.25 0 0 0 18 4.524l3.11-.732a.75.75 0 0 1 .917.81 47.784 47.784 0 0 0 .005 10.337.75.75 0 0 1-.574.812l-3.114.733a9.75 9.75 0 0 1-6.594-.77l-.108-.054a8.25 8.25 0 0 0-5.69-.625l-2.202.55V21a.75.75 0 0 1-1.5 0V3A.75.75 0 0 1 3 2.25Z" clip-rule="evenodd" />`,
|
|
625
|
+
},
|
|
596
626
|
// ── CRM / Vocero — íconos propios sin equivalente Heroicons (11-a-solercia-ui, PR2) ──
|
|
597
627
|
// Sin licencia MIT de terceros que reproducir: diseño propio, mismo patrón que la
|
|
598
628
|
// sección de rich-editor (trazo stroke-linecap/linejoin round, viewBox 24×24 implícito
|
|
@@ -691,6 +721,44 @@ const ICON_REGISTRY = {
|
|
|
691
721
|
outline: `<path stroke-linecap="round" stroke-linejoin="round" d="M9 15l6-6M11 6l.46-.54a5 5 0 0 1 7.08 7.08l-.54.46M13 18l-.4.53a5.07 5.07 0 0 1-7.13 0 4.97 4.97 0 0 1 0-7.07l.52-.46" />`,
|
|
692
722
|
fill: '',
|
|
693
723
|
},
|
|
724
|
+
// ── Aportes v0.6.0 — Heroicons v2.1.5, `d` copiados sin editar ────────────────
|
|
725
|
+
// Ocho íconos nuevos para el ciclo candidato a 0.6.0: acciones de
|
|
726
|
+
// descarga/impresión, contenido educativo (libro, bombilla, presentación),
|
|
727
|
+
// reconocimiento (pulgar arriba) y jerarquía de carpetas (folder/folder-open,
|
|
728
|
+
// para árboles de archivos). outline + solid desde el paquete npm
|
|
729
|
+
// `heroicons@2.1.5` (MIT), sin modificar el atributo `d`.
|
|
730
|
+
'arrow-down-tray': {
|
|
731
|
+
outline: `<path stroke-linecap="round" stroke-linejoin="round" d="M3 16.5v2.25A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75V16.5M16.5 12 12 16.5m0 0L7.5 12m4.5 4.5V3" />`,
|
|
732
|
+
fill: `<path fill-rule="evenodd" d="M12 2.25a.75.75 0 0 1 .75.75v11.69l3.22-3.22a.75.75 0 1 1 1.06 1.06l-4.5 4.5a.75.75 0 0 1-1.06 0l-4.5-4.5a.75.75 0 1 1 1.06-1.06l3.22 3.22V3a.75.75 0 0 1 .75-.75Zm-9 13.5a.75.75 0 0 1 .75.75v2.25a1.5 1.5 0 0 0 1.5 1.5h13.5a1.5 1.5 0 0 0 1.5-1.5V16.5a.75.75 0 0 1 1.5 0v2.25a3 3 0 0 1-3 3H5.25a3 3 0 0 1-3-3V16.5a.75.75 0 0 1 .75-.75Z" clip-rule="evenodd" />`,
|
|
733
|
+
},
|
|
734
|
+
'book-open': {
|
|
735
|
+
outline: `<path stroke-linecap="round" stroke-linejoin="round" d="M12 6.042A8.967 8.967 0 0 0 6 3.75c-1.052 0-2.062.18-3 .512v14.25A8.987 8.987 0 0 1 6 18c2.305 0 4.408.867 6 2.292m0-14.25a8.966 8.966 0 0 1 6-2.292c1.052 0 2.062.18 3 .512v14.25A8.987 8.987 0 0 0 18 18a8.967 8.967 0 0 0-6 2.292m0-14.25v14.25" />`,
|
|
736
|
+
fill: `<path d="M11.25 4.533A9.707 9.707 0 0 0 6 3a9.735 9.735 0 0 0-3.25.555.75.75 0 0 0-.5.707v14.25a.75.75 0 0 0 1 .707A8.237 8.237 0 0 1 6 18.75c1.995 0 3.823.707 5.25 1.886V4.533ZM12.75 20.636A8.214 8.214 0 0 1 18 18.75c.966 0 1.89.166 2.75.47a.75.75 0 0 0 1-.708V4.262a.75.75 0 0 0-.5-.707A9.735 9.735 0 0 0 18 3a9.707 9.707 0 0 0-5.25 1.533v16.103Z" />`,
|
|
737
|
+
},
|
|
738
|
+
'light-bulb': {
|
|
739
|
+
outline: `<path stroke-linecap="round" stroke-linejoin="round" d="M12 18v-5.25m0 0a6.01 6.01 0 0 0 1.5-.189m-1.5.189a6.01 6.01 0 0 1-1.5-.189m3.75 7.478a12.06 12.06 0 0 1-4.5 0m3.75 2.383a14.406 14.406 0 0 1-3 0M14.25 18v-.192c0-.983.658-1.823 1.508-2.316a7.5 7.5 0 1 0-7.517 0c.85.493 1.509 1.333 1.509 2.316V18" />`,
|
|
740
|
+
fill: `<path d="M12 .75a8.25 8.25 0 0 0-4.135 15.39c.686.398 1.115 1.008 1.134 1.623a.75.75 0 0 0 .577.706c.352.083.71.148 1.074.195.323.041.6-.218.6-.544v-4.661a6.714 6.714 0 0 1-.937-.171.75.75 0 1 1 .374-1.453 5.261 5.261 0 0 0 2.626 0 .75.75 0 1 1 .374 1.452 6.712 6.712 0 0 1-.937.172v4.66c0 .327.277.586.6.545.364-.047.722-.112 1.074-.195a.75.75 0 0 0 .577-.706c.02-.615.448-1.225 1.134-1.623A8.25 8.25 0 0 0 12 .75Z" /><path fill-rule="evenodd" d="M9.013 19.9a.75.75 0 0 1 .877-.597 11.319 11.319 0 0 0 4.22 0 .75.75 0 1 1 .28 1.473 12.819 12.819 0 0 1-4.78 0 .75.75 0 0 1-.597-.876ZM9.754 22.344a.75.75 0 0 1 .824-.668 13.682 13.682 0 0 0 2.844 0 .75.75 0 1 1 .156 1.492 15.156 15.156 0 0 1-3.156 0 .75.75 0 0 1-.668-.824Z" clip-rule="evenodd" />`,
|
|
741
|
+
},
|
|
742
|
+
'hand-thumb-up': {
|
|
743
|
+
outline: `<path stroke-linecap="round" stroke-linejoin="round" d="M6.633 10.25c.806 0 1.533-.446 2.031-1.08a9.041 9.041 0 0 1 2.861-2.4c.723-.384 1.35-.956 1.653-1.715a4.498 4.498 0 0 0 .322-1.672V2.75a.75.75 0 0 1 .75-.75 2.25 2.25 0 0 1 2.25 2.25c0 1.152-.26 2.243-.723 3.218-.266.558.107 1.282.725 1.282m0 0h3.126c1.026 0 1.945.694 2.054 1.715.045.422.068.85.068 1.285a11.95 11.95 0 0 1-2.649 7.521c-.388.482-.987.729-1.605.729H13.48c-.483 0-.964-.078-1.423-.23l-3.114-1.04a4.501 4.501 0 0 0-1.423-.23H5.904m10.598-9.75H14.25M5.904 18.5c.083.205.173.405.27.602.197.4-.078.898-.523.898h-.908c-.889 0-1.713-.518-1.972-1.368a12 12 0 0 1-.521-3.507c0-1.553.295-3.036.831-4.398C3.387 9.953 4.167 9.5 5 9.5h1.053c.472 0 .745.556.5.96a8.958 8.958 0 0 0-1.302 4.665c0 1.194.232 2.333.654 3.375Z" />`,
|
|
744
|
+
fill: `<path d="M7.493 18.5c-.425 0-.82-.236-.975-.632A7.48 7.48 0 0 1 6 15.125c0-1.75.599-3.358 1.602-4.634.151-.192.373-.309.6-.397.473-.183.89-.514 1.212-.924a9.042 9.042 0 0 1 2.861-2.4c.723-.384 1.35-.956 1.653-1.715a4.498 4.498 0 0 0 .322-1.672V2.75A.75.75 0 0 1 15 2a2.25 2.25 0 0 1 2.25 2.25c0 1.152-.26 2.243-.723 3.218-.266.558.107 1.282.725 1.282h3.126c1.026 0 1.945.694 2.054 1.715.045.422.068.85.068 1.285a11.95 11.95 0 0 1-2.649 7.521c-.388.482-.987.729-1.605.729H14.23c-.483 0-.964-.078-1.423-.23l-3.114-1.04a4.501 4.501 0 0 0-1.423-.23h-.777ZM2.331 10.727a11.969 11.969 0 0 0-.831 4.398 12 12 0 0 0 .52 3.507C2.28 19.482 3.105 20 3.994 20H4.9c.445 0 .72-.498.523-.898a8.963 8.963 0 0 1-.924-3.977c0-1.708.476-3.305 1.302-4.666.245-.403-.028-.959-.5-.959H4.25c-.832 0-1.612.453-1.918 1.227Z" />`,
|
|
745
|
+
},
|
|
746
|
+
'presentation-chart-line': {
|
|
747
|
+
outline: `<path stroke-linecap="round" stroke-linejoin="round" d="M3.75 3v11.25A2.25 2.25 0 0 0 6 16.5h2.25M3.75 3h-1.5m1.5 0h16.5m0 0h1.5m-1.5 0v11.25A2.25 2.25 0 0 1 18 16.5h-2.25m-7.5 0h7.5m-7.5 0-1 3m8.5-3 1 3m0 0 .5 1.5m-.5-1.5h-9.5m0 0-.5 1.5m.75-9 3-3 2.148 2.148A12.061 12.061 0 0 1 16.5 7.605" />`,
|
|
748
|
+
fill: `<path fill-rule="evenodd" d="M2.25 2.25a.75.75 0 0 0 0 1.5H3v10.5a3 3 0 0 0 3 3h1.21l-1.172 3.513a.75.75 0 0 0 1.424.474l.329-.987h8.418l.33.987a.75.75 0 0 0 1.422-.474l-1.17-3.513H18a3 3 0 0 0 3-3V3.75h.75a.75.75 0 0 0 0-1.5H2.25Zm6.54 15h6.42l.5 1.5H8.29l.5-1.5Zm8.085-8.995a.75.75 0 1 0-.75-1.299 12.81 12.81 0 0 0-3.558 3.05L11.03 8.47a.75.75 0 0 0-1.06 0l-3 3a.75.75 0 1 0 1.06 1.06l2.47-2.47 1.617 1.618a.75.75 0 0 0 1.146-.102 11.312 11.312 0 0 1 3.612-3.321Z" clip-rule="evenodd" />`,
|
|
749
|
+
},
|
|
750
|
+
printer: {
|
|
751
|
+
outline: `<path stroke-linecap="round" stroke-linejoin="round" d="M6.72 13.829c-.24.03-.48.062-.72.096m.72-.096a42.415 42.415 0 0 1 10.56 0m-10.56 0L6.34 18m10.94-4.171c.24.03.48.062.72.096m-.72-.096L17.66 18m0 0 .229 2.523a1.125 1.125 0 0 1-1.12 1.227H7.231c-.662 0-1.18-.568-1.12-1.227L6.34 18m11.318 0h1.091A2.25 2.25 0 0 0 21 15.75V9.456c0-1.081-.768-2.015-1.837-2.175a48.055 48.055 0 0 0-1.913-.247M6.34 18H5.25A2.25 2.25 0 0 1 3 15.75V9.456c0-1.081.768-2.015 1.837-2.175a48.041 48.041 0 0 1 1.913-.247m10.5 0a48.536 48.536 0 0 0-10.5 0m10.5 0V3.375c0-.621-.504-1.125-1.125-1.125h-8.25c-.621 0-1.125.504-1.125 1.125v3.659M18 10.5h.008v.008H18V10.5Zm-3 0h.008v.008H15V10.5Z" />`,
|
|
752
|
+
fill: `<path fill-rule="evenodd" d="M7.875 1.5C6.839 1.5 6 2.34 6 3.375v2.99c-.426.053-.851.11-1.274.174-1.454.218-2.476 1.483-2.476 2.917v6.294a3 3 0 0 0 3 3h.27l-.155 1.705A1.875 1.875 0 0 0 7.232 22.5h9.536a1.875 1.875 0 0 0 1.867-2.045l-.155-1.705h.27a3 3 0 0 0 3-3V9.456c0-1.434-1.022-2.7-2.476-2.917A48.716 48.716 0 0 0 18 6.366V3.375c0-1.036-.84-1.875-1.875-1.875h-8.25ZM16.5 6.205v-2.83A.375.375 0 0 0 16.125 3h-8.25a.375.375 0 0 0-.375.375v2.83a49.353 49.353 0 0 1 9 0Zm-.217 8.265c.178.018.317.16.333.337l.526 5.784a.375.375 0 0 1-.374.409H7.232a.375.375 0 0 1-.374-.409l.526-5.784a.373.373 0 0 1 .333-.337 41.741 41.741 0 0 1 8.566 0Zm.967-3.97a.75.75 0 0 1 .75-.75h.008a.75.75 0 0 1 .75.75v.008a.75.75 0 0 1-.75.75H18a.75.75 0 0 1-.75-.75V10.5ZM15 9.75a.75.75 0 0 0-.75.75v.008c0 .414.336.75.75.75h.008a.75.75 0 0 0 .75-.75V10.5a.75.75 0 0 0-.75-.75H15Z" clip-rule="evenodd" />`,
|
|
753
|
+
},
|
|
754
|
+
folder: {
|
|
755
|
+
outline: `<path stroke-linecap="round" stroke-linejoin="round" d="M2.25 12.75V12A2.25 2.25 0 0 1 4.5 9.75h15A2.25 2.25 0 0 1 21.75 12v.75m-8.69-6.44-2.12-2.12a1.5 1.5 0 0 0-1.061-.44H4.5A2.25 2.25 0 0 0 2.25 6v12a2.25 2.25 0 0 0 2.25 2.25h15A2.25 2.25 0 0 0 21.75 18V9a2.25 2.25 0 0 0-2.25-2.25h-5.379a1.5 1.5 0 0 1-1.06-.44Z" />`,
|
|
756
|
+
fill: `<path d="M19.906 9c.382 0 .749.057 1.094.162V9a3 3 0 0 0-3-3h-3.879a.75.75 0 0 1-.53-.22L11.47 3.66A2.25 2.25 0 0 0 9.879 3H6a3 3 0 0 0-3 3v3.162A3.756 3.756 0 0 1 4.094 9h15.812ZM4.094 10.5a2.25 2.25 0 0 0-2.227 2.568l.857 6A2.25 2.25 0 0 0 4.951 21H19.05a2.25 2.25 0 0 0 2.227-1.932l.857-6a2.25 2.25 0 0 0-2.227-2.568H4.094Z" />`,
|
|
757
|
+
},
|
|
758
|
+
'folder-open': {
|
|
759
|
+
outline: `<path stroke-linecap="round" stroke-linejoin="round" d="M3.75 9.776c.112-.017.227-.026.344-.026h15.812c.117 0 .232.009.344.026m-16.5 0a2.25 2.25 0 0 0-1.883 2.542l.857 6a2.25 2.25 0 0 0 2.227 1.932H19.05a2.25 2.25 0 0 0 2.227-1.932l.857-6a2.25 2.25 0 0 0-1.883-2.542m-16.5 0V6A2.25 2.25 0 0 1 6 3.75h3.879a1.5 1.5 0 0 1 1.06.44l2.122 2.12a1.5 1.5 0 0 0 1.06.44H18A2.25 2.25 0 0 1 20.25 9v.776" />`,
|
|
760
|
+
fill: `<path d="M19.5 21a3 3 0 0 0 3-3v-4.5a3 3 0 0 0-3-3h-15a3 3 0 0 0-3 3V18a3 3 0 0 0 3 3h15ZM1.5 10.146V6a3 3 0 0 1 3-3h5.379a2.25 2.25 0 0 1 1.59.659l2.122 2.121c.14.141.331.22.53.22H19.5a3 3 0 0 1 3 3v1.146A4.483 4.483 0 0 0 19.5 9h-15a4.483 4.483 0 0 0-3 1.146Z" />`,
|
|
761
|
+
},
|
|
694
762
|
};
|
|
695
763
|
|
|
696
764
|
class SolIconComponent {
|
|
@@ -947,6 +1015,23 @@ class SolSelectComponent {
|
|
|
947
1015
|
/** Label for the "all" option in single mode. */
|
|
948
1016
|
allOptionLabel = input('Todos', /* @ts-ignore */
|
|
949
1017
|
...(ngDevMode ? [{ debugName: "allOptionLabel" }] : /* istanbul ignore next */ []));
|
|
1018
|
+
/**
|
|
1019
|
+
* Viewport width (px) at or below which the trigger and the inner search
|
|
1020
|
+
* rise to 16px to avoid iOS Safari auto-zoom. The CSS baseline keeps
|
|
1021
|
+
* protecting viewports up to 640px without JavaScript; a larger value
|
|
1022
|
+
* (e.g. 768 for hosts whose mobile layout starts there) extends it.
|
|
1023
|
+
*/
|
|
1024
|
+
mobileBreakpoint = input(640, /* @ts-ignore */
|
|
1025
|
+
...(ngDevMode ? [{ debugName: "mobileBreakpoint" }] : /* istanbul ignore next */ []));
|
|
1026
|
+
/** Current viewport width, refreshed on `window:resize`. */
|
|
1027
|
+
viewportWidth = signal(SolSelectComponent.readViewportWidth(), /* @ts-ignore */
|
|
1028
|
+
...(ngDevMode ? [{ debugName: "viewportWidth" }] : /* istanbul ignore next */ []));
|
|
1029
|
+
/** True when the viewport is within `mobileBreakpoint` (drives the touch classes). */
|
|
1030
|
+
touchViewport = computed(() => {
|
|
1031
|
+
const width = this.viewportWidth();
|
|
1032
|
+
return width > 0 && width <= this.mobileBreakpoint();
|
|
1033
|
+
}, /* @ts-ignore */
|
|
1034
|
+
...(ngDevMode ? [{ debugName: "touchViewport" }] : /* istanbul ignore next */ []));
|
|
950
1035
|
// ── Internal state ──
|
|
951
1036
|
isOpen = signal(false, /* @ts-ignore */
|
|
952
1037
|
...(ngDevMode ? [{ debugName: "isOpen" }] : /* istanbul ignore next */ []));
|
|
@@ -1014,6 +1099,12 @@ class SolSelectComponent {
|
|
|
1014
1099
|
constructor(hostEl) {
|
|
1015
1100
|
this.hostEl = hostEl;
|
|
1016
1101
|
}
|
|
1102
|
+
onViewportResize() {
|
|
1103
|
+
this.viewportWidth.set(SolSelectComponent.readViewportWidth());
|
|
1104
|
+
}
|
|
1105
|
+
static readViewportWidth() {
|
|
1106
|
+
return typeof window !== 'undefined' && Number.isFinite(window.innerWidth) ? window.innerWidth : 0;
|
|
1107
|
+
}
|
|
1017
1108
|
toggleDropdown() {
|
|
1018
1109
|
if (this.disabled())
|
|
1019
1110
|
return;
|
|
@@ -1085,7 +1176,7 @@ class SolSelectComponent {
|
|
|
1085
1176
|
this.onChange(Array.from(this.multiValues()));
|
|
1086
1177
|
}
|
|
1087
1178
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: SolSelectComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
1088
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: SolSelectComponent, isStandalone: true, selector: "sol-select", inputs: { placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, error: { classPropertyName: "error", publicName: "error", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, searchable: { classPropertyName: "searchable", publicName: "searchable", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, showAllOption: { classPropertyName: "showAllOption", publicName: "showAllOption", isSignal: true, isRequired: false, transformFunction: null }, allOptionLabel: { classPropertyName: "allOptionLabel", publicName: "allOptionLabel", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "document:click": "onDocumentClick($event)" } }, providers: [
|
|
1179
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: SolSelectComponent, isStandalone: true, selector: "sol-select", inputs: { placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, error: { classPropertyName: "error", publicName: "error", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, searchable: { classPropertyName: "searchable", publicName: "searchable", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, showAllOption: { classPropertyName: "showAllOption", publicName: "showAllOption", isSignal: true, isRequired: false, transformFunction: null }, allOptionLabel: { classPropertyName: "allOptionLabel", publicName: "allOptionLabel", isSignal: true, isRequired: false, transformFunction: null }, mobileBreakpoint: { classPropertyName: "mobileBreakpoint", publicName: "mobileBreakpoint", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "document:click": "onDocumentClick($event)", "window:resize": "onViewportResize()" }, properties: { "class.sol-select--touch": "touchViewport()" } }, providers: [
|
|
1089
1180
|
{
|
|
1090
1181
|
provide: NG_VALUE_ACCESSOR,
|
|
1091
1182
|
useExisting: forwardRef(() => SolSelectComponent),
|
|
@@ -1128,6 +1219,7 @@ class SolSelectComponent {
|
|
|
1128
1219
|
[solFloatingPanel]="triggerBtn"
|
|
1129
1220
|
(dropUpChange)="dropUp.set($event)"
|
|
1130
1221
|
[class.sol-select__dropdown--up]="dropUp()"
|
|
1222
|
+
[class.sol-select__dropdown--touch]="touchViewport()"
|
|
1131
1223
|
>
|
|
1132
1224
|
<!-- Search -->
|
|
1133
1225
|
@if (searchable()) {
|
|
@@ -1189,11 +1281,13 @@ class SolSelectComponent {
|
|
|
1189
1281
|
@if (error()) {
|
|
1190
1282
|
<p class="sol-select__error">{{ error() }}</p>
|
|
1191
1283
|
}
|
|
1192
|
-
`, isInline: true, styles: [":host{display:block}:host,.sol-select__dropdown{--sol-select-bg: var(--sol-input-bg, var(--sol-bg-surface, #ffffff));--sol-select-text: var(--sol-color-text-primary, #1e293b);--sol-select-placeholder: var(--sol-color-text-muted, #94a3b8);--sol-select-border: var(--sol-border-color-default, #cbd5e1);--sol-select-border-focus: var(--sol-color-primary, #6366f1);--sol-select-error-color: var(--sol-color-danger, #ef4444);--sol-select-label-color: var(--sol-color-text-secondary, #475569);--sol-select-arrow-color: var(--sol-color-text-muted, #94a3b8);--sol-select-disabled-opacity: var(--sol-disabled-opacity, .55);--sol-select-radius: var(--sol-input-radius, var(--sol-border-radius-md, .5rem));--sol-select-border-width: var(--sol-border-width-default, 1px);--sol-select-padding-x: var(--sol-space-sm, .75rem);--sol-select-height: var(--sol-size-input-height, 2.5rem);--sol-select-font-size: var(--sol-font-size-base, .875rem);--sol-select-label-font-size: var(--sol-font-size-sm, .75rem);--sol-select-label-font-weight: var(--sol-font-weight-bold, 600);--sol-select-shadow: var(--sol-input-shadow, var(--sol-shadow-sm, 0 1px 2px rgba(0,0,0,.05)));--sol-select-focus-ring: var(--sol-input-focus-ring, 0 0 0 3px color-mix(in srgb, var(--sol-color-primary, #6366f1) 40%, transparent));--sol-select-transition: var(--sol-dur-fast, .15s) var(--sol-ease, ease);--sol-select-dropdown-bg: var(--sol-bg-surface, #ffffff);--sol-select-option-hover: var(--sol-color-bg-hover, rgba(0,0,0,.04));--sol-select-option-active-bg: color-mix(in srgb, var(--sol-color-primary, #6366f1) 12%, transparent);--sol-select-option-active-text: var(--sol-color-primary, #6366f1)}.sol-select__label{display:block;margin-bottom:.375rem;font-size:var(--sol-select-label-font-size);font-weight:var(--sol-select-label-font-weight);color:var(--sol-select-label-color);line-height:1.4}.sol-select__wrapper{position:relative;display:block}.sol-select__trigger{display:flex;align-items:center;justify-content:space-between;width:100%;height:var(--sol-select-height);padding:0 var(--sol-select-padding-x);font-family:inherit;font-size:var(--sol-select-font-size);color:var(--sol-select-text);background-color:var(--sol-select-bg);border:var(--sol-input-border, var(--sol-select-border-width) solid var(--sol-select-border));border-radius:var(--sol-select-radius);box-shadow:var(--sol-select-shadow);cursor:pointer;transition:border-color var(--sol-select-transition),box-shadow var(--sol-select-transition);text-align:left}.sol-select__trigger:focus{outline:none;border:var(--sol-input-focus-border, var(--sol-select-border-width) solid var(--sol-select-border-focus));box-shadow:var(--sol-select-focus-ring)}.sol-select__trigger:disabled{cursor:not-allowed;opacity:var(--sol-select-disabled-opacity)}.sol-select__trigger--error{border-color:var(--sol-select-error-color)}.sol-select__trigger--open{border:var(--sol-input-focus-border, var(--sol-select-border-width) solid var(--sol-select-border-focus));box-shadow:var(--sol-select-focus-ring)}.sol-select__display{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.sol-select__display--placeholder{color:var(--sol-select-placeholder)}.sol-select__arrow{width:1.25rem;height:1.25rem;flex-shrink:0;color:var(--sol-select-arrow-color);transition:transform var(--sol-select-transition)}.sol-select__arrow--open{transform:rotate(180deg)}.sol-select__dropdown{position:absolute;top:calc(100% + 4px);left:0;right:0;background:var(--sol-select-dropdown-bg);border:var(--sol-select-border-width) solid var(--sol-select-border);border-radius:var(--sol-select-radius);box-shadow:var(--sol-shadow-lg, 0 10px 25px rgba(0,0,0,.15));max-height:280px;display:flex;flex-direction:column;animation:sol-select-fade .12s ease-out}.sol-select__search-box{padding:.5rem;border-bottom:1px solid var(--sol-select-border)}.sol-select__search{width:100%;height:2rem;padding:0 .5rem;font-family:inherit;font-size:var(--sol-select-font-size);color:var(--sol-select-text);background:var(--sol-select-bg);border:var(--sol-select-border-width) solid var(--sol-select-border);border-radius:calc(var(--sol-select-radius) - 2px);outline:none}.sol-select__search:focus{border-color:var(--sol-select-border-focus)}.sol-select__bulk-actions{display:flex;gap:.25rem;padding:.375rem .5rem;border-bottom:1px solid var(--sol-select-border)}.sol-select__bulk-btn{flex:1;padding:.25rem;font-size:.7rem;font-weight:600;text-transform:uppercase;letter-spacing:.03em;color:var(--sol-select-option-active-text);background:transparent;border:1px solid var(--sol-select-border);border-radius:calc(var(--sol-select-radius) - 2px);cursor:pointer;transition:background var(--sol-select-transition)}.sol-select__bulk-btn:hover{background:var(--sol-select-option-hover)}.sol-select__options{overflow-y:auto;flex:1;padding:.25rem 0}.sol-select__option{display:flex;align-items:center;gap:.5rem;padding:.5rem .75rem;font-size:var(--sol-select-font-size);color:var(--sol-select-text);cursor:pointer;transition:background var(--sol-select-transition)}.sol-select__option:hover{background:var(--sol-select-option-hover)}.sol-select__option--active{background:var(--sol-select-option-active-bg);color:var(--sol-select-option-active-text);font-weight:500}.sol-select__check{display:inline-flex;align-items:center;justify-content:center;width:1rem;height:1rem;border:2px solid var(--sol-select-border);border-radius:3px;font-size:.65rem;flex-shrink:0}.sol-select__check--checked{background:var(--sol-select-option-active-text);border-color:var(--sol-select-option-active-text);color:#fff}.sol-select__empty{padding:.75rem;text-align:center;color:var(--sol-select-placeholder);font-size:var(--sol-select-font-size)}.sol-select__error{margin:.25rem 0 0;font-size:var(--sol-select-label-font-size);color:var(--sol-select-error-color);line-height:1.4}.sol-select__dropdown--up{top:auto;bottom:calc(100% + 4px);animation:sol-select-fade-up .12s ease-out}@keyframes sol-select-fade{0%{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:translateY(0)}}@keyframes sol-select-fade-up{0%{opacity:0;transform:translateY(4px)}to{opacity:1;transform:translateY(0)}}@media(max-width:640px){.sol-select__search,.sol-select__trigger{font-size:16px}}\n"], dependencies: [{ kind: "component", type: SolIconComponent, selector: "sol-icon", inputs: ["name", "size", "variant"] }, { kind: "directive", type: SolFloatingPanelDirective, selector: "[solFloatingPanel]", inputs: ["solFloatingPanel", "gap", "flipThreshold", "matchTriggerWidth", "align"], outputs: ["dropUpChange"], exportAs: ["solFloatingPanel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1284
|
+
`, isInline: true, styles: [":host{display:block}:host,.sol-select__dropdown{--sol-select-bg: var(--sol-input-bg, var(--sol-bg-surface, #ffffff));--sol-select-text: var(--sol-color-text-primary, #1e293b);--sol-select-placeholder: var(--sol-color-text-muted, #94a3b8);--sol-select-border: var(--sol-border-color-default, #cbd5e1);--sol-select-border-focus: var(--sol-color-primary, #6366f1);--sol-select-error-color: var(--sol-color-danger, #ef4444);--sol-select-label-color: var(--sol-color-text-secondary, #475569);--sol-select-arrow-color: var(--sol-color-text-muted, #94a3b8);--sol-select-disabled-opacity: var(--sol-disabled-opacity, .55);--sol-select-radius: var(--sol-input-radius, var(--sol-border-radius-md, .5rem));--sol-select-border-width: var(--sol-border-width-default, 1px);--sol-select-padding-x: var(--sol-space-sm, .75rem);--sol-select-height: var(--sol-size-input-height, 2.5rem);--sol-select-font-size: var(--sol-font-size-base, .875rem);--sol-select-label-font-size: var(--sol-font-size-sm, .75rem);--sol-select-label-font-weight: var(--sol-font-weight-bold, 600);--sol-select-shadow: var(--sol-input-shadow, var(--sol-shadow-sm, 0 1px 2px rgba(0,0,0,.05)));--sol-select-focus-ring: var(--sol-input-focus-ring, 0 0 0 3px color-mix(in srgb, var(--sol-color-primary, #6366f1) 40%, transparent));--sol-select-transition: var(--sol-dur-fast, .15s) var(--sol-ease, ease);--sol-select-dropdown-bg: var(--sol-bg-surface, #ffffff);--sol-select-option-hover: var(--sol-color-bg-hover, rgba(0,0,0,.04));--sol-select-option-active-bg: color-mix(in srgb, var(--sol-color-primary, #6366f1) 12%, transparent);--sol-select-option-active-text: var(--sol-color-primary, #6366f1)}.sol-select__label{display:block;margin-bottom:.375rem;font-size:var(--sol-select-label-font-size);font-weight:var(--sol-select-label-font-weight);color:var(--sol-select-label-color);line-height:1.4}.sol-select__wrapper{position:relative;display:block}.sol-select__trigger{display:flex;align-items:center;justify-content:space-between;width:100%;height:var(--sol-select-height);padding:0 var(--sol-select-padding-x);font-family:inherit;font-size:var(--sol-select-font-size);color:var(--sol-select-text);background-color:var(--sol-select-bg);border:var(--sol-input-border, var(--sol-select-border-width) solid var(--sol-select-border));border-radius:var(--sol-select-radius);box-shadow:var(--sol-select-shadow);cursor:pointer;transition:border-color var(--sol-select-transition),box-shadow var(--sol-select-transition);text-align:left}.sol-select__trigger:focus{outline:none;border:var(--sol-input-focus-border, var(--sol-select-border-width) solid var(--sol-select-border-focus));box-shadow:var(--sol-select-focus-ring)}.sol-select__trigger:disabled{cursor:not-allowed;opacity:var(--sol-select-disabled-opacity)}.sol-select__trigger--error{border-color:var(--sol-select-error-color)}.sol-select__trigger--open{border:var(--sol-input-focus-border, var(--sol-select-border-width) solid var(--sol-select-border-focus));box-shadow:var(--sol-select-focus-ring)}.sol-select__display{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.sol-select__display--placeholder{color:var(--sol-select-placeholder)}.sol-select__arrow{width:1.25rem;height:1.25rem;flex-shrink:0;color:var(--sol-select-arrow-color);transition:transform var(--sol-select-transition)}.sol-select__arrow--open{transform:rotate(180deg)}.sol-select__dropdown{position:absolute;top:calc(100% + 4px);left:0;right:0;background:var(--sol-select-dropdown-bg);border:var(--sol-select-border-width) solid var(--sol-select-border);border-radius:var(--sol-select-radius);box-shadow:var(--sol-shadow-lg, 0 10px 25px rgba(0,0,0,.15));max-height:280px;display:flex;flex-direction:column;animation:sol-select-fade .12s ease-out}.sol-select__search-box{padding:.5rem;border-bottom:1px solid var(--sol-select-border)}.sol-select__search{width:100%;height:2rem;padding:0 .5rem;font-family:inherit;font-size:var(--sol-select-font-size);color:var(--sol-select-text);background:var(--sol-select-bg);border:var(--sol-select-border-width) solid var(--sol-select-border);border-radius:calc(var(--sol-select-radius) - 2px);outline:none}.sol-select__search:focus{border-color:var(--sol-select-border-focus)}.sol-select__bulk-actions{display:flex;gap:.25rem;padding:.375rem .5rem;border-bottom:1px solid var(--sol-select-border)}.sol-select__bulk-btn{flex:1;padding:.25rem;font-size:.7rem;font-weight:600;text-transform:uppercase;letter-spacing:.03em;color:var(--sol-select-option-active-text);background:transparent;border:1px solid var(--sol-select-border);border-radius:calc(var(--sol-select-radius) - 2px);cursor:pointer;transition:background var(--sol-select-transition)}.sol-select__bulk-btn:hover{background:var(--sol-select-option-hover)}.sol-select__options{overflow-y:auto;flex:1;padding:.25rem 0}.sol-select__option{display:flex;align-items:center;gap:.5rem;padding:.5rem .75rem;font-size:var(--sol-select-font-size);color:var(--sol-select-text);cursor:pointer;transition:background var(--sol-select-transition)}.sol-select__option:hover{background:var(--sol-select-option-hover)}.sol-select__option--active{background:var(--sol-select-option-active-bg);color:var(--sol-select-option-active-text);font-weight:500}.sol-select__check{display:inline-flex;align-items:center;justify-content:center;width:1rem;height:1rem;border:2px solid var(--sol-select-border);border-radius:3px;font-size:.65rem;flex-shrink:0}.sol-select__check--checked{background:var(--sol-select-option-active-text);border-color:var(--sol-select-option-active-text);color:#fff}.sol-select__empty{padding:.75rem;text-align:center;color:var(--sol-select-placeholder);font-size:var(--sol-select-font-size)}.sol-select__error{margin:.25rem 0 0;font-size:var(--sol-select-label-font-size);color:var(--sol-select-error-color);line-height:1.4}.sol-select__dropdown--up{top:auto;bottom:calc(100% + 4px);animation:sol-select-fade-up .12s ease-out}@keyframes sol-select-fade{0%{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:translateY(0)}}@keyframes sol-select-fade-up{0%{opacity:0;transform:translateY(4px)}to{opacity:1;transform:translateY(0)}}@media(max-width:640px){.sol-select__search,.sol-select__trigger{font-size:16px}}:host(.sol-select--touch) .sol-select__trigger,.sol-select__dropdown--touch .sol-select__search{font-size:var(--sol-font-size-touch-input, 16px)}\n"], dependencies: [{ kind: "component", type: SolIconComponent, selector: "sol-icon", inputs: ["name", "size", "variant"] }, { kind: "directive", type: SolFloatingPanelDirective, selector: "[solFloatingPanel]", inputs: ["solFloatingPanel", "gap", "flipThreshold", "matchTriggerWidth", "align"], outputs: ["dropUpChange"], exportAs: ["solFloatingPanel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1193
1285
|
}
|
|
1194
1286
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: SolSelectComponent, decorators: [{
|
|
1195
1287
|
type: Component,
|
|
1196
|
-
args: [{ selector: 'sol-select', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [SolIconComponent, SolFloatingPanelDirective],
|
|
1288
|
+
args: [{ selector: 'sol-select', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [SolIconComponent, SolFloatingPanelDirective], host: {
|
|
1289
|
+
'[class.sol-select--touch]': 'touchViewport()',
|
|
1290
|
+
}, providers: [
|
|
1197
1291
|
{
|
|
1198
1292
|
provide: NG_VALUE_ACCESSOR,
|
|
1199
1293
|
useExisting: forwardRef(() => SolSelectComponent),
|
|
@@ -1236,6 +1330,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
1236
1330
|
[solFloatingPanel]="triggerBtn"
|
|
1237
1331
|
(dropUpChange)="dropUp.set($event)"
|
|
1238
1332
|
[class.sol-select__dropdown--up]="dropUp()"
|
|
1333
|
+
[class.sol-select__dropdown--touch]="touchViewport()"
|
|
1239
1334
|
>
|
|
1240
1335
|
<!-- Search -->
|
|
1241
1336
|
@if (searchable()) {
|
|
@@ -1297,10 +1392,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
1297
1392
|
@if (error()) {
|
|
1298
1393
|
<p class="sol-select__error">{{ error() }}</p>
|
|
1299
1394
|
}
|
|
1300
|
-
`, styles: [":host{display:block}:host,.sol-select__dropdown{--sol-select-bg: var(--sol-input-bg, var(--sol-bg-surface, #ffffff));--sol-select-text: var(--sol-color-text-primary, #1e293b);--sol-select-placeholder: var(--sol-color-text-muted, #94a3b8);--sol-select-border: var(--sol-border-color-default, #cbd5e1);--sol-select-border-focus: var(--sol-color-primary, #6366f1);--sol-select-error-color: var(--sol-color-danger, #ef4444);--sol-select-label-color: var(--sol-color-text-secondary, #475569);--sol-select-arrow-color: var(--sol-color-text-muted, #94a3b8);--sol-select-disabled-opacity: var(--sol-disabled-opacity, .55);--sol-select-radius: var(--sol-input-radius, var(--sol-border-radius-md, .5rem));--sol-select-border-width: var(--sol-border-width-default, 1px);--sol-select-padding-x: var(--sol-space-sm, .75rem);--sol-select-height: var(--sol-size-input-height, 2.5rem);--sol-select-font-size: var(--sol-font-size-base, .875rem);--sol-select-label-font-size: var(--sol-font-size-sm, .75rem);--sol-select-label-font-weight: var(--sol-font-weight-bold, 600);--sol-select-shadow: var(--sol-input-shadow, var(--sol-shadow-sm, 0 1px 2px rgba(0,0,0,.05)));--sol-select-focus-ring: var(--sol-input-focus-ring, 0 0 0 3px color-mix(in srgb, var(--sol-color-primary, #6366f1) 40%, transparent));--sol-select-transition: var(--sol-dur-fast, .15s) var(--sol-ease, ease);--sol-select-dropdown-bg: var(--sol-bg-surface, #ffffff);--sol-select-option-hover: var(--sol-color-bg-hover, rgba(0,0,0,.04));--sol-select-option-active-bg: color-mix(in srgb, var(--sol-color-primary, #6366f1) 12%, transparent);--sol-select-option-active-text: var(--sol-color-primary, #6366f1)}.sol-select__label{display:block;margin-bottom:.375rem;font-size:var(--sol-select-label-font-size);font-weight:var(--sol-select-label-font-weight);color:var(--sol-select-label-color);line-height:1.4}.sol-select__wrapper{position:relative;display:block}.sol-select__trigger{display:flex;align-items:center;justify-content:space-between;width:100%;height:var(--sol-select-height);padding:0 var(--sol-select-padding-x);font-family:inherit;font-size:var(--sol-select-font-size);color:var(--sol-select-text);background-color:var(--sol-select-bg);border:var(--sol-input-border, var(--sol-select-border-width) solid var(--sol-select-border));border-radius:var(--sol-select-radius);box-shadow:var(--sol-select-shadow);cursor:pointer;transition:border-color var(--sol-select-transition),box-shadow var(--sol-select-transition);text-align:left}.sol-select__trigger:focus{outline:none;border:var(--sol-input-focus-border, var(--sol-select-border-width) solid var(--sol-select-border-focus));box-shadow:var(--sol-select-focus-ring)}.sol-select__trigger:disabled{cursor:not-allowed;opacity:var(--sol-select-disabled-opacity)}.sol-select__trigger--error{border-color:var(--sol-select-error-color)}.sol-select__trigger--open{border:var(--sol-input-focus-border, var(--sol-select-border-width) solid var(--sol-select-border-focus));box-shadow:var(--sol-select-focus-ring)}.sol-select__display{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.sol-select__display--placeholder{color:var(--sol-select-placeholder)}.sol-select__arrow{width:1.25rem;height:1.25rem;flex-shrink:0;color:var(--sol-select-arrow-color);transition:transform var(--sol-select-transition)}.sol-select__arrow--open{transform:rotate(180deg)}.sol-select__dropdown{position:absolute;top:calc(100% + 4px);left:0;right:0;background:var(--sol-select-dropdown-bg);border:var(--sol-select-border-width) solid var(--sol-select-border);border-radius:var(--sol-select-radius);box-shadow:var(--sol-shadow-lg, 0 10px 25px rgba(0,0,0,.15));max-height:280px;display:flex;flex-direction:column;animation:sol-select-fade .12s ease-out}.sol-select__search-box{padding:.5rem;border-bottom:1px solid var(--sol-select-border)}.sol-select__search{width:100%;height:2rem;padding:0 .5rem;font-family:inherit;font-size:var(--sol-select-font-size);color:var(--sol-select-text);background:var(--sol-select-bg);border:var(--sol-select-border-width) solid var(--sol-select-border);border-radius:calc(var(--sol-select-radius) - 2px);outline:none}.sol-select__search:focus{border-color:var(--sol-select-border-focus)}.sol-select__bulk-actions{display:flex;gap:.25rem;padding:.375rem .5rem;border-bottom:1px solid var(--sol-select-border)}.sol-select__bulk-btn{flex:1;padding:.25rem;font-size:.7rem;font-weight:600;text-transform:uppercase;letter-spacing:.03em;color:var(--sol-select-option-active-text);background:transparent;border:1px solid var(--sol-select-border);border-radius:calc(var(--sol-select-radius) - 2px);cursor:pointer;transition:background var(--sol-select-transition)}.sol-select__bulk-btn:hover{background:var(--sol-select-option-hover)}.sol-select__options{overflow-y:auto;flex:1;padding:.25rem 0}.sol-select__option{display:flex;align-items:center;gap:.5rem;padding:.5rem .75rem;font-size:var(--sol-select-font-size);color:var(--sol-select-text);cursor:pointer;transition:background var(--sol-select-transition)}.sol-select__option:hover{background:var(--sol-select-option-hover)}.sol-select__option--active{background:var(--sol-select-option-active-bg);color:var(--sol-select-option-active-text);font-weight:500}.sol-select__check{display:inline-flex;align-items:center;justify-content:center;width:1rem;height:1rem;border:2px solid var(--sol-select-border);border-radius:3px;font-size:.65rem;flex-shrink:0}.sol-select__check--checked{background:var(--sol-select-option-active-text);border-color:var(--sol-select-option-active-text);color:#fff}.sol-select__empty{padding:.75rem;text-align:center;color:var(--sol-select-placeholder);font-size:var(--sol-select-font-size)}.sol-select__error{margin:.25rem 0 0;font-size:var(--sol-select-label-font-size);color:var(--sol-select-error-color);line-height:1.4}.sol-select__dropdown--up{top:auto;bottom:calc(100% + 4px);animation:sol-select-fade-up .12s ease-out}@keyframes sol-select-fade{0%{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:translateY(0)}}@keyframes sol-select-fade-up{0%{opacity:0;transform:translateY(4px)}to{opacity:1;transform:translateY(0)}}@media(max-width:640px){.sol-select__search,.sol-select__trigger{font-size:16px}}\n"] }]
|
|
1301
|
-
}], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: { placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], error: [{ type: i0.Input, args: [{ isSignal: true, alias: "error", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], searchable: [{ type: i0.Input, args: [{ isSignal: true, alias: "searchable", required: false }] }], multiple: [{ type: i0.Input, args: [{ isSignal: true, alias: "multiple", required: false }] }], options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }], showAllOption: [{ type: i0.Input, args: [{ isSignal: true, alias: "showAllOption", required: false }] }], allOptionLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "allOptionLabel", required: false }] }], searchInput: [{ type: i0.ViewChild, args: ['searchInput', { isSignal: true }] }], dropdownPanel: [{ type: i0.ViewChild, args: ['dropdownPanel', { isSignal: true }] }], onDocumentClick: [{
|
|
1395
|
+
`, styles: [":host{display:block}:host,.sol-select__dropdown{--sol-select-bg: var(--sol-input-bg, var(--sol-bg-surface, #ffffff));--sol-select-text: var(--sol-color-text-primary, #1e293b);--sol-select-placeholder: var(--sol-color-text-muted, #94a3b8);--sol-select-border: var(--sol-border-color-default, #cbd5e1);--sol-select-border-focus: var(--sol-color-primary, #6366f1);--sol-select-error-color: var(--sol-color-danger, #ef4444);--sol-select-label-color: var(--sol-color-text-secondary, #475569);--sol-select-arrow-color: var(--sol-color-text-muted, #94a3b8);--sol-select-disabled-opacity: var(--sol-disabled-opacity, .55);--sol-select-radius: var(--sol-input-radius, var(--sol-border-radius-md, .5rem));--sol-select-border-width: var(--sol-border-width-default, 1px);--sol-select-padding-x: var(--sol-space-sm, .75rem);--sol-select-height: var(--sol-size-input-height, 2.5rem);--sol-select-font-size: var(--sol-font-size-base, .875rem);--sol-select-label-font-size: var(--sol-font-size-sm, .75rem);--sol-select-label-font-weight: var(--sol-font-weight-bold, 600);--sol-select-shadow: var(--sol-input-shadow, var(--sol-shadow-sm, 0 1px 2px rgba(0,0,0,.05)));--sol-select-focus-ring: var(--sol-input-focus-ring, 0 0 0 3px color-mix(in srgb, var(--sol-color-primary, #6366f1) 40%, transparent));--sol-select-transition: var(--sol-dur-fast, .15s) var(--sol-ease, ease);--sol-select-dropdown-bg: var(--sol-bg-surface, #ffffff);--sol-select-option-hover: var(--sol-color-bg-hover, rgba(0,0,0,.04));--sol-select-option-active-bg: color-mix(in srgb, var(--sol-color-primary, #6366f1) 12%, transparent);--sol-select-option-active-text: var(--sol-color-primary, #6366f1)}.sol-select__label{display:block;margin-bottom:.375rem;font-size:var(--sol-select-label-font-size);font-weight:var(--sol-select-label-font-weight);color:var(--sol-select-label-color);line-height:1.4}.sol-select__wrapper{position:relative;display:block}.sol-select__trigger{display:flex;align-items:center;justify-content:space-between;width:100%;height:var(--sol-select-height);padding:0 var(--sol-select-padding-x);font-family:inherit;font-size:var(--sol-select-font-size);color:var(--sol-select-text);background-color:var(--sol-select-bg);border:var(--sol-input-border, var(--sol-select-border-width) solid var(--sol-select-border));border-radius:var(--sol-select-radius);box-shadow:var(--sol-select-shadow);cursor:pointer;transition:border-color var(--sol-select-transition),box-shadow var(--sol-select-transition);text-align:left}.sol-select__trigger:focus{outline:none;border:var(--sol-input-focus-border, var(--sol-select-border-width) solid var(--sol-select-border-focus));box-shadow:var(--sol-select-focus-ring)}.sol-select__trigger:disabled{cursor:not-allowed;opacity:var(--sol-select-disabled-opacity)}.sol-select__trigger--error{border-color:var(--sol-select-error-color)}.sol-select__trigger--open{border:var(--sol-input-focus-border, var(--sol-select-border-width) solid var(--sol-select-border-focus));box-shadow:var(--sol-select-focus-ring)}.sol-select__display{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.sol-select__display--placeholder{color:var(--sol-select-placeholder)}.sol-select__arrow{width:1.25rem;height:1.25rem;flex-shrink:0;color:var(--sol-select-arrow-color);transition:transform var(--sol-select-transition)}.sol-select__arrow--open{transform:rotate(180deg)}.sol-select__dropdown{position:absolute;top:calc(100% + 4px);left:0;right:0;background:var(--sol-select-dropdown-bg);border:var(--sol-select-border-width) solid var(--sol-select-border);border-radius:var(--sol-select-radius);box-shadow:var(--sol-shadow-lg, 0 10px 25px rgba(0,0,0,.15));max-height:280px;display:flex;flex-direction:column;animation:sol-select-fade .12s ease-out}.sol-select__search-box{padding:.5rem;border-bottom:1px solid var(--sol-select-border)}.sol-select__search{width:100%;height:2rem;padding:0 .5rem;font-family:inherit;font-size:var(--sol-select-font-size);color:var(--sol-select-text);background:var(--sol-select-bg);border:var(--sol-select-border-width) solid var(--sol-select-border);border-radius:calc(var(--sol-select-radius) - 2px);outline:none}.sol-select__search:focus{border-color:var(--sol-select-border-focus)}.sol-select__bulk-actions{display:flex;gap:.25rem;padding:.375rem .5rem;border-bottom:1px solid var(--sol-select-border)}.sol-select__bulk-btn{flex:1;padding:.25rem;font-size:.7rem;font-weight:600;text-transform:uppercase;letter-spacing:.03em;color:var(--sol-select-option-active-text);background:transparent;border:1px solid var(--sol-select-border);border-radius:calc(var(--sol-select-radius) - 2px);cursor:pointer;transition:background var(--sol-select-transition)}.sol-select__bulk-btn:hover{background:var(--sol-select-option-hover)}.sol-select__options{overflow-y:auto;flex:1;padding:.25rem 0}.sol-select__option{display:flex;align-items:center;gap:.5rem;padding:.5rem .75rem;font-size:var(--sol-select-font-size);color:var(--sol-select-text);cursor:pointer;transition:background var(--sol-select-transition)}.sol-select__option:hover{background:var(--sol-select-option-hover)}.sol-select__option--active{background:var(--sol-select-option-active-bg);color:var(--sol-select-option-active-text);font-weight:500}.sol-select__check{display:inline-flex;align-items:center;justify-content:center;width:1rem;height:1rem;border:2px solid var(--sol-select-border);border-radius:3px;font-size:.65rem;flex-shrink:0}.sol-select__check--checked{background:var(--sol-select-option-active-text);border-color:var(--sol-select-option-active-text);color:#fff}.sol-select__empty{padding:.75rem;text-align:center;color:var(--sol-select-placeholder);font-size:var(--sol-select-font-size)}.sol-select__error{margin:.25rem 0 0;font-size:var(--sol-select-label-font-size);color:var(--sol-select-error-color);line-height:1.4}.sol-select__dropdown--up{top:auto;bottom:calc(100% + 4px);animation:sol-select-fade-up .12s ease-out}@keyframes sol-select-fade{0%{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:translateY(0)}}@keyframes sol-select-fade-up{0%{opacity:0;transform:translateY(4px)}to{opacity:1;transform:translateY(0)}}@media(max-width:640px){.sol-select__search,.sol-select__trigger{font-size:16px}}:host(.sol-select--touch) .sol-select__trigger,.sol-select__dropdown--touch .sol-select__search{font-size:var(--sol-font-size-touch-input, 16px)}\n"] }]
|
|
1396
|
+
}], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: { placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], error: [{ type: i0.Input, args: [{ isSignal: true, alias: "error", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], searchable: [{ type: i0.Input, args: [{ isSignal: true, alias: "searchable", required: false }] }], multiple: [{ type: i0.Input, args: [{ isSignal: true, alias: "multiple", required: false }] }], options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }], showAllOption: [{ type: i0.Input, args: [{ isSignal: true, alias: "showAllOption", required: false }] }], allOptionLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "allOptionLabel", required: false }] }], mobileBreakpoint: [{ type: i0.Input, args: [{ isSignal: true, alias: "mobileBreakpoint", required: false }] }], searchInput: [{ type: i0.ViewChild, args: ['searchInput', { isSignal: true }] }], dropdownPanel: [{ type: i0.ViewChild, args: ['dropdownPanel', { isSignal: true }] }], onDocumentClick: [{
|
|
1302
1397
|
type: HostListener,
|
|
1303
1398
|
args: ['document:click', ['$event']]
|
|
1399
|
+
}], onViewportResize: [{
|
|
1400
|
+
type: HostListener,
|
|
1401
|
+
args: ['window:resize']
|
|
1304
1402
|
}] } });
|
|
1305
1403
|
|
|
1306
1404
|
class SolTextareaComponent {
|
|
@@ -2022,7 +2120,7 @@ class SolCardComponent {
|
|
|
2022
2120
|
<div [class]="hostClasses()">
|
|
2023
2121
|
<ng-content />
|
|
2024
2122
|
</div>
|
|
2025
|
-
`, isInline: true, styles: [".sol-card{background:var(--sol-card-bg, var(--sol-bg-surface, #fff));border:var(--sol-card-border, 1px solid var(--sol-border-color-default, #e5e7eb));border-radius:var(--sol-card-radius, var(--sol-border-radius-lg, 12px));box-shadow:var(--sol-card-shadow, var(--sol-shadow-sm, 0 1px 3px rgba(0, 0, 0, .08)));-webkit-backdrop-filter:var(--sol-card-blur, none);backdrop-filter:var(--sol-card-blur, none);transition:box-shadow var(--sol-dur-base, .24s) var(--sol-ease, ease),transform var(--sol-dur-base, .24s) var(--sol-ease, ease)}.sol-card:hover{transform:translateY(var(--sol-hover-lift, 0px));box-shadow:var(--sol-card-shadow-hover, var(--sol-card-shadow, var(--sol-shadow-sm)))}.sol-card-padded{padding:1.5rem}.sol-card-hoverable{cursor:pointer}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2123
|
+
`, isInline: true, styles: [":host{display:block}.sol-card{background:var(--sol-card-bg, var(--sol-bg-surface, #fff));border:var(--sol-card-border, 1px solid var(--sol-border-color-default, #e5e7eb));border-radius:var(--sol-card-radius, var(--sol-border-radius-lg, 12px));box-shadow:var(--sol-card-shadow, var(--sol-shadow-sm, 0 1px 3px rgba(0, 0, 0, .08)));-webkit-backdrop-filter:var(--sol-card-blur, none);backdrop-filter:var(--sol-card-blur, none);transition:box-shadow var(--sol-dur-base, .24s) var(--sol-ease, ease),transform var(--sol-dur-base, .24s) var(--sol-ease, ease)}.sol-card:hover{transform:translateY(var(--sol-hover-lift, 0px));box-shadow:var(--sol-card-shadow-hover, var(--sol-card-shadow, var(--sol-shadow-sm)))}.sol-card-padded{padding:1.5rem}.sol-card-hoverable{cursor:pointer}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2026
2124
|
}
|
|
2027
2125
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: SolCardComponent, decorators: [{
|
|
2028
2126
|
type: Component,
|
|
@@ -2030,7 +2128,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
2030
2128
|
<div [class]="hostClasses()">
|
|
2031
2129
|
<ng-content />
|
|
2032
2130
|
</div>
|
|
2033
|
-
`, styles: [".sol-card{background:var(--sol-card-bg, var(--sol-bg-surface, #fff));border:var(--sol-card-border, 1px solid var(--sol-border-color-default, #e5e7eb));border-radius:var(--sol-card-radius, var(--sol-border-radius-lg, 12px));box-shadow:var(--sol-card-shadow, var(--sol-shadow-sm, 0 1px 3px rgba(0, 0, 0, .08)));-webkit-backdrop-filter:var(--sol-card-blur, none);backdrop-filter:var(--sol-card-blur, none);transition:box-shadow var(--sol-dur-base, .24s) var(--sol-ease, ease),transform var(--sol-dur-base, .24s) var(--sol-ease, ease)}.sol-card:hover{transform:translateY(var(--sol-hover-lift, 0px));box-shadow:var(--sol-card-shadow-hover, var(--sol-card-shadow, var(--sol-shadow-sm)))}.sol-card-padded{padding:1.5rem}.sol-card-hoverable{cursor:pointer}\n"] }]
|
|
2131
|
+
`, styles: [":host{display:block}.sol-card{background:var(--sol-card-bg, var(--sol-bg-surface, #fff));border:var(--sol-card-border, 1px solid var(--sol-border-color-default, #e5e7eb));border-radius:var(--sol-card-radius, var(--sol-border-radius-lg, 12px));box-shadow:var(--sol-card-shadow, var(--sol-shadow-sm, 0 1px 3px rgba(0, 0, 0, .08)));-webkit-backdrop-filter:var(--sol-card-blur, none);backdrop-filter:var(--sol-card-blur, none);transition:box-shadow var(--sol-dur-base, .24s) var(--sol-ease, ease),transform var(--sol-dur-base, .24s) var(--sol-ease, ease)}.sol-card:hover{transform:translateY(var(--sol-hover-lift, 0px));box-shadow:var(--sol-card-shadow-hover, var(--sol-card-shadow, var(--sol-shadow-sm)))}.sol-card-padded{padding:1.5rem}.sol-card-hoverable{cursor:pointer}\n"] }]
|
|
2034
2132
|
}], propDecorators: { padding: [{ type: i0.Input, args: [{ isSignal: true, alias: "padding", required: false }] }], hoverable: [{ type: i0.Input, args: [{ isSignal: true, alias: "hoverable", required: false }] }] } });
|
|
2035
2133
|
|
|
2036
2134
|
class SolSpinnerComponent {
|
|
@@ -5558,6 +5656,13 @@ const THEME_SOURCE = new InjectionToken('THEME_SOURCE', {
|
|
|
5558
5656
|
// Null-object: no host adapter → no tenant theme → default is used.
|
|
5559
5657
|
factory: () => ({ async loadTheme() { return null; } }),
|
|
5560
5658
|
});
|
|
5659
|
+
/**
|
|
5660
|
+
* The bundled "Vértice" ThemeFile as a plain constant (0.6.0). It is the
|
|
5661
|
+
* factory value of `SOL_DEFAULT_THEME` and the default base theme of the
|
|
5662
|
+
* headless Theme Studio builder (`@solercia/ui/theme-studio`). Treat it as
|
|
5663
|
+
* read-only: clone it before mutating.
|
|
5664
|
+
*/
|
|
5665
|
+
const SOL_BUNDLED_DEFAULT_THEME = defaultTheme;
|
|
5561
5666
|
/**
|
|
5562
5667
|
* The theme the library ships with and applies when there is no tenant theme.
|
|
5563
5668
|
* Defaults to the bundled "Vértice" theme (a full ThemeFile that mirrors the
|
|
@@ -5568,7 +5673,7 @@ const THEME_SOURCE = new InjectionToken('THEME_SOURCE', {
|
|
|
5568
5673
|
*/
|
|
5569
5674
|
const SOL_DEFAULT_THEME = new InjectionToken('SOL_DEFAULT_THEME', {
|
|
5570
5675
|
providedIn: 'root',
|
|
5571
|
-
factory: () =>
|
|
5676
|
+
factory: () => SOL_BUNDLED_DEFAULT_THEME,
|
|
5572
5677
|
});
|
|
5573
5678
|
|
|
5574
5679
|
/**
|
|
@@ -5602,7 +5707,7 @@ const THEME_PREF_KEY = 'sol-dark-mode';
|
|
|
5602
5707
|
/** Atajo para defaults v2 que copian otra ruta ya resuelta del contrato (respeta el modo). */
|
|
5603
5708
|
const sameAs = (path) => (ctx) => ctx.resolve(path);
|
|
5604
5709
|
/**
|
|
5605
|
-
* Tabla única de "qué variables existen":
|
|
5710
|
+
* Tabla única de "qué variables existen": 96 filas (47 v1 obligatorias + 49 v2
|
|
5606
5711
|
* con default). Cada fila es [nombreCssVar, rutaDelToken, defaultV1?]; la ruta
|
|
5607
5712
|
* apunta dentro de `{ primitives, semantic, component }` (ver `resolveCssVars`).
|
|
5608
5713
|
* Agregar/quitar una fila cambia el conjunto emitido — por eso el test de tokens
|
|
@@ -5612,6 +5717,8 @@ const EMIT_TABLE = [
|
|
|
5612
5717
|
// Colors
|
|
5613
5718
|
['--sol-color-primary', 'semantic.color.primary'],
|
|
5614
5719
|
['--sol-color-secondary', 'semantic.color.secondary'],
|
|
5720
|
+
// Text color for secondary actions (Cancel-style buttons); consumed by sol-button.
|
|
5721
|
+
['--sol-color-secondary-contrast', 'semantic.color.secondaryContrast', '#1E293B'],
|
|
5615
5722
|
['--sol-color-accent', 'semantic.color.accent'],
|
|
5616
5723
|
['--sol-color-success', 'semantic.color.success'],
|
|
5617
5724
|
['--sol-color-warning', 'semantic.color.warning'],
|
|
@@ -5643,6 +5750,10 @@ const EMIT_TABLE = [
|
|
|
5643
5750
|
['--sol-size-component-sm', 'primitives.size.control.sm'],
|
|
5644
5751
|
['--sol-size-component-md', 'primitives.size.control.md'],
|
|
5645
5752
|
['--sol-size-component-lg', 'primitives.size.control.lg'],
|
|
5753
|
+
// Additive mobile minimums (Fitts / iOS auto-zoom): consumed inside media
|
|
5754
|
+
// queries only, so desktop density is untouched.
|
|
5755
|
+
['--sol-size-control-touch', 'primitives.size.control.touch', '44px'],
|
|
5756
|
+
['--sol-font-size-touch-input', 'primitives.font.size.touchInput', '16px'],
|
|
5646
5757
|
['--sol-size-sidebar-width', 'component.layout.sidebarWidth'],
|
|
5647
5758
|
['--sol-size-header-height', 'component.layout.headerHeight'],
|
|
5648
5759
|
// Spacing
|
|
@@ -5736,6 +5847,10 @@ const EMIT_TABLE = [
|
|
|
5736
5847
|
// cuadro de diálogo lo lleve por defecto; un tema puede subirlo (glass) o
|
|
5737
5848
|
// anularlo ("none", p. ej. skins planos/brutalistas).
|
|
5738
5849
|
['--sol-overlay-blur', 'component.overlay.blur', 'blur(3px)'],
|
|
5850
|
+
// Contraste del primario (por modo): texto/ícono sobre el primario. Los componentes ya lo
|
|
5851
|
+
// consumían con fallback blanco; ahora el tema lo fija para primarios claros
|
|
5852
|
+
// (menta, amarillo), que necesitan texto oscuro encima.
|
|
5853
|
+
['--sol-color-primary-contrast', 'semantic.color.primaryContrast', '#FFFFFF'],
|
|
5739
5854
|
];
|
|
5740
5855
|
/**
|
|
5741
5856
|
* Referencias `{ruta}` — GLOBAL: los temas v2 embeben refs dentro de shorthands
|
|
@@ -5939,7 +6054,7 @@ function isRenderableTheme(file) {
|
|
|
5939
6054
|
/**
|
|
5940
6055
|
* ThemeService — runtime de theming white-label, AGNÓSTICO del host.
|
|
5941
6056
|
*
|
|
5942
|
-
* Emite los
|
|
6057
|
+
* Emite los 96 tokens `--sol-*` sobre `:root` a partir de un `ThemeFile` y
|
|
5943
6058
|
* reacciona a tres entradas: el tema del tenant (cargado por el puerto
|
|
5944
6059
|
* `THEME_SOURCE` que provee el host), el default empaquetado
|
|
5945
6060
|
* (`SOL_DEFAULT_THEME`) y el toggle light/dark. NO conoce el ORIGEN del tema
|
|
@@ -6012,6 +6127,18 @@ class ThemeService {
|
|
|
6012
6127
|
return meta.logo?.altText?.trim() || meta.tenant || null;
|
|
6013
6128
|
}, /* @ts-ignore */
|
|
6014
6129
|
...(ngDevMode ? [{ debugName: "brandName" }] : /* istanbul ignore next */ []));
|
|
6130
|
+
/**
|
|
6131
|
+
* URL del favicon del TENANT: `meta.favicon` sanitizado si existe y es seguro;
|
|
6132
|
+
* si no, la URL del logo efectivo. `null` sin tema de tenant (se restaura el
|
|
6133
|
+
* favicon empaquetado del host).
|
|
6134
|
+
*/
|
|
6135
|
+
tenantFavicon = computed(() => {
|
|
6136
|
+
const tenant = this.tenantTheme();
|
|
6137
|
+
if (!tenant)
|
|
6138
|
+
return null;
|
|
6139
|
+
return sanitizeAssetUrl(tenant.meta?.favicon) ?? this.logo()?.url ?? null;
|
|
6140
|
+
}, /* @ts-ignore */
|
|
6141
|
+
...(ngDevMode ? [{ debugName: "tenantFavicon" }] : /* istanbul ignore next */ []));
|
|
6015
6142
|
/** href original del favicon empaquetado (index.html); se captura una sola vez. */
|
|
6016
6143
|
faviconOriginalHref = null;
|
|
6017
6144
|
faviconCaptured = false;
|
|
@@ -6033,11 +6160,11 @@ class ThemeService {
|
|
|
6033
6160
|
}
|
|
6034
6161
|
});
|
|
6035
6162
|
// Favicon: SOLO el tema del tenant rebrandea; el default restaura el de
|
|
6036
|
-
// index.html. `
|
|
6037
|
-
//
|
|
6163
|
+
// index.html. `meta.favicon` (0.6.0, sanitizado) manda cuando existe; sin
|
|
6164
|
+
// él, el favicon sigue al logo efectivo del modo actual (logo dual), así
|
|
6165
|
+
// que reacciona también al toggle light/dark.
|
|
6038
6166
|
effect(() => {
|
|
6039
|
-
|
|
6040
|
-
this.applyFavicon(tenantLogo?.url ?? null);
|
|
6167
|
+
this.applyFavicon(this.tenantFavicon());
|
|
6041
6168
|
});
|
|
6042
6169
|
// Fuentes web por tenant (v2): un ÚNICO <link> a Google Fonts construido
|
|
6043
6170
|
// por código (family + weights). Cambiar de tema reemplaza el link; un
|
|
@@ -6058,15 +6185,76 @@ class ThemeService {
|
|
|
6058
6185
|
* en vez de que la librería tire vía THEME_SOURCE). Validado como cualquier
|
|
6059
6186
|
* tema: uno inválido cae al default. Útil para hosts que ya tienen el tema en
|
|
6060
6187
|
* memoria (SSR, caché) o que no quieren implementar un ThemeSource.
|
|
6188
|
+
*
|
|
6189
|
+
* MODO POR DEFECTO (BD): si el tema traído trae `meta.defaultMode` y este
|
|
6190
|
+
* navegador NO tiene todavía una elección explícita del toggle
|
|
6191
|
+
* (`hasExplicitModePreference()` en `false`), ese modo se aplica AHORA — sin
|
|
6192
|
+
* persistirlo en `localStorage` — para que BD siga gobernando mientras el
|
|
6193
|
+
* usuario no elija por su cuenta.
|
|
6061
6194
|
*/
|
|
6062
6195
|
setTenantTheme(theme) {
|
|
6063
|
-
|
|
6196
|
+
const validated = isRenderableTheme(theme) ? theme : null;
|
|
6197
|
+
this.tenantTheme.set(validated);
|
|
6198
|
+
this.applyEntityDefaultMode(validated);
|
|
6199
|
+
}
|
|
6200
|
+
/**
|
|
6201
|
+
* Aplica `meta.defaultMode` del tema de la entidad (BD) como AUTORIDAD en
|
|
6202
|
+
* cada carga: cuando el tema declara un modo por defecto, ese modo gana
|
|
6203
|
+
* SIEMPRE, sobrescribiendo cualquier valor viejo en `localStorage`. Asi
|
|
6204
|
+
* ningun navegador se queda "pegado" en un modo antiguo — al recargar, el
|
|
6205
|
+
* modo vuelve a salir de BD. El toggle sol/luna sigue funcionando como
|
|
6206
|
+
* override en vivo dentro de la sesion; el siguiente arranque vuelve a
|
|
6207
|
+
* imponer el valor de BD. Si el tema NO declara `defaultMode` (v1), no se
|
|
6208
|
+
* toca nada y rige la preferencia local / del sistema de siempre.
|
|
6209
|
+
*
|
|
6210
|
+
* Se llama desde los DOS caminos que fijan el tema del tenant: el PUSH
|
|
6211
|
+
* (`setTenantTheme`) y el PULL via THEME_SOURCE (`loadTenantTheme`), para
|
|
6212
|
+
* que el shell real de PANDORA (que tira el tema) tambien lo honre.
|
|
6213
|
+
*/
|
|
6214
|
+
applyEntityDefaultMode(theme) {
|
|
6215
|
+
const defaultMode = theme?.meta?.defaultMode;
|
|
6216
|
+
if (defaultMode === undefined)
|
|
6217
|
+
return;
|
|
6218
|
+
const dark = defaultMode === 'dark';
|
|
6219
|
+
this._isDark.set(dark);
|
|
6220
|
+
this.applyDarkClass(dark);
|
|
6221
|
+
// Sincroniza localStorage con el valor de BD para que el estado quede
|
|
6222
|
+
// consistente y el navegador nunca conserve un modo obsoleto.
|
|
6223
|
+
try {
|
|
6224
|
+
localStorage.setItem(THEME_PREF_KEY, String(dark));
|
|
6225
|
+
}
|
|
6226
|
+
catch {
|
|
6227
|
+
// Storage inaccesible: el modo queda aplicado en memoria de todos modos.
|
|
6228
|
+
}
|
|
6229
|
+
}
|
|
6230
|
+
/**
|
|
6231
|
+
* Fija el modo oscuro/claro y lo PERSISTE como elección EXPLÍCITA del
|
|
6232
|
+
* usuario (toggle sol/luna, o "Aplicar tema" del Theme Studio). A partir de
|
|
6233
|
+
* este punto `hasExplicitModePreference()` es `true` y `setTenantTheme` deja
|
|
6234
|
+
* de imponer `meta.defaultMode` en este navegador.
|
|
6235
|
+
*/
|
|
6236
|
+
setDarkMode(dark) {
|
|
6237
|
+
this._isDark.set(dark);
|
|
6238
|
+
try {
|
|
6239
|
+
localStorage.setItem(THEME_PREF_KEY, String(dark));
|
|
6240
|
+
}
|
|
6241
|
+
catch {
|
|
6242
|
+
// Storage inaccesible (incógnito/navegador restringido): el modo queda
|
|
6243
|
+
// aplicado en memoria, solo no persiste entre sesiones.
|
|
6244
|
+
}
|
|
6245
|
+
this.applyDarkClass(dark);
|
|
6064
6246
|
}
|
|
6065
6247
|
toggleMode() {
|
|
6066
|
-
|
|
6067
|
-
|
|
6068
|
-
|
|
6069
|
-
|
|
6248
|
+
this.setDarkMode(!this._isDark());
|
|
6249
|
+
}
|
|
6250
|
+
/** `true` si este navegador ya tiene una elección EXPLÍCITA de modo (toggle) en `localStorage`. */
|
|
6251
|
+
hasExplicitModePreference() {
|
|
6252
|
+
try {
|
|
6253
|
+
return localStorage.getItem(THEME_PREF_KEY) !== null;
|
|
6254
|
+
}
|
|
6255
|
+
catch {
|
|
6256
|
+
return false;
|
|
6257
|
+
}
|
|
6070
6258
|
}
|
|
6071
6259
|
/**
|
|
6072
6260
|
* Fuerza la recarga del tema del tenant activo (Theme Studio: tras el PUT
|
|
@@ -6098,6 +6286,7 @@ class ThemeService {
|
|
|
6098
6286
|
return;
|
|
6099
6287
|
if (isRenderableTheme(file)) {
|
|
6100
6288
|
this.tenantTheme.set(file);
|
|
6289
|
+
this.applyEntityDefaultMode(file);
|
|
6101
6290
|
}
|
|
6102
6291
|
else {
|
|
6103
6292
|
console.warn(`ThemeService: el tema de la empresa ${companyId} llegó inválido o vacío; se aplica el tema por defecto.`);
|
|
@@ -6118,7 +6307,13 @@ class ThemeService {
|
|
|
6118
6307
|
return companyId !== (this.tenantResolver?.activeTenantId() ?? null);
|
|
6119
6308
|
}
|
|
6120
6309
|
loadDarkPreference() {
|
|
6121
|
-
|
|
6310
|
+
let stored = null;
|
|
6311
|
+
try {
|
|
6312
|
+
stored = localStorage.getItem(THEME_PREF_KEY);
|
|
6313
|
+
}
|
|
6314
|
+
catch {
|
|
6315
|
+
stored = null;
|
|
6316
|
+
}
|
|
6122
6317
|
if (stored !== null)
|
|
6123
6318
|
return stored === 'true';
|
|
6124
6319
|
// matchMedia no existe en jsdom — sin señal del sistema, modo claro.
|
|
@@ -6223,6 +6418,25 @@ function provideTheme() {
|
|
|
6223
6418
|
});
|
|
6224
6419
|
}
|
|
6225
6420
|
|
|
6421
|
+
/**
|
|
6422
|
+
* Modelo de tokens en 3 niveles (W3C DTCG-aligned): primitivos → semánticos → componente.
|
|
6423
|
+
* Los niveles VIVEN en esta fuente TS + `themes/default.theme.json` y se resuelven hacia
|
|
6424
|
+
* abajo (ver `resolveCssVars` en `theme.service.ts`) hacia el conjunto de variables
|
|
6425
|
+
* `--sol-*` de la `EMIT_TABLE`.
|
|
6426
|
+
*
|
|
6427
|
+
* ThemeFile v2 (E8 — skins white-label): todos los bloques nuevos son OPCIONALES (`?`).
|
|
6428
|
+
* Un ThemeFile v1 sigue siendo válido sin cambios: cada token v2 ausente emite su
|
|
6429
|
+
* default (el look del `default.json` actual). Ver `ThemeFile-v2-SPEC.md` del handoff.
|
|
6430
|
+
*/
|
|
6431
|
+
/** Catálogo ordenado de variantes de tabla (para selectores y validación). */
|
|
6432
|
+
const SOL_TABLE_VARIANTS = [
|
|
6433
|
+
'clean',
|
|
6434
|
+
'zebra',
|
|
6435
|
+
'bordered',
|
|
6436
|
+
'emphasis-header',
|
|
6437
|
+
'banded',
|
|
6438
|
+
];
|
|
6439
|
+
|
|
6226
6440
|
/**
|
|
6227
6441
|
* Variables `--sol-*` que alimentan el chart y su fallback (valores del modo
|
|
6228
6442
|
* light de `styles.css`). El fallback solo aplica si la variable no resuelve
|
|
@@ -8490,7 +8704,7 @@ class SolIconButtonComponent {
|
|
|
8490
8704
|
>
|
|
8491
8705
|
<sol-icon [name]="icon()" [size]="iconSize()" />
|
|
8492
8706
|
</button>
|
|
8493
|
-
`, isInline: true, styles: [":host{display:inline-block}.sol-icon-btn{display:grid;place-items:center;padding:0;border:1px solid transparent;border-radius:var(--sol-button-radius, var(--sol-border-radius-md, .5rem));background:transparent;color:var(--sol-color-text-muted, #64748b);cursor:pointer;transition:background-color var(--sol-dur-fast, .15s) var(--sol-ease, ease),color var(--sol-dur-fast, .15s) var(--sol-ease, ease),box-shadow var(--sol-dur-fast, .15s) var(--sol-ease, ease),transform var(--sol-dur-fast, .15s) var(--sol-ease, ease)}.sol-icon-btn:active:not(:disabled){transform:scale(var(--sol-press-scale, .96))}.sol-icon-btn:focus-visible{outline:none;box-shadow:var(--sol-focus-ring, 0 0 0 3px color-mix(in srgb, var(--sol-color-primary, #6366f1) 40%, transparent))}.sol-icon-btn:disabled{cursor:not-allowed;opacity:var(--sol-disabled-opacity, .55)}.sol-icon-btn--default{border-color:var(--sol-border-color-default, #e2e8f0);background:var(--sol-bg-surface, #fff);color:var(--sol-color-text-muted, #64748b)}.sol-icon-btn--default:hover:not(:disabled){background:color-mix(in srgb,var(--sol-color-primary, #2563eb) 8%,var(--sol-bg-surface, #fff));color:var(--sol-color-text-primary, #0f172a)}.sol-icon-btn--danger{color:var(--sol-color-danger, #ef4444)}.sol-icon-btn--danger:hover:not(:disabled){background:color-mix(in srgb,var(--sol-color-danger, #ef4444) 12%,transparent)}.sol-icon-btn--ghost{color:var(--sol-color-text-muted, #64748b)}.sol-icon-btn--ghost:hover:not(:disabled){background:color-mix(in srgb,var(--sol-color-primary, #2563eb) 10%,transparent);color:var(--sol-color-text-primary, #0f172a)}.sol-icon-btn--sm{width:32px;height:32px}.sol-icon-btn--md{width:36px;height:36px}.sol-icon-btn--lg{width:40px;height:40px}.sol-icon-btn--touch{width:44px;height:44px}\n"], dependencies: [{ kind: "component", type: SolIconComponent, selector: "sol-icon", inputs: ["name", "size", "variant"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
8707
|
+
`, isInline: true, styles: [":host{display:inline-block}.sol-icon-btn{display:grid;place-items:center;padding:0;border:1px solid transparent;border-radius:var(--sol-button-radius, var(--sol-border-radius-md, .5rem));background:transparent;color:var(--sol-color-text-muted, #64748b);cursor:pointer;transition:background-color var(--sol-dur-fast, .15s) var(--sol-ease, ease),color var(--sol-dur-fast, .15s) var(--sol-ease, ease),box-shadow var(--sol-dur-fast, .15s) var(--sol-ease, ease),transform var(--sol-dur-fast, .15s) var(--sol-ease, ease)}.sol-icon-btn:active:not(:disabled){transform:scale(var(--sol-press-scale, .96))}.sol-icon-btn:focus-visible{outline:none;box-shadow:var(--sol-focus-ring, 0 0 0 3px color-mix(in srgb, var(--sol-color-primary, #6366f1) 40%, transparent))}.sol-icon-btn:disabled{cursor:not-allowed;opacity:var(--sol-disabled-opacity, .55)}.sol-icon-btn--default{border-color:var(--sol-border-color-default, #e2e8f0);background:var(--sol-bg-surface, #fff);color:var(--sol-color-text-muted, #64748b)}.sol-icon-btn--default:hover:not(:disabled){background:color-mix(in srgb,var(--sol-color-primary, #2563eb) 8%,var(--sol-bg-surface, #fff));color:var(--sol-color-text-primary, #0f172a)}.sol-icon-btn--danger{color:var(--sol-color-danger, #ef4444)}.sol-icon-btn--danger:hover:not(:disabled){background:color-mix(in srgb,var(--sol-color-danger, #ef4444) 12%,transparent)}.sol-icon-btn--ghost{color:var(--sol-color-text-muted, #64748b)}.sol-icon-btn--ghost:hover:not(:disabled){background:color-mix(in srgb,var(--sol-color-primary, #2563eb) 10%,transparent);color:var(--sol-color-text-primary, #0f172a)}.sol-icon-btn--outline{border-color:var(--sol-border-color-default, #e2e8f0);background:transparent;color:var(--sol-color-text-muted, #64748b)}.sol-icon-btn--outline:hover:not(:disabled){background:color-mix(in srgb,var(--sol-color-primary, #2563eb) 8%,transparent);color:var(--sol-color-text-primary, #0f172a)}.sol-icon-btn--sm{width:32px;height:32px}.sol-icon-btn--md{width:36px;height:36px}.sol-icon-btn--lg{width:40px;height:40px}.sol-icon-btn--touch{width:44px;height:44px}\n"], dependencies: [{ kind: "component", type: SolIconComponent, selector: "sol-icon", inputs: ["name", "size", "variant"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
8494
8708
|
}
|
|
8495
8709
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: SolIconButtonComponent, decorators: [{
|
|
8496
8710
|
type: Component,
|
|
@@ -8504,7 +8718,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
8504
8718
|
>
|
|
8505
8719
|
<sol-icon [name]="icon()" [size]="iconSize()" />
|
|
8506
8720
|
</button>
|
|
8507
|
-
`, styles: [":host{display:inline-block}.sol-icon-btn{display:grid;place-items:center;padding:0;border:1px solid transparent;border-radius:var(--sol-button-radius, var(--sol-border-radius-md, .5rem));background:transparent;color:var(--sol-color-text-muted, #64748b);cursor:pointer;transition:background-color var(--sol-dur-fast, .15s) var(--sol-ease, ease),color var(--sol-dur-fast, .15s) var(--sol-ease, ease),box-shadow var(--sol-dur-fast, .15s) var(--sol-ease, ease),transform var(--sol-dur-fast, .15s) var(--sol-ease, ease)}.sol-icon-btn:active:not(:disabled){transform:scale(var(--sol-press-scale, .96))}.sol-icon-btn:focus-visible{outline:none;box-shadow:var(--sol-focus-ring, 0 0 0 3px color-mix(in srgb, var(--sol-color-primary, #6366f1) 40%, transparent))}.sol-icon-btn:disabled{cursor:not-allowed;opacity:var(--sol-disabled-opacity, .55)}.sol-icon-btn--default{border-color:var(--sol-border-color-default, #e2e8f0);background:var(--sol-bg-surface, #fff);color:var(--sol-color-text-muted, #64748b)}.sol-icon-btn--default:hover:not(:disabled){background:color-mix(in srgb,var(--sol-color-primary, #2563eb) 8%,var(--sol-bg-surface, #fff));color:var(--sol-color-text-primary, #0f172a)}.sol-icon-btn--danger{color:var(--sol-color-danger, #ef4444)}.sol-icon-btn--danger:hover:not(:disabled){background:color-mix(in srgb,var(--sol-color-danger, #ef4444) 12%,transparent)}.sol-icon-btn--ghost{color:var(--sol-color-text-muted, #64748b)}.sol-icon-btn--ghost:hover:not(:disabled){background:color-mix(in srgb,var(--sol-color-primary, #2563eb) 10%,transparent);color:var(--sol-color-text-primary, #0f172a)}.sol-icon-btn--sm{width:32px;height:32px}.sol-icon-btn--md{width:36px;height:36px}.sol-icon-btn--lg{width:40px;height:40px}.sol-icon-btn--touch{width:44px;height:44px}\n"] }]
|
|
8721
|
+
`, styles: [":host{display:inline-block}.sol-icon-btn{display:grid;place-items:center;padding:0;border:1px solid transparent;border-radius:var(--sol-button-radius, var(--sol-border-radius-md, .5rem));background:transparent;color:var(--sol-color-text-muted, #64748b);cursor:pointer;transition:background-color var(--sol-dur-fast, .15s) var(--sol-ease, ease),color var(--sol-dur-fast, .15s) var(--sol-ease, ease),box-shadow var(--sol-dur-fast, .15s) var(--sol-ease, ease),transform var(--sol-dur-fast, .15s) var(--sol-ease, ease)}.sol-icon-btn:active:not(:disabled){transform:scale(var(--sol-press-scale, .96))}.sol-icon-btn:focus-visible{outline:none;box-shadow:var(--sol-focus-ring, 0 0 0 3px color-mix(in srgb, var(--sol-color-primary, #6366f1) 40%, transparent))}.sol-icon-btn:disabled{cursor:not-allowed;opacity:var(--sol-disabled-opacity, .55)}.sol-icon-btn--default{border-color:var(--sol-border-color-default, #e2e8f0);background:var(--sol-bg-surface, #fff);color:var(--sol-color-text-muted, #64748b)}.sol-icon-btn--default:hover:not(:disabled){background:color-mix(in srgb,var(--sol-color-primary, #2563eb) 8%,var(--sol-bg-surface, #fff));color:var(--sol-color-text-primary, #0f172a)}.sol-icon-btn--danger{color:var(--sol-color-danger, #ef4444)}.sol-icon-btn--danger:hover:not(:disabled){background:color-mix(in srgb,var(--sol-color-danger, #ef4444) 12%,transparent)}.sol-icon-btn--ghost{color:var(--sol-color-text-muted, #64748b)}.sol-icon-btn--ghost:hover:not(:disabled){background:color-mix(in srgb,var(--sol-color-primary, #2563eb) 10%,transparent);color:var(--sol-color-text-primary, #0f172a)}.sol-icon-btn--outline{border-color:var(--sol-border-color-default, #e2e8f0);background:transparent;color:var(--sol-color-text-muted, #64748b)}.sol-icon-btn--outline:hover:not(:disabled){background:color-mix(in srgb,var(--sol-color-primary, #2563eb) 8%,transparent);color:var(--sol-color-text-primary, #0f172a)}.sol-icon-btn--sm{width:32px;height:32px}.sol-icon-btn--md{width:36px;height:36px}.sol-icon-btn--lg{width:40px;height:40px}.sol-icon-btn--touch{width:44px;height:44px}\n"] }]
|
|
8508
8722
|
}], propDecorators: { icon: [{ type: i0.Input, args: [{ isSignal: true, alias: "icon", required: true }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: true }] }], type: [{ type: i0.Input, args: [{ isSignal: true, alias: "type", required: false }] }], variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], clicked: [{ type: i0.Output, args: ["clicked"] }] } });
|
|
8509
8723
|
|
|
8510
8724
|
/**
|
|
@@ -8611,9 +8825,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
8611
8825
|
}], ctorParameters: () => [], propDecorators: { solRowReveal: [{ type: i0.Input, args: [{ isSignal: true, alias: "solRowReveal", required: false }] }], solRowRevealIndex: [{ type: i0.Input, args: [{ isSignal: true, alias: "solRowRevealIndex", required: false }] }], solRowRevealReplay: [{ type: i0.Input, args: [{ isSignal: true, alias: "solRowRevealReplay", required: false }] }] } });
|
|
8612
8826
|
/**
|
|
8613
8827
|
* Tabla de datos genérica dirigida por columnas: búsqueda, orden, paginación,
|
|
8614
|
-
* estado de carga (skeleton), estado vacío
|
|
8615
|
-
*
|
|
8616
|
-
*
|
|
8828
|
+
* estado de carga (skeleton), estado vacío, filtros por columna (opt-in, ver
|
|
8829
|
+
* `DataTableColumn.filter`) y acciones por fila (posición configurable, ver
|
|
8830
|
+
* `actionsPosition`). Colapsa cada fila a un resumen expandible (sin scroll
|
|
8831
|
+
* horizontal) cuando el tema activo lo prefiere
|
|
8832
|
+
* (`component.table.mobile: "collapse"`) y el ancho de su propio HOST — no
|
|
8833
|
+
* del viewport del navegador, ver `collapseWidth` — cae por debajo del
|
|
8834
|
+
* umbral: una tabla dentro de un layout angosto (sidebar, grid a dos
|
|
8835
|
+
* columnas) colapsa aunque la ventana siga en ancho desktop.
|
|
8617
8836
|
*
|
|
8618
8837
|
* Componente presentacional: no conoce dominio. Las acciones no genéricas se
|
|
8619
8838
|
* proyectan por el slot `#rowActions` (TemplateRef que recibe la fila).
|
|
@@ -8621,6 +8840,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
8621
8840
|
*/
|
|
8622
8841
|
class SolDataTableComponent {
|
|
8623
8842
|
themeService = inject(ThemeService);
|
|
8843
|
+
host = inject(ElementRef);
|
|
8624
8844
|
data = input([], /* @ts-ignore */
|
|
8625
8845
|
...(ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []));
|
|
8626
8846
|
columns = input([], /* @ts-ignore */
|
|
@@ -8652,6 +8872,16 @@ class SolDataTableComponent {
|
|
|
8652
8872
|
/** Encabezado de la columna de acciones. */
|
|
8653
8873
|
actionsLabel = input('Acciones', /* @ts-ignore */
|
|
8654
8874
|
...(ngDevMode ? [{ debugName: "actionsLabel" }] : /* istanbul ignore next */ []));
|
|
8875
|
+
/**
|
|
8876
|
+
* Posición de la columna de acciones (0.6.0). `'end'` (default) preserva
|
|
8877
|
+
* el comportamiento previo — th/td de acciones después de las columnas de
|
|
8878
|
+
* datos. `'start'` los renderiza ANTES, como primera columna (aplica al
|
|
8879
|
+
* `#rowActions` proyectado y a los botones editar/eliminar por defecto
|
|
8880
|
+
* por igual). Sin efecto en el modo colapsado móvil: ahí las acciones
|
|
8881
|
+
* siguen viviendo solo en el detalle expandido de la card.
|
|
8882
|
+
*/
|
|
8883
|
+
actionsPosition = input('end', /* @ts-ignore */
|
|
8884
|
+
...(ngDevMode ? [{ debugName: "actionsPosition" }] : /* istanbul ignore next */ []));
|
|
8655
8885
|
/**
|
|
8656
8886
|
* aria-label del botón ▶ de expansión de fila en el modo móvil. El default
|
|
8657
8887
|
* se alinea con el texto de la clave i18n `shared.table.toggleDetails`
|
|
@@ -8672,6 +8902,26 @@ class SolDataTableComponent {
|
|
|
8672
8902
|
*/
|
|
8673
8903
|
rowReveal = input(true, /* @ts-ignore */
|
|
8674
8904
|
...(ngDevMode ? [{ debugName: "rowReveal" }] : /* istanbul ignore next */ []));
|
|
8905
|
+
/**
|
|
8906
|
+
* Ancho (px) del HOST bajo el cual la tabla colapsa a cards (0.6.0).
|
|
8907
|
+
* Reemplaza el criterio anterior, que solo miraba el viewport del
|
|
8908
|
+
* navegador (`matchMedia`) — la fuente de verdad ahora es un
|
|
8909
|
+
* `ResizeObserver` sobre el propio elemento raíz del componente, así que
|
|
8910
|
+
* una tabla dentro de un contenedor angosto (sidebar, grid a dos
|
|
8911
|
+
* columnas) colapsa aunque la ventana siga en ancho desktop. El default
|
|
8912
|
+
* (767) conserva el breakpoint canónico previo.
|
|
8913
|
+
*/
|
|
8914
|
+
collapseWidth = input(767, /* @ts-ignore */
|
|
8915
|
+
...(ngDevMode ? [{ debugName: "collapseWidth" }] : /* istanbul ignore next */ []));
|
|
8916
|
+
/**
|
|
8917
|
+
* Variante visual (0.6.0): `clean` | `zebra` | `bordered` | `emphasis-header`
|
|
8918
|
+
* | `banded`. Sobrescribe `component.table.variant` del tema activo; `null`
|
|
8919
|
+
* (default) deja decidir al tema y, si el tema tampoco la declara, la tabla
|
|
8920
|
+
* conserva su look de siempre. Los colores salen de `var(--sol-*)`, así que
|
|
8921
|
+
* la variante reacciona sola a claro/oscuro.
|
|
8922
|
+
*/
|
|
8923
|
+
variant = input(null, /* @ts-ignore */
|
|
8924
|
+
...(ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []));
|
|
8675
8925
|
editClicked = output();
|
|
8676
8926
|
deleteClicked = output();
|
|
8677
8927
|
/**
|
|
@@ -8697,6 +8947,9 @@ class SolDataTableComponent {
|
|
|
8697
8947
|
...(ngDevMode ? [{ debugName: "sortKey" }] : /* istanbul ignore next */ []));
|
|
8698
8948
|
sortDirection = signal('asc', /* @ts-ignore */
|
|
8699
8949
|
...(ngDevMode ? [{ debugName: "sortDirection" }] : /* istanbul ignore next */ []));
|
|
8950
|
+
/** Valor de filtro por columna (0.6.0), indexado por `DataTableColumn.key`. */
|
|
8951
|
+
columnFilters = signal({}, /* @ts-ignore */
|
|
8952
|
+
...(ngDevMode ? [{ debugName: "columnFilters" }] : /* istanbul ignore next */ []));
|
|
8700
8953
|
/**
|
|
8701
8954
|
* Clave de replay de `solRowReveal`: cambia con cualquier búsqueda, orden
|
|
8702
8955
|
* o paginación — reinicia la animación de entrada de las filas visibles
|
|
@@ -8704,8 +8957,12 @@ class SolDataTableComponent {
|
|
|
8704
8957
|
*/
|
|
8705
8958
|
revealReplayKey = computed(() => `${this.searchTerm()}:${this.sortKey()}:${this.sortDirection()}:${this.currentPage()}`, /* @ts-ignore */
|
|
8706
8959
|
...(ngDevMode ? [{ debugName: "revealReplayKey" }] : /* istanbul ignore next */ []));
|
|
8707
|
-
/**
|
|
8708
|
-
|
|
8960
|
+
/**
|
|
8961
|
+
* Señal reactiva al ancho del HOST (0.6.0, ver `collapseWidth`): true
|
|
8962
|
+
* cuando el ResizeObserver mide un ancho <= `collapseWidth()`. Fuente de
|
|
8963
|
+
* verdad del colapso — ya NO es el viewport del navegador.
|
|
8964
|
+
*/
|
|
8965
|
+
isContainerNarrow = observeContainerWidth(this.host, this.collapseWidth);
|
|
8709
8966
|
/** Índices de las filas fantasma del estado de carga (7 filas fijas). */
|
|
8710
8967
|
skeletonRows = [0, 1, 2, 3, 4, 5, 6];
|
|
8711
8968
|
/**
|
|
@@ -8720,8 +8977,18 @@ class SolDataTableComponent {
|
|
|
8720
8977
|
return file?.modes?.[mode]?.component?.table?.mobile ?? 'collapse';
|
|
8721
8978
|
}, /* @ts-ignore */
|
|
8722
8979
|
...(ngDevMode ? [{ debugName: "tableMobileMode" }] : /* istanbul ignore next */ []));
|
|
8723
|
-
/**
|
|
8724
|
-
|
|
8980
|
+
/** Variante efectiva: el input manda; si no, `component.table.variant` del tema activo. */
|
|
8981
|
+
effectiveVariant = computed(() => {
|
|
8982
|
+
const own = this.variant();
|
|
8983
|
+
if (own)
|
|
8984
|
+
return own;
|
|
8985
|
+
const file = this.themeService.activeTheme();
|
|
8986
|
+
const mode = this.themeService.isDark() ? 'dark' : 'light';
|
|
8987
|
+
return file?.modes?.[mode]?.component?.table?.variant ?? null;
|
|
8988
|
+
}, /* @ts-ignore */
|
|
8989
|
+
...(ngDevMode ? [{ debugName: "effectiveVariant" }] : /* istanbul ignore next */ []));
|
|
8990
|
+
/** El modo colapsado aplica solo con host angosto (`collapseWidth`) y preferencia "collapse". */
|
|
8991
|
+
mobileCollapse = computed(() => this.isContainerNarrow() && this.tableMobileMode() === 'collapse', /* @ts-ignore */
|
|
8725
8992
|
...(ngDevMode ? [{ debugName: "mobileCollapse" }] : /* istanbul ignore next */ []));
|
|
8726
8993
|
/** Filas expandidas del modo colapsado (por id de trackBy). */
|
|
8727
8994
|
expandedRows = signal(new Set(), /* @ts-ignore */
|
|
@@ -8743,12 +9010,30 @@ class SolDataTableComponent {
|
|
|
8743
9010
|
return this.columns().filter((col) => col !== title && col !== subtitle && col !== badge);
|
|
8744
9011
|
}, /* @ts-ignore */
|
|
8745
9012
|
...(ngDevMode ? [{ debugName: "mobileDetailCols" }] : /* istanbul ignore next */ []));
|
|
9013
|
+
/** true si AL MENOS una columna declara `filter` — dispara la fila de filtros. */
|
|
9014
|
+
hasColumnFilters = computed(() => this.columns().some((col) => !!col.filter), /* @ts-ignore */
|
|
9015
|
+
...(ngDevMode ? [{ debugName: "hasColumnFilters" }] : /* istanbul ignore next */ []));
|
|
8746
9016
|
filteredData = computed(() => {
|
|
8747
9017
|
let result = [...this.data()];
|
|
8748
9018
|
const term = this.searchTerm().toLowerCase();
|
|
8749
9019
|
if (term) {
|
|
8750
9020
|
result = result.filter((row) => this.columns().some((col) => String(this.resolveValue(row, col.key) ?? '').toLowerCase().includes(term)));
|
|
8751
9021
|
}
|
|
9022
|
+
// Filtros por columna (0.6.0): se COMBINAN (AND) entre sí y con la
|
|
9023
|
+
// búsqueda global de arriba. 'select' es igualdad exacta (viene de un
|
|
9024
|
+
// desplegable con las opciones reales de la columna); 'text' es
|
|
9025
|
+
// contención — el mismo criterio que la búsqueda global.
|
|
9026
|
+
const activeFilters = Object.entries(this.columnFilters()).filter(([, value]) => value !== '');
|
|
9027
|
+
if (activeFilters.length > 0) {
|
|
9028
|
+
const columnByKey = new Map(this.columns().map((col) => [col.key, col]));
|
|
9029
|
+
result = result.filter((row) => activeFilters.every(([key, value]) => {
|
|
9030
|
+
const cellValue = String(this.resolveValue(row, key) ?? '').toLowerCase();
|
|
9031
|
+
const needle = value.toLowerCase();
|
|
9032
|
+
return columnByKey.get(key)?.filter === 'select'
|
|
9033
|
+
? cellValue === needle
|
|
9034
|
+
: cellValue.includes(needle);
|
|
9035
|
+
}));
|
|
9036
|
+
}
|
|
8752
9037
|
const key = this.sortKey();
|
|
8753
9038
|
if (key) {
|
|
8754
9039
|
const dir = this.sortDirection() === 'asc' ? 1 : -1;
|
|
@@ -8780,6 +9065,22 @@ class SolDataTableComponent {
|
|
|
8780
9065
|
}
|
|
8781
9066
|
return index;
|
|
8782
9067
|
}
|
|
9068
|
+
/**
|
|
9069
|
+
* Valores únicos (ordenados) de `column` dentro de `data()` — puebla el
|
|
9070
|
+
* `<select>` de su filtro (0.6.0). Deriva del dataset completo, no del ya
|
|
9071
|
+
* filtrado: así las opciones no desaparecen a medida que el propio
|
|
9072
|
+
* usuario filtra.
|
|
9073
|
+
*/
|
|
9074
|
+
columnFilterOptions(column) {
|
|
9075
|
+
const values = new Set();
|
|
9076
|
+
for (const row of this.data()) {
|
|
9077
|
+
const value = this.resolveValue(row, column.key);
|
|
9078
|
+
if (value !== undefined && value !== null && value !== '') {
|
|
9079
|
+
values.add(String(value));
|
|
9080
|
+
}
|
|
9081
|
+
}
|
|
9082
|
+
return Array.from(values).sort((a, b) => a.localeCompare(b));
|
|
9083
|
+
}
|
|
8783
9084
|
/** Estado de expansión de una fila en el modo móvil colapsado. */
|
|
8784
9085
|
isRowExpanded(id) {
|
|
8785
9086
|
return this.expandedRows().has(id);
|
|
@@ -8803,6 +9104,15 @@ class SolDataTableComponent {
|
|
|
8803
9104
|
// Al filtrar, el detalle expandido pierde contexto — se colapsa todo.
|
|
8804
9105
|
this.expandedRows.set(new Set());
|
|
8805
9106
|
}
|
|
9107
|
+
/** Cambia el filtro de una columna (0.6.0) desde su input/select nativo. */
|
|
9108
|
+
onColumnFilterChange(key, event) {
|
|
9109
|
+
const value = event.target.value;
|
|
9110
|
+
this.columnFilters.update((current) => ({ ...current, [key]: value }));
|
|
9111
|
+
this.currentPage.set(1);
|
|
9112
|
+
// Mismo criterio que onSearch: al filtrar, el detalle expandido pierde
|
|
9113
|
+
// contexto — se colapsa todo.
|
|
9114
|
+
this.expandedRows.set(new Set());
|
|
9115
|
+
}
|
|
8806
9116
|
onSort(key) {
|
|
8807
9117
|
if (this.sortKey() === key) {
|
|
8808
9118
|
this.sortDirection.update((d) => (d === 'asc' ? 'desc' : 'asc'));
|
|
@@ -8817,7 +9127,7 @@ class SolDataTableComponent {
|
|
|
8817
9127
|
this.currentPage.set(1);
|
|
8818
9128
|
}
|
|
8819
9129
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: SolDataTableComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
8820
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: SolDataTableComponent, isStandalone: true, selector: "sol-data-table", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, columns: { classPropertyName: "columns", publicName: "columns", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, searchPlaceholder: { classPropertyName: "searchPlaceholder", publicName: "searchPlaceholder", isSignal: true, isRequired: false, transformFunction: null }, emptyMessage: { classPropertyName: "emptyMessage", publicName: "emptyMessage", isSignal: true, isRequired: false, transformFunction: null }, paginated: { classPropertyName: "paginated", publicName: "paginated", isSignal: true, isRequired: false, transformFunction: null }, showToolbar: { classPropertyName: "showToolbar", publicName: "showToolbar", isSignal: true, isRequired: false, transformFunction: null }, filterPosition: { classPropertyName: "filterPosition", publicName: "filterPosition", isSignal: true, isRequired: false, transformFunction: null }, showActions: { classPropertyName: "showActions", publicName: "showActions", isSignal: true, isRequired: false, transformFunction: null }, showEditAction: { classPropertyName: "showEditAction", publicName: "showEditAction", isSignal: true, isRequired: false, transformFunction: null }, showDeleteAction: { classPropertyName: "showDeleteAction", publicName: "showDeleteAction", isSignal: true, isRequired: false, transformFunction: null }, trackByKey: { classPropertyName: "trackByKey", publicName: "trackByKey", isSignal: true, isRequired: false, transformFunction: null }, actionsLabel: { classPropertyName: "actionsLabel", publicName: "actionsLabel", isSignal: true, isRequired: false, transformFunction: null }, toggleDetailsLabel: { classPropertyName: "toggleDetailsLabel", publicName: "toggleDetailsLabel", isSignal: true, isRequired: false, transformFunction: null }, rowReveal: { classPropertyName: "rowReveal", publicName: "rowReveal", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { editClicked: "editClicked", deleteClicked: "deleteClicked" }, queries: [{ propertyName: "rowActionsTemplate", first: true, predicate: ["rowActions"], descendants: true, isSignal: true }], ngImport: i0, template: `
|
|
9130
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: SolDataTableComponent, isStandalone: true, selector: "sol-data-table", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, columns: { classPropertyName: "columns", publicName: "columns", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, searchPlaceholder: { classPropertyName: "searchPlaceholder", publicName: "searchPlaceholder", isSignal: true, isRequired: false, transformFunction: null }, emptyMessage: { classPropertyName: "emptyMessage", publicName: "emptyMessage", isSignal: true, isRequired: false, transformFunction: null }, paginated: { classPropertyName: "paginated", publicName: "paginated", isSignal: true, isRequired: false, transformFunction: null }, showToolbar: { classPropertyName: "showToolbar", publicName: "showToolbar", isSignal: true, isRequired: false, transformFunction: null }, filterPosition: { classPropertyName: "filterPosition", publicName: "filterPosition", isSignal: true, isRequired: false, transformFunction: null }, showActions: { classPropertyName: "showActions", publicName: "showActions", isSignal: true, isRequired: false, transformFunction: null }, showEditAction: { classPropertyName: "showEditAction", publicName: "showEditAction", isSignal: true, isRequired: false, transformFunction: null }, showDeleteAction: { classPropertyName: "showDeleteAction", publicName: "showDeleteAction", isSignal: true, isRequired: false, transformFunction: null }, trackByKey: { classPropertyName: "trackByKey", publicName: "trackByKey", isSignal: true, isRequired: false, transformFunction: null }, actionsLabel: { classPropertyName: "actionsLabel", publicName: "actionsLabel", isSignal: true, isRequired: false, transformFunction: null }, actionsPosition: { classPropertyName: "actionsPosition", publicName: "actionsPosition", isSignal: true, isRequired: false, transformFunction: null }, toggleDetailsLabel: { classPropertyName: "toggleDetailsLabel", publicName: "toggleDetailsLabel", isSignal: true, isRequired: false, transformFunction: null }, rowReveal: { classPropertyName: "rowReveal", publicName: "rowReveal", isSignal: true, isRequired: false, transformFunction: null }, collapseWidth: { classPropertyName: "collapseWidth", publicName: "collapseWidth", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { editClicked: "editClicked", deleteClicked: "deleteClicked" }, queries: [{ propertyName: "rowActionsTemplate", first: true, predicate: ["rowActions"], descendants: true, isSignal: true }], ngImport: i0, template: `
|
|
8821
9131
|
<!-- Slot para filtros personalizados (fuera de la tarjeta) -->
|
|
8822
9132
|
<div
|
|
8823
9133
|
class="sol-data-table__filters"
|
|
@@ -8826,7 +9136,11 @@ class SolDataTableComponent {
|
|
|
8826
9136
|
<ng-content select="[tableFilters]" />
|
|
8827
9137
|
</div>
|
|
8828
9138
|
|
|
8829
|
-
<div
|
|
9139
|
+
<div
|
|
9140
|
+
class="sol-data-table"
|
|
9141
|
+
[attr.aria-busy]="loadingVisible() || null"
|
|
9142
|
+
[attr.data-variant]="effectiveVariant()"
|
|
9143
|
+
>
|
|
8830
9144
|
@if (showToolbar()) {
|
|
8831
9145
|
<div class="sol-data-table__toolbar">
|
|
8832
9146
|
<div class="sol-data-table__toolbar-left">
|
|
@@ -8843,10 +9157,10 @@ class SolDataTableComponent {
|
|
|
8843
9157
|
|
|
8844
9158
|
<!-- Acciones por fila compartidas entre el modo tabla y el modo móvil. -->
|
|
8845
9159
|
<ng-template #rowActionButtons let-row>
|
|
8846
|
-
|
|
8847
|
-
|
|
8848
|
-
|
|
8849
|
-
|
|
9160
|
+
<div class="sol-data-table__action-group">
|
|
9161
|
+
@if (rowActionsTemplate(); as tpl) {
|
|
9162
|
+
<ng-container *ngTemplateOutlet="tpl; context: { $implicit: row }" />
|
|
9163
|
+
} @else {
|
|
8850
9164
|
@if (showEditAction()) {
|
|
8851
9165
|
<sol-button variant="ghost" size="sm" (clicked)="editClicked.emit(row)">
|
|
8852
9166
|
<sol-icon name="edit" size="sm" />
|
|
@@ -8857,8 +9171,25 @@ class SolDataTableComponent {
|
|
|
8857
9171
|
<sol-icon name="trash" size="sm" class="text-red-500" />
|
|
8858
9172
|
</sol-button>
|
|
8859
9173
|
}
|
|
8860
|
-
|
|
8861
|
-
|
|
9174
|
+
}
|
|
9175
|
+
</div>
|
|
9176
|
+
</ng-template>
|
|
9177
|
+
|
|
9178
|
+
<!-- Celda(s) de acciones del modo tabla, reutilizadas en ambas
|
|
9179
|
+
posiciones ('start'/'end', ver input actionsPosition) para no
|
|
9180
|
+
duplicar el mismo th/td dos veces en el template. -->
|
|
9181
|
+
<ng-template #actionsHeaderCell>
|
|
9182
|
+
<th class="sol-data-table__th sol-data-table__th--actions">{{ actionsLabel() }}</th>
|
|
9183
|
+
</ng-template>
|
|
9184
|
+
|
|
9185
|
+
<ng-template #actionsFilterCell>
|
|
9186
|
+
<th class="sol-data-table__filter-cell"></th>
|
|
9187
|
+
</ng-template>
|
|
9188
|
+
|
|
9189
|
+
<ng-template #actionsBodyCell let-row>
|
|
9190
|
+
<td class="sol-data-table__td sol-data-table__td--actions">
|
|
9191
|
+
<ng-container *ngTemplateOutlet="rowActionButtons; context: { $implicit: row }" />
|
|
9192
|
+
</td>
|
|
8862
9193
|
</ng-template>
|
|
8863
9194
|
|
|
8864
9195
|
@if (mobileCollapse()) {
|
|
@@ -8961,6 +9292,9 @@ class SolDataTableComponent {
|
|
|
8961
9292
|
<table class="sol-data-table__table">
|
|
8962
9293
|
<thead>
|
|
8963
9294
|
<tr>
|
|
9295
|
+
@if (showActions() && actionsPosition() === 'start') {
|
|
9296
|
+
<ng-container *ngTemplateOutlet="actionsHeaderCell" />
|
|
9297
|
+
}
|
|
8964
9298
|
@for (col of columns(); track col.key) {
|
|
8965
9299
|
<th
|
|
8966
9300
|
class="sol-data-table__th"
|
|
@@ -8976,10 +9310,51 @@ class SolDataTableComponent {
|
|
|
8976
9310
|
}
|
|
8977
9311
|
</th>
|
|
8978
9312
|
}
|
|
8979
|
-
@if (showActions()) {
|
|
8980
|
-
<
|
|
9313
|
+
@if (showActions() && actionsPosition() === 'end') {
|
|
9314
|
+
<ng-container *ngTemplateOutlet="actionsHeaderCell" />
|
|
8981
9315
|
}
|
|
8982
9316
|
</tr>
|
|
9317
|
+
@if (hasColumnFilters()) {
|
|
9318
|
+
<!-- Fila de filtros opt-in (ver DataTableColumn.filter): solo
|
|
9319
|
+
dentro de <table>, nunca en el modo colapsado móvil (que
|
|
9320
|
+
ni siquiera renderiza este bloque). Las celdas siguen el
|
|
9321
|
+
mismo actionsPosition que el header para no desalinear
|
|
9322
|
+
columnas. -->
|
|
9323
|
+
<tr class="sol-data-table__filters-row">
|
|
9324
|
+
@if (showActions() && actionsPosition() === 'start') {
|
|
9325
|
+
<ng-container *ngTemplateOutlet="actionsFilterCell" />
|
|
9326
|
+
}
|
|
9327
|
+
@for (col of columns(); track col.key) {
|
|
9328
|
+
<th class="sol-data-table__filter-cell">
|
|
9329
|
+
@if (col.filter === 'text') {
|
|
9330
|
+
<input
|
|
9331
|
+
type="text"
|
|
9332
|
+
class="sol-data-table__filter-input"
|
|
9333
|
+
placeholder="…"
|
|
9334
|
+
[attr.aria-label]="col.label"
|
|
9335
|
+
[value]="columnFilters()[col.key] ?? ''"
|
|
9336
|
+
(input)="onColumnFilterChange(col.key, $event)"
|
|
9337
|
+
/>
|
|
9338
|
+
} @else if (col.filter === 'select') {
|
|
9339
|
+
<select
|
|
9340
|
+
class="sol-data-table__filter-select"
|
|
9341
|
+
[attr.aria-label]="col.label"
|
|
9342
|
+
[value]="columnFilters()[col.key] ?? ''"
|
|
9343
|
+
(change)="onColumnFilterChange(col.key, $event)"
|
|
9344
|
+
>
|
|
9345
|
+
<option value="">Todas</option>
|
|
9346
|
+
@for (opt of columnFilterOptions(col); track opt) {
|
|
9347
|
+
<option [value]="opt">{{ opt }}</option>
|
|
9348
|
+
}
|
|
9349
|
+
</select>
|
|
9350
|
+
}
|
|
9351
|
+
</th>
|
|
9352
|
+
}
|
|
9353
|
+
@if (showActions() && actionsPosition() === 'end') {
|
|
9354
|
+
<ng-container *ngTemplateOutlet="actionsFilterCell" />
|
|
9355
|
+
}
|
|
9356
|
+
</tr>
|
|
9357
|
+
}
|
|
8983
9358
|
</thead>
|
|
8984
9359
|
<tbody>
|
|
8985
9360
|
@if (loadingVisible()) {
|
|
@@ -8998,6 +9373,9 @@ class SolDataTableComponent {
|
|
|
8998
9373
|
[solRowRevealIndex]="$index"
|
|
8999
9374
|
[solRowRevealReplay]="revealReplayKey()"
|
|
9000
9375
|
>
|
|
9376
|
+
@if (showActions() && actionsPosition() === 'start') {
|
|
9377
|
+
<ng-container *ngTemplateOutlet="actionsBodyCell; context: { $implicit: row }" />
|
|
9378
|
+
}
|
|
9001
9379
|
@for (col of columns(); track col.key) {
|
|
9002
9380
|
<td class="sol-data-table__td">
|
|
9003
9381
|
@if (col.cellTemplate) {
|
|
@@ -9007,10 +9385,8 @@ class SolDataTableComponent {
|
|
|
9007
9385
|
}
|
|
9008
9386
|
</td>
|
|
9009
9387
|
}
|
|
9010
|
-
@if (showActions()) {
|
|
9011
|
-
<
|
|
9012
|
-
<ng-container *ngTemplateOutlet="rowActionButtons; context: { $implicit: row }" />
|
|
9013
|
-
</td>
|
|
9388
|
+
@if (showActions() && actionsPosition() === 'end') {
|
|
9389
|
+
<ng-container *ngTemplateOutlet="actionsBodyCell; context: { $implicit: row }" />
|
|
9014
9390
|
}
|
|
9015
9391
|
</tr>
|
|
9016
9392
|
} @empty {
|
|
@@ -9038,7 +9414,7 @@ class SolDataTableComponent {
|
|
|
9038
9414
|
/>
|
|
9039
9415
|
</div>
|
|
9040
9416
|
}
|
|
9041
|
-
`, isInline: true, styles: [".sol-data-table__filters{display:flex;align-items:center;gap:12px;flex-wrap:wrap;margin-bottom:12px}.sol-data-table__filters:empty{display:none}.sol-data-table{background:var(--sol-card-bg, var(--sol-bg-surface, #fff));border:var(--sol-card-border, 1px solid var(--sol-border-color-default, #E2E8F0));border-radius:var(--sol-card-radius, var(--sol-border-radius-lg, 12px));box-shadow:var(--sol-card-shadow, var(--sol-shadow-sm));overflow:hidden}.sol-data-table__toolbar{display:flex;align-items:center;justify-content:space-between;padding:12px 16px;gap:12px;border-bottom:1px solid var(--sol-border-color-default, #E2E8F0)}.sol-data-table__toolbar-left{display:flex;align-items:center;gap:8px}.sol-data-table__toolbar-right{display:flex;align-items:center;gap:8px;min-width:200px;max-width:280px}.sol-data-table__wrapper{overflow-x:auto}.sol-data-table__table{width:100%;border-collapse:collapse}.sol-data-table__th{padding:10px 16px;font-size:var(--sol-font-size-xs, 11px);font-weight:600;color:var(--sol-color-text-muted, #64748B);text-transform:uppercase;letter-spacing:.05em;text-align:left;background:color-mix(in srgb,var(--sol-border-color-default, #E2E8F0) 30%,transparent);border-bottom:1px solid var(--sol-border-color-default, #E2E8F0);white-space:nowrap;-webkit-user-select:none;user-select:none}.sol-data-table__th--sortable{cursor:pointer;transition:color .15s}.sol-data-table__th--sortable:hover{color:var(--sol-color-text-primary, #0F172A)}.sol-data-table__th--actions{width:
|
|
9417
|
+
`, isInline: true, styles: [".sol-data-table__filters{display:flex;align-items:center;gap:12px;flex-wrap:wrap;margin-bottom:12px}.sol-data-table__filters:empty{display:none}.sol-data-table{background:var(--sol-card-bg, var(--sol-bg-surface, #fff));border:var(--sol-card-border, 1px solid var(--sol-border-color-default, #E2E8F0));border-radius:var(--sol-card-radius, var(--sol-border-radius-lg, 12px));box-shadow:var(--sol-card-shadow, var(--sol-shadow-sm));overflow:hidden}.sol-data-table__toolbar{display:flex;align-items:center;justify-content:space-between;padding:12px 16px;gap:12px;border-bottom:1px solid var(--sol-border-color-default, #E2E8F0)}.sol-data-table__toolbar-left{display:flex;align-items:center;gap:8px}.sol-data-table__toolbar-right{display:flex;align-items:center;gap:8px;min-width:200px;max-width:280px}.sol-data-table__wrapper{overflow-x:auto}.sol-data-table__table{width:100%;border-collapse:collapse}.sol-data-table__th{padding:10px 16px;font-size:var(--sol-font-size-xs, 11px);font-weight:600;color:var(--sol-color-text-muted, #64748B);text-transform:uppercase;letter-spacing:.05em;text-align:left;background:color-mix(in srgb,var(--sol-border-color-default, #E2E8F0) 30%,transparent);border-bottom:1px solid var(--sol-border-color-default, #E2E8F0);white-space:nowrap;-webkit-user-select:none;user-select:none}.sol-data-table__th--sortable{cursor:pointer;transition:color .15s}.sol-data-table__th--sortable:hover{color:var(--sol-color-text-primary, #0F172A)}.sol-data-table__th--actions{width:1%;white-space:nowrap;text-align:center}.sol-data-table__filter-cell{padding:6px 16px;background:color-mix(in srgb,var(--sol-border-color-default, #E2E8F0) 15%,transparent);border-bottom:1px solid var(--sol-border-color-default, #E2E8F0)}.sol-data-table__filter-input,.sol-data-table__filter-select{width:100%;box-sizing:border-box;height:var(--sol-size-component-sm, 30px);padding:0 8px;font-family:inherit;font-size:var(--sol-font-size-sm, 12px);color:var(--sol-color-text-primary, #0F172A);background:var(--sol-bg-surface, #fff);border:1px solid var(--sol-border-color-default, #E2E8F0);border-radius:var(--sol-border-radius-sm, 6px);outline:none;transition:border-color var(--sol-dur-fast, .15s) var(--sol-ease, ease),box-shadow var(--sol-dur-fast, .15s) var(--sol-ease, ease)}.sol-data-table__filter-input::placeholder{color:var(--sol-color-text-muted, #94A3B8)}.sol-data-table__filter-input:focus,.sol-data-table__filter-select:focus{border-color:var(--sol-color-primary, #2563EB);box-shadow:var(--sol-focus-ring, 0 0 0 2px color-mix(in srgb, var(--sol-color-primary, #2563EB) 20%, transparent))}.sol-data-table__sort-icon{margin-left:4px;font-size:12px;color:var(--sol-color-primary, #2563EB)}.sol-data-table__tr{border-bottom:1px solid var(--sol-border-color-default, #E2E8F0);transition:background-color .15s}.sol-data-table__tr:last-child .sol-data-table__td{border-bottom:none}.sol-data-table__tr:hover{background:color-mix(in srgb,var(--sol-color-primary, #2563EB) 3%,transparent)}.sol-data-table__td{padding:12px 16px;font-size:var(--sol-font-size-sm, 13px);color:var(--sol-color-text-primary, #0F172A);vertical-align:middle}.sol-data-table__td--actions{text-align:center;white-space:nowrap}.sol-data-table__action-group{display:flex;align-items:center;justify-content:center;gap:4px}.sol-data-table__empty{padding:40px 16px;text-align:center;font-size:var(--sol-font-size-sm, 13px);color:var(--sol-color-text-muted, #94A3B8)}.sol-data-table__footer{padding:8px 4px 0}.sol-data-table[data-variant]{--sol-table-header-bg: color-mix(in srgb, var(--sol-color-primary, #2563EB) 8%, var(--sol-bg-surface, #FFFFFF));--sol-table-header-strong-bg: color-mix(in srgb, var(--sol-color-primary, #2563EB) 16%, var(--sol-bg-surface, #FFFFFF));--sol-table-zebra: color-mix(in srgb, var(--sol-color-text-primary, #0F172A) 4%, transparent);--sol-table-band: color-mix(in srgb, var(--sol-color-primary, #2563EB) 7%, transparent);--sol-table-cell-border: var(--sol-border-color-default, #E2E8F0);--sol-table-hover: color-mix(in srgb, var(--sol-color-text-primary, #0F172A) 6%, transparent)}.sol-data-table[data-variant] .sol-data-table__th{background:var(--sol-table-header-bg);color:var(--sol-color-text-secondary, #475569);font-size:var(--sol-font-size-sm, 12px);border-bottom:var(--sol-border-width-default, 1px) solid var(--sol-table-cell-border)}.sol-data-table[data-variant] .sol-data-table__tr{border-bottom:var(--sol-border-width-default, 1px) solid var(--sol-table-cell-border)}.sol-data-table[data-variant]:not([data-variant=clean]) .sol-data-table__table>tbody>.sol-data-table__tr:nth-of-type(odd){background:var(--sol-table-zebra)}.sol-data-table[data-variant=banded] .sol-data-table__table>tbody>.sol-data-table__tr:nth-of-type(3n){background:var(--sol-table-band)}.sol-data-table[data-variant][data-variant] .sol-data-table__table>tbody>.sol-data-table__tr:hover{background:var(--sol-table-hover)}.sol-data-table[data-variant=bordered] .sol-data-table__table{border:var(--sol-border-width-default, 1px) solid var(--sol-table-cell-border)}.sol-data-table[data-variant=bordered] .sol-data-table__th,.sol-data-table[data-variant=bordered] .sol-data-table__td,.sol-data-table[data-variant=bordered] .sol-data-table__table .sol-data-table__tr:last-child>.sol-data-table__td{border:var(--sol-border-width-default, 1px) solid var(--sol-table-cell-border)}.sol-data-table[data-variant=emphasis-header] .sol-data-table__th{background:var(--sol-table-header-strong-bg);color:var(--sol-color-primary, #2563EB)}.sol-data-table__cards{list-style:none;margin:0;padding:0}.sol-data-table__card{border-bottom:1px solid var(--sol-border-color-default, #E2E8F0)}.sol-data-table__card:last-child{border-bottom:none}.sol-data-table__card-head{display:flex;align-items:center;gap:10px;width:100%;min-width:0;padding:12px;border:none;background:transparent;font:inherit;text-align:left;color:var(--sol-color-text-primary, #0F172A);cursor:pointer;box-sizing:border-box}.sol-data-table__card-chevron{flex-shrink:0;color:var(--sol-color-text-muted, #94A3B8);transition:transform var(--sol-dur-fast, .12s) var(--sol-ease, ease)}.sol-data-table__card-chevron--open{transform:rotate(90deg)}.sol-data-table__card-main{flex:1;min-width:0;display:flex;flex-direction:column;gap:2px}.sol-data-table__card-title{font-size:var(--sol-font-size-sm, 13px);font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.sol-data-table__card-sub{font-size:var(--sol-font-size-sm, 12px);color:var(--sol-color-text-muted, #64748B);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.sol-data-table__card-chip{flex-shrink:0;max-width:40%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:2px 10px;border-radius:var(--sol-border-radius-full, 9999px);font-size:11px;font-weight:600;color:var(--sol-color-primary, #2563EB);background:color-mix(in srgb,var(--sol-color-primary, #2563EB) 12%,transparent)}.sol-data-table__card-details{padding:0 12px 12px 34px;animation:sol-data-table-reveal var(--sol-dur-base, .24s) var(--sol-ease-entrance, ease-out) backwards}@keyframes sol-data-table-reveal{0%{opacity:0;transform:translateY(4px)}to{opacity:1;transform:translateY(0)}}.sol-data-table__card-kv-list{margin:0;display:flex;flex-direction:column;gap:6px}.sol-data-table__card-kv{display:flex;gap:8px;align-items:baseline;min-width:0}.sol-data-table__card-kv dt{flex-shrink:0;font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:.05em;color:var(--sol-color-text-muted, #64748B)}.sol-data-table__card-kv dd{margin:0;min-width:0;font-size:var(--sol-font-size-sm, 13px);color:var(--sol-color-text-primary, #0F172A);overflow-wrap:anywhere}.sol-data-table__card-actions{display:flex;justify-content:flex-end;gap:4px;margin-top:10px}@media(max-width:767px){.sol-data-table__toolbar{flex-wrap:wrap}.sol-data-table__toolbar-right{flex:1;min-width:0;max-width:none}}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: SolSearchInputComponent, selector: "sol-search-input", inputs: ["placeholder"], outputs: ["searchChange"] }, { kind: "component", type: SolPaginationComponent, selector: "sol-pagination", inputs: ["totalItems", "pageSize", "currentPage", "pageSizeOptions"], outputs: ["pageChanged", "pageSizeChanged"] }, { kind: "component", type: SolButtonComponent, selector: "sol-button", inputs: ["variant", "size", "disabled", "type", "loading"], outputs: ["clicked"] }, { kind: "component", type: SolIconComponent, selector: "sol-icon", inputs: ["name", "size", "variant"] }, { kind: "component", type: SolSkeletonComponent, selector: "sol-skeleton", inputs: ["variant", "width", "height", "aspectRatio", "count"] }, { kind: "directive", type: RowRevealDirective, selector: "[solRowReveal]", inputs: ["solRowReveal", "solRowRevealIndex", "solRowRevealReplay"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
9042
9418
|
}
|
|
9043
9419
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: SolDataTableComponent, decorators: [{
|
|
9044
9420
|
type: Component,
|
|
@@ -9059,7 +9435,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
9059
9435
|
<ng-content select="[tableFilters]" />
|
|
9060
9436
|
</div>
|
|
9061
9437
|
|
|
9062
|
-
<div
|
|
9438
|
+
<div
|
|
9439
|
+
class="sol-data-table"
|
|
9440
|
+
[attr.aria-busy]="loadingVisible() || null"
|
|
9441
|
+
[attr.data-variant]="effectiveVariant()"
|
|
9442
|
+
>
|
|
9063
9443
|
@if (showToolbar()) {
|
|
9064
9444
|
<div class="sol-data-table__toolbar">
|
|
9065
9445
|
<div class="sol-data-table__toolbar-left">
|
|
@@ -9076,10 +9456,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
9076
9456
|
|
|
9077
9457
|
<!-- Acciones por fila compartidas entre el modo tabla y el modo móvil. -->
|
|
9078
9458
|
<ng-template #rowActionButtons let-row>
|
|
9079
|
-
|
|
9080
|
-
|
|
9081
|
-
|
|
9082
|
-
|
|
9459
|
+
<div class="sol-data-table__action-group">
|
|
9460
|
+
@if (rowActionsTemplate(); as tpl) {
|
|
9461
|
+
<ng-container *ngTemplateOutlet="tpl; context: { $implicit: row }" />
|
|
9462
|
+
} @else {
|
|
9083
9463
|
@if (showEditAction()) {
|
|
9084
9464
|
<sol-button variant="ghost" size="sm" (clicked)="editClicked.emit(row)">
|
|
9085
9465
|
<sol-icon name="edit" size="sm" />
|
|
@@ -9090,8 +9470,25 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
9090
9470
|
<sol-icon name="trash" size="sm" class="text-red-500" />
|
|
9091
9471
|
</sol-button>
|
|
9092
9472
|
}
|
|
9093
|
-
|
|
9094
|
-
|
|
9473
|
+
}
|
|
9474
|
+
</div>
|
|
9475
|
+
</ng-template>
|
|
9476
|
+
|
|
9477
|
+
<!-- Celda(s) de acciones del modo tabla, reutilizadas en ambas
|
|
9478
|
+
posiciones ('start'/'end', ver input actionsPosition) para no
|
|
9479
|
+
duplicar el mismo th/td dos veces en el template. -->
|
|
9480
|
+
<ng-template #actionsHeaderCell>
|
|
9481
|
+
<th class="sol-data-table__th sol-data-table__th--actions">{{ actionsLabel() }}</th>
|
|
9482
|
+
</ng-template>
|
|
9483
|
+
|
|
9484
|
+
<ng-template #actionsFilterCell>
|
|
9485
|
+
<th class="sol-data-table__filter-cell"></th>
|
|
9486
|
+
</ng-template>
|
|
9487
|
+
|
|
9488
|
+
<ng-template #actionsBodyCell let-row>
|
|
9489
|
+
<td class="sol-data-table__td sol-data-table__td--actions">
|
|
9490
|
+
<ng-container *ngTemplateOutlet="rowActionButtons; context: { $implicit: row }" />
|
|
9491
|
+
</td>
|
|
9095
9492
|
</ng-template>
|
|
9096
9493
|
|
|
9097
9494
|
@if (mobileCollapse()) {
|
|
@@ -9194,6 +9591,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
9194
9591
|
<table class="sol-data-table__table">
|
|
9195
9592
|
<thead>
|
|
9196
9593
|
<tr>
|
|
9594
|
+
@if (showActions() && actionsPosition() === 'start') {
|
|
9595
|
+
<ng-container *ngTemplateOutlet="actionsHeaderCell" />
|
|
9596
|
+
}
|
|
9197
9597
|
@for (col of columns(); track col.key) {
|
|
9198
9598
|
<th
|
|
9199
9599
|
class="sol-data-table__th"
|
|
@@ -9209,10 +9609,51 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
9209
9609
|
}
|
|
9210
9610
|
</th>
|
|
9211
9611
|
}
|
|
9212
|
-
@if (showActions()) {
|
|
9213
|
-
<
|
|
9612
|
+
@if (showActions() && actionsPosition() === 'end') {
|
|
9613
|
+
<ng-container *ngTemplateOutlet="actionsHeaderCell" />
|
|
9214
9614
|
}
|
|
9215
9615
|
</tr>
|
|
9616
|
+
@if (hasColumnFilters()) {
|
|
9617
|
+
<!-- Fila de filtros opt-in (ver DataTableColumn.filter): solo
|
|
9618
|
+
dentro de <table>, nunca en el modo colapsado móvil (que
|
|
9619
|
+
ni siquiera renderiza este bloque). Las celdas siguen el
|
|
9620
|
+
mismo actionsPosition que el header para no desalinear
|
|
9621
|
+
columnas. -->
|
|
9622
|
+
<tr class="sol-data-table__filters-row">
|
|
9623
|
+
@if (showActions() && actionsPosition() === 'start') {
|
|
9624
|
+
<ng-container *ngTemplateOutlet="actionsFilterCell" />
|
|
9625
|
+
}
|
|
9626
|
+
@for (col of columns(); track col.key) {
|
|
9627
|
+
<th class="sol-data-table__filter-cell">
|
|
9628
|
+
@if (col.filter === 'text') {
|
|
9629
|
+
<input
|
|
9630
|
+
type="text"
|
|
9631
|
+
class="sol-data-table__filter-input"
|
|
9632
|
+
placeholder="…"
|
|
9633
|
+
[attr.aria-label]="col.label"
|
|
9634
|
+
[value]="columnFilters()[col.key] ?? ''"
|
|
9635
|
+
(input)="onColumnFilterChange(col.key, $event)"
|
|
9636
|
+
/>
|
|
9637
|
+
} @else if (col.filter === 'select') {
|
|
9638
|
+
<select
|
|
9639
|
+
class="sol-data-table__filter-select"
|
|
9640
|
+
[attr.aria-label]="col.label"
|
|
9641
|
+
[value]="columnFilters()[col.key] ?? ''"
|
|
9642
|
+
(change)="onColumnFilterChange(col.key, $event)"
|
|
9643
|
+
>
|
|
9644
|
+
<option value="">Todas</option>
|
|
9645
|
+
@for (opt of columnFilterOptions(col); track opt) {
|
|
9646
|
+
<option [value]="opt">{{ opt }}</option>
|
|
9647
|
+
}
|
|
9648
|
+
</select>
|
|
9649
|
+
}
|
|
9650
|
+
</th>
|
|
9651
|
+
}
|
|
9652
|
+
@if (showActions() && actionsPosition() === 'end') {
|
|
9653
|
+
<ng-container *ngTemplateOutlet="actionsFilterCell" />
|
|
9654
|
+
}
|
|
9655
|
+
</tr>
|
|
9656
|
+
}
|
|
9216
9657
|
</thead>
|
|
9217
9658
|
<tbody>
|
|
9218
9659
|
@if (loadingVisible()) {
|
|
@@ -9231,6 +9672,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
9231
9672
|
[solRowRevealIndex]="$index"
|
|
9232
9673
|
[solRowRevealReplay]="revealReplayKey()"
|
|
9233
9674
|
>
|
|
9675
|
+
@if (showActions() && actionsPosition() === 'start') {
|
|
9676
|
+
<ng-container *ngTemplateOutlet="actionsBodyCell; context: { $implicit: row }" />
|
|
9677
|
+
}
|
|
9234
9678
|
@for (col of columns(); track col.key) {
|
|
9235
9679
|
<td class="sol-data-table__td">
|
|
9236
9680
|
@if (col.cellTemplate) {
|
|
@@ -9240,10 +9684,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
9240
9684
|
}
|
|
9241
9685
|
</td>
|
|
9242
9686
|
}
|
|
9243
|
-
@if (showActions()) {
|
|
9244
|
-
<
|
|
9245
|
-
<ng-container *ngTemplateOutlet="rowActionButtons; context: { $implicit: row }" />
|
|
9246
|
-
</td>
|
|
9687
|
+
@if (showActions() && actionsPosition() === 'end') {
|
|
9688
|
+
<ng-container *ngTemplateOutlet="actionsBodyCell; context: { $implicit: row }" />
|
|
9247
9689
|
}
|
|
9248
9690
|
</tr>
|
|
9249
9691
|
} @empty {
|
|
@@ -9271,8 +9713,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
9271
9713
|
/>
|
|
9272
9714
|
</div>
|
|
9273
9715
|
}
|
|
9274
|
-
`, styles: [".sol-data-table__filters{display:flex;align-items:center;gap:12px;flex-wrap:wrap;margin-bottom:12px}.sol-data-table__filters:empty{display:none}.sol-data-table{background:var(--sol-card-bg, var(--sol-bg-surface, #fff));border:var(--sol-card-border, 1px solid var(--sol-border-color-default, #E2E8F0));border-radius:var(--sol-card-radius, var(--sol-border-radius-lg, 12px));box-shadow:var(--sol-card-shadow, var(--sol-shadow-sm));overflow:hidden}.sol-data-table__toolbar{display:flex;align-items:center;justify-content:space-between;padding:12px 16px;gap:12px;border-bottom:1px solid var(--sol-border-color-default, #E2E8F0)}.sol-data-table__toolbar-left{display:flex;align-items:center;gap:8px}.sol-data-table__toolbar-right{display:flex;align-items:center;gap:8px;min-width:200px;max-width:280px}.sol-data-table__wrapper{overflow-x:auto}.sol-data-table__table{width:100%;border-collapse:collapse}.sol-data-table__th{padding:10px 16px;font-size:var(--sol-font-size-xs, 11px);font-weight:600;color:var(--sol-color-text-muted, #64748B);text-transform:uppercase;letter-spacing:.05em;text-align:left;background:color-mix(in srgb,var(--sol-border-color-default, #E2E8F0) 30%,transparent);border-bottom:1px solid var(--sol-border-color-default, #E2E8F0);white-space:nowrap;-webkit-user-select:none;user-select:none}.sol-data-table__th--sortable{cursor:pointer;transition:color .15s}.sol-data-table__th--sortable:hover{color:var(--sol-color-text-primary, #0F172A)}.sol-data-table__th--actions{width:
|
|
9275
|
-
}], propDecorators: { data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: false }] }], columns: [{ type: i0.Input, args: [{ isSignal: true, alias: "columns", required: false }] }], loading: [{ type: i0.Input, args: [{ isSignal: true, alias: "loading", required: false }] }], searchPlaceholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "searchPlaceholder", required: false }] }], emptyMessage: [{ type: i0.Input, args: [{ isSignal: true, alias: "emptyMessage", required: false }] }], paginated: [{ type: i0.Input, args: [{ isSignal: true, alias: "paginated", required: false }] }], showToolbar: [{ type: i0.Input, args: [{ isSignal: true, alias: "showToolbar", required: false }] }], filterPosition: [{ type: i0.Input, args: [{ isSignal: true, alias: "filterPosition", required: false }] }], showActions: [{ type: i0.Input, args: [{ isSignal: true, alias: "showActions", required: false }] }], showEditAction: [{ type: i0.Input, args: [{ isSignal: true, alias: "showEditAction", required: false }] }], showDeleteAction: [{ type: i0.Input, args: [{ isSignal: true, alias: "showDeleteAction", required: false }] }], trackByKey: [{ type: i0.Input, args: [{ isSignal: true, alias: "trackByKey", required: false }] }], actionsLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "actionsLabel", required: false }] }], toggleDetailsLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "toggleDetailsLabel", required: false }] }], rowReveal: [{ type: i0.Input, args: [{ isSignal: true, alias: "rowReveal", required: false }] }], editClicked: [{ type: i0.Output, args: ["editClicked"] }], deleteClicked: [{ type: i0.Output, args: ["deleteClicked"] }], rowActionsTemplate: [{ type: i0.ContentChild, args: ['rowActions', { isSignal: true }] }] } });
|
|
9716
|
+
`, styles: [".sol-data-table__filters{display:flex;align-items:center;gap:12px;flex-wrap:wrap;margin-bottom:12px}.sol-data-table__filters:empty{display:none}.sol-data-table{background:var(--sol-card-bg, var(--sol-bg-surface, #fff));border:var(--sol-card-border, 1px solid var(--sol-border-color-default, #E2E8F0));border-radius:var(--sol-card-radius, var(--sol-border-radius-lg, 12px));box-shadow:var(--sol-card-shadow, var(--sol-shadow-sm));overflow:hidden}.sol-data-table__toolbar{display:flex;align-items:center;justify-content:space-between;padding:12px 16px;gap:12px;border-bottom:1px solid var(--sol-border-color-default, #E2E8F0)}.sol-data-table__toolbar-left{display:flex;align-items:center;gap:8px}.sol-data-table__toolbar-right{display:flex;align-items:center;gap:8px;min-width:200px;max-width:280px}.sol-data-table__wrapper{overflow-x:auto}.sol-data-table__table{width:100%;border-collapse:collapse}.sol-data-table__th{padding:10px 16px;font-size:var(--sol-font-size-xs, 11px);font-weight:600;color:var(--sol-color-text-muted, #64748B);text-transform:uppercase;letter-spacing:.05em;text-align:left;background:color-mix(in srgb,var(--sol-border-color-default, #E2E8F0) 30%,transparent);border-bottom:1px solid var(--sol-border-color-default, #E2E8F0);white-space:nowrap;-webkit-user-select:none;user-select:none}.sol-data-table__th--sortable{cursor:pointer;transition:color .15s}.sol-data-table__th--sortable:hover{color:var(--sol-color-text-primary, #0F172A)}.sol-data-table__th--actions{width:1%;white-space:nowrap;text-align:center}.sol-data-table__filter-cell{padding:6px 16px;background:color-mix(in srgb,var(--sol-border-color-default, #E2E8F0) 15%,transparent);border-bottom:1px solid var(--sol-border-color-default, #E2E8F0)}.sol-data-table__filter-input,.sol-data-table__filter-select{width:100%;box-sizing:border-box;height:var(--sol-size-component-sm, 30px);padding:0 8px;font-family:inherit;font-size:var(--sol-font-size-sm, 12px);color:var(--sol-color-text-primary, #0F172A);background:var(--sol-bg-surface, #fff);border:1px solid var(--sol-border-color-default, #E2E8F0);border-radius:var(--sol-border-radius-sm, 6px);outline:none;transition:border-color var(--sol-dur-fast, .15s) var(--sol-ease, ease),box-shadow var(--sol-dur-fast, .15s) var(--sol-ease, ease)}.sol-data-table__filter-input::placeholder{color:var(--sol-color-text-muted, #94A3B8)}.sol-data-table__filter-input:focus,.sol-data-table__filter-select:focus{border-color:var(--sol-color-primary, #2563EB);box-shadow:var(--sol-focus-ring, 0 0 0 2px color-mix(in srgb, var(--sol-color-primary, #2563EB) 20%, transparent))}.sol-data-table__sort-icon{margin-left:4px;font-size:12px;color:var(--sol-color-primary, #2563EB)}.sol-data-table__tr{border-bottom:1px solid var(--sol-border-color-default, #E2E8F0);transition:background-color .15s}.sol-data-table__tr:last-child .sol-data-table__td{border-bottom:none}.sol-data-table__tr:hover{background:color-mix(in srgb,var(--sol-color-primary, #2563EB) 3%,transparent)}.sol-data-table__td{padding:12px 16px;font-size:var(--sol-font-size-sm, 13px);color:var(--sol-color-text-primary, #0F172A);vertical-align:middle}.sol-data-table__td--actions{text-align:center;white-space:nowrap}.sol-data-table__action-group{display:flex;align-items:center;justify-content:center;gap:4px}.sol-data-table__empty{padding:40px 16px;text-align:center;font-size:var(--sol-font-size-sm, 13px);color:var(--sol-color-text-muted, #94A3B8)}.sol-data-table__footer{padding:8px 4px 0}.sol-data-table[data-variant]{--sol-table-header-bg: color-mix(in srgb, var(--sol-color-primary, #2563EB) 8%, var(--sol-bg-surface, #FFFFFF));--sol-table-header-strong-bg: color-mix(in srgb, var(--sol-color-primary, #2563EB) 16%, var(--sol-bg-surface, #FFFFFF));--sol-table-zebra: color-mix(in srgb, var(--sol-color-text-primary, #0F172A) 4%, transparent);--sol-table-band: color-mix(in srgb, var(--sol-color-primary, #2563EB) 7%, transparent);--sol-table-cell-border: var(--sol-border-color-default, #E2E8F0);--sol-table-hover: color-mix(in srgb, var(--sol-color-text-primary, #0F172A) 6%, transparent)}.sol-data-table[data-variant] .sol-data-table__th{background:var(--sol-table-header-bg);color:var(--sol-color-text-secondary, #475569);font-size:var(--sol-font-size-sm, 12px);border-bottom:var(--sol-border-width-default, 1px) solid var(--sol-table-cell-border)}.sol-data-table[data-variant] .sol-data-table__tr{border-bottom:var(--sol-border-width-default, 1px) solid var(--sol-table-cell-border)}.sol-data-table[data-variant]:not([data-variant=clean]) .sol-data-table__table>tbody>.sol-data-table__tr:nth-of-type(odd){background:var(--sol-table-zebra)}.sol-data-table[data-variant=banded] .sol-data-table__table>tbody>.sol-data-table__tr:nth-of-type(3n){background:var(--sol-table-band)}.sol-data-table[data-variant][data-variant] .sol-data-table__table>tbody>.sol-data-table__tr:hover{background:var(--sol-table-hover)}.sol-data-table[data-variant=bordered] .sol-data-table__table{border:var(--sol-border-width-default, 1px) solid var(--sol-table-cell-border)}.sol-data-table[data-variant=bordered] .sol-data-table__th,.sol-data-table[data-variant=bordered] .sol-data-table__td,.sol-data-table[data-variant=bordered] .sol-data-table__table .sol-data-table__tr:last-child>.sol-data-table__td{border:var(--sol-border-width-default, 1px) solid var(--sol-table-cell-border)}.sol-data-table[data-variant=emphasis-header] .sol-data-table__th{background:var(--sol-table-header-strong-bg);color:var(--sol-color-primary, #2563EB)}.sol-data-table__cards{list-style:none;margin:0;padding:0}.sol-data-table__card{border-bottom:1px solid var(--sol-border-color-default, #E2E8F0)}.sol-data-table__card:last-child{border-bottom:none}.sol-data-table__card-head{display:flex;align-items:center;gap:10px;width:100%;min-width:0;padding:12px;border:none;background:transparent;font:inherit;text-align:left;color:var(--sol-color-text-primary, #0F172A);cursor:pointer;box-sizing:border-box}.sol-data-table__card-chevron{flex-shrink:0;color:var(--sol-color-text-muted, #94A3B8);transition:transform var(--sol-dur-fast, .12s) var(--sol-ease, ease)}.sol-data-table__card-chevron--open{transform:rotate(90deg)}.sol-data-table__card-main{flex:1;min-width:0;display:flex;flex-direction:column;gap:2px}.sol-data-table__card-title{font-size:var(--sol-font-size-sm, 13px);font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.sol-data-table__card-sub{font-size:var(--sol-font-size-sm, 12px);color:var(--sol-color-text-muted, #64748B);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.sol-data-table__card-chip{flex-shrink:0;max-width:40%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:2px 10px;border-radius:var(--sol-border-radius-full, 9999px);font-size:11px;font-weight:600;color:var(--sol-color-primary, #2563EB);background:color-mix(in srgb,var(--sol-color-primary, #2563EB) 12%,transparent)}.sol-data-table__card-details{padding:0 12px 12px 34px;animation:sol-data-table-reveal var(--sol-dur-base, .24s) var(--sol-ease-entrance, ease-out) backwards}@keyframes sol-data-table-reveal{0%{opacity:0;transform:translateY(4px)}to{opacity:1;transform:translateY(0)}}.sol-data-table__card-kv-list{margin:0;display:flex;flex-direction:column;gap:6px}.sol-data-table__card-kv{display:flex;gap:8px;align-items:baseline;min-width:0}.sol-data-table__card-kv dt{flex-shrink:0;font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:.05em;color:var(--sol-color-text-muted, #64748B)}.sol-data-table__card-kv dd{margin:0;min-width:0;font-size:var(--sol-font-size-sm, 13px);color:var(--sol-color-text-primary, #0F172A);overflow-wrap:anywhere}.sol-data-table__card-actions{display:flex;justify-content:flex-end;gap:4px;margin-top:10px}@media(max-width:767px){.sol-data-table__toolbar{flex-wrap:wrap}.sol-data-table__toolbar-right{flex:1;min-width:0;max-width:none}}\n"] }]
|
|
9717
|
+
}], propDecorators: { data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: false }] }], columns: [{ type: i0.Input, args: [{ isSignal: true, alias: "columns", required: false }] }], loading: [{ type: i0.Input, args: [{ isSignal: true, alias: "loading", required: false }] }], searchPlaceholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "searchPlaceholder", required: false }] }], emptyMessage: [{ type: i0.Input, args: [{ isSignal: true, alias: "emptyMessage", required: false }] }], paginated: [{ type: i0.Input, args: [{ isSignal: true, alias: "paginated", required: false }] }], showToolbar: [{ type: i0.Input, args: [{ isSignal: true, alias: "showToolbar", required: false }] }], filterPosition: [{ type: i0.Input, args: [{ isSignal: true, alias: "filterPosition", required: false }] }], showActions: [{ type: i0.Input, args: [{ isSignal: true, alias: "showActions", required: false }] }], showEditAction: [{ type: i0.Input, args: [{ isSignal: true, alias: "showEditAction", required: false }] }], showDeleteAction: [{ type: i0.Input, args: [{ isSignal: true, alias: "showDeleteAction", required: false }] }], trackByKey: [{ type: i0.Input, args: [{ isSignal: true, alias: "trackByKey", required: false }] }], actionsLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "actionsLabel", required: false }] }], actionsPosition: [{ type: i0.Input, args: [{ isSignal: true, alias: "actionsPosition", required: false }] }], toggleDetailsLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "toggleDetailsLabel", required: false }] }], rowReveal: [{ type: i0.Input, args: [{ isSignal: true, alias: "rowReveal", required: false }] }], collapseWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "collapseWidth", required: false }] }], variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], editClicked: [{ type: i0.Output, args: ["editClicked"] }], deleteClicked: [{ type: i0.Output, args: ["deleteClicked"] }], rowActionsTemplate: [{ type: i0.ContentChild, args: ['rowActions', { isSignal: true }] }] } });
|
|
9276
9718
|
/**
|
|
9277
9719
|
* "Estira" una señal de carga a un tiempo mínimo visible (patrón anti-flash).
|
|
9278
9720
|
* Con un backend rápido `loading` pasa a `false` en pocos ms y el skeleton
|
|
@@ -9314,29 +9756,49 @@ function stretchLoading(source, minMs = 450) {
|
|
|
9314
9756
|
destroyRef.onDestroy(clear);
|
|
9315
9757
|
return computed(() => visible());
|
|
9316
9758
|
}
|
|
9317
|
-
/**
|
|
9759
|
+
/** Breakpoint canónico usado SOLO como valor inicial anti-flicker (ver abajo). */
|
|
9318
9760
|
const MOBILE_MEDIA_QUERY$1 = '(max-width: 767px)';
|
|
9319
9761
|
/**
|
|
9320
|
-
* Señal booleana reactiva al
|
|
9321
|
-
*
|
|
9322
|
-
*
|
|
9323
|
-
* (
|
|
9762
|
+
* Señal booleana reactiva al ancho del elemento HOST (0.6.0) — fuente de
|
|
9763
|
+
* verdad del colapso a cards vía `ResizeObserver`. Reemplaza el criterio
|
|
9764
|
+
* anterior (`matchMedia` sobre el VIEWPORT del navegador): true cuando el
|
|
9765
|
+
* ancho medido del host es <= `collapseWidth()`. Así una tabla dentro de un
|
|
9766
|
+
* contenedor angosto (sidebar, grid a dos columnas) colapsa aunque la
|
|
9767
|
+
* ventana siga en ancho desktop.
|
|
9768
|
+
*
|
|
9769
|
+
* `matchMedia` contra el breakpoint canónico 767px se conserva SOLO como
|
|
9770
|
+
* valor inicial (anti-flicker) hasta que llega la primera medición real del
|
|
9771
|
+
* observer — nunca se vuelve a consultar después de eso.
|
|
9772
|
+
*
|
|
9773
|
+
* Debe invocarse en contexto de inyección (inicializador de campo): usa
|
|
9774
|
+
* `DestroyRef` para desconectar el observer al destruir el componente.
|
|
9775
|
+
* Guarda para jsdom/SSR: sin `ResizeObserver` queda fija en el valor
|
|
9776
|
+
* inicial (mismo criterio que el resto de la lib usa para ese entorno).
|
|
9324
9777
|
*/
|
|
9325
|
-
function
|
|
9778
|
+
function observeContainerWidth(host, collapseWidth) {
|
|
9326
9779
|
const destroyRef = inject(DestroyRef);
|
|
9327
|
-
const
|
|
9328
|
-
|
|
9329
|
-
|
|
9330
|
-
|
|
9331
|
-
}
|
|
9332
|
-
const
|
|
9333
|
-
|
|
9334
|
-
|
|
9335
|
-
|
|
9336
|
-
|
|
9337
|
-
|
|
9338
|
-
|
|
9339
|
-
|
|
9780
|
+
const initial = typeof window !== 'undefined' && typeof window.matchMedia === 'function'
|
|
9781
|
+
? window.matchMedia(MOBILE_MEDIA_QUERY$1).matches
|
|
9782
|
+
: false;
|
|
9783
|
+
const hostWidth = signal(null, /* @ts-ignore */
|
|
9784
|
+
...(ngDevMode ? [{ debugName: "hostWidth" }] : /* istanbul ignore next */ []));
|
|
9785
|
+
const narrow = computed(() => {
|
|
9786
|
+
const width = hostWidth();
|
|
9787
|
+
return width === null ? initial : width <= collapseWidth();
|
|
9788
|
+
}, /* @ts-ignore */
|
|
9789
|
+
...(ngDevMode ? [{ debugName: "narrow" }] : /* istanbul ignore next */ []));
|
|
9790
|
+
if (typeof ResizeObserver === 'undefined') {
|
|
9791
|
+
return narrow;
|
|
9792
|
+
}
|
|
9793
|
+
const observer = new ResizeObserver((entries) => {
|
|
9794
|
+
const entry = entries[0];
|
|
9795
|
+
if (entry) {
|
|
9796
|
+
hostWidth.set(entry.contentRect.width);
|
|
9797
|
+
}
|
|
9798
|
+
});
|
|
9799
|
+
observer.observe(host.nativeElement);
|
|
9800
|
+
destroyRef.onDestroy(() => observer.disconnect());
|
|
9801
|
+
return narrow;
|
|
9340
9802
|
}
|
|
9341
9803
|
|
|
9342
9804
|
const PALETTE_SIZE = 8;
|
|
@@ -9441,7 +9903,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
9441
9903
|
}], propDecorators: { name: [{ type: i0.Input, args: [{ isSignal: true, alias: "name", required: true }] }], imageUrl: [{ type: i0.Input, args: [{ isSignal: true, alias: "imageUrl", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }] } });
|
|
9442
9904
|
|
|
9443
9905
|
/** Escala de calificación: 5 estrellas, como la de Google. */
|
|
9444
|
-
const MAX_STARS = 5;
|
|
9906
|
+
const MAX_STARS$1 = 5;
|
|
9445
9907
|
/**
|
|
9446
9908
|
* `sol-star-rating` — calificación de 1 a 5 en estrellas, de solo lectura.
|
|
9447
9909
|
*
|
|
@@ -9469,16 +9931,16 @@ class SolStarRatingComponent {
|
|
|
9469
9931
|
showValue = input(false, /* @ts-ignore */
|
|
9470
9932
|
...(ngDevMode ? [{ debugName: "showValue" }] : /* istanbul ignore next */ []));
|
|
9471
9933
|
/** Índices para el `@for`: siempre son 5 estrellas. */
|
|
9472
|
-
stars = Array.from({ length: MAX_STARS }, (_, i) => i);
|
|
9934
|
+
stars = Array.from({ length: MAX_STARS$1 }, (_, i) => i);
|
|
9473
9935
|
/** Valor recortado al rango válido: un dato raro no rompe el ancho. */
|
|
9474
9936
|
safeValue = computed(() => {
|
|
9475
9937
|
const raw = this.value();
|
|
9476
9938
|
if (raw === null || !Number.isFinite(raw))
|
|
9477
9939
|
return 0;
|
|
9478
|
-
return Math.min(Math.max(raw, 0), MAX_STARS);
|
|
9940
|
+
return Math.min(Math.max(raw, 0), MAX_STARS$1);
|
|
9479
9941
|
}, /* @ts-ignore */
|
|
9480
9942
|
...(ngDevMode ? [{ debugName: "safeValue" }] : /* istanbul ignore next */ []));
|
|
9481
|
-
filledPercent = computed(() => (this.safeValue() / MAX_STARS) * 100, /* @ts-ignore */
|
|
9943
|
+
filledPercent = computed(() => (this.safeValue() / MAX_STARS$1) * 100, /* @ts-ignore */
|
|
9482
9944
|
...(ngDevMode ? [{ debugName: "filledPercent" }] : /* istanbul ignore next */ []));
|
|
9483
9945
|
/** Un decimal y coma decimal, como se escribe en español. */
|
|
9484
9946
|
formattedValue = computed(() => this.safeValue().toFixed(1).replace('.', ','), /* @ts-ignore */
|
|
@@ -9487,13 +9949,13 @@ class SolStarRatingComponent {
|
|
|
9487
9949
|
const rating = this.formattedValue();
|
|
9488
9950
|
const translated = this.i18n.translate('shared.starRating.label', {
|
|
9489
9951
|
rating,
|
|
9490
|
-
max: MAX_STARS,
|
|
9952
|
+
max: MAX_STARS$1,
|
|
9491
9953
|
});
|
|
9492
9954
|
// El contrato de `SolI18n` devuelve la clave misma cuando falta, así que
|
|
9493
9955
|
// ese caso se detecta y se cae a un texto propio en vez de anunciarle la
|
|
9494
9956
|
// clave cruda a un lector de pantalla.
|
|
9495
9957
|
return translated === 'shared.starRating.label'
|
|
9496
|
-
? `${rating} de ${MAX_STARS}`
|
|
9958
|
+
? `${rating} de ${MAX_STARS$1}`
|
|
9497
9959
|
: translated;
|
|
9498
9960
|
}, /* @ts-ignore */
|
|
9499
9961
|
...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
@@ -9545,84 +10007,531 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
9545
10007
|
`, styles: [":host{display:inline-flex}.sol-star-rating{display:inline-flex;align-items:center;gap:var(--sol-space-xs, .25rem)}.sol-star-rating__stars{position:relative;display:inline-flex;flex:none}.sol-star-rating__stars sol-icon{color:var(--sol-color-warning)}.sol-star-rating__empty{opacity:.35}.sol-star-rating__filled{position:absolute;inset-block:0;inset-inline-start:0;display:inline-flex;overflow:hidden;pointer-events:none}.sol-star-rating__value{font-weight:var(--sol-font-weight-bold, 600);color:var(--sol-color-text-primary)}\n"] }]
|
|
9546
10008
|
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], showValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "showValue", required: false }] }] } });
|
|
9547
10009
|
|
|
9548
|
-
/**
|
|
9549
|
-
const
|
|
9550
|
-
success: 'var(--sol-color-success, #10b981)',
|
|
9551
|
-
warning: 'var(--sol-color-warning, #f59e0b)',
|
|
9552
|
-
danger: 'var(--sol-color-danger, #ef4444)',
|
|
9553
|
-
info: 'var(--sol-color-info, #3b82f6)',
|
|
9554
|
-
neutral: 'var(--sol-color-text-muted, #94a3b8)',
|
|
9555
|
-
};
|
|
9556
|
-
|
|
9557
|
-
/** Default del spec: éxito ≥80, advertencia ≥50, peligro <50. */
|
|
9558
|
-
const DEFAULT_SCORE_THRESHOLDS = [
|
|
9559
|
-
{ upTo: 50, tone: 'danger' },
|
|
9560
|
-
{ upTo: 80, tone: 'warning' },
|
|
9561
|
-
{ upTo: Infinity, tone: 'success' },
|
|
9562
|
-
];
|
|
9563
|
-
/**
|
|
9564
|
-
* Resuelve el tono de `score` contra `thresholds` (ordenados ascendente por
|
|
9565
|
-
* `upTo`): el primero cuyo `upTo` sea mayor que `score` gana; si ninguno lo
|
|
9566
|
-
* es, se usa el tono del último umbral. PURA — sin dependencias de Angular.
|
|
9567
|
-
*/
|
|
9568
|
-
function resolveScoreTone(score, thresholds) {
|
|
9569
|
-
const sorted = [...thresholds].sort((a, b) => a.upTo - b.upTo);
|
|
9570
|
-
const match = sorted.find((t) => score < t.upTo);
|
|
9571
|
-
return match?.tone ?? sorted[sorted.length - 1]?.tone ?? 'neutral';
|
|
9572
|
-
}
|
|
10010
|
+
/** Escala de calificación: 5 estrellas, la misma de `sol-star-rating`. */
|
|
10011
|
+
const MAX_STARS = 5;
|
|
9573
10012
|
/**
|
|
9574
|
-
* `sol-
|
|
9575
|
-
* configurables (spec: solercia-ui-vocero-atoms). Genérico: no sabe si el
|
|
9576
|
-
* puntaje viene de un lead, una corrida del laboratorio o cualquier otra
|
|
9577
|
-
* métrica — eso lo decide el consumidor vía `[value]`/`[thresholds]`.
|
|
10013
|
+
* `sol-rating-input` — calificación INTERACTIVA de 1 a 5 estrellas.
|
|
9578
10014
|
*
|
|
9579
|
-
*
|
|
9580
|
-
*
|
|
9581
|
-
*
|
|
9582
|
-
*
|
|
10015
|
+
* ## Por qué es un componente aparte de `sol-star-rating`
|
|
10016
|
+
*
|
|
10017
|
+
* `sol-star-rating` es de SOLO LECTURA: su contenedor es un `role="img"` con
|
|
10018
|
+
* el valor en el `aria-label` y sus estrellas son `aria-hidden`. Un lector de
|
|
10019
|
+
* pantalla anuncia «4,3 de 5» de un tirón, como quien lee una imagen.
|
|
10020
|
+
*
|
|
10021
|
+
* Este componente es un GRUPO DE OPCIONES: `role="radiogroup"` con cinco
|
|
10022
|
+
* `role="radio"`, `aria-checked` por estrella, navegación por teclado y una
|
|
10023
|
+
* sola parada de tabulación. Son dos contratos de accesibilidad distintos —
|
|
10024
|
+
* mostrar un valor y capturarlo no son el mismo widget. Unirlos detrás de una
|
|
10025
|
+
* bandera `interactive` obligaría a alternar rol, foco, tabindex y semántica
|
|
10026
|
+
* de cada estrella dentro de una misma clase, y ninguno de los dos modos
|
|
10027
|
+
* quedaría bien. Por eso `sol-star-rating` NO se modificó.
|
|
10028
|
+
*
|
|
10029
|
+
* ## Sin valor por defecto (decisión deliberada)
|
|
10030
|
+
*
|
|
10031
|
+
* El principio de «smart defaults» dice que pre-seleccionar lo probable ahorra
|
|
10032
|
+
* decisiones. Este es exactamente el caso donde ese principio NO aplica: su
|
|
10033
|
+
* límite ético es que el default debe servir a quien responde, no a quien
|
|
10034
|
+
* pregunta. Una calificación pre-marcada ancla la respuesta (sesgo de anclaje)
|
|
10035
|
+
* y le sirve al negocio, no a la clienta: si arranca en 5, la respuesta media
|
|
10036
|
+
* sube sin que nadie lo haya decidido, y el dato deja de medir la experiencia.
|
|
10037
|
+
*
|
|
10038
|
+
* Por eso `value` arranca en `null` y las cinco estrellas nacen vacías, con
|
|
10039
|
+
* ninguna `aria-checked="true"` — un radiogroup sin opción marcada es
|
|
10040
|
+
* perfectamente válido en ARIA. `writeValue(null)` vuelve a ese estado.
|
|
10041
|
+
*
|
|
10042
|
+
* ## Teclado (patrón radiogroup de WAI-ARIA)
|
|
10043
|
+
*
|
|
10044
|
+
* - `Tab` entra al grupo una sola vez: cae en la estrella marcada, o en la
|
|
10045
|
+
* primera cuando todavía no hay calificación (roving tabindex).
|
|
10046
|
+
* - `←`/`↑` y `→`/`↓` mueven el foco y marcan la estrella que reciben — es el
|
|
10047
|
+
* comportamiento estándar de un grupo de radios. Los extremos no dan la
|
|
10048
|
+
* vuelta: `←` sobre la primera la marca (así la estrella 1 siempre es
|
|
10049
|
+
* alcanzable sin ratón).
|
|
10050
|
+
* - `Inicio`/`Fin` saltan a la primera/última y la marcan.
|
|
10051
|
+
* - `Espacio` marca la estrella enfocada — útil al entrar al grupo vacío sin
|
|
10052
|
+
* haber movido el foco.
|
|
10053
|
+
* - `Suprimir`/`Retroceso` limpian la selección cuando `allowClear` está
|
|
10054
|
+
* activo.
|
|
10055
|
+
*
|
|
10056
|
+
* ## Estados
|
|
10057
|
+
*
|
|
10058
|
+
* - **normal**: interactivo.
|
|
10059
|
+
* - **`disabled`**: no se puede usar ni enfocar (`aria-disabled` en el grupo).
|
|
10060
|
+
* Lo activa el input homónimo o un `control.disable()` del formulario.
|
|
10061
|
+
* - **`readOnly`**: el valor está congelado pero se lee con contraste pleno y
|
|
10062
|
+
* sigue siendo enfocable (`aria-readonly`). Distinto de `disabled` a
|
|
10063
|
+
* propósito: «esto ya no se cambia» no es lo mismo que «esto no es para ti».
|
|
10064
|
+
* - **`error`**: mensaje visible (mismo contrato de `sol-input`: un texto, no
|
|
10065
|
+
* un booleano), `aria-invalid` y `aria-describedby` sobre el grupo.
|
|
10066
|
+
*
|
|
10067
|
+
* La vista previa al pasar el ratón pinta las estrellas pero NUNCA toca
|
|
10068
|
+
* `value` ni `aria-checked`: al salir el puntero vuelve lo elegido, así que
|
|
10069
|
+
* pasar por encima jamás pierde la respuesta de la clienta.
|
|
10070
|
+
*
|
|
10071
|
+
* Objetivo táctil: cada estrella reserva un área real de 44×44 px (ley de
|
|
10072
|
+
* Fitts) porque se usa desde el celular; por eso el tamaño por defecto es
|
|
10073
|
+
* `lg` y no el `sm` del componente de solo lectura.
|
|
10074
|
+
*
|
|
10075
|
+
* ```html
|
|
10076
|
+
* <sol-rating-input
|
|
10077
|
+
* formControlName="calificacion"
|
|
10078
|
+
* ariaLabelKey="pages.appointment.rateVisit"
|
|
10079
|
+
* [allowClear]="true"
|
|
10080
|
+
* [error]="form.controls.calificacion.touched && form.controls.calificacion.invalid
|
|
10081
|
+
* ? ('pages.appointment.rateRequired' | transloco) : ''"
|
|
10082
|
+
* (ratingChanged)="registrar($event)"
|
|
10083
|
+
* />
|
|
10084
|
+
* ```
|
|
9583
10085
|
*/
|
|
9584
|
-
class
|
|
10086
|
+
class SolRatingInputComponent {
|
|
9585
10087
|
i18n = inject(SOL_I18N);
|
|
9586
|
-
/**
|
|
9587
|
-
|
|
10088
|
+
/** Botones de estrella renderizados, en el mismo orden que `stars`. */
|
|
10089
|
+
starRefs = viewChildren('starRef', /* @ts-ignore */
|
|
10090
|
+
...(ngDevMode ? [{ debugName: "starRefs" }] : /* istanbul ignore next */ []));
|
|
10091
|
+
static nextId = 0;
|
|
10092
|
+
/** Id del mensaje de error, referenciado por `aria-describedby` del grupo. */
|
|
10093
|
+
errorId = `sol-rating-input-error-${SolRatingInputComponent.nextId++}`;
|
|
10094
|
+
/** Tamaño de las estrellas. Hereda la escala de `sol-icon`. */
|
|
10095
|
+
size = input('lg', /* @ts-ignore */
|
|
10096
|
+
...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
10097
|
+
/** Bloquea el control por completo: ni se usa ni se enfoca. */
|
|
10098
|
+
disabled = input(false, /* @ts-ignore */
|
|
10099
|
+
...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
10100
|
+
/** Congela el valor conservando contraste y foco (`aria-readonly`). */
|
|
10101
|
+
readOnly = input(false, /* @ts-ignore */
|
|
10102
|
+
...(ngDevMode ? [{ debugName: "readOnly" }] : /* istanbul ignore next */ []));
|
|
10103
|
+
/** Mensaje de error visible. Cadena vacía = sin error (contrato de `sol-input`). */
|
|
10104
|
+
error = input('', /* @ts-ignore */
|
|
10105
|
+
...(ngDevMode ? [{ debugName: "error" }] : /* istanbul ignore next */ []));
|
|
10106
|
+
/** Habilita quitar la calificación ya dada (botón visible + Suprimir/Retroceso). */
|
|
10107
|
+
allowClear = input(false, /* @ts-ignore */
|
|
10108
|
+
...(ngDevMode ? [{ debugName: "allowClear" }] : /* istanbul ignore next */ []));
|
|
10109
|
+
/** Clave i18n del nombre accesible del grupo. */
|
|
10110
|
+
ariaLabelKey = input('shared.ratingInput.groupLabel', /* @ts-ignore */
|
|
10111
|
+
...(ngDevMode ? [{ debugName: "ariaLabelKey" }] : /* istanbul ignore next */ []));
|
|
10112
|
+
/** Clave i18n del nombre accesible de cada estrella (recibe `value` y `max`). */
|
|
10113
|
+
optionLabelKey = input('shared.ratingInput.option', /* @ts-ignore */
|
|
10114
|
+
...(ngDevMode ? [{ debugName: "optionLabelKey" }] : /* istanbul ignore next */ []));
|
|
10115
|
+
/** Clave i18n del botón que quita la calificación. */
|
|
10116
|
+
clearLabelKey = input('shared.ratingInput.clear', /* @ts-ignore */
|
|
10117
|
+
...(ngDevMode ? [{ debugName: "clearLabelKey" }] : /* istanbul ignore next */ []));
|
|
10118
|
+
/** Emite la calificación elegida, o `null` cuando se limpia. */
|
|
10119
|
+
ratingChanged = output();
|
|
10120
|
+
/**
|
|
10121
|
+
* Calificación actual. `null` = sin responder — el estado inicial, a
|
|
10122
|
+
* propósito (ver el JSDoc de la clase).
|
|
10123
|
+
*/
|
|
10124
|
+
value = signal(null, /* @ts-ignore */
|
|
9588
10125
|
...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
9589
|
-
/**
|
|
9590
|
-
|
|
9591
|
-
...(ngDevMode ? [{ debugName: "
|
|
9592
|
-
|
|
9593
|
-
|
|
9594
|
-
|
|
9595
|
-
|
|
9596
|
-
|
|
10126
|
+
/** Estrella bajo el puntero. Solo pinta: nunca cambia `value`. */
|
|
10127
|
+
previewValue = signal(null, /* @ts-ignore */
|
|
10128
|
+
...(ngDevMode ? [{ debugName: "previewValue" }] : /* istanbul ignore next */ []));
|
|
10129
|
+
/** Última estrella enfocada; manda sobre `value` para el roving tabindex. */
|
|
10130
|
+
focusedIndex = signal(null, /* @ts-ignore */
|
|
10131
|
+
...(ngDevMode ? [{ debugName: "focusedIndex" }] : /* istanbul ignore next */ []));
|
|
10132
|
+
/** Valores del `@for`: las 5 estrellas, de 1 a 5. */
|
|
10133
|
+
stars = Array.from({ length: MAX_STARS }, (_, i) => i + 1);
|
|
9597
10134
|
/**
|
|
9598
|
-
*
|
|
9599
|
-
*
|
|
9600
|
-
* `parseFloat` fallido). Sin esta guarda, `NaN < umbral` es SIEMPRE `false`
|
|
9601
|
-
* y `resolveScoreTone` cae al último tono ("éxito") mostrando una insignia
|
|
9602
|
-
* verde con el texto literal "NaN".
|
|
10135
|
+
* Deshabilitado desde el formulario (`control.disable()`), independiente del
|
|
10136
|
+
* input `disabled`.
|
|
9603
10137
|
*/
|
|
9604
|
-
|
|
9605
|
-
|
|
9606
|
-
|
|
9607
|
-
|
|
9608
|
-
|
|
9609
|
-
|
|
9610
|
-
|
|
9611
|
-
|
|
9612
|
-
|
|
9613
|
-
|
|
9614
|
-
|
|
9615
|
-
|
|
9616
|
-
}
|
|
9617
|
-
|
|
9618
|
-
|
|
9619
|
-
|
|
9620
|
-
|
|
9621
|
-
|
|
10138
|
+
formDisabled = signal(false, /* @ts-ignore */
|
|
10139
|
+
...(ngDevMode ? [{ debugName: "formDisabled" }] : /* istanbul ignore next */ []));
|
|
10140
|
+
/**
|
|
10141
|
+
* Deshabilitado efectivo: el input del consumidor O el estado del formulario.
|
|
10142
|
+
*
|
|
10143
|
+
* Diverge a propósito de los controles más viejos de la librería
|
|
10144
|
+
* (`sol-select`, `sol-number-input`), que dejan `setDisabledState` vacío y
|
|
10145
|
+
* solo miran su input: con `[formControl]`, un `control.disable()` los deja
|
|
10146
|
+
* plenamente usables. Aquí el formulario SÍ manda, que es lo que un
|
|
10147
|
+
* `ControlValueAccessor` promete.
|
|
10148
|
+
*/
|
|
10149
|
+
isDisabled = computed(() => this.disabled() || this.formDisabled(), /* @ts-ignore */
|
|
10150
|
+
...(ngDevMode ? [{ debugName: "isDisabled" }] : /* istanbul ignore next */ []));
|
|
10151
|
+
/** `true` cuando el control admite cambios (ni deshabilitado ni de solo lectura). */
|
|
10152
|
+
interactive = computed(() => !this.isDisabled() && !this.readOnly(), /* @ts-ignore */
|
|
10153
|
+
...(ngDevMode ? [{ debugName: "interactive" }] : /* istanbul ignore next */ []));
|
|
10154
|
+
/** El botón de limpiar solo existe si hay algo que limpiar y se puede. */
|
|
10155
|
+
canClear = computed(() => this.allowClear() && this.value() !== null && this.interactive(), /* @ts-ignore */
|
|
10156
|
+
...(ngDevMode ? [{ debugName: "canClear" }] : /* istanbul ignore next */ []));
|
|
10157
|
+
/**
|
|
10158
|
+
* Índice (base 0) de la única estrella que participa del orden de tabulación:
|
|
10159
|
+
* la enfocada por última vez, si no la marcada, y si tampoco hay, la primera.
|
|
10160
|
+
* Nunca depende de la vista previa del ratón.
|
|
10161
|
+
*/
|
|
10162
|
+
rovingIndex = computed(() => {
|
|
10163
|
+
const focused = this.focusedIndex();
|
|
10164
|
+
if (focused !== null)
|
|
10165
|
+
return focused;
|
|
10166
|
+
const current = this.value();
|
|
10167
|
+
return current !== null ? current - 1 : 0;
|
|
9622
10168
|
}, /* @ts-ignore */
|
|
9623
|
-
...(ngDevMode ? [{ debugName: "
|
|
9624
|
-
|
|
9625
|
-
|
|
10169
|
+
...(ngDevMode ? [{ debugName: "rovingIndex" }] : /* istanbul ignore next */ []));
|
|
10170
|
+
groupLabel = computed(() => this.text(this.ariaLabelKey(), 'Calificación de 1 a 5 estrellas'), /* @ts-ignore */
|
|
10171
|
+
...(ngDevMode ? [{ debugName: "groupLabel" }] : /* istanbul ignore next */ []));
|
|
10172
|
+
clearLabel = computed(() => this.text(this.clearLabelKey(), 'Quitar la calificación'), /* @ts-ignore */
|
|
10173
|
+
...(ngDevMode ? [{ debugName: "clearLabel" }] : /* istanbul ignore next */ []));
|
|
10174
|
+
onChange = () => { };
|
|
10175
|
+
onTouched = () => { };
|
|
10176
|
+
/** `aria-checked` de la estrella: mira SOLO el valor, jamás la vista previa. */
|
|
10177
|
+
isChecked(star) {
|
|
10178
|
+
return this.value() === star;
|
|
10179
|
+
}
|
|
10180
|
+
/** Pintado: la vista previa manda sobre el valor mientras el puntero esté encima. */
|
|
10181
|
+
isFilled(star) {
|
|
10182
|
+
const reference = this.previewValue() ?? this.value();
|
|
10183
|
+
return reference !== null && star <= reference;
|
|
10184
|
+
}
|
|
10185
|
+
tabIndexFor(star) {
|
|
10186
|
+
return star - 1 === this.rovingIndex() ? 0 : -1;
|
|
10187
|
+
}
|
|
10188
|
+
optionLabel(star) {
|
|
10189
|
+
return this.text(this.optionLabelKey(), `${star} de ${MAX_STARS}`, {
|
|
10190
|
+
value: star,
|
|
10191
|
+
max: MAX_STARS,
|
|
10192
|
+
});
|
|
10193
|
+
}
|
|
10194
|
+
onStarFocus(star) {
|
|
10195
|
+
this.focusedIndex.set(star - 1);
|
|
10196
|
+
}
|
|
10197
|
+
preview(star) {
|
|
10198
|
+
if (!this.interactive())
|
|
10199
|
+
return;
|
|
10200
|
+
this.previewValue.set(star);
|
|
10201
|
+
}
|
|
10202
|
+
clearPreview() {
|
|
10203
|
+
this.previewValue.set(null);
|
|
10204
|
+
}
|
|
10205
|
+
markTouched() {
|
|
10206
|
+
this.onTouched();
|
|
10207
|
+
}
|
|
10208
|
+
/**
|
|
10209
|
+
* Marca una estrella. Reemite solo si el valor cambió de verdad.
|
|
10210
|
+
*
|
|
10211
|
+
* Normaliza la entrada (`1..5`) antes de tocar nada: la plantilla nunca
|
|
10212
|
+
* manda un valor fuera de escala, pero este método es público y un consumidor
|
|
10213
|
+
* podría llamarlo con cualquier número — una calificación de 9 rompería el
|
|
10214
|
+
* `aria-checked` de las cinco estrellas.
|
|
10215
|
+
*/
|
|
10216
|
+
select(star) {
|
|
10217
|
+
if (!this.interactive())
|
|
10218
|
+
return;
|
|
10219
|
+
const next = normalizeRating(star);
|
|
10220
|
+
if (next === null)
|
|
10221
|
+
return;
|
|
10222
|
+
this.focusedIndex.set(next - 1);
|
|
10223
|
+
if (this.value() === next)
|
|
10224
|
+
return;
|
|
10225
|
+
this.value.set(next);
|
|
10226
|
+
this.onChange(next);
|
|
10227
|
+
this.ratingChanged.emit(next);
|
|
10228
|
+
this.onTouched();
|
|
10229
|
+
}
|
|
10230
|
+
/** Vuelve al estado «sin responder». Requiere `allowClear`. */
|
|
10231
|
+
clear() {
|
|
10232
|
+
if (!this.interactive() || !this.allowClear())
|
|
10233
|
+
return;
|
|
10234
|
+
if (this.value() === null)
|
|
10235
|
+
return;
|
|
10236
|
+
this.value.set(null);
|
|
10237
|
+
this.previewValue.set(null);
|
|
10238
|
+
this.onChange(null);
|
|
10239
|
+
this.ratingChanged.emit(null);
|
|
10240
|
+
this.onTouched();
|
|
10241
|
+
}
|
|
10242
|
+
onKeydown(event) {
|
|
10243
|
+
if (!this.interactive())
|
|
10244
|
+
return;
|
|
10245
|
+
if (event.key === 'Delete' || event.key === 'Backspace') {
|
|
10246
|
+
if (!this.allowClear() || this.value() === null)
|
|
10247
|
+
return;
|
|
10248
|
+
event.preventDefault();
|
|
10249
|
+
this.clear();
|
|
10250
|
+
return;
|
|
10251
|
+
}
|
|
10252
|
+
if (event.key === ' ' || event.key === 'Spacebar') {
|
|
10253
|
+
event.preventDefault();
|
|
10254
|
+
this.select(this.rovingIndex() + 1);
|
|
10255
|
+
return;
|
|
10256
|
+
}
|
|
10257
|
+
const forward = event.key === 'ArrowRight' || event.key === 'ArrowDown';
|
|
10258
|
+
const backward = event.key === 'ArrowLeft' || event.key === 'ArrowUp';
|
|
10259
|
+
const home = event.key === 'Home';
|
|
10260
|
+
const end = event.key === 'End';
|
|
10261
|
+
if (!forward && !backward && !home && !end)
|
|
10262
|
+
return;
|
|
10263
|
+
event.preventDefault();
|
|
10264
|
+
const current = this.rovingIndex();
|
|
10265
|
+
let next;
|
|
10266
|
+
if (home)
|
|
10267
|
+
next = 0;
|
|
10268
|
+
else if (end)
|
|
10269
|
+
next = MAX_STARS - 1;
|
|
10270
|
+
// Sin vuelta en los extremos: `←` sobre la primera la deja ahí y la marca,
|
|
10271
|
+
// que es la única forma de elegir "1" con teclado desde el grupo vacío.
|
|
10272
|
+
else if (forward)
|
|
10273
|
+
next = Math.min(current + 1, MAX_STARS - 1);
|
|
10274
|
+
else
|
|
10275
|
+
next = Math.max(current - 1, 0);
|
|
10276
|
+
this.select(next + 1);
|
|
10277
|
+
this.focusStar(next);
|
|
10278
|
+
}
|
|
10279
|
+
/**
|
|
10280
|
+
* Mueve el foco a la estrella `index` (base 0) por referencia de plantilla,
|
|
10281
|
+
* sin depender de selectores CSS internos — mismo criterio que `sol-chip-group`.
|
|
10282
|
+
*/
|
|
10283
|
+
focusStar(index) {
|
|
10284
|
+
this.starRefs()[index]?.nativeElement.focus();
|
|
10285
|
+
}
|
|
10286
|
+
/**
|
|
10287
|
+
* Resuelve un texto por i18n con respaldo es-CO propio.
|
|
10288
|
+
*
|
|
10289
|
+
* El contrato `SolI18n` devuelve la CLAVE cuando falta la traducción, así que
|
|
10290
|
+
* ese caso se detecta y se cae al texto de la casa en vez de anunciarle la
|
|
10291
|
+
* clave cruda a un lector de pantalla — mismo criterio de `sol-star-rating`.
|
|
10292
|
+
*/
|
|
10293
|
+
text(key, fallback, params) {
|
|
10294
|
+
this.i18n.activeLang();
|
|
10295
|
+
const translated = this.i18n.translate(key, params);
|
|
10296
|
+
return translated && translated !== key ? translated : fallback;
|
|
10297
|
+
}
|
|
10298
|
+
// ── ControlValueAccessor ──
|
|
10299
|
+
/**
|
|
10300
|
+
* Normaliza lo que llegue del formulario a `1..5` o `null`. Un `0`, un `NaN`
|
|
10301
|
+
* o un `undefined` significan «sin responder», no «cero estrellas»: la escala
|
|
10302
|
+
* empieza en 1 y el vacío tiene que seguir siendo distinguible.
|
|
10303
|
+
*/
|
|
10304
|
+
writeValue(value) {
|
|
10305
|
+
this.value.set(normalizeRating(value));
|
|
10306
|
+
this.previewValue.set(null);
|
|
10307
|
+
this.focusedIndex.set(null);
|
|
10308
|
+
}
|
|
10309
|
+
registerOnChange(fn) {
|
|
10310
|
+
this.onChange = fn;
|
|
10311
|
+
}
|
|
10312
|
+
registerOnTouched(fn) {
|
|
10313
|
+
this.onTouched = fn;
|
|
10314
|
+
}
|
|
10315
|
+
setDisabledState(isDisabled) {
|
|
10316
|
+
this.formDisabled.set(isDisabled);
|
|
10317
|
+
}
|
|
10318
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: SolRatingInputComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
10319
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: SolRatingInputComponent, isStandalone: true, selector: "sol-rating-input", inputs: { size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, readOnly: { classPropertyName: "readOnly", publicName: "readOnly", isSignal: true, isRequired: false, transformFunction: null }, error: { classPropertyName: "error", publicName: "error", isSignal: true, isRequired: false, transformFunction: null }, allowClear: { classPropertyName: "allowClear", publicName: "allowClear", isSignal: true, isRequired: false, transformFunction: null }, ariaLabelKey: { classPropertyName: "ariaLabelKey", publicName: "ariaLabelKey", isSignal: true, isRequired: false, transformFunction: null }, optionLabelKey: { classPropertyName: "optionLabelKey", publicName: "optionLabelKey", isSignal: true, isRequired: false, transformFunction: null }, clearLabelKey: { classPropertyName: "clearLabelKey", publicName: "clearLabelKey", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { ratingChanged: "ratingChanged" }, providers: [
|
|
10320
|
+
{
|
|
10321
|
+
provide: NG_VALUE_ACCESSOR,
|
|
10322
|
+
useExisting: forwardRef(() => SolRatingInputComponent),
|
|
10323
|
+
multi: true,
|
|
10324
|
+
},
|
|
10325
|
+
], viewQueries: [{ propertyName: "starRefs", predicate: ["starRef"], descendants: true, isSignal: true }], ngImport: i0, template: `
|
|
10326
|
+
<div class="sol-rating-input" [class.sol-rating-input--error]="!!error()">
|
|
10327
|
+
<div class="sol-rating-input__row">
|
|
10328
|
+
<div
|
|
10329
|
+
class="sol-rating-input__group"
|
|
10330
|
+
role="radiogroup"
|
|
10331
|
+
[attr.aria-label]="groupLabel()"
|
|
10332
|
+
[attr.aria-disabled]="isDisabled() ? 'true' : null"
|
|
10333
|
+
[attr.aria-readonly]="readOnly() ? 'true' : null"
|
|
10334
|
+
[attr.aria-invalid]="error() ? 'true' : null"
|
|
10335
|
+
[attr.aria-describedby]="error() ? errorId : null"
|
|
10336
|
+
(keydown)="onKeydown($event)"
|
|
10337
|
+
(focusout)="markTouched()"
|
|
10338
|
+
(mouseleave)="clearPreview()"
|
|
10339
|
+
>
|
|
10340
|
+
@for (star of stars; track star) {
|
|
10341
|
+
<button
|
|
10342
|
+
#starRef
|
|
10343
|
+
type="button"
|
|
10344
|
+
class="sol-rating-input__star"
|
|
10345
|
+
[class.sol-rating-input__star--on]="isFilled(star)"
|
|
10346
|
+
role="radio"
|
|
10347
|
+
[attr.aria-checked]="isChecked(star)"
|
|
10348
|
+
[attr.aria-label]="optionLabel(star)"
|
|
10349
|
+
[attr.tabindex]="tabIndexFor(star)"
|
|
10350
|
+
[disabled]="isDisabled()"
|
|
10351
|
+
(click)="select(star)"
|
|
10352
|
+
(focus)="onStarFocus(star)"
|
|
10353
|
+
(mouseenter)="preview(star)"
|
|
10354
|
+
>
|
|
10355
|
+
<sol-icon
|
|
10356
|
+
name="star"
|
|
10357
|
+
[variant]="isFilled(star) ? 'fill' : 'outline'"
|
|
10358
|
+
[size]="size()"
|
|
10359
|
+
/>
|
|
10360
|
+
</button>
|
|
10361
|
+
}
|
|
10362
|
+
</div>
|
|
10363
|
+
|
|
10364
|
+
@if (canClear()) {
|
|
10365
|
+
<button
|
|
10366
|
+
type="button"
|
|
10367
|
+
class="sol-rating-input__clear"
|
|
10368
|
+
[attr.aria-label]="clearLabel()"
|
|
10369
|
+
(click)="clear()"
|
|
10370
|
+
>
|
|
10371
|
+
<sol-icon name="x-mark" size="sm" />
|
|
10372
|
+
</button>
|
|
10373
|
+
}
|
|
10374
|
+
</div>
|
|
10375
|
+
|
|
10376
|
+
@if (error()) {
|
|
10377
|
+
<span class="sol-rating-input__error" [id]="errorId" role="alert">{{ error() }}</span>
|
|
10378
|
+
}
|
|
10379
|
+
</div>
|
|
10380
|
+
`, isInline: true, styles: [":host{display:inline-block;--sol-rating-input-on: var(--sol-color-warning);--sol-rating-input-off: var(--sol-color-text-muted, #94a3b8);--sol-rating-input-danger: var(--sol-color-danger, #ef4444);--sol-rating-input-disabled-opacity: var(--sol-disabled-opacity, .55);--sol-rating-input-transition: var(--sol-dur-fast, .15s) var(--sol-ease, ease);--sol-rating-input-focus-ring: var(--sol-color-primary, #6366f1);--sol-rating-input-hit: 44px}.sol-rating-input{display:flex;flex-direction:column;gap:var(--sol-space-xs, .25rem)}.sol-rating-input__row{display:flex;align-items:center;gap:var(--sol-space-xs, .25rem)}.sol-rating-input__group{display:inline-flex;align-items:center}.sol-rating-input__star{display:inline-flex;align-items:center;justify-content:center;min-width:var(--sol-rating-input-hit);min-height:var(--sol-rating-input-hit);padding:0;border:none;background:transparent;color:var(--sol-rating-input-off);cursor:pointer;border-radius:var(--sol-border-radius-sm, .25rem);transition:color var(--sol-rating-input-transition),transform var(--sol-rating-input-transition);-webkit-tap-highlight-color:transparent}.sol-rating-input__star--on{color:var(--sol-rating-input-on)}.sol-rating-input__star:focus-visible{outline:2px solid var(--sol-rating-input-focus-ring);outline-offset:-2px}.sol-rating-input__star:disabled{cursor:not-allowed}.sol-rating-input__group:not([aria-disabled]):not([aria-readonly]) .sol-rating-input__star:hover{transform:scale(1.08)}.sol-rating-input__group[aria-disabled]{opacity:var(--sol-rating-input-disabled-opacity)}.sol-rating-input__group[aria-readonly] .sol-rating-input__star{cursor:default}.sol-rating-input--error .sol-rating-input__star:not(.sol-rating-input__star--on){color:var(--sol-rating-input-danger)}.sol-rating-input__clear{display:inline-flex;align-items:center;justify-content:center;min-width:var(--sol-rating-input-hit);min-height:var(--sol-rating-input-hit);padding:0;border:none;background:transparent;color:var(--sol-color-text-secondary, #475569);cursor:pointer;border-radius:var(--sol-border-radius-sm, .25rem);transition:color var(--sol-rating-input-transition)}.sol-rating-input__clear:hover{color:var(--sol-color-text-primary, #1e293b)}.sol-rating-input__clear:focus-visible{outline:2px solid var(--sol-rating-input-focus-ring);outline-offset:-2px}.sol-rating-input__error{font-size:var(--sol-font-size-sm, .75rem);color:var(--sol-rating-input-danger);line-height:1.3}@media(prefers-reduced-motion:reduce){.sol-rating-input__star,.sol-rating-input__clear{transition:none}.sol-rating-input__group:not([aria-disabled]):not([aria-readonly]) .sol-rating-input__star:hover{transform:none}}\n"], dependencies: [{ kind: "component", type: SolIconComponent, selector: "sol-icon", inputs: ["name", "size", "variant"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
10381
|
+
}
|
|
10382
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: SolRatingInputComponent, decorators: [{
|
|
10383
|
+
type: Component,
|
|
10384
|
+
args: [{ selector: 'sol-rating-input', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [SolIconComponent], providers: [
|
|
10385
|
+
{
|
|
10386
|
+
provide: NG_VALUE_ACCESSOR,
|
|
10387
|
+
useExisting: forwardRef(() => SolRatingInputComponent),
|
|
10388
|
+
multi: true,
|
|
10389
|
+
},
|
|
10390
|
+
], template: `
|
|
10391
|
+
<div class="sol-rating-input" [class.sol-rating-input--error]="!!error()">
|
|
10392
|
+
<div class="sol-rating-input__row">
|
|
10393
|
+
<div
|
|
10394
|
+
class="sol-rating-input__group"
|
|
10395
|
+
role="radiogroup"
|
|
10396
|
+
[attr.aria-label]="groupLabel()"
|
|
10397
|
+
[attr.aria-disabled]="isDisabled() ? 'true' : null"
|
|
10398
|
+
[attr.aria-readonly]="readOnly() ? 'true' : null"
|
|
10399
|
+
[attr.aria-invalid]="error() ? 'true' : null"
|
|
10400
|
+
[attr.aria-describedby]="error() ? errorId : null"
|
|
10401
|
+
(keydown)="onKeydown($event)"
|
|
10402
|
+
(focusout)="markTouched()"
|
|
10403
|
+
(mouseleave)="clearPreview()"
|
|
10404
|
+
>
|
|
10405
|
+
@for (star of stars; track star) {
|
|
10406
|
+
<button
|
|
10407
|
+
#starRef
|
|
10408
|
+
type="button"
|
|
10409
|
+
class="sol-rating-input__star"
|
|
10410
|
+
[class.sol-rating-input__star--on]="isFilled(star)"
|
|
10411
|
+
role="radio"
|
|
10412
|
+
[attr.aria-checked]="isChecked(star)"
|
|
10413
|
+
[attr.aria-label]="optionLabel(star)"
|
|
10414
|
+
[attr.tabindex]="tabIndexFor(star)"
|
|
10415
|
+
[disabled]="isDisabled()"
|
|
10416
|
+
(click)="select(star)"
|
|
10417
|
+
(focus)="onStarFocus(star)"
|
|
10418
|
+
(mouseenter)="preview(star)"
|
|
10419
|
+
>
|
|
10420
|
+
<sol-icon
|
|
10421
|
+
name="star"
|
|
10422
|
+
[variant]="isFilled(star) ? 'fill' : 'outline'"
|
|
10423
|
+
[size]="size()"
|
|
10424
|
+
/>
|
|
10425
|
+
</button>
|
|
10426
|
+
}
|
|
10427
|
+
</div>
|
|
10428
|
+
|
|
10429
|
+
@if (canClear()) {
|
|
10430
|
+
<button
|
|
10431
|
+
type="button"
|
|
10432
|
+
class="sol-rating-input__clear"
|
|
10433
|
+
[attr.aria-label]="clearLabel()"
|
|
10434
|
+
(click)="clear()"
|
|
10435
|
+
>
|
|
10436
|
+
<sol-icon name="x-mark" size="sm" />
|
|
10437
|
+
</button>
|
|
10438
|
+
}
|
|
10439
|
+
</div>
|
|
10440
|
+
|
|
10441
|
+
@if (error()) {
|
|
10442
|
+
<span class="sol-rating-input__error" [id]="errorId" role="alert">{{ error() }}</span>
|
|
10443
|
+
}
|
|
10444
|
+
</div>
|
|
10445
|
+
`, styles: [":host{display:inline-block;--sol-rating-input-on: var(--sol-color-warning);--sol-rating-input-off: var(--sol-color-text-muted, #94a3b8);--sol-rating-input-danger: var(--sol-color-danger, #ef4444);--sol-rating-input-disabled-opacity: var(--sol-disabled-opacity, .55);--sol-rating-input-transition: var(--sol-dur-fast, .15s) var(--sol-ease, ease);--sol-rating-input-focus-ring: var(--sol-color-primary, #6366f1);--sol-rating-input-hit: 44px}.sol-rating-input{display:flex;flex-direction:column;gap:var(--sol-space-xs, .25rem)}.sol-rating-input__row{display:flex;align-items:center;gap:var(--sol-space-xs, .25rem)}.sol-rating-input__group{display:inline-flex;align-items:center}.sol-rating-input__star{display:inline-flex;align-items:center;justify-content:center;min-width:var(--sol-rating-input-hit);min-height:var(--sol-rating-input-hit);padding:0;border:none;background:transparent;color:var(--sol-rating-input-off);cursor:pointer;border-radius:var(--sol-border-radius-sm, .25rem);transition:color var(--sol-rating-input-transition),transform var(--sol-rating-input-transition);-webkit-tap-highlight-color:transparent}.sol-rating-input__star--on{color:var(--sol-rating-input-on)}.sol-rating-input__star:focus-visible{outline:2px solid var(--sol-rating-input-focus-ring);outline-offset:-2px}.sol-rating-input__star:disabled{cursor:not-allowed}.sol-rating-input__group:not([aria-disabled]):not([aria-readonly]) .sol-rating-input__star:hover{transform:scale(1.08)}.sol-rating-input__group[aria-disabled]{opacity:var(--sol-rating-input-disabled-opacity)}.sol-rating-input__group[aria-readonly] .sol-rating-input__star{cursor:default}.sol-rating-input--error .sol-rating-input__star:not(.sol-rating-input__star--on){color:var(--sol-rating-input-danger)}.sol-rating-input__clear{display:inline-flex;align-items:center;justify-content:center;min-width:var(--sol-rating-input-hit);min-height:var(--sol-rating-input-hit);padding:0;border:none;background:transparent;color:var(--sol-color-text-secondary, #475569);cursor:pointer;border-radius:var(--sol-border-radius-sm, .25rem);transition:color var(--sol-rating-input-transition)}.sol-rating-input__clear:hover{color:var(--sol-color-text-primary, #1e293b)}.sol-rating-input__clear:focus-visible{outline:2px solid var(--sol-rating-input-focus-ring);outline-offset:-2px}.sol-rating-input__error{font-size:var(--sol-font-size-sm, .75rem);color:var(--sol-rating-input-danger);line-height:1.3}@media(prefers-reduced-motion:reduce){.sol-rating-input__star,.sol-rating-input__clear{transition:none}.sol-rating-input__group:not([aria-disabled]):not([aria-readonly]) .sol-rating-input__star:hover{transform:none}}\n"] }]
|
|
10446
|
+
}], propDecorators: { starRefs: [{ type: i0.ViewChildren, args: ['starRef', { isSignal: true }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], readOnly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readOnly", required: false }] }], error: [{ type: i0.Input, args: [{ isSignal: true, alias: "error", required: false }] }], allowClear: [{ type: i0.Input, args: [{ isSignal: true, alias: "allowClear", required: false }] }], ariaLabelKey: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabelKey", required: false }] }], optionLabelKey: [{ type: i0.Input, args: [{ isSignal: true, alias: "optionLabelKey", required: false }] }], clearLabelKey: [{ type: i0.Input, args: [{ isSignal: true, alias: "clearLabelKey", required: false }] }], ratingChanged: [{ type: i0.Output, args: ["ratingChanged"] }] } });
|
|
10447
|
+
/** Recorta cualquier entrada a una calificación válida (`1..5`) o a `null`. */
|
|
10448
|
+
function normalizeRating(raw) {
|
|
10449
|
+
if (raw === null || raw === undefined || !Number.isFinite(raw))
|
|
10450
|
+
return null;
|
|
10451
|
+
const rounded = Math.round(raw);
|
|
10452
|
+
if (rounded < 1)
|
|
10453
|
+
return null;
|
|
10454
|
+
return Math.min(rounded, MAX_STARS);
|
|
10455
|
+
}
|
|
10456
|
+
|
|
10457
|
+
/** Color CSS (`var(--sol-color-*)` con fallback) por tono — fuente única para toda la lib. */
|
|
10458
|
+
const TONE_COLOR = {
|
|
10459
|
+
success: 'var(--sol-color-success, #10b981)',
|
|
10460
|
+
warning: 'var(--sol-color-warning, #f59e0b)',
|
|
10461
|
+
danger: 'var(--sol-color-danger, #ef4444)',
|
|
10462
|
+
info: 'var(--sol-color-info, #3b82f6)',
|
|
10463
|
+
neutral: 'var(--sol-color-text-muted, #94a3b8)',
|
|
10464
|
+
};
|
|
10465
|
+
|
|
10466
|
+
/** Default del spec: éxito ≥80, advertencia ≥50, peligro <50. */
|
|
10467
|
+
const DEFAULT_SCORE_THRESHOLDS = [
|
|
10468
|
+
{ upTo: 50, tone: 'danger' },
|
|
10469
|
+
{ upTo: 80, tone: 'warning' },
|
|
10470
|
+
{ upTo: Infinity, tone: 'success' },
|
|
10471
|
+
];
|
|
10472
|
+
/**
|
|
10473
|
+
* Resuelve el tono de `score` contra `thresholds` (ordenados ascendente por
|
|
10474
|
+
* `upTo`): el primero cuyo `upTo` sea mayor que `score` gana; si ninguno lo
|
|
10475
|
+
* es, se usa el tono del último umbral. PURA — sin dependencias de Angular.
|
|
10476
|
+
*/
|
|
10477
|
+
function resolveScoreTone(score, thresholds) {
|
|
10478
|
+
const sorted = [...thresholds].sort((a, b) => a.upTo - b.upTo);
|
|
10479
|
+
const match = sorted.find((t) => score < t.upTo);
|
|
10480
|
+
return match?.tone ?? sorted[sorted.length - 1]?.tone ?? 'neutral';
|
|
10481
|
+
}
|
|
10482
|
+
/**
|
|
10483
|
+
* `sol-score-badge` — puntaje numérico con tono resuelto contra umbrales
|
|
10484
|
+
* configurables (spec: solercia-ui-vocero-atoms). Genérico: no sabe si el
|
|
10485
|
+
* puntaje viene de un lead, una corrida del laboratorio o cualquier otra
|
|
10486
|
+
* métrica — eso lo decide el consumidor vía `[value]`/`[thresholds]`.
|
|
10487
|
+
*
|
|
10488
|
+
* Estados especiales:
|
|
10489
|
+
* - `pending=true` ("en curso"): la métrica aún se está calculando.
|
|
10490
|
+
* - `value=null` ("sin dato"): no hay puntaje disponible todavía.
|
|
10491
|
+
* Ambos usan el tono neutral y un texto por clave i18n en vez del número.
|
|
10492
|
+
*/
|
|
10493
|
+
class SolScoreBadgeComponent {
|
|
10494
|
+
i18n = inject(SOL_I18N);
|
|
10495
|
+
/** Puntaje a mostrar; `null` = sin dato todavía. */
|
|
10496
|
+
value = input(null, /* @ts-ignore */
|
|
10497
|
+
...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
10498
|
+
/** Escala del puntaje (default 100). Los umbrales siempre se evalúan en escala 0-100. */
|
|
10499
|
+
max = input(100, /* @ts-ignore */
|
|
10500
|
+
...(ngDevMode ? [{ debugName: "max" }] : /* istanbul ignore next */ []));
|
|
10501
|
+
thresholds = input(DEFAULT_SCORE_THRESHOLDS, /* @ts-ignore */
|
|
10502
|
+
...(ngDevMode ? [{ debugName: "thresholds" }] : /* istanbul ignore next */ []));
|
|
10503
|
+
/** `true` mientras la métrica se está calculando (p. ej. corrida del laboratorio en curso). */
|
|
10504
|
+
pending = input(false, /* @ts-ignore */
|
|
10505
|
+
...(ngDevMode ? [{ debugName: "pending" }] : /* istanbul ignore next */ []));
|
|
10506
|
+
/**
|
|
10507
|
+
* `true` cuando no hay puntaje utilizable: `value=null` (sin dato todavía)
|
|
10508
|
+
* O `value` es `NaN` (p. ej. una división 0/0 corriente arriba, o un
|
|
10509
|
+
* `parseFloat` fallido). Sin esta guarda, `NaN < umbral` es SIEMPRE `false`
|
|
10510
|
+
* y `resolveScoreTone` cae al último tono ("éxito") mostrando una insignia
|
|
10511
|
+
* verde con el texto literal "NaN".
|
|
10512
|
+
*/
|
|
10513
|
+
hasNoData = computed(() => {
|
|
10514
|
+
const v = this.value();
|
|
10515
|
+
return v === null || Number.isNaN(v);
|
|
10516
|
+
}, /* @ts-ignore */
|
|
10517
|
+
...(ngDevMode ? [{ debugName: "hasNoData" }] : /* istanbul ignore next */ []));
|
|
10518
|
+
/** Puntaje normalizado a 0-100 para evaluar contra los umbrales (el texto mostrado usa el valor crudo). */
|
|
10519
|
+
normalizedValue = computed(() => {
|
|
10520
|
+
const v = this.value();
|
|
10521
|
+
if (v === null)
|
|
10522
|
+
return null;
|
|
10523
|
+
const m = this.max();
|
|
10524
|
+
return m > 0 ? (v / m) * 100 : v;
|
|
10525
|
+
}, /* @ts-ignore */
|
|
10526
|
+
...(ngDevMode ? [{ debugName: "normalizedValue" }] : /* istanbul ignore next */ []));
|
|
10527
|
+
tone = computed(() => {
|
|
10528
|
+
if (this.pending() || this.hasNoData())
|
|
10529
|
+
return 'neutral';
|
|
10530
|
+
return resolveScoreTone(this.normalizedValue(), this.thresholds());
|
|
10531
|
+
}, /* @ts-ignore */
|
|
10532
|
+
...(ngDevMode ? [{ debugName: "tone" }] : /* istanbul ignore next */ []));
|
|
10533
|
+
displayText = computed(() => {
|
|
10534
|
+
this.i18n.activeLang();
|
|
9626
10535
|
if (this.pending())
|
|
9627
10536
|
return this.i18n.translate('shared.scoreBadge.pending');
|
|
9628
10537
|
return this.hasNoData() ? this.i18n.translate('shared.scoreBadge.empty') : `${this.value()}`;
|
|
@@ -14365,6 +15274,1505 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
14365
15274
|
`, styles: [":host{display:block;position:relative}.sol-flow-canvas{position:relative;width:100%;min-height:320px;overflow:hidden;background:var(--sol-bg-sunken, var(--sol-bg-page, #f8fafc));border-radius:var(--sol-border-radius-lg, 12px);touch-action:none;--sol-flow-canvas-hit-min: min(calc(44px / var(--sol-flow-canvas-zoom, 1)), 176px)}.sol-flow-canvas__world{position:absolute;inset:0;transform-origin:0 0;will-change:transform}.sol-flow-canvas__edges{position:absolute;inset:0;width:100%;height:100%;pointer-events:none;overflow:visible}.sol-flow-canvas__edge-line{stroke:var(--sol-border-color-default, #94a3b8);stroke-width:2;fill:none}.sol-flow-canvas__edge-ghost{stroke:var(--sol-color-info, #3b82f6);stroke-width:2;stroke-dasharray:6 4;fill:none}.sol-flow-canvas__edge-arrow{fill:var(--sol-border-color-default, #94a3b8)}.sol-flow-canvas__edge-label{position:absolute;transform:translate(-50%,-50%);display:flex;align-items:center;gap:4px;background:var(--sol-bg-surface, #fff);border:1px solid var(--sol-border-color-default, #e2e8f0);border-radius:var(--sol-border-radius-full, 999px);padding:2px 8px;font-size:var(--sol-font-size-xs, 11px);color:var(--sol-color-text-secondary, #475569);z-index:2}.sol-flow-canvas__edge-remove{border:none;background:transparent;color:var(--sol-color-danger, #ef4444);cursor:pointer;font-size:var(--sol-font-size-sm, 13px);line-height:1;display:inline-flex;align-items:center;justify-content:center;flex:none;width:var(--sol-flow-canvas-hit-min, 44px);height:var(--sol-flow-canvas-hit-min, 44px);margin:calc((13px - var(--sol-flow-canvas-hit-min, 44px)) / 2)}.sol-flow-canvas__node{position:absolute;width:180px;display:flex;align-items:stretch;gap:4px;z-index:3;touch-action:none}.sol-flow-canvas__node-surface{flex:1;display:flex;flex-direction:column;justify-content:center;min-height:var(--sol-flow-canvas-hit-min, 44px);text-align:left;padding:10px 12px;background:var(--sol-bg-surface, #fff);border:2px solid var(--sol-border-color-default, #e2e8f0);border-radius:var(--sol-border-radius-lg, 10px);box-shadow:var(--sol-shadow-sm, 0 1px 2px rgba(0, 0, 0, .06));cursor:grab;font-family:var(--sol-font-family);color:var(--sol-color-text-primary);transition:opacity .15s ease}.sol-flow-canvas__node-surface:focus-visible{outline:2px solid var(--sol-color-primary, #2563eb);outline-offset:2px}.sol-flow-canvas__node--selected .sol-flow-canvas__node-surface{border-color:var(--sol-color-primary, #2563eb)}.sol-flow-canvas__node--highlighted .sol-flow-canvas__node-surface{box-shadow:0 0 0 3px color-mix(in srgb,var(--sol-color-primary, #2563eb) 30%,transparent)}.sol-flow-canvas__node--connect-source .sol-flow-canvas__node-surface{border-style:dashed;border-color:var(--sol-color-info, #3b82f6)}.sol-flow-canvas__node--connect-valid-target .sol-flow-canvas__node-surface{border-style:dashed;border-color:var(--sol-color-success, #10b981);box-shadow:0 0 0 3px color-mix(in srgb,var(--sol-color-success, #10b981) 25%,transparent)}.sol-flow-canvas__node--connect-invalid-target .sol-flow-canvas__node-surface{opacity:.45}.sol-flow-canvas__node[data-visual-state=running] .sol-flow-canvas__node-surface{border-color:var(--sol-color-info, #3b82f6)}.sol-flow-canvas__node[data-visual-state=ok] .sol-flow-canvas__node-surface{border-color:var(--sol-color-success, #10b981)}.sol-flow-canvas__node[data-visual-state=error] .sol-flow-canvas__node-surface{border-color:var(--sol-color-danger, #ef4444)}.sol-flow-canvas__node-label{font-size:var(--sol-font-size-sm, 13px);font-weight:600}.sol-flow-canvas__node-connect-handle{align-self:center;flex:none;display:inline-flex;align-items:center;justify-content:center;min-width:var(--sol-flow-canvas-hit-min, 44px);min-height:var(--sol-flow-canvas-hit-min, 44px);border:1px solid var(--sol-border-color-default, #e2e8f0);border-radius:var(--sol-border-radius-md, 8px);background:var(--sol-bg-surface, #fff);color:var(--sol-color-text-secondary, #475569);cursor:pointer}.sol-flow-canvas__announce{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}.sol-flow-canvas__auto-layout{display:none;position:absolute;right:12px;bottom:12px;z-index:4;min-width:44px;min-height:44px;padding:0 16px;align-items:center;justify-content:center;border:1px solid var(--sol-border-color-default, #e2e8f0);border-radius:var(--sol-border-radius-full, 999px);background:var(--sol-bg-surface, #fff);color:var(--sol-color-text-primary);font-family:var(--sol-font-family);font-size:var(--sol-font-size-sm, 13px);font-weight:600;box-shadow:var(--sol-shadow-md, 0 4px 12px rgba(0, 0, 0, .12));cursor:pointer}.sol-flow-canvas__auto-layout:focus-visible{outline:2px solid var(--sol-color-primary, #2563eb);outline-offset:2px}@media(max-width:767px){.sol-flow-canvas__auto-layout{display:inline-flex}}\n"] }]
|
|
14366
15275
|
}], ctorParameters: () => [], propDecorators: { nodes: [{ type: i0.Input, args: [{ isSignal: true, alias: "nodes", required: false }] }], edges: [{ type: i0.Input, args: [{ isSignal: true, alias: "edges", required: false }] }], isReadonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], selectedId: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectedId", required: false }] }], highlightedNodeId: [{ type: i0.Input, args: [{ isSignal: true, alias: "highlightedNodeId", required: false }] }], nodeTemplate: [{ type: i0.Input, args: [{ isSignal: true, alias: "nodeTemplate", required: false }] }], nodeMoved: [{ type: i0.Output, args: ["nodeMoved"] }], nodeSelected: [{ type: i0.Output, args: ["nodeSelected"] }], connectionCreated: [{ type: i0.Output, args: ["connectionCreated"] }], connectionRemoved: [{ type: i0.Output, args: ["connectionRemoved"] }], canvasHostRef: [{ type: i0.ViewChild, args: ['canvasHost', { isSignal: true }] }] } });
|
|
14367
15276
|
|
|
15277
|
+
/**
|
|
15278
|
+
* Profundidad máxima por defecto: 5 niveles visibles (raíz = nivel 1).
|
|
15279
|
+
*
|
|
15280
|
+
* Es una cota DURA heredada del árbol de jerarquía que originó este
|
|
15281
|
+
* componente: mantiene el DOM acotado (sin virtualización), evita sangrías
|
|
15282
|
+
* ilegibles en móvil y —lo más importante para un primitivo genérico— corta
|
|
15283
|
+
* la recursión si el consumidor pasa por error un grafo con ciclos.
|
|
15284
|
+
*/
|
|
15285
|
+
const SOL_TREE_MAX_DEPTH = 5;
|
|
15286
|
+
/**
|
|
15287
|
+
* Marca el `<ng-template>` que pinta el CONTENIDO de cada nodo. Debe ser hijo
|
|
15288
|
+
* directo de `<sol-tree>`. Sin él, el árbol cae a un render por defecto que
|
|
15289
|
+
* muestra `node.label`.
|
|
15290
|
+
*
|
|
15291
|
+
* ```html
|
|
15292
|
+
* <sol-tree [nodes]="arbol()" (nodeSelected)="ir($event)">
|
|
15293
|
+
* <ng-template solTreeNodeDef let-node let-depth="depth">
|
|
15294
|
+
* <span>{{ node.label }}</span>
|
|
15295
|
+
* <sol-badge>{{ node.data?.metodologia }}</sol-badge>
|
|
15296
|
+
* </ng-template>
|
|
15297
|
+
* </sol-tree>
|
|
15298
|
+
* ```
|
|
15299
|
+
*
|
|
15300
|
+
* Nota de tipado: sin un input que ancle el genérico, TypeScript infiere
|
|
15301
|
+
* `T = unknown`, así que `node.data` llega como `unknown` y el consumidor lo
|
|
15302
|
+
* estrecha en su propio código. Es el mismo compromiso de `matTreeNodeDef`;
|
|
15303
|
+
* se prefirió eso antes que ensuciar la API con un input solo-para-inferencia.
|
|
15304
|
+
*/
|
|
15305
|
+
class SolTreeNodeDefDirective {
|
|
15306
|
+
template = inject((TemplateRef));
|
|
15307
|
+
/** Tipa las variables `let-` del template (`let-node`, `let-depth`, …). */
|
|
15308
|
+
static ngTemplateContextGuard(_directive, _context) {
|
|
15309
|
+
return true;
|
|
15310
|
+
}
|
|
15311
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: SolTreeNodeDefDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
15312
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.6", type: SolTreeNodeDefDirective, isStandalone: true, selector: "[solTreeNodeDef]", ngImport: i0 });
|
|
15313
|
+
}
|
|
15314
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: SolTreeNodeDefDirective, decorators: [{
|
|
15315
|
+
type: Directive,
|
|
15316
|
+
args: [{
|
|
15317
|
+
selector: '[solTreeNodeDef]',
|
|
15318
|
+
standalone: true,
|
|
15319
|
+
}]
|
|
15320
|
+
}] });
|
|
15321
|
+
/**
|
|
15322
|
+
* Estado compartido por TODOS los nodos de un mismo `sol-tree` (se provee en
|
|
15323
|
+
* `providers` del contenedor, así cada árbol tiene el suyo).
|
|
15324
|
+
*
|
|
15325
|
+
* `activeId` es el cursor del roving tabindex: solo el nodo activo lleva
|
|
15326
|
+
* `tabindex="0"`, el resto `-1`. Así el árbol completo es UNA sola parada de
|
|
15327
|
+
* Tab y las flechas mueven el foco adentro (patrón `tree` de la APG).
|
|
15328
|
+
*/
|
|
15329
|
+
class SolTreeState {
|
|
15330
|
+
/** Id del único nodo que es parada de Tab. */
|
|
15331
|
+
activeId = signal(null, /* @ts-ignore */
|
|
15332
|
+
...(ngDevMode ? [{ debugName: "activeId" }] : /* istanbul ignore next */ []));
|
|
15333
|
+
/** Lo instala el contenedor en su constructor, antes de crear cualquier nodo. */
|
|
15334
|
+
owner;
|
|
15335
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: SolTreeState, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
15336
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: SolTreeState });
|
|
15337
|
+
}
|
|
15338
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: SolTreeState, decorators: [{
|
|
15339
|
+
type: Injectable
|
|
15340
|
+
}] });
|
|
15341
|
+
/**
|
|
15342
|
+
* Nodo recursivo del árbol: se renderiza a sí mismo para cada hijo, de modo
|
|
15343
|
+
* que el anidamiento ARIA (`treeitem` › `group` › `treeitem`) calza con el
|
|
15344
|
+
* DOM sin listas aplanadas.
|
|
15345
|
+
*
|
|
15346
|
+
* `role="treeitem"`, el `tabindex` y el manejo de teclado viven en el HOST
|
|
15347
|
+
* (no en un `<div>` interno): así este elemento es el que recibe el foco y
|
|
15348
|
+
* el que aparece en la consulta del roving tabindex de `moveFocus()`.
|
|
15349
|
+
*
|
|
15350
|
+
* Es una pieza INTERNA de `sol-tree`; no se usa suelta.
|
|
15351
|
+
*/
|
|
15352
|
+
class SolTreeNodeComponent {
|
|
15353
|
+
/** Nodo que pinta esta instancia. */
|
|
15354
|
+
node = input.required(/* @ts-ignore */
|
|
15355
|
+
...(ngDevMode ? [{ debugName: "node" }] : /* istanbul ignore next */ []));
|
|
15356
|
+
/** Profundidad base 0 (las raíces valen 0). */
|
|
15357
|
+
depth = input(0, /* @ts-ignore */
|
|
15358
|
+
...(ngDevMode ? [{ debugName: "depth" }] : /* istanbul ignore next */ []));
|
|
15359
|
+
el = inject(ElementRef);
|
|
15360
|
+
state = inject(SolTreeState);
|
|
15361
|
+
i18n = inject(SOL_I18N);
|
|
15362
|
+
children = computed(() => this.node().children ?? [], /* @ts-ignore */
|
|
15363
|
+
...(ngDevMode ? [{ debugName: "children" }] : /* istanbul ignore next */ []));
|
|
15364
|
+
hasChildren = computed(() => this.children().length > 0, /* @ts-ignore */
|
|
15365
|
+
...(ngDevMode ? [{ debugName: "hasChildren" }] : /* istanbul ignore next */ []));
|
|
15366
|
+
expanded = computed(() => this.state.owner.expandedSet().has(this.node().id), /* @ts-ignore */
|
|
15367
|
+
...(ngDevMode ? [{ debugName: "expanded" }] : /* istanbul ignore next */ []));
|
|
15368
|
+
indent = computed(() => this.state.owner.indent(), /* @ts-ignore */
|
|
15369
|
+
...(ngDevMode ? [{ debugName: "indent" }] : /* istanbul ignore next */ []));
|
|
15370
|
+
nodeTemplate = computed(() => this.state.owner.nodeTemplate(), /* @ts-ignore */
|
|
15371
|
+
...(ngDevMode ? [{ debugName: "nodeTemplate" }] : /* istanbul ignore next */ []));
|
|
15372
|
+
/** Corta la recursión en `maxDepth` niveles visibles (ver {@link SOL_TREE_MAX_DEPTH}). */
|
|
15373
|
+
canDescend = computed(() => this.depth() + 1 < this.state.owner.maxDepth(), /* @ts-ignore */
|
|
15374
|
+
...(ngDevMode ? [{ debugName: "canDescend" }] : /* istanbul ignore next */ []));
|
|
15375
|
+
showChildren = computed(() => this.hasChildren() && this.expanded() && this.canDescend(), /* @ts-ignore */
|
|
15376
|
+
...(ngDevMode ? [{ debugName: "showChildren" }] : /* istanbul ignore next */ []));
|
|
15377
|
+
/** Roving tabindex: solo el nodo activo es parada de Tab. */
|
|
15378
|
+
tabIndexValue = computed(() => this.state.activeId() === this.node().id ? 0 : -1, /* @ts-ignore */
|
|
15379
|
+
...(ngDevMode ? [{ debugName: "tabIndexValue" }] : /* istanbul ignore next */ []));
|
|
15380
|
+
templateContext = computed(() => ({
|
|
15381
|
+
$implicit: this.node(),
|
|
15382
|
+
node: this.node(),
|
|
15383
|
+
depth: this.depth(),
|
|
15384
|
+
expanded: this.expanded(),
|
|
15385
|
+
hasChildren: this.hasChildren(),
|
|
15386
|
+
}), /* @ts-ignore */
|
|
15387
|
+
...(ngDevMode ? [{ debugName: "templateContext" }] : /* istanbul ignore next */ []));
|
|
15388
|
+
/** `aria-label` del chevron: varía con el estado y con el nombre del nodo. */
|
|
15389
|
+
toggleAriaLabel = computed(() => {
|
|
15390
|
+
this.i18n.activeLang();
|
|
15391
|
+
const label = this.node().label;
|
|
15392
|
+
return this.expanded()
|
|
15393
|
+
? this.text('shared.tree.collapseAria', `Contraer ${label}`, label)
|
|
15394
|
+
: this.text('shared.tree.expandAria', `Expandir ${label}`, label);
|
|
15395
|
+
}, /* @ts-ignore */
|
|
15396
|
+
...(ngDevMode ? [{ debugName: "toggleAriaLabel" }] : /* istanbul ignore next */ []));
|
|
15397
|
+
onToggleClick(event) {
|
|
15398
|
+
// El clic en el chevron no debe burbujear hacia la fila del consumidor.
|
|
15399
|
+
event.stopPropagation();
|
|
15400
|
+
this.state.owner.toggle(this.node());
|
|
15401
|
+
}
|
|
15402
|
+
onFocus() {
|
|
15403
|
+
this.state.activeId.set(this.node().id);
|
|
15404
|
+
}
|
|
15405
|
+
/**
|
|
15406
|
+
* Teclado del patrón `tree` (idéntico al del árbol de jerarquía original):
|
|
15407
|
+
* Enter/Espacio activa —alterna si tiene hijos, selecciona si es hoja—,
|
|
15408
|
+
* ←/→ colapsa/expande y ↑/↓ mueven el foco entre los `treeitem` VISIBLES.
|
|
15409
|
+
*
|
|
15410
|
+
* Dos ajustes sobre el original, ambos deliberados:
|
|
15411
|
+
* 1. "Activar una hoja" ya no navega: emite `nodeSelected` y el consumidor
|
|
15412
|
+
* decide (requisito de acoplamiento cero al dominio).
|
|
15413
|
+
* 2. Solo actúa el `treeitem` REALMENTE enfocado. El original escuchaba en
|
|
15414
|
+
* el host sin filtrar el `target`, así que la tecla de un nodo anidado
|
|
15415
|
+
* burbujeaba y sus ancestros la volvían a procesar (con ↓ el foco
|
|
15416
|
+
* terminaba en el lugar equivocado); además, con esta guarda, escribir
|
|
15417
|
+
* con flechas dentro de un campo de la plantilla proyectada ya no mueve
|
|
15418
|
+
* el foco del árbol.
|
|
15419
|
+
*/
|
|
15420
|
+
onKeydown(event) {
|
|
15421
|
+
if (event.target !== this.el.nativeElement)
|
|
15422
|
+
return;
|
|
15423
|
+
switch (event.key) {
|
|
15424
|
+
case 'Enter':
|
|
15425
|
+
case ' ':
|
|
15426
|
+
event.preventDefault();
|
|
15427
|
+
if (this.hasChildren()) {
|
|
15428
|
+
this.state.owner.toggle(this.node());
|
|
15429
|
+
}
|
|
15430
|
+
else {
|
|
15431
|
+
this.state.owner.select(this.node());
|
|
15432
|
+
}
|
|
15433
|
+
break;
|
|
15434
|
+
case 'ArrowRight':
|
|
15435
|
+
if (this.hasChildren() && !this.expanded()) {
|
|
15436
|
+
event.preventDefault();
|
|
15437
|
+
this.state.owner.toggle(this.node());
|
|
15438
|
+
}
|
|
15439
|
+
break;
|
|
15440
|
+
case 'ArrowLeft':
|
|
15441
|
+
if (this.hasChildren() && this.expanded()) {
|
|
15442
|
+
event.preventDefault();
|
|
15443
|
+
this.state.owner.toggle(this.node());
|
|
15444
|
+
}
|
|
15445
|
+
break;
|
|
15446
|
+
case 'ArrowDown':
|
|
15447
|
+
event.preventDefault();
|
|
15448
|
+
this.moveFocus(1);
|
|
15449
|
+
break;
|
|
15450
|
+
case 'ArrowUp':
|
|
15451
|
+
event.preventDefault();
|
|
15452
|
+
this.moveFocus(-1);
|
|
15453
|
+
break;
|
|
15454
|
+
}
|
|
15455
|
+
}
|
|
15456
|
+
/**
|
|
15457
|
+
* Mueve el foco al `treeitem` visible siguiente/anterior en orden del DOM.
|
|
15458
|
+
* Como los hijos colapsados no se renderizan, ese orden ya coincide con el
|
|
15459
|
+
* orden visual de arriba hacia abajo: no hace falta aplanar el árbol.
|
|
15460
|
+
*/
|
|
15461
|
+
moveFocus(delta) {
|
|
15462
|
+
const container = this.el.nativeElement.closest('[role="tree"]');
|
|
15463
|
+
if (!container)
|
|
15464
|
+
return;
|
|
15465
|
+
const items = Array.from(container.querySelectorAll('[role="treeitem"]'));
|
|
15466
|
+
const index = items.indexOf(this.el.nativeElement);
|
|
15467
|
+
items[index + delta]?.focus();
|
|
15468
|
+
}
|
|
15469
|
+
/** Resuelve texto: clave i18n (si el host la traduce) → default es-CO. */
|
|
15470
|
+
text(key, fallback, label) {
|
|
15471
|
+
const translated = this.i18n.translate(key, { label });
|
|
15472
|
+
return translated && translated !== key ? translated : fallback;
|
|
15473
|
+
}
|
|
15474
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: SolTreeNodeComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
15475
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: SolTreeNodeComponent, isStandalone: true, selector: "sol-tree-node", inputs: { node: { classPropertyName: "node", publicName: "node", isSignal: true, isRequired: true, transformFunction: null }, depth: { classPropertyName: "depth", publicName: "depth", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "treeitem" }, listeners: { "keydown": "onKeydown($event)", "focus": "onFocus()" }, properties: { "attr.aria-expanded": "hasChildren() ? expanded() : null", "attr.aria-level": "depth() + 1", "attr.tabindex": "tabIndexValue()" }, classAttribute: "sol-tree__item" }, ngImport: i0, template: `
|
|
15476
|
+
<div class="sol-tree__row" [style.paddingLeft.px]="depth() * indent()">
|
|
15477
|
+
@if (hasChildren()) {
|
|
15478
|
+
<button
|
|
15479
|
+
type="button"
|
|
15480
|
+
class="sol-tree__toggle"
|
|
15481
|
+
tabindex="-1"
|
|
15482
|
+
[attr.aria-label]="toggleAriaLabel()"
|
|
15483
|
+
(click)="onToggleClick($event)"
|
|
15484
|
+
>
|
|
15485
|
+
<sol-icon [name]="expanded() ? 'chevron-down' : 'chevron-right'" size="sm" />
|
|
15486
|
+
</button>
|
|
15487
|
+
} @else {
|
|
15488
|
+
<span class="sol-tree__toggle-spacer" aria-hidden="true"></span>
|
|
15489
|
+
}
|
|
15490
|
+
|
|
15491
|
+
<div class="sol-tree__content">
|
|
15492
|
+
@if (nodeTemplate(); as tpl) {
|
|
15493
|
+
<ng-container
|
|
15494
|
+
[ngTemplateOutlet]="tpl"
|
|
15495
|
+
[ngTemplateOutletContext]="templateContext()"
|
|
15496
|
+
/>
|
|
15497
|
+
} @else {
|
|
15498
|
+
<span class="sol-tree__label">{{ node().label }}</span>
|
|
15499
|
+
}
|
|
15500
|
+
</div>
|
|
15501
|
+
</div>
|
|
15502
|
+
|
|
15503
|
+
@if (showChildren()) {
|
|
15504
|
+
<div role="group" class="sol-tree__group">
|
|
15505
|
+
@for (child of children(); track child.id) {
|
|
15506
|
+
<sol-tree-node [node]="child" [depth]="depth() + 1" />
|
|
15507
|
+
}
|
|
15508
|
+
</div>
|
|
15509
|
+
}
|
|
15510
|
+
`, isInline: true, styles: [":host{display:block;border-radius:var(--sol-border-radius-lg, 12px);outline:none}:host(:focus-visible){outline:2px solid var(--sol-color-primary, #2563eb);outline-offset:2px}.sol-tree__row{display:flex;align-items:center;gap:var(--sol-space-sm, .5rem);min-width:0}.sol-tree__toggle,.sol-tree__toggle-spacer{flex:none;width:2.25rem;height:2.25rem}.sol-tree__toggle{display:inline-flex;align-items:center;justify-content:center;padding:0;border:none;border-radius:var(--sol-border-radius-md, 8px);background:transparent;color:var(--sol-color-text-secondary, #6b7280);cursor:pointer;transition:background var(--sol-dur-fast, .12s) var(--sol-ease, ease),color var(--sol-dur-fast, .12s) var(--sol-ease, ease)}.sol-tree__toggle:hover{background:var(--sol-bg-sunken, rgba(0, 0, 0, .05));color:var(--sol-color-text-primary, #111827)}.sol-tree__content{flex:1 1 auto;min-width:0}.sol-tree__label{display:block;overflow:hidden;color:var(--sol-color-text-primary, #111827);font-family:var(--sol-font-family);font-size:var(--sol-font-size-base, 14px);text-overflow:ellipsis;white-space:nowrap}.sol-tree__group{display:flex;flex-direction:column;gap:var(--sol-space-sm, .5rem);margin-top:var(--sol-space-sm, .5rem)}@media(prefers-reduced-motion:reduce){.sol-tree__toggle{transition:none}}\n"], dependencies: [{ kind: "component", type: SolTreeNodeComponent, selector: "sol-tree-node", inputs: ["node", "depth"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: SolIconComponent, selector: "sol-icon", inputs: ["name", "size", "variant"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
15511
|
+
}
|
|
15512
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: SolTreeNodeComponent, decorators: [{
|
|
15513
|
+
type: Component,
|
|
15514
|
+
args: [{ selector: 'sol-tree-node', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [NgTemplateOutlet, SolIconComponent, SolTreeNodeComponent], host: {
|
|
15515
|
+
role: 'treeitem',
|
|
15516
|
+
class: 'sol-tree__item',
|
|
15517
|
+
'[attr.aria-expanded]': 'hasChildren() ? expanded() : null',
|
|
15518
|
+
'[attr.aria-level]': 'depth() + 1',
|
|
15519
|
+
'[attr.tabindex]': 'tabIndexValue()',
|
|
15520
|
+
'(keydown)': 'onKeydown($event)',
|
|
15521
|
+
'(focus)': 'onFocus()',
|
|
15522
|
+
}, template: `
|
|
15523
|
+
<div class="sol-tree__row" [style.paddingLeft.px]="depth() * indent()">
|
|
15524
|
+
@if (hasChildren()) {
|
|
15525
|
+
<button
|
|
15526
|
+
type="button"
|
|
15527
|
+
class="sol-tree__toggle"
|
|
15528
|
+
tabindex="-1"
|
|
15529
|
+
[attr.aria-label]="toggleAriaLabel()"
|
|
15530
|
+
(click)="onToggleClick($event)"
|
|
15531
|
+
>
|
|
15532
|
+
<sol-icon [name]="expanded() ? 'chevron-down' : 'chevron-right'" size="sm" />
|
|
15533
|
+
</button>
|
|
15534
|
+
} @else {
|
|
15535
|
+
<span class="sol-tree__toggle-spacer" aria-hidden="true"></span>
|
|
15536
|
+
}
|
|
15537
|
+
|
|
15538
|
+
<div class="sol-tree__content">
|
|
15539
|
+
@if (nodeTemplate(); as tpl) {
|
|
15540
|
+
<ng-container
|
|
15541
|
+
[ngTemplateOutlet]="tpl"
|
|
15542
|
+
[ngTemplateOutletContext]="templateContext()"
|
|
15543
|
+
/>
|
|
15544
|
+
} @else {
|
|
15545
|
+
<span class="sol-tree__label">{{ node().label }}</span>
|
|
15546
|
+
}
|
|
15547
|
+
</div>
|
|
15548
|
+
</div>
|
|
15549
|
+
|
|
15550
|
+
@if (showChildren()) {
|
|
15551
|
+
<div role="group" class="sol-tree__group">
|
|
15552
|
+
@for (child of children(); track child.id) {
|
|
15553
|
+
<sol-tree-node [node]="child" [depth]="depth() + 1" />
|
|
15554
|
+
}
|
|
15555
|
+
</div>
|
|
15556
|
+
}
|
|
15557
|
+
`, styles: [":host{display:block;border-radius:var(--sol-border-radius-lg, 12px);outline:none}:host(:focus-visible){outline:2px solid var(--sol-color-primary, #2563eb);outline-offset:2px}.sol-tree__row{display:flex;align-items:center;gap:var(--sol-space-sm, .5rem);min-width:0}.sol-tree__toggle,.sol-tree__toggle-spacer{flex:none;width:2.25rem;height:2.25rem}.sol-tree__toggle{display:inline-flex;align-items:center;justify-content:center;padding:0;border:none;border-radius:var(--sol-border-radius-md, 8px);background:transparent;color:var(--sol-color-text-secondary, #6b7280);cursor:pointer;transition:background var(--sol-dur-fast, .12s) var(--sol-ease, ease),color var(--sol-dur-fast, .12s) var(--sol-ease, ease)}.sol-tree__toggle:hover{background:var(--sol-bg-sunken, rgba(0, 0, 0, .05));color:var(--sol-color-text-primary, #111827)}.sol-tree__content{flex:1 1 auto;min-width:0}.sol-tree__label{display:block;overflow:hidden;color:var(--sol-color-text-primary, #111827);font-family:var(--sol-font-family);font-size:var(--sol-font-size-base, 14px);text-overflow:ellipsis;white-space:nowrap}.sol-tree__group{display:flex;flex-direction:column;gap:var(--sol-space-sm, .5rem);margin-top:var(--sol-space-sm, .5rem)}@media(prefers-reduced-motion:reduce){.sol-tree__toggle{transition:none}}\n"] }]
|
|
15558
|
+
}], propDecorators: { node: [{ type: i0.Input, args: [{ isSignal: true, alias: "node", required: true }] }], depth: [{ type: i0.Input, args: [{ isSignal: true, alias: "depth", required: false }] }] } });
|
|
15559
|
+
/**
|
|
15560
|
+
* `sol-tree` — árbol jerárquico genérico del design system.
|
|
15561
|
+
*
|
|
15562
|
+
* Sube a la librería el MECANISMO (recursión, ARIA `tree`/`treeitem`/`group`,
|
|
15563
|
+
* roving tabindex con flechas, expandir/colapsar, cota de profundidad) y deja
|
|
15564
|
+
* en la aplicación el CÓMO SE PINTA cada nodo, vía el `ng-template` marcado
|
|
15565
|
+
* con `solTreeNodeDef`. Cero conocimiento del dominio: ni rutas, ni `Router`,
|
|
15566
|
+
* ni badges, ni barras de avance.
|
|
15567
|
+
*
|
|
15568
|
+
* ```html
|
|
15569
|
+
* <sol-tree
|
|
15570
|
+
* [nodes]="arbol()"
|
|
15571
|
+
* [(expandedIds)]="expandidos"
|
|
15572
|
+
* (nodeSelected)="router.navigate(['/proyectos', $event.id])"
|
|
15573
|
+
* (nodeToggled)="persistir($event.expandedIds)"
|
|
15574
|
+
* >
|
|
15575
|
+
* <ng-template solTreeNodeDef let-node let-expanded="expanded">
|
|
15576
|
+
* <sol-card>{{ node.label }}</sol-card>
|
|
15577
|
+
* </ng-template>
|
|
15578
|
+
* </sol-tree>
|
|
15579
|
+
* ```
|
|
15580
|
+
*
|
|
15581
|
+
* Estados: si `nodes` llega vacío el árbol no pinta nada — el vacío legítimo,
|
|
15582
|
+
* la carga y el error son del consumidor (`sol-skeleton`, `sol-empty-state`).
|
|
15583
|
+
*
|
|
15584
|
+
* @typeParam T Tipo de la carga libre `data` de cada nodo.
|
|
15585
|
+
*/
|
|
15586
|
+
class SolTreeComponent {
|
|
15587
|
+
i18n = inject(SOL_I18N);
|
|
15588
|
+
state = inject(SolTreeState);
|
|
15589
|
+
/** Raíces del bosque. Un árbol de una sola raíz es un arreglo de un elemento. */
|
|
15590
|
+
nodes = input.required(/* @ts-ignore */
|
|
15591
|
+
...(ngDevMode ? [{ debugName: "nodes" }] : /* istanbul ignore next */ []));
|
|
15592
|
+
/**
|
|
15593
|
+
* Ids expandidos, enlazable en dos vías `[(expandedIds)]`.
|
|
15594
|
+
*
|
|
15595
|
+
* `null` (default) = NO controlado: el árbol maneja la expansión solo y la
|
|
15596
|
+
* siembra con {@link defaultExpandedDepth}. Cualquier arreglo —incluido
|
|
15597
|
+
* `[]`— pasa a modo controlado: manda el consumidor y el árbol solo propone
|
|
15598
|
+
* el nuevo valor. Se eligió `null` en vez de `[]` como default justamente
|
|
15599
|
+
* para poder distinguir "no me controles" de "todo colapsado".
|
|
15600
|
+
*/
|
|
15601
|
+
expandedIds = model(null, /* @ts-ignore */
|
|
15602
|
+
...(ngDevMode ? [{ debugName: "expandedIds" }] : /* istanbul ignore next */ []));
|
|
15603
|
+
/**
|
|
15604
|
+
* Niveles que arrancan expandidos en modo no controlado. `1` (default)
|
|
15605
|
+
* expande las raíces, así el árbol nunca se ve como un muro de filas
|
|
15606
|
+
* colapsadas; `0` lo deja todo cerrado.
|
|
15607
|
+
*/
|
|
15608
|
+
defaultExpandedDepth = input(1, /* @ts-ignore */
|
|
15609
|
+
...(ngDevMode ? [{ debugName: "defaultExpandedDepth" }] : /* istanbul ignore next */ []));
|
|
15610
|
+
/** Niveles VISIBLES como máximo. Ver {@link SOL_TREE_MAX_DEPTH}. */
|
|
15611
|
+
maxDepth = input(SOL_TREE_MAX_DEPTH, /* @ts-ignore */
|
|
15612
|
+
...(ngDevMode ? [{ debugName: "maxDepth" }] : /* istanbul ignore next */ []));
|
|
15613
|
+
/** Sangría en px que suma cada nivel. */
|
|
15614
|
+
indent = input(16, /* @ts-ignore */
|
|
15615
|
+
...(ngDevMode ? [{ debugName: "indent" }] : /* istanbul ignore next */ []));
|
|
15616
|
+
/** Override del `aria-label` del contenedor `role="tree"`. */
|
|
15617
|
+
ariaLabel = input('', /* @ts-ignore */
|
|
15618
|
+
...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
15619
|
+
/** Se emite al activar un nodo hoja con Enter/Espacio, o al llamar {@link select}. */
|
|
15620
|
+
nodeSelected = output();
|
|
15621
|
+
/** Se emite en cada expandir/colapsar, con el set completo resultante. */
|
|
15622
|
+
nodeToggled = output();
|
|
15623
|
+
/** Plantilla de contenido proyectada (opcional: sin ella se pinta `node.label`). */
|
|
15624
|
+
nodeDef = contentChild(SolTreeNodeDefDirective, /* @ts-ignore */
|
|
15625
|
+
...(ngDevMode ? [{ debugName: "nodeDef" }] : /* istanbul ignore next */ []));
|
|
15626
|
+
nodeTemplate = computed(() => this.nodeDef()?.template ?? null, /* @ts-ignore */
|
|
15627
|
+
...(ngDevMode ? [{ debugName: "nodeTemplate" }] : /* istanbul ignore next */ []));
|
|
15628
|
+
/** Ids que la semilla dejaría expandidos con la profundidad actual. */
|
|
15629
|
+
seedIds = computed(() => collectExpandableIds(this.nodes(), this.defaultExpandedDepth()), /* @ts-ignore */
|
|
15630
|
+
...(ngDevMode ? [{ debugName: "seedIds" }] : /* istanbul ignore next */ []));
|
|
15631
|
+
/**
|
|
15632
|
+
* Clave estructural de la semilla. Se compara como string (no por
|
|
15633
|
+
* identidad del arreglo) para que un `nodes` recreado con el MISMO
|
|
15634
|
+
* contenido no borre lo que el usuario ya expandió o colapsó a mano.
|
|
15635
|
+
*/
|
|
15636
|
+
seedKey = computed(() => this.seedIds().join('|'), /* @ts-ignore */
|
|
15637
|
+
...(ngDevMode ? [{ debugName: "seedKey" }] : /* istanbul ignore next */ []));
|
|
15638
|
+
/** Expansión interna (modo no controlado); se resiembra al cambiar el árbol. */
|
|
15639
|
+
autoExpanded = linkedSignal({ ...(ngDevMode ? { debugName: "autoExpanded" } : /* istanbul ignore next */ {}), source: this.seedKey,
|
|
15640
|
+
computation: () => untracked(() => new Set(this.seedIds())) });
|
|
15641
|
+
/** Set de expansión vigente: el del consumidor si controla, si no el interno. */
|
|
15642
|
+
expandedSet = computed(() => {
|
|
15643
|
+
const controlled = this.expandedIds();
|
|
15644
|
+
return controlled === null ? this.autoExpanded() : new Set(controlled);
|
|
15645
|
+
}, /* @ts-ignore */
|
|
15646
|
+
...(ngDevMode ? [{ debugName: "expandedSet" }] : /* istanbul ignore next */ []));
|
|
15647
|
+
treeAriaLabel = computed(() => {
|
|
15648
|
+
this.i18n.activeLang();
|
|
15649
|
+
const override = this.ariaLabel().trim();
|
|
15650
|
+
if (override)
|
|
15651
|
+
return override;
|
|
15652
|
+
const translated = this.i18n.translate('shared.tree.ariaLabel');
|
|
15653
|
+
return translated && translated !== 'shared.tree.ariaLabel'
|
|
15654
|
+
? translated
|
|
15655
|
+
: 'Árbol jerárquico';
|
|
15656
|
+
}, /* @ts-ignore */
|
|
15657
|
+
...(ngDevMode ? [{ debugName: "treeAriaLabel" }] : /* istanbul ignore next */ []));
|
|
15658
|
+
constructor() {
|
|
15659
|
+
this.state.owner = this;
|
|
15660
|
+
// Roving tabindex: el árbol siempre tiene UNA parada de Tab. Se ancla en
|
|
15661
|
+
// la primera raíz y solo se reubica si el nodo activo desapareció del
|
|
15662
|
+
// árbol (recarga, filtro), nunca mientras el usuario navega con flechas.
|
|
15663
|
+
effect(() => {
|
|
15664
|
+
const roots = this.nodes();
|
|
15665
|
+
untracked(() => {
|
|
15666
|
+
const active = this.state.activeId();
|
|
15667
|
+
if (active !== null && containsId(roots, active))
|
|
15668
|
+
return;
|
|
15669
|
+
this.state.activeId.set(roots[0]?.id ?? null);
|
|
15670
|
+
});
|
|
15671
|
+
});
|
|
15672
|
+
}
|
|
15673
|
+
/** ¿Está expandido ese id? */
|
|
15674
|
+
isExpanded(id) {
|
|
15675
|
+
return this.expandedSet().has(id);
|
|
15676
|
+
}
|
|
15677
|
+
/** Alterna la expansión de un nodo (lo mismo que hace el chevron). */
|
|
15678
|
+
toggle(node) {
|
|
15679
|
+
this.setExpanded(node, !this.expandedSet().has(node.id));
|
|
15680
|
+
}
|
|
15681
|
+
/** Fija la expansión de un nodo y emite `nodeToggled`. */
|
|
15682
|
+
setExpanded(node, expanded) {
|
|
15683
|
+
const next = new Set(this.expandedSet());
|
|
15684
|
+
if (expanded) {
|
|
15685
|
+
next.add(node.id);
|
|
15686
|
+
}
|
|
15687
|
+
else {
|
|
15688
|
+
next.delete(node.id);
|
|
15689
|
+
}
|
|
15690
|
+
const ids = [...next];
|
|
15691
|
+
this.autoExpanded.set(next);
|
|
15692
|
+
if (this.expandedIds() !== null) {
|
|
15693
|
+
this.expandedIds.set(ids);
|
|
15694
|
+
}
|
|
15695
|
+
this.nodeToggled.emit({
|
|
15696
|
+
node: node,
|
|
15697
|
+
expanded,
|
|
15698
|
+
expandedIds: ids,
|
|
15699
|
+
});
|
|
15700
|
+
}
|
|
15701
|
+
/**
|
|
15702
|
+
* Emite `nodeSelected`. Es la puerta para que la plantilla proyectada
|
|
15703
|
+
* seleccione CUALQUIER nodo con un clic propio (`(click)="tree.select(node)"`
|
|
15704
|
+
* sobre una referencia `#tree`), no solo las hojas con Enter/Espacio.
|
|
15705
|
+
*/
|
|
15706
|
+
select(node) {
|
|
15707
|
+
this.nodeSelected.emit(node);
|
|
15708
|
+
}
|
|
15709
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: SolTreeComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
15710
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: SolTreeComponent, isStandalone: true, selector: "sol-tree", inputs: { nodes: { classPropertyName: "nodes", publicName: "nodes", isSignal: true, isRequired: true, transformFunction: null }, expandedIds: { classPropertyName: "expandedIds", publicName: "expandedIds", isSignal: true, isRequired: false, transformFunction: null }, defaultExpandedDepth: { classPropertyName: "defaultExpandedDepth", publicName: "defaultExpandedDepth", isSignal: true, isRequired: false, transformFunction: null }, maxDepth: { classPropertyName: "maxDepth", publicName: "maxDepth", isSignal: true, isRequired: false, transformFunction: null }, indent: { classPropertyName: "indent", publicName: "indent", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { expandedIds: "expandedIdsChange", nodeSelected: "nodeSelected", nodeToggled: "nodeToggled" }, providers: [SolTreeState], queries: [{ propertyName: "nodeDef", first: true, predicate: SolTreeNodeDefDirective, descendants: true, isSignal: true }], ngImport: i0, template: `
|
|
15711
|
+
<div role="tree" class="sol-tree" [attr.aria-label]="treeAriaLabel()">
|
|
15712
|
+
@for (root of nodes(); track root.id) {
|
|
15713
|
+
<sol-tree-node [node]="root" [depth]="0" />
|
|
15714
|
+
}
|
|
15715
|
+
</div>
|
|
15716
|
+
`, isInline: true, styles: [":host{display:block;width:100%}.sol-tree{display:flex;flex-direction:column;gap:var(--sol-space-sm, .5rem);font-family:var(--sol-font-family)}\n"], dependencies: [{ kind: "component", type: SolTreeNodeComponent, selector: "sol-tree-node", inputs: ["node", "depth"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
15717
|
+
}
|
|
15718
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: SolTreeComponent, decorators: [{
|
|
15719
|
+
type: Component,
|
|
15720
|
+
args: [{ selector: 'sol-tree', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, providers: [SolTreeState], imports: [SolTreeNodeComponent], template: `
|
|
15721
|
+
<div role="tree" class="sol-tree" [attr.aria-label]="treeAriaLabel()">
|
|
15722
|
+
@for (root of nodes(); track root.id) {
|
|
15723
|
+
<sol-tree-node [node]="root" [depth]="0" />
|
|
15724
|
+
}
|
|
15725
|
+
</div>
|
|
15726
|
+
`, styles: [":host{display:block;width:100%}.sol-tree{display:flex;flex-direction:column;gap:var(--sol-space-sm, .5rem);font-family:var(--sol-font-family)}\n"] }]
|
|
15727
|
+
}], ctorParameters: () => [], propDecorators: { nodes: [{ type: i0.Input, args: [{ isSignal: true, alias: "nodes", required: true }] }], expandedIds: [{ type: i0.Input, args: [{ isSignal: true, alias: "expandedIds", required: false }] }, { type: i0.Output, args: ["expandedIdsChange"] }], defaultExpandedDepth: [{ type: i0.Input, args: [{ isSignal: true, alias: "defaultExpandedDepth", required: false }] }], maxDepth: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxDepth", required: false }] }], indent: [{ type: i0.Input, args: [{ isSignal: true, alias: "indent", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], nodeSelected: [{ type: i0.Output, args: ["nodeSelected"] }], nodeToggled: [{ type: i0.Output, args: ["nodeToggled"] }], nodeDef: [{ type: i0.ContentChild, args: [i0.forwardRef(() => SolTreeNodeDefDirective), { isSignal: true }] }] } });
|
|
15728
|
+
/** Ids de los nodos con hijos que están por encima de `depth` (base 0). */
|
|
15729
|
+
function collectExpandableIds(nodes, depth, current = 0) {
|
|
15730
|
+
if (current >= depth)
|
|
15731
|
+
return [];
|
|
15732
|
+
const ids = [];
|
|
15733
|
+
for (const node of nodes) {
|
|
15734
|
+
const children = node.children ?? [];
|
|
15735
|
+
if (children.length === 0)
|
|
15736
|
+
continue;
|
|
15737
|
+
ids.push(node.id);
|
|
15738
|
+
ids.push(...collectExpandableIds(children, depth, current + 1));
|
|
15739
|
+
}
|
|
15740
|
+
return ids;
|
|
15741
|
+
}
|
|
15742
|
+
/** ¿Existe ese id en alguna parte del bosque? */
|
|
15743
|
+
function containsId(nodes, id) {
|
|
15744
|
+
for (const node of nodes) {
|
|
15745
|
+
if (node.id === id)
|
|
15746
|
+
return true;
|
|
15747
|
+
if (containsId(node.children ?? [], id))
|
|
15748
|
+
return true;
|
|
15749
|
+
}
|
|
15750
|
+
return false;
|
|
15751
|
+
}
|
|
15752
|
+
|
|
15753
|
+
const MINUTE_MS = 60_000;
|
|
15754
|
+
/**
|
|
15755
|
+
* `sol-notification-panel` — centro de notificaciones genérico y sin
|
|
15756
|
+
* acoplamiento al dominio.
|
|
15757
|
+
*
|
|
15758
|
+
* Extraído del `notification-panel` de `solercia-command`, que inyectaba
|
|
15759
|
+
* `NotificationsService` (se auto-alimentaba), inyectaba `Router` (navegaba
|
|
15760
|
+
* solo) e importaba `AppNotification`/`RULE_TYPE_LABELS` de `@entities`.
|
|
15761
|
+
* Aquí SUBE únicamente la presentación: la lista, el contador de no leídas,
|
|
15762
|
+
* los estados y las acciones. QUEDA en la aplicación de dónde salen los
|
|
15763
|
+
* datos y a dónde navega cada notificación — el panel no inyecta servicios
|
|
15764
|
+
* de datos, no llama HTTP y no navega: **emite**.
|
|
15765
|
+
*
|
|
15766
|
+
* ## Vacío ≠ error (deuda que este componente salda)
|
|
15767
|
+
*
|
|
15768
|
+
* El original mostraba "no hay notificaciones" también cuando la carga
|
|
15769
|
+
* fallaba (su `error:` solo apagaba el spinner), así que le mentía al
|
|
15770
|
+
* usuario. Aquí `state()` es excluyente y ordenado —
|
|
15771
|
+
* `loading` › `error` › `empty` › `content`— con `error` ANTES de `empty`:
|
|
15772
|
+
* una carga fallida deja `items` vacío, y si `empty` ganara volveríamos a
|
|
15773
|
+
* decir "no tienes notificaciones" cuando la verdad es "no pudimos saberlo".
|
|
15774
|
+
* Además el estado de error se pinta con estructura, tono y `role="alert"`
|
|
15775
|
+
* propios (nunca el `sol-empty-state`) y ofrece salida vía `retryRequested`.
|
|
15776
|
+
*
|
|
15777
|
+
* ## Fuente de verdad
|
|
15778
|
+
*
|
|
15779
|
+
* El panel NO guarda un espejo interno de `read`: lo pinta desde `items`.
|
|
15780
|
+
* Marcar como leída emite y espera que el consumidor reasigne `items` — así
|
|
15781
|
+
* la UI nunca afirma un cambio que el backend rechazó.
|
|
15782
|
+
*
|
|
15783
|
+
* Uso:
|
|
15784
|
+
* ```html
|
|
15785
|
+
* <sol-notification-panel
|
|
15786
|
+
* [items]="notificaciones()"
|
|
15787
|
+
* [loading]="cargando()"
|
|
15788
|
+
* [error]="fallo()"
|
|
15789
|
+
* [errorMessage]="mensajeDelBackend()"
|
|
15790
|
+
* (itemSelected)="abrir($event)"
|
|
15791
|
+
* (markedRead)="marcarLeida($event)"
|
|
15792
|
+
* (markedAllRead)="marcarTodas()"
|
|
15793
|
+
* (retryRequested)="recargar()"
|
|
15794
|
+
* (closed)="cerrar()"
|
|
15795
|
+
* />
|
|
15796
|
+
* ```
|
|
15797
|
+
*/
|
|
15798
|
+
class SolNotificationPanelComponent {
|
|
15799
|
+
i18n = inject(SOL_I18N);
|
|
15800
|
+
/**
|
|
15801
|
+
* Notificaciones a mostrar. El panel NO las va a buscar: el consumidor es
|
|
15802
|
+
* la fuente de verdad. Tipado con `null | undefined` a propósito, para el
|
|
15803
|
+
* patrón `[items]="stream$ | async"` (misma lección que `sol-timeline`).
|
|
15804
|
+
*/
|
|
15805
|
+
items = input([], /* @ts-ignore */
|
|
15806
|
+
...(ngDevMode ? [{ debugName: "items" }] : /* istanbul ignore next */ []));
|
|
15807
|
+
/** `true` mientras la carga está en curso. Gana sobre cualquier otro estado. */
|
|
15808
|
+
loading = input(false, /* @ts-ignore */
|
|
15809
|
+
...(ngDevMode ? [{ debugName: "loading" }] : /* istanbul ignore next */ []));
|
|
15810
|
+
/** `true` cuando la carga falló. Gana sobre el vacío — nunca se confunden. */
|
|
15811
|
+
error = input(false, /* @ts-ignore */
|
|
15812
|
+
...(ngDevMode ? [{ debugName: "error" }] : /* istanbul ignore next */ []));
|
|
15813
|
+
/**
|
|
15814
|
+
* Detalle del error tal como lo reportó el consumidor (mensaje del
|
|
15815
|
+
* backend). Cuando viene, reemplaza la descripción genérica: un error
|
|
15816
|
+
* específico jamás debe degradarse a "algo salió mal".
|
|
15817
|
+
*/
|
|
15818
|
+
errorMessage = input('', /* @ts-ignore */
|
|
15819
|
+
...(ngDevMode ? [{ debugName: "errorMessage" }] : /* istanbul ignore next */ []));
|
|
15820
|
+
/**
|
|
15821
|
+
* Claves i18n del estado vacío. Son inputs (no constantes) para que un
|
|
15822
|
+
* consumidor que filtra la lista distinga "todavía no hay nada" de "no hay
|
|
15823
|
+
* resultados con este filtro" sin que la librería conozca filtro alguno.
|
|
15824
|
+
*/
|
|
15825
|
+
emptyTitleKey = input('shared.notificationPanel.emptyTitle', /* @ts-ignore */
|
|
15826
|
+
...(ngDevMode ? [{ debugName: "emptyTitleKey" }] : /* istanbul ignore next */ []));
|
|
15827
|
+
emptyDescriptionKey = input('shared.notificationPanel.emptyDescription', /* @ts-ignore */
|
|
15828
|
+
...(ngDevMode ? [{ debugName: "emptyDescriptionKey" }] : /* istanbul ignore next */ []));
|
|
15829
|
+
/** Se activó una notificación. El consumidor decide a dónde lleva. */
|
|
15830
|
+
itemSelected = output();
|
|
15831
|
+
/** Se pidió marcar UNA notificación como leída. */
|
|
15832
|
+
markedRead = output();
|
|
15833
|
+
/** Se pidió marcar todas como leídas. */
|
|
15834
|
+
markedAllRead = output();
|
|
15835
|
+
/**
|
|
15836
|
+
* Se pidió reintentar la carga. Añadido sobre los cuatro outputs del
|
|
15837
|
+
* encargo: un estado de error sin salida es un callejón sin salida — el
|
|
15838
|
+
* usuario ve el fallo y no puede hacer nada desde el panel.
|
|
15839
|
+
*/
|
|
15840
|
+
retryRequested = output();
|
|
15841
|
+
/** Se pidió cerrar el panel. */
|
|
15842
|
+
closed = output();
|
|
15843
|
+
/** Lista normalizada: `null`/`undefined` se tratan como vacía. */
|
|
15844
|
+
list = computed(() => this.items() ?? [], /* @ts-ignore */
|
|
15845
|
+
...(ngDevMode ? [{ debugName: "list" }] : /* istanbul ignore next */ []));
|
|
15846
|
+
/** Notificaciones sin leer. `read` ausente cuenta como NO leída. */
|
|
15847
|
+
unreadCount = computed(() => this.list().reduce((total, item) => total + (item.read ? 0 : 1), 0), /* @ts-ignore */
|
|
15848
|
+
...(ngDevMode ? [{ debugName: "unreadCount" }] : /* istanbul ignore next */ []));
|
|
15849
|
+
/**
|
|
15850
|
+
* Estado excluyente. El orden es la corrección de fondo: `error` ANTES de
|
|
15851
|
+
* `empty`, porque una carga fallida también deja la lista vacía.
|
|
15852
|
+
*/
|
|
15853
|
+
state = computed(() => {
|
|
15854
|
+
if (this.loading())
|
|
15855
|
+
return 'loading';
|
|
15856
|
+
if (this.error())
|
|
15857
|
+
return 'error';
|
|
15858
|
+
return this.list().length === 0 ? 'empty' : 'content';
|
|
15859
|
+
}, /* @ts-ignore */
|
|
15860
|
+
...(ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []));
|
|
15861
|
+
/** Filas listas para pintar: la notificación + su tiempo relativo y tono. */
|
|
15862
|
+
rows = computed(() => {
|
|
15863
|
+
this.i18n.activeLang();
|
|
15864
|
+
const now = Date.now();
|
|
15865
|
+
return this.list().map((item) => ({
|
|
15866
|
+
item,
|
|
15867
|
+
timeLabel: this.formatRelativeTime(item.timestamp, now),
|
|
15868
|
+
tone: item.tone ?? 'neutral',
|
|
15869
|
+
}));
|
|
15870
|
+
}, /* @ts-ignore */
|
|
15871
|
+
...(ngDevMode ? [{ debugName: "rows" }] : /* istanbul ignore next */ []));
|
|
15872
|
+
// ---- copy propio del panel (claves fijas → `t()` reactivo) ----
|
|
15873
|
+
dialogAria = this.i18n.t('shared.notificationPanel.dialogAria');
|
|
15874
|
+
title = this.i18n.t('shared.notificationPanel.title');
|
|
15875
|
+
markAllReadLabel = this.i18n.t('shared.notificationPanel.markAllRead');
|
|
15876
|
+
closeLabel = this.i18n.t('shared.notificationPanel.close');
|
|
15877
|
+
markReadLabel = this.i18n.t('shared.notificationPanel.markRead');
|
|
15878
|
+
unreadDotLabel = this.i18n.t('shared.notificationPanel.unreadDot');
|
|
15879
|
+
errorTitle = this.i18n.t('shared.notificationPanel.errorTitle');
|
|
15880
|
+
retryLabel = this.i18n.t('shared.notificationPanel.retry');
|
|
15881
|
+
/** Etiqueta accesible del contador; el badge solo muestra el número. */
|
|
15882
|
+
unreadAria = computed(() => {
|
|
15883
|
+
this.i18n.activeLang();
|
|
15884
|
+
return this.i18n.translate('shared.notificationPanel.unreadCount', {
|
|
15885
|
+
count: this.unreadCount(),
|
|
15886
|
+
});
|
|
15887
|
+
}, /* @ts-ignore */
|
|
15888
|
+
...(ngDevMode ? [{ debugName: "unreadAria" }] : /* istanbul ignore next */ []));
|
|
15889
|
+
/** Descripción del error: el mensaje real del consumidor si lo hay. */
|
|
15890
|
+
errorDescription = computed(() => {
|
|
15891
|
+
this.i18n.activeLang();
|
|
15892
|
+
const detail = this.errorMessage().trim();
|
|
15893
|
+
return detail || this.i18n.translate('shared.notificationPanel.errorDescription');
|
|
15894
|
+
}, /* @ts-ignore */
|
|
15895
|
+
...(ngDevMode ? [{ debugName: "errorDescription" }] : /* istanbul ignore next */ []));
|
|
15896
|
+
/**
|
|
15897
|
+
* Formatea la marca de tiempo como texto relativo ("hace 2 h"). Devuelve
|
|
15898
|
+
* cadena vacía cuando falta o es inválida — el panel omite el tiempo en vez
|
|
15899
|
+
* de mostrar basura.
|
|
15900
|
+
*/
|
|
15901
|
+
formatRelativeTime(value, now) {
|
|
15902
|
+
if (value === null || value === undefined)
|
|
15903
|
+
return '';
|
|
15904
|
+
const ms = value instanceof Date
|
|
15905
|
+
? value.getTime()
|
|
15906
|
+
: typeof value === 'number'
|
|
15907
|
+
? value
|
|
15908
|
+
: Date.parse(value);
|
|
15909
|
+
if (!Number.isFinite(ms))
|
|
15910
|
+
return '';
|
|
15911
|
+
const minutes = Math.floor((now - ms) / MINUTE_MS);
|
|
15912
|
+
if (minutes < 1)
|
|
15913
|
+
return this.i18n.translate('shared.notificationPanel.relativeTime.now');
|
|
15914
|
+
if (minutes < 60) {
|
|
15915
|
+
return this.i18n.translate('shared.notificationPanel.relativeTime.minutes', {
|
|
15916
|
+
count: minutes,
|
|
15917
|
+
});
|
|
15918
|
+
}
|
|
15919
|
+
const hours = Math.floor(minutes / 60);
|
|
15920
|
+
if (hours < 24) {
|
|
15921
|
+
return this.i18n.translate('shared.notificationPanel.relativeTime.hours', { count: hours });
|
|
15922
|
+
}
|
|
15923
|
+
return this.i18n.translate('shared.notificationPanel.relativeTime.days', {
|
|
15924
|
+
count: Math.floor(hours / 24),
|
|
15925
|
+
});
|
|
15926
|
+
}
|
|
15927
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: SolNotificationPanelComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
15928
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: SolNotificationPanelComponent, isStandalone: true, selector: "sol-notification-panel", inputs: { items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, error: { classPropertyName: "error", publicName: "error", isSignal: true, isRequired: false, transformFunction: null }, errorMessage: { classPropertyName: "errorMessage", publicName: "errorMessage", isSignal: true, isRequired: false, transformFunction: null }, emptyTitleKey: { classPropertyName: "emptyTitleKey", publicName: "emptyTitleKey", isSignal: true, isRequired: false, transformFunction: null }, emptyDescriptionKey: { classPropertyName: "emptyDescriptionKey", publicName: "emptyDescriptionKey", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { itemSelected: "itemSelected", markedRead: "markedRead", markedAllRead: "markedAllRead", retryRequested: "retryRequested", closed: "closed" }, ngImport: i0, template: `
|
|
15929
|
+
<div class="sol-notification-panel" role="dialog" [attr.aria-label]="dialogAria()">
|
|
15930
|
+
<header class="sol-notification-panel__header">
|
|
15931
|
+
<div class="sol-notification-panel__heading">
|
|
15932
|
+
<h2 class="sol-notification-panel__title">{{ title() }}</h2>
|
|
15933
|
+
@if (unreadCount() > 0) {
|
|
15934
|
+
<span
|
|
15935
|
+
class="sol-notification-panel__unread"
|
|
15936
|
+
role="status"
|
|
15937
|
+
[attr.aria-label]="unreadAria()"
|
|
15938
|
+
>
|
|
15939
|
+
<sol-badge variant="info" size="sm">{{ unreadCount() }}</sol-badge>
|
|
15940
|
+
</span>
|
|
15941
|
+
}
|
|
15942
|
+
</div>
|
|
15943
|
+
|
|
15944
|
+
<div class="sol-notification-panel__header-actions">
|
|
15945
|
+
@if (unreadCount() > 0) {
|
|
15946
|
+
<sol-button
|
|
15947
|
+
variant="ghost"
|
|
15948
|
+
size="sm"
|
|
15949
|
+
class="sol-notification-panel__mark-all"
|
|
15950
|
+
(clicked)="markedAllRead.emit()"
|
|
15951
|
+
>
|
|
15952
|
+
{{ markAllReadLabel() }}
|
|
15953
|
+
</sol-button>
|
|
15954
|
+
}
|
|
15955
|
+
<sol-icon-button
|
|
15956
|
+
icon="x-mark"
|
|
15957
|
+
variant="ghost"
|
|
15958
|
+
size="touch"
|
|
15959
|
+
[ariaLabel]="closeLabel()"
|
|
15960
|
+
(clicked)="closed.emit()"
|
|
15961
|
+
/>
|
|
15962
|
+
</div>
|
|
15963
|
+
</header>
|
|
15964
|
+
|
|
15965
|
+
<div class="sol-notification-panel__body" [attr.data-state]="state()">
|
|
15966
|
+
@switch (state()) {
|
|
15967
|
+
@case ('loading') {
|
|
15968
|
+
<div class="sol-notification-panel__loading">
|
|
15969
|
+
<sol-spinner size="md" />
|
|
15970
|
+
</div>
|
|
15971
|
+
}
|
|
15972
|
+
|
|
15973
|
+
@case ('error') {
|
|
15974
|
+
<div class="sol-notification-panel__error" role="alert">
|
|
15975
|
+
<span class="sol-notification-panel__error-icon" aria-hidden="true">
|
|
15976
|
+
<sol-icon name="exclamation-triangle" size="lg" />
|
|
15977
|
+
</span>
|
|
15978
|
+
<p class="sol-notification-panel__error-title">{{ errorTitle() }}</p>
|
|
15979
|
+
<p class="sol-notification-panel__error-description">{{ errorDescription() }}</p>
|
|
15980
|
+
<sol-button variant="secondary" size="sm" (clicked)="retryRequested.emit()">
|
|
15981
|
+
{{ retryLabel() }}
|
|
15982
|
+
</sol-button>
|
|
15983
|
+
</div>
|
|
15984
|
+
}
|
|
15985
|
+
|
|
15986
|
+
@case ('empty') {
|
|
15987
|
+
<sol-empty-state
|
|
15988
|
+
class="sol-notification-panel__empty"
|
|
15989
|
+
icon="bell"
|
|
15990
|
+
[titleKey]="emptyTitleKey()"
|
|
15991
|
+
[descriptionKey]="emptyDescriptionKey()"
|
|
15992
|
+
/>
|
|
15993
|
+
}
|
|
15994
|
+
|
|
15995
|
+
@default {
|
|
15996
|
+
<ul class="sol-notification-panel__list" role="list">
|
|
15997
|
+
@for (row of rows(); track row.item.id) {
|
|
15998
|
+
<li
|
|
15999
|
+
class="sol-notification-panel__item"
|
|
16000
|
+
[class.sol-notification-panel__item--unread]="!row.item.read"
|
|
16001
|
+
>
|
|
16002
|
+
<button
|
|
16003
|
+
type="button"
|
|
16004
|
+
class="sol-notification-panel__content"
|
|
16005
|
+
(click)="itemSelected.emit(row.item)"
|
|
16006
|
+
>
|
|
16007
|
+
<span class="sol-notification-panel__item-title">
|
|
16008
|
+
@if (!row.item.read) {
|
|
16009
|
+
<span
|
|
16010
|
+
class="sol-notification-panel__dot"
|
|
16011
|
+
[attr.aria-label]="unreadDotLabel()"
|
|
16012
|
+
></span>
|
|
16013
|
+
}
|
|
16014
|
+
{{ row.item.title }}
|
|
16015
|
+
</span>
|
|
16016
|
+
|
|
16017
|
+
@if (row.item.body) {
|
|
16018
|
+
<span class="sol-notification-panel__item-body">{{ row.item.body }}</span>
|
|
16019
|
+
}
|
|
16020
|
+
|
|
16021
|
+
@if (row.item.typeLabel || row.timeLabel) {
|
|
16022
|
+
<span class="sol-notification-panel__meta">
|
|
16023
|
+
@if (row.item.typeLabel) {
|
|
16024
|
+
<sol-badge [variant]="row.tone" size="sm">
|
|
16025
|
+
{{ row.item.typeLabel }}
|
|
16026
|
+
</sol-badge>
|
|
16027
|
+
}
|
|
16028
|
+
@if (row.timeLabel) {
|
|
16029
|
+
<span class="sol-notification-panel__time">{{ row.timeLabel }}</span>
|
|
16030
|
+
}
|
|
16031
|
+
</span>
|
|
16032
|
+
}
|
|
16033
|
+
</button>
|
|
16034
|
+
|
|
16035
|
+
@if (!row.item.read) {
|
|
16036
|
+
<sol-icon-button
|
|
16037
|
+
icon="check"
|
|
16038
|
+
variant="ghost"
|
|
16039
|
+
size="touch"
|
|
16040
|
+
class="sol-notification-panel__mark-read"
|
|
16041
|
+
[ariaLabel]="markReadLabel()"
|
|
16042
|
+
(clicked)="markedRead.emit(row.item)"
|
|
16043
|
+
/>
|
|
16044
|
+
}
|
|
16045
|
+
</li>
|
|
16046
|
+
}
|
|
16047
|
+
</ul>
|
|
16048
|
+
}
|
|
16049
|
+
}
|
|
16050
|
+
</div>
|
|
16051
|
+
</div>
|
|
16052
|
+
`, isInline: true, styles: [":host{display:block;font-family:var(--sol-font-family, inherit)}.sol-notification-panel{display:flex;flex-direction:column;width:100%;overflow:hidden;border:var(--sol-border-width-default, 1px) solid var(--sol-border-color-default, #e2e8f0);border-radius:var(--sol-card-radius, var(--sol-border-radius-lg, 12px));background:var(--sol-card-bg, var(--sol-bg-surface, #fff));box-shadow:var(--sol-shadow-lg, 0 10px 25px rgb(15 23 42 / 12%))}.sol-notification-panel__header{display:flex;align-items:center;justify-content:space-between;gap:var(--sol-space-sm, 8px);padding:var(--sol-space-sm, 8px) var(--sol-space-md, 16px);border-bottom:var(--sol-border-width-default, 1px) solid var(--sol-border-color-default, #e2e8f0)}.sol-notification-panel__heading{display:inline-flex;align-items:center;gap:var(--sol-space-sm, 8px);min-width:0}.sol-notification-panel__title{margin:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:var(--sol-font-size-base, .9375rem);font-weight:var(--sol-font-weight-bold, 600);color:var(--sol-color-text-primary, #0f172a)}.sol-notification-panel__unread{display:inline-flex}.sol-notification-panel__header-actions{display:inline-flex;align-items:center;gap:var(--sol-space-xs, 4px);flex-shrink:0}.sol-notification-panel__body{max-height:28rem;overflow-y:auto}.sol-notification-panel__loading{display:flex;align-items:center;justify-content:center;padding:var(--sol-space-xl, 40px) var(--sol-space-md, 16px)}.sol-notification-panel__error{display:flex;flex-direction:column;align-items:center;text-align:center;gap:var(--sol-space-xs, 4px);padding:var(--sol-space-xl, 40px) var(--sol-space-md, 16px);background:color-mix(in srgb,var(--sol-color-danger, #ef4444) 6%,transparent)}.sol-notification-panel__error-icon{display:inline-flex;color:var(--sol-color-danger, #ef4444);margin-bottom:var(--sol-space-xs, 4px)}.sol-notification-panel__error-title{margin:0;font-size:var(--sol-font-size-sm, .875rem);font-weight:var(--sol-font-weight-bold, 600);color:var(--sol-color-text-primary, #0f172a)}.sol-notification-panel__error-description{margin:0 0 var(--sol-space-sm, 8px);max-width:32ch;font-size:var(--sol-font-size-sm, .8125rem);color:var(--sol-color-text-muted, #64748b)}.sol-notification-panel__empty{display:block}.sol-notification-panel__list{margin:0;padding:0;list-style:none}.sol-notification-panel__item{display:flex;align-items:flex-start;gap:var(--sol-space-xs, 4px);padding-right:var(--sol-space-sm, 8px);border-bottom:var(--sol-border-width-default, 1px) solid var(--sol-border-color-default, #e2e8f0);transition:background-color var(--sol-dur-fast, .15s) var(--sol-ease, ease)}.sol-notification-panel__item:last-child{border-bottom:none}.sol-notification-panel__item:hover{background:var(--sol-bg-sunken, color-mix(in srgb, var(--sol-color-primary, #2563eb) 5%, transparent))}.sol-notification-panel__item--unread{background:color-mix(in srgb,var(--sol-color-info, #3b82f6) 7%,transparent)}.sol-notification-panel__content{display:grid;gap:2px;flex:1 1 auto;min-width:0;margin:0;padding:var(--sol-space-sm, 10px) var(--sol-space-md, 16px);border:none;background:transparent;font:inherit;text-align:left;cursor:pointer}.sol-notification-panel__content:focus-visible{outline:none;box-shadow:var( --sol-focus-ring, inset 0 0 0 2px color-mix(in srgb, var(--sol-color-primary, #2563eb) 45%, transparent) )}.sol-notification-panel__item-title{display:flex;align-items:center;gap:var(--sol-space-xs, 6px);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:var(--sol-font-size-sm, .875rem);font-weight:var(--sol-font-weight-normal, 500);color:var(--sol-color-text-primary, #0f172a)}.sol-notification-panel__item--unread .sol-notification-panel__item-title{font-weight:var(--sol-font-weight-bold, 600)}.sol-notification-panel__dot{width:7px;height:7px;flex-shrink:0;border-radius:var(--sol-border-radius-full, 9999px);background:var(--sol-color-info, #3b82f6)}.sol-notification-panel__item-body{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;line-clamp:2;overflow:hidden;font-size:var(--sol-font-size-sm, .75rem);color:var(--sol-color-text-muted, #64748b)}.sol-notification-panel__meta{display:flex;flex-wrap:wrap;align-items:center;gap:var(--sol-space-xs, 6px);margin-top:var(--sol-space-xs, 4px)}.sol-notification-panel__time{font-size:var(--sol-font-size-sm, .6875rem);color:var(--sol-color-text-secondary, #94a3b8)}.sol-notification-panel__mark-read{align-self:center;flex-shrink:0}@media(prefers-reduced-motion:reduce){.sol-notification-panel__item{transition:none}}\n"], dependencies: [{ kind: "component", type: SolBadgeComponent, selector: "sol-badge", inputs: ["variant", "size"] }, { kind: "component", type: SolButtonComponent, selector: "sol-button", inputs: ["variant", "size", "disabled", "type", "loading"], outputs: ["clicked"] }, { kind: "component", type: SolEmptyStateComponent, selector: "sol-empty-state", inputs: ["icon", "titleKey", "descriptionKey"] }, { kind: "component", type: SolIconComponent, selector: "sol-icon", inputs: ["name", "size", "variant"] }, { kind: "component", type: SolIconButtonComponent, selector: "sol-icon-button", inputs: ["icon", "ariaLabel", "type", "variant", "size", "disabled"], outputs: ["clicked"] }, { kind: "component", type: SolSpinnerComponent, selector: "sol-spinner", inputs: ["size", "color"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
16053
|
+
}
|
|
16054
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: SolNotificationPanelComponent, decorators: [{
|
|
16055
|
+
type: Component,
|
|
16056
|
+
args: [{ selector: 'sol-notification-panel', standalone: true, imports: [
|
|
16057
|
+
SolBadgeComponent,
|
|
16058
|
+
SolButtonComponent,
|
|
16059
|
+
SolEmptyStateComponent,
|
|
16060
|
+
SolIconComponent,
|
|
16061
|
+
SolIconButtonComponent,
|
|
16062
|
+
SolSpinnerComponent,
|
|
16063
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, template: `
|
|
16064
|
+
<div class="sol-notification-panel" role="dialog" [attr.aria-label]="dialogAria()">
|
|
16065
|
+
<header class="sol-notification-panel__header">
|
|
16066
|
+
<div class="sol-notification-panel__heading">
|
|
16067
|
+
<h2 class="sol-notification-panel__title">{{ title() }}</h2>
|
|
16068
|
+
@if (unreadCount() > 0) {
|
|
16069
|
+
<span
|
|
16070
|
+
class="sol-notification-panel__unread"
|
|
16071
|
+
role="status"
|
|
16072
|
+
[attr.aria-label]="unreadAria()"
|
|
16073
|
+
>
|
|
16074
|
+
<sol-badge variant="info" size="sm">{{ unreadCount() }}</sol-badge>
|
|
16075
|
+
</span>
|
|
16076
|
+
}
|
|
16077
|
+
</div>
|
|
16078
|
+
|
|
16079
|
+
<div class="sol-notification-panel__header-actions">
|
|
16080
|
+
@if (unreadCount() > 0) {
|
|
16081
|
+
<sol-button
|
|
16082
|
+
variant="ghost"
|
|
16083
|
+
size="sm"
|
|
16084
|
+
class="sol-notification-panel__mark-all"
|
|
16085
|
+
(clicked)="markedAllRead.emit()"
|
|
16086
|
+
>
|
|
16087
|
+
{{ markAllReadLabel() }}
|
|
16088
|
+
</sol-button>
|
|
16089
|
+
}
|
|
16090
|
+
<sol-icon-button
|
|
16091
|
+
icon="x-mark"
|
|
16092
|
+
variant="ghost"
|
|
16093
|
+
size="touch"
|
|
16094
|
+
[ariaLabel]="closeLabel()"
|
|
16095
|
+
(clicked)="closed.emit()"
|
|
16096
|
+
/>
|
|
16097
|
+
</div>
|
|
16098
|
+
</header>
|
|
16099
|
+
|
|
16100
|
+
<div class="sol-notification-panel__body" [attr.data-state]="state()">
|
|
16101
|
+
@switch (state()) {
|
|
16102
|
+
@case ('loading') {
|
|
16103
|
+
<div class="sol-notification-panel__loading">
|
|
16104
|
+
<sol-spinner size="md" />
|
|
16105
|
+
</div>
|
|
16106
|
+
}
|
|
16107
|
+
|
|
16108
|
+
@case ('error') {
|
|
16109
|
+
<div class="sol-notification-panel__error" role="alert">
|
|
16110
|
+
<span class="sol-notification-panel__error-icon" aria-hidden="true">
|
|
16111
|
+
<sol-icon name="exclamation-triangle" size="lg" />
|
|
16112
|
+
</span>
|
|
16113
|
+
<p class="sol-notification-panel__error-title">{{ errorTitle() }}</p>
|
|
16114
|
+
<p class="sol-notification-panel__error-description">{{ errorDescription() }}</p>
|
|
16115
|
+
<sol-button variant="secondary" size="sm" (clicked)="retryRequested.emit()">
|
|
16116
|
+
{{ retryLabel() }}
|
|
16117
|
+
</sol-button>
|
|
16118
|
+
</div>
|
|
16119
|
+
}
|
|
16120
|
+
|
|
16121
|
+
@case ('empty') {
|
|
16122
|
+
<sol-empty-state
|
|
16123
|
+
class="sol-notification-panel__empty"
|
|
16124
|
+
icon="bell"
|
|
16125
|
+
[titleKey]="emptyTitleKey()"
|
|
16126
|
+
[descriptionKey]="emptyDescriptionKey()"
|
|
16127
|
+
/>
|
|
16128
|
+
}
|
|
16129
|
+
|
|
16130
|
+
@default {
|
|
16131
|
+
<ul class="sol-notification-panel__list" role="list">
|
|
16132
|
+
@for (row of rows(); track row.item.id) {
|
|
16133
|
+
<li
|
|
16134
|
+
class="sol-notification-panel__item"
|
|
16135
|
+
[class.sol-notification-panel__item--unread]="!row.item.read"
|
|
16136
|
+
>
|
|
16137
|
+
<button
|
|
16138
|
+
type="button"
|
|
16139
|
+
class="sol-notification-panel__content"
|
|
16140
|
+
(click)="itemSelected.emit(row.item)"
|
|
16141
|
+
>
|
|
16142
|
+
<span class="sol-notification-panel__item-title">
|
|
16143
|
+
@if (!row.item.read) {
|
|
16144
|
+
<span
|
|
16145
|
+
class="sol-notification-panel__dot"
|
|
16146
|
+
[attr.aria-label]="unreadDotLabel()"
|
|
16147
|
+
></span>
|
|
16148
|
+
}
|
|
16149
|
+
{{ row.item.title }}
|
|
16150
|
+
</span>
|
|
16151
|
+
|
|
16152
|
+
@if (row.item.body) {
|
|
16153
|
+
<span class="sol-notification-panel__item-body">{{ row.item.body }}</span>
|
|
16154
|
+
}
|
|
16155
|
+
|
|
16156
|
+
@if (row.item.typeLabel || row.timeLabel) {
|
|
16157
|
+
<span class="sol-notification-panel__meta">
|
|
16158
|
+
@if (row.item.typeLabel) {
|
|
16159
|
+
<sol-badge [variant]="row.tone" size="sm">
|
|
16160
|
+
{{ row.item.typeLabel }}
|
|
16161
|
+
</sol-badge>
|
|
16162
|
+
}
|
|
16163
|
+
@if (row.timeLabel) {
|
|
16164
|
+
<span class="sol-notification-panel__time">{{ row.timeLabel }}</span>
|
|
16165
|
+
}
|
|
16166
|
+
</span>
|
|
16167
|
+
}
|
|
16168
|
+
</button>
|
|
16169
|
+
|
|
16170
|
+
@if (!row.item.read) {
|
|
16171
|
+
<sol-icon-button
|
|
16172
|
+
icon="check"
|
|
16173
|
+
variant="ghost"
|
|
16174
|
+
size="touch"
|
|
16175
|
+
class="sol-notification-panel__mark-read"
|
|
16176
|
+
[ariaLabel]="markReadLabel()"
|
|
16177
|
+
(clicked)="markedRead.emit(row.item)"
|
|
16178
|
+
/>
|
|
16179
|
+
}
|
|
16180
|
+
</li>
|
|
16181
|
+
}
|
|
16182
|
+
</ul>
|
|
16183
|
+
}
|
|
16184
|
+
}
|
|
16185
|
+
</div>
|
|
16186
|
+
</div>
|
|
16187
|
+
`, styles: [":host{display:block;font-family:var(--sol-font-family, inherit)}.sol-notification-panel{display:flex;flex-direction:column;width:100%;overflow:hidden;border:var(--sol-border-width-default, 1px) solid var(--sol-border-color-default, #e2e8f0);border-radius:var(--sol-card-radius, var(--sol-border-radius-lg, 12px));background:var(--sol-card-bg, var(--sol-bg-surface, #fff));box-shadow:var(--sol-shadow-lg, 0 10px 25px rgb(15 23 42 / 12%))}.sol-notification-panel__header{display:flex;align-items:center;justify-content:space-between;gap:var(--sol-space-sm, 8px);padding:var(--sol-space-sm, 8px) var(--sol-space-md, 16px);border-bottom:var(--sol-border-width-default, 1px) solid var(--sol-border-color-default, #e2e8f0)}.sol-notification-panel__heading{display:inline-flex;align-items:center;gap:var(--sol-space-sm, 8px);min-width:0}.sol-notification-panel__title{margin:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:var(--sol-font-size-base, .9375rem);font-weight:var(--sol-font-weight-bold, 600);color:var(--sol-color-text-primary, #0f172a)}.sol-notification-panel__unread{display:inline-flex}.sol-notification-panel__header-actions{display:inline-flex;align-items:center;gap:var(--sol-space-xs, 4px);flex-shrink:0}.sol-notification-panel__body{max-height:28rem;overflow-y:auto}.sol-notification-panel__loading{display:flex;align-items:center;justify-content:center;padding:var(--sol-space-xl, 40px) var(--sol-space-md, 16px)}.sol-notification-panel__error{display:flex;flex-direction:column;align-items:center;text-align:center;gap:var(--sol-space-xs, 4px);padding:var(--sol-space-xl, 40px) var(--sol-space-md, 16px);background:color-mix(in srgb,var(--sol-color-danger, #ef4444) 6%,transparent)}.sol-notification-panel__error-icon{display:inline-flex;color:var(--sol-color-danger, #ef4444);margin-bottom:var(--sol-space-xs, 4px)}.sol-notification-panel__error-title{margin:0;font-size:var(--sol-font-size-sm, .875rem);font-weight:var(--sol-font-weight-bold, 600);color:var(--sol-color-text-primary, #0f172a)}.sol-notification-panel__error-description{margin:0 0 var(--sol-space-sm, 8px);max-width:32ch;font-size:var(--sol-font-size-sm, .8125rem);color:var(--sol-color-text-muted, #64748b)}.sol-notification-panel__empty{display:block}.sol-notification-panel__list{margin:0;padding:0;list-style:none}.sol-notification-panel__item{display:flex;align-items:flex-start;gap:var(--sol-space-xs, 4px);padding-right:var(--sol-space-sm, 8px);border-bottom:var(--sol-border-width-default, 1px) solid var(--sol-border-color-default, #e2e8f0);transition:background-color var(--sol-dur-fast, .15s) var(--sol-ease, ease)}.sol-notification-panel__item:last-child{border-bottom:none}.sol-notification-panel__item:hover{background:var(--sol-bg-sunken, color-mix(in srgb, var(--sol-color-primary, #2563eb) 5%, transparent))}.sol-notification-panel__item--unread{background:color-mix(in srgb,var(--sol-color-info, #3b82f6) 7%,transparent)}.sol-notification-panel__content{display:grid;gap:2px;flex:1 1 auto;min-width:0;margin:0;padding:var(--sol-space-sm, 10px) var(--sol-space-md, 16px);border:none;background:transparent;font:inherit;text-align:left;cursor:pointer}.sol-notification-panel__content:focus-visible{outline:none;box-shadow:var( --sol-focus-ring, inset 0 0 0 2px color-mix(in srgb, var(--sol-color-primary, #2563eb) 45%, transparent) )}.sol-notification-panel__item-title{display:flex;align-items:center;gap:var(--sol-space-xs, 6px);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:var(--sol-font-size-sm, .875rem);font-weight:var(--sol-font-weight-normal, 500);color:var(--sol-color-text-primary, #0f172a)}.sol-notification-panel__item--unread .sol-notification-panel__item-title{font-weight:var(--sol-font-weight-bold, 600)}.sol-notification-panel__dot{width:7px;height:7px;flex-shrink:0;border-radius:var(--sol-border-radius-full, 9999px);background:var(--sol-color-info, #3b82f6)}.sol-notification-panel__item-body{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;line-clamp:2;overflow:hidden;font-size:var(--sol-font-size-sm, .75rem);color:var(--sol-color-text-muted, #64748b)}.sol-notification-panel__meta{display:flex;flex-wrap:wrap;align-items:center;gap:var(--sol-space-xs, 6px);margin-top:var(--sol-space-xs, 4px)}.sol-notification-panel__time{font-size:var(--sol-font-size-sm, .6875rem);color:var(--sol-color-text-secondary, #94a3b8)}.sol-notification-panel__mark-read{align-self:center;flex-shrink:0}@media(prefers-reduced-motion:reduce){.sol-notification-panel__item{transition:none}}\n"] }]
|
|
16188
|
+
}], propDecorators: { items: [{ type: i0.Input, args: [{ isSignal: true, alias: "items", required: false }] }], loading: [{ type: i0.Input, args: [{ isSignal: true, alias: "loading", required: false }] }], error: [{ type: i0.Input, args: [{ isSignal: true, alias: "error", required: false }] }], errorMessage: [{ type: i0.Input, args: [{ isSignal: true, alias: "errorMessage", required: false }] }], emptyTitleKey: [{ type: i0.Input, args: [{ isSignal: true, alias: "emptyTitleKey", required: false }] }], emptyDescriptionKey: [{ type: i0.Input, args: [{ isSignal: true, alias: "emptyDescriptionKey", required: false }] }], itemSelected: [{ type: i0.Output, args: ["itemSelected"] }], markedRead: [{ type: i0.Output, args: ["markedRead"] }], markedAllRead: [{ type: i0.Output, args: ["markedAllRead"] }], retryRequested: [{ type: i0.Output, args: ["retryRequested"] }], closed: [{ type: i0.Output, args: ["closed"] }] } });
|
|
16189
|
+
|
|
16190
|
+
/** Prefijo del catálogo i18n donde viven los textos por defecto del componente. */
|
|
16191
|
+
const I18N_PREFIX = 'shared.scopeSwitcher';
|
|
16192
|
+
/**
|
|
16193
|
+
* `sol-scope-switcher` — selector genérico de ámbito activo.
|
|
16194
|
+
*
|
|
16195
|
+
* Presenta la lista de ámbitos disponibles con su etiqueta y su etiqueta
|
|
16196
|
+
* secundaria, marca cuál está activo y emite el elegido. Nada más.
|
|
16197
|
+
*
|
|
16198
|
+
* ## Frontera deliberada: esto es SOLO el selector visual
|
|
16199
|
+
*
|
|
16200
|
+
* El componente es un control puro y sin memoria. NO persiste la elección, NO
|
|
16201
|
+
* reinicia stores, NO recarga menús, NO reconecta sockets y NO toca cabeceras
|
|
16202
|
+
* HTTP: todo eso es política de la aplicación anfitriona, que reacciona a
|
|
16203
|
+
* `scopeSelected` y decide qué significa "cambiar de ámbito" en su dominio.
|
|
16204
|
+
* Meter cualquiera de esas responsabilidades aquí ataría `@solercia/ui` a un
|
|
16205
|
+
* backend y a un modelo de sesión concretos, que es justo lo que este refactor
|
|
16206
|
+
* evita.
|
|
16207
|
+
*
|
|
16208
|
+
* También es la aplicación —no el componente— la que decide si un cambio
|
|
16209
|
+
* prospera: mientras verifica el acceso puede pasar `disabled` para congelar
|
|
16210
|
+
* el control, y si falla puede pasar `status="error"` conservando `scopes` y
|
|
16211
|
+
* `activeScopeId` anteriores. En ese caso el selector sigue mostrando el
|
|
16212
|
+
* contexto vigente y suma una alerta debajo, sin quedar en un estado a medias.
|
|
16213
|
+
*
|
|
16214
|
+
* ## Un solo ámbito
|
|
16215
|
+
*
|
|
16216
|
+
* Con un único ámbito no se renderiza disparador ni panel: se muestra como
|
|
16217
|
+
* activo, en texto estático, sin obligar a elegir entre una sola opción.
|
|
16218
|
+
*
|
|
16219
|
+
* @typeParam TData Tipo de la carga libre `SolScope.data`.
|
|
16220
|
+
*
|
|
16221
|
+
* @example
|
|
16222
|
+
* ```html
|
|
16223
|
+
* <sol-scope-switcher
|
|
16224
|
+
* [scopes]="empresas()"
|
|
16225
|
+
* [activeScopeId]="empresaActivaId()"
|
|
16226
|
+
* [status]="estado()"
|
|
16227
|
+
* [disabled]="cambiando()"
|
|
16228
|
+
* (scopeSelected)="cambiarEmpresa($event)"
|
|
16229
|
+
* />
|
|
16230
|
+
* ```
|
|
16231
|
+
*/
|
|
16232
|
+
class SolScopeSwitcherComponent {
|
|
16233
|
+
i18n = inject(SOL_I18N);
|
|
16234
|
+
hostEl = inject(ElementRef);
|
|
16235
|
+
// ── Entradas ────────────────────────────────────────────────────────────────
|
|
16236
|
+
/**
|
|
16237
|
+
* Ámbitos disponibles, en el orden en que deben listarse. Tolera `null` y
|
|
16238
|
+
* `undefined` para servir sin ceremonia al patrón asíncrono
|
|
16239
|
+
* (`[scopes]="stream$ | async"`), que emite vacío antes de traer datos.
|
|
16240
|
+
*/
|
|
16241
|
+
scopes = input([], /* @ts-ignore */
|
|
16242
|
+
...(ngDevMode ? [{ debugName: "scopes" }] : /* istanbul ignore next */ []));
|
|
16243
|
+
/**
|
|
16244
|
+
* Id del ámbito activo. `null` (o un id que ya no está en la lista) cae al
|
|
16245
|
+
* primer ámbito disponible: el backend suele aplicar ese mismo respaldo, y
|
|
16246
|
+
* mostrar un disparador en blanco sería mentirle al usuario sobre el
|
|
16247
|
+
* contexto en el que realmente está trabajando.
|
|
16248
|
+
*/
|
|
16249
|
+
activeScopeId = input(null, /* @ts-ignore */
|
|
16250
|
+
...(ngDevMode ? [{ debugName: "activeScopeId" }] : /* istanbul ignore next */ []));
|
|
16251
|
+
/** Estado del selector. La lista vacía se deriva de `scopes`, no de aquí. */
|
|
16252
|
+
status = input('idle', /* @ts-ignore */
|
|
16253
|
+
...(ngDevMode ? [{ debugName: "status" }] : /* istanbul ignore next */ []));
|
|
16254
|
+
/**
|
|
16255
|
+
* Congela el disparador sin ocultar el contexto (p. ej. mientras la
|
|
16256
|
+
* aplicación verifica el acceso al ámbito recién elegido).
|
|
16257
|
+
*/
|
|
16258
|
+
disabled = input(false, /* @ts-ignore */
|
|
16259
|
+
...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
16260
|
+
/** Borde del disparador contra el que se alinea el panel. */
|
|
16261
|
+
align = input('end', /* @ts-ignore */
|
|
16262
|
+
...(ngDevMode ? [{ debugName: "align" }] : /* istanbul ignore next */ []));
|
|
16263
|
+
/**
|
|
16264
|
+
* Mensaje de error ya resuelto. Sobrescribe el texto por defecto para que la
|
|
16265
|
+
* aplicación distinga "sin conexión" de "perdiste el acceso"; si viene vacío,
|
|
16266
|
+
* se usa la clave `shared.scopeSwitcher.error`.
|
|
16267
|
+
*/
|
|
16268
|
+
errorMessage = input('', /* @ts-ignore */
|
|
16269
|
+
...(ngDevMode ? [{ debugName: "errorMessage" }] : /* istanbul ignore next */ []));
|
|
16270
|
+
/** Texto del estado vacío. Vacío ⇒ clave `shared.scopeSwitcher.empty`. */
|
|
16271
|
+
emptyMessage = input('', /* @ts-ignore */
|
|
16272
|
+
...(ngDevMode ? [{ debugName: "emptyMessage" }] : /* istanbul ignore next */ []));
|
|
16273
|
+
/** Texto del estado de carga. Vacío ⇒ clave `shared.scopeSwitcher.loading`. */
|
|
16274
|
+
loadingMessage = input('', /* @ts-ignore */
|
|
16275
|
+
...(ngDevMode ? [{ debugName: "loadingMessage" }] : /* istanbul ignore next */ []));
|
|
16276
|
+
/** `aria-label` del disparador. Vacío ⇒ clave `shared.scopeSwitcher.trigger`. */
|
|
16277
|
+
triggerAriaLabel = input('', /* @ts-ignore */
|
|
16278
|
+
...(ngDevMode ? [{ debugName: "triggerAriaLabel" }] : /* istanbul ignore next */ []));
|
|
16279
|
+
/** `aria-label` del panel. Vacío ⇒ clave `shared.scopeSwitcher.panel`. */
|
|
16280
|
+
panelAriaLabel = input('', /* @ts-ignore */
|
|
16281
|
+
...(ngDevMode ? [{ debugName: "panelAriaLabel" }] : /* istanbul ignore next */ []));
|
|
16282
|
+
// ── Salidas ─────────────────────────────────────────────────────────────────
|
|
16283
|
+
/**
|
|
16284
|
+
* Emite el ámbito elegido, con su `data` intacta. El componente NO persiste,
|
|
16285
|
+
* NO recarga y NO reintenta: la aplicación decide qué hacer con el evento.
|
|
16286
|
+
*
|
|
16287
|
+
* No emite cuando el usuario vuelve a elegir el ámbito que ya estaba activo —
|
|
16288
|
+
* en el consumidor eso equivaldría a reiniciar todo el contexto sin motivo.
|
|
16289
|
+
*/
|
|
16290
|
+
scopeSelected = output();
|
|
16291
|
+
/** Emite al abrir (`true`) y al cerrar (`false`) el panel. */
|
|
16292
|
+
openChange = output();
|
|
16293
|
+
// ── Estado interno ──────────────────────────────────────────────────────────
|
|
16294
|
+
/** Verdadero mientras el panel está desplegado. */
|
|
16295
|
+
isOpen = signal(false, /* @ts-ignore */
|
|
16296
|
+
...(ngDevMode ? [{ debugName: "isOpen" }] : /* istanbul ignore next */ []));
|
|
16297
|
+
/** Verdadero cuando el panel volteó hacia arriba (lo decide la directiva). */
|
|
16298
|
+
dropUp = signal(false, /* @ts-ignore */
|
|
16299
|
+
...(ngDevMode ? [{ debugName: "dropUp" }] : /* istanbul ignore next */ []));
|
|
16300
|
+
/** Índice del ámbito enfocado por teclado; `-1` cuando el panel está cerrado. */
|
|
16301
|
+
highlightedIndex = signal(-1, /* @ts-ignore */
|
|
16302
|
+
...(ngDevMode ? [{ debugName: "highlightedIndex" }] : /* istanbul ignore next */ []));
|
|
16303
|
+
/** Altura estimada del panel: umbral de volteo de `solFloatingPanel`. */
|
|
16304
|
+
panelFlipThreshold = 320;
|
|
16305
|
+
static nextId = 0;
|
|
16306
|
+
/** Id único que enlaza el disparador (`aria-controls`) con el panel portaleado. */
|
|
16307
|
+
panelId = `sol-scope-switcher-panel-${SolScopeSwitcherComponent.nextId++}`;
|
|
16308
|
+
triggerRef = viewChild('triggerBtn', /* @ts-ignore */
|
|
16309
|
+
...(ngDevMode ? [{ debugName: "triggerRef" }] : /* istanbul ignore next */ []));
|
|
16310
|
+
panelRef = viewChild('panel', /* @ts-ignore */
|
|
16311
|
+
...(ngDevMode ? [{ debugName: "panelRef" }] : /* istanbul ignore next */ []));
|
|
16312
|
+
optionRefs = viewChildren('optionBtn', /* @ts-ignore */
|
|
16313
|
+
...(ngDevMode ? [{ debugName: "optionRefs" }] : /* istanbul ignore next */ []));
|
|
16314
|
+
// ── Derivados ───────────────────────────────────────────────────────────────
|
|
16315
|
+
/** Lista normalizada: `null`/`undefined` se comportan como lista vacía. */
|
|
16316
|
+
scopeList = computed(() => this.scopes() ?? [], /* @ts-ignore */
|
|
16317
|
+
...(ngDevMode ? [{ debugName: "scopeList" }] : /* istanbul ignore next */ []));
|
|
16318
|
+
/** No hay ámbitos que listar. Es un estado legítimo, nunca un error. */
|
|
16319
|
+
isEmpty = computed(() => this.scopeList().length === 0, /* @ts-ignore */
|
|
16320
|
+
...(ngDevMode ? [{ debugName: "isEmpty" }] : /* istanbul ignore next */ []));
|
|
16321
|
+
/** Un único ámbito: se muestra como activo, sin obligar a elegir. */
|
|
16322
|
+
isSingle = computed(() => this.scopeList().length === 1, /* @ts-ignore */
|
|
16323
|
+
...(ngDevMode ? [{ debugName: "isSingle" }] : /* istanbul ignore next */ []));
|
|
16324
|
+
/** El selector está reportando una falla. */
|
|
16325
|
+
hasError = computed(() => this.status() === 'error', /* @ts-ignore */
|
|
16326
|
+
...(ngDevMode ? [{ debugName: "hasError" }] : /* istanbul ignore next */ []));
|
|
16327
|
+
/** Id realmente vigente: el explícito si sigue en la lista, si no el primero. */
|
|
16328
|
+
effectiveActiveId = computed(() => {
|
|
16329
|
+
const list = this.scopeList();
|
|
16330
|
+
const explicit = this.activeScopeId();
|
|
16331
|
+
if (explicit != null && list.some((scope) => scope.id === explicit))
|
|
16332
|
+
return explicit;
|
|
16333
|
+
return list[0]?.id ?? null;
|
|
16334
|
+
}, /* @ts-ignore */
|
|
16335
|
+
...(ngDevMode ? [{ debugName: "effectiveActiveId" }] : /* istanbul ignore next */ []));
|
|
16336
|
+
/** Ámbito activo resuelto, o `null` cuando la lista está vacía. */
|
|
16337
|
+
activeScope = computed(() => {
|
|
16338
|
+
const id = this.effectiveActiveId();
|
|
16339
|
+
return this.scopeList().find((scope) => scope.id === id) ?? null;
|
|
16340
|
+
}, /* @ts-ignore */
|
|
16341
|
+
...(ngDevMode ? [{ debugName: "activeScope" }] : /* istanbul ignore next */ []));
|
|
16342
|
+
// ── Textos ──────────────────────────────────────────────────────────────────
|
|
16343
|
+
// Idioma "sobrescritura primero, clave después" (mismo idiom que sol-date-picker):
|
|
16344
|
+
// el consumidor puede pasar su propio texto, y si no, manda el catálogo i18n.
|
|
16345
|
+
loadingKey = this.i18n.t(`${I18N_PREFIX}.loading`);
|
|
16346
|
+
emptyKey = this.i18n.t(`${I18N_PREFIX}.empty`);
|
|
16347
|
+
errorKey = this.i18n.t(`${I18N_PREFIX}.error`);
|
|
16348
|
+
triggerAriaKey = this.i18n.t(`${I18N_PREFIX}.trigger`);
|
|
16349
|
+
panelAriaKey = this.i18n.t(`${I18N_PREFIX}.panel`);
|
|
16350
|
+
activeOptionAriaKey = this.i18n.t(`${I18N_PREFIX}.activeOption`);
|
|
16351
|
+
loadingText = computed(() => this.loadingMessage() || this.loadingKey(), /* @ts-ignore */
|
|
16352
|
+
...(ngDevMode ? [{ debugName: "loadingText" }] : /* istanbul ignore next */ []));
|
|
16353
|
+
emptyText = computed(() => this.emptyMessage() || this.emptyKey(), /* @ts-ignore */
|
|
16354
|
+
...(ngDevMode ? [{ debugName: "emptyText" }] : /* istanbul ignore next */ []));
|
|
16355
|
+
errorText = computed(() => this.errorMessage() || this.errorKey(), /* @ts-ignore */
|
|
16356
|
+
...(ngDevMode ? [{ debugName: "errorText" }] : /* istanbul ignore next */ []));
|
|
16357
|
+
triggerAriaText = computed(() => this.triggerAriaLabel() || this.triggerAriaKey(), /* @ts-ignore */
|
|
16358
|
+
...(ngDevMode ? [{ debugName: "triggerAriaText" }] : /* istanbul ignore next */ []));
|
|
16359
|
+
panelAriaText = computed(() => this.panelAriaLabel() || this.panelAriaKey(), /* @ts-ignore */
|
|
16360
|
+
...(ngDevMode ? [{ debugName: "panelAriaText" }] : /* istanbul ignore next */ []));
|
|
16361
|
+
activeOptionAriaText = this.activeOptionAriaKey;
|
|
16362
|
+
constructor() {
|
|
16363
|
+
// Foco itinerante del listbox: la opción resaltada recibe el foco real (en
|
|
16364
|
+
// vez de simularlo con aria-activedescendant), así el lector de pantalla y
|
|
16365
|
+
// el foco visible del navegador cuentan siempre la misma historia. El
|
|
16366
|
+
// efecto depende de `optionRefs`, así que también corre en la primera
|
|
16367
|
+
// materialización del panel, no solo en los cambios de índice posteriores.
|
|
16368
|
+
effect(() => {
|
|
16369
|
+
if (!this.isOpen())
|
|
16370
|
+
return;
|
|
16371
|
+
const index = this.highlightedIndex();
|
|
16372
|
+
this.optionRefs()[index]?.nativeElement.focus();
|
|
16373
|
+
});
|
|
16374
|
+
}
|
|
16375
|
+
// ── Interacción ─────────────────────────────────────────────────────────────
|
|
16376
|
+
/** Abre o cierra el panel desde el disparador. */
|
|
16377
|
+
onTriggerClick() {
|
|
16378
|
+
if (this.isOpen()) {
|
|
16379
|
+
this.close();
|
|
16380
|
+
return;
|
|
16381
|
+
}
|
|
16382
|
+
this.open();
|
|
16383
|
+
}
|
|
16384
|
+
/** Teclado del disparador: abre con flechas/Enter/Espacio. */
|
|
16385
|
+
onTriggerKeydown(event) {
|
|
16386
|
+
switch (event.key) {
|
|
16387
|
+
case 'ArrowDown':
|
|
16388
|
+
case 'ArrowUp':
|
|
16389
|
+
case 'Enter':
|
|
16390
|
+
case ' ':
|
|
16391
|
+
event.preventDefault();
|
|
16392
|
+
this.open();
|
|
16393
|
+
break;
|
|
16394
|
+
default:
|
|
16395
|
+
break;
|
|
16396
|
+
}
|
|
16397
|
+
}
|
|
16398
|
+
/** Teclado del panel: navegación itinerante y selección. */
|
|
16399
|
+
onPanelKeydown(event) {
|
|
16400
|
+
const total = this.scopeList().length;
|
|
16401
|
+
if (total === 0)
|
|
16402
|
+
return;
|
|
16403
|
+
switch (event.key) {
|
|
16404
|
+
case 'ArrowDown':
|
|
16405
|
+
event.preventDefault();
|
|
16406
|
+
this.highlightedIndex.update((i) => (i + 1) % total);
|
|
16407
|
+
break;
|
|
16408
|
+
case 'ArrowUp':
|
|
16409
|
+
event.preventDefault();
|
|
16410
|
+
this.highlightedIndex.update((i) => (i - 1 + total) % total);
|
|
16411
|
+
break;
|
|
16412
|
+
case 'Home':
|
|
16413
|
+
event.preventDefault();
|
|
16414
|
+
this.highlightedIndex.set(0);
|
|
16415
|
+
break;
|
|
16416
|
+
case 'End':
|
|
16417
|
+
event.preventDefault();
|
|
16418
|
+
this.highlightedIndex.set(total - 1);
|
|
16419
|
+
break;
|
|
16420
|
+
case 'Enter':
|
|
16421
|
+
case ' ': {
|
|
16422
|
+
event.preventDefault();
|
|
16423
|
+
const scope = this.scopeList()[this.highlightedIndex()];
|
|
16424
|
+
if (scope)
|
|
16425
|
+
this.select(scope);
|
|
16426
|
+
break;
|
|
16427
|
+
}
|
|
16428
|
+
case 'Tab':
|
|
16429
|
+
// Tabular sale del selector: el panel se cierra en vez de dejar el foco
|
|
16430
|
+
// suelto en un nodo portaleado fuera del orden natural del documento.
|
|
16431
|
+
this.close();
|
|
16432
|
+
break;
|
|
16433
|
+
default:
|
|
16434
|
+
break;
|
|
16435
|
+
}
|
|
16436
|
+
}
|
|
16437
|
+
/** Elige un ámbito, cierra el panel y devuelve el foco al disparador. */
|
|
16438
|
+
select(scope) {
|
|
16439
|
+
const wasActive = scope.id === this.effectiveActiveId();
|
|
16440
|
+
this.close(true);
|
|
16441
|
+
if (wasActive)
|
|
16442
|
+
return;
|
|
16443
|
+
this.scopeSelected.emit(scope);
|
|
16444
|
+
}
|
|
16445
|
+
/** Escape cierra el panel y devuelve el foco al disparador. */
|
|
16446
|
+
onDocumentEscape() {
|
|
16447
|
+
if (!this.isOpen())
|
|
16448
|
+
return;
|
|
16449
|
+
this.close(true);
|
|
16450
|
+
}
|
|
16451
|
+
/**
|
|
16452
|
+
* Clic afuera. El panel vive portaleado en `document.body`, así que "dentro"
|
|
16453
|
+
* abarca tanto el host como el nodo portaleado.
|
|
16454
|
+
*/
|
|
16455
|
+
onDocumentClick(event) {
|
|
16456
|
+
if (!this.isOpen())
|
|
16457
|
+
return;
|
|
16458
|
+
const target = event.target;
|
|
16459
|
+
const insideHost = this.hostEl.nativeElement.contains(target);
|
|
16460
|
+
const insidePanel = this.panelRef()?.nativeElement.contains(target) ?? false;
|
|
16461
|
+
if (!insideHost && !insidePanel)
|
|
16462
|
+
this.close();
|
|
16463
|
+
}
|
|
16464
|
+
// ── Ciclo del panel ─────────────────────────────────────────────────────────
|
|
16465
|
+
open() {
|
|
16466
|
+
if (this.disabled() || this.isOpen())
|
|
16467
|
+
return;
|
|
16468
|
+
const list = this.scopeList();
|
|
16469
|
+
const activeIndex = list.findIndex((scope) => scope.id === this.effectiveActiveId());
|
|
16470
|
+
// Arranca sobre el ámbito vigente (no en cero): el usuario ve de entrada
|
|
16471
|
+
// dónde está parado y llega al vecino con una sola flecha.
|
|
16472
|
+
this.highlightedIndex.set(activeIndex >= 0 ? activeIndex : 0);
|
|
16473
|
+
this.isOpen.set(true);
|
|
16474
|
+
this.openChange.emit(true);
|
|
16475
|
+
}
|
|
16476
|
+
close(returnFocus = false) {
|
|
16477
|
+
if (!this.isOpen())
|
|
16478
|
+
return;
|
|
16479
|
+
this.isOpen.set(false);
|
|
16480
|
+
this.highlightedIndex.set(-1);
|
|
16481
|
+
this.openChange.emit(false);
|
|
16482
|
+
if (returnFocus)
|
|
16483
|
+
this.triggerRef()?.nativeElement.focus();
|
|
16484
|
+
}
|
|
16485
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: SolScopeSwitcherComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
16486
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: SolScopeSwitcherComponent, isStandalone: true, selector: "sol-scope-switcher", inputs: { scopes: { classPropertyName: "scopes", publicName: "scopes", isSignal: true, isRequired: false, transformFunction: null }, activeScopeId: { classPropertyName: "activeScopeId", publicName: "activeScopeId", isSignal: true, isRequired: false, transformFunction: null }, status: { classPropertyName: "status", publicName: "status", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, align: { classPropertyName: "align", publicName: "align", isSignal: true, isRequired: false, transformFunction: null }, errorMessage: { classPropertyName: "errorMessage", publicName: "errorMessage", isSignal: true, isRequired: false, transformFunction: null }, emptyMessage: { classPropertyName: "emptyMessage", publicName: "emptyMessage", isSignal: true, isRequired: false, transformFunction: null }, loadingMessage: { classPropertyName: "loadingMessage", publicName: "loadingMessage", isSignal: true, isRequired: false, transformFunction: null }, triggerAriaLabel: { classPropertyName: "triggerAriaLabel", publicName: "triggerAriaLabel", isSignal: true, isRequired: false, transformFunction: null }, panelAriaLabel: { classPropertyName: "panelAriaLabel", publicName: "panelAriaLabel", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { scopeSelected: "scopeSelected", openChange: "openChange" }, host: { listeners: { "document:keydown.escape": "onDocumentEscape()", "document:click": "onDocumentClick($event)" } }, viewQueries: [{ propertyName: "triggerRef", first: true, predicate: ["triggerBtn"], descendants: true, isSignal: true }, { propertyName: "panelRef", first: true, predicate: ["panel"], descendants: true, isSignal: true }, { propertyName: "optionRefs", predicate: ["optionBtn"], descendants: true, isSignal: true }], ngImport: i0, template: `
|
|
16487
|
+
@if (status() === 'loading') {
|
|
16488
|
+
<span class="sol-scope-switcher__loading" role="status">
|
|
16489
|
+
<sol-spinner size="sm" />
|
|
16490
|
+
<span class="sol-scope-switcher__loading-text">{{ loadingText() }}</span>
|
|
16491
|
+
</span>
|
|
16492
|
+
} @else {
|
|
16493
|
+
@if (isEmpty()) {
|
|
16494
|
+
<!-- Vacío legítimo: solo se pinta si NO hay error, para que "no tienes
|
|
16495
|
+
ámbitos" jamás se lea como "la consulta falló". -->
|
|
16496
|
+
@if (!hasError()) {
|
|
16497
|
+
<span class="sol-scope-switcher__empty">
|
|
16498
|
+
<sol-icon name="building" size="sm" class="sol-scope-switcher__empty-icon" />
|
|
16499
|
+
<span>{{ emptyText() }}</span>
|
|
16500
|
+
</span>
|
|
16501
|
+
}
|
|
16502
|
+
} @else if (isSingle()) {
|
|
16503
|
+
<span class="sol-scope-switcher__static" [attr.aria-label]="triggerAriaText()">
|
|
16504
|
+
@if (activeScope(); as scope) {
|
|
16505
|
+
@if (scope.icon) {
|
|
16506
|
+
<sol-icon [name]="scope.icon" size="sm" class="sol-scope-switcher__icon" />
|
|
16507
|
+
} @else {
|
|
16508
|
+
<sol-avatar [name]="scope.label" [imageUrl]="scope.imageUrl ?? null" size="sm" />
|
|
16509
|
+
}
|
|
16510
|
+
<span class="sol-scope-switcher__labels">
|
|
16511
|
+
<span class="sol-scope-switcher__label">{{ scope.label }}</span>
|
|
16512
|
+
@if (scope.sublabel) {
|
|
16513
|
+
<span class="sol-scope-switcher__sublabel">{{ scope.sublabel }}</span>
|
|
16514
|
+
}
|
|
16515
|
+
</span>
|
|
16516
|
+
}
|
|
16517
|
+
</span>
|
|
16518
|
+
} @else {
|
|
16519
|
+
<div class="sol-scope-switcher__host">
|
|
16520
|
+
<button
|
|
16521
|
+
#triggerBtn
|
|
16522
|
+
type="button"
|
|
16523
|
+
class="sol-scope-switcher__trigger"
|
|
16524
|
+
[class.sol-scope-switcher__trigger--open]="isOpen()"
|
|
16525
|
+
[disabled]="disabled()"
|
|
16526
|
+
aria-haspopup="listbox"
|
|
16527
|
+
[attr.aria-expanded]="isOpen()"
|
|
16528
|
+
[attr.aria-controls]="isOpen() ? panelId : null"
|
|
16529
|
+
[attr.aria-label]="triggerAriaText()"
|
|
16530
|
+
(click)="onTriggerClick()"
|
|
16531
|
+
(keydown)="onTriggerKeydown($event)"
|
|
16532
|
+
>
|
|
16533
|
+
@if (activeScope(); as scope) {
|
|
16534
|
+
@if (scope.icon) {
|
|
16535
|
+
<sol-icon [name]="scope.icon" size="sm" class="sol-scope-switcher__icon" />
|
|
16536
|
+
} @else {
|
|
16537
|
+
<sol-avatar [name]="scope.label" [imageUrl]="scope.imageUrl ?? null" size="sm" />
|
|
16538
|
+
}
|
|
16539
|
+
<span class="sol-scope-switcher__labels">
|
|
16540
|
+
<span class="sol-scope-switcher__label">{{ scope.label }}</span>
|
|
16541
|
+
@if (scope.sublabel) {
|
|
16542
|
+
<span class="sol-scope-switcher__sublabel">{{ scope.sublabel }}</span>
|
|
16543
|
+
}
|
|
16544
|
+
</span>
|
|
16545
|
+
}
|
|
16546
|
+
<sol-icon
|
|
16547
|
+
name="chevron-down"
|
|
16548
|
+
variant="fill"
|
|
16549
|
+
size="sm"
|
|
16550
|
+
class="sol-scope-switcher__arrow"
|
|
16551
|
+
[class.sol-scope-switcher__arrow--open]="isOpen()"
|
|
16552
|
+
/>
|
|
16553
|
+
</button>
|
|
16554
|
+
|
|
16555
|
+
<!-- El panel se portalea a document.body con position:fixed vía la
|
|
16556
|
+
directiva compartida solFloatingPanel: el switcher suele vivir en
|
|
16557
|
+
un header con overflow, y sin el portal el panel quedaría
|
|
16558
|
+
recortado. El trigger queda enlazado por aria-controls porque
|
|
16559
|
+
ambos viven en árboles distintos del DOM. -->
|
|
16560
|
+
@if (isOpen()) {
|
|
16561
|
+
<div
|
|
16562
|
+
#panel
|
|
16563
|
+
[id]="panelId"
|
|
16564
|
+
class="sol-scope-switcher__panel"
|
|
16565
|
+
[class.sol-scope-switcher__panel--up]="dropUp()"
|
|
16566
|
+
role="listbox"
|
|
16567
|
+
[attr.aria-label]="panelAriaText()"
|
|
16568
|
+
[solFloatingPanel]="triggerBtn"
|
|
16569
|
+
[matchTriggerWidth]="false"
|
|
16570
|
+
[flipThreshold]="panelFlipThreshold"
|
|
16571
|
+
[align]="align()"
|
|
16572
|
+
(dropUpChange)="dropUp.set($event)"
|
|
16573
|
+
(keydown)="onPanelKeydown($event)"
|
|
16574
|
+
>
|
|
16575
|
+
@for (scope of scopeList(); track scope.id; let i = $index) {
|
|
16576
|
+
<button
|
|
16577
|
+
#optionBtn
|
|
16578
|
+
type="button"
|
|
16579
|
+
class="sol-scope-switcher__option"
|
|
16580
|
+
[class.sol-scope-switcher__option--active]="scope.id === effectiveActiveId()"
|
|
16581
|
+
role="option"
|
|
16582
|
+
tabindex="-1"
|
|
16583
|
+
[attr.aria-selected]="scope.id === effectiveActiveId()"
|
|
16584
|
+
(click)="select(scope)"
|
|
16585
|
+
>
|
|
16586
|
+
@if (scope.icon) {
|
|
16587
|
+
<sol-icon [name]="scope.icon" size="sm" class="sol-scope-switcher__icon" />
|
|
16588
|
+
} @else {
|
|
16589
|
+
<sol-avatar [name]="scope.label" [imageUrl]="scope.imageUrl ?? null" size="sm" />
|
|
16590
|
+
}
|
|
16591
|
+
<span class="sol-scope-switcher__labels">
|
|
16592
|
+
<span class="sol-scope-switcher__label">{{ scope.label }}</span>
|
|
16593
|
+
@if (scope.sublabel) {
|
|
16594
|
+
<span class="sol-scope-switcher__sublabel">{{ scope.sublabel }}</span>
|
|
16595
|
+
}
|
|
16596
|
+
</span>
|
|
16597
|
+
@if (scope.id === effectiveActiveId()) {
|
|
16598
|
+
<sol-icon
|
|
16599
|
+
name="check"
|
|
16600
|
+
size="sm"
|
|
16601
|
+
class="sol-scope-switcher__check"
|
|
16602
|
+
[attr.aria-label]="activeOptionAriaText()"
|
|
16603
|
+
/>
|
|
16604
|
+
}
|
|
16605
|
+
</button>
|
|
16606
|
+
}
|
|
16607
|
+
</div>
|
|
16608
|
+
}
|
|
16609
|
+
</div>
|
|
16610
|
+
}
|
|
16611
|
+
|
|
16612
|
+
<!-- La alerta NO reemplaza al selector: convive con él para que un cambio
|
|
16613
|
+
fallido conserve el contexto anterior en pantalla (y se muestra sola
|
|
16614
|
+
cuando lo que falló fue la carga misma de la lista). -->
|
|
16615
|
+
@if (hasError()) {
|
|
16616
|
+
<p class="sol-scope-switcher__error" role="alert">
|
|
16617
|
+
<sol-icon name="exclamation-triangle" size="sm" class="sol-scope-switcher__error-icon" />
|
|
16618
|
+
<span>{{ errorText() }}</span>
|
|
16619
|
+
</p>
|
|
16620
|
+
}
|
|
16621
|
+
}
|
|
16622
|
+
`, isInline: true, styles: [":host{display:inline-block}:host,.sol-scope-switcher__panel{--sol-scope-switcher-bg: var(--sol-bg-surface, #ffffff);--sol-scope-switcher-text: var(--sol-color-text-primary, #1e293b);--sol-scope-switcher-muted: var(--sol-color-text-muted, #94a3b8);--sol-scope-switcher-border: var(--sol-border-color-default, #cbd5e1);--sol-scope-switcher-border-width: var(--sol-border-width-default, 1px);--sol-scope-switcher-accent: var(--sol-color-primary, #6366f1);--sol-scope-switcher-danger: var(--sol-color-danger, #ef4444);--sol-scope-switcher-radius: var(--sol-border-radius-md, .5rem);--sol-scope-switcher-height: var(--sol-size-input-height, 2.5rem);--sol-scope-switcher-gap: var(--sol-space-xs, .5rem);--sol-scope-switcher-padding-x: var(--sol-space-sm, .75rem);--sol-scope-switcher-font-size: var(--sol-font-size-base, .875rem);--sol-scope-switcher-sub-font-size: var(--sol-font-size-sm, .75rem);--sol-scope-switcher-weight: var(--sol-font-weight-bold, 600);--sol-scope-switcher-shadow: var(--sol-shadow-lg, 0 10px 25px rgba(0, 0, 0, .15));--sol-scope-switcher-hover: var(--sol-color-bg-hover, rgba(0, 0, 0, .04));--sol-scope-switcher-active-bg: color-mix(in srgb, var(--sol-color-primary, #6366f1) 12%, transparent);--sol-scope-switcher-focus-ring: 0 0 0 3px color-mix(in srgb, var(--sol-color-primary, #6366f1) 40%, transparent);--sol-scope-switcher-transition: var(--sol-dur-fast, .15s) var(--sol-ease, ease);--sol-scope-switcher-disabled-opacity: var(--sol-disabled-opacity, .55)}.sol-scope-switcher__host{position:relative;display:inline-block}.sol-scope-switcher__loading,.sol-scope-switcher__empty,.sol-scope-switcher__static{display:inline-flex;align-items:center;gap:var(--sol-scope-switcher-gap);min-height:var(--sol-scope-switcher-height);padding:0 var(--sol-scope-switcher-padding-x);font-size:var(--sol-scope-switcher-font-size);line-height:1.3}.sol-scope-switcher__loading,.sol-scope-switcher__empty{color:var(--sol-scope-switcher-muted)}.sol-scope-switcher__empty-icon{flex-shrink:0;color:var(--sol-scope-switcher-muted)}.sol-scope-switcher__static{color:var(--sol-scope-switcher-text);background:var(--sol-scope-switcher-bg);border:var(--sol-scope-switcher-border-width) solid var(--sol-scope-switcher-border);border-radius:var(--sol-scope-switcher-radius)}.sol-scope-switcher__trigger{display:inline-flex;align-items:center;gap:var(--sol-scope-switcher-gap);min-height:var(--sol-scope-switcher-height);max-width:100%;padding:0 var(--sol-scope-switcher-padding-x);font-family:inherit;font-size:var(--sol-scope-switcher-font-size);color:var(--sol-scope-switcher-text);text-align:left;background:var(--sol-scope-switcher-bg);border:var(--sol-scope-switcher-border-width) solid var(--sol-scope-switcher-border);border-radius:var(--sol-scope-switcher-radius);cursor:pointer;transition:background var(--sol-scope-switcher-transition),border-color var(--sol-scope-switcher-transition),box-shadow var(--sol-scope-switcher-transition)}.sol-scope-switcher__trigger:hover:not(:disabled){background:var(--sol-scope-switcher-hover)}.sol-scope-switcher__trigger:focus-visible{outline:none;border-color:var(--sol-scope-switcher-accent);box-shadow:var(--sol-scope-switcher-focus-ring)}.sol-scope-switcher__trigger--open{border-color:var(--sol-scope-switcher-accent)}.sol-scope-switcher__trigger:disabled{cursor:not-allowed;opacity:var(--sol-scope-switcher-disabled-opacity)}.sol-scope-switcher__arrow{flex-shrink:0;color:var(--sol-scope-switcher-muted);transition:transform var(--sol-scope-switcher-transition)}.sol-scope-switcher__arrow--open{transform:rotate(180deg)}.sol-scope-switcher__icon{flex-shrink:0;color:var(--sol-scope-switcher-muted)}.sol-scope-switcher__labels{display:flex;flex-direction:column;min-width:0;flex:1}.sol-scope-switcher__label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:var(--sol-scope-switcher-weight)}.sol-scope-switcher__sublabel{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:var(--sol-scope-switcher-sub-font-size);font-weight:400;color:var(--sol-scope-switcher-muted)}.sol-scope-switcher__panel{position:absolute;top:calc(100% + 4px);left:0;display:flex;flex-direction:column;min-width:15rem;max-width:22rem;max-height:20rem;overflow-y:auto;padding:.25rem;background:var(--sol-scope-switcher-bg);border:var(--sol-scope-switcher-border-width) solid var(--sol-scope-switcher-border);border-radius:var(--sol-scope-switcher-radius);box-shadow:var(--sol-scope-switcher-shadow);animation:sol-scope-switcher-fade .12s ease-out}.sol-scope-switcher__panel--up{top:auto;bottom:calc(100% + 4px)}.sol-scope-switcher__option{display:flex;align-items:center;gap:var(--sol-scope-switcher-gap);width:100%;padding:.5rem .625rem;font-family:inherit;font-size:var(--sol-scope-switcher-font-size);color:var(--sol-scope-switcher-text);text-align:left;background:transparent;border:none;border-radius:calc(var(--sol-scope-switcher-radius) - 2px);cursor:pointer;transition:background var(--sol-scope-switcher-transition)}.sol-scope-switcher__option:hover{background:var(--sol-scope-switcher-hover)}.sol-scope-switcher__option:focus-visible{outline:none;box-shadow:var(--sol-scope-switcher-focus-ring)}.sol-scope-switcher__option--active{background:var(--sol-scope-switcher-active-bg)}.sol-scope-switcher__option--active .sol-scope-switcher__label{color:var(--sol-scope-switcher-accent)}.sol-scope-switcher__check{flex-shrink:0;color:var(--sol-scope-switcher-accent)}.sol-scope-switcher__error{display:flex;align-items:flex-start;gap:.375rem;margin:.25rem 0 0;font-size:var(--sol-scope-switcher-sub-font-size);line-height:1.4;color:var(--sol-scope-switcher-danger)}.sol-scope-switcher__error-icon{flex-shrink:0;color:var(--sol-scope-switcher-danger)}@keyframes sol-scope-switcher-fade{0%{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:translateY(0)}}@media(prefers-reduced-motion:reduce){.sol-scope-switcher__panel{animation:none}.sol-scope-switcher__arrow,.sol-scope-switcher__trigger,.sol-scope-switcher__option{transition:none}}\n"], dependencies: [{ kind: "component", type: SolAvatarComponent, selector: "sol-avatar", inputs: ["name", "imageUrl", "size"] }, { kind: "component", type: SolIconComponent, selector: "sol-icon", inputs: ["name", "size", "variant"] }, { kind: "component", type: SolSpinnerComponent, selector: "sol-spinner", inputs: ["size", "color"] }, { kind: "directive", type: SolFloatingPanelDirective, selector: "[solFloatingPanel]", inputs: ["solFloatingPanel", "gap", "flipThreshold", "matchTriggerWidth", "align"], outputs: ["dropUpChange"], exportAs: ["solFloatingPanel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
16623
|
+
}
|
|
16624
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: SolScopeSwitcherComponent, decorators: [{
|
|
16625
|
+
type: Component,
|
|
16626
|
+
args: [{ selector: 'sol-scope-switcher', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [
|
|
16627
|
+
SolAvatarComponent,
|
|
16628
|
+
SolIconComponent,
|
|
16629
|
+
SolSpinnerComponent,
|
|
16630
|
+
SolFloatingPanelDirective,
|
|
16631
|
+
], template: `
|
|
16632
|
+
@if (status() === 'loading') {
|
|
16633
|
+
<span class="sol-scope-switcher__loading" role="status">
|
|
16634
|
+
<sol-spinner size="sm" />
|
|
16635
|
+
<span class="sol-scope-switcher__loading-text">{{ loadingText() }}</span>
|
|
16636
|
+
</span>
|
|
16637
|
+
} @else {
|
|
16638
|
+
@if (isEmpty()) {
|
|
16639
|
+
<!-- Vacío legítimo: solo se pinta si NO hay error, para que "no tienes
|
|
16640
|
+
ámbitos" jamás se lea como "la consulta falló". -->
|
|
16641
|
+
@if (!hasError()) {
|
|
16642
|
+
<span class="sol-scope-switcher__empty">
|
|
16643
|
+
<sol-icon name="building" size="sm" class="sol-scope-switcher__empty-icon" />
|
|
16644
|
+
<span>{{ emptyText() }}</span>
|
|
16645
|
+
</span>
|
|
16646
|
+
}
|
|
16647
|
+
} @else if (isSingle()) {
|
|
16648
|
+
<span class="sol-scope-switcher__static" [attr.aria-label]="triggerAriaText()">
|
|
16649
|
+
@if (activeScope(); as scope) {
|
|
16650
|
+
@if (scope.icon) {
|
|
16651
|
+
<sol-icon [name]="scope.icon" size="sm" class="sol-scope-switcher__icon" />
|
|
16652
|
+
} @else {
|
|
16653
|
+
<sol-avatar [name]="scope.label" [imageUrl]="scope.imageUrl ?? null" size="sm" />
|
|
16654
|
+
}
|
|
16655
|
+
<span class="sol-scope-switcher__labels">
|
|
16656
|
+
<span class="sol-scope-switcher__label">{{ scope.label }}</span>
|
|
16657
|
+
@if (scope.sublabel) {
|
|
16658
|
+
<span class="sol-scope-switcher__sublabel">{{ scope.sublabel }}</span>
|
|
16659
|
+
}
|
|
16660
|
+
</span>
|
|
16661
|
+
}
|
|
16662
|
+
</span>
|
|
16663
|
+
} @else {
|
|
16664
|
+
<div class="sol-scope-switcher__host">
|
|
16665
|
+
<button
|
|
16666
|
+
#triggerBtn
|
|
16667
|
+
type="button"
|
|
16668
|
+
class="sol-scope-switcher__trigger"
|
|
16669
|
+
[class.sol-scope-switcher__trigger--open]="isOpen()"
|
|
16670
|
+
[disabled]="disabled()"
|
|
16671
|
+
aria-haspopup="listbox"
|
|
16672
|
+
[attr.aria-expanded]="isOpen()"
|
|
16673
|
+
[attr.aria-controls]="isOpen() ? panelId : null"
|
|
16674
|
+
[attr.aria-label]="triggerAriaText()"
|
|
16675
|
+
(click)="onTriggerClick()"
|
|
16676
|
+
(keydown)="onTriggerKeydown($event)"
|
|
16677
|
+
>
|
|
16678
|
+
@if (activeScope(); as scope) {
|
|
16679
|
+
@if (scope.icon) {
|
|
16680
|
+
<sol-icon [name]="scope.icon" size="sm" class="sol-scope-switcher__icon" />
|
|
16681
|
+
} @else {
|
|
16682
|
+
<sol-avatar [name]="scope.label" [imageUrl]="scope.imageUrl ?? null" size="sm" />
|
|
16683
|
+
}
|
|
16684
|
+
<span class="sol-scope-switcher__labels">
|
|
16685
|
+
<span class="sol-scope-switcher__label">{{ scope.label }}</span>
|
|
16686
|
+
@if (scope.sublabel) {
|
|
16687
|
+
<span class="sol-scope-switcher__sublabel">{{ scope.sublabel }}</span>
|
|
16688
|
+
}
|
|
16689
|
+
</span>
|
|
16690
|
+
}
|
|
16691
|
+
<sol-icon
|
|
16692
|
+
name="chevron-down"
|
|
16693
|
+
variant="fill"
|
|
16694
|
+
size="sm"
|
|
16695
|
+
class="sol-scope-switcher__arrow"
|
|
16696
|
+
[class.sol-scope-switcher__arrow--open]="isOpen()"
|
|
16697
|
+
/>
|
|
16698
|
+
</button>
|
|
16699
|
+
|
|
16700
|
+
<!-- El panel se portalea a document.body con position:fixed vía la
|
|
16701
|
+
directiva compartida solFloatingPanel: el switcher suele vivir en
|
|
16702
|
+
un header con overflow, y sin el portal el panel quedaría
|
|
16703
|
+
recortado. El trigger queda enlazado por aria-controls porque
|
|
16704
|
+
ambos viven en árboles distintos del DOM. -->
|
|
16705
|
+
@if (isOpen()) {
|
|
16706
|
+
<div
|
|
16707
|
+
#panel
|
|
16708
|
+
[id]="panelId"
|
|
16709
|
+
class="sol-scope-switcher__panel"
|
|
16710
|
+
[class.sol-scope-switcher__panel--up]="dropUp()"
|
|
16711
|
+
role="listbox"
|
|
16712
|
+
[attr.aria-label]="panelAriaText()"
|
|
16713
|
+
[solFloatingPanel]="triggerBtn"
|
|
16714
|
+
[matchTriggerWidth]="false"
|
|
16715
|
+
[flipThreshold]="panelFlipThreshold"
|
|
16716
|
+
[align]="align()"
|
|
16717
|
+
(dropUpChange)="dropUp.set($event)"
|
|
16718
|
+
(keydown)="onPanelKeydown($event)"
|
|
16719
|
+
>
|
|
16720
|
+
@for (scope of scopeList(); track scope.id; let i = $index) {
|
|
16721
|
+
<button
|
|
16722
|
+
#optionBtn
|
|
16723
|
+
type="button"
|
|
16724
|
+
class="sol-scope-switcher__option"
|
|
16725
|
+
[class.sol-scope-switcher__option--active]="scope.id === effectiveActiveId()"
|
|
16726
|
+
role="option"
|
|
16727
|
+
tabindex="-1"
|
|
16728
|
+
[attr.aria-selected]="scope.id === effectiveActiveId()"
|
|
16729
|
+
(click)="select(scope)"
|
|
16730
|
+
>
|
|
16731
|
+
@if (scope.icon) {
|
|
16732
|
+
<sol-icon [name]="scope.icon" size="sm" class="sol-scope-switcher__icon" />
|
|
16733
|
+
} @else {
|
|
16734
|
+
<sol-avatar [name]="scope.label" [imageUrl]="scope.imageUrl ?? null" size="sm" />
|
|
16735
|
+
}
|
|
16736
|
+
<span class="sol-scope-switcher__labels">
|
|
16737
|
+
<span class="sol-scope-switcher__label">{{ scope.label }}</span>
|
|
16738
|
+
@if (scope.sublabel) {
|
|
16739
|
+
<span class="sol-scope-switcher__sublabel">{{ scope.sublabel }}</span>
|
|
16740
|
+
}
|
|
16741
|
+
</span>
|
|
16742
|
+
@if (scope.id === effectiveActiveId()) {
|
|
16743
|
+
<sol-icon
|
|
16744
|
+
name="check"
|
|
16745
|
+
size="sm"
|
|
16746
|
+
class="sol-scope-switcher__check"
|
|
16747
|
+
[attr.aria-label]="activeOptionAriaText()"
|
|
16748
|
+
/>
|
|
16749
|
+
}
|
|
16750
|
+
</button>
|
|
16751
|
+
}
|
|
16752
|
+
</div>
|
|
16753
|
+
}
|
|
16754
|
+
</div>
|
|
16755
|
+
}
|
|
16756
|
+
|
|
16757
|
+
<!-- La alerta NO reemplaza al selector: convive con él para que un cambio
|
|
16758
|
+
fallido conserve el contexto anterior en pantalla (y se muestra sola
|
|
16759
|
+
cuando lo que falló fue la carga misma de la lista). -->
|
|
16760
|
+
@if (hasError()) {
|
|
16761
|
+
<p class="sol-scope-switcher__error" role="alert">
|
|
16762
|
+
<sol-icon name="exclamation-triangle" size="sm" class="sol-scope-switcher__error-icon" />
|
|
16763
|
+
<span>{{ errorText() }}</span>
|
|
16764
|
+
</p>
|
|
16765
|
+
}
|
|
16766
|
+
}
|
|
16767
|
+
`, styles: [":host{display:inline-block}:host,.sol-scope-switcher__panel{--sol-scope-switcher-bg: var(--sol-bg-surface, #ffffff);--sol-scope-switcher-text: var(--sol-color-text-primary, #1e293b);--sol-scope-switcher-muted: var(--sol-color-text-muted, #94a3b8);--sol-scope-switcher-border: var(--sol-border-color-default, #cbd5e1);--sol-scope-switcher-border-width: var(--sol-border-width-default, 1px);--sol-scope-switcher-accent: var(--sol-color-primary, #6366f1);--sol-scope-switcher-danger: var(--sol-color-danger, #ef4444);--sol-scope-switcher-radius: var(--sol-border-radius-md, .5rem);--sol-scope-switcher-height: var(--sol-size-input-height, 2.5rem);--sol-scope-switcher-gap: var(--sol-space-xs, .5rem);--sol-scope-switcher-padding-x: var(--sol-space-sm, .75rem);--sol-scope-switcher-font-size: var(--sol-font-size-base, .875rem);--sol-scope-switcher-sub-font-size: var(--sol-font-size-sm, .75rem);--sol-scope-switcher-weight: var(--sol-font-weight-bold, 600);--sol-scope-switcher-shadow: var(--sol-shadow-lg, 0 10px 25px rgba(0, 0, 0, .15));--sol-scope-switcher-hover: var(--sol-color-bg-hover, rgba(0, 0, 0, .04));--sol-scope-switcher-active-bg: color-mix(in srgb, var(--sol-color-primary, #6366f1) 12%, transparent);--sol-scope-switcher-focus-ring: 0 0 0 3px color-mix(in srgb, var(--sol-color-primary, #6366f1) 40%, transparent);--sol-scope-switcher-transition: var(--sol-dur-fast, .15s) var(--sol-ease, ease);--sol-scope-switcher-disabled-opacity: var(--sol-disabled-opacity, .55)}.sol-scope-switcher__host{position:relative;display:inline-block}.sol-scope-switcher__loading,.sol-scope-switcher__empty,.sol-scope-switcher__static{display:inline-flex;align-items:center;gap:var(--sol-scope-switcher-gap);min-height:var(--sol-scope-switcher-height);padding:0 var(--sol-scope-switcher-padding-x);font-size:var(--sol-scope-switcher-font-size);line-height:1.3}.sol-scope-switcher__loading,.sol-scope-switcher__empty{color:var(--sol-scope-switcher-muted)}.sol-scope-switcher__empty-icon{flex-shrink:0;color:var(--sol-scope-switcher-muted)}.sol-scope-switcher__static{color:var(--sol-scope-switcher-text);background:var(--sol-scope-switcher-bg);border:var(--sol-scope-switcher-border-width) solid var(--sol-scope-switcher-border);border-radius:var(--sol-scope-switcher-radius)}.sol-scope-switcher__trigger{display:inline-flex;align-items:center;gap:var(--sol-scope-switcher-gap);min-height:var(--sol-scope-switcher-height);max-width:100%;padding:0 var(--sol-scope-switcher-padding-x);font-family:inherit;font-size:var(--sol-scope-switcher-font-size);color:var(--sol-scope-switcher-text);text-align:left;background:var(--sol-scope-switcher-bg);border:var(--sol-scope-switcher-border-width) solid var(--sol-scope-switcher-border);border-radius:var(--sol-scope-switcher-radius);cursor:pointer;transition:background var(--sol-scope-switcher-transition),border-color var(--sol-scope-switcher-transition),box-shadow var(--sol-scope-switcher-transition)}.sol-scope-switcher__trigger:hover:not(:disabled){background:var(--sol-scope-switcher-hover)}.sol-scope-switcher__trigger:focus-visible{outline:none;border-color:var(--sol-scope-switcher-accent);box-shadow:var(--sol-scope-switcher-focus-ring)}.sol-scope-switcher__trigger--open{border-color:var(--sol-scope-switcher-accent)}.sol-scope-switcher__trigger:disabled{cursor:not-allowed;opacity:var(--sol-scope-switcher-disabled-opacity)}.sol-scope-switcher__arrow{flex-shrink:0;color:var(--sol-scope-switcher-muted);transition:transform var(--sol-scope-switcher-transition)}.sol-scope-switcher__arrow--open{transform:rotate(180deg)}.sol-scope-switcher__icon{flex-shrink:0;color:var(--sol-scope-switcher-muted)}.sol-scope-switcher__labels{display:flex;flex-direction:column;min-width:0;flex:1}.sol-scope-switcher__label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:var(--sol-scope-switcher-weight)}.sol-scope-switcher__sublabel{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:var(--sol-scope-switcher-sub-font-size);font-weight:400;color:var(--sol-scope-switcher-muted)}.sol-scope-switcher__panel{position:absolute;top:calc(100% + 4px);left:0;display:flex;flex-direction:column;min-width:15rem;max-width:22rem;max-height:20rem;overflow-y:auto;padding:.25rem;background:var(--sol-scope-switcher-bg);border:var(--sol-scope-switcher-border-width) solid var(--sol-scope-switcher-border);border-radius:var(--sol-scope-switcher-radius);box-shadow:var(--sol-scope-switcher-shadow);animation:sol-scope-switcher-fade .12s ease-out}.sol-scope-switcher__panel--up{top:auto;bottom:calc(100% + 4px)}.sol-scope-switcher__option{display:flex;align-items:center;gap:var(--sol-scope-switcher-gap);width:100%;padding:.5rem .625rem;font-family:inherit;font-size:var(--sol-scope-switcher-font-size);color:var(--sol-scope-switcher-text);text-align:left;background:transparent;border:none;border-radius:calc(var(--sol-scope-switcher-radius) - 2px);cursor:pointer;transition:background var(--sol-scope-switcher-transition)}.sol-scope-switcher__option:hover{background:var(--sol-scope-switcher-hover)}.sol-scope-switcher__option:focus-visible{outline:none;box-shadow:var(--sol-scope-switcher-focus-ring)}.sol-scope-switcher__option--active{background:var(--sol-scope-switcher-active-bg)}.sol-scope-switcher__option--active .sol-scope-switcher__label{color:var(--sol-scope-switcher-accent)}.sol-scope-switcher__check{flex-shrink:0;color:var(--sol-scope-switcher-accent)}.sol-scope-switcher__error{display:flex;align-items:flex-start;gap:.375rem;margin:.25rem 0 0;font-size:var(--sol-scope-switcher-sub-font-size);line-height:1.4;color:var(--sol-scope-switcher-danger)}.sol-scope-switcher__error-icon{flex-shrink:0;color:var(--sol-scope-switcher-danger)}@keyframes sol-scope-switcher-fade{0%{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:translateY(0)}}@media(prefers-reduced-motion:reduce){.sol-scope-switcher__panel{animation:none}.sol-scope-switcher__arrow,.sol-scope-switcher__trigger,.sol-scope-switcher__option{transition:none}}\n"] }]
|
|
16768
|
+
}], ctorParameters: () => [], propDecorators: { scopes: [{ type: i0.Input, args: [{ isSignal: true, alias: "scopes", required: false }] }], activeScopeId: [{ type: i0.Input, args: [{ isSignal: true, alias: "activeScopeId", required: false }] }], status: [{ type: i0.Input, args: [{ isSignal: true, alias: "status", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], align: [{ type: i0.Input, args: [{ isSignal: true, alias: "align", required: false }] }], errorMessage: [{ type: i0.Input, args: [{ isSignal: true, alias: "errorMessage", required: false }] }], emptyMessage: [{ type: i0.Input, args: [{ isSignal: true, alias: "emptyMessage", required: false }] }], loadingMessage: [{ type: i0.Input, args: [{ isSignal: true, alias: "loadingMessage", required: false }] }], triggerAriaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "triggerAriaLabel", required: false }] }], panelAriaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "panelAriaLabel", required: false }] }], scopeSelected: [{ type: i0.Output, args: ["scopeSelected"] }], openChange: [{ type: i0.Output, args: ["openChange"] }], triggerRef: [{ type: i0.ViewChild, args: ['triggerBtn', { isSignal: true }] }], panelRef: [{ type: i0.ViewChild, args: ['panel', { isSignal: true }] }], optionRefs: [{ type: i0.ViewChildren, args: ['optionBtn', { isSignal: true }] }], onDocumentEscape: [{
|
|
16769
|
+
type: HostListener,
|
|
16770
|
+
args: ['document:keydown.escape']
|
|
16771
|
+
}], onDocumentClick: [{
|
|
16772
|
+
type: HostListener,
|
|
16773
|
+
args: ['document:click', ['$event']]
|
|
16774
|
+
}] } });
|
|
16775
|
+
|
|
14368
16776
|
// Shared UI — atomic design system components
|
|
14369
16777
|
|
|
14370
16778
|
/*
|
|
@@ -14375,5 +16783,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
14375
16783
|
* Generated bundle index. Do not edit.
|
|
14376
16784
|
*/
|
|
14377
16785
|
|
|
14378
|
-
export { DEFAULT_SCORE_THRESHOLDS, EMIT_TABLE, KANBAN_ADD_ACTION, KanbanReorderService, NEUTRAL_CALENDAR_COLOR, SOL_CALENDAR_COLOR, SOL_CHART_ENGINE, SOL_DEFAULT_THEME, SOL_I18N, SOL_TENANT_RESOLVER, SolAvatarComponent, SolBadgeComponent, SolButtonComponent, SolCalendarComponent, SolCalendarGridComponent, SolCalendarHeaderComponent, SolCardComponent, SolChartComponent, SolCheckboxComponent, SolChipComponent, SolChipGroupComponent, SolDataTableComponent, SolDatePickerComponent, SolDayPickerComponent, SolDrawerComponent, SolEmptyStateComponent, SolFileUploadComponent, SolFlowCanvasComponent, SolFormFieldComponent, SolIconButtonComponent, SolIconComponent, SolInputComponent, SolKanbanBoardComponent, SolKanbanCardComponent, SolKanbanColumnComponent, SolKanbanDragSourceComponent, SolMessageStatusComponent, SolModalComponent, SolNumberInputComponent, SolPageHeaderComponent, SolPaginationComponent, SolProgressBarComponent, SolRichEditorComponent, SolScoreBadgeComponent, SolSearchInputComponent, SolSelectComponent, SolSkeletonComponent, SolSpinnerComponent, SolStarRatingComponent, SolStepperComponent, SolTabsComponent, SolTextareaComponent, SolTimelineComponent, SolToggleComponent, SolTooltipComponent, SolTrendComponent, SolViewToggleComponent, SolVirtualScrollComponent, SolWizardComponent, SolWizardStepDirective, TCPDF_ALLOWED_STYLE_PROPERTIES, TCPDF_ALLOWED_TAGS, THEME_SOURCE, ThemeService, buildDayColumns, buildGoogleFontsUrl, collectUndatedNodes, computeAutoLayoutPositions, computeEventHeight, computeEventTop, computeGlobalRange, computeInitials, computeMonthAxisTicks, computeNowTop, createIdentitySolI18n, dayKey, defaultStatusToken, defaultTrendFormat, getWeekStart, hashToPaletteIndex, isRenderableTheme, isSafeBackgroundImage, isSafeCssColor, parseEventDate, positionRows, provideTheme, resolveCssVars, resolveScoreTone, resolveTrendDirection, sanitizeAssetUrl, sanitizeHtmlToTcpdf, serializeElementToTcpdfHtml };
|
|
16786
|
+
export { DEFAULT_SCORE_THRESHOLDS, EMIT_TABLE, KANBAN_ADD_ACTION, KanbanReorderService, NEUTRAL_CALENDAR_COLOR, SOL_BUNDLED_DEFAULT_THEME, SOL_CALENDAR_COLOR, SOL_CHART_ENGINE, SOL_DEFAULT_THEME, SOL_I18N, SOL_TABLE_VARIANTS, SOL_TENANT_RESOLVER, SOL_TREE_MAX_DEPTH, SolAvatarComponent, SolBadgeComponent, SolButtonComponent, SolCalendarComponent, SolCalendarGridComponent, SolCalendarHeaderComponent, SolCardComponent, SolChartComponent, SolCheckboxComponent, SolChipComponent, SolChipGroupComponent, SolDataTableComponent, SolDatePickerComponent, SolDayPickerComponent, SolDrawerComponent, SolEmptyStateComponent, SolFileUploadComponent, SolFlowCanvasComponent, SolFormFieldComponent, SolIconButtonComponent, SolIconComponent, SolInputComponent, SolKanbanBoardComponent, SolKanbanCardComponent, SolKanbanColumnComponent, SolKanbanDragSourceComponent, SolMessageStatusComponent, SolModalComponent, SolNotificationPanelComponent, SolNumberInputComponent, SolPageHeaderComponent, SolPaginationComponent, SolProgressBarComponent, SolRatingInputComponent, SolRichEditorComponent, SolScopeSwitcherComponent, SolScoreBadgeComponent, SolSearchInputComponent, SolSelectComponent, SolSkeletonComponent, SolSpinnerComponent, SolStarRatingComponent, SolStepperComponent, SolTabsComponent, SolTextareaComponent, SolTimelineComponent, SolToggleComponent, SolTooltipComponent, SolTreeComponent, SolTreeNodeDefDirective, SolTrendComponent, SolViewToggleComponent, SolVirtualScrollComponent, SolWizardComponent, SolWizardStepDirective, TCPDF_ALLOWED_STYLE_PROPERTIES, TCPDF_ALLOWED_TAGS, THEME_SOURCE, ThemeService, buildDayColumns, buildGoogleFontsUrl, collectUndatedNodes, computeAutoLayoutPositions, computeEventHeight, computeEventTop, computeGlobalRange, computeInitials, computeMonthAxisTicks, computeNowTop, createIdentitySolI18n, dayKey, defaultStatusToken, defaultTrendFormat, getWeekStart, hashToPaletteIndex, isRenderableTheme, isSafeBackgroundImage, isSafeCssColor, normalizeRating, parseEventDate, positionRows, provideTheme, resolveCssVars, resolveScoreTone, resolveTrendDirection, sanitizeAssetUrl, sanitizeHtmlToTcpdf, serializeElementToTcpdfHtml };
|
|
14379
16787
|
//# sourceMappingURL=solercia-ui.mjs.map
|