@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
@@ -1,293 +1,430 @@
1
- import * as i0 from '@angular/core';
2
- import { Pipe, inject, Injectable, computed, signal, output, input, model, effect, untracked, Component } from '@angular/core';
3
- import * as i1 from '@angular/forms';
4
- import { FormsModule } from '@angular/forms';
5
- import { ButtonDirective } from '@nanahoshi/mona-ui/button';
6
- import { ButtonGroupComponent } from '@nanahoshi/mona-ui/button-group';
7
- import { DatePickerComponent } from '@nanahoshi/mona-ui/date-picker';
8
- import { DropdownListComponent } from '@nanahoshi/mona-ui/dropdown-list';
9
- import { MonaI18nService } from '@nanahoshi/mona-ui/i18n';
10
- import { NumericTextBoxComponent } from '@nanahoshi/mona-ui/numeric-text-box';
11
- import { TextBoxComponent } from '@nanahoshi/mona-ui/text-box';
12
- import { cva } from 'class-variance-authority';
13
- import { themeOverlaySurfaceClasses } from '@nanahoshi/mona-ui/internal';
14
-
15
- // Generated from i18n/catalogs/en-US.messages.json by scripts/generate-locale-catalogs.ts. Do not edit.
16
- // Edit the JSON file and run `npm run generate:locale-catalogs`.
1
+ import * as i0 from "@angular/core";
2
+ import { Component, Injectable, Pipe, computed, effect, inject, input, model, output, signal, untracked } from "@angular/core";
3
+ import * as i1 from "@angular/forms";
4
+ import { FormsModule } from "@angular/forms";
5
+ import { ButtonDirective } from "@nanahoshi/mona-ui/button";
6
+ import { ButtonGroupComponent } from "@nanahoshi/mona-ui/button-group";
7
+ import { DatePickerComponent } from "@nanahoshi/mona-ui/date-picker";
8
+ import { DropdownListComponent } from "@nanahoshi/mona-ui/dropdown-list";
9
+ import { MonaI18nService } from "@nanahoshi/mona-ui/i18n";
10
+ import { NumericTextBoxComponent } from "@nanahoshi/mona-ui/numeric-text-box";
11
+ import { TextBoxComponent } from "@nanahoshi/mona-ui/text-box";
12
+ import { cva } from "class-variance-authority";
13
+ import { themeOverlaySurfaceClasses } from "@nanahoshi/mona-ui/internal";
17
14
  const FILTER_DEFAULT_MESSAGES = {
18
- and: "AND",
19
- apply: "Apply",
20
- clear: "Clear",
21
- contains: "Contains",
22
- doesNotContain: "Does not contain",
23
- endsWith: "Ends with",
24
- isAfter: "Is after",
25
- isAfterOrEqualTo: "Is after or equal to",
26
- isBefore: "Is before",
27
- isBeforeOrEqualTo: "Is before or equal to",
28
- isEmpty: "Is empty",
29
- isEqualTo: "Is equal to",
30
- isFalse: "Is false",
31
- isGreaterThan: "Is greater than",
32
- isGreaterThanOrEqualTo: "Is greater than or equal to",
33
- isLessThan: "Is less than",
34
- isLessThanOrEqualTo: "Is less than or equal to",
35
- isNotEmpty: "Is not empty",
36
- isNotEqualTo: "Is not equal to",
37
- isNotNull: "Is not null",
38
- isNotNullOrEmpty: "Is not null or empty",
39
- isNull: "Is null",
40
- isNullOrEmpty: "Is null or empty",
41
- isTrue: "Is true",
42
- logic: "Combine conditions",
43
- operator: "Operator",
44
- or: "OR",
45
- secondOperator: "Second operator",
46
- secondValue: "Second value",
47
- startsWith: "Starts with",
48
- value: "Value"
15
+ and: "AND",
16
+ apply: "Apply",
17
+ clear: "Clear",
18
+ contains: "Contains",
19
+ doesNotContain: "Does not contain",
20
+ endsWith: "Ends with",
21
+ isAfter: "Is after",
22
+ isAfterOrEqualTo: "Is after or equal to",
23
+ isBefore: "Is before",
24
+ isBeforeOrEqualTo: "Is before or equal to",
25
+ isEmpty: "Is empty",
26
+ isEqualTo: "Is equal to",
27
+ isFalse: "Is false",
28
+ isGreaterThan: "Is greater than",
29
+ isGreaterThanOrEqualTo: "Is greater than or equal to",
30
+ isLessThan: "Is less than",
31
+ isLessThanOrEqualTo: "Is less than or equal to",
32
+ isNotEmpty: "Is not empty",
33
+ isNotEqualTo: "Is not equal to",
34
+ isNotNull: "Is not null",
35
+ isNotNullOrEmpty: "Is not null or empty",
36
+ isNull: "Is null",
37
+ isNullOrEmpty: "Is null or empty",
38
+ isTrue: "Is true",
39
+ logic: "Combine conditions",
40
+ operator: "Operator",
41
+ or: "OR",
42
+ secondOperator: "Second operator",
43
+ secondValue: "Second value",
44
+ startsWith: "Starts with",
45
+ value: "Value"
49
46
  };
50
-
51
- class OperatorFilterPipe {
52
- transform(value, visibleOperators) {
53
- if (!visibleOperators) {
54
- return value;
55
- }
56
- const operators = Array.from(visibleOperators);
57
- if (!operators.length) {
58
- return value;
59
- }
60
- return value
61
- .filter(item => operators.includes(item.value))
62
- .sort((a, b) => {
63
- return operators.indexOf(a.value) - operators.indexOf(b.value);
64
- });
65
- }
66
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: OperatorFilterPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
67
- static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "22.0.6", ngImport: i0, type: OperatorFilterPipe, isStandalone: true, name: "operatorFilter" }); }
68
- }
69
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: OperatorFilterPipe, decorators: [{
70
- type: Pipe,
71
- args: [{
72
- name: "operatorFilter"
73
- }]
74
- }] });
75
-
76
- class ValuelessOperatorPipe {
77
- transform(value) {
78
- return (value === "isnull" ||
79
- value === "isnotnull" ||
80
- value === "isempty" ||
81
- value === "isnotempty" ||
82
- value === "isnullorempty" ||
83
- value === "isnotnullorempty");
84
- }
85
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ValuelessOperatorPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
86
- static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "22.0.6", ngImport: i0, type: ValuelessOperatorPipe, isStandalone: true, name: "valuelessOperator" }); }
87
- }
88
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ValuelessOperatorPipe, decorators: [{
89
- type: Pipe,
90
- args: [{
91
- name: "valuelessOperator"
92
- }]
93
- }] });
94
-
95
- class FilterService {
96
- #i18n = inject(MonaI18nService);
97
- #messages = this.#i18n.componentMessages("filter", FILTER_DEFAULT_MESSAGES);
98
- get booleanFilterMenuItems() {
99
- const m = this.#messages();
100
- return [
101
- { text: m.isTrue, value: "istrue" },
102
- { text: m.isFalse, value: "isfalse" },
103
- { text: m.isNull, value: "isnull" },
104
- { text: m.isNotNull, value: "isnotnull" }
105
- ];
106
- }
107
- get dateFilterMenuItems() {
108
- const m = this.#messages();
109
- return [
110
- { text: m.isEqualTo, value: "eq" },
111
- { text: m.isNotEqualTo, value: "neq" },
112
- { text: m.isAfter, value: "gt" },
113
- { text: m.isAfterOrEqualTo, value: "gte" },
114
- { text: m.isBefore, value: "lt" },
115
- { text: m.isBeforeOrEqualTo, value: "lte" },
116
- { text: m.isNull, value: "isnull" },
117
- { text: m.isNotNull, value: "isnotnull" }
118
- ];
119
- }
120
- // TODO: Add null and empty filter operators
121
- get numericFilterMenuItems() {
122
- const m = this.#messages();
123
- return [
124
- { text: m.isEqualTo, value: "eq" },
125
- { text: m.isNotEqualTo, value: "neq" },
126
- { text: m.isGreaterThan, value: "gt" },
127
- { text: m.isGreaterThanOrEqualTo, value: "gte" },
128
- { text: m.isLessThan, value: "lt" },
129
- { text: m.isLessThanOrEqualTo, value: "lte" },
130
- { text: m.isNull, value: "isnull" },
131
- { text: m.isNotNull, value: "isnotnull" }
132
- ];
133
- }
134
- get stringFilterMenuItems() {
135
- const m = this.#messages();
136
- return [
137
- { text: m.contains, value: "contains" },
138
- { text: m.doesNotContain, value: "doesnotcontain" },
139
- { text: m.endsWith, value: "endswith" },
140
- { text: m.startsWith, value: "startswith" },
141
- { text: m.isEqualTo, value: "eq" },
142
- { text: m.isNotEqualTo, value: "neq" },
143
- { text: m.isEmpty, value: "isempty" },
144
- { text: m.isNotEmpty, value: "isnotempty" },
145
- { text: m.isNull, value: "isnull" },
146
- { text: m.isNotNull, value: "isnotnull" },
147
- { text: m.isNullOrEmpty, value: "isnullorempty" },
148
- { text: m.isNotNullOrEmpty, value: "isnotnullorempty" }
149
- ];
150
- }
151
- buildBooleanFilterDescriptor(args) {
152
- const descriptors = [];
153
- const descriptor1 = this.getBooleanDescriptor(args.operator1, args.field);
154
- if (descriptor1) {
155
- descriptors.push(descriptor1);
156
- }
157
- if (args.logic) {
158
- const descriptor2 = this.getBooleanDescriptor(args.operator2, args.field);
159
- if (descriptor2) {
160
- descriptors.push(descriptor2);
161
- }
162
- }
163
- return {
164
- logic: args.logic || "and",
165
- filters: descriptors
166
- };
167
- }
168
- buildDateFilterDescriptor(args) {
169
- const descriptors = [];
170
- const descriptor1 = this.getDateDescriptor(args.operator1, args.field, args.value1);
171
- if (descriptor1) {
172
- descriptors.push(descriptor1);
173
- }
174
- if (args.logic) {
175
- const descriptor2 = this.getDateDescriptor(args.operator2, args.field, args.value2);
176
- if (descriptor2) {
177
- descriptors.push(descriptor2);
178
- }
179
- }
180
- return {
181
- logic: args.logic || "and",
182
- filters: descriptors
183
- };
184
- }
185
- buildNumberFilterDescriptor(args) {
186
- const descriptors = [];
187
- const descriptor1 = this.getNumberDescriptor(args.operator1, args.field, args.value1);
188
- if (descriptor1) {
189
- descriptors.push(descriptor1);
190
- }
191
- if (args.logic) {
192
- const descriptor2 = this.getNumberDescriptor(args.operator2, args.field, args.value2);
193
- if (descriptor2) {
194
- descriptors.push(descriptor2);
195
- }
196
- }
197
- return {
198
- logic: args.logic || "and",
199
- filters: descriptors
200
- };
201
- }
202
- buildStringFilterDescriptor(args) {
203
- const descriptors = [];
204
- const descriptor1 = this.getStringDescriptor(args.operator1, args.field, args.value1);
205
- if (descriptor1) {
206
- descriptors.push(descriptor1);
207
- }
208
- if (args.logic) {
209
- const descriptor2 = this.getStringDescriptor(args.operator2, args.field, args.value2);
210
- if (descriptor2) {
211
- descriptors.push(descriptor2);
212
- }
213
- }
214
- return {
215
- logic: args.logic || "and",
216
- filters: descriptors
217
- };
218
- }
219
- getBooleanDescriptor(operator, field) {
220
- if (operator === "isnotnull" || operator === "isnull") {
221
- return { field, operator };
222
- }
223
- else if (operator === "istrue") {
224
- return { field, operator };
225
- }
226
- else if (operator === "isfalse") {
227
- return { field, operator };
228
- }
229
- return null;
230
- }
231
- getDateDescriptor(operator, field, value) {
232
- if (operator === "isnotnull" || operator === "isnull") {
233
- return { field, operator };
234
- }
235
- else if (value != null) {
236
- return { field, operator, value };
237
- }
238
- return null;
239
- }
240
- getNumberDescriptor(operator, field, value) {
241
- if (operator === "isnotnull" || operator === "isnull") {
242
- return { field, operator };
243
- }
244
- else if (value != null) {
245
- return { field, operator, value };
246
- }
247
- return null;
248
- }
249
- getStringDescriptor(operator, field, value) {
250
- if (operator === "isnotnull" || operator === "isnull") {
251
- return { field, operator };
252
- }
253
- else if (operator === "isempty" || operator === "isnotempty") {
254
- return { field, operator };
255
- }
256
- else if (operator === "isnullorempty" || operator === "isnotnullorempty") {
257
- return { field, operator };
258
- }
259
- else if (value != null) {
260
- return { field, operator, value };
261
- }
262
- return null;
263
- }
264
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: FilterService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
265
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: FilterService }); }
266
- }
267
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: FilterService, decorators: [{
268
- type: Injectable
269
- }] });
270
-
47
+ var OperatorFilterPipe = class OperatorFilterPipe {
48
+ transform(value, visibleOperators) {
49
+ if (!visibleOperators) return value;
50
+ const operators = Array.from(visibleOperators);
51
+ if (!operators.length) return value;
52
+ return value.filter((item) => operators.includes(item.value)).sort((a, b) => {
53
+ return operators.indexOf(a.value) - operators.indexOf(b.value);
54
+ });
55
+ }
56
+ static {
57
+ this.ɵfac = i0.ɵɵngDeclareFactory({
58
+ minVersion: "12.0.0",
59
+ version: "22.2.6",
60
+ ngImport: i0,
61
+ type: OperatorFilterPipe,
62
+ deps: [],
63
+ target: i0.ɵɵFactoryTarget.Pipe
64
+ });
65
+ }
66
+ static {
67
+ this.ɵpipe = i0.ɵɵngDeclarePipe({
68
+ minVersion: "14.0.0",
69
+ version: "22.2.6",
70
+ ngImport: i0,
71
+ type: OperatorFilterPipe,
72
+ isStandalone: true,
73
+ name: "operatorFilter"
74
+ });
75
+ }
76
+ };
77
+ i0.ɵɵngDeclareClassMetadata({
78
+ minVersion: "12.0.0",
79
+ version: "22.2.6",
80
+ ngImport: i0,
81
+ type: OperatorFilterPipe,
82
+ decorators: [{
83
+ type: Pipe,
84
+ args: [{ name: "operatorFilter" }]
85
+ }]
86
+ });
87
+ var ValuelessOperatorPipe = class ValuelessOperatorPipe {
88
+ transform(value) {
89
+ return value === "isnull" || value === "isnotnull" || value === "isempty" || value === "isnotempty" || value === "isnullorempty" || value === "isnotnullorempty";
90
+ }
91
+ static {
92
+ this.ɵfac = i0.ɵɵngDeclareFactory({
93
+ minVersion: "12.0.0",
94
+ version: "22.2.6",
95
+ ngImport: i0,
96
+ type: ValuelessOperatorPipe,
97
+ deps: [],
98
+ target: i0.ɵɵFactoryTarget.Pipe
99
+ });
100
+ }
101
+ static {
102
+ this.ɵpipe = i0.ɵɵngDeclarePipe({
103
+ minVersion: "14.0.0",
104
+ version: "22.2.6",
105
+ ngImport: i0,
106
+ type: ValuelessOperatorPipe,
107
+ isStandalone: true,
108
+ name: "valuelessOperator"
109
+ });
110
+ }
111
+ };
112
+ i0.ɵɵngDeclareClassMetadata({
113
+ minVersion: "12.0.0",
114
+ version: "22.2.6",
115
+ ngImport: i0,
116
+ type: ValuelessOperatorPipe,
117
+ decorators: [{
118
+ type: Pipe,
119
+ args: [{ name: "valuelessOperator" }]
120
+ }]
121
+ });
122
+ var FilterService = class FilterService {
123
+ #i18n = inject(MonaI18nService);
124
+ #messages = this.#i18n.componentMessages("filter", FILTER_DEFAULT_MESSAGES);
125
+ get booleanFilterMenuItems() {
126
+ const m = this.#messages();
127
+ return [
128
+ {
129
+ text: m.isTrue,
130
+ value: "istrue"
131
+ },
132
+ {
133
+ text: m.isFalse,
134
+ value: "isfalse"
135
+ },
136
+ {
137
+ text: m.isNull,
138
+ value: "isnull"
139
+ },
140
+ {
141
+ text: m.isNotNull,
142
+ value: "isnotnull"
143
+ }
144
+ ];
145
+ }
146
+ get dateFilterMenuItems() {
147
+ const m = this.#messages();
148
+ return [
149
+ {
150
+ text: m.isEqualTo,
151
+ value: "eq"
152
+ },
153
+ {
154
+ text: m.isNotEqualTo,
155
+ value: "neq"
156
+ },
157
+ {
158
+ text: m.isAfter,
159
+ value: "gt"
160
+ },
161
+ {
162
+ text: m.isAfterOrEqualTo,
163
+ value: "gte"
164
+ },
165
+ {
166
+ text: m.isBefore,
167
+ value: "lt"
168
+ },
169
+ {
170
+ text: m.isBeforeOrEqualTo,
171
+ value: "lte"
172
+ },
173
+ {
174
+ text: m.isNull,
175
+ value: "isnull"
176
+ },
177
+ {
178
+ text: m.isNotNull,
179
+ value: "isnotnull"
180
+ }
181
+ ];
182
+ }
183
+ get numericFilterMenuItems() {
184
+ const m = this.#messages();
185
+ return [
186
+ {
187
+ text: m.isEqualTo,
188
+ value: "eq"
189
+ },
190
+ {
191
+ text: m.isNotEqualTo,
192
+ value: "neq"
193
+ },
194
+ {
195
+ text: m.isGreaterThan,
196
+ value: "gt"
197
+ },
198
+ {
199
+ text: m.isGreaterThanOrEqualTo,
200
+ value: "gte"
201
+ },
202
+ {
203
+ text: m.isLessThan,
204
+ value: "lt"
205
+ },
206
+ {
207
+ text: m.isLessThanOrEqualTo,
208
+ value: "lte"
209
+ },
210
+ {
211
+ text: m.isNull,
212
+ value: "isnull"
213
+ },
214
+ {
215
+ text: m.isNotNull,
216
+ value: "isnotnull"
217
+ }
218
+ ];
219
+ }
220
+ get stringFilterMenuItems() {
221
+ const m = this.#messages();
222
+ return [
223
+ {
224
+ text: m.contains,
225
+ value: "contains"
226
+ },
227
+ {
228
+ text: m.doesNotContain,
229
+ value: "doesnotcontain"
230
+ },
231
+ {
232
+ text: m.endsWith,
233
+ value: "endswith"
234
+ },
235
+ {
236
+ text: m.startsWith,
237
+ value: "startswith"
238
+ },
239
+ {
240
+ text: m.isEqualTo,
241
+ value: "eq"
242
+ },
243
+ {
244
+ text: m.isNotEqualTo,
245
+ value: "neq"
246
+ },
247
+ {
248
+ text: m.isEmpty,
249
+ value: "isempty"
250
+ },
251
+ {
252
+ text: m.isNotEmpty,
253
+ value: "isnotempty"
254
+ },
255
+ {
256
+ text: m.isNull,
257
+ value: "isnull"
258
+ },
259
+ {
260
+ text: m.isNotNull,
261
+ value: "isnotnull"
262
+ },
263
+ {
264
+ text: m.isNullOrEmpty,
265
+ value: "isnullorempty"
266
+ },
267
+ {
268
+ text: m.isNotNullOrEmpty,
269
+ value: "isnotnullorempty"
270
+ }
271
+ ];
272
+ }
273
+ buildBooleanFilterDescriptor(args) {
274
+ const descriptors = [];
275
+ const descriptor1 = this.getBooleanDescriptor(args.operator1, args.field);
276
+ if (descriptor1) descriptors.push(descriptor1);
277
+ if (args.logic) {
278
+ const descriptor2 = this.getBooleanDescriptor(args.operator2, args.field);
279
+ if (descriptor2) descriptors.push(descriptor2);
280
+ }
281
+ return {
282
+ logic: args.logic || "and",
283
+ filters: descriptors
284
+ };
285
+ }
286
+ buildDateFilterDescriptor(args) {
287
+ const descriptors = [];
288
+ const descriptor1 = this.getDateDescriptor(args.operator1, args.field, args.value1);
289
+ if (descriptor1) descriptors.push(descriptor1);
290
+ if (args.logic) {
291
+ const descriptor2 = this.getDateDescriptor(args.operator2, args.field, args.value2);
292
+ if (descriptor2) descriptors.push(descriptor2);
293
+ }
294
+ return {
295
+ logic: args.logic || "and",
296
+ filters: descriptors
297
+ };
298
+ }
299
+ buildNumberFilterDescriptor(args) {
300
+ const descriptors = [];
301
+ const descriptor1 = this.getNumberDescriptor(args.operator1, args.field, args.value1);
302
+ if (descriptor1) descriptors.push(descriptor1);
303
+ if (args.logic) {
304
+ const descriptor2 = this.getNumberDescriptor(args.operator2, args.field, args.value2);
305
+ if (descriptor2) descriptors.push(descriptor2);
306
+ }
307
+ return {
308
+ logic: args.logic || "and",
309
+ filters: descriptors
310
+ };
311
+ }
312
+ buildStringFilterDescriptor(args) {
313
+ const descriptors = [];
314
+ const descriptor1 = this.getStringDescriptor(args.operator1, args.field, args.value1);
315
+ if (descriptor1) descriptors.push(descriptor1);
316
+ if (args.logic) {
317
+ const descriptor2 = this.getStringDescriptor(args.operator2, args.field, args.value2);
318
+ if (descriptor2) descriptors.push(descriptor2);
319
+ }
320
+ return {
321
+ logic: args.logic || "and",
322
+ filters: descriptors
323
+ };
324
+ }
325
+ getBooleanDescriptor(operator, field) {
326
+ if (operator === "isnotnull" || operator === "isnull") return {
327
+ field,
328
+ operator
329
+ };
330
+ else if (operator === "istrue") return {
331
+ field,
332
+ operator
333
+ };
334
+ else if (operator === "isfalse") return {
335
+ field,
336
+ operator
337
+ };
338
+ return null;
339
+ }
340
+ getDateDescriptor(operator, field, value) {
341
+ if (operator === "isnotnull" || operator === "isnull") return {
342
+ field,
343
+ operator
344
+ };
345
+ else if (value != null) return {
346
+ field,
347
+ operator,
348
+ value
349
+ };
350
+ return null;
351
+ }
352
+ getNumberDescriptor(operator, field, value) {
353
+ if (operator === "isnotnull" || operator === "isnull") return {
354
+ field,
355
+ operator
356
+ };
357
+ else if (value != null) return {
358
+ field,
359
+ operator,
360
+ value
361
+ };
362
+ return null;
363
+ }
364
+ getStringDescriptor(operator, field, value) {
365
+ if (operator === "isnotnull" || operator === "isnull") return {
366
+ field,
367
+ operator
368
+ };
369
+ else if (operator === "isempty" || operator === "isnotempty") return {
370
+ field,
371
+ operator
372
+ };
373
+ else if (operator === "isnullorempty" || operator === "isnotnullorempty") return {
374
+ field,
375
+ operator
376
+ };
377
+ else if (value != null) return {
378
+ field,
379
+ operator,
380
+ value
381
+ };
382
+ return null;
383
+ }
384
+ static {
385
+ this.ɵfac = i0.ɵɵngDeclareFactory({
386
+ minVersion: "12.0.0",
387
+ version: "22.2.6",
388
+ ngImport: i0,
389
+ type: FilterService,
390
+ deps: [],
391
+ target: i0.ɵɵFactoryTarget.Injectable
392
+ });
393
+ }
394
+ static {
395
+ this.ɵprov = i0.ɵɵngDeclareInjectable({
396
+ minVersion: "12.0.0",
397
+ version: "22.2.6",
398
+ ngImport: i0,
399
+ type: FilterService
400
+ });
401
+ }
402
+ };
403
+ i0.ɵɵngDeclareClassMetadata({
404
+ minVersion: "12.0.0",
405
+ version: "22.2.6",
406
+ ngImport: i0,
407
+ type: FilterService,
408
+ decorators: [{ type: Injectable }]
409
+ });
271
410
  const filterMenuBaseThemeVariants = cva(`
272
411
  flex w-full flex-col
273
412
  gap-2 p-1
274
413
  ${themeOverlaySurfaceClasses} text-foreground
275
414
  border border-border shadow-(--shadow-overlay)
276
- `, {
277
- variants: {
278
- rounded: {
279
- none: "rounded-none",
280
- small: "rounded-sm",
281
- medium: "rounded-md",
282
- large: "rounded-lg"
283
- },
284
- size: {
285
- small: "",
286
- medium: "",
287
- large: ""
288
- }
289
- }
290
- });
415
+ `, { variants: {
416
+ rounded: {
417
+ none: "rounded-none",
418
+ small: "rounded-sm",
419
+ medium: "rounded-md",
420
+ large: "rounded-lg"
421
+ },
422
+ size: {
423
+ small: "",
424
+ medium: "",
425
+ large: ""
426
+ }
427
+ } });
291
428
  const filterMenuItemThemeVariants = cva(`
292
429
  flex flex-col gap-1
293
430
  [&>mona-button-group>button]:flex-1
@@ -297,441 +434,672 @@ const filterMenuActionsThemeVariants = cva(`
297
434
  items-center justify-center
298
435
  gap-1 [&>button]:flex-1
299
436
  `);
300
-
301
437
  const operatorFilter = new OperatorFilterPipe();
302
438
  const valuelessOperator = new ValuelessOperatorPipe();
303
- /**
304
- * Builds a filter for one field from up to two conditions joined by AND or OR. The first condition starts at the
305
- * first allowed operator; Enter in a value applies, as does the Apply button.
306
- */
307
- class FilterMenuComponent {
308
- #filterService;
309
- #i18n;
310
- #booleanFilterValues;
311
- /** Whether each condition's operator was picked or loaded, rather than defaulted. */
312
- #chosenOperators;
313
- constructor() {
314
- this.#filterService = inject(FilterService);
315
- this.#i18n = inject(MonaI18nService);
316
- this.#booleanFilterValues = [null, null];
317
- /** Whether each condition's operator was picked or loaded, rather than defaulted. */
318
- this.#chosenOperators = [false, false];
319
- this.applyDisabled = computed(() => {
320
- if (!this.firstFilterValid()) {
321
- return true;
322
- }
323
- return !!(this.selectedConnectorItem() && !this.secondFilterValid());
324
- }, /* @ts-ignore */
325
- ...(ngDevMode ? [{ debugName: "applyDisabled" }] : /* istanbul ignore next */ []));
326
- this.baseClass = computed(() => {
327
- return filterMenuBaseThemeVariants();
328
- }, /* @ts-ignore */
329
- ...(ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []));
330
- this.connectorDataItems = computed(() => [
331
- { text: this.messages().and, value: "and" },
332
- { text: this.messages().or, value: "or" }
333
- ], /* @ts-ignore */
334
- ...(ngDevMode ? [{ debugName: "connectorDataItems" }] : /* istanbul ignore next */ []));
335
- this.dateFilterValues = signal([null, null], /* @ts-ignore */
336
- ...(ngDevMode ? [{ debugName: "dateFilterValues" }] : /* istanbul ignore next */ []));
337
- this.filterMenuActionsClass = computed(() => {
338
- return filterMenuActionsThemeVariants();
339
- }, /* @ts-ignore */
340
- ...(ngDevMode ? [{ debugName: "filterMenuActionsClass" }] : /* istanbul ignore next */ []));
341
- this.filterMenuItemClass = computed(() => {
342
- return filterMenuItemThemeVariants();
343
- }, /* @ts-ignore */
344
- ...(ngDevMode ? [{ debugName: "filterMenuItemClass" }] : /* istanbul ignore next */ []));
345
- this.firstFilterValid = computed(() => this.#conditionValid(0), /* @ts-ignore */
346
- ...(ngDevMode ? [{ debugName: "firstFilterValid" }] : /* istanbul ignore next */ []));
347
- this.messages = this.#i18n.componentMessages("filter", FILTER_DEFAULT_MESSAGES);
348
- this.numberFilterValues = signal([null, null], /* @ts-ignore */
349
- ...(ngDevMode ? [{ debugName: "numberFilterValues" }] : /* istanbul ignore next */ []));
350
- /** The operators of the menu's type that `operators` allows, in its order; labels follow the locale. */
351
- this.operatorItems = computed(() => {
352
- let items;
353
- switch (this.type()) {
354
- case "string":
355
- items = this.#filterService.stringFilterMenuItems;
356
- break;
357
- case "number":
358
- items = this.#filterService.numericFilterMenuItems;
359
- break;
360
- case "date":
361
- items = this.#filterService.dateFilterMenuItems;
362
- break;
363
- case "boolean":
364
- items = this.#filterService.booleanFilterMenuItems;
365
- break;
366
- default:
367
- items = [];
368
- }
369
- return operatorFilter.transform(items, this.operators());
370
- }, /* @ts-ignore */
371
- ...(ngDevMode ? [{ debugName: "operatorItems" }] : /* istanbul ignore next */ []));
372
- this.secondFilterValid = computed(() => this.#conditionValid(1), /* @ts-ignore */
373
- ...(ngDevMode ? [{ debugName: "secondFilterValid" }] : /* istanbul ignore next */ []));
374
- this.selectedConnectorItem = signal(null, /* @ts-ignore */
375
- ...(ngDevMode ? [{ debugName: "selectedConnectorItem" }] : /* istanbul ignore next */ []));
376
- this.selectedFilterMenuDataItemList = signal([
377
- undefined,
378
- undefined
379
- ], /* @ts-ignore */
380
- ...(ngDevMode ? [{ debugName: "selectedFilterMenuDataItemList" }] : /* istanbul ignore next */ []));
381
- this.stringFilterValues = signal(["", ""], /* @ts-ignore */
382
- ...(ngDevMode ? [{ debugName: "stringFilterValues" }] : /* istanbul ignore next */ []));
383
- this.apply = output();
384
- /**
385
- * @description Options of the date input. Without a `format`, the date picker uses the locale's date format.
386
- * @default {}
387
- */
388
- this.dateOptions = input({}, /* @ts-ignore */
389
- ...(ngDevMode ? [{ debugName: "dateOptions" }] : /* istanbul ignore next */ []));
390
- /**
391
- * @description The field the filter applies to.
392
- * @default ""
393
- */
394
- this.field = input("", /* @ts-ignore */
395
- ...(ngDevMode ? [{ debugName: "field" }] : /* istanbul ignore next */ []));
396
- /**
397
- * @description The operators offered, in this order; all of the type's operators when empty.
398
- * @default []
399
- */
400
- this.operators = input([], /* @ts-ignore */
401
- ...(ngDevMode ? [{ debugName: "operators" }] : /* istanbul ignore next */ []));
402
- this.rounded = input("medium", /* @ts-ignore */
403
- ...(ngDevMode ? [{ debugName: "rounded" }] : /* istanbul ignore next */ []));
404
- this.size = input("medium", /* @ts-ignore */
405
- ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
406
- /**
407
- * @description The data type of the field, which picks the operators and the value input.
408
- * @default "string"
409
- */
410
- this.type = input("string", /* @ts-ignore */
411
- ...(ngDevMode ? [{ debugName: "type" }] : /* istanbul ignore next */ []));
412
- /**
413
- * @description The conditions shown in the menu. Setting it to `undefined` clears the menu.
414
- */
415
- this.value = model(/* @ts-ignore */
416
- ...(ngDevMode ? [undefined, { debugName: "value" }] : /* istanbul ignore next */ []));
417
- effect(() => {
418
- const value = this.value();
419
- untracked(() => {
420
- if (value) {
421
- this.setFilterValues(value);
422
- }
423
- else {
424
- this.#resetConditions();
425
- }
426
- });
427
- });
428
- // Keep a chosen operator while it is still allowed (its label follows the locale); any other condition
429
- // starts at the first allowed operator.
430
- effect(() => {
431
- const items = this.operatorItems();
432
- const connector = this.selectedConnectorItem();
433
- const current = this.selectedFilterMenuDataItemList();
434
- untracked(() => {
435
- const match = (index) => {
436
- const item = current[index];
437
- return item == null || !this.#chosenOperators[index]
438
- ? undefined
439
- : items.find(candidate => candidate.value === item.value);
440
- };
441
- const first = match(0) ?? items[0];
442
- const second = connector == null ? undefined : (match(1) ?? items[0]);
443
- if (first !== current[0] || second !== current[1]) {
444
- this.selectedFilterMenuDataItemList.set([first, second]);
445
- }
446
- });
447
- });
448
- effect(() => {
449
- const connectors = this.connectorDataItems();
450
- untracked(() => {
451
- const current = this.selectedConnectorItem();
452
- if (current == null) {
453
- return;
454
- }
455
- const next = connectors.find(connector => connector.value === current.value) ?? null;
456
- if (next != null && next.text !== current.text) {
457
- this.selectedConnectorItem.set(next);
458
- }
459
- });
460
- });
461
- }
462
- getFilterValues() {
463
- const filterValue = (target) => {
464
- return {
465
- operator1: this.selectedFilterMenuDataItemList()[0]?.value,
466
- value1: target[0],
467
- logic: this.selectedConnectorItem()?.value,
468
- operator2: this.selectedFilterMenuDataItemList()[1]?.value,
469
- value2: target[1]
470
- };
471
- };
472
- switch (this.type()) {
473
- case "string": {
474
- const [value1, value2] = this.stringFilterValues();
475
- return filterValue([value1.trim(), value2.trim()]);
476
- }
477
- case "number":
478
- return filterValue(this.numberFilterValues());
479
- case "date":
480
- return filterValue(this.dateFilterValues());
481
- case "boolean":
482
- return filterValue(this.#booleanFilterValues);
483
- default:
484
- return {
485
- operator1: undefined,
486
- value1: null,
487
- logic: undefined,
488
- operator2: undefined,
489
- value2: null
490
- };
491
- }
492
- }
493
- onConnectorChange(item, selected) {
494
- if (selected) {
495
- this.selectedConnectorItem.set(item);
496
- }
497
- else if (item.value === this.selectedConnectorItem()?.value) {
498
- this.selectedConnectorItem.set(null);
499
- }
500
- }
501
- onFilterApply() {
502
- if (this.applyDisabled()) {
503
- return;
504
- }
505
- if (!this.selectedConnectorItem()) {
506
- this.clearSecondFilterValues();
507
- }
508
- if (this.type() === "string") {
509
- this.applyStringFilters();
510
- }
511
- else if (this.type() === "number") {
512
- this.applyNumberFilters();
513
- }
514
- else if (this.type() === "date") {
515
- this.applyDateFilters();
516
- }
517
- else if (this.type() === "boolean") {
518
- this.applyBooleanFilters();
519
- }
520
- }
521
- onFilterClear() {
522
- this.#resetConditions();
523
- this.apply.emit({
524
- logic: "and",
525
- filters: []
526
- });
527
- }
528
- onFilterOperatorChange(index, item) {
529
- this.#chosenOperators[index] = true;
530
- this.selectedFilterMenuDataItemList.update(list => {
531
- const next = [...list];
532
- next[index] = item;
533
- return next;
534
- });
535
- }
536
- /** Enter in a value applies the filter, unless an IME is composing text. */
537
- onValueKeydown(event) {
538
- if (event.key !== "Enter" || event.isComposing || event.keyCode === 229) {
539
- return;
540
- }
541
- event.preventDefault();
542
- this.onFilterApply();
543
- }
544
- /** Whether a condition is complete: valueless operators need no value; text must not be blank. */
545
- #conditionValid(index) {
546
- const operator = this.selectedFilterMenuDataItemList()[index]?.value;
547
- if (!operator) {
548
- return false;
549
- }
550
- if (valuelessOperator.transform(operator)) {
551
- return true;
552
- }
553
- switch (this.type()) {
554
- case "string":
555
- return this.stringFilterValues()[index].trim() !== "";
556
- case "number":
557
- return this.numberFilterValues()[index] !== null;
558
- case "date":
559
- return this.dateFilterValues()[index] !== null;
560
- case "boolean":
561
- return true;
562
- default:
563
- return false;
564
- }
565
- }
566
- #resetConditions() {
567
- this.numberFilterValues.set([null, null]);
568
- this.stringFilterValues.set(["", ""]);
569
- this.dateFilterValues.set([null, null]);
570
- this.#booleanFilterValues = [null, null];
571
- this.selectedConnectorItem.set(null);
572
- this.#chosenOperators = [false, false];
573
- this.selectedFilterMenuDataItemList.set([this.operatorItems()[0], undefined]);
574
- }
575
- applyBooleanFilters() {
576
- const operator1 = this.selectedFilterMenuDataItemList()[0]?.value;
577
- const operator2 = this.selectedFilterMenuDataItemList()[1]?.value;
578
- const field = this.field();
579
- const logic = this.selectedConnectorItem()?.value ?? null;
580
- const descriptor = this.#filterService.buildBooleanFilterDescriptor({
581
- field,
582
- logic,
583
- operator1,
584
- operator2,
585
- value1: true,
586
- value2: true
587
- });
588
- this.apply.emit(descriptor);
589
- }
590
- applyDateFilters() {
591
- const value1 = this.dateFilterValues()[0];
592
- const value2 = this.dateFilterValues()[1];
593
- const operator1 = this.selectedFilterMenuDataItemList()[0]?.value;
594
- const operator2 = this.selectedFilterMenuDataItemList()[1]?.value;
595
- const field = this.field();
596
- const logic = this.selectedConnectorItem()?.value ?? null;
597
- const descriptor = this.#filterService.buildDateFilterDescriptor({
598
- field,
599
- logic,
600
- operator1,
601
- operator2,
602
- value1,
603
- value2
604
- });
605
- this.apply.emit(descriptor);
606
- }
607
- applyNumberFilters() {
608
- const value1 = this.numberFilterValues()[0];
609
- const value2 = this.numberFilterValues()[1];
610
- const operator1 = this.selectedFilterMenuDataItemList()[0]?.value;
611
- const operator2 = this.selectedFilterMenuDataItemList()[1]?.value;
612
- const field = this.field();
613
- const logic = this.selectedConnectorItem()?.value ?? null;
614
- const descriptor = this.#filterService.buildNumberFilterDescriptor({
615
- field,
616
- logic,
617
- operator1,
618
- operator2,
619
- value1,
620
- value2
621
- });
622
- this.apply.emit(descriptor);
623
- }
624
- applyStringFilters() {
625
- const value1 = this.stringFilterValues()[0].trim();
626
- const value2 = this.stringFilterValues()[1].trim();
627
- const operator1 = this.selectedFilterMenuDataItemList()[0]?.value;
628
- const operator2 = this.selectedFilterMenuDataItemList()[1]?.value;
629
- const field = this.field();
630
- const logic = this.selectedConnectorItem()?.value ?? null;
631
- const descriptor = this.#filterService.buildStringFilterDescriptor({
632
- field,
633
- logic,
634
- operator1,
635
- operator2,
636
- value1,
637
- value2
638
- });
639
- this.apply.emit(descriptor);
640
- }
641
- clearSecondFilterValues() {
642
- this.#chosenOperators[1] = false;
643
- this.selectedFilterMenuDataItemList.set([this.selectedFilterMenuDataItemList()[0], undefined]);
644
- switch (this.type()) {
645
- case "string":
646
- this.stringFilterValues.set([this.stringFilterValues()[0], ""]);
647
- break;
648
- case "number":
649
- this.numberFilterValues.set([this.numberFilterValues()[0], null]);
650
- break;
651
- case "date":
652
- this.dateFilterValues.set([this.dateFilterValues()[0], null]);
653
- break;
654
- case "boolean":
655
- this.#booleanFilterValues[1] = null;
656
- break;
657
- default:
658
- break;
659
- }
660
- }
661
- setFilterValues(values) {
662
- const items = this.operatorItems();
663
- this.#chosenOperators = [values.operator1 != null, values.operator2 != null];
664
- this.selectedFilterMenuDataItemList.set([
665
- items.find(f => f.value === values.operator1) ?? items[0],
666
- items.find(f => f.value === values.operator2) ?? undefined
667
- ]);
668
- // Values the menu's inputs can't show are left empty.
669
- const { value1, value2 } = values;
670
- switch (this.type()) {
671
- case "string": {
672
- const text = (value) => (value == null ? "" : String(value));
673
- this.stringFilterValues.set([text(value1), text(value2)]);
674
- break;
675
- }
676
- case "number": {
677
- const num = (value) => (typeof value === "number" ? value : null);
678
- this.numberFilterValues.set([num(value1), num(value2)]);
679
- break;
680
- }
681
- case "date": {
682
- // A date from saved state may be text or a time stamp.
683
- const date = (value) => {
684
- if (value instanceof Date) {
685
- return value;
686
- }
687
- if (typeof value !== "string" && typeof value !== "number") {
688
- return null;
689
- }
690
- const parsed = new Date(value);
691
- return Number.isNaN(parsed.getTime()) ? null : parsed;
692
- };
693
- this.dateFilterValues.set([date(value1), date(value2)]);
694
- break;
695
- }
696
- case "boolean": {
697
- const bool = (value) => (typeof value === "boolean" ? value : null);
698
- this.#booleanFilterValues = [bool(value1), bool(value2)];
699
- break;
700
- }
701
- default:
702
- break;
703
- }
704
- const selectedConnectorItem = values.operator2 && values.logic
705
- ? (this.connectorDataItems().find(c => c.value === values.logic) ?? null)
706
- : null;
707
- this.selectedConnectorItem.set(selectedConnectorItem);
708
- }
709
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: FilterMenuComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
710
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: FilterMenuComponent, isStandalone: true, selector: "mona-filter-menu", inputs: { dateOptions: { classPropertyName: "dateOptions", publicName: "dateOptions", isSignal: true, isRequired: false, transformFunction: null }, field: { classPropertyName: "field", publicName: "field", isSignal: true, isRequired: false, transformFunction: null }, operators: { classPropertyName: "operators", publicName: "operators", isSignal: true, isRequired: false, transformFunction: null }, rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { apply: "apply", value: "valueChange" }, host: { properties: { "class": "baseClass()" } }, providers: [FilterService], ngImport: i0, template: "<div [class]=\"filterMenuItemClass()\">\n <mona-dropdown-list\n [data]=\"operatorItems()\"\n textField=\"text\"\n valueField=\"value\"\n [size]=\"size()\"\n [rounded]=\"rounded()\"\n [aria-label]=\"messages().operator\"\n [ngModel]=\"selectedFilterMenuDataItemList()[0]\"\n (ngModelChange)=\"onFilterOperatorChange(0, $event)\"></mona-dropdown-list>\n @switch (type()) {\n @case (\"string\") {\n <mona-text-box\n [ngModel]=\"stringFilterValues()[0]\"\n (ngModelChange)=\"stringFilterValues.set([$event, stringFilterValues()[1]])\"\n [size]=\"size()\"\n [rounded]=\"rounded()\"\n [aria-label]=\"messages().value\"\n (keydown)=\"onValueKeydown($event)\"\n [disabled]=\"selectedFilterMenuDataItemList()[0]?.value | valuelessOperator\"></mona-text-box>\n }\n @case (\"number\") {\n <mona-numeric-text-box\n [ngModel]=\"numberFilterValues()[0]\"\n (ngModelChange)=\"numberFilterValues.set([$event, numberFilterValues()[1]])\"\n [size]=\"size()\"\n [rounded]=\"rounded()\"\n [aria-label]=\"messages().value\"\n (keydown)=\"onValueKeydown($event)\"\n [disabled]=\"selectedFilterMenuDataItemList()[0]?.value | valuelessOperator\"></mona-numeric-text-box>\n }\n @case (\"date\") {\n <mona-date-picker\n [ngModel]=\"dateFilterValues()[0]\"\n (ngModelChange)=\"dateFilterValues.set([$event, dateFilterValues()[1]])\"\n [format]=\"dateOptions().format ?? null\"\n [size]=\"size()\"\n [rounded]=\"rounded()\"\n [aria-label]=\"messages().value\"\n (keydown)=\"onValueKeydown($event)\"\n [disabled]=\"selectedFilterMenuDataItemList()[0]?.value | valuelessOperator\"></mona-date-picker>\n }\n }\n</div>\n@if (firstFilterValid()) {\n <div [class]=\"filterMenuItemClass()\">\n <mona-button-group\n selection=\"single\"\n [size]=\"size()\"\n [rounded]=\"rounded()\"\n [aria-label]=\"messages().logic\"\n [disabled]=\"!firstFilterValid()\">\n @for (item of connectorDataItems(); track item.value) {\n <button\n monaButton\n [selected]=\"item.value === selectedConnectorItem()?.value\"\n (selectedChange)=\"onConnectorChange(item, $event)\">\n {{ item.text }}\n </button>\n }\n </mona-button-group>\n </div>\n}\n@if (!!selectedConnectorItem()) {\n <div [class]=\"filterMenuItemClass()\">\n <mona-dropdown-list\n [data]=\"operatorItems()\"\n textField=\"text\"\n valueField=\"value\"\n [size]=\"size()\"\n [rounded]=\"rounded()\"\n [aria-label]=\"messages().secondOperator\"\n [ngModel]=\"selectedFilterMenuDataItemList()[1]\"\n (ngModelChange)=\"onFilterOperatorChange(1, $event)\"></mona-dropdown-list>\n @switch (type()) {\n @case (\"string\") {\n <mona-text-box\n [ngModel]=\"stringFilterValues()[1]\"\n (ngModelChange)=\"stringFilterValues.set([stringFilterValues()[0], $event])\"\n [size]=\"size()\"\n [rounded]=\"rounded()\"\n [aria-label]=\"messages().secondValue\"\n (keydown)=\"onValueKeydown($event)\"\n [disabled]=\"selectedFilterMenuDataItemList()[1]?.value | valuelessOperator\"></mona-text-box>\n }\n @case (\"number\") {\n <mona-numeric-text-box\n [ngModel]=\"numberFilterValues()[1]\"\n (ngModelChange)=\"numberFilterValues.set([numberFilterValues()[0], $event])\"\n [size]=\"size()\"\n [rounded]=\"rounded()\"\n [aria-label]=\"messages().secondValue\"\n (keydown)=\"onValueKeydown($event)\"\n [disabled]=\"selectedFilterMenuDataItemList()[1]?.value | valuelessOperator\"></mona-numeric-text-box>\n }\n @case (\"date\") {\n <mona-date-picker\n [ngModel]=\"dateFilterValues()[1]\"\n (ngModelChange)=\"dateFilterValues.set([dateFilterValues()[0], $event])\"\n [format]=\"dateOptions().format ?? null\"\n [size]=\"size()\"\n [rounded]=\"rounded()\"\n [aria-label]=\"messages().secondValue\"\n (keydown)=\"onValueKeydown($event)\"\n [disabled]=\"selectedFilterMenuDataItemList()[1]?.value | valuelessOperator\"></mona-date-picker>\n }\n }\n </div>\n}\n<div [class]=\"`${filterMenuItemClass()} ${filterMenuActionsClass()}`\">\n <button\n monaButton\n (click)=\"onFilterApply()\"\n [look]=\"'primary'\"\n [size]=\"size()\"\n [rounded]=\"rounded()\"\n [disabled]=\"applyDisabled()\">\n {{ messages().apply }}\n </button>\n <button monaButton (click)=\"onFilterClear()\" [look]=\"'default'\" [size]=\"size()\" [rounded]=\"rounded()\">\n {{ messages().clear }}\n </button>\n</div>\n", dependencies: [{ kind: "component", type: DropdownListComponent, selector: "mona-dropdown-list", inputs: ["aria-describedby", "aria-label", "aria-labelledby", "data", "disabled", "invalid", "itemDisabled", "loading", "placeholder", "popupClass", "popupHeight", "popupWidth", "readonly", "required", "rounded", "showClearButton", "size", "textField", "touched", "class", "value", "valueField", "valuePrimitive"], outputs: ["close", "closed", "open", "opened", "touch", "valueChange"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: TextBoxComponent, selector: "mona-text-box", inputs: ["aria-describedby", "aria-label", "aria-labelledby", "clearButton", "disabled", "inputAttributes", "inputClass", "inputId", "inputStyle", "invalid", "maxLength", "minLength", "name", "placeholder", "readonly", "required", "rounded", "size", "touched", "type", "class", "value"], outputs: ["inputBlur", "inputFocus", "touch", "valueChange"] }, { kind: "component", type: NumericTextBoxComponent, selector: "mona-numeric-text-box", inputs: ["formatter", "maxValue", "minValue", "step", "value"], outputs: ["valueChange"] }, { kind: "component", type: DatePickerComponent, selector: "mona-date-picker", inputs: ["aria-describedby", "aria-label", "aria-labelledby", "disabled", "disabledDates", "firstDay", "format", "inputId", "invalid", "max", "min", "placeholder", "popupClass", "popupHeight", "popupWidth", "readonly", "readonlyInput", "required", "rounded", "showClearButton", "size", "touched", "class", "value", "weekNumber"], outputs: ["close", "closed", "open", "opened", "touch", "valueChange"] }, { kind: "component", type: ButtonGroupComponent, selector: "mona-button-group", inputs: ["allowEmpty", "aria-label", "aria-labelledby", "disabled", "invalid", "look", "readonly", "rounded", "selection", "size", "touched", "class", "value"], outputs: ["buttonClick", "touch", "valueChange"] }, { kind: "directive", type: ButtonDirective, selector: "button[monaButton]", inputs: ["aria-haspopup", "disabled", "iconOnly", "loading", "look", "rounded", "selected", "size", "tabindex", "toggleable", "type", "class", "value"], outputs: ["lookChange", "selectedChange"] }, { kind: "pipe", type: ValuelessOperatorPipe, name: "valuelessOperator" }] }); }
711
- }
712
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: FilterMenuComponent, decorators: [{
713
- type: Component,
714
- args: [{ selector: "mona-filter-menu", imports: [
715
- DropdownListComponent,
716
- FormsModule,
717
- TextBoxComponent,
718
- NumericTextBoxComponent,
719
- DatePickerComponent,
720
- ButtonGroupComponent,
721
- ButtonDirective,
722
- ValuelessOperatorPipe
723
- ], providers: [FilterService], host: {
724
- "[class]": "baseClass()"
725
- }, template: "<div [class]=\"filterMenuItemClass()\">\n <mona-dropdown-list\n [data]=\"operatorItems()\"\n textField=\"text\"\n valueField=\"value\"\n [size]=\"size()\"\n [rounded]=\"rounded()\"\n [aria-label]=\"messages().operator\"\n [ngModel]=\"selectedFilterMenuDataItemList()[0]\"\n (ngModelChange)=\"onFilterOperatorChange(0, $event)\"></mona-dropdown-list>\n @switch (type()) {\n @case (\"string\") {\n <mona-text-box\n [ngModel]=\"stringFilterValues()[0]\"\n (ngModelChange)=\"stringFilterValues.set([$event, stringFilterValues()[1]])\"\n [size]=\"size()\"\n [rounded]=\"rounded()\"\n [aria-label]=\"messages().value\"\n (keydown)=\"onValueKeydown($event)\"\n [disabled]=\"selectedFilterMenuDataItemList()[0]?.value | valuelessOperator\"></mona-text-box>\n }\n @case (\"number\") {\n <mona-numeric-text-box\n [ngModel]=\"numberFilterValues()[0]\"\n (ngModelChange)=\"numberFilterValues.set([$event, numberFilterValues()[1]])\"\n [size]=\"size()\"\n [rounded]=\"rounded()\"\n [aria-label]=\"messages().value\"\n (keydown)=\"onValueKeydown($event)\"\n [disabled]=\"selectedFilterMenuDataItemList()[0]?.value | valuelessOperator\"></mona-numeric-text-box>\n }\n @case (\"date\") {\n <mona-date-picker\n [ngModel]=\"dateFilterValues()[0]\"\n (ngModelChange)=\"dateFilterValues.set([$event, dateFilterValues()[1]])\"\n [format]=\"dateOptions().format ?? null\"\n [size]=\"size()\"\n [rounded]=\"rounded()\"\n [aria-label]=\"messages().value\"\n (keydown)=\"onValueKeydown($event)\"\n [disabled]=\"selectedFilterMenuDataItemList()[0]?.value | valuelessOperator\"></mona-date-picker>\n }\n }\n</div>\n@if (firstFilterValid()) {\n <div [class]=\"filterMenuItemClass()\">\n <mona-button-group\n selection=\"single\"\n [size]=\"size()\"\n [rounded]=\"rounded()\"\n [aria-label]=\"messages().logic\"\n [disabled]=\"!firstFilterValid()\">\n @for (item of connectorDataItems(); track item.value) {\n <button\n monaButton\n [selected]=\"item.value === selectedConnectorItem()?.value\"\n (selectedChange)=\"onConnectorChange(item, $event)\">\n {{ item.text }}\n </button>\n }\n </mona-button-group>\n </div>\n}\n@if (!!selectedConnectorItem()) {\n <div [class]=\"filterMenuItemClass()\">\n <mona-dropdown-list\n [data]=\"operatorItems()\"\n textField=\"text\"\n valueField=\"value\"\n [size]=\"size()\"\n [rounded]=\"rounded()\"\n [aria-label]=\"messages().secondOperator\"\n [ngModel]=\"selectedFilterMenuDataItemList()[1]\"\n (ngModelChange)=\"onFilterOperatorChange(1, $event)\"></mona-dropdown-list>\n @switch (type()) {\n @case (\"string\") {\n <mona-text-box\n [ngModel]=\"stringFilterValues()[1]\"\n (ngModelChange)=\"stringFilterValues.set([stringFilterValues()[0], $event])\"\n [size]=\"size()\"\n [rounded]=\"rounded()\"\n [aria-label]=\"messages().secondValue\"\n (keydown)=\"onValueKeydown($event)\"\n [disabled]=\"selectedFilterMenuDataItemList()[1]?.value | valuelessOperator\"></mona-text-box>\n }\n @case (\"number\") {\n <mona-numeric-text-box\n [ngModel]=\"numberFilterValues()[1]\"\n (ngModelChange)=\"numberFilterValues.set([numberFilterValues()[0], $event])\"\n [size]=\"size()\"\n [rounded]=\"rounded()\"\n [aria-label]=\"messages().secondValue\"\n (keydown)=\"onValueKeydown($event)\"\n [disabled]=\"selectedFilterMenuDataItemList()[1]?.value | valuelessOperator\"></mona-numeric-text-box>\n }\n @case (\"date\") {\n <mona-date-picker\n [ngModel]=\"dateFilterValues()[1]\"\n (ngModelChange)=\"dateFilterValues.set([dateFilterValues()[0], $event])\"\n [format]=\"dateOptions().format ?? null\"\n [size]=\"size()\"\n [rounded]=\"rounded()\"\n [aria-label]=\"messages().secondValue\"\n (keydown)=\"onValueKeydown($event)\"\n [disabled]=\"selectedFilterMenuDataItemList()[1]?.value | valuelessOperator\"></mona-date-picker>\n }\n }\n </div>\n}\n<div [class]=\"`${filterMenuItemClass()} ${filterMenuActionsClass()}`\">\n <button\n monaButton\n (click)=\"onFilterApply()\"\n [look]=\"'primary'\"\n [size]=\"size()\"\n [rounded]=\"rounded()\"\n [disabled]=\"applyDisabled()\">\n {{ messages().apply }}\n </button>\n <button monaButton (click)=\"onFilterClear()\" [look]=\"'default'\" [size]=\"size()\" [rounded]=\"rounded()\">\n {{ messages().clear }}\n </button>\n</div>\n" }]
726
- }], ctorParameters: () => [], propDecorators: { apply: [{ type: i0.Output, args: ["apply"] }], dateOptions: [{ type: i0.Input, args: [{ isSignal: true, alias: "dateOptions", required: false }] }], field: [{ type: i0.Input, args: [{ isSignal: true, alias: "field", required: false }] }], operators: [{ type: i0.Input, args: [{ isSignal: true, alias: "operators", required: false }] }], rounded: [{ type: i0.Input, args: [{ isSignal: true, alias: "rounded", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], type: [{ type: i0.Input, args: [{ isSignal: true, alias: "type", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }] } });
727
-
728
- /*
729
- * Public API Surface of @nanahoshi/mona-ui/filter
730
- */
731
-
732
- /**
733
- * Generated bundle index. Do not edit.
734
- */
735
-
439
+ var FilterMenuComponent = class FilterMenuComponent {
440
+ #filterService;
441
+ #i18n;
442
+ #booleanFilterValues;
443
+ #chosenOperators;
444
+ constructor() {
445
+ this.#filterService = inject(FilterService);
446
+ this.#i18n = inject(MonaI18nService);
447
+ this.#booleanFilterValues = [null, null];
448
+ this.#chosenOperators = [false, false];
449
+ this.applyDisabled = computed(() => {
450
+ if (!this.firstFilterValid()) return true;
451
+ return !!(this.selectedConnectorItem() && !this.secondFilterValid());
452
+ }, ...ngDevMode ? [{ debugName: "applyDisabled" }] : /* istanbul ignore next */ []);
453
+ this.baseClass = computed(() => {
454
+ return filterMenuBaseThemeVariants();
455
+ }, ...ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []);
456
+ this.connectorDataItems = computed(() => [{
457
+ text: this.messages().and,
458
+ value: "and"
459
+ }, {
460
+ text: this.messages().or,
461
+ value: "or"
462
+ }], ...ngDevMode ? [{ debugName: "connectorDataItems" }] : /* istanbul ignore next */ []);
463
+ this.dateFilterValues = signal([null, null], ...ngDevMode ? [{ debugName: "dateFilterValues" }] : /* istanbul ignore next */ []);
464
+ this.filterMenuActionsClass = computed(() => {
465
+ return filterMenuActionsThemeVariants();
466
+ }, ...ngDevMode ? [{ debugName: "filterMenuActionsClass" }] : /* istanbul ignore next */ []);
467
+ this.filterMenuItemClass = computed(() => {
468
+ return filterMenuItemThemeVariants();
469
+ }, ...ngDevMode ? [{ debugName: "filterMenuItemClass" }] : /* istanbul ignore next */ []);
470
+ this.firstFilterValid = computed(() => this.#conditionValid(0), ...ngDevMode ? [{ debugName: "firstFilterValid" }] : /* istanbul ignore next */ []);
471
+ this.messages = this.#i18n.componentMessages("filter", FILTER_DEFAULT_MESSAGES);
472
+ this.numberFilterValues = signal([null, null], ...ngDevMode ? [{ debugName: "numberFilterValues" }] : /* istanbul ignore next */ []);
473
+ this.operatorItems = computed(() => {
474
+ let items;
475
+ switch (this.type()) {
476
+ case "string":
477
+ items = this.#filterService.stringFilterMenuItems;
478
+ break;
479
+ case "number":
480
+ items = this.#filterService.numericFilterMenuItems;
481
+ break;
482
+ case "date":
483
+ items = this.#filterService.dateFilterMenuItems;
484
+ break;
485
+ case "boolean":
486
+ items = this.#filterService.booleanFilterMenuItems;
487
+ break;
488
+ default: items = [];
489
+ }
490
+ return operatorFilter.transform(items, this.operators());
491
+ }, ...ngDevMode ? [{ debugName: "operatorItems" }] : /* istanbul ignore next */ []);
492
+ this.secondFilterValid = computed(() => this.#conditionValid(1), ...ngDevMode ? [{ debugName: "secondFilterValid" }] : /* istanbul ignore next */ []);
493
+ this.selectedConnectorItem = signal(null, ...ngDevMode ? [{ debugName: "selectedConnectorItem" }] : /* istanbul ignore next */ []);
494
+ this.selectedFilterMenuDataItemList = signal([void 0, void 0], ...ngDevMode ? [{ debugName: "selectedFilterMenuDataItemList" }] : /* istanbul ignore next */ []);
495
+ this.stringFilterValues = signal(["", ""], ...ngDevMode ? [{ debugName: "stringFilterValues" }] : /* istanbul ignore next */ []);
496
+ this.apply = output();
497
+ this.dateOptions = input({}, ...ngDevMode ? [{ debugName: "dateOptions" }] : /* istanbul ignore next */ []);
498
+ this.field = input("", ...ngDevMode ? [{ debugName: "field" }] : /* istanbul ignore next */ []);
499
+ this.operators = input([], ...ngDevMode ? [{ debugName: "operators" }] : /* istanbul ignore next */ []);
500
+ this.rounded = input("medium", ...ngDevMode ? [{ debugName: "rounded" }] : /* istanbul ignore next */ []);
501
+ this.size = input("medium", ...ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []);
502
+ this.type = input("string", ...ngDevMode ? [{ debugName: "type" }] : /* istanbul ignore next */ []);
503
+ this.value = model(...ngDevMode ? [void 0, { debugName: "value" }] : /* istanbul ignore next */ []);
504
+ effect(() => {
505
+ const value = this.value();
506
+ untracked(() => {
507
+ if (value) this.setFilterValues(value);
508
+ else this.#resetConditions();
509
+ });
510
+ });
511
+ effect(() => {
512
+ const items = this.operatorItems();
513
+ const connector = this.selectedConnectorItem();
514
+ const current = this.selectedFilterMenuDataItemList();
515
+ untracked(() => {
516
+ const match = (index) => {
517
+ const item = current[index];
518
+ return item == null || !this.#chosenOperators[index] ? void 0 : items.find((candidate) => candidate.value === item.value);
519
+ };
520
+ const first = match(0) ?? items[0];
521
+ const second = connector == null ? void 0 : match(1) ?? items[0];
522
+ if (first !== current[0] || second !== current[1]) this.selectedFilterMenuDataItemList.set([first, second]);
523
+ });
524
+ });
525
+ effect(() => {
526
+ const connectors = this.connectorDataItems();
527
+ untracked(() => {
528
+ const current = this.selectedConnectorItem();
529
+ if (current == null) return;
530
+ const next = connectors.find((connector) => connector.value === current.value) ?? null;
531
+ if (next != null && next.text !== current.text) this.selectedConnectorItem.set(next);
532
+ });
533
+ });
534
+ }
535
+ getFilterValues() {
536
+ const filterValue = (target) => {
537
+ return {
538
+ operator1: this.selectedFilterMenuDataItemList()[0]?.value,
539
+ value1: target[0],
540
+ logic: this.selectedConnectorItem()?.value,
541
+ operator2: this.selectedFilterMenuDataItemList()[1]?.value,
542
+ value2: target[1]
543
+ };
544
+ };
545
+ switch (this.type()) {
546
+ case "string": {
547
+ const [value1, value2] = this.stringFilterValues();
548
+ return filterValue([value1.trim(), value2.trim()]);
549
+ }
550
+ case "number": return filterValue(this.numberFilterValues());
551
+ case "date": return filterValue(this.dateFilterValues());
552
+ case "boolean": return filterValue(this.#booleanFilterValues);
553
+ default: return {
554
+ operator1: void 0,
555
+ value1: null,
556
+ logic: void 0,
557
+ operator2: void 0,
558
+ value2: null
559
+ };
560
+ }
561
+ }
562
+ onConnectorChange(item, selected) {
563
+ if (selected) this.selectedConnectorItem.set(item);
564
+ else if (item.value === this.selectedConnectorItem()?.value) this.selectedConnectorItem.set(null);
565
+ }
566
+ onFilterApply() {
567
+ if (this.applyDisabled()) return;
568
+ if (!this.selectedConnectorItem()) this.clearSecondFilterValues();
569
+ if (this.type() === "string") this.applyStringFilters();
570
+ else if (this.type() === "number") this.applyNumberFilters();
571
+ else if (this.type() === "date") this.applyDateFilters();
572
+ else if (this.type() === "boolean") this.applyBooleanFilters();
573
+ }
574
+ onFilterClear() {
575
+ this.#resetConditions();
576
+ this.apply.emit({
577
+ logic: "and",
578
+ filters: []
579
+ });
580
+ }
581
+ onFilterOperatorChange(index, item) {
582
+ this.#chosenOperators[index] = true;
583
+ this.selectedFilterMenuDataItemList.update((list) => {
584
+ const next = [...list];
585
+ next[index] = item;
586
+ return next;
587
+ });
588
+ }
589
+ onValueKeydown(event) {
590
+ if (event.key !== "Enter" || event.isComposing || event.keyCode === 229) return;
591
+ event.preventDefault();
592
+ this.onFilterApply();
593
+ }
594
+ #conditionValid(index) {
595
+ const operator = this.selectedFilterMenuDataItemList()[index]?.value;
596
+ if (!operator) return false;
597
+ if (valuelessOperator.transform(operator)) return true;
598
+ switch (this.type()) {
599
+ case "string": return this.stringFilterValues()[index].trim() !== "";
600
+ case "number": return this.numberFilterValues()[index] !== null;
601
+ case "date": return this.dateFilterValues()[index] !== null;
602
+ case "boolean": return true;
603
+ default: return false;
604
+ }
605
+ }
606
+ #resetConditions() {
607
+ this.numberFilterValues.set([null, null]);
608
+ this.stringFilterValues.set(["", ""]);
609
+ this.dateFilterValues.set([null, null]);
610
+ this.#booleanFilterValues = [null, null];
611
+ this.selectedConnectorItem.set(null);
612
+ this.#chosenOperators = [false, false];
613
+ this.selectedFilterMenuDataItemList.set([this.operatorItems()[0], void 0]);
614
+ }
615
+ applyBooleanFilters() {
616
+ const operator1 = this.selectedFilterMenuDataItemList()[0]?.value;
617
+ const operator2 = this.selectedFilterMenuDataItemList()[1]?.value;
618
+ const field = this.field();
619
+ const logic = this.selectedConnectorItem()?.value ?? null;
620
+ const descriptor = this.#filterService.buildBooleanFilterDescriptor({
621
+ field,
622
+ logic,
623
+ operator1,
624
+ operator2,
625
+ value1: true,
626
+ value2: true
627
+ });
628
+ this.apply.emit(descriptor);
629
+ }
630
+ applyDateFilters() {
631
+ const value1 = this.dateFilterValues()[0];
632
+ const value2 = this.dateFilterValues()[1];
633
+ const operator1 = this.selectedFilterMenuDataItemList()[0]?.value;
634
+ const operator2 = this.selectedFilterMenuDataItemList()[1]?.value;
635
+ const field = this.field();
636
+ const logic = this.selectedConnectorItem()?.value ?? null;
637
+ const descriptor = this.#filterService.buildDateFilterDescriptor({
638
+ field,
639
+ logic,
640
+ operator1,
641
+ operator2,
642
+ value1,
643
+ value2
644
+ });
645
+ this.apply.emit(descriptor);
646
+ }
647
+ applyNumberFilters() {
648
+ const value1 = this.numberFilterValues()[0];
649
+ const value2 = this.numberFilterValues()[1];
650
+ const operator1 = this.selectedFilterMenuDataItemList()[0]?.value;
651
+ const operator2 = this.selectedFilterMenuDataItemList()[1]?.value;
652
+ const field = this.field();
653
+ const logic = this.selectedConnectorItem()?.value ?? null;
654
+ const descriptor = this.#filterService.buildNumberFilterDescriptor({
655
+ field,
656
+ logic,
657
+ operator1,
658
+ operator2,
659
+ value1,
660
+ value2
661
+ });
662
+ this.apply.emit(descriptor);
663
+ }
664
+ applyStringFilters() {
665
+ const value1 = this.stringFilterValues()[0].trim();
666
+ const value2 = this.stringFilterValues()[1].trim();
667
+ const operator1 = this.selectedFilterMenuDataItemList()[0]?.value;
668
+ const operator2 = this.selectedFilterMenuDataItemList()[1]?.value;
669
+ const field = this.field();
670
+ const logic = this.selectedConnectorItem()?.value ?? null;
671
+ const descriptor = this.#filterService.buildStringFilterDescriptor({
672
+ field,
673
+ logic,
674
+ operator1,
675
+ operator2,
676
+ value1,
677
+ value2
678
+ });
679
+ this.apply.emit(descriptor);
680
+ }
681
+ clearSecondFilterValues() {
682
+ this.#chosenOperators[1] = false;
683
+ this.selectedFilterMenuDataItemList.set([this.selectedFilterMenuDataItemList()[0], void 0]);
684
+ switch (this.type()) {
685
+ case "string":
686
+ this.stringFilterValues.set([this.stringFilterValues()[0], ""]);
687
+ break;
688
+ case "number":
689
+ this.numberFilterValues.set([this.numberFilterValues()[0], null]);
690
+ break;
691
+ case "date":
692
+ this.dateFilterValues.set([this.dateFilterValues()[0], null]);
693
+ break;
694
+ case "boolean": this.#booleanFilterValues[1] = null;
695
+ }
696
+ }
697
+ setFilterValues(values) {
698
+ const items = this.operatorItems();
699
+ this.#chosenOperators = [values.operator1 != null, values.operator2 != null];
700
+ this.selectedFilterMenuDataItemList.set([items.find((f) => f.value === values.operator1) ?? items[0], items.find((f) => f.value === values.operator2) ?? void 0]);
701
+ const { value1, value2 } = values;
702
+ switch (this.type()) {
703
+ case "string": {
704
+ const text = (value) => value == null ? "" : String(value);
705
+ this.stringFilterValues.set([text(value1), text(value2)]);
706
+ break;
707
+ }
708
+ case "number": {
709
+ const num = (value) => typeof value === "number" ? value : null;
710
+ this.numberFilterValues.set([num(value1), num(value2)]);
711
+ break;
712
+ }
713
+ case "date": {
714
+ const date = (value) => {
715
+ if (value instanceof Date) return value;
716
+ if (typeof value !== "string" && typeof value !== "number") return null;
717
+ const parsed = new Date(value);
718
+ return Number.isNaN(parsed.getTime()) ? null : parsed;
719
+ };
720
+ this.dateFilterValues.set([date(value1), date(value2)]);
721
+ break;
722
+ }
723
+ case "boolean": {
724
+ const bool = (value) => typeof value === "boolean" ? value : null;
725
+ this.#booleanFilterValues = [bool(value1), bool(value2)];
726
+ break;
727
+ }
728
+ }
729
+ const selectedConnectorItem = values.operator2 && values.logic ? this.connectorDataItems().find((c) => c.value === values.logic) ?? null : null;
730
+ this.selectedConnectorItem.set(selectedConnectorItem);
731
+ }
732
+ static {
733
+ this.ɵfac = i0.ɵɵngDeclareFactory({
734
+ minVersion: "12.0.0",
735
+ version: "22.2.6",
736
+ ngImport: i0,
737
+ type: FilterMenuComponent,
738
+ deps: [],
739
+ target: i0.ɵɵFactoryTarget.Component
740
+ });
741
+ }
742
+ static {
743
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
744
+ minVersion: "17.0.0",
745
+ version: "22.2.6",
746
+ type: FilterMenuComponent,
747
+ isStandalone: true,
748
+ selector: "mona-filter-menu",
749
+ inputs: {
750
+ dateOptions: {
751
+ classPropertyName: "dateOptions",
752
+ publicName: "dateOptions",
753
+ isSignal: true,
754
+ isRequired: false,
755
+ transformFunction: null
756
+ },
757
+ field: {
758
+ classPropertyName: "field",
759
+ publicName: "field",
760
+ isSignal: true,
761
+ isRequired: false,
762
+ transformFunction: null
763
+ },
764
+ operators: {
765
+ classPropertyName: "operators",
766
+ publicName: "operators",
767
+ isSignal: true,
768
+ isRequired: false,
769
+ transformFunction: null
770
+ },
771
+ rounded: {
772
+ classPropertyName: "rounded",
773
+ publicName: "rounded",
774
+ isSignal: true,
775
+ isRequired: false,
776
+ transformFunction: null
777
+ },
778
+ size: {
779
+ classPropertyName: "size",
780
+ publicName: "size",
781
+ isSignal: true,
782
+ isRequired: false,
783
+ transformFunction: null
784
+ },
785
+ type: {
786
+ classPropertyName: "type",
787
+ publicName: "type",
788
+ isSignal: true,
789
+ isRequired: false,
790
+ transformFunction: null
791
+ },
792
+ value: {
793
+ classPropertyName: "value",
794
+ publicName: "value",
795
+ isSignal: true,
796
+ isRequired: false,
797
+ transformFunction: null
798
+ }
799
+ },
800
+ outputs: {
801
+ apply: "apply",
802
+ value: "valueChange"
803
+ },
804
+ host: { properties: { "class": "baseClass()" } },
805
+ providers: [FilterService],
806
+ ngImport: i0,
807
+ template: "<div [class]=\"filterMenuItemClass()\">\n <mona-dropdown-list\n [data]=\"operatorItems()\"\n textField=\"text\"\n valueField=\"value\"\n [size]=\"size()\"\n [rounded]=\"rounded()\"\n [aria-label]=\"messages().operator\"\n [ngModel]=\"selectedFilterMenuDataItemList()[0]\"\n (ngModelChange)=\"onFilterOperatorChange(0, $event)\"></mona-dropdown-list>\n @switch (type()) {\n @case (\"string\") {\n <mona-text-box\n [ngModel]=\"stringFilterValues()[0]\"\n (ngModelChange)=\"stringFilterValues.set([$event, stringFilterValues()[1]])\"\n [size]=\"size()\"\n [rounded]=\"rounded()\"\n [aria-label]=\"messages().value\"\n (keydown)=\"onValueKeydown($event)\"\n [disabled]=\"selectedFilterMenuDataItemList()[0]?.value | valuelessOperator\"></mona-text-box>\n }\n @case (\"number\") {\n <mona-numeric-text-box\n [ngModel]=\"numberFilterValues()[0]\"\n (ngModelChange)=\"numberFilterValues.set([$event, numberFilterValues()[1]])\"\n [size]=\"size()\"\n [rounded]=\"rounded()\"\n [aria-label]=\"messages().value\"\n (keydown)=\"onValueKeydown($event)\"\n [disabled]=\"selectedFilterMenuDataItemList()[0]?.value | valuelessOperator\"></mona-numeric-text-box>\n }\n @case (\"date\") {\n <mona-date-picker\n [ngModel]=\"dateFilterValues()[0]\"\n (ngModelChange)=\"dateFilterValues.set([$event, dateFilterValues()[1]])\"\n [format]=\"dateOptions().format ?? null\"\n [size]=\"size()\"\n [rounded]=\"rounded()\"\n [aria-label]=\"messages().value\"\n (keydown)=\"onValueKeydown($event)\"\n [disabled]=\"selectedFilterMenuDataItemList()[0]?.value | valuelessOperator\"></mona-date-picker>\n }\n }\n</div>\n@if (firstFilterValid()) {\n <div [class]=\"filterMenuItemClass()\">\n <mona-button-group\n selection=\"single\"\n [size]=\"size()\"\n [rounded]=\"rounded()\"\n [aria-label]=\"messages().logic\"\n [disabled]=\"!firstFilterValid()\">\n @for (item of connectorDataItems(); track item.value) {\n <button\n monaButton\n [selected]=\"item.value === selectedConnectorItem()?.value\"\n (selectedChange)=\"onConnectorChange(item, $event)\">\n {{ item.text }}\n </button>\n }\n </mona-button-group>\n </div>\n}\n@if (!!selectedConnectorItem()) {\n <div [class]=\"filterMenuItemClass()\">\n <mona-dropdown-list\n [data]=\"operatorItems()\"\n textField=\"text\"\n valueField=\"value\"\n [size]=\"size()\"\n [rounded]=\"rounded()\"\n [aria-label]=\"messages().secondOperator\"\n [ngModel]=\"selectedFilterMenuDataItemList()[1]\"\n (ngModelChange)=\"onFilterOperatorChange(1, $event)\"></mona-dropdown-list>\n @switch (type()) {\n @case (\"string\") {\n <mona-text-box\n [ngModel]=\"stringFilterValues()[1]\"\n (ngModelChange)=\"stringFilterValues.set([stringFilterValues()[0], $event])\"\n [size]=\"size()\"\n [rounded]=\"rounded()\"\n [aria-label]=\"messages().secondValue\"\n (keydown)=\"onValueKeydown($event)\"\n [disabled]=\"selectedFilterMenuDataItemList()[1]?.value | valuelessOperator\"></mona-text-box>\n }\n @case (\"number\") {\n <mona-numeric-text-box\n [ngModel]=\"numberFilterValues()[1]\"\n (ngModelChange)=\"numberFilterValues.set([numberFilterValues()[0], $event])\"\n [size]=\"size()\"\n [rounded]=\"rounded()\"\n [aria-label]=\"messages().secondValue\"\n (keydown)=\"onValueKeydown($event)\"\n [disabled]=\"selectedFilterMenuDataItemList()[1]?.value | valuelessOperator\"></mona-numeric-text-box>\n }\n @case (\"date\") {\n <mona-date-picker\n [ngModel]=\"dateFilterValues()[1]\"\n (ngModelChange)=\"dateFilterValues.set([dateFilterValues()[0], $event])\"\n [format]=\"dateOptions().format ?? null\"\n [size]=\"size()\"\n [rounded]=\"rounded()\"\n [aria-label]=\"messages().secondValue\"\n (keydown)=\"onValueKeydown($event)\"\n [disabled]=\"selectedFilterMenuDataItemList()[1]?.value | valuelessOperator\"></mona-date-picker>\n }\n }\n </div>\n}\n<div [class]=\"`${filterMenuItemClass()} ${filterMenuActionsClass()}`\">\n <button\n monaButton\n (click)=\"onFilterApply()\"\n [look]=\"'primary'\"\n [size]=\"size()\"\n [rounded]=\"rounded()\"\n [disabled]=\"applyDisabled()\">\n {{ messages().apply }}\n </button>\n <button monaButton (click)=\"onFilterClear()\" [look]=\"'default'\" [size]=\"size()\" [rounded]=\"rounded()\">\n {{ messages().clear }}\n </button>\n</div>\n",
808
+ dependencies: [
809
+ {
810
+ kind: "component",
811
+ type: DropdownListComponent,
812
+ selector: "mona-dropdown-list",
813
+ inputs: [
814
+ "aria-describedby",
815
+ "aria-label",
816
+ "aria-labelledby",
817
+ "data",
818
+ "disabled",
819
+ "invalid",
820
+ "itemDisabled",
821
+ "loading",
822
+ "placeholder",
823
+ "popupClass",
824
+ "popupHeight",
825
+ "popupWidth",
826
+ "readonly",
827
+ "required",
828
+ "rounded",
829
+ "showClearButton",
830
+ "size",
831
+ "textField",
832
+ "touched",
833
+ "class",
834
+ "value",
835
+ "valueField",
836
+ "valuePrimitive"
837
+ ],
838
+ outputs: [
839
+ "close",
840
+ "closed",
841
+ "open",
842
+ "opened",
843
+ "touch",
844
+ "valueChange"
845
+ ]
846
+ },
847
+ {
848
+ kind: "ngmodule",
849
+ type: FormsModule
850
+ },
851
+ {
852
+ kind: "directive",
853
+ type: i1.NgControlStatus,
854
+ selector: "[formControlName],[ngModel],[formControl]"
855
+ },
856
+ {
857
+ kind: "directive",
858
+ type: i1.NgModel,
859
+ selector: "[ngModel]:not([formControlName]):not([formControl])",
860
+ inputs: [
861
+ "name",
862
+ "disabled",
863
+ "ngModel",
864
+ "ngModelOptions"
865
+ ],
866
+ outputs: ["ngModelChange"],
867
+ exportAs: ["ngModel"]
868
+ },
869
+ {
870
+ kind: "component",
871
+ type: TextBoxComponent,
872
+ selector: "mona-text-box",
873
+ inputs: [
874
+ "aria-describedby",
875
+ "aria-label",
876
+ "aria-labelledby",
877
+ "clearButton",
878
+ "disabled",
879
+ "inputAttributes",
880
+ "inputClass",
881
+ "inputId",
882
+ "inputStyle",
883
+ "invalid",
884
+ "maxLength",
885
+ "minLength",
886
+ "name",
887
+ "placeholder",
888
+ "readonly",
889
+ "required",
890
+ "rounded",
891
+ "size",
892
+ "touched",
893
+ "type",
894
+ "class",
895
+ "value"
896
+ ],
897
+ outputs: [
898
+ "inputBlur",
899
+ "inputFocus",
900
+ "touch",
901
+ "valueChange"
902
+ ]
903
+ },
904
+ {
905
+ kind: "component",
906
+ type: NumericTextBoxComponent,
907
+ selector: "mona-numeric-text-box",
908
+ inputs: [
909
+ "formatter",
910
+ "maxValue",
911
+ "minValue",
912
+ "step",
913
+ "value"
914
+ ],
915
+ outputs: ["valueChange"]
916
+ },
917
+ {
918
+ kind: "component",
919
+ type: DatePickerComponent,
920
+ selector: "mona-date-picker",
921
+ inputs: [
922
+ "aria-describedby",
923
+ "aria-label",
924
+ "aria-labelledby",
925
+ "disabled",
926
+ "disabledDates",
927
+ "firstDay",
928
+ "format",
929
+ "inputId",
930
+ "invalid",
931
+ "max",
932
+ "min",
933
+ "placeholder",
934
+ "popupClass",
935
+ "popupHeight",
936
+ "popupWidth",
937
+ "readonly",
938
+ "readonlyInput",
939
+ "required",
940
+ "rounded",
941
+ "showClearButton",
942
+ "size",
943
+ "touched",
944
+ "class",
945
+ "value",
946
+ "weekNumber"
947
+ ],
948
+ outputs: [
949
+ "close",
950
+ "closed",
951
+ "open",
952
+ "opened",
953
+ "touch",
954
+ "valueChange"
955
+ ]
956
+ },
957
+ {
958
+ kind: "component",
959
+ type: ButtonGroupComponent,
960
+ selector: "mona-button-group",
961
+ inputs: [
962
+ "allowEmpty",
963
+ "aria-label",
964
+ "aria-labelledby",
965
+ "disabled",
966
+ "invalid",
967
+ "look",
968
+ "readonly",
969
+ "rounded",
970
+ "selection",
971
+ "size",
972
+ "touched",
973
+ "class",
974
+ "value"
975
+ ],
976
+ outputs: [
977
+ "buttonClick",
978
+ "touch",
979
+ "valueChange"
980
+ ]
981
+ },
982
+ {
983
+ kind: "directive",
984
+ type: ButtonDirective,
985
+ selector: "button[monaButton]",
986
+ inputs: [
987
+ "aria-haspopup",
988
+ "disabled",
989
+ "iconOnly",
990
+ "loading",
991
+ "look",
992
+ "rounded",
993
+ "selected",
994
+ "size",
995
+ "tabindex",
996
+ "toggleable",
997
+ "type",
998
+ "class",
999
+ "value"
1000
+ ],
1001
+ outputs: ["lookChange", "selectedChange"]
1002
+ },
1003
+ {
1004
+ kind: "pipe",
1005
+ type: ValuelessOperatorPipe,
1006
+ name: "valuelessOperator"
1007
+ }
1008
+ ]
1009
+ });
1010
+ }
1011
+ };
1012
+ i0.ɵɵngDeclareClassMetadata({
1013
+ minVersion: "12.0.0",
1014
+ version: "22.2.6",
1015
+ ngImport: i0,
1016
+ type: FilterMenuComponent,
1017
+ decorators: [{
1018
+ type: Component,
1019
+ args: [{
1020
+ selector: "mona-filter-menu",
1021
+ imports: [
1022
+ DropdownListComponent,
1023
+ FormsModule,
1024
+ TextBoxComponent,
1025
+ NumericTextBoxComponent,
1026
+ DatePickerComponent,
1027
+ ButtonGroupComponent,
1028
+ ButtonDirective,
1029
+ ValuelessOperatorPipe
1030
+ ],
1031
+ providers: [FilterService],
1032
+ host: { "[class]": "baseClass()" },
1033
+ template: "<div [class]=\"filterMenuItemClass()\">\n <mona-dropdown-list\n [data]=\"operatorItems()\"\n textField=\"text\"\n valueField=\"value\"\n [size]=\"size()\"\n [rounded]=\"rounded()\"\n [aria-label]=\"messages().operator\"\n [ngModel]=\"selectedFilterMenuDataItemList()[0]\"\n (ngModelChange)=\"onFilterOperatorChange(0, $event)\"></mona-dropdown-list>\n @switch (type()) {\n @case (\"string\") {\n <mona-text-box\n [ngModel]=\"stringFilterValues()[0]\"\n (ngModelChange)=\"stringFilterValues.set([$event, stringFilterValues()[1]])\"\n [size]=\"size()\"\n [rounded]=\"rounded()\"\n [aria-label]=\"messages().value\"\n (keydown)=\"onValueKeydown($event)\"\n [disabled]=\"selectedFilterMenuDataItemList()[0]?.value | valuelessOperator\"></mona-text-box>\n }\n @case (\"number\") {\n <mona-numeric-text-box\n [ngModel]=\"numberFilterValues()[0]\"\n (ngModelChange)=\"numberFilterValues.set([$event, numberFilterValues()[1]])\"\n [size]=\"size()\"\n [rounded]=\"rounded()\"\n [aria-label]=\"messages().value\"\n (keydown)=\"onValueKeydown($event)\"\n [disabled]=\"selectedFilterMenuDataItemList()[0]?.value | valuelessOperator\"></mona-numeric-text-box>\n }\n @case (\"date\") {\n <mona-date-picker\n [ngModel]=\"dateFilterValues()[0]\"\n (ngModelChange)=\"dateFilterValues.set([$event, dateFilterValues()[1]])\"\n [format]=\"dateOptions().format ?? null\"\n [size]=\"size()\"\n [rounded]=\"rounded()\"\n [aria-label]=\"messages().value\"\n (keydown)=\"onValueKeydown($event)\"\n [disabled]=\"selectedFilterMenuDataItemList()[0]?.value | valuelessOperator\"></mona-date-picker>\n }\n }\n</div>\n@if (firstFilterValid()) {\n <div [class]=\"filterMenuItemClass()\">\n <mona-button-group\n selection=\"single\"\n [size]=\"size()\"\n [rounded]=\"rounded()\"\n [aria-label]=\"messages().logic\"\n [disabled]=\"!firstFilterValid()\">\n @for (item of connectorDataItems(); track item.value) {\n <button\n monaButton\n [selected]=\"item.value === selectedConnectorItem()?.value\"\n (selectedChange)=\"onConnectorChange(item, $event)\">\n {{ item.text }}\n </button>\n }\n </mona-button-group>\n </div>\n}\n@if (!!selectedConnectorItem()) {\n <div [class]=\"filterMenuItemClass()\">\n <mona-dropdown-list\n [data]=\"operatorItems()\"\n textField=\"text\"\n valueField=\"value\"\n [size]=\"size()\"\n [rounded]=\"rounded()\"\n [aria-label]=\"messages().secondOperator\"\n [ngModel]=\"selectedFilterMenuDataItemList()[1]\"\n (ngModelChange)=\"onFilterOperatorChange(1, $event)\"></mona-dropdown-list>\n @switch (type()) {\n @case (\"string\") {\n <mona-text-box\n [ngModel]=\"stringFilterValues()[1]\"\n (ngModelChange)=\"stringFilterValues.set([stringFilterValues()[0], $event])\"\n [size]=\"size()\"\n [rounded]=\"rounded()\"\n [aria-label]=\"messages().secondValue\"\n (keydown)=\"onValueKeydown($event)\"\n [disabled]=\"selectedFilterMenuDataItemList()[1]?.value | valuelessOperator\"></mona-text-box>\n }\n @case (\"number\") {\n <mona-numeric-text-box\n [ngModel]=\"numberFilterValues()[1]\"\n (ngModelChange)=\"numberFilterValues.set([numberFilterValues()[0], $event])\"\n [size]=\"size()\"\n [rounded]=\"rounded()\"\n [aria-label]=\"messages().secondValue\"\n (keydown)=\"onValueKeydown($event)\"\n [disabled]=\"selectedFilterMenuDataItemList()[1]?.value | valuelessOperator\"></mona-numeric-text-box>\n }\n @case (\"date\") {\n <mona-date-picker\n [ngModel]=\"dateFilterValues()[1]\"\n (ngModelChange)=\"dateFilterValues.set([dateFilterValues()[0], $event])\"\n [format]=\"dateOptions().format ?? null\"\n [size]=\"size()\"\n [rounded]=\"rounded()\"\n [aria-label]=\"messages().secondValue\"\n (keydown)=\"onValueKeydown($event)\"\n [disabled]=\"selectedFilterMenuDataItemList()[1]?.value | valuelessOperator\"></mona-date-picker>\n }\n }\n </div>\n}\n<div [class]=\"`${filterMenuItemClass()} ${filterMenuActionsClass()}`\">\n <button\n monaButton\n (click)=\"onFilterApply()\"\n [look]=\"'primary'\"\n [size]=\"size()\"\n [rounded]=\"rounded()\"\n [disabled]=\"applyDisabled()\">\n {{ messages().apply }}\n </button>\n <button monaButton (click)=\"onFilterClear()\" [look]=\"'default'\" [size]=\"size()\" [rounded]=\"rounded()\">\n {{ messages().clear }}\n </button>\n</div>\n"
1034
+ }]
1035
+ }],
1036
+ ctorParameters: () => [],
1037
+ propDecorators: {
1038
+ apply: [{
1039
+ type: i0.Output,
1040
+ args: ["apply"]
1041
+ }],
1042
+ dateOptions: [{
1043
+ type: i0.Input,
1044
+ args: [{
1045
+ isSignal: true,
1046
+ alias: "dateOptions",
1047
+ required: false
1048
+ }]
1049
+ }],
1050
+ field: [{
1051
+ type: i0.Input,
1052
+ args: [{
1053
+ isSignal: true,
1054
+ alias: "field",
1055
+ required: false
1056
+ }]
1057
+ }],
1058
+ operators: [{
1059
+ type: i0.Input,
1060
+ args: [{
1061
+ isSignal: true,
1062
+ alias: "operators",
1063
+ required: false
1064
+ }]
1065
+ }],
1066
+ rounded: [{
1067
+ type: i0.Input,
1068
+ args: [{
1069
+ isSignal: true,
1070
+ alias: "rounded",
1071
+ required: false
1072
+ }]
1073
+ }],
1074
+ size: [{
1075
+ type: i0.Input,
1076
+ args: [{
1077
+ isSignal: true,
1078
+ alias: "size",
1079
+ required: false
1080
+ }]
1081
+ }],
1082
+ type: [{
1083
+ type: i0.Input,
1084
+ args: [{
1085
+ isSignal: true,
1086
+ alias: "type",
1087
+ required: false
1088
+ }]
1089
+ }],
1090
+ value: [{
1091
+ type: i0.Input,
1092
+ args: [{
1093
+ isSignal: true,
1094
+ alias: "value",
1095
+ required: false
1096
+ }]
1097
+ }, {
1098
+ type: i0.Output,
1099
+ args: ["valueChange"]
1100
+ }]
1101
+ }
1102
+ });
736
1103
  export { FILTER_DEFAULT_MESSAGES, FilterMenuComponent, FilterService };
737
- //# sourceMappingURL=nanahoshi-mona-ui-filter.mjs.map
1104
+
1105
+ //# sourceMappingURL=nanahoshi-mona-ui-filter.mjs.map