cmat 0.0.110 → 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 +985 -669
  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 +39806 -22071
  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 -92
  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 -5194
@@ -1,422 +1,617 @@
1
- import { coerceBooleanProperty } from '@angular/cdk/coercion';
2
- import { NgStyle } from '@angular/common';
3
- import * as i0 from '@angular/core';
4
- import { viewChild, input, output, signal, inject, DOCUMENT, Renderer2, ElementRef, HostListener, Input, ChangeDetectionStrategy, ViewEncapsulation, Component } from '@angular/core';
5
- import { NgControl } from '@angular/forms';
6
- import { MatFormFieldControl } from '@angular/material/form-field';
7
- import { isNil } from 'lodash-es';
8
- import { Subject } from 'rxjs';
9
-
10
- /* eslint-disable @typescript-eslint/member-ordering */
1
+ import { coerceBooleanProperty } from "@angular/cdk/coercion";
2
+ import { NgStyle } from "@angular/common";
3
+ import * as i0 from "@angular/core";
4
+ import { ChangeDetectionStrategy, Component, DOCUMENT, ElementRef, HostListener, Input, Renderer2, ViewEncapsulation, inject, input, output, signal, viewChild } from "@angular/core";
5
+ import { NgControl } from "@angular/forms";
6
+ import { MatFormFieldControl } from "@angular/material/form-field";
7
+ import { isNil } from "lodash-es";
8
+ import { Subject } from "rxjs";
11
9
  let NEXT_ID = 0;
12
- class CmatKnobInputComponent {
13
- get value() {
14
- return this._valueSignal() ?? this.min();
15
- }
16
- set value(val) {
17
- const current = this._valueSignal();
18
- if (val !== current) {
19
- this._valueSignal.set(val);
20
- this.stateChanges.next();
21
- this._onModelChange(val);
22
- this.valueChange.emit(val);
23
- }
24
- }
25
- get placeholder() {
26
- return this._placeholderSignal();
27
- }
28
- set placeholder(plh) {
29
- this._placeholderSignal.set(plh);
30
- this.stateChanges.next();
31
- }
32
- get required() {
33
- return this._requiredSignal();
34
- }
35
- set required(req) {
36
- this._requiredSignal.set(coerceBooleanProperty(req));
37
- this.stateChanges.next();
38
- }
39
- get disabled() {
40
- if (!isNil(this.ngControl?.disabled)) {
41
- return this.ngControl.disabled;
42
- }
43
- return this._disabledSignal();
44
- }
45
- set disabled(val) {
46
- const coerced = coerceBooleanProperty(val);
47
- this._disabledSignal.set(coerced);
48
- if (this._focused && coerced) {
49
- this._focused = false;
50
- }
51
- this.stateChanges.next();
52
- }
53
- get empty() {
54
- return this._valueSignal() == null;
55
- }
56
- get errorState() {
57
- if (this.ngControl == null)
58
- return false;
59
- return (this.touched() && !!this.ngControl?.invalid) ?? false;
60
- }
61
- get shouldLabelFloat() {
62
- return this._focused || !this.empty;
63
- }
64
- get focused() {
65
- return this._focused;
66
- }
67
- constructor() {
68
- this.knobElementRef = viewChild('knob', /* @ts-ignore */
69
- ...(ngDevMode ? [{ debugName: "knobElementRef" }] : /* istanbul ignore next */ []));
70
- this.valueColor = input('var(--cmat-primary)', /* @ts-ignore */
71
- ...(ngDevMode ? [{ debugName: "valueColor" }] : /* istanbul ignore next */ []));
72
- this.rangeColor = input('var(--cmat-border)', /* @ts-ignore */
73
- ...(ngDevMode ? [{ debugName: "rangeColor" }] : /* istanbul ignore next */ []));
74
- this.textColor = input('var(--cmat-text-default)', /* @ts-ignore */
75
- ...(ngDevMode ? [{ debugName: "textColor" }] : /* istanbul ignore next */ []));
76
- this.valueTemplate = input('{value}', /* @ts-ignore */
77
- ...(ngDevMode ? [{ debugName: "valueTemplate" }] : /* istanbul ignore next */ []));
78
- this.name = input(/* @ts-ignore */
79
- ...(ngDevMode ? [undefined, { debugName: "name" }] : /* istanbul ignore next */ []));
80
- this.size = input(100, /* @ts-ignore */
81
- ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
82
- this.step = input(1, /* @ts-ignore */
83
- ...(ngDevMode ? [{ debugName: "step" }] : /* istanbul ignore next */ []));
84
- this.min = input(0, /* @ts-ignore */
85
- ...(ngDevMode ? [{ debugName: "min" }] : /* istanbul ignore next */ []));
86
- this.max = input(100, /* @ts-ignore */
87
- ...(ngDevMode ? [{ debugName: "max" }] : /* istanbul ignore next */ []));
88
- this.strokeWidth = input(14, /* @ts-ignore */
89
- ...(ngDevMode ? [{ debugName: "strokeWidth" }] : /* istanbul ignore next */ []));
90
- this.showValue = input(true, /* @ts-ignore */
91
- ...(ngDevMode ? [{ debugName: "showValue" }] : /* istanbul ignore next */ []));
92
- this.valueChange = output();
93
- this.id = `cmat-knob-input-${NEXT_ID++}`;
94
- this.stateChanges = new Subject();
95
- this._valueSignal = signal(null, /* @ts-ignore */
96
- ...(ngDevMode ? [{ debugName: "_valueSignal" }] : /* istanbul ignore next */ []));
97
- this._placeholderSignal = signal('', /* @ts-ignore */
98
- ...(ngDevMode ? [{ debugName: "_placeholderSignal" }] : /* istanbul ignore next */ []));
99
- this._requiredSignal = signal(false, /* @ts-ignore */
100
- ...(ngDevMode ? [{ debugName: "_requiredSignal" }] : /* istanbul ignore next */ []));
101
- this._disabledSignal = signal(false, /* @ts-ignore */
102
- ...(ngDevMode ? [{ debugName: "_disabledSignal" }] : /* istanbul ignore next */ []));
103
- this._focused = false;
104
- this.touched = signal(false, /* @ts-ignore */
105
- ...(ngDevMode ? [{ debugName: "touched" }] : /* istanbul ignore next */ []));
106
- this.refreshVersion = signal(0, /* @ts-ignore */
107
- ...(ngDevMode ? [{ debugName: "refreshVersion" }] : /* istanbul ignore next */ []));
108
- this.radius = 40;
109
- this.midX = 50;
110
- this.midY = 50;
111
- this.minRadians = (4 * Math.PI) / 3;
112
- this.maxRadians = -Math.PI / 3;
113
- this.ngControl = inject(NgControl, { optional: true, self: true });
114
- this._document = inject(DOCUMENT);
115
- this._renderer = inject(Renderer2);
116
- this._el = inject(ElementRef);
117
- this.windowMouseMoveListener = null;
118
- this.windowMouseUpListener = null;
119
- this.windowTouchMoveListener = null;
120
- this.windowTouchEndListener = null;
121
- // --- CVA Internal Functions ---
122
- this._onModelChange = () => {
123
- // Intentionally left blank
124
- };
125
- this._onTouchedChange = () => { };
126
- if (this.ngControl != null) {
127
- this.ngControl.valueAccessor = this;
128
- }
129
- }
130
- ngOnDestroy() {
131
- this.stateChanges.complete();
132
- this._cleanupListeners();
133
- }
134
- _cleanupListeners() {
135
- if (this.windowMouseMoveListener)
136
- this.windowMouseMoveListener();
137
- if (this.windowMouseUpListener)
138
- this.windowMouseUpListener();
139
- if (this.windowTouchMoveListener)
140
- this.windowTouchMoveListener();
141
- if (this.windowTouchEndListener)
142
- this.windowTouchEndListener();
143
- this.windowMouseMoveListener = null;
144
- this.windowMouseUpListener = null;
145
- this.windowTouchMoveListener = null;
146
- this.windowTouchEndListener = null;
147
- }
148
- writeValue(value) {
149
- this._valueSignal.set(value ?? this.min());
150
- this.refreshVersion.update(v => v + 1);
151
- this.stateChanges.next();
152
- }
153
- registerOnChange(fn) {
154
- this._onModelChange = fn;
155
- }
156
- registerOnTouched(fn) {
157
- this._onTouchedChange = fn;
158
- }
159
- setDisabledState(val) {
160
- this.disabled = val;
161
- this.refreshVersion.update(v => v + 1);
162
- this.stateChanges.next();
163
- }
164
- setDescribedByIds(ids) {
165
- this.userAriaDescribedBy = ids.length ? ids.join(' ') : undefined;
166
- const knobEl = this.knobElementRef()?.nativeElement;
167
- if (knobEl) {
168
- if (ids.length) {
169
- knobEl.setAttribute('aria-describedby', ids.join(' '));
170
- }
171
- else {
172
- knobEl.removeAttribute('aria-describedby');
173
- }
174
- }
175
- this.stateChanges.next();
176
- }
177
- onContainerClick() {
178
- if (!this.focused) {
179
- this.knobElementRef()?.nativeElement.focus();
180
- }
181
- }
182
- onKeyDown(event) {
183
- const keyboardEvent = event;
184
- if (!this.disabled) {
185
- switch (keyboardEvent.code) {
186
- case 'Enter':
187
- case 'Space': {
188
- keyboardEvent.preventDefault();
189
- break;
190
- }
191
- case 'ArrowRight':
192
- case 'ArrowUp': {
193
- keyboardEvent.preventDefault();
194
- this.updateModelValue(this.value + 1);
195
- break;
196
- }
197
- case 'ArrowLeft':
198
- case 'ArrowDown': {
199
- keyboardEvent.preventDefault();
200
- this.updateModelValue(this.value - 1);
201
- break;
202
- }
203
- case 'Home': {
204
- keyboardEvent.preventDefault();
205
- this.updateModelValue(this.min());
206
- break;
207
- }
208
- case 'End': {
209
- keyboardEvent.preventDefault();
210
- this.updateModelValue(this.max());
211
- break;
212
- }
213
- case 'PageUp': {
214
- keyboardEvent.preventDefault();
215
- this.updateModelValue(this.value + 10);
216
- break;
217
- }
218
- case 'PageDown': {
219
- keyboardEvent.preventDefault();
220
- this.updateModelValue(this.value - 10);
221
- break;
222
- }
223
- }
224
- }
225
- }
226
- onMouseDown(event) {
227
- if (!this.disabled) {
228
- this._cleanupListeners();
229
- const win = this._document.defaultView ?? window;
230
- this.windowMouseMoveListener = this._renderer.listen(win, 'mousemove', this.onMouseMove.bind(this));
231
- this.windowMouseUpListener = this._renderer.listen(win, 'mouseup', this.onMouseUp.bind(this));
232
- event.preventDefault();
233
- }
234
- }
235
- onMouseUp(event) {
236
- if (!this.disabled) {
237
- this._cleanupListeners();
238
- event.preventDefault();
239
- }
240
- }
241
- onTouchStart(event) {
242
- if (!this.disabled) {
243
- this._cleanupListeners();
244
- const win = this._document.defaultView ?? window;
245
- this.windowTouchMoveListener = this._renderer.listen(win, 'touchmove', this.onTouchMove.bind(this));
246
- this.windowTouchEndListener = this._renderer.listen(win, 'touchend', this.onTouchEnd.bind(this));
247
- event.preventDefault();
248
- }
249
- }
250
- onTouchEnd(event) {
251
- if (!this.disabled) {
252
- this._cleanupListeners();
253
- event.preventDefault();
254
- }
255
- }
256
- onFocusIn() {
257
- if (!this._focused) {
258
- this._focused = true;
259
- this.stateChanges.next();
260
- }
261
- }
262
- onFocusOut(event) {
263
- const knobEl = this.knobElementRef()?.nativeElement;
264
- // Check if relatedTarget is outside the component
265
- if (knobEl &&
266
- !knobEl.contains(event.relatedTarget)) {
267
- this.touched.set(true);
268
- this._focused = false;
269
- this._onTouchedChange();
270
- this.stateChanges.next();
271
- }
272
- }
273
- // --- Logic Methods ---
274
- mapRange(x, inMin, inMax, outMin, outMax) {
275
- return ((x - inMin) * (outMax - outMin)) / (inMax - inMin) + outMin;
276
- }
277
- onClick(event) {
278
- if (!this.disabled) {
279
- this.updateValue(event.offsetX, event.offsetY);
280
- }
281
- }
282
- updateValue(offsetX, offsetY) {
283
- let dx = offsetX - this.size() / 2;
284
- let dy = this.size() / 2 - offsetY;
285
- let angle = Math.atan2(dy, dx);
286
- let start = -Math.PI / 2 - Math.PI / 6;
287
- this.updateModel(angle, start);
288
- }
289
- updateModel(angle, start) {
290
- let mappedValue;
291
- if (angle > this.maxRadians)
292
- mappedValue = this.mapRange(angle, this.minRadians, this.maxRadians, this.min(), this.max());
293
- else if (angle < start)
294
- mappedValue = this.mapRange(angle + 2 * Math.PI, this.minRadians, this.maxRadians, this.min(), this.max());
295
- else
296
- return;
297
- let newValue = Math.round((mappedValue - this.min()) / this.step()) * this.step() +
298
- this.min();
299
- this.value = newValue;
300
- }
301
- onMouseMove(event) {
302
- if (!this.disabled) {
303
- this.updateValue(event.offsetX, event.offsetY);
304
- event.preventDefault();
305
- this.refreshVersion.update(v => v + 1);
306
- }
307
- }
308
- onTouchMove(event) {
309
- if (!this.disabled &&
310
- event instanceof TouchEvent &&
311
- event.touches.length === 1) {
312
- const rect = this._el.nativeElement.firstElementChild?.getBoundingClientRect();
313
- const touch = event.targetTouches.item(0);
314
- if (touch && rect) {
315
- const offsetX = touch.clientX - rect.left;
316
- const offsetY = touch.clientY - rect.top;
317
- this.updateValue(offsetX, offsetY);
318
- this.refreshVersion.update(v => v + 1);
319
- }
320
- }
321
- }
322
- updateModelValue(newValue) {
323
- if (newValue > this.max())
324
- this.value = this.max();
325
- else if (newValue < this.min())
326
- this.value = this.min();
327
- else
328
- this.value = newValue;
329
- }
330
- // --- SVG Path Calculations ---
331
- rangePath() {
332
- return `M ${this.minX()} ${this.minY()} A ${this.radius} ${this.radius} 0 1 1 ${this.maxX()} ${this.maxY()}`;
333
- }
334
- valuePath() {
335
- return `M ${this.zeroX()} ${this.zeroY()} A ${this.radius} ${this.radius} 0 ${this.largeArc()} ${this.sweep()} ${this.valueX()} ${this.valueY()}`;
336
- }
337
- zeroRadians() {
338
- if (this.min() > 0 && this.max() > 0)
339
- return this.mapRange(this.min(), this.min(), this.max(), this.minRadians, this.maxRadians);
340
- else
341
- return this.mapRange(0, this.min(), this.max(), this.minRadians, this.maxRadians);
342
- }
343
- valueRadians() {
344
- return this.mapRange(this.value, this.min(), this.max(), this.minRadians, this.maxRadians);
345
- }
346
- minX() {
347
- return this.midX + Math.cos(this.minRadians) * this.radius;
348
- }
349
- minY() {
350
- return this.midY - Math.sin(this.minRadians) * this.radius;
351
- }
352
- maxX() {
353
- return this.midX + Math.cos(this.maxRadians) * this.radius;
354
- }
355
- maxY() {
356
- return this.midY - Math.sin(this.maxRadians) * this.radius;
357
- }
358
- zeroX() {
359
- return this.midX + Math.cos(this.zeroRadians()) * this.radius;
360
- }
361
- zeroY() {
362
- return this.midY - Math.sin(this.zeroRadians()) * this.radius;
363
- }
364
- valueX() {
365
- return this.midX + Math.cos(this.valueRadians()) * this.radius;
366
- }
367
- valueY() {
368
- return this.midY - Math.sin(this.valueRadians()) * this.radius;
369
- }
370
- largeArc() {
371
- return Math.abs(this.zeroRadians() - this.valueRadians()) < Math.PI ? 0 : 1;
372
- }
373
- sweep() {
374
- return this.valueRadians() > this.zeroRadians() ? 0 : 1;
375
- }
376
- valueToDisplay() {
377
- return this.valueTemplate().replace('{value}', this.value.toString());
378
- }
379
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.0", ngImport: i0, type: CmatKnobInputComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
380
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.2.0", type: CmatKnobInputComponent, isStandalone: true, selector: "cmat-knob-input", inputs: { valueColor: { classPropertyName: "valueColor", publicName: "valueColor", isSignal: true, isRequired: false, transformFunction: null }, rangeColor: { classPropertyName: "rangeColor", publicName: "rangeColor", isSignal: true, isRequired: false, transformFunction: null }, textColor: { classPropertyName: "textColor", publicName: "textColor", isSignal: true, isRequired: false, transformFunction: null }, valueTemplate: { classPropertyName: "valueTemplate", publicName: "valueTemplate", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, step: { classPropertyName: "step", publicName: "step", isSignal: true, isRequired: false, transformFunction: null }, min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, strokeWidth: { classPropertyName: "strokeWidth", publicName: "strokeWidth", isSignal: true, isRequired: false, transformFunction: null }, showValue: { classPropertyName: "showValue", publicName: "showValue", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: false, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", 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: { valueChange: "valueChange" }, host: { listeners: { "keydown": "onKeyDown($event)", "mousedown": "onMouseDown($event)", "mouseup": "onMouseUp($event)", "touchstart": "onTouchStart($event)", "touchend": "onTouchEnd($event)" }, properties: { "attr.id": "id" } }, providers: [
381
- { provide: MatFormFieldControl, useExisting: CmatKnobInputComponent },
382
- ], viewQueries: [{ propertyName: "knobElementRef", first: true, predicate: ["knob"], descendants: true, isSignal: true }], exportAs: ["cmatKnobInput"], ngImport: i0, template: "<!-- eslint-disable @angular-eslint/template/no-inline-styles -->\r\n<div\r\n #knob\r\n tabindex=\"-1\"\r\n [attr.data-refresh]=\"refreshVersion()\"\r\n [class.cmat-knob-disabled]=\"disabled\"\r\n (focusin)=\"onFocusIn()\"\r\n (focusout)=\"onFocusOut($event)\"\r\n>\r\n <svg\r\n viewBox=\"0 0 100 100\"\r\n role=\"slider\"\r\n [style.width]=\"size() + 'px'\"\r\n [style.height]=\"size() + 'px'\"\r\n [attr.aria-valuemin]=\"min()\"\r\n [attr.aria-valuemax]=\"max()\"\r\n [attr.aria-valuenow]=\"value\"\r\n [attr.tabindex]=\"disabled ? -1 : 0\"\r\n (click)=\"onClick($event)\"\r\n (keydown.enter)=\"onKeyDown($event)\"\r\n (keydown.space)=\"onKeyDown($event)\"\r\n >\r\n <path\r\n class=\"knob-range\"\r\n [attr.d]=\"rangePath()\"\r\n [attr.stroke-width]=\"strokeWidth()\"\r\n [attr.stroke]=\"rangeColor()\"\r\n ></path>\r\n <path\r\n class=\"knob-value\"\r\n [attr.d]=\"valuePath()\"\r\n [attr.stroke-width]=\"strokeWidth()\"\r\n [attr.stroke]=\"valueColor()\"\r\n ></path>\r\n @if (showValue()) {\r\n <text\r\n text-anchor=\"middle\"\r\n class=\"knob-text\"\r\n [attr.x]=\"50\"\r\n [attr.y]=\"57\"\r\n [attr.fill]=\"textColor()\"\r\n [attr.name]=\"name()\"\r\n >\r\n {{ valueToDisplay() }}\r\n </text>\r\n }\r\n </svg>\r\n</div>", styles: ["cmat-knob-input .knob-range{fill:none;transition:stroke .1s ease-in}cmat-knob-input .knob-value{animation-name:dash-frame;animation-fill-mode:forwards;fill:none}cmat-knob-input .knob-text{font-size:1.3rem;text-align:center}cmat-knob-input .cmat-knob-disabled{opacity:.6}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
383
- }
384
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.0", ngImport: i0, type: CmatKnobInputComponent, decorators: [{
385
- type: Component,
386
- args: [{ selector: 'cmat-knob-input', providers: [
387
- { provide: MatFormFieldControl, useExisting: CmatKnobInputComponent },
388
- ], exportAs: 'cmatKnobInput', imports: [NgStyle], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, host: {
389
- // eslint-disable-next-line @typescript-eslint/naming-convention
390
- '[attr.id]': 'id',
391
- }, template: "<!-- eslint-disable @angular-eslint/template/no-inline-styles -->\r\n<div\r\n #knob\r\n tabindex=\"-1\"\r\n [attr.data-refresh]=\"refreshVersion()\"\r\n [class.cmat-knob-disabled]=\"disabled\"\r\n (focusin)=\"onFocusIn()\"\r\n (focusout)=\"onFocusOut($event)\"\r\n>\r\n <svg\r\n viewBox=\"0 0 100 100\"\r\n role=\"slider\"\r\n [style.width]=\"size() + 'px'\"\r\n [style.height]=\"size() + 'px'\"\r\n [attr.aria-valuemin]=\"min()\"\r\n [attr.aria-valuemax]=\"max()\"\r\n [attr.aria-valuenow]=\"value\"\r\n [attr.tabindex]=\"disabled ? -1 : 0\"\r\n (click)=\"onClick($event)\"\r\n (keydown.enter)=\"onKeyDown($event)\"\r\n (keydown.space)=\"onKeyDown($event)\"\r\n >\r\n <path\r\n class=\"knob-range\"\r\n [attr.d]=\"rangePath()\"\r\n [attr.stroke-width]=\"strokeWidth()\"\r\n [attr.stroke]=\"rangeColor()\"\r\n ></path>\r\n <path\r\n class=\"knob-value\"\r\n [attr.d]=\"valuePath()\"\r\n [attr.stroke-width]=\"strokeWidth()\"\r\n [attr.stroke]=\"valueColor()\"\r\n ></path>\r\n @if (showValue()) {\r\n <text\r\n text-anchor=\"middle\"\r\n class=\"knob-text\"\r\n [attr.x]=\"50\"\r\n [attr.y]=\"57\"\r\n [attr.fill]=\"textColor()\"\r\n [attr.name]=\"name()\"\r\n >\r\n {{ valueToDisplay() }}\r\n </text>\r\n }\r\n </svg>\r\n</div>", styles: ["cmat-knob-input .knob-range{fill:none;transition:stroke .1s ease-in}cmat-knob-input .knob-value{animation-name:dash-frame;animation-fill-mode:forwards;fill:none}cmat-knob-input .knob-text{font-size:1.3rem;text-align:center}cmat-knob-input .cmat-knob-disabled{opacity:.6}\n"] }]
392
- }], ctorParameters: () => [], propDecorators: { knobElementRef: [{ type: i0.ViewChild, args: ['knob', { isSignal: true }] }], valueColor: [{ type: i0.Input, args: [{ isSignal: true, alias: "valueColor", required: false }] }], rangeColor: [{ type: i0.Input, args: [{ isSignal: true, alias: "rangeColor", required: false }] }], textColor: [{ type: i0.Input, args: [{ isSignal: true, alias: "textColor", required: false }] }], valueTemplate: [{ type: i0.Input, args: [{ isSignal: true, alias: "valueTemplate", required: false }] }], name: [{ type: i0.Input, args: [{ isSignal: true, alias: "name", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], step: [{ type: i0.Input, args: [{ isSignal: true, alias: "step", required: false }] }], min: [{ type: i0.Input, args: [{ isSignal: true, alias: "min", required: false }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], strokeWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "strokeWidth", required: false }] }], showValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "showValue", required: false }] }], valueChange: [{ type: i0.Output, args: ["valueChange"] }], value: [{
393
- type: Input
394
- }], placeholder: [{
395
- type: Input
396
- }], required: [{
397
- type: Input
398
- }], disabled: [{
399
- type: Input
400
- }], onKeyDown: [{
401
- type: HostListener,
402
- args: ['keydown', ['$event']]
403
- }], onMouseDown: [{
404
- type: HostListener,
405
- args: ['mousedown', ['$event']]
406
- }], onMouseUp: [{
407
- type: HostListener,
408
- args: ['mouseup', ['$event']]
409
- }], onTouchStart: [{
410
- type: HostListener,
411
- args: ['touchstart', ['$event']]
412
- }], onTouchEnd: [{
413
- type: HostListener,
414
- args: ['touchend', ['$event']]
415
- }] } });
416
-
417
- /**
418
- * Generated bundle index. Do not edit.
419
- */
420
-
10
+ var CmatKnobInputComponent = class CmatKnobInputComponent {
11
+ get value() {
12
+ return this._valueSignal() ?? this.min();
13
+ }
14
+ set value(val) {
15
+ if (val !== this._valueSignal()) {
16
+ this._valueSignal.set(val);
17
+ this.stateChanges.next();
18
+ this._onModelChange(val);
19
+ this.valueChange.emit(val);
20
+ }
21
+ }
22
+ get placeholder() {
23
+ return this._placeholderSignal();
24
+ }
25
+ set placeholder(plh) {
26
+ this._placeholderSignal.set(plh);
27
+ this.stateChanges.next();
28
+ }
29
+ get required() {
30
+ return this._requiredSignal();
31
+ }
32
+ set required(req) {
33
+ this._requiredSignal.set(coerceBooleanProperty(req));
34
+ this.stateChanges.next();
35
+ }
36
+ get disabled() {
37
+ if (!isNil(this.ngControl?.disabled)) return this.ngControl.disabled;
38
+ return this._disabledSignal();
39
+ }
40
+ set disabled(val) {
41
+ const coerced = coerceBooleanProperty(val);
42
+ this._disabledSignal.set(coerced);
43
+ if (this._focused && coerced) this._focused = false;
44
+ this.stateChanges.next();
45
+ }
46
+ get empty() {
47
+ return this._valueSignal() == null;
48
+ }
49
+ get errorState() {
50
+ if (this.ngControl == null) return false;
51
+ return (this.touched() && !!this.ngControl?.invalid) ?? false;
52
+ }
53
+ get shouldLabelFloat() {
54
+ return this._focused || !this.empty;
55
+ }
56
+ get focused() {
57
+ return this._focused;
58
+ }
59
+ constructor() {
60
+ this.knobElementRef = viewChild("knob", ...ngDevMode ? [{ debugName: "knobElementRef" }] : /* istanbul ignore next */ []);
61
+ this.valueColor = input("var(--cmat-primary)", ...ngDevMode ? [{ debugName: "valueColor" }] : /* istanbul ignore next */ []);
62
+ this.rangeColor = input("var(--cmat-border)", ...ngDevMode ? [{ debugName: "rangeColor" }] : /* istanbul ignore next */ []);
63
+ this.textColor = input("var(--cmat-text-default)", ...ngDevMode ? [{ debugName: "textColor" }] : /* istanbul ignore next */ []);
64
+ this.valueTemplate = input("{value}", ...ngDevMode ? [{ debugName: "valueTemplate" }] : /* istanbul ignore next */ []);
65
+ this.name = input(...ngDevMode ? [void 0, { debugName: "name" }] : /* istanbul ignore next */ []);
66
+ this.size = input(100, ...ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []);
67
+ this.step = input(1, ...ngDevMode ? [{ debugName: "step" }] : /* istanbul ignore next */ []);
68
+ this.min = input(0, ...ngDevMode ? [{ debugName: "min" }] : /* istanbul ignore next */ []);
69
+ this.max = input(100, ...ngDevMode ? [{ debugName: "max" }] : /* istanbul ignore next */ []);
70
+ this.strokeWidth = input(14, ...ngDevMode ? [{ debugName: "strokeWidth" }] : /* istanbul ignore next */ []);
71
+ this.showValue = input(true, ...ngDevMode ? [{ debugName: "showValue" }] : /* istanbul ignore next */ []);
72
+ this.valueChange = output();
73
+ this.id = `cmat-knob-input-${NEXT_ID++}`;
74
+ this.stateChanges = new Subject();
75
+ this._valueSignal = signal(null, ...ngDevMode ? [{ debugName: "_valueSignal" }] : /* istanbul ignore next */ []);
76
+ this._placeholderSignal = signal("", ...ngDevMode ? [{ debugName: "_placeholderSignal" }] : /* istanbul ignore next */ []);
77
+ this._requiredSignal = signal(false, ...ngDevMode ? [{ debugName: "_requiredSignal" }] : /* istanbul ignore next */ []);
78
+ this._disabledSignal = signal(false, ...ngDevMode ? [{ debugName: "_disabledSignal" }] : /* istanbul ignore next */ []);
79
+ this._focused = false;
80
+ this.touched = signal(false, ...ngDevMode ? [{ debugName: "touched" }] : /* istanbul ignore next */ []);
81
+ this.refreshVersion = signal(0, ...ngDevMode ? [{ debugName: "refreshVersion" }] : /* istanbul ignore next */ []);
82
+ this.radius = 40;
83
+ this.midX = 50;
84
+ this.midY = 50;
85
+ this.minRadians = 4 * Math.PI / 3;
86
+ this.maxRadians = -Math.PI / 3;
87
+ this.ngControl = inject(NgControl, {
88
+ optional: true,
89
+ self: true
90
+ });
91
+ this._document = inject(DOCUMENT);
92
+ this._renderer = inject(Renderer2);
93
+ this._el = inject(ElementRef);
94
+ this.windowMouseMoveListener = null;
95
+ this.windowMouseUpListener = null;
96
+ this.windowTouchMoveListener = null;
97
+ this.windowTouchEndListener = null;
98
+ this._onModelChange = () => {};
99
+ this._onTouchedChange = () => {};
100
+ if (this.ngControl != null) this.ngControl.valueAccessor = this;
101
+ }
102
+ ngOnDestroy() {
103
+ this.stateChanges.complete();
104
+ this._cleanupListeners();
105
+ }
106
+ _cleanupListeners() {
107
+ if (this.windowMouseMoveListener) this.windowMouseMoveListener();
108
+ if (this.windowMouseUpListener) this.windowMouseUpListener();
109
+ if (this.windowTouchMoveListener) this.windowTouchMoveListener();
110
+ if (this.windowTouchEndListener) this.windowTouchEndListener();
111
+ this.windowMouseMoveListener = null;
112
+ this.windowMouseUpListener = null;
113
+ this.windowTouchMoveListener = null;
114
+ this.windowTouchEndListener = null;
115
+ }
116
+ writeValue(value) {
117
+ this._valueSignal.set(value ?? this.min());
118
+ this.refreshVersion.update((v) => v + 1);
119
+ this.stateChanges.next();
120
+ }
121
+ registerOnChange(fn) {
122
+ this._onModelChange = fn;
123
+ }
124
+ registerOnTouched(fn) {
125
+ this._onTouchedChange = fn;
126
+ }
127
+ setDisabledState(val) {
128
+ this.disabled = val;
129
+ this.refreshVersion.update((v) => v + 1);
130
+ this.stateChanges.next();
131
+ }
132
+ setDescribedByIds(ids) {
133
+ this.userAriaDescribedBy = ids.length ? ids.join(" ") : void 0;
134
+ const knobEl = this.knobElementRef()?.nativeElement;
135
+ if (knobEl) {
136
+ if (ids.length) knobEl.setAttribute("aria-describedby", ids.join(" "));
137
+ else knobEl.removeAttribute("aria-describedby");
138
+ }
139
+ this.stateChanges.next();
140
+ }
141
+ onContainerClick() {
142
+ if (!this.focused) this.knobElementRef()?.nativeElement.focus();
143
+ }
144
+ onKeyDown(event) {
145
+ const keyboardEvent = event;
146
+ if (!this.disabled) switch (keyboardEvent.code) {
147
+ case "Enter":
148
+ case "Space":
149
+ keyboardEvent.preventDefault();
150
+ break;
151
+ case "ArrowRight":
152
+ case "ArrowUp":
153
+ keyboardEvent.preventDefault();
154
+ this.updateModelValue(this.value + 1);
155
+ break;
156
+ case "ArrowLeft":
157
+ case "ArrowDown":
158
+ keyboardEvent.preventDefault();
159
+ this.updateModelValue(this.value - 1);
160
+ break;
161
+ case "Home":
162
+ keyboardEvent.preventDefault();
163
+ this.updateModelValue(this.min());
164
+ break;
165
+ case "End":
166
+ keyboardEvent.preventDefault();
167
+ this.updateModelValue(this.max());
168
+ break;
169
+ case "PageUp":
170
+ keyboardEvent.preventDefault();
171
+ this.updateModelValue(this.value + 10);
172
+ break;
173
+ case "PageDown":
174
+ keyboardEvent.preventDefault();
175
+ this.updateModelValue(this.value - 10);
176
+ }
177
+ }
178
+ onMouseDown(event) {
179
+ if (!this.disabled) {
180
+ this._cleanupListeners();
181
+ const win = this._document.defaultView ?? window;
182
+ this.windowMouseMoveListener = this._renderer.listen(win, "mousemove", this.onMouseMove.bind(this));
183
+ this.windowMouseUpListener = this._renderer.listen(win, "mouseup", this.onMouseUp.bind(this));
184
+ event.preventDefault();
185
+ }
186
+ }
187
+ onMouseUp(event) {
188
+ if (!this.disabled) {
189
+ this._cleanupListeners();
190
+ event.preventDefault();
191
+ }
192
+ }
193
+ onTouchStart(event) {
194
+ if (!this.disabled) {
195
+ this._cleanupListeners();
196
+ const win = this._document.defaultView ?? window;
197
+ this.windowTouchMoveListener = this._renderer.listen(win, "touchmove", this.onTouchMove.bind(this));
198
+ this.windowTouchEndListener = this._renderer.listen(win, "touchend", this.onTouchEnd.bind(this));
199
+ event.preventDefault();
200
+ }
201
+ }
202
+ onTouchEnd(event) {
203
+ if (!this.disabled) {
204
+ this._cleanupListeners();
205
+ event.preventDefault();
206
+ }
207
+ }
208
+ onFocusIn() {
209
+ if (!this._focused) {
210
+ this._focused = true;
211
+ this.stateChanges.next();
212
+ }
213
+ }
214
+ onFocusOut(event) {
215
+ const knobEl = this.knobElementRef()?.nativeElement;
216
+ if (knobEl && !knobEl.contains(event.relatedTarget)) {
217
+ this.touched.set(true);
218
+ this._focused = false;
219
+ this._onTouchedChange();
220
+ this.stateChanges.next();
221
+ }
222
+ }
223
+ mapRange(x, inMin, inMax, outMin, outMax) {
224
+ return (x - inMin) * (outMax - outMin) / (inMax - inMin) + outMin;
225
+ }
226
+ onClick(event) {
227
+ if (!this.disabled) this.updateValue(event.offsetX, event.offsetY);
228
+ }
229
+ updateValue(offsetX, offsetY) {
230
+ let dx = offsetX - this.size() / 2;
231
+ let dy = this.size() / 2 - offsetY;
232
+ let angle = Math.atan2(dy, dx);
233
+ let start = -Math.PI / 2 - Math.PI / 6;
234
+ this.updateModel(angle, start);
235
+ }
236
+ updateModel(angle, start) {
237
+ let mappedValue;
238
+ if (angle > this.maxRadians) mappedValue = this.mapRange(angle, this.minRadians, this.maxRadians, this.min(), this.max());
239
+ else if (angle < start) mappedValue = this.mapRange(angle + 2 * Math.PI, this.minRadians, this.maxRadians, this.min(), this.max());
240
+ else return;
241
+ let newValue = Math.round((mappedValue - this.min()) / this.step()) * this.step() + this.min();
242
+ this.value = newValue;
243
+ }
244
+ onMouseMove(event) {
245
+ if (!this.disabled) {
246
+ this.updateValue(event.offsetX, event.offsetY);
247
+ event.preventDefault();
248
+ this.refreshVersion.update((v) => v + 1);
249
+ }
250
+ }
251
+ onTouchMove(event) {
252
+ if (!this.disabled && event instanceof TouchEvent && event.touches.length === 1) {
253
+ const rect = this._el.nativeElement.firstElementChild?.getBoundingClientRect();
254
+ const touch = event.targetTouches.item(0);
255
+ if (touch && rect) {
256
+ const offsetX = touch.clientX - rect.left;
257
+ const offsetY = touch.clientY - rect.top;
258
+ this.updateValue(offsetX, offsetY);
259
+ this.refreshVersion.update((v) => v + 1);
260
+ }
261
+ }
262
+ }
263
+ updateModelValue(newValue) {
264
+ if (newValue > this.max()) this.value = this.max();
265
+ else if (newValue < this.min()) this.value = this.min();
266
+ else this.value = newValue;
267
+ }
268
+ rangePath() {
269
+ return `M ${this.minX()} ${this.minY()} A ${this.radius} ${this.radius} 0 1 1 ${this.maxX()} ${this.maxY()}`;
270
+ }
271
+ valuePath() {
272
+ return `M ${this.zeroX()} ${this.zeroY()} A ${this.radius} ${this.radius} 0 ${this.largeArc()} ${this.sweep()} ${this.valueX()} ${this.valueY()}`;
273
+ }
274
+ zeroRadians() {
275
+ if (this.min() > 0 && this.max() > 0) return this.mapRange(this.min(), this.min(), this.max(), this.minRadians, this.maxRadians);
276
+ else return this.mapRange(0, this.min(), this.max(), this.minRadians, this.maxRadians);
277
+ }
278
+ valueRadians() {
279
+ return this.mapRange(this.value, this.min(), this.max(), this.minRadians, this.maxRadians);
280
+ }
281
+ minX() {
282
+ return this.midX + Math.cos(this.minRadians) * this.radius;
283
+ }
284
+ minY() {
285
+ return this.midY - Math.sin(this.minRadians) * this.radius;
286
+ }
287
+ maxX() {
288
+ return this.midX + Math.cos(this.maxRadians) * this.radius;
289
+ }
290
+ maxY() {
291
+ return this.midY - Math.sin(this.maxRadians) * this.radius;
292
+ }
293
+ zeroX() {
294
+ return this.midX + Math.cos(this.zeroRadians()) * this.radius;
295
+ }
296
+ zeroY() {
297
+ return this.midY - Math.sin(this.zeroRadians()) * this.radius;
298
+ }
299
+ valueX() {
300
+ return this.midX + Math.cos(this.valueRadians()) * this.radius;
301
+ }
302
+ valueY() {
303
+ return this.midY - Math.sin(this.valueRadians()) * this.radius;
304
+ }
305
+ largeArc() {
306
+ return Math.abs(this.zeroRadians() - this.valueRadians()) < Math.PI ? 0 : 1;
307
+ }
308
+ sweep() {
309
+ return this.valueRadians() > this.zeroRadians() ? 0 : 1;
310
+ }
311
+ valueToDisplay() {
312
+ return this.valueTemplate().replace("{value}", this.value.toString());
313
+ }
314
+ static {
315
+ this.ɵfac = i0.ɵɵngDeclareFactory({
316
+ minVersion: "12.0.0",
317
+ version: "22.2.3",
318
+ ngImport: i0,
319
+ type: CmatKnobInputComponent,
320
+ deps: [],
321
+ target: i0.ɵɵFactoryTarget.Component
322
+ });
323
+ }
324
+ static {
325
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
326
+ minVersion: "17.0.0",
327
+ version: "22.2.3",
328
+ type: CmatKnobInputComponent,
329
+ isStandalone: true,
330
+ selector: "cmat-knob-input",
331
+ inputs: {
332
+ valueColor: {
333
+ classPropertyName: "valueColor",
334
+ publicName: "valueColor",
335
+ isSignal: true,
336
+ isRequired: false,
337
+ transformFunction: null
338
+ },
339
+ rangeColor: {
340
+ classPropertyName: "rangeColor",
341
+ publicName: "rangeColor",
342
+ isSignal: true,
343
+ isRequired: false,
344
+ transformFunction: null
345
+ },
346
+ textColor: {
347
+ classPropertyName: "textColor",
348
+ publicName: "textColor",
349
+ isSignal: true,
350
+ isRequired: false,
351
+ transformFunction: null
352
+ },
353
+ valueTemplate: {
354
+ classPropertyName: "valueTemplate",
355
+ publicName: "valueTemplate",
356
+ isSignal: true,
357
+ isRequired: false,
358
+ transformFunction: null
359
+ },
360
+ name: {
361
+ classPropertyName: "name",
362
+ publicName: "name",
363
+ isSignal: true,
364
+ isRequired: false,
365
+ transformFunction: null
366
+ },
367
+ size: {
368
+ classPropertyName: "size",
369
+ publicName: "size",
370
+ isSignal: true,
371
+ isRequired: false,
372
+ transformFunction: null
373
+ },
374
+ step: {
375
+ classPropertyName: "step",
376
+ publicName: "step",
377
+ isSignal: true,
378
+ isRequired: false,
379
+ transformFunction: null
380
+ },
381
+ min: {
382
+ classPropertyName: "min",
383
+ publicName: "min",
384
+ isSignal: true,
385
+ isRequired: false,
386
+ transformFunction: null
387
+ },
388
+ max: {
389
+ classPropertyName: "max",
390
+ publicName: "max",
391
+ isSignal: true,
392
+ isRequired: false,
393
+ transformFunction: null
394
+ },
395
+ strokeWidth: {
396
+ classPropertyName: "strokeWidth",
397
+ publicName: "strokeWidth",
398
+ isSignal: true,
399
+ isRequired: false,
400
+ transformFunction: null
401
+ },
402
+ showValue: {
403
+ classPropertyName: "showValue",
404
+ publicName: "showValue",
405
+ isSignal: true,
406
+ isRequired: false,
407
+ transformFunction: null
408
+ },
409
+ value: {
410
+ classPropertyName: "value",
411
+ publicName: "value",
412
+ isSignal: false,
413
+ isRequired: false,
414
+ transformFunction: null
415
+ },
416
+ placeholder: {
417
+ classPropertyName: "placeholder",
418
+ publicName: "placeholder",
419
+ isSignal: false,
420
+ isRequired: false,
421
+ transformFunction: null
422
+ },
423
+ required: {
424
+ classPropertyName: "required",
425
+ publicName: "required",
426
+ isSignal: false,
427
+ isRequired: false,
428
+ transformFunction: null
429
+ },
430
+ disabled: {
431
+ classPropertyName: "disabled",
432
+ publicName: "disabled",
433
+ isSignal: false,
434
+ isRequired: false,
435
+ transformFunction: null
436
+ }
437
+ },
438
+ outputs: { valueChange: "valueChange" },
439
+ host: {
440
+ listeners: {
441
+ "keydown": "onKeyDown($event)",
442
+ "mousedown": "onMouseDown($event)",
443
+ "mouseup": "onMouseUp($event)",
444
+ "touchstart": "onTouchStart($event)",
445
+ "touchend": "onTouchEnd($event)"
446
+ },
447
+ properties: { "attr.id": "id" }
448
+ },
449
+ providers: [{
450
+ provide: MatFormFieldControl,
451
+ useExisting: CmatKnobInputComponent
452
+ }],
453
+ viewQueries: [{
454
+ propertyName: "knobElementRef",
455
+ first: true,
456
+ predicate: ["knob"],
457
+ descendants: true,
458
+ isSignal: true
459
+ }],
460
+ exportAs: ["cmatKnobInput"],
461
+ ngImport: i0,
462
+ template: "<!-- eslint-disable @angular-eslint/template/no-inline-styles -->\r\n<div\r\n #knob\r\n tabindex=\"-1\"\r\n [attr.data-refresh]=\"refreshVersion()\"\r\n [class.cmat-knob-disabled]=\"disabled\"\r\n (focusin)=\"onFocusIn()\"\r\n (focusout)=\"onFocusOut($event)\"\r\n>\r\n <svg\r\n viewBox=\"0 0 100 100\"\r\n role=\"slider\"\r\n [style.width]=\"size() + 'px'\"\r\n [style.height]=\"size() + 'px'\"\r\n [attr.aria-valuemin]=\"min()\"\r\n [attr.aria-valuemax]=\"max()\"\r\n [attr.aria-valuenow]=\"value\"\r\n [attr.tabindex]=\"disabled ? -1 : 0\"\r\n (click)=\"onClick($event)\"\r\n (keydown.enter)=\"onKeyDown($event)\"\r\n (keydown.space)=\"onKeyDown($event)\"\r\n >\r\n <path\r\n class=\"knob-range\"\r\n [attr.d]=\"rangePath()\"\r\n [attr.stroke-width]=\"strokeWidth()\"\r\n [attr.stroke]=\"rangeColor()\"\r\n ></path>\r\n <path\r\n class=\"knob-value\"\r\n [attr.d]=\"valuePath()\"\r\n [attr.stroke-width]=\"strokeWidth()\"\r\n [attr.stroke]=\"valueColor()\"\r\n ></path>\r\n @if (showValue()) {\r\n <text\r\n text-anchor=\"middle\"\r\n class=\"knob-text\"\r\n [attr.x]=\"50\"\r\n [attr.y]=\"57\"\r\n [attr.fill]=\"textColor()\"\r\n [attr.name]=\"name()\"\r\n >\r\n {{ valueToDisplay() }}\r\n </text>\r\n }\r\n </svg>\r\n</div>",
463
+ styles: ["cmat-knob-input .knob-range{fill:none;transition:stroke .1s ease-in}cmat-knob-input .knob-value{animation-name:dash-frame;animation-fill-mode:forwards;fill:none}cmat-knob-input .knob-text{font-size:1.3rem;text-align:center}cmat-knob-input .cmat-knob-disabled{opacity:.6}\n"],
464
+ changeDetection: i0.ChangeDetectionStrategy.OnPush,
465
+ encapsulation: i0.ViewEncapsulation.None
466
+ });
467
+ }
468
+ };
469
+ i0.ɵɵngDeclareClassMetadata({
470
+ minVersion: "12.0.0",
471
+ version: "22.2.3",
472
+ ngImport: i0,
473
+ type: CmatKnobInputComponent,
474
+ decorators: [{
475
+ type: Component,
476
+ args: [{
477
+ selector: "cmat-knob-input",
478
+ providers: [{
479
+ provide: MatFormFieldControl,
480
+ useExisting: CmatKnobInputComponent
481
+ }],
482
+ exportAs: "cmatKnobInput",
483
+ imports: [NgStyle],
484
+ encapsulation: ViewEncapsulation.None,
485
+ changeDetection: ChangeDetectionStrategy.OnPush,
486
+ host: { "[attr.id]": "id" },
487
+ template: "<!-- eslint-disable @angular-eslint/template/no-inline-styles -->\r\n<div\r\n #knob\r\n tabindex=\"-1\"\r\n [attr.data-refresh]=\"refreshVersion()\"\r\n [class.cmat-knob-disabled]=\"disabled\"\r\n (focusin)=\"onFocusIn()\"\r\n (focusout)=\"onFocusOut($event)\"\r\n>\r\n <svg\r\n viewBox=\"0 0 100 100\"\r\n role=\"slider\"\r\n [style.width]=\"size() + 'px'\"\r\n [style.height]=\"size() + 'px'\"\r\n [attr.aria-valuemin]=\"min()\"\r\n [attr.aria-valuemax]=\"max()\"\r\n [attr.aria-valuenow]=\"value\"\r\n [attr.tabindex]=\"disabled ? -1 : 0\"\r\n (click)=\"onClick($event)\"\r\n (keydown.enter)=\"onKeyDown($event)\"\r\n (keydown.space)=\"onKeyDown($event)\"\r\n >\r\n <path\r\n class=\"knob-range\"\r\n [attr.d]=\"rangePath()\"\r\n [attr.stroke-width]=\"strokeWidth()\"\r\n [attr.stroke]=\"rangeColor()\"\r\n ></path>\r\n <path\r\n class=\"knob-value\"\r\n [attr.d]=\"valuePath()\"\r\n [attr.stroke-width]=\"strokeWidth()\"\r\n [attr.stroke]=\"valueColor()\"\r\n ></path>\r\n @if (showValue()) {\r\n <text\r\n text-anchor=\"middle\"\r\n class=\"knob-text\"\r\n [attr.x]=\"50\"\r\n [attr.y]=\"57\"\r\n [attr.fill]=\"textColor()\"\r\n [attr.name]=\"name()\"\r\n >\r\n {{ valueToDisplay() }}\r\n </text>\r\n }\r\n </svg>\r\n</div>",
488
+ styles: ["cmat-knob-input .knob-range{fill:none;transition:stroke .1s ease-in}cmat-knob-input .knob-value{animation-name:dash-frame;animation-fill-mode:forwards;fill:none}cmat-knob-input .knob-text{font-size:1.3rem;text-align:center}cmat-knob-input .cmat-knob-disabled{opacity:.6}\n"]
489
+ }]
490
+ }],
491
+ ctorParameters: () => [],
492
+ propDecorators: {
493
+ knobElementRef: [{
494
+ type: i0.ViewChild,
495
+ args: ["knob", { isSignal: true }]
496
+ }],
497
+ valueColor: [{
498
+ type: i0.Input,
499
+ args: [{
500
+ isSignal: true,
501
+ alias: "valueColor",
502
+ required: false
503
+ }]
504
+ }],
505
+ rangeColor: [{
506
+ type: i0.Input,
507
+ args: [{
508
+ isSignal: true,
509
+ alias: "rangeColor",
510
+ required: false
511
+ }]
512
+ }],
513
+ textColor: [{
514
+ type: i0.Input,
515
+ args: [{
516
+ isSignal: true,
517
+ alias: "textColor",
518
+ required: false
519
+ }]
520
+ }],
521
+ valueTemplate: [{
522
+ type: i0.Input,
523
+ args: [{
524
+ isSignal: true,
525
+ alias: "valueTemplate",
526
+ required: false
527
+ }]
528
+ }],
529
+ name: [{
530
+ type: i0.Input,
531
+ args: [{
532
+ isSignal: true,
533
+ alias: "name",
534
+ required: false
535
+ }]
536
+ }],
537
+ size: [{
538
+ type: i0.Input,
539
+ args: [{
540
+ isSignal: true,
541
+ alias: "size",
542
+ required: false
543
+ }]
544
+ }],
545
+ step: [{
546
+ type: i0.Input,
547
+ args: [{
548
+ isSignal: true,
549
+ alias: "step",
550
+ required: false
551
+ }]
552
+ }],
553
+ min: [{
554
+ type: i0.Input,
555
+ args: [{
556
+ isSignal: true,
557
+ alias: "min",
558
+ required: false
559
+ }]
560
+ }],
561
+ max: [{
562
+ type: i0.Input,
563
+ args: [{
564
+ isSignal: true,
565
+ alias: "max",
566
+ required: false
567
+ }]
568
+ }],
569
+ strokeWidth: [{
570
+ type: i0.Input,
571
+ args: [{
572
+ isSignal: true,
573
+ alias: "strokeWidth",
574
+ required: false
575
+ }]
576
+ }],
577
+ showValue: [{
578
+ type: i0.Input,
579
+ args: [{
580
+ isSignal: true,
581
+ alias: "showValue",
582
+ required: false
583
+ }]
584
+ }],
585
+ valueChange: [{
586
+ type: i0.Output,
587
+ args: ["valueChange"]
588
+ }],
589
+ value: [{ type: Input }],
590
+ placeholder: [{ type: Input }],
591
+ required: [{ type: Input }],
592
+ disabled: [{ type: Input }],
593
+ onKeyDown: [{
594
+ type: HostListener,
595
+ args: ["keydown", ["$event"]]
596
+ }],
597
+ onMouseDown: [{
598
+ type: HostListener,
599
+ args: ["mousedown", ["$event"]]
600
+ }],
601
+ onMouseUp: [{
602
+ type: HostListener,
603
+ args: ["mouseup", ["$event"]]
604
+ }],
605
+ onTouchStart: [{
606
+ type: HostListener,
607
+ args: ["touchstart", ["$event"]]
608
+ }],
609
+ onTouchEnd: [{
610
+ type: HostListener,
611
+ args: ["touchend", ["$event"]]
612
+ }]
613
+ }
614
+ });
421
615
  export { CmatKnobInputComponent };
422
- //# sourceMappingURL=cmat-components-knob-input.mjs.map
616
+
617
+ //# sourceMappingURL=cmat-components-knob-input.mjs.map