@nanahoshi/mona-ui 0.27.2 → 0.28.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 (208) hide show
  1. package/docs/api/chart.md +2 -2
  2. package/docs/api/popup.md +1 -1
  3. package/docs/api/theme.md +2 -2
  4. package/docs/chart.md +14 -0
  5. package/docs/editor.md +2 -0
  6. package/docs/installation.md +147 -15
  7. package/docs/introduction.md +37 -15
  8. package/docs/theming-built-in-themes.md +67 -0
  9. package/docs/theming-custom-colors.md +274 -0
  10. package/docs/theming-custom-themes.md +168 -0
  11. package/docs/theming.md +164 -248
  12. package/fesm2022/nanahoshi-mona-ui-auto-complete.mjs +1089 -603
  13. package/fesm2022/nanahoshi-mona-ui-avatar.mjs +369 -184
  14. package/fesm2022/nanahoshi-mona-ui-breadcrumb.mjs +658 -371
  15. package/fesm2022/nanahoshi-mona-ui-button-group.mjs +513 -359
  16. package/fesm2022/nanahoshi-mona-ui-button.mjs +622 -517
  17. package/fesm2022/nanahoshi-mona-ui-calendar.mjs +2070 -1573
  18. package/fesm2022/nanahoshi-mona-ui-card.mjs +620 -316
  19. package/fesm2022/nanahoshi-mona-ui-chart.mjs +61151 -64921
  20. package/fesm2022/nanahoshi-mona-ui-check-box.mjs +646 -317
  21. package/fesm2022/nanahoshi-mona-ui-chip.mjs +737 -516
  22. package/fesm2022/nanahoshi-mona-ui-circular-progress-bar.mjs +441 -242
  23. package/fesm2022/nanahoshi-mona-ui-collapsible.mjs +443 -390
  24. package/fesm2022/nanahoshi-mona-ui-color-gradient.mjs +1138 -814
  25. package/fesm2022/nanahoshi-mona-ui-color-palette.mjs +1114 -959
  26. package/fesm2022/nanahoshi-mona-ui-color-picker.mjs +858 -504
  27. package/fesm2022/nanahoshi-mona-ui-combo-box.mjs +1181 -742
  28. package/fesm2022/nanahoshi-mona-ui-command.mjs +1454 -853
  29. package/fesm2022/nanahoshi-mona-ui-common.mjs +569 -743
  30. package/fesm2022/nanahoshi-mona-ui-contextmenu.mjs +978 -532
  31. package/fesm2022/nanahoshi-mona-ui-date-input.mjs +283 -266
  32. package/fesm2022/nanahoshi-mona-ui-date-picker.mjs +973 -451
  33. package/fesm2022/nanahoshi-mona-ui-datetime-picker.mjs +1203 -658
  34. package/fesm2022/nanahoshi-mona-ui-dialog.mjs +1415 -936
  35. package/fesm2022/nanahoshi-mona-ui-dropdown-button.mjs +1165 -568
  36. package/fesm2022/nanahoshi-mona-ui-dropdown-list.mjs +1142 -677
  37. package/fesm2022/nanahoshi-mona-ui-dropdowns.mjs +1018 -734
  38. package/fesm2022/nanahoshi-mona-ui-editor.mjs +3589 -2122
  39. package/fesm2022/nanahoshi-mona-ui-expansion-panel.mjs +577 -359
  40. package/fesm2022/nanahoshi-mona-ui-fieldset.mjs +311 -151
  41. package/fesm2022/nanahoshi-mona-ui-filter.mjs +1086 -718
  42. package/fesm2022/nanahoshi-mona-ui-grid-grid-colgroup.component-NhONCVIX.mjs +77 -0
  43. package/fesm2022/nanahoshi-mona-ui-grid-grid-footer-row.component-Djv8ZnT5.mjs +480 -0
  44. package/fesm2022/nanahoshi-mona-ui-grid-grid-list.component-WbXAzGCa.mjs +470 -0
  45. package/fesm2022/nanahoshi-mona-ui-grid-grid-row.component-DkWTD3pN.mjs +2115 -0
  46. package/fesm2022/nanahoshi-mona-ui-grid-grid-virtual-list.component-DAHqTwBJ.mjs +330 -0
  47. package/fesm2022/nanahoshi-mona-ui-grid-grid.styles-BmLU-3zP.mjs +3766 -0
  48. package/fesm2022/nanahoshi-mona-ui-grid.mjs +5418 -2
  49. package/fesm2022/nanahoshi-mona-ui-i18n-icu.mjs +1379 -1079
  50. package/fesm2022/nanahoshi-mona-ui-i18n.mjs +4451 -5077
  51. package/fesm2022/nanahoshi-mona-ui-internal-filter-input.mjs +344 -143
  52. package/fesm2022/nanahoshi-mona-ui-internal-indicator-icon.mjs +257 -127
  53. package/fesm2022/nanahoshi-mona-ui-internal-list.mjs +2080 -1829
  54. package/fesm2022/nanahoshi-mona-ui-internal-popup-menu.mjs +103 -141
  55. package/fesm2022/nanahoshi-mona-ui-internal-tree.mjs +2498 -2706
  56. package/fesm2022/nanahoshi-mona-ui-internal.mjs +722 -1007
  57. package/fesm2022/nanahoshi-mona-ui-label.mjs +313 -202
  58. package/fesm2022/nanahoshi-mona-ui-list-box.mjs +1308 -1009
  59. package/fesm2022/nanahoshi-mona-ui-list-view.mjs +1411 -677
  60. package/fesm2022/nanahoshi-mona-ui-list.mjs +1 -6
  61. package/fesm2022/nanahoshi-mona-ui-locales-ar-sa.mjs +556 -577
  62. package/fesm2022/nanahoshi-mona-ui-locales-de-de.mjs +530 -573
  63. package/fesm2022/nanahoshi-mona-ui-locales-es-es.mjs +530 -573
  64. package/fesm2022/nanahoshi-mona-ui-locales-fr-fr.mjs +533 -576
  65. package/fesm2022/nanahoshi-mona-ui-locales-id-id.mjs +520 -555
  66. package/fesm2022/nanahoshi-mona-ui-locales-it-it.mjs +530 -571
  67. package/fesm2022/nanahoshi-mona-ui-locales-ja-jp.mjs +520 -555
  68. package/fesm2022/nanahoshi-mona-ui-locales-ko-kr.mjs +520 -555
  69. package/fesm2022/nanahoshi-mona-ui-locales-pt-br.mjs +530 -571
  70. package/fesm2022/nanahoshi-mona-ui-locales-ru-ru.mjs +576 -591
  71. package/fesm2022/nanahoshi-mona-ui-locales-tr-tr.mjs +530 -565
  72. package/fesm2022/nanahoshi-mona-ui-locales-zh-cn.mjs +520 -555
  73. package/fesm2022/nanahoshi-mona-ui-locales-zh-tw.mjs +520 -555
  74. package/fesm2022/nanahoshi-mona-ui-locales.mjs +59 -77
  75. package/fesm2022/nanahoshi-mona-ui-menubar.mjs +1411 -829
  76. package/fesm2022/nanahoshi-mona-ui-multi-select.mjs +1326 -702
  77. package/fesm2022/nanahoshi-mona-ui-notification.mjs +763 -675
  78. package/fesm2022/nanahoshi-mona-ui-numeric-text-box.mjs +1306 -826
  79. package/fesm2022/nanahoshi-mona-ui-otp-input.mjs +1122 -897
  80. package/fesm2022/nanahoshi-mona-ui-pager.mjs +1110 -651
  81. package/fesm2022/nanahoshi-mona-ui-placeholder.mjs +95 -53
  82. package/fesm2022/nanahoshi-mona-ui-popover.mjs +559 -397
  83. package/fesm2022/nanahoshi-mona-ui-popup-menu.mjs +2323 -1694
  84. package/fesm2022/nanahoshi-mona-ui-popup.mjs +1657 -1455
  85. package/fesm2022/nanahoshi-mona-ui-progress-bar.mjs +441 -267
  86. package/fesm2022/nanahoshi-mona-ui-query.mjs +211 -340
  87. package/fesm2022/nanahoshi-mona-ui-radio-button.mjs +1017 -548
  88. package/fesm2022/nanahoshi-mona-ui-rating.mjs +874 -624
  89. package/fesm2022/nanahoshi-mona-ui-scroll-view.mjs +1130 -917
  90. package/fesm2022/nanahoshi-mona-ui-segmented.mjs +705 -455
  91. package/fesm2022/nanahoshi-mona-ui-sheet.mjs +461 -283
  92. package/fesm2022/nanahoshi-mona-ui-sidebar.mjs +2791 -2449
  93. package/fesm2022/nanahoshi-mona-ui-skeleton.mjs +145 -90
  94. package/fesm2022/nanahoshi-mona-ui-slider.mjs +1563 -1103
  95. package/fesm2022/nanahoshi-mona-ui-spinner.mjs +738 -673
  96. package/fesm2022/nanahoshi-mona-ui-split-button.mjs +1287 -647
  97. package/fesm2022/nanahoshi-mona-ui-splitter.mjs +1313 -909
  98. package/fesm2022/nanahoshi-mona-ui-stepper.mjs +761 -540
  99. package/fesm2022/nanahoshi-mona-ui-switch.mjs +611 -280
  100. package/fesm2022/nanahoshi-mona-ui-tabs.mjs +1393 -841
  101. package/fesm2022/nanahoshi-mona-ui-text-area.mjs +142 -73
  102. package/fesm2022/nanahoshi-mona-ui-text-box.mjs +876 -374
  103. package/fesm2022/nanahoshi-mona-ui-theme.mjs +1465 -1449
  104. package/fesm2022/nanahoshi-mona-ui-time-picker.mjs +897 -443
  105. package/fesm2022/nanahoshi-mona-ui-time-selector.mjs +1100 -703
  106. package/fesm2022/nanahoshi-mona-ui-tooltip.mjs +789 -538
  107. package/fesm2022/nanahoshi-mona-ui-tree-view.mjs +1361 -805
  108. package/fesm2022/nanahoshi-mona-ui-window.mjs +2145 -1531
  109. package/fesm2022/nanahoshi-mona-ui.mjs +1 -8
  110. package/llms.txt +6 -2
  111. package/package.json +62 -23
  112. package/types/nanahoshi-mona-ui-auto-complete.d.ts +367 -233
  113. package/types/nanahoshi-mona-ui-avatar.d.ts +722 -649
  114. package/types/nanahoshi-mona-ui-breadcrumb.d.ts +134 -103
  115. package/types/nanahoshi-mona-ui-button-group.d.ts +213 -152
  116. package/types/nanahoshi-mona-ui-button.d.ts +227 -166
  117. package/types/nanahoshi-mona-ui-calendar.d.ts +324 -259
  118. package/types/nanahoshi-mona-ui-card.d.ts +125 -111
  119. package/types/nanahoshi-mona-ui-chart.d.ts +10483 -7326
  120. package/types/nanahoshi-mona-ui-check-box.d.ts +293 -180
  121. package/types/nanahoshi-mona-ui-chip.d.ts +208 -141
  122. package/types/nanahoshi-mona-ui-circular-progress-bar.d.ts +194 -133
  123. package/types/nanahoshi-mona-ui-collapsible.d.ts +103 -87
  124. package/types/nanahoshi-mona-ui-color-gradient.d.ts +281 -213
  125. package/types/nanahoshi-mona-ui-color-palette.d.ts +201 -138
  126. package/types/nanahoshi-mona-ui-color-picker.d.ts +283 -194
  127. package/types/nanahoshi-mona-ui-combo-box.d.ts +401 -262
  128. package/types/nanahoshi-mona-ui-command.d.ts +279 -191
  129. package/types/nanahoshi-mona-ui-common.d.ts +354 -385
  130. package/types/nanahoshi-mona-ui-contextmenu.d.ts +142 -117
  131. package/types/nanahoshi-mona-ui-date-input.d.ts +79 -96
  132. package/types/nanahoshi-mona-ui-date-picker.d.ts +338 -208
  133. package/types/nanahoshi-mona-ui-datetime-picker.d.ts +413 -259
  134. package/types/nanahoshi-mona-ui-dialog.d.ts +470 -381
  135. package/types/nanahoshi-mona-ui-dropdown-button.d.ts +216 -168
  136. package/types/nanahoshi-mona-ui-dropdown-list.d.ts +369 -243
  137. package/types/nanahoshi-mona-ui-dropdowns.d.ts +231 -217
  138. package/types/nanahoshi-mona-ui-editor.d.ts +302 -235
  139. package/types/nanahoshi-mona-ui-expansion-panel.d.ts +140 -109
  140. package/types/nanahoshi-mona-ui-fieldset.d.ts +98 -68
  141. package/types/nanahoshi-mona-ui-filter.d.ts +150 -124
  142. package/types/nanahoshi-mona-ui-grid.d.ts +1956 -1678
  143. package/types/nanahoshi-mona-ui-i18n-icu.d.ts +25 -34
  144. package/types/nanahoshi-mona-ui-i18n.d.ts +987 -1052
  145. package/types/nanahoshi-mona-ui-internal-filter-input.d.ts +118 -71
  146. package/types/nanahoshi-mona-ui-internal-indicator-icon.d.ts +56 -27
  147. package/types/nanahoshi-mona-ui-internal-list.d.ts +474 -408
  148. package/types/nanahoshi-mona-ui-internal-popup-menu.d.ts +143 -150
  149. package/types/nanahoshi-mona-ui-internal-tree.d.ts +493 -506
  150. package/types/nanahoshi-mona-ui-internal.d.ts +195 -213
  151. package/types/nanahoshi-mona-ui-label.d.ts +108 -78
  152. package/types/nanahoshi-mona-ui-list-box.d.ts +392 -322
  153. package/types/nanahoshi-mona-ui-list-view.d.ts +423 -282
  154. package/types/nanahoshi-mona-ui-list.d.ts +2 -1
  155. package/types/nanahoshi-mona-ui-locales-ar-sa.d.ts +540 -542
  156. package/types/nanahoshi-mona-ui-locales-de-de.d.ts +540 -542
  157. package/types/nanahoshi-mona-ui-locales-es-es.d.ts +540 -542
  158. package/types/nanahoshi-mona-ui-locales-fr-fr.d.ts +540 -542
  159. package/types/nanahoshi-mona-ui-locales-id-id.d.ts +540 -542
  160. package/types/nanahoshi-mona-ui-locales-it-it.d.ts +540 -542
  161. package/types/nanahoshi-mona-ui-locales-ja-jp.d.ts +540 -542
  162. package/types/nanahoshi-mona-ui-locales-ko-kr.d.ts +540 -542
  163. package/types/nanahoshi-mona-ui-locales-pt-br.d.ts +540 -542
  164. package/types/nanahoshi-mona-ui-locales-ru-ru.d.ts +540 -542
  165. package/types/nanahoshi-mona-ui-locales-tr-tr.d.ts +540 -542
  166. package/types/nanahoshi-mona-ui-locales-zh-cn.d.ts +540 -542
  167. package/types/nanahoshi-mona-ui-locales-zh-tw.d.ts +540 -542
  168. package/types/nanahoshi-mona-ui-locales.d.ts +17 -19
  169. package/types/nanahoshi-mona-ui-menubar.d.ts +210 -181
  170. package/types/nanahoshi-mona-ui-multi-select.d.ts +416 -276
  171. package/types/nanahoshi-mona-ui-notification.d.ts +140 -151
  172. package/types/nanahoshi-mona-ui-numeric-text-box.d.ts +407 -270
  173. package/types/nanahoshi-mona-ui-otp-input.d.ts +364 -241
  174. package/types/nanahoshi-mona-ui-pager.d.ts +379 -301
  175. package/types/nanahoshi-mona-ui-placeholder.d.ts +35 -28
  176. package/types/nanahoshi-mona-ui-popover.d.ts +176 -134
  177. package/types/nanahoshi-mona-ui-popup-menu.d.ts +488 -344
  178. package/types/nanahoshi-mona-ui-popup.d.ts +698 -560
  179. package/types/nanahoshi-mona-ui-progress-bar.d.ts +197 -137
  180. package/types/nanahoshi-mona-ui-query.d.ts +82 -88
  181. package/types/nanahoshi-mona-ui-radio-button.d.ts +434 -269
  182. package/types/nanahoshi-mona-ui-rating.d.ts +348 -254
  183. package/types/nanahoshi-mona-ui-scroll-view.d.ts +244 -172
  184. package/types/nanahoshi-mona-ui-segmented.d.ts +250 -175
  185. package/types/nanahoshi-mona-ui-sheet.d.ts +115 -63
  186. package/types/nanahoshi-mona-ui-sidebar.d.ts +653 -493
  187. package/types/nanahoshi-mona-ui-skeleton.d.ts +55 -39
  188. package/types/nanahoshi-mona-ui-slider.d.ts +503 -354
  189. package/types/nanahoshi-mona-ui-spinner.d.ts +125 -112
  190. package/types/nanahoshi-mona-ui-split-button.d.ts +241 -196
  191. package/types/nanahoshi-mona-ui-splitter.d.ts +124 -78
  192. package/types/nanahoshi-mona-ui-stepper.d.ts +206 -181
  193. package/types/nanahoshi-mona-ui-switch.d.ts +197 -131
  194. package/types/nanahoshi-mona-ui-tabs.d.ts +349 -248
  195. package/types/nanahoshi-mona-ui-text-area.d.ts +52 -36
  196. package/types/nanahoshi-mona-ui-text-box.d.ts +349 -218
  197. package/types/nanahoshi-mona-ui-theme.d.ts +415 -408
  198. package/types/nanahoshi-mona-ui-time-picker.d.ts +357 -217
  199. package/types/nanahoshi-mona-ui-time-selector.d.ts +255 -170
  200. package/types/nanahoshi-mona-ui-tooltip.d.ts +222 -144
  201. package/types/nanahoshi-mona-ui-tree-view.d.ts +466 -308
  202. package/types/nanahoshi-mona-ui-window.d.ts +494 -399
  203. package/types/nanahoshi-mona-ui.d.ts +1 -2
  204. package/fesm2022/nanahoshi-mona-ui-grid-grid-footer-row.component-DjNnVxHE.mjs +0 -181
  205. package/fesm2022/nanahoshi-mona-ui-grid-grid-list.component-ihQIKeP-.mjs +0 -208
  206. package/fesm2022/nanahoshi-mona-ui-grid-grid-row.component-BpnybNcs.mjs +0 -1082
  207. package/fesm2022/nanahoshi-mona-ui-grid-grid-virtual-list.component-CYlgfc7c.mjs +0 -186
  208. package/fesm2022/nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-LCzfCYd3.mjs +0 -7568
@@ -0,0 +1,2115 @@
1
+ import { B as GridLockedCellDirective, F as gridSelectionCellThemeVariants, I as GridLogicalCellDirective, L as GRID_CELL_FOCUSABLE_SELECTOR, N as gridRowReorderHandleThemeVariants, O as gridListTableCellThemeVariants, U as GridNavigationService, V as GridService, a as gridCellEditorBaseThemeVariants, b as gridGroupRowThemeVariants, i as gridCellDirtyIndicatorThemeVariants, k as gridListTableRowThemeVariants, n as gridCellBaseThemeVariants, o as gridCellEditorInputThemeVariants, r as gridCellContainerThemeVariants, s as gridCellTextThemeVariants } from "./nanahoshi-mona-ui-grid-grid.styles-BmLU-3zP.mjs";
2
+ import { n as removeGridRow } from "./nanahoshi-mona-ui-grid-grid-colgroup.component-NhONCVIX.mjs";
3
+ import * as i0 from "@angular/core";
4
+ import { Component, Directive, ElementRef, Injector, LOCALE_ID, afterNextRender, computed, effect, inject, input, isDevMode, model, output, signal, untracked, viewChild } from "@angular/core";
5
+ import { DialogService } from "@nanahoshi/mona-ui/dialog";
6
+ import { MonaI18nService, formatGregorianDateToLocaleString, parseLocalizedNumber } from "@nanahoshi/mona-ui/i18n";
7
+ import { v4 } from "uuid";
8
+ import { NgTemplateOutlet, formatDate } from "@angular/common";
9
+ import { LiveAnnouncer } from "@angular/cdk/a11y";
10
+ import { FormField } from "@angular/forms/signals";
11
+ import { CdkDragHandle } from "@angular/cdk/drag-drop";
12
+ import { LucideCheck, LucideChevronDown, LucideChevronRight, LucideDynamicIcon, LucideGripVertical, LucideMinus, LucideOctagonAlert, LucidePencil, LucidePlus, LucideTrash2, LucideX } from "@lucide/angular";
13
+ import { ButtonDirective } from "@nanahoshi/mona-ui/button";
14
+ import { twMerge } from "tailwind-merge";
15
+ import { DatePickerComponent } from "@nanahoshi/mona-ui/date-picker";
16
+ import { NumericTextBoxComponent } from "@nanahoshi/mona-ui/numeric-text-box";
17
+ import { TextBoxComponent } from "@nanahoshi/mona-ui/text-box";
18
+ import { CheckBoxComponent } from "@nanahoshi/mona-ui/check-box";
19
+ import { TooltipComponent } from "@nanahoshi/mona-ui/tooltip";
20
+ var GridCellDirective = 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
+ }), ...ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []);
28
+ this.groupHeader = input(false, ...ngDevMode ? [{ debugName: "groupHeader" }] : /* istanbul ignore next */ []);
29
+ this.groupIndent = input(false, ...ngDevMode ? [{ debugName: "groupIndent" }] : /* istanbul ignore next */ []);
30
+ this.lastInRow = input(false, ...ngDevMode ? [{ debugName: "lastInRow" }] : /* istanbul ignore next */ []);
31
+ }
32
+ #gridService;
33
+ static {
34
+ this.ɵfac = i0.ɵɵngDeclareFactory({
35
+ minVersion: "12.0.0",
36
+ version: "22.2.6",
37
+ ngImport: i0,
38
+ type: GridCellDirective,
39
+ deps: [],
40
+ target: i0.ɵɵFactoryTarget.Directive
41
+ });
42
+ }
43
+ static {
44
+ this.ɵdir = i0.ɵɵngDeclareDirective({
45
+ minVersion: "17.1.0",
46
+ version: "22.2.6",
47
+ type: GridCellDirective,
48
+ isStandalone: true,
49
+ selector: "td[monaGridCell]",
50
+ inputs: {
51
+ groupHeader: {
52
+ classPropertyName: "groupHeader",
53
+ publicName: "groupHeader",
54
+ isSignal: true,
55
+ isRequired: false,
56
+ transformFunction: null
57
+ },
58
+ groupIndent: {
59
+ classPropertyName: "groupIndent",
60
+ publicName: "groupIndent",
61
+ isSignal: true,
62
+ isRequired: false,
63
+ transformFunction: null
64
+ },
65
+ lastInRow: {
66
+ classPropertyName: "lastInRow",
67
+ publicName: "lastInRow",
68
+ isSignal: true,
69
+ isRequired: false,
70
+ transformFunction: null
71
+ }
72
+ },
73
+ host: {
74
+ attributes: { "role": "gridcell" },
75
+ properties: { "class": "baseClass()" }
76
+ },
77
+ ngImport: i0
78
+ });
79
+ }
80
+ };
81
+ i0.ɵɵngDeclareClassMetadata({
82
+ minVersion: "12.0.0",
83
+ version: "22.2.6",
84
+ ngImport: i0,
85
+ type: GridCellDirective,
86
+ decorators: [{
87
+ type: Directive,
88
+ args: [{
89
+ selector: "td[monaGridCell]",
90
+ host: {
91
+ "[class]": "baseClass()",
92
+ role: "gridcell"
93
+ }
94
+ }]
95
+ }],
96
+ propDecorators: {
97
+ groupHeader: [{
98
+ type: i0.Input,
99
+ args: [{
100
+ isSignal: true,
101
+ alias: "groupHeader",
102
+ required: false
103
+ }]
104
+ }],
105
+ groupIndent: [{
106
+ type: i0.Input,
107
+ args: [{
108
+ isSignal: true,
109
+ alias: "groupIndent",
110
+ required: false
111
+ }]
112
+ }],
113
+ lastInRow: [{
114
+ type: i0.Input,
115
+ args: [{
116
+ isSignal: true,
117
+ alias: "lastInRow",
118
+ required: false
119
+ }]
120
+ }]
121
+ }
122
+ });
123
+ var GridCommandCellComponent = class GridCommandCellComponent {
124
+ constructor() {
125
+ this.#dialogService = inject(DialogService);
126
+ this.#elementRef = inject(ElementRef);
127
+ this.#gridNavigationService = inject(GridNavigationService);
128
+ this.canEditRows = computed(() => {
129
+ const editableOptions = this.gridService.editableOptions();
130
+ return editableOptions.enabled === true && editableOptions.mode === "row";
131
+ }, ...ngDevMode ? [{ debugName: "canEditRows" }] : /* istanbul ignore next */ []);
132
+ this.commandContext = computed(() => ({
133
+ $implicit: this.row()?.data ?? this.gridService.addRowData(),
134
+ cancel: (event) => this.cancel(event),
135
+ edit: (event) => this.edit(event),
136
+ isEditing: this.isEditing(),
137
+ isNew: this.newRow(),
138
+ remove: (event) => this.remove(event),
139
+ row: this.row(),
140
+ rowData: this.row()?.data ?? this.gridService.addRowData(),
141
+ save: (event) => this.save(event)
142
+ }), ...ngDevMode ? [{ debugName: "commandContext" }] : /* istanbul ignore next */ []);
143
+ this.gridService = inject(GridService);
144
+ this.hasRowError = computed(() => this.rowErrorMessages().length > 0, ...ngDevMode ? [{ debugName: "hasRowError" }] : /* istanbul ignore next */ []);
145
+ this.isEditing = computed(() => {
146
+ const row = this.row();
147
+ const context = this.gridService.editContext();
148
+ return this.newRow() || row != null && context?.mode === "row" && context.rowUid === row.uid;
149
+ }, ...ngDevMode ? [{ debugName: "isEditing" }] : /* istanbul ignore next */ []);
150
+ this.labels = computed(() => {
151
+ const row = this.newRow() ? null : this.row();
152
+ return {
153
+ cancel: this.gridService.getRowCommandAriaLabel("cancel", row),
154
+ edit: row == null ? "" : this.gridService.getRowCommandAriaLabel("edit", row),
155
+ remove: row == null ? "" : this.gridService.getRowCommandAriaLabel("remove", row),
156
+ save: this.gridService.getRowCommandAriaLabel("save", row)
157
+ };
158
+ }, ...ngDevMode ? [{ debugName: "labels" }] : /* istanbul ignore next */ []);
159
+ this.messages = computed(() => this.gridService.messages(), ...ngDevMode ? [{ debugName: "messages" }] : /* istanbul ignore next */ []);
160
+ this.rowErrorId = `mona-grid-row-error-${v4()}`;
161
+ this.rowErrorMessages = computed(() => {
162
+ if (!this.isEditing()) return [];
163
+ const session = this.gridService.editSession();
164
+ if (session == null) return [];
165
+ return session.form().errorSummary().map((error) => error.message).filter((message) => !!message);
166
+ }, ...ngDevMode ? [{ debugName: "rowErrorMessages" }] : /* istanbul ignore next */ []);
167
+ this.rowErrorTooltip = computed(() => this.rowErrorMessages().join("\n") || this.messages().rowValidationError, ...ngDevMode ? [{ debugName: "rowErrorTooltip" }] : /* istanbul ignore next */ []);
168
+ this.column = input.required(...ngDevMode ? [{ debugName: "column" }] : /* istanbul ignore next */ []);
169
+ this.newRow = input(false, ...ngDevMode ? [{ debugName: "newRow" }] : /* istanbul ignore next */ []);
170
+ this.row = input(null, ...ngDevMode ? [{ debugName: "row" }] : /* istanbul ignore next */ []);
171
+ }
172
+ #dialogService;
173
+ #elementRef;
174
+ #gridNavigationService;
175
+ cancel(event) {
176
+ event?.stopPropagation();
177
+ if (this.newRow() ? this.gridService.cancelAddRow(event) : this.gridService.cancelEdit(event)) this.#afterRowCommand();
178
+ }
179
+ edit(event) {
180
+ event?.stopPropagation();
181
+ if (!this.canEditRows()) return;
182
+ const row = this.row();
183
+ if (row != null) this.gridService.startRowEdit(row, event);
184
+ }
185
+ remove(event) {
186
+ event?.stopPropagation();
187
+ const row = this.row();
188
+ if (row == null) return;
189
+ removeGridRow({
190
+ dialogService: this.#dialogService,
191
+ gridNavigationService: this.#gridNavigationService,
192
+ gridService: this.gridService
193
+ }, {
194
+ confirm: this.column().removeConfirmation,
195
+ element: this.#elementRef.nativeElement,
196
+ event,
197
+ row
198
+ });
199
+ }
200
+ save(event) {
201
+ event?.stopPropagation();
202
+ if (this.newRow() ? this.gridService.saveAddRow(event) : this.gridService.commitRowEdit(event)) this.#afterRowCommand();
203
+ }
204
+ #afterRowCommand() {
205
+ this.#focusCell();
206
+ if (this.newRow()) this.#gridNavigationService.refocusAfterRender();
207
+ }
208
+ #focusCell() {
209
+ this.#elementRef.nativeElement.closest("td")?.focus();
210
+ }
211
+ static {
212
+ this.ɵfac = i0.ɵɵngDeclareFactory({
213
+ minVersion: "12.0.0",
214
+ version: "22.2.6",
215
+ ngImport: i0,
216
+ type: GridCommandCellComponent,
217
+ deps: [],
218
+ target: i0.ɵɵFactoryTarget.Component
219
+ });
220
+ }
221
+ static {
222
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
223
+ minVersion: "17.0.0",
224
+ version: "22.2.6",
225
+ type: GridCommandCellComponent,
226
+ isStandalone: true,
227
+ selector: "mona-grid-command-cell",
228
+ inputs: {
229
+ column: {
230
+ classPropertyName: "column",
231
+ publicName: "column",
232
+ isSignal: true,
233
+ isRequired: true,
234
+ transformFunction: null
235
+ },
236
+ newRow: {
237
+ classPropertyName: "newRow",
238
+ publicName: "newRow",
239
+ isSignal: true,
240
+ isRequired: false,
241
+ transformFunction: null
242
+ },
243
+ row: {
244
+ classPropertyName: "row",
245
+ publicName: "row",
246
+ isSignal: true,
247
+ isRequired: false,
248
+ transformFunction: null
249
+ }
250
+ },
251
+ host: { classAttribute: "flex items-center w-full min-h-9" },
252
+ ngImport: i0,
253
+ 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",
254
+ dependencies: [
255
+ {
256
+ kind: "directive",
257
+ type: ButtonDirective,
258
+ selector: "button[monaButton]",
259
+ inputs: [
260
+ "aria-haspopup",
261
+ "disabled",
262
+ "iconOnly",
263
+ "loading",
264
+ "look",
265
+ "rounded",
266
+ "selected",
267
+ "size",
268
+ "tabindex",
269
+ "toggleable",
270
+ "type",
271
+ "class",
272
+ "value"
273
+ ],
274
+ outputs: ["lookChange", "selectedChange"]
275
+ },
276
+ {
277
+ kind: "directive",
278
+ type: NgTemplateOutlet,
279
+ selector: "[ngTemplateOutlet]",
280
+ inputs: [
281
+ "ngTemplateOutletContext",
282
+ "ngTemplateOutlet",
283
+ "ngTemplateOutletInjector"
284
+ ]
285
+ },
286
+ {
287
+ kind: "component",
288
+ type: LucideCheck,
289
+ selector: "svg[lucideCheck]"
290
+ },
291
+ {
292
+ kind: "component",
293
+ type: LucideOctagonAlert,
294
+ selector: "svg[lucideOctagonExclamationPoint], svg[lucideAlertOctagon], svg[lucideOctagonAlert]"
295
+ },
296
+ {
297
+ kind: "component",
298
+ type: LucideX,
299
+ selector: "svg[lucideX]"
300
+ },
301
+ {
302
+ kind: "component",
303
+ type: LucidePencil,
304
+ selector: "svg[lucidePencil]"
305
+ },
306
+ {
307
+ kind: "component",
308
+ type: LucideTrash2,
309
+ selector: "svg[lucideTrash], svg[lucideTrash2]"
310
+ },
311
+ {
312
+ kind: "component",
313
+ type: TooltipComponent,
314
+ selector: "mona-tooltip",
315
+ inputs: [
316
+ "disabled",
317
+ "hideDelay",
318
+ "position",
319
+ "rounded",
320
+ "showDelay",
321
+ "target"
322
+ ],
323
+ outputs: ["hidden", "shown"]
324
+ }
325
+ ]
326
+ });
327
+ }
328
+ };
329
+ i0.ɵɵngDeclareClassMetadata({
330
+ minVersion: "12.0.0",
331
+ version: "22.2.6",
332
+ ngImport: i0,
333
+ type: GridCommandCellComponent,
334
+ decorators: [{
335
+ type: Component,
336
+ args: [{
337
+ selector: "mona-grid-command-cell",
338
+ imports: [
339
+ ButtonDirective,
340
+ NgTemplateOutlet,
341
+ LucideCheck,
342
+ LucideOctagonAlert,
343
+ LucideX,
344
+ LucidePencil,
345
+ LucideTrash2,
346
+ TooltipComponent
347
+ ],
348
+ host: { class: "flex items-center w-full min-h-9" },
349
+ 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"
350
+ }]
351
+ }],
352
+ propDecorators: {
353
+ column: [{
354
+ type: i0.Input,
355
+ args: [{
356
+ isSignal: true,
357
+ alias: "column",
358
+ required: true
359
+ }]
360
+ }],
361
+ newRow: [{
362
+ type: i0.Input,
363
+ args: [{
364
+ isSignal: true,
365
+ alias: "newRow",
366
+ required: false
367
+ }]
368
+ }],
369
+ row: [{
370
+ type: i0.Input,
371
+ args: [{
372
+ isSignal: true,
373
+ alias: "row",
374
+ required: false
375
+ }]
376
+ }]
377
+ }
378
+ });
379
+ const ROW_EDITOR_SELECTOR = "mona-grid-editor, mona-grid-command-cell";
380
+ const MACHINE_NUMBER_PATTERN = /^[-+]?(\d+\.?\d*|\.\d+)(e[-+]?\d+)?$/i;
381
+ var GridEditorComponent = class GridEditorComponent {
382
+ #datePopupOpen;
383
+ #elementRef;
384
+ #gridService;
385
+ #i18n;
386
+ #logicalCell;
387
+ #rowEditing;
388
+ #ignoreNextBooleanFocusOut;
389
+ #lastDateValue;
390
+ constructor() {
391
+ this.#datePopupOpen = signal(false, ...ngDevMode ? [{ debugName: "#datePopupOpen" }] : /* istanbul ignore next */ []);
392
+ this.#elementRef = inject(ElementRef);
393
+ this.#gridService = inject(GridService, { optional: true });
394
+ this.#i18n = inject(MonaI18nService, { optional: true });
395
+ this.#logicalCell = inject(GridLogicalCellDirective, { optional: true });
396
+ this.#rowEditing = computed(() => this.isNew() || this.#gridService?.editContext()?.mode === "row", ...ngDevMode ? [{ debugName: "#rowEditing" }] : /* istanbul ignore next */ []);
397
+ this.#ignoreNextBooleanFocusOut = false;
398
+ this.#lastDateValue = null;
399
+ this.numericTextBoxRef = viewChild(NumericTextBoxComponent, ...ngDevMode ? [{ debugName: "numericTextBoxRef" }] : /* istanbul ignore next */ []);
400
+ this.textBoxRef = viewChild(TextBoxComponent, ...ngDevMode ? [{ debugName: "textBoxRef" }] : /* istanbul ignore next */ []);
401
+ this.baseClass = computed(() => {
402
+ return gridCellEditorBaseThemeVariants({ virtual: this.#gridService?.virtualScrollOptions().enabled ?? false });
403
+ }, ...ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []);
404
+ this.booleanField = computed(() => this.formField(), ...ngDevMode ? [{ debugName: "booleanField" }] : /* istanbul ignore next */ []);
405
+ this.dateField = computed(() => this.formField(), ...ngDevMode ? [{ debugName: "dateField" }] : /* istanbul ignore next */ []);
406
+ this.editTemplateContext = computed(() => {
407
+ const field = this.formField();
408
+ if (field == null) return null;
409
+ return {
410
+ cancel: () => this.cancelEdit.emit(),
411
+ column: this.column().field,
412
+ commit: () => this.commit.emit("enter"),
413
+ dataField: this.column().field,
414
+ dataItem: this.session().model(),
415
+ errors: field().errors(),
416
+ field,
417
+ form: this.session().form,
418
+ invalid: field().invalid(),
419
+ isNew: this.isNew(),
420
+ session: this.session(),
421
+ setValue: (value) => field().value.set(value),
422
+ touched: field().touched(),
423
+ value: field().value()
424
+ };
425
+ }, ...ngDevMode ? [{ debugName: "editTemplateContext" }] : /* istanbul ignore next */ []);
426
+ this.editorInputClass = computed(() => {
427
+ return gridCellEditorInputThemeVariants({ virtual: this.#gridService?.virtualScrollOptions().enabled ?? false });
428
+ }, ...ngDevMode ? [{ debugName: "editorInputClass" }] : /* istanbul ignore next */ []);
429
+ this.editorLabel = computed(() => this.column().title || this.column().field, ...ngDevMode ? [{ debugName: "editorLabel" }] : /* istanbul ignore next */ []);
430
+ this.errorDescribedBy = computed(() => this.hasFieldError() ? this.errorId : "", ...ngDevMode ? [{ debugName: "errorDescribedBy" }] : /* istanbul ignore next */ []);
431
+ this.errorId = `mona-grid-editor-error-${v4()}`;
432
+ this.fieldErrorMessage = computed(() => {
433
+ const [firstError] = this.formField()?.().errors() ?? [];
434
+ return firstError?.message ?? this.#gridService?.messages().fieldValidationError ?? "";
435
+ }, ...ngDevMode ? [{ debugName: "fieldErrorMessage" }] : /* istanbul ignore next */ []);
436
+ this.formField = computed(() => this.session().form[this.column().field] ?? null, ...ngDevMode ? [{ debugName: "formField" }] : /* istanbul ignore next */ []);
437
+ this.hasFieldError = computed(() => {
438
+ const field = this.formField()?.();
439
+ return field != null && field.invalid() && field.touched();
440
+ }, ...ngDevMode ? [{ debugName: "hasFieldError" }] : /* istanbul ignore next */ []);
441
+ this.numberField = computed(() => this.formField(), ...ngDevMode ? [{ debugName: "numberField" }] : /* istanbul ignore next */ []);
442
+ this.readOnlyValue = computed(() => this.session().model()[this.column().field], ...ngDevMode ? [{ debugName: "readOnlyValue" }] : /* istanbul ignore next */ []);
443
+ this.stringField = computed(() => this.formField(), ...ngDevMode ? [{ debugName: "stringField" }] : /* istanbul ignore next */ []);
444
+ this.autoFocus = input(true, ...ngDevMode ? [{ debugName: "autoFocus" }] : /* istanbul ignore next */ []);
445
+ this.cancelEdit = output();
446
+ this.column = input.required(...ngDevMode ? [{ debugName: "column" }] : /* istanbul ignore next */ []);
447
+ this.commit = output();
448
+ this.isNew = input(false, ...ngDevMode ? [{ debugName: "isNew" }] : /* istanbul ignore next */ []);
449
+ this.session = input.required(...ngDevMode ? [{ debugName: "session" }] : /* istanbul ignore next */ []);
450
+ this.tabNavigate = output();
451
+ this.tabNavigationEnabled = input(false, ...ngDevMode ? [{ debugName: "tabNavigationEnabled" }] : /* istanbul ignore next */ []);
452
+ effect(() => {
453
+ if (this.formField() == null && isDevMode()) console.warn(`mona-grid: column '${this.column().field}' has no form field in the edit session, so it is shown read-only. Give the row a value for the field, or set the column's editable to false.`);
454
+ });
455
+ effect(() => {
456
+ if (this.column().dataType !== "number") return;
457
+ const field = this.formField();
458
+ if (field == null) return;
459
+ const value = field().value();
460
+ const coercedValue = this.#coerceNumberValue(value);
461
+ if (Object.is(value, coercedValue)) return;
462
+ untracked(() => field().value.set(coercedValue));
463
+ });
464
+ effect(() => {
465
+ if (this.column().dataType !== "date") return;
466
+ const field = this.formField();
467
+ if (field == null) return;
468
+ const value = field().value();
469
+ untracked(() => this.#keepTimeOfDay(field, value));
470
+ });
471
+ afterNextRender({ read: () => this.#focusEditor() });
472
+ }
473
+ onBooleanEditorClick() {
474
+ this.#focusBooleanInput();
475
+ }
476
+ onBooleanEditorFocusOut(event) {
477
+ const relatedTarget = event.relatedTarget;
478
+ const editorHost = event.currentTarget;
479
+ if (relatedTarget && editorHost.contains(relatedTarget)) return;
480
+ if (this.#ignoreNextBooleanFocusOut) return;
481
+ this.commit.emit("blur");
482
+ }
483
+ onBooleanEditorPointerDown() {
484
+ this.#ignoreNextBooleanFocusOut = true;
485
+ setTimeout(() => {
486
+ this.#ignoreNextBooleanFocusOut = false;
487
+ });
488
+ }
489
+ onDatePickerClose() {
490
+ this.#datePopupOpen.set(false);
491
+ }
492
+ onDatePickerOpen() {
493
+ this.#datePopupOpen.set(true);
494
+ }
495
+ onEditorKeydown(event) {
496
+ if (event.isComposing || event.keyCode === 229 || this.#datePopupOpen()) return;
497
+ if (event.key === "Enter") {
498
+ event.preventDefault();
499
+ this.commit.emit("enter");
500
+ } else if (event.key === "Escape" && !event.defaultPrevented) {
501
+ event.preventDefault();
502
+ this.cancelEdit.emit();
503
+ }
504
+ }
505
+ onHostKeydown(event) {
506
+ if (event.key !== "Tab" || event.defaultPrevented || event.isComposing) return;
507
+ if (this.tabNavigationEnabled()) {
508
+ event.preventDefault();
509
+ event.stopPropagation();
510
+ this.tabNavigate.emit(event.shiftKey ? "previous" : "next");
511
+ return;
512
+ }
513
+ if (!this.#rowEditing()) return;
514
+ event.preventDefault();
515
+ event.stopPropagation();
516
+ if (!this.#focusSiblingControl(event.shiftKey)) this.#logicalCell?.leaveGrid(event.shiftKey);
517
+ }
518
+ #coerceNumberValue(value) {
519
+ if (typeof value === "number") return Number.isFinite(value) ? value : null;
520
+ if (typeof value !== "string") return null;
521
+ const text = value.trim();
522
+ if (text === "") return null;
523
+ if (MACHINE_NUMBER_PATTERN.test(text)) {
524
+ const numberValue = Number(text);
525
+ return Number.isFinite(numberValue) ? numberValue : null;
526
+ }
527
+ return parseLocalizedNumber(text, this.#i18n?.localeId() ?? "en-US");
528
+ }
529
+ #focusBooleanInput() {
530
+ this.#elementRef.nativeElement.querySelector("input[type=\"checkbox\"]")?.focus();
531
+ }
532
+ #focusEditor() {
533
+ if (!this.autoFocus()) return;
534
+ if (this.column().editTemplate) {
535
+ this.#focusTemplateTarget();
536
+ return;
537
+ }
538
+ this.textBoxRef()?.focus();
539
+ this.numericTextBoxRef()?.focus();
540
+ const type = this.column().dataType;
541
+ if (type === "date") this.#elementRef.nativeElement.querySelector("input")?.focus();
542
+ if (type === "boolean") this.#focusBooleanInput();
543
+ }
544
+ #focusSiblingControl(backwards) {
545
+ const host = this.#elementRef.nativeElement;
546
+ const row = host.closest("tr");
547
+ if (row == null) return false;
548
+ const controls = [];
549
+ let current = -1;
550
+ for (const container of Array.from(row.querySelectorAll(ROW_EDITOR_SELECTOR))) {
551
+ const targets = this.#focusTargets(container);
552
+ if (container === host) current = controls.length;
553
+ controls.push(...container.localName === "mona-grid-editor" ? targets.slice(0, 1) : targets);
554
+ }
555
+ if (current < 0) return false;
556
+ const target = controls[backwards ? current - 1 : current + 1];
557
+ if (target == null) return false;
558
+ target.focus();
559
+ return true;
560
+ }
561
+ #focusTargets(container) {
562
+ return Array.from(container.querySelectorAll(GRID_CELL_FOCUSABLE_SELECTOR)).filter((candidate) => !candidate.hasAttribute("disabled") && candidate.getAttribute("aria-hidden") !== "true" && candidate.closest("[aria-hidden='true'], [hidden], [inert]") == null);
563
+ }
564
+ #focusTemplateTarget() {
565
+ this.#focusTargets(this.#elementRef.nativeElement)[0]?.focus();
566
+ }
567
+ #keepTimeOfDay(field, value) {
568
+ const previous = this.#lastDateValue;
569
+ this.#lastDateValue = value instanceof Date ? value : null;
570
+ if (!(value instanceof Date) || previous == null || value === previous || Number.isNaN(value.getTime())) return;
571
+ const midnight = (date) => date.getHours() === 0 && date.getMinutes() === 0 && date.getSeconds() === 0 && date.getMilliseconds() === 0;
572
+ if (!midnight(value) || midnight(previous)) return;
573
+ const withTime = new Date(value);
574
+ withTime.setHours(previous.getHours(), previous.getMinutes(), previous.getSeconds(), previous.getMilliseconds());
575
+ this.#lastDateValue = withTime;
576
+ field().value.set(withTime);
577
+ }
578
+ static {
579
+ this.ɵfac = i0.ɵɵngDeclareFactory({
580
+ minVersion: "12.0.0",
581
+ version: "22.2.6",
582
+ ngImport: i0,
583
+ type: GridEditorComponent,
584
+ deps: [],
585
+ target: i0.ɵɵFactoryTarget.Component
586
+ });
587
+ }
588
+ static {
589
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
590
+ minVersion: "17.0.0",
591
+ version: "22.2.6",
592
+ type: GridEditorComponent,
593
+ isStandalone: true,
594
+ selector: "mona-grid-editor",
595
+ inputs: {
596
+ autoFocus: {
597
+ classPropertyName: "autoFocus",
598
+ publicName: "autoFocus",
599
+ isSignal: true,
600
+ isRequired: false,
601
+ transformFunction: null
602
+ },
603
+ column: {
604
+ classPropertyName: "column",
605
+ publicName: "column",
606
+ isSignal: true,
607
+ isRequired: true,
608
+ transformFunction: null
609
+ },
610
+ isNew: {
611
+ classPropertyName: "isNew",
612
+ publicName: "isNew",
613
+ isSignal: true,
614
+ isRequired: false,
615
+ transformFunction: null
616
+ },
617
+ session: {
618
+ classPropertyName: "session",
619
+ publicName: "session",
620
+ isSignal: true,
621
+ isRequired: true,
622
+ transformFunction: null
623
+ },
624
+ tabNavigationEnabled: {
625
+ classPropertyName: "tabNavigationEnabled",
626
+ publicName: "tabNavigationEnabled",
627
+ isSignal: true,
628
+ isRequired: false,
629
+ transformFunction: null
630
+ }
631
+ },
632
+ outputs: {
633
+ cancelEdit: "cancelEdit",
634
+ commit: "commit",
635
+ tabNavigate: "tabNavigate"
636
+ },
637
+ host: {
638
+ listeners: { "keydown": "onHostKeydown($event)" },
639
+ properties: { "class": "baseClass()" }
640
+ },
641
+ viewQueries: [{
642
+ propertyName: "numericTextBoxRef",
643
+ first: true,
644
+ predicate: NumericTextBoxComponent,
645
+ descendants: true,
646
+ isSignal: true
647
+ }, {
648
+ propertyName: "textBoxRef",
649
+ first: true,
650
+ predicate: TextBoxComponent,
651
+ descendants: true,
652
+ isSignal: true
653
+ }],
654
+ ngImport: i0,
655
+ 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",
656
+ dependencies: [
657
+ {
658
+ kind: "component",
659
+ type: CheckBoxComponent,
660
+ selector: "mona-check-box",
661
+ inputs: [
662
+ "aria-describedby",
663
+ "aria-label",
664
+ "aria-labelledby",
665
+ "checked",
666
+ "disabled",
667
+ "indeterminate",
668
+ "inputId",
669
+ "invalid",
670
+ "label",
671
+ "labelPosition",
672
+ "labelSize",
673
+ "name",
674
+ "readonly",
675
+ "required",
676
+ "rounded",
677
+ "tabIndex",
678
+ "touched",
679
+ "class"
680
+ ],
681
+ outputs: [
682
+ "checkedChange",
683
+ "indeterminateChange",
684
+ "inputBlur",
685
+ "inputChange",
686
+ "inputFocus",
687
+ "touch"
688
+ ]
689
+ },
690
+ {
691
+ kind: "component",
692
+ type: DatePickerComponent,
693
+ selector: "mona-date-picker",
694
+ inputs: [
695
+ "aria-describedby",
696
+ "aria-label",
697
+ "aria-labelledby",
698
+ "disabled",
699
+ "disabledDates",
700
+ "firstDay",
701
+ "format",
702
+ "inputId",
703
+ "invalid",
704
+ "max",
705
+ "min",
706
+ "placeholder",
707
+ "popupClass",
708
+ "popupHeight",
709
+ "popupWidth",
710
+ "readonly",
711
+ "readonlyInput",
712
+ "required",
713
+ "rounded",
714
+ "showClearButton",
715
+ "size",
716
+ "touched",
717
+ "class",
718
+ "value",
719
+ "weekNumber"
720
+ ],
721
+ outputs: [
722
+ "close",
723
+ "closed",
724
+ "open",
725
+ "opened",
726
+ "touch",
727
+ "valueChange"
728
+ ]
729
+ },
730
+ {
731
+ kind: "directive",
732
+ type: FormField,
733
+ selector: "[formField]",
734
+ inputs: ["formField"],
735
+ exportAs: ["formField"]
736
+ },
737
+ {
738
+ kind: "component",
739
+ type: LucideOctagonAlert,
740
+ selector: "svg[lucideOctagonExclamationPoint], svg[lucideAlertOctagon], svg[lucideOctagonAlert]"
741
+ },
742
+ {
743
+ kind: "directive",
744
+ type: NgTemplateOutlet,
745
+ selector: "[ngTemplateOutlet]",
746
+ inputs: [
747
+ "ngTemplateOutletContext",
748
+ "ngTemplateOutlet",
749
+ "ngTemplateOutletInjector"
750
+ ]
751
+ },
752
+ {
753
+ kind: "component",
754
+ type: NumericTextBoxComponent,
755
+ selector: "mona-numeric-text-box",
756
+ inputs: [
757
+ "formatter",
758
+ "maxValue",
759
+ "minValue",
760
+ "step",
761
+ "value"
762
+ ],
763
+ outputs: ["valueChange"]
764
+ },
765
+ {
766
+ kind: "component",
767
+ type: TextBoxComponent,
768
+ selector: "mona-text-box",
769
+ inputs: [
770
+ "aria-describedby",
771
+ "aria-label",
772
+ "aria-labelledby",
773
+ "clearButton",
774
+ "disabled",
775
+ "inputAttributes",
776
+ "inputClass",
777
+ "inputId",
778
+ "inputStyle",
779
+ "invalid",
780
+ "maxLength",
781
+ "minLength",
782
+ "name",
783
+ "placeholder",
784
+ "readonly",
785
+ "required",
786
+ "rounded",
787
+ "size",
788
+ "touched",
789
+ "type",
790
+ "class",
791
+ "value"
792
+ ],
793
+ outputs: [
794
+ "inputBlur",
795
+ "inputFocus",
796
+ "touch",
797
+ "valueChange"
798
+ ]
799
+ },
800
+ {
801
+ kind: "component",
802
+ type: TooltipComponent,
803
+ selector: "mona-tooltip",
804
+ inputs: [
805
+ "disabled",
806
+ "hideDelay",
807
+ "position",
808
+ "rounded",
809
+ "showDelay",
810
+ "target"
811
+ ],
812
+ outputs: ["hidden", "shown"]
813
+ }
814
+ ]
815
+ });
816
+ }
817
+ };
818
+ i0.ɵɵngDeclareClassMetadata({
819
+ minVersion: "12.0.0",
820
+ version: "22.2.6",
821
+ ngImport: i0,
822
+ type: GridEditorComponent,
823
+ decorators: [{
824
+ type: Component,
825
+ args: [{
826
+ selector: "mona-grid-editor",
827
+ imports: [
828
+ CheckBoxComponent,
829
+ DatePickerComponent,
830
+ FormField,
831
+ LucideOctagonAlert,
832
+ NgTemplateOutlet,
833
+ NumericTextBoxComponent,
834
+ TextBoxComponent,
835
+ TooltipComponent
836
+ ],
837
+ host: {
838
+ "[class]": "baseClass()",
839
+ "(keydown)": "onHostKeydown($event)"
840
+ },
841
+ 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"
842
+ }]
843
+ }],
844
+ ctorParameters: () => [],
845
+ propDecorators: {
846
+ numericTextBoxRef: [{
847
+ type: i0.ViewChild,
848
+ args: [i0.forwardRef(() => NumericTextBoxComponent), { isSignal: true }]
849
+ }],
850
+ textBoxRef: [{
851
+ type: i0.ViewChild,
852
+ args: [i0.forwardRef(() => TextBoxComponent), { isSignal: true }]
853
+ }],
854
+ autoFocus: [{
855
+ type: i0.Input,
856
+ args: [{
857
+ isSignal: true,
858
+ alias: "autoFocus",
859
+ required: false
860
+ }]
861
+ }],
862
+ cancelEdit: [{
863
+ type: i0.Output,
864
+ args: ["cancelEdit"]
865
+ }],
866
+ column: [{
867
+ type: i0.Input,
868
+ args: [{
869
+ isSignal: true,
870
+ alias: "column",
871
+ required: true
872
+ }]
873
+ }],
874
+ commit: [{
875
+ type: i0.Output,
876
+ args: ["commit"]
877
+ }],
878
+ isNew: [{
879
+ type: i0.Input,
880
+ args: [{
881
+ isSignal: true,
882
+ alias: "isNew",
883
+ required: false
884
+ }]
885
+ }],
886
+ session: [{
887
+ type: i0.Input,
888
+ args: [{
889
+ isSignal: true,
890
+ alias: "session",
891
+ required: true
892
+ }]
893
+ }],
894
+ tabNavigate: [{
895
+ type: i0.Output,
896
+ args: ["tabNavigate"]
897
+ }],
898
+ tabNavigationEnabled: [{
899
+ type: i0.Input,
900
+ args: [{
901
+ isSignal: true,
902
+ alias: "tabNavigationEnabled",
903
+ required: false
904
+ }]
905
+ }]
906
+ }
907
+ });
908
+ var GridAddRowComponent = class GridAddRowComponent {
909
+ constructor() {
910
+ this.#gridNavigationService = inject(GridNavigationService);
911
+ this.baseClass = computed(() => {
912
+ return gridListTableRowThemeVariants({ selected: false });
913
+ }, ...ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []);
914
+ this.firstEditableColumn = computed(() => this.gridService.visibleColumns().firstOrDefault((column) => column.kind === "data" && column.editable), ...ngDevMode ? [{ debugName: "firstEditableColumn" }] : /* istanbul ignore next */ []);
915
+ this.gridService = inject(GridService);
916
+ this.structuralColumnIds = {
917
+ detail: void 0,
918
+ reorder: "$rowReorder",
919
+ selection: "$selection"
920
+ };
921
+ }
922
+ #gridNavigationService;
923
+ onCancel() {
924
+ if (this.gridService.cancelAddRow(void 0, "escape")) this.#gridNavigationService.refocusAfterRender();
925
+ }
926
+ onCommit(trigger) {
927
+ if (trigger === "enter" && this.gridService.saveAddRow()) this.#gridNavigationService.refocusAfterRender();
928
+ }
929
+ static {
930
+ this.ɵfac = i0.ɵɵngDeclareFactory({
931
+ minVersion: "12.0.0",
932
+ version: "22.2.6",
933
+ ngImport: i0,
934
+ type: GridAddRowComponent,
935
+ deps: [],
936
+ target: i0.ɵɵFactoryTarget.Component
937
+ });
938
+ }
939
+ static {
940
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
941
+ minVersion: "17.0.0",
942
+ version: "22.2.6",
943
+ type: GridAddRowComponent,
944
+ isStandalone: true,
945
+ selector: "tr[monaGridAddRow]",
946
+ host: {
947
+ attributes: {
948
+ "role": "row",
949
+ "data-grid-add-row": "true"
950
+ },
951
+ properties: {
952
+ "class": "baseClass()",
953
+ "attr.aria-rowindex": "gridService.headerRowCount() + 1"
954
+ }
955
+ },
956
+ ngImport: i0,
957
+ 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",
958
+ dependencies: [
959
+ {
960
+ kind: "directive",
961
+ type: GridCellDirective,
962
+ selector: "td[monaGridCell]",
963
+ inputs: [
964
+ "groupHeader",
965
+ "groupIndent",
966
+ "lastInRow"
967
+ ]
968
+ },
969
+ {
970
+ kind: "component",
971
+ type: GridCommandCellComponent,
972
+ selector: "mona-grid-command-cell",
973
+ inputs: [
974
+ "column",
975
+ "newRow",
976
+ "row"
977
+ ]
978
+ },
979
+ {
980
+ kind: "component",
981
+ type: GridEditorComponent,
982
+ selector: "mona-grid-editor",
983
+ inputs: [
984
+ "autoFocus",
985
+ "column",
986
+ "isNew",
987
+ "session",
988
+ "tabNavigationEnabled"
989
+ ],
990
+ outputs: [
991
+ "cancelEdit",
992
+ "commit",
993
+ "tabNavigate"
994
+ ]
995
+ },
996
+ {
997
+ kind: "directive",
998
+ type: GridLockedCellDirective,
999
+ selector: "td[monaGridLockedCell], th[monaGridLockedCell]",
1000
+ inputs: ["monaGridLockedCell", "lockedCellHeader"]
1001
+ },
1002
+ {
1003
+ kind: "directive",
1004
+ type: GridLogicalCellDirective,
1005
+ selector: "td[monaGridLogicalCell], th[monaGridLogicalCell]",
1006
+ inputs: [
1007
+ "ariaColIndex",
1008
+ "cellKind",
1009
+ "colIndex",
1010
+ "columnId",
1011
+ "editable",
1012
+ "expanded",
1013
+ "firstInRow",
1014
+ "groupHeader",
1015
+ "groupKey",
1016
+ "lastInRow",
1017
+ "readOnly",
1018
+ "rowIndex",
1019
+ "rowUid",
1020
+ "section"
1021
+ ],
1022
+ outputs: [
1023
+ "edit",
1024
+ "menuOpen",
1025
+ "toggleExpand"
1026
+ ]
1027
+ }
1028
+ ]
1029
+ });
1030
+ }
1031
+ };
1032
+ i0.ɵɵngDeclareClassMetadata({
1033
+ minVersion: "12.0.0",
1034
+ version: "22.2.6",
1035
+ ngImport: i0,
1036
+ type: GridAddRowComponent,
1037
+ decorators: [{
1038
+ type: Component,
1039
+ args: [{
1040
+ selector: "tr[monaGridAddRow]",
1041
+ imports: [
1042
+ GridCellDirective,
1043
+ GridCommandCellComponent,
1044
+ GridEditorComponent,
1045
+ GridLockedCellDirective,
1046
+ GridLogicalCellDirective
1047
+ ],
1048
+ host: {
1049
+ "[class]": "baseClass()",
1050
+ role: "row",
1051
+ "[attr.aria-rowindex]": "gridService.headerRowCount() + 1",
1052
+ "data-grid-add-row": "true"
1053
+ },
1054
+ 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"
1055
+ }]
1056
+ }]
1057
+ });
1058
+ var GridToggleComponent = class GridToggleComponent {
1059
+ constructor() {
1060
+ this.collapseIcon = computed(() => {
1061
+ return this.type() === "detail" ? LucideMinus : LucideChevronDown;
1062
+ }, ...ngDevMode ? [{ debugName: "collapseIcon" }] : /* istanbul ignore next */ []);
1063
+ this.expandIcon = computed(() => {
1064
+ return this.type() === "detail" ? LucidePlus : LucideChevronRight;
1065
+ }, ...ngDevMode ? [{ debugName: "expandIcon" }] : /* istanbul ignore next */ []);
1066
+ this.expanded = model.required(...ngDevMode ? [{ debugName: "expanded" }] : /* istanbul ignore next */ []);
1067
+ this.label = input(null, ...ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []);
1068
+ this.type = input.required(...ngDevMode ? [{ debugName: "type" }] : /* istanbul ignore next */ []);
1069
+ this.width = input.required(...ngDevMode ? [{ debugName: "width" }] : /* istanbul ignore next */ []);
1070
+ }
1071
+ onToggleDetailClick(event) {
1072
+ event.stopPropagation();
1073
+ this.expanded.update((v) => !v);
1074
+ }
1075
+ static {
1076
+ this.ɵfac = i0.ɵɵngDeclareFactory({
1077
+ minVersion: "12.0.0",
1078
+ version: "22.2.6",
1079
+ ngImport: i0,
1080
+ type: GridToggleComponent,
1081
+ deps: [],
1082
+ target: i0.ɵɵFactoryTarget.Component
1083
+ });
1084
+ }
1085
+ static {
1086
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
1087
+ minVersion: "17.0.0",
1088
+ version: "22.2.6",
1089
+ type: GridToggleComponent,
1090
+ isStandalone: true,
1091
+ selector: "mona-grid-toggle",
1092
+ inputs: {
1093
+ expanded: {
1094
+ classPropertyName: "expanded",
1095
+ publicName: "expanded",
1096
+ isSignal: true,
1097
+ isRequired: true,
1098
+ transformFunction: null
1099
+ },
1100
+ label: {
1101
+ classPropertyName: "label",
1102
+ publicName: "label",
1103
+ isSignal: true,
1104
+ isRequired: false,
1105
+ transformFunction: null
1106
+ },
1107
+ type: {
1108
+ classPropertyName: "type",
1109
+ publicName: "type",
1110
+ isSignal: true,
1111
+ isRequired: true,
1112
+ transformFunction: null
1113
+ },
1114
+ width: {
1115
+ classPropertyName: "width",
1116
+ publicName: "width",
1117
+ isSignal: true,
1118
+ isRequired: true,
1119
+ transformFunction: null
1120
+ }
1121
+ },
1122
+ outputs: { expanded: "expandedChange" },
1123
+ ngImport: i0,
1124
+ 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",
1125
+ dependencies: [{
1126
+ kind: "component",
1127
+ type: LucideDynamicIcon,
1128
+ selector: "svg[lucideIcon]",
1129
+ inputs: ["lucideIcon"]
1130
+ }]
1131
+ });
1132
+ }
1133
+ };
1134
+ i0.ɵɵngDeclareClassMetadata({
1135
+ minVersion: "12.0.0",
1136
+ version: "22.2.6",
1137
+ ngImport: i0,
1138
+ type: GridToggleComponent,
1139
+ decorators: [{
1140
+ type: Component,
1141
+ args: [{
1142
+ selector: "mona-grid-toggle",
1143
+ imports: [LucideDynamicIcon],
1144
+ 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"
1145
+ }]
1146
+ }],
1147
+ propDecorators: {
1148
+ expanded: [{
1149
+ type: i0.Input,
1150
+ args: [{
1151
+ isSignal: true,
1152
+ alias: "expanded",
1153
+ required: true
1154
+ }]
1155
+ }, {
1156
+ type: i0.Output,
1157
+ args: ["expandedChange"]
1158
+ }],
1159
+ label: [{
1160
+ type: i0.Input,
1161
+ args: [{
1162
+ isSignal: true,
1163
+ alias: "label",
1164
+ required: false
1165
+ }]
1166
+ }],
1167
+ type: [{
1168
+ type: i0.Input,
1169
+ args: [{
1170
+ isSignal: true,
1171
+ alias: "type",
1172
+ required: true
1173
+ }]
1174
+ }],
1175
+ width: [{
1176
+ type: i0.Input,
1177
+ args: [{
1178
+ isSignal: true,
1179
+ alias: "width",
1180
+ required: true
1181
+ }]
1182
+ }]
1183
+ }
1184
+ });
1185
+ var GridGroupRowComponent = class GridGroupRowComponent {
1186
+ constructor() {
1187
+ this.collapsed = computed(() => this.gridService.isGroupCollapsed(this.group().groupKey), ...ngDevMode ? [{ debugName: "collapsed" }] : /* istanbul ignore next */ []);
1188
+ this.gridService = inject(GridService);
1189
+ this.indentColumns = computed(() => this.gridService.layout().filter((column) => column.kind === "group" && column.depth < this.group().depth), ...ngDevMode ? [{ debugName: "indentColumns" }] : /* istanbul ignore next */ []);
1190
+ this.rowClass = computed(() => gridGroupRowThemeVariants({ virtual: this.gridService.virtualScrollOptions().enabled }), ...ngDevMode ? [{ debugName: "rowClass" }] : /* istanbul ignore next */ []);
1191
+ this.titleClass = computed(() => this.gridService.virtualScrollOptions().enabled ? "absolute inset-0 flex items-center text-sm whitespace-nowrap overflow-hidden" : "flex min-h-9 items-center text-sm whitespace-nowrap", ...ngDevMode ? [{ debugName: "titleClass" }] : /* istanbul ignore next */ []);
1192
+ this.titleColIndex = computed(() => this.group().depth + (this.gridService.rowReorderColumnVisible() ? 1 : 0) + 1, ...ngDevMode ? [{ debugName: "titleColIndex" }] : /* istanbul ignore next */ []);
1193
+ this.titleColspan = computed(() => this.gridService.layout().length - this.group().depth - (this.gridService.rowReorderColumnVisible() ? 1 : 0), ...ngDevMode ? [{ debugName: "titleColspan" }] : /* istanbul ignore next */ []);
1194
+ this.ariaRowIndex = input(null, ...ngDevMode ? [{ debugName: "ariaRowIndex" }] : /* istanbul ignore next */ []);
1195
+ this.group = input.required(...ngDevMode ? [{ debugName: "group" }] : /* istanbul ignore next */ []);
1196
+ this.rowIndex = input.required(...ngDevMode ? [{ debugName: "rowIndex" }] : /* istanbul ignore next */ []);
1197
+ }
1198
+ toggle() {
1199
+ this.gridService.toggleGroupCollapse(this.group().groupKey);
1200
+ }
1201
+ static {
1202
+ this.ɵfac = i0.ɵɵngDeclareFactory({
1203
+ minVersion: "12.0.0",
1204
+ version: "22.2.6",
1205
+ ngImport: i0,
1206
+ type: GridGroupRowComponent,
1207
+ deps: [],
1208
+ target: i0.ɵɵFactoryTarget.Component
1209
+ });
1210
+ }
1211
+ static {
1212
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
1213
+ minVersion: "17.0.0",
1214
+ version: "22.2.6",
1215
+ type: GridGroupRowComponent,
1216
+ isStandalone: true,
1217
+ selector: "tr[monaGridGroupRow]",
1218
+ inputs: {
1219
+ ariaRowIndex: {
1220
+ classPropertyName: "ariaRowIndex",
1221
+ publicName: "ariaRowIndex",
1222
+ isSignal: true,
1223
+ isRequired: false,
1224
+ transformFunction: null
1225
+ },
1226
+ group: {
1227
+ classPropertyName: "group",
1228
+ publicName: "group",
1229
+ isSignal: true,
1230
+ isRequired: true,
1231
+ transformFunction: null
1232
+ },
1233
+ rowIndex: {
1234
+ classPropertyName: "rowIndex",
1235
+ publicName: "rowIndex",
1236
+ isSignal: true,
1237
+ isRequired: true,
1238
+ transformFunction: null
1239
+ }
1240
+ },
1241
+ host: {
1242
+ attributes: { "role": "row" },
1243
+ properties: {
1244
+ "class": "rowClass()",
1245
+ "attr.aria-level": "group().depth + 1",
1246
+ "attr.aria-expanded": "!collapsed()",
1247
+ "attr.aria-rowindex": "ariaRowIndex()"
1248
+ }
1249
+ },
1250
+ ngImport: i0,
1251
+ 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",
1252
+ dependencies: [
1253
+ {
1254
+ kind: "directive",
1255
+ type: GridCellDirective,
1256
+ selector: "td[monaGridCell]",
1257
+ inputs: [
1258
+ "groupHeader",
1259
+ "groupIndent",
1260
+ "lastInRow"
1261
+ ]
1262
+ },
1263
+ {
1264
+ kind: "directive",
1265
+ type: GridLockedCellDirective,
1266
+ selector: "td[monaGridLockedCell], th[monaGridLockedCell]",
1267
+ inputs: ["monaGridLockedCell", "lockedCellHeader"]
1268
+ },
1269
+ {
1270
+ kind: "directive",
1271
+ type: GridLogicalCellDirective,
1272
+ selector: "td[monaGridLogicalCell], th[monaGridLogicalCell]",
1273
+ inputs: [
1274
+ "ariaColIndex",
1275
+ "cellKind",
1276
+ "colIndex",
1277
+ "columnId",
1278
+ "editable",
1279
+ "expanded",
1280
+ "firstInRow",
1281
+ "groupHeader",
1282
+ "groupKey",
1283
+ "lastInRow",
1284
+ "readOnly",
1285
+ "rowIndex",
1286
+ "rowUid",
1287
+ "section"
1288
+ ],
1289
+ outputs: [
1290
+ "edit",
1291
+ "menuOpen",
1292
+ "toggleExpand"
1293
+ ]
1294
+ },
1295
+ {
1296
+ kind: "component",
1297
+ type: GridToggleComponent,
1298
+ selector: "mona-grid-toggle",
1299
+ inputs: [
1300
+ "expanded",
1301
+ "label",
1302
+ "type",
1303
+ "width"
1304
+ ],
1305
+ outputs: ["expandedChange"]
1306
+ }
1307
+ ]
1308
+ });
1309
+ }
1310
+ };
1311
+ i0.ɵɵngDeclareClassMetadata({
1312
+ minVersion: "12.0.0",
1313
+ version: "22.2.6",
1314
+ ngImport: i0,
1315
+ type: GridGroupRowComponent,
1316
+ decorators: [{
1317
+ type: Component,
1318
+ args: [{
1319
+ selector: "tr[monaGridGroupRow]",
1320
+ imports: [
1321
+ GridCellDirective,
1322
+ GridLockedCellDirective,
1323
+ GridLogicalCellDirective,
1324
+ GridToggleComponent
1325
+ ],
1326
+ host: {
1327
+ "[class]": "rowClass()",
1328
+ role: "row",
1329
+ "[attr.aria-level]": "group().depth + 1",
1330
+ "[attr.aria-expanded]": "!collapsed()",
1331
+ "[attr.aria-rowindex]": "ariaRowIndex()"
1332
+ },
1333
+ 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"
1334
+ }]
1335
+ }],
1336
+ propDecorators: {
1337
+ ariaRowIndex: [{
1338
+ type: i0.Input,
1339
+ args: [{
1340
+ isSignal: true,
1341
+ alias: "ariaRowIndex",
1342
+ required: false
1343
+ }]
1344
+ }],
1345
+ group: [{
1346
+ type: i0.Input,
1347
+ args: [{
1348
+ isSignal: true,
1349
+ alias: "group",
1350
+ required: true
1351
+ }]
1352
+ }],
1353
+ rowIndex: [{
1354
+ type: i0.Input,
1355
+ args: [{
1356
+ isSignal: true,
1357
+ alias: "rowIndex",
1358
+ required: true
1359
+ }]
1360
+ }]
1361
+ }
1362
+ });
1363
+ var GridCellComponent = class GridCellComponent {
1364
+ constructor() {
1365
+ this.#elementRef = inject(ElementRef);
1366
+ this.#gridNavigationService = inject(GridNavigationService);
1367
+ this.#i18n = inject(MonaI18nService);
1368
+ this.#injector = inject(Injector);
1369
+ this.#locale = inject(LOCALE_ID);
1370
+ this.#logicalCell = inject(GridLogicalCellDirective, { optional: true });
1371
+ this.baseClass = computed(() => {
1372
+ return gridCellBaseThemeVariants({ virtual: this.gridService.virtualScrollOptions().enabled });
1373
+ }, ...ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []);
1374
+ this.cellContainerClass = computed(() => {
1375
+ const editing = this.isEditing();
1376
+ return gridCellContainerThemeVariants({
1377
+ editing,
1378
+ virtual: this.gridService.virtualScrollOptions().enabled
1379
+ });
1380
+ }, ...ngDevMode ? [{ debugName: "cellContainerClass" }] : /* istanbul ignore next */ []);
1381
+ this.cellDirtyIndicatorClass = computed(() => {
1382
+ return gridCellDirtyIndicatorThemeVariants();
1383
+ }, ...ngDevMode ? [{ debugName: "cellDirtyIndicatorClass" }] : /* istanbul ignore next */ []);
1384
+ this.cellTextClass = computed(() => {
1385
+ return gridCellTextThemeVariants();
1386
+ }, ...ngDevMode ? [{ debugName: "cellTextClass" }] : /* istanbul ignore next */ []);
1387
+ this.cellUid = computed(() => `${this.row().uid}_${this.column().id}`, ...ngDevMode ? [{ debugName: "cellUid" }] : /* istanbul ignore next */ []);
1388
+ this.displayValue = computed(() => {
1389
+ const editedRowData = this.gridService.editViewDict().get(this.row().uid);
1390
+ const rowData = this.row().data;
1391
+ return (editedRowData ?? rowData)[this.column().field];
1392
+ }, ...ngDevMode ? [{ debugName: "displayValue" }] : /* istanbul ignore next */ []);
1393
+ this.editContextIsCellMode = computed(() => this.gridService.editContext()?.mode === "cell", ...ngDevMode ? [{ debugName: "editContextIsCellMode" }] : /* istanbul ignore next */ []);
1394
+ this.formattedDisplayValue = computed(() => {
1395
+ const column = this.column();
1396
+ const value = this.displayValue();
1397
+ const format = column.format;
1398
+ if (format == null) return column.dataType === "date" && value instanceof Date && !Number.isNaN(value.getTime()) ? formatGregorianDateToLocaleString(value, this.#i18n.localeId(), {
1399
+ day: "2-digit",
1400
+ month: "2-digit",
1401
+ year: "numeric"
1402
+ }) : value;
1403
+ if (typeof format === "function") return format(value, this.row().data, column);
1404
+ if (column.dataType === "date") return this.formatDateValue(value, format);
1405
+ return value;
1406
+ }, ...ngDevMode ? [{ debugName: "formattedDisplayValue" }] : /* istanbul ignore next */ []);
1407
+ this.gridService = inject(GridService);
1408
+ this.isCellPristine = computed(() => {
1409
+ const row = this.row();
1410
+ const editedRowData = this.gridService.editViewDict().get(row.uid);
1411
+ if (!editedRowData) return true;
1412
+ const field = this.column().field;
1413
+ return row.data[field] === editedRowData[field];
1414
+ }, ...ngDevMode ? [{ debugName: "isCellPristine" }] : /* istanbul ignore next */ []);
1415
+ this.isEditing = computed(() => {
1416
+ const context = this.gridService.editContext();
1417
+ if (context == null) return false;
1418
+ if (context.mode === "cell") return context.cellUid === this.cellUid();
1419
+ return context.rowUid === this.row().uid && this.column().editable;
1420
+ }, ...ngDevMode ? [{ debugName: "isEditing" }] : /* istanbul ignore next */ []);
1421
+ this.shouldAutoFocusEditor = computed(() => {
1422
+ const context = this.gridService.editContext();
1423
+ if (context?.mode === "cell") return context.cellUid === this.cellUid();
1424
+ if (context?.mode !== "row" || context.rowUid !== this.row().uid) return false;
1425
+ if (context.focusColumnId != null) return context.focusColumnId === this.column().id;
1426
+ return this.gridService.visibleColumns().firstOrDefault((column) => column.kind === "data" && column.editable) === this.column();
1427
+ }, ...ngDevMode ? [{ debugName: "shouldAutoFocusEditor" }] : /* istanbul ignore next */ []);
1428
+ this.column = input.required(...ngDevMode ? [{ debugName: "column" }] : /* istanbul ignore next */ []);
1429
+ this.row = input.required(...ngDevMode ? [{ debugName: "row" }] : /* istanbul ignore next */ []);
1430
+ }
1431
+ #elementRef;
1432
+ #gridNavigationService;
1433
+ #i18n;
1434
+ #injector;
1435
+ #locale;
1436
+ #logicalCell;
1437
+ handleLogicalCellEnter(originalEvent) {
1438
+ const editableOptions = this.gridService.editableOptions();
1439
+ if (!editableOptions.enabled || this.column().kind !== "data") return;
1440
+ if (editableOptions.mode === "cell") {
1441
+ this.startEdit(originalEvent);
1442
+ return;
1443
+ }
1444
+ const context = this.gridService.editContext();
1445
+ if (context?.mode === "row" && context.rowUid === this.row().uid) {
1446
+ this.focusInnerEditor();
1447
+ return;
1448
+ }
1449
+ const column = this.column();
1450
+ this.gridService.startRowEdit(this.row(), originalEvent, column.editable ? column.id : null);
1451
+ }
1452
+ onCellDoubleClick(event) {
1453
+ if (this.gridService.editableOptions().mode === "cell") this.startEdit(event);
1454
+ }
1455
+ onEditCancel() {
1456
+ if (this.gridService.editContext() != null && this.gridService.cancelEdit(void 0, "escape")) this.focusHostCell();
1457
+ }
1458
+ onEditCommit(trigger) {
1459
+ const context = this.gridService.editContext();
1460
+ if (context?.mode === "cell") {
1461
+ if (this.gridService.stopCellEdit()) this.focusHostCell();
1462
+ return;
1463
+ }
1464
+ if (context?.mode === "row" && trigger === "enter" && this.gridService.commitRowEdit()) this.focusHostCell();
1465
+ }
1466
+ onEditTabNavigate(direction) {
1467
+ if (this.gridService.editContext()?.mode !== "cell") return;
1468
+ const rowUid = this.row().uid;
1469
+ const columnId = this.column().id;
1470
+ if (!this.gridService.stopCellEdit()) return;
1471
+ afterNextRender({ read: () => {
1472
+ if (this.#gridNavigationService.focusAdjacentEditableCell(rowUid, columnId, direction)) return;
1473
+ if (!this.#logicalCell?.leaveGrid(direction === "previous")) this.focusHostCell();
1474
+ } }, { injector: this.#injector });
1475
+ }
1476
+ focusHostCell() {
1477
+ this.#elementRef.nativeElement.closest("td")?.focus();
1478
+ }
1479
+ focusInnerEditor() {
1480
+ this.#elementRef.nativeElement.querySelector(GRID_CELL_FOCUSABLE_SELECTOR)?.focus();
1481
+ }
1482
+ formatDateValue(value, format) {
1483
+ if (value == null) return value;
1484
+ if (value instanceof Date || typeof value === "number" || typeof value === "string") try {
1485
+ return formatDate(value, format, this.#locale);
1486
+ } catch {
1487
+ return value;
1488
+ }
1489
+ return value;
1490
+ }
1491
+ startEdit(originalEvent) {
1492
+ if (!this.gridService.editableOptions().enabled || !this.column().editable || this.column().kind !== "data") return;
1493
+ this.gridService.startCellEdit(this.cellUid(), this.row(), this.column(), originalEvent);
1494
+ }
1495
+ static {
1496
+ this.ɵfac = i0.ɵɵngDeclareFactory({
1497
+ minVersion: "12.0.0",
1498
+ version: "22.2.6",
1499
+ ngImport: i0,
1500
+ type: GridCellComponent,
1501
+ deps: [],
1502
+ target: i0.ɵɵFactoryTarget.Component
1503
+ });
1504
+ }
1505
+ static {
1506
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
1507
+ minVersion: "17.0.0",
1508
+ version: "22.2.6",
1509
+ type: GridCellComponent,
1510
+ isStandalone: true,
1511
+ selector: "mona-grid-cell",
1512
+ inputs: {
1513
+ column: {
1514
+ classPropertyName: "column",
1515
+ publicName: "column",
1516
+ isSignal: true,
1517
+ isRequired: true,
1518
+ transformFunction: null
1519
+ },
1520
+ row: {
1521
+ classPropertyName: "row",
1522
+ publicName: "row",
1523
+ isSignal: true,
1524
+ isRequired: true,
1525
+ transformFunction: null
1526
+ }
1527
+ },
1528
+ host: { properties: { "class": "baseClass()" } },
1529
+ ngImport: i0,
1530
+ 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",
1531
+ dependencies: [
1532
+ {
1533
+ kind: "component",
1534
+ type: GridCommandCellComponent,
1535
+ selector: "mona-grid-command-cell",
1536
+ inputs: [
1537
+ "column",
1538
+ "newRow",
1539
+ "row"
1540
+ ]
1541
+ },
1542
+ {
1543
+ kind: "component",
1544
+ type: GridEditorComponent,
1545
+ selector: "mona-grid-editor",
1546
+ inputs: [
1547
+ "autoFocus",
1548
+ "column",
1549
+ "isNew",
1550
+ "session",
1551
+ "tabNavigationEnabled"
1552
+ ],
1553
+ outputs: [
1554
+ "cancelEdit",
1555
+ "commit",
1556
+ "tabNavigate"
1557
+ ]
1558
+ },
1559
+ {
1560
+ kind: "directive",
1561
+ type: NgTemplateOutlet,
1562
+ selector: "[ngTemplateOutlet]",
1563
+ inputs: [
1564
+ "ngTemplateOutletContext",
1565
+ "ngTemplateOutlet",
1566
+ "ngTemplateOutletInjector"
1567
+ ]
1568
+ }
1569
+ ]
1570
+ });
1571
+ }
1572
+ };
1573
+ i0.ɵɵngDeclareClassMetadata({
1574
+ minVersion: "12.0.0",
1575
+ version: "22.2.6",
1576
+ ngImport: i0,
1577
+ type: GridCellComponent,
1578
+ decorators: [{
1579
+ type: Component,
1580
+ args: [{
1581
+ selector: "mona-grid-cell",
1582
+ imports: [
1583
+ GridCommandCellComponent,
1584
+ GridEditorComponent,
1585
+ NgTemplateOutlet
1586
+ ],
1587
+ host: { "[class]": "baseClass()" },
1588
+ 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"
1589
+ }]
1590
+ }],
1591
+ propDecorators: {
1592
+ column: [{
1593
+ type: i0.Input,
1594
+ args: [{
1595
+ isSignal: true,
1596
+ alias: "column",
1597
+ required: true
1598
+ }]
1599
+ }],
1600
+ row: [{
1601
+ type: i0.Input,
1602
+ args: [{
1603
+ isSignal: true,
1604
+ alias: "row",
1605
+ required: true
1606
+ }]
1607
+ }]
1608
+ }
1609
+ });
1610
+ var GridRowReorderHandleComponent = class GridRowReorderHandleComponent {
1611
+ constructor() {
1612
+ this.#gridService = inject(GridService);
1613
+ this.#hostElement = inject(ElementRef).nativeElement;
1614
+ this.#injector = inject(Injector);
1615
+ this.#liveAnnouncer = inject(LiveAnnouncer);
1616
+ this.ariaLabel = computed(() => {
1617
+ const absoluteIndex = this.pageIndex() + this.#gridService.paginationState().skip;
1618
+ const label = this.#gridService.getRowReorderAriaLabel(this.row(), absoluteIndex);
1619
+ const reasonText = this.disabledReasonText();
1620
+ const messages = this.#gridService.messages();
1621
+ return messages.rowReorderHandleAriaLabel(label, messages.rowReorderKeyboardHint, reasonText ?? void 0);
1622
+ }, ...ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []);
1623
+ this.disabled = computed(() => !this.#gridService.canReorderRow(this.row()), ...ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []);
1624
+ this.disabledReasonText = computed(() => {
1625
+ const reason = this.#gridService.rowReorderDisabledReason();
1626
+ const messages = this.#gridService.messages();
1627
+ switch (reason) {
1628
+ case null: return null;
1629
+ case "disabled": return messages.rowReorderDisabled;
1630
+ case "editing": return messages.rowReorderDisabledEditing;
1631
+ case "filtered": return messages.rowReorderDisabledFiltered;
1632
+ case "grouped": return messages.rowReorderDisabledGrouped;
1633
+ case "single-row": return messages.rowReorderDisabledSingleRow;
1634
+ case "server-binding": return messages.rowReorderDisabledServerBinding;
1635
+ case "sorted": return messages.rowReorderDisabledSorted;
1636
+ case "virtual-scroll": return messages.rowReorderDisabledVirtualScroll;
1637
+ }
1638
+ }, ...ngDevMode ? [{ debugName: "disabledReasonText" }] : /* istanbul ignore next */ []);
1639
+ this.handleClass = gridRowReorderHandleThemeVariants();
1640
+ this.pageIndex = input.required(...ngDevMode ? [{ debugName: "pageIndex" }] : /* istanbul ignore next */ []);
1641
+ this.row = input.required(...ngDevMode ? [{ debugName: "row" }] : /* istanbul ignore next */ []);
1642
+ }
1643
+ #gridService;
1644
+ #hostElement;
1645
+ #injector;
1646
+ #liveAnnouncer;
1647
+ onKeydown(event) {
1648
+ if (event.key !== "ArrowUp" && event.key !== "ArrowDown" || !event.altKey) return;
1649
+ event.preventDefault();
1650
+ event.stopPropagation();
1651
+ const direction = event.key === "ArrowUp" ? -1 : 1;
1652
+ const targetIndex = this.pageIndex() + direction;
1653
+ if (targetIndex < 0 || targetIndex >= this.#gridService.viewPageRows().length) return;
1654
+ if (this.#gridService.requestRowReorder(this.row(), this.pageIndex(), targetIndex)) {
1655
+ afterNextRender({ write: () => {
1656
+ const button = this.#hostElement.querySelector("button");
1657
+ if (button != null && this.#hostElement.ownerDocument.activeElement !== button) button.focus();
1658
+ } }, { injector: this.#injector });
1659
+ const skip = this.#gridService.paginationState().skip;
1660
+ const fromRowNumber = skip + this.pageIndex() + 1;
1661
+ const toPosition = skip + targetIndex + 1;
1662
+ this.#liveAnnouncer.announce(this.#gridService.messages().rowReorderMoved(fromRowNumber, toPosition));
1663
+ }
1664
+ }
1665
+ static {
1666
+ this.ɵfac = i0.ɵɵngDeclareFactory({
1667
+ minVersion: "12.0.0",
1668
+ version: "22.2.6",
1669
+ ngImport: i0,
1670
+ type: GridRowReorderHandleComponent,
1671
+ deps: [],
1672
+ target: i0.ɵɵFactoryTarget.Component
1673
+ });
1674
+ }
1675
+ static {
1676
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
1677
+ minVersion: "17.1.0",
1678
+ version: "22.2.6",
1679
+ type: GridRowReorderHandleComponent,
1680
+ isStandalone: true,
1681
+ selector: "mona-grid-row-reorder-handle",
1682
+ inputs: {
1683
+ pageIndex: {
1684
+ classPropertyName: "pageIndex",
1685
+ publicName: "pageIndex",
1686
+ isSignal: true,
1687
+ isRequired: true,
1688
+ transformFunction: null
1689
+ },
1690
+ row: {
1691
+ classPropertyName: "row",
1692
+ publicName: "row",
1693
+ isSignal: true,
1694
+ isRequired: true,
1695
+ transformFunction: null
1696
+ }
1697
+ },
1698
+ host: { listeners: {
1699
+ "click": "$event.stopPropagation()",
1700
+ "contextmenu": "$event.stopPropagation()",
1701
+ "dblclick": "$event.stopPropagation()"
1702
+ } },
1703
+ ngImport: i0,
1704
+ 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",
1705
+ dependencies: [{
1706
+ kind: "component",
1707
+ type: LucideGripVertical,
1708
+ selector: "svg[lucideGripVertical]"
1709
+ }, {
1710
+ kind: "directive",
1711
+ type: CdkDragHandle,
1712
+ selector: "[cdkDragHandle]",
1713
+ inputs: ["cdkDragHandleDisabled"]
1714
+ }]
1715
+ });
1716
+ }
1717
+ };
1718
+ i0.ɵɵngDeclareClassMetadata({
1719
+ minVersion: "12.0.0",
1720
+ version: "22.2.6",
1721
+ ngImport: i0,
1722
+ type: GridRowReorderHandleComponent,
1723
+ decorators: [{
1724
+ type: Component,
1725
+ args: [{
1726
+ selector: "mona-grid-row-reorder-handle",
1727
+ imports: [LucideGripVertical, CdkDragHandle],
1728
+ host: {
1729
+ "(click)": "$event.stopPropagation()",
1730
+ "(contextmenu)": "$event.stopPropagation()",
1731
+ "(dblclick)": "$event.stopPropagation()"
1732
+ },
1733
+ 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"
1734
+ }]
1735
+ }],
1736
+ propDecorators: {
1737
+ pageIndex: [{
1738
+ type: i0.Input,
1739
+ args: [{
1740
+ isSignal: true,
1741
+ alias: "pageIndex",
1742
+ required: true
1743
+ }]
1744
+ }],
1745
+ row: [{
1746
+ type: i0.Input,
1747
+ args: [{
1748
+ isSignal: true,
1749
+ alias: "row",
1750
+ required: true
1751
+ }]
1752
+ }]
1753
+ }
1754
+ });
1755
+ var GridSelectionCheckboxComponent = class GridSelectionCheckboxComponent {
1756
+ constructor() {
1757
+ this.#gridService = inject(GridService);
1758
+ this.ariaLabel = computed(() => {
1759
+ const labelFn = this.#gridService.selectableOptions().rowAriaLabel;
1760
+ if (labelFn) return labelFn(this.row().data);
1761
+ return this.#gridService.messages().selectRow(this.rowIndex() + 1);
1762
+ }, ...ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []);
1763
+ this.checked = computed(() => this.#gridService.isRowSelected(this.row()), ...ngDevMode ? [{ debugName: "checked" }] : /* istanbul ignore next */ []);
1764
+ this.hostClass = computed(() => gridSelectionCellThemeVariants({ virtual: this.#gridService.virtualScrollOptions().enabled }), ...ngDevMode ? [{ debugName: "hostClass" }] : /* istanbul ignore next */ []);
1765
+ this.row = input.required(...ngDevMode ? [{ debugName: "row" }] : /* istanbul ignore next */ []);
1766
+ this.rowIndex = input.required(...ngDevMode ? [{ debugName: "rowIndex" }] : /* istanbul ignore next */ []);
1767
+ }
1768
+ #gridService;
1769
+ onCheckedChange(checked) {
1770
+ this.#gridService.setRowSelected(this.row(), checked);
1771
+ }
1772
+ static {
1773
+ this.ɵfac = i0.ɵɵngDeclareFactory({
1774
+ minVersion: "12.0.0",
1775
+ version: "22.2.6",
1776
+ ngImport: i0,
1777
+ type: GridSelectionCheckboxComponent,
1778
+ deps: [],
1779
+ target: i0.ɵɵFactoryTarget.Component
1780
+ });
1781
+ }
1782
+ static {
1783
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
1784
+ minVersion: "17.1.0",
1785
+ version: "22.2.6",
1786
+ type: GridSelectionCheckboxComponent,
1787
+ isStandalone: true,
1788
+ selector: "mona-grid-selection-checkbox",
1789
+ inputs: {
1790
+ row: {
1791
+ classPropertyName: "row",
1792
+ publicName: "row",
1793
+ isSignal: true,
1794
+ isRequired: true,
1795
+ transformFunction: null
1796
+ },
1797
+ rowIndex: {
1798
+ classPropertyName: "rowIndex",
1799
+ publicName: "rowIndex",
1800
+ isSignal: true,
1801
+ isRequired: true,
1802
+ transformFunction: null
1803
+ }
1804
+ },
1805
+ host: {
1806
+ listeners: { "click": "$event.stopPropagation()" },
1807
+ properties: { "class": "hostClass()" }
1808
+ },
1809
+ ngImport: i0,
1810
+ template: "<mona-check-box\n [checked]=\"checked()\"\n (checkedChange)=\"onCheckedChange($event)\">\n <span class=\"sr-only\">{{ ariaLabel() }}</span>\n</mona-check-box>\n",
1811
+ dependencies: [{
1812
+ kind: "component",
1813
+ type: CheckBoxComponent,
1814
+ selector: "mona-check-box",
1815
+ inputs: [
1816
+ "aria-describedby",
1817
+ "aria-label",
1818
+ "aria-labelledby",
1819
+ "checked",
1820
+ "disabled",
1821
+ "indeterminate",
1822
+ "inputId",
1823
+ "invalid",
1824
+ "label",
1825
+ "labelPosition",
1826
+ "labelSize",
1827
+ "name",
1828
+ "readonly",
1829
+ "required",
1830
+ "rounded",
1831
+ "tabIndex",
1832
+ "touched",
1833
+ "class"
1834
+ ],
1835
+ outputs: [
1836
+ "checkedChange",
1837
+ "indeterminateChange",
1838
+ "inputBlur",
1839
+ "inputChange",
1840
+ "inputFocus",
1841
+ "touch"
1842
+ ]
1843
+ }]
1844
+ });
1845
+ }
1846
+ };
1847
+ i0.ɵɵngDeclareClassMetadata({
1848
+ minVersion: "12.0.0",
1849
+ version: "22.2.6",
1850
+ ngImport: i0,
1851
+ type: GridSelectionCheckboxComponent,
1852
+ decorators: [{
1853
+ type: Component,
1854
+ args: [{
1855
+ selector: "mona-grid-selection-checkbox",
1856
+ imports: [CheckBoxComponent],
1857
+ host: {
1858
+ "[class]": "hostClass()",
1859
+ "(click)": "$event.stopPropagation()"
1860
+ },
1861
+ template: "<mona-check-box\n [checked]=\"checked()\"\n (checkedChange)=\"onCheckedChange($event)\">\n <span class=\"sr-only\">{{ ariaLabel() }}</span>\n</mona-check-box>\n"
1862
+ }]
1863
+ }],
1864
+ propDecorators: {
1865
+ row: [{
1866
+ type: i0.Input,
1867
+ args: [{
1868
+ isSignal: true,
1869
+ alias: "row",
1870
+ required: true
1871
+ }]
1872
+ }],
1873
+ rowIndex: [{
1874
+ type: i0.Input,
1875
+ args: [{
1876
+ isSignal: true,
1877
+ alias: "rowIndex",
1878
+ required: true
1879
+ }]
1880
+ }]
1881
+ }
1882
+ });
1883
+ var GridRowComponent = class GridRowComponent {
1884
+ constructor() {
1885
+ this.ariaLevel = computed(() => {
1886
+ const groupCount = this.gridService.groupColumns().length;
1887
+ return groupCount === 0 ? null : groupCount + 1;
1888
+ }, ...ngDevMode ? [{ debugName: "ariaLevel" }] : /* istanbul ignore next */ []);
1889
+ this.baseClass = computed(() => {
1890
+ const variantClass = gridListTableRowThemeVariants({
1891
+ selected: this.selected(),
1892
+ virtual: this.gridService.virtualScrollOptions().enabled
1893
+ });
1894
+ const userClass = this.gridService.rowClass()?.(this.row().data);
1895
+ return twMerge(variantClass, typeof userClass === "string" ? userClass : userClass?.join(" "));
1896
+ }, ...ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []);
1897
+ this.cellEditMode = computed(() => {
1898
+ const options = this.gridService.editableOptions();
1899
+ return options.enabled === true && options.mode === "cell";
1900
+ }, ...ngDevMode ? [{ debugName: "cellEditMode" }] : /* istanbul ignore next */ []);
1901
+ this.detailToggleClass = computed(() => this.gridService.virtualScrollOptions().enabled ? "flex h-full w-full items-stretch justify-center" : "flex min-h-9 w-full items-center justify-center", ...ngDevMode ? [{ debugName: "detailToggleClass" }] : /* istanbul ignore next */ []);
1902
+ this.detailToggleLabel = computed(() => {
1903
+ const messages = this.gridService.messages();
1904
+ const rowNumber = this.index() + this.gridService.paginationState().skip + 1;
1905
+ return this.expanded() ? messages.collapseDetail(rowNumber) : messages.expandDetail(rowNumber);
1906
+ }, ...ngDevMode ? [{ debugName: "detailToggleLabel" }] : /* istanbul ignore next */ []);
1907
+ this.editingEnabled = computed(() => this.gridService.editableOptions().enabled === true, ...ngDevMode ? [{ debugName: "editingEnabled" }] : /* istanbul ignore next */ []);
1908
+ this.gridService = inject(GridService);
1909
+ this.selectable = computed(() => this.gridService.selectableOptions().enabled, ...ngDevMode ? [{ debugName: "selectable" }] : /* istanbul ignore next */ []);
1910
+ this.ariaRowIndex = input(null, ...ngDevMode ? [{ debugName: "ariaRowIndex" }] : /* istanbul ignore next */ []);
1911
+ this.expanded = computed(() => this.gridService.isRowExpanded(this.row()), ...ngDevMode ? [{ debugName: "expanded" }] : /* istanbul ignore next */ []);
1912
+ this.index = input.required(...ngDevMode ? [{ debugName: "index" }] : /* istanbul ignore next */ []);
1913
+ this.row = input.required(...ngDevMode ? [{ debugName: "row" }] : /* istanbul ignore next */ []);
1914
+ this.selected = computed(() => this.gridService.isRowSelected(this.row()), ...ngDevMode ? [{ debugName: "selected" }] : /* istanbul ignore next */ []);
1915
+ }
1916
+ onClick(event) {
1917
+ this.gridService.handleRowClick(event, this.row());
1918
+ }
1919
+ toggleDetail() {
1920
+ this.gridService.setRowExpanded(this.row(), !this.expanded());
1921
+ }
1922
+ static {
1923
+ this.ɵfac = i0.ɵɵngDeclareFactory({
1924
+ minVersion: "12.0.0",
1925
+ version: "22.2.6",
1926
+ ngImport: i0,
1927
+ type: GridRowComponent,
1928
+ deps: [],
1929
+ target: i0.ɵɵFactoryTarget.Component
1930
+ });
1931
+ }
1932
+ static {
1933
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
1934
+ minVersion: "17.0.0",
1935
+ version: "22.2.6",
1936
+ type: GridRowComponent,
1937
+ isStandalone: true,
1938
+ selector: "tr[monaGridRow]",
1939
+ inputs: {
1940
+ ariaRowIndex: {
1941
+ classPropertyName: "ariaRowIndex",
1942
+ publicName: "ariaRowIndex",
1943
+ isSignal: true,
1944
+ isRequired: false,
1945
+ transformFunction: null
1946
+ },
1947
+ index: {
1948
+ classPropertyName: "index",
1949
+ publicName: "index",
1950
+ isSignal: true,
1951
+ isRequired: true,
1952
+ transformFunction: null
1953
+ },
1954
+ row: {
1955
+ classPropertyName: "row",
1956
+ publicName: "row",
1957
+ isSignal: true,
1958
+ isRequired: true,
1959
+ transformFunction: null
1960
+ }
1961
+ },
1962
+ host: {
1963
+ attributes: { "role": "row" },
1964
+ listeners: { "click": "onClick($event)" },
1965
+ properties: {
1966
+ "class": "baseClass()",
1967
+ "attr.data-ruid": "row().uid",
1968
+ "attr.data-row-view-index": "index()",
1969
+ "attr.aria-selected": "selectable() ? selected() : null",
1970
+ "attr.aria-rowindex": "ariaRowIndex()",
1971
+ "attr.aria-level": "ariaLevel()"
1972
+ }
1973
+ },
1974
+ exportAs: ["monaGridRow"],
1975
+ ngImport: i0,
1976
+ 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",
1977
+ dependencies: [
1978
+ {
1979
+ kind: "component",
1980
+ type: GridCellComponent,
1981
+ selector: "mona-grid-cell",
1982
+ inputs: ["column", "row"]
1983
+ },
1984
+ {
1985
+ kind: "directive",
1986
+ type: GridCellDirective,
1987
+ selector: "td[monaGridCell]",
1988
+ inputs: [
1989
+ "groupHeader",
1990
+ "groupIndent",
1991
+ "lastInRow"
1992
+ ]
1993
+ },
1994
+ {
1995
+ kind: "directive",
1996
+ type: GridLockedCellDirective,
1997
+ selector: "td[monaGridLockedCell], th[monaGridLockedCell]",
1998
+ inputs: ["monaGridLockedCell", "lockedCellHeader"]
1999
+ },
2000
+ {
2001
+ kind: "directive",
2002
+ type: GridLogicalCellDirective,
2003
+ selector: "td[monaGridLogicalCell], th[monaGridLogicalCell]",
2004
+ inputs: [
2005
+ "ariaColIndex",
2006
+ "cellKind",
2007
+ "colIndex",
2008
+ "columnId",
2009
+ "editable",
2010
+ "expanded",
2011
+ "firstInRow",
2012
+ "groupHeader",
2013
+ "groupKey",
2014
+ "lastInRow",
2015
+ "readOnly",
2016
+ "rowIndex",
2017
+ "rowUid",
2018
+ "section"
2019
+ ],
2020
+ outputs: [
2021
+ "edit",
2022
+ "menuOpen",
2023
+ "toggleExpand"
2024
+ ]
2025
+ },
2026
+ {
2027
+ kind: "component",
2028
+ type: GridRowReorderHandleComponent,
2029
+ selector: "mona-grid-row-reorder-handle",
2030
+ inputs: ["pageIndex", "row"]
2031
+ },
2032
+ {
2033
+ kind: "component",
2034
+ type: GridSelectionCheckboxComponent,
2035
+ selector: "mona-grid-selection-checkbox",
2036
+ inputs: ["row", "rowIndex"]
2037
+ },
2038
+ {
2039
+ kind: "component",
2040
+ type: GridToggleComponent,
2041
+ selector: "mona-grid-toggle",
2042
+ inputs: [
2043
+ "expanded",
2044
+ "label",
2045
+ "type",
2046
+ "width"
2047
+ ],
2048
+ outputs: ["expandedChange"]
2049
+ }
2050
+ ]
2051
+ });
2052
+ }
2053
+ };
2054
+ i0.ɵɵngDeclareClassMetadata({
2055
+ minVersion: "12.0.0",
2056
+ version: "22.2.6",
2057
+ ngImport: i0,
2058
+ type: GridRowComponent,
2059
+ decorators: [{
2060
+ type: Component,
2061
+ args: [{
2062
+ selector: "tr[monaGridRow]",
2063
+ exportAs: "monaGridRow",
2064
+ imports: [
2065
+ GridCellComponent,
2066
+ GridCellDirective,
2067
+ GridLockedCellDirective,
2068
+ GridLogicalCellDirective,
2069
+ GridRowReorderHandleComponent,
2070
+ GridSelectionCheckboxComponent,
2071
+ GridToggleComponent
2072
+ ],
2073
+ host: {
2074
+ "[class]": "baseClass()",
2075
+ "[attr.data-ruid]": "row().uid",
2076
+ "[attr.data-row-view-index]": "index()",
2077
+ role: "row",
2078
+ "[attr.aria-selected]": "selectable() ? selected() : null",
2079
+ "[attr.aria-rowindex]": "ariaRowIndex()",
2080
+ "[attr.aria-level]": "ariaLevel()",
2081
+ "(click)": "onClick($event)"
2082
+ },
2083
+ 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"
2084
+ }]
2085
+ }],
2086
+ propDecorators: {
2087
+ ariaRowIndex: [{
2088
+ type: i0.Input,
2089
+ args: [{
2090
+ isSignal: true,
2091
+ alias: "ariaRowIndex",
2092
+ required: false
2093
+ }]
2094
+ }],
2095
+ index: [{
2096
+ type: i0.Input,
2097
+ args: [{
2098
+ isSignal: true,
2099
+ alias: "index",
2100
+ required: true
2101
+ }]
2102
+ }],
2103
+ row: [{
2104
+ type: i0.Input,
2105
+ args: [{
2106
+ isSignal: true,
2107
+ alias: "row",
2108
+ required: true
2109
+ }]
2110
+ }]
2111
+ }
2112
+ });
2113
+ export { GridCellDirective as i, GridGroupRowComponent as n, GridAddRowComponent as r, GridRowComponent as t };
2114
+
2115
+ //# sourceMappingURL=nanahoshi-mona-ui-grid-grid-row.component-DkWTD3pN.mjs.map