cmat 0.0.111 → 0.0.112

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 (256) hide show
  1. package/fesm2022/cmat-components-adapter.mjs +531 -536
  2. package/fesm2022/cmat-components-adapter.mjs.map +1 -1
  3. package/fesm2022/cmat-components-breadcrumb.mjs +521 -356
  4. package/fesm2022/cmat-components-breadcrumb.mjs.map +1 -1
  5. package/fesm2022/cmat-components-card.mjs +150 -42
  6. package/fesm2022/cmat-components-card.mjs.map +1 -1
  7. package/fesm2022/cmat-components-carousel.mjs +1120 -629
  8. package/fesm2022/cmat-components-carousel.mjs.map +1 -1
  9. package/fesm2022/cmat-components-cascade.mjs +861 -441
  10. package/fesm2022/cmat-components-cascade.mjs.map +1 -1
  11. package/fesm2022/cmat-components-chip-input.mjs +580 -335
  12. package/fesm2022/cmat-components-chip-input.mjs.map +1 -1
  13. package/fesm2022/cmat-components-code-editor.mjs +197 -105
  14. package/fesm2022/cmat-components-code-editor.mjs.map +1 -1
  15. package/fesm2022/cmat-components-color-picker.mjs +1762 -825
  16. package/fesm2022/cmat-components-color-picker.mjs.map +1 -1
  17. package/fesm2022/cmat-components-custom-formly.mjs +5196 -2531
  18. package/fesm2022/cmat-components-custom-formly.mjs.map +1 -1
  19. package/fesm2022/cmat-components-data-picker.mjs +1901 -1073
  20. package/fesm2022/cmat-components-data-picker.mjs.map +1 -1
  21. package/fesm2022/cmat-components-date-range.mjs +701 -456
  22. package/fesm2022/cmat-components-date-range.mjs.map +1 -1
  23. package/fesm2022/cmat-components-date-time-display.mjs +137 -30
  24. package/fesm2022/cmat-components-date-time-display.mjs.map +1 -1
  25. package/fesm2022/cmat-components-drawer.mjs +410 -258
  26. package/fesm2022/cmat-components-drawer.mjs.map +1 -1
  27. package/fesm2022/cmat-components-empty-state.mjs +201 -41
  28. package/fesm2022/cmat-components-empty-state.mjs.map +1 -1
  29. package/fesm2022/cmat-components-file-preview.mjs +198 -35
  30. package/fesm2022/cmat-components-file-preview.mjs.map +1 -1
  31. package/fesm2022/cmat-components-filter-toolbar.mjs +320 -72
  32. package/fesm2022/cmat-components-filter-toolbar.mjs.map +1 -1
  33. package/fesm2022/cmat-components-form-actions.mjs +102 -26
  34. package/fesm2022/cmat-components-form-actions.mjs.map +1 -1
  35. package/fesm2022/cmat-components-fullscreen.mjs +167 -47
  36. package/fesm2022/cmat-components-fullscreen.mjs.map +1 -1
  37. package/fesm2022/cmat-components-highlight.mjs +203 -112
  38. package/fesm2022/cmat-components-highlight.mjs.map +1 -1
  39. package/fesm2022/cmat-components-image-viewer.mjs +489 -215
  40. package/fesm2022/cmat-components-image-viewer.mjs.map +1 -1
  41. package/fesm2022/cmat-components-inline-loading.mjs +117 -27
  42. package/fesm2022/cmat-components-inline-loading.mjs.map +1 -1
  43. package/fesm2022/cmat-components-json-editor.mjs +276 -230
  44. package/fesm2022/cmat-components-json-editor.mjs.map +1 -1
  45. package/fesm2022/cmat-components-knob-input.mjs +615 -420
  46. package/fesm2022/cmat-components-knob-input.mjs.map +1 -1
  47. package/fesm2022/cmat-components-loading-overlay.mjs +53 -25
  48. package/fesm2022/cmat-components-loading-overlay.mjs.map +1 -1
  49. package/fesm2022/cmat-components-masonry.mjs +120 -40
  50. package/fesm2022/cmat-components-masonry.mjs.map +1 -1
  51. package/fesm2022/cmat-components-material-color-picker.mjs +332 -155
  52. package/fesm2022/cmat-components-material-color-picker.mjs.map +1 -1
  53. package/fesm2022/cmat-components-material-datetimepicker.mjs +4283 -2504
  54. package/fesm2022/cmat-components-material-datetimepicker.mjs.map +1 -1
  55. package/fesm2022/cmat-components-navigation.mjs +3080 -1404
  56. package/fesm2022/cmat-components-navigation.mjs.map +1 -1
  57. package/fesm2022/cmat-components-opt-input.mjs +540 -466
  58. package/fesm2022/cmat-components-opt-input.mjs.map +1 -1
  59. package/fesm2022/cmat-components-org-chart.mjs +528 -125
  60. package/fesm2022/cmat-components-org-chart.mjs.map +1 -1
  61. package/fesm2022/cmat-components-page-header.mjs +141 -32
  62. package/fesm2022/cmat-components-page-header.mjs.map +1 -1
  63. package/fesm2022/cmat-components-pagination.mjs +866 -534
  64. package/fesm2022/cmat-components-pagination.mjs.map +1 -1
  65. package/fesm2022/cmat-components-password-strength.mjs +873 -434
  66. package/fesm2022/cmat-components-password-strength.mjs.map +1 -1
  67. package/fesm2022/cmat-components-popover.mjs +1012 -731
  68. package/fesm2022/cmat-components-popover.mjs.map +1 -1
  69. package/fesm2022/cmat-components-progress-bar.mjs +98 -35
  70. package/fesm2022/cmat-components-progress-bar.mjs.map +1 -1
  71. package/fesm2022/cmat-components-qrcode.mjs +463 -287
  72. package/fesm2022/cmat-components-qrcode.mjs.map +1 -1
  73. package/fesm2022/cmat-components-rating.mjs +377 -203
  74. package/fesm2022/cmat-components-rating.mjs.map +1 -1
  75. package/fesm2022/cmat-components-rich-text-editor.mjs +153 -39
  76. package/fesm2022/cmat-components-rich-text-editor.mjs.map +1 -1
  77. package/fesm2022/cmat-components-select-search.mjs +926 -496
  78. package/fesm2022/cmat-components-select-search.mjs.map +1 -1
  79. package/fesm2022/cmat-components-select-table.mjs +1280 -842
  80. package/fesm2022/cmat-components-select-table.mjs.map +1 -1
  81. package/fesm2022/cmat-components-select-tree.mjs +998 -690
  82. package/fesm2022/cmat-components-select-tree.mjs.map +1 -1
  83. package/fesm2022/cmat-components-skeleton.mjs +143 -57
  84. package/fesm2022/cmat-components-skeleton.mjs.map +1 -1
  85. package/fesm2022/cmat-components-speed-dial.mjs +457 -303
  86. package/fesm2022/cmat-components-speed-dial.mjs.map +1 -1
  87. package/fesm2022/cmat-components-status-tag.mjs +136 -44
  88. package/fesm2022/cmat-components-status-tag.mjs.map +1 -1
  89. package/fesm2022/cmat-components-table-toolbar.mjs +120 -28
  90. package/fesm2022/cmat-components-table-toolbar.mjs.map +1 -1
  91. package/fesm2022/cmat-components-timeline.mjs +464 -168
  92. package/fesm2022/cmat-components-timeline.mjs.map +1 -1
  93. package/fesm2022/cmat-components-toast.mjs +346 -262
  94. package/fesm2022/cmat-components-toast.mjs.map +1 -1
  95. package/fesm2022/cmat-components-transfer-picker.mjs +1427 -593
  96. package/fesm2022/cmat-components-transfer-picker.mjs.map +1 -1
  97. package/fesm2022/cmat-components-treetable.mjs +372 -112
  98. package/fesm2022/cmat-components-treetable.mjs.map +1 -1
  99. package/fesm2022/cmat-components-upload.mjs +904 -410
  100. package/fesm2022/cmat-components-upload.mjs.map +1 -1
  101. package/fesm2022/cmat-components-x6-angular-shape.mjs +153 -170
  102. package/fesm2022/cmat-components-x6-angular-shape.mjs.map +1 -1
  103. package/fesm2022/cmat-directives-animate-on-scroll.mjs +220 -138
  104. package/fesm2022/cmat-directives-animate-on-scroll.mjs.map +1 -1
  105. package/fesm2022/cmat-directives-arrow-cursor.mjs +246 -193
  106. package/fesm2022/cmat-directives-arrow-cursor.mjs.map +1 -1
  107. package/fesm2022/cmat-directives-autofocus.mjs +43 -25
  108. package/fesm2022/cmat-directives-autofocus.mjs.map +1 -1
  109. package/fesm2022/cmat-directives-data-exporter.mjs +537 -338
  110. package/fesm2022/cmat-directives-data-exporter.mjs.map +1 -1
  111. package/fesm2022/cmat-directives-debounce.mjs +162 -76
  112. package/fesm2022/cmat-directives-debounce.mjs.map +1 -1
  113. package/fesm2022/cmat-directives-digit-only.mjs +457 -356
  114. package/fesm2022/cmat-directives-digit-only.mjs.map +1 -1
  115. package/fesm2022/cmat-directives-equal-validator.mjs +70 -53
  116. package/fesm2022/cmat-directives-equal-validator.mjs.map +1 -1
  117. package/fesm2022/cmat-directives-seamless-auto-scroll.mjs +180 -132
  118. package/fesm2022/cmat-directives-seamless-auto-scroll.mjs.map +1 -1
  119. package/fesm2022/cmat-lib-mock-api.mjs +207 -195
  120. package/fesm2022/cmat-lib-mock-api.mjs.map +1 -1
  121. package/fesm2022/cmat-pipes-bytes.mjs +50 -30
  122. package/fesm2022/cmat-pipes-bytes.mjs.map +1 -1
  123. package/fesm2022/cmat-pipes-date-format.mjs +41 -25
  124. package/fesm2022/cmat-pipes-date-format.mjs.map +1 -1
  125. package/fesm2022/cmat-pipes-find-by-key.mjs +44 -26
  126. package/fesm2022/cmat-pipes-find-by-key.mjs.map +1 -1
  127. package/fesm2022/cmat-pipes-group-by.mjs +50 -38
  128. package/fesm2022/cmat-pipes-group-by.mjs.map +1 -1
  129. package/fesm2022/cmat-pipes-keys.mjs +44 -31
  130. package/fesm2022/cmat-pipes-keys.mjs.map +1 -1
  131. package/fesm2022/cmat-pipes-secure.mjs +60 -49
  132. package/fesm2022/cmat-pipes-secure.mjs.map +1 -1
  133. package/fesm2022/cmat-pipes-uppercase.mjs +39 -22
  134. package/fesm2022/cmat-pipes-uppercase.mjs.map +1 -1
  135. package/fesm2022/cmat-reports.mjs +2751 -0
  136. package/fesm2022/cmat-reports.mjs.map +1 -0
  137. package/fesm2022/cmat-services-alert.mjs +249 -277
  138. package/fesm2022/cmat-services-alert.mjs.map +1 -1
  139. package/fesm2022/cmat-services-config.mjs +110 -81
  140. package/fesm2022/cmat-services-config.mjs.map +1 -1
  141. package/fesm2022/cmat-services-confirmation.mjs +184 -73
  142. package/fesm2022/cmat-services-confirmation.mjs.map +1 -1
  143. package/fesm2022/cmat-services-data.mjs +136 -125
  144. package/fesm2022/cmat-services-data.mjs.map +1 -1
  145. package/fesm2022/cmat-services-export-as.mjs +165 -183
  146. package/fesm2022/cmat-services-export-as.mjs.map +1 -1
  147. package/fesm2022/cmat-services-loading.mjs +116 -95
  148. package/fesm2022/cmat-services-loading.mjs.map +1 -1
  149. package/fesm2022/cmat-services-local-storage.mjs +75 -66
  150. package/fesm2022/cmat-services-local-storage.mjs.map +1 -1
  151. package/fesm2022/cmat-services-media-watcher.mjs +69 -64
  152. package/fesm2022/cmat-services-media-watcher.mjs.map +1 -1
  153. package/fesm2022/cmat-services-platform.mjs +48 -45
  154. package/fesm2022/cmat-services-platform.mjs.map +1 -1
  155. package/fesm2022/cmat-services-print.mjs +984 -1109
  156. package/fesm2022/cmat-services-print.mjs.map +1 -1
  157. package/fesm2022/cmat-services-splash-screen.mjs +53 -38
  158. package/fesm2022/cmat-services-splash-screen.mjs.map +1 -1
  159. package/fesm2022/cmat-services-title.mjs +57 -47
  160. package/fesm2022/cmat-services-title.mjs.map +1 -1
  161. package/fesm2022/cmat-services-translation.mjs +79 -68
  162. package/fesm2022/cmat-services-translation.mjs.map +1 -1
  163. package/fesm2022/cmat-services-utils.mjs +424 -517
  164. package/fesm2022/cmat-services-utils.mjs.map +1 -1
  165. package/fesm2022/cmat-validators.mjs +23 -33
  166. package/fesm2022/cmat-validators.mjs.map +1 -1
  167. package/fesm2022/cmat-version.mjs +12 -16
  168. package/fesm2022/cmat-version.mjs.map +1 -1
  169. package/fesm2022/cmat.mjs +39805 -22511
  170. package/fesm2022/cmat.mjs.map +1 -1
  171. package/package.json +5 -1
  172. package/types/cmat-components-adapter.d.ts +145 -156
  173. package/types/cmat-components-breadcrumb.d.ts +108 -86
  174. package/types/cmat-components-card.d.ts +34 -18
  175. package/types/cmat-components-carousel.d.ts +251 -134
  176. package/types/cmat-components-cascade.d.ts +158 -117
  177. package/types/cmat-components-chip-input.d.ts +105 -71
  178. package/types/cmat-components-code-editor.d.ts +59 -34
  179. package/types/cmat-components-color-picker.d.ts +378 -236
  180. package/types/cmat-components-custom-formly.d.ts +776 -814
  181. package/types/cmat-components-data-picker.d.ts +502 -360
  182. package/types/cmat-components-date-range.d.ts +106 -77
  183. package/types/cmat-components-date-time-display.d.ts +36 -13
  184. package/types/cmat-components-drawer.d.ts +91 -61
  185. package/types/cmat-components-empty-state.d.ts +47 -17
  186. package/types/cmat-components-file-preview.d.ts +42 -14
  187. package/types/cmat-components-filter-toolbar.d.ts +57 -25
  188. package/types/cmat-components-form-actions.d.ts +18 -10
  189. package/types/cmat-components-fullscreen.d.ts +21 -13
  190. package/types/cmat-components-highlight.d.ts +33 -26
  191. package/types/cmat-components-image-viewer.d.ts +119 -58
  192. package/types/cmat-components-inline-loading.d.ts +24 -11
  193. package/types/cmat-components-json-editor.d.ts +39 -28
  194. package/types/cmat-components-knob-input.d.ts +172 -101
  195. package/types/cmat-components-loading-overlay.d.ts +8 -11
  196. package/types/cmat-components-masonry.d.ts +27 -14
  197. package/types/cmat-components-material-color-picker.d.ts +56 -42
  198. package/types/cmat-components-material-datetimepicker.d.ts +817 -454
  199. package/types/cmat-components-navigation.d.ts +295 -221
  200. package/types/cmat-components-opt-input.d.ts +111 -90
  201. package/types/cmat-components-org-chart.d.ts +53 -35
  202. package/types/cmat-components-page-header.d.ts +37 -14
  203. package/types/cmat-components-pagination.d.ts +144 -107
  204. package/types/cmat-components-password-strength.d.ts +197 -86
  205. package/types/cmat-components-popover.d.ts +264 -166
  206. package/types/cmat-components-progress-bar.d.ts +17 -14
  207. package/types/cmat-components-qrcode.d.ts +111 -42
  208. package/types/cmat-components-rating.d.ts +105 -59
  209. package/types/cmat-components-rich-text-editor.d.ts +39 -16
  210. package/types/cmat-components-select-search.d.ts +195 -99
  211. package/types/cmat-components-select-table.d.ts +241 -142
  212. package/types/cmat-components-select-tree.d.ts +185 -118
  213. package/types/cmat-components-skeleton.d.ts +55 -32
  214. package/types/cmat-components-speed-dial.d.ts +86 -61
  215. package/types/cmat-components-status-tag.d.ts +42 -24
  216. package/types/cmat-components-table-toolbar.d.ts +30 -12
  217. package/types/cmat-components-timeline.d.ts +83 -51
  218. package/types/cmat-components-toast.d.ts +84 -85
  219. package/types/cmat-components-transfer-picker.d.ts +228 -181
  220. package/types/cmat-components-treetable.d.ts +63 -39
  221. package/types/cmat-components-upload.d.ts +205 -106
  222. package/types/cmat-components-x6-angular-shape.d.ts +29 -37
  223. package/types/cmat-directives-animate-on-scroll.d.ts +48 -30
  224. package/types/cmat-directives-arrow-cursor.d.ts +55 -35
  225. package/types/cmat-directives-autofocus.d.ts +8 -11
  226. package/types/cmat-directives-data-exporter.d.ts +71 -40
  227. package/types/cmat-directives-debounce.d.ts +31 -28
  228. package/types/cmat-directives-digit-only.d.ts +90 -53
  229. package/types/cmat-directives-equal-validator.d.ts +11 -14
  230. package/types/cmat-directives-seamless-auto-scroll.d.ts +42 -29
  231. package/types/cmat-lib-mock-api.d.ts +46 -55
  232. package/types/cmat-pipes-bytes.d.ts +7 -10
  233. package/types/cmat-pipes-date-format.d.ts +7 -10
  234. package/types/cmat-pipes-find-by-key.d.ts +8 -12
  235. package/types/cmat-pipes-group-by.d.ts +11 -15
  236. package/types/cmat-pipes-keys.d.ts +10 -13
  237. package/types/cmat-pipes-secure.d.ts +14 -17
  238. package/types/cmat-pipes-uppercase.d.ts +7 -10
  239. package/types/cmat-reports.d.ts +1131 -0
  240. package/types/cmat-services-alert.d.ts +80 -87
  241. package/types/cmat-services-config.d.ts +37 -43
  242. package/types/cmat-services-confirmation.d.ts +31 -37
  243. package/types/cmat-services-data.d.ts +18 -21
  244. package/types/cmat-services-export-as.d.ts +28 -33
  245. package/types/cmat-services-loading.d.ts +27 -31
  246. package/types/cmat-services-local-storage.d.ts +17 -21
  247. package/types/cmat-services-media-watcher.d.ts +14 -18
  248. package/types/cmat-services-platform.d.ts +8 -11
  249. package/types/cmat-services-print.d.ts +97 -102
  250. package/types/cmat-services-splash-screen.d.ts +11 -14
  251. package/types/cmat-services-title.d.ts +9 -12
  252. package/types/cmat-services-translation.d.ts +19 -22
  253. package/types/cmat-services-utils.d.ts +76 -80
  254. package/types/cmat-validators.d.ts +5 -8
  255. package/types/cmat-version.d.ts +8 -10
  256. package/types/cmat.d.ts +7551 -5204
@@ -1,845 +1,1283 @@
1
- import { coerceBooleanProperty } from '@angular/cdk/coercion';
2
- import * as i4 from '@angular/common';
3
- import { CommonModule } from '@angular/common';
4
- import * as i0 from '@angular/core';
5
- import { input, output, viewChild, viewChildren, signal, inject, DestroyRef, ChangeDetectorRef, computed, effect, untracked, Input, HostListener, ViewEncapsulation, ChangeDetectionStrategy, Component } from '@angular/core';
6
- import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
7
- import * as i3 from '@angular/forms';
8
- import { FormControl, NgControl, FormGroup, ReactiveFormsModule } from '@angular/forms';
9
- import * as i1 from '@angular/material/form-field';
10
- import { MatFormFieldModule, MatFormFieldControl } from '@angular/material/form-field';
11
- import * as i5 from '@angular/material/icon';
12
- import { MatIconModule } from '@angular/material/icon';
13
- import * as i7 from '@angular/material/input';
14
- import { MatInputModule } from '@angular/material/input';
15
- import * as i2 from '@angular/material/select';
16
- import { MatOption, MatSelectModule } from '@angular/material/select';
17
- import * as i8 from '@angular/material/sort';
18
- import { MatSort, MatSortModule } from '@angular/material/sort';
19
- import * as i6 from '@angular/material/table';
20
- import { MatTable, MatTableModule } from '@angular/material/table';
21
- import { CmatSelectSearchComponent } from 'cmat/components/select-search';
22
- import { CmatDigitOnlyDirective } from 'cmat/directives/digit-only';
23
- import { isArray, isNil, isNumber, isString } from 'lodash-es';
24
- import { Subject, merge, debounceTime } from 'rxjs';
25
-
26
- /* eslint-disable @typescript-eslint/member-ordering */
1
+ import { coerceBooleanProperty } from "@angular/cdk/coercion";
2
+ import * as i4 from "@angular/common";
3
+ import { CommonModule } from "@angular/common";
4
+ import * as i0 from "@angular/core";
5
+ import { ChangeDetectionStrategy, ChangeDetectorRef, Component, DestroyRef, HostListener, Input, ViewEncapsulation, computed, effect, inject, input, output, signal, untracked, viewChild, viewChildren } from "@angular/core";
6
+ import { takeUntilDestroyed } from "@angular/core/rxjs-interop";
7
+ import * as i3 from "@angular/forms";
8
+ import { FormControl, FormGroup, NgControl, ReactiveFormsModule } from "@angular/forms";
9
+ import * as i1 from "@angular/material/form-field";
10
+ import { MatFormFieldControl, MatFormFieldModule } from "@angular/material/form-field";
11
+ import * as i5 from "@angular/material/icon";
12
+ import { MatIconModule } from "@angular/material/icon";
13
+ import * as i7 from "@angular/material/input";
14
+ import { MatInputModule } from "@angular/material/input";
15
+ import * as i2 from "@angular/material/select";
16
+ import { MatOption, MatSelectModule } from "@angular/material/select";
17
+ import * as i8 from "@angular/material/sort";
18
+ import { MatSort, MatSortModule } from "@angular/material/sort";
19
+ import * as i6 from "@angular/material/table";
20
+ import { MatTable, MatTableModule } from "@angular/material/table";
21
+ import { CmatSelectSearchComponent } from "cmat/components/select-search";
22
+ import { CmatDigitOnlyDirective } from "cmat/directives/digit-only";
23
+ import { isArray, isNil, isNumber, isString } from "lodash-es";
24
+ import { Subject, debounceTime, merge } from "rxjs";
27
25
  const MAX_SAFE_INTEGER = 9007199254740991;
28
26
  let NEXT_ID = 0;
29
- class CmatSelectTableComponent {
30
- get focused() {
31
- return this._focusedSignal();
32
- }
33
- get touched() {
34
- return this._touchedSignal();
35
- }
36
- constructor() {
37
- this.id = `cmat-select-table-${NEXT_ID++}`;
38
- this.dataSource = input(/* @ts-ignore */
39
- ...(ngDevMode ? [undefined, { debugName: "dataSource" }] : /* istanbul ignore next */ []));
40
- this.noEntriesFoundLabel = input('无结果', /* @ts-ignore */
41
- ...(ngDevMode ? [{ debugName: "noEntriesFoundLabel" }] : /* istanbul ignore next */ []));
42
- this.showNoFoundLabel = input(true, /* @ts-ignore */
43
- ...(ngDevMode ? [{ debugName: "showNoFoundLabel" }] : /* istanbul ignore next */ []));
44
- this.isPhone = input(false, /* @ts-ignore */
45
- ...(ngDevMode ? [{ debugName: "isPhone" }] : /* istanbul ignore next */ []));
46
- this.multiple = input(false, /* @ts-ignore */
47
- ...(ngDevMode ? [{ debugName: "multiple" }] : /* istanbul ignore next */ []));
48
- this.overallSearchEnabled = input(true, /* @ts-ignore */
49
- ...(ngDevMode ? [{ debugName: "overallSearchEnabled" }] : /* istanbul ignore next */ []));
50
- this.overallSearchVisible = input(/* @ts-ignore */
51
- ...(ngDevMode ? [undefined, { debugName: "overallSearchVisible" }] : /* istanbul ignore next */ []));
52
- this.resetSortOnOpen = input(/* @ts-ignore */
53
- ...(ngDevMode ? [undefined, { debugName: "resetSortOnOpen" }] : /* istanbul ignore next */ []));
54
- this.resetFiltersOnOpen = input(/* @ts-ignore */
55
- ...(ngDevMode ? [undefined, { debugName: "resetFiltersOnOpen" }] : /* istanbul ignore next */ []));
56
- this.customTriggerLabelFn = input(/* @ts-ignore */
57
- ...(ngDevMode ? [undefined, { debugName: "customTriggerLabelFn" }] : /* istanbul ignore next */ []));
58
- this.triggerLabelSort = input(/* @ts-ignore */
59
- ...(ngDevMode ? [undefined, { debugName: "triggerLabelSort" }] : /* istanbul ignore next */ []));
60
- this.customTriggerLabelTemplate = input(/* @ts-ignore */
61
- ...(ngDevMode ? [undefined, { debugName: "customTriggerLabelTemplate" }] : /* istanbul ignore next */ []));
62
- this.canNull = input(/* @ts-ignore */
63
- ...(ngDevMode ? [undefined, { debugName: "canNull" }] : /* istanbul ignore next */ []));
64
- this.defaultSort = input(/* @ts-ignore */
65
- ...(ngDevMode ? [undefined, { debugName: "defaultSort" }] : /* istanbul ignore next */ []));
66
- this.resetOptionAction = input(/* @ts-ignore */
67
- ...(ngDevMode ? [undefined, { debugName: "resetOptionAction" }] : /* istanbul ignore next */ []));
68
- this.keyParam = input('id', /* @ts-ignore */
69
- ...(ngDevMode ? [{ debugName: "keyParam" }] : /* istanbul ignore next */ []));
70
- this.compareWith = input((o1, o2) => {
71
- return o1 && o2 ? o1?.name === o2?.name && o1?.id === o2?.id : o1 === o2;
72
- }, /* @ts-ignore */
73
- ...(ngDevMode ? [{ debugName: "compareWith" }] : /* istanbul ignore next */ []));
74
- this.closed = output();
75
- this._matSelectSearch = viewChild(CmatSelectSearchComponent, /* @ts-ignore */
76
- ...(ngDevMode ? [{ debugName: "_matSelectSearch" }] : /* istanbul ignore next */ []));
77
- this._sort = viewChild(MatSort, /* @ts-ignore */
78
- ...(ngDevMode ? [{ debugName: "_sort" }] : /* istanbul ignore next */ []));
79
- this._table = viewChild(MatTable, /* @ts-ignore */
80
- ...(ngDevMode ? [{ debugName: "_table" }] : /* istanbul ignore next */ []));
81
- this._matOptions = viewChildren(MatOption, /* @ts-ignore */
82
- ...(ngDevMode ? [{ debugName: "_matOptions" }] : /* istanbul ignore next */ []));
83
- this._matSelectSignal = viewChild('componentSelect', /* @ts-ignore */
84
- ...(ngDevMode ? [{ debugName: "_matSelectSignal" }] : /* istanbul ignore next */ []));
85
- this.tableDataSource = signal([], /* @ts-ignore */
86
- ...(ngDevMode ? [{ debugName: "tableDataSource" }] : /* istanbul ignore next */ []));
87
- this.tableColumns = signal([], /* @ts-ignore */
88
- ...(ngDevMode ? [{ debugName: "tableColumns" }] : /* istanbul ignore next */ []));
89
- this._rowById = new Map();
90
- this._columnKeys = [];
91
- this.completeRowList = signal([], /* @ts-ignore */
92
- ...(ngDevMode ? [{ debugName: "completeRowList" }] : /* istanbul ignore next */ []));
93
- this.overallSearchVisibleState = signal(false, /* @ts-ignore */
94
- ...(ngDevMode ? [{ debugName: "overallSearchVisibleState" }] : /* istanbul ignore next */ []));
95
- this.overallFilterControl = new FormControl('');
96
- this.selectControl = new FormControl();
97
- this.stateChanges = new Subject();
98
- this._focusedSignal = signal(false, /* @ts-ignore */
99
- ...(ngDevMode ? [{ debugName: "_focusedSignal" }] : /* istanbul ignore next */ []));
100
- this._touchedSignal = signal(false, /* @ts-ignore */
101
- ...(ngDevMode ? [{ debugName: "_touchedSignal" }] : /* istanbul ignore next */ []));
102
- this._placeholderSignal = signal('', /* @ts-ignore */
103
- ...(ngDevMode ? [{ debugName: "_placeholderSignal" }] : /* istanbul ignore next */ []));
104
- this._disabledSignal = signal(false, /* @ts-ignore */
105
- ...(ngDevMode ? [{ debugName: "_disabledSignal" }] : /* istanbul ignore next */ []));
106
- this._requiredSignal = signal(false, /* @ts-ignore */
107
- ...(ngDevMode ? [{ debugName: "_requiredSignal" }] : /* istanbul ignore next */ []));
108
- this.ngControl = inject(NgControl, { optional: true, self: true });
109
- this._destroyRef = inject(DestroyRef);
110
- this._cdr = inject(ChangeDetectorRef);
111
- // _init 重入守卫:selectControl.setValue 触发 MatSelect._onChange → writeValue → _init 递归
112
- this._initRunning = false;
113
- // 保存 writeValue 传入的原始值(可能是部分行对象),
114
- // dataSource 变更时始终用原始值重新解析,避免 _init 解析后覆盖 _value 导致原始值丢失
115
- this._rawValue = null;
116
- // dataSource effect 解析期间为 true,阻止 writeValue 覆盖 _rawValue
117
- this._resolvingFromDataSource = false;
118
- this._nullRow = { id: null };
119
- this._value = null;
120
- this._triggerLabel = computed(() => this.customTriggerLabelFn()?.(this.completeRowList()) ??
121
- this.simpleTriggerLabelFn(this.completeRowList()), /* @ts-ignore */
122
- ...(ngDevMode ? [{ debugName: "_triggerLabel" }] : /* istanbul ignore next */ []));
123
- this._onModelChange = () => { };
124
- // eslint-disable-next-line @typescript-eslint/no-empty-function
125
- this._onTouchedChange = () => { };
126
- if (this.ngControl != null) {
127
- this.ngControl.valueAccessor = this;
128
- }
129
- this.tableColumnsMap = new Map();
130
- this._filterControls = new FormGroup({});
131
- effect(() => {
132
- const matSelect = this._matSelectSignal();
133
- if (matSelect && !this._matSelect) {
134
- this._matSelect = matSelect;
135
- untracked(() => {
136
- this._init(this.value);
137
- });
138
- this._matSelect.setDisabledState(this._disabledSignal());
139
- this._setPanelClass();
140
- }
141
- else if (matSelect && this._matSelect !== matSelect) {
142
- this._matSelect = matSelect;
143
- this._setPanelClass();
144
- }
145
- });
146
- // 监听 dataSource signal 变化,重建数据结构并解析表单值
147
- effect(() => {
148
- const ds = this.dataSource();
149
- if (!ds || !isArray(ds.data) || ds.data.length === 0)
150
- return;
151
- untracked(() => {
152
- const columns = ds.columns;
153
- const data = ds.data;
154
- this._columnKeys = columns.map((column) => column.key);
155
- this.tableDataSource.set([...data]);
156
- if (this.addNullRow()) {
157
- this.tableDataSource.update(value => [this._nullRow, ...value]);
158
- }
159
- this.tableColumns.set(['_selection', ...this._columnKeys]);
160
- this.tableColumnsMap.clear();
161
- columns.forEach((column) => this.tableColumnsMap.set(column.key, column));
162
- this._rowById.clear();
163
- data.forEach((row) => {
164
- const rowKey = row[this.keyParam()];
165
- if (!isNil(rowKey)) {
166
- this._rowById.set(rowKey, row);
167
- }
168
- });
169
- // matSelect 就绪后,用原始值重新解析(不用 this.value,它可能已被上次 _init 覆盖为解析后的完整行)
170
- if (this._matSelect) {
171
- this._resolvingFromDataSource = true;
172
- try {
173
- this._init(this._rawValue);
174
- }
175
- finally {
176
- this._resolvingFromDataSource = false;
177
- }
178
- this.stateChanges.next();
179
- // effect 在 CD 之后执行,当前 CD 已处理过投影内容,
180
- // 推迟到微任务强制第二轮 CD 刷新 <mat-select-trigger>
181
- void Promise.resolve().then(() => this._cdr.detectChanges());
182
- }
183
- });
184
- });
185
- }
186
- clickedOut() {
187
- if (!this._matSelect?.panelOpen) {
188
- this._focusedSignal.set(false);
189
- this.stateChanges.next();
190
- }
191
- }
192
- ngAfterViewInit() {
193
- const sortInstance = this._sort();
194
- if (!sortInstance) {
195
- return;
196
- }
197
- merge(...[
198
- sortInstance.sortChange,
199
- this._filterControls.valueChanges,
200
- this.overallFilterControl.valueChanges,
201
- ])
202
- .pipe(takeUntilDestroyed(this._destroyRef), debounceTime(300))
203
- .subscribe(() => {
204
- const dataClone = [
205
- ...((this.dataSource() ?? { data: [] }).data || []),
206
- ];
207
- if (this.addNullRow()) {
208
- dataClone.unshift(this._nullRow);
209
- }
210
- if (this.overallSearchEnabled() && this.overallSearchVisibleState()) {
211
- this._applyOverallFilter(dataClone);
212
- }
213
- else {
214
- this._applyColumnLevelFilters(dataClone);
215
- }
216
- const currentSort = this._sort();
217
- const defaultSort = this.defaultSort();
218
- if (currentSort && !currentSort.active && !isNil(defaultSort) && defaultSort.active) {
219
- currentSort.active = defaultSort.active;
220
- currentSort.direction = defaultSort.direction;
221
- }
222
- const sortedData = !currentSort?.active
223
- ? dataClone
224
- : this._sortData(dataClone, currentSort.active, currentSort.direction);
225
- this.tableDataSource.set(sortedData);
226
- });
227
- }
228
- ngOnDestroy() {
229
- this.stateChanges.complete();
230
- }
231
- get placeholder() {
232
- return this._placeholderSignal();
233
- }
234
- set placeholder(value) {
235
- this._placeholderSignal.set(value);
236
- this.stateChanges.next();
237
- }
238
- get value() {
239
- return this._value;
240
- }
241
- set value(value) {
242
- if (value !== this.value) {
243
- this._value = value;
244
- this.stateChanges.next();
245
- this._onModelChange(value);
246
- }
247
- }
248
- get empty() {
249
- return !this._value;
250
- }
251
- get errorState() {
252
- if (this.ngControl == null)
253
- return false;
254
- return (this.touched && this.ngControl?.invalid) ?? false;
255
- }
256
- get shouldLabelFloat() {
257
- return this._focusedSignal() || !this.empty;
258
- }
259
- get required() {
260
- return this._requiredSignal();
261
- }
262
- set required(value) {
263
- this._requiredSignal.set(coerceBooleanProperty(value));
264
- this.stateChanges.next();
265
- }
266
- get disabled() {
267
- if (!isNil(this.ngControl?.disabled)) {
268
- return this.ngControl.disabled;
269
- }
270
- return this._disabledSignal();
271
- }
272
- set disabled(value) {
273
- const isDisabled = coerceBooleanProperty(value);
274
- this._disabledSignal.set(isDisabled);
275
- if (this._focusedSignal() && isDisabled) {
276
- this._focusedSignal.set(false);
277
- this.stateChanges.next();
278
- }
279
- }
280
- registerOnChange(fn) {
281
- this._onModelChange = fn;
282
- }
283
- registerOnTouched(fn) {
284
- this._onTouchedChange = fn;
285
- this._matSelect?.registerOnTouched(fn);
286
- }
287
- setDisabledState(isDisabled) {
288
- this._disabledSignal.set(isDisabled);
289
- this._matSelect?.setDisabledState(isDisabled);
290
- }
291
- setDescribedByIds(ids) {
292
- this._matSelect?.setDescribedByIds(ids);
293
- }
294
- onContainerClick() {
295
- if (!this._focusedSignal()) {
296
- this._matSelect?.focus();
297
- }
298
- }
299
- onFocusIn() {
300
- if (!this._focusedSignal()) {
301
- this._focusedSignal.set(true);
302
- this.stateChanges.next();
303
- }
304
- }
305
- onFocusOut(event) {
306
- const matSelectPanel = this._matSelect?.panel?.nativeElement;
307
- if (matSelectPanel &&
308
- !(matSelectPanel).contains(event.relatedTarget)) {
309
- this._touchedSignal.set(true);
310
- this._focusedSignal.set(false);
311
- this._onTouchedChange();
312
- this.stateChanges.next();
313
- }
314
- }
315
- writeValue(value) {
316
- // dataSource effect 解析期间,_onModelChange 级联触发的 writeValue 不覆盖原始值
317
- if (!this._resolvingFromDataSource) {
318
- this._rawValue = value;
319
- }
320
- this._init(value);
321
- }
322
- ngOnChanges(changes) {
323
- if (!isNil(changes.resetFiltersOnOpen) &&
324
- changes.resetFiltersOnOpen.currentValue !== false) {
325
- this._resetFilters();
326
- }
327
- }
328
- emulateMatOptionClick(event) {
329
- if (!(event.target instanceof HTMLElement)) {
330
- return;
331
- }
332
- let rowElement = event.target;
333
- while (rowElement != null &&
334
- rowElement instanceof HTMLElement &&
335
- rowElement.tagName.toLowerCase() !== 'tr') {
336
- rowElement = rowElement.parentElement;
337
- }
338
- if (rowElement === null) {
339
- return;
340
- }
341
- const childOption = rowElement.querySelector('mat-option');
342
- if (!childOption) {
343
- return;
344
- }
345
- if (event.target.tagName.toLowerCase() != 'mat-pseudo-checkbox') {
346
- childOption.click();
347
- }
348
- const option = this._getMatOptionById(childOption.id);
349
- if (!option) {
350
- return;
351
- }
352
- const multiple = this.multiple();
353
- if (multiple && this._matSelect.panelOpen) {
354
- this._updateCompleteRowList(option.value, option.selected);
355
- this.completeRowList.set([...this.completeRowList()]);
356
- // 同步更新 selectControl 以触发 UI 更新
357
- if (this.selectControl) {
358
- this.selectControl.setValue([...this.completeRowList()], { emitEvent: false });
359
- }
360
- }
361
- if (!multiple) {
362
- const newRow = option.value ? [option.value] : [];
363
- this.completeRowList.set(newRow);
364
- }
365
- }
366
- openedChange(opened) {
367
- const overallSearchEnabled = this.overallSearchEnabled();
368
- if (this.resetFiltersOnOpen() !== false ||
369
- (!this._matOptions().length && overallSearchEnabled) ||
370
- (overallSearchEnabled && this._matOptions().length === 1)) {
371
- this._resetFilters();
372
- }
373
- this.overallSearchVisibleState.set(!!this.overallSearchVisible());
374
- if (this.resetSortOnOpen() !== false) {
375
- const sortInstance = this._sort();
376
- if (sortInstance) {
377
- sortInstance.sort({ id: '', start: 'asc', disableClear: false });
378
- }
379
- }
380
- if (!opened) {
381
- this.value = this._getCommittedValue();
382
- if (this.value === null) {
383
- this.completeRowList.set([]);
384
- this._checkAndResetSelection();
385
- }
386
- this._syncMatSelectValue(this.value);
387
- this.closed.emit(!opened);
388
- return;
389
- }
390
- const tableInstance = this._table();
391
- if (tableInstance) {
392
- const table = tableInstance;
393
- table._headerRowDefChanged = true;
394
- }
395
- setTimeout(() => this._expandPanelForTableRows(), 1);
396
- }
397
- filterFormControl(key) {
398
- if (!this._filterControls.contains(key)) {
399
- this._filterControls.registerControl(key, new FormControl(''));
400
- }
401
- return this._filterControls.get(key);
402
- }
403
- simpleTriggerLabelFn(value) {
404
- const rows = this._getTriggerRows(value);
405
- return rows.map(row => this._resolveTriggerLabel(row)).join(', ');
406
- }
407
- toggleOverallSearch() {
408
- this.overallSearchVisibleState.update(value => !value);
409
- this._resetFilters();
410
- if (this.overallSearchVisibleState()) {
411
- const searchInstance = this._matSelectSearch();
412
- if (searchInstance) {
413
- setTimeout(() => searchInstance.focus());
414
- }
415
- }
416
- }
417
- addNullRow() {
418
- return !this.multiple() && (this.canNull() ?? false);
419
- }
420
- get hasNullRow() {
421
- return this.addNullRow();
422
- }
423
- _init(value) {
424
- // selectControl.setValue 触发 MatSelect._onChange → writeValue → _init 递归,直接跳过
425
- if (this._initRunning)
426
- return;
427
- this._initRunning = true;
428
- try {
429
- const list = [];
430
- if (value) {
431
- const multiple = this.multiple();
432
- if (multiple && Array.isArray(value)) {
433
- value.forEach((v) => this._updateCompleteRowList(v, true, list));
434
- }
435
- else if (!multiple) {
436
- this._updateCompleteRowList(value, true, list);
437
- }
438
- }
439
- this.completeRowList.set(list);
440
- this._value =
441
- this.completeRowList().length > 0 ? [...this.completeRowList()] : value;
442
- if (this._matSelect) {
443
- this._matSelect.writeValue(this._value);
444
- }
445
- // 同步 selectControl,临时替换 MatSelect._onChange 为 no-op
446
- // 阻断 selectControl.setValue → MatSelect._onChange → _onModelChange → 父 FormControl 级联
447
- if (this.selectControl) {
448
- const origOnChange = this._matSelect?._onChange;
449
- if (this._matSelect) {
450
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
451
- this._matSelect._onChange = () => { };
452
- }
453
- try {
454
- this.selectControl.setValue(this.value, { emitEvent: false });
455
- }
456
- finally {
457
- if (this._matSelect && origOnChange) {
458
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
459
- this._matSelect._onChange = origOnChange;
460
- }
461
- }
462
- }
463
- // 将解析后的完整行传播回父表单(_resolvingFromDataSource 阻止 writeValue 覆盖 _rawValue)
464
- if (this.completeRowList().length > 0) {
465
- this._onModelChange(this._value);
466
- }
467
- }
468
- finally {
469
- this._initRunning = false;
470
- }
471
- }
472
- _updateCompleteRowList(value, selected, list = this.completeRowList()) {
473
- if (isNil(value)) {
474
- return;
475
- }
476
- if (selected) {
477
- const keyParam = this.keyParam();
478
- const rowKey = value[keyParam];
479
- if (isNil(rowKey)) {
480
- return;
481
- }
482
- const row = this._rowById.get(rowKey);
483
- if (!row) {
484
- return;
485
- }
486
- const exists = list.some(item => item[keyParam] === row[keyParam]);
487
- if (!exists) {
488
- list.push(row);
489
- }
490
- }
491
- else {
492
- const keyParam = this.keyParam();
493
- const keyValue = value[keyParam];
494
- const rowIndex = list.findIndex(i => i[keyParam] === keyValue);
495
- if (rowIndex > -1) {
496
- list.splice(rowIndex, 1);
497
- if (list === this.completeRowList()) {
498
- this.completeRowList.set([...list]);
499
- }
500
- }
501
- }
502
- }
503
- _applyColumnLevelFilters(data) {
504
- this.filteredOutRows = {};
505
- const filters = {};
506
- Object.keys(this._filterControls.controls)
507
- .filter((key) => {
508
- const column = this.tableColumnsMap.get(key);
509
- return !isNil(column?.filter) && column.filter.enabled !== false;
510
- })
511
- .filter((key) => {
512
- const filterControl = this._filterControls.get(key);
513
- const value = filterControl?.value;
514
- return (!isNil(value) &&
515
- ((isArray(value) && value.length > 0) ||
516
- (typeof value === 'string' && value.trim().length > 0) ||
517
- (typeof value === 'number' && `${value}`.trim().length > 0)));
518
- })
519
- .forEach((key) => {
520
- const column = this.tableColumnsMap.get(key);
521
- const filterControl = this._filterControls.get(key);
522
- filters[key] = {
523
- filter: column?.filter,
524
- value: filterControl?.value,
525
- };
526
- });
527
- const filterKeys = Object.keys(filters);
528
- for (let i = data.length - 1; i >= 0; i--) {
529
- // eslint-disable-next-line @typescript-eslint/prefer-for-of
530
- for (let k = 0; k < filterKeys.length; k++) {
531
- const filterKey = filterKeys[k];
532
- const row = data[i];
533
- const filter = filters[filterKey];
534
- if (isNil(row)) {
535
- this._removeFilteredRow(data, i);
536
- break;
537
- }
538
- if (!this._matchesColumnFilter(row, filterKey, filter)) {
539
- this._removeFilteredRow(data, i);
540
- break;
541
- }
542
- }
543
- }
544
- }
545
- _applyOverallFilter(data) {
546
- this.filteredOutRows = {};
547
- if (isNil(this.overallFilterControl.value)) {
548
- return;
549
- }
550
- const filterValueLC = (this.overallFilterControl.value ?? '').toLowerCase();
551
- if (filterValueLC.trim().length === 0) {
552
- return;
553
- }
554
- for (let i = data.length - 1; i >= 0; i--) {
555
- const row = data[i];
556
- let rowShouldBeFiltered = true;
557
- const rowKeys = this._columnKeys;
558
- for (let j = rowKeys.length - 1; j >= 0; j--) {
559
- const key = rowKeys[j];
560
- const cellValue = row[key];
561
- if (isNil(cellValue)) {
562
- continue;
563
- }
564
- const cellValueLC = typeof cellValue === 'string'
565
- ? cellValue.toLowerCase()
566
- : typeof cellValue === 'number' ||
567
- typeof cellValue === 'boolean' ||
568
- typeof cellValue === 'bigint'
569
- ? String(cellValue).toLowerCase()
570
- : '';
571
- if (cellValueLC.includes(filterValueLC)) {
572
- rowShouldBeFiltered = false;
573
- break;
574
- }
575
- }
576
- if (rowShouldBeFiltered) {
577
- this._removeFilteredRow(data, i);
578
- }
579
- }
580
- }
581
- _resetFilters() {
582
- this.overallFilterControl.setValue('');
583
- Object.keys(this._filterControls.controls).forEach(key => this._filterControls.get(key)?.setValue(''));
584
- }
585
- _sortingDataAccessor(data, active) {
586
- const value = data[active];
587
- if (isNumber(value)) {
588
- const numberValue = Number(value);
589
- return numberValue < MAX_SAFE_INTEGER ? numberValue : value;
590
- }
591
- return value;
592
- }
593
- _sortData(data, active, direction) {
594
- if (!active || direction === '') {
595
- return data;
596
- }
597
- return data.sort((a, b) => {
598
- let aValue = this._sortingDataAccessor(a, active);
599
- let bValue = this._sortingDataAccessor(b, active);
600
- if (a.id === null) {
601
- return -1;
602
- }
603
- else if (b.id === null) {
604
- return 1;
605
- }
606
- if (aValue === bValue) {
607
- return 0;
608
- }
609
- if (isNil(aValue) && !isNil(bValue)) {
610
- return -1;
611
- }
612
- else if (!isNil(aValue) && isNil(bValue)) {
613
- return 1;
614
- }
615
- if (aValue instanceof Date) {
616
- aValue = aValue.getTime();
617
- }
618
- if (bValue instanceof Date) {
619
- bValue = bValue.getTime();
620
- }
621
- if (isString(aValue) && isString(bValue)) {
622
- return aValue.localeCompare(bValue) * (direction === 'asc' ? 1 : -1);
623
- }
624
- aValue = isNaN(aValue) ? `${aValue}` : +aValue;
625
- bValue = isNaN(bValue) ? `${bValue}` : +bValue;
626
- if (isString(aValue) && isNumber(bValue)) {
627
- return 1 * (direction === 'asc' ? 1 : -1);
628
- }
629
- if (isNumber(aValue) && isString(bValue)) {
630
- return -1 * (direction === 'asc' ? 1 : -1);
631
- }
632
- return (aValue > bValue ? 1 : -1) * (direction === 'asc' ? 1 : -1);
633
- });
634
- }
635
- _checkAndResetSelection() {
636
- const resetOptionAction = this.resetOptionAction();
637
- if (this._matSelect.value &&
638
- isArray(this._matSelect.value) &&
639
- this._matSelect.value.length < 1 &&
640
- !isNil(resetOptionAction)) {
641
- resetOptionAction();
642
- }
643
- }
644
- _matchesColumnFilter(row, filterKey, filter) {
645
- const cellValue = row[filterKey];
646
- if (isNil(cellValue)) {
647
- return false;
648
- }
649
- const columnFilter = filter.filter;
650
- const comparator = columnFilter?.comparator;
651
- const filterValue = filter.value;
652
- let normalizedFilterValue;
653
- if (columnFilter?.type === 'number') {
654
- normalizedFilterValue = Number(filterValue);
655
- }
656
- else if (filterValue === null || filterValue === undefined) {
657
- normalizedFilterValue = '';
658
- }
659
- else if (typeof filterValue === 'object') {
660
- normalizedFilterValue = '';
661
- }
662
- else {
663
- normalizedFilterValue = filterValue;
664
- }
665
- if (typeof columnFilter?.comparatorFn === 'function') {
666
- return columnFilter.comparatorFn.call(null, cellValue, normalizedFilterValue, row);
667
- }
668
- if (isNil(comparator) || comparator === 'equals') {
669
- return normalizedFilterValue === cellValue;
670
- }
671
- if (typeof cellValue !== 'string' ||
672
- typeof normalizedFilterValue !== 'string') {
673
- return false;
674
- }
675
- const cellValueLC = cellValue.toLowerCase();
676
- const filterValueLC = normalizedFilterValue.toLowerCase();
677
- if (isNil(comparator) || comparator === 'equalsIgnoreCase') {
678
- return filterValueLC === cellValueLC;
679
- }
680
- if (comparator === 'contains') {
681
- return cellValue.includes(normalizedFilterValue);
682
- }
683
- if (comparator === 'containsIgnoreCase') {
684
- return cellValueLC.includes(filterValueLC);
685
- }
686
- if (comparator === 'startsWith') {
687
- return cellValue.startsWith(normalizedFilterValue);
688
- }
689
- if (comparator === 'startsWithIgnoreCase') {
690
- return cellValueLC.startsWith(filterValueLC);
691
- }
692
- return true;
693
- }
694
- _getMatOptionById(id) {
695
- return this._matOptions().find(option => option.id === id);
696
- }
697
- getFilterContext(column) {
698
- return { column };
699
- }
700
- getCellValue(row, key) {
701
- return row[key];
702
- }
703
- _expandPanelForTableRows() {
704
- let tableAdditionalHeight = 0;
705
- const tableInstance = this._table();
706
- if (!tableInstance) {
707
- return;
708
- }
709
- tableInstance
710
- ._getRenderedRows(tableInstance._headerRowOutlet)
711
- .forEach(row => (tableAdditionalHeight += row.getBoundingClientRect().height));
712
- tableInstance
713
- ._getRenderedRows(tableInstance._footerRowOutlet)
714
- .forEach(row => (tableAdditionalHeight += row.getBoundingClientRect().height));
715
- const panelElement = this._matSelect?.panel?.nativeElement;
716
- if (!panelElement) {
717
- return;
718
- }
719
- const panelHeight = panelElement.getBoundingClientRect().height;
720
- if (!isNaN(panelHeight)) {
721
- panelElement.style.maxHeight = `${panelHeight + tableAdditionalHeight}px`;
722
- }
723
- }
724
- _getCommittedValue() {
725
- if (this.completeRowList().length === 0) {
726
- return null;
727
- }
728
- return this.multiple()
729
- ? [...this.completeRowList()]
730
- : { ...this.completeRowList()[0] };
731
- }
732
- _syncMatSelectValue(value) {
733
- this._matSelect.writeValue(value);
734
- this._matSelect._onChange(value);
735
- }
736
- _removeFilteredRow(data, index) {
737
- data
738
- .splice(index, 1)
739
- .forEach(item => (this.filteredOutRows[`${item.id}`] = item));
740
- }
741
- _resolveTriggerLabel(row) {
742
- if (isNil(row)) {
743
- return '';
744
- }
745
- const customTriggerLabelTemplate = this.customTriggerLabelTemplate();
746
- const template = typeof customTriggerLabelTemplate === 'string'
747
- ? customTriggerLabelTemplate.trim()
748
- : '';
749
- if (template.length === 0) {
750
- return `${row.id}`;
751
- }
752
- const rowRecord = row;
753
- let hasMatch = false;
754
- const substitution = template.replace(/[$]{1}[{]{1}([^}]+)[}]{1}?/g, (_, key) => {
755
- const value = rowRecord[String(key)];
756
- if (isNil(value)) {
757
- return '';
758
- }
759
- if (typeof value !== 'string' &&
760
- typeof value !== 'number' &&
761
- typeof value !== 'boolean' &&
762
- typeof value !== 'bigint') {
763
- return '';
764
- }
765
- hasMatch = true;
766
- return String(value);
767
- });
768
- return hasMatch ? substitution.trim() : `${row.id}`;
769
- }
770
- _getTriggerRows(value) {
771
- const triggerLabelSort = this.triggerLabelSort();
772
- if (isNil(triggerLabelSort)) {
773
- return value;
774
- }
775
- return this._sortData([...value], triggerLabelSort.active, triggerLabelSort.direction);
776
- }
777
- _setPanelClass() {
778
- let panelClass = [
779
- 'overflow-hidden',
780
- 'cmat-select-search-table-panel',
781
- ];
782
- if (this._matSelect.panelClass) {
783
- if (Array.isArray(this._matSelect.panelClass)) {
784
- this._matSelect.panelClass = [this._matSelect.panelClass, ...panelClass];
785
- }
786
- else if (typeof this._matSelect.panelClass === 'string') {
787
- this._matSelect.panelClass = [
788
- this._matSelect.panelClass,
789
- ...panelClass,
790
- ];
791
- }
792
- else if (typeof this._matSelect.panelClass === 'object') {
793
- const panelClassObject = this._matSelect.panelClass;
794
- panelClass.forEach((i) => {
795
- panelClassObject[i] = true;
796
- });
797
- }
798
- }
799
- else {
800
- this._matSelect.panelClass = panelClass;
801
- }
802
- }
803
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.0", ngImport: i0, type: CmatSelectTableComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
804
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.2.0", type: CmatSelectTableComponent, isStandalone: true, selector: "cmat-select-table", inputs: { dataSource: { classPropertyName: "dataSource", publicName: "dataSource", isSignal: true, isRequired: false, transformFunction: null }, noEntriesFoundLabel: { classPropertyName: "noEntriesFoundLabel", publicName: "noEntriesFoundLabel", isSignal: true, isRequired: false, transformFunction: null }, showNoFoundLabel: { classPropertyName: "showNoFoundLabel", publicName: "showNoFoundLabel", isSignal: true, isRequired: false, transformFunction: null }, isPhone: { classPropertyName: "isPhone", publicName: "isPhone", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, overallSearchEnabled: { classPropertyName: "overallSearchEnabled", publicName: "overallSearchEnabled", isSignal: true, isRequired: false, transformFunction: null }, overallSearchVisible: { classPropertyName: "overallSearchVisible", publicName: "overallSearchVisible", isSignal: true, isRequired: false, transformFunction: null }, resetSortOnOpen: { classPropertyName: "resetSortOnOpen", publicName: "resetSortOnOpen", isSignal: true, isRequired: false, transformFunction: null }, resetFiltersOnOpen: { classPropertyName: "resetFiltersOnOpen", publicName: "resetFiltersOnOpen", isSignal: true, isRequired: false, transformFunction: null }, customTriggerLabelFn: { classPropertyName: "customTriggerLabelFn", publicName: "customTriggerLabelFn", isSignal: true, isRequired: false, transformFunction: null }, triggerLabelSort: { classPropertyName: "triggerLabelSort", publicName: "triggerLabelSort", isSignal: true, isRequired: false, transformFunction: null }, customTriggerLabelTemplate: { classPropertyName: "customTriggerLabelTemplate", publicName: "customTriggerLabelTemplate", isSignal: true, isRequired: false, transformFunction: null }, canNull: { classPropertyName: "canNull", publicName: "canNull", isSignal: true, isRequired: false, transformFunction: null }, defaultSort: { classPropertyName: "defaultSort", publicName: "defaultSort", isSignal: true, isRequired: false, transformFunction: null }, resetOptionAction: { classPropertyName: "resetOptionAction", publicName: "resetOptionAction", isSignal: true, isRequired: false, transformFunction: null }, keyParam: { classPropertyName: "keyParam", publicName: "keyParam", isSignal: true, isRequired: false, transformFunction: null }, compareWith: { classPropertyName: "compareWith", publicName: "compareWith", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: false, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: false, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: false, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: false, isRequired: false, transformFunction: null } }, outputs: { closed: "closed" }, host: { listeners: { "document:click": "clickedOut()" }, properties: { "attr.id": "id" } }, providers: [
805
- { provide: MatFormFieldControl, useExisting: CmatSelectTableComponent },
806
- ], viewQueries: [{ propertyName: "_matSelectSearch", first: true, predicate: CmatSelectSearchComponent, descendants: true, isSignal: true }, { propertyName: "_sort", first: true, predicate: MatSort, descendants: true, isSignal: true }, { propertyName: "_table", first: true, predicate: MatTable, descendants: true, isSignal: true }, { propertyName: "_matOptions", predicate: MatOption, descendants: true, isSignal: true }, { propertyName: "_matSelectSignal", first: true, predicate: ["componentSelect"], descendants: true, isSignal: true }], exportAs: ["cmatSelectTable"], usesOnChanges: true, ngImport: i0, template: "@if (multiple()) {\r\n<mat-select #componentSelect multiple disableRipple [placeholder]=\"placeholder\" [required]=\"required\"\r\n [formControl]=\"selectControl\" [compareWith]=\"compareWith()\" (focusin)=\"onFocusIn()\"\r\n (openedChange)=\"openedChange($event)\">\r\n <mat-select-trigger>{{ _triggerLabel() }}</mat-select-trigger>\r\n\r\n <div class=\"h-full overflow-y-auto scrollbar-custom\" [ngClass]=\"{ 'hidden-header': overallSearchVisibleState() }\"\r\n (focusout)=\"onFocusOut($event)\">\r\n @if (overallSearchEnabled()) {\r\n <mat-option [ngClass]=\"{ hidden: !overallSearchVisibleState() === true }\">\r\n <cmat-select-search \r\n [showNoFoundLabel]=\"showNoFoundLabel()\" \r\n [noEntriesFoundLabel]=\"noEntriesFoundLabel()\"\r\n [formControl]=\"overallFilterControl\" \r\n [clearSearchInput]=\"resetFiltersOnOpen()??false\">\r\n </cmat-select-search>\r\n </mat-option>\r\n\r\n @if (!isPhone()) {\r\n <div class=\"overall-search-toggle\" [ngStyle]=\"{\r\n height: overallSearchVisibleState() ? '48px' : '55.4px',\r\n }\">\r\n <mat-icon color=\"primary\" [svgIcon]=\"\r\n overallSearchVisibleState()\r\n ? 'mat_outline:arrow_back'\r\n : 'mat_outline:search'\r\n \" (click)=\"toggleOverallSearch()\">\r\n </mat-icon>\r\n </div>\r\n }\r\n }\r\n <table #table mat-table matSort [dataSource]=\"tableDataSource()\">\r\n @for (columnKey of tableColumns(); track $index) {\r\n @let column = tableColumnsMap.get(columnKey);\r\n @switch (columnKey) {\r\n @case (\"_selection\") {\r\n <ng-container [matColumnDef]=\"columnKey\">\r\n <th *matHeaderCellDef mat-header-cell [ngClass]=\"{ selection: true, hidden: !multiple() }\"></th>\r\n <td *matCellDef=\"let row\" mat-cell [ngClass]=\"{ selection: true, hidden: !multiple() }\">\r\n <mat-option [value]=\"row\"></mat-option>\r\n </td>\r\n </ng-container>\r\n }\r\n @default {\r\n <ng-container [matColumnDef]=\"columnKey\">\r\n <th *matHeaderCellDef mat-header-cell mat-sort-header [disabled]=\"!column?.sortable\">\r\n @if (!column?.sortable) {\r\n <div>{{ column?.name }}</div>\r\n } @else {\r\n @switch (column?.filter.type) {\r\n @case (\"string\") {\r\n <ng-container [ngTemplateOutlet]=\"filterTypeString\"\r\n [ngTemplateOutletContext]=\"getFilterContext(column)\"></ng-container>\r\n }\r\n @case (\"number\") {\r\n <ng-container [ngTemplateOutlet]=\"filterTypeNumber\"\r\n [ngTemplateOutletContext]=\"getFilterContext(column)\"></ng-container>\r\n }\r\n @default {\r\n <div>{{ column?.name }}</div>\r\n }\r\n }\r\n }\r\n </th>\r\n <td *matCellDef=\"let row\" mat-cell>\r\n <div class=\"has-label-on-mobile\" [attr.data-label]=\"column?.name + ':'\">\r\n {{ getCellValue(row, columnKey) }}\r\n </div>\r\n </td>\r\n </ng-container>\r\n }\r\n }\r\n }\r\n \r\n <tr *matHeaderRowDef=\"tableColumns(); sticky: true\" mat-header-row></tr>\r\n <tr *matRowDef=\"let row; columns: tableColumns()\" mat-row (click)=\"emulateMatOptionClick($event)\"></tr>\r\n </table>\r\n </div>\r\n</mat-select>\r\n} @else {\r\n<mat-select #componentSelect disableRipple [placeholder]=\"placeholder\" [required]=\"required\"\r\n [formControl]=\"selectControl\" [compareWith]=\"compareWith()\" (focusin)=\"onFocusIn()\"\r\n (openedChange)=\"openedChange($event)\">\r\n <mat-select-trigger>{{ _triggerLabel() }}</mat-select-trigger>\r\n\r\n <div class=\"h-full overflow-y-auto scrollbar-custom\" [ngClass]=\"{ 'hidden-header': overallSearchVisibleState() }\"\r\n (focusout)=\"onFocusOut($event)\">\r\n @if (overallSearchEnabled()) {\r\n <mat-option [ngClass]=\"{ hidden: !overallSearchVisibleState() === true }\">\r\n <cmat-select-search [showNoFoundLabel]=\"showNoFoundLabel()\" [noEntriesFoundLabel]=\"noEntriesFoundLabel()\"\r\n [formControl]=\"overallFilterControl\" [clearSearchInput]=\"resetFiltersOnOpen()??false\">\r\n </cmat-select-search>\r\n </mat-option>\r\n\r\n @if (!isPhone()) {\r\n <div class=\"overall-search-toggle\" [ngStyle]=\"{\r\n height: overallSearchVisibleState() ? '48px' : '55.4px',\r\n }\">\r\n <mat-icon color=\"primary\" [svgIcon]=\"\r\n overallSearchVisibleState()\r\n ? 'mat_outline:arrow_back'\r\n : 'mat_outline:search'\r\n \" (click)=\"toggleOverallSearch()\">\r\n </mat-icon>\r\n </div>\r\n }\r\n }\r\n <table #table mat-table matSort [dataSource]=\"tableDataSource()\">\r\n @for (columnKey of tableColumns(); track $index) {\r\n @let column = tableColumnsMap.get(columnKey);\r\n @switch (columnKey) {\r\n @case (\"_selection\") {\r\n <ng-container [matColumnDef]=\"columnKey\">\r\n <th *matHeaderCellDef mat-header-cell class=\"selection\"></th>\r\n <td *matCellDef=\"let row\" mat-cell class=\"selection\">\r\n @if (row.id === null) {\r\n <mat-option></mat-option>\r\n } @else {\r\n <mat-option [value]=\"row\"></mat-option>\r\n }\r\n </td>\r\n </ng-container>\r\n }\r\n @default {\r\n <ng-container [matColumnDef]=\"columnKey\">\r\n <th *matHeaderCellDef mat-header-cell mat-sort-header [disabled]=\"!column?.sortable\">\r\n @if (!column?.sortable) {\r\n <div>{{ column?.name }}</div>\r\n } @else {\r\n @switch (column?.filter.type) {\r\n @case (\"string\") {\r\n <ng-container [ngTemplateOutlet]=\"filterTypeString\"\r\n [ngTemplateOutletContext]=\"getFilterContext(column)\"></ng-container>\r\n }\r\n @case (\"number\") {\r\n <ng-container [ngTemplateOutlet]=\"filterTypeNumber\"\r\n [ngTemplateOutletContext]=\"getFilterContext(column)\"></ng-container>\r\n }\r\n @default {\r\n <div>{{ column?.name }}</div>\r\n }\r\n }\r\n }\r\n </th>\r\n <td *matCellDef=\"let row\" mat-cell [colSpan]=\"\r\n hasNullRow && row.id === null && $index === 1\r\n ? tableColumns().length\r\n : 1\r\n \" [ngStyle]=\"{\r\n display:\r\n hasNullRow && row.id === null && $index !== 1\r\n ? 'none'\r\n : '',\r\n }\">\r\n <div class=\"has-label-on-mobile\" [attr.data-label]=\"column?.name + ':'\">\r\n {{\r\n hasNullRow && row.id === null && $index === 1\r\n ? \"\u7A7A\"\r\n : getCellValue(row, columnKey)\r\n }}\r\n </div>\r\n </td>\r\n </ng-container>\r\n }\r\n }\r\n }\r\n\r\n <tr *matHeaderRowDef=\"tableColumns(); sticky: true\" mat-header-row></tr>\r\n <tr *matRowDef=\"let row; columns: tableColumns()\" mat-row (click)=\"emulateMatOptionClick($event)\"></tr>\r\n </table>\r\n </div>\r\n</mat-select>\r\n}\r\n<ng-template #filterTypeString let-column=\"column\">\r\n <mat-form-field appearance=\"fill\" class=\"filter\" (click)=\"$event.stopPropagation()\">\r\n <input matInput [formControl]=\"filterFormControl(column.key)\" [placeholder]=\"column.name\"\r\n (keydown)=\"$event.stopPropagation()\" (keyup)=\"$event.stopPropagation()\" (keypress)=\"$event.stopPropagation()\" />\r\n </mat-form-field>\r\n</ng-template>\r\n\r\n<ng-template #filterTypeNumber let-column=\"column\">\r\n <mat-form-field appearance=\"fill\" class=\"filter\" (click)=\"$event.stopPropagation()\">\r\n <input matInput cmatDigitOnly [min]=\"0\" [formControl]=\"filterFormControl(column.key)\" [placeholder]=\"column.name\"\r\n (keydown)=\"$event.stopPropagation()\" (keyup)=\"$event.stopPropagation()\" (keypress)=\"$event.stopPropagation()\" />\r\n </mat-form-field>\r\n</ng-template>", styles: ["cmat-select-table{display:block;width:100%}.cmat-select-search-table-panel{min-width:max-content;max-width:100%;min-height:240px;padding-top:0!important}.cmat-select-search-table-panel .overall-search-toggle{z-index:102;display:flex;cursor:pointer;position:absolute;width:48px;height:48px;align-items:center;left:12px;top:0;pointer-events:auto}.cmat-select-search-table-panel .overall-search-toggle mat-icon{pointer-events:auto;-webkit-user-select:none;user-select:none}.cmat-select-search-table-panel .hidden-header table thead{display:none}.cmat-select-search-table-panel table{width:100%}.cmat-select-search-table-panel table tr{cursor:pointer;height:48px;max-height:48px}.cmat-select-search-table-panel table tr mat-option{height:48px;max-height:48px}.cmat-select-search-table-panel table tr td{-webkit-user-select:none;user-select:none;border-bottom:0!important;box-shadow:inset 0 -1px var(--cmat-border)}.cmat-select-search-table-panel table tr th .mat-sort-header-container{height:55px}.cmat-select-search-table-panel table tr th .mat-sort-header-container mat-form-field .mat-form-field-infix{width:initial}.cmat-select-search-table-panel table tr th[aria-sort] .mat-sort-header-arrow{opacity:1!important}.cmat-select-search-table-panel table tr td mat-option,.cmat-select-search-table-panel table tr th mat-option{background:transparent!important}.cmat-select-search-table-panel table tr td.selection,.cmat-select-search-table-panel table tr th.selection{width:48px;padding:0;margin:0}.cmat-select-search-table-panel table tr:has(td:first-child mat-option[aria-selected=true]){background-color:var(--mat-option-hover-state-layer-color, color-mix(in srgb, var(--mat-sys-on-surface) calc(var(--mat-sys-hover-state-layer-opacity) * 100%), transparent))!important;color:rgba(var(--cmat-primary-rgb),1)!important}.cmat-select-search-table-panel .cmat-select-search-inner>span{visibility:hidden}\n"], dependencies: [{ kind: "component", type: CmatSelectSearchComponent, selector: "cmat-select-search", inputs: ["placeholderLabel", "type", "noEntriesFoundLabel", "showNoFoundLabel", "clearSearchInput", "searching", "disableInitialFocus", "enableClearOnEscapePressed", "preventHomeEndKeyPropagation", "disableScrollToActiveOnOptionsChanged", "ariaLabel", "showToggleAllCheckbox", "toggleAllCheckboxChecked", "toggleAllCheckboxIndeterminate", "toggleAllCheckboxTooltipMessage", "toggleAllCheckboxTooltipPosition", "hideClearSearchButton", "alwaysRestoreSelectedOptionsMulti", "debounceTime", "optionsCount"], outputs: ["toggleAll"], exportAs: ["cmatSelectSearch"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i1.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "ngmodule", type: MatSelectModule }, { kind: "component", type: i2.MatSelect, selector: "mat-select", inputs: ["aria-describedby", "panelClass", "disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator", "placeholder", "required", "multiple", "disableOptionCentering", "compareWith", "value", "aria-label", "aria-labelledby", "errorStateMatcher", "typeaheadDebounceInterval", "sortComparator", "id", "panelWidth", "canSelectNullableOptions"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "directive", type: i2.MatSelectTrigger, selector: "mat-select-trigger" }, { kind: "component", type: i2.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i3.DefaultValueAccessor, selector: "input:not([type=checkbox]):not([ngNoCva])[formControlName],textarea:not([ngNoCva])[formControlName],input:not([type=checkbox]):not([ngNoCva])[formControl],textarea:not([ngNoCva])[formControl],input:not([type=checkbox]):not([ngNoCva])[ngModel],textarea:not([ngNoCva])[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i3.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i4.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i4.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i4.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i5.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatTableModule }, { kind: "component", type: i6.MatTable, selector: "mat-table, table[mat-table]", exportAs: ["matTable"] }, { kind: "directive", type: i6.MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { kind: "directive", type: i6.MatHeaderRowDef, selector: "[matHeaderRowDef]", inputs: ["matHeaderRowDef", "matHeaderRowDefSticky"] }, { kind: "directive", type: i6.MatColumnDef, selector: "[matColumnDef]", inputs: ["matColumnDef"] }, { kind: "directive", type: i6.MatCellDef, selector: "[matCellDef]" }, { kind: "directive", type: i6.MatRowDef, selector: "[matRowDef]", inputs: ["matRowDefColumns", "matRowDefWhen"] }, { kind: "directive", type: i6.MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { kind: "directive", type: i6.MatCell, selector: "mat-cell, td[mat-cell]" }, { kind: "component", type: i6.MatHeaderRow, selector: "mat-header-row, tr[mat-header-row]", exportAs: ["matHeaderRow"] }, { kind: "component", type: i6.MatRow, selector: "mat-row, tr[mat-row]", exportAs: ["matRow"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i7.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "ngmodule", type: MatSortModule }, { kind: "directive", type: i8.MatSort, selector: "[matSort]", inputs: ["matSortActive", "matSortStart", "matSortDirection", "matSortDisableClear", "matSortDisabled"], outputs: ["matSortChange"], exportAs: ["matSort"] }, { kind: "component", type: i8.MatSortHeader, selector: "[mat-sort-header]", inputs: ["mat-sort-header", "arrowPosition", "start", "disabled", "sortActionDescription", "disableClear"], exportAs: ["matSortHeader"] }, { kind: "directive", type: CmatDigitOnlyDirective, selector: "[cmatDigitOnly]", inputs: ["decimal", "decimalSeparator", "allowNegatives", "allowPaste", "negativeSign", "min", "max", "pattern"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
807
- }
808
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.0", ngImport: i0, type: CmatSelectTableComponent, decorators: [{
809
- type: Component,
810
- args: [{ selector: 'cmat-select-table', exportAs: 'cmatSelectTable', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, providers: [
811
- { provide: MatFormFieldControl, useExisting: CmatSelectTableComponent },
812
- ], imports: [
813
- CmatSelectSearchComponent,
814
- MatFormFieldModule,
815
- MatSelectModule,
816
- ReactiveFormsModule,
817
- CommonModule,
818
- MatIconModule,
819
- MatTableModule,
820
- MatInputModule,
821
- MatSortModule,
822
- CmatDigitOnlyDirective,
823
- ], host: {
824
- // eslint-disable-next-line @typescript-eslint/naming-convention
825
- '[attr.id]': 'id',
826
- }, template: "@if (multiple()) {\r\n<mat-select #componentSelect multiple disableRipple [placeholder]=\"placeholder\" [required]=\"required\"\r\n [formControl]=\"selectControl\" [compareWith]=\"compareWith()\" (focusin)=\"onFocusIn()\"\r\n (openedChange)=\"openedChange($event)\">\r\n <mat-select-trigger>{{ _triggerLabel() }}</mat-select-trigger>\r\n\r\n <div class=\"h-full overflow-y-auto scrollbar-custom\" [ngClass]=\"{ 'hidden-header': overallSearchVisibleState() }\"\r\n (focusout)=\"onFocusOut($event)\">\r\n @if (overallSearchEnabled()) {\r\n <mat-option [ngClass]=\"{ hidden: !overallSearchVisibleState() === true }\">\r\n <cmat-select-search \r\n [showNoFoundLabel]=\"showNoFoundLabel()\" \r\n [noEntriesFoundLabel]=\"noEntriesFoundLabel()\"\r\n [formControl]=\"overallFilterControl\" \r\n [clearSearchInput]=\"resetFiltersOnOpen()??false\">\r\n </cmat-select-search>\r\n </mat-option>\r\n\r\n @if (!isPhone()) {\r\n <div class=\"overall-search-toggle\" [ngStyle]=\"{\r\n height: overallSearchVisibleState() ? '48px' : '55.4px',\r\n }\">\r\n <mat-icon color=\"primary\" [svgIcon]=\"\r\n overallSearchVisibleState()\r\n ? 'mat_outline:arrow_back'\r\n : 'mat_outline:search'\r\n \" (click)=\"toggleOverallSearch()\">\r\n </mat-icon>\r\n </div>\r\n }\r\n }\r\n <table #table mat-table matSort [dataSource]=\"tableDataSource()\">\r\n @for (columnKey of tableColumns(); track $index) {\r\n @let column = tableColumnsMap.get(columnKey);\r\n @switch (columnKey) {\r\n @case (\"_selection\") {\r\n <ng-container [matColumnDef]=\"columnKey\">\r\n <th *matHeaderCellDef mat-header-cell [ngClass]=\"{ selection: true, hidden: !multiple() }\"></th>\r\n <td *matCellDef=\"let row\" mat-cell [ngClass]=\"{ selection: true, hidden: !multiple() }\">\r\n <mat-option [value]=\"row\"></mat-option>\r\n </td>\r\n </ng-container>\r\n }\r\n @default {\r\n <ng-container [matColumnDef]=\"columnKey\">\r\n <th *matHeaderCellDef mat-header-cell mat-sort-header [disabled]=\"!column?.sortable\">\r\n @if (!column?.sortable) {\r\n <div>{{ column?.name }}</div>\r\n } @else {\r\n @switch (column?.filter.type) {\r\n @case (\"string\") {\r\n <ng-container [ngTemplateOutlet]=\"filterTypeString\"\r\n [ngTemplateOutletContext]=\"getFilterContext(column)\"></ng-container>\r\n }\r\n @case (\"number\") {\r\n <ng-container [ngTemplateOutlet]=\"filterTypeNumber\"\r\n [ngTemplateOutletContext]=\"getFilterContext(column)\"></ng-container>\r\n }\r\n @default {\r\n <div>{{ column?.name }}</div>\r\n }\r\n }\r\n }\r\n </th>\r\n <td *matCellDef=\"let row\" mat-cell>\r\n <div class=\"has-label-on-mobile\" [attr.data-label]=\"column?.name + ':'\">\r\n {{ getCellValue(row, columnKey) }}\r\n </div>\r\n </td>\r\n </ng-container>\r\n }\r\n }\r\n }\r\n \r\n <tr *matHeaderRowDef=\"tableColumns(); sticky: true\" mat-header-row></tr>\r\n <tr *matRowDef=\"let row; columns: tableColumns()\" mat-row (click)=\"emulateMatOptionClick($event)\"></tr>\r\n </table>\r\n </div>\r\n</mat-select>\r\n} @else {\r\n<mat-select #componentSelect disableRipple [placeholder]=\"placeholder\" [required]=\"required\"\r\n [formControl]=\"selectControl\" [compareWith]=\"compareWith()\" (focusin)=\"onFocusIn()\"\r\n (openedChange)=\"openedChange($event)\">\r\n <mat-select-trigger>{{ _triggerLabel() }}</mat-select-trigger>\r\n\r\n <div class=\"h-full overflow-y-auto scrollbar-custom\" [ngClass]=\"{ 'hidden-header': overallSearchVisibleState() }\"\r\n (focusout)=\"onFocusOut($event)\">\r\n @if (overallSearchEnabled()) {\r\n <mat-option [ngClass]=\"{ hidden: !overallSearchVisibleState() === true }\">\r\n <cmat-select-search [showNoFoundLabel]=\"showNoFoundLabel()\" [noEntriesFoundLabel]=\"noEntriesFoundLabel()\"\r\n [formControl]=\"overallFilterControl\" [clearSearchInput]=\"resetFiltersOnOpen()??false\">\r\n </cmat-select-search>\r\n </mat-option>\r\n\r\n @if (!isPhone()) {\r\n <div class=\"overall-search-toggle\" [ngStyle]=\"{\r\n height: overallSearchVisibleState() ? '48px' : '55.4px',\r\n }\">\r\n <mat-icon color=\"primary\" [svgIcon]=\"\r\n overallSearchVisibleState()\r\n ? 'mat_outline:arrow_back'\r\n : 'mat_outline:search'\r\n \" (click)=\"toggleOverallSearch()\">\r\n </mat-icon>\r\n </div>\r\n }\r\n }\r\n <table #table mat-table matSort [dataSource]=\"tableDataSource()\">\r\n @for (columnKey of tableColumns(); track $index) {\r\n @let column = tableColumnsMap.get(columnKey);\r\n @switch (columnKey) {\r\n @case (\"_selection\") {\r\n <ng-container [matColumnDef]=\"columnKey\">\r\n <th *matHeaderCellDef mat-header-cell class=\"selection\"></th>\r\n <td *matCellDef=\"let row\" mat-cell class=\"selection\">\r\n @if (row.id === null) {\r\n <mat-option></mat-option>\r\n } @else {\r\n <mat-option [value]=\"row\"></mat-option>\r\n }\r\n </td>\r\n </ng-container>\r\n }\r\n @default {\r\n <ng-container [matColumnDef]=\"columnKey\">\r\n <th *matHeaderCellDef mat-header-cell mat-sort-header [disabled]=\"!column?.sortable\">\r\n @if (!column?.sortable) {\r\n <div>{{ column?.name }}</div>\r\n } @else {\r\n @switch (column?.filter.type) {\r\n @case (\"string\") {\r\n <ng-container [ngTemplateOutlet]=\"filterTypeString\"\r\n [ngTemplateOutletContext]=\"getFilterContext(column)\"></ng-container>\r\n }\r\n @case (\"number\") {\r\n <ng-container [ngTemplateOutlet]=\"filterTypeNumber\"\r\n [ngTemplateOutletContext]=\"getFilterContext(column)\"></ng-container>\r\n }\r\n @default {\r\n <div>{{ column?.name }}</div>\r\n }\r\n }\r\n }\r\n </th>\r\n <td *matCellDef=\"let row\" mat-cell [colSpan]=\"\r\n hasNullRow && row.id === null && $index === 1\r\n ? tableColumns().length\r\n : 1\r\n \" [ngStyle]=\"{\r\n display:\r\n hasNullRow && row.id === null && $index !== 1\r\n ? 'none'\r\n : '',\r\n }\">\r\n <div class=\"has-label-on-mobile\" [attr.data-label]=\"column?.name + ':'\">\r\n {{\r\n hasNullRow && row.id === null && $index === 1\r\n ? \"\u7A7A\"\r\n : getCellValue(row, columnKey)\r\n }}\r\n </div>\r\n </td>\r\n </ng-container>\r\n }\r\n }\r\n }\r\n\r\n <tr *matHeaderRowDef=\"tableColumns(); sticky: true\" mat-header-row></tr>\r\n <tr *matRowDef=\"let row; columns: tableColumns()\" mat-row (click)=\"emulateMatOptionClick($event)\"></tr>\r\n </table>\r\n </div>\r\n</mat-select>\r\n}\r\n<ng-template #filterTypeString let-column=\"column\">\r\n <mat-form-field appearance=\"fill\" class=\"filter\" (click)=\"$event.stopPropagation()\">\r\n <input matInput [formControl]=\"filterFormControl(column.key)\" [placeholder]=\"column.name\"\r\n (keydown)=\"$event.stopPropagation()\" (keyup)=\"$event.stopPropagation()\" (keypress)=\"$event.stopPropagation()\" />\r\n </mat-form-field>\r\n</ng-template>\r\n\r\n<ng-template #filterTypeNumber let-column=\"column\">\r\n <mat-form-field appearance=\"fill\" class=\"filter\" (click)=\"$event.stopPropagation()\">\r\n <input matInput cmatDigitOnly [min]=\"0\" [formControl]=\"filterFormControl(column.key)\" [placeholder]=\"column.name\"\r\n (keydown)=\"$event.stopPropagation()\" (keyup)=\"$event.stopPropagation()\" (keypress)=\"$event.stopPropagation()\" />\r\n </mat-form-field>\r\n</ng-template>", styles: ["cmat-select-table{display:block;width:100%}.cmat-select-search-table-panel{min-width:max-content;max-width:100%;min-height:240px;padding-top:0!important}.cmat-select-search-table-panel .overall-search-toggle{z-index:102;display:flex;cursor:pointer;position:absolute;width:48px;height:48px;align-items:center;left:12px;top:0;pointer-events:auto}.cmat-select-search-table-panel .overall-search-toggle mat-icon{pointer-events:auto;-webkit-user-select:none;user-select:none}.cmat-select-search-table-panel .hidden-header table thead{display:none}.cmat-select-search-table-panel table{width:100%}.cmat-select-search-table-panel table tr{cursor:pointer;height:48px;max-height:48px}.cmat-select-search-table-panel table tr mat-option{height:48px;max-height:48px}.cmat-select-search-table-panel table tr td{-webkit-user-select:none;user-select:none;border-bottom:0!important;box-shadow:inset 0 -1px var(--cmat-border)}.cmat-select-search-table-panel table tr th .mat-sort-header-container{height:55px}.cmat-select-search-table-panel table tr th .mat-sort-header-container mat-form-field .mat-form-field-infix{width:initial}.cmat-select-search-table-panel table tr th[aria-sort] .mat-sort-header-arrow{opacity:1!important}.cmat-select-search-table-panel table tr td mat-option,.cmat-select-search-table-panel table tr th mat-option{background:transparent!important}.cmat-select-search-table-panel table tr td.selection,.cmat-select-search-table-panel table tr th.selection{width:48px;padding:0;margin:0}.cmat-select-search-table-panel table tr:has(td:first-child mat-option[aria-selected=true]){background-color:var(--mat-option-hover-state-layer-color, color-mix(in srgb, var(--mat-sys-on-surface) calc(var(--mat-sys-hover-state-layer-opacity) * 100%), transparent))!important;color:rgba(var(--cmat-primary-rgb),1)!important}.cmat-select-search-table-panel .cmat-select-search-inner>span{visibility:hidden}\n"] }]
827
- }], ctorParameters: () => [], propDecorators: { dataSource: [{ type: i0.Input, args: [{ isSignal: true, alias: "dataSource", required: false }] }], noEntriesFoundLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "noEntriesFoundLabel", required: false }] }], showNoFoundLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "showNoFoundLabel", required: false }] }], isPhone: [{ type: i0.Input, args: [{ isSignal: true, alias: "isPhone", required: false }] }], multiple: [{ type: i0.Input, args: [{ isSignal: true, alias: "multiple", required: false }] }], overallSearchEnabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "overallSearchEnabled", required: false }] }], overallSearchVisible: [{ type: i0.Input, args: [{ isSignal: true, alias: "overallSearchVisible", required: false }] }], resetSortOnOpen: [{ type: i0.Input, args: [{ isSignal: true, alias: "resetSortOnOpen", required: false }] }], resetFiltersOnOpen: [{ type: i0.Input, args: [{ isSignal: true, alias: "resetFiltersOnOpen", required: false }] }], customTriggerLabelFn: [{ type: i0.Input, args: [{ isSignal: true, alias: "customTriggerLabelFn", required: false }] }], triggerLabelSort: [{ type: i0.Input, args: [{ isSignal: true, alias: "triggerLabelSort", required: false }] }], customTriggerLabelTemplate: [{ type: i0.Input, args: [{ isSignal: true, alias: "customTriggerLabelTemplate", required: false }] }], canNull: [{ type: i0.Input, args: [{ isSignal: true, alias: "canNull", required: false }] }], defaultSort: [{ type: i0.Input, args: [{ isSignal: true, alias: "defaultSort", required: false }] }], resetOptionAction: [{ type: i0.Input, args: [{ isSignal: true, alias: "resetOptionAction", required: false }] }], keyParam: [{ type: i0.Input, args: [{ isSignal: true, alias: "keyParam", required: false }] }], compareWith: [{ type: i0.Input, args: [{ isSignal: true, alias: "compareWith", required: false }] }], closed: [{ type: i0.Output, args: ["closed"] }], _matSelectSearch: [{ type: i0.ViewChild, args: [i0.forwardRef(() => CmatSelectSearchComponent), { isSignal: true }] }], _sort: [{ type: i0.ViewChild, args: [i0.forwardRef(() => MatSort), { isSignal: true }] }], _table: [{ type: i0.ViewChild, args: [i0.forwardRef(() => MatTable), { isSignal: true }] }], _matOptions: [{ type: i0.ViewChildren, args: [i0.forwardRef(() => MatOption), { isSignal: true }] }], _matSelectSignal: [{ type: i0.ViewChild, args: ['componentSelect', { isSignal: true }] }], clickedOut: [{
828
- type: HostListener,
829
- args: ['document:click']
830
- }], placeholder: [{
831
- type: Input
832
- }], value: [{
833
- type: Input
834
- }], required: [{
835
- type: Input
836
- }], disabled: [{
837
- type: Input
838
- }] } });
839
-
840
- /**
841
- * Generated bundle index. Do not edit.
842
- */
843
-
27
+ var CmatSelectTableComponent = class CmatSelectTableComponent {
28
+ get focused() {
29
+ return this._focusedSignal();
30
+ }
31
+ get touched() {
32
+ return this._touchedSignal();
33
+ }
34
+ constructor() {
35
+ this.id = `cmat-select-table-${NEXT_ID++}`;
36
+ this.dataSource = input(...ngDevMode ? [void 0, { debugName: "dataSource" }] : /* istanbul ignore next */ []);
37
+ this.noEntriesFoundLabel = input("无结果", ...ngDevMode ? [{ debugName: "noEntriesFoundLabel" }] : /* istanbul ignore next */ []);
38
+ this.showNoFoundLabel = input(true, ...ngDevMode ? [{ debugName: "showNoFoundLabel" }] : /* istanbul ignore next */ []);
39
+ this.isPhone = input(false, ...ngDevMode ? [{ debugName: "isPhone" }] : /* istanbul ignore next */ []);
40
+ this.multiple = input(false, ...ngDevMode ? [{ debugName: "multiple" }] : /* istanbul ignore next */ []);
41
+ this.overallSearchEnabled = input(true, ...ngDevMode ? [{ debugName: "overallSearchEnabled" }] : /* istanbul ignore next */ []);
42
+ this.overallSearchVisible = input(...ngDevMode ? [void 0, { debugName: "overallSearchVisible" }] : /* istanbul ignore next */ []);
43
+ this.resetSortOnOpen = input(...ngDevMode ? [void 0, { debugName: "resetSortOnOpen" }] : /* istanbul ignore next */ []);
44
+ this.resetFiltersOnOpen = input(...ngDevMode ? [void 0, { debugName: "resetFiltersOnOpen" }] : /* istanbul ignore next */ []);
45
+ this.customTriggerLabelFn = input(...ngDevMode ? [void 0, { debugName: "customTriggerLabelFn" }] : /* istanbul ignore next */ []);
46
+ this.triggerLabelSort = input(...ngDevMode ? [void 0, { debugName: "triggerLabelSort" }] : /* istanbul ignore next */ []);
47
+ this.customTriggerLabelTemplate = input(...ngDevMode ? [void 0, { debugName: "customTriggerLabelTemplate" }] : /* istanbul ignore next */ []);
48
+ this.canNull = input(...ngDevMode ? [void 0, { debugName: "canNull" }] : /* istanbul ignore next */ []);
49
+ this.defaultSort = input(...ngDevMode ? [void 0, { debugName: "defaultSort" }] : /* istanbul ignore next */ []);
50
+ this.resetOptionAction = input(...ngDevMode ? [void 0, { debugName: "resetOptionAction" }] : /* istanbul ignore next */ []);
51
+ this.keyParam = input("id", ...ngDevMode ? [{ debugName: "keyParam" }] : /* istanbul ignore next */ []);
52
+ this.compareWith = input((o1, o2) => {
53
+ return o1 && o2 ? o1?.name === o2?.name && o1?.id === o2?.id : o1 === o2;
54
+ }, ...ngDevMode ? [{ debugName: "compareWith" }] : /* istanbul ignore next */ []);
55
+ this.closed = output();
56
+ this._matSelectSearch = viewChild(CmatSelectSearchComponent, ...ngDevMode ? [{ debugName: "_matSelectSearch" }] : /* istanbul ignore next */ []);
57
+ this._sort = viewChild(MatSort, ...ngDevMode ? [{ debugName: "_sort" }] : /* istanbul ignore next */ []);
58
+ this._table = viewChild(MatTable, ...ngDevMode ? [{ debugName: "_table" }] : /* istanbul ignore next */ []);
59
+ this._matOptions = viewChildren(MatOption, ...ngDevMode ? [{ debugName: "_matOptions" }] : /* istanbul ignore next */ []);
60
+ this._matSelectSignal = viewChild("componentSelect", ...ngDevMode ? [{ debugName: "_matSelectSignal" }] : /* istanbul ignore next */ []);
61
+ this.tableDataSource = signal([], ...ngDevMode ? [{ debugName: "tableDataSource" }] : /* istanbul ignore next */ []);
62
+ this.tableColumns = signal([], ...ngDevMode ? [{ debugName: "tableColumns" }] : /* istanbul ignore next */ []);
63
+ this._rowById = /* @__PURE__ */ new Map();
64
+ this._columnKeys = [];
65
+ this.completeRowList = signal([], ...ngDevMode ? [{ debugName: "completeRowList" }] : /* istanbul ignore next */ []);
66
+ this.overallSearchVisibleState = signal(false, ...ngDevMode ? [{ debugName: "overallSearchVisibleState" }] : /* istanbul ignore next */ []);
67
+ this.overallFilterControl = new FormControl("");
68
+ this.selectControl = new FormControl();
69
+ this.stateChanges = new Subject();
70
+ this._focusedSignal = signal(false, ...ngDevMode ? [{ debugName: "_focusedSignal" }] : /* istanbul ignore next */ []);
71
+ this._touchedSignal = signal(false, ...ngDevMode ? [{ debugName: "_touchedSignal" }] : /* istanbul ignore next */ []);
72
+ this._placeholderSignal = signal("", ...ngDevMode ? [{ debugName: "_placeholderSignal" }] : /* istanbul ignore next */ []);
73
+ this._disabledSignal = signal(false, ...ngDevMode ? [{ debugName: "_disabledSignal" }] : /* istanbul ignore next */ []);
74
+ this._requiredSignal = signal(false, ...ngDevMode ? [{ debugName: "_requiredSignal" }] : /* istanbul ignore next */ []);
75
+ this.ngControl = inject(NgControl, {
76
+ optional: true,
77
+ self: true
78
+ });
79
+ this._destroyRef = inject(DestroyRef);
80
+ this._cdr = inject(ChangeDetectorRef);
81
+ this._initRunning = false;
82
+ this._rawValue = null;
83
+ this._resolvingFromDataSource = false;
84
+ this._nullRow = { id: null };
85
+ this._value = null;
86
+ this._triggerLabel = computed(() => this.customTriggerLabelFn()?.(this.completeRowList()) ?? this.simpleTriggerLabelFn(this.completeRowList()), ...ngDevMode ? [{ debugName: "_triggerLabel" }] : /* istanbul ignore next */ []);
87
+ this._onModelChange = () => {};
88
+ this._onTouchedChange = () => {};
89
+ if (this.ngControl != null) this.ngControl.valueAccessor = this;
90
+ this.tableColumnsMap = /* @__PURE__ */ new Map();
91
+ this._filterControls = new FormGroup({});
92
+ effect(() => {
93
+ const matSelect = this._matSelectSignal();
94
+ if (matSelect && !this._matSelect) {
95
+ this._matSelect = matSelect;
96
+ untracked(() => {
97
+ this._init(this.value);
98
+ });
99
+ this._matSelect.setDisabledState(this._disabledSignal());
100
+ this._setPanelClass();
101
+ } else if (matSelect && this._matSelect !== matSelect) {
102
+ this._matSelect = matSelect;
103
+ this._setPanelClass();
104
+ }
105
+ });
106
+ effect(() => {
107
+ const ds = this.dataSource();
108
+ if (!ds || !isArray(ds.data) || ds.data.length === 0) return;
109
+ untracked(() => {
110
+ const columns = ds.columns;
111
+ const data = ds.data;
112
+ this._columnKeys = columns.map((column) => column.key);
113
+ this.tableDataSource.set([...data]);
114
+ if (this.addNullRow()) this.tableDataSource.update((value) => [this._nullRow, ...value]);
115
+ this.tableColumns.set(["_selection", ...this._columnKeys]);
116
+ this.tableColumnsMap.clear();
117
+ columns.forEach((column) => this.tableColumnsMap.set(column.key, column));
118
+ this._rowById.clear();
119
+ data.forEach((row) => {
120
+ const rowKey = row[this.keyParam()];
121
+ if (!isNil(rowKey)) this._rowById.set(rowKey, row);
122
+ });
123
+ if (this._matSelect) {
124
+ this._resolvingFromDataSource = true;
125
+ try {
126
+ this._init(this._rawValue);
127
+ } finally {
128
+ this._resolvingFromDataSource = false;
129
+ }
130
+ this.stateChanges.next();
131
+ Promise.resolve().then(() => this._cdr.detectChanges());
132
+ }
133
+ });
134
+ });
135
+ }
136
+ clickedOut() {
137
+ if (!this._matSelect?.panelOpen) {
138
+ this._focusedSignal.set(false);
139
+ this.stateChanges.next();
140
+ }
141
+ }
142
+ ngAfterViewInit() {
143
+ const sortInstance = this._sort();
144
+ if (!sortInstance) return;
145
+ merge(...[
146
+ sortInstance.sortChange,
147
+ this._filterControls.valueChanges,
148
+ this.overallFilterControl.valueChanges
149
+ ]).pipe(takeUntilDestroyed(this._destroyRef), debounceTime(300)).subscribe(() => {
150
+ const dataClone = [...(this.dataSource() ?? { data: [] }).data || []];
151
+ if (this.addNullRow()) dataClone.unshift(this._nullRow);
152
+ if (this.overallSearchEnabled() && this.overallSearchVisibleState()) this._applyOverallFilter(dataClone);
153
+ else this._applyColumnLevelFilters(dataClone);
154
+ const currentSort = this._sort();
155
+ const defaultSort = this.defaultSort();
156
+ if (currentSort && !currentSort.active && !isNil(defaultSort) && defaultSort.active) {
157
+ currentSort.active = defaultSort.active;
158
+ currentSort.direction = defaultSort.direction;
159
+ }
160
+ const sortedData = !currentSort?.active ? dataClone : this._sortData(dataClone, currentSort.active, currentSort.direction);
161
+ this.tableDataSource.set(sortedData);
162
+ });
163
+ }
164
+ ngOnDestroy() {
165
+ this.stateChanges.complete();
166
+ }
167
+ get placeholder() {
168
+ return this._placeholderSignal();
169
+ }
170
+ set placeholder(value) {
171
+ this._placeholderSignal.set(value);
172
+ this.stateChanges.next();
173
+ }
174
+ get value() {
175
+ return this._value;
176
+ }
177
+ set value(value) {
178
+ if (value !== this.value) {
179
+ this._value = value;
180
+ this.stateChanges.next();
181
+ this._onModelChange(value);
182
+ }
183
+ }
184
+ get empty() {
185
+ return !this._value;
186
+ }
187
+ get errorState() {
188
+ if (this.ngControl == null) return false;
189
+ return (this.touched && this.ngControl?.invalid) ?? false;
190
+ }
191
+ get shouldLabelFloat() {
192
+ return this._focusedSignal() || !this.empty;
193
+ }
194
+ get required() {
195
+ return this._requiredSignal();
196
+ }
197
+ set required(value) {
198
+ this._requiredSignal.set(coerceBooleanProperty(value));
199
+ this.stateChanges.next();
200
+ }
201
+ get disabled() {
202
+ if (!isNil(this.ngControl?.disabled)) return this.ngControl.disabled;
203
+ return this._disabledSignal();
204
+ }
205
+ set disabled(value) {
206
+ const isDisabled = coerceBooleanProperty(value);
207
+ this._disabledSignal.set(isDisabled);
208
+ if (this._focusedSignal() && isDisabled) {
209
+ this._focusedSignal.set(false);
210
+ this.stateChanges.next();
211
+ }
212
+ }
213
+ registerOnChange(fn) {
214
+ this._onModelChange = fn;
215
+ }
216
+ registerOnTouched(fn) {
217
+ this._onTouchedChange = fn;
218
+ this._matSelect?.registerOnTouched(fn);
219
+ }
220
+ setDisabledState(isDisabled) {
221
+ this._disabledSignal.set(isDisabled);
222
+ this._matSelect?.setDisabledState(isDisabled);
223
+ }
224
+ setDescribedByIds(ids) {
225
+ this._matSelect?.setDescribedByIds(ids);
226
+ }
227
+ onContainerClick() {
228
+ if (!this._focusedSignal()) this._matSelect?.focus();
229
+ }
230
+ onFocusIn() {
231
+ if (!this._focusedSignal()) {
232
+ this._focusedSignal.set(true);
233
+ this.stateChanges.next();
234
+ }
235
+ }
236
+ onFocusOut(event) {
237
+ const matSelectPanel = this._matSelect?.panel?.nativeElement;
238
+ if (matSelectPanel && !matSelectPanel.contains(event.relatedTarget)) {
239
+ this._touchedSignal.set(true);
240
+ this._focusedSignal.set(false);
241
+ this._onTouchedChange();
242
+ this.stateChanges.next();
243
+ }
244
+ }
245
+ writeValue(value) {
246
+ if (!this._resolvingFromDataSource) this._rawValue = value;
247
+ this._init(value);
248
+ }
249
+ ngOnChanges(changes) {
250
+ if (!isNil(changes.resetFiltersOnOpen) && changes.resetFiltersOnOpen.currentValue !== false) this._resetFilters();
251
+ }
252
+ emulateMatOptionClick(event) {
253
+ if (!(event.target instanceof HTMLElement)) return;
254
+ let rowElement = event.target;
255
+ while (rowElement != null && rowElement instanceof HTMLElement && rowElement.tagName.toLowerCase() !== "tr") rowElement = rowElement.parentElement;
256
+ if (rowElement === null) return;
257
+ const childOption = rowElement.querySelector("mat-option");
258
+ if (!childOption) return;
259
+ if (event.target.tagName.toLowerCase() != "mat-pseudo-checkbox") childOption.click();
260
+ const option = this._getMatOptionById(childOption.id);
261
+ if (!option) return;
262
+ const multiple = this.multiple();
263
+ if (multiple && this._matSelect.panelOpen) {
264
+ this._updateCompleteRowList(option.value, option.selected);
265
+ this.completeRowList.set([...this.completeRowList()]);
266
+ if (this.selectControl) this.selectControl.setValue([...this.completeRowList()], { emitEvent: false });
267
+ }
268
+ if (!multiple) {
269
+ const newRow = option.value ? [option.value] : [];
270
+ this.completeRowList.set(newRow);
271
+ }
272
+ }
273
+ openedChange(opened) {
274
+ const overallSearchEnabled = this.overallSearchEnabled();
275
+ if (this.resetFiltersOnOpen() !== false || !this._matOptions().length && overallSearchEnabled || overallSearchEnabled && this._matOptions().length === 1) this._resetFilters();
276
+ this.overallSearchVisibleState.set(!!this.overallSearchVisible());
277
+ if (this.resetSortOnOpen() !== false) {
278
+ const sortInstance = this._sort();
279
+ if (sortInstance) sortInstance.sort({
280
+ id: "",
281
+ start: "asc",
282
+ disableClear: false
283
+ });
284
+ }
285
+ if (!opened) {
286
+ this.value = this._getCommittedValue();
287
+ if (this.value === null) {
288
+ this.completeRowList.set([]);
289
+ this._checkAndResetSelection();
290
+ }
291
+ this._syncMatSelectValue(this.value);
292
+ this.closed.emit(!opened);
293
+ return;
294
+ }
295
+ const tableInstance = this._table();
296
+ if (tableInstance) {
297
+ const table = tableInstance;
298
+ table._headerRowDefChanged = true;
299
+ }
300
+ setTimeout(() => this._expandPanelForTableRows(), 1);
301
+ }
302
+ filterFormControl(key) {
303
+ if (!this._filterControls.contains(key)) this._filterControls.registerControl(key, new FormControl(""));
304
+ return this._filterControls.get(key);
305
+ }
306
+ simpleTriggerLabelFn(value) {
307
+ return this._getTriggerRows(value).map((row) => this._resolveTriggerLabel(row)).join(", ");
308
+ }
309
+ toggleOverallSearch() {
310
+ this.overallSearchVisibleState.update((value) => !value);
311
+ this._resetFilters();
312
+ if (this.overallSearchVisibleState()) {
313
+ const searchInstance = this._matSelectSearch();
314
+ if (searchInstance) setTimeout(() => searchInstance.focus());
315
+ }
316
+ }
317
+ addNullRow() {
318
+ return !this.multiple() && (this.canNull() ?? false);
319
+ }
320
+ get hasNullRow() {
321
+ return this.addNullRow();
322
+ }
323
+ _init(value) {
324
+ if (this._initRunning) return;
325
+ this._initRunning = true;
326
+ try {
327
+ const list = [];
328
+ if (value) {
329
+ const multiple = this.multiple();
330
+ if (multiple && Array.isArray(value)) value.forEach((v) => this._updateCompleteRowList(v, true, list));
331
+ else if (!multiple) this._updateCompleteRowList(value, true, list);
332
+ }
333
+ this.completeRowList.set(list);
334
+ this._value = this.completeRowList().length > 0 ? [...this.completeRowList()] : value;
335
+ if (this._matSelect) this._matSelect.writeValue(this._value);
336
+ if (this.selectControl) {
337
+ const origOnChange = this._matSelect?._onChange;
338
+ if (this._matSelect) this._matSelect._onChange = () => {};
339
+ try {
340
+ this.selectControl.setValue(this.value, { emitEvent: false });
341
+ } finally {
342
+ if (this._matSelect && origOnChange) this._matSelect._onChange = origOnChange;
343
+ }
344
+ }
345
+ if (this.completeRowList().length > 0) this._onModelChange(this._value);
346
+ } finally {
347
+ this._initRunning = false;
348
+ }
349
+ }
350
+ _updateCompleteRowList(value, selected, list = this.completeRowList()) {
351
+ if (isNil(value)) return;
352
+ if (selected) {
353
+ const keyParam = this.keyParam();
354
+ const rowKey = value[keyParam];
355
+ if (isNil(rowKey)) return;
356
+ const row = this._rowById.get(rowKey);
357
+ if (!row) return;
358
+ if (!list.some((item) => item[keyParam] === row[keyParam])) list.push(row);
359
+ } else {
360
+ const keyParam = this.keyParam();
361
+ const keyValue = value[keyParam];
362
+ const rowIndex = list.findIndex((i) => i[keyParam] === keyValue);
363
+ if (rowIndex > -1) {
364
+ list.splice(rowIndex, 1);
365
+ if (list === this.completeRowList()) this.completeRowList.set([...list]);
366
+ }
367
+ }
368
+ }
369
+ _applyColumnLevelFilters(data) {
370
+ this.filteredOutRows = {};
371
+ const filters = {};
372
+ Object.keys(this._filterControls.controls).filter((key) => {
373
+ const column = this.tableColumnsMap.get(key);
374
+ return !isNil(column?.filter) && column.filter.enabled !== false;
375
+ }).filter((key) => {
376
+ const value = this._filterControls.get(key)?.value;
377
+ return !isNil(value) && (isArray(value) && value.length > 0 || typeof value === "string" && value.trim().length > 0 || typeof value === "number" && `${value}`.trim().length > 0);
378
+ }).forEach((key) => {
379
+ const column = this.tableColumnsMap.get(key);
380
+ const filterControl = this._filterControls.get(key);
381
+ filters[key] = {
382
+ filter: column?.filter,
383
+ value: filterControl?.value
384
+ };
385
+ });
386
+ const filterKeys = Object.keys(filters);
387
+ for (let i = data.length - 1; i >= 0; i--) for (let k = 0; k < filterKeys.length; k++) {
388
+ const filterKey = filterKeys[k];
389
+ const row = data[i];
390
+ const filter = filters[filterKey];
391
+ if (isNil(row)) {
392
+ this._removeFilteredRow(data, i);
393
+ break;
394
+ }
395
+ if (!this._matchesColumnFilter(row, filterKey, filter)) {
396
+ this._removeFilteredRow(data, i);
397
+ break;
398
+ }
399
+ }
400
+ }
401
+ _applyOverallFilter(data) {
402
+ this.filteredOutRows = {};
403
+ if (isNil(this.overallFilterControl.value)) return;
404
+ const filterValueLC = (this.overallFilterControl.value ?? "").toLowerCase();
405
+ if (filterValueLC.trim().length === 0) return;
406
+ for (let i = data.length - 1; i >= 0; i--) {
407
+ const row = data[i];
408
+ let rowShouldBeFiltered = true;
409
+ const rowKeys = this._columnKeys;
410
+ for (let j = rowKeys.length - 1; j >= 0; j--) {
411
+ const cellValue = row[rowKeys[j]];
412
+ if (isNil(cellValue)) continue;
413
+ if ((typeof cellValue === "string" ? cellValue.toLowerCase() : typeof cellValue === "number" || typeof cellValue === "boolean" || typeof cellValue === "bigint" ? String(cellValue).toLowerCase() : "").includes(filterValueLC)) {
414
+ rowShouldBeFiltered = false;
415
+ break;
416
+ }
417
+ }
418
+ if (rowShouldBeFiltered) this._removeFilteredRow(data, i);
419
+ }
420
+ }
421
+ _resetFilters() {
422
+ this.overallFilterControl.setValue("");
423
+ Object.keys(this._filterControls.controls).forEach((key) => this._filterControls.get(key)?.setValue(""));
424
+ }
425
+ _sortingDataAccessor(data, active) {
426
+ const value = data[active];
427
+ if (isNumber(value)) {
428
+ const numberValue = Number(value);
429
+ return numberValue < MAX_SAFE_INTEGER ? numberValue : value;
430
+ }
431
+ return value;
432
+ }
433
+ _sortData(data, active, direction) {
434
+ if (!active || direction === "") return data;
435
+ return data.sort((a, b) => {
436
+ let aValue = this._sortingDataAccessor(a, active);
437
+ let bValue = this._sortingDataAccessor(b, active);
438
+ if (a.id === null) return -1;
439
+ else if (b.id === null) return 1;
440
+ if (aValue === bValue) return 0;
441
+ if (isNil(aValue) && !isNil(bValue)) return -1;
442
+ else if (!isNil(aValue) && isNil(bValue)) return 1;
443
+ if (aValue instanceof Date) aValue = aValue.getTime();
444
+ if (bValue instanceof Date) bValue = bValue.getTime();
445
+ if (isString(aValue) && isString(bValue)) return aValue.localeCompare(bValue) * (direction === "asc" ? 1 : -1);
446
+ aValue = isNaN(aValue) ? `${aValue}` : +aValue;
447
+ bValue = isNaN(bValue) ? `${bValue}` : +bValue;
448
+ if (isString(aValue) && isNumber(bValue)) return 1 * (direction === "asc" ? 1 : -1);
449
+ if (isNumber(aValue) && isString(bValue)) return -1 * (direction === "asc" ? 1 : -1);
450
+ return (aValue > bValue ? 1 : -1) * (direction === "asc" ? 1 : -1);
451
+ });
452
+ }
453
+ _checkAndResetSelection() {
454
+ const resetOptionAction = this.resetOptionAction();
455
+ if (this._matSelect.value && isArray(this._matSelect.value) && this._matSelect.value.length < 1 && !isNil(resetOptionAction)) resetOptionAction();
456
+ }
457
+ _matchesColumnFilter(row, filterKey, filter) {
458
+ const cellValue = row[filterKey];
459
+ if (isNil(cellValue)) return false;
460
+ const columnFilter = filter.filter;
461
+ const comparator = columnFilter?.comparator;
462
+ const filterValue = filter.value;
463
+ let normalizedFilterValue;
464
+ if (columnFilter?.type === "number") normalizedFilterValue = Number(filterValue);
465
+ else if (filterValue === null || filterValue === void 0) normalizedFilterValue = "";
466
+ else if (typeof filterValue === "object") normalizedFilterValue = "";
467
+ else normalizedFilterValue = filterValue;
468
+ if (typeof columnFilter?.comparatorFn === "function") return columnFilter.comparatorFn.call(null, cellValue, normalizedFilterValue, row);
469
+ if (isNil(comparator) || comparator === "equals") return normalizedFilterValue === cellValue;
470
+ if (typeof cellValue !== "string" || typeof normalizedFilterValue !== "string") return false;
471
+ const cellValueLC = cellValue.toLowerCase();
472
+ const filterValueLC = normalizedFilterValue.toLowerCase();
473
+ if (isNil(comparator) || comparator === "equalsIgnoreCase") return filterValueLC === cellValueLC;
474
+ if (comparator === "contains") return cellValue.includes(normalizedFilterValue);
475
+ if (comparator === "containsIgnoreCase") return cellValueLC.includes(filterValueLC);
476
+ if (comparator === "startsWith") return cellValue.startsWith(normalizedFilterValue);
477
+ if (comparator === "startsWithIgnoreCase") return cellValueLC.startsWith(filterValueLC);
478
+ return true;
479
+ }
480
+ _getMatOptionById(id) {
481
+ return this._matOptions().find((option) => option.id === id);
482
+ }
483
+ getFilterContext(column) {
484
+ return { column };
485
+ }
486
+ getCellValue(row, key) {
487
+ return row[key];
488
+ }
489
+ _expandPanelForTableRows() {
490
+ let tableAdditionalHeight = 0;
491
+ const tableInstance = this._table();
492
+ if (!tableInstance) return;
493
+ tableInstance._getRenderedRows(tableInstance._headerRowOutlet).forEach((row) => tableAdditionalHeight += row.getBoundingClientRect().height);
494
+ tableInstance._getRenderedRows(tableInstance._footerRowOutlet).forEach((row) => tableAdditionalHeight += row.getBoundingClientRect().height);
495
+ const panelElement = this._matSelect?.panel?.nativeElement;
496
+ if (!panelElement) return;
497
+ const panelHeight = panelElement.getBoundingClientRect().height;
498
+ if (!isNaN(panelHeight)) panelElement.style.maxHeight = `${panelHeight + tableAdditionalHeight}px`;
499
+ }
500
+ _getCommittedValue() {
501
+ if (this.completeRowList().length === 0) return null;
502
+ return this.multiple() ? [...this.completeRowList()] : { ...this.completeRowList()[0] };
503
+ }
504
+ _syncMatSelectValue(value) {
505
+ this._matSelect.writeValue(value);
506
+ this._matSelect._onChange(value);
507
+ }
508
+ _removeFilteredRow(data, index) {
509
+ data.splice(index, 1).forEach((item) => this.filteredOutRows[`${item.id}`] = item);
510
+ }
511
+ _resolveTriggerLabel(row) {
512
+ if (isNil(row)) return "";
513
+ const customTriggerLabelTemplate = this.customTriggerLabelTemplate();
514
+ const template = typeof customTriggerLabelTemplate === "string" ? customTriggerLabelTemplate.trim() : "";
515
+ if (template.length === 0) return `${row.id}`;
516
+ const rowRecord = row;
517
+ let hasMatch = false;
518
+ const substitution = template.replace(/[$]{1}[{]{1}([^}]+)[}]{1}?/g, (_, key) => {
519
+ const value = rowRecord[String(key)];
520
+ if (isNil(value)) return "";
521
+ if (typeof value !== "string" && typeof value !== "number" && typeof value !== "boolean" && typeof value !== "bigint") return "";
522
+ hasMatch = true;
523
+ return String(value);
524
+ });
525
+ return hasMatch ? substitution.trim() : `${row.id}`;
526
+ }
527
+ _getTriggerRows(value) {
528
+ const triggerLabelSort = this.triggerLabelSort();
529
+ if (isNil(triggerLabelSort)) return value;
530
+ return this._sortData([...value], triggerLabelSort.active, triggerLabelSort.direction);
531
+ }
532
+ _setPanelClass() {
533
+ let panelClass = ["overflow-hidden", "cmat-select-search-table-panel"];
534
+ if (this._matSelect.panelClass) {
535
+ if (Array.isArray(this._matSelect.panelClass)) this._matSelect.panelClass = [this._matSelect.panelClass, ...panelClass];
536
+ else if (typeof this._matSelect.panelClass === "string") this._matSelect.panelClass = [this._matSelect.panelClass, ...panelClass];
537
+ else if (typeof this._matSelect.panelClass === "object") {
538
+ const panelClassObject = this._matSelect.panelClass;
539
+ panelClass.forEach((i) => {
540
+ panelClassObject[i] = true;
541
+ });
542
+ }
543
+ } else this._matSelect.panelClass = panelClass;
544
+ }
545
+ static {
546
+ this.ɵfac = i0.ɵɵngDeclareFactory({
547
+ minVersion: "12.0.0",
548
+ version: "22.2.3",
549
+ ngImport: i0,
550
+ type: CmatSelectTableComponent,
551
+ deps: [],
552
+ target: i0.ɵɵFactoryTarget.Component
553
+ });
554
+ }
555
+ static {
556
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
557
+ minVersion: "17.0.0",
558
+ version: "22.2.3",
559
+ type: CmatSelectTableComponent,
560
+ isStandalone: true,
561
+ selector: "cmat-select-table",
562
+ inputs: {
563
+ dataSource: {
564
+ classPropertyName: "dataSource",
565
+ publicName: "dataSource",
566
+ isSignal: true,
567
+ isRequired: false,
568
+ transformFunction: null
569
+ },
570
+ noEntriesFoundLabel: {
571
+ classPropertyName: "noEntriesFoundLabel",
572
+ publicName: "noEntriesFoundLabel",
573
+ isSignal: true,
574
+ isRequired: false,
575
+ transformFunction: null
576
+ },
577
+ showNoFoundLabel: {
578
+ classPropertyName: "showNoFoundLabel",
579
+ publicName: "showNoFoundLabel",
580
+ isSignal: true,
581
+ isRequired: false,
582
+ transformFunction: null
583
+ },
584
+ isPhone: {
585
+ classPropertyName: "isPhone",
586
+ publicName: "isPhone",
587
+ isSignal: true,
588
+ isRequired: false,
589
+ transformFunction: null
590
+ },
591
+ multiple: {
592
+ classPropertyName: "multiple",
593
+ publicName: "multiple",
594
+ isSignal: true,
595
+ isRequired: false,
596
+ transformFunction: null
597
+ },
598
+ overallSearchEnabled: {
599
+ classPropertyName: "overallSearchEnabled",
600
+ publicName: "overallSearchEnabled",
601
+ isSignal: true,
602
+ isRequired: false,
603
+ transformFunction: null
604
+ },
605
+ overallSearchVisible: {
606
+ classPropertyName: "overallSearchVisible",
607
+ publicName: "overallSearchVisible",
608
+ isSignal: true,
609
+ isRequired: false,
610
+ transformFunction: null
611
+ },
612
+ resetSortOnOpen: {
613
+ classPropertyName: "resetSortOnOpen",
614
+ publicName: "resetSortOnOpen",
615
+ isSignal: true,
616
+ isRequired: false,
617
+ transformFunction: null
618
+ },
619
+ resetFiltersOnOpen: {
620
+ classPropertyName: "resetFiltersOnOpen",
621
+ publicName: "resetFiltersOnOpen",
622
+ isSignal: true,
623
+ isRequired: false,
624
+ transformFunction: null
625
+ },
626
+ customTriggerLabelFn: {
627
+ classPropertyName: "customTriggerLabelFn",
628
+ publicName: "customTriggerLabelFn",
629
+ isSignal: true,
630
+ isRequired: false,
631
+ transformFunction: null
632
+ },
633
+ triggerLabelSort: {
634
+ classPropertyName: "triggerLabelSort",
635
+ publicName: "triggerLabelSort",
636
+ isSignal: true,
637
+ isRequired: false,
638
+ transformFunction: null
639
+ },
640
+ customTriggerLabelTemplate: {
641
+ classPropertyName: "customTriggerLabelTemplate",
642
+ publicName: "customTriggerLabelTemplate",
643
+ isSignal: true,
644
+ isRequired: false,
645
+ transformFunction: null
646
+ },
647
+ canNull: {
648
+ classPropertyName: "canNull",
649
+ publicName: "canNull",
650
+ isSignal: true,
651
+ isRequired: false,
652
+ transformFunction: null
653
+ },
654
+ defaultSort: {
655
+ classPropertyName: "defaultSort",
656
+ publicName: "defaultSort",
657
+ isSignal: true,
658
+ isRequired: false,
659
+ transformFunction: null
660
+ },
661
+ resetOptionAction: {
662
+ classPropertyName: "resetOptionAction",
663
+ publicName: "resetOptionAction",
664
+ isSignal: true,
665
+ isRequired: false,
666
+ transformFunction: null
667
+ },
668
+ keyParam: {
669
+ classPropertyName: "keyParam",
670
+ publicName: "keyParam",
671
+ isSignal: true,
672
+ isRequired: false,
673
+ transformFunction: null
674
+ },
675
+ compareWith: {
676
+ classPropertyName: "compareWith",
677
+ publicName: "compareWith",
678
+ isSignal: true,
679
+ isRequired: false,
680
+ transformFunction: null
681
+ },
682
+ placeholder: {
683
+ classPropertyName: "placeholder",
684
+ publicName: "placeholder",
685
+ isSignal: false,
686
+ isRequired: false,
687
+ transformFunction: null
688
+ },
689
+ value: {
690
+ classPropertyName: "value",
691
+ publicName: "value",
692
+ isSignal: false,
693
+ isRequired: false,
694
+ transformFunction: null
695
+ },
696
+ required: {
697
+ classPropertyName: "required",
698
+ publicName: "required",
699
+ isSignal: false,
700
+ isRequired: false,
701
+ transformFunction: null
702
+ },
703
+ disabled: {
704
+ classPropertyName: "disabled",
705
+ publicName: "disabled",
706
+ isSignal: false,
707
+ isRequired: false,
708
+ transformFunction: null
709
+ }
710
+ },
711
+ outputs: { closed: "closed" },
712
+ host: {
713
+ listeners: { "document:click": "clickedOut()" },
714
+ properties: { "attr.id": "id" }
715
+ },
716
+ providers: [{
717
+ provide: MatFormFieldControl,
718
+ useExisting: CmatSelectTableComponent
719
+ }],
720
+ viewQueries: [
721
+ {
722
+ propertyName: "_matSelectSearch",
723
+ first: true,
724
+ predicate: CmatSelectSearchComponent,
725
+ descendants: true,
726
+ isSignal: true
727
+ },
728
+ {
729
+ propertyName: "_sort",
730
+ first: true,
731
+ predicate: MatSort,
732
+ descendants: true,
733
+ isSignal: true
734
+ },
735
+ {
736
+ propertyName: "_table",
737
+ first: true,
738
+ predicate: MatTable,
739
+ descendants: true,
740
+ isSignal: true
741
+ },
742
+ {
743
+ propertyName: "_matOptions",
744
+ predicate: MatOption,
745
+ descendants: true,
746
+ isSignal: true
747
+ },
748
+ {
749
+ propertyName: "_matSelectSignal",
750
+ first: true,
751
+ predicate: ["componentSelect"],
752
+ descendants: true,
753
+ isSignal: true
754
+ }
755
+ ],
756
+ exportAs: ["cmatSelectTable"],
757
+ usesOnChanges: true,
758
+ ngImport: i0,
759
+ template: "@if (multiple()) {\r\n<mat-select #componentSelect multiple disableRipple [placeholder]=\"placeholder\" [required]=\"required\"\r\n [formControl]=\"selectControl\" [compareWith]=\"compareWith()\" (focusin)=\"onFocusIn()\"\r\n (openedChange)=\"openedChange($event)\">\r\n <mat-select-trigger>{{ _triggerLabel() }}</mat-select-trigger>\r\n\r\n <div class=\"h-full overflow-y-auto scrollbar-custom\" [ngClass]=\"{ 'hidden-header': overallSearchVisibleState() }\"\r\n (focusout)=\"onFocusOut($event)\">\r\n @if (overallSearchEnabled()) {\r\n <mat-option [ngClass]=\"{ hidden: !overallSearchVisibleState() === true }\">\r\n <cmat-select-search \r\n [showNoFoundLabel]=\"showNoFoundLabel()\" \r\n [noEntriesFoundLabel]=\"noEntriesFoundLabel()\"\r\n [formControl]=\"overallFilterControl\" \r\n [clearSearchInput]=\"resetFiltersOnOpen()??false\">\r\n </cmat-select-search>\r\n </mat-option>\r\n\r\n @if (!isPhone()) {\r\n <div class=\"overall-search-toggle\" [ngStyle]=\"{\r\n height: overallSearchVisibleState() ? '48px' : '55.4px',\r\n }\">\r\n <mat-icon color=\"primary\" [svgIcon]=\"\r\n overallSearchVisibleState()\r\n ? 'mat_outline:arrow_back'\r\n : 'mat_outline:search'\r\n \" (click)=\"toggleOverallSearch()\">\r\n </mat-icon>\r\n </div>\r\n }\r\n }\r\n <table #table mat-table matSort [dataSource]=\"tableDataSource()\">\r\n @for (columnKey of tableColumns(); track $index) {\r\n @let column = tableColumnsMap.get(columnKey);\r\n @switch (columnKey) {\r\n @case (\"_selection\") {\r\n <ng-container [matColumnDef]=\"columnKey\">\r\n <th *matHeaderCellDef mat-header-cell [ngClass]=\"{ selection: true, hidden: !multiple() }\"></th>\r\n <td *matCellDef=\"let row\" mat-cell [ngClass]=\"{ selection: true, hidden: !multiple() }\">\r\n <mat-option [value]=\"row\"></mat-option>\r\n </td>\r\n </ng-container>\r\n }\r\n @default {\r\n <ng-container [matColumnDef]=\"columnKey\">\r\n <th *matHeaderCellDef mat-header-cell mat-sort-header [disabled]=\"!column?.sortable\">\r\n @if (!column?.sortable) {\r\n <div>{{ column?.name }}</div>\r\n } @else {\r\n @switch (column?.filter.type) {\r\n @case (\"string\") {\r\n <ng-container [ngTemplateOutlet]=\"filterTypeString\"\r\n [ngTemplateOutletContext]=\"getFilterContext(column)\"></ng-container>\r\n }\r\n @case (\"number\") {\r\n <ng-container [ngTemplateOutlet]=\"filterTypeNumber\"\r\n [ngTemplateOutletContext]=\"getFilterContext(column)\"></ng-container>\r\n }\r\n @default {\r\n <div>{{ column?.name }}</div>\r\n }\r\n }\r\n }\r\n </th>\r\n <td *matCellDef=\"let row\" mat-cell>\r\n <div class=\"has-label-on-mobile\" [attr.data-label]=\"column?.name + ':'\">\r\n {{ getCellValue(row, columnKey) }}\r\n </div>\r\n </td>\r\n </ng-container>\r\n }\r\n }\r\n }\r\n \r\n <tr *matHeaderRowDef=\"tableColumns(); sticky: true\" mat-header-row></tr>\r\n <tr *matRowDef=\"let row; columns: tableColumns()\" mat-row (click)=\"emulateMatOptionClick($event)\"></tr>\r\n </table>\r\n </div>\r\n</mat-select>\r\n} @else {\r\n<mat-select #componentSelect disableRipple [placeholder]=\"placeholder\" [required]=\"required\"\r\n [formControl]=\"selectControl\" [compareWith]=\"compareWith()\" (focusin)=\"onFocusIn()\"\r\n (openedChange)=\"openedChange($event)\">\r\n <mat-select-trigger>{{ _triggerLabel() }}</mat-select-trigger>\r\n\r\n <div class=\"h-full overflow-y-auto scrollbar-custom\" [ngClass]=\"{ 'hidden-header': overallSearchVisibleState() }\"\r\n (focusout)=\"onFocusOut($event)\">\r\n @if (overallSearchEnabled()) {\r\n <mat-option [ngClass]=\"{ hidden: !overallSearchVisibleState() === true }\">\r\n <cmat-select-search [showNoFoundLabel]=\"showNoFoundLabel()\" [noEntriesFoundLabel]=\"noEntriesFoundLabel()\"\r\n [formControl]=\"overallFilterControl\" [clearSearchInput]=\"resetFiltersOnOpen()??false\">\r\n </cmat-select-search>\r\n </mat-option>\r\n\r\n @if (!isPhone()) {\r\n <div class=\"overall-search-toggle\" [ngStyle]=\"{\r\n height: overallSearchVisibleState() ? '48px' : '55.4px',\r\n }\">\r\n <mat-icon color=\"primary\" [svgIcon]=\"\r\n overallSearchVisibleState()\r\n ? 'mat_outline:arrow_back'\r\n : 'mat_outline:search'\r\n \" (click)=\"toggleOverallSearch()\">\r\n </mat-icon>\r\n </div>\r\n }\r\n }\r\n <table #table mat-table matSort [dataSource]=\"tableDataSource()\">\r\n @for (columnKey of tableColumns(); track $index) {\r\n @let column = tableColumnsMap.get(columnKey);\r\n @switch (columnKey) {\r\n @case (\"_selection\") {\r\n <ng-container [matColumnDef]=\"columnKey\">\r\n <th *matHeaderCellDef mat-header-cell class=\"selection\"></th>\r\n <td *matCellDef=\"let row\" mat-cell class=\"selection\">\r\n @if (row.id === null) {\r\n <mat-option></mat-option>\r\n } @else {\r\n <mat-option [value]=\"row\"></mat-option>\r\n }\r\n </td>\r\n </ng-container>\r\n }\r\n @default {\r\n <ng-container [matColumnDef]=\"columnKey\">\r\n <th *matHeaderCellDef mat-header-cell mat-sort-header [disabled]=\"!column?.sortable\">\r\n @if (!column?.sortable) {\r\n <div>{{ column?.name }}</div>\r\n } @else {\r\n @switch (column?.filter.type) {\r\n @case (\"string\") {\r\n <ng-container [ngTemplateOutlet]=\"filterTypeString\"\r\n [ngTemplateOutletContext]=\"getFilterContext(column)\"></ng-container>\r\n }\r\n @case (\"number\") {\r\n <ng-container [ngTemplateOutlet]=\"filterTypeNumber\"\r\n [ngTemplateOutletContext]=\"getFilterContext(column)\"></ng-container>\r\n }\r\n @default {\r\n <div>{{ column?.name }}</div>\r\n }\r\n }\r\n }\r\n </th>\r\n <td *matCellDef=\"let row\" mat-cell [colSpan]=\"\r\n hasNullRow && row.id === null && $index === 1\r\n ? tableColumns().length\r\n : 1\r\n \" [ngStyle]=\"{\r\n display:\r\n hasNullRow && row.id === null && $index !== 1\r\n ? 'none'\r\n : '',\r\n }\">\r\n <div class=\"has-label-on-mobile\" [attr.data-label]=\"column?.name + ':'\">\r\n {{\r\n hasNullRow && row.id === null && $index === 1\r\n ? \"空\"\r\n : getCellValue(row, columnKey)\r\n }}\r\n </div>\r\n </td>\r\n </ng-container>\r\n }\r\n }\r\n }\r\n\r\n <tr *matHeaderRowDef=\"tableColumns(); sticky: true\" mat-header-row></tr>\r\n <tr *matRowDef=\"let row; columns: tableColumns()\" mat-row (click)=\"emulateMatOptionClick($event)\"></tr>\r\n </table>\r\n </div>\r\n</mat-select>\r\n}\r\n<ng-template #filterTypeString let-column=\"column\">\r\n <mat-form-field appearance=\"fill\" class=\"filter\" (click)=\"$event.stopPropagation()\">\r\n <input matInput [formControl]=\"filterFormControl(column.key)\" [placeholder]=\"column.name\"\r\n (keydown)=\"$event.stopPropagation()\" (keyup)=\"$event.stopPropagation()\" (keypress)=\"$event.stopPropagation()\" />\r\n </mat-form-field>\r\n</ng-template>\r\n\r\n<ng-template #filterTypeNumber let-column=\"column\">\r\n <mat-form-field appearance=\"fill\" class=\"filter\" (click)=\"$event.stopPropagation()\">\r\n <input matInput cmatDigitOnly [min]=\"0\" [formControl]=\"filterFormControl(column.key)\" [placeholder]=\"column.name\"\r\n (keydown)=\"$event.stopPropagation()\" (keyup)=\"$event.stopPropagation()\" (keypress)=\"$event.stopPropagation()\" />\r\n </mat-form-field>\r\n</ng-template>",
760
+ styles: ["cmat-select-table{display:block;width:100%}.cmat-select-search-table-panel{min-width:max-content;max-width:100%;min-height:240px;padding-top:0!important}.cmat-select-search-table-panel .overall-search-toggle{z-index:102;display:flex;cursor:pointer;position:absolute;width:48px;height:48px;align-items:center;left:12px;top:0;pointer-events:auto}.cmat-select-search-table-panel .overall-search-toggle mat-icon{pointer-events:auto;-webkit-user-select:none;user-select:none}.cmat-select-search-table-panel .hidden-header table thead{display:none}.cmat-select-search-table-panel table{width:100%}.cmat-select-search-table-panel table tr{cursor:pointer;height:48px;max-height:48px}.cmat-select-search-table-panel table tr mat-option{height:48px;max-height:48px}.cmat-select-search-table-panel table tr td{-webkit-user-select:none;user-select:none;border-bottom:0!important;box-shadow:inset 0 -1px var(--cmat-border)}.cmat-select-search-table-panel table tr th .mat-sort-header-container{height:55px}.cmat-select-search-table-panel table tr th .mat-sort-header-container mat-form-field .mat-form-field-infix{width:initial}.cmat-select-search-table-panel table tr th[aria-sort] .mat-sort-header-arrow{opacity:1!important}.cmat-select-search-table-panel table tr td mat-option,.cmat-select-search-table-panel table tr th mat-option{background:transparent!important}.cmat-select-search-table-panel table tr td.selection,.cmat-select-search-table-panel table tr th.selection{width:48px;padding:0;margin:0}.cmat-select-search-table-panel table tr:has(td:first-child mat-option[aria-selected=true]){background-color:var(--mat-option-hover-state-layer-color, color-mix(in srgb, var(--mat-sys-on-surface) calc(var(--mat-sys-hover-state-layer-opacity) * 100%), transparent))!important;color:rgba(var(--cmat-primary-rgb),1)!important}.cmat-select-search-table-panel .cmat-select-search-inner>span{visibility:hidden}\n"],
761
+ dependencies: [
762
+ {
763
+ kind: "component",
764
+ type: CmatSelectSearchComponent,
765
+ selector: "cmat-select-search",
766
+ inputs: [
767
+ "placeholderLabel",
768
+ "type",
769
+ "noEntriesFoundLabel",
770
+ "showNoFoundLabel",
771
+ "clearSearchInput",
772
+ "searching",
773
+ "disableInitialFocus",
774
+ "enableClearOnEscapePressed",
775
+ "preventHomeEndKeyPropagation",
776
+ "disableScrollToActiveOnOptionsChanged",
777
+ "ariaLabel",
778
+ "showToggleAllCheckbox",
779
+ "toggleAllCheckboxChecked",
780
+ "toggleAllCheckboxIndeterminate",
781
+ "toggleAllCheckboxTooltipMessage",
782
+ "toggleAllCheckboxTooltipPosition",
783
+ "hideClearSearchButton",
784
+ "alwaysRestoreSelectedOptionsMulti",
785
+ "debounceTime",
786
+ "optionsCount"
787
+ ],
788
+ outputs: ["toggleAll"],
789
+ exportAs: ["cmatSelectSearch"]
790
+ },
791
+ {
792
+ kind: "ngmodule",
793
+ type: MatFormFieldModule
794
+ },
795
+ {
796
+ kind: "component",
797
+ type: i1.MatFormField,
798
+ selector: "mat-form-field",
799
+ inputs: [
800
+ "hideRequiredMarker",
801
+ "color",
802
+ "floatLabel",
803
+ "appearance",
804
+ "subscriptSizing",
805
+ "hintLabel"
806
+ ],
807
+ exportAs: ["matFormField"]
808
+ },
809
+ {
810
+ kind: "ngmodule",
811
+ type: MatSelectModule
812
+ },
813
+ {
814
+ kind: "component",
815
+ type: i2.MatSelect,
816
+ selector: "mat-select",
817
+ inputs: [
818
+ "aria-describedby",
819
+ "panelClass",
820
+ "disabled",
821
+ "disableRipple",
822
+ "tabIndex",
823
+ "hideSingleSelectionIndicator",
824
+ "placeholder",
825
+ "required",
826
+ "multiple",
827
+ "disableOptionCentering",
828
+ "compareWith",
829
+ "value",
830
+ "aria-label",
831
+ "aria-labelledby",
832
+ "errorStateMatcher",
833
+ "typeaheadDebounceInterval",
834
+ "sortComparator",
835
+ "id",
836
+ "panelWidth",
837
+ "canSelectNullableOptions"
838
+ ],
839
+ outputs: [
840
+ "openedChange",
841
+ "opened",
842
+ "closed",
843
+ "selectionChange",
844
+ "valueChange"
845
+ ],
846
+ exportAs: ["matSelect"]
847
+ },
848
+ {
849
+ kind: "directive",
850
+ type: i2.MatSelectTrigger,
851
+ selector: "mat-select-trigger"
852
+ },
853
+ {
854
+ kind: "component",
855
+ type: i2.MatOption,
856
+ selector: "mat-option",
857
+ inputs: [
858
+ "value",
859
+ "id",
860
+ "disabled"
861
+ ],
862
+ outputs: ["onSelectionChange"],
863
+ exportAs: ["matOption"]
864
+ },
865
+ {
866
+ kind: "ngmodule",
867
+ type: ReactiveFormsModule
868
+ },
869
+ {
870
+ kind: "directive",
871
+ type: i3.DefaultValueAccessor,
872
+ selector: "input:not([type=checkbox]):not([ngNoCva])[formControlName],textarea:not([ngNoCva])[formControlName],input:not([type=checkbox]):not([ngNoCva])[formControl],textarea:not([ngNoCva])[formControl],input:not([type=checkbox]):not([ngNoCva])[ngModel],textarea:not([ngNoCva])[ngModel],[ngDefaultControl]"
873
+ },
874
+ {
875
+ kind: "directive",
876
+ type: i3.NgControlStatus,
877
+ selector: "[formControlName],[ngModel],[formControl]"
878
+ },
879
+ {
880
+ kind: "directive",
881
+ type: i3.RequiredValidator,
882
+ selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]",
883
+ inputs: ["required"]
884
+ },
885
+ {
886
+ kind: "directive",
887
+ type: i3.FormControlDirective,
888
+ selector: "[formControl]",
889
+ inputs: [
890
+ "formControl",
891
+ "disabled",
892
+ "ngModel"
893
+ ],
894
+ outputs: ["ngModelChange"],
895
+ exportAs: ["ngForm"]
896
+ },
897
+ {
898
+ kind: "ngmodule",
899
+ type: CommonModule
900
+ },
901
+ {
902
+ kind: "directive",
903
+ type: i4.NgClass,
904
+ selector: "[ngClass]",
905
+ inputs: ["class", "ngClass"]
906
+ },
907
+ {
908
+ kind: "directive",
909
+ type: i4.NgTemplateOutlet,
910
+ selector: "[ngTemplateOutlet]",
911
+ inputs: [
912
+ "ngTemplateOutletContext",
913
+ "ngTemplateOutlet",
914
+ "ngTemplateOutletInjector"
915
+ ]
916
+ },
917
+ {
918
+ kind: "directive",
919
+ type: i4.NgStyle,
920
+ selector: "[ngStyle]",
921
+ inputs: ["ngStyle"]
922
+ },
923
+ {
924
+ kind: "ngmodule",
925
+ type: MatIconModule
926
+ },
927
+ {
928
+ kind: "component",
929
+ type: i5.MatIcon,
930
+ selector: "mat-icon",
931
+ inputs: [
932
+ "color",
933
+ "inline",
934
+ "svgIcon",
935
+ "fontSet",
936
+ "fontIcon"
937
+ ],
938
+ exportAs: ["matIcon"]
939
+ },
940
+ {
941
+ kind: "ngmodule",
942
+ type: MatTableModule
943
+ },
944
+ {
945
+ kind: "component",
946
+ type: i6.MatTable,
947
+ selector: "mat-table, table[mat-table]",
948
+ exportAs: ["matTable"]
949
+ },
950
+ {
951
+ kind: "directive",
952
+ type: i6.MatHeaderCellDef,
953
+ selector: "[matHeaderCellDef]"
954
+ },
955
+ {
956
+ kind: "directive",
957
+ type: i6.MatHeaderRowDef,
958
+ selector: "[matHeaderRowDef]",
959
+ inputs: ["matHeaderRowDef", "matHeaderRowDefSticky"]
960
+ },
961
+ {
962
+ kind: "directive",
963
+ type: i6.MatColumnDef,
964
+ selector: "[matColumnDef]",
965
+ inputs: ["matColumnDef"]
966
+ },
967
+ {
968
+ kind: "directive",
969
+ type: i6.MatCellDef,
970
+ selector: "[matCellDef]"
971
+ },
972
+ {
973
+ kind: "directive",
974
+ type: i6.MatRowDef,
975
+ selector: "[matRowDef]",
976
+ inputs: ["matRowDefColumns", "matRowDefWhen"]
977
+ },
978
+ {
979
+ kind: "directive",
980
+ type: i6.MatHeaderCell,
981
+ selector: "mat-header-cell, th[mat-header-cell]"
982
+ },
983
+ {
984
+ kind: "directive",
985
+ type: i6.MatCell,
986
+ selector: "mat-cell, td[mat-cell]"
987
+ },
988
+ {
989
+ kind: "component",
990
+ type: i6.MatHeaderRow,
991
+ selector: "mat-header-row, tr[mat-header-row]",
992
+ exportAs: ["matHeaderRow"]
993
+ },
994
+ {
995
+ kind: "component",
996
+ type: i6.MatRow,
997
+ selector: "mat-row, tr[mat-row]",
998
+ exportAs: ["matRow"]
999
+ },
1000
+ {
1001
+ kind: "ngmodule",
1002
+ type: MatInputModule
1003
+ },
1004
+ {
1005
+ kind: "directive",
1006
+ type: i7.MatInput,
1007
+ selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]",
1008
+ inputs: [
1009
+ "disabled",
1010
+ "id",
1011
+ "placeholder",
1012
+ "name",
1013
+ "required",
1014
+ "type",
1015
+ "errorStateMatcher",
1016
+ "aria-describedby",
1017
+ "value",
1018
+ "readonly",
1019
+ "disabledInteractive"
1020
+ ],
1021
+ exportAs: ["matInput"]
1022
+ },
1023
+ {
1024
+ kind: "ngmodule",
1025
+ type: MatSortModule
1026
+ },
1027
+ {
1028
+ kind: "directive",
1029
+ type: i8.MatSort,
1030
+ selector: "[matSort]",
1031
+ inputs: [
1032
+ "matSortActive",
1033
+ "matSortStart",
1034
+ "matSortDirection",
1035
+ "matSortDisableClear",
1036
+ "matSortDisabled"
1037
+ ],
1038
+ outputs: ["matSortChange"],
1039
+ exportAs: ["matSort"]
1040
+ },
1041
+ {
1042
+ kind: "component",
1043
+ type: i8.MatSortHeader,
1044
+ selector: "[mat-sort-header]",
1045
+ inputs: [
1046
+ "mat-sort-header",
1047
+ "arrowPosition",
1048
+ "start",
1049
+ "disabled",
1050
+ "sortActionDescription",
1051
+ "disableClear"
1052
+ ],
1053
+ exportAs: ["matSortHeader"]
1054
+ },
1055
+ {
1056
+ kind: "directive",
1057
+ type: CmatDigitOnlyDirective,
1058
+ selector: "[cmatDigitOnly]",
1059
+ inputs: [
1060
+ "decimal",
1061
+ "decimalSeparator",
1062
+ "allowNegatives",
1063
+ "allowPaste",
1064
+ "negativeSign",
1065
+ "min",
1066
+ "max",
1067
+ "pattern"
1068
+ ]
1069
+ }
1070
+ ],
1071
+ changeDetection: i0.ChangeDetectionStrategy.OnPush,
1072
+ encapsulation: i0.ViewEncapsulation.None
1073
+ });
1074
+ }
1075
+ };
1076
+ i0.ɵɵngDeclareClassMetadata({
1077
+ minVersion: "12.0.0",
1078
+ version: "22.2.3",
1079
+ ngImport: i0,
1080
+ type: CmatSelectTableComponent,
1081
+ decorators: [{
1082
+ type: Component,
1083
+ args: [{
1084
+ selector: "cmat-select-table",
1085
+ exportAs: "cmatSelectTable",
1086
+ changeDetection: ChangeDetectionStrategy.OnPush,
1087
+ encapsulation: ViewEncapsulation.None,
1088
+ providers: [{
1089
+ provide: MatFormFieldControl,
1090
+ useExisting: CmatSelectTableComponent
1091
+ }],
1092
+ imports: [
1093
+ CmatSelectSearchComponent,
1094
+ MatFormFieldModule,
1095
+ MatSelectModule,
1096
+ ReactiveFormsModule,
1097
+ CommonModule,
1098
+ MatIconModule,
1099
+ MatTableModule,
1100
+ MatInputModule,
1101
+ MatSortModule,
1102
+ CmatDigitOnlyDirective
1103
+ ],
1104
+ host: { "[attr.id]": "id" },
1105
+ template: "@if (multiple()) {\r\n<mat-select #componentSelect multiple disableRipple [placeholder]=\"placeholder\" [required]=\"required\"\r\n [formControl]=\"selectControl\" [compareWith]=\"compareWith()\" (focusin)=\"onFocusIn()\"\r\n (openedChange)=\"openedChange($event)\">\r\n <mat-select-trigger>{{ _triggerLabel() }}</mat-select-trigger>\r\n\r\n <div class=\"h-full overflow-y-auto scrollbar-custom\" [ngClass]=\"{ 'hidden-header': overallSearchVisibleState() }\"\r\n (focusout)=\"onFocusOut($event)\">\r\n @if (overallSearchEnabled()) {\r\n <mat-option [ngClass]=\"{ hidden: !overallSearchVisibleState() === true }\">\r\n <cmat-select-search \r\n [showNoFoundLabel]=\"showNoFoundLabel()\" \r\n [noEntriesFoundLabel]=\"noEntriesFoundLabel()\"\r\n [formControl]=\"overallFilterControl\" \r\n [clearSearchInput]=\"resetFiltersOnOpen()??false\">\r\n </cmat-select-search>\r\n </mat-option>\r\n\r\n @if (!isPhone()) {\r\n <div class=\"overall-search-toggle\" [ngStyle]=\"{\r\n height: overallSearchVisibleState() ? '48px' : '55.4px',\r\n }\">\r\n <mat-icon color=\"primary\" [svgIcon]=\"\r\n overallSearchVisibleState()\r\n ? 'mat_outline:arrow_back'\r\n : 'mat_outline:search'\r\n \" (click)=\"toggleOverallSearch()\">\r\n </mat-icon>\r\n </div>\r\n }\r\n }\r\n <table #table mat-table matSort [dataSource]=\"tableDataSource()\">\r\n @for (columnKey of tableColumns(); track $index) {\r\n @let column = tableColumnsMap.get(columnKey);\r\n @switch (columnKey) {\r\n @case (\"_selection\") {\r\n <ng-container [matColumnDef]=\"columnKey\">\r\n <th *matHeaderCellDef mat-header-cell [ngClass]=\"{ selection: true, hidden: !multiple() }\"></th>\r\n <td *matCellDef=\"let row\" mat-cell [ngClass]=\"{ selection: true, hidden: !multiple() }\">\r\n <mat-option [value]=\"row\"></mat-option>\r\n </td>\r\n </ng-container>\r\n }\r\n @default {\r\n <ng-container [matColumnDef]=\"columnKey\">\r\n <th *matHeaderCellDef mat-header-cell mat-sort-header [disabled]=\"!column?.sortable\">\r\n @if (!column?.sortable) {\r\n <div>{{ column?.name }}</div>\r\n } @else {\r\n @switch (column?.filter.type) {\r\n @case (\"string\") {\r\n <ng-container [ngTemplateOutlet]=\"filterTypeString\"\r\n [ngTemplateOutletContext]=\"getFilterContext(column)\"></ng-container>\r\n }\r\n @case (\"number\") {\r\n <ng-container [ngTemplateOutlet]=\"filterTypeNumber\"\r\n [ngTemplateOutletContext]=\"getFilterContext(column)\"></ng-container>\r\n }\r\n @default {\r\n <div>{{ column?.name }}</div>\r\n }\r\n }\r\n }\r\n </th>\r\n <td *matCellDef=\"let row\" mat-cell>\r\n <div class=\"has-label-on-mobile\" [attr.data-label]=\"column?.name + ':'\">\r\n {{ getCellValue(row, columnKey) }}\r\n </div>\r\n </td>\r\n </ng-container>\r\n }\r\n }\r\n }\r\n \r\n <tr *matHeaderRowDef=\"tableColumns(); sticky: true\" mat-header-row></tr>\r\n <tr *matRowDef=\"let row; columns: tableColumns()\" mat-row (click)=\"emulateMatOptionClick($event)\"></tr>\r\n </table>\r\n </div>\r\n</mat-select>\r\n} @else {\r\n<mat-select #componentSelect disableRipple [placeholder]=\"placeholder\" [required]=\"required\"\r\n [formControl]=\"selectControl\" [compareWith]=\"compareWith()\" (focusin)=\"onFocusIn()\"\r\n (openedChange)=\"openedChange($event)\">\r\n <mat-select-trigger>{{ _triggerLabel() }}</mat-select-trigger>\r\n\r\n <div class=\"h-full overflow-y-auto scrollbar-custom\" [ngClass]=\"{ 'hidden-header': overallSearchVisibleState() }\"\r\n (focusout)=\"onFocusOut($event)\">\r\n @if (overallSearchEnabled()) {\r\n <mat-option [ngClass]=\"{ hidden: !overallSearchVisibleState() === true }\">\r\n <cmat-select-search [showNoFoundLabel]=\"showNoFoundLabel()\" [noEntriesFoundLabel]=\"noEntriesFoundLabel()\"\r\n [formControl]=\"overallFilterControl\" [clearSearchInput]=\"resetFiltersOnOpen()??false\">\r\n </cmat-select-search>\r\n </mat-option>\r\n\r\n @if (!isPhone()) {\r\n <div class=\"overall-search-toggle\" [ngStyle]=\"{\r\n height: overallSearchVisibleState() ? '48px' : '55.4px',\r\n }\">\r\n <mat-icon color=\"primary\" [svgIcon]=\"\r\n overallSearchVisibleState()\r\n ? 'mat_outline:arrow_back'\r\n : 'mat_outline:search'\r\n \" (click)=\"toggleOverallSearch()\">\r\n </mat-icon>\r\n </div>\r\n }\r\n }\r\n <table #table mat-table matSort [dataSource]=\"tableDataSource()\">\r\n @for (columnKey of tableColumns(); track $index) {\r\n @let column = tableColumnsMap.get(columnKey);\r\n @switch (columnKey) {\r\n @case (\"_selection\") {\r\n <ng-container [matColumnDef]=\"columnKey\">\r\n <th *matHeaderCellDef mat-header-cell class=\"selection\"></th>\r\n <td *matCellDef=\"let row\" mat-cell class=\"selection\">\r\n @if (row.id === null) {\r\n <mat-option></mat-option>\r\n } @else {\r\n <mat-option [value]=\"row\"></mat-option>\r\n }\r\n </td>\r\n </ng-container>\r\n }\r\n @default {\r\n <ng-container [matColumnDef]=\"columnKey\">\r\n <th *matHeaderCellDef mat-header-cell mat-sort-header [disabled]=\"!column?.sortable\">\r\n @if (!column?.sortable) {\r\n <div>{{ column?.name }}</div>\r\n } @else {\r\n @switch (column?.filter.type) {\r\n @case (\"string\") {\r\n <ng-container [ngTemplateOutlet]=\"filterTypeString\"\r\n [ngTemplateOutletContext]=\"getFilterContext(column)\"></ng-container>\r\n }\r\n @case (\"number\") {\r\n <ng-container [ngTemplateOutlet]=\"filterTypeNumber\"\r\n [ngTemplateOutletContext]=\"getFilterContext(column)\"></ng-container>\r\n }\r\n @default {\r\n <div>{{ column?.name }}</div>\r\n }\r\n }\r\n }\r\n </th>\r\n <td *matCellDef=\"let row\" mat-cell [colSpan]=\"\r\n hasNullRow && row.id === null && $index === 1\r\n ? tableColumns().length\r\n : 1\r\n \" [ngStyle]=\"{\r\n display:\r\n hasNullRow && row.id === null && $index !== 1\r\n ? 'none'\r\n : '',\r\n }\">\r\n <div class=\"has-label-on-mobile\" [attr.data-label]=\"column?.name + ':'\">\r\n {{\r\n hasNullRow && row.id === null && $index === 1\r\n ? \"空\"\r\n : getCellValue(row, columnKey)\r\n }}\r\n </div>\r\n </td>\r\n </ng-container>\r\n }\r\n }\r\n }\r\n\r\n <tr *matHeaderRowDef=\"tableColumns(); sticky: true\" mat-header-row></tr>\r\n <tr *matRowDef=\"let row; columns: tableColumns()\" mat-row (click)=\"emulateMatOptionClick($event)\"></tr>\r\n </table>\r\n </div>\r\n</mat-select>\r\n}\r\n<ng-template #filterTypeString let-column=\"column\">\r\n <mat-form-field appearance=\"fill\" class=\"filter\" (click)=\"$event.stopPropagation()\">\r\n <input matInput [formControl]=\"filterFormControl(column.key)\" [placeholder]=\"column.name\"\r\n (keydown)=\"$event.stopPropagation()\" (keyup)=\"$event.stopPropagation()\" (keypress)=\"$event.stopPropagation()\" />\r\n </mat-form-field>\r\n</ng-template>\r\n\r\n<ng-template #filterTypeNumber let-column=\"column\">\r\n <mat-form-field appearance=\"fill\" class=\"filter\" (click)=\"$event.stopPropagation()\">\r\n <input matInput cmatDigitOnly [min]=\"0\" [formControl]=\"filterFormControl(column.key)\" [placeholder]=\"column.name\"\r\n (keydown)=\"$event.stopPropagation()\" (keyup)=\"$event.stopPropagation()\" (keypress)=\"$event.stopPropagation()\" />\r\n </mat-form-field>\r\n</ng-template>",
1106
+ styles: ["cmat-select-table{display:block;width:100%}.cmat-select-search-table-panel{min-width:max-content;max-width:100%;min-height:240px;padding-top:0!important}.cmat-select-search-table-panel .overall-search-toggle{z-index:102;display:flex;cursor:pointer;position:absolute;width:48px;height:48px;align-items:center;left:12px;top:0;pointer-events:auto}.cmat-select-search-table-panel .overall-search-toggle mat-icon{pointer-events:auto;-webkit-user-select:none;user-select:none}.cmat-select-search-table-panel .hidden-header table thead{display:none}.cmat-select-search-table-panel table{width:100%}.cmat-select-search-table-panel table tr{cursor:pointer;height:48px;max-height:48px}.cmat-select-search-table-panel table tr mat-option{height:48px;max-height:48px}.cmat-select-search-table-panel table tr td{-webkit-user-select:none;user-select:none;border-bottom:0!important;box-shadow:inset 0 -1px var(--cmat-border)}.cmat-select-search-table-panel table tr th .mat-sort-header-container{height:55px}.cmat-select-search-table-panel table tr th .mat-sort-header-container mat-form-field .mat-form-field-infix{width:initial}.cmat-select-search-table-panel table tr th[aria-sort] .mat-sort-header-arrow{opacity:1!important}.cmat-select-search-table-panel table tr td mat-option,.cmat-select-search-table-panel table tr th mat-option{background:transparent!important}.cmat-select-search-table-panel table tr td.selection,.cmat-select-search-table-panel table tr th.selection{width:48px;padding:0;margin:0}.cmat-select-search-table-panel table tr:has(td:first-child mat-option[aria-selected=true]){background-color:var(--mat-option-hover-state-layer-color, color-mix(in srgb, var(--mat-sys-on-surface) calc(var(--mat-sys-hover-state-layer-opacity) * 100%), transparent))!important;color:rgba(var(--cmat-primary-rgb),1)!important}.cmat-select-search-table-panel .cmat-select-search-inner>span{visibility:hidden}\n"]
1107
+ }]
1108
+ }],
1109
+ ctorParameters: () => [],
1110
+ propDecorators: {
1111
+ dataSource: [{
1112
+ type: i0.Input,
1113
+ args: [{
1114
+ isSignal: true,
1115
+ alias: "dataSource",
1116
+ required: false
1117
+ }]
1118
+ }],
1119
+ noEntriesFoundLabel: [{
1120
+ type: i0.Input,
1121
+ args: [{
1122
+ isSignal: true,
1123
+ alias: "noEntriesFoundLabel",
1124
+ required: false
1125
+ }]
1126
+ }],
1127
+ showNoFoundLabel: [{
1128
+ type: i0.Input,
1129
+ args: [{
1130
+ isSignal: true,
1131
+ alias: "showNoFoundLabel",
1132
+ required: false
1133
+ }]
1134
+ }],
1135
+ isPhone: [{
1136
+ type: i0.Input,
1137
+ args: [{
1138
+ isSignal: true,
1139
+ alias: "isPhone",
1140
+ required: false
1141
+ }]
1142
+ }],
1143
+ multiple: [{
1144
+ type: i0.Input,
1145
+ args: [{
1146
+ isSignal: true,
1147
+ alias: "multiple",
1148
+ required: false
1149
+ }]
1150
+ }],
1151
+ overallSearchEnabled: [{
1152
+ type: i0.Input,
1153
+ args: [{
1154
+ isSignal: true,
1155
+ alias: "overallSearchEnabled",
1156
+ required: false
1157
+ }]
1158
+ }],
1159
+ overallSearchVisible: [{
1160
+ type: i0.Input,
1161
+ args: [{
1162
+ isSignal: true,
1163
+ alias: "overallSearchVisible",
1164
+ required: false
1165
+ }]
1166
+ }],
1167
+ resetSortOnOpen: [{
1168
+ type: i0.Input,
1169
+ args: [{
1170
+ isSignal: true,
1171
+ alias: "resetSortOnOpen",
1172
+ required: false
1173
+ }]
1174
+ }],
1175
+ resetFiltersOnOpen: [{
1176
+ type: i0.Input,
1177
+ args: [{
1178
+ isSignal: true,
1179
+ alias: "resetFiltersOnOpen",
1180
+ required: false
1181
+ }]
1182
+ }],
1183
+ customTriggerLabelFn: [{
1184
+ type: i0.Input,
1185
+ args: [{
1186
+ isSignal: true,
1187
+ alias: "customTriggerLabelFn",
1188
+ required: false
1189
+ }]
1190
+ }],
1191
+ triggerLabelSort: [{
1192
+ type: i0.Input,
1193
+ args: [{
1194
+ isSignal: true,
1195
+ alias: "triggerLabelSort",
1196
+ required: false
1197
+ }]
1198
+ }],
1199
+ customTriggerLabelTemplate: [{
1200
+ type: i0.Input,
1201
+ args: [{
1202
+ isSignal: true,
1203
+ alias: "customTriggerLabelTemplate",
1204
+ required: false
1205
+ }]
1206
+ }],
1207
+ canNull: [{
1208
+ type: i0.Input,
1209
+ args: [{
1210
+ isSignal: true,
1211
+ alias: "canNull",
1212
+ required: false
1213
+ }]
1214
+ }],
1215
+ defaultSort: [{
1216
+ type: i0.Input,
1217
+ args: [{
1218
+ isSignal: true,
1219
+ alias: "defaultSort",
1220
+ required: false
1221
+ }]
1222
+ }],
1223
+ resetOptionAction: [{
1224
+ type: i0.Input,
1225
+ args: [{
1226
+ isSignal: true,
1227
+ alias: "resetOptionAction",
1228
+ required: false
1229
+ }]
1230
+ }],
1231
+ keyParam: [{
1232
+ type: i0.Input,
1233
+ args: [{
1234
+ isSignal: true,
1235
+ alias: "keyParam",
1236
+ required: false
1237
+ }]
1238
+ }],
1239
+ compareWith: [{
1240
+ type: i0.Input,
1241
+ args: [{
1242
+ isSignal: true,
1243
+ alias: "compareWith",
1244
+ required: false
1245
+ }]
1246
+ }],
1247
+ closed: [{
1248
+ type: i0.Output,
1249
+ args: ["closed"]
1250
+ }],
1251
+ _matSelectSearch: [{
1252
+ type: i0.ViewChild,
1253
+ args: [i0.forwardRef(() => CmatSelectSearchComponent), { isSignal: true }]
1254
+ }],
1255
+ _sort: [{
1256
+ type: i0.ViewChild,
1257
+ args: [i0.forwardRef(() => MatSort), { isSignal: true }]
1258
+ }],
1259
+ _table: [{
1260
+ type: i0.ViewChild,
1261
+ args: [i0.forwardRef(() => MatTable), { isSignal: true }]
1262
+ }],
1263
+ _matOptions: [{
1264
+ type: i0.ViewChildren,
1265
+ args: [i0.forwardRef(() => MatOption), { isSignal: true }]
1266
+ }],
1267
+ _matSelectSignal: [{
1268
+ type: i0.ViewChild,
1269
+ args: ["componentSelect", { isSignal: true }]
1270
+ }],
1271
+ clickedOut: [{
1272
+ type: HostListener,
1273
+ args: ["document:click"]
1274
+ }],
1275
+ placeholder: [{ type: Input }],
1276
+ value: [{ type: Input }],
1277
+ required: [{ type: Input }],
1278
+ disabled: [{ type: Input }]
1279
+ }
1280
+ });
844
1281
  export { CmatSelectTableComponent };
845
- //# sourceMappingURL=cmat-components-select-table.mjs.map
1282
+
1283
+ //# sourceMappingURL=cmat-components-select-table.mjs.map