@nanahoshi/mona-ui 0.27.2 → 0.29.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 (213) hide show
  1. package/docs/api/chart.md +2 -2
  2. package/docs/api/locales.md +8 -0
  3. package/docs/api/popup.md +1 -1
  4. package/docs/api/theme.md +2 -2
  5. package/docs/chart.md +14 -0
  6. package/docs/editor.md +2 -0
  7. package/docs/installation.md +147 -15
  8. package/docs/introduction.md +37 -15
  9. package/docs/theming-built-in-themes.md +67 -0
  10. package/docs/theming-custom-colors.md +274 -0
  11. package/docs/theming-custom-themes.md +168 -0
  12. package/docs/theming.md +164 -248
  13. package/fesm2022/nanahoshi-mona-ui-auto-complete.mjs +1089 -603
  14. package/fesm2022/nanahoshi-mona-ui-avatar.mjs +369 -184
  15. package/fesm2022/nanahoshi-mona-ui-breadcrumb.mjs +658 -371
  16. package/fesm2022/nanahoshi-mona-ui-button-group.mjs +513 -359
  17. package/fesm2022/nanahoshi-mona-ui-button.mjs +622 -517
  18. package/fesm2022/nanahoshi-mona-ui-calendar.mjs +2071 -1573
  19. package/fesm2022/nanahoshi-mona-ui-card.mjs +620 -316
  20. package/fesm2022/nanahoshi-mona-ui-chart.mjs +61151 -64921
  21. package/fesm2022/nanahoshi-mona-ui-check-box.mjs +646 -317
  22. package/fesm2022/nanahoshi-mona-ui-chip.mjs +737 -516
  23. package/fesm2022/nanahoshi-mona-ui-circular-progress-bar.mjs +441 -242
  24. package/fesm2022/nanahoshi-mona-ui-collapsible.mjs +443 -390
  25. package/fesm2022/nanahoshi-mona-ui-color-gradient.mjs +1138 -814
  26. package/fesm2022/nanahoshi-mona-ui-color-palette.mjs +1114 -959
  27. package/fesm2022/nanahoshi-mona-ui-color-picker.mjs +858 -504
  28. package/fesm2022/nanahoshi-mona-ui-combo-box.mjs +1181 -742
  29. package/fesm2022/nanahoshi-mona-ui-command.mjs +1454 -853
  30. package/fesm2022/nanahoshi-mona-ui-common.mjs +569 -743
  31. package/fesm2022/nanahoshi-mona-ui-contextmenu.mjs +978 -532
  32. package/fesm2022/nanahoshi-mona-ui-date-input.mjs +283 -266
  33. package/fesm2022/nanahoshi-mona-ui-date-picker.mjs +973 -451
  34. package/fesm2022/nanahoshi-mona-ui-datetime-picker.mjs +1203 -658
  35. package/fesm2022/nanahoshi-mona-ui-dialog.mjs +1415 -936
  36. package/fesm2022/nanahoshi-mona-ui-dropdown-button.mjs +1165 -568
  37. package/fesm2022/nanahoshi-mona-ui-dropdown-list.mjs +1142 -677
  38. package/fesm2022/nanahoshi-mona-ui-dropdowns.mjs +1018 -734
  39. package/fesm2022/nanahoshi-mona-ui-editor.mjs +3589 -2122
  40. package/fesm2022/nanahoshi-mona-ui-expansion-panel.mjs +577 -359
  41. package/fesm2022/nanahoshi-mona-ui-fieldset.mjs +311 -151
  42. package/fesm2022/nanahoshi-mona-ui-filter.mjs +1086 -718
  43. package/fesm2022/nanahoshi-mona-ui-grid-grid-colgroup.component-NhONCVIX.mjs +77 -0
  44. package/fesm2022/nanahoshi-mona-ui-grid-grid-footer-row.component-Djv8ZnT5.mjs +480 -0
  45. package/fesm2022/nanahoshi-mona-ui-grid-grid-list.component-WbXAzGCa.mjs +470 -0
  46. package/fesm2022/nanahoshi-mona-ui-grid-grid-row.component-DkWTD3pN.mjs +2115 -0
  47. package/fesm2022/nanahoshi-mona-ui-grid-grid-virtual-list.component-DAHqTwBJ.mjs +330 -0
  48. package/fesm2022/nanahoshi-mona-ui-grid-grid.styles-BmLU-3zP.mjs +3766 -0
  49. package/fesm2022/nanahoshi-mona-ui-grid.mjs +5418 -2
  50. package/fesm2022/nanahoshi-mona-ui-i18n-icu.mjs +1379 -1079
  51. package/fesm2022/nanahoshi-mona-ui-i18n.mjs +4451 -5077
  52. package/fesm2022/nanahoshi-mona-ui-internal-filter-input.mjs +344 -143
  53. package/fesm2022/nanahoshi-mona-ui-internal-indicator-icon.mjs +257 -127
  54. package/fesm2022/nanahoshi-mona-ui-internal-list.mjs +2080 -1829
  55. package/fesm2022/nanahoshi-mona-ui-internal-popup-menu.mjs +103 -141
  56. package/fesm2022/nanahoshi-mona-ui-internal-tree.mjs +2498 -2706
  57. package/fesm2022/nanahoshi-mona-ui-internal.mjs +722 -1007
  58. package/fesm2022/nanahoshi-mona-ui-label.mjs +313 -202
  59. package/fesm2022/nanahoshi-mona-ui-list-box.mjs +1308 -1009
  60. package/fesm2022/nanahoshi-mona-ui-list-view.mjs +1411 -677
  61. package/fesm2022/nanahoshi-mona-ui-list.mjs +1 -6
  62. package/fesm2022/nanahoshi-mona-ui-locales-ar-sa.mjs +556 -577
  63. package/fesm2022/nanahoshi-mona-ui-locales-de-de.mjs +530 -573
  64. package/fesm2022/nanahoshi-mona-ui-locales-es-es.mjs +530 -573
  65. package/fesm2022/nanahoshi-mona-ui-locales-fr-fr.mjs +533 -576
  66. package/fesm2022/nanahoshi-mona-ui-locales-id-id.mjs +520 -555
  67. package/fesm2022/nanahoshi-mona-ui-locales-it-it.mjs +530 -571
  68. package/fesm2022/nanahoshi-mona-ui-locales-ja-jp.mjs +520 -555
  69. package/fesm2022/nanahoshi-mona-ui-locales-ko-kr.mjs +520 -555
  70. package/fesm2022/nanahoshi-mona-ui-locales-pl-pl.mjs +599 -0
  71. package/fesm2022/nanahoshi-mona-ui-locales-pt-br.mjs +530 -571
  72. package/fesm2022/nanahoshi-mona-ui-locales-ru-ru.mjs +576 -591
  73. package/fesm2022/nanahoshi-mona-ui-locales-tr-tr.mjs +530 -565
  74. package/fesm2022/nanahoshi-mona-ui-locales-zh-cn.mjs +520 -555
  75. package/fesm2022/nanahoshi-mona-ui-locales-zh-tw.mjs +520 -555
  76. package/fesm2022/nanahoshi-mona-ui-locales.mjs +61 -77
  77. package/fesm2022/nanahoshi-mona-ui-menubar.mjs +1411 -829
  78. package/fesm2022/nanahoshi-mona-ui-multi-select.mjs +1326 -702
  79. package/fesm2022/nanahoshi-mona-ui-notification.mjs +763 -675
  80. package/fesm2022/nanahoshi-mona-ui-numeric-text-box.mjs +1306 -826
  81. package/fesm2022/nanahoshi-mona-ui-otp-input.mjs +1122 -897
  82. package/fesm2022/nanahoshi-mona-ui-pager.mjs +1110 -651
  83. package/fesm2022/nanahoshi-mona-ui-placeholder.mjs +95 -53
  84. package/fesm2022/nanahoshi-mona-ui-popover.mjs +559 -397
  85. package/fesm2022/nanahoshi-mona-ui-popup-menu.mjs +2323 -1694
  86. package/fesm2022/nanahoshi-mona-ui-popup.mjs +1657 -1455
  87. package/fesm2022/nanahoshi-mona-ui-progress-bar.mjs +441 -267
  88. package/fesm2022/nanahoshi-mona-ui-query.mjs +211 -340
  89. package/fesm2022/nanahoshi-mona-ui-radio-button.mjs +1017 -548
  90. package/fesm2022/nanahoshi-mona-ui-rating.mjs +874 -624
  91. package/fesm2022/nanahoshi-mona-ui-scroll-view.mjs +1130 -917
  92. package/fesm2022/nanahoshi-mona-ui-segmented.mjs +705 -455
  93. package/fesm2022/nanahoshi-mona-ui-sheet.mjs +461 -283
  94. package/fesm2022/nanahoshi-mona-ui-sidebar.mjs +2791 -2449
  95. package/fesm2022/nanahoshi-mona-ui-skeleton.mjs +145 -90
  96. package/fesm2022/nanahoshi-mona-ui-slider.mjs +1563 -1103
  97. package/fesm2022/nanahoshi-mona-ui-spinner.mjs +738 -673
  98. package/fesm2022/nanahoshi-mona-ui-split-button.mjs +1287 -647
  99. package/fesm2022/nanahoshi-mona-ui-splitter.mjs +1313 -909
  100. package/fesm2022/nanahoshi-mona-ui-stepper.mjs +761 -540
  101. package/fesm2022/nanahoshi-mona-ui-switch.mjs +611 -280
  102. package/fesm2022/nanahoshi-mona-ui-tabs.mjs +1393 -841
  103. package/fesm2022/nanahoshi-mona-ui-text-area.mjs +142 -73
  104. package/fesm2022/nanahoshi-mona-ui-text-box.mjs +876 -374
  105. package/fesm2022/nanahoshi-mona-ui-theme.mjs +1465 -1449
  106. package/fesm2022/nanahoshi-mona-ui-time-picker.mjs +897 -443
  107. package/fesm2022/nanahoshi-mona-ui-time-selector.mjs +1100 -703
  108. package/fesm2022/nanahoshi-mona-ui-tooltip.mjs +789 -538
  109. package/fesm2022/nanahoshi-mona-ui-tree-view.mjs +1361 -805
  110. package/fesm2022/nanahoshi-mona-ui-window.mjs +2145 -1531
  111. package/fesm2022/nanahoshi-mona-ui.mjs +1 -8
  112. package/llms.txt +7 -3
  113. package/locales/pl-pl/package.json +4 -0
  114. package/locales/pl-pl/pl-pl.messages.json +536 -0
  115. package/package.json +66 -23
  116. package/types/nanahoshi-mona-ui-auto-complete.d.ts +367 -233
  117. package/types/nanahoshi-mona-ui-avatar.d.ts +722 -649
  118. package/types/nanahoshi-mona-ui-breadcrumb.d.ts +134 -103
  119. package/types/nanahoshi-mona-ui-button-group.d.ts +213 -152
  120. package/types/nanahoshi-mona-ui-button.d.ts +227 -166
  121. package/types/nanahoshi-mona-ui-calendar.d.ts +324 -259
  122. package/types/nanahoshi-mona-ui-card.d.ts +125 -111
  123. package/types/nanahoshi-mona-ui-chart.d.ts +10483 -7326
  124. package/types/nanahoshi-mona-ui-check-box.d.ts +293 -180
  125. package/types/nanahoshi-mona-ui-chip.d.ts +208 -141
  126. package/types/nanahoshi-mona-ui-circular-progress-bar.d.ts +194 -133
  127. package/types/nanahoshi-mona-ui-collapsible.d.ts +103 -87
  128. package/types/nanahoshi-mona-ui-color-gradient.d.ts +281 -213
  129. package/types/nanahoshi-mona-ui-color-palette.d.ts +201 -138
  130. package/types/nanahoshi-mona-ui-color-picker.d.ts +283 -194
  131. package/types/nanahoshi-mona-ui-combo-box.d.ts +401 -262
  132. package/types/nanahoshi-mona-ui-command.d.ts +279 -191
  133. package/types/nanahoshi-mona-ui-common.d.ts +354 -385
  134. package/types/nanahoshi-mona-ui-contextmenu.d.ts +142 -117
  135. package/types/nanahoshi-mona-ui-date-input.d.ts +79 -96
  136. package/types/nanahoshi-mona-ui-date-picker.d.ts +338 -208
  137. package/types/nanahoshi-mona-ui-datetime-picker.d.ts +413 -259
  138. package/types/nanahoshi-mona-ui-dialog.d.ts +470 -381
  139. package/types/nanahoshi-mona-ui-dropdown-button.d.ts +216 -168
  140. package/types/nanahoshi-mona-ui-dropdown-list.d.ts +369 -243
  141. package/types/nanahoshi-mona-ui-dropdowns.d.ts +231 -217
  142. package/types/nanahoshi-mona-ui-editor.d.ts +302 -235
  143. package/types/nanahoshi-mona-ui-expansion-panel.d.ts +140 -109
  144. package/types/nanahoshi-mona-ui-fieldset.d.ts +98 -68
  145. package/types/nanahoshi-mona-ui-filter.d.ts +150 -124
  146. package/types/nanahoshi-mona-ui-grid.d.ts +1956 -1678
  147. package/types/nanahoshi-mona-ui-i18n-icu.d.ts +25 -34
  148. package/types/nanahoshi-mona-ui-i18n.d.ts +987 -1052
  149. package/types/nanahoshi-mona-ui-internal-filter-input.d.ts +118 -71
  150. package/types/nanahoshi-mona-ui-internal-indicator-icon.d.ts +56 -27
  151. package/types/nanahoshi-mona-ui-internal-list.d.ts +474 -408
  152. package/types/nanahoshi-mona-ui-internal-popup-menu.d.ts +143 -150
  153. package/types/nanahoshi-mona-ui-internal-tree.d.ts +493 -506
  154. package/types/nanahoshi-mona-ui-internal.d.ts +195 -213
  155. package/types/nanahoshi-mona-ui-label.d.ts +108 -78
  156. package/types/nanahoshi-mona-ui-list-box.d.ts +392 -322
  157. package/types/nanahoshi-mona-ui-list-view.d.ts +423 -282
  158. package/types/nanahoshi-mona-ui-list.d.ts +2 -1
  159. package/types/nanahoshi-mona-ui-locales-ar-sa.d.ts +540 -542
  160. package/types/nanahoshi-mona-ui-locales-de-de.d.ts +540 -542
  161. package/types/nanahoshi-mona-ui-locales-es-es.d.ts +540 -542
  162. package/types/nanahoshi-mona-ui-locales-fr-fr.d.ts +540 -542
  163. package/types/nanahoshi-mona-ui-locales-id-id.d.ts +540 -542
  164. package/types/nanahoshi-mona-ui-locales-it-it.d.ts +540 -542
  165. package/types/nanahoshi-mona-ui-locales-ja-jp.d.ts +540 -542
  166. package/types/nanahoshi-mona-ui-locales-ko-kr.d.ts +540 -542
  167. package/types/nanahoshi-mona-ui-locales-pl-pl.d.ts +540 -0
  168. package/types/nanahoshi-mona-ui-locales-pt-br.d.ts +540 -542
  169. package/types/nanahoshi-mona-ui-locales-ru-ru.d.ts +540 -542
  170. package/types/nanahoshi-mona-ui-locales-tr-tr.d.ts +540 -542
  171. package/types/nanahoshi-mona-ui-locales-zh-cn.d.ts +540 -542
  172. package/types/nanahoshi-mona-ui-locales-zh-tw.d.ts +540 -542
  173. package/types/nanahoshi-mona-ui-locales.d.ts +18 -19
  174. package/types/nanahoshi-mona-ui-menubar.d.ts +210 -181
  175. package/types/nanahoshi-mona-ui-multi-select.d.ts +416 -276
  176. package/types/nanahoshi-mona-ui-notification.d.ts +140 -151
  177. package/types/nanahoshi-mona-ui-numeric-text-box.d.ts +407 -270
  178. package/types/nanahoshi-mona-ui-otp-input.d.ts +364 -241
  179. package/types/nanahoshi-mona-ui-pager.d.ts +379 -301
  180. package/types/nanahoshi-mona-ui-placeholder.d.ts +35 -28
  181. package/types/nanahoshi-mona-ui-popover.d.ts +176 -134
  182. package/types/nanahoshi-mona-ui-popup-menu.d.ts +488 -344
  183. package/types/nanahoshi-mona-ui-popup.d.ts +698 -560
  184. package/types/nanahoshi-mona-ui-progress-bar.d.ts +197 -137
  185. package/types/nanahoshi-mona-ui-query.d.ts +82 -88
  186. package/types/nanahoshi-mona-ui-radio-button.d.ts +434 -269
  187. package/types/nanahoshi-mona-ui-rating.d.ts +348 -254
  188. package/types/nanahoshi-mona-ui-scroll-view.d.ts +244 -172
  189. package/types/nanahoshi-mona-ui-segmented.d.ts +250 -175
  190. package/types/nanahoshi-mona-ui-sheet.d.ts +115 -63
  191. package/types/nanahoshi-mona-ui-sidebar.d.ts +653 -493
  192. package/types/nanahoshi-mona-ui-skeleton.d.ts +55 -39
  193. package/types/nanahoshi-mona-ui-slider.d.ts +503 -354
  194. package/types/nanahoshi-mona-ui-spinner.d.ts +125 -112
  195. package/types/nanahoshi-mona-ui-split-button.d.ts +241 -196
  196. package/types/nanahoshi-mona-ui-splitter.d.ts +124 -78
  197. package/types/nanahoshi-mona-ui-stepper.d.ts +206 -181
  198. package/types/nanahoshi-mona-ui-switch.d.ts +197 -131
  199. package/types/nanahoshi-mona-ui-tabs.d.ts +349 -248
  200. package/types/nanahoshi-mona-ui-text-area.d.ts +52 -36
  201. package/types/nanahoshi-mona-ui-text-box.d.ts +349 -218
  202. package/types/nanahoshi-mona-ui-theme.d.ts +415 -408
  203. package/types/nanahoshi-mona-ui-time-picker.d.ts +357 -217
  204. package/types/nanahoshi-mona-ui-time-selector.d.ts +255 -170
  205. package/types/nanahoshi-mona-ui-tooltip.d.ts +222 -144
  206. package/types/nanahoshi-mona-ui-tree-view.d.ts +466 -308
  207. package/types/nanahoshi-mona-ui-window.d.ts +494 -399
  208. package/types/nanahoshi-mona-ui.d.ts +1 -2
  209. package/fesm2022/nanahoshi-mona-ui-grid-grid-footer-row.component-DjNnVxHE.mjs +0 -181
  210. package/fesm2022/nanahoshi-mona-ui-grid-grid-list.component-ihQIKeP-.mjs +0 -208
  211. package/fesm2022/nanahoshi-mona-ui-grid-grid-row.component-BpnybNcs.mjs +0 -1082
  212. package/fesm2022/nanahoshi-mona-ui-grid-grid-virtual-list.component-CYlgfc7c.mjs +0 -186
  213. package/fesm2022/nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-LCzfCYd3.mjs +0 -7568
@@ -1,1082 +0,0 @@
1
- import * as i0 from '@angular/core';
2
- import { inject, computed, input, Directive, ElementRef, Component, signal, viewChild, output, effect, isDevMode, untracked, afterNextRender, model, Injector, LOCALE_ID } from '@angular/core';
3
- import { G as GridService, j as gridListTableCellThemeVariants, e as GridNavigationService, r as removeGridRow, k as GridLogicalCellDirective, l as gridCellEditorBaseThemeVariants, m as gridCellEditorInputThemeVariants, n as GRID_CELL_FOCUSABLE_SELECTOR, o as gridListTableRowThemeVariants, a as GridLockedCellDirective, p as gridGroupRowThemeVariants, q as gridCellBaseThemeVariants, s as gridCellContainerThemeVariants, t as gridCellDirtyIndicatorThemeVariants, u as gridCellTextThemeVariants, v as gridRowReorderHandleThemeVariants, w as gridSelectionCellThemeVariants } from './nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-LCzfCYd3.mjs';
4
- import { twMerge } from 'tailwind-merge';
5
- import { NgTemplateOutlet, formatDate } from '@angular/common';
6
- import { MonaI18nService, parseLocalizedNumber, formatGregorianDateToLocaleString } from '@nanahoshi/mona-ui/i18n';
7
- import { LucideCheck, LucideOctagonAlert, LucideX, LucidePencil, LucideTrash2, LucideMinus, LucideChevronDown, LucidePlus, LucideChevronRight, LucideDynamicIcon, LucideGripVertical } from '@lucide/angular';
8
- import { ButtonDirective } from '@nanahoshi/mona-ui/button';
9
- import { DialogService } from '@nanahoshi/mona-ui/dialog';
10
- import { TooltipComponent } from '@nanahoshi/mona-ui/tooltip';
11
- import { v4 } from 'uuid';
12
- import { FormField } from '@angular/forms/signals';
13
- import { CheckBoxComponent } from '@nanahoshi/mona-ui/check-box';
14
- import { DatePickerComponent } from '@nanahoshi/mona-ui/date-picker';
15
- import { NumericTextBoxComponent } from '@nanahoshi/mona-ui/numeric-text-box';
16
- import { TextBoxComponent } from '@nanahoshi/mona-ui/text-box';
17
- import { LiveAnnouncer } from '@angular/cdk/a11y';
18
- import { CdkDragHandle } from '@angular/cdk/drag-drop';
19
-
20
- class GridCellDirective {
21
- constructor() {
22
- this.#gridService = inject(GridService, { optional: true });
23
- this.baseClass = computed(() => gridListTableCellThemeVariants({
24
- virtual: this.#gridService?.virtualScrollOptions().enabled ?? false,
25
- groupIndent: this.groupIndent(),
26
- lastInRow: this.lastInRow() || this.groupHeader()
27
- }), /* @ts-ignore */
28
- ...(ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []));
29
- /** Marks a group header title cell. It spans to the end of the row, so it draws no end border. */
30
- this.groupHeader = input(false, /* @ts-ignore */
31
- ...(ngDevMode ? [{ debugName: "groupHeader" }] : /* istanbul ignore next */ []));
32
- /** Marks an indent cell under a group, which uses the muted group background. */
33
- this.groupIndent = input(false, /* @ts-ignore */
34
- ...(ngDevMode ? [{ debugName: "groupIndent" }] : /* istanbul ignore next */ []));
35
- this.lastInRow = input(false, /* @ts-ignore */
36
- ...(ngDevMode ? [{ debugName: "lastInRow" }] : /* istanbul ignore next */ []));
37
- }
38
- #gridService;
39
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridCellDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
40
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.6", type: GridCellDirective, isStandalone: true, selector: "td[monaGridCell]", inputs: { groupHeader: { classPropertyName: "groupHeader", publicName: "groupHeader", isSignal: true, isRequired: false, transformFunction: null }, groupIndent: { classPropertyName: "groupIndent", publicName: "groupIndent", isSignal: true, isRequired: false, transformFunction: null }, lastInRow: { classPropertyName: "lastInRow", publicName: "lastInRow", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "gridcell" }, properties: { "class": "baseClass()" } }, ngImport: i0 }); }
41
- }
42
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridCellDirective, decorators: [{
43
- type: Directive,
44
- args: [{
45
- selector: "td[monaGridCell]",
46
- host: {
47
- "[class]": "baseClass()",
48
- role: "gridcell"
49
- }
50
- }]
51
- }], propDecorators: { groupHeader: [{ type: i0.Input, args: [{ isSignal: true, alias: "groupHeader", required: false }] }], groupIndent: [{ type: i0.Input, args: [{ isSignal: true, alias: "groupIndent", required: false }] }], lastInRow: [{ type: i0.Input, args: [{ isSignal: true, alias: "lastInRow", required: false }] }] } });
52
-
53
- class GridCommandCellComponent {
54
- constructor() {
55
- this.#dialogService = inject(DialogService);
56
- this.#elementRef = inject((ElementRef));
57
- this.#gridNavigationService = inject(GridNavigationService);
58
- this.canEditRows = computed(() => {
59
- const editableOptions = this.gridService.editableOptions();
60
- return editableOptions.enabled === true && editableOptions.mode === "row";
61
- }, /* @ts-ignore */
62
- ...(ngDevMode ? [{ debugName: "canEditRows" }] : /* istanbul ignore next */ []));
63
- this.commandContext = computed(() => ({
64
- $implicit: this.row()?.data ?? this.gridService.addRowData(),
65
- cancel: (event) => this.cancel(event),
66
- edit: (event) => this.edit(event),
67
- isEditing: this.isEditing(),
68
- isNew: this.newRow(),
69
- remove: (event) => this.remove(event),
70
- row: this.row(),
71
- rowData: this.row()?.data ?? this.gridService.addRowData(),
72
- save: (event) => this.save(event)
73
- }), /* @ts-ignore */
74
- ...(ngDevMode ? [{ debugName: "commandContext" }] : /* istanbul ignore next */ []));
75
- this.gridService = inject(GridService);
76
- this.hasRowError = computed(() => this.rowErrorMessages().length > 0, /* @ts-ignore */
77
- ...(ngDevMode ? [{ debugName: "hasRowError" }] : /* istanbul ignore next */ []));
78
- this.isEditing = computed(() => {
79
- const row = this.row();
80
- const context = this.gridService.editContext();
81
- return this.newRow() || (row != null && context?.mode === "row" && context.rowUid === row.uid);
82
- }, /* @ts-ignore */
83
- ...(ngDevMode ? [{ debugName: "isEditing" }] : /* istanbul ignore next */ []));
84
- /** Button names that say which row they act on. */
85
- this.labels = computed(() => {
86
- const row = this.newRow() ? null : this.row();
87
- return {
88
- cancel: this.gridService.getRowCommandAriaLabel("cancel", row),
89
- edit: row == null ? "" : this.gridService.getRowCommandAriaLabel("edit", row),
90
- remove: row == null ? "" : this.gridService.getRowCommandAriaLabel("remove", row),
91
- save: this.gridService.getRowCommandAriaLabel("save", row)
92
- };
93
- }, /* @ts-ignore */
94
- ...(ngDevMode ? [{ debugName: "labels" }] : /* istanbul ignore next */ []));
95
- this.messages = computed(() => this.gridService.messages(), /* @ts-ignore */
96
- ...(ngDevMode ? [{ debugName: "messages" }] : /* istanbul ignore next */ []));
97
- this.rowErrorId = `mona-grid-row-error-${v4()}`;
98
- this.rowErrorMessages = computed(() => {
99
- if (!this.isEditing()) {
100
- return [];
101
- }
102
- const session = this.gridService.editSession();
103
- if (session == null) {
104
- return [];
105
- }
106
- return session
107
- .form()
108
- .errorSummary()
109
- .map(error => error.message)
110
- .filter((message) => !!message);
111
- }, /* @ts-ignore */
112
- ...(ngDevMode ? [{ debugName: "rowErrorMessages" }] : /* istanbul ignore next */ []));
113
- this.rowErrorTooltip = computed(() => this.rowErrorMessages().join("\n") || this.messages().rowValidationError, /* @ts-ignore */
114
- ...(ngDevMode ? [{ debugName: "rowErrorTooltip" }] : /* istanbul ignore next */ []));
115
- this.column = input.required(/* @ts-ignore */
116
- ...(ngDevMode ? [{ debugName: "column" }] : /* istanbul ignore next */ []));
117
- this.newRow = input(false, /* @ts-ignore */
118
- ...(ngDevMode ? [{ debugName: "newRow" }] : /* istanbul ignore next */ []));
119
- this.row = input(null, /* @ts-ignore */
120
- ...(ngDevMode ? [{ debugName: "row" }] : /* istanbul ignore next */ []));
121
- }
122
- #dialogService;
123
- #elementRef;
124
- #gridNavigationService;
125
- cancel(event) {
126
- event?.stopPropagation();
127
- const canceled = this.newRow() ? this.gridService.cancelAddRow(event) : this.gridService.cancelEdit(event);
128
- if (canceled) {
129
- this.#afterRowCommand();
130
- }
131
- }
132
- edit(event) {
133
- event?.stopPropagation();
134
- if (!this.canEditRows()) {
135
- return;
136
- }
137
- const row = this.row();
138
- if (row != null) {
139
- this.gridService.startRowEdit(row, event);
140
- }
141
- }
142
- remove(event) {
143
- event?.stopPropagation();
144
- const row = this.row();
145
- if (row == null) {
146
- return;
147
- }
148
- removeGridRow({
149
- dialogService: this.#dialogService,
150
- gridNavigationService: this.#gridNavigationService,
151
- gridService: this.gridService
152
- }, { confirm: this.column().removeConfirmation, element: this.#elementRef.nativeElement, event, row });
153
- }
154
- save(event) {
155
- event?.stopPropagation();
156
- const saved = this.newRow() ? this.gridService.saveAddRow(event) : this.gridService.commitRowEdit(event);
157
- if (saved) {
158
- this.#afterRowCommand();
159
- }
160
- }
161
- /**
162
- * The Save and Cancel buttons go away with the editor: focus their cell, or once the add row is gone, the
163
- * nearest cell.
164
- */
165
- #afterRowCommand() {
166
- this.#focusCell();
167
- if (this.newRow()) {
168
- this.#gridNavigationService.refocusAfterRender();
169
- }
170
- }
171
- #focusCell() {
172
- this.#elementRef.nativeElement.closest("td")?.focus();
173
- }
174
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridCommandCellComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
175
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: GridCommandCellComponent, isStandalone: true, selector: "mona-grid-command-cell", inputs: { column: { classPropertyName: "column", publicName: "column", isSignal: true, isRequired: true, transformFunction: null }, newRow: { classPropertyName: "newRow", publicName: "newRow", isSignal: true, isRequired: false, transformFunction: null }, row: { classPropertyName: "row", publicName: "row", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "flex items-center w-full min-h-9" }, ngImport: i0, template: "@if (column().commandTemplate) {\n <ng-container\n [ngTemplateOutlet]=\"column().commandTemplate\"\n [ngTemplateOutletContext]=\"commandContext()\"></ng-container>\n} @else {\n <div class=\"flex min-h-9 items-center gap-1 px-1\">\n @if (isEditing()) {\n @if (hasRowError()) {\n <span class=\"shrink-0 px-1 text-error\" aria-hidden=\"true\" #rowErrorIcon>\n <svg lucideOctagonAlert [size]=\"14\"></svg>\n </span>\n <mona-tooltip [target]=\"rowErrorIcon\">\n <span class=\"p-1 whitespace-pre-line\">{{ rowErrorTooltip() }}</span>\n </mona-tooltip>\n <span class=\"sr-only\" [id]=\"rowErrorId\">{{ rowErrorTooltip() }}</span>\n }\n <button\n monaButton\n look=\"ghost\"\n size=\"small\"\n [iconOnly]=\"true\"\n [attr.aria-label]=\"labels().save\"\n [attr.aria-describedby]=\"hasRowError() ? rowErrorId : null\"\n [attr.title]=\"messages().save\"\n class=\"w-6 h-6\"\n [tabindex]=\"-1\"\n (click)=\"save($event)\">\n <svg lucideCheck [size]=\"14\"></svg>\n </button>\n <button\n monaButton\n look=\"ghost\"\n size=\"small\"\n [iconOnly]=\"true\"\n [attr.aria-label]=\"labels().cancel\"\n [attr.title]=\"messages().cancel\"\n class=\"w-6 h-6\"\n [tabindex]=\"-1\"\n (click)=\"cancel($event)\">\n <svg lucideX [size]=\"14\"></svg>\n </button>\n } @else {\n @if (canEditRows()) {\n <button\n monaButton\n look=\"ghost\"\n size=\"small\"\n [iconOnly]=\"true\"\n [attr.aria-label]=\"labels().edit\"\n [attr.title]=\"messages().edit\"\n class=\"w-6 h-6\"\n [tabindex]=\"-1\"\n (click)=\"edit($event)\">\n <svg lucidePencil [size]=\"14\"></svg>\n </button>\n }\n <button\n monaButton\n look=\"ghost\"\n size=\"small\"\n [iconOnly]=\"true\"\n [attr.aria-label]=\"labels().remove\"\n [attr.title]=\"messages().remove\"\n class=\"w-6 h-6\"\n [tabindex]=\"-1\"\n (click)=\"remove($event)\">\n <svg lucideTrash2 [size]=\"14\"></svg>\n </button>\n }\n </div>\n}\n", dependencies: [{ kind: "directive", type: ButtonDirective, selector: "button[monaButton]", inputs: ["aria-haspopup", "disabled", "iconOnly", "loading", "look", "rounded", "selected", "size", "tabindex", "toggleable", "type", "class", "value"], outputs: ["lookChange", "selectedChange"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: LucideCheck, selector: "svg[lucideCheck]" }, { kind: "component", type: LucideOctagonAlert, selector: "svg[lucideOctagonAlert], svg[lucideAlertOctagon]" }, { kind: "component", type: LucideX, selector: "svg[lucideX]" }, { kind: "component", type: LucidePencil, selector: "svg[lucidePencil]" }, { kind: "component", type: LucideTrash2, selector: "svg[lucideTrash2]" }, { kind: "component", type: TooltipComponent, selector: "mona-tooltip", inputs: ["disabled", "hideDelay", "position", "rounded", "showDelay", "target"], outputs: ["hidden", "shown"] }] }); }
176
- }
177
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridCommandCellComponent, decorators: [{
178
- type: Component,
179
- args: [{ selector: "mona-grid-command-cell", imports: [
180
- ButtonDirective,
181
- NgTemplateOutlet,
182
- LucideCheck,
183
- LucideOctagonAlert,
184
- LucideX,
185
- LucidePencil,
186
- LucideTrash2,
187
- TooltipComponent
188
- ], host: {
189
- class: "flex items-center w-full min-h-9"
190
- }, template: "@if (column().commandTemplate) {\n <ng-container\n [ngTemplateOutlet]=\"column().commandTemplate\"\n [ngTemplateOutletContext]=\"commandContext()\"></ng-container>\n} @else {\n <div class=\"flex min-h-9 items-center gap-1 px-1\">\n @if (isEditing()) {\n @if (hasRowError()) {\n <span class=\"shrink-0 px-1 text-error\" aria-hidden=\"true\" #rowErrorIcon>\n <svg lucideOctagonAlert [size]=\"14\"></svg>\n </span>\n <mona-tooltip [target]=\"rowErrorIcon\">\n <span class=\"p-1 whitespace-pre-line\">{{ rowErrorTooltip() }}</span>\n </mona-tooltip>\n <span class=\"sr-only\" [id]=\"rowErrorId\">{{ rowErrorTooltip() }}</span>\n }\n <button\n monaButton\n look=\"ghost\"\n size=\"small\"\n [iconOnly]=\"true\"\n [attr.aria-label]=\"labels().save\"\n [attr.aria-describedby]=\"hasRowError() ? rowErrorId : null\"\n [attr.title]=\"messages().save\"\n class=\"w-6 h-6\"\n [tabindex]=\"-1\"\n (click)=\"save($event)\">\n <svg lucideCheck [size]=\"14\"></svg>\n </button>\n <button\n monaButton\n look=\"ghost\"\n size=\"small\"\n [iconOnly]=\"true\"\n [attr.aria-label]=\"labels().cancel\"\n [attr.title]=\"messages().cancel\"\n class=\"w-6 h-6\"\n [tabindex]=\"-1\"\n (click)=\"cancel($event)\">\n <svg lucideX [size]=\"14\"></svg>\n </button>\n } @else {\n @if (canEditRows()) {\n <button\n monaButton\n look=\"ghost\"\n size=\"small\"\n [iconOnly]=\"true\"\n [attr.aria-label]=\"labels().edit\"\n [attr.title]=\"messages().edit\"\n class=\"w-6 h-6\"\n [tabindex]=\"-1\"\n (click)=\"edit($event)\">\n <svg lucidePencil [size]=\"14\"></svg>\n </button>\n }\n <button\n monaButton\n look=\"ghost\"\n size=\"small\"\n [iconOnly]=\"true\"\n [attr.aria-label]=\"labels().remove\"\n [attr.title]=\"messages().remove\"\n class=\"w-6 h-6\"\n [tabindex]=\"-1\"\n (click)=\"remove($event)\">\n <svg lucideTrash2 [size]=\"14\"></svg>\n </button>\n }\n </div>\n}\n" }]
191
- }], propDecorators: { column: [{ type: i0.Input, args: [{ isSignal: true, alias: "column", required: true }] }], newRow: [{ type: i0.Input, args: [{ isSignal: true, alias: "newRow", required: false }] }], row: [{ type: i0.Input, args: [{ isSignal: true, alias: "row", required: false }] }] } });
192
-
193
- /** The controls Tab moves between in an edited row: each editor's first control and the row's command buttons. */
194
- const ROW_EDITOR_SELECTOR = "mona-grid-editor, mona-grid-command-cell";
195
- /** A number written the way JavaScript writes it, such as data from a server: `1234.5`, `-2e3`. */
196
- const MACHINE_NUMBER_PATTERN = /^[-+]?(\d+\.?\d*|\.\d+)(e[-+]?\d+)?$/i;
197
- class GridEditorComponent {
198
- #datePopupOpen;
199
- #elementRef;
200
- #gridService;
201
- #i18n;
202
- #logicalCell;
203
- /** Tab and Enter work on the whole row: in row edit mode and in the add row. */
204
- #rowEditing;
205
- #ignoreNextBooleanFocusOut;
206
- /** The date before the last change, whose time of day a picked day keeps. */
207
- #lastDateValue;
208
- constructor() {
209
- this.#datePopupOpen = signal(false, /* @ts-ignore */
210
- ...(ngDevMode ? [{ debugName: "#datePopupOpen" }] : /* istanbul ignore next */ []));
211
- this.#elementRef = inject((ElementRef));
212
- this.#gridService = inject(GridService, { optional: true });
213
- this.#i18n = inject(MonaI18nService, { optional: true });
214
- this.#logicalCell = inject(GridLogicalCellDirective, { optional: true });
215
- /** Tab and Enter work on the whole row: in row edit mode and in the add row. */
216
- this.#rowEditing = computed(() => this.isNew() || this.#gridService?.editContext()?.mode === "row", /* @ts-ignore */
217
- ...(ngDevMode ? [{ debugName: "#rowEditing" }] : /* istanbul ignore next */ []));
218
- this.#ignoreNextBooleanFocusOut = false;
219
- /** The date before the last change, whose time of day a picked day keeps. */
220
- this.#lastDateValue = null;
221
- this.numericTextBoxRef = viewChild(NumericTextBoxComponent, /* @ts-ignore */
222
- ...(ngDevMode ? [{ debugName: "numericTextBoxRef" }] : /* istanbul ignore next */ []));
223
- this.textBoxRef = viewChild(TextBoxComponent, /* @ts-ignore */
224
- ...(ngDevMode ? [{ debugName: "textBoxRef" }] : /* istanbul ignore next */ []));
225
- this.baseClass = computed(() => {
226
- return gridCellEditorBaseThemeVariants({ virtual: this.#gridService?.virtualScrollOptions().enabled ?? false });
227
- }, /* @ts-ignore */
228
- ...(ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []));
229
- /**
230
- * The form field typed for the editor that the column's data type picks. The column's type is the contract
231
- * for its values, so these narrow the field for the template instead of turning off its type checks.
232
- */
233
- this.booleanField = computed(() => this.formField(), /* @ts-ignore */
234
- ...(ngDevMode ? [{ debugName: "booleanField" }] : /* istanbul ignore next */ []));
235
- this.dateField = computed(() => this.formField(), /* @ts-ignore */
236
- ...(ngDevMode ? [{ debugName: "dateField" }] : /* istanbul ignore next */ []));
237
- this.editTemplateContext = computed(() => {
238
- const field = this.formField();
239
- if (field == null) {
240
- return null;
241
- }
242
- return {
243
- cancel: () => this.cancelEdit.emit(),
244
- column: this.column().field,
245
- commit: () => this.commit.emit("enter"),
246
- dataField: this.column().field,
247
- dataItem: this.session().model(),
248
- errors: field().errors(),
249
- field,
250
- form: this.session().form,
251
- invalid: field().invalid(),
252
- isNew: this.isNew(),
253
- session: this.session(),
254
- setValue: (value) => field().value.set(value),
255
- touched: field().touched(),
256
- value: field().value()
257
- };
258
- }, /* @ts-ignore */
259
- ...(ngDevMode ? [{ debugName: "editTemplateContext" }] : /* istanbul ignore next */ []));
260
- this.editorInputClass = computed(() => {
261
- return gridCellEditorInputThemeVariants({
262
- virtual: this.#gridService?.virtualScrollOptions().enabled ?? false
263
- });
264
- }, /* @ts-ignore */
265
- ...(ngDevMode ? [{ debugName: "editorInputClass" }] : /* istanbul ignore next */ []));
266
- /** The editor's accessible name: the column title, as the header that would name it is in another table. */
267
- this.editorLabel = computed(() => this.column().title || this.column().field, /* @ts-ignore */
268
- ...(ngDevMode ? [{ debugName: "editorLabel" }] : /* istanbul ignore next */ []));
269
- this.errorDescribedBy = computed(() => (this.hasFieldError() ? this.errorId : ""), /* @ts-ignore */
270
- ...(ngDevMode ? [{ debugName: "errorDescribedBy" }] : /* istanbul ignore next */ []));
271
- this.errorId = `mona-grid-editor-error-${v4()}`;
272
- this.fieldErrorMessage = computed(() => {
273
- const [firstError] = this.formField()?.().errors() ?? [];
274
- return firstError?.message ?? this.#gridService?.messages().fieldValidationError ?? "";
275
- }, /* @ts-ignore */
276
- ...(ngDevMode ? [{ debugName: "fieldErrorMessage" }] : /* istanbul ignore next */ []));
277
- /** The column's form field; null when the session has none, as for a value a signal form can't hold. */
278
- this.formField = computed(() => this.session().form[this.column().field] ?? null, /* @ts-ignore */
279
- ...(ngDevMode ? [{ debugName: "formField" }] : /* istanbul ignore next */ []));
280
- this.hasFieldError = computed(() => {
281
- const field = this.formField()?.();
282
- return field != null && field.invalid() && field.touched();
283
- }, /* @ts-ignore */
284
- ...(ngDevMode ? [{ debugName: "hasFieldError" }] : /* istanbul ignore next */ []));
285
- this.numberField = computed(() => this.formField(), /* @ts-ignore */
286
- ...(ngDevMode ? [{ debugName: "numberField" }] : /* istanbul ignore next */ []));
287
- this.readOnlyValue = computed(() => this.session().model()[this.column().field], /* @ts-ignore */
288
- ...(ngDevMode ? [{ debugName: "readOnlyValue" }] : /* istanbul ignore next */ []));
289
- this.stringField = computed(() => this.formField(), /* @ts-ignore */
290
- ...(ngDevMode ? [{ debugName: "stringField" }] : /* istanbul ignore next */ []));
291
- /**
292
- * @description Controls whether the editor focuses its input after it renders.
293
- */
294
- this.autoFocus = input(true, /* @ts-ignore */
295
- ...(ngDevMode ? [{ debugName: "autoFocus" }] : /* istanbul ignore next */ []));
296
- this.cancelEdit = output();
297
- this.column = input.required(/* @ts-ignore */
298
- ...(ngDevMode ? [{ debugName: "column" }] : /* istanbul ignore next */ []));
299
- this.commit = output();
300
- this.isNew = input(false, /* @ts-ignore */
301
- ...(ngDevMode ? [{ debugName: "isNew" }] : /* istanbul ignore next */ []));
302
- this.session = input.required(/* @ts-ignore */
303
- ...(ngDevMode ? [{ debugName: "session" }] : /* istanbul ignore next */ []));
304
- this.tabNavigate = output();
305
- /**
306
- * @description Enables Tab and Shift+Tab traversal between editable cells while cell editing.
307
- */
308
- this.tabNavigationEnabled = input(false, /* @ts-ignore */
309
- ...(ngDevMode ? [{ debugName: "tabNavigationEnabled" }] : /* istanbul ignore next */ []));
310
- effect(() => {
311
- if (this.formField() == null && isDevMode()) {
312
- console.warn(`mona-grid: column '${this.column().field}' has no form field in the edit session, so it is ` +
313
- "shown read-only. Give the row a value for the field, or set the column's editable to false.");
314
- }
315
- });
316
- effect(() => {
317
- if (this.column().dataType !== "number") {
318
- return;
319
- }
320
- const field = this.formField();
321
- if (field == null) {
322
- return;
323
- }
324
- const value = field().value();
325
- const coercedValue = this.#coerceNumberValue(value);
326
- if (Object.is(value, coercedValue)) {
327
- return;
328
- }
329
- untracked(() => field().value.set(coercedValue));
330
- });
331
- effect(() => {
332
- if (this.column().dataType !== "date") {
333
- return;
334
- }
335
- const field = this.formField();
336
- if (field == null) {
337
- return;
338
- }
339
- const value = field().value();
340
- untracked(() => this.#keepTimeOfDay(field, value));
341
- });
342
- afterNextRender({
343
- read: () => this.#focusEditor()
344
- });
345
- }
346
- onBooleanEditorClick() {
347
- this.#focusBooleanInput();
348
- }
349
- onBooleanEditorFocusOut(event) {
350
- const relatedTarget = event.relatedTarget;
351
- const editorHost = event.currentTarget;
352
- if (relatedTarget && editorHost.contains(relatedTarget)) {
353
- return;
354
- }
355
- if (this.#ignoreNextBooleanFocusOut) {
356
- return;
357
- }
358
- this.commit.emit("blur");
359
- }
360
- onBooleanEditorPointerDown() {
361
- this.#ignoreNextBooleanFocusOut = true;
362
- setTimeout(() => {
363
- this.#ignoreNextBooleanFocusOut = false;
364
- });
365
- }
366
- onDatePickerClose() {
367
- this.#datePopupOpen.set(false);
368
- }
369
- onDatePickerOpen() {
370
- this.#datePopupOpen.set(true);
371
- }
372
- /** Enter commits and Escape cancels, except while an IME composes or the date popup is open. */
373
- onEditorKeydown(event) {
374
- if (event.isComposing || event.keyCode === 229 || this.#datePopupOpen()) {
375
- return;
376
- }
377
- if (event.key === "Enter") {
378
- event.preventDefault();
379
- this.commit.emit("enter");
380
- }
381
- else if (event.key === "Escape" && !event.defaultPrevented) {
382
- event.preventDefault();
383
- this.cancelEdit.emit();
384
- }
385
- }
386
- onHostKeydown(event) {
387
- if (event.key !== "Tab" || event.defaultPrevented || event.isComposing) {
388
- return;
389
- }
390
- if (this.tabNavigationEnabled()) {
391
- event.preventDefault();
392
- event.stopPropagation();
393
- this.tabNavigate.emit(event.shiftKey ? "previous" : "next");
394
- return;
395
- }
396
- if (!this.#rowEditing()) {
397
- return;
398
- }
399
- // Tab moves between the row's editors and commands; past either end it leaves the grid.
400
- event.preventDefault();
401
- event.stopPropagation();
402
- if (!this.#focusSiblingControl(event.shiftKey)) {
403
- this.#logicalCell?.leaveGrid(event.shiftKey);
404
- }
405
- }
406
- #coerceNumberValue(value) {
407
- if (typeof value === "number") {
408
- return Number.isFinite(value) ? value : null;
409
- }
410
- if (typeof value !== "string") {
411
- return null;
412
- }
413
- const text = value.trim();
414
- if (text === "") {
415
- return null;
416
- }
417
- if (MACHINE_NUMBER_PATTERN.test(text)) {
418
- const numberValue = Number(text);
419
- return Number.isFinite(numberValue) ? numberValue : null;
420
- }
421
- // Text as a person writes it in the grid's locale: "1.234,5" in de-DE.
422
- return parseLocalizedNumber(text, this.#i18n?.localeId() ?? "en-US");
423
- }
424
- #focusBooleanInput() {
425
- const checkbox = this.#elementRef.nativeElement.querySelector('input[type="checkbox"]');
426
- checkbox?.focus();
427
- }
428
- #focusEditor() {
429
- if (!this.autoFocus()) {
430
- return;
431
- }
432
- if (this.column().editTemplate) {
433
- this.#focusTemplateTarget();
434
- return;
435
- }
436
- this.textBoxRef()?.focus();
437
- this.numericTextBoxRef()?.focus();
438
- const type = this.column().dataType;
439
- if (type === "date") {
440
- const inputElement = this.#elementRef.nativeElement.querySelector("input");
441
- inputElement?.focus();
442
- }
443
- if (type === "boolean") {
444
- this.#focusBooleanInput();
445
- }
446
- }
447
- /** Focuses the next or previous editor or command button in the row; false at either end. */
448
- #focusSiblingControl(backwards) {
449
- const host = this.#elementRef.nativeElement;
450
- const row = host.closest("tr");
451
- if (row == null) {
452
- return false;
453
- }
454
- const controls = [];
455
- let current = -1;
456
- for (const container of Array.from(row.querySelectorAll(ROW_EDITOR_SELECTOR))) {
457
- const targets = this.#focusTargets(container);
458
- if (container === host) {
459
- current = controls.length;
460
- }
461
- // An editor is one stop; the command cell's buttons are one each.
462
- controls.push(...(container.localName === "mona-grid-editor" ? targets.slice(0, 1) : targets));
463
- }
464
- if (current < 0) {
465
- return false;
466
- }
467
- const target = controls[backwards ? current - 1 : current + 1];
468
- if (target == null) {
469
- return false;
470
- }
471
- target.focus();
472
- return true;
473
- }
474
- #focusTargets(container) {
475
- return Array.from(container.querySelectorAll(GRID_CELL_FOCUSABLE_SELECTOR)).filter(candidate => !candidate.hasAttribute("disabled") &&
476
- candidate.getAttribute("aria-hidden") !== "true" &&
477
- candidate.closest("[aria-hidden='true'], [hidden], [inert]") == null);
478
- }
479
- #focusTemplateTarget() {
480
- this.#focusTargets(this.#elementRef.nativeElement)[0]?.focus();
481
- }
482
- /**
483
- * Keeps the time of day when a new day is picked: the date picker gives midnight, which would drop the time a
484
- * value had.
485
- */
486
- #keepTimeOfDay(field, value) {
487
- const previous = this.#lastDateValue;
488
- this.#lastDateValue = value instanceof Date ? value : null;
489
- if (!(value instanceof Date) || previous == null || value === previous || Number.isNaN(value.getTime())) {
490
- return;
491
- }
492
- const midnight = (date) => date.getHours() === 0 && date.getMinutes() === 0 && date.getSeconds() === 0 && date.getMilliseconds() === 0;
493
- if (!midnight(value) || midnight(previous)) {
494
- return;
495
- }
496
- const withTime = new Date(value);
497
- withTime.setHours(previous.getHours(), previous.getMinutes(), previous.getSeconds(), previous.getMilliseconds());
498
- this.#lastDateValue = withTime;
499
- field().value.set(withTime);
500
- }
501
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridEditorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
502
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: GridEditorComponent, isStandalone: true, selector: "mona-grid-editor", inputs: { autoFocus: { classPropertyName: "autoFocus", publicName: "autoFocus", isSignal: true, isRequired: false, transformFunction: null }, column: { classPropertyName: "column", publicName: "column", isSignal: true, isRequired: true, transformFunction: null }, isNew: { classPropertyName: "isNew", publicName: "isNew", isSignal: true, isRequired: false, transformFunction: null }, session: { classPropertyName: "session", publicName: "session", isSignal: true, isRequired: true, transformFunction: null }, tabNavigationEnabled: { classPropertyName: "tabNavigationEnabled", publicName: "tabNavigationEnabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { cancelEdit: "cancelEdit", commit: "commit", tabNavigate: "tabNavigate" }, host: { listeners: { "keydown": "onHostKeydown($event)" }, properties: { "class": "baseClass()" } }, viewQueries: [{ propertyName: "numericTextBoxRef", first: true, predicate: NumericTextBoxComponent, descendants: true, isSignal: true }, { propertyName: "textBoxRef", first: true, predicate: TextBoxComponent, descendants: true, isSignal: true }], ngImport: i0, template: "@if (formField()) {\n @if (column().editTemplate) {\n <ng-container\n [ngTemplateOutlet]=\"column().editTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: editTemplateContext() }\"></ng-container>\n } @else {\n <div class=\"relative flex items-center w-full min-h-8\">\n @switch (column().dataType) {\n @case (\"string\") {\n @if (stringField(); as field) {\n <mona-text-box\n [class]=\"editorInputClass()\"\n [inputAttributes]=\"{ autocomplete: 'off' }\"\n [rounded]=\"'none'\"\n [formField]=\"field\"\n [aria-label]=\"editorLabel()\"\n [aria-describedby]=\"errorDescribedBy()\"\n (keydown)=\"onEditorKeydown($event)\"\n (inputBlur)=\"commit.emit('blur')\"\n [size]=\"'small'\"></mona-text-box>\n }\n }\n @case (\"number\") {\n @if (numberField(); as field) {\n <mona-numeric-text-box\n [class]=\"editorInputClass()\"\n [rounded]=\"'none'\"\n [formField]=\"field\"\n [aria-label]=\"editorLabel()\"\n [aria-describedby]=\"errorDescribedBy()\"\n (keydown)=\"onEditorKeydown($event)\"\n (inputBlur)=\"commit.emit('blur')\"\n [size]=\"'small'\"></mona-numeric-text-box>\n }\n }\n @case (\"boolean\") {\n @if (booleanField(); as field) {\n <mona-check-box\n class=\"{{ editorInputClass() }} ms-2\"\n [rounded]=\"'none'\"\n [formField]=\"field\"\n [aria-label]=\"editorLabel()\"\n [aria-describedby]=\"errorDescribedBy()\"\n (click)=\"onBooleanEditorClick()\"\n (focusout)=\"onBooleanEditorFocusOut($event)\"\n (pointerdown)=\"onBooleanEditorPointerDown()\"\n (keydown)=\"onEditorKeydown($event)\"></mona-check-box>\n }\n }\n @case (\"date\") {\n @if (dateField(); as field) {\n <mona-date-picker\n [class]=\"editorInputClass()\"\n [rounded]=\"'none'\"\n [formField]=\"field\"\n [aria-label]=\"editorLabel()\"\n [aria-describedby]=\"errorDescribedBy()\"\n (keydown)=\"onEditorKeydown($event)\"\n (touch)=\"commit.emit('blur')\"\n (opened)=\"onDatePickerOpen()\"\n (closed)=\"onDatePickerClose()\"\n size=\"small\"></mona-date-picker>\n }\n }\n }\n @if (hasFieldError()) {\n <span class=\"shrink-0 px-1 text-error\" aria-hidden=\"true\" #fieldErrorIcon>\n <svg lucideOctagonAlert [size]=\"12\"></svg>\n </span>\n <mona-tooltip [target]=\"fieldErrorIcon\">\n <span class=\"p-1\">{{ fieldErrorMessage() }}</span>\n </mona-tooltip>\n <span class=\"sr-only\" [id]=\"errorId\">{{ fieldErrorMessage() }}</span>\n }\n </div>\n }\n} @else {\n <span class=\"block truncate px-2\">{{ readOnlyValue() }}</span>\n}\n", dependencies: [{ kind: "component", type: CheckBoxComponent, selector: "mona-check-box", inputs: ["aria-describedby", "aria-label", "aria-labelledby", "checked", "disabled", "indeterminate", "inputId", "invalid", "label", "labelPosition", "labelSize", "name", "readonly", "required", "rounded", "tabIndex", "touched", "class"], outputs: ["checkedChange", "indeterminateChange", "inputBlur", "inputChange", "inputFocus", "touch"] }, { kind: "component", type: DatePickerComponent, selector: "mona-date-picker", inputs: ["aria-describedby", "aria-label", "aria-labelledby", "disabled", "disabledDates", "firstDay", "format", "inputId", "invalid", "max", "min", "placeholder", "popupClass", "popupHeight", "popupWidth", "readonly", "readonlyInput", "required", "rounded", "showClearButton", "size", "touched", "class", "value", "weekNumber"], outputs: ["close", "closed", "open", "opened", "touch", "valueChange"] }, { kind: "directive", type: FormField, selector: "[formField]", inputs: ["formField"], exportAs: ["formField"] }, { kind: "component", type: LucideOctagonAlert, selector: "svg[lucideOctagonAlert], svg[lucideAlertOctagon]" }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: NumericTextBoxComponent, selector: "mona-numeric-text-box", inputs: ["formatter", "maxValue", "minValue", "step", "value"], outputs: ["valueChange"] }, { kind: "component", type: TextBoxComponent, selector: "mona-text-box", inputs: ["aria-describedby", "aria-label", "aria-labelledby", "clearButton", "disabled", "inputAttributes", "inputClass", "inputId", "inputStyle", "invalid", "maxLength", "minLength", "name", "placeholder", "readonly", "required", "rounded", "size", "touched", "type", "class", "value"], outputs: ["inputBlur", "inputFocus", "touch", "valueChange"] }, { kind: "component", type: TooltipComponent, selector: "mona-tooltip", inputs: ["disabled", "hideDelay", "position", "rounded", "showDelay", "target"], outputs: ["hidden", "shown"] }] }); }
503
- }
504
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridEditorComponent, decorators: [{
505
- type: Component,
506
- args: [{ selector: "mona-grid-editor", imports: [
507
- CheckBoxComponent,
508
- DatePickerComponent,
509
- FormField,
510
- LucideOctagonAlert,
511
- NgTemplateOutlet,
512
- NumericTextBoxComponent,
513
- TextBoxComponent,
514
- TooltipComponent
515
- ], host: {
516
- "[class]": "baseClass()",
517
- "(keydown)": "onHostKeydown($event)"
518
- }, template: "@if (formField()) {\n @if (column().editTemplate) {\n <ng-container\n [ngTemplateOutlet]=\"column().editTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: editTemplateContext() }\"></ng-container>\n } @else {\n <div class=\"relative flex items-center w-full min-h-8\">\n @switch (column().dataType) {\n @case (\"string\") {\n @if (stringField(); as field) {\n <mona-text-box\n [class]=\"editorInputClass()\"\n [inputAttributes]=\"{ autocomplete: 'off' }\"\n [rounded]=\"'none'\"\n [formField]=\"field\"\n [aria-label]=\"editorLabel()\"\n [aria-describedby]=\"errorDescribedBy()\"\n (keydown)=\"onEditorKeydown($event)\"\n (inputBlur)=\"commit.emit('blur')\"\n [size]=\"'small'\"></mona-text-box>\n }\n }\n @case (\"number\") {\n @if (numberField(); as field) {\n <mona-numeric-text-box\n [class]=\"editorInputClass()\"\n [rounded]=\"'none'\"\n [formField]=\"field\"\n [aria-label]=\"editorLabel()\"\n [aria-describedby]=\"errorDescribedBy()\"\n (keydown)=\"onEditorKeydown($event)\"\n (inputBlur)=\"commit.emit('blur')\"\n [size]=\"'small'\"></mona-numeric-text-box>\n }\n }\n @case (\"boolean\") {\n @if (booleanField(); as field) {\n <mona-check-box\n class=\"{{ editorInputClass() }} ms-2\"\n [rounded]=\"'none'\"\n [formField]=\"field\"\n [aria-label]=\"editorLabel()\"\n [aria-describedby]=\"errorDescribedBy()\"\n (click)=\"onBooleanEditorClick()\"\n (focusout)=\"onBooleanEditorFocusOut($event)\"\n (pointerdown)=\"onBooleanEditorPointerDown()\"\n (keydown)=\"onEditorKeydown($event)\"></mona-check-box>\n }\n }\n @case (\"date\") {\n @if (dateField(); as field) {\n <mona-date-picker\n [class]=\"editorInputClass()\"\n [rounded]=\"'none'\"\n [formField]=\"field\"\n [aria-label]=\"editorLabel()\"\n [aria-describedby]=\"errorDescribedBy()\"\n (keydown)=\"onEditorKeydown($event)\"\n (touch)=\"commit.emit('blur')\"\n (opened)=\"onDatePickerOpen()\"\n (closed)=\"onDatePickerClose()\"\n size=\"small\"></mona-date-picker>\n }\n }\n }\n @if (hasFieldError()) {\n <span class=\"shrink-0 px-1 text-error\" aria-hidden=\"true\" #fieldErrorIcon>\n <svg lucideOctagonAlert [size]=\"12\"></svg>\n </span>\n <mona-tooltip [target]=\"fieldErrorIcon\">\n <span class=\"p-1\">{{ fieldErrorMessage() }}</span>\n </mona-tooltip>\n <span class=\"sr-only\" [id]=\"errorId\">{{ fieldErrorMessage() }}</span>\n }\n </div>\n }\n} @else {\n <span class=\"block truncate px-2\">{{ readOnlyValue() }}</span>\n}\n" }]
519
- }], ctorParameters: () => [], propDecorators: { numericTextBoxRef: [{ type: i0.ViewChild, args: [i0.forwardRef(() => NumericTextBoxComponent), { isSignal: true }] }], textBoxRef: [{ type: i0.ViewChild, args: [i0.forwardRef(() => TextBoxComponent), { isSignal: true }] }], autoFocus: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoFocus", required: false }] }], cancelEdit: [{ type: i0.Output, args: ["cancelEdit"] }], column: [{ type: i0.Input, args: [{ isSignal: true, alias: "column", required: true }] }], commit: [{ type: i0.Output, args: ["commit"] }], isNew: [{ type: i0.Input, args: [{ isSignal: true, alias: "isNew", required: false }] }], session: [{ type: i0.Input, args: [{ isSignal: true, alias: "session", required: true }] }], tabNavigate: [{ type: i0.Output, args: ["tabNavigate"] }], tabNavigationEnabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "tabNavigationEnabled", required: false }] }] } });
520
-
521
- class GridAddRowComponent {
522
- constructor() {
523
- this.#gridNavigationService = inject(GridNavigationService);
524
- this.baseClass = computed(() => {
525
- return gridListTableRowThemeVariants({ selected: false });
526
- }, /* @ts-ignore */
527
- ...(ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []));
528
- this.firstEditableColumn = computed(() => this.gridService.visibleColumns().firstOrDefault(column => column.kind === "data" && column.editable), /* @ts-ignore */
529
- ...(ngDevMode ? [{ debugName: "firstEditableColumn" }] : /* istanbul ignore next */ []));
530
- this.gridService = inject(GridService);
531
- this.structuralColumnIds = {
532
- detail: undefined,
533
- reorder: "$rowReorder",
534
- selection: "$selection"
535
- };
536
- }
537
- #gridNavigationService;
538
- /** Escape discards the new row; focus goes to the nearest cell once the row is gone. */
539
- onCancel() {
540
- if (this.gridService.cancelAddRow(undefined, "escape")) {
541
- this.#gridNavigationService.refocusAfterRender();
542
- }
543
- }
544
- /** Enter saves the new row (validated); leaving an editor keeps the row open. */
545
- onCommit(trigger) {
546
- if (trigger === "enter" && this.gridService.saveAddRow()) {
547
- this.#gridNavigationService.refocusAfterRender();
548
- }
549
- }
550
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridAddRowComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
551
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: GridAddRowComponent, isStandalone: true, selector: "tr[monaGridAddRow]", host: { attributes: { "role": "row", "data-grid-add-row": "true" }, properties: { "class": "baseClass()", "attr.aria-rowindex": "gridService.headerRowCount() + 1" } }, ngImport: i0, template: "@if (gridService.addRowData(); as rowData) {\n @let session = gridService.editSession();\n @for (layoutColumn of gridService.layout(); track layoutColumn.key) {\n @if (layoutColumn.kind === \"column\") {\n @let column = layoutColumn.column;\n <td\n monaGridCell\n [monaGridLockedCell]=\"layoutColumn.key\"\n monaGridLogicalCell\n [cellKind]=\"column.kind\"\n [colIndex]=\"layoutColumn.logicalIndex\"\n [columnId]=\"column.id\"\n [rowIndex]=\"-1\"\n [section]=\"'add'\"\n [firstInRow]=\"layoutColumn.firstInRow\"\n [lastInRow]=\"layoutColumn.lastInRow\">\n @if (column.kind === \"command\") {\n <mona-grid-command-cell [column]=\"column\" [newRow]=\"true\"></mona-grid-command-cell>\n } @else if (column.editable && session) {\n <mona-grid-editor\n [column]=\"column\"\n [autoFocus]=\"column === firstEditableColumn()\"\n [isNew]=\"true\"\n [session]=\"session\"\n (commit)=\"onCommit($event)\"\n (cancelEdit)=\"onCancel()\"></mona-grid-editor>\n } @else {\n <span class=\"block truncate px-2\">{{ rowData[column.field] }}</span>\n }\n </td>\n } @else if (layoutColumn.kind === \"group\") {\n <td\n monaGridCell\n [monaGridLockedCell]=\"layoutColumn.key\"\n [lockedCellHeader]=\"true\"\n [groupIndent]=\"true\"></td>\n } @else {\n <td\n monaGridCell\n monaGridLogicalCell\n [monaGridLockedCell]=\"layoutColumn.key\"\n [rowIndex]=\"-1\"\n [colIndex]=\"layoutColumn.logicalIndex\"\n [cellKind]=\"layoutColumn.kind === 'detail' ? 'detail' : 'command'\"\n [columnId]=\"structuralColumnIds[layoutColumn.kind]\"\n [firstInRow]=\"layoutColumn.firstInRow\"\n [lastInRow]=\"layoutColumn.lastInRow\"\n [section]=\"'add'\"></td>\n }\n }\n}\n", dependencies: [{ kind: "directive", type: GridCellDirective, selector: "td[monaGridCell]", inputs: ["groupHeader", "groupIndent", "lastInRow"] }, { kind: "component", type: GridCommandCellComponent, selector: "mona-grid-command-cell", inputs: ["column", "newRow", "row"] }, { kind: "component", type: GridEditorComponent, selector: "mona-grid-editor", inputs: ["autoFocus", "column", "isNew", "session", "tabNavigationEnabled"], outputs: ["cancelEdit", "commit", "tabNavigate"] }, { kind: "directive", type: GridLockedCellDirective, selector: "td[monaGridLockedCell], th[monaGridLockedCell]", inputs: ["monaGridLockedCell", "lockedCellHeader"] }, { kind: "directive", type: GridLogicalCellDirective, selector: "td[monaGridLogicalCell], th[monaGridLogicalCell]", inputs: ["ariaColIndex", "cellKind", "colIndex", "columnId", "editable", "expanded", "firstInRow", "groupHeader", "groupKey", "lastInRow", "readOnly", "rowIndex", "rowUid", "section"], outputs: ["edit", "menuOpen", "toggleExpand"] }] }); }
552
- }
553
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridAddRowComponent, decorators: [{
554
- type: Component,
555
- args: [{ selector: "tr[monaGridAddRow]", imports: [
556
- GridCellDirective,
557
- GridCommandCellComponent,
558
- GridEditorComponent,
559
- GridLockedCellDirective,
560
- GridLogicalCellDirective
561
- ], host: {
562
- "[class]": "baseClass()",
563
- role: "row",
564
- "[attr.aria-rowindex]": "gridService.headerRowCount() + 1",
565
- "data-grid-add-row": "true"
566
- }, template: "@if (gridService.addRowData(); as rowData) {\n @let session = gridService.editSession();\n @for (layoutColumn of gridService.layout(); track layoutColumn.key) {\n @if (layoutColumn.kind === \"column\") {\n @let column = layoutColumn.column;\n <td\n monaGridCell\n [monaGridLockedCell]=\"layoutColumn.key\"\n monaGridLogicalCell\n [cellKind]=\"column.kind\"\n [colIndex]=\"layoutColumn.logicalIndex\"\n [columnId]=\"column.id\"\n [rowIndex]=\"-1\"\n [section]=\"'add'\"\n [firstInRow]=\"layoutColumn.firstInRow\"\n [lastInRow]=\"layoutColumn.lastInRow\">\n @if (column.kind === \"command\") {\n <mona-grid-command-cell [column]=\"column\" [newRow]=\"true\"></mona-grid-command-cell>\n } @else if (column.editable && session) {\n <mona-grid-editor\n [column]=\"column\"\n [autoFocus]=\"column === firstEditableColumn()\"\n [isNew]=\"true\"\n [session]=\"session\"\n (commit)=\"onCommit($event)\"\n (cancelEdit)=\"onCancel()\"></mona-grid-editor>\n } @else {\n <span class=\"block truncate px-2\">{{ rowData[column.field] }}</span>\n }\n </td>\n } @else if (layoutColumn.kind === \"group\") {\n <td\n monaGridCell\n [monaGridLockedCell]=\"layoutColumn.key\"\n [lockedCellHeader]=\"true\"\n [groupIndent]=\"true\"></td>\n } @else {\n <td\n monaGridCell\n monaGridLogicalCell\n [monaGridLockedCell]=\"layoutColumn.key\"\n [rowIndex]=\"-1\"\n [colIndex]=\"layoutColumn.logicalIndex\"\n [cellKind]=\"layoutColumn.kind === 'detail' ? 'detail' : 'command'\"\n [columnId]=\"structuralColumnIds[layoutColumn.kind]\"\n [firstInRow]=\"layoutColumn.firstInRow\"\n [lastInRow]=\"layoutColumn.lastInRow\"\n [section]=\"'add'\"></td>\n }\n }\n}\n" }]
567
- }] });
568
-
569
- class GridToggleComponent {
570
- constructor() {
571
- this.collapseIcon = computed(() => {
572
- const type = this.type();
573
- return type === "detail" ? LucideMinus : LucideChevronDown;
574
- }, /* @ts-ignore */
575
- ...(ngDevMode ? [{ debugName: "collapseIcon" }] : /* istanbul ignore next */ []));
576
- this.expandIcon = computed(() => {
577
- const type = this.type();
578
- return type === "detail" ? LucidePlus : LucideChevronRight;
579
- }, /* @ts-ignore */
580
- ...(ngDevMode ? [{ debugName: "expandIcon" }] : /* istanbul ignore next */ []));
581
- this.expanded = model.required(/* @ts-ignore */
582
- ...(ngDevMode ? [{ debugName: "expanded" }] : /* istanbul ignore next */ []));
583
- /** The detail toggle button's name, such as "Expand details of row 3". */
584
- this.label = input(null, /* @ts-ignore */
585
- ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
586
- this.type = input.required(/* @ts-ignore */
587
- ...(ngDevMode ? [{ debugName: "type" }] : /* istanbul ignore next */ []));
588
- this.width = input.required(/* @ts-ignore */
589
- ...(ngDevMode ? [{ debugName: "width" }] : /* istanbul ignore next */ []));
590
- }
591
- onToggleDetailClick(event) {
592
- event.stopPropagation();
593
- this.expanded.update(v => !v);
594
- }
595
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridToggleComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
596
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: GridToggleComponent, isStandalone: true, selector: "mona-grid-toggle", inputs: { expanded: { classPropertyName: "expanded", publicName: "expanded", isSignal: true, isRequired: true, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: true, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { expanded: "expandedChange" }, ngImport: i0, template: "@if (type() === \"detail\") {\n <button\n type=\"button\"\n [style.width.px]=\"width()\"\n class=\"inline-flex items-center justify-center min-h-9 aspect-square cursor-pointer outline-none focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-focus-indicator\"\n [attr.aria-expanded]=\"expanded()\"\n [attr.aria-label]=\"label()\"\n (click)=\"onToggleDetailClick($event)\">\n @if (expanded()) {\n <svg [lucideIcon]=\"collapseIcon()\" [size]=\"16\" aria-hidden=\"true\"></svg>\n } @else {\n <svg [lucideIcon]=\"expandIcon()\" [size]=\"16\" aria-hidden=\"true\"></svg>\n }\n </button>\n} @else {\n <!-- The group row carries aria-expanded, and its cell expands with Enter and the arrows. -->\n <span\n [style.width.px]=\"width()\"\n class=\"inline-flex items-center justify-center min-h-9 aspect-square\"\n aria-hidden=\"true\"\n (click)=\"onToggleDetailClick($event)\">\n @if (expanded()) {\n <svg [lucideIcon]=\"collapseIcon()\" [size]=\"16\"></svg>\n } @else {\n <svg [lucideIcon]=\"expandIcon()\" [size]=\"16\"></svg>\n }\n </span>\n}\n", dependencies: [{ kind: "component", type: LucideDynamicIcon, selector: "svg[lucideIcon]", inputs: ["lucideIcon"] }] }); }
597
- }
598
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridToggleComponent, decorators: [{
599
- type: Component,
600
- args: [{ selector: "mona-grid-toggle", imports: [LucideDynamicIcon], template: "@if (type() === \"detail\") {\n <button\n type=\"button\"\n [style.width.px]=\"width()\"\n class=\"inline-flex items-center justify-center min-h-9 aspect-square cursor-pointer outline-none focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-focus-indicator\"\n [attr.aria-expanded]=\"expanded()\"\n [attr.aria-label]=\"label()\"\n (click)=\"onToggleDetailClick($event)\">\n @if (expanded()) {\n <svg [lucideIcon]=\"collapseIcon()\" [size]=\"16\" aria-hidden=\"true\"></svg>\n } @else {\n <svg [lucideIcon]=\"expandIcon()\" [size]=\"16\" aria-hidden=\"true\"></svg>\n }\n </button>\n} @else {\n <!-- The group row carries aria-expanded, and its cell expands with Enter and the arrows. -->\n <span\n [style.width.px]=\"width()\"\n class=\"inline-flex items-center justify-center min-h-9 aspect-square\"\n aria-hidden=\"true\"\n (click)=\"onToggleDetailClick($event)\">\n @if (expanded()) {\n <svg [lucideIcon]=\"collapseIcon()\" [size]=\"16\"></svg>\n } @else {\n <svg [lucideIcon]=\"expandIcon()\" [size]=\"16\"></svg>\n }\n </span>\n}\n" }]
601
- }], propDecorators: { expanded: [{ type: i0.Input, args: [{ isSignal: true, alias: "expanded", required: true }] }, { type: i0.Output, args: ["expandedChange"] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], type: [{ type: i0.Input, args: [{ isSignal: true, alias: "type", required: true }] }], width: [{ type: i0.Input, args: [{ isSignal: true, alias: "width", required: true }] }] } });
602
-
603
- /**
604
- * A group header row. It indents by the group depth, and its title cell spans the remaining columns.
605
- */
606
- class GridGroupRowComponent {
607
- constructor() {
608
- this.collapsed = computed(() => this.gridService.isGroupCollapsed(this.group().groupKey), /* @ts-ignore */
609
- ...(ngDevMode ? [{ debugName: "collapsed" }] : /* istanbul ignore next */ []));
610
- this.gridService = inject(GridService);
611
- this.indentColumns = computed(() => this.gridService.layout().filter(column => column.kind === "group" && column.depth < this.group().depth), /* @ts-ignore */
612
- ...(ngDevMode ? [{ debugName: "indentColumns" }] : /* istanbul ignore next */ []));
613
- this.rowClass = computed(() => gridGroupRowThemeVariants({ virtual: this.gridService.virtualScrollOptions().enabled }), /* @ts-ignore */
614
- ...(ngDevMode ? [{ debugName: "rowClass" }] : /* istanbul ignore next */ []));
615
- this.titleClass = computed(() => this.gridService.virtualScrollOptions().enabled
616
- ? "absolute inset-0 flex items-center text-sm whitespace-nowrap overflow-hidden"
617
- : "flex min-h-9 items-center text-sm whitespace-nowrap", /* @ts-ignore */
618
- ...(ngDevMode ? [{ debugName: "titleClass" }] : /* istanbul ignore next */ []));
619
- /** The title cell comes after the indents and the reorder placeholder. */
620
- this.titleColIndex = computed(() => this.group().depth + (this.gridService.rowReorderColumnVisible() ? 1 : 0) + 1, /* @ts-ignore */
621
- ...(ngDevMode ? [{ debugName: "titleColIndex" }] : /* istanbul ignore next */ []));
622
- // Everything after the indents and the reorder placeholder.
623
- this.titleColspan = computed(() => this.gridService.layout().length - this.group().depth - (this.gridService.rowReorderColumnVisible() ? 1 : 0), /* @ts-ignore */
624
- ...(ngDevMode ? [{ debugName: "titleColspan" }] : /* istanbul ignore next */ []));
625
- this.ariaRowIndex = input(null, /* @ts-ignore */
626
- ...(ngDevMode ? [{ debugName: "ariaRowIndex" }] : /* istanbul ignore next */ []));
627
- this.group = input.required(/* @ts-ignore */
628
- ...(ngDevMode ? [{ debugName: "group" }] : /* istanbul ignore next */ []));
629
- /** The index of this row among the rendered body rows. */
630
- this.rowIndex = input.required(/* @ts-ignore */
631
- ...(ngDevMode ? [{ debugName: "rowIndex" }] : /* istanbul ignore next */ []));
632
- }
633
- toggle() {
634
- this.gridService.toggleGroupCollapse(this.group().groupKey);
635
- }
636
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridGroupRowComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
637
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: GridGroupRowComponent, isStandalone: true, selector: "tr[monaGridGroupRow]", inputs: { ariaRowIndex: { classPropertyName: "ariaRowIndex", publicName: "ariaRowIndex", isSignal: true, isRequired: false, transformFunction: null }, group: { classPropertyName: "group", publicName: "group", isSignal: true, isRequired: true, transformFunction: null }, rowIndex: { classPropertyName: "rowIndex", publicName: "rowIndex", isSignal: true, isRequired: true, transformFunction: null } }, host: { attributes: { "role": "row" }, properties: { "class": "rowClass()", "attr.aria-level": "group().depth + 1", "attr.aria-expanded": "!collapsed()", "attr.aria-rowindex": "ariaRowIndex()" } }, ngImport: i0, template: "@for (layoutColumn of indentColumns(); track layoutColumn.key) {\n <td monaGridCell [monaGridLockedCell]=\"layoutColumn.key\" [lockedCellHeader]=\"true\" [groupIndent]=\"true\"></td>\n}\n@if (gridService.rowReorderColumnVisible()) {\n <!-- Sits right after the indents, so it pins like the group column at this depth. -->\n <td\n monaGridCell\n [monaGridLockedCell]=\"'group:' + group().depth\"\n [lockedCellHeader]=\"true\"\n [groupIndent]=\"true\"></td>\n}\n<td\n monaGridCell\n monaGridLogicalCell\n [cellKind]=\"'group'\"\n [rowIndex]=\"rowIndex()\"\n [colIndex]=\"0\"\n [section]=\"'body'\"\n [groupHeader]=\"true\"\n [firstInRow]=\"true\"\n [lastInRow]=\"gridService.visibleColumns().length === 0\"\n [groupKey]=\"group().groupKey\"\n [expanded]=\"!collapsed()\"\n [ariaColIndex]=\"titleColIndex()\"\n [attr.colspan]=\"titleColspan()\"\n (toggleExpand)=\"toggle()\">\n <p [class]=\"titleClass()\">\n <mona-grid-toggle\n [expanded]=\"!collapsed()\"\n [width]=\"gridService.groupColumnWidth\"\n [type]=\"'group'\"\n (expandedChange)=\"toggle()\" />\n <span class=\"font-bold\">{{ group().title }}: {{ group().groupValue }}</span>\n </p>\n</td>\n", dependencies: [{ kind: "directive", type: GridCellDirective, selector: "td[monaGridCell]", inputs: ["groupHeader", "groupIndent", "lastInRow"] }, { kind: "directive", type: GridLockedCellDirective, selector: "td[monaGridLockedCell], th[monaGridLockedCell]", inputs: ["monaGridLockedCell", "lockedCellHeader"] }, { kind: "directive", type: GridLogicalCellDirective, selector: "td[monaGridLogicalCell], th[monaGridLogicalCell]", inputs: ["ariaColIndex", "cellKind", "colIndex", "columnId", "editable", "expanded", "firstInRow", "groupHeader", "groupKey", "lastInRow", "readOnly", "rowIndex", "rowUid", "section"], outputs: ["edit", "menuOpen", "toggleExpand"] }, { kind: "component", type: GridToggleComponent, selector: "mona-grid-toggle", inputs: ["expanded", "label", "type", "width"], outputs: ["expandedChange"] }] }); }
638
- }
639
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridGroupRowComponent, decorators: [{
640
- type: Component,
641
- args: [{ selector: "tr[monaGridGroupRow]", imports: [GridCellDirective, GridLockedCellDirective, GridLogicalCellDirective, GridToggleComponent], host: {
642
- "[class]": "rowClass()",
643
- role: "row",
644
- "[attr.aria-level]": "group().depth + 1",
645
- "[attr.aria-expanded]": "!collapsed()",
646
- "[attr.aria-rowindex]": "ariaRowIndex()"
647
- }, template: "@for (layoutColumn of indentColumns(); track layoutColumn.key) {\n <td monaGridCell [monaGridLockedCell]=\"layoutColumn.key\" [lockedCellHeader]=\"true\" [groupIndent]=\"true\"></td>\n}\n@if (gridService.rowReorderColumnVisible()) {\n <!-- Sits right after the indents, so it pins like the group column at this depth. -->\n <td\n monaGridCell\n [monaGridLockedCell]=\"'group:' + group().depth\"\n [lockedCellHeader]=\"true\"\n [groupIndent]=\"true\"></td>\n}\n<td\n monaGridCell\n monaGridLogicalCell\n [cellKind]=\"'group'\"\n [rowIndex]=\"rowIndex()\"\n [colIndex]=\"0\"\n [section]=\"'body'\"\n [groupHeader]=\"true\"\n [firstInRow]=\"true\"\n [lastInRow]=\"gridService.visibleColumns().length === 0\"\n [groupKey]=\"group().groupKey\"\n [expanded]=\"!collapsed()\"\n [ariaColIndex]=\"titleColIndex()\"\n [attr.colspan]=\"titleColspan()\"\n (toggleExpand)=\"toggle()\">\n <p [class]=\"titleClass()\">\n <mona-grid-toggle\n [expanded]=\"!collapsed()\"\n [width]=\"gridService.groupColumnWidth\"\n [type]=\"'group'\"\n (expandedChange)=\"toggle()\" />\n <span class=\"font-bold\">{{ group().title }}: {{ group().groupValue }}</span>\n </p>\n</td>\n" }]
648
- }], propDecorators: { ariaRowIndex: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaRowIndex", required: false }] }], group: [{ type: i0.Input, args: [{ isSignal: true, alias: "group", required: true }] }], rowIndex: [{ type: i0.Input, args: [{ isSignal: true, alias: "rowIndex", required: true }] }] } });
649
-
650
- class GridCellComponent {
651
- constructor() {
652
- this.#elementRef = inject((ElementRef));
653
- this.#gridNavigationService = inject(GridNavigationService);
654
- this.#i18n = inject(MonaI18nService);
655
- this.#injector = inject(Injector);
656
- this.#locale = inject(LOCALE_ID);
657
- this.#logicalCell = inject(GridLogicalCellDirective, { optional: true });
658
- this.baseClass = computed(() => {
659
- return gridCellBaseThemeVariants({ virtual: this.gridService.virtualScrollOptions().enabled });
660
- }, /* @ts-ignore */
661
- ...(ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []));
662
- this.cellContainerClass = computed(() => {
663
- const editing = this.isEditing();
664
- return gridCellContainerThemeVariants({ editing, virtual: this.gridService.virtualScrollOptions().enabled });
665
- }, /* @ts-ignore */
666
- ...(ngDevMode ? [{ debugName: "cellContainerClass" }] : /* istanbul ignore next */ []));
667
- this.cellDirtyIndicatorClass = computed(() => {
668
- return gridCellDirtyIndicatorThemeVariants();
669
- }, /* @ts-ignore */
670
- ...(ngDevMode ? [{ debugName: "cellDirtyIndicatorClass" }] : /* istanbul ignore next */ []));
671
- this.cellTextClass = computed(() => {
672
- return gridCellTextThemeVariants();
673
- }, /* @ts-ignore */
674
- ...(ngDevMode ? [{ debugName: "cellTextClass" }] : /* istanbul ignore next */ []));
675
- this.cellUid = computed(() => `${this.row().uid}_${this.column().id}`, /* @ts-ignore */
676
- ...(ngDevMode ? [{ debugName: "cellUid" }] : /* istanbul ignore next */ []));
677
- this.displayValue = computed(() => {
678
- const editedRowData = this.gridService.editViewDict().get(this.row().uid);
679
- const rowData = this.row().data;
680
- const effectiveRowData = editedRowData ?? rowData;
681
- return effectiveRowData[this.column().field];
682
- }, /* @ts-ignore */
683
- ...(ngDevMode ? [{ debugName: "displayValue" }] : /* istanbul ignore next */ []));
684
- this.editContextIsCellMode = computed(() => this.gridService.editContext()?.mode === "cell", /* @ts-ignore */
685
- ...(ngDevMode ? [{ debugName: "editContextIsCellMode" }] : /* istanbul ignore next */ []));
686
- this.formattedDisplayValue = computed(() => {
687
- const column = this.column();
688
- const value = this.displayValue();
689
- const format = column.format;
690
- if (format == null) {
691
- // A date shows in the locale's numeric date format, as the date picker and the filter row show it.
692
- return column.dataType === "date" && value instanceof Date && !Number.isNaN(value.getTime())
693
- ? formatGregorianDateToLocaleString(value, this.#i18n.localeId(), {
694
- day: "2-digit",
695
- month: "2-digit",
696
- year: "numeric"
697
- })
698
- : value;
699
- }
700
- if (typeof format === "function") {
701
- return format(value, this.row().data, column);
702
- }
703
- if (column.dataType === "date") {
704
- return this.formatDateValue(value, format);
705
- }
706
- return value;
707
- }, /* @ts-ignore */
708
- ...(ngDevMode ? [{ debugName: "formattedDisplayValue" }] : /* istanbul ignore next */ []));
709
- this.gridService = inject(GridService);
710
- this.isCellPristine = computed(() => {
711
- const row = this.row();
712
- const editedRowData = this.gridService.editViewDict().get(row.uid);
713
- if (!editedRowData) {
714
- return true;
715
- }
716
- const field = this.column().field;
717
- return row.data[field] === editedRowData[field];
718
- }, /* @ts-ignore */
719
- ...(ngDevMode ? [{ debugName: "isCellPristine" }] : /* istanbul ignore next */ []));
720
- this.isEditing = computed(() => {
721
- const context = this.gridService.editContext();
722
- if (context == null) {
723
- return false;
724
- }
725
- if (context.mode === "cell") {
726
- return context.cellUid === this.cellUid();
727
- }
728
- return context.rowUid === this.row().uid && this.column().editable;
729
- }, /* @ts-ignore */
730
- ...(ngDevMode ? [{ debugName: "isEditing" }] : /* istanbul ignore next */ []));
731
- this.shouldAutoFocusEditor = computed(() => {
732
- const context = this.gridService.editContext();
733
- if (context?.mode === "cell") {
734
- return context.cellUid === this.cellUid();
735
- }
736
- if (context?.mode !== "row" || context.rowUid !== this.row().uid) {
737
- return false;
738
- }
739
- if (context.focusColumnId != null) {
740
- return context.focusColumnId === this.column().id;
741
- }
742
- return (this.gridService.visibleColumns().firstOrDefault(column => column.kind === "data" && column.editable) ===
743
- this.column());
744
- }, /* @ts-ignore */
745
- ...(ngDevMode ? [{ debugName: "shouldAutoFocusEditor" }] : /* istanbul ignore next */ []));
746
- this.column = input.required(/* @ts-ignore */
747
- ...(ngDevMode ? [{ debugName: "column" }] : /* istanbul ignore next */ []));
748
- this.row = input.required(/* @ts-ignore */
749
- ...(ngDevMode ? [{ debugName: "row" }] : /* istanbul ignore next */ []));
750
- }
751
- #elementRef;
752
- #gridNavigationService;
753
- #i18n;
754
- #injector;
755
- #locale;
756
- #logicalCell;
757
- /** Enter or F2: edits the cell in cell mode; in row mode, edits the row from this cell's editor. */
758
- handleLogicalCellEnter(originalEvent) {
759
- const editableOptions = this.gridService.editableOptions();
760
- if (!editableOptions.enabled || this.column().kind !== "data") {
761
- return;
762
- }
763
- if (editableOptions.mode === "cell") {
764
- this.startEdit(originalEvent);
765
- return;
766
- }
767
- const context = this.gridService.editContext();
768
- if (context?.mode === "row" && context.rowUid === this.row().uid) {
769
- this.focusInnerEditor();
770
- return;
771
- }
772
- const column = this.column();
773
- this.gridService.startRowEdit(this.row(), originalEvent, column.editable ? column.id : null);
774
- }
775
- onCellDoubleClick(event) {
776
- if (this.gridService.editableOptions().mode === "cell") {
777
- this.startEdit(event);
778
- }
779
- }
780
- /** Escape: cancels the cell or row edit. Focus stays in the editor when the cancel is prevented. */
781
- onEditCancel() {
782
- if (this.gridService.editContext() != null && this.gridService.cancelEdit(undefined, "escape")) {
783
- this.focusHostCell();
784
- }
785
- }
786
- /** Ends a cell edit on Enter or blur; a row edit only on Enter, as focus moves between its editors. */
787
- onEditCommit(trigger) {
788
- const context = this.gridService.editContext();
789
- if (context?.mode === "cell") {
790
- if (this.gridService.stopCellEdit()) {
791
- this.focusHostCell();
792
- }
793
- return;
794
- }
795
- if (context?.mode === "row" && trigger === "enter" && this.gridService.commitRowEdit()) {
796
- this.focusHostCell();
797
- }
798
- }
799
- onEditTabNavigate(direction) {
800
- const context = this.gridService.editContext();
801
- if (context?.mode !== "cell") {
802
- return;
803
- }
804
- const rowUid = this.row().uid;
805
- const columnId = this.column().id;
806
- if (!this.gridService.stopCellEdit()) {
807
- return;
808
- }
809
- // The commit may replace the row data, so wait for the grid to re-render before starting the next edit.
810
- afterNextRender({
811
- read: () => {
812
- if (this.#gridNavigationService.focusAdjacentEditableCell(rowUid, columnId, direction)) {
813
- return;
814
- }
815
- // The last editable cell: Tab leaves the grid, or stays on the cell when nothing follows it.
816
- if (!this.#logicalCell?.leaveGrid(direction === "previous")) {
817
- this.focusHostCell();
818
- }
819
- }
820
- }, { injector: this.#injector });
821
- }
822
- focusHostCell() {
823
- const cellElement = this.#elementRef.nativeElement.closest("td");
824
- cellElement?.focus();
825
- }
826
- focusInnerEditor() {
827
- const target = this.#elementRef.nativeElement.querySelector(GRID_CELL_FOCUSABLE_SELECTOR);
828
- target?.focus();
829
- }
830
- formatDateValue(value, format) {
831
- if (value == null) {
832
- return value;
833
- }
834
- if (value instanceof Date || typeof value === "number" || typeof value === "string") {
835
- try {
836
- return formatDate(value, format, this.#locale);
837
- }
838
- catch {
839
- return value;
840
- }
841
- }
842
- return value;
843
- }
844
- startEdit(originalEvent) {
845
- if (!this.gridService.editableOptions().enabled || !this.column().editable || this.column().kind !== "data") {
846
- return;
847
- }
848
- this.gridService.startCellEdit(this.cellUid(), this.row(), this.column(), originalEvent);
849
- }
850
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridCellComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
851
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: GridCellComponent, isStandalone: true, selector: "mona-grid-cell", inputs: { column: { classPropertyName: "column", publicName: "column", isSignal: true, isRequired: true, transformFunction: null }, row: { classPropertyName: "row", publicName: "row", isSignal: true, isRequired: true, transformFunction: null } }, host: { properties: { "class": "baseClass()" } }, ngImport: i0, template: "@let dataItem = row().data;\n@let dataKey = column().field;\n\n@if (column().kind === \"command\") {\n <mona-grid-command-cell [column]=\"column()\" [row]=\"row()\"></mona-grid-command-cell>\n} @else {\n <div\n [class]=\"cellContainerClass()\"\n [attr.data-uid]=\"cellUid()\"\n [attr.data-ruid]=\"row().uid\"\n [attr.data-field]=\"dataKey\"\n [attr.data-col-index]=\"column().index\"\n (dblclick)=\"onCellDoubleClick($event)\">\n @if (isEditing() && gridService.editSession(); as session) {\n <mona-grid-editor\n [column]=\"column()\"\n [autoFocus]=\"shouldAutoFocusEditor()\"\n [session]=\"session\"\n [tabNavigationEnabled]=\"editContextIsCellMode()\"\n (commit)=\"onEditCommit($event)\"\n (cancelEdit)=\"onEditCancel()\"\n (tabNavigate)=\"onEditTabNavigate($event)\"></mona-grid-editor>\n } @else if (column().cellTemplate) {\n <ng-container\n [ngTemplateOutlet]=\"column().cellTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: dataItem, column: column().field }\"></ng-container>\n } @else {\n <span [class]=\"cellTextClass()\">{{ formattedDisplayValue() }}</span>\n }\n @if (!isCellPristine()) {\n <span\n aria-hidden=\"true\"\n [class]=\"cellDirtyIndicatorClass()\"\n [title]=\"gridService.messages().modified\"></span>\n }\n </div>\n}\n", dependencies: [{ kind: "component", type: GridCommandCellComponent, selector: "mona-grid-command-cell", inputs: ["column", "newRow", "row"] }, { kind: "component", type: GridEditorComponent, selector: "mona-grid-editor", inputs: ["autoFocus", "column", "isNew", "session", "tabNavigationEnabled"], outputs: ["cancelEdit", "commit", "tabNavigate"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] }); }
852
- }
853
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridCellComponent, decorators: [{
854
- type: Component,
855
- args: [{ selector: "mona-grid-cell", imports: [GridCommandCellComponent, GridEditorComponent, NgTemplateOutlet], host: {
856
- "[class]": "baseClass()"
857
- }, template: "@let dataItem = row().data;\n@let dataKey = column().field;\n\n@if (column().kind === \"command\") {\n <mona-grid-command-cell [column]=\"column()\" [row]=\"row()\"></mona-grid-command-cell>\n} @else {\n <div\n [class]=\"cellContainerClass()\"\n [attr.data-uid]=\"cellUid()\"\n [attr.data-ruid]=\"row().uid\"\n [attr.data-field]=\"dataKey\"\n [attr.data-col-index]=\"column().index\"\n (dblclick)=\"onCellDoubleClick($event)\">\n @if (isEditing() && gridService.editSession(); as session) {\n <mona-grid-editor\n [column]=\"column()\"\n [autoFocus]=\"shouldAutoFocusEditor()\"\n [session]=\"session\"\n [tabNavigationEnabled]=\"editContextIsCellMode()\"\n (commit)=\"onEditCommit($event)\"\n (cancelEdit)=\"onEditCancel()\"\n (tabNavigate)=\"onEditTabNavigate($event)\"></mona-grid-editor>\n } @else if (column().cellTemplate) {\n <ng-container\n [ngTemplateOutlet]=\"column().cellTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: dataItem, column: column().field }\"></ng-container>\n } @else {\n <span [class]=\"cellTextClass()\">{{ formattedDisplayValue() }}</span>\n }\n @if (!isCellPristine()) {\n <span\n aria-hidden=\"true\"\n [class]=\"cellDirtyIndicatorClass()\"\n [title]=\"gridService.messages().modified\"></span>\n }\n </div>\n}\n" }]
858
- }], propDecorators: { column: [{ type: i0.Input, args: [{ isSignal: true, alias: "column", required: true }] }], row: [{ type: i0.Input, args: [{ isSignal: true, alias: "row", required: true }] }] } });
859
-
860
- class GridRowReorderHandleComponent {
861
- constructor() {
862
- this.#gridService = inject(GridService);
863
- this.#hostElement = inject(ElementRef).nativeElement;
864
- this.#injector = inject(Injector);
865
- this.#liveAnnouncer = inject(LiveAnnouncer);
866
- this.ariaLabel = computed(() => {
867
- const absoluteIndex = this.pageIndex() + this.#gridService.paginationState().skip;
868
- const label = this.#gridService.getRowReorderAriaLabel(this.row(), absoluteIndex);
869
- const reasonText = this.disabledReasonText();
870
- const messages = this.#gridService.messages();
871
- return messages.rowReorderHandleAriaLabel(label, messages.rowReorderKeyboardHint, reasonText ?? undefined);
872
- }, /* @ts-ignore */
873
- ...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
874
- this.disabled = computed(() => !this.#gridService.canReorderRow(this.row()), /* @ts-ignore */
875
- ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
876
- this.disabledReasonText = computed(() => {
877
- const reason = this.#gridService.rowReorderDisabledReason();
878
- const messages = this.#gridService.messages();
879
- switch (reason) {
880
- case null:
881
- return null;
882
- case "disabled":
883
- return messages.rowReorderDisabled;
884
- case "editing":
885
- return messages.rowReorderDisabledEditing;
886
- case "filtered":
887
- return messages.rowReorderDisabledFiltered;
888
- case "grouped":
889
- return messages.rowReorderDisabledGrouped;
890
- case "single-row":
891
- return messages.rowReorderDisabledSingleRow;
892
- case "server-binding":
893
- return messages.rowReorderDisabledServerBinding;
894
- case "sorted":
895
- return messages.rowReorderDisabledSorted;
896
- case "virtual-scroll":
897
- return messages.rowReorderDisabledVirtualScroll;
898
- }
899
- }, /* @ts-ignore */
900
- ...(ngDevMode ? [{ debugName: "disabledReasonText" }] : /* istanbul ignore next */ []));
901
- this.handleClass = gridRowReorderHandleThemeVariants();
902
- /**
903
- * @description The row's position within the current page, used to move the row and derive its accessible label.
904
- */
905
- this.pageIndex = input.required(/* @ts-ignore */
906
- ...(ngDevMode ? [{ debugName: "pageIndex" }] : /* istanbul ignore next */ []));
907
- /**
908
- * @description The grid row whose reorder handle this button controls.
909
- */
910
- this.row = input.required(/* @ts-ignore */
911
- ...(ngDevMode ? [{ debugName: "row" }] : /* istanbul ignore next */ []));
912
- }
913
- #gridService;
914
- #hostElement;
915
- #injector;
916
- #liveAnnouncer;
917
- onKeydown(event) {
918
- if ((event.key !== "ArrowUp" && event.key !== "ArrowDown") || !event.altKey) {
919
- return;
920
- }
921
- event.preventDefault();
922
- event.stopPropagation();
923
- const direction = event.key === "ArrowUp" ? -1 : 1;
924
- const targetIndex = this.pageIndex() + direction;
925
- if (targetIndex < 0 || targetIndex >= this.#gridService.viewPageRows().length) {
926
- return;
927
- }
928
- const moved = this.#gridService.requestRowReorder(this.row(), this.pageIndex(), targetIndex);
929
- if (moved) {
930
- // Re-rendering the new order moves this row in the DOM, which drops focus. Keep it so the row can move again.
931
- afterNextRender({
932
- write: () => {
933
- const button = this.#hostElement.querySelector("button");
934
- if (button != null && this.#hostElement.ownerDocument.activeElement !== button) {
935
- button.focus();
936
- }
937
- }
938
- }, { injector: this.#injector });
939
- const skip = this.#gridService.paginationState().skip;
940
- const fromRowNumber = skip + this.pageIndex() + 1;
941
- const toPosition = skip + targetIndex + 1;
942
- this.#liveAnnouncer.announce(this.#gridService.messages().rowReorderMoved(fromRowNumber, toPosition));
943
- }
944
- }
945
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridRowReorderHandleComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
946
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.6", type: GridRowReorderHandleComponent, isStandalone: true, selector: "mona-grid-row-reorder-handle", inputs: { pageIndex: { classPropertyName: "pageIndex", publicName: "pageIndex", isSignal: true, isRequired: true, transformFunction: null }, row: { classPropertyName: "row", publicName: "row", isSignal: true, isRequired: true, transformFunction: null } }, host: { listeners: { "click": "$event.stopPropagation()", "contextmenu": "$event.stopPropagation()", "dblclick": "$event.stopPropagation()" } }, ngImport: i0, template: "<button\n type=\"button\"\n cdkDragHandle\n [class]=\"handleClass\"\n [disabled]=\"disabled()\"\n [attr.title]=\"disabledReasonText()\"\n [attr.aria-label]=\"ariaLabel()\"\n aria-keyshortcuts=\"Alt+ArrowUp Alt+ArrowDown\"\n (keydown)=\"onKeydown($event)\">\n <svg lucideGripVertical [size]=\"16\" aria-hidden=\"true\"></svg>\n</button>\n", dependencies: [{ kind: "component", type: LucideGripVertical, selector: "svg[lucideGripVertical]" }, { kind: "directive", type: CdkDragHandle, selector: "[cdkDragHandle]", inputs: ["cdkDragHandleDisabled"] }] }); }
947
- }
948
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridRowReorderHandleComponent, decorators: [{
949
- type: Component,
950
- args: [{ selector: "mona-grid-row-reorder-handle", imports: [LucideGripVertical, CdkDragHandle], host: {
951
- "(click)": "$event.stopPropagation()",
952
- "(contextmenu)": "$event.stopPropagation()",
953
- "(dblclick)": "$event.stopPropagation()"
954
- }, template: "<button\n type=\"button\"\n cdkDragHandle\n [class]=\"handleClass\"\n [disabled]=\"disabled()\"\n [attr.title]=\"disabledReasonText()\"\n [attr.aria-label]=\"ariaLabel()\"\n aria-keyshortcuts=\"Alt+ArrowUp Alt+ArrowDown\"\n (keydown)=\"onKeydown($event)\">\n <svg lucideGripVertical [size]=\"16\" aria-hidden=\"true\"></svg>\n</button>\n" }]
955
- }], propDecorators: { pageIndex: [{ type: i0.Input, args: [{ isSignal: true, alias: "pageIndex", required: true }] }], row: [{ type: i0.Input, args: [{ isSignal: true, alias: "row", required: true }] }] } });
956
-
957
- class GridSelectionCheckboxComponent {
958
- constructor() {
959
- this.#gridService = inject(GridService);
960
- this.ariaLabel = computed(() => {
961
- const labelFn = this.#gridService.selectableOptions().rowAriaLabel;
962
- if (labelFn) {
963
- return labelFn(this.row().data);
964
- }
965
- return this.#gridService.messages().selectRow(this.rowIndex() + 1);
966
- }, /* @ts-ignore */
967
- ...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
968
- this.checked = computed(() => this.#gridService.isRowSelected(this.row()), /* @ts-ignore */
969
- ...(ngDevMode ? [{ debugName: "checked" }] : /* istanbul ignore next */ []));
970
- this.hostClass = computed(() => gridSelectionCellThemeVariants({ virtual: this.#gridService.virtualScrollOptions().enabled }), /* @ts-ignore */
971
- ...(ngDevMode ? [{ debugName: "hostClass" }] : /* istanbul ignore next */ []));
972
- /**
973
- * @description The grid row whose selected state this checkbox controls.
974
- */
975
- this.row = input.required(/* @ts-ignore */
976
- ...(ngDevMode ? [{ debugName: "row" }] : /* istanbul ignore next */ []));
977
- /**
978
- * @description The row's position within its rendered list, used to derive a default accessible label.
979
- */
980
- this.rowIndex = input.required(/* @ts-ignore */
981
- ...(ngDevMode ? [{ debugName: "rowIndex" }] : /* istanbul ignore next */ []));
982
- }
983
- #gridService;
984
- onCheckedChange(checked) {
985
- this.#gridService.setRowSelected(this.row(), checked);
986
- }
987
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridSelectionCheckboxComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
988
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.6", type: GridSelectionCheckboxComponent, isStandalone: true, selector: "mona-grid-selection-checkbox", inputs: { row: { classPropertyName: "row", publicName: "row", isSignal: true, isRequired: true, transformFunction: null }, rowIndex: { classPropertyName: "rowIndex", publicName: "rowIndex", isSignal: true, isRequired: true, transformFunction: null } }, host: { listeners: { "click": "$event.stopPropagation()" }, properties: { "class": "hostClass()" } }, ngImport: i0, template: "<mona-check-box\n [checked]=\"checked()\"\n (checkedChange)=\"onCheckedChange($event)\">\n <span class=\"sr-only\">{{ ariaLabel() }}</span>\n</mona-check-box>\n", dependencies: [{ kind: "component", type: CheckBoxComponent, selector: "mona-check-box", inputs: ["aria-describedby", "aria-label", "aria-labelledby", "checked", "disabled", "indeterminate", "inputId", "invalid", "label", "labelPosition", "labelSize", "name", "readonly", "required", "rounded", "tabIndex", "touched", "class"], outputs: ["checkedChange", "indeterminateChange", "inputBlur", "inputChange", "inputFocus", "touch"] }] }); }
989
- }
990
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridSelectionCheckboxComponent, decorators: [{
991
- type: Component,
992
- args: [{ selector: "mona-grid-selection-checkbox", imports: [CheckBoxComponent], host: {
993
- "[class]": "hostClass()",
994
- "(click)": "$event.stopPropagation()"
995
- }, template: "<mona-check-box\n [checked]=\"checked()\"\n (checkedChange)=\"onCheckedChange($event)\">\n <span class=\"sr-only\">{{ ariaLabel() }}</span>\n</mona-check-box>\n" }]
996
- }], propDecorators: { row: [{ type: i0.Input, args: [{ isSignal: true, alias: "row", required: true }] }], rowIndex: [{ type: i0.Input, args: [{ isSignal: true, alias: "rowIndex", required: true }] }] } });
997
-
998
- /** A data row of the grid body, with one cell per layout column. */
999
- class GridRowComponent {
1000
- constructor() {
1001
- /** Rows under groups sit one level below the innermost group (treegrid). */
1002
- this.ariaLevel = computed(() => {
1003
- const groupCount = this.gridService.groupColumns().length;
1004
- return groupCount === 0 ? null : groupCount + 1;
1005
- }, /* @ts-ignore */
1006
- ...(ngDevMode ? [{ debugName: "ariaLevel" }] : /* istanbul ignore next */ []));
1007
- this.baseClass = computed(() => {
1008
- const variantClass = gridListTableRowThemeVariants({
1009
- selected: this.selected(),
1010
- virtual: this.gridService.virtualScrollOptions().enabled
1011
- });
1012
- const userClass = this.gridService.rowClass()?.(this.row().data);
1013
- return twMerge(variantClass, typeof userClass === "string" ? userClass : userClass?.join(" "));
1014
- }, /* @ts-ignore */
1015
- ...(ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []));
1016
- this.cellEditMode = computed(() => {
1017
- const options = this.gridService.editableOptions();
1018
- return options.enabled === true && options.mode === "cell";
1019
- }, /* @ts-ignore */
1020
- ...(ngDevMode ? [{ debugName: "cellEditMode" }] : /* istanbul ignore next */ []));
1021
- this.detailToggleClass = computed(() => this.gridService.virtualScrollOptions().enabled
1022
- ? "flex h-full w-full items-stretch justify-center"
1023
- : "flex min-h-9 w-full items-center justify-center", /* @ts-ignore */
1024
- ...(ngDevMode ? [{ debugName: "detailToggleClass" }] : /* istanbul ignore next */ []));
1025
- this.detailToggleLabel = computed(() => {
1026
- const messages = this.gridService.messages();
1027
- const rowNumber = this.index() + this.gridService.paginationState().skip + 1;
1028
- return this.expanded() ? messages.collapseDetail(rowNumber) : messages.expandDetail(rowNumber);
1029
- }, /* @ts-ignore */
1030
- ...(ngDevMode ? [{ debugName: "detailToggleLabel" }] : /* istanbul ignore next */ []));
1031
- /** With editing on, data cells say whether their column can be edited, in either edit mode. */
1032
- this.editingEnabled = computed(() => this.gridService.editableOptions().enabled === true, /* @ts-ignore */
1033
- ...(ngDevMode ? [{ debugName: "editingEnabled" }] : /* istanbul ignore next */ []));
1034
- this.gridService = inject(GridService);
1035
- this.selectable = computed(() => this.gridService.selectableOptions().enabled, /* @ts-ignore */
1036
- ...(ngDevMode ? [{ debugName: "selectable" }] : /* istanbul ignore next */ []));
1037
- /** The row's `aria-rowindex`, counted by the body list across every row of the grid. */
1038
- this.ariaRowIndex = input(null, /* @ts-ignore */
1039
- ...(ngDevMode ? [{ debugName: "ariaRowIndex" }] : /* istanbul ignore next */ []));
1040
- this.expanded = computed(() => this.gridService.isRowExpanded(this.row()), /* @ts-ignore */
1041
- ...(ngDevMode ? [{ debugName: "expanded" }] : /* istanbul ignore next */ []));
1042
- /** The index of this row among the rendered body rows. */
1043
- this.index = input.required(/* @ts-ignore */
1044
- ...(ngDevMode ? [{ debugName: "index" }] : /* istanbul ignore next */ []));
1045
- this.row = input.required(/* @ts-ignore */
1046
- ...(ngDevMode ? [{ debugName: "row" }] : /* istanbul ignore next */ []));
1047
- this.selected = computed(() => this.gridService.isRowSelected(this.row()), /* @ts-ignore */
1048
- ...(ngDevMode ? [{ debugName: "selected" }] : /* istanbul ignore next */ []));
1049
- }
1050
- onClick(event) {
1051
- this.gridService.handleRowClick(event, this.row());
1052
- }
1053
- toggleDetail() {
1054
- this.gridService.setRowExpanded(this.row(), !this.expanded());
1055
- }
1056
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridRowComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1057
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: GridRowComponent, isStandalone: true, selector: "tr[monaGridRow]", inputs: { ariaRowIndex: { classPropertyName: "ariaRowIndex", publicName: "ariaRowIndex", isSignal: true, isRequired: false, transformFunction: null }, index: { classPropertyName: "index", publicName: "index", isSignal: true, isRequired: true, transformFunction: null }, row: { classPropertyName: "row", publicName: "row", isSignal: true, isRequired: true, transformFunction: null } }, host: { attributes: { "role": "row" }, listeners: { "click": "onClick($event)" }, properties: { "class": "baseClass()", "attr.data-ruid": "row().uid", "attr.data-row-view-index": "index()", "attr.aria-selected": "selectable() ? selected() : null", "attr.aria-rowindex": "ariaRowIndex()", "attr.aria-level": "ariaLevel()" } }, exportAs: ["monaGridRow"], ngImport: i0, template: "@for (layoutColumn of gridService.layout(); track layoutColumn.key) {\n @if (layoutColumn.kind === \"column\") {\n <td\n monaGridCell\n [monaGridLockedCell]=\"layoutColumn.key\"\n monaGridLogicalCell\n [cellKind]=\"layoutColumn.column.kind\"\n [colIndex]=\"layoutColumn.logicalIndex\"\n [columnId]=\"layoutColumn.column.id\"\n [editable]=\"cellEditMode() && layoutColumn.column.kind === 'data' && layoutColumn.column.editable === true\"\n [rowIndex]=\"index()\"\n [rowUid]=\"row().uid\"\n [section]=\"'body'\"\n [firstInRow]=\"layoutColumn.firstInRow\"\n [lastInRow]=\"layoutColumn.lastInRow\"\n [readOnly]=\"editingEnabled() && layoutColumn.column.kind === 'data' ? !layoutColumn.column.editable : null\"\n (edit)=\"gridCell.handleLogicalCellEnter()\">\n <mona-grid-cell #gridCell [column]=\"layoutColumn.column\" [row]=\"row()\" />\n </td>\n } @else if (layoutColumn.kind === \"group\") {\n <td monaGridCell [monaGridLockedCell]=\"layoutColumn.key\" [lockedCellHeader]=\"true\" [groupIndent]=\"true\"></td>\n } @else if (layoutColumn.kind === \"reorder\") {\n <td\n monaGridCell\n [monaGridLockedCell]=\"layoutColumn.key\"\n monaGridLogicalCell\n [cellKind]=\"'command'\"\n [columnId]=\"'$rowReorder'\"\n [colIndex]=\"layoutColumn.logicalIndex\"\n [rowIndex]=\"index()\"\n [rowUid]=\"row().uid\"\n [section]=\"'body'\"\n [firstInRow]=\"layoutColumn.firstInRow\"\n [lastInRow]=\"layoutColumn.lastInRow\">\n <mona-grid-row-reorder-handle [row]=\"row()\" [pageIndex]=\"index()\" />\n </td>\n } @else if (layoutColumn.kind === \"detail\") {\n <td\n monaGridCell\n [monaGridLockedCell]=\"layoutColumn.key\"\n monaGridLogicalCell\n [cellKind]=\"'detail'\"\n [colIndex]=\"layoutColumn.logicalIndex\"\n [rowIndex]=\"index()\"\n [rowUid]=\"row().uid\"\n [section]=\"'body'\"\n [firstInRow]=\"layoutColumn.firstInRow\"\n [lastInRow]=\"layoutColumn.lastInRow\"\n (toggleExpand)=\"toggleDetail()\">\n <span [class]=\"detailToggleClass()\">\n <mona-grid-toggle\n [expanded]=\"expanded()\"\n [label]=\"detailToggleLabel()\"\n [type]=\"'detail'\"\n [width]=\"gridService.detailColumnWidth\"\n (expandedChange)=\"toggleDetail()\" />\n </span>\n </td>\n } @else if (layoutColumn.kind === \"selection\") {\n <td\n monaGridCell\n [monaGridLockedCell]=\"layoutColumn.key\"\n monaGridLogicalCell\n [cellKind]=\"'command'\"\n [columnId]=\"'$selection'\"\n [colIndex]=\"layoutColumn.logicalIndex\"\n [rowIndex]=\"index()\"\n [rowUid]=\"row().uid\"\n [section]=\"'body'\"\n [firstInRow]=\"layoutColumn.firstInRow\"\n [lastInRow]=\"layoutColumn.lastInRow\">\n <mona-grid-selection-checkbox [row]=\"row()\" [rowIndex]=\"index()\" />\n </td>\n }\n}\n", dependencies: [{ kind: "component", type: GridCellComponent, selector: "mona-grid-cell", inputs: ["column", "row"] }, { kind: "directive", type: GridCellDirective, selector: "td[monaGridCell]", inputs: ["groupHeader", "groupIndent", "lastInRow"] }, { kind: "directive", type: GridLockedCellDirective, selector: "td[monaGridLockedCell], th[monaGridLockedCell]", inputs: ["monaGridLockedCell", "lockedCellHeader"] }, { kind: "directive", type: GridLogicalCellDirective, selector: "td[monaGridLogicalCell], th[monaGridLogicalCell]", inputs: ["ariaColIndex", "cellKind", "colIndex", "columnId", "editable", "expanded", "firstInRow", "groupHeader", "groupKey", "lastInRow", "readOnly", "rowIndex", "rowUid", "section"], outputs: ["edit", "menuOpen", "toggleExpand"] }, { kind: "component", type: GridRowReorderHandleComponent, selector: "mona-grid-row-reorder-handle", inputs: ["pageIndex", "row"] }, { kind: "component", type: GridSelectionCheckboxComponent, selector: "mona-grid-selection-checkbox", inputs: ["row", "rowIndex"] }, { kind: "component", type: GridToggleComponent, selector: "mona-grid-toggle", inputs: ["expanded", "label", "type", "width"], outputs: ["expandedChange"] }] }); }
1058
- }
1059
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridRowComponent, decorators: [{
1060
- type: Component,
1061
- args: [{ selector: "tr[monaGridRow]", exportAs: "monaGridRow", imports: [
1062
- GridCellComponent,
1063
- GridCellDirective,
1064
- GridLockedCellDirective,
1065
- GridLogicalCellDirective,
1066
- GridRowReorderHandleComponent,
1067
- GridSelectionCheckboxComponent,
1068
- GridToggleComponent
1069
- ], host: {
1070
- "[class]": "baseClass()",
1071
- "[attr.data-ruid]": "row().uid",
1072
- "[attr.data-row-view-index]": "index()",
1073
- role: "row",
1074
- "[attr.aria-selected]": "selectable() ? selected() : null",
1075
- "[attr.aria-rowindex]": "ariaRowIndex()",
1076
- "[attr.aria-level]": "ariaLevel()",
1077
- "(click)": "onClick($event)"
1078
- }, template: "@for (layoutColumn of gridService.layout(); track layoutColumn.key) {\n @if (layoutColumn.kind === \"column\") {\n <td\n monaGridCell\n [monaGridLockedCell]=\"layoutColumn.key\"\n monaGridLogicalCell\n [cellKind]=\"layoutColumn.column.kind\"\n [colIndex]=\"layoutColumn.logicalIndex\"\n [columnId]=\"layoutColumn.column.id\"\n [editable]=\"cellEditMode() && layoutColumn.column.kind === 'data' && layoutColumn.column.editable === true\"\n [rowIndex]=\"index()\"\n [rowUid]=\"row().uid\"\n [section]=\"'body'\"\n [firstInRow]=\"layoutColumn.firstInRow\"\n [lastInRow]=\"layoutColumn.lastInRow\"\n [readOnly]=\"editingEnabled() && layoutColumn.column.kind === 'data' ? !layoutColumn.column.editable : null\"\n (edit)=\"gridCell.handleLogicalCellEnter()\">\n <mona-grid-cell #gridCell [column]=\"layoutColumn.column\" [row]=\"row()\" />\n </td>\n } @else if (layoutColumn.kind === \"group\") {\n <td monaGridCell [monaGridLockedCell]=\"layoutColumn.key\" [lockedCellHeader]=\"true\" [groupIndent]=\"true\"></td>\n } @else if (layoutColumn.kind === \"reorder\") {\n <td\n monaGridCell\n [monaGridLockedCell]=\"layoutColumn.key\"\n monaGridLogicalCell\n [cellKind]=\"'command'\"\n [columnId]=\"'$rowReorder'\"\n [colIndex]=\"layoutColumn.logicalIndex\"\n [rowIndex]=\"index()\"\n [rowUid]=\"row().uid\"\n [section]=\"'body'\"\n [firstInRow]=\"layoutColumn.firstInRow\"\n [lastInRow]=\"layoutColumn.lastInRow\">\n <mona-grid-row-reorder-handle [row]=\"row()\" [pageIndex]=\"index()\" />\n </td>\n } @else if (layoutColumn.kind === \"detail\") {\n <td\n monaGridCell\n [monaGridLockedCell]=\"layoutColumn.key\"\n monaGridLogicalCell\n [cellKind]=\"'detail'\"\n [colIndex]=\"layoutColumn.logicalIndex\"\n [rowIndex]=\"index()\"\n [rowUid]=\"row().uid\"\n [section]=\"'body'\"\n [firstInRow]=\"layoutColumn.firstInRow\"\n [lastInRow]=\"layoutColumn.lastInRow\"\n (toggleExpand)=\"toggleDetail()\">\n <span [class]=\"detailToggleClass()\">\n <mona-grid-toggle\n [expanded]=\"expanded()\"\n [label]=\"detailToggleLabel()\"\n [type]=\"'detail'\"\n [width]=\"gridService.detailColumnWidth\"\n (expandedChange)=\"toggleDetail()\" />\n </span>\n </td>\n } @else if (layoutColumn.kind === \"selection\") {\n <td\n monaGridCell\n [monaGridLockedCell]=\"layoutColumn.key\"\n monaGridLogicalCell\n [cellKind]=\"'command'\"\n [columnId]=\"'$selection'\"\n [colIndex]=\"layoutColumn.logicalIndex\"\n [rowIndex]=\"index()\"\n [rowUid]=\"row().uid\"\n [section]=\"'body'\"\n [firstInRow]=\"layoutColumn.firstInRow\"\n [lastInRow]=\"layoutColumn.lastInRow\">\n <mona-grid-selection-checkbox [row]=\"row()\" [rowIndex]=\"index()\" />\n </td>\n }\n}\n" }]
1079
- }], propDecorators: { ariaRowIndex: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaRowIndex", required: false }] }], index: [{ type: i0.Input, args: [{ isSignal: true, alias: "index", required: true }] }], row: [{ type: i0.Input, args: [{ isSignal: true, alias: "row", required: true }] }] } });
1080
-
1081
- export { GridCellDirective as G, GridAddRowComponent as a, GridGroupRowComponent as b, GridRowComponent as c };
1082
- //# sourceMappingURL=nanahoshi-mona-ui-grid-grid-row.component-BpnybNcs.mjs.map