@caribeng/ui 22.1.1 → 22.2.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 (253) hide show
  1. package/README.md +48 -8
  2. package/fesm2022/caribeng-ui-accordion.mjs +2 -2
  3. package/fesm2022/caribeng-ui-anchor.mjs +169 -0
  4. package/fesm2022/caribeng-ui-autocomplete.mjs +10 -8
  5. package/fesm2022/caribeng-ui-avatargroup.mjs +9 -3
  6. package/fesm2022/caribeng-ui-blockui.mjs +12 -4
  7. package/fesm2022/caribeng-ui-breadcrumb.mjs +5 -2
  8. package/fesm2022/caribeng-ui-button.mjs +22 -2
  9. package/fesm2022/caribeng-ui-caribe-alert.mjs +5 -2
  10. package/fesm2022/caribeng-ui-caribe-animation-lottie.mjs +6 -3
  11. package/fesm2022/caribeng-ui-caribe-button-group.mjs +6 -3
  12. package/fesm2022/caribeng-ui-caribe-calendar.mjs +11 -6
  13. package/fesm2022/caribeng-ui-caribe-card-content.mjs +6 -3
  14. package/fesm2022/caribeng-ui-caribe-card-move.mjs +29 -7
  15. package/fesm2022/caribeng-ui-caribe-card-select.mjs +56 -14
  16. package/fesm2022/caribeng-ui-caribe-circle-loading.mjs +10 -7
  17. package/fesm2022/caribeng-ui-caribe-coachmark.mjs +42 -19
  18. package/fesm2022/caribeng-ui-caribe-data-table.mjs +15 -9
  19. package/fesm2022/caribeng-ui-caribe-dots-indicator.mjs +38 -5
  20. package/fesm2022/caribeng-ui-caribe-expansion-panel.mjs +16 -5
  21. package/fesm2022/caribeng-ui-caribe-fab-menu.mjs +56 -7
  22. package/fesm2022/caribeng-ui-caribe-file-download.mjs +68 -27
  23. package/fesm2022/caribeng-ui-caribe-file-select.mjs +22 -17
  24. package/fesm2022/caribeng-ui-caribe-float-menu.mjs +6 -3
  25. package/fesm2022/caribeng-ui-caribe-footer.mjs +8 -4
  26. package/fesm2022/caribeng-ui-caribe-header.mjs +6 -3
  27. package/fesm2022/caribeng-ui-caribe-icon-button.mjs +6 -3
  28. package/fesm2022/caribeng-ui-caribe-illustration.mjs +6 -3
  29. package/fesm2022/caribeng-ui-caribe-inline-alert.mjs +5 -2
  30. package/fesm2022/caribeng-ui-caribe-input-search.mjs +14 -10
  31. package/fesm2022/caribeng-ui-caribe-input-select.mjs +12 -10
  32. package/fesm2022/caribeng-ui-caribe-input-token.mjs +61 -11
  33. package/fesm2022/caribeng-ui-caribe-link.mjs +7 -2
  34. package/fesm2022/caribeng-ui-caribe-loader.mjs +8 -5
  35. package/fesm2022/caribeng-ui-caribe-modal.mjs +32 -16
  36. package/fesm2022/caribeng-ui-caribe-off-canvas.mjs +26 -12
  37. package/fesm2022/caribeng-ui-caribe-onboarding.mjs +44 -19
  38. package/fesm2022/caribeng-ui-caribe-pictogram.mjs +6 -3
  39. package/fesm2022/caribeng-ui-caribe-pop-over.mjs +34 -10
  40. package/fesm2022/caribeng-ui-caribe-preloader.mjs +9 -6
  41. package/fesm2022/caribeng-ui-caribe-progress-bar.mjs +5 -2
  42. package/fesm2022/caribeng-ui-caribe-shortcut.mjs +8 -3
  43. package/fesm2022/caribeng-ui-caribe-step-indicator.mjs +12 -5
  44. package/fesm2022/caribeng-ui-caribe-stroke.mjs +6 -3
  45. package/fesm2022/caribeng-ui-caribe-switch.mjs +5 -3
  46. package/fesm2022/caribeng-ui-caribe-tag-button.mjs +1 -1
  47. package/fesm2022/caribeng-ui-caribe-tracker.mjs +5 -2
  48. package/fesm2022/caribeng-ui-caribe-transaction-status.mjs +1 -1
  49. package/fesm2022/caribeng-ui-caribe-voucher.mjs +11 -8
  50. package/fesm2022/caribeng-ui-carousel.mjs +49 -14
  51. package/fesm2022/caribeng-ui-cascadeselect.mjs +22 -8
  52. package/fesm2022/caribeng-ui-chart.mjs +2598 -303
  53. package/fesm2022/caribeng-ui-chip.mjs +9 -4
  54. package/fesm2022/caribeng-ui-chips.mjs +9 -5
  55. package/fesm2022/caribeng-ui-colorpicker.mjs +9 -7
  56. package/fesm2022/caribeng-ui-confirmdialog.mjs +74 -9
  57. package/fesm2022/caribeng-ui-confirmpopup.mjs +134 -9
  58. package/fesm2022/caribeng-ui-contextmenu.mjs +6 -3
  59. package/fesm2022/caribeng-ui-dataview.mjs +211 -6
  60. package/fesm2022/caribeng-ui-datepicker.mjs +1630 -393
  61. package/fesm2022/caribeng-ui-descriptions.mjs +124 -0
  62. package/fesm2022/caribeng-ui-dialog.mjs +10 -7
  63. package/fesm2022/caribeng-ui-dock.mjs +6 -3
  64. package/fesm2022/caribeng-ui-drawer.mjs +10 -7
  65. package/fesm2022/caribeng-ui-dynamicdialog.mjs +210 -6
  66. package/fesm2022/caribeng-ui-editor.mjs +4392 -243
  67. package/fesm2022/caribeng-ui-empty.mjs +80 -0
  68. package/fesm2022/caribeng-ui-file-card.mjs +2 -2
  69. package/fesm2022/caribeng-ui-fileupload.mjs +96 -19
  70. package/fesm2022/caribeng-ui-floatlabel.mjs +4 -2
  71. package/fesm2022/caribeng-ui-folder-card.mjs +10 -3
  72. package/fesm2022/caribeng-ui-galleria.mjs +76 -45
  73. package/fesm2022/caribeng-ui-image.mjs +52 -29
  74. package/fesm2022/caribeng-ui-inplace.mjs +22 -6
  75. package/fesm2022/caribeng-ui-input-number.mjs +9 -7
  76. package/fesm2022/caribeng-ui-inputgroup.mjs +2 -2
  77. package/fesm2022/caribeng-ui-inputmask.mjs +14 -11
  78. package/fesm2022/caribeng-ui-inputotp.mjs +12 -6
  79. package/fesm2022/caribeng-ui-keyfilter.mjs +72 -0
  80. package/fesm2022/caribeng-ui-listbox.mjs +13 -11
  81. package/fesm2022/caribeng-ui-megamenu.mjs +222 -30
  82. package/fesm2022/caribeng-ui-menu.mjs +11 -5
  83. package/fesm2022/caribeng-ui-menubar.mjs +10 -5
  84. package/fesm2022/caribeng-ui-message.mjs +7 -4
  85. package/fesm2022/caribeng-ui-metergroup.mjs +29 -11
  86. package/fesm2022/caribeng-ui-multiselect.mjs +399 -97
  87. package/fesm2022/caribeng-ui-orderlist.mjs +230 -11
  88. package/fesm2022/caribeng-ui-organizationchart.mjs +12 -7
  89. package/fesm2022/caribeng-ui-paginator.mjs +18 -15
  90. package/fesm2022/caribeng-ui-panel.mjs +5 -2
  91. package/fesm2022/caribeng-ui-panelmenu.mjs +6 -3
  92. package/fesm2022/caribeng-ui-password.mjs +8 -6
  93. package/fesm2022/caribeng-ui-pdfviewer.mjs +1553 -0
  94. package/fesm2022/caribeng-ui-picklist.mjs +251 -14
  95. package/fesm2022/caribeng-ui-pricing.mjs +17 -14
  96. package/fesm2022/caribeng-ui-rating.mjs +7 -3
  97. package/fesm2022/caribeng-ui-repeater.mjs +223 -0
  98. package/fesm2022/caribeng-ui-result.mjs +91 -0
  99. package/fesm2022/caribeng-ui-scrollpanel.mjs +6 -3
  100. package/fesm2022/caribeng-ui-scrolltop.mjs +6 -3
  101. package/fesm2022/caribeng-ui-select.mjs +379 -87
  102. package/fesm2022/caribeng-ui-selectbutton.mjs +2 -2
  103. package/fesm2022/caribeng-ui-slider.mjs +171 -75
  104. package/fesm2022/caribeng-ui-speeddial.mjs +7 -4
  105. package/fesm2022/caribeng-ui-spinner.mjs +5 -2
  106. package/fesm2022/caribeng-ui-splitbutton.mjs +163 -0
  107. package/fesm2022/caribeng-ui-splitter.mjs +5 -2
  108. package/fesm2022/caribeng-ui-statistic.mjs +183 -0
  109. package/fesm2022/caribeng-ui-stepper.mjs +8 -5
  110. package/fesm2022/caribeng-ui-steps.mjs +6 -3
  111. package/fesm2022/caribeng-ui-table.mjs +708 -82
  112. package/fesm2022/caribeng-ui-tabmenu.mjs +6 -3
  113. package/fesm2022/caribeng-ui-tag.mjs +2 -2
  114. package/fesm2022/caribeng-ui-terminal.mjs +45 -9
  115. package/fesm2022/caribeng-ui-themetoggle.mjs +82 -0
  116. package/fesm2022/caribeng-ui-tieredmenu.mjs +9 -6
  117. package/fesm2022/caribeng-ui-timeline.mjs +175 -6
  118. package/fesm2022/caribeng-ui-toast.mjs +7 -4
  119. package/fesm2022/caribeng-ui-togglebutton.mjs +8 -6
  120. package/fesm2022/caribeng-ui-toolbar.mjs +6 -3
  121. package/fesm2022/caribeng-ui-tree.mjs +302 -6
  122. package/fesm2022/caribeng-ui-treeselect.mjs +26 -10
  123. package/fesm2022/caribeng-ui-treetable.mjs +269 -6
  124. package/fesm2022/caribeng-ui-virtualscroller.mjs +123 -10
  125. package/fesm2022/caribeng-ui.mjs +829 -6
  126. package/package.json +53 -3
  127. package/schematics/collection.json +10 -0
  128. package/schematics/ng-add/index.js +125 -0
  129. package/schematics/ng-add/schema.js +2 -0
  130. package/schematics/ng-add/schema.json +66 -0
  131. package/styles/caribeng.css +380 -0
  132. package/styles/scss/_mixins.scss +46 -0
  133. package/styles/scss/_overlay.scss +15 -0
  134. package/styles/scss/_tokens.scss +267 -0
  135. package/styles/scss/_utilities.scss +73 -0
  136. package/styles/scss/_variables.scss +33 -0
  137. package/styles/scss/index.scss +16 -0
  138. package/types/caribeng-ui-anchor.d.ts +50 -0
  139. package/types/caribeng-ui-autocomplete.d.ts +4 -2
  140. package/types/caribeng-ui-avatargroup.d.ts +3 -1
  141. package/types/caribeng-ui-blockui.d.ts +9 -4
  142. package/types/caribeng-ui-breadcrumb.d.ts +3 -0
  143. package/types/caribeng-ui-button.d.ts +9 -1
  144. package/types/caribeng-ui-caribe-alert.d.ts +3 -0
  145. package/types/caribeng-ui-caribe-animation-lottie.d.ts +4 -1
  146. package/types/caribeng-ui-caribe-button-group.d.ts +4 -1
  147. package/types/caribeng-ui-caribe-calendar.d.ts +5 -1
  148. package/types/caribeng-ui-caribe-card-content.d.ts +4 -1
  149. package/types/caribeng-ui-caribe-card-move.d.ts +13 -13
  150. package/types/caribeng-ui-caribe-card-select.d.ts +10 -1
  151. package/types/caribeng-ui-caribe-circle-loading.d.ts +4 -1
  152. package/types/caribeng-ui-caribe-coachmark.d.ts +6 -0
  153. package/types/caribeng-ui-caribe-data-table.d.ts +7 -2
  154. package/types/caribeng-ui-caribe-dots-indicator.d.ts +9 -0
  155. package/types/caribeng-ui-caribe-expansion-panel.d.ts +7 -10
  156. package/types/caribeng-ui-caribe-fab-menu.d.ts +10 -1
  157. package/types/caribeng-ui-caribe-file-download.d.ts +8 -10
  158. package/types/caribeng-ui-caribe-file-select.d.ts +7 -1
  159. package/types/caribeng-ui-caribe-float-menu.d.ts +4 -1
  160. package/types/caribeng-ui-caribe-header.d.ts +3 -0
  161. package/types/caribeng-ui-caribe-icon-button.d.ts +4 -1
  162. package/types/caribeng-ui-caribe-illustration.d.ts +4 -1
  163. package/types/caribeng-ui-caribe-inline-alert.d.ts +3 -0
  164. package/types/caribeng-ui-caribe-input-search.d.ts +4 -2
  165. package/types/caribeng-ui-caribe-input-select.d.ts +4 -2
  166. package/types/caribeng-ui-caribe-input-token.d.ts +16 -1
  167. package/types/caribeng-ui-caribe-link.d.ts +3 -0
  168. package/types/caribeng-ui-caribe-loader.d.ts +4 -1
  169. package/types/caribeng-ui-caribe-modal.d.ts +7 -10
  170. package/types/caribeng-ui-caribe-off-canvas.d.ts +6 -1
  171. package/types/caribeng-ui-caribe-onboarding.d.ts +6 -0
  172. package/types/caribeng-ui-caribe-pictogram.d.ts +4 -1
  173. package/types/caribeng-ui-caribe-pop-over.d.ts +7 -10
  174. package/types/caribeng-ui-caribe-preloader.d.ts +4 -1
  175. package/types/caribeng-ui-caribe-progress-bar.d.ts +3 -0
  176. package/types/caribeng-ui-caribe-shortcut.d.ts +3 -1
  177. package/types/caribeng-ui-caribe-step-indicator.d.ts +6 -0
  178. package/types/caribeng-ui-caribe-stroke.d.ts +4 -1
  179. package/types/caribeng-ui-caribe-switch.d.ts +3 -1
  180. package/types/caribeng-ui-caribe-tracker.d.ts +3 -0
  181. package/types/caribeng-ui-caribe-voucher.d.ts +5 -2
  182. package/types/caribeng-ui-carousel.d.ts +10 -1
  183. package/types/caribeng-ui-cascadeselect.d.ts +7 -2
  184. package/types/caribeng-ui-chart.d.ts +469 -44
  185. package/types/caribeng-ui-chip.d.ts +6 -0
  186. package/types/caribeng-ui-chips.d.ts +6 -2
  187. package/types/caribeng-ui-colorpicker.d.ts +3 -1
  188. package/types/caribeng-ui-confirmdialog.d.ts +25 -6
  189. package/types/caribeng-ui-confirmpopup.d.ts +37 -5
  190. package/types/caribeng-ui-contextmenu.d.ts +4 -1
  191. package/types/caribeng-ui-dataview.d.ts +63 -5
  192. package/types/caribeng-ui-datepicker.d.ts +186 -21
  193. package/types/caribeng-ui-descriptions.d.ts +63 -0
  194. package/types/caribeng-ui-dialog.d.ts +4 -1
  195. package/types/caribeng-ui-dock.d.ts +4 -1
  196. package/types/caribeng-ui-drawer.d.ts +4 -1
  197. package/types/caribeng-ui-dynamicdialog.d.ts +93 -3
  198. package/types/caribeng-ui-editor.d.ts +486 -13
  199. package/types/caribeng-ui-empty.d.ts +34 -0
  200. package/types/caribeng-ui-file-card.d.ts +1 -1
  201. package/types/caribeng-ui-fileupload.d.ts +27 -4
  202. package/types/caribeng-ui-folder-card.d.ts +4 -1
  203. package/types/caribeng-ui-galleria.d.ts +9 -0
  204. package/types/caribeng-ui-image.d.ts +10 -0
  205. package/types/caribeng-ui-inplace.d.ts +8 -0
  206. package/types/caribeng-ui-input-number.d.ts +3 -1
  207. package/types/caribeng-ui-inputmask.d.ts +5 -0
  208. package/types/caribeng-ui-inputotp.d.ts +7 -2
  209. package/types/caribeng-ui-keyfilter.d.ts +30 -0
  210. package/types/caribeng-ui-listbox.d.ts +5 -3
  211. package/types/caribeng-ui-megamenu.d.ts +26 -2
  212. package/types/caribeng-ui-menu.d.ts +7 -2
  213. package/types/caribeng-ui-menubar.d.ts +5 -1
  214. package/types/caribeng-ui-message.d.ts +3 -0
  215. package/types/caribeng-ui-metergroup.d.ts +9 -1
  216. package/types/caribeng-ui-multiselect.d.ts +71 -10
  217. package/types/caribeng-ui-orderlist.d.ts +58 -6
  218. package/types/caribeng-ui-organizationchart.d.ts +7 -1
  219. package/types/caribeng-ui-paginator.d.ts +3 -0
  220. package/types/caribeng-ui-panel.d.ts +3 -0
  221. package/types/caribeng-ui-panelmenu.d.ts +4 -1
  222. package/types/caribeng-ui-password.d.ts +4 -2
  223. package/types/caribeng-ui-pdfviewer.d.ts +258 -0
  224. package/types/caribeng-ui-picklist.d.ts +67 -7
  225. package/types/caribeng-ui-pricing.d.ts +8 -5
  226. package/types/caribeng-ui-rating.d.ts +6 -2
  227. package/types/caribeng-ui-repeater.d.ts +79 -0
  228. package/types/caribeng-ui-result.d.ts +35 -0
  229. package/types/caribeng-ui-scrollpanel.d.ts +4 -1
  230. package/types/caribeng-ui-scrolltop.d.ts +4 -1
  231. package/types/caribeng-ui-select.d.ts +73 -9
  232. package/types/caribeng-ui-slider.d.ts +63 -10
  233. package/types/caribeng-ui-speeddial.d.ts +5 -2
  234. package/types/caribeng-ui-spinner.d.ts +3 -0
  235. package/types/caribeng-ui-splitbutton.d.ts +49 -0
  236. package/types/caribeng-ui-splitter.d.ts +3 -0
  237. package/types/caribeng-ui-statistic.d.ts +65 -0
  238. package/types/caribeng-ui-stepper.d.ts +3 -0
  239. package/types/caribeng-ui-steps.d.ts +4 -1
  240. package/types/caribeng-ui-table.d.ts +184 -16
  241. package/types/caribeng-ui-tabmenu.d.ts +4 -1
  242. package/types/caribeng-ui-terminal.d.ts +10 -0
  243. package/types/caribeng-ui-themetoggle.d.ts +32 -0
  244. package/types/caribeng-ui-tieredmenu.d.ts +5 -2
  245. package/types/caribeng-ui-timeline.d.ts +63 -4
  246. package/types/caribeng-ui-toast.d.ts +3 -0
  247. package/types/caribeng-ui-togglebutton.d.ts +5 -3
  248. package/types/caribeng-ui-toolbar.d.ts +7 -4
  249. package/types/caribeng-ui-tree.d.ts +76 -4
  250. package/types/caribeng-ui-treeselect.d.ts +10 -2
  251. package/types/caribeng-ui-treetable.d.ts +68 -4
  252. package/types/caribeng-ui-virtualscroller.d.ts +45 -5
  253. package/types/caribeng-ui.d.ts +501 -12
@@ -1,26 +1,289 @@
1
+ import { NgTemplateOutlet } from '@angular/common';
1
2
  import * as i0 from '@angular/core';
2
- import { input, signal, ChangeDetectionStrategy, Component } from '@angular/core';
3
+ import { input, inject, TemplateRef, Directive, ElementRef, output, contentChildren, signal, computed, ViewEncapsulation, ChangeDetectionStrategy, Component } from '@angular/core';
4
+ import { injectCbTranslation, cbFormat } from '@caribeng/ui';
5
+ import { CbIcon } from '@caribeng/ui/icon';
3
6
 
7
+ /** Plantilla para las celdas de una columna (`cbTreeTableCell="campo"`). */
8
+ class CbTreeTableCellTemplate {
9
+ constructor() {
10
+ this.field = input.required({ ...(ngDevMode ? { debugName: "field" } : /* istanbul ignore next */ {}), alias: 'cbTreeTableCell' });
11
+ this.template = inject(TemplateRef);
12
+ }
13
+ static ngTemplateContextGuard(_dir, ctx) {
14
+ return true;
15
+ }
16
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbTreeTableCellTemplate, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
17
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.5", type: CbTreeTableCellTemplate, isStandalone: true, selector: "ng-template[cbTreeTableCell]", inputs: { field: { classPropertyName: "field", publicName: "cbTreeTableCell", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0 }); }
18
+ }
19
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbTreeTableCellTemplate, decorators: [{
20
+ type: Directive,
21
+ args: [{ selector: 'ng-template[cbTreeTableCell]' }]
22
+ }], propDecorators: { field: [{ type: i0.Input, args: [{ isSignal: true, alias: "cbTreeTableCell", required: true }] }] } });
23
+ let nextUid = 0;
24
+ /**
25
+ * Tabla jerárquica de CaribeNG (patrón *treegrid* de WAI-ARIA): niveles
26
+ * ilimitados con sangría, filas expandibles y navegación con teclado.
27
+ *
28
+ * @example
29
+ * ```html
30
+ * <cb-treetable [value]="nodes" [columns]="columns" ariaLabel="Archivos" />
31
+ * ```
32
+ */
4
33
  class CbTreeTable {
5
34
  constructor() {
35
+ this.t = injectCbTranslation();
36
+ this.fmt = cbFormat;
37
+ this.host = inject(ElementRef);
38
+ this.uid = `cb-treetable-${++nextUid}`;
39
+ /** Nodos raíz. */
6
40
  this.value = input([], /* @ts-ignore */
7
41
  ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
42
+ /** Columnas; la primera muestra la jerarquía. */
8
43
  this.columns = input([], /* @ts-ignore */
9
44
  ...(ngDevMode ? [{ debugName: "columns" }] : /* istanbul ignore next */ []));
45
+ /** Nombre accesible de la tabla. */
46
+ this.ariaLabel = input('', /* @ts-ignore */
47
+ ...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
48
+ /** Se emite al expandir una fila. */
49
+ this.nodeExpand = output();
50
+ /** Se emite al contraer una fila. */
51
+ this.nodeCollapse = output();
52
+ this.cellTemplates = contentChildren(CbTreeTableCellTemplate, /* @ts-ignore */
53
+ ...(ngDevMode ? [{ debugName: "cellTemplates" }] : /* istanbul ignore next */ []));
10
54
  this.expanded = signal(new Set(), /* @ts-ignore */
11
55
  ...(ngDevMode ? [{ debugName: "expanded" }] : /* istanbul ignore next */ []));
56
+ this.activeKey = signal(null, /* @ts-ignore */
57
+ ...(ngDevMode ? [{ debugName: "activeKey" }] : /* istanbul ignore next */ []));
58
+ this.tabbableKey = computed(() => this.activeKey() ?? this.value()[0]?.key ?? null, /* @ts-ignore */
59
+ ...(ngDevMode ? [{ debugName: "tabbableKey" }] : /* istanbul ignore next */ []));
60
+ /** Filas visibles: las de las ramas expandidas, en orden. */
61
+ this.rows = computed(() => {
62
+ const out = [];
63
+ const walk = (nodes, level, parentKey) => nodes.forEach((node, i) => {
64
+ out.push({ node, level, parentKey, setSize: nodes.length, posInSet: i + 1 });
65
+ if (node.children?.length && this.expanded().has(node.key))
66
+ walk(node.children, level + 1, node.key);
67
+ });
68
+ walk(this.value(), 1, null);
69
+ return out;
70
+ }, /* @ts-ignore */
71
+ ...(ngDevMode ? [{ debugName: "rows" }] : /* istanbul ignore next */ []));
72
+ }
73
+ /** Expande todas las filas. */
74
+ expandAll() {
75
+ const keys = new Set();
76
+ const walk = (nodes) => nodes.forEach((n) => {
77
+ if (n.children?.length) {
78
+ keys.add(n.key);
79
+ walk(n.children);
80
+ }
81
+ });
82
+ walk(this.value());
83
+ this.expanded.set(keys);
84
+ }
85
+ /** Contrae todas las filas. */
86
+ collapseAll() {
87
+ this.expanded.set(new Set());
88
+ }
89
+ hasChildren(node) {
90
+ return !!node.children?.length;
91
+ }
92
+ isExpanded(node) {
93
+ return this.expanded().has(node.key);
94
+ }
95
+ rowId(node) {
96
+ return `${this.uid}-${node.key}`;
97
+ }
98
+ /** Texto de la primera columna, para las etiquetas accesibles. */
99
+ label(node) {
100
+ const field = this.columns()[0]?.field;
101
+ return field ? String(node.data[field] ?? '') : node.key;
102
+ }
103
+ cellTemplate(field) {
104
+ return this.cellTemplates().find((c) => c.field() === field)?.template ?? null;
105
+ }
106
+ toggle(node) {
107
+ this.setExpanded(node, !this.isExpanded(node));
108
+ }
109
+ onKeydown(event) {
110
+ const rows = this.rows();
111
+ const index = rows.findIndex((r) => r.node.key === this.tabbableKey());
112
+ if (index < 0)
113
+ return;
114
+ const current = rows[index];
115
+ let target;
116
+ switch (event.key) {
117
+ case 'ArrowDown':
118
+ target = rows[index + 1];
119
+ break;
120
+ case 'ArrowUp':
121
+ target = rows[index - 1];
122
+ break;
123
+ case 'Home':
124
+ target = rows[0];
125
+ break;
126
+ case 'End':
127
+ target = rows[rows.length - 1];
128
+ break;
129
+ case 'ArrowRight':
130
+ if (this.hasChildren(current.node) && !this.isExpanded(current.node))
131
+ this.setExpanded(current.node, true);
132
+ else if (this.isExpanded(current.node))
133
+ target = rows[index + 1];
134
+ break;
135
+ case 'ArrowLeft':
136
+ if (this.isExpanded(current.node))
137
+ this.setExpanded(current.node, false);
138
+ else if (current.parentKey)
139
+ target = rows.find((r) => r.node.key === current.parentKey);
140
+ break;
141
+ case 'Enter':
142
+ case ' ':
143
+ if (this.hasChildren(current.node))
144
+ this.toggle(current.node);
145
+ break;
146
+ default:
147
+ return;
148
+ }
149
+ event.preventDefault();
150
+ if (target) {
151
+ this.activeKey.set(target.node.key);
152
+ const id = this.rowId(target.node);
153
+ Array.from(this.host.nativeElement.querySelectorAll('tr[id]'))
154
+ .find((el) => el.id === id)
155
+ ?.focus();
156
+ }
157
+ }
158
+ setExpanded(node, open) {
159
+ if (open === this.isExpanded(node))
160
+ return;
161
+ const next = new Set(this.expanded());
162
+ if (open)
163
+ next.add(node.key);
164
+ else
165
+ next.delete(node.key);
166
+ this.expanded.set(next);
167
+ (open ? this.nodeExpand : this.nodeCollapse).emit(node);
12
168
  }
13
- toggle(k) { const n = new Set(this.expanded()); n.has(k) ? n.delete(k) : n.add(k); this.expanded.set(n); }
14
169
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbTreeTable, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
15
- 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 } }, ngImport: i0, template: `<table class="cb-treetable"><thead><tr>@for(col of columns();track col.field){<th>{{col.header}}</th>}</tr></thead><tbody>@for(node of value();track node.key){<tr><td>@if(node.children?.length){<button type="button" (click)="toggle(node.key)" [attr.aria-label]="expanded().has(node.key)?'Contraer':'Expandir'">{{expanded().has(node.key)?'−':'+'}}</button>}@for(col of columns();track col.field){<span [style.padding-left.px]="$first?12:0">{{node.data[col.field]}}</span>}</td>@for(col of columns().slice(1);track col.field){<td>{{node.data[col.field]}}</td>}</tr>@if(node.children?.length&&expanded().has(node.key)){@for(child of node.children;track child.key){<tr><td>@for(col of columns();track col.field){<span>{{child.data[col.field]}}</span>}</td>@for(col of columns().slice(1);track col.field){<td>{{child.data[col.field]}}</td>}</tr>}}}</tbody></table>`, isInline: true, styles: [":host{display:block;overflow:auto}.cb-treetable{width:100%;border-collapse:collapse;color:var(--cb-color-text,#111827)}th,td{padding:.7rem;text-align:left;border-bottom:1px solid var(--cb-color-border,#d1d5db)}button{margin-right:.5rem}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
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: `
171
+ <table class="cb-treetable" role="treegrid" [attr.aria-label]="ariaLabel() || null" (keydown)="onKeydown($event)">
172
+ <thead>
173
+ <tr>
174
+ @for (col of columns(); track col.field) {
175
+ <th scope="col">{{ col.header }}</th>
176
+ }
177
+ </tr>
178
+ </thead>
179
+ <tbody>
180
+ @for (row of rows(); track row.node.key) {
181
+ <tr
182
+ class="cb-treetable__row"
183
+ [id]="rowId(row.node)"
184
+ [attr.aria-level]="row.level"
185
+ [attr.aria-setsize]="row.setSize"
186
+ [attr.aria-posinset]="row.posInSet"
187
+ [attr.aria-expanded]="hasChildren(row.node) ? isExpanded(row.node) : null"
188
+ [attr.tabindex]="row.node.key === tabbableKey() ? 0 : -1"
189
+ (focus)="activeKey.set(row.node.key)"
190
+ >
191
+ @for (col of columns(); track col.field; let first = $first) {
192
+ <td [class.cb-treetable__first]="first">
193
+ @if (first) {
194
+ <span
195
+ class="cb-treetable__indent"
196
+ [style.inline-size]="'calc(' + (row.level - 1) + ' * var(--cb-treetable-indent, 1.25rem))'"
197
+ aria-hidden="true"
198
+ ></span>
199
+ @if (hasChildren(row.node)) {
200
+ <button
201
+ type="button"
202
+ class="cb-treetable__toggler"
203
+ tabindex="-1"
204
+ [attr.aria-label]="fmt(isExpanded(row.node) ? t().collapseItem : t().expandItem, label(row.node))"
205
+ (click)="toggle(row.node)"
206
+ >
207
+ <cb-icon name="chevron-right" [size]="14" [class.cb-is-open]="isExpanded(row.node)" aria-hidden="true" />
208
+ </button>
209
+ } @else {
210
+ <span class="cb-treetable__spacer" aria-hidden="true"></span>
211
+ }
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 }" />
215
+ } @else {
216
+ {{ row.node.data[col.field] }}
217
+ }
218
+ </td>
219
+ }
220
+ </tr>
221
+ }
222
+ </tbody>
223
+ </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 }); }
16
225
  }
17
226
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbTreeTable, decorators: [{
18
227
  type: Component,
19
- args: [{ selector: 'cb-treetable', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, template: `<table class="cb-treetable"><thead><tr>@for(col of columns();track col.field){<th>{{col.header}}</th>}</tr></thead><tbody>@for(node of value();track node.key){<tr><td>@if(node.children?.length){<button type="button" (click)="toggle(node.key)" [attr.aria-label]="expanded().has(node.key)?'Contraer':'Expandir'">{{expanded().has(node.key)?'−':'+'}}</button>}@for(col of columns();track col.field){<span [style.padding-left.px]="$first?12:0">{{node.data[col.field]}}</span>}</td>@for(col of columns().slice(1);track col.field){<td>{{node.data[col.field]}}</td>}</tr>@if(node.children?.length&&expanded().has(node.key)){@for(child of node.children;track child.key){<tr><td>@for(col of columns();track col.field){<span>{{child.data[col.field]}}</span>}</td>@for(col of columns().slice(1);track col.field){<td>{{child.data[col.field]}}</td>}</tr>}}}</tbody></table>`, styles: [":host{display:block;overflow:auto}.cb-treetable{width:100%;border-collapse:collapse;color:var(--cb-color-text,#111827)}th,td{padding:.7rem;text-align:left;border-bottom:1px solid var(--cb-color-border,#d1d5db)}button{margin-right:.5rem}\n"] }]
20
- }], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }], columns: [{ type: i0.Input, args: [{ isSignal: true, alias: "columns", required: false }] }] } });
228
+ args: [{ selector: 'cb-treetable', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.Emulated, imports: [NgTemplateOutlet, CbIcon], host: { class: 'cb-treetable-host' }, template: `
229
+ <table class="cb-treetable" role="treegrid" [attr.aria-label]="ariaLabel() || null" (keydown)="onKeydown($event)">
230
+ <thead>
231
+ <tr>
232
+ @for (col of columns(); track col.field) {
233
+ <th scope="col">{{ col.header }}</th>
234
+ }
235
+ </tr>
236
+ </thead>
237
+ <tbody>
238
+ @for (row of rows(); track row.node.key) {
239
+ <tr
240
+ class="cb-treetable__row"
241
+ [id]="rowId(row.node)"
242
+ [attr.aria-level]="row.level"
243
+ [attr.aria-setsize]="row.setSize"
244
+ [attr.aria-posinset]="row.posInSet"
245
+ [attr.aria-expanded]="hasChildren(row.node) ? isExpanded(row.node) : null"
246
+ [attr.tabindex]="row.node.key === tabbableKey() ? 0 : -1"
247
+ (focus)="activeKey.set(row.node.key)"
248
+ >
249
+ @for (col of columns(); track col.field; let first = $first) {
250
+ <td [class.cb-treetable__first]="first">
251
+ @if (first) {
252
+ <span
253
+ class="cb-treetable__indent"
254
+ [style.inline-size]="'calc(' + (row.level - 1) + ' * var(--cb-treetable-indent, 1.25rem))'"
255
+ aria-hidden="true"
256
+ ></span>
257
+ @if (hasChildren(row.node)) {
258
+ <button
259
+ type="button"
260
+ class="cb-treetable__toggler"
261
+ tabindex="-1"
262
+ [attr.aria-label]="fmt(isExpanded(row.node) ? t().collapseItem : t().expandItem, label(row.node))"
263
+ (click)="toggle(row.node)"
264
+ >
265
+ <cb-icon name="chevron-right" [size]="14" [class.cb-is-open]="isExpanded(row.node)" aria-hidden="true" />
266
+ </button>
267
+ } @else {
268
+ <span class="cb-treetable__spacer" aria-hidden="true"></span>
269
+ }
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 }" />
273
+ } @else {
274
+ {{ row.node.data[col.field] }}
275
+ }
276
+ </td>
277
+ }
278
+ </tr>
279
+ }
280
+ </tbody>
281
+ </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 }] }] } });
21
284
 
22
285
  /**
23
286
  * Generated bundle index. Do not edit.
24
287
  */
25
288
 
26
- export { CbTreeTable };
289
+ export { CbTreeTable, CbTreeTableCellTemplate };
@@ -1,34 +1,147 @@
1
+ import { NgTemplateOutlet } from '@angular/common';
1
2
  import * as i0 from '@angular/core';
2
- import { input, signal, computed, ChangeDetectionStrategy, Component } from '@angular/core';
3
+ import { inject, TemplateRef, Directive, input, contentChild, viewChild, signal, computed, ViewEncapsulation, ChangeDetectionStrategy, Component } from '@angular/core';
3
4
 
5
+ /** Plantilla de cada elemento de un `<cb-virtualscroller>`. */
6
+ class CbVirtualItemTemplate {
7
+ constructor() {
8
+ this.template = inject(TemplateRef);
9
+ }
10
+ static ngTemplateContextGuard(_dir, ctx) {
11
+ return true;
12
+ }
13
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbVirtualItemTemplate, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
14
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.5", type: CbVirtualItemTemplate, isStandalone: true, selector: "ng-template[cbVirtualItem]", ngImport: i0 }); }
15
+ }
16
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbVirtualItemTemplate, decorators: [{
17
+ type: Directive,
18
+ args: [{ selector: 'ng-template[cbVirtualItem]' }]
19
+ }] });
20
+ /**
21
+ * Lista virtualizada de CaribeNG: solo pinta los elementos visibles (más un
22
+ * margen) aunque la lista tenga miles. Cada elemento expone `aria-setsize` y
23
+ * `aria-posinset`, así el lector de pantalla conoce el total.
24
+ *
25
+ * @example
26
+ * ```html
27
+ * <cb-virtualscroller [items]="clientes" [itemSize]="48" [viewportHeight]="320" ariaLabel="Clientes">
28
+ * <ng-template cbVirtualItem let-cliente let-i="index">{{ i + 1 }}. {{ cliente.nombre }}</ng-template>
29
+ * </cb-virtualscroller>
30
+ * ```
31
+ */
4
32
  class CbVirtualScroller {
5
33
  constructor() {
34
+ /** Elementos de la lista. */
6
35
  this.items = input([], /* @ts-ignore */
7
36
  ...(ngDevMode ? [{ debugName: "items" }] : /* istanbul ignore next */ []));
37
+ /** Alto fijo de cada elemento, en píxeles. */
8
38
  this.itemSize = input(40, /* @ts-ignore */
9
39
  ...(ngDevMode ? [{ debugName: "itemSize" }] : /* istanbul ignore next */ []));
40
+ /** Alto visible de la lista, en píxeles. */
10
41
  this.viewportHeight = input(240, /* @ts-ignore */
11
42
  ...(ngDevMode ? [{ debugName: "viewportHeight" }] : /* istanbul ignore next */ []));
12
- this.start = signal(0, /* @ts-ignore */
43
+ /** Elementos extra que se pintan por encima y por debajo de lo visible (evita parpadeos al hacer scroll). */
44
+ this.buffer = input(4, /* @ts-ignore */
45
+ ...(ngDevMode ? [{ debugName: "buffer" }] : /* istanbul ignore next */ []));
46
+ /** Nombre accesible de la lista. */
47
+ this.ariaLabel = input('', /* @ts-ignore */
48
+ ...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
49
+ this.itemTemplate = contentChild(CbVirtualItemTemplate, /* @ts-ignore */
50
+ ...(ngDevMode ? [{ debugName: "itemTemplate" }] : /* istanbul ignore next */ []));
51
+ this.viewport = viewChild.required('viewport');
52
+ this.scrollTop = signal(0, /* @ts-ignore */
53
+ ...(ngDevMode ? [{ debugName: "scrollTop" }] : /* istanbul ignore next */ []));
54
+ /** Índice del primer elemento pintado. */
55
+ this.start = computed(() => Math.max(0, Math.floor(this.scrollTop() / this.itemSize()) - this.buffer()), /* @ts-ignore */
13
56
  ...(ngDevMode ? [{ debugName: "start" }] : /* istanbul ignore next */ []));
14
- this.visibleItems = computed(() => { const count = Math.ceil(this.viewportHeight() / this.itemSize()) + 2; return this.items().slice(this.start(), this.start() + count); }, /* @ts-ignore */
57
+ this.end = computed(() => Math.min(this.items().length, Math.ceil((this.scrollTop() + this.viewportHeight()) / this.itemSize()) + this.buffer()), /* @ts-ignore */
58
+ ...(ngDevMode ? [{ debugName: "end" }] : /* istanbul ignore next */ []));
59
+ this.visibleItems = computed(() => this.items().slice(this.start(), this.end()), /* @ts-ignore */
15
60
  ...(ngDevMode ? [{ debugName: "visibleItems" }] : /* istanbul ignore next */ []));
16
61
  this.offset = computed(() => this.start() * this.itemSize(), /* @ts-ignore */
17
62
  ...(ngDevMode ? [{ debugName: "offset" }] : /* istanbul ignore next */ []));
18
- this.bottomSpace = computed(() => Math.max(0, this.items().length - this.start() - this.visibleItems().length) * this.itemSize(), /* @ts-ignore */
19
- ...(ngDevMode ? [{ debugName: "bottomSpace" }] : /* istanbul ignore next */ []));
63
+ this.totalHeight = computed(() => this.items().length * this.itemSize(), /* @ts-ignore */
64
+ ...(ngDevMode ? [{ debugName: "totalHeight" }] : /* istanbul ignore next */ []));
65
+ }
66
+ /** Desplaza la lista hasta el elemento indicado (lo deja arriba). */
67
+ scrollToIndex(index) {
68
+ const top = Math.max(0, Math.min(index, this.items().length - 1)) * this.itemSize();
69
+ this.viewport().nativeElement.scrollTop = top;
70
+ this.scrollTop.set(top);
71
+ }
72
+ onScroll(event) {
73
+ this.scrollTop.set(event.target.scrollTop);
20
74
  }
21
- onScroll(e) { this.start.set(Math.floor(e.target.scrollTop / this.itemSize())); }
22
75
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbVirtualScroller, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
23
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: CbVirtualScroller, isStandalone: true, selector: "cb-virtualscroller", inputs: { items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: false, transformFunction: null }, itemSize: { classPropertyName: "itemSize", publicName: "itemSize", isSignal: true, isRequired: false, transformFunction: null }, viewportHeight: { classPropertyName: "viewportHeight", publicName: "viewportHeight", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `<div class="cb-virtualscroller" [style.height.px]="viewportHeight()" (scroll)="onScroll($event)" role="list"><div [style.height.px]="offset()"></div>@for(item of visibleItems();track $index){<div class="cb-virtualscroller__item" role="listitem" [style.height.px]="itemSize()">{{item}}</div>}<div [style.height.px]="bottomSpace()"></div></div>`, isInline: true, styles: [":host{display:block}.cb-virtualscroller{overflow:auto;border:1px solid var(--cb-color-border,#d1d5db);border-radius:.5rem}.cb-virtualscroller__item{box-sizing:border-box;display:flex;align-items:center;padding:0 .75rem;border-bottom:1px solid var(--cb-color-border,#e5e7eb);color:var(--cb-color-text,#111827)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
76
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: CbVirtualScroller, isStandalone: true, selector: "cb-virtualscroller", inputs: { items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: false, transformFunction: null }, itemSize: { classPropertyName: "itemSize", publicName: "itemSize", isSignal: true, isRequired: false, transformFunction: null }, viewportHeight: { classPropertyName: "viewportHeight", publicName: "viewportHeight", isSignal: true, isRequired: false, transformFunction: null }, buffer: { classPropertyName: "buffer", publicName: "buffer", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "cb-virtualscroller-host" }, queries: [{ propertyName: "itemTemplate", first: true, predicate: CbVirtualItemTemplate, descendants: true, isSignal: true }], viewQueries: [{ propertyName: "viewport", first: true, predicate: ["viewport"], descendants: true, isSignal: true }], ngImport: i0, template: `
77
+ <div
78
+ #viewport
79
+ class="cb-virtualscroller"
80
+ role="list"
81
+ tabindex="0"
82
+ [attr.aria-label]="ariaLabel() || null"
83
+ [style.height.px]="viewportHeight()"
84
+ (scroll)="onScroll($event)"
85
+ >
86
+ <div class="cb-virtualscroller__spacer" [style.height.px]="totalHeight()">
87
+ <div class="cb-virtualscroller__window" [style.transform]="'translateY(' + offset() + 'px)'">
88
+ @for (item of visibleItems(); track start() + $index; let i = $index) {
89
+ <div
90
+ class="cb-virtualscroller__item"
91
+ role="listitem"
92
+ [attr.aria-setsize]="items().length"
93
+ [attr.aria-posinset]="start() + i + 1"
94
+ [style.height.px]="itemSize()"
95
+ >
96
+ @if (itemTemplate(); as tpl) {
97
+ <ng-container *ngTemplateOutlet="tpl.template; context: { $implicit: item, index: start() + i }" />
98
+ } @else {
99
+ {{ item }}
100
+ }
101
+ </div>
102
+ }
103
+ </div>
104
+ </div>
105
+ </div>
106
+ `, isInline: true, styles: [":host{display:block;box-sizing:border-box;width:100%}.cb-virtualscroller{overflow-y:auto;border:1px solid var(--cb-color-border);border-radius:var(--cb-radius-md, .5rem);background:var(--cb-color-surface-raised);color:var(--cb-color-text);outline:none}.cb-virtualscroller:focus-visible{box-shadow:0 0 0 2px var(--cb-color-focus-ring, var(--cb-color-primary-500))}.cb-virtualscroller__spacer{position:relative}.cb-virtualscroller__window{position:absolute;inset-inline:0;top:0;will-change:transform}.cb-virtualscroller__item{box-sizing:border-box;display:flex;align-items:center;padding:0 var(--cb-space-3, .75rem);border-bottom:1px solid var(--cb-color-border);font-size:var(--cb-text-sm, .875rem)}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
24
107
  }
25
108
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbVirtualScroller, decorators: [{
26
109
  type: Component,
27
- args: [{ selector: 'cb-virtualscroller', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, template: `<div class="cb-virtualscroller" [style.height.px]="viewportHeight()" (scroll)="onScroll($event)" role="list"><div [style.height.px]="offset()"></div>@for(item of visibleItems();track $index){<div class="cb-virtualscroller__item" role="listitem" [style.height.px]="itemSize()">{{item}}</div>}<div [style.height.px]="bottomSpace()"></div></div>`, styles: [":host{display:block}.cb-virtualscroller{overflow:auto;border:1px solid var(--cb-color-border,#d1d5db);border-radius:.5rem}.cb-virtualscroller__item{box-sizing:border-box;display:flex;align-items:center;padding:0 .75rem;border-bottom:1px solid var(--cb-color-border,#e5e7eb);color:var(--cb-color-text,#111827)}\n"] }]
28
- }], propDecorators: { items: [{ type: i0.Input, args: [{ isSignal: true, alias: "items", required: false }] }], itemSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "itemSize", required: false }] }], viewportHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "viewportHeight", required: false }] }] } });
110
+ args: [{ selector: 'cb-virtualscroller', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.Emulated, imports: [NgTemplateOutlet], host: { class: 'cb-virtualscroller-host' }, template: `
111
+ <div
112
+ #viewport
113
+ class="cb-virtualscroller"
114
+ role="list"
115
+ tabindex="0"
116
+ [attr.aria-label]="ariaLabel() || null"
117
+ [style.height.px]="viewportHeight()"
118
+ (scroll)="onScroll($event)"
119
+ >
120
+ <div class="cb-virtualscroller__spacer" [style.height.px]="totalHeight()">
121
+ <div class="cb-virtualscroller__window" [style.transform]="'translateY(' + offset() + 'px)'">
122
+ @for (item of visibleItems(); track start() + $index; let i = $index) {
123
+ <div
124
+ class="cb-virtualscroller__item"
125
+ role="listitem"
126
+ [attr.aria-setsize]="items().length"
127
+ [attr.aria-posinset]="start() + i + 1"
128
+ [style.height.px]="itemSize()"
129
+ >
130
+ @if (itemTemplate(); as tpl) {
131
+ <ng-container *ngTemplateOutlet="tpl.template; context: { $implicit: item, index: start() + i }" />
132
+ } @else {
133
+ {{ item }}
134
+ }
135
+ </div>
136
+ }
137
+ </div>
138
+ </div>
139
+ </div>
140
+ `, styles: [":host{display:block;box-sizing:border-box;width:100%}.cb-virtualscroller{overflow-y:auto;border:1px solid var(--cb-color-border);border-radius:var(--cb-radius-md, .5rem);background:var(--cb-color-surface-raised);color:var(--cb-color-text);outline:none}.cb-virtualscroller:focus-visible{box-shadow:0 0 0 2px var(--cb-color-focus-ring, var(--cb-color-primary-500))}.cb-virtualscroller__spacer{position:relative}.cb-virtualscroller__window{position:absolute;inset-inline:0;top:0;will-change:transform}.cb-virtualscroller__item{box-sizing:border-box;display:flex;align-items:center;padding:0 var(--cb-space-3, .75rem);border-bottom:1px solid var(--cb-color-border);font-size:var(--cb-text-sm, .875rem)}\n"] }]
141
+ }], propDecorators: { items: [{ type: i0.Input, args: [{ isSignal: true, alias: "items", required: false }] }], itemSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "itemSize", required: false }] }], viewportHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "viewportHeight", required: false }] }], buffer: [{ type: i0.Input, args: [{ isSignal: true, alias: "buffer", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], itemTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => CbVirtualItemTemplate), { isSignal: true }] }], viewport: [{ type: i0.ViewChild, args: ['viewport', { isSignal: true }] }] } });
29
142
 
30
143
  /**
31
144
  * Generated bundle index. Do not edit.
32
145
  */
33
146
 
34
- export { CbVirtualScroller };
147
+ export { CbVirtualItemTemplate, CbVirtualScroller };