@solercia/ui 0.1.0 → 0.1.1
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 +21 -0
- package/fesm2022/solercia-ui.mjs +1213 -11
- package/fesm2022/solercia-ui.mjs.map +1 -1
- package/package.json +2 -2
- package/types/solercia-ui.d.ts +269 -6
package/fesm2022/solercia-ui.mjs
CHANGED
|
@@ -2324,7 +2324,7 @@ function parseInput(value) {
|
|
|
2324
2324
|
}
|
|
2325
2325
|
// Dimensiones aproximadas del popover para el cálculo manual de viewport.
|
|
2326
2326
|
const POPOVER_HEIGHT = 340;
|
|
2327
|
-
const POPOVER_WIDTH = 300;
|
|
2327
|
+
const POPOVER_WIDTH$1 = 300;
|
|
2328
2328
|
/**
|
|
2329
2329
|
* `sol-date-picker` — calendario propio del design system, tematizado con
|
|
2330
2330
|
* tokens `--sol-*` (light/dark) y con tres vistas navegables:
|
|
@@ -2596,7 +2596,7 @@ class SolDatePickerComponent {
|
|
|
2596
2596
|
const rect = this.hostEl.nativeElement.getBoundingClientRect();
|
|
2597
2597
|
const spaceBelow = window.innerHeight - rect.bottom;
|
|
2598
2598
|
this.dropUp.set(spaceBelow < POPOVER_HEIGHT && rect.top > POPOVER_HEIGHT);
|
|
2599
|
-
this.alignEnd.set(rect.left + POPOVER_WIDTH > window.innerWidth);
|
|
2599
|
+
this.alignEnd.set(rect.left + POPOVER_WIDTH$1 > window.innerWidth);
|
|
2600
2600
|
}
|
|
2601
2601
|
// ── Navegación del encabezado ──
|
|
2602
2602
|
goPrev() {
|
|
@@ -5797,8 +5797,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
5797
5797
|
* ── Allowlist de TAGS de salida ──────────────────────────────────────────
|
|
5798
5798
|
* Bloque: <p> <h1> <h2> <h3> <ul> <ol> <li> <table><tbody><tr><td> <br>
|
|
5799
5799
|
* Inline: <strong> <em> <u> <s> <a> <img>
|
|
5800
|
+
* Chip: <span data-mention-id="…"> / <span data-task-key="…"> (OPT-IN)
|
|
5800
5801
|
* Nada más. Todo lo demás se desanida (unwrap), se convierte o se descarta.
|
|
5801
5802
|
*
|
|
5803
|
+
* ── Chips de mención (@) y enlace de tarea (#) — OPT-IN ───────────────────
|
|
5804
|
+
* Un `<span>` se PRESERVA en la salida SOLO si porta `data-mention-id` o
|
|
5805
|
+
* `data-task-key`. En ese caso se emite un span canónico con EXACTAMENTE ese
|
|
5806
|
+
* único atributo data-* (valor escapado) y su texto; cualquier otro atributo
|
|
5807
|
+
* del span de entrada (class, style, on*, contenteditable, href…) se DESCARTA
|
|
5808
|
+
* —no hay passthrough—. Un `<span>` normal (sin data de chip) se desanida
|
|
5809
|
+
* como siempre. Esto no abre XSS: solo el atributo data-* controlado y el
|
|
5810
|
+
* texto escapado sobreviven; el span nunca lleva estilos ni handlers.
|
|
5811
|
+
*
|
|
5802
5812
|
* ── Conversión de tags de entrada ────────────────────────────────────────
|
|
5803
5813
|
* <b>/<strong> → <strong>
|
|
5804
5814
|
* <i>/<em> → <em>
|
|
@@ -5837,10 +5847,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
5837
5847
|
* serializa por allowlist. `<script>`, `<style>`, `<iframe>`, handlers `on*`,
|
|
5838
5848
|
* `href="javascript:"` y `src` no permitidos se descartan.
|
|
5839
5849
|
*/
|
|
5840
|
-
/**
|
|
5850
|
+
/**
|
|
5851
|
+
* Tags permitidos en la salida (para documentación/validación externa).
|
|
5852
|
+
* `span` SOLO se emite para chips de mención/tarea (`data-mention-id` /
|
|
5853
|
+
* `data-task-key`); un `<span>` normal se sigue desanidando.
|
|
5854
|
+
*/
|
|
5841
5855
|
const TCPDF_ALLOWED_TAGS = [
|
|
5842
5856
|
'p', 'h1', 'h2', 'h3', 'strong', 'em', 'u', 's',
|
|
5843
|
-
'ul', 'ol', 'li', 'table', 'tbody', 'tr', 'td', 'a', 'img', 'br',
|
|
5857
|
+
'ul', 'ol', 'li', 'table', 'tbody', 'tr', 'td', 'a', 'img', 'br', 'span',
|
|
5844
5858
|
];
|
|
5845
5859
|
/**
|
|
5846
5860
|
* Propiedades CSS de ENTRADA que el serializador inspecciona. `text-align` se
|
|
@@ -5990,6 +6004,27 @@ function hasBlockChild(el) {
|
|
|
5990
6004
|
return Array.from(el.children).some((child) => BLOCK_TAGS.has(child.localName) && !DROP_TAGS.has(child.localName));
|
|
5991
6005
|
}
|
|
5992
6006
|
// ── Serialización inline ─────────────────────────────────────────────────
|
|
6007
|
+
/**
|
|
6008
|
+
* Chip OPT-IN de mención (@) o enlace de tarea (#).
|
|
6009
|
+
*
|
|
6010
|
+
* Devuelve el span canónico con EXACTAMENTE un atributo data-* (escapado) y el
|
|
6011
|
+
* texto escapado; descarta cualquier otro atributo (class, style, on*, …). Un
|
|
6012
|
+
* span con el data de chip pero sin texto se descarta (''). Un span SIN data de
|
|
6013
|
+
* chip devuelve `null` para que el recorrido lo desanide como span normal.
|
|
6014
|
+
*/
|
|
6015
|
+
function serializeMentionChip(el) {
|
|
6016
|
+
const mentionId = (el.getAttribute('data-mention-id') ?? '').trim();
|
|
6017
|
+
if (mentionId) {
|
|
6018
|
+
const text = escapeText(collapseWs(el.textContent ?? '')).trim();
|
|
6019
|
+
return text ? `<span data-mention-id="${escapeAttr(mentionId)}">${text}</span>` : '';
|
|
6020
|
+
}
|
|
6021
|
+
const taskKey = (el.getAttribute('data-task-key') ?? '').trim();
|
|
6022
|
+
if (taskKey) {
|
|
6023
|
+
const text = escapeText(collapseWs(el.textContent ?? '')).trim();
|
|
6024
|
+
return text ? `<span data-task-key="${escapeAttr(taskKey)}">${text}</span>` : '';
|
|
6025
|
+
}
|
|
6026
|
+
return null;
|
|
6027
|
+
}
|
|
5993
6028
|
function serializeImg(el) {
|
|
5994
6029
|
const src = (el.getAttribute('src') ?? '').trim();
|
|
5995
6030
|
if (!isSafeImgSrc(src))
|
|
@@ -6020,6 +6055,12 @@ function serializeInline(node, ctx) {
|
|
|
6020
6055
|
return '<br />';
|
|
6021
6056
|
if (tag === 'img')
|
|
6022
6057
|
return serializeImg(el);
|
|
6058
|
+
// Chip de mención/tarea (opt-in): se preserva; un span normal → null (unwrap).
|
|
6059
|
+
if (tag === 'span') {
|
|
6060
|
+
const chip = serializeMentionChip(el);
|
|
6061
|
+
if (chip !== null)
|
|
6062
|
+
return chip;
|
|
6063
|
+
}
|
|
6023
6064
|
if (tag === 'a') {
|
|
6024
6065
|
const inner = serializeInlineChildren(el, { ...ctx, marks: new Set(ctx.marks) });
|
|
6025
6066
|
if (!inner)
|
|
@@ -6271,6 +6312,12 @@ const EMPTY_FORMATS = {
|
|
|
6271
6312
|
};
|
|
6272
6313
|
/** Tamaño máximo de la rejilla del selector de tablas. */
|
|
6273
6314
|
const TABLE_GRID_MAX = 8;
|
|
6315
|
+
/** Máximo de resultados listados en el popover de menciones/tareas. */
|
|
6316
|
+
const MENTION_MAX_RESULTS = 8;
|
|
6317
|
+
/** Longitud máxima de la consulta tras `@`/`#` antes de descartar el trigger. */
|
|
6318
|
+
const MENTION_QUERY_MAX = 30;
|
|
6319
|
+
/** Ancho de referencia del popover (px) para acotar su posición horizontal. */
|
|
6320
|
+
const POPOVER_WIDTH = 208;
|
|
6274
6321
|
/**
|
|
6275
6322
|
* `sol-rich-editor` — editor de texto enriquecido PROPIO del design system.
|
|
6276
6323
|
*
|
|
@@ -6315,9 +6362,25 @@ class SolRichEditorComponent {
|
|
|
6315
6362
|
/** Hook opcional para subir la imagen y usar su URL en vez del data URL. */
|
|
6316
6363
|
imageUpload = input(null, /* @ts-ignore */
|
|
6317
6364
|
...(ngDevMode ? [{ debugName: "imageUpload" }] : /* istanbul ignore next */ []));
|
|
6365
|
+
/**
|
|
6366
|
+
* Usuarios mencionables con `@` (opt-in). Vacío ⇒ menciones DESACTIVADAS:
|
|
6367
|
+
* el editor se comporta exactamente igual que sin esta capacidad.
|
|
6368
|
+
*/
|
|
6369
|
+
mentionableUsers = input([], /* @ts-ignore */
|
|
6370
|
+
...(ngDevMode ? [{ debugName: "mentionableUsers" }] : /* istanbul ignore next */ []));
|
|
6371
|
+
/**
|
|
6372
|
+
* Tareas enlazables con `#` (opt-in). Vacío ⇒ enlaces DESACTIVADOS: el
|
|
6373
|
+
* editor se comporta exactamente igual que sin esta capacidad.
|
|
6374
|
+
*/
|
|
6375
|
+
linkableTasks = input([], /* @ts-ignore */
|
|
6376
|
+
...(ngDevMode ? [{ debugName: "linkableTasks" }] : /* istanbul ignore next */ []));
|
|
6318
6377
|
// ── Outputs ─────────────────────────────────────────────────────────
|
|
6319
6378
|
/** Emite el HTML limpio en cada cambio (además del flujo CVA). */
|
|
6320
6379
|
valueChange = output();
|
|
6380
|
+
/** IDs únicos (orden de documento) de los usuarios mencionados en el contenido. */
|
|
6381
|
+
mentionsChange = output();
|
|
6382
|
+
/** Keys únicas (orden de documento) de las tareas enlazadas en el contenido. */
|
|
6383
|
+
taskLinksChange = output();
|
|
6321
6384
|
// ── Referencias del template ────────────────────────────────────────
|
|
6322
6385
|
editable = viewChild.required('editable', /* @ts-ignore */
|
|
6323
6386
|
...(ngDevMode ? [{ debugName: "editable" }] : /* istanbul ignore next */ []));
|
|
@@ -6346,6 +6409,45 @@ class SolRichEditorComponent {
|
|
|
6346
6409
|
...(ngDevMode ? [{ debugName: "linkUrl" }] : /* istanbul ignore next */ []));
|
|
6347
6410
|
imageError = signal('', /* @ts-ignore */
|
|
6348
6411
|
...(ngDevMode ? [{ debugName: "imageError" }] : /* istanbul ignore next */ []));
|
|
6412
|
+
// ── Estado de menciones (@) / tareas (#) — opt-in ───────────────────
|
|
6413
|
+
showMentionPopover = signal(false, /* @ts-ignore */
|
|
6414
|
+
...(ngDevMode ? [{ debugName: "showMentionPopover" }] : /* istanbul ignore next */ []));
|
|
6415
|
+
showTaskPopover = signal(false, /* @ts-ignore */
|
|
6416
|
+
...(ngDevMode ? [{ debugName: "showTaskPopover" }] : /* istanbul ignore next */ []));
|
|
6417
|
+
activeIndex = signal(0, /* @ts-ignore */
|
|
6418
|
+
...(ngDevMode ? [{ debugName: "activeIndex" }] : /* istanbul ignore next */ []));
|
|
6419
|
+
popoverTop = signal(0, /* @ts-ignore */
|
|
6420
|
+
...(ngDevMode ? [{ debugName: "popoverTop" }] : /* istanbul ignore next */ []));
|
|
6421
|
+
popoverLeft = signal(0, /* @ts-ignore */
|
|
6422
|
+
...(ngDevMode ? [{ debugName: "popoverLeft" }] : /* istanbul ignore next */ []));
|
|
6423
|
+
mentionQuery = signal('', /* @ts-ignore */
|
|
6424
|
+
...(ngDevMode ? [{ debugName: "mentionQuery" }] : /* istanbul ignore next */ []));
|
|
6425
|
+
taskQuery = signal('', /* @ts-ignore */
|
|
6426
|
+
...(ngDevMode ? [{ debugName: "taskQuery" }] : /* istanbul ignore next */ []));
|
|
6427
|
+
/** Rango que abarca `@query`/`#query`; se reemplaza por el chip al elegir. */
|
|
6428
|
+
triggerRange = null;
|
|
6429
|
+
/** Menciones activas solo si hay usuarios; si no, el trigger `@` se ignora. */
|
|
6430
|
+
mentionsEnabled = computed(() => this.mentionableUsers().length > 0, /* @ts-ignore */
|
|
6431
|
+
...(ngDevMode ? [{ debugName: "mentionsEnabled" }] : /* istanbul ignore next */ []));
|
|
6432
|
+
/** Enlaces activos solo si hay tareas; si no, el trigger `#` se ignora. */
|
|
6433
|
+
tasksEnabled = computed(() => this.linkableTasks().length > 0, /* @ts-ignore */
|
|
6434
|
+
...(ngDevMode ? [{ debugName: "tasksEnabled" }] : /* istanbul ignore next */ []));
|
|
6435
|
+
filteredUsers = computed(() => {
|
|
6436
|
+
const query = this.mentionQuery().toLowerCase();
|
|
6437
|
+
return this.mentionableUsers()
|
|
6438
|
+
.filter((user) => !query || user.name.toLowerCase().includes(query))
|
|
6439
|
+
.slice(0, MENTION_MAX_RESULTS);
|
|
6440
|
+
}, /* @ts-ignore */
|
|
6441
|
+
...(ngDevMode ? [{ debugName: "filteredUsers" }] : /* istanbul ignore next */ []));
|
|
6442
|
+
filteredTasks = computed(() => {
|
|
6443
|
+
const query = this.taskQuery().toLowerCase();
|
|
6444
|
+
return this.linkableTasks()
|
|
6445
|
+
.filter((task) => !query ||
|
|
6446
|
+
task.key.toLowerCase().includes(query) ||
|
|
6447
|
+
task.title.toLowerCase().includes(query))
|
|
6448
|
+
.slice(0, MENTION_MAX_RESULTS);
|
|
6449
|
+
}, /* @ts-ignore */
|
|
6450
|
+
...(ngDevMode ? [{ debugName: "filteredTasks" }] : /* istanbul ignore next */ []));
|
|
6349
6451
|
isDisabled = computed(() => this.disabled() || this._disabledByForm(), /* @ts-ignore */
|
|
6350
6452
|
...(ngDevMode ? [{ debugName: "isDisabled" }] : /* istanbul ignore next */ []));
|
|
6351
6453
|
isEmpty = computed(() => this._value().trim().length === 0, /* @ts-ignore */
|
|
@@ -6371,6 +6473,7 @@ class SolRichEditorComponent {
|
|
|
6371
6473
|
tablePicker: t('tablePicker'),
|
|
6372
6474
|
linkPlaceholder: t('linkPlaceholder'), linkConfirm: t('linkConfirm'),
|
|
6373
6475
|
editorAria: t('editorAria'), imageTooLarge: t('imageTooLarge'),
|
|
6476
|
+
mentionList: t('mentionList'), taskList: t('taskList'),
|
|
6374
6477
|
};
|
|
6375
6478
|
}, /* @ts-ignore */
|
|
6376
6479
|
...(ngDevMode ? [{ debugName: "labels" }] : /* istanbul ignore next */ []));
|
|
@@ -6394,11 +6497,13 @@ class SolRichEditorComponent {
|
|
|
6394
6497
|
this.updateActiveFormats();
|
|
6395
6498
|
};
|
|
6396
6499
|
document.addEventListener('selectionchange', onSelectionChange);
|
|
6397
|
-
// Cierra los menús al hacer clic fuera del componente.
|
|
6500
|
+
// Cierra los menús y popovers al hacer clic fuera del componente.
|
|
6398
6501
|
const onDocClick = (event) => {
|
|
6399
6502
|
const host = this.editable().nativeElement.closest('.sol-rich-editor');
|
|
6400
|
-
if (host && !host.contains(event.target))
|
|
6503
|
+
if (host && !host.contains(event.target)) {
|
|
6401
6504
|
this.closeMenus();
|
|
6505
|
+
this.closePopovers();
|
|
6506
|
+
}
|
|
6402
6507
|
};
|
|
6403
6508
|
document.addEventListener('click', onDocClick);
|
|
6404
6509
|
this.destroyRef.onDestroy(() => {
|
|
@@ -6422,10 +6527,45 @@ class SolRichEditorComponent {
|
|
|
6422
6527
|
getHtml() { return this._value(); }
|
|
6423
6528
|
// ── Manejo de eventos del área editable ─────────────────────────────
|
|
6424
6529
|
onInput() {
|
|
6530
|
+
if (this.mentionsEnabled() || this.tasksEnabled())
|
|
6531
|
+
this.detectAutocomplete();
|
|
6425
6532
|
this.emitChange();
|
|
6426
6533
|
this.scheduleActiveUpdate();
|
|
6427
6534
|
}
|
|
6428
6535
|
onBlur() { this.onTouched(); }
|
|
6536
|
+
/** Navegación del popover de menciones/tareas (solo cuando está abierto). */
|
|
6537
|
+
onKeyDown(event) {
|
|
6538
|
+
if (!this.showMentionPopover() && !this.showTaskPopover())
|
|
6539
|
+
return;
|
|
6540
|
+
const length = this.showMentionPopover()
|
|
6541
|
+
? this.filteredUsers().length
|
|
6542
|
+
: this.filteredTasks().length;
|
|
6543
|
+
switch (event.key) {
|
|
6544
|
+
case 'ArrowDown':
|
|
6545
|
+
event.preventDefault();
|
|
6546
|
+
this.activeIndex.update((i) => Math.min(i + 1, length - 1));
|
|
6547
|
+
break;
|
|
6548
|
+
case 'ArrowUp':
|
|
6549
|
+
event.preventDefault();
|
|
6550
|
+
this.activeIndex.update((i) => Math.max(i - 1, 0));
|
|
6551
|
+
break;
|
|
6552
|
+
case 'Enter':
|
|
6553
|
+
event.preventDefault();
|
|
6554
|
+
if (this.showMentionPopover())
|
|
6555
|
+
this.selectMention(null, this.activeIndex());
|
|
6556
|
+
else
|
|
6557
|
+
this.selectTask(null, this.activeIndex());
|
|
6558
|
+
break;
|
|
6559
|
+
case 'Escape':
|
|
6560
|
+
event.preventDefault();
|
|
6561
|
+
this.closePopovers();
|
|
6562
|
+
break;
|
|
6563
|
+
}
|
|
6564
|
+
}
|
|
6565
|
+
/** Inicial en mayúscula para el avatar del popover de menciones. */
|
|
6566
|
+
initial(name) {
|
|
6567
|
+
return (name.trim().charAt(0) || '?').toUpperCase();
|
|
6568
|
+
}
|
|
6429
6569
|
/** Recalcula el estado de la toolbar de forma diferida (tras el DOM). */
|
|
6430
6570
|
scheduleActiveUpdate() {
|
|
6431
6571
|
if (this.activeUpdateHandle)
|
|
@@ -6591,6 +6731,177 @@ class SolRichEditorComponent {
|
|
|
6591
6731
|
clearTimeout(this.errorHandle);
|
|
6592
6732
|
this.errorHandle = setTimeout(() => this.imageError.set(''), 4000);
|
|
6593
6733
|
}
|
|
6734
|
+
// ── Menciones (@) / tareas (#) — opt-in ─────────────────────────────
|
|
6735
|
+
/**
|
|
6736
|
+
* Analiza el texto anterior al cursor: si hay un trigger `@`/`#` activo (al
|
|
6737
|
+
* inicio o precedido por espacio) y su lista está habilitada, abre el popover
|
|
6738
|
+
* respectivo; si no, lo cierra.
|
|
6739
|
+
*/
|
|
6740
|
+
detectAutocomplete() {
|
|
6741
|
+
const found = this.getQueryBeforeCursor();
|
|
6742
|
+
if (!found) {
|
|
6743
|
+
this.closePopovers();
|
|
6744
|
+
return;
|
|
6745
|
+
}
|
|
6746
|
+
const { trigger, query, range } = found;
|
|
6747
|
+
if (trigger === '@' && !this.mentionsEnabled()) {
|
|
6748
|
+
this.closePopovers();
|
|
6749
|
+
return;
|
|
6750
|
+
}
|
|
6751
|
+
if (trigger === '#' && !this.tasksEnabled()) {
|
|
6752
|
+
this.closePopovers();
|
|
6753
|
+
return;
|
|
6754
|
+
}
|
|
6755
|
+
this.triggerRange = range;
|
|
6756
|
+
this.activeIndex.set(0);
|
|
6757
|
+
if (trigger === '@') {
|
|
6758
|
+
this.mentionQuery.set(query);
|
|
6759
|
+
this.showMentionPopover.set(true);
|
|
6760
|
+
this.showTaskPopover.set(false);
|
|
6761
|
+
}
|
|
6762
|
+
else {
|
|
6763
|
+
this.taskQuery.set(query);
|
|
6764
|
+
this.showTaskPopover.set(true);
|
|
6765
|
+
this.showMentionPopover.set(false);
|
|
6766
|
+
}
|
|
6767
|
+
this.positionPopover();
|
|
6768
|
+
}
|
|
6769
|
+
/** Trigger + consulta inmediatamente antes del cursor colapsado (o null). */
|
|
6770
|
+
getQueryBeforeCursor() {
|
|
6771
|
+
const selection = document.getSelection();
|
|
6772
|
+
if (!selection || selection.rangeCount === 0)
|
|
6773
|
+
return null;
|
|
6774
|
+
const range = selection.getRangeAt(0);
|
|
6775
|
+
if (!range.collapsed)
|
|
6776
|
+
return null;
|
|
6777
|
+
const container = range.startContainer;
|
|
6778
|
+
if (container.nodeType !== Node.TEXT_NODE)
|
|
6779
|
+
return null;
|
|
6780
|
+
if (!this.editable().nativeElement.contains(container))
|
|
6781
|
+
return null;
|
|
6782
|
+
const text = container.textContent ?? '';
|
|
6783
|
+
const offset = range.startOffset;
|
|
6784
|
+
const before = text.slice(0, offset);
|
|
6785
|
+
let triggerIdx = -1;
|
|
6786
|
+
let trigger = null;
|
|
6787
|
+
for (let i = before.length - 1; i >= 0; i--) {
|
|
6788
|
+
const ch = before[i];
|
|
6789
|
+
if (ch === '@' || ch === '#') {
|
|
6790
|
+
if (i === 0 || /\s/.test(before[i - 1])) {
|
|
6791
|
+
triggerIdx = i;
|
|
6792
|
+
trigger = ch;
|
|
6793
|
+
}
|
|
6794
|
+
break;
|
|
6795
|
+
}
|
|
6796
|
+
if (/\s/.test(ch))
|
|
6797
|
+
break; // espacio antes del trigger ⇒ no hay match
|
|
6798
|
+
}
|
|
6799
|
+
if (triggerIdx === -1 || !trigger)
|
|
6800
|
+
return null;
|
|
6801
|
+
const query = before.slice(triggerIdx + 1);
|
|
6802
|
+
if (query.length > MENTION_QUERY_MAX)
|
|
6803
|
+
return null;
|
|
6804
|
+
const triggerRange = document.createRange();
|
|
6805
|
+
triggerRange.setStart(container, triggerIdx);
|
|
6806
|
+
triggerRange.setEnd(container, offset);
|
|
6807
|
+
return { trigger, query, range: triggerRange };
|
|
6808
|
+
}
|
|
6809
|
+
/** Ubica el popover bajo el caret (cálculo manual; sin librerías de posición). */
|
|
6810
|
+
positionPopover() {
|
|
6811
|
+
const selection = document.getSelection();
|
|
6812
|
+
if (!selection || selection.rangeCount === 0)
|
|
6813
|
+
return;
|
|
6814
|
+
const host = this.editable().nativeElement.closest('.sol-rich-editor');
|
|
6815
|
+
if (!host || typeof host.getBoundingClientRect !== 'function')
|
|
6816
|
+
return;
|
|
6817
|
+
const caret = selection.getRangeAt(0).cloneRange();
|
|
6818
|
+
caret.collapse(true);
|
|
6819
|
+
// `Range.getBoundingClientRect` no existe en jsdom (tests): sin medidas de
|
|
6820
|
+
// viewport se conserva la posición por defecto (0,0) sin romper el flujo.
|
|
6821
|
+
if (typeof caret.getBoundingClientRect !== 'function')
|
|
6822
|
+
return;
|
|
6823
|
+
const caretRect = caret.getBoundingClientRect();
|
|
6824
|
+
const hostRect = host.getBoundingClientRect();
|
|
6825
|
+
const count = this.showMentionPopover()
|
|
6826
|
+
? this.filteredUsers().length
|
|
6827
|
+
: this.filteredTasks().length;
|
|
6828
|
+
const estHeight = Math.min(count, 6) * 36 + 8;
|
|
6829
|
+
const below = caretRect.bottom - hostRect.top + 4;
|
|
6830
|
+
const roomBelow = hostRect.bottom - caretRect.bottom;
|
|
6831
|
+
// Si no cabe abajo pero sí arriba, se abre hacia arriba (flip).
|
|
6832
|
+
const top = roomBelow < estHeight && caretRect.top - hostRect.top > estHeight
|
|
6833
|
+
? caretRect.top - hostRect.top - estHeight - 4
|
|
6834
|
+
: below;
|
|
6835
|
+
const left = Math.max(0, Math.min(caretRect.left - hostRect.left, hostRect.width - POPOVER_WIDTH));
|
|
6836
|
+
this.popoverTop.set(Math.max(0, top));
|
|
6837
|
+
this.popoverLeft.set(left);
|
|
6838
|
+
}
|
|
6839
|
+
closePopovers() {
|
|
6840
|
+
this.showMentionPopover.set(false);
|
|
6841
|
+
this.showTaskPopover.set(false);
|
|
6842
|
+
this.triggerRange = null;
|
|
6843
|
+
}
|
|
6844
|
+
selectMention(event, index) {
|
|
6845
|
+
event?.preventDefault();
|
|
6846
|
+
const user = this.filteredUsers()[index];
|
|
6847
|
+
if (!user)
|
|
6848
|
+
return;
|
|
6849
|
+
this.insertChip(`@${user.name}`, 'data-mention-id', user.id);
|
|
6850
|
+
this.closePopovers();
|
|
6851
|
+
this.emitChange();
|
|
6852
|
+
}
|
|
6853
|
+
selectTask(event, index) {
|
|
6854
|
+
event?.preventDefault();
|
|
6855
|
+
const task = this.filteredTasks()[index];
|
|
6856
|
+
if (!task)
|
|
6857
|
+
return;
|
|
6858
|
+
this.insertChip(task.key, 'data-task-key', task.key);
|
|
6859
|
+
this.closePopovers();
|
|
6860
|
+
this.emitChange();
|
|
6861
|
+
}
|
|
6862
|
+
/**
|
|
6863
|
+
* Reemplaza el rango `@query`/`#query` por un chip `<span>` no editable con
|
|
6864
|
+
* el atributo data-* dado, y deja el cursor tras él con un espacio.
|
|
6865
|
+
*/
|
|
6866
|
+
insertChip(label, attr, value) {
|
|
6867
|
+
if (!this.triggerRange)
|
|
6868
|
+
return;
|
|
6869
|
+
const selection = document.getSelection();
|
|
6870
|
+
if (!selection)
|
|
6871
|
+
return;
|
|
6872
|
+
const chip = document.createElement('span');
|
|
6873
|
+
chip.setAttribute('contenteditable', 'false');
|
|
6874
|
+
chip.textContent = label;
|
|
6875
|
+
chip.setAttribute(attr, value);
|
|
6876
|
+
this.triggerRange.deleteContents();
|
|
6877
|
+
this.triggerRange.insertNode(chip);
|
|
6878
|
+
const after = document.createRange();
|
|
6879
|
+
after.setStartAfter(chip);
|
|
6880
|
+
after.collapse(true);
|
|
6881
|
+
selection.removeAllRanges();
|
|
6882
|
+
selection.addRange(after);
|
|
6883
|
+
// Espacio para poder seguir escribiendo fuera del chip.
|
|
6884
|
+
this.safeExec('insertText', ' ');
|
|
6885
|
+
this.triggerRange = null;
|
|
6886
|
+
}
|
|
6887
|
+
/** Marca los chips como no editables tras (re)pintar el contenido. */
|
|
6888
|
+
hardenChips() {
|
|
6889
|
+
this.editable()
|
|
6890
|
+
.nativeElement.querySelectorAll('[data-mention-id],[data-task-key]')
|
|
6891
|
+
.forEach((el) => { el.setAttribute('contenteditable', 'false'); });
|
|
6892
|
+
}
|
|
6893
|
+
/** IDs/keys únicos (orden de documento) de los chips presentes en el DOM. */
|
|
6894
|
+
collectChipValues(attr) {
|
|
6895
|
+
const seen = new Set();
|
|
6896
|
+
this.editable()
|
|
6897
|
+
.nativeElement.querySelectorAll(`[${attr}]`)
|
|
6898
|
+
.forEach((el) => {
|
|
6899
|
+
const value = el.getAttribute(attr)?.trim();
|
|
6900
|
+
if (value)
|
|
6901
|
+
seen.add(value);
|
|
6902
|
+
});
|
|
6903
|
+
return [...seen];
|
|
6904
|
+
}
|
|
6594
6905
|
// ── Pegado (saneado SIEMPRE por el serializador) ────────────────────
|
|
6595
6906
|
onPaste(event) {
|
|
6596
6907
|
const data = event.clipboardData;
|
|
@@ -6712,6 +7023,8 @@ class SolRichEditorComponent {
|
|
|
6712
7023
|
this._value.set(clean);
|
|
6713
7024
|
this.onChange(clean);
|
|
6714
7025
|
this.valueChange.emit(clean);
|
|
7026
|
+
this.mentionsChange.emit(this.collectChipValues('data-mention-id'));
|
|
7027
|
+
this.taskLinksChange.emit(this.collectChipValues('data-task-key'));
|
|
6715
7028
|
}
|
|
6716
7029
|
applyPending() {
|
|
6717
7030
|
if (!this.viewReady)
|
|
@@ -6720,6 +7033,7 @@ class SolRichEditorComponent {
|
|
|
6720
7033
|
const editable = this.editable().nativeElement;
|
|
6721
7034
|
if (editable.innerHTML !== clean)
|
|
6722
7035
|
editable.innerHTML = clean;
|
|
7036
|
+
this.hardenChips();
|
|
6723
7037
|
this._value.set(clean);
|
|
6724
7038
|
}
|
|
6725
7039
|
updateActiveFormats() {
|
|
@@ -6764,7 +7078,7 @@ class SolRichEditorComponent {
|
|
|
6764
7078
|
return null;
|
|
6765
7079
|
}
|
|
6766
7080
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: SolRichEditorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
6767
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: SolRichEditorComponent, isStandalone: true, selector: "sol-rich-editor", inputs: { placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, minHeight: { classPropertyName: "minHeight", publicName: "minHeight", isSignal: true, isRequired: false, transformFunction: null }, maxHeight: { classPropertyName: "maxHeight", publicName: "maxHeight", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, imageMaxBytes: { classPropertyName: "imageMaxBytes", publicName: "imageMaxBytes", isSignal: true, isRequired: false, transformFunction: null }, imageUpload: { classPropertyName: "imageUpload", publicName: "imageUpload", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { valueChange: "valueChange" }, providers: [
|
|
7081
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: SolRichEditorComponent, isStandalone: true, selector: "sol-rich-editor", inputs: { placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, minHeight: { classPropertyName: "minHeight", publicName: "minHeight", isSignal: true, isRequired: false, transformFunction: null }, maxHeight: { classPropertyName: "maxHeight", publicName: "maxHeight", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, imageMaxBytes: { classPropertyName: "imageMaxBytes", publicName: "imageMaxBytes", isSignal: true, isRequired: false, transformFunction: null }, imageUpload: { classPropertyName: "imageUpload", publicName: "imageUpload", isSignal: true, isRequired: false, transformFunction: null }, mentionableUsers: { classPropertyName: "mentionableUsers", publicName: "mentionableUsers", isSignal: true, isRequired: false, transformFunction: null }, linkableTasks: { classPropertyName: "linkableTasks", publicName: "linkableTasks", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { valueChange: "valueChange", mentionsChange: "mentionsChange", taskLinksChange: "taskLinksChange" }, providers: [
|
|
6768
7082
|
{
|
|
6769
7083
|
provide: NG_VALUE_ACCESSOR,
|
|
6770
7084
|
useExisting: forwardRef(() => SolRichEditorComponent),
|
|
@@ -6963,11 +7277,52 @@ class SolRichEditorComponent {
|
|
|
6963
7277
|
[style.max-height]="maxHeight() || null"
|
|
6964
7278
|
(input)="onInput()"
|
|
6965
7279
|
(blur)="onBlur()"
|
|
7280
|
+
(keydown)="onKeyDown($event)"
|
|
6966
7281
|
(keyup)="scheduleActiveUpdate()"
|
|
6967
7282
|
(mouseup)="scheduleActiveUpdate()"
|
|
6968
7283
|
(paste)="onPaste($event)"
|
|
6969
7284
|
></div>
|
|
6970
7285
|
|
|
7286
|
+
<!-- ── Popover de menciones (@) — opt-in ──────────────────────────── -->
|
|
7287
|
+
@if (showMentionPopover() && filteredUsers().length > 0) {
|
|
7288
|
+
<div
|
|
7289
|
+
class="sol-rich-editor__popover" role="listbox"
|
|
7290
|
+
[attr.aria-label]="labels().mentionList"
|
|
7291
|
+
[style.top.px]="popoverTop()" [style.left.px]="popoverLeft()"
|
|
7292
|
+
>
|
|
7293
|
+
@for (user of filteredUsers(); track user.id; let i = $index) {
|
|
7294
|
+
<button
|
|
7295
|
+
type="button" role="option" class="sol-rich-editor__popover-item"
|
|
7296
|
+
[class.is-active]="i === activeIndex()" [attr.aria-selected]="i === activeIndex()"
|
|
7297
|
+
(mousedown)="selectMention($event, i)" (mouseenter)="activeIndex.set(i)"
|
|
7298
|
+
>
|
|
7299
|
+
<span class="sol-rich-editor__avatar" aria-hidden="true">{{ initial(user.name) }}</span>
|
|
7300
|
+
<span class="sol-rich-editor__popover-label">{{ user.name }}</span>
|
|
7301
|
+
</button>
|
|
7302
|
+
}
|
|
7303
|
+
</div>
|
|
7304
|
+
}
|
|
7305
|
+
|
|
7306
|
+
<!-- ── Popover de tareas (#) — opt-in ─────────────────────────────── -->
|
|
7307
|
+
@if (showTaskPopover() && filteredTasks().length > 0) {
|
|
7308
|
+
<div
|
|
7309
|
+
class="sol-rich-editor__popover sol-rich-editor__popover--task" role="listbox"
|
|
7310
|
+
[attr.aria-label]="labels().taskList"
|
|
7311
|
+
[style.top.px]="popoverTop()" [style.left.px]="popoverLeft()"
|
|
7312
|
+
>
|
|
7313
|
+
@for (task of filteredTasks(); track task.key; let i = $index) {
|
|
7314
|
+
<button
|
|
7315
|
+
type="button" role="option" class="sol-rich-editor__popover-item"
|
|
7316
|
+
[class.is-active]="i === activeIndex()" [attr.aria-selected]="i === activeIndex()"
|
|
7317
|
+
(mousedown)="selectTask($event, i)" (mouseenter)="activeIndex.set(i)"
|
|
7318
|
+
>
|
|
7319
|
+
<span class="sol-rich-editor__task-key" aria-hidden="true">{{ task.key }}</span>
|
|
7320
|
+
<span class="sol-rich-editor__popover-label sol-rich-editor__popover-label--truncate">{{ task.title }}</span>
|
|
7321
|
+
</button>
|
|
7322
|
+
}
|
|
7323
|
+
</div>
|
|
7324
|
+
}
|
|
7325
|
+
|
|
6971
7326
|
@if (imageError()) {
|
|
6972
7327
|
<p class="sol-rich-editor__error" role="alert">{{ imageError() }}</p>
|
|
6973
7328
|
}
|
|
@@ -6978,7 +7333,7 @@ class SolRichEditorComponent {
|
|
|
6978
7333
|
(change)="onFileSelected($event)" tabindex="-1" aria-hidden="true"
|
|
6979
7334
|
/>
|
|
6980
7335
|
</div>
|
|
6981
|
-
`, isInline: true, styles: [":host{display:block;--sre-bg: var(--sol-input-bg, var(--sol-bg-surface, #ffffff));--sre-text: var(--sol-color-text-primary, #1e293b);--sre-muted: var(--sol-color-text-muted, #94a3b8);--sre-border: var(--sol-border-color-default, #cbd5e1);--sre-border-focus: var(--sol-color-primary, #6366f1);--sre-radius: var(--sol-input-radius, var(--sol-border-radius-md, .5rem));--sre-toolbar-bg: var(--sol-bg-sunken, var(--sol-bg-page, #f8fafc));--sre-btn-hover: color-mix(in srgb, var(--sol-color-primary, #6366f1) 12%, transparent);--sre-btn-active: color-mix(in srgb, var(--sol-color-primary, #6366f1) 18%, transparent);--sre-focus-ring: var(--sol-input-focus-ring, 0 0 0 3px color-mix(in srgb, var(--sol-color-primary, #6366f1) 30%, transparent));--sre-font: var(--sol-font-family, system-ui, sans-serif);--sre-font-size: var(--sol-font-size-base, .9375rem);--sre-transition: var(--sol-dur-fast, .15s) var(--sol-ease, ease)}.sol-rich-editor{display:flex;flex-direction:column;border:var(--sol-input-border, var(--sol-border-width-default, 1px) solid var(--sre-border));border-radius:var(--sre-radius);background:var(--sre-bg);box-shadow:var(--sol-input-shadow, none);overflow:hidden;transition:border-color var(--sre-transition),box-shadow var(--sre-transition)}.sol-rich-editor:focus-within{border-color:var(--sre-border-focus);box-shadow:var(--sre-focus-ring)}.sol-rich-editor--disabled{opacity:var(--sol-disabled-opacity, .55)}.sol-rich-editor__toolbar{display:flex;flex-wrap:wrap;align-items:center;gap:.125rem;padding:.375rem .5rem;background:var(--sre-toolbar-bg);border-bottom:1px solid var(--sre-border)}.sol-rich-editor__group{display:flex;align-items:center;gap:.125rem}.sol-rich-editor__group--menu{position:relative;display:inline-flex}.sol-rich-editor__sep{width:1px;align-self:stretch;margin:.125rem .25rem;background:var(--sre-border)}.sol-rich-editor__btn{display:inline-flex;align-items:center;justify-content:center;width:1.875rem;height:1.875rem;padding:0;border:none;border-radius:var(--sol-border-radius-sm, .375rem);background:transparent;color:var(--sre-text);cursor:pointer;transition:background-color var(--sre-transition),color var(--sre-transition)}.sol-rich-editor__btn:hover:not(:disabled){background:var(--sre-btn-hover)}.sol-rich-editor__btn:focus-visible{outline:2px solid var(--sre-border-focus);outline-offset:1px}.sol-rich-editor__btn.is-active{background:var(--sre-btn-active);color:var(--sol-color-primary, #6366f1)}.sol-rich-editor__btn:disabled{cursor:not-allowed;opacity:.5}.sol-rich-editor__menu{position:absolute;top:calc(100% + .25rem);left:0;z-index:var(--sol-z-dropdown, 1000);min-width:9rem;padding:.25rem;background:var(--sol-bg-surface, #ffffff);border:1px solid var(--sre-border);border-radius:var(--sol-border-radius-md, .5rem);box-shadow:var(--sol-shadow-lg, 0 10px 25px rgba(0, 0, 0, .12))}.sol-rich-editor__menu-item{display:block;width:100%;padding:.375rem .625rem;border:none;border-radius:var(--sol-border-radius-sm, .375rem);background:transparent;color:var(--sre-text);font-family:var(--sre-font);font-size:var(--sol-font-size-base, .9375rem);text-align:left;cursor:pointer}.sol-rich-editor__menu-item:hover{background:var(--sre-btn-hover)}.sol-rich-editor__menu-item--h1{font-size:1.375rem;font-weight:700}.sol-rich-editor__menu-item--h2{font-size:1.125rem;font-weight:700}.sol-rich-editor__menu-item--h3{font-size:1rem;font-weight:600}.sol-rich-editor__menu--table{min-width:auto}.sol-rich-editor__grid{display:flex;flex-direction:column;gap:2px}.sol-rich-editor__grid-row{display:flex;gap:2px}.sol-rich-editor__grid-cell{width:1rem;height:1rem;padding:0;border:1px solid var(--sre-border);border-radius:2px;background:var(--sol-bg-surface, #ffffff);cursor:pointer}.sol-rich-editor__grid-cell.is-on{background:color-mix(in srgb,var(--sol-color-primary, #6366f1) 45%,transparent);border-color:var(--sol-color-primary, #6366f1)}.sol-rich-editor__grid-label{margin-top:.375rem;text-align:center;font-family:var(--sre-font);font-size:var(--sol-font-size-sm, .75rem);color:var(--sre-muted)}.sol-rich-editor__menu--link{min-width:15rem}.sol-rich-editor__link-input{width:100%;height:var(--sol-size-input-height, 2.25rem);padding:0 .5rem;font-family:var(--sre-font);font-size:var(--sol-font-size-base, .9375rem);color:var(--sre-text);background:var(--sre-bg);border:1px solid var(--sre-border);border-radius:var(--sol-border-radius-sm, .375rem);outline:none;box-sizing:border-box}.sol-rich-editor__link-input:focus{border-color:var(--sre-border-focus)}.sol-rich-editor__link-actions{display:flex;gap:.375rem;margin-top:.375rem}.sol-rich-editor__link-btn{flex:1;padding:.375rem .5rem;border:1px solid var(--sre-border);border-radius:var(--sol-border-radius-sm, .375rem);background:transparent;color:var(--sre-text);font-family:var(--sre-font);font-size:var(--sol-font-size-sm, .75rem);cursor:pointer}.sol-rich-editor__link-btn:hover{background:var(--sre-btn-hover)}.sol-rich-editor__link-btn--primary{background:var(--sol-color-primary, #6366f1);border-color:var(--sol-color-primary, #6366f1);color:var(--sol-color-primary-contrast, #ffffff)}.sol-rich-editor__content{flex:1;padding:.75rem .875rem;overflow-y:auto;font-family:var(--sre-font);font-size:var(--sre-font-size);line-height:var(--sol-line-height, 1.6);color:var(--sre-text);outline:none;word-break:break-word}.sol-rich-editor__content.is-empty:before{content:attr(data-placeholder);color:var(--sre-muted);pointer-events:none}.sol-rich-editor__error{margin:0;padding:.375rem .875rem;font-family:var(--sre-font);font-size:var(--sol-font-size-sm, .75rem);color:var(--sol-color-danger, #ef4444)}.sol-rich-editor__file{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}.sol-rich-editor__content ::ng-deep h1{font-size:1.5rem;font-weight:700;margin:.5rem 0;line-height:1.25}.sol-rich-editor__content ::ng-deep h2{font-size:1.25rem;font-weight:700;margin:.5rem 0;line-height:1.3}.sol-rich-editor__content ::ng-deep h3{font-size:1.0625rem;font-weight:600;margin:.5rem 0;line-height:1.35}.sol-rich-editor__content ::ng-deep p{margin:0 0 .5rem}.sol-rich-editor__content ::ng-deep ul,.sol-rich-editor__content ::ng-deep ol{margin:0 0 .5rem;padding-left:1.5rem}.sol-rich-editor__content ::ng-deep li{margin:.125rem 0}.sol-rich-editor__content ::ng-deep a{color:var(--sol-color-primary, #6366f1);text-decoration:underline}.sol-rich-editor__content ::ng-deep img{max-width:100%;height:auto;border-radius:var(--sol-border-radius-sm, .375rem)}.sol-rich-editor__content ::ng-deep table{border-collapse:collapse;margin:.5rem 0;width:auto}.sol-rich-editor__content ::ng-deep td,.sol-rich-editor__content ::ng-deep th{border:1px solid var(--sre-border);padding:.375rem .5rem;min-width:3rem}\n"], dependencies: [{ kind: "component", type: SolIconComponent, selector: "sol-icon", inputs: ["name", "size", "variant"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
7336
|
+
`, isInline: true, styles: [":host{display:block;--sre-bg: var(--sol-input-bg, var(--sol-bg-surface, #ffffff));--sre-text: var(--sol-color-text-primary, #1e293b);--sre-muted: var(--sol-color-text-muted, #94a3b8);--sre-border: var(--sol-border-color-default, #cbd5e1);--sre-border-focus: var(--sol-color-primary, #6366f1);--sre-radius: var(--sol-input-radius, var(--sol-border-radius-md, .5rem));--sre-toolbar-bg: var(--sol-bg-sunken, var(--sol-bg-page, #f8fafc));--sre-btn-hover: color-mix(in srgb, var(--sol-color-primary, #6366f1) 12%, transparent);--sre-btn-active: color-mix(in srgb, var(--sol-color-primary, #6366f1) 18%, transparent);--sre-focus-ring: var(--sol-input-focus-ring, 0 0 0 3px color-mix(in srgb, var(--sol-color-primary, #6366f1) 30%, transparent));--sre-font: var(--sol-font-family, system-ui, sans-serif);--sre-font-size: var(--sol-font-size-base, .9375rem);--sre-transition: var(--sol-dur-fast, .15s) var(--sol-ease, ease)}.sol-rich-editor{position:relative;display:flex;flex-direction:column;border:var(--sol-input-border, var(--sol-border-width-default, 1px) solid var(--sre-border));border-radius:var(--sre-radius);background:var(--sre-bg);box-shadow:var(--sol-input-shadow, none);overflow:hidden;transition:border-color var(--sre-transition),box-shadow var(--sre-transition)}.sol-rich-editor:focus-within{border-color:var(--sre-border-focus);box-shadow:var(--sre-focus-ring)}.sol-rich-editor--disabled{opacity:var(--sol-disabled-opacity, .55)}.sol-rich-editor__toolbar{display:flex;flex-wrap:wrap;align-items:center;gap:.125rem;padding:.375rem .5rem;background:var(--sre-toolbar-bg);border-bottom:1px solid var(--sre-border)}.sol-rich-editor__group{display:flex;align-items:center;gap:.125rem}.sol-rich-editor__group--menu{position:relative;display:inline-flex}.sol-rich-editor__sep{width:1px;align-self:stretch;margin:.125rem .25rem;background:var(--sre-border)}.sol-rich-editor__btn{display:inline-flex;align-items:center;justify-content:center;width:1.875rem;height:1.875rem;padding:0;border:none;border-radius:var(--sol-border-radius-sm, .375rem);background:transparent;color:var(--sre-text);cursor:pointer;transition:background-color var(--sre-transition),color var(--sre-transition)}.sol-rich-editor__btn:hover:not(:disabled){background:var(--sre-btn-hover)}.sol-rich-editor__btn:focus-visible{outline:2px solid var(--sre-border-focus);outline-offset:1px}.sol-rich-editor__btn.is-active{background:var(--sre-btn-active);color:var(--sol-color-primary, #6366f1)}.sol-rich-editor__btn:disabled{cursor:not-allowed;opacity:.5}.sol-rich-editor__menu{position:absolute;top:calc(100% + .25rem);left:0;z-index:var(--sol-z-dropdown, 1000);min-width:9rem;padding:.25rem;background:var(--sol-bg-surface, #ffffff);border:1px solid var(--sre-border);border-radius:var(--sol-border-radius-md, .5rem);box-shadow:var(--sol-shadow-lg, 0 10px 25px rgba(0, 0, 0, .12))}.sol-rich-editor__menu-item{display:block;width:100%;padding:.375rem .625rem;border:none;border-radius:var(--sol-border-radius-sm, .375rem);background:transparent;color:var(--sre-text);font-family:var(--sre-font);font-size:var(--sol-font-size-base, .9375rem);text-align:left;cursor:pointer}.sol-rich-editor__menu-item:hover{background:var(--sre-btn-hover)}.sol-rich-editor__menu-item--h1{font-size:1.375rem;font-weight:700}.sol-rich-editor__menu-item--h2{font-size:1.125rem;font-weight:700}.sol-rich-editor__menu-item--h3{font-size:1rem;font-weight:600}.sol-rich-editor__menu--table{min-width:auto}.sol-rich-editor__grid{display:flex;flex-direction:column;gap:2px}.sol-rich-editor__grid-row{display:flex;gap:2px}.sol-rich-editor__grid-cell{width:1rem;height:1rem;padding:0;border:1px solid var(--sre-border);border-radius:2px;background:var(--sol-bg-surface, #ffffff);cursor:pointer}.sol-rich-editor__grid-cell.is-on{background:color-mix(in srgb,var(--sol-color-primary, #6366f1) 45%,transparent);border-color:var(--sol-color-primary, #6366f1)}.sol-rich-editor__grid-label{margin-top:.375rem;text-align:center;font-family:var(--sre-font);font-size:var(--sol-font-size-sm, .75rem);color:var(--sre-muted)}.sol-rich-editor__menu--link{min-width:15rem}.sol-rich-editor__link-input{width:100%;height:var(--sol-size-input-height, 2.25rem);padding:0 .5rem;font-family:var(--sre-font);font-size:var(--sol-font-size-base, .9375rem);color:var(--sre-text);background:var(--sre-bg);border:1px solid var(--sre-border);border-radius:var(--sol-border-radius-sm, .375rem);outline:none;box-sizing:border-box}.sol-rich-editor__link-input:focus{border-color:var(--sre-border-focus)}.sol-rich-editor__link-actions{display:flex;gap:.375rem;margin-top:.375rem}.sol-rich-editor__link-btn{flex:1;padding:.375rem .5rem;border:1px solid var(--sre-border);border-radius:var(--sol-border-radius-sm, .375rem);background:transparent;color:var(--sre-text);font-family:var(--sre-font);font-size:var(--sol-font-size-sm, .75rem);cursor:pointer}.sol-rich-editor__link-btn:hover{background:var(--sre-btn-hover)}.sol-rich-editor__link-btn--primary{background:var(--sol-color-primary, #6366f1);border-color:var(--sol-color-primary, #6366f1);color:var(--sol-color-primary-contrast, #ffffff)}.sol-rich-editor__content{flex:1;padding:.75rem .875rem;overflow-y:auto;font-family:var(--sre-font);font-size:var(--sre-font-size);line-height:var(--sol-line-height, 1.6);color:var(--sre-text);outline:none;word-break:break-word}.sol-rich-editor__content.is-empty:before{content:attr(data-placeholder);color:var(--sre-muted);pointer-events:none}.sol-rich-editor__error{margin:0;padding:.375rem .875rem;font-family:var(--sre-font);font-size:var(--sol-font-size-sm, .75rem);color:var(--sol-color-danger, #ef4444)}.sol-rich-editor__file{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}.sol-rich-editor__popover{position:absolute;z-index:var(--sol-z-dropdown, 1000);min-width:12rem;max-width:18rem;max-height:14rem;overflow-y:auto;padding:.25rem;background:var(--sol-bg-surface, #ffffff);border:1px solid var(--sre-border);border-radius:var(--sol-border-radius-md, .5rem);box-shadow:var(--sol-shadow-lg, 0 10px 25px rgba(0, 0, 0, .12))}.sol-rich-editor__popover--task{min-width:16rem}.sol-rich-editor__popover-item{display:flex;align-items:center;gap:.5rem;width:100%;padding:.375rem .5rem;border:none;border-radius:var(--sol-border-radius-sm, .375rem);background:transparent;color:var(--sre-text);font-family:var(--sre-font);font-size:var(--sol-font-size-base, .9375rem);text-align:left;cursor:pointer}.sol-rich-editor__popover-item:hover,.sol-rich-editor__popover-item.is-active{background:var(--sre-btn-hover)}.sol-rich-editor__popover-label{flex:1;min-width:0}.sol-rich-editor__popover-label--truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.sol-rich-editor__avatar{display:inline-flex;align-items:center;justify-content:center;width:1.5rem;height:1.5rem;flex-shrink:0;border-radius:9999px;background:color-mix(in srgb,var(--sol-color-primary, #6366f1) 20%,transparent);color:var(--sol-color-primary, #6366f1);font-size:var(--sol-font-size-sm, .75rem);font-weight:600}.sol-rich-editor__task-key{flex-shrink:0;padding:.0625rem .375rem;border-radius:var(--sol-border-radius-sm, .375rem);background:color-mix(in srgb,var(--sol-color-success, #10b981) 14%,transparent);color:var(--sol-color-success, #10b981);font-family:var(--sol-font-family-mono, ui-monospace, monospace);font-size:var(--sol-font-size-sm, .75rem);font-weight:600}.sol-rich-editor__content ::ng-deep span[data-mention-id]{display:inline-block;padding:0 .375rem;border-radius:var(--sol-border-radius-sm, .375rem);background:color-mix(in srgb,var(--sol-color-primary, #6366f1) 12%,transparent);color:var(--sol-color-primary, #6366f1);font-weight:500;white-space:nowrap}.sol-rich-editor__content ::ng-deep span[data-task-key]{display:inline-block;padding:0 .375rem;border-radius:var(--sol-border-radius-sm, .375rem);background:color-mix(in srgb,var(--sol-color-success, #10b981) 14%,transparent);color:var(--sol-color-success, #10b981);font-family:var(--sol-font-family-mono, ui-monospace, monospace);font-weight:600;white-space:nowrap}.sol-rich-editor__content ::ng-deep h1{font-size:1.5rem;font-weight:700;margin:.5rem 0;line-height:1.25}.sol-rich-editor__content ::ng-deep h2{font-size:1.25rem;font-weight:700;margin:.5rem 0;line-height:1.3}.sol-rich-editor__content ::ng-deep h3{font-size:1.0625rem;font-weight:600;margin:.5rem 0;line-height:1.35}.sol-rich-editor__content ::ng-deep p{margin:0 0 .5rem}.sol-rich-editor__content ::ng-deep ul,.sol-rich-editor__content ::ng-deep ol{margin:0 0 .5rem;padding-left:1.5rem}.sol-rich-editor__content ::ng-deep li{margin:.125rem 0}.sol-rich-editor__content ::ng-deep a{color:var(--sol-color-primary, #6366f1);text-decoration:underline}.sol-rich-editor__content ::ng-deep img{max-width:100%;height:auto;border-radius:var(--sol-border-radius-sm, .375rem)}.sol-rich-editor__content ::ng-deep table{border-collapse:collapse;margin:.5rem 0;width:auto}.sol-rich-editor__content ::ng-deep td,.sol-rich-editor__content ::ng-deep th{border:1px solid var(--sre-border);padding:.375rem .5rem;min-width:3rem}\n"], dependencies: [{ kind: "component", type: SolIconComponent, selector: "sol-icon", inputs: ["name", "size", "variant"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
6982
7337
|
}
|
|
6983
7338
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: SolRichEditorComponent, decorators: [{
|
|
6984
7339
|
type: Component,
|
|
@@ -7181,11 +7536,52 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
7181
7536
|
[style.max-height]="maxHeight() || null"
|
|
7182
7537
|
(input)="onInput()"
|
|
7183
7538
|
(blur)="onBlur()"
|
|
7539
|
+
(keydown)="onKeyDown($event)"
|
|
7184
7540
|
(keyup)="scheduleActiveUpdate()"
|
|
7185
7541
|
(mouseup)="scheduleActiveUpdate()"
|
|
7186
7542
|
(paste)="onPaste($event)"
|
|
7187
7543
|
></div>
|
|
7188
7544
|
|
|
7545
|
+
<!-- ── Popover de menciones (@) — opt-in ──────────────────────────── -->
|
|
7546
|
+
@if (showMentionPopover() && filteredUsers().length > 0) {
|
|
7547
|
+
<div
|
|
7548
|
+
class="sol-rich-editor__popover" role="listbox"
|
|
7549
|
+
[attr.aria-label]="labels().mentionList"
|
|
7550
|
+
[style.top.px]="popoverTop()" [style.left.px]="popoverLeft()"
|
|
7551
|
+
>
|
|
7552
|
+
@for (user of filteredUsers(); track user.id; let i = $index) {
|
|
7553
|
+
<button
|
|
7554
|
+
type="button" role="option" class="sol-rich-editor__popover-item"
|
|
7555
|
+
[class.is-active]="i === activeIndex()" [attr.aria-selected]="i === activeIndex()"
|
|
7556
|
+
(mousedown)="selectMention($event, i)" (mouseenter)="activeIndex.set(i)"
|
|
7557
|
+
>
|
|
7558
|
+
<span class="sol-rich-editor__avatar" aria-hidden="true">{{ initial(user.name) }}</span>
|
|
7559
|
+
<span class="sol-rich-editor__popover-label">{{ user.name }}</span>
|
|
7560
|
+
</button>
|
|
7561
|
+
}
|
|
7562
|
+
</div>
|
|
7563
|
+
}
|
|
7564
|
+
|
|
7565
|
+
<!-- ── Popover de tareas (#) — opt-in ─────────────────────────────── -->
|
|
7566
|
+
@if (showTaskPopover() && filteredTasks().length > 0) {
|
|
7567
|
+
<div
|
|
7568
|
+
class="sol-rich-editor__popover sol-rich-editor__popover--task" role="listbox"
|
|
7569
|
+
[attr.aria-label]="labels().taskList"
|
|
7570
|
+
[style.top.px]="popoverTop()" [style.left.px]="popoverLeft()"
|
|
7571
|
+
>
|
|
7572
|
+
@for (task of filteredTasks(); track task.key; let i = $index) {
|
|
7573
|
+
<button
|
|
7574
|
+
type="button" role="option" class="sol-rich-editor__popover-item"
|
|
7575
|
+
[class.is-active]="i === activeIndex()" [attr.aria-selected]="i === activeIndex()"
|
|
7576
|
+
(mousedown)="selectTask($event, i)" (mouseenter)="activeIndex.set(i)"
|
|
7577
|
+
>
|
|
7578
|
+
<span class="sol-rich-editor__task-key" aria-hidden="true">{{ task.key }}</span>
|
|
7579
|
+
<span class="sol-rich-editor__popover-label sol-rich-editor__popover-label--truncate">{{ task.title }}</span>
|
|
7580
|
+
</button>
|
|
7581
|
+
}
|
|
7582
|
+
</div>
|
|
7583
|
+
}
|
|
7584
|
+
|
|
7189
7585
|
@if (imageError()) {
|
|
7190
7586
|
<p class="sol-rich-editor__error" role="alert">{{ imageError() }}</p>
|
|
7191
7587
|
}
|
|
@@ -7196,8 +7592,814 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
7196
7592
|
(change)="onFileSelected($event)" tabindex="-1" aria-hidden="true"
|
|
7197
7593
|
/>
|
|
7198
7594
|
</div>
|
|
7199
|
-
`, styles: [":host{display:block;--sre-bg: var(--sol-input-bg, var(--sol-bg-surface, #ffffff));--sre-text: var(--sol-color-text-primary, #1e293b);--sre-muted: var(--sol-color-text-muted, #94a3b8);--sre-border: var(--sol-border-color-default, #cbd5e1);--sre-border-focus: var(--sol-color-primary, #6366f1);--sre-radius: var(--sol-input-radius, var(--sol-border-radius-md, .5rem));--sre-toolbar-bg: var(--sol-bg-sunken, var(--sol-bg-page, #f8fafc));--sre-btn-hover: color-mix(in srgb, var(--sol-color-primary, #6366f1) 12%, transparent);--sre-btn-active: color-mix(in srgb, var(--sol-color-primary, #6366f1) 18%, transparent);--sre-focus-ring: var(--sol-input-focus-ring, 0 0 0 3px color-mix(in srgb, var(--sol-color-primary, #6366f1) 30%, transparent));--sre-font: var(--sol-font-family, system-ui, sans-serif);--sre-font-size: var(--sol-font-size-base, .9375rem);--sre-transition: var(--sol-dur-fast, .15s) var(--sol-ease, ease)}.sol-rich-editor{display:flex;flex-direction:column;border:var(--sol-input-border, var(--sol-border-width-default, 1px) solid var(--sre-border));border-radius:var(--sre-radius);background:var(--sre-bg);box-shadow:var(--sol-input-shadow, none);overflow:hidden;transition:border-color var(--sre-transition),box-shadow var(--sre-transition)}.sol-rich-editor:focus-within{border-color:var(--sre-border-focus);box-shadow:var(--sre-focus-ring)}.sol-rich-editor--disabled{opacity:var(--sol-disabled-opacity, .55)}.sol-rich-editor__toolbar{display:flex;flex-wrap:wrap;align-items:center;gap:.125rem;padding:.375rem .5rem;background:var(--sre-toolbar-bg);border-bottom:1px solid var(--sre-border)}.sol-rich-editor__group{display:flex;align-items:center;gap:.125rem}.sol-rich-editor__group--menu{position:relative;display:inline-flex}.sol-rich-editor__sep{width:1px;align-self:stretch;margin:.125rem .25rem;background:var(--sre-border)}.sol-rich-editor__btn{display:inline-flex;align-items:center;justify-content:center;width:1.875rem;height:1.875rem;padding:0;border:none;border-radius:var(--sol-border-radius-sm, .375rem);background:transparent;color:var(--sre-text);cursor:pointer;transition:background-color var(--sre-transition),color var(--sre-transition)}.sol-rich-editor__btn:hover:not(:disabled){background:var(--sre-btn-hover)}.sol-rich-editor__btn:focus-visible{outline:2px solid var(--sre-border-focus);outline-offset:1px}.sol-rich-editor__btn.is-active{background:var(--sre-btn-active);color:var(--sol-color-primary, #6366f1)}.sol-rich-editor__btn:disabled{cursor:not-allowed;opacity:.5}.sol-rich-editor__menu{position:absolute;top:calc(100% + .25rem);left:0;z-index:var(--sol-z-dropdown, 1000);min-width:9rem;padding:.25rem;background:var(--sol-bg-surface, #ffffff);border:1px solid var(--sre-border);border-radius:var(--sol-border-radius-md, .5rem);box-shadow:var(--sol-shadow-lg, 0 10px 25px rgba(0, 0, 0, .12))}.sol-rich-editor__menu-item{display:block;width:100%;padding:.375rem .625rem;border:none;border-radius:var(--sol-border-radius-sm, .375rem);background:transparent;color:var(--sre-text);font-family:var(--sre-font);font-size:var(--sol-font-size-base, .9375rem);text-align:left;cursor:pointer}.sol-rich-editor__menu-item:hover{background:var(--sre-btn-hover)}.sol-rich-editor__menu-item--h1{font-size:1.375rem;font-weight:700}.sol-rich-editor__menu-item--h2{font-size:1.125rem;font-weight:700}.sol-rich-editor__menu-item--h3{font-size:1rem;font-weight:600}.sol-rich-editor__menu--table{min-width:auto}.sol-rich-editor__grid{display:flex;flex-direction:column;gap:2px}.sol-rich-editor__grid-row{display:flex;gap:2px}.sol-rich-editor__grid-cell{width:1rem;height:1rem;padding:0;border:1px solid var(--sre-border);border-radius:2px;background:var(--sol-bg-surface, #ffffff);cursor:pointer}.sol-rich-editor__grid-cell.is-on{background:color-mix(in srgb,var(--sol-color-primary, #6366f1) 45%,transparent);border-color:var(--sol-color-primary, #6366f1)}.sol-rich-editor__grid-label{margin-top:.375rem;text-align:center;font-family:var(--sre-font);font-size:var(--sol-font-size-sm, .75rem);color:var(--sre-muted)}.sol-rich-editor__menu--link{min-width:15rem}.sol-rich-editor__link-input{width:100%;height:var(--sol-size-input-height, 2.25rem);padding:0 .5rem;font-family:var(--sre-font);font-size:var(--sol-font-size-base, .9375rem);color:var(--sre-text);background:var(--sre-bg);border:1px solid var(--sre-border);border-radius:var(--sol-border-radius-sm, .375rem);outline:none;box-sizing:border-box}.sol-rich-editor__link-input:focus{border-color:var(--sre-border-focus)}.sol-rich-editor__link-actions{display:flex;gap:.375rem;margin-top:.375rem}.sol-rich-editor__link-btn{flex:1;padding:.375rem .5rem;border:1px solid var(--sre-border);border-radius:var(--sol-border-radius-sm, .375rem);background:transparent;color:var(--sre-text);font-family:var(--sre-font);font-size:var(--sol-font-size-sm, .75rem);cursor:pointer}.sol-rich-editor__link-btn:hover{background:var(--sre-btn-hover)}.sol-rich-editor__link-btn--primary{background:var(--sol-color-primary, #6366f1);border-color:var(--sol-color-primary, #6366f1);color:var(--sol-color-primary-contrast, #ffffff)}.sol-rich-editor__content{flex:1;padding:.75rem .875rem;overflow-y:auto;font-family:var(--sre-font);font-size:var(--sre-font-size);line-height:var(--sol-line-height, 1.6);color:var(--sre-text);outline:none;word-break:break-word}.sol-rich-editor__content.is-empty:before{content:attr(data-placeholder);color:var(--sre-muted);pointer-events:none}.sol-rich-editor__error{margin:0;padding:.375rem .875rem;font-family:var(--sre-font);font-size:var(--sol-font-size-sm, .75rem);color:var(--sol-color-danger, #ef4444)}.sol-rich-editor__file{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}.sol-rich-editor__content ::ng-deep h1{font-size:1.5rem;font-weight:700;margin:.5rem 0;line-height:1.25}.sol-rich-editor__content ::ng-deep h2{font-size:1.25rem;font-weight:700;margin:.5rem 0;line-height:1.3}.sol-rich-editor__content ::ng-deep h3{font-size:1.0625rem;font-weight:600;margin:.5rem 0;line-height:1.35}.sol-rich-editor__content ::ng-deep p{margin:0 0 .5rem}.sol-rich-editor__content ::ng-deep ul,.sol-rich-editor__content ::ng-deep ol{margin:0 0 .5rem;padding-left:1.5rem}.sol-rich-editor__content ::ng-deep li{margin:.125rem 0}.sol-rich-editor__content ::ng-deep a{color:var(--sol-color-primary, #6366f1);text-decoration:underline}.sol-rich-editor__content ::ng-deep img{max-width:100%;height:auto;border-radius:var(--sol-border-radius-sm, .375rem)}.sol-rich-editor__content ::ng-deep table{border-collapse:collapse;margin:.5rem 0;width:auto}.sol-rich-editor__content ::ng-deep td,.sol-rich-editor__content ::ng-deep th{border:1px solid var(--sre-border);padding:.375rem .5rem;min-width:3rem}\n"] }]
|
|
7200
|
-
}], propDecorators: { placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], minHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "minHeight", required: false }] }], maxHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxHeight", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], imageMaxBytes: [{ type: i0.Input, args: [{ isSignal: true, alias: "imageMaxBytes", required: false }] }], imageUpload: [{ type: i0.Input, args: [{ isSignal: true, alias: "imageUpload", required: false }] }], valueChange: [{ type: i0.Output, args: ["valueChange"] }], editable: [{ type: i0.ViewChild, args: ['editable', { isSignal: true }] }], fileInput: [{ type: i0.ViewChild, args: ['fileInput', { isSignal: true }] }], linkInput: [{ type: i0.ViewChild, args: ['linkInput', { isSignal: true }] }] } });
|
|
7595
|
+
`, styles: [":host{display:block;--sre-bg: var(--sol-input-bg, var(--sol-bg-surface, #ffffff));--sre-text: var(--sol-color-text-primary, #1e293b);--sre-muted: var(--sol-color-text-muted, #94a3b8);--sre-border: var(--sol-border-color-default, #cbd5e1);--sre-border-focus: var(--sol-color-primary, #6366f1);--sre-radius: var(--sol-input-radius, var(--sol-border-radius-md, .5rem));--sre-toolbar-bg: var(--sol-bg-sunken, var(--sol-bg-page, #f8fafc));--sre-btn-hover: color-mix(in srgb, var(--sol-color-primary, #6366f1) 12%, transparent);--sre-btn-active: color-mix(in srgb, var(--sol-color-primary, #6366f1) 18%, transparent);--sre-focus-ring: var(--sol-input-focus-ring, 0 0 0 3px color-mix(in srgb, var(--sol-color-primary, #6366f1) 30%, transparent));--sre-font: var(--sol-font-family, system-ui, sans-serif);--sre-font-size: var(--sol-font-size-base, .9375rem);--sre-transition: var(--sol-dur-fast, .15s) var(--sol-ease, ease)}.sol-rich-editor{position:relative;display:flex;flex-direction:column;border:var(--sol-input-border, var(--sol-border-width-default, 1px) solid var(--sre-border));border-radius:var(--sre-radius);background:var(--sre-bg);box-shadow:var(--sol-input-shadow, none);overflow:hidden;transition:border-color var(--sre-transition),box-shadow var(--sre-transition)}.sol-rich-editor:focus-within{border-color:var(--sre-border-focus);box-shadow:var(--sre-focus-ring)}.sol-rich-editor--disabled{opacity:var(--sol-disabled-opacity, .55)}.sol-rich-editor__toolbar{display:flex;flex-wrap:wrap;align-items:center;gap:.125rem;padding:.375rem .5rem;background:var(--sre-toolbar-bg);border-bottom:1px solid var(--sre-border)}.sol-rich-editor__group{display:flex;align-items:center;gap:.125rem}.sol-rich-editor__group--menu{position:relative;display:inline-flex}.sol-rich-editor__sep{width:1px;align-self:stretch;margin:.125rem .25rem;background:var(--sre-border)}.sol-rich-editor__btn{display:inline-flex;align-items:center;justify-content:center;width:1.875rem;height:1.875rem;padding:0;border:none;border-radius:var(--sol-border-radius-sm, .375rem);background:transparent;color:var(--sre-text);cursor:pointer;transition:background-color var(--sre-transition),color var(--sre-transition)}.sol-rich-editor__btn:hover:not(:disabled){background:var(--sre-btn-hover)}.sol-rich-editor__btn:focus-visible{outline:2px solid var(--sre-border-focus);outline-offset:1px}.sol-rich-editor__btn.is-active{background:var(--sre-btn-active);color:var(--sol-color-primary, #6366f1)}.sol-rich-editor__btn:disabled{cursor:not-allowed;opacity:.5}.sol-rich-editor__menu{position:absolute;top:calc(100% + .25rem);left:0;z-index:var(--sol-z-dropdown, 1000);min-width:9rem;padding:.25rem;background:var(--sol-bg-surface, #ffffff);border:1px solid var(--sre-border);border-radius:var(--sol-border-radius-md, .5rem);box-shadow:var(--sol-shadow-lg, 0 10px 25px rgba(0, 0, 0, .12))}.sol-rich-editor__menu-item{display:block;width:100%;padding:.375rem .625rem;border:none;border-radius:var(--sol-border-radius-sm, .375rem);background:transparent;color:var(--sre-text);font-family:var(--sre-font);font-size:var(--sol-font-size-base, .9375rem);text-align:left;cursor:pointer}.sol-rich-editor__menu-item:hover{background:var(--sre-btn-hover)}.sol-rich-editor__menu-item--h1{font-size:1.375rem;font-weight:700}.sol-rich-editor__menu-item--h2{font-size:1.125rem;font-weight:700}.sol-rich-editor__menu-item--h3{font-size:1rem;font-weight:600}.sol-rich-editor__menu--table{min-width:auto}.sol-rich-editor__grid{display:flex;flex-direction:column;gap:2px}.sol-rich-editor__grid-row{display:flex;gap:2px}.sol-rich-editor__grid-cell{width:1rem;height:1rem;padding:0;border:1px solid var(--sre-border);border-radius:2px;background:var(--sol-bg-surface, #ffffff);cursor:pointer}.sol-rich-editor__grid-cell.is-on{background:color-mix(in srgb,var(--sol-color-primary, #6366f1) 45%,transparent);border-color:var(--sol-color-primary, #6366f1)}.sol-rich-editor__grid-label{margin-top:.375rem;text-align:center;font-family:var(--sre-font);font-size:var(--sol-font-size-sm, .75rem);color:var(--sre-muted)}.sol-rich-editor__menu--link{min-width:15rem}.sol-rich-editor__link-input{width:100%;height:var(--sol-size-input-height, 2.25rem);padding:0 .5rem;font-family:var(--sre-font);font-size:var(--sol-font-size-base, .9375rem);color:var(--sre-text);background:var(--sre-bg);border:1px solid var(--sre-border);border-radius:var(--sol-border-radius-sm, .375rem);outline:none;box-sizing:border-box}.sol-rich-editor__link-input:focus{border-color:var(--sre-border-focus)}.sol-rich-editor__link-actions{display:flex;gap:.375rem;margin-top:.375rem}.sol-rich-editor__link-btn{flex:1;padding:.375rem .5rem;border:1px solid var(--sre-border);border-radius:var(--sol-border-radius-sm, .375rem);background:transparent;color:var(--sre-text);font-family:var(--sre-font);font-size:var(--sol-font-size-sm, .75rem);cursor:pointer}.sol-rich-editor__link-btn:hover{background:var(--sre-btn-hover)}.sol-rich-editor__link-btn--primary{background:var(--sol-color-primary, #6366f1);border-color:var(--sol-color-primary, #6366f1);color:var(--sol-color-primary-contrast, #ffffff)}.sol-rich-editor__content{flex:1;padding:.75rem .875rem;overflow-y:auto;font-family:var(--sre-font);font-size:var(--sre-font-size);line-height:var(--sol-line-height, 1.6);color:var(--sre-text);outline:none;word-break:break-word}.sol-rich-editor__content.is-empty:before{content:attr(data-placeholder);color:var(--sre-muted);pointer-events:none}.sol-rich-editor__error{margin:0;padding:.375rem .875rem;font-family:var(--sre-font);font-size:var(--sol-font-size-sm, .75rem);color:var(--sol-color-danger, #ef4444)}.sol-rich-editor__file{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}.sol-rich-editor__popover{position:absolute;z-index:var(--sol-z-dropdown, 1000);min-width:12rem;max-width:18rem;max-height:14rem;overflow-y:auto;padding:.25rem;background:var(--sol-bg-surface, #ffffff);border:1px solid var(--sre-border);border-radius:var(--sol-border-radius-md, .5rem);box-shadow:var(--sol-shadow-lg, 0 10px 25px rgba(0, 0, 0, .12))}.sol-rich-editor__popover--task{min-width:16rem}.sol-rich-editor__popover-item{display:flex;align-items:center;gap:.5rem;width:100%;padding:.375rem .5rem;border:none;border-radius:var(--sol-border-radius-sm, .375rem);background:transparent;color:var(--sre-text);font-family:var(--sre-font);font-size:var(--sol-font-size-base, .9375rem);text-align:left;cursor:pointer}.sol-rich-editor__popover-item:hover,.sol-rich-editor__popover-item.is-active{background:var(--sre-btn-hover)}.sol-rich-editor__popover-label{flex:1;min-width:0}.sol-rich-editor__popover-label--truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.sol-rich-editor__avatar{display:inline-flex;align-items:center;justify-content:center;width:1.5rem;height:1.5rem;flex-shrink:0;border-radius:9999px;background:color-mix(in srgb,var(--sol-color-primary, #6366f1) 20%,transparent);color:var(--sol-color-primary, #6366f1);font-size:var(--sol-font-size-sm, .75rem);font-weight:600}.sol-rich-editor__task-key{flex-shrink:0;padding:.0625rem .375rem;border-radius:var(--sol-border-radius-sm, .375rem);background:color-mix(in srgb,var(--sol-color-success, #10b981) 14%,transparent);color:var(--sol-color-success, #10b981);font-family:var(--sol-font-family-mono, ui-monospace, monospace);font-size:var(--sol-font-size-sm, .75rem);font-weight:600}.sol-rich-editor__content ::ng-deep span[data-mention-id]{display:inline-block;padding:0 .375rem;border-radius:var(--sol-border-radius-sm, .375rem);background:color-mix(in srgb,var(--sol-color-primary, #6366f1) 12%,transparent);color:var(--sol-color-primary, #6366f1);font-weight:500;white-space:nowrap}.sol-rich-editor__content ::ng-deep span[data-task-key]{display:inline-block;padding:0 .375rem;border-radius:var(--sol-border-radius-sm, .375rem);background:color-mix(in srgb,var(--sol-color-success, #10b981) 14%,transparent);color:var(--sol-color-success, #10b981);font-family:var(--sol-font-family-mono, ui-monospace, monospace);font-weight:600;white-space:nowrap}.sol-rich-editor__content ::ng-deep h1{font-size:1.5rem;font-weight:700;margin:.5rem 0;line-height:1.25}.sol-rich-editor__content ::ng-deep h2{font-size:1.25rem;font-weight:700;margin:.5rem 0;line-height:1.3}.sol-rich-editor__content ::ng-deep h3{font-size:1.0625rem;font-weight:600;margin:.5rem 0;line-height:1.35}.sol-rich-editor__content ::ng-deep p{margin:0 0 .5rem}.sol-rich-editor__content ::ng-deep ul,.sol-rich-editor__content ::ng-deep ol{margin:0 0 .5rem;padding-left:1.5rem}.sol-rich-editor__content ::ng-deep li{margin:.125rem 0}.sol-rich-editor__content ::ng-deep a{color:var(--sol-color-primary, #6366f1);text-decoration:underline}.sol-rich-editor__content ::ng-deep img{max-width:100%;height:auto;border-radius:var(--sol-border-radius-sm, .375rem)}.sol-rich-editor__content ::ng-deep table{border-collapse:collapse;margin:.5rem 0;width:auto}.sol-rich-editor__content ::ng-deep td,.sol-rich-editor__content ::ng-deep th{border:1px solid var(--sre-border);padding:.375rem .5rem;min-width:3rem}\n"] }]
|
|
7596
|
+
}], propDecorators: { placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], minHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "minHeight", required: false }] }], maxHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxHeight", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], imageMaxBytes: [{ type: i0.Input, args: [{ isSignal: true, alias: "imageMaxBytes", required: false }] }], imageUpload: [{ type: i0.Input, args: [{ isSignal: true, alias: "imageUpload", required: false }] }], mentionableUsers: [{ type: i0.Input, args: [{ isSignal: true, alias: "mentionableUsers", required: false }] }], linkableTasks: [{ type: i0.Input, args: [{ isSignal: true, alias: "linkableTasks", required: false }] }], valueChange: [{ type: i0.Output, args: ["valueChange"] }], mentionsChange: [{ type: i0.Output, args: ["mentionsChange"] }], taskLinksChange: [{ type: i0.Output, args: ["taskLinksChange"] }], editable: [{ type: i0.ViewChild, args: ['editable', { isSignal: true }] }], fileInput: [{ type: i0.ViewChild, args: ['fileInput', { isSignal: true }] }], linkInput: [{ type: i0.ViewChild, args: ['linkInput', { isSignal: true }] }] } });
|
|
7597
|
+
|
|
7598
|
+
/**
|
|
7599
|
+
* Cabecera de página del design system: título (H1) + subtítulo opcional a la
|
|
7600
|
+
* izquierda, con un slot proyectado de acciones alineadas a la derecha (p. ej.
|
|
7601
|
+
* un botón "Crear"). Tematizado con `var(--sol-*)` — soporta light y dark.
|
|
7602
|
+
*
|
|
7603
|
+
* Uso:
|
|
7604
|
+
* ```html
|
|
7605
|
+
* <sol-page-header title="Profesionales" subtitle="Gestiona tu equipo">
|
|
7606
|
+
* <sol-button (clicked)="crear()">Crear</sol-button>
|
|
7607
|
+
* </sol-page-header>
|
|
7608
|
+
* ```
|
|
7609
|
+
*/
|
|
7610
|
+
class SolPageHeaderComponent {
|
|
7611
|
+
/** Título principal (H1). Obligatorio. */
|
|
7612
|
+
title = input.required(/* @ts-ignore */
|
|
7613
|
+
...(ngDevMode ? [{ debugName: "title" }] : /* istanbul ignore next */ []));
|
|
7614
|
+
/** Subtítulo opcional bajo el título. */
|
|
7615
|
+
subtitle = input('', /* @ts-ignore */
|
|
7616
|
+
...(ngDevMode ? [{ debugName: "subtitle" }] : /* istanbul ignore next */ []));
|
|
7617
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: SolPageHeaderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
7618
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: SolPageHeaderComponent, isStandalone: true, selector: "sol-page-header", inputs: { title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: true, transformFunction: null }, subtitle: { classPropertyName: "subtitle", publicName: "subtitle", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
|
|
7619
|
+
<div class="sol-page-header">
|
|
7620
|
+
<div class="sol-page-header__titles">
|
|
7621
|
+
<h1 class="sol-page-header__title">{{ title() }}</h1>
|
|
7622
|
+
@if (subtitle()) {
|
|
7623
|
+
<p class="sol-page-header__subtitle">{{ subtitle() }}</p>
|
|
7624
|
+
}
|
|
7625
|
+
</div>
|
|
7626
|
+
<div class="sol-page-header__actions">
|
|
7627
|
+
<ng-content />
|
|
7628
|
+
</div>
|
|
7629
|
+
</div>
|
|
7630
|
+
`, isInline: true, styles: [":host{display:block}.sol-page-header{display:flex;flex-wrap:wrap;align-items:flex-end;justify-content:space-between;gap:var(--sol-space-sm, .75rem)}.sol-page-header__titles{min-width:0}.sol-page-header__title{margin:0;font-family:var(--sol-font-display, var(--sol-font-family, inherit));font-size:var(--sol-font-size-xl, 1.5rem);font-weight:var(--sol-display-weight, var(--sol-font-weight-bold, 700));letter-spacing:var(--sol-display-tracking, -.01em);text-transform:var(--sol-display-transform, none);line-height:1.2;color:var(--sol-color-text-primary, #0f172a)}.sol-page-header__subtitle{margin:var(--sol-space-xs, .25rem) 0 0;font-size:var(--sol-font-size-sm, .8125rem);color:var(--sol-color-text-muted, #64748b)}.sol-page-header__actions{display:flex;align-items:center;gap:var(--sol-space-sm, .5rem);flex-shrink:0}.sol-page-header__actions:empty{display:none}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
7631
|
+
}
|
|
7632
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: SolPageHeaderComponent, decorators: [{
|
|
7633
|
+
type: Component,
|
|
7634
|
+
args: [{ selector: 'sol-page-header', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, template: `
|
|
7635
|
+
<div class="sol-page-header">
|
|
7636
|
+
<div class="sol-page-header__titles">
|
|
7637
|
+
<h1 class="sol-page-header__title">{{ title() }}</h1>
|
|
7638
|
+
@if (subtitle()) {
|
|
7639
|
+
<p class="sol-page-header__subtitle">{{ subtitle() }}</p>
|
|
7640
|
+
}
|
|
7641
|
+
</div>
|
|
7642
|
+
<div class="sol-page-header__actions">
|
|
7643
|
+
<ng-content />
|
|
7644
|
+
</div>
|
|
7645
|
+
</div>
|
|
7646
|
+
`, styles: [":host{display:block}.sol-page-header{display:flex;flex-wrap:wrap;align-items:flex-end;justify-content:space-between;gap:var(--sol-space-sm, .75rem)}.sol-page-header__titles{min-width:0}.sol-page-header__title{margin:0;font-family:var(--sol-font-display, var(--sol-font-family, inherit));font-size:var(--sol-font-size-xl, 1.5rem);font-weight:var(--sol-display-weight, var(--sol-font-weight-bold, 700));letter-spacing:var(--sol-display-tracking, -.01em);text-transform:var(--sol-display-transform, none);line-height:1.2;color:var(--sol-color-text-primary, #0f172a)}.sol-page-header__subtitle{margin:var(--sol-space-xs, .25rem) 0 0;font-size:var(--sol-font-size-sm, .8125rem);color:var(--sol-color-text-muted, #64748b)}.sol-page-header__actions{display:flex;align-items:center;gap:var(--sol-space-sm, .5rem);flex-shrink:0}.sol-page-header__actions:empty{display:none}\n"] }]
|
|
7647
|
+
}], propDecorators: { title: [{ type: i0.Input, args: [{ isSignal: true, alias: "title", required: true }] }], subtitle: [{ type: i0.Input, args: [{ isSignal: true, alias: "subtitle", required: false }] }] } });
|
|
7648
|
+
|
|
7649
|
+
/**
|
|
7650
|
+
* Botón cuadrado de solo ícono, con `aria-label` obligatorio por accesibilidad.
|
|
7651
|
+
* El ícono sale del registry de la librería vía `sol-icon` (nunca SVG inline).
|
|
7652
|
+
* Tematizado con `var(--sol-*)` — soporta light y dark.
|
|
7653
|
+
*
|
|
7654
|
+
* Uso:
|
|
7655
|
+
* ```html
|
|
7656
|
+
* <sol-icon-button icon="edit" ariaLabel="Editar" (clicked)="editar()" />
|
|
7657
|
+
* <sol-icon-button icon="trash" variant="danger" ariaLabel="Eliminar" (clicked)="eliminar()" />
|
|
7658
|
+
* ```
|
|
7659
|
+
*/
|
|
7660
|
+
class SolIconButtonComponent {
|
|
7661
|
+
/** Ícono del registry a mostrar. Obligatorio. */
|
|
7662
|
+
icon = input.required(/* @ts-ignore */
|
|
7663
|
+
...(ngDevMode ? [{ debugName: "icon" }] : /* istanbul ignore next */ []));
|
|
7664
|
+
/** Etiqueta accesible obligatoria (el botón no tiene texto visible). */
|
|
7665
|
+
ariaLabel = input.required(/* @ts-ignore */
|
|
7666
|
+
...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
7667
|
+
/** Atributo `type` nativo del botón. */
|
|
7668
|
+
type = input('button', /* @ts-ignore */
|
|
7669
|
+
...(ngDevMode ? [{ debugName: "type" }] : /* istanbul ignore next */ []));
|
|
7670
|
+
/** Estilo visual. */
|
|
7671
|
+
variant = input('default', /* @ts-ignore */
|
|
7672
|
+
...(ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []));
|
|
7673
|
+
/** Tamaño cuadrado. */
|
|
7674
|
+
size = input('md', /* @ts-ignore */
|
|
7675
|
+
...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
7676
|
+
/** Deshabilita el botón. */
|
|
7677
|
+
disabled = input(false, /* @ts-ignore */
|
|
7678
|
+
...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
7679
|
+
/** Se emite al hacer clic cuando el botón no está deshabilitado. */
|
|
7680
|
+
clicked = output();
|
|
7681
|
+
/** Clases CSS combinando variante y tamaño. */
|
|
7682
|
+
cssClass = computed(() => `sol-icon-btn sol-icon-btn--${this.variant()} sol-icon-btn--${this.size()}`, /* @ts-ignore */
|
|
7683
|
+
...(ngDevMode ? [{ debugName: "cssClass" }] : /* istanbul ignore next */ []));
|
|
7684
|
+
onClick(event) {
|
|
7685
|
+
if (this.disabled()) {
|
|
7686
|
+
event.stopPropagation();
|
|
7687
|
+
return;
|
|
7688
|
+
}
|
|
7689
|
+
this.clicked.emit();
|
|
7690
|
+
}
|
|
7691
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: SolIconButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
7692
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.6", type: SolIconButtonComponent, isStandalone: true, selector: "sol-icon-button", inputs: { icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: true, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: true, transformFunction: null }, type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { clicked: "clicked" }, ngImport: i0, template: `
|
|
7693
|
+
<button
|
|
7694
|
+
[type]="type()"
|
|
7695
|
+
[class]="cssClass()"
|
|
7696
|
+
[disabled]="disabled()"
|
|
7697
|
+
[attr.aria-label]="ariaLabel()"
|
|
7698
|
+
(click)="onClick($event)"
|
|
7699
|
+
>
|
|
7700
|
+
<sol-icon [name]="icon()" [size]="size()" />
|
|
7701
|
+
</button>
|
|
7702
|
+
`, 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}\n"], dependencies: [{ kind: "component", type: SolIconComponent, selector: "sol-icon", inputs: ["name", "size", "variant"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
7703
|
+
}
|
|
7704
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: SolIconButtonComponent, decorators: [{
|
|
7705
|
+
type: Component,
|
|
7706
|
+
args: [{ selector: 'sol-icon-button', standalone: true, imports: [SolIconComponent], changeDetection: ChangeDetectionStrategy.OnPush, template: `
|
|
7707
|
+
<button
|
|
7708
|
+
[type]="type()"
|
|
7709
|
+
[class]="cssClass()"
|
|
7710
|
+
[disabled]="disabled()"
|
|
7711
|
+
[attr.aria-label]="ariaLabel()"
|
|
7712
|
+
(click)="onClick($event)"
|
|
7713
|
+
>
|
|
7714
|
+
<sol-icon [name]="icon()" [size]="size()" />
|
|
7715
|
+
</button>
|
|
7716
|
+
`, 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}\n"] }]
|
|
7717
|
+
}], 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"] }] } });
|
|
7718
|
+
|
|
7719
|
+
/**
|
|
7720
|
+
* Tabla de datos genérica dirigida por columnas: búsqueda, orden, paginación,
|
|
7721
|
+
* estado de carga (skeleton), estado vacío y acciones por fila. En viewport
|
|
7722
|
+
* móvil colapsa cada fila a un resumen expandible (sin scroll horizontal)
|
|
7723
|
+
* cuando el tema activo lo prefiere (`component.table.mobile: "collapse"`).
|
|
7724
|
+
*
|
|
7725
|
+
* Componente presentacional: no conoce dominio. Las acciones no genéricas se
|
|
7726
|
+
* proyectan por el slot `#rowActions` (TemplateRef que recibe la fila).
|
|
7727
|
+
* Tematizado con `var(--sol-*)` — soporta light y dark.
|
|
7728
|
+
*/
|
|
7729
|
+
class SolDataTableComponent {
|
|
7730
|
+
themeService = inject(ThemeService);
|
|
7731
|
+
data = input([], /* @ts-ignore */
|
|
7732
|
+
...(ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []));
|
|
7733
|
+
columns = input([], /* @ts-ignore */
|
|
7734
|
+
...(ngDevMode ? [{ debugName: "columns" }] : /* istanbul ignore next */ []));
|
|
7735
|
+
/**
|
|
7736
|
+
* Estado de carga de la fuente de datos: sustituye el cuerpo por filas
|
|
7737
|
+
* skeleton tokenizadas y oculta la paginación mientras esté activo.
|
|
7738
|
+
*/
|
|
7739
|
+
loading = input(false, /* @ts-ignore */
|
|
7740
|
+
...(ngDevMode ? [{ debugName: "loading" }] : /* istanbul ignore next */ []));
|
|
7741
|
+
searchPlaceholder = input('Buscar...', /* @ts-ignore */
|
|
7742
|
+
...(ngDevMode ? [{ debugName: "searchPlaceholder" }] : /* istanbul ignore next */ []));
|
|
7743
|
+
emptyMessage = input('No hay datos disponibles', /* @ts-ignore */
|
|
7744
|
+
...(ngDevMode ? [{ debugName: "emptyMessage" }] : /* istanbul ignore next */ []));
|
|
7745
|
+
paginated = input(true, /* @ts-ignore */
|
|
7746
|
+
...(ngDevMode ? [{ debugName: "paginated" }] : /* istanbul ignore next */ []));
|
|
7747
|
+
showToolbar = input(true, /* @ts-ignore */
|
|
7748
|
+
...(ngDevMode ? [{ debugName: "showToolbar" }] : /* istanbul ignore next */ []));
|
|
7749
|
+
filterPosition = input('left', /* @ts-ignore */
|
|
7750
|
+
...(ngDevMode ? [{ debugName: "filterPosition" }] : /* istanbul ignore next */ []));
|
|
7751
|
+
showActions = input(true, /* @ts-ignore */
|
|
7752
|
+
...(ngDevMode ? [{ debugName: "showActions" }] : /* istanbul ignore next */ []));
|
|
7753
|
+
showEditAction = input(true, /* @ts-ignore */
|
|
7754
|
+
...(ngDevMode ? [{ debugName: "showEditAction" }] : /* istanbul ignore next */ []));
|
|
7755
|
+
showDeleteAction = input(true, /* @ts-ignore */
|
|
7756
|
+
...(ngDevMode ? [{ debugName: "showDeleteAction" }] : /* istanbul ignore next */ []));
|
|
7757
|
+
trackByKey = input('id', /* @ts-ignore */
|
|
7758
|
+
...(ngDevMode ? [{ debugName: "trackByKey" }] : /* istanbul ignore next */ []));
|
|
7759
|
+
/** Encabezado de la columna de acciones. */
|
|
7760
|
+
actionsLabel = input('Acciones', /* @ts-ignore */
|
|
7761
|
+
...(ngDevMode ? [{ debugName: "actionsLabel" }] : /* istanbul ignore next */ []));
|
|
7762
|
+
/** aria-label del botón ▶ de expansión de fila en el modo móvil. */
|
|
7763
|
+
toggleDetailsLabel = input('Ver detalles', /* @ts-ignore */
|
|
7764
|
+
...(ngDevMode ? [{ debugName: "toggleDetailsLabel" }] : /* istanbul ignore next */ []));
|
|
7765
|
+
editClicked = output();
|
|
7766
|
+
deleteClicked = output();
|
|
7767
|
+
/**
|
|
7768
|
+
* Plantilla de acciones por fila proyectada con `#rowActions`. Recibe la fila
|
|
7769
|
+
* como `$implicit`. Cuando existe, reemplaza los botones editar/eliminar por
|
|
7770
|
+
* defecto: aquí van las acciones específicas del dominio del consumidor.
|
|
7771
|
+
*/
|
|
7772
|
+
rowActionsTemplate = contentChild('rowActions', /* @ts-ignore */
|
|
7773
|
+
...(ngDevMode ? [{ debugName: "rowActionsTemplate" }] : /* istanbul ignore next */ []));
|
|
7774
|
+
/**
|
|
7775
|
+
* Carga "estirada" a un mínimo visible (anti-flash): con un backend rápido
|
|
7776
|
+
* `loading` se apaga antes de que el skeleton se perciba. `loadingVisible`
|
|
7777
|
+
* mantiene el skeleton un instante mínimo — es lo que consume el template.
|
|
7778
|
+
*/
|
|
7779
|
+
loadingVisible = stretchLoading(this.loading);
|
|
7780
|
+
searchTerm = signal('', /* @ts-ignore */
|
|
7781
|
+
...(ngDevMode ? [{ debugName: "searchTerm" }] : /* istanbul ignore next */ []));
|
|
7782
|
+
currentPage = signal(1, /* @ts-ignore */
|
|
7783
|
+
...(ngDevMode ? [{ debugName: "currentPage" }] : /* istanbul ignore next */ []));
|
|
7784
|
+
pageSize = signal(10, /* @ts-ignore */
|
|
7785
|
+
...(ngDevMode ? [{ debugName: "pageSize" }] : /* istanbul ignore next */ []));
|
|
7786
|
+
sortKey = signal('', /* @ts-ignore */
|
|
7787
|
+
...(ngDevMode ? [{ debugName: "sortKey" }] : /* istanbul ignore next */ []));
|
|
7788
|
+
sortDirection = signal('asc', /* @ts-ignore */
|
|
7789
|
+
...(ngDevMode ? [{ debugName: "sortDirection" }] : /* istanbul ignore next */ []));
|
|
7790
|
+
/** Señal reactiva de viewport móvil (breakpoint canónico 767px). */
|
|
7791
|
+
isMobileViewport = observeMobileViewport();
|
|
7792
|
+
/** Índices de las filas fantasma del estado de carga (7 filas fijas). */
|
|
7793
|
+
skeletonRows = [0, 1, 2, 3, 4, 5, 6];
|
|
7794
|
+
/**
|
|
7795
|
+
* Token aditivo `component.table.mobile` del ThemeFile activo.
|
|
7796
|
+
* "collapse" (default): filas colapsables sin scroll horizontal.
|
|
7797
|
+
* "scroll": conserva la tabla con overflow-x. El token ajusta la
|
|
7798
|
+
* preferencia — NUNCA la estructura del componente.
|
|
7799
|
+
*/
|
|
7800
|
+
tableMobileMode = computed(() => {
|
|
7801
|
+
const file = this.themeService.activeTheme();
|
|
7802
|
+
const mode = this.themeService.isDark() ? 'dark' : 'light';
|
|
7803
|
+
return file?.modes?.[mode]?.component?.table?.mobile ?? 'collapse';
|
|
7804
|
+
}, /* @ts-ignore */
|
|
7805
|
+
...(ngDevMode ? [{ debugName: "tableMobileMode" }] : /* istanbul ignore next */ []));
|
|
7806
|
+
/** El modo colapsado aplica solo en viewport móvil con preferencia "collapse". */
|
|
7807
|
+
mobileCollapse = computed(() => this.isMobileViewport() && this.tableMobileMode() === 'collapse', /* @ts-ignore */
|
|
7808
|
+
...(ngDevMode ? [{ debugName: "mobileCollapse" }] : /* istanbul ignore next */ []));
|
|
7809
|
+
/** Filas expandidas del modo colapsado (por id de trackBy). */
|
|
7810
|
+
expandedRows = signal(new Set(), /* @ts-ignore */
|
|
7811
|
+
...(ngDevMode ? [{ debugName: "expandedRows" }] : /* istanbul ignore next */ []));
|
|
7812
|
+
/** Columna título de la fila colapsada = primera columna configurada. */
|
|
7813
|
+
mobileTitleCol = computed(() => this.columns()[0], /* @ts-ignore */
|
|
7814
|
+
...(ngDevMode ? [{ debugName: "mobileTitleCol" }] : /* istanbul ignore next */ []));
|
|
7815
|
+
/** Columna del chip de estado = la marcada con `badge: true` (si existe). */
|
|
7816
|
+
mobileBadgeCol = computed(() => this.columns().find((col) => col.badge), /* @ts-ignore */
|
|
7817
|
+
...(ngDevMode ? [{ debugName: "mobileBadgeCol" }] : /* istanbul ignore next */ []));
|
|
7818
|
+
/** Subdato = la segunda columna que no sea el chip de estado. */
|
|
7819
|
+
mobileSubtitleCol = computed(() => this.columns().find((col, index) => index > 0 && !col.badge), /* @ts-ignore */
|
|
7820
|
+
...(ngDevMode ? [{ debugName: "mobileSubtitleCol" }] : /* istanbul ignore next */ []));
|
|
7821
|
+
/** Columnas ocultas en el colapso: todas menos título, subdato y chip. */
|
|
7822
|
+
mobileDetailCols = computed(() => {
|
|
7823
|
+
const title = this.mobileTitleCol();
|
|
7824
|
+
const subtitle = this.mobileSubtitleCol();
|
|
7825
|
+
const badge = this.mobileBadgeCol();
|
|
7826
|
+
return this.columns().filter((col) => col !== title && col !== subtitle && col !== badge);
|
|
7827
|
+
}, /* @ts-ignore */
|
|
7828
|
+
...(ngDevMode ? [{ debugName: "mobileDetailCols" }] : /* istanbul ignore next */ []));
|
|
7829
|
+
filteredData = computed(() => {
|
|
7830
|
+
let result = [...this.data()];
|
|
7831
|
+
const term = this.searchTerm().toLowerCase();
|
|
7832
|
+
if (term) {
|
|
7833
|
+
result = result.filter((row) => this.columns().some((col) => String(this.resolveValue(row, col.key) ?? '').toLowerCase().includes(term)));
|
|
7834
|
+
}
|
|
7835
|
+
const key = this.sortKey();
|
|
7836
|
+
if (key) {
|
|
7837
|
+
const dir = this.sortDirection() === 'asc' ? 1 : -1;
|
|
7838
|
+
result.sort((a, b) => {
|
|
7839
|
+
const va = this.resolveValue(a, key);
|
|
7840
|
+
const vb = this.resolveValue(b, key);
|
|
7841
|
+
return va > vb ? dir : va < vb ? -dir : 0;
|
|
7842
|
+
});
|
|
7843
|
+
}
|
|
7844
|
+
return result;
|
|
7845
|
+
}, /* @ts-ignore */
|
|
7846
|
+
...(ngDevMode ? [{ debugName: "filteredData" }] : /* istanbul ignore next */ []));
|
|
7847
|
+
pagedData = computed(() => {
|
|
7848
|
+
if (!this.paginated())
|
|
7849
|
+
return this.filteredData();
|
|
7850
|
+
const start = (this.currentPage() - 1) * this.pageSize();
|
|
7851
|
+
return this.filteredData().slice(start, start + this.pageSize());
|
|
7852
|
+
}, /* @ts-ignore */
|
|
7853
|
+
...(ngDevMode ? [{ debugName: "pagedData" }] : /* istanbul ignore next */ []));
|
|
7854
|
+
resolveValue(row, key) {
|
|
7855
|
+
return key.split('.').reduce((obj, k) => (obj == null ? undefined : obj[k]), row) ?? '';
|
|
7856
|
+
}
|
|
7857
|
+
trackId(index, row) {
|
|
7858
|
+
const key = this.trackByKey();
|
|
7859
|
+
if (key) {
|
|
7860
|
+
const val = row[key];
|
|
7861
|
+
if (val !== undefined && val !== null && val !== '')
|
|
7862
|
+
return val;
|
|
7863
|
+
}
|
|
7864
|
+
return index;
|
|
7865
|
+
}
|
|
7866
|
+
/** Estado de expansión de una fila en el modo móvil colapsado. */
|
|
7867
|
+
isRowExpanded(id) {
|
|
7868
|
+
return this.expandedRows().has(id);
|
|
7869
|
+
}
|
|
7870
|
+
/** Expande/colapsa una fila del modo móvil colapsado. */
|
|
7871
|
+
toggleRow(id) {
|
|
7872
|
+
this.expandedRows.update((current) => {
|
|
7873
|
+
const next = new Set(current);
|
|
7874
|
+
if (next.has(id)) {
|
|
7875
|
+
next.delete(id);
|
|
7876
|
+
}
|
|
7877
|
+
else {
|
|
7878
|
+
next.add(id);
|
|
7879
|
+
}
|
|
7880
|
+
return next;
|
|
7881
|
+
});
|
|
7882
|
+
}
|
|
7883
|
+
onSearch(term) {
|
|
7884
|
+
this.searchTerm.set(term);
|
|
7885
|
+
this.currentPage.set(1);
|
|
7886
|
+
// Al filtrar, el detalle expandido pierde contexto — se colapsa todo.
|
|
7887
|
+
this.expandedRows.set(new Set());
|
|
7888
|
+
}
|
|
7889
|
+
onSort(key) {
|
|
7890
|
+
if (this.sortKey() === key) {
|
|
7891
|
+
this.sortDirection.update((d) => (d === 'asc' ? 'desc' : 'asc'));
|
|
7892
|
+
}
|
|
7893
|
+
else {
|
|
7894
|
+
this.sortKey.set(key);
|
|
7895
|
+
this.sortDirection.set('asc');
|
|
7896
|
+
}
|
|
7897
|
+
}
|
|
7898
|
+
onPageSizeChange(size) {
|
|
7899
|
+
this.pageSize.set(size);
|
|
7900
|
+
this.currentPage.set(1);
|
|
7901
|
+
}
|
|
7902
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: SolDataTableComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
7903
|
+
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 } }, outputs: { editClicked: "editClicked", deleteClicked: "deleteClicked" }, queries: [{ propertyName: "rowActionsTemplate", first: true, predicate: ["rowActions"], descendants: true, isSignal: true }], ngImport: i0, template: `
|
|
7904
|
+
<!-- Slot para filtros personalizados (fuera de la tarjeta) -->
|
|
7905
|
+
<div
|
|
7906
|
+
class="sol-data-table__filters"
|
|
7907
|
+
[style.justify-content]="filterPosition() === 'right' ? 'flex-end' : 'flex-start'"
|
|
7908
|
+
>
|
|
7909
|
+
<ng-content select="[tableFilters]" />
|
|
7910
|
+
</div>
|
|
7911
|
+
|
|
7912
|
+
<div class="sol-data-table" [attr.aria-busy]="loadingVisible() || null">
|
|
7913
|
+
@if (showToolbar()) {
|
|
7914
|
+
<div class="sol-data-table__toolbar">
|
|
7915
|
+
<div class="sol-data-table__toolbar-left">
|
|
7916
|
+
<ng-content select="[tableActions]" />
|
|
7917
|
+
</div>
|
|
7918
|
+
<div class="sol-data-table__toolbar-right">
|
|
7919
|
+
<sol-search-input
|
|
7920
|
+
[placeholder]="searchPlaceholder()"
|
|
7921
|
+
(searchChange)="onSearch($event)"
|
|
7922
|
+
/>
|
|
7923
|
+
</div>
|
|
7924
|
+
</div>
|
|
7925
|
+
}
|
|
7926
|
+
|
|
7927
|
+
<!-- Acciones por fila compartidas entre el modo tabla y el modo móvil. -->
|
|
7928
|
+
<ng-template #rowActionButtons let-row>
|
|
7929
|
+
@if (rowActionsTemplate(); as tpl) {
|
|
7930
|
+
<ng-container *ngTemplateOutlet="tpl; context: { $implicit: row }" />
|
|
7931
|
+
} @else {
|
|
7932
|
+
<div class="sol-data-table__action-group">
|
|
7933
|
+
@if (showEditAction()) {
|
|
7934
|
+
<sol-button variant="ghost" size="sm" (clicked)="editClicked.emit(row)">
|
|
7935
|
+
<sol-icon name="edit" size="sm" />
|
|
7936
|
+
</sol-button>
|
|
7937
|
+
}
|
|
7938
|
+
@if (showDeleteAction()) {
|
|
7939
|
+
<sol-button variant="ghost" size="sm" (clicked)="deleteClicked.emit(row)">
|
|
7940
|
+
<sol-icon name="trash" size="sm" class="text-red-500" />
|
|
7941
|
+
</sol-button>
|
|
7942
|
+
}
|
|
7943
|
+
</div>
|
|
7944
|
+
}
|
|
7945
|
+
</ng-template>
|
|
7946
|
+
|
|
7947
|
+
@if (mobileCollapse()) {
|
|
7948
|
+
<!-- Modo móvil colapsado: cada fila es [▶] título + subdato · chip de
|
|
7949
|
+
estado; el detalle despliega las columnas ocultas como pares
|
|
7950
|
+
clave/valor. -->
|
|
7951
|
+
@if (loadingVisible()) {
|
|
7952
|
+
<ul class="sol-data-table__cards">
|
|
7953
|
+
@for (i of skeletonRows; track i) {
|
|
7954
|
+
<li>
|
|
7955
|
+
<sol-skeleton variant="row" height="56px" />
|
|
7956
|
+
</li>
|
|
7957
|
+
}
|
|
7958
|
+
</ul>
|
|
7959
|
+
} @else {
|
|
7960
|
+
<ul class="sol-data-table__cards">
|
|
7961
|
+
@for (row of pagedData(); track trackId($index, row)) {
|
|
7962
|
+
<li class="sol-data-table__card">
|
|
7963
|
+
<button
|
|
7964
|
+
type="button"
|
|
7965
|
+
class="sol-data-table__card-head"
|
|
7966
|
+
[attr.aria-expanded]="isRowExpanded(trackId($index, row))"
|
|
7967
|
+
[attr.aria-label]="toggleDetailsLabel()"
|
|
7968
|
+
(click)="toggleRow(trackId($index, row))"
|
|
7969
|
+
data-testid="fila-colapsada"
|
|
7970
|
+
>
|
|
7971
|
+
<sol-icon
|
|
7972
|
+
name="chevron-right"
|
|
7973
|
+
size="sm"
|
|
7974
|
+
class="sol-data-table__card-chevron"
|
|
7975
|
+
[class.sol-data-table__card-chevron--open]="isRowExpanded(trackId($index, row))"
|
|
7976
|
+
/>
|
|
7977
|
+
<span class="sol-data-table__card-main">
|
|
7978
|
+
@if (mobileTitleCol(); as col) {
|
|
7979
|
+
<span class="sol-data-table__card-title">
|
|
7980
|
+
@if (col.cellTemplate) {
|
|
7981
|
+
<ng-container *ngTemplateOutlet="col.cellTemplate; context: { $implicit: resolveValue(row, col.key), row: row }" />
|
|
7982
|
+
} @else {
|
|
7983
|
+
{{ resolveValue(row, col.key) }}
|
|
7984
|
+
}
|
|
7985
|
+
</span>
|
|
7986
|
+
}
|
|
7987
|
+
@if (mobileSubtitleCol(); as col) {
|
|
7988
|
+
<span class="sol-data-table__card-sub">
|
|
7989
|
+
@if (col.cellTemplate) {
|
|
7990
|
+
<ng-container *ngTemplateOutlet="col.cellTemplate; context: { $implicit: resolveValue(row, col.key), row: row }" />
|
|
7991
|
+
} @else {
|
|
7992
|
+
{{ resolveValue(row, col.key) }}
|
|
7993
|
+
}
|
|
7994
|
+
</span>
|
|
7995
|
+
}
|
|
7996
|
+
</span>
|
|
7997
|
+
@if (mobileBadgeCol(); as col) {
|
|
7998
|
+
<span class="sol-data-table__card-chip">
|
|
7999
|
+
@if (col.cellTemplate) {
|
|
8000
|
+
<ng-container *ngTemplateOutlet="col.cellTemplate; context: { $implicit: resolveValue(row, col.key), row: row }" />
|
|
8001
|
+
} @else {
|
|
8002
|
+
{{ resolveValue(row, col.key) }}
|
|
8003
|
+
}
|
|
8004
|
+
</span>
|
|
8005
|
+
}
|
|
8006
|
+
</button>
|
|
8007
|
+
|
|
8008
|
+
@if (isRowExpanded(trackId($index, row))) {
|
|
8009
|
+
<div class="sol-data-table__card-details" data-testid="detalle-fila">
|
|
8010
|
+
<dl class="sol-data-table__card-kv-list">
|
|
8011
|
+
@for (col of mobileDetailCols(); track col.key) {
|
|
8012
|
+
<div class="sol-data-table__card-kv">
|
|
8013
|
+
<dt>{{ col.label }}</dt>
|
|
8014
|
+
<dd>
|
|
8015
|
+
@if (col.cellTemplate) {
|
|
8016
|
+
<ng-container *ngTemplateOutlet="col.cellTemplate; context: { $implicit: resolveValue(row, col.key), row: row }" />
|
|
8017
|
+
} @else {
|
|
8018
|
+
{{ resolveValue(row, col.key) }}
|
|
8019
|
+
}
|
|
8020
|
+
</dd>
|
|
8021
|
+
</div>
|
|
8022
|
+
}
|
|
8023
|
+
</dl>
|
|
8024
|
+
@if (showActions()) {
|
|
8025
|
+
<div class="sol-data-table__card-actions">
|
|
8026
|
+
<ng-container *ngTemplateOutlet="rowActionButtons; context: { $implicit: row }" />
|
|
8027
|
+
</div>
|
|
8028
|
+
}
|
|
8029
|
+
</div>
|
|
8030
|
+
}
|
|
8031
|
+
</li>
|
|
8032
|
+
} @empty {
|
|
8033
|
+
<li class="sol-data-table__empty">{{ emptyMessage() }}</li>
|
|
8034
|
+
}
|
|
8035
|
+
</ul>
|
|
8036
|
+
}
|
|
8037
|
+
} @else {
|
|
8038
|
+
<div class="sol-data-table__wrapper">
|
|
8039
|
+
<table class="sol-data-table__table">
|
|
8040
|
+
<thead>
|
|
8041
|
+
<tr>
|
|
8042
|
+
@for (col of columns(); track col.key) {
|
|
8043
|
+
<th
|
|
8044
|
+
class="sol-data-table__th"
|
|
8045
|
+
[style.width]="col.width || 'auto'"
|
|
8046
|
+
[class.sol-data-table__th--sortable]="col.sortable"
|
|
8047
|
+
(click)="col.sortable ? onSort(col.key) : null"
|
|
8048
|
+
>
|
|
8049
|
+
{{ col.label }}
|
|
8050
|
+
@if (col.sortable && sortKey() === col.key) {
|
|
8051
|
+
<span class="sol-data-table__sort-icon">
|
|
8052
|
+
{{ sortDirection() === 'asc' ? '↑' : '↓' }}
|
|
8053
|
+
</span>
|
|
8054
|
+
}
|
|
8055
|
+
</th>
|
|
8056
|
+
}
|
|
8057
|
+
@if (showActions()) {
|
|
8058
|
+
<th class="sol-data-table__th sol-data-table__th--actions">{{ actionsLabel() }}</th>
|
|
8059
|
+
}
|
|
8060
|
+
</tr>
|
|
8061
|
+
</thead>
|
|
8062
|
+
<tbody>
|
|
8063
|
+
@if (loadingVisible()) {
|
|
8064
|
+
@for (i of skeletonRows; track i) {
|
|
8065
|
+
<tr class="sol-data-table__tr">
|
|
8066
|
+
<td class="sol-data-table__td" [attr.colspan]="columns().length + (showActions() ? 1 : 0)">
|
|
8067
|
+
<sol-skeleton variant="row" />
|
|
8068
|
+
</td>
|
|
8069
|
+
</tr>
|
|
8070
|
+
}
|
|
8071
|
+
} @else {
|
|
8072
|
+
@for (row of pagedData(); track trackId($index, row)) {
|
|
8073
|
+
<tr class="sol-data-table__tr">
|
|
8074
|
+
@for (col of columns(); track col.key) {
|
|
8075
|
+
<td class="sol-data-table__td">
|
|
8076
|
+
@if (col.cellTemplate) {
|
|
8077
|
+
<ng-container *ngTemplateOutlet="col.cellTemplate; context: { $implicit: resolveValue(row, col.key), row: row }" />
|
|
8078
|
+
} @else {
|
|
8079
|
+
{{ resolveValue(row, col.key) }}
|
|
8080
|
+
}
|
|
8081
|
+
</td>
|
|
8082
|
+
}
|
|
8083
|
+
@if (showActions()) {
|
|
8084
|
+
<td class="sol-data-table__td sol-data-table__td--actions">
|
|
8085
|
+
<ng-container *ngTemplateOutlet="rowActionButtons; context: { $implicit: row }" />
|
|
8086
|
+
</td>
|
|
8087
|
+
}
|
|
8088
|
+
</tr>
|
|
8089
|
+
} @empty {
|
|
8090
|
+
<tr>
|
|
8091
|
+
<td class="sol-data-table__empty" [attr.colspan]="columns().length + (showActions() ? 1 : 0)">
|
|
8092
|
+
{{ emptyMessage() }}
|
|
8093
|
+
</td>
|
|
8094
|
+
</tr>
|
|
8095
|
+
}
|
|
8096
|
+
}
|
|
8097
|
+
</tbody>
|
|
8098
|
+
</table>
|
|
8099
|
+
</div>
|
|
8100
|
+
}
|
|
8101
|
+
</div>
|
|
8102
|
+
|
|
8103
|
+
@if (paginated() && !loadingVisible()) {
|
|
8104
|
+
<div class="sol-data-table__footer">
|
|
8105
|
+
<sol-pagination
|
|
8106
|
+
[totalItems]="filteredData().length"
|
|
8107
|
+
[pageSize]="pageSize()"
|
|
8108
|
+
[currentPage]="currentPage()"
|
|
8109
|
+
(pageChanged)="currentPage.set($event)"
|
|
8110
|
+
(pageSizeChanged)="onPageSizeChange($event)"
|
|
8111
|
+
/>
|
|
8112
|
+
</div>
|
|
8113
|
+
}
|
|
8114
|
+
`, 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:100px;text-align:center}.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}.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__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"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
8115
|
+
}
|
|
8116
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: SolDataTableComponent, decorators: [{
|
|
8117
|
+
type: Component,
|
|
8118
|
+
args: [{ selector: 'sol-data-table', standalone: true, imports: [
|
|
8119
|
+
NgTemplateOutlet,
|
|
8120
|
+
SolSearchInputComponent,
|
|
8121
|
+
SolPaginationComponent,
|
|
8122
|
+
SolButtonComponent,
|
|
8123
|
+
SolIconComponent,
|
|
8124
|
+
SolSkeletonComponent,
|
|
8125
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, template: `
|
|
8126
|
+
<!-- Slot para filtros personalizados (fuera de la tarjeta) -->
|
|
8127
|
+
<div
|
|
8128
|
+
class="sol-data-table__filters"
|
|
8129
|
+
[style.justify-content]="filterPosition() === 'right' ? 'flex-end' : 'flex-start'"
|
|
8130
|
+
>
|
|
8131
|
+
<ng-content select="[tableFilters]" />
|
|
8132
|
+
</div>
|
|
8133
|
+
|
|
8134
|
+
<div class="sol-data-table" [attr.aria-busy]="loadingVisible() || null">
|
|
8135
|
+
@if (showToolbar()) {
|
|
8136
|
+
<div class="sol-data-table__toolbar">
|
|
8137
|
+
<div class="sol-data-table__toolbar-left">
|
|
8138
|
+
<ng-content select="[tableActions]" />
|
|
8139
|
+
</div>
|
|
8140
|
+
<div class="sol-data-table__toolbar-right">
|
|
8141
|
+
<sol-search-input
|
|
8142
|
+
[placeholder]="searchPlaceholder()"
|
|
8143
|
+
(searchChange)="onSearch($event)"
|
|
8144
|
+
/>
|
|
8145
|
+
</div>
|
|
8146
|
+
</div>
|
|
8147
|
+
}
|
|
8148
|
+
|
|
8149
|
+
<!-- Acciones por fila compartidas entre el modo tabla y el modo móvil. -->
|
|
8150
|
+
<ng-template #rowActionButtons let-row>
|
|
8151
|
+
@if (rowActionsTemplate(); as tpl) {
|
|
8152
|
+
<ng-container *ngTemplateOutlet="tpl; context: { $implicit: row }" />
|
|
8153
|
+
} @else {
|
|
8154
|
+
<div class="sol-data-table__action-group">
|
|
8155
|
+
@if (showEditAction()) {
|
|
8156
|
+
<sol-button variant="ghost" size="sm" (clicked)="editClicked.emit(row)">
|
|
8157
|
+
<sol-icon name="edit" size="sm" />
|
|
8158
|
+
</sol-button>
|
|
8159
|
+
}
|
|
8160
|
+
@if (showDeleteAction()) {
|
|
8161
|
+
<sol-button variant="ghost" size="sm" (clicked)="deleteClicked.emit(row)">
|
|
8162
|
+
<sol-icon name="trash" size="sm" class="text-red-500" />
|
|
8163
|
+
</sol-button>
|
|
8164
|
+
}
|
|
8165
|
+
</div>
|
|
8166
|
+
}
|
|
8167
|
+
</ng-template>
|
|
8168
|
+
|
|
8169
|
+
@if (mobileCollapse()) {
|
|
8170
|
+
<!-- Modo móvil colapsado: cada fila es [▶] título + subdato · chip de
|
|
8171
|
+
estado; el detalle despliega las columnas ocultas como pares
|
|
8172
|
+
clave/valor. -->
|
|
8173
|
+
@if (loadingVisible()) {
|
|
8174
|
+
<ul class="sol-data-table__cards">
|
|
8175
|
+
@for (i of skeletonRows; track i) {
|
|
8176
|
+
<li>
|
|
8177
|
+
<sol-skeleton variant="row" height="56px" />
|
|
8178
|
+
</li>
|
|
8179
|
+
}
|
|
8180
|
+
</ul>
|
|
8181
|
+
} @else {
|
|
8182
|
+
<ul class="sol-data-table__cards">
|
|
8183
|
+
@for (row of pagedData(); track trackId($index, row)) {
|
|
8184
|
+
<li class="sol-data-table__card">
|
|
8185
|
+
<button
|
|
8186
|
+
type="button"
|
|
8187
|
+
class="sol-data-table__card-head"
|
|
8188
|
+
[attr.aria-expanded]="isRowExpanded(trackId($index, row))"
|
|
8189
|
+
[attr.aria-label]="toggleDetailsLabel()"
|
|
8190
|
+
(click)="toggleRow(trackId($index, row))"
|
|
8191
|
+
data-testid="fila-colapsada"
|
|
8192
|
+
>
|
|
8193
|
+
<sol-icon
|
|
8194
|
+
name="chevron-right"
|
|
8195
|
+
size="sm"
|
|
8196
|
+
class="sol-data-table__card-chevron"
|
|
8197
|
+
[class.sol-data-table__card-chevron--open]="isRowExpanded(trackId($index, row))"
|
|
8198
|
+
/>
|
|
8199
|
+
<span class="sol-data-table__card-main">
|
|
8200
|
+
@if (mobileTitleCol(); as col) {
|
|
8201
|
+
<span class="sol-data-table__card-title">
|
|
8202
|
+
@if (col.cellTemplate) {
|
|
8203
|
+
<ng-container *ngTemplateOutlet="col.cellTemplate; context: { $implicit: resolveValue(row, col.key), row: row }" />
|
|
8204
|
+
} @else {
|
|
8205
|
+
{{ resolveValue(row, col.key) }}
|
|
8206
|
+
}
|
|
8207
|
+
</span>
|
|
8208
|
+
}
|
|
8209
|
+
@if (mobileSubtitleCol(); as col) {
|
|
8210
|
+
<span class="sol-data-table__card-sub">
|
|
8211
|
+
@if (col.cellTemplate) {
|
|
8212
|
+
<ng-container *ngTemplateOutlet="col.cellTemplate; context: { $implicit: resolveValue(row, col.key), row: row }" />
|
|
8213
|
+
} @else {
|
|
8214
|
+
{{ resolveValue(row, col.key) }}
|
|
8215
|
+
}
|
|
8216
|
+
</span>
|
|
8217
|
+
}
|
|
8218
|
+
</span>
|
|
8219
|
+
@if (mobileBadgeCol(); as col) {
|
|
8220
|
+
<span class="sol-data-table__card-chip">
|
|
8221
|
+
@if (col.cellTemplate) {
|
|
8222
|
+
<ng-container *ngTemplateOutlet="col.cellTemplate; context: { $implicit: resolveValue(row, col.key), row: row }" />
|
|
8223
|
+
} @else {
|
|
8224
|
+
{{ resolveValue(row, col.key) }}
|
|
8225
|
+
}
|
|
8226
|
+
</span>
|
|
8227
|
+
}
|
|
8228
|
+
</button>
|
|
8229
|
+
|
|
8230
|
+
@if (isRowExpanded(trackId($index, row))) {
|
|
8231
|
+
<div class="sol-data-table__card-details" data-testid="detalle-fila">
|
|
8232
|
+
<dl class="sol-data-table__card-kv-list">
|
|
8233
|
+
@for (col of mobileDetailCols(); track col.key) {
|
|
8234
|
+
<div class="sol-data-table__card-kv">
|
|
8235
|
+
<dt>{{ col.label }}</dt>
|
|
8236
|
+
<dd>
|
|
8237
|
+
@if (col.cellTemplate) {
|
|
8238
|
+
<ng-container *ngTemplateOutlet="col.cellTemplate; context: { $implicit: resolveValue(row, col.key), row: row }" />
|
|
8239
|
+
} @else {
|
|
8240
|
+
{{ resolveValue(row, col.key) }}
|
|
8241
|
+
}
|
|
8242
|
+
</dd>
|
|
8243
|
+
</div>
|
|
8244
|
+
}
|
|
8245
|
+
</dl>
|
|
8246
|
+
@if (showActions()) {
|
|
8247
|
+
<div class="sol-data-table__card-actions">
|
|
8248
|
+
<ng-container *ngTemplateOutlet="rowActionButtons; context: { $implicit: row }" />
|
|
8249
|
+
</div>
|
|
8250
|
+
}
|
|
8251
|
+
</div>
|
|
8252
|
+
}
|
|
8253
|
+
</li>
|
|
8254
|
+
} @empty {
|
|
8255
|
+
<li class="sol-data-table__empty">{{ emptyMessage() }}</li>
|
|
8256
|
+
}
|
|
8257
|
+
</ul>
|
|
8258
|
+
}
|
|
8259
|
+
} @else {
|
|
8260
|
+
<div class="sol-data-table__wrapper">
|
|
8261
|
+
<table class="sol-data-table__table">
|
|
8262
|
+
<thead>
|
|
8263
|
+
<tr>
|
|
8264
|
+
@for (col of columns(); track col.key) {
|
|
8265
|
+
<th
|
|
8266
|
+
class="sol-data-table__th"
|
|
8267
|
+
[style.width]="col.width || 'auto'"
|
|
8268
|
+
[class.sol-data-table__th--sortable]="col.sortable"
|
|
8269
|
+
(click)="col.sortable ? onSort(col.key) : null"
|
|
8270
|
+
>
|
|
8271
|
+
{{ col.label }}
|
|
8272
|
+
@if (col.sortable && sortKey() === col.key) {
|
|
8273
|
+
<span class="sol-data-table__sort-icon">
|
|
8274
|
+
{{ sortDirection() === 'asc' ? '↑' : '↓' }}
|
|
8275
|
+
</span>
|
|
8276
|
+
}
|
|
8277
|
+
</th>
|
|
8278
|
+
}
|
|
8279
|
+
@if (showActions()) {
|
|
8280
|
+
<th class="sol-data-table__th sol-data-table__th--actions">{{ actionsLabel() }}</th>
|
|
8281
|
+
}
|
|
8282
|
+
</tr>
|
|
8283
|
+
</thead>
|
|
8284
|
+
<tbody>
|
|
8285
|
+
@if (loadingVisible()) {
|
|
8286
|
+
@for (i of skeletonRows; track i) {
|
|
8287
|
+
<tr class="sol-data-table__tr">
|
|
8288
|
+
<td class="sol-data-table__td" [attr.colspan]="columns().length + (showActions() ? 1 : 0)">
|
|
8289
|
+
<sol-skeleton variant="row" />
|
|
8290
|
+
</td>
|
|
8291
|
+
</tr>
|
|
8292
|
+
}
|
|
8293
|
+
} @else {
|
|
8294
|
+
@for (row of pagedData(); track trackId($index, row)) {
|
|
8295
|
+
<tr class="sol-data-table__tr">
|
|
8296
|
+
@for (col of columns(); track col.key) {
|
|
8297
|
+
<td class="sol-data-table__td">
|
|
8298
|
+
@if (col.cellTemplate) {
|
|
8299
|
+
<ng-container *ngTemplateOutlet="col.cellTemplate; context: { $implicit: resolveValue(row, col.key), row: row }" />
|
|
8300
|
+
} @else {
|
|
8301
|
+
{{ resolveValue(row, col.key) }}
|
|
8302
|
+
}
|
|
8303
|
+
</td>
|
|
8304
|
+
}
|
|
8305
|
+
@if (showActions()) {
|
|
8306
|
+
<td class="sol-data-table__td sol-data-table__td--actions">
|
|
8307
|
+
<ng-container *ngTemplateOutlet="rowActionButtons; context: { $implicit: row }" />
|
|
8308
|
+
</td>
|
|
8309
|
+
}
|
|
8310
|
+
</tr>
|
|
8311
|
+
} @empty {
|
|
8312
|
+
<tr>
|
|
8313
|
+
<td class="sol-data-table__empty" [attr.colspan]="columns().length + (showActions() ? 1 : 0)">
|
|
8314
|
+
{{ emptyMessage() }}
|
|
8315
|
+
</td>
|
|
8316
|
+
</tr>
|
|
8317
|
+
}
|
|
8318
|
+
}
|
|
8319
|
+
</tbody>
|
|
8320
|
+
</table>
|
|
8321
|
+
</div>
|
|
8322
|
+
}
|
|
8323
|
+
</div>
|
|
8324
|
+
|
|
8325
|
+
@if (paginated() && !loadingVisible()) {
|
|
8326
|
+
<div class="sol-data-table__footer">
|
|
8327
|
+
<sol-pagination
|
|
8328
|
+
[totalItems]="filteredData().length"
|
|
8329
|
+
[pageSize]="pageSize()"
|
|
8330
|
+
[currentPage]="currentPage()"
|
|
8331
|
+
(pageChanged)="currentPage.set($event)"
|
|
8332
|
+
(pageSizeChanged)="onPageSizeChange($event)"
|
|
8333
|
+
/>
|
|
8334
|
+
</div>
|
|
8335
|
+
}
|
|
8336
|
+
`, 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:100px;text-align:center}.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}.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__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"] }]
|
|
8337
|
+
}], 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 }] }], editClicked: [{ type: i0.Output, args: ["editClicked"] }], deleteClicked: [{ type: i0.Output, args: ["deleteClicked"] }], rowActionsTemplate: [{ type: i0.ContentChild, args: ['rowActions', { isSignal: true }] }] } });
|
|
8338
|
+
/**
|
|
8339
|
+
* "Estira" una señal de carga a un tiempo mínimo visible (patrón anti-flash).
|
|
8340
|
+
* Con un backend rápido `loading` pasa a `false` en pocos ms y el skeleton
|
|
8341
|
+
* parpadea imperceptiblemente; este helper lo mantiene visible al menos
|
|
8342
|
+
* `minMs` desde que se encendió, sin agregar latencia real a los datos.
|
|
8343
|
+
* Debe invocarse en contexto de inyección (inicializador de campo).
|
|
8344
|
+
*/
|
|
8345
|
+
function stretchLoading(source, minMs = 450) {
|
|
8346
|
+
const visible = signal(source(), /* @ts-ignore */
|
|
8347
|
+
...(ngDevMode ? [{ debugName: "visible" }] : /* istanbul ignore next */ []));
|
|
8348
|
+
const destroyRef = inject(DestroyRef);
|
|
8349
|
+
let onSince = 0;
|
|
8350
|
+
let timer = null;
|
|
8351
|
+
const clear = () => {
|
|
8352
|
+
if (timer !== null) {
|
|
8353
|
+
clearTimeout(timer);
|
|
8354
|
+
timer = null;
|
|
8355
|
+
}
|
|
8356
|
+
};
|
|
8357
|
+
effect(() => {
|
|
8358
|
+
const loading = source();
|
|
8359
|
+
clear();
|
|
8360
|
+
if (loading) {
|
|
8361
|
+
onSince = Date.now();
|
|
8362
|
+
visible.set(true);
|
|
8363
|
+
return;
|
|
8364
|
+
}
|
|
8365
|
+
const elapsed = Date.now() - onSince;
|
|
8366
|
+
if (elapsed >= minMs) {
|
|
8367
|
+
visible.set(false);
|
|
8368
|
+
}
|
|
8369
|
+
else {
|
|
8370
|
+
timer = setTimeout(() => {
|
|
8371
|
+
visible.set(false);
|
|
8372
|
+
timer = null;
|
|
8373
|
+
}, minMs - elapsed);
|
|
8374
|
+
}
|
|
8375
|
+
});
|
|
8376
|
+
destroyRef.onDestroy(clear);
|
|
8377
|
+
return computed(() => visible());
|
|
8378
|
+
}
|
|
8379
|
+
/** Ancho canónico bajo el cual la tabla adopta su comportamiento móvil. */
|
|
8380
|
+
const MOBILE_MEDIA_QUERY = '(max-width: 767px)';
|
|
8381
|
+
/**
|
|
8382
|
+
* Señal booleana reactiva al viewport móvil. Debe invocarse en contexto de
|
|
8383
|
+
* inyección (inicializador de campo): usa `DestroyRef` para retirar el
|
|
8384
|
+
* listener. Guarda para jsdom/SSR: sin `matchMedia` queda en `false`
|
|
8385
|
+
* (comportamiento desktop).
|
|
8386
|
+
*/
|
|
8387
|
+
function observeMobileViewport() {
|
|
8388
|
+
const destroyRef = inject(DestroyRef);
|
|
8389
|
+
const matches = signal(false, /* @ts-ignore */
|
|
8390
|
+
...(ngDevMode ? [{ debugName: "matches" }] : /* istanbul ignore next */ []));
|
|
8391
|
+
if (typeof window === 'undefined' || typeof window.matchMedia !== 'function') {
|
|
8392
|
+
return matches.asReadonly();
|
|
8393
|
+
}
|
|
8394
|
+
const mediaQueryList = window.matchMedia(MOBILE_MEDIA_QUERY);
|
|
8395
|
+
matches.set(mediaQueryList.matches);
|
|
8396
|
+
if (typeof mediaQueryList.addEventListener === 'function') {
|
|
8397
|
+
const onChange = (event) => matches.set(event.matches);
|
|
8398
|
+
mediaQueryList.addEventListener('change', onChange);
|
|
8399
|
+
destroyRef.onDestroy(() => mediaQueryList.removeEventListener('change', onChange));
|
|
8400
|
+
}
|
|
8401
|
+
return matches.asReadonly();
|
|
8402
|
+
}
|
|
7201
8403
|
|
|
7202
8404
|
// Shared UI — atomic design system components
|
|
7203
8405
|
|
|
@@ -7209,5 +8411,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
7209
8411
|
* Generated bundle index. Do not edit.
|
|
7210
8412
|
*/
|
|
7211
8413
|
|
|
7212
|
-
export { EMIT_TABLE, SOL_CHART_ENGINE, SOL_DEFAULT_THEME, SOL_I18N, SOL_TENANT_RESOLVER, SolBadgeComponent, SolButtonComponent, SolCardComponent, SolChartComponent, SolCheckboxComponent, SolDatePickerComponent, SolDayPickerComponent, SolEmptyStateComponent, SolFileUploadComponent, SolFormFieldComponent, SolIconComponent, SolInputComponent, SolModalComponent, SolPaginationComponent, SolProgressBarComponent, SolRichEditorComponent, SolSearchInputComponent, SolSelectComponent, SolSkeletonComponent, SolSpinnerComponent, SolStepperComponent, SolTabsComponent, SolTextareaComponent, SolToggleComponent, SolTooltipComponent, SolViewToggleComponent, SolVirtualScrollComponent, SolWizardComponent, SolWizardStepDirective, TCPDF_ALLOWED_STYLE_PROPERTIES, TCPDF_ALLOWED_TAGS, THEME_SOURCE, ThemeService, buildGoogleFontsUrl, createIdentitySolI18n, isRenderableTheme, isSafeBackgroundImage, provideTheme, resolveCssVars, sanitizeAssetUrl, sanitizeHtmlToTcpdf, serializeElementToTcpdfHtml };
|
|
8414
|
+
export { EMIT_TABLE, SOL_CHART_ENGINE, SOL_DEFAULT_THEME, SOL_I18N, SOL_TENANT_RESOLVER, SolBadgeComponent, SolButtonComponent, SolCardComponent, SolChartComponent, SolCheckboxComponent, SolDataTableComponent, SolDatePickerComponent, SolDayPickerComponent, SolEmptyStateComponent, SolFileUploadComponent, SolFormFieldComponent, SolIconButtonComponent, SolIconComponent, SolInputComponent, SolModalComponent, SolPageHeaderComponent, SolPaginationComponent, SolProgressBarComponent, SolRichEditorComponent, SolSearchInputComponent, SolSelectComponent, SolSkeletonComponent, SolSpinnerComponent, SolStepperComponent, SolTabsComponent, SolTextareaComponent, SolToggleComponent, SolTooltipComponent, SolViewToggleComponent, SolVirtualScrollComponent, SolWizardComponent, SolWizardStepDirective, TCPDF_ALLOWED_STYLE_PROPERTIES, TCPDF_ALLOWED_TAGS, THEME_SOURCE, ThemeService, buildGoogleFontsUrl, createIdentitySolI18n, isRenderableTheme, isSafeBackgroundImage, provideTheme, resolveCssVars, sanitizeAssetUrl, sanitizeHtmlToTcpdf, serializeElementToTcpdfHtml };
|
|
7213
8415
|
//# sourceMappingURL=solercia-ui.mjs.map
|