@caribeng/ui 22.4.0 → 22.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (186) hide show
  1. package/README.md +311 -313
  2. package/fesm2022/caribeng-ui-account-picker.mjs +533 -0
  3. package/fesm2022/caribeng-ui-aging.mjs +488 -0
  4. package/fesm2022/{caribeng-ui-caribe-alert.mjs → caribeng-ui-alert.mjs} +45 -45
  5. package/fesm2022/caribeng-ui-amount.mjs +249 -0
  6. package/fesm2022/caribeng-ui-anchor.mjs +2 -2
  7. package/fesm2022/{caribeng-ui-caribe-animation-lottie.mjs → caribeng-ui-animation-lottie.mjs} +41 -41
  8. package/fesm2022/caribeng-ui-audit-log.mjs +323 -0
  9. package/fesm2022/caribeng-ui-avatar.mjs +2 -2
  10. package/fesm2022/caribeng-ui-breadcrumb.mjs +13 -3
  11. package/fesm2022/{caribeng-ui-caribe-button-group.mjs → caribeng-ui-button-group.mjs} +15 -15
  12. package/fesm2022/caribeng-ui-button.mjs +2 -2
  13. package/fesm2022/{caribeng-ui-caribe-card-content.mjs → caribeng-ui-card-content.mjs} +39 -39
  14. package/fesm2022/{caribeng-ui-caribe-card-move.mjs → caribeng-ui-card-move.mjs} +65 -65
  15. package/fesm2022/{caribeng-ui-caribe-card-primary.mjs → caribeng-ui-card-primary.mjs} +31 -31
  16. package/fesm2022/{caribeng-ui-caribe-card-select.mjs → caribeng-ui-card-select.mjs} +67 -67
  17. package/fesm2022/caribeng-ui-carousel.mjs +2 -2
  18. package/fesm2022/caribeng-ui-cascadeselect.mjs +45 -9
  19. package/fesm2022/caribeng-ui-chat.mjs +2 -2
  20. package/fesm2022/{caribeng-ui-caribe-coachmark.mjs → caribeng-ui-coachmark.mjs} +85 -85
  21. package/fesm2022/caribeng-ui-command-palette.mjs +2 -2
  22. package/fesm2022/caribeng-ui-comments.mjs +864 -0
  23. package/fesm2022/caribeng-ui-datagrid.mjs +1635 -0
  24. package/fesm2022/caribeng-ui-dataview.mjs +2 -2
  25. package/fesm2022/caribeng-ui-datepicker.mjs +2 -2
  26. package/fesm2022/caribeng-ui-document.mjs +495 -0
  27. package/fesm2022/{caribeng-ui-caribe-dots-indicator.mjs → caribeng-ui-dots-indicator.mjs} +41 -41
  28. package/fesm2022/caribeng-ui-dynamic-form.mjs +1581 -0
  29. package/fesm2022/caribeng-ui-editor.mjs +2303 -1311
  30. package/fesm2022/{caribeng-ui-caribe-expansion-panel.mjs → caribeng-ui-expansion-panel.mjs} +39 -39
  31. package/fesm2022/{caribeng-ui-caribe-fab-menu.mjs → caribeng-ui-fab-menu.mjs} +75 -75
  32. package/fesm2022/caribeng-ui-file-card.mjs +2 -2
  33. package/fesm2022/{caribeng-ui-caribe-file-download.mjs → caribeng-ui-file-download.mjs} +63 -63
  34. package/fesm2022/caribeng-ui-financial-report.mjs +380 -0
  35. package/fesm2022/{caribeng-ui-caribe-float-menu.mjs → caribeng-ui-float-menu.mjs} +31 -31
  36. package/fesm2022/caribeng-ui-floatlabel.mjs +2 -2
  37. package/fesm2022/caribeng-ui-flow.mjs +1508 -0
  38. package/fesm2022/{caribeng-ui-caribe-footer.mjs → caribeng-ui-footer.mjs} +19 -19
  39. package/fesm2022/caribeng-ui-gantt.mjs +1094 -0
  40. package/fesm2022/{caribeng-ui-caribe-header.mjs → caribeng-ui-header.mjs} +49 -49
  41. package/fesm2022/{caribeng-ui-caribe-icon-button.mjs → caribeng-ui-icon-button.mjs} +23 -23
  42. package/fesm2022/caribeng-ui-image-cropper.mjs +671 -0
  43. package/fesm2022/caribeng-ui-import-wizard.mjs +746 -0
  44. package/fesm2022/caribeng-ui-infinite-scroll.mjs +226 -0
  45. package/fesm2022/caribeng-ui-input-number.mjs +22 -6
  46. package/fesm2022/{caribeng-ui-caribe-input-search.mjs → caribeng-ui-input-search.mjs} +65 -65
  47. package/fesm2022/{caribeng-ui-caribe-input-token.mjs → caribeng-ui-input-token.mjs} +59 -59
  48. package/fesm2022/caribeng-ui-inputotp.mjs +2 -2
  49. package/fesm2022/caribeng-ui-journal-entry.mjs +340 -0
  50. package/fesm2022/caribeng-ui-kanban.mjs +6 -6
  51. package/fesm2022/caribeng-ui-kpi.mjs +189 -0
  52. package/fesm2022/{caribeng-ui-caribe-link.mjs → caribeng-ui-link.mjs} +37 -37
  53. package/fesm2022/caribeng-ui-masonry.mjs +93 -0
  54. package/fesm2022/caribeng-ui-media-player.mjs +821 -0
  55. package/fesm2022/caribeng-ui-mentions.mjs +2 -2
  56. package/fesm2022/caribeng-ui-notification-center.mjs +636 -0
  57. package/fesm2022/{caribeng-ui-caribe-off-canvas.mjs → caribeng-ui-off-canvas.mjs} +55 -55
  58. package/fesm2022/{caribeng-ui-caribe-onboarding.mjs → caribeng-ui-onboarding.mjs} +105 -105
  59. package/fesm2022/caribeng-ui-orderlist.mjs +2 -2
  60. package/fesm2022/caribeng-ui-pdfviewer.mjs +1755 -25
  61. package/fesm2022/caribeng-ui-period-picker.mjs +637 -0
  62. package/fesm2022/caribeng-ui-phone-input.mjs +2 -2
  63. package/fesm2022/caribeng-ui-picklist.mjs +2 -2
  64. package/fesm2022/caribeng-ui-pivot.mjs +419 -0
  65. package/fesm2022/caribeng-ui-pricing.mjs +2 -2
  66. package/fesm2022/caribeng-ui-rating.mjs +14 -17
  67. package/fesm2022/caribeng-ui-reconciliation.mjs +386 -0
  68. package/fesm2022/caribeng-ui-scheduler.mjs +1027 -0
  69. package/fesm2022/caribeng-ui-select.mjs +2 -2
  70. package/fesm2022/{caribeng-ui-caribe-shortcut.mjs → caribeng-ui-shortcut.mjs} +29 -29
  71. package/fesm2022/caribeng-ui-sidebar.mjs +2 -2
  72. package/fesm2022/caribeng-ui-signature-pad.mjs +654 -0
  73. package/fesm2022/{caribeng-ui-caribe-status.mjs → caribeng-ui-status.mjs} +11 -11
  74. package/fesm2022/{caribeng-ui-caribe-step-indicator.mjs → caribeng-ui-step-indicator.mjs} +53 -53
  75. package/fesm2022/caribeng-ui-stepper.mjs +2 -2
  76. package/fesm2022/caribeng-ui-steps.mjs +2 -2
  77. package/fesm2022/caribeng-ui-table.mjs +323 -15
  78. package/fesm2022/caribeng-ui-tabmenu.mjs +2 -2
  79. package/fesm2022/caribeng-ui-tabs.mjs +2 -2
  80. package/fesm2022/{caribeng-ui-caribe-tag-button.mjs → caribeng-ui-tag-button.mjs} +25 -25
  81. package/fesm2022/caribeng-ui-tag.mjs +2 -2
  82. package/fesm2022/caribeng-ui-tieredmenu.mjs +6 -6
  83. package/fesm2022/{caribeng-ui-caribe-tracker.mjs → caribeng-ui-tracker.mjs} +29 -29
  84. package/fesm2022/{caribeng-ui-caribe-transaction-status.mjs → caribeng-ui-transaction-status.mjs} +11 -11
  85. package/fesm2022/caribeng-ui-treeselect.mjs +44 -9
  86. package/fesm2022/caribeng-ui-treetable.mjs +236 -17
  87. package/fesm2022/{caribeng-ui-caribe-voucher.mjs → caribeng-ui-voucher.mjs} +45 -45
  88. package/fesm2022/caribeng-ui-xlsx.mjs +486 -0
  89. package/fesm2022/caribeng-ui.mjs +1181 -1
  90. package/package.json +217 -177
  91. package/types/caribeng-ui-account-picker.d.ts +142 -0
  92. package/types/caribeng-ui-aging.d.ts +123 -0
  93. package/types/{caribeng-ui-caribe-alert.d.ts → caribeng-ui-alert.d.ts} +2 -2
  94. package/types/caribeng-ui-amount.d.ts +82 -0
  95. package/types/{caribeng-ui-caribe-animation-lottie.d.ts → caribeng-ui-animation-lottie.d.ts} +2 -2
  96. package/types/caribeng-ui-audit-log.d.ts +86 -0
  97. package/types/caribeng-ui-breadcrumb.d.ts +2 -2
  98. package/types/{caribeng-ui-caribe-button-group.d.ts → caribeng-ui-button-group.d.ts} +2 -2
  99. package/types/{caribeng-ui-caribe-card-content.d.ts → caribeng-ui-card-content.d.ts} +2 -2
  100. package/types/{caribeng-ui-caribe-card-move.d.ts → caribeng-ui-card-move.d.ts} +1 -1
  101. package/types/{caribeng-ui-caribe-card-primary.d.ts → caribeng-ui-card-primary.d.ts} +2 -2
  102. package/types/{caribeng-ui-caribe-card-select.d.ts → caribeng-ui-card-select.d.ts} +2 -2
  103. package/types/caribeng-ui-cascadeselect.d.ts +6 -0
  104. package/types/{caribeng-ui-caribe-coachmark.d.ts → caribeng-ui-coachmark.d.ts} +2 -2
  105. package/types/caribeng-ui-comments.d.ts +214 -0
  106. package/types/caribeng-ui-datagrid.d.ts +269 -0
  107. package/types/caribeng-ui-document.d.ts +138 -0
  108. package/types/{caribeng-ui-caribe-dots-indicator.d.ts → caribeng-ui-dots-indicator.d.ts} +2 -2
  109. package/types/caribeng-ui-dynamic-form.d.ts +409 -0
  110. package/types/caribeng-ui-editor.d.ts +110 -12
  111. package/types/{caribeng-ui-caribe-expansion-panel.d.ts → caribeng-ui-expansion-panel.d.ts} +1 -1
  112. package/types/{caribeng-ui-caribe-fab-menu.d.ts → caribeng-ui-fab-menu.d.ts} +2 -2
  113. package/types/{caribeng-ui-caribe-file-download.d.ts → caribeng-ui-file-download.d.ts} +1 -1
  114. package/types/caribeng-ui-financial-report.d.ts +102 -0
  115. package/types/{caribeng-ui-caribe-float-menu.d.ts → caribeng-ui-float-menu.d.ts} +2 -2
  116. package/types/caribeng-ui-flow.d.ts +228 -0
  117. package/types/{caribeng-ui-caribe-footer.d.ts → caribeng-ui-footer.d.ts} +2 -2
  118. package/types/caribeng-ui-gantt.d.ts +244 -0
  119. package/types/{caribeng-ui-caribe-header.d.ts → caribeng-ui-header.d.ts} +2 -2
  120. package/types/{caribeng-ui-caribe-icon-button.d.ts → caribeng-ui-icon-button.d.ts} +2 -2
  121. package/types/{caribeng-ui-caribe-illustration.d.ts → caribeng-ui-illustration.d.ts} +1 -1
  122. package/types/caribeng-ui-image-cropper.d.ts +169 -0
  123. package/types/caribeng-ui-import-wizard.d.ts +149 -0
  124. package/types/caribeng-ui-infinite-scroll.d.ts +75 -0
  125. package/types/caribeng-ui-input-number.d.ts +1 -1
  126. package/types/{caribeng-ui-caribe-input-search.d.ts → caribeng-ui-input-search.d.ts} +2 -2
  127. package/types/{caribeng-ui-caribe-input-token.d.ts → caribeng-ui-input-token.d.ts} +2 -2
  128. package/types/caribeng-ui-journal-entry.d.ts +110 -0
  129. package/types/caribeng-ui-kpi.d.ts +64 -0
  130. package/types/{caribeng-ui-caribe-link.d.ts → caribeng-ui-link.d.ts} +2 -2
  131. package/types/{caribeng-ui-caribe-logo.d.ts → caribeng-ui-logo.d.ts} +1 -1
  132. package/types/caribeng-ui-masonry.d.ts +32 -0
  133. package/types/caribeng-ui-media-player.d.ts +140 -0
  134. package/types/caribeng-ui-notification-center.d.ts +153 -0
  135. package/types/{caribeng-ui-caribe-off-canvas.d.ts → caribeng-ui-off-canvas.d.ts} +2 -2
  136. package/types/{caribeng-ui-caribe-onboarding.d.ts → caribeng-ui-onboarding.d.ts} +2 -2
  137. package/types/caribeng-ui-pdfviewer.d.ts +245 -5
  138. package/types/caribeng-ui-period-picker.d.ts +148 -0
  139. package/types/caribeng-ui-pivot.d.ts +116 -0
  140. package/types/caribeng-ui-reconciliation.d.ts +109 -0
  141. package/types/caribeng-ui-scheduler.d.ts +188 -0
  142. package/types/{caribeng-ui-caribe-shortcut.d.ts → caribeng-ui-shortcut.d.ts} +2 -2
  143. package/types/caribeng-ui-signature-pad.d.ts +151 -0
  144. package/types/{caribeng-ui-caribe-status.d.ts → caribeng-ui-status.d.ts} +2 -2
  145. package/types/{caribeng-ui-caribe-step-indicator.d.ts → caribeng-ui-step-indicator.d.ts} +2 -2
  146. package/types/caribeng-ui-table.d.ts +66 -2
  147. package/types/{caribeng-ui-caribe-tag-button.d.ts → caribeng-ui-tag-button.d.ts} +2 -2
  148. package/types/{caribeng-ui-caribe-tracker.d.ts → caribeng-ui-tracker.d.ts} +2 -2
  149. package/types/{caribeng-ui-caribe-transaction-status.d.ts → caribeng-ui-transaction-status.d.ts} +2 -2
  150. package/types/caribeng-ui-treeselect.d.ts +6 -0
  151. package/types/caribeng-ui-treetable.d.ts +67 -2
  152. package/types/{caribeng-ui-caribe-voucher.d.ts → caribeng-ui-voucher.d.ts} +2 -2
  153. package/types/caribeng-ui-xlsx.d.ts +79 -0
  154. package/types/caribeng-ui.d.ts +711 -2
  155. package/fesm2022/caribeng-ui-caribe-calendar.mjs +0 -92
  156. package/fesm2022/caribeng-ui-caribe-circle-loading.mjs +0 -130
  157. package/fesm2022/caribeng-ui-caribe-data-table.mjs +0 -94
  158. package/fesm2022/caribeng-ui-caribe-file-select.mjs +0 -88
  159. package/fesm2022/caribeng-ui-caribe-inline-alert.mjs +0 -100
  160. package/fesm2022/caribeng-ui-caribe-input-date.mjs +0 -138
  161. package/fesm2022/caribeng-ui-caribe-input-select.mjs +0 -154
  162. package/fesm2022/caribeng-ui-caribe-loader.mjs +0 -48
  163. package/fesm2022/caribeng-ui-caribe-modal.mjs +0 -119
  164. package/fesm2022/caribeng-ui-caribe-pictogram.mjs +0 -52
  165. package/fesm2022/caribeng-ui-caribe-pop-over.mjs +0 -104
  166. package/fesm2022/caribeng-ui-caribe-preloader.mjs +0 -57
  167. package/fesm2022/caribeng-ui-caribe-progress-bar.mjs +0 -84
  168. package/fesm2022/caribeng-ui-caribe-stroke.mjs +0 -69
  169. package/fesm2022/caribeng-ui-caribe-switch.mjs +0 -182
  170. package/types/caribeng-ui-caribe-calendar.d.ts +0 -27
  171. package/types/caribeng-ui-caribe-circle-loading.d.ts +0 -28
  172. package/types/caribeng-ui-caribe-data-table.d.ts +0 -26
  173. package/types/caribeng-ui-caribe-file-select.d.ts +0 -31
  174. package/types/caribeng-ui-caribe-inline-alert.d.ts +0 -28
  175. package/types/caribeng-ui-caribe-input-date.d.ts +0 -40
  176. package/types/caribeng-ui-caribe-input-select.d.ts +0 -47
  177. package/types/caribeng-ui-caribe-loader.d.ts +0 -22
  178. package/types/caribeng-ui-caribe-modal.d.ts +0 -21
  179. package/types/caribeng-ui-caribe-pictogram.d.ts +0 -15
  180. package/types/caribeng-ui-caribe-pop-over.d.ts +0 -17
  181. package/types/caribeng-ui-caribe-preloader.d.ts +0 -24
  182. package/types/caribeng-ui-caribe-progress-bar.d.ts +0 -28
  183. package/types/caribeng-ui-caribe-stroke.d.ts +0 -17
  184. package/types/caribeng-ui-caribe-switch.d.ts +0 -55
  185. /package/fesm2022/{caribeng-ui-caribe-illustration.mjs → caribeng-ui-illustration.mjs} +0 -0
  186. /package/fesm2022/{caribeng-ui-caribe-logo.mjs → caribeng-ui-logo.mjs} +0 -0
@@ -1,8 +1,9 @@
1
1
  import { NgTemplateOutlet } from '@angular/common';
2
2
  import * as i0 from '@angular/core';
3
3
  import { input, inject, TemplateRef, Directive, ElementRef, output, contentChildren, signal, computed, ViewEncapsulation, ChangeDetectionStrategy, Component } from '@angular/core';
4
- import { injectCbTranslation, cbFormat } from '@caribeng/ui';
4
+ import { injectCbTranslation, cbFormat, CB_CONFIG, cbToNumber, cbFormatAmount, cbSummarize } from '@caribeng/ui';
5
5
  import { CbIcon } from '@caribeng/ui/icon';
6
+ import { currencySymbol, cbDownloadXlsx } from '@caribeng/ui/xlsx';
6
7
 
7
8
  /** Plantilla para las celdas de una columna (`cbTreeTableCell="campo"`). */
8
9
  class CbTreeTableCellTemplate {
@@ -45,10 +46,30 @@ class CbTreeTable {
45
46
  /** Nombre accesible de la tabla. */
46
47
  this.ariaLabel = input('', /* @ts-ignore */
47
48
  ...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
49
+ /**
50
+ * Las filas padre muestran, en las columnas con `summary`, el total de sus
51
+ * descendientes (p. ej. el saldo de una cuenta mayor a partir de sus auxiliares).
52
+ */
53
+ this.rollup = input(false, { ...(ngDevMode ? { debugName: "rollup" } : /* istanbul ignore next */ {}), transform: (v) => v !== false && v != null && `${v}` !== 'false' });
54
+ /** Moneda de las columnas `currency` (si no, la de `provideCaribeNG({ currency })`). */
55
+ this.currency = input(undefined, /* @ts-ignore */
56
+ ...(ngDevMode ? [{ debugName: "currency" }] : /* istanbul ignore next */ []));
57
+ /** Muestra el pie con los totales de las columnas con `summary`. */
58
+ this.showFooter = input(true, { ...(ngDevMode ? { debugName: "showFooter" } : /* istanbul ignore next */ {}), transform: (v) => v !== false && v != null && `${v}` !== 'false' });
59
+ /** Clases CSS extra por fila (p. ej. para filas de total). */
60
+ this.rowClass = input(null, /* @ts-ignore */
61
+ ...(ngDevMode ? [{ debugName: "rowClass" }] : /* istanbul ignore next */ []));
62
+ /** Las filas sin hijos se activan con clic o Enter (`nodeActivate`), p. ej. para ver sus movimientos. */
63
+ this.activateLeaves = input(false, { ...(ngDevMode ? { debugName: "activateLeaves" } : /* istanbul ignore next */ {}), transform: (v) => v !== false && v != null && `${v}` !== 'false' });
64
+ /** Negativos con signo o entre paréntesis (si no, el de `provideCaribeNG({ negativeStyle })`). */
65
+ this.negativeStyle = input(undefined, /* @ts-ignore */
66
+ ...(ngDevMode ? [{ debugName: "negativeStyle" }] : /* istanbul ignore next */ []));
48
67
  /** Se emite al expandir una fila. */
49
68
  this.nodeExpand = output();
50
69
  /** Se emite al contraer una fila. */
51
70
  this.nodeCollapse = output();
71
+ /** Con `activateLeaves`: clic o Enter sobre una fila sin hijos. */
72
+ this.nodeActivate = output();
52
73
  this.cellTemplates = contentChildren(CbTreeTableCellTemplate, /* @ts-ignore */
53
74
  ...(ngDevMode ? [{ debugName: "cellTemplates" }] : /* istanbul ignore next */ []));
54
75
  this.expanded = signal(new Set(), /* @ts-ignore */
@@ -69,6 +90,72 @@ class CbTreeTable {
69
90
  return out;
70
91
  }, /* @ts-ignore */
71
92
  ...(ngDevMode ? [{ debugName: "rows" }] : /* istanbul ignore next */ []));
93
+ this.config = inject(CB_CONFIG);
94
+ this.hasFooterText = computed(() => this.columns().some((c) => c.footer), /* @ts-ignore */
95
+ ...(ngDevMode ? [{ debugName: "hasFooterText" }] : /* istanbul ignore next */ []));
96
+ this.hasFooter = computed(() => this.hasFooterText() || this.columns().some((c) => c.summary), /* @ts-ignore */
97
+ ...(ngDevMode ? [{ debugName: "hasFooter" }] : /* istanbul ignore next */ []));
98
+ /** Columna de la etiqueta "Total": la primera sin total. */
99
+ this.labelColumn = computed(() => Math.max(0, this.columns().findIndex((c) => !c.summary)), /* @ts-ignore */
100
+ ...(ngDevMode ? [{ debugName: "labelColumn" }] : /* istanbul ignore next */ []));
101
+ /** Totales de cada nodo con hijos (sobre sus hojas), por columna con `summary`. */
102
+ this.aggregates = computed(() => {
103
+ const cols = this.columns().filter((c) => c.summary);
104
+ const out = new Map();
105
+ if (!cols.length)
106
+ return out;
107
+ const leavesOf = (node) => {
108
+ if (!node.children?.length)
109
+ return [node.data];
110
+ const leaves = node.children.flatMap(leavesOf);
111
+ out.set(node.key, this.summarize(cols, leaves));
112
+ return leaves;
113
+ };
114
+ const all = this.value().flatMap(leavesOf);
115
+ out.set('', this.summarize(cols, all));
116
+ return out;
117
+ }, /* @ts-ignore */
118
+ ...(ngDevMode ? [{ debugName: "aggregates" }] : /* istanbul ignore next */ []));
119
+ /** Totales del pie (sobre todas las hojas). */
120
+ this.totals = computed(() => this.aggregates().get('') ?? {}, /* @ts-ignore */
121
+ ...(ngDevMode ? [{ debugName: "totals" }] : /* istanbul ignore next */ []));
122
+ }
123
+ /**
124
+ * Hoja de Excel con todas las filas (también las contraídas) agrupadas por
125
+ * nivel con el esquema de Excel, sangría en la primera columna, filas padre en
126
+ * negrita (con sus totales si hay `rollup`) y el total al final.
127
+ */
128
+ toExcelSheet(options = {}) {
129
+ const cols = this.columns();
130
+ const locale = this.config.numberLocale ?? this.t().intlLocale;
131
+ const rows = [];
132
+ const walk = (nodes, level) => nodes.forEach((node) => {
133
+ const parent = !!node.children?.length;
134
+ rows.push({ level, indent: level, bold: parent, cells: cols.map((c) => (c.format && !this.isNumeric(c) ? c.format(this.valueOf(node, c), node) : this.valueOf(node, c))) });
135
+ if (parent)
136
+ walk(node.children, level + 1);
137
+ });
138
+ walk(this.value(), 0);
139
+ return {
140
+ name: options.sheetName ?? (this.ariaLabel() || 'Datos'),
141
+ title: options.title,
142
+ columns: cols.map((c) => {
143
+ const currency = c.currency ?? this.currency() ?? this.config.currency;
144
+ return {
145
+ header: c.header,
146
+ type: c.type === 'currency' ? (currency ? 'currency' : 'number') : c.type === 'number' ? 'number' : c.type === 'percent' ? 'percent' : 'text',
147
+ decimals: c.decimals,
148
+ negative: c.negative ?? this.negativeStyle() ?? this.config.negativeStyle,
149
+ symbol: c.type === 'currency' && currency ? currencySymbol(currency, locale) : undefined,
150
+ };
151
+ }),
152
+ rows,
153
+ totals: this.hasFooter() ? cols.map((c, i) => (c.footer ?? (i === this.labelColumn() && !this.hasFooterText() ? this.t().tableTotal : (this.totals()[c.field] ?? null)))) : undefined,
154
+ };
155
+ }
156
+ /** Descarga el árbol en Excel (`nombre.xlsx`), con los niveles plegables. */
157
+ exportExcel(filename = 'datos', options = {}) {
158
+ cbDownloadXlsx(filename, this.toExcelSheet(options));
72
159
  }
73
160
  /** Expande todas las filas. */
74
161
  expandAll() {
@@ -82,6 +169,18 @@ class CbTreeTable {
82
169
  walk(this.value());
83
170
  this.expanded.set(keys);
84
171
  }
172
+ /** Expande las filas hasta el nivel `level` (1 = solo las raíces visibles) y contrae el resto. */
173
+ expandToLevel(level) {
174
+ const keys = new Set();
175
+ const walk = (nodes, depth) => nodes.forEach((n) => {
176
+ if (n.children?.length && depth < level) {
177
+ keys.add(n.key);
178
+ walk(n.children, depth + 1);
179
+ }
180
+ });
181
+ walk(this.value(), 1);
182
+ this.expanded.set(keys);
183
+ }
85
184
  /** Contrae todas las filas. */
86
185
  collapseAll() {
87
186
  this.expanded.set(new Set());
@@ -100,9 +199,61 @@ class CbTreeTable {
100
199
  const field = this.columns()[0]?.field;
101
200
  return field ? String(node.data[field] ?? '') : node.key;
102
201
  }
202
+ /** Valor de una celda: el total de sus descendientes en las filas padre con `rollup`. */
203
+ valueOf(node, col) {
204
+ if (this.rollup() && col.summary && node.children?.length)
205
+ return this.aggregates().get(node.key)?.[col.field];
206
+ return node.data[col.field];
207
+ }
208
+ isNumeric(col) {
209
+ return col.type === 'number' || col.type === 'currency' || col.type === 'percent';
210
+ }
211
+ alignOf(col) {
212
+ return col.align || (this.isNumeric(col) ? 'right' : null);
213
+ }
214
+ isNegative(value, col) {
215
+ const n = this.isNumeric(col) ? cbToNumber(value) : null;
216
+ return n !== null && n < 0;
217
+ }
218
+ display(value, col, node) {
219
+ if (col.format)
220
+ return col.format(value, node);
221
+ return this.isNumeric(col) ? this.formatNumber(value, col) : value;
222
+ }
223
+ summaryText(value, col) {
224
+ if (value === undefined || value === null)
225
+ return '';
226
+ if (col.summary === 'count')
227
+ return cbFormatAmount(value, this.config.numberLocale ?? this.t().intlLocale, { decimals: 0 });
228
+ return String(this.display(value, col, null) ?? '');
229
+ }
230
+ summarize(cols, leaves) {
231
+ const out = {};
232
+ for (const col of cols) {
233
+ out[col.field] = typeof col.summary === 'function' ? col.summary(leaves) : cbSummarize(leaves.map((d) => d[col.field]), col.summary);
234
+ }
235
+ return out;
236
+ }
237
+ formatNumber(value, col) {
238
+ const locale = this.config.numberLocale ?? this.t().intlLocale;
239
+ const negative = col.negative ?? this.negativeStyle() ?? this.config.negativeStyle ?? 'minus';
240
+ if (col.type === 'percent') {
241
+ const n = cbToNumber(value);
242
+ if (n === null)
243
+ return value == null ? '' : String(value);
244
+ const text = new Intl.NumberFormat(locale, { style: 'percent', minimumFractionDigits: col.decimals ?? 0, maximumFractionDigits: col.decimals ?? 2 }).format(Math.abs(n));
245
+ return n < 0 ? (negative === 'parens' ? `(${text})` : `-${text}`) : text;
246
+ }
247
+ const currency = col.type === 'currency' ? (col.currency ?? this.currency() ?? this.config.currency ?? null) : null;
248
+ return cbFormatAmount(value, locale, { currency, decimals: col.decimals, negative });
249
+ }
103
250
  cellTemplate(field) {
104
251
  return this.cellTemplates().find((c) => c.field() === field)?.template ?? null;
105
252
  }
253
+ onRowClick(node) {
254
+ if (this.activateLeaves() && !this.hasChildren(node))
255
+ this.nodeActivate.emit(node);
256
+ }
106
257
  toggle(node) {
107
258
  this.setExpanded(node, !this.isExpanded(node));
108
259
  }
@@ -142,6 +293,8 @@ class CbTreeTable {
142
293
  case ' ':
143
294
  if (this.hasChildren(current.node))
144
295
  this.toggle(current.node);
296
+ else if (event.key === 'Enter' && this.activateLeaves())
297
+ this.nodeActivate.emit(current.node);
145
298
  break;
146
299
  default:
147
300
  return;
@@ -167,12 +320,12 @@ class CbTreeTable {
167
320
  (open ? this.nodeExpand : this.nodeCollapse).emit(node);
168
321
  }
169
322
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbTreeTable, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
170
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: CbTreeTable, isStandalone: true, selector: "cb-treetable", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, columns: { classPropertyName: "columns", publicName: "columns", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { nodeExpand: "nodeExpand", nodeCollapse: "nodeCollapse" }, host: { classAttribute: "cb-treetable-host" }, queries: [{ propertyName: "cellTemplates", predicate: CbTreeTableCellTemplate, isSignal: true }], ngImport: i0, template: `
323
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: CbTreeTable, isStandalone: true, selector: "cb-treetable", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, columns: { classPropertyName: "columns", publicName: "columns", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null }, rollup: { classPropertyName: "rollup", publicName: "rollup", isSignal: true, isRequired: false, transformFunction: null }, currency: { classPropertyName: "currency", publicName: "currency", isSignal: true, isRequired: false, transformFunction: null }, showFooter: { classPropertyName: "showFooter", publicName: "showFooter", isSignal: true, isRequired: false, transformFunction: null }, rowClass: { classPropertyName: "rowClass", publicName: "rowClass", isSignal: true, isRequired: false, transformFunction: null }, activateLeaves: { classPropertyName: "activateLeaves", publicName: "activateLeaves", isSignal: true, isRequired: false, transformFunction: null }, negativeStyle: { classPropertyName: "negativeStyle", publicName: "negativeStyle", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { nodeExpand: "nodeExpand", nodeCollapse: "nodeCollapse", nodeActivate: "nodeActivate" }, host: { classAttribute: "cb-treetable-host" }, queries: [{ propertyName: "cellTemplates", predicate: CbTreeTableCellTemplate, isSignal: true }], ngImport: i0, template: `
171
324
  <table class="cb-treetable" role="treegrid" [attr.aria-label]="ariaLabel() || null" (keydown)="onKeydown($event)">
172
325
  <thead>
173
326
  <tr>
174
327
  @for (col of columns(); track col.field) {
175
- <th scope="col">{{ col.header }}</th>
328
+ <th scope="col" [style.text-align]="alignOf(col)" [style.width]="col.width || null">{{ col.header }}</th>
176
329
  }
177
330
  </tr>
178
331
  </thead>
@@ -180,6 +333,10 @@ class CbTreeTable {
180
333
  @for (row of rows(); track row.node.key) {
181
334
  <tr
182
335
  class="cb-treetable__row"
336
+ [class]="rowClass()?.(row.node) ?? ''"
337
+ [class.cb-treetable__row--parent]="rollup() && hasChildren(row.node)"
338
+ [class.cb-treetable__row--activatable]="activateLeaves() && !hasChildren(row.node)"
339
+ (click)="onRowClick(row.node)"
183
340
  [id]="rowId(row.node)"
184
341
  [attr.aria-level]="row.level"
185
342
  [attr.aria-setsize]="row.setSize"
@@ -189,8 +346,14 @@ class CbTreeTable {
189
346
  (focus)="activeKey.set(row.node.key)"
190
347
  >
191
348
  @for (col of columns(); track col.field; let first = $first) {
192
- <td [class.cb-treetable__first]="first">
349
+ <td
350
+ [class.cb-treetable__first]="first"
351
+ [class.cb-treetable__num]="isNumeric(col)"
352
+ [class.cb-is-negative]="isNegative(valueOf(row.node, col), col)"
353
+ [style.text-align]="alignOf(col)"
354
+ >
193
355
  @if (first) {
356
+ <span class="cb-treetable__cell">
194
357
  <span
195
358
  class="cb-treetable__indent"
196
359
  [style.inline-size]="'calc(' + (row.level - 1) + ' * var(--cb-treetable-indent, 1.25rem))'"
@@ -209,19 +372,42 @@ class CbTreeTable {
209
372
  } @else {
210
373
  <span class="cb-treetable__spacer" aria-hidden="true"></span>
211
374
  }
212
- }
213
- @if (cellTemplate(col.field); as tpl) {
214
- <ng-container *ngTemplateOutlet="tpl; context: { $implicit: row.node.data[col.field], node: row.node, level: row.level }" />
375
+ <span class="cb-treetable__label">
376
+ <ng-container *ngTemplateOutlet="content; context: { row, col }" />
377
+ </span>
378
+ </span>
215
379
  } @else {
216
- {{ row.node.data[col.field] }}
380
+ <ng-container *ngTemplateOutlet="content; context: { row, col }" />
217
381
  }
218
382
  </td>
219
383
  }
220
384
  </tr>
221
385
  }
222
386
  </tbody>
387
+ <ng-template #content let-row="row" let-col="col">
388
+ @if (cellTemplate(col.field); as tpl) {
389
+ <ng-container *ngTemplateOutlet="tpl; context: { $implicit: valueOf(row.node, col), node: row.node, level: row.level }" />
390
+ } @else {
391
+ {{ display(valueOf(row.node, col), col, row.node) }}
392
+ }
393
+ </ng-template>
394
+ @if (showFooter() && hasFooter() && rows().length) {
395
+ <tfoot>
396
+ <tr class="cb-treetable__foot">
397
+ @for (col of columns(); track col.field; let c = $index) {
398
+ @if (col.footer || (c === labelColumn() && !hasFooterText())) {
399
+ <th scope="row" [style.text-align]="alignOf(col)">{{ col.footer || t().tableTotal }}</th>
400
+ } @else {
401
+ <td [class.cb-treetable__num]="isNumeric(col)" [class.cb-is-negative]="isNegative(totals()[col.field], col)" [style.text-align]="alignOf(col)">
402
+ {{ summaryText(totals()[col.field], col) }}
403
+ </td>
404
+ }
405
+ }
406
+ </tr>
407
+ </tfoot>
408
+ }
223
409
  </table>
224
- `, isInline: true, styles: [":host{display:block;overflow-x:auto;color:var(--cb-color-text);font-size:var(--cb-text-sm, .875rem)}.cb-treetable{width:100%;border-collapse:collapse}.cb-treetable th{padding:.65rem .85rem;text-align:left;font-size:var(--cb-text-xs, .75rem);font-weight:var(--cb-font-weight-semibold, 600);text-transform:uppercase;letter-spacing:.04em;color:var(--cb-color-text-muted);border-bottom:1px solid var(--cb-color-border)}.cb-treetable td{padding:.55rem .85rem;border-bottom:1px solid var(--cb-color-border);vertical-align:middle}.cb-treetable__row{outline:none;transition:background var(--cb-duration-fast, .12s) var(--cb-ease, ease)}.cb-treetable__row:hover{background:color-mix(in srgb,var(--cb-color-text) 4%,transparent)}.cb-treetable__row:focus-visible{box-shadow:inset 0 0 0 2px var(--cb-color-focus-ring, var(--cb-color-primary-500))}.cb-treetable__first{white-space:nowrap}.cb-treetable__indent,.cb-treetable__spacer{display:inline-block;vertical-align:middle}.cb-treetable__spacer{width:1.5rem}.cb-treetable__toggler{display:inline-flex;align-items:center;justify-content:center;width:1.5rem;height:1.5rem;margin-inline-end:.25rem;padding:0;vertical-align:middle;border:0;border-radius:var(--cb-radius-sm, 4px);background:transparent;color:var(--cb-color-text-muted);cursor:pointer}.cb-treetable__toggler:hover{color:var(--cb-color-text);background:color-mix(in srgb,var(--cb-color-text) 8%,transparent)}.cb-treetable__toggler cb-icon{transition:transform var(--cb-duration-fast, .12s) var(--cb-ease, ease)}.cb-treetable__toggler cb-icon.cb-is-open{transform:rotate(90deg)}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: CbIcon, selector: "cb-icon", inputs: ["name", "size", "spin", "ariaLabel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
410
+ `, isInline: true, styles: [":host{display:block;overflow-x:auto;container-type:inline-size;color:var(--cb-color-text);font-size:var(--cb-text-sm, .875rem)}.cb-treetable{width:100%;border-collapse:collapse}.cb-treetable th{padding:.65rem .85rem;text-align:left;font-size:var(--cb-text-xs, .75rem);font-weight:var(--cb-font-weight-semibold, 600);text-transform:uppercase;letter-spacing:.04em;color:var(--cb-color-text-muted);border-bottom:1px solid var(--cb-color-border)}.cb-treetable td{padding:.55rem .85rem;border-bottom:1px solid var(--cb-color-border);vertical-align:middle}.cb-treetable__row{outline:none;transition:background var(--cb-duration-fast, .12s) var(--cb-ease, ease)}.cb-treetable__row:hover{background:color-mix(in srgb,var(--cb-color-text) 4%,transparent)}.cb-treetable__row:focus-visible{box-shadow:inset 0 0 0 2px var(--cb-color-focus-ring, var(--cb-color-primary-500))}.cb-treetable__first{white-space:nowrap}.cb-treetable__cell{display:contents}.cb-treetable__indent,.cb-treetable__spacer{display:inline-block;vertical-align:middle}.cb-treetable__spacer{width:1.5rem}.cb-treetable__toggler{display:inline-flex;align-items:center;justify-content:center;width:1.5rem;height:1.5rem;margin-inline-end:.25rem;padding:0;vertical-align:middle;border:0;border-radius:var(--cb-radius-sm, 4px);background:transparent;color:var(--cb-color-text-muted);cursor:pointer}.cb-treetable__toggler:hover{color:var(--cb-color-text);background:color-mix(in srgb,var(--cb-color-text) 8%,transparent)}.cb-treetable__toggler cb-icon{transition:transform var(--cb-duration-fast, .12s) var(--cb-ease, ease)}.cb-treetable__toggler cb-icon.cb-is-open{transform:rotate(90deg)}.cb-treetable__num{font-variant-numeric:tabular-nums;white-space:nowrap}.cb-treetable .cb-is-negative{color:var(--cb-color-danger-text, #dc2626)}.cb-treetable__row--parent{font-weight:var(--cb-font-weight-semibold, 600)}.cb-treetable__foot>th,.cb-treetable__foot>td{padding:.65rem .85rem;border-top:2px solid var(--cb-color-border-strong);background:var(--cb-color-surface-subtle);color:var(--cb-color-text-strong, var(--cb-color-text));font-size:var(--cb-text-sm, .875rem);font-weight:var(--cb-font-weight-semibold, 600);text-transform:none;letter-spacing:0}.cb-treetable__row--activatable{cursor:pointer}@container (max-width: 40rem){.cb-treetable__first,.cb-treetable thead th:first-child,.cb-treetable__foot>:first-child{position:sticky;left:0;z-index:1;min-width:8rem;max-width:11rem;white-space:normal}.cb-treetable__first,.cb-treetable thead th:first-child{background-color:var(--cb-color-bg)}.cb-treetable__first{box-shadow:inset -1px 0 0 var(--cb-color-border)}.cb-treetable__cell{display:flex;align-items:center}.cb-treetable__indent,.cb-treetable__spacer,.cb-treetable__toggler{flex:none}.cb-treetable__label{flex:1;min-width:0}}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: CbIcon, selector: "cb-icon", inputs: ["name", "size", "spin", "ariaLabel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
225
411
  }
226
412
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbTreeTable, decorators: [{
227
413
  type: Component,
@@ -230,7 +416,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
230
416
  <thead>
231
417
  <tr>
232
418
  @for (col of columns(); track col.field) {
233
- <th scope="col">{{ col.header }}</th>
419
+ <th scope="col" [style.text-align]="alignOf(col)" [style.width]="col.width || null">{{ col.header }}</th>
234
420
  }
235
421
  </tr>
236
422
  </thead>
@@ -238,6 +424,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
238
424
  @for (row of rows(); track row.node.key) {
239
425
  <tr
240
426
  class="cb-treetable__row"
427
+ [class]="rowClass()?.(row.node) ?? ''"
428
+ [class.cb-treetable__row--parent]="rollup() && hasChildren(row.node)"
429
+ [class.cb-treetable__row--activatable]="activateLeaves() && !hasChildren(row.node)"
430
+ (click)="onRowClick(row.node)"
241
431
  [id]="rowId(row.node)"
242
432
  [attr.aria-level]="row.level"
243
433
  [attr.aria-setsize]="row.setSize"
@@ -247,8 +437,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
247
437
  (focus)="activeKey.set(row.node.key)"
248
438
  >
249
439
  @for (col of columns(); track col.field; let first = $first) {
250
- <td [class.cb-treetable__first]="first">
440
+ <td
441
+ [class.cb-treetable__first]="first"
442
+ [class.cb-treetable__num]="isNumeric(col)"
443
+ [class.cb-is-negative]="isNegative(valueOf(row.node, col), col)"
444
+ [style.text-align]="alignOf(col)"
445
+ >
251
446
  @if (first) {
447
+ <span class="cb-treetable__cell">
252
448
  <span
253
449
  class="cb-treetable__indent"
254
450
  [style.inline-size]="'calc(' + (row.level - 1) + ' * var(--cb-treetable-indent, 1.25rem))'"
@@ -267,20 +463,43 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
267
463
  } @else {
268
464
  <span class="cb-treetable__spacer" aria-hidden="true"></span>
269
465
  }
270
- }
271
- @if (cellTemplate(col.field); as tpl) {
272
- <ng-container *ngTemplateOutlet="tpl; context: { $implicit: row.node.data[col.field], node: row.node, level: row.level }" />
466
+ <span class="cb-treetable__label">
467
+ <ng-container *ngTemplateOutlet="content; context: { row, col }" />
468
+ </span>
469
+ </span>
273
470
  } @else {
274
- {{ row.node.data[col.field] }}
471
+ <ng-container *ngTemplateOutlet="content; context: { row, col }" />
275
472
  }
276
473
  </td>
277
474
  }
278
475
  </tr>
279
476
  }
280
477
  </tbody>
478
+ <ng-template #content let-row="row" let-col="col">
479
+ @if (cellTemplate(col.field); as tpl) {
480
+ <ng-container *ngTemplateOutlet="tpl; context: { $implicit: valueOf(row.node, col), node: row.node, level: row.level }" />
481
+ } @else {
482
+ {{ display(valueOf(row.node, col), col, row.node) }}
483
+ }
484
+ </ng-template>
485
+ @if (showFooter() && hasFooter() && rows().length) {
486
+ <tfoot>
487
+ <tr class="cb-treetable__foot">
488
+ @for (col of columns(); track col.field; let c = $index) {
489
+ @if (col.footer || (c === labelColumn() && !hasFooterText())) {
490
+ <th scope="row" [style.text-align]="alignOf(col)">{{ col.footer || t().tableTotal }}</th>
491
+ } @else {
492
+ <td [class.cb-treetable__num]="isNumeric(col)" [class.cb-is-negative]="isNegative(totals()[col.field], col)" [style.text-align]="alignOf(col)">
493
+ {{ summaryText(totals()[col.field], col) }}
494
+ </td>
495
+ }
496
+ }
497
+ </tr>
498
+ </tfoot>
499
+ }
281
500
  </table>
282
- `, styles: [":host{display:block;overflow-x:auto;color:var(--cb-color-text);font-size:var(--cb-text-sm, .875rem)}.cb-treetable{width:100%;border-collapse:collapse}.cb-treetable th{padding:.65rem .85rem;text-align:left;font-size:var(--cb-text-xs, .75rem);font-weight:var(--cb-font-weight-semibold, 600);text-transform:uppercase;letter-spacing:.04em;color:var(--cb-color-text-muted);border-bottom:1px solid var(--cb-color-border)}.cb-treetable td{padding:.55rem .85rem;border-bottom:1px solid var(--cb-color-border);vertical-align:middle}.cb-treetable__row{outline:none;transition:background var(--cb-duration-fast, .12s) var(--cb-ease, ease)}.cb-treetable__row:hover{background:color-mix(in srgb,var(--cb-color-text) 4%,transparent)}.cb-treetable__row:focus-visible{box-shadow:inset 0 0 0 2px var(--cb-color-focus-ring, var(--cb-color-primary-500))}.cb-treetable__first{white-space:nowrap}.cb-treetable__indent,.cb-treetable__spacer{display:inline-block;vertical-align:middle}.cb-treetable__spacer{width:1.5rem}.cb-treetable__toggler{display:inline-flex;align-items:center;justify-content:center;width:1.5rem;height:1.5rem;margin-inline-end:.25rem;padding:0;vertical-align:middle;border:0;border-radius:var(--cb-radius-sm, 4px);background:transparent;color:var(--cb-color-text-muted);cursor:pointer}.cb-treetable__toggler:hover{color:var(--cb-color-text);background:color-mix(in srgb,var(--cb-color-text) 8%,transparent)}.cb-treetable__toggler cb-icon{transition:transform var(--cb-duration-fast, .12s) var(--cb-ease, ease)}.cb-treetable__toggler cb-icon.cb-is-open{transform:rotate(90deg)}\n"] }]
283
- }], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }], columns: [{ type: i0.Input, args: [{ isSignal: true, alias: "columns", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], nodeExpand: [{ type: i0.Output, args: ["nodeExpand"] }], nodeCollapse: [{ type: i0.Output, args: ["nodeCollapse"] }], cellTemplates: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => CbTreeTableCellTemplate), { isSignal: true }] }] } });
501
+ `, styles: [":host{display:block;overflow-x:auto;container-type:inline-size;color:var(--cb-color-text);font-size:var(--cb-text-sm, .875rem)}.cb-treetable{width:100%;border-collapse:collapse}.cb-treetable th{padding:.65rem .85rem;text-align:left;font-size:var(--cb-text-xs, .75rem);font-weight:var(--cb-font-weight-semibold, 600);text-transform:uppercase;letter-spacing:.04em;color:var(--cb-color-text-muted);border-bottom:1px solid var(--cb-color-border)}.cb-treetable td{padding:.55rem .85rem;border-bottom:1px solid var(--cb-color-border);vertical-align:middle}.cb-treetable__row{outline:none;transition:background var(--cb-duration-fast, .12s) var(--cb-ease, ease)}.cb-treetable__row:hover{background:color-mix(in srgb,var(--cb-color-text) 4%,transparent)}.cb-treetable__row:focus-visible{box-shadow:inset 0 0 0 2px var(--cb-color-focus-ring, var(--cb-color-primary-500))}.cb-treetable__first{white-space:nowrap}.cb-treetable__cell{display:contents}.cb-treetable__indent,.cb-treetable__spacer{display:inline-block;vertical-align:middle}.cb-treetable__spacer{width:1.5rem}.cb-treetable__toggler{display:inline-flex;align-items:center;justify-content:center;width:1.5rem;height:1.5rem;margin-inline-end:.25rem;padding:0;vertical-align:middle;border:0;border-radius:var(--cb-radius-sm, 4px);background:transparent;color:var(--cb-color-text-muted);cursor:pointer}.cb-treetable__toggler:hover{color:var(--cb-color-text);background:color-mix(in srgb,var(--cb-color-text) 8%,transparent)}.cb-treetable__toggler cb-icon{transition:transform var(--cb-duration-fast, .12s) var(--cb-ease, ease)}.cb-treetable__toggler cb-icon.cb-is-open{transform:rotate(90deg)}.cb-treetable__num{font-variant-numeric:tabular-nums;white-space:nowrap}.cb-treetable .cb-is-negative{color:var(--cb-color-danger-text, #dc2626)}.cb-treetable__row--parent{font-weight:var(--cb-font-weight-semibold, 600)}.cb-treetable__foot>th,.cb-treetable__foot>td{padding:.65rem .85rem;border-top:2px solid var(--cb-color-border-strong);background:var(--cb-color-surface-subtle);color:var(--cb-color-text-strong, var(--cb-color-text));font-size:var(--cb-text-sm, .875rem);font-weight:var(--cb-font-weight-semibold, 600);text-transform:none;letter-spacing:0}.cb-treetable__row--activatable{cursor:pointer}@container (max-width: 40rem){.cb-treetable__first,.cb-treetable thead th:first-child,.cb-treetable__foot>:first-child{position:sticky;left:0;z-index:1;min-width:8rem;max-width:11rem;white-space:normal}.cb-treetable__first,.cb-treetable thead th:first-child{background-color:var(--cb-color-bg)}.cb-treetable__first{box-shadow:inset -1px 0 0 var(--cb-color-border)}.cb-treetable__cell{display:flex;align-items:center}.cb-treetable__indent,.cb-treetable__spacer,.cb-treetable__toggler{flex:none}.cb-treetable__label{flex:1;min-width:0}}\n"] }]
502
+ }], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }], columns: [{ type: i0.Input, args: [{ isSignal: true, alias: "columns", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], rollup: [{ type: i0.Input, args: [{ isSignal: true, alias: "rollup", required: false }] }], currency: [{ type: i0.Input, args: [{ isSignal: true, alias: "currency", required: false }] }], showFooter: [{ type: i0.Input, args: [{ isSignal: true, alias: "showFooter", required: false }] }], rowClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "rowClass", required: false }] }], activateLeaves: [{ type: i0.Input, args: [{ isSignal: true, alias: "activateLeaves", required: false }] }], negativeStyle: [{ type: i0.Input, args: [{ isSignal: true, alias: "negativeStyle", required: false }] }], nodeExpand: [{ type: i0.Output, args: ["nodeExpand"] }], nodeCollapse: [{ type: i0.Output, args: ["nodeCollapse"] }], nodeActivate: [{ type: i0.Output, args: ["nodeActivate"] }], cellTemplates: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => CbTreeTableCellTemplate), { isSignal: true }] }] } });
284
503
 
285
504
  /**
286
505
  * Generated bundle index. Do not edit.
@@ -3,7 +3,7 @@ import { input, output, ViewEncapsulation, ChangeDetectionStrategy, Component }
3
3
  import { injectCbTranslation } from '@caribeng/ui';
4
4
 
5
5
  /**
6
- * Voucher de Caribe Design: comprobante de operación con filas clave/valor y
6
+ * Voucher: comprobante de operación con filas clave/valor y
7
7
  * una acción para compartir.
8
8
  *
9
9
  * @example
@@ -24,53 +24,53 @@ class CbVoucher {
24
24
  this.copy = output();
25
25
  }
26
26
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbVoucher, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
27
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: CbVoucher, isStandalone: true, selector: "cb-voucher", inputs: { title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, rows: { classPropertyName: "rows", publicName: "rows", isSignal: true, isRequired: false, transformFunction: null }, actionLabel: { classPropertyName: "actionLabel", publicName: "actionLabel", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { copy: "copy" }, ngImport: i0, template: `
28
- <article class="cb-voucher">
29
- <header class="cb-voucher__head">
30
- <span class="cb-voucher__check" aria-hidden="true">✓</span>
31
- <h2 class="cb-voucher__title">{{ (title() ?? t().receipt) }}</h2>
32
- </header>
33
- <div class="cb-voucher__intro"><ng-content /></div>
34
- <dl class="cb-voucher__list">
35
- @for (row of rows(); track $index) {
36
- <div class="cb-voucher__row">
37
- <dt class="cb-voucher__label">{{ row.label }}</dt>
38
- <dd class="cb-voucher__value">{{ row.value }}</dd>
39
- </div>
40
- }
41
- </dl>
42
- <div class="cb-voucher__foot">
43
- <button type="button" class="cb-voucher__action" (click)="copy.emit()">
44
- {{ (actionLabel() ?? t().share) }}
45
- </button>
46
- </div>
47
- </article>
48
- `, isInline: true, styles: [":host{display:block;width:100%;max-width:22rem}.cb-voucher{display:flex;flex-direction:column;gap:var(--cb-space-4, 1rem);box-sizing:border-box;padding:var(--cb-space-5, 1.25rem);font-family:var(--cb-font-sans, inherit);color:var(--cb-color-text-strong, #0f172a);background-color:var(--cb-color-surface-0, #ffffff);border:1px solid var(--cb-color-border, #e2e8f0);border-radius:var(--cb-radius-lg, .75rem);box-shadow:var(--cb-shadow-sm, 0 1px 3px rgba(0, 0, 0, .08))}.cb-voucher__head{display:flex;flex-direction:column;align-items:center;gap:var(--cb-space-2, .5rem);text-align:center}.cb-voucher__check{display:inline-flex;align-items:center;justify-content:center;width:2.75rem;height:2.75rem;font-size:1.4rem;font-weight:var(--cb-font-weight-bold, 700);color:#fff;background-color:var(--cb-color-success-500, #16a34a);border-radius:var(--cb-radius-full, 999px)}.cb-voucher__title{margin:0;font-size:var(--cb-text-lg, 1.05rem);font-weight:var(--cb-font-weight-semibold, 600)}.cb-voucher__intro{font-size:var(--cb-text-sm, .875rem);color:var(--cb-color-text-muted, #64748b);text-align:center}.cb-voucher__intro:empty{display:none}.cb-voucher__list{margin:0;padding:var(--cb-space-3, .75rem) 0;border-top:1px dashed var(--cb-color-border, #e2e8f0);border-bottom:1px dashed var(--cb-color-border, #e2e8f0);display:flex;flex-direction:column;gap:var(--cb-space-3, .6rem)}.cb-voucher__row{display:flex;align-items:baseline;justify-content:space-between;gap:var(--cb-space-3, .75rem)}.cb-voucher__label{font-size:var(--cb-text-sm, .8125rem);color:var(--cb-color-text-muted, #64748b)}.cb-voucher__value{margin:0;font-size:var(--cb-text-sm, .875rem);font-weight:var(--cb-font-weight-medium, 500);text-align:right}.cb-voucher__foot{display:flex;justify-content:center}.cb-voucher__action{width:100%;padding:var(--cb-space-3, .65rem) var(--cb-space-4, 1rem);font:inherit;font-size:var(--cb-text-sm, .875rem);font-weight:var(--cb-font-weight-semibold, 600);color:var(--cb-color-primary-contrast, #ffffff);background-color:var(--cb-color-primary-600, #047857);border:none;border-radius:var(--cb-radius-md, .5rem);cursor:pointer;transition:background-color var(--cb-duration-fast, .12s) var(--cb-ease, ease)}.cb-voucher__action:hover{background-color:var(--cb-color-primary-700, #065f46)}:host-context([data-theme=\"dark\"]) .cb-voucher{color:var(--cb-color-surface-0, #f8fafc);background-color:var(--cb-color-surface-800, #1e293b);border-color:var(--cb-color-surface-600, #475569)}:host-context([data-theme=\"dark\"]) .cb-voucher__list{border-color:var(--cb-color-surface-600, #475569)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
27
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: CbVoucher, isStandalone: true, selector: "cb-voucher", inputs: { title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, rows: { classPropertyName: "rows", publicName: "rows", isSignal: true, isRequired: false, transformFunction: null }, actionLabel: { classPropertyName: "actionLabel", publicName: "actionLabel", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { copy: "copy" }, ngImport: i0, template: `
28
+ <article class="cb-voucher">
29
+ <header class="cb-voucher__head">
30
+ <span class="cb-voucher__check" aria-hidden="true">✓</span>
31
+ <h2 class="cb-voucher__title">{{ (title() ?? t().receipt) }}</h2>
32
+ </header>
33
+ <div class="cb-voucher__intro"><ng-content /></div>
34
+ <dl class="cb-voucher__list">
35
+ @for (row of rows(); track $index) {
36
+ <div class="cb-voucher__row">
37
+ <dt class="cb-voucher__label">{{ row.label }}</dt>
38
+ <dd class="cb-voucher__value">{{ row.value }}</dd>
39
+ </div>
40
+ }
41
+ </dl>
42
+ <div class="cb-voucher__foot">
43
+ <button type="button" class="cb-voucher__action" (click)="copy.emit()">
44
+ {{ (actionLabel() ?? t().share) }}
45
+ </button>
46
+ </div>
47
+ </article>
48
+ `, isInline: true, styles: [":host{display:block;width:100%;max-width:22rem}.cb-voucher{display:flex;flex-direction:column;gap:var(--cb-space-4, 1rem);box-sizing:border-box;padding:var(--cb-space-5, 1.25rem);font-family:var(--cb-font-sans, inherit);color:var(--cb-color-text-strong, #0f172a);background-color:var(--cb-color-surface-0, #ffffff);border:1px solid var(--cb-color-border, #e2e8f0);border-radius:var(--cb-radius-lg, .75rem);box-shadow:var(--cb-shadow-sm, 0 1px 3px rgba(0, 0, 0, .08))}.cb-voucher__head{display:flex;flex-direction:column;align-items:center;gap:var(--cb-space-2, .5rem);text-align:center}.cb-voucher__check{display:inline-flex;align-items:center;justify-content:center;width:2.75rem;height:2.75rem;font-size:1.4rem;font-weight:var(--cb-font-weight-bold, 700);color:#fff;background-color:var(--cb-color-success-500, #16a34a);border-radius:var(--cb-radius-full, 999px)}.cb-voucher__title{margin:0;font-size:var(--cb-text-lg, 1.05rem);font-weight:var(--cb-font-weight-semibold, 600)}.cb-voucher__intro{font-size:var(--cb-text-sm, .875rem);color:var(--cb-color-text-muted, #64748b);text-align:center}.cb-voucher__intro:empty{display:none}.cb-voucher__list{margin:0;padding:var(--cb-space-3, .75rem) 0;border-top:1px dashed var(--cb-color-border, #e2e8f0);border-bottom:1px dashed var(--cb-color-border, #e2e8f0);display:flex;flex-direction:column;gap:var(--cb-space-3, .6rem)}.cb-voucher__row{display:flex;align-items:baseline;justify-content:space-between;gap:var(--cb-space-3, .75rem)}.cb-voucher__label{font-size:var(--cb-text-sm, .8125rem);color:var(--cb-color-text-muted, #64748b)}.cb-voucher__value{margin:0;font-size:var(--cb-text-sm, .875rem);font-weight:var(--cb-font-weight-medium, 500);text-align:right}.cb-voucher__foot{display:flex;justify-content:center}.cb-voucher__action{width:100%;padding:var(--cb-space-3, .65rem) var(--cb-space-4, 1rem);font:inherit;font-size:var(--cb-text-sm, .875rem);font-weight:var(--cb-font-weight-semibold, 600);color:#fff;background-color:var(--cb-color-primary-700, #047857);border:none;border-radius:var(--cb-radius-md, .5rem);cursor:pointer;transition:background-color var(--cb-duration-fast, .12s) var(--cb-ease, ease)}.cb-voucher__action:hover{background-color:var(--cb-color-primary-700, #065f46)}:host-context([data-theme=\"dark\"]) .cb-voucher{color:var(--cb-color-surface-0, #f8fafc);background-color:var(--cb-color-surface-800, #1e293b);border-color:var(--cb-color-surface-600, #475569)}:host-context([data-theme=\"dark\"]) .cb-voucher__list{border-color:var(--cb-color-surface-600, #475569)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
49
49
  }
50
50
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbVoucher, decorators: [{
51
51
  type: Component,
52
- args: [{ selector: 'cb-voucher', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.Emulated, template: `
53
- <article class="cb-voucher">
54
- <header class="cb-voucher__head">
55
- <span class="cb-voucher__check" aria-hidden="true">✓</span>
56
- <h2 class="cb-voucher__title">{{ (title() ?? t().receipt) }}</h2>
57
- </header>
58
- <div class="cb-voucher__intro"><ng-content /></div>
59
- <dl class="cb-voucher__list">
60
- @for (row of rows(); track $index) {
61
- <div class="cb-voucher__row">
62
- <dt class="cb-voucher__label">{{ row.label }}</dt>
63
- <dd class="cb-voucher__value">{{ row.value }}</dd>
64
- </div>
65
- }
66
- </dl>
67
- <div class="cb-voucher__foot">
68
- <button type="button" class="cb-voucher__action" (click)="copy.emit()">
69
- {{ (actionLabel() ?? t().share) }}
70
- </button>
71
- </div>
72
- </article>
73
- `, styles: [":host{display:block;width:100%;max-width:22rem}.cb-voucher{display:flex;flex-direction:column;gap:var(--cb-space-4, 1rem);box-sizing:border-box;padding:var(--cb-space-5, 1.25rem);font-family:var(--cb-font-sans, inherit);color:var(--cb-color-text-strong, #0f172a);background-color:var(--cb-color-surface-0, #ffffff);border:1px solid var(--cb-color-border, #e2e8f0);border-radius:var(--cb-radius-lg, .75rem);box-shadow:var(--cb-shadow-sm, 0 1px 3px rgba(0, 0, 0, .08))}.cb-voucher__head{display:flex;flex-direction:column;align-items:center;gap:var(--cb-space-2, .5rem);text-align:center}.cb-voucher__check{display:inline-flex;align-items:center;justify-content:center;width:2.75rem;height:2.75rem;font-size:1.4rem;font-weight:var(--cb-font-weight-bold, 700);color:#fff;background-color:var(--cb-color-success-500, #16a34a);border-radius:var(--cb-radius-full, 999px)}.cb-voucher__title{margin:0;font-size:var(--cb-text-lg, 1.05rem);font-weight:var(--cb-font-weight-semibold, 600)}.cb-voucher__intro{font-size:var(--cb-text-sm, .875rem);color:var(--cb-color-text-muted, #64748b);text-align:center}.cb-voucher__intro:empty{display:none}.cb-voucher__list{margin:0;padding:var(--cb-space-3, .75rem) 0;border-top:1px dashed var(--cb-color-border, #e2e8f0);border-bottom:1px dashed var(--cb-color-border, #e2e8f0);display:flex;flex-direction:column;gap:var(--cb-space-3, .6rem)}.cb-voucher__row{display:flex;align-items:baseline;justify-content:space-between;gap:var(--cb-space-3, .75rem)}.cb-voucher__label{font-size:var(--cb-text-sm, .8125rem);color:var(--cb-color-text-muted, #64748b)}.cb-voucher__value{margin:0;font-size:var(--cb-text-sm, .875rem);font-weight:var(--cb-font-weight-medium, 500);text-align:right}.cb-voucher__foot{display:flex;justify-content:center}.cb-voucher__action{width:100%;padding:var(--cb-space-3, .65rem) var(--cb-space-4, 1rem);font:inherit;font-size:var(--cb-text-sm, .875rem);font-weight:var(--cb-font-weight-semibold, 600);color:var(--cb-color-primary-contrast, #ffffff);background-color:var(--cb-color-primary-600, #047857);border:none;border-radius:var(--cb-radius-md, .5rem);cursor:pointer;transition:background-color var(--cb-duration-fast, .12s) var(--cb-ease, ease)}.cb-voucher__action:hover{background-color:var(--cb-color-primary-700, #065f46)}:host-context([data-theme=\"dark\"]) .cb-voucher{color:var(--cb-color-surface-0, #f8fafc);background-color:var(--cb-color-surface-800, #1e293b);border-color:var(--cb-color-surface-600, #475569)}:host-context([data-theme=\"dark\"]) .cb-voucher__list{border-color:var(--cb-color-surface-600, #475569)}\n"] }]
52
+ args: [{ selector: 'cb-voucher', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.Emulated, template: `
53
+ <article class="cb-voucher">
54
+ <header class="cb-voucher__head">
55
+ <span class="cb-voucher__check" aria-hidden="true">✓</span>
56
+ <h2 class="cb-voucher__title">{{ (title() ?? t().receipt) }}</h2>
57
+ </header>
58
+ <div class="cb-voucher__intro"><ng-content /></div>
59
+ <dl class="cb-voucher__list">
60
+ @for (row of rows(); track $index) {
61
+ <div class="cb-voucher__row">
62
+ <dt class="cb-voucher__label">{{ row.label }}</dt>
63
+ <dd class="cb-voucher__value">{{ row.value }}</dd>
64
+ </div>
65
+ }
66
+ </dl>
67
+ <div class="cb-voucher__foot">
68
+ <button type="button" class="cb-voucher__action" (click)="copy.emit()">
69
+ {{ (actionLabel() ?? t().share) }}
70
+ </button>
71
+ </div>
72
+ </article>
73
+ `, styles: [":host{display:block;width:100%;max-width:22rem}.cb-voucher{display:flex;flex-direction:column;gap:var(--cb-space-4, 1rem);box-sizing:border-box;padding:var(--cb-space-5, 1.25rem);font-family:var(--cb-font-sans, inherit);color:var(--cb-color-text-strong, #0f172a);background-color:var(--cb-color-surface-0, #ffffff);border:1px solid var(--cb-color-border, #e2e8f0);border-radius:var(--cb-radius-lg, .75rem);box-shadow:var(--cb-shadow-sm, 0 1px 3px rgba(0, 0, 0, .08))}.cb-voucher__head{display:flex;flex-direction:column;align-items:center;gap:var(--cb-space-2, .5rem);text-align:center}.cb-voucher__check{display:inline-flex;align-items:center;justify-content:center;width:2.75rem;height:2.75rem;font-size:1.4rem;font-weight:var(--cb-font-weight-bold, 700);color:#fff;background-color:var(--cb-color-success-500, #16a34a);border-radius:var(--cb-radius-full, 999px)}.cb-voucher__title{margin:0;font-size:var(--cb-text-lg, 1.05rem);font-weight:var(--cb-font-weight-semibold, 600)}.cb-voucher__intro{font-size:var(--cb-text-sm, .875rem);color:var(--cb-color-text-muted, #64748b);text-align:center}.cb-voucher__intro:empty{display:none}.cb-voucher__list{margin:0;padding:var(--cb-space-3, .75rem) 0;border-top:1px dashed var(--cb-color-border, #e2e8f0);border-bottom:1px dashed var(--cb-color-border, #e2e8f0);display:flex;flex-direction:column;gap:var(--cb-space-3, .6rem)}.cb-voucher__row{display:flex;align-items:baseline;justify-content:space-between;gap:var(--cb-space-3, .75rem)}.cb-voucher__label{font-size:var(--cb-text-sm, .8125rem);color:var(--cb-color-text-muted, #64748b)}.cb-voucher__value{margin:0;font-size:var(--cb-text-sm, .875rem);font-weight:var(--cb-font-weight-medium, 500);text-align:right}.cb-voucher__foot{display:flex;justify-content:center}.cb-voucher__action{width:100%;padding:var(--cb-space-3, .65rem) var(--cb-space-4, 1rem);font:inherit;font-size:var(--cb-text-sm, .875rem);font-weight:var(--cb-font-weight-semibold, 600);color:#fff;background-color:var(--cb-color-primary-700, #047857);border:none;border-radius:var(--cb-radius-md, .5rem);cursor:pointer;transition:background-color var(--cb-duration-fast, .12s) var(--cb-ease, ease)}.cb-voucher__action:hover{background-color:var(--cb-color-primary-700, #065f46)}:host-context([data-theme=\"dark\"]) .cb-voucher{color:var(--cb-color-surface-0, #f8fafc);background-color:var(--cb-color-surface-800, #1e293b);border-color:var(--cb-color-surface-600, #475569)}:host-context([data-theme=\"dark\"]) .cb-voucher__list{border-color:var(--cb-color-surface-600, #475569)}\n"] }]
74
74
  }], propDecorators: { title: [{ type: i0.Input, args: [{ isSignal: true, alias: "title", required: false }] }], rows: [{ type: i0.Input, args: [{ isSignal: true, alias: "rows", required: false }] }], actionLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "actionLabel", required: false }] }], copy: [{ type: i0.Output, args: ["copy"] }] } });
75
75
 
76
76
  /**