cmat 0.0.111 → 0.0.113

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 +2761 -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 +1138 -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,337 +1,582 @@
1
- import { coerceBooleanProperty } from '@angular/cdk/coercion';
2
- import { ENTER, COMMA } from '@angular/cdk/keycodes';
3
- import * as i0 from '@angular/core';
4
- import { inject, input, signal, viewChild, DestroyRef, computed, Input, ChangeDetectionStrategy, ViewEncapsulation, Component } from '@angular/core';
5
- import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
6
- import * as i5 from '@angular/forms';
7
- import { NgControl, FormControl, ReactiveFormsModule } from '@angular/forms';
8
- import * as i3 from '@angular/material/autocomplete';
9
- import { MatAutocompleteModule } from '@angular/material/autocomplete';
10
- import * as i1 from '@angular/material/chips';
11
- import { MatChipsModule } from '@angular/material/chips';
12
- import { MatFormFieldControl } from '@angular/material/form-field';
13
- import * as i4 from '@angular/material/icon';
14
- import { MatIconModule } from '@angular/material/icon';
15
- import * as i2 from '@angular/material/input';
16
- import { MatInputModule } from '@angular/material/input';
17
- import { isNil, isArray, isEmpty } from 'lodash-es';
18
- import { Subject, filter } from 'rxjs';
19
-
20
- /* eslint-disable @typescript-eslint/member-ordering */
1
+ import { coerceBooleanProperty } from "@angular/cdk/coercion";
2
+ import { COMMA, ENTER } from "@angular/cdk/keycodes";
3
+ import * as i0 from "@angular/core";
4
+ import { ChangeDetectionStrategy, Component, DestroyRef, Input, ViewEncapsulation, computed, inject, input, signal, viewChild } from "@angular/core";
5
+ import { takeUntilDestroyed } from "@angular/core/rxjs-interop";
6
+ import * as i5 from "@angular/forms";
7
+ import { FormControl, NgControl, ReactiveFormsModule } from "@angular/forms";
8
+ import * as i3 from "@angular/material/autocomplete";
9
+ import { MatAutocompleteModule } from "@angular/material/autocomplete";
10
+ import * as i1 from "@angular/material/chips";
11
+ import { MatChipsModule } from "@angular/material/chips";
12
+ import { MatFormFieldControl } from "@angular/material/form-field";
13
+ import * as i4 from "@angular/material/icon";
14
+ import { MatIconModule } from "@angular/material/icon";
15
+ import * as i2 from "@angular/material/input";
16
+ import { MatInputModule } from "@angular/material/input";
17
+ import { isArray, isEmpty, isNil } from "lodash-es";
18
+ import { Subject, filter } from "rxjs";
21
19
  let NEXT_ID = 0;
22
- class CmatChipInputComponent {
23
- constructor() {
24
- this.id = `cmat-chip-input-${NEXT_ID++}`;
25
- this.ngControl = inject(NgControl, { optional: true, self: true });
26
- this.selectableOptions = input(/* @ts-ignore */
27
- ...(ngDevMode ? [undefined, { debugName: "selectableOptions" }] : /* istanbul ignore next */ []));
28
- this.hasAutocomplete = input(false, /* @ts-ignore */
29
- ...(ngDevMode ? [{ debugName: "hasAutocomplete" }] : /* istanbul ignore next */ []));
30
- this.outputIsString = input(false, /* @ts-ignore */
31
- ...(ngDevMode ? [{ debugName: "outputIsString" }] : /* istanbul ignore next */ []));
32
- this.separatorKey = input(',', /* @ts-ignore */
33
- ...(ngDevMode ? [{ debugName: "separatorKey" }] : /* istanbul ignore next */ []));
34
- this.inputControl = new FormControl(null);
35
- this.separatorKeysCodes = [ENTER, COMMA];
36
- this.controlType = 'cmat-chip-input';
37
- this.autocompleteOptionActive = signal(false, /* @ts-ignore */
38
- ...(ngDevMode ? [{ debugName: "autocompleteOptionActive" }] : /* istanbul ignore next */ []));
39
- this._inputValueSignal = signal(null, /* @ts-ignore */
40
- ...(ngDevMode ? [{ debugName: "_inputValueSignal" }] : /* istanbul ignore next */ []));
41
- this.stateChanges = new Subject();
42
- this._focused = signal(false, /* @ts-ignore */
43
- ...(ngDevMode ? [{ debugName: "_focused" }] : /* istanbul ignore next */ []));
44
- this._touched = signal(false, /* @ts-ignore */
45
- ...(ngDevMode ? [{ debugName: "_touched" }] : /* istanbul ignore next */ []));
46
- this._placeholderSignal = signal('', /* @ts-ignore */
47
- ...(ngDevMode ? [{ debugName: "_placeholderSignal" }] : /* istanbul ignore next */ []));
48
- this._disabledSignal = signal(false, /* @ts-ignore */
49
- ...(ngDevMode ? [{ debugName: "_disabledSignal" }] : /* istanbul ignore next */ []));
50
- this._requiredSignal = signal(false, /* @ts-ignore */
51
- ...(ngDevMode ? [{ debugName: "_requiredSignal" }] : /* istanbul ignore next */ []));
52
- this._valueSignal = signal(null, /* @ts-ignore */
53
- ...(ngDevMode ? [{ debugName: "_valueSignal" }] : /* istanbul ignore next */ []));
54
- this.selectedOptions = signal([], /* @ts-ignore */
55
- ...(ngDevMode ? [{ debugName: "selectedOptions" }] : /* istanbul ignore next */ []));
56
- this._inputElementRef = viewChild('input', /* @ts-ignore */
57
- ...(ngDevMode ? [{ debugName: "_inputElementRef" }] : /* istanbul ignore next */ []));
58
- this._autoTrigger = viewChild('autoTrigger', /* @ts-ignore */
59
- ...(ngDevMode ? [{ debugName: "_autoTrigger" }] : /* istanbul ignore next */ []));
60
- this._suppressPanelOpen = false;
61
- this._maxFilteredItems = 50;
62
- this._destroyRef = inject(DestroyRef);
63
- this.filteredOptions = computed(() => {
64
- if (!this.hasAutocomplete()) {
65
- return null;
66
- }
67
- // 使用 Signal 追踪输入框的值变化
68
- const currentValue = this._inputValueSignal() ?? '';
69
- // 如果值为空,显示所有未选中的选项
70
- const selectable = currentValue
71
- ? this._filter(currentValue)
72
- : this.selectableOptions()?.slice() ?? [];
73
- const notSelected = selectable.filter(option => !this.selectedOptions().includes(option));
74
- return notSelected.slice(0, this._maxFilteredItems);
75
- }, /* @ts-ignore */
76
- ...(ngDevMode ? [{ debugName: "filteredOptions" }] : /* istanbul ignore next */ []));
77
- this._onModelChange = () => { };
78
- this._onTouchedChange = () => { };
79
- if (this.ngControl != null) {
80
- this.ngControl.valueAccessor = this;
81
- }
82
- // 同步输入框的值到 Signal,确保 computed 能立即响应
83
- this.inputControl.valueChanges.pipe(takeUntilDestroyed(this._destroyRef)).subscribe((value) => {
84
- this._inputValueSignal.set(value ?? null);
85
- });
86
- // 监听输入框变化,当值变为空且处于焦点状态时,强制打开面板
87
- this.inputControl.valueChanges.pipe(takeUntilDestroyed(this._destroyRef), filter(value => this.hasAutocomplete() && this._focused() && (value === '' || value === null))).subscribe(() => {
88
- setTimeout(() => {
89
- this._autoTrigger()?.openPanel();
90
- });
91
- });
92
- }
93
- ngOnDestroy() {
94
- this.stateChanges.complete();
95
- }
96
- get focused() {
97
- return this._focused();
98
- }
99
- get touched() {
100
- return this._touched();
101
- }
102
- get placeholder() {
103
- return this._placeholderSignal();
104
- }
105
- set placeholder(value) {
106
- this._placeholderSignal.set(value);
107
- this.stateChanges.next();
108
- }
109
- get value() {
110
- return this._valueSignal();
111
- }
112
- set value(value) {
113
- if (value !== this._valueSignal()) {
114
- this._valueSignal.set(value);
115
- this.stateChanges.next();
116
- this._onModelChange(value);
117
- }
118
- }
119
- get empty() {
120
- const val = this._valueSignal();
121
- if (isNil(val))
122
- return true;
123
- if (Array.isArray(val))
124
- return val.length === 0;
125
- return val === '';
126
- }
127
- get errorState() {
128
- if (this.ngControl == null)
129
- return false;
130
- return (this._touched() && this.ngControl?.invalid) ?? false;
131
- }
132
- get shouldLabelFloat() {
133
- return this._focused() || !this.empty;
134
- }
135
- get required() {
136
- return this._requiredSignal();
137
- }
138
- set required(value) {
139
- this._requiredSignal.set(coerceBooleanProperty(value));
140
- this.stateChanges.next();
141
- }
142
- get disabled() {
143
- if (!isNil(this.ngControl?.disabled)) {
144
- return this.ngControl.disabled;
145
- }
146
- return this._disabledSignal();
147
- }
148
- set disabled(value) {
149
- const isDisabled = coerceBooleanProperty(value);
150
- this._disabledSignal.set(isDisabled);
151
- if (isDisabled || this.ngControl?.disabled) {
152
- this.inputControl.disable();
153
- }
154
- else {
155
- this.inputControl.enable();
156
- }
157
- if (this._focused() && isDisabled) {
158
- this._focused.set(false);
159
- this.stateChanges.next();
160
- }
161
- }
162
- registerOnChange(fn) {
163
- this._onModelChange = fn;
164
- }
165
- registerOnTouched(fn) {
166
- this._onTouchedChange = fn;
167
- }
168
- writeValue(value) {
169
- let options = [];
170
- if (isArray(value)) {
171
- options = value;
172
- }
173
- else if (!isNil(value) && !isEmpty(value)) {
174
- options = (value).split(this.separatorKey())
175
- .map(v => v.trim())
176
- .filter(v => v);
177
- }
178
- options = Array.from(new Set(options));
179
- this.selectedOptions.set(options);
180
- const finalValue = this.outputIsString() ? options.join(this.separatorKey()) : options;
181
- if (this._valueSignal() !== finalValue) {
182
- this._valueSignal.set(finalValue);
183
- this.stateChanges.next();
184
- }
185
- this.inputControl.setValue(null);
186
- }
187
- setDisabledState(isDisabled) {
188
- this.disabled = isDisabled;
189
- }
190
- setDescribedByIds(ids) {
191
- if (ids.length) {
192
- this._inputElementRef()?.nativeElement.setAttribute('aria-describedby', ids.join(' '));
193
- }
194
- else {
195
- this._inputElementRef()?.nativeElement.removeAttribute('aria-describedby');
196
- }
197
- }
198
- onContainerClick() {
199
- if (!this._focused()) {
200
- this._inputElementRef()?.nativeElement.focus();
201
- }
202
- }
203
- onAdd(event) {
204
- if (this.autocompleteOptionActive()) {
205
- return;
206
- }
207
- const value = (event.value || '').trim();
208
- if (value) {
209
- const isSelectable = !this.hasAutocomplete() || this.selectableOptions()?.includes(value);
210
- if (isSelectable && !this.selectedOptions().includes(value)) {
211
- const newValue = [...this.selectedOptions(), value];
212
- this._updateValue(newValue);
213
- }
214
- }
215
- event.chipInput.clear();
216
- this.inputControl.setValue(null);
217
- }
218
- onRemove(option) {
219
- const index = this.selectedOptions().findIndex((i) => i === option);
220
- if (index >= 0) {
221
- const newOptions = [...this.selectedOptions()];
222
- newOptions.splice(index, 1);
223
- this._updateValue(newOptions);
224
- this._suppressPanelOpen = true;
225
- setTimeout(() => {
226
- this._suppressPanelOpen = false;
227
- }, 150);
228
- this._inputElementRef()?.nativeElement.focus();
229
- }
230
- }
231
- onSelected(event) {
232
- const selectedValue = event.option.viewValue;
233
- if (!this.selectedOptions().includes(selectedValue)) {
234
- const newValue = [...this.selectedOptions(), selectedValue];
235
- this._updateValue(newValue);
236
- }
237
- // 先关闭面板,再设置抑制标志位
238
- this._autoTrigger()?.closePanel();
239
- // 正常设置值,让 valueChanges 触发
240
- this.inputControl.setValue(null);
241
- // 立即同步更新 Signal,避免异步延迟
242
- this._inputValueSignal.set(null);
243
- this.autocompleteOptionActive.set(false);
244
- // 设置抑制标志位,防止选择后面板重新打开
245
- this._suppressPanelOpen = true;
246
- // 延迟重置标志位,确保焦点事件处理完成
247
- setTimeout(() => {
248
- this._suppressPanelOpen = false;
249
- }, 100);
250
- }
251
- onFocusIn(event) {
252
- if (!this.focused) {
253
- this._focused.set(true);
254
- this.stateChanges.next();
255
- if (this.hasAutocomplete() && !this._suppressPanelOpen) {
256
- // 检查焦点来源,如果是来自 chip 的点击,不打开面板
257
- const target = event?.target;
258
- if (target?.closest('mat-chip-row')) {
259
- return;
260
- }
261
- setTimeout(() => {
262
- if (!this._suppressPanelOpen) {
263
- this._autoTrigger()?.openPanel();
264
- }
265
- }, 50);
266
- }
267
- }
268
- }
269
- onFocusOut(event) {
270
- const containerEl = this._inputElementRef()?.nativeElement;
271
- if (containerEl && !containerEl.contains(event.relatedTarget)) {
272
- this._touched.set(true);
273
- this._focused.set(false);
274
- this._onTouchedChange();
275
- this.stateChanges.next();
276
- // 失去焦点时,如果启用了自动完成,延迟关闭面板以确保选择操作完成
277
- if (this.hasAutocomplete()) {
278
- setTimeout(() => {
279
- // 再次检查是否仍然处于失焦状态,避免误关
280
- if (!this._focused()) {
281
- this._autoTrigger()?.closePanel();
282
- }
283
- }, 150);
284
- }
285
- }
286
- }
287
- onActivated(event) {
288
- this.autocompleteOptionActive.set(event.option != null);
289
- }
290
- _updateValue(newOptions) {
291
- this.selectedOptions.set(newOptions);
292
- if (this.outputIsString()) {
293
- this.value = newOptions.join(this.separatorKey());
294
- }
295
- else {
296
- this.value = newOptions;
297
- }
298
- }
299
- _filter(value) {
300
- const filterValue = value.toLowerCase();
301
- return this.selectableOptions()?.filter(v => v.toLowerCase().includes(filterValue)) ?? [];
302
- }
303
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.0", ngImport: i0, type: CmatChipInputComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
304
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.2.0", type: CmatChipInputComponent, isStandalone: true, selector: "cmat-chip-input", inputs: { selectableOptions: { classPropertyName: "selectableOptions", publicName: "selectableOptions", isSignal: true, isRequired: false, transformFunction: null }, hasAutocomplete: { classPropertyName: "hasAutocomplete", publicName: "hasAutocomplete", isSignal: true, isRequired: false, transformFunction: null }, outputIsString: { classPropertyName: "outputIsString", publicName: "outputIsString", isSignal: true, isRequired: false, transformFunction: null }, separatorKey: { classPropertyName: "separatorKey", publicName: "separatorKey", 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 } }, host: { properties: { "attr.id": "id" } }, providers: [
305
- { provide: MatFormFieldControl, useExisting: CmatChipInputComponent },
306
- ], viewQueries: [{ propertyName: "_inputElementRef", first: true, predicate: ["input"], descendants: true, isSignal: true }, { propertyName: "_autoTrigger", first: true, predicate: ["autoTrigger"], descendants: true, isSignal: true }], exportAs: ["cmatChipInput"], ngImport: i0, template: "<mat-chip-grid #chipList class=\"items-center\" (focusin)=\"onFocusIn($event)\" (focusout)=\"onFocusOut($event)\">\r\n @for (option of selectedOptions(); track option) {\r\n <mat-chip-row (removed)=\"onRemove(option)\" (click)=\"$event.stopPropagation()\">\r\n {{ option }}\r\n <button matChipRemove class=\"print:hidden\" (click)=\"$event.stopPropagation()\">\r\n <mat-icon class=\"icon-size-5\" [svgIcon]=\"'mat_solid:cancel'\"></mat-icon>\r\n </button>\r\n </mat-chip-row>\r\n }\r\n\r\n @if (hasAutocomplete()) {\r\n <input #input #autoTrigger=\"matAutocompleteTrigger\" matInput [formControl]=\"inputControl\" [placeholder]=\"placeholder?placeholder:'\u5F00\u59CB\u9009\u62E9...'\"\r\n [matAutocomplete]=\"autoComplete\" [required]=\"required\" [matChipInputFor]=\"chipList\"\r\n [matChipInputSeparatorKeyCodes]=\"separatorKeysCodes\" (matChipInputTokenEnd)=\"onAdd($event)\" />\r\n <mat-autocomplete #autoComplete=\"matAutocomplete\" (optionSelected)=\"onSelected($event)\"\r\n (optionActivated)=\"onActivated($event)\">\r\n @for (option of filteredOptions(); track option) {\r\n <mat-option [value]=\"option\">\r\n {{ option }}\r\n </mat-option>\r\n }\r\n </mat-autocomplete>\r\n } @else {\r\n <input #input [formControl]=\"inputControl\" [placeholder]=\"placeholder?placeholder:'\u5F00\u59CB\u586B\u5199...'\" [matChipInputFor]=\"chipList\"\r\n [required]=\"required\" [matChipInputSeparatorKeyCodes]=\"separatorKeysCodes\" (matChipInputTokenEnd)=\"onAdd($event)\" />\r\n }\r\n</mat-chip-grid>", dependencies: [{ kind: "ngmodule", type: MatChipsModule }, { kind: "component", type: i1.MatChipGrid, selector: "mat-chip-grid", inputs: ["disabled", "placeholder", "required", "value", "errorStateMatcher"], outputs: ["change", "valueChange"] }, { kind: "directive", type: i1.MatChipInput, selector: "input[matChipInputFor]", inputs: ["matChipInputFor", "matChipInputAddOnBlur", "matChipInputSeparatorKeyCodes", "placeholder", "id", "disabled", "readonly", "matChipInputDisabledInteractive"], outputs: ["matChipInputTokenEnd"], exportAs: ["matChipInput", "matChipInputFor"] }, { kind: "directive", type: i1.MatChipRemove, selector: "[matChipRemove]" }, { kind: "component", type: i1.MatChipRow, selector: "mat-chip-row, [mat-chip-row], mat-basic-chip-row, [mat-basic-chip-row]", inputs: ["editable"], outputs: ["edited"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i2.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: MatAutocompleteModule }, { kind: "component", type: i3.MatAutocomplete, selector: "mat-autocomplete", inputs: ["aria-label", "aria-labelledby", "displayWith", "autoActiveFirstOption", "autoSelectActiveOption", "requireSelection", "panelWidth", "disableRipple", "class", "hideSingleSelectionIndicator"], outputs: ["optionSelected", "opened", "closed", "optionActivated"], exportAs: ["matAutocomplete"] }, { kind: "component", type: i3.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "directive", type: i3.MatAutocompleteTrigger, selector: "input[matAutocomplete], textarea[matAutocomplete]", inputs: ["matAutocomplete", "matAutocompletePosition", "matAutocompleteConnectedTo", "autocomplete", "matAutocompleteDisabled"], exportAs: ["matAutocompleteTrigger"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i4.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i5.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: i5.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i5.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i5.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
307
- }
308
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.0", ngImport: i0, type: CmatChipInputComponent, decorators: [{
309
- type: Component,
310
- args: [{ selector: 'cmat-chip-input', providers: [
311
- { provide: MatFormFieldControl, useExisting: CmatChipInputComponent },
312
- ], exportAs: 'cmatChipInput', imports: [
313
- MatChipsModule,
314
- MatInputModule,
315
- MatAutocompleteModule,
316
- MatIconModule,
317
- ReactiveFormsModule,
318
- ], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, host: {
319
- // eslint-disable-next-line @typescript-eslint/naming-convention
320
- '[attr.id]': 'id',
321
- }, template: "<mat-chip-grid #chipList class=\"items-center\" (focusin)=\"onFocusIn($event)\" (focusout)=\"onFocusOut($event)\">\r\n @for (option of selectedOptions(); track option) {\r\n <mat-chip-row (removed)=\"onRemove(option)\" (click)=\"$event.stopPropagation()\">\r\n {{ option }}\r\n <button matChipRemove class=\"print:hidden\" (click)=\"$event.stopPropagation()\">\r\n <mat-icon class=\"icon-size-5\" [svgIcon]=\"'mat_solid:cancel'\"></mat-icon>\r\n </button>\r\n </mat-chip-row>\r\n }\r\n\r\n @if (hasAutocomplete()) {\r\n <input #input #autoTrigger=\"matAutocompleteTrigger\" matInput [formControl]=\"inputControl\" [placeholder]=\"placeholder?placeholder:'\u5F00\u59CB\u9009\u62E9...'\"\r\n [matAutocomplete]=\"autoComplete\" [required]=\"required\" [matChipInputFor]=\"chipList\"\r\n [matChipInputSeparatorKeyCodes]=\"separatorKeysCodes\" (matChipInputTokenEnd)=\"onAdd($event)\" />\r\n <mat-autocomplete #autoComplete=\"matAutocomplete\" (optionSelected)=\"onSelected($event)\"\r\n (optionActivated)=\"onActivated($event)\">\r\n @for (option of filteredOptions(); track option) {\r\n <mat-option [value]=\"option\">\r\n {{ option }}\r\n </mat-option>\r\n }\r\n </mat-autocomplete>\r\n } @else {\r\n <input #input [formControl]=\"inputControl\" [placeholder]=\"placeholder?placeholder:'\u5F00\u59CB\u586B\u5199...'\" [matChipInputFor]=\"chipList\"\r\n [required]=\"required\" [matChipInputSeparatorKeyCodes]=\"separatorKeysCodes\" (matChipInputTokenEnd)=\"onAdd($event)\" />\r\n }\r\n</mat-chip-grid>" }]
322
- }], ctorParameters: () => [], propDecorators: { selectableOptions: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectableOptions", required: false }] }], hasAutocomplete: [{ type: i0.Input, args: [{ isSignal: true, alias: "hasAutocomplete", required: false }] }], outputIsString: [{ type: i0.Input, args: [{ isSignal: true, alias: "outputIsString", required: false }] }], separatorKey: [{ type: i0.Input, args: [{ isSignal: true, alias: "separatorKey", required: false }] }], _inputElementRef: [{ type: i0.ViewChild, args: ['input', { isSignal: true }] }], _autoTrigger: [{ type: i0.ViewChild, args: ['autoTrigger', { isSignal: true }] }], placeholder: [{
323
- type: Input
324
- }], value: [{
325
- type: Input
326
- }], required: [{
327
- type: Input
328
- }], disabled: [{
329
- type: Input
330
- }] } });
331
-
332
- /**
333
- * Generated bundle index. Do not edit.
334
- */
335
-
20
+ var CmatChipInputComponent = class CmatChipInputComponent {
21
+ constructor() {
22
+ this.id = `cmat-chip-input-${NEXT_ID++}`;
23
+ this.ngControl = inject(NgControl, {
24
+ optional: true,
25
+ self: true
26
+ });
27
+ this.selectableOptions = input(...ngDevMode ? [void 0, { debugName: "selectableOptions" }] : /* istanbul ignore next */ []);
28
+ this.hasAutocomplete = input(false, ...ngDevMode ? [{ debugName: "hasAutocomplete" }] : /* istanbul ignore next */ []);
29
+ this.outputIsString = input(false, ...ngDevMode ? [{ debugName: "outputIsString" }] : /* istanbul ignore next */ []);
30
+ this.separatorKey = input(",", ...ngDevMode ? [{ debugName: "separatorKey" }] : /* istanbul ignore next */ []);
31
+ this.inputControl = new FormControl(null);
32
+ this.separatorKeysCodes = [ENTER, COMMA];
33
+ this.controlType = "cmat-chip-input";
34
+ this.autocompleteOptionActive = signal(false, ...ngDevMode ? [{ debugName: "autocompleteOptionActive" }] : /* istanbul ignore next */ []);
35
+ this._inputValueSignal = signal(null, ...ngDevMode ? [{ debugName: "_inputValueSignal" }] : /* istanbul ignore next */ []);
36
+ this.stateChanges = new Subject();
37
+ this._focused = signal(false, ...ngDevMode ? [{ debugName: "_focused" }] : /* istanbul ignore next */ []);
38
+ this._touched = signal(false, ...ngDevMode ? [{ debugName: "_touched" }] : /* istanbul ignore next */ []);
39
+ this._placeholderSignal = signal("", ...ngDevMode ? [{ debugName: "_placeholderSignal" }] : /* istanbul ignore next */ []);
40
+ this._disabledSignal = signal(false, ...ngDevMode ? [{ debugName: "_disabledSignal" }] : /* istanbul ignore next */ []);
41
+ this._requiredSignal = signal(false, ...ngDevMode ? [{ debugName: "_requiredSignal" }] : /* istanbul ignore next */ []);
42
+ this._valueSignal = signal(null, ...ngDevMode ? [{ debugName: "_valueSignal" }] : /* istanbul ignore next */ []);
43
+ this.selectedOptions = signal([], ...ngDevMode ? [{ debugName: "selectedOptions" }] : /* istanbul ignore next */ []);
44
+ this._inputElementRef = viewChild("input", ...ngDevMode ? [{ debugName: "_inputElementRef" }] : /* istanbul ignore next */ []);
45
+ this._autoTrigger = viewChild("autoTrigger", ...ngDevMode ? [{ debugName: "_autoTrigger" }] : /* istanbul ignore next */ []);
46
+ this._suppressPanelOpen = false;
47
+ this._maxFilteredItems = 50;
48
+ this._destroyRef = inject(DestroyRef);
49
+ this.filteredOptions = computed(() => {
50
+ if (!this.hasAutocomplete()) return null;
51
+ const currentValue = this._inputValueSignal() ?? "";
52
+ return (currentValue ? this._filter(currentValue) : this.selectableOptions()?.slice() ?? []).filter((option) => !this.selectedOptions().includes(option)).slice(0, this._maxFilteredItems);
53
+ }, ...ngDevMode ? [{ debugName: "filteredOptions" }] : /* istanbul ignore next */ []);
54
+ this._onModelChange = () => {};
55
+ this._onTouchedChange = () => {};
56
+ if (this.ngControl != null) this.ngControl.valueAccessor = this;
57
+ this.inputControl.valueChanges.pipe(takeUntilDestroyed(this._destroyRef)).subscribe((value) => {
58
+ this._inputValueSignal.set(value ?? null);
59
+ });
60
+ this.inputControl.valueChanges.pipe(takeUntilDestroyed(this._destroyRef), filter((value) => this.hasAutocomplete() && this._focused() && (value === "" || value === null))).subscribe(() => {
61
+ setTimeout(() => {
62
+ this._autoTrigger()?.openPanel();
63
+ });
64
+ });
65
+ }
66
+ ngOnDestroy() {
67
+ this.stateChanges.complete();
68
+ }
69
+ get focused() {
70
+ return this._focused();
71
+ }
72
+ get touched() {
73
+ return this._touched();
74
+ }
75
+ get placeholder() {
76
+ return this._placeholderSignal();
77
+ }
78
+ set placeholder(value) {
79
+ this._placeholderSignal.set(value);
80
+ this.stateChanges.next();
81
+ }
82
+ get value() {
83
+ return this._valueSignal();
84
+ }
85
+ set value(value) {
86
+ if (value !== this._valueSignal()) {
87
+ this._valueSignal.set(value);
88
+ this.stateChanges.next();
89
+ this._onModelChange(value);
90
+ }
91
+ }
92
+ get empty() {
93
+ const val = this._valueSignal();
94
+ if (isNil(val)) return true;
95
+ if (Array.isArray(val)) return val.length === 0;
96
+ return val === "";
97
+ }
98
+ get errorState() {
99
+ if (this.ngControl == null) return false;
100
+ return (this._touched() && this.ngControl?.invalid) ?? false;
101
+ }
102
+ get shouldLabelFloat() {
103
+ return this._focused() || !this.empty;
104
+ }
105
+ get required() {
106
+ return this._requiredSignal();
107
+ }
108
+ set required(value) {
109
+ this._requiredSignal.set(coerceBooleanProperty(value));
110
+ this.stateChanges.next();
111
+ }
112
+ get disabled() {
113
+ if (!isNil(this.ngControl?.disabled)) return this.ngControl.disabled;
114
+ return this._disabledSignal();
115
+ }
116
+ set disabled(value) {
117
+ const isDisabled = coerceBooleanProperty(value);
118
+ this._disabledSignal.set(isDisabled);
119
+ if (isDisabled || this.ngControl?.disabled) this.inputControl.disable();
120
+ else this.inputControl.enable();
121
+ if (this._focused() && isDisabled) {
122
+ this._focused.set(false);
123
+ this.stateChanges.next();
124
+ }
125
+ }
126
+ registerOnChange(fn) {
127
+ this._onModelChange = fn;
128
+ }
129
+ registerOnTouched(fn) {
130
+ this._onTouchedChange = fn;
131
+ }
132
+ writeValue(value) {
133
+ let options = [];
134
+ if (isArray(value)) options = value;
135
+ else if (!isNil(value) && !isEmpty(value)) options = value.split(this.separatorKey()).map((v) => v.trim()).filter((v) => v);
136
+ options = Array.from(new Set(options));
137
+ this.selectedOptions.set(options);
138
+ const finalValue = this.outputIsString() ? options.join(this.separatorKey()) : options;
139
+ if (this._valueSignal() !== finalValue) {
140
+ this._valueSignal.set(finalValue);
141
+ this.stateChanges.next();
142
+ }
143
+ this.inputControl.setValue(null);
144
+ }
145
+ setDisabledState(isDisabled) {
146
+ this.disabled = isDisabled;
147
+ }
148
+ setDescribedByIds(ids) {
149
+ if (ids.length) this._inputElementRef()?.nativeElement.setAttribute("aria-describedby", ids.join(" "));
150
+ else this._inputElementRef()?.nativeElement.removeAttribute("aria-describedby");
151
+ }
152
+ onContainerClick() {
153
+ if (!this._focused()) this._inputElementRef()?.nativeElement.focus();
154
+ }
155
+ onAdd(event) {
156
+ if (this.autocompleteOptionActive()) return;
157
+ const value = (event.value || "").trim();
158
+ if (value) {
159
+ if ((!this.hasAutocomplete() || this.selectableOptions()?.includes(value)) && !this.selectedOptions().includes(value)) {
160
+ const newValue = [...this.selectedOptions(), value];
161
+ this._updateValue(newValue);
162
+ }
163
+ }
164
+ event.chipInput.clear();
165
+ this.inputControl.setValue(null);
166
+ }
167
+ onRemove(option) {
168
+ const index = this.selectedOptions().findIndex((i) => i === option);
169
+ if (index >= 0) {
170
+ const newOptions = [...this.selectedOptions()];
171
+ newOptions.splice(index, 1);
172
+ this._updateValue(newOptions);
173
+ this._suppressPanelOpen = true;
174
+ setTimeout(() => {
175
+ this._suppressPanelOpen = false;
176
+ }, 150);
177
+ this._inputElementRef()?.nativeElement.focus();
178
+ }
179
+ }
180
+ onSelected(event) {
181
+ const selectedValue = event.option.viewValue;
182
+ if (!this.selectedOptions().includes(selectedValue)) {
183
+ const newValue = [...this.selectedOptions(), selectedValue];
184
+ this._updateValue(newValue);
185
+ }
186
+ this._autoTrigger()?.closePanel();
187
+ this.inputControl.setValue(null);
188
+ this._inputValueSignal.set(null);
189
+ this.autocompleteOptionActive.set(false);
190
+ this._suppressPanelOpen = true;
191
+ setTimeout(() => {
192
+ this._suppressPanelOpen = false;
193
+ }, 100);
194
+ }
195
+ onFocusIn(event) {
196
+ if (!this.focused) {
197
+ this._focused.set(true);
198
+ this.stateChanges.next();
199
+ if (this.hasAutocomplete() && !this._suppressPanelOpen) {
200
+ if ((event?.target)?.closest("mat-chip-row")) return;
201
+ setTimeout(() => {
202
+ if (!this._suppressPanelOpen) this._autoTrigger()?.openPanel();
203
+ }, 50);
204
+ }
205
+ }
206
+ }
207
+ onFocusOut(event) {
208
+ const containerEl = this._inputElementRef()?.nativeElement;
209
+ if (containerEl && !containerEl.contains(event.relatedTarget)) {
210
+ this._touched.set(true);
211
+ this._focused.set(false);
212
+ this._onTouchedChange();
213
+ this.stateChanges.next();
214
+ if (this.hasAutocomplete()) setTimeout(() => {
215
+ if (!this._focused()) this._autoTrigger()?.closePanel();
216
+ }, 150);
217
+ }
218
+ }
219
+ onActivated(event) {
220
+ this.autocompleteOptionActive.set(event.option != null);
221
+ }
222
+ _updateValue(newOptions) {
223
+ this.selectedOptions.set(newOptions);
224
+ if (this.outputIsString()) this.value = newOptions.join(this.separatorKey());
225
+ else this.value = newOptions;
226
+ }
227
+ _filter(value) {
228
+ const filterValue = value.toLowerCase();
229
+ return this.selectableOptions()?.filter((v) => v.toLowerCase().includes(filterValue)) ?? [];
230
+ }
231
+ static {
232
+ this.ɵfac = i0.ɵɵngDeclareFactory({
233
+ minVersion: "12.0.0",
234
+ version: "22.2.3",
235
+ ngImport: i0,
236
+ type: CmatChipInputComponent,
237
+ deps: [],
238
+ target: i0.ɵɵFactoryTarget.Component
239
+ });
240
+ }
241
+ static {
242
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
243
+ minVersion: "17.0.0",
244
+ version: "22.2.3",
245
+ type: CmatChipInputComponent,
246
+ isStandalone: true,
247
+ selector: "cmat-chip-input",
248
+ inputs: {
249
+ selectableOptions: {
250
+ classPropertyName: "selectableOptions",
251
+ publicName: "selectableOptions",
252
+ isSignal: true,
253
+ isRequired: false,
254
+ transformFunction: null
255
+ },
256
+ hasAutocomplete: {
257
+ classPropertyName: "hasAutocomplete",
258
+ publicName: "hasAutocomplete",
259
+ isSignal: true,
260
+ isRequired: false,
261
+ transformFunction: null
262
+ },
263
+ outputIsString: {
264
+ classPropertyName: "outputIsString",
265
+ publicName: "outputIsString",
266
+ isSignal: true,
267
+ isRequired: false,
268
+ transformFunction: null
269
+ },
270
+ separatorKey: {
271
+ classPropertyName: "separatorKey",
272
+ publicName: "separatorKey",
273
+ isSignal: true,
274
+ isRequired: false,
275
+ transformFunction: null
276
+ },
277
+ placeholder: {
278
+ classPropertyName: "placeholder",
279
+ publicName: "placeholder",
280
+ isSignal: false,
281
+ isRequired: false,
282
+ transformFunction: null
283
+ },
284
+ value: {
285
+ classPropertyName: "value",
286
+ publicName: "value",
287
+ isSignal: false,
288
+ isRequired: false,
289
+ transformFunction: null
290
+ },
291
+ required: {
292
+ classPropertyName: "required",
293
+ publicName: "required",
294
+ isSignal: false,
295
+ isRequired: false,
296
+ transformFunction: null
297
+ },
298
+ disabled: {
299
+ classPropertyName: "disabled",
300
+ publicName: "disabled",
301
+ isSignal: false,
302
+ isRequired: false,
303
+ transformFunction: null
304
+ }
305
+ },
306
+ host: { properties: { "attr.id": "id" } },
307
+ providers: [{
308
+ provide: MatFormFieldControl,
309
+ useExisting: CmatChipInputComponent
310
+ }],
311
+ viewQueries: [{
312
+ propertyName: "_inputElementRef",
313
+ first: true,
314
+ predicate: ["input"],
315
+ descendants: true,
316
+ isSignal: true
317
+ }, {
318
+ propertyName: "_autoTrigger",
319
+ first: true,
320
+ predicate: ["autoTrigger"],
321
+ descendants: true,
322
+ isSignal: true
323
+ }],
324
+ exportAs: ["cmatChipInput"],
325
+ ngImport: i0,
326
+ template: "<mat-chip-grid #chipList class=\"items-center\" (focusin)=\"onFocusIn($event)\" (focusout)=\"onFocusOut($event)\">\r\n @for (option of selectedOptions(); track option) {\r\n <mat-chip-row (removed)=\"onRemove(option)\" (click)=\"$event.stopPropagation()\">\r\n {{ option }}\r\n <button matChipRemove class=\"print:hidden\" (click)=\"$event.stopPropagation()\">\r\n <mat-icon class=\"icon-size-5\" [svgIcon]=\"'mat_solid:cancel'\"></mat-icon>\r\n </button>\r\n </mat-chip-row>\r\n }\r\n\r\n @if (hasAutocomplete()) {\r\n <input #input #autoTrigger=\"matAutocompleteTrigger\" matInput [formControl]=\"inputControl\" [placeholder]=\"placeholder?placeholder:'开始选择...'\"\r\n [matAutocomplete]=\"autoComplete\" [required]=\"required\" [matChipInputFor]=\"chipList\"\r\n [matChipInputSeparatorKeyCodes]=\"separatorKeysCodes\" (matChipInputTokenEnd)=\"onAdd($event)\" />\r\n <mat-autocomplete #autoComplete=\"matAutocomplete\" (optionSelected)=\"onSelected($event)\"\r\n (optionActivated)=\"onActivated($event)\">\r\n @for (option of filteredOptions(); track option) {\r\n <mat-option [value]=\"option\">\r\n {{ option }}\r\n </mat-option>\r\n }\r\n </mat-autocomplete>\r\n } @else {\r\n <input #input [formControl]=\"inputControl\" [placeholder]=\"placeholder?placeholder:'开始填写...'\" [matChipInputFor]=\"chipList\"\r\n [required]=\"required\" [matChipInputSeparatorKeyCodes]=\"separatorKeysCodes\" (matChipInputTokenEnd)=\"onAdd($event)\" />\r\n }\r\n</mat-chip-grid>",
327
+ dependencies: [
328
+ {
329
+ kind: "ngmodule",
330
+ type: MatChipsModule
331
+ },
332
+ {
333
+ kind: "component",
334
+ type: i1.MatChipGrid,
335
+ selector: "mat-chip-grid",
336
+ inputs: [
337
+ "disabled",
338
+ "placeholder",
339
+ "required",
340
+ "value",
341
+ "errorStateMatcher"
342
+ ],
343
+ outputs: ["change", "valueChange"]
344
+ },
345
+ {
346
+ kind: "directive",
347
+ type: i1.MatChipInput,
348
+ selector: "input[matChipInputFor]",
349
+ inputs: [
350
+ "matChipInputFor",
351
+ "matChipInputAddOnBlur",
352
+ "matChipInputSeparatorKeyCodes",
353
+ "placeholder",
354
+ "id",
355
+ "disabled",
356
+ "readonly",
357
+ "matChipInputDisabledInteractive"
358
+ ],
359
+ outputs: ["matChipInputTokenEnd"],
360
+ exportAs: ["matChipInput", "matChipInputFor"]
361
+ },
362
+ {
363
+ kind: "directive",
364
+ type: i1.MatChipRemove,
365
+ selector: "[matChipRemove]"
366
+ },
367
+ {
368
+ kind: "component",
369
+ type: i1.MatChipRow,
370
+ selector: "mat-chip-row, [mat-chip-row], mat-basic-chip-row, [mat-basic-chip-row]",
371
+ inputs: ["editable"],
372
+ outputs: ["edited"]
373
+ },
374
+ {
375
+ kind: "ngmodule",
376
+ type: MatInputModule
377
+ },
378
+ {
379
+ kind: "directive",
380
+ type: i2.MatInput,
381
+ selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]",
382
+ inputs: [
383
+ "disabled",
384
+ "id",
385
+ "placeholder",
386
+ "name",
387
+ "required",
388
+ "type",
389
+ "errorStateMatcher",
390
+ "aria-describedby",
391
+ "value",
392
+ "readonly",
393
+ "disabledInteractive"
394
+ ],
395
+ exportAs: ["matInput"]
396
+ },
397
+ {
398
+ kind: "ngmodule",
399
+ type: MatAutocompleteModule
400
+ },
401
+ {
402
+ kind: "component",
403
+ type: i3.MatAutocomplete,
404
+ selector: "mat-autocomplete",
405
+ inputs: [
406
+ "aria-label",
407
+ "aria-labelledby",
408
+ "displayWith",
409
+ "autoActiveFirstOption",
410
+ "autoSelectActiveOption",
411
+ "requireSelection",
412
+ "panelWidth",
413
+ "disableRipple",
414
+ "class",
415
+ "hideSingleSelectionIndicator"
416
+ ],
417
+ outputs: [
418
+ "optionSelected",
419
+ "opened",
420
+ "closed",
421
+ "optionActivated"
422
+ ],
423
+ exportAs: ["matAutocomplete"]
424
+ },
425
+ {
426
+ kind: "component",
427
+ type: i3.MatOption,
428
+ selector: "mat-option",
429
+ inputs: [
430
+ "value",
431
+ "id",
432
+ "disabled"
433
+ ],
434
+ outputs: ["onSelectionChange"],
435
+ exportAs: ["matOption"]
436
+ },
437
+ {
438
+ kind: "directive",
439
+ type: i3.MatAutocompleteTrigger,
440
+ selector: "input[matAutocomplete], textarea[matAutocomplete]",
441
+ inputs: [
442
+ "matAutocomplete",
443
+ "matAutocompletePosition",
444
+ "matAutocompleteConnectedTo",
445
+ "autocomplete",
446
+ "matAutocompleteDisabled"
447
+ ],
448
+ exportAs: ["matAutocompleteTrigger"]
449
+ },
450
+ {
451
+ kind: "ngmodule",
452
+ type: MatIconModule
453
+ },
454
+ {
455
+ kind: "component",
456
+ type: i4.MatIcon,
457
+ selector: "mat-icon",
458
+ inputs: [
459
+ "color",
460
+ "inline",
461
+ "svgIcon",
462
+ "fontSet",
463
+ "fontIcon"
464
+ ],
465
+ exportAs: ["matIcon"]
466
+ },
467
+ {
468
+ kind: "ngmodule",
469
+ type: ReactiveFormsModule
470
+ },
471
+ {
472
+ kind: "directive",
473
+ type: i5.DefaultValueAccessor,
474
+ 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]"
475
+ },
476
+ {
477
+ kind: "directive",
478
+ type: i5.NgControlStatus,
479
+ selector: "[formControlName],[ngModel],[formControl]"
480
+ },
481
+ {
482
+ kind: "directive",
483
+ type: i5.RequiredValidator,
484
+ selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]",
485
+ inputs: ["required"]
486
+ },
487
+ {
488
+ kind: "directive",
489
+ type: i5.FormControlDirective,
490
+ selector: "[formControl]",
491
+ inputs: [
492
+ "formControl",
493
+ "disabled",
494
+ "ngModel"
495
+ ],
496
+ outputs: ["ngModelChange"],
497
+ exportAs: ["ngForm"]
498
+ }
499
+ ],
500
+ changeDetection: i0.ChangeDetectionStrategy.OnPush,
501
+ encapsulation: i0.ViewEncapsulation.None
502
+ });
503
+ }
504
+ };
505
+ i0.ɵɵngDeclareClassMetadata({
506
+ minVersion: "12.0.0",
507
+ version: "22.2.3",
508
+ ngImport: i0,
509
+ type: CmatChipInputComponent,
510
+ decorators: [{
511
+ type: Component,
512
+ args: [{
513
+ selector: "cmat-chip-input",
514
+ providers: [{
515
+ provide: MatFormFieldControl,
516
+ useExisting: CmatChipInputComponent
517
+ }],
518
+ exportAs: "cmatChipInput",
519
+ imports: [
520
+ MatChipsModule,
521
+ MatInputModule,
522
+ MatAutocompleteModule,
523
+ MatIconModule,
524
+ ReactiveFormsModule
525
+ ],
526
+ encapsulation: ViewEncapsulation.None,
527
+ changeDetection: ChangeDetectionStrategy.OnPush,
528
+ host: { "[attr.id]": "id" },
529
+ template: "<mat-chip-grid #chipList class=\"items-center\" (focusin)=\"onFocusIn($event)\" (focusout)=\"onFocusOut($event)\">\r\n @for (option of selectedOptions(); track option) {\r\n <mat-chip-row (removed)=\"onRemove(option)\" (click)=\"$event.stopPropagation()\">\r\n {{ option }}\r\n <button matChipRemove class=\"print:hidden\" (click)=\"$event.stopPropagation()\">\r\n <mat-icon class=\"icon-size-5\" [svgIcon]=\"'mat_solid:cancel'\"></mat-icon>\r\n </button>\r\n </mat-chip-row>\r\n }\r\n\r\n @if (hasAutocomplete()) {\r\n <input #input #autoTrigger=\"matAutocompleteTrigger\" matInput [formControl]=\"inputControl\" [placeholder]=\"placeholder?placeholder:'开始选择...'\"\r\n [matAutocomplete]=\"autoComplete\" [required]=\"required\" [matChipInputFor]=\"chipList\"\r\n [matChipInputSeparatorKeyCodes]=\"separatorKeysCodes\" (matChipInputTokenEnd)=\"onAdd($event)\" />\r\n <mat-autocomplete #autoComplete=\"matAutocomplete\" (optionSelected)=\"onSelected($event)\"\r\n (optionActivated)=\"onActivated($event)\">\r\n @for (option of filteredOptions(); track option) {\r\n <mat-option [value]=\"option\">\r\n {{ option }}\r\n </mat-option>\r\n }\r\n </mat-autocomplete>\r\n } @else {\r\n <input #input [formControl]=\"inputControl\" [placeholder]=\"placeholder?placeholder:'开始填写...'\" [matChipInputFor]=\"chipList\"\r\n [required]=\"required\" [matChipInputSeparatorKeyCodes]=\"separatorKeysCodes\" (matChipInputTokenEnd)=\"onAdd($event)\" />\r\n }\r\n</mat-chip-grid>"
530
+ }]
531
+ }],
532
+ ctorParameters: () => [],
533
+ propDecorators: {
534
+ selectableOptions: [{
535
+ type: i0.Input,
536
+ args: [{
537
+ isSignal: true,
538
+ alias: "selectableOptions",
539
+ required: false
540
+ }]
541
+ }],
542
+ hasAutocomplete: [{
543
+ type: i0.Input,
544
+ args: [{
545
+ isSignal: true,
546
+ alias: "hasAutocomplete",
547
+ required: false
548
+ }]
549
+ }],
550
+ outputIsString: [{
551
+ type: i0.Input,
552
+ args: [{
553
+ isSignal: true,
554
+ alias: "outputIsString",
555
+ required: false
556
+ }]
557
+ }],
558
+ separatorKey: [{
559
+ type: i0.Input,
560
+ args: [{
561
+ isSignal: true,
562
+ alias: "separatorKey",
563
+ required: false
564
+ }]
565
+ }],
566
+ _inputElementRef: [{
567
+ type: i0.ViewChild,
568
+ args: ["input", { isSignal: true }]
569
+ }],
570
+ _autoTrigger: [{
571
+ type: i0.ViewChild,
572
+ args: ["autoTrigger", { isSignal: true }]
573
+ }],
574
+ placeholder: [{ type: Input }],
575
+ value: [{ type: Input }],
576
+ required: [{ type: Input }],
577
+ disabled: [{ type: Input }]
578
+ }
579
+ });
336
580
  export { CmatChipInputComponent };
337
- //# sourceMappingURL=cmat-components-chip-input.mjs.map
581
+
582
+ //# sourceMappingURL=cmat-components-chip-input.mjs.map