@kaufmann-lab/ui 0.1.46 → 0.1.47
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.
|
@@ -6192,6 +6192,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImpor
|
|
|
6192
6192
|
}, template: "<div class=\"kf-content-slot__media\">\n <kf-icon [name]=\"icon()\" [size]=\"compact() ? 'md' : 'lg'\" />\n</div>\n<span class=\"kf-content-slot__title\">{{ title() }}</span>\n@if (description()) {\n <p class=\"kf-content-slot__description\">{{ description() }}</p>\n}\n@if (!compact()) {\n <span class=\"kf-content-slot__footer\">\n <kf-text as=\"span\" variant=\"overline\">Contenido disponible para uso</kf-text>\n </span>\n}\n", styles: [":host{display:flex;flex-direction:column;gap:var(--kf-space-xs);padding:var(--kf-space-md);border:1px solid var(--kf-color-border);border-radius:var(--kf-radius-sm);background:var(--kf-color-white);font-family:var(--kf-font-body)}.kf-content-slot__media{display:flex;align-items:center;justify-content:center;height:96px;margin-bottom:var(--kf-space-xs);border-radius:var(--kf-radius-sm);background:var(--kf-color-surface);color:var(--kf-color-border-strong)}:host(.kf-content-slot--compact) .kf-content-slot__media{height:56px}.kf-content-slot__title{font-family:var(--kf-font-title);font-weight:700;color:var(--kf-color-ink)}.kf-content-slot__description{margin:0;font-size:var(--kf-font-size-label);color:var(--kf-color-text-muted)}.kf-content-slot__footer{align-self:flex-start;margin-top:var(--kf-space-xs);padding:2px var(--kf-space-sm);border-radius:var(--kf-radius-pill);background:var(--kf-color-surface)}\n"] }]
|
|
6193
6193
|
}], propDecorators: { title: [{ type: i0.Input, args: [{ isSignal: true, alias: "title", required: false }] }], description: [{ type: i0.Input, args: [{ isSignal: true, alias: "description", required: false }] }], icon: [{ type: i0.Input, args: [{ isSignal: true, alias: "icon", required: false }] }], compact: [{ type: i0.Input, args: [{ isSignal: true, alias: "compact", required: false }] }] } });
|
|
6194
6194
|
|
|
6195
|
+
/** Acepta el nivel como número (`[headingLevel]="2"`) o como atributo estático (`headingLevel="2"`). */
|
|
6196
|
+
function toHeadingLevel(value) {
|
|
6197
|
+
const level = Number(value);
|
|
6198
|
+
return level === 2 || level === 3 || level === 4 ? level : null;
|
|
6199
|
+
}
|
|
6195
6200
|
/**
|
|
6196
6201
|
* Placeholder para una sección sin contenido. Dos tonos, con anatomía
|
|
6197
6202
|
* distinta (páginas 27-28 del design system, que los trata como piezas
|
|
@@ -6251,9 +6256,38 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImpor
|
|
|
6251
6256
|
* metadatos debajo de los botones ("¿Ya estás conectado? …", "Intento 2 ·
|
|
6252
6257
|
* 10:42"). Vacío, no ocupa lugar.
|
|
6253
6258
|
*
|
|
6254
|
-
*
|
|
6255
|
-
*
|
|
6256
|
-
* vacío no debe alterar su
|
|
6259
|
+
* ## Título y encabezado
|
|
6260
|
+
* `title` se dibuja como texto destacado (`<p>`), no como encabezado: el nivel
|
|
6261
|
+
* depende de la página que lo contiene, y un estado vacío no debe alterar su
|
|
6262
|
+
* estructura. Cuando el estado ocupa la pantalla entera y el título sí es el
|
|
6263
|
+
* encabezado de su región, `headingLevel` (2, 3 o 4) lo dibuja como `<h2>`,
|
|
6264
|
+
* `<h3>` o `<h4>`. Solo cambia el elemento: el aspecto es el mismo.
|
|
6265
|
+
*
|
|
6266
|
+
* ## Composición compacta con chip (pantallas completas, mobile)
|
|
6267
|
+
* Cuatro opciones, independientes entre sí y apagadas por defecto, que juntas dan el
|
|
6268
|
+
* estado de una pantalla completa sin sobrescribir el CSS de la librería:
|
|
6269
|
+
*
|
|
6270
|
+
* - `iconChip`: el ícono (24px) va en un círculo tonal de 56px que toma el tono del estado
|
|
6271
|
+
* (`neutral` usa los roles de marca `primary-soft` / `primary-active`; el resto, el par
|
|
6272
|
+
* `*-soft` / `*-strong` de su rol). El ritmo vertical es el de `card` (`--kf-space-md`
|
|
6273
|
+
* entre bloques, título pegado a su texto) y, en `flat`, el relleno vertical sube a
|
|
6274
|
+
* `--kf-space-xl`. En `card` el chip ya existe y `iconChip` no cambia nada.
|
|
6275
|
+
* - `size="sm"`: el contenido pasa a `body-sm` con interlineado 1.5 y el título a negrita.
|
|
6276
|
+
* - `textTone="neutral"`: el texto del contenido queda atenuado también en `error`; el color
|
|
6277
|
+
* del tono lo lleva solo el ícono.
|
|
6278
|
+
* - `headingLevel`: ver arriba.
|
|
6279
|
+
*
|
|
6280
|
+
* <kf-empty-state variant="flat" iconChip size="sm" textTone="neutral" headingLevel="2"
|
|
6281
|
+
* tone="error" icon="alert-circle" title="No se pudo cargar la lista"
|
|
6282
|
+
* role="alert">
|
|
6283
|
+
* Revisar la conexión e intentar de nuevo.
|
|
6284
|
+
* <kf-button kf-empty-state-actions variant="outline" (click)="retry()">Reintentar</kf-button>
|
|
6285
|
+
* </kf-empty-state>
|
|
6286
|
+
*
|
|
6287
|
+
* ## Regiones vivas
|
|
6288
|
+
* El rol (`role="status"` para un vacío, `role="alert"` para una falla) lo pone el consumidor
|
|
6289
|
+
* en el host, como en `kf-content-state`: no todo estado debe interrumpir al lector de pantalla,
|
|
6290
|
+
* y quien conoce el contexto es quien decide.
|
|
6257
6291
|
*/
|
|
6258
6292
|
class EmptyState {
|
|
6259
6293
|
icon = input(undefined, /* @ts-ignore */
|
|
@@ -6267,10 +6301,20 @@ class EmptyState {
|
|
|
6267
6301
|
/** Título destacado sobre el contenido. Opcional en ambas variantes. */
|
|
6268
6302
|
title = input(/* @ts-ignore */
|
|
6269
6303
|
...(ngDevMode ? [undefined, { debugName: "title" }] : /* istanbul ignore next */ []));
|
|
6270
|
-
|
|
6304
|
+
/** Dibuja el título como `<h2>`, `<h3>` o `<h4>`. Sin valor (default) es un `<p>`. El aspecto no cambia. */
|
|
6305
|
+
headingLevel = input(null, { ...(ngDevMode ? { debugName: "headingLevel" } : /* istanbul ignore next */ {}), transform: toHeadingLevel });
|
|
6306
|
+
/** Pone el ícono (24px) en un círculo tonal de 56px en `inline` y `flat`. En `card` el chip ya es el de siempre. */
|
|
6307
|
+
iconChip = input(false, { ...(ngDevMode ? { debugName: "iconChip" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
6308
|
+
/** `md` (default) o `sm`: contenido en `body-sm` y título en negrita. */
|
|
6309
|
+
size = input('md', /* @ts-ignore */
|
|
6310
|
+
...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
6311
|
+
/** `auto` (default) sigue al tono; `neutral` deja el texto atenuado y el color del tono solo en el ícono. */
|
|
6312
|
+
textTone = input('auto', /* @ts-ignore */
|
|
6313
|
+
...(ngDevMode ? [{ debugName: "textTone" }] : /* istanbul ignore next */ []));
|
|
6314
|
+
iconSize = computed(() => this.variant() === 'card' || this.tone() === 'error' || this.iconChip() ? 'lg' : 'md', /* @ts-ignore */
|
|
6271
6315
|
...(ngDevMode ? [{ debugName: "iconSize" }] : /* istanbul ignore next */ []));
|
|
6272
6316
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: EmptyState, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
6273
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.0", type: EmptyState, isStandalone: true, selector: "kf-empty-state", inputs: { icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null }, tone: { classPropertyName: "tone", publicName: "tone", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.kf-empty-state--error": "tone() === 'error'", "class.kf-empty-state--warn": "tone() === 'warn'", "class.kf-empty-state--info": "tone() === 'info'", "class.kf-empty-state--ok": "tone() === 'ok'", "class.kf-empty-state--card": "variant() === 'card'", "class.kf-empty-state--flat": "variant() === 'flat'", "attr.title": "null" } }, ngImport: i0, template: "@if (icon(); as iconName) {\n <span class=\"kf-empty-state__icon\">\n <kf-icon [name]=\"iconName\" [size]=\"iconSize()\" />\n </span>\n}\n@if (title(); as titleText) {\n <p class=\"kf-empty-state__title\">{{ titleText }}</p>\n}\n<div class=\"kf-empty-state__content\">\n <ng-content />\n</div>\n<div class=\"kf-empty-state__actions\"><ng-content select=\"[kf-empty-state-actions]\" /></div>\n<div class=\"kf-empty-state__footer\"><ng-content select=\"[kf-empty-state-footer]\" /></div>\n", styles: [":host{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:var(--kf-space-sm);padding:var(--kf-space-xl);border:1px dashed var(--kf-color-border-strong);border-radius:var(--kf-radius-md);background:var(--kf-color-surface);color:var(--kf-color-text-muted);font:inherit;text-align:center}:host(.kf-empty-state--error){border:none;background:var(--kf-color-error-soft)}.kf-empty-state__content{color:var(--kf-color-text-muted);font-family:var(--kf-font-body)}:host(.kf-empty-state--error) .kf-empty-state__content{color:var(--kf-color-error-strong)}.kf-empty-state__title{margin:0;font-family:var(--kf-font-title);font-size:var(--kf-font-size-title-sm);line-height:1.25;color:var(--kf-color-ink)}.kf-empty-state__actions{display:flex;flex-wrap:wrap;align-items:center;justify-content:center;gap:var(--kf-space-sm)}.kf-empty-state__actions>::ng-deep [kf-empty-state-actions]{display:flex;flex-wrap:wrap;align-items:center;justify-content:center;gap:var(--kf-space-sm)}.kf-empty-state__actions:empty,.kf-empty-state__footer:empty{display:none}.kf-empty-state__footer{display:flex;flex-direction:column;align-items:center;gap:var(--kf-space-xs);font-size:var(--kf-font-size-caption);color:var(--kf-color-text)}:host(.kf-empty-state--ok) .kf-empty-state__icon{color:var(--kf-color-success-strong)}:host(.kf-empty-state--warn) .kf-empty-state__icon{color:var(--kf-color-warning-strong)}:host(.kf-empty-state--info) .kf-empty-state__icon{color:var(--kf-color-info-strong)}:host(.kf-empty-state--flat){padding:var(--kf-space-lg) var(--kf-space-md);border:0;background:transparent}:host(.kf-empty-state--card){box-sizing:border-box;width:min(480px,100%);gap:var(--kf-space-md);padding:var(--kf-space-xl) var(--kf-space-lg);border:1px solid var(--kf-color-border);border-radius:var(--kf-radius-lg);background:var(--kf-color-white);box-shadow:var(--kf-elevation-raised);color:var(--kf-color-text)}:host(.kf-empty-state--card) .kf-empty-state__title+.kf-empty-state__content{margin-top:calc(var(--kf-space-sm) - var(--kf-space-md))}:host(.kf-empty-state--card) .kf-empty-state__content>::ng-deep :is(p,ol,ul),:host(.kf-empty-state--card) .kf-empty-state__footer>::ng-deep [kf-empty-state-footer] :is(p),:host(.kf-empty-state--card) .kf-empty-state__footer>::ng-deep p[kf-empty-state-footer]{margin:0}:host(.kf-empty-state--card) .kf-empty-state__content:empty{display:none}:host(.kf-empty-state--card) .kf-empty-state__content{display:flex;flex-direction:column;align-items:stretch;gap:var(--kf-space-md);align-self:stretch;color:var(--kf-color-text);font-size:var(--kf-font-size-body-sm);line-height:1.5}:host(.kf-empty-state--card.kf-empty-state--error) .kf-empty-state__content{color:var(--kf-color-text)}:host(.kf-empty-state--card) .kf-empty-state__icon{display:flex;align-items:center;justify-content:center;width:56px;height:56px;border-radius:50%;background:var(--kf-color-surface);color:var(--kf-color-text-muted)}:host(.kf-empty-state--card.kf-empty-state--ok) .kf-empty-state__icon{background:var(--kf-color-success-soft);color:var(--kf-color-success-strong)}:host(.kf-empty-state--card.kf-empty-state--warn) .kf-empty-state__icon{background:var(--kf-color-warning-soft);color:var(--kf-color-warning-strong)}:host(.kf-empty-state--card.kf-empty-state--info) .kf-empty-state__icon{background:var(--kf-color-info-soft);color:var(--kf-color-info-strong)}:host(.kf-empty-state--card.kf-empty-state--error) .kf-empty-state__icon{background:var(--kf-color-error-soft);color:var(--kf-color-error-strong)}\n"], dependencies: [{ kind: "component", type: Icon, selector: "kf-icon", inputs: ["name", "size", "rotate", "filled"] }] });
|
|
6317
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.0", type: EmptyState, isStandalone: true, selector: "kf-empty-state", inputs: { icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null }, tone: { classPropertyName: "tone", publicName: "tone", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, headingLevel: { classPropertyName: "headingLevel", publicName: "headingLevel", isSignal: true, isRequired: false, transformFunction: null }, iconChip: { classPropertyName: "iconChip", publicName: "iconChip", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, textTone: { classPropertyName: "textTone", publicName: "textTone", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.kf-empty-state--error": "tone() === 'error'", "class.kf-empty-state--warn": "tone() === 'warn'", "class.kf-empty-state--info": "tone() === 'info'", "class.kf-empty-state--ok": "tone() === 'ok'", "class.kf-empty-state--card": "variant() === 'card'", "class.kf-empty-state--flat": "variant() === 'flat'", "class.kf-empty-state--chip": "iconChip() && variant() !== 'card'", "class.kf-empty-state--sm": "size() === 'sm'", "class.kf-empty-state--text-neutral": "textTone() === 'neutral'", "attr.title": "null" } }, ngImport: i0, template: "@if (icon(); as iconName) {\n <span class=\"kf-empty-state__icon\">\n <kf-icon [name]=\"iconName\" [size]=\"iconSize()\" />\n </span>\n}\n@if (title(); as titleText) {\n @switch (headingLevel()) {\n @case (2) {\n <h2 class=\"kf-empty-state__title\">{{ titleText }}</h2>\n }\n @case (3) {\n <h3 class=\"kf-empty-state__title\">{{ titleText }}</h3>\n }\n @case (4) {\n <h4 class=\"kf-empty-state__title\">{{ titleText }}</h4>\n }\n @default {\n <p class=\"kf-empty-state__title\">{{ titleText }}</p>\n }\n }\n}\n<div class=\"kf-empty-state__content\">\n <ng-content />\n</div>\n<div class=\"kf-empty-state__actions\"><ng-content select=\"[kf-empty-state-actions]\" /></div>\n<div class=\"kf-empty-state__footer\"><ng-content select=\"[kf-empty-state-footer]\" /></div>\n", styles: [":host{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:var(--kf-space-sm);padding:var(--kf-space-xl);border:1px dashed var(--kf-color-border-strong);border-radius:var(--kf-radius-md);background:var(--kf-color-surface);color:var(--kf-color-text-muted);font:inherit;text-align:center}:host(.kf-empty-state--error){border:none;background:var(--kf-color-error-soft)}.kf-empty-state__content{color:var(--kf-color-text-muted);font-family:var(--kf-font-body)}:host(.kf-empty-state--error) .kf-empty-state__content{color:var(--kf-color-error-strong)}.kf-empty-state__title{margin:0;font-family:var(--kf-font-title);font-size:var(--kf-font-size-title-sm);font-weight:inherit;line-height:1.25;color:var(--kf-color-ink)}.kf-empty-state__actions{display:flex;flex-wrap:wrap;align-items:center;justify-content:center;gap:var(--kf-space-sm)}.kf-empty-state__actions>::ng-deep [kf-empty-state-actions]{display:flex;flex-wrap:wrap;align-items:center;justify-content:center;gap:var(--kf-space-sm)}.kf-empty-state__actions:empty,.kf-empty-state__footer:empty{display:none}.kf-empty-state__footer{display:flex;flex-direction:column;align-items:center;gap:var(--kf-space-xs);font-size:var(--kf-font-size-caption);color:var(--kf-color-text)}:host(.kf-empty-state--ok) .kf-empty-state__icon{color:var(--kf-color-success-strong)}:host(.kf-empty-state--warn) .kf-empty-state__icon{color:var(--kf-color-warning-strong)}:host(.kf-empty-state--info) .kf-empty-state__icon{color:var(--kf-color-info-strong)}:host(.kf-empty-state--flat){padding:var(--kf-space-lg) var(--kf-space-md);border:0;background:transparent}:host(.kf-empty-state--sm) .kf-empty-state__title{font-weight:var(--kf-font-weight-title)}:host(.kf-empty-state--sm) .kf-empty-state__content{font-size:var(--kf-font-size-body-sm);line-height:1.5}:host(.kf-empty-state--text-neutral.kf-empty-state--error) .kf-empty-state__content{color:var(--kf-color-text-muted)}:host(.kf-empty-state--chip){gap:var(--kf-space-md)}:host(.kf-empty-state--chip.kf-empty-state--flat){padding-block:var(--kf-space-xl)}:host(.kf-empty-state--chip) .kf-empty-state__title+.kf-empty-state__content{margin-top:calc(var(--kf-space-sm) - var(--kf-space-md))}:host(.kf-empty-state--chip) .kf-empty-state__content:empty{display:none}:host(.kf-empty-state--chip) .kf-empty-state__icon{display:flex;align-items:center;justify-content:center;width:56px;height:56px;border-radius:50%;background:var(--kf-color-primary-soft);color:var(--kf-color-primary-active)}:host(.kf-empty-state--chip.kf-empty-state--ok) .kf-empty-state__icon{background:var(--kf-color-success-soft);color:var(--kf-color-success-strong)}:host(.kf-empty-state--chip.kf-empty-state--warn) .kf-empty-state__icon{background:var(--kf-color-warning-soft);color:var(--kf-color-warning-strong)}:host(.kf-empty-state--chip.kf-empty-state--info) .kf-empty-state__icon{background:var(--kf-color-info-soft);color:var(--kf-color-info-strong)}:host(.kf-empty-state--chip.kf-empty-state--error) .kf-empty-state__icon{background:var(--kf-color-error-soft);color:var(--kf-color-error-strong)}:host(.kf-empty-state--chip.kf-empty-state--error:not(.kf-empty-state--flat)) .kf-empty-state__icon{background:var(--kf-color-white)}:host(.kf-empty-state--card){box-sizing:border-box;width:min(480px,100%);gap:var(--kf-space-md);padding:var(--kf-space-xl) var(--kf-space-lg);border:1px solid var(--kf-color-border);border-radius:var(--kf-radius-lg);background:var(--kf-color-white);box-shadow:var(--kf-elevation-raised);color:var(--kf-color-text)}:host(.kf-empty-state--card) .kf-empty-state__title+.kf-empty-state__content{margin-top:calc(var(--kf-space-sm) - var(--kf-space-md))}:host(.kf-empty-state--card) .kf-empty-state__content>::ng-deep :is(p,ol,ul),:host(.kf-empty-state--card) .kf-empty-state__footer>::ng-deep [kf-empty-state-footer] :is(p),:host(.kf-empty-state--card) .kf-empty-state__footer>::ng-deep p[kf-empty-state-footer]{margin:0}:host(.kf-empty-state--card) .kf-empty-state__content:empty{display:none}:host(.kf-empty-state--card) .kf-empty-state__content{display:flex;flex-direction:column;align-items:stretch;gap:var(--kf-space-md);align-self:stretch;color:var(--kf-color-text);font-size:var(--kf-font-size-body-sm);line-height:1.5}:host(.kf-empty-state--card.kf-empty-state--error) .kf-empty-state__content{color:var(--kf-color-text)}:host(.kf-empty-state--card) .kf-empty-state__icon{display:flex;align-items:center;justify-content:center;width:56px;height:56px;border-radius:50%;background:var(--kf-color-surface);color:var(--kf-color-text-muted)}:host(.kf-empty-state--card.kf-empty-state--ok) .kf-empty-state__icon{background:var(--kf-color-success-soft);color:var(--kf-color-success-strong)}:host(.kf-empty-state--card.kf-empty-state--warn) .kf-empty-state__icon{background:var(--kf-color-warning-soft);color:var(--kf-color-warning-strong)}:host(.kf-empty-state--card.kf-empty-state--info) .kf-empty-state__icon{background:var(--kf-color-info-soft);color:var(--kf-color-info-strong)}:host(.kf-empty-state--card.kf-empty-state--error) .kf-empty-state__icon{background:var(--kf-color-error-soft);color:var(--kf-color-error-strong)}\n"], dependencies: [{ kind: "component", type: Icon, selector: "kf-icon", inputs: ["name", "size", "rotate", "filled"] }] });
|
|
6274
6318
|
}
|
|
6275
6319
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: EmptyState, decorators: [{
|
|
6276
6320
|
type: Component,
|
|
@@ -6281,11 +6325,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImpor
|
|
|
6281
6325
|
'[class.kf-empty-state--ok]': "tone() === 'ok'",
|
|
6282
6326
|
'[class.kf-empty-state--card]': "variant() === 'card'",
|
|
6283
6327
|
'[class.kf-empty-state--flat]': "variant() === 'flat'",
|
|
6328
|
+
// En `card` el chip ya existe con sus propios colores: la clase solo marca el chip de `inline` y `flat`.
|
|
6329
|
+
'[class.kf-empty-state--chip]': "iconChip() && variant() !== 'card'",
|
|
6330
|
+
'[class.kf-empty-state--sm]': "size() === 'sm'",
|
|
6331
|
+
'[class.kf-empty-state--text-neutral]': "textTone() === 'neutral'",
|
|
6284
6332
|
// `title` es un input con nombre de atributo nativo: escrito estático,
|
|
6285
6333
|
// Angular también lo dejaría en el host como tooltip sobre todo el bloque.
|
|
6286
6334
|
'[attr.title]': 'null',
|
|
6287
|
-
}, template: "@if (icon(); as iconName) {\n <span class=\"kf-empty-state__icon\">\n <kf-icon [name]=\"iconName\" [size]=\"iconSize()\" />\n </span>\n}\n@if (title(); as titleText) {\n <p class=\"kf-empty-state__title\">{{ titleText }}</p>\n}\n<div class=\"kf-empty-state__content\">\n <ng-content />\n</div>\n<div class=\"kf-empty-state__actions\"><ng-content select=\"[kf-empty-state-actions]\" /></div>\n<div class=\"kf-empty-state__footer\"><ng-content select=\"[kf-empty-state-footer]\" /></div>\n", styles: [":host{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:var(--kf-space-sm);padding:var(--kf-space-xl);border:1px dashed var(--kf-color-border-strong);border-radius:var(--kf-radius-md);background:var(--kf-color-surface);color:var(--kf-color-text-muted);font:inherit;text-align:center}:host(.kf-empty-state--error){border:none;background:var(--kf-color-error-soft)}.kf-empty-state__content{color:var(--kf-color-text-muted);font-family:var(--kf-font-body)}:host(.kf-empty-state--error) .kf-empty-state__content{color:var(--kf-color-error-strong)}.kf-empty-state__title{margin:0;font-family:var(--kf-font-title);font-size:var(--kf-font-size-title-sm);line-height:1.25;color:var(--kf-color-ink)}.kf-empty-state__actions{display:flex;flex-wrap:wrap;align-items:center;justify-content:center;gap:var(--kf-space-sm)}.kf-empty-state__actions>::ng-deep [kf-empty-state-actions]{display:flex;flex-wrap:wrap;align-items:center;justify-content:center;gap:var(--kf-space-sm)}.kf-empty-state__actions:empty,.kf-empty-state__footer:empty{display:none}.kf-empty-state__footer{display:flex;flex-direction:column;align-items:center;gap:var(--kf-space-xs);font-size:var(--kf-font-size-caption);color:var(--kf-color-text)}:host(.kf-empty-state--ok) .kf-empty-state__icon{color:var(--kf-color-success-strong)}:host(.kf-empty-state--warn) .kf-empty-state__icon{color:var(--kf-color-warning-strong)}:host(.kf-empty-state--info) .kf-empty-state__icon{color:var(--kf-color-info-strong)}:host(.kf-empty-state--flat){padding:var(--kf-space-lg) var(--kf-space-md);border:0;background:transparent}:host(.kf-empty-state--card){box-sizing:border-box;width:min(480px,100%);gap:var(--kf-space-md);padding:var(--kf-space-xl) var(--kf-space-lg);border:1px solid var(--kf-color-border);border-radius:var(--kf-radius-lg);background:var(--kf-color-white);box-shadow:var(--kf-elevation-raised);color:var(--kf-color-text)}:host(.kf-empty-state--card) .kf-empty-state__title+.kf-empty-state__content{margin-top:calc(var(--kf-space-sm) - var(--kf-space-md))}:host(.kf-empty-state--card) .kf-empty-state__content>::ng-deep :is(p,ol,ul),:host(.kf-empty-state--card) .kf-empty-state__footer>::ng-deep [kf-empty-state-footer] :is(p),:host(.kf-empty-state--card) .kf-empty-state__footer>::ng-deep p[kf-empty-state-footer]{margin:0}:host(.kf-empty-state--card) .kf-empty-state__content:empty{display:none}:host(.kf-empty-state--card) .kf-empty-state__content{display:flex;flex-direction:column;align-items:stretch;gap:var(--kf-space-md);align-self:stretch;color:var(--kf-color-text);font-size:var(--kf-font-size-body-sm);line-height:1.5}:host(.kf-empty-state--card.kf-empty-state--error) .kf-empty-state__content{color:var(--kf-color-text)}:host(.kf-empty-state--card) .kf-empty-state__icon{display:flex;align-items:center;justify-content:center;width:56px;height:56px;border-radius:50%;background:var(--kf-color-surface);color:var(--kf-color-text-muted)}:host(.kf-empty-state--card.kf-empty-state--ok) .kf-empty-state__icon{background:var(--kf-color-success-soft);color:var(--kf-color-success-strong)}:host(.kf-empty-state--card.kf-empty-state--warn) .kf-empty-state__icon{background:var(--kf-color-warning-soft);color:var(--kf-color-warning-strong)}:host(.kf-empty-state--card.kf-empty-state--info) .kf-empty-state__icon{background:var(--kf-color-info-soft);color:var(--kf-color-info-strong)}:host(.kf-empty-state--card.kf-empty-state--error) .kf-empty-state__icon{background:var(--kf-color-error-soft);color:var(--kf-color-error-strong)}\n"] }]
|
|
6288
|
-
}], propDecorators: { icon: [{ type: i0.Input, args: [{ isSignal: true, alias: "icon", required: false }] }], tone: [{ type: i0.Input, args: [{ isSignal: true, alias: "tone", required: false }] }], variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], title: [{ type: i0.Input, args: [{ isSignal: true, alias: "title", required: false }] }] } });
|
|
6335
|
+
}, template: "@if (icon(); as iconName) {\n <span class=\"kf-empty-state__icon\">\n <kf-icon [name]=\"iconName\" [size]=\"iconSize()\" />\n </span>\n}\n@if (title(); as titleText) {\n @switch (headingLevel()) {\n @case (2) {\n <h2 class=\"kf-empty-state__title\">{{ titleText }}</h2>\n }\n @case (3) {\n <h3 class=\"kf-empty-state__title\">{{ titleText }}</h3>\n }\n @case (4) {\n <h4 class=\"kf-empty-state__title\">{{ titleText }}</h4>\n }\n @default {\n <p class=\"kf-empty-state__title\">{{ titleText }}</p>\n }\n }\n}\n<div class=\"kf-empty-state__content\">\n <ng-content />\n</div>\n<div class=\"kf-empty-state__actions\"><ng-content select=\"[kf-empty-state-actions]\" /></div>\n<div class=\"kf-empty-state__footer\"><ng-content select=\"[kf-empty-state-footer]\" /></div>\n", styles: [":host{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:var(--kf-space-sm);padding:var(--kf-space-xl);border:1px dashed var(--kf-color-border-strong);border-radius:var(--kf-radius-md);background:var(--kf-color-surface);color:var(--kf-color-text-muted);font:inherit;text-align:center}:host(.kf-empty-state--error){border:none;background:var(--kf-color-error-soft)}.kf-empty-state__content{color:var(--kf-color-text-muted);font-family:var(--kf-font-body)}:host(.kf-empty-state--error) .kf-empty-state__content{color:var(--kf-color-error-strong)}.kf-empty-state__title{margin:0;font-family:var(--kf-font-title);font-size:var(--kf-font-size-title-sm);font-weight:inherit;line-height:1.25;color:var(--kf-color-ink)}.kf-empty-state__actions{display:flex;flex-wrap:wrap;align-items:center;justify-content:center;gap:var(--kf-space-sm)}.kf-empty-state__actions>::ng-deep [kf-empty-state-actions]{display:flex;flex-wrap:wrap;align-items:center;justify-content:center;gap:var(--kf-space-sm)}.kf-empty-state__actions:empty,.kf-empty-state__footer:empty{display:none}.kf-empty-state__footer{display:flex;flex-direction:column;align-items:center;gap:var(--kf-space-xs);font-size:var(--kf-font-size-caption);color:var(--kf-color-text)}:host(.kf-empty-state--ok) .kf-empty-state__icon{color:var(--kf-color-success-strong)}:host(.kf-empty-state--warn) .kf-empty-state__icon{color:var(--kf-color-warning-strong)}:host(.kf-empty-state--info) .kf-empty-state__icon{color:var(--kf-color-info-strong)}:host(.kf-empty-state--flat){padding:var(--kf-space-lg) var(--kf-space-md);border:0;background:transparent}:host(.kf-empty-state--sm) .kf-empty-state__title{font-weight:var(--kf-font-weight-title)}:host(.kf-empty-state--sm) .kf-empty-state__content{font-size:var(--kf-font-size-body-sm);line-height:1.5}:host(.kf-empty-state--text-neutral.kf-empty-state--error) .kf-empty-state__content{color:var(--kf-color-text-muted)}:host(.kf-empty-state--chip){gap:var(--kf-space-md)}:host(.kf-empty-state--chip.kf-empty-state--flat){padding-block:var(--kf-space-xl)}:host(.kf-empty-state--chip) .kf-empty-state__title+.kf-empty-state__content{margin-top:calc(var(--kf-space-sm) - var(--kf-space-md))}:host(.kf-empty-state--chip) .kf-empty-state__content:empty{display:none}:host(.kf-empty-state--chip) .kf-empty-state__icon{display:flex;align-items:center;justify-content:center;width:56px;height:56px;border-radius:50%;background:var(--kf-color-primary-soft);color:var(--kf-color-primary-active)}:host(.kf-empty-state--chip.kf-empty-state--ok) .kf-empty-state__icon{background:var(--kf-color-success-soft);color:var(--kf-color-success-strong)}:host(.kf-empty-state--chip.kf-empty-state--warn) .kf-empty-state__icon{background:var(--kf-color-warning-soft);color:var(--kf-color-warning-strong)}:host(.kf-empty-state--chip.kf-empty-state--info) .kf-empty-state__icon{background:var(--kf-color-info-soft);color:var(--kf-color-info-strong)}:host(.kf-empty-state--chip.kf-empty-state--error) .kf-empty-state__icon{background:var(--kf-color-error-soft);color:var(--kf-color-error-strong)}:host(.kf-empty-state--chip.kf-empty-state--error:not(.kf-empty-state--flat)) .kf-empty-state__icon{background:var(--kf-color-white)}:host(.kf-empty-state--card){box-sizing:border-box;width:min(480px,100%);gap:var(--kf-space-md);padding:var(--kf-space-xl) var(--kf-space-lg);border:1px solid var(--kf-color-border);border-radius:var(--kf-radius-lg);background:var(--kf-color-white);box-shadow:var(--kf-elevation-raised);color:var(--kf-color-text)}:host(.kf-empty-state--card) .kf-empty-state__title+.kf-empty-state__content{margin-top:calc(var(--kf-space-sm) - var(--kf-space-md))}:host(.kf-empty-state--card) .kf-empty-state__content>::ng-deep :is(p,ol,ul),:host(.kf-empty-state--card) .kf-empty-state__footer>::ng-deep [kf-empty-state-footer] :is(p),:host(.kf-empty-state--card) .kf-empty-state__footer>::ng-deep p[kf-empty-state-footer]{margin:0}:host(.kf-empty-state--card) .kf-empty-state__content:empty{display:none}:host(.kf-empty-state--card) .kf-empty-state__content{display:flex;flex-direction:column;align-items:stretch;gap:var(--kf-space-md);align-self:stretch;color:var(--kf-color-text);font-size:var(--kf-font-size-body-sm);line-height:1.5}:host(.kf-empty-state--card.kf-empty-state--error) .kf-empty-state__content{color:var(--kf-color-text)}:host(.kf-empty-state--card) .kf-empty-state__icon{display:flex;align-items:center;justify-content:center;width:56px;height:56px;border-radius:50%;background:var(--kf-color-surface);color:var(--kf-color-text-muted)}:host(.kf-empty-state--card.kf-empty-state--ok) .kf-empty-state__icon{background:var(--kf-color-success-soft);color:var(--kf-color-success-strong)}:host(.kf-empty-state--card.kf-empty-state--warn) .kf-empty-state__icon{background:var(--kf-color-warning-soft);color:var(--kf-color-warning-strong)}:host(.kf-empty-state--card.kf-empty-state--info) .kf-empty-state__icon{background:var(--kf-color-info-soft);color:var(--kf-color-info-strong)}:host(.kf-empty-state--card.kf-empty-state--error) .kf-empty-state__icon{background:var(--kf-color-error-soft);color:var(--kf-color-error-strong)}\n"] }]
|
|
6336
|
+
}], propDecorators: { icon: [{ type: i0.Input, args: [{ isSignal: true, alias: "icon", required: false }] }], tone: [{ type: i0.Input, args: [{ isSignal: true, alias: "tone", required: false }] }], variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], title: [{ type: i0.Input, args: [{ isSignal: true, alias: "title", required: false }] }], headingLevel: [{ type: i0.Input, args: [{ isSignal: true, alias: "headingLevel", required: false }] }], iconChip: [{ type: i0.Input, args: [{ isSignal: true, alias: "iconChip", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], textTone: [{ type: i0.Input, args: [{ isSignal: true, alias: "textTone", required: false }] }] } });
|
|
6289
6337
|
|
|
6290
6338
|
/**
|
|
6291
6339
|
* Bloque placeholder con shimmer para contenido que todavía carga: una línea
|
|
@@ -7213,6 +7261,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImpor
|
|
|
7213
7261
|
args: [{ selector: 'kf-view-toggle', imports: [Icon], template: "<div\n class=\"kf-view-toggle\"\n role=\"radiogroup\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-disabled]=\"disabled() ? 'true' : null\"\n>\n <button\n type=\"button\"\n role=\"radio\"\n class=\"kf-view-toggle__option\"\n [class.kf-view-toggle__option--icon]=\"iconOnly()\"\n [class.kf-view-toggle__option--active]=\"view() === 'table'\"\n [attr.aria-checked]=\"view() === 'table'\"\n [attr.aria-label]=\"iconOnly() ? tableLabel() : null\"\n [attr.title]=\"iconOnly() ? tableLabel() : null\"\n [attr.tabindex]=\"view() === 'table' ? 0 : -1\"\n [disabled]=\"disabled()\"\n (click)=\"select('table')\"\n (keydown)=\"onKeydown($event)\"\n >\n @if (iconOnly()) {\n <kf-icon name=\"list\" size=\"md\" />\n } @else {\n {{ tableLabel() }}\n }\n </button>\n <button\n type=\"button\"\n role=\"radio\"\n class=\"kf-view-toggle__option\"\n [class.kf-view-toggle__option--icon]=\"iconOnly()\"\n [class.kf-view-toggle__option--active]=\"view() === 'cards'\"\n [attr.aria-checked]=\"view() === 'cards'\"\n [attr.aria-label]=\"iconOnly() ? cardsLabel() : null\"\n [attr.title]=\"iconOnly() ? cardsLabel() : null\"\n [attr.tabindex]=\"view() === 'cards' ? 0 : -1\"\n [disabled]=\"disabled()\"\n (click)=\"select('cards')\"\n (keydown)=\"onKeydown($event)\"\n >\n @if (iconOnly()) {\n <kf-icon name=\"layout-grid\" size=\"md\" />\n } @else {\n {{ cardsLabel() }}\n }\n </button>\n</div>\n", styles: [":host{display:inline-block;font-family:var(--kf-font-body)}.kf-view-toggle{display:inline-flex;align-items:stretch;gap:2px;padding:2px;background:var(--kf-color-surface);border:1px solid var(--kf-color-border);border-radius:var(--kf-radius-sm)}.kf-view-toggle__option{font:inherit;font-size:.85rem;line-height:1;color:var(--kf-color-text-muted);background:transparent;border:none;border-radius:var(--kf-radius-xs);padding:var(--kf-space-xs) var(--kf-space-sm);cursor:pointer;transition:background var(--kf-motion-fast, .14s),color var(--kf-motion-fast, .14s),box-shadow var(--kf-motion-fast, .14s)}.kf-view-toggle__option:hover:not(.kf-view-toggle__option--active,:disabled){color:var(--kf-color-text)}.kf-view-toggle__option:focus-visible{outline:none;box-shadow:var(--kf-shadow-focus)}.kf-view-toggle__option--active{color:var(--kf-color-ink);background:var(--kf-color-white);box-shadow:var(--kf-shadow-xs)}.kf-view-toggle__option:disabled{opacity:.5;cursor:not-allowed}.kf-view-toggle__option--icon{display:inline-flex;align-items:center;justify-content:center;min-width:32px;min-height:32px;padding:var(--kf-space-xs)}@media(max-width:640px),(pointer:coarse){.kf-view-toggle__option--icon{min-width:44px;min-height:44px}}@media(prefers-reduced-motion:reduce){.kf-view-toggle__option{transition:none}}\n"] }]
|
|
7214
7262
|
}], propDecorators: { view: [{ type: i0.Input, args: [{ isSignal: true, alias: "view", required: true }] }], iconOnly: [{ type: i0.Input, args: [{ isSignal: true, alias: "iconOnly", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], tableLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "tableLabel", required: false }] }], cardsLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "cardsLabel", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], viewChange: [{ type: i0.Output, args: ["viewChange"] }] } });
|
|
7215
7263
|
|
|
7264
|
+
/** Controles que no pueden vivir dentro de una tarjeta `role="button"` (controles anidados). */
|
|
7265
|
+
const NESTED_CONTROL_SELECTOR = 'a[href], button, input, select, textarea, [role="button"], [role="link"], [role="menuitem"], [role="checkbox"], [role="switch"], [role="tab"], [contenteditable="true"]';
|
|
7216
7266
|
/** Controles cuyo clic/Enter NO debe activar además la fila o tarjeta que los contiene. */
|
|
7217
7267
|
const INTERACTIVE_CONTROL_SELECTOR = 'a[href], button, input, select, textarea, summary, label, [role="button"], [role="link"], [role="menuitem"], [role="checkbox"], [role="switch"], [role="tab"], [contenteditable="true"]';
|
|
7218
7268
|
/** Piso de ancho de una columna `grow` que no declara `minWidth` ni `width`. */
|
|
@@ -7389,10 +7439,29 @@ const DEFAULT_PAGE_SIZE_OPTIONS = [10, 25, 50];
|
|
|
7389
7439
|
* [cellAriaLabel]="stageLabel" (cellClick)="openStage($event.row, $event.column)" />
|
|
7390
7440
|
*
|
|
7391
7441
|
* Convive con `rowClick`: la fila sigue emitiéndolo desde cualquier punto que
|
|
7392
|
-
* no sea una celda interactiva. En tarjetas, la tarjeta deja
|
|
7393
|
-
*
|
|
7394
|
-
* `
|
|
7395
|
-
*
|
|
7442
|
+
* no sea una celda interactiva. En tarjetas, sin `[rowClickable]` la tarjeta deja
|
|
7443
|
+
* de ser clicable cuando hay una columna `interactive` o `cardRole: 'action'`.
|
|
7444
|
+
* `sticky`, `cellTemplates`, `currentRowKey`, la ordenación y la paginación no cambian.
|
|
7445
|
+
*
|
|
7446
|
+
* Tarjeta clicable con controles adentro: una tarjeta nunca es un `role="button"` si
|
|
7447
|
+
* contiene un control (WCAG 4.1.2, controles anidados). Con `selectable`, `cardMenu`, una
|
|
7448
|
+
* columna `interactive`, una `cardRole: 'action'` o una columna con `hasControls: true`
|
|
7449
|
+
* (el `cellTemplates` trae un enlace, un botón, un interruptor, una casilla o un campo), la
|
|
7450
|
+
* tarjeta clicable (`rowClickable` o el cálculo automático) queda sin rol ni `tabindex` y la
|
|
7451
|
+
* abre un `<button>` propio, visible con el foco como anillo de la tarjeta (nombre con
|
|
7452
|
+
* `cardOpenLabel`, por defecto «Abrir {título}»), que va primero en el orden de Tab. Un clic
|
|
7453
|
+
* o Enter dentro de un control interno no abre la fila; el clic en el resto de la tarjeta
|
|
7454
|
+
* sigue abriéndola con el mouse. Una tarjeta sin controles conserva el `role="button"`:
|
|
7455
|
+
*
|
|
7456
|
+
* columns = [
|
|
7457
|
+
* { key: 'plate', label: 'Placa', cardRole: 'title' },
|
|
7458
|
+
* { key: 'owner', label: 'Responsable', hasControls: true },
|
|
7459
|
+
* ];
|
|
7460
|
+
* <kf-data-table [columns]="columns" [rows]="units" cardable (rowClick)="open($event.row)"
|
|
7461
|
+
* [cellTemplates]="{ owner: ownerLink }" [cardOpenLabel]="openLabel" />
|
|
7462
|
+
*
|
|
7463
|
+
* En desarrollo, una tarjeta con `role="button"` que contiene un control sin declarar avisa
|
|
7464
|
+
* con `console.warn` una sola vez.
|
|
7396
7465
|
*/
|
|
7397
7466
|
class DataTable {
|
|
7398
7467
|
columns = input.required(/* @ts-ignore */
|
|
@@ -7520,6 +7589,13 @@ class DataTable {
|
|
|
7520
7589
|
this.activeView();
|
|
7521
7590
|
this.evaluateAutoCards();
|
|
7522
7591
|
});
|
|
7592
|
+
afterRenderEffect(() => {
|
|
7593
|
+
this.activeView();
|
|
7594
|
+
this.displayedRows();
|
|
7595
|
+
this.shownColumns();
|
|
7596
|
+
this.cardInteractive();
|
|
7597
|
+
this.warnIfNestedControls();
|
|
7598
|
+
});
|
|
7523
7599
|
afterNextRender(() => {
|
|
7524
7600
|
const observer = new ResizeObserver(() => this.evaluateAutoCards());
|
|
7525
7601
|
observer.observe(this.hostEl.nativeElement);
|
|
@@ -7831,9 +7907,12 @@ class DataTable {
|
|
|
7831
7907
|
cardMenuAriaLabel(row) {
|
|
7832
7908
|
return this.cardMenuLabel()?.(row) ?? 'Acciones de la fila';
|
|
7833
7909
|
}
|
|
7834
|
-
/**
|
|
7910
|
+
/**
|
|
7911
|
+
* La tarjeta lleva casilla, menú o celdas con controles propios: no puede ser un `role="button"`
|
|
7912
|
+
* con controles adentro, la abre su botón `card-open`.
|
|
7913
|
+
*/
|
|
7835
7914
|
cardHasNestedControls(row) {
|
|
7836
|
-
return this.selectable() || this.cardMenuEntries(row) !== null;
|
|
7915
|
+
return (this.selectable() || this.cardMenuEntries(row) !== null || this.cardColumnsHaveControls());
|
|
7837
7916
|
}
|
|
7838
7917
|
cardOpenAriaLabel(row) {
|
|
7839
7918
|
const custom = this.cardOpenLabel()?.(row);
|
|
@@ -7885,7 +7964,10 @@ class DataTable {
|
|
|
7885
7964
|
density = input('comfortable', /* @ts-ignore */
|
|
7886
7965
|
...(ngDevMode ? [{ debugName: "density" }] : /* istanbul ignore next */ []));
|
|
7887
7966
|
/** Fuerza si la fila entera dispara `rowClick` en la vista de tabla —
|
|
7888
|
-
* ver `rowInteractive` para el cálculo automático cuando no se define.
|
|
7967
|
+
* ver `rowInteractive` para el cálculo automático cuando no se define. En tarjetas fuerza
|
|
7968
|
+
* `cardInteractive`; una tarjeta con controles propios (columnas `interactive`, `action` o
|
|
7969
|
+
* `hasControls`, `selectable`, `cardMenu`) se abre con su botón `card-open`, nunca como
|
|
7970
|
+
* `role="button"`. */
|
|
7889
7971
|
rowClickable = input(null, /* @ts-ignore */
|
|
7890
7972
|
...(ngDevMode ? [{ debugName: "rowClickable" }] : /* istanbul ignore next */ []));
|
|
7891
7973
|
/**
|
|
@@ -7895,7 +7977,7 @@ class DataTable {
|
|
|
7895
7977
|
* dentro de una celda — así una página de N filas no suma N paradas de Tab
|
|
7896
7978
|
* sin rol. El clic con mouse sigue emitiendo `rowClick`. Default `true`
|
|
7897
7979
|
* (comportamiento histórico). No afecta a las tarjetas, que son
|
|
7898
|
-
* `role="button"
|
|
7980
|
+
* `role="button"` salvo que lleven controles propios (ver `hasControls`).
|
|
7899
7981
|
*/
|
|
7900
7982
|
rowFocusable = input(true, /* @ts-ignore */
|
|
7901
7983
|
...(ngDevMode ? [{ debugName: "rowFocusable" }] : /* istanbul ignore next */ []));
|
|
@@ -8272,7 +8354,9 @@ class DataTable {
|
|
|
8272
8354
|
/**
|
|
8273
8355
|
* La card entera es clickeable solo si no tiene acciones propias: un
|
|
8274
8356
|
* `role="button"` con botones adentro es inválido y deja el foco ambiguo.
|
|
8275
|
-
* Con columnas `action`, la interacción la manejan esos botones.
|
|
8357
|
+
* Con columnas `action`, la interacción la manejan esos botones. Una columna con
|
|
8358
|
+
* `hasControls` no la desactiva: la tarjeta sigue siendo clicable, pero se abre con
|
|
8359
|
+
* su botón `card-open` en vez de ser un `role="button"`.
|
|
8276
8360
|
*/
|
|
8277
8361
|
cardInteractive = computed(() => this.rowClickable() ??
|
|
8278
8362
|
(this.cardActionColumns().length === 0 && !this.hasInteractiveColumns()), /* @ts-ignore */
|
|
@@ -8280,6 +8364,12 @@ class DataTable {
|
|
|
8280
8364
|
/** Hay al menos una columna `interactive` (celdas con botón propio). */
|
|
8281
8365
|
hasInteractiveColumns = computed(() => this.shownColumns().some((column) => column.interactive), /* @ts-ignore */
|
|
8282
8366
|
...(ngDevMode ? [{ debugName: "hasInteractiveColumns" }] : /* istanbul ignore next */ []));
|
|
8367
|
+
/**
|
|
8368
|
+
* Alguna columna mostrada trae controles propios: es `interactive`, va en la zona de acciones
|
|
8369
|
+
* (`cardRole: 'action'`) o declara `hasControls`.
|
|
8370
|
+
*/
|
|
8371
|
+
cardColumnsHaveControls = computed(() => this.shownColumns().some((column) => column.interactive || column.hasControls || column.cardRole === 'action'), /* @ts-ignore */
|
|
8372
|
+
...(ngDevMode ? [{ debugName: "cardColumnsHaveControls" }] : /* istanbul ignore next */ []));
|
|
8283
8373
|
/**
|
|
8284
8374
|
* Mismo criterio que `cardInteractive`, para la vista de tabla: la fila
|
|
8285
8375
|
* entera dispara `rowClick` solo si no hay una columna `action` que ya
|
|
@@ -8366,6 +8456,26 @@ class DataTable {
|
|
|
8366
8456
|
}
|
|
8367
8457
|
this.rowClick.emit({ row, index });
|
|
8368
8458
|
}
|
|
8459
|
+
warnedNestedControls = false;
|
|
8460
|
+
/**
|
|
8461
|
+
* Solo desarrollo: una tarjeta `role="button"` con un control adentro es HTML inválido. La tabla no
|
|
8462
|
+
* ve dentro de los templates, así que avisa una vez y pide declarar `hasControls` en la columna.
|
|
8463
|
+
*/
|
|
8464
|
+
warnIfNestedControls() {
|
|
8465
|
+
if (!isDevMode() || this.warnedNestedControls) {
|
|
8466
|
+
return;
|
|
8467
|
+
}
|
|
8468
|
+
for (const card of this.hostEl.nativeElement.querySelectorAll('.kf-data-table__card[role="button"]')) {
|
|
8469
|
+
const control = card.querySelector(NESTED_CONTROL_SELECTOR);
|
|
8470
|
+
if (control) {
|
|
8471
|
+
this.warnedNestedControls = true;
|
|
8472
|
+
console.warn(`[kf-data-table] una tarjeta clicable es un role="button" y contiene un control (<${control.localName}>): ` +
|
|
8473
|
+
'un control dentro de un botón es inválido. Declarar `hasControls: true` en la columna cuyo ' +
|
|
8474
|
+
'template lo trae para que la fila se abra con un botón propio.');
|
|
8475
|
+
return;
|
|
8476
|
+
}
|
|
8477
|
+
}
|
|
8478
|
+
}
|
|
8369
8479
|
/** Activación de una celda interactiva (clic, o Enter/Espacio sobre su botón). */
|
|
8370
8480
|
onCellClick(row, column, index) {
|
|
8371
8481
|
this.cellClick.emit({ row, column, index });
|
|
@@ -8835,7 +8945,7 @@ class ContentState {
|
|
|
8835
8945
|
customLoading = computed(() => this.projectedLoading() ?? this.loadingTemplate(), /* @ts-ignore */
|
|
8836
8946
|
...(ngDevMode ? [{ debugName: "customLoading" }] : /* istanbul ignore next */ []));
|
|
8837
8947
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: ContentState, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
8838
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.0", type: ContentState, isStandalone: true, selector: "kf-content-state", inputs: { state: { classPropertyName: "state", publicName: "state", isSignal: true, isRequired: true, transformFunction: null }, load: { classPropertyName: "load", publicName: "load", isSignal: true, isRequired: false, transformFunction: null }, title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, subtitle: { classPropertyName: "subtitle", publicName: "subtitle", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null }, loadingLabel: { classPropertyName: "loadingLabel", publicName: "loadingLabel", isSignal: true, isRequired: false, transformFunction: null }, loadingTemplate: { classPropertyName: "loadingTemplate", publicName: "loadingTemplate", isSignal: true, isRequired: false, transformFunction: null }, loadingPreset: { classPropertyName: "loadingPreset", publicName: "loadingPreset", isSignal: true, isRequired: false, transformFunction: null } }, queries: [{ propertyName: "projectedLoading", first: true, predicate: ContentStateLoading, descendants: true, read: TemplateRef, isSignal: true }], ngImport: i0, template: "@switch (state()) {\n @case ('ready') {\n <ng-content />\n }\n @case ('loading') {\n @if (load() === 'skeleton') {\n <!-- Fuera del contenedor `aria-busy`: una regi\u00F3n viva ocupada no anuncia nada. -->\n <span class=\"kf-sr-only\" role=\"status\">{{ loadingLabel() }}</span>\n }\n <div class=\"kf-content-state__loading\" aria-busy=\"true\">\n @if (load() === 'spinner') {\n <kf-spinner [label]=\"loadingLabel()\" />\n } @else {\n @if (customLoading(); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" />\n } @else if (loadingPreset(); as preset) {\n <kf-skeleton-preset [variant]=\"preset\" />\n } @else {\n <kf-skeleton />\n <kf-skeleton width=\"80%\" />\n <kf-skeleton width=\"60%\" />\n }\n }\n </div>\n }\n @default {\n <kf-empty-state\n [tone]=\"state() === 'error' ? 'error' : 'neutral'\"\n [variant]=\"variant()\"\n [icon]=\"icon()\"\n [attr.role]=\"state() === 'error' ? 'alert' : 'status'\"\n >\n @if (title()) {\n <p class=\"kf-content-state__title\">{{ title() }}</p>\n }\n @if (subtitle()) {\n <p class=\"kf-content-state__subtitle\">{{ subtitle() }}</p>\n }\n <div class=\"kf-content-state__actions\"><ng-content select=\"[actions]\" /></div>\n </kf-empty-state>\n }\n}\n", styles: [".kf-sr-only{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}:host{position:relative;display:block;font-family:var(--kf-font-body)}.kf-content-state__loading{display:flex;flex-direction:column;gap:var(--kf-space-sm);min-width:min(12rem,100vw);box-sizing:border-box}.kf-content-state__title{margin:0;font-family:var(--kf-font-title);font-weight:700;color:var(--kf-color-ink)}.kf-content-state__subtitle{margin:0;color:var(--kf-color-text-muted)}.kf-content-state__actions:empty{display:none}.kf-content-state__actions{display:flex;flex-wrap:wrap;justify-content:center;gap:var(--kf-space-sm);margin-top:var(--kf-space-sm)}\n"], dependencies: [{ kind: "component", type: EmptyState, selector: "kf-empty-state", inputs: ["icon", "tone", "variant", "title"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: Skeleton, selector: "kf-skeleton", inputs: ["variant", "width", "height"] }, { kind: "component", type: SkeletonPreset, selector: "kf-skeleton-preset", inputs: ["variant", "count", "columns", "label"] }, { kind: "component", type: Spinner, selector: "kf-spinner", inputs: ["size", "label", "onDark"] }] });
|
|
8948
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.0", type: ContentState, isStandalone: true, selector: "kf-content-state", inputs: { state: { classPropertyName: "state", publicName: "state", isSignal: true, isRequired: true, transformFunction: null }, load: { classPropertyName: "load", publicName: "load", isSignal: true, isRequired: false, transformFunction: null }, title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, subtitle: { classPropertyName: "subtitle", publicName: "subtitle", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null }, loadingLabel: { classPropertyName: "loadingLabel", publicName: "loadingLabel", isSignal: true, isRequired: false, transformFunction: null }, loadingTemplate: { classPropertyName: "loadingTemplate", publicName: "loadingTemplate", isSignal: true, isRequired: false, transformFunction: null }, loadingPreset: { classPropertyName: "loadingPreset", publicName: "loadingPreset", isSignal: true, isRequired: false, transformFunction: null } }, queries: [{ propertyName: "projectedLoading", first: true, predicate: ContentStateLoading, descendants: true, read: TemplateRef, isSignal: true }], ngImport: i0, template: "@switch (state()) {\n @case ('ready') {\n <ng-content />\n }\n @case ('loading') {\n @if (load() === 'skeleton') {\n <!-- Fuera del contenedor `aria-busy`: una regi\u00F3n viva ocupada no anuncia nada. -->\n <span class=\"kf-sr-only\" role=\"status\">{{ loadingLabel() }}</span>\n }\n <div class=\"kf-content-state__loading\" aria-busy=\"true\">\n @if (load() === 'spinner') {\n <kf-spinner [label]=\"loadingLabel()\" />\n } @else {\n @if (customLoading(); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" />\n } @else if (loadingPreset(); as preset) {\n <kf-skeleton-preset [variant]=\"preset\" />\n } @else {\n <kf-skeleton />\n <kf-skeleton width=\"80%\" />\n <kf-skeleton width=\"60%\" />\n }\n }\n </div>\n }\n @default {\n <kf-empty-state\n [tone]=\"state() === 'error' ? 'error' : 'neutral'\"\n [variant]=\"variant()\"\n [icon]=\"icon()\"\n [attr.role]=\"state() === 'error' ? 'alert' : 'status'\"\n >\n @if (title()) {\n <p class=\"kf-content-state__title\">{{ title() }}</p>\n }\n @if (subtitle()) {\n <p class=\"kf-content-state__subtitle\">{{ subtitle() }}</p>\n }\n <div class=\"kf-content-state__actions\"><ng-content select=\"[actions]\" /></div>\n </kf-empty-state>\n }\n}\n", styles: [".kf-sr-only{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}:host{position:relative;display:block;font-family:var(--kf-font-body)}.kf-content-state__loading{display:flex;flex-direction:column;gap:var(--kf-space-sm);min-width:min(12rem,100vw);box-sizing:border-box}.kf-content-state__title{margin:0;font-family:var(--kf-font-title);font-weight:700;color:var(--kf-color-ink)}.kf-content-state__subtitle{margin:0;color:var(--kf-color-text-muted)}.kf-content-state__actions:empty{display:none}.kf-content-state__actions{display:flex;flex-wrap:wrap;justify-content:center;gap:var(--kf-space-sm);margin-top:var(--kf-space-sm)}\n"], dependencies: [{ kind: "component", type: EmptyState, selector: "kf-empty-state", inputs: ["icon", "tone", "variant", "title", "headingLevel", "iconChip", "size", "textTone"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: Skeleton, selector: "kf-skeleton", inputs: ["variant", "width", "height"] }, { kind: "component", type: SkeletonPreset, selector: "kf-skeleton-preset", inputs: ["variant", "count", "columns", "label"] }, { kind: "component", type: Spinner, selector: "kf-spinner", inputs: ["size", "label", "onDark"] }] });
|
|
8839
8949
|
}
|
|
8840
8950
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: ContentState, decorators: [{
|
|
8841
8951
|
type: Component,
|