cmat 0.0.118 → 0.0.119

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 (245) hide show
  1. package/fesm2022/cmat-components-adapter.mjs +9 -9
  2. package/fesm2022/cmat-components-breadcrumb.mjs +10 -9
  3. package/fesm2022/cmat-components-breadcrumb.mjs.map +1 -1
  4. package/fesm2022/cmat-components-card.mjs +6 -6
  5. package/fesm2022/cmat-components-card.mjs.map +1 -1
  6. package/fesm2022/cmat-components-carousel.mjs +16 -16
  7. package/fesm2022/cmat-components-carousel.mjs.map +1 -1
  8. package/fesm2022/cmat-components-cascade.mjs +1 -863
  9. package/fesm2022/cmat-components-chip-input.mjs +11 -11
  10. package/fesm2022/cmat-components-code-editor.mjs +3 -3
  11. package/fesm2022/cmat-components-color-picker.mjs +45 -45
  12. package/fesm2022/cmat-components-color-picker.mjs.map +1 -1
  13. package/fesm2022/cmat-components-custom-formly.mjs +214 -214
  14. package/fesm2022/cmat-components-custom-formly.mjs.map +1 -1
  15. package/fesm2022/cmat-components-data-picker.mjs +38 -38
  16. package/fesm2022/cmat-components-data-picker.mjs.map +1 -1
  17. package/fesm2022/cmat-components-date-range.mjs +15 -16
  18. package/fesm2022/cmat-components-date-range.mjs.map +1 -1
  19. package/fesm2022/cmat-components-date-time-display.mjs +4 -4
  20. package/fesm2022/cmat-components-drawer.mjs +9 -9
  21. package/fesm2022/cmat-components-drawer.mjs.map +1 -1
  22. package/fesm2022/cmat-components-empty-state.mjs +4 -4
  23. package/fesm2022/cmat-components-file-preview.mjs +4 -4
  24. package/fesm2022/cmat-components-filter-toolbar.mjs +12 -13
  25. package/fesm2022/cmat-components-filter-toolbar.mjs.map +1 -1
  26. package/fesm2022/cmat-components-form-actions.mjs +6 -6
  27. package/fesm2022/cmat-components-fullscreen.mjs +4 -4
  28. package/fesm2022/cmat-components-highlight.mjs +7 -7
  29. package/fesm2022/cmat-components-image-viewer.mjs +7 -7
  30. package/fesm2022/cmat-components-image-viewer.mjs.map +1 -1
  31. package/fesm2022/cmat-components-inline-loading.mjs +3 -3
  32. package/fesm2022/cmat-components-json-editor.mjs +7 -7
  33. package/fesm2022/cmat-components-json-editor.mjs.map +1 -1
  34. package/fesm2022/cmat-components-knob-input.mjs +6 -6
  35. package/fesm2022/cmat-components-loading-overlay.mjs +5 -5
  36. package/fesm2022/cmat-components-loading-overlay.mjs.map +1 -1
  37. package/fesm2022/cmat-components-masonry.mjs +4 -4
  38. package/fesm2022/cmat-components-material-color-picker.mjs +1 -337
  39. package/fesm2022/cmat-components-material-datetimepicker.mjs +1 -4312
  40. package/fesm2022/cmat-components-navigation.mjs +1 -3081
  41. package/fesm2022/cmat-components-opt-input.mjs +1 -542
  42. package/fesm2022/cmat-components-org-chart.mjs +1 -529
  43. package/fesm2022/cmat-components-page-header.mjs +4 -4
  44. package/fesm2022/cmat-components-pagination.mjs +21 -21
  45. package/fesm2022/cmat-components-pagination.mjs.map +1 -1
  46. package/fesm2022/cmat-components-password-strength.mjs +1 -880
  47. package/fesm2022/cmat-components-popover.mjs +1 -1022
  48. package/fesm2022/cmat-components-progress-bar.mjs +4 -4
  49. package/fesm2022/cmat-components-qrcode.mjs +3 -3
  50. package/fesm2022/cmat-components-rating.mjs +8 -8
  51. package/fesm2022/cmat-components-rich-text-editor.mjs +3 -3
  52. package/fesm2022/cmat-components-select-search.mjs +1 -930
  53. package/fesm2022/cmat-components-select-table.mjs +39 -39
  54. package/fesm2022/cmat-components-select-table.mjs.map +1 -1
  55. package/fesm2022/cmat-components-select-tree.mjs +28 -27
  56. package/fesm2022/cmat-components-select-tree.mjs.map +1 -1
  57. package/fesm2022/cmat-components-skeleton.mjs +5 -5
  58. package/fesm2022/cmat-components-skeleton.mjs.map +1 -1
  59. package/fesm2022/cmat-components-speed-dial.mjs +12 -12
  60. package/fesm2022/cmat-components-speed-dial.mjs.map +1 -1
  61. package/fesm2022/cmat-components-status-tag.mjs +6 -6
  62. package/fesm2022/cmat-components-status-tag.mjs.map +1 -1
  63. package/fesm2022/cmat-components-table-toolbar.mjs +4 -4
  64. package/fesm2022/cmat-components-timeline.mjs +19 -19
  65. package/fesm2022/cmat-components-timeline.mjs.map +1 -1
  66. package/fesm2022/cmat-components-toast.mjs +14 -14
  67. package/fesm2022/cmat-components-toast.mjs.map +1 -1
  68. package/fesm2022/cmat-components-transfer-picker.mjs +48 -49
  69. package/fesm2022/cmat-components-transfer-picker.mjs.map +1 -1
  70. package/fesm2022/cmat-components-treetable.mjs +8 -8
  71. package/fesm2022/cmat-components-upload.mjs +17 -17
  72. package/fesm2022/cmat-components-x6-angular-shape.mjs +1 -1
  73. package/fesm2022/cmat-directives-animate-on-scroll.mjs +1 -221
  74. package/fesm2022/cmat-directives-arrow-cursor.mjs +3 -3
  75. package/fesm2022/cmat-directives-autofocus.mjs +3 -3
  76. package/fesm2022/cmat-directives-data-exporter.mjs +1 -544
  77. package/fesm2022/cmat-directives-debounce.mjs +1 -163
  78. package/fesm2022/cmat-directives-digit-only.mjs +6 -6
  79. package/fesm2022/cmat-directives-equal-validator.mjs +3 -3
  80. package/fesm2022/cmat-directives-seamless-auto-scroll.mjs +3 -3
  81. package/fesm2022/cmat-lib-mock-api.mjs +8 -8
  82. package/fesm2022/cmat-pipes-bytes.mjs +3 -3
  83. package/fesm2022/cmat-pipes-date-format.mjs +3 -3
  84. package/fesm2022/cmat-pipes-find-by-key.mjs +3 -3
  85. package/fesm2022/cmat-pipes-group-by.mjs +3 -3
  86. package/fesm2022/cmat-pipes-keys.mjs +3 -3
  87. package/fesm2022/cmat-pipes-secure.mjs +6 -6
  88. package/fesm2022/cmat-pipes-uppercase.mjs +3 -3
  89. package/fesm2022/cmat-reports.mjs +86 -80
  90. package/fesm2022/cmat-reports.mjs.map +1 -1
  91. package/fesm2022/cmat-services-alert.mjs +4 -4
  92. package/fesm2022/cmat-services-config.mjs +6 -6
  93. package/fesm2022/cmat-services-confirmation.mjs +1 -185
  94. package/fesm2022/cmat-services-data.mjs +5 -5
  95. package/fesm2022/cmat-services-export-as.mjs +4 -4
  96. package/fesm2022/cmat-services-loading.mjs +6 -6
  97. package/fesm2022/cmat-services-local-storage.mjs +3 -3
  98. package/fesm2022/cmat-services-media-watcher.mjs +4 -4
  99. package/fesm2022/cmat-services-platform.mjs +4 -4
  100. package/fesm2022/cmat-services-print.mjs +3 -3
  101. package/fesm2022/cmat-services-splash-screen.mjs +4 -4
  102. package/fesm2022/cmat-services-title.mjs +6 -6
  103. package/fesm2022/cmat-services-translation.mjs +4 -4
  104. package/fesm2022/cmat-services-utils.mjs +7 -7
  105. package/fesm2022/cmat.mjs +77 -39582
  106. package/fesm2022/public-api-BE83BHd7.mjs +930 -0
  107. package/fesm2022/public-api-BE83BHd7.mjs.map +1 -0
  108. package/fesm2022/public-api-BcmOSkgf.mjs +542 -0
  109. package/fesm2022/public-api-BcmOSkgf.mjs.map +1 -0
  110. package/fesm2022/public-api-BmMqKDzm.mjs +4312 -0
  111. package/fesm2022/public-api-BmMqKDzm.mjs.map +1 -0
  112. package/fesm2022/public-api-BnRFazGR.mjs +221 -0
  113. package/fesm2022/public-api-BnRFazGR.mjs.map +1 -0
  114. package/fesm2022/public-api-C9N9rKkB.mjs +185 -0
  115. package/fesm2022/public-api-C9N9rKkB.mjs.map +1 -0
  116. package/fesm2022/public-api-CXmCX9ZQ.mjs +863 -0
  117. package/fesm2022/public-api-CXmCX9ZQ.mjs.map +1 -0
  118. package/fesm2022/public-api-CfILyvuV.mjs +880 -0
  119. package/fesm2022/public-api-CfILyvuV.mjs.map +1 -0
  120. package/fesm2022/public-api-CgtBw-7O.mjs +163 -0
  121. package/fesm2022/public-api-CgtBw-7O.mjs.map +1 -0
  122. package/fesm2022/public-api-DEtzrfqy.mjs +544 -0
  123. package/fesm2022/public-api-DEtzrfqy.mjs.map +1 -0
  124. package/fesm2022/public-api-EK51WC1y.mjs +1022 -0
  125. package/fesm2022/public-api-EK51WC1y.mjs.map +1 -0
  126. package/fesm2022/public-api-IpTsAgZ4.mjs +3081 -0
  127. package/fesm2022/public-api-IpTsAgZ4.mjs.map +1 -0
  128. package/fesm2022/public-api-iRaKIVmd.mjs +338 -0
  129. package/fesm2022/public-api-iRaKIVmd.mjs.map +1 -0
  130. package/fesm2022/public-api-nzzDLiDj.mjs +529 -0
  131. package/fesm2022/public-api-nzzDLiDj.mjs.map +1 -0
  132. package/fesm2022/{cmat-quill-docx-exporter-D9Eo73Wq.mjs → quill-docx-exporter-D9Eo73Wq.mjs} +1 -1
  133. package/fesm2022/quill-docx-exporter-D9Eo73Wq.mjs.map +1 -0
  134. package/package.json +23 -22
  135. package/types/cmat-components-adapter.d.ts +0 -3
  136. package/types/cmat-components-breadcrumb.d.ts +1 -4
  137. package/types/cmat-components-card.d.ts +0 -3
  138. package/types/cmat-components-carousel.d.ts +0 -3
  139. package/types/cmat-components-cascade.d.ts +0 -3
  140. package/types/cmat-components-chip-input.d.ts +3 -6
  141. package/types/cmat-components-code-editor.d.ts +0 -3
  142. package/types/cmat-components-color-picker.d.ts +0 -3
  143. package/types/cmat-components-custom-formly.d.ts +2 -861
  144. package/types/cmat-components-data-picker.d.ts +6 -9
  145. package/types/cmat-components-date-range.d.ts +1 -4
  146. package/types/cmat-components-date-time-display.d.ts +0 -3
  147. package/types/cmat-components-drawer.d.ts +1 -4
  148. package/types/cmat-components-empty-state.d.ts +0 -3
  149. package/types/cmat-components-file-preview.d.ts +0 -3
  150. package/types/cmat-components-filter-toolbar.d.ts +0 -3
  151. package/types/cmat-components-form-actions.d.ts +1 -4
  152. package/types/cmat-components-fullscreen.d.ts +0 -3
  153. package/types/cmat-components-highlight.d.ts +0 -3
  154. package/types/cmat-components-image-viewer.d.ts +0 -3
  155. package/types/cmat-components-inline-loading.d.ts +0 -3
  156. package/types/cmat-components-json-editor.d.ts +0 -3
  157. package/types/cmat-components-knob-input.d.ts +1 -4
  158. package/types/cmat-components-loading-overlay.d.ts +0 -3
  159. package/types/cmat-components-masonry.d.ts +0 -3
  160. package/types/cmat-components-material-color-picker.d.ts +1 -4
  161. package/types/cmat-components-material-datetimepicker.d.ts +2 -840
  162. package/types/cmat-components-navigation.d.ts +1 -4
  163. package/types/cmat-components-opt-input.d.ts +2 -117
  164. package/types/cmat-components-org-chart.d.ts +1 -4
  165. package/types/cmat-components-page-header.d.ts +1 -4
  166. package/types/cmat-components-pagination.d.ts +0 -3
  167. package/types/cmat-components-password-strength.d.ts +2 -205
  168. package/types/cmat-components-popover.d.ts +2 -274
  169. package/types/cmat-components-progress-bar.d.ts +0 -3
  170. package/types/cmat-components-qrcode.d.ts +2 -117
  171. package/types/cmat-components-rating.d.ts +1 -4
  172. package/types/cmat-components-rich-text-editor.d.ts +1 -4
  173. package/types/cmat-components-select-search.d.ts +2 -204
  174. package/types/cmat-components-select-table.d.ts +3 -6
  175. package/types/cmat-components-select-tree.d.ts +4 -7
  176. package/types/cmat-components-skeleton.d.ts +0 -3
  177. package/types/cmat-components-speed-dial.d.ts +0 -3
  178. package/types/cmat-components-status-tag.d.ts +2 -5
  179. package/types/cmat-components-table-toolbar.d.ts +0 -3
  180. package/types/cmat-components-timeline.d.ts +0 -3
  181. package/types/cmat-components-toast.d.ts +0 -3
  182. package/types/cmat-components-transfer-picker.d.ts +2 -5
  183. package/types/cmat-components-treetable.d.ts +0 -3
  184. package/types/cmat-components-upload.d.ts +1 -4
  185. package/types/cmat-components-x6-angular-shape.d.ts +1 -4
  186. package/types/cmat-directives-animate-on-scroll.d.ts +0 -3
  187. package/types/cmat-directives-arrow-cursor.d.ts +0 -3
  188. package/types/cmat-directives-autofocus.d.ts +0 -3
  189. package/types/cmat-directives-data-exporter.d.ts +1 -4
  190. package/types/cmat-directives-debounce.d.ts +2 -38
  191. package/types/cmat-directives-digit-only.d.ts +0 -3
  192. package/types/cmat-directives-equal-validator.d.ts +1 -4
  193. package/types/cmat-directives-seamless-auto-scroll.d.ts +1 -4
  194. package/types/cmat-lib-mock-api.d.ts +1 -4
  195. package/types/cmat-pipes-bytes.d.ts +0 -3
  196. package/types/cmat-pipes-date-format.d.ts +0 -3
  197. package/types/cmat-pipes-find-by-key.d.ts +0 -3
  198. package/types/cmat-pipes-group-by.d.ts +0 -3
  199. package/types/cmat-pipes-keys.d.ts +0 -3
  200. package/types/cmat-pipes-secure.d.ts +1 -4
  201. package/types/cmat-pipes-uppercase.d.ts +0 -3
  202. package/types/cmat-reports.d.ts +6 -9
  203. package/types/cmat-services-alert.d.ts +1 -4
  204. package/types/cmat-services-config.d.ts +0 -3
  205. package/types/cmat-services-confirmation.d.ts +2 -40
  206. package/types/cmat-services-data.d.ts +1 -4
  207. package/types/cmat-services-export-as.d.ts +1 -4
  208. package/types/cmat-services-loading.d.ts +1 -4
  209. package/types/cmat-services-local-storage.d.ts +0 -3
  210. package/types/cmat-services-media-watcher.d.ts +0 -3
  211. package/types/cmat-services-platform.d.ts +0 -3
  212. package/types/cmat-services-print.d.ts +0 -3
  213. package/types/cmat-services-splash-screen.d.ts +0 -3
  214. package/types/cmat-services-title.d.ts +0 -3
  215. package/types/cmat-services-translation.d.ts +1 -4
  216. package/types/cmat-services-utils.d.ts +2 -5
  217. package/types/cmat-validators.d.ts +0 -3
  218. package/types/cmat-version.d.ts +0 -3
  219. package/types/cmat.d.ts +78 -7686
  220. package/types/public-api-BFGGDRK3.d.ts +201 -0
  221. package/types/public-api-BXS379ev.d.ts +202 -0
  222. package/types/public-api-C4CvABGO.d.ts +114 -0
  223. package/types/public-api-CSYz4G5Z.d.ts +271 -0
  224. package/types/public-api-NSrmlKKH.d.ts +114 -0
  225. package/types/public-api-PfNpHSSm.d.ts +837 -0
  226. package/types/public-api-f3WtygQS.d.ts +35 -0
  227. package/types/public-api-nBuSXSMJ.d.ts +858 -0
  228. package/types/public-api-yYeZrUAV.d.ts +37 -0
  229. package/fesm2022/cmat-components-cascade.mjs.map +0 -1
  230. package/fesm2022/cmat-components-custom-formly-quill-docx-exporter-BwwGX2Ie.mjs +0 -294
  231. package/fesm2022/cmat-components-custom-formly-quill-docx-exporter-BwwGX2Ie.mjs.map +0 -1
  232. package/fesm2022/cmat-components-material-color-picker.mjs.map +0 -1
  233. package/fesm2022/cmat-components-material-datetimepicker.mjs.map +0 -1
  234. package/fesm2022/cmat-components-navigation.mjs.map +0 -1
  235. package/fesm2022/cmat-components-opt-input.mjs.map +0 -1
  236. package/fesm2022/cmat-components-org-chart.mjs.map +0 -1
  237. package/fesm2022/cmat-components-password-strength.mjs.map +0 -1
  238. package/fesm2022/cmat-components-popover.mjs.map +0 -1
  239. package/fesm2022/cmat-components-select-search.mjs.map +0 -1
  240. package/fesm2022/cmat-directives-animate-on-scroll.mjs.map +0 -1
  241. package/fesm2022/cmat-directives-data-exporter.mjs.map +0 -1
  242. package/fesm2022/cmat-directives-debounce.mjs.map +0 -1
  243. package/fesm2022/cmat-quill-docx-exporter-D9Eo73Wq.mjs.map +0 -1
  244. package/fesm2022/cmat-services-confirmation.mjs.map +0 -1
  245. package/fesm2022/cmat.mjs.map +0 -1
@@ -1,542 +1 @@
1
- import { coerceBooleanProperty } from "@angular/cdk/coercion";
2
- import * as i1 from "@angular/common";
3
- import { CommonModule } from "@angular/common";
4
- import * as i0 from "@angular/core";
5
- import { ChangeDetectionStrategy, Component, DOCUMENT, DestroyRef, Input, ViewEncapsulation, computed, inject, input, output, signal } from "@angular/core";
6
- import { takeUntilDestroyed } from "@angular/core/rxjs-interop";
7
- import * as i2 from "@angular/forms";
8
- import { FormBuilder, FormControl, NgControl, ReactiveFormsModule } from "@angular/forms";
9
- import { MatFormFieldControl } from "@angular/material/form-field";
10
- import { Subject } from "rxjs";
11
- var KeyboardUtil = class {
12
- static ifTab(event) {
13
- return this.ifKey(event, "Tab");
14
- }
15
- static ifDelete(event) {
16
- return this.ifKey(event, "Delete;Del");
17
- }
18
- static ifBackspace(event) {
19
- return this.ifKey(event, "Backspace");
20
- }
21
- static ifRightArrow(event) {
22
- return this.ifKey(event, "ArrowRight;Right");
23
- }
24
- static ifLeftArrow(event) {
25
- return this.ifKey(event, "ArrowLeft;Left");
26
- }
27
- static ifSpacebar(event) {
28
- return this.ifKey(event, "Spacebar; ");
29
- }
30
- static ifKey(event, keys) {
31
- return keys.split(";").some((k) => k === event.key);
32
- }
33
- };
34
- let NEXT_ID = 1;
35
- var CmatOtpInputComponent = class CmatOtpInputComponent {
36
- get errorState() {
37
- if (this.ngControl == null) return false;
38
- return (this.ngControl.invalid && ((this.ngControl.dirty ?? false) || this.ngControl.touched)) ?? false;
39
- }
40
- constructor() {
41
- this.config = input({ length: 4 }, ...ngDevMode ? [{ debugName: "config" }] : /* istanbul ignore next */ []);
42
- this.onBlur = output();
43
- this.onInputChange = output();
44
- this.id = `cmat-otp-input-${NEXT_ID}`;
45
- this.stateChanges = new Subject();
46
- this._placeholderSignal = signal("", ...ngDevMode ? [{ debugName: "_placeholderSignal" }] : /* istanbul ignore next */ []);
47
- this._requiredSignal = signal(false, ...ngDevMode ? [{ debugName: "_requiredSignal" }] : /* istanbul ignore next */ []);
48
- this._disabledSignal = signal(false, ...ngDevMode ? [{ debugName: "_disabledSignal" }] : /* istanbul ignore next */ []);
49
- this._valueSignal = signal(null, ...ngDevMode ? [{ debugName: "_valueSignal" }] : /* istanbul ignore next */ []);
50
- this._currentValSignal = signal(null, ...ngDevMode ? [{ debugName: "_currentValSignal" }] : /* istanbul ignore next */ []);
51
- this._focused = false;
52
- this._activeFocusCount = 0;
53
- this.controlKeys = computed(() => Object.keys(this.otpForm?.controls ?? {}), ...ngDevMode ? [{ debugName: "controlKeys" }] : /* istanbul ignore next */ []);
54
- this.inputType = computed(() => {
55
- const cfg = this.config();
56
- return cfg?.isPasswordInput ? "password" : cfg?.allowNumbersOnly ? "tel" : "text";
57
- }, ...ngDevMode ? [{ debugName: "inputType" }] : /* istanbul ignore next */ []);
58
- this.componentKey = (NEXT_ID++).toString(36);
59
- this.ngControl = inject(NgControl, {
60
- optional: true,
61
- self: true
62
- });
63
- this._document = inject(DOCUMENT);
64
- this._formBuilder = inject(FormBuilder);
65
- this._destroyRef = inject(DestroyRef);
66
- this._valueChangesSub = null;
67
- this._pendingTimeouts = [];
68
- this._onModelChange = () => {};
69
- this._onTouchedChange = () => {};
70
- this.otpForm = this._formBuilder.group({});
71
- if (this.ngControl != null) this.ngControl.valueAccessor = this;
72
- this._rebuildForm();
73
- }
74
- get placeholder() {
75
- return this._placeholderSignal();
76
- }
77
- set placeholder(value) {
78
- this._placeholderSignal.set(value);
79
- this.stateChanges.next();
80
- }
81
- get required() {
82
- return this._requiredSignal();
83
- }
84
- set required(value) {
85
- this._requiredSignal.set(coerceBooleanProperty(value));
86
- this.stateChanges.next();
87
- }
88
- get disabled() {
89
- if (!this.ngControl.disabled && this.ngControl.disabled !== null) return this.ngControl.disabled;
90
- return this._disabledSignal();
91
- }
92
- set disabled(value) {
93
- const isDisabled = coerceBooleanProperty(value);
94
- this._disabledSignal.set(isDisabled);
95
- this.setDisabledState(isDisabled);
96
- if (isDisabled && this._focused) {
97
- this._focused = false;
98
- this.stateChanges.next();
99
- }
100
- }
101
- get focused() {
102
- return this._focused;
103
- }
104
- get value() {
105
- return this._valueSignal();
106
- }
107
- set value(val) {
108
- if (val !== this._valueSignal()) {
109
- this._valueSignal.set(val);
110
- this.stateChanges.next();
111
- this._onModelChange(val);
112
- }
113
- }
114
- get empty() {
115
- return !this._valueSignal();
116
- }
117
- get shouldLabelFloat() {
118
- return this._focused || !this.empty;
119
- }
120
- setDisabledState(isDisabled) {
121
- if (this.otpForm) {
122
- if (isDisabled) this.otpForm.disable({ emitEvent: false });
123
- else this.otpForm.enable({ emitEvent: false });
124
- }
125
- this.stateChanges.next();
126
- }
127
- writeValue(value) {
128
- this._currentValSignal.set(value || null);
129
- if (this.otpForm && this._currentValSignal()) this.setValue(this._currentValSignal());
130
- }
131
- registerOnChange(fn) {
132
- this._onModelChange = fn;
133
- }
134
- registerOnTouched(fn) {
135
- this._onTouchedChange = fn;
136
- }
137
- onFocusIn() {
138
- this._onTouchedChange();
139
- this._activeFocusCount++;
140
- if (!this._focused) {
141
- this._focused = true;
142
- this.stateChanges.next();
143
- }
144
- }
145
- onFocusOut() {
146
- const timeoutId = setTimeout(() => {
147
- this._removePendingTimeout(timeoutId);
148
- this._activeFocusCount--;
149
- if (this._activeFocusCount === 0) {
150
- this._focused = false;
151
- this._onTouchedChange();
152
- this.onBlur.emit();
153
- this.stateChanges.next();
154
- }
155
- }, 0);
156
- this._pendingTimeouts.push(timeoutId);
157
- }
158
- ngAfterViewInit() {
159
- if (!this.config().disableAutoFocus) {
160
- const containerItem = this._document.getElementById(`c_${this.componentKey}`);
161
- if (containerItem) {
162
- const ele = containerItem.getElementsByClassName("cmat-otp-input")[0];
163
- if (ele?.focus) ele.focus();
164
- }
165
- }
166
- }
167
- ngOnDestroy() {
168
- this._pendingTimeouts.forEach((id) => clearTimeout(id));
169
- this._pendingTimeouts = [];
170
- this._valueChangesSub?.unsubscribe();
171
- this._valueChangesSub = null;
172
- this.stateChanges.complete();
173
- this.otpForm.reset();
174
- }
175
- setDescribedByIds(ids) {
176
- this.userAriaDescribedBy = ids.length ? ids.join(" ") : void 0;
177
- const containerItem = this._document.getElementById(`c_${this.componentKey}`);
178
- if (containerItem) {
179
- if (ids.length) containerItem.setAttribute("aria-describedby", ids.join(" "));
180
- else containerItem.removeAttribute("aria-describedby");
181
- }
182
- this.stateChanges.next();
183
- }
184
- onContainerClick() {
185
- if (!this._focused) {
186
- const containerItem = this._document.getElementById(`c_${this.componentKey}`);
187
- if (containerItem) containerItem.focus();
188
- }
189
- }
190
- onKeyDown($event, inputIdx) {
191
- const inputTarget = $event.target;
192
- const prevInputId = this.getBoxId(inputIdx - 1);
193
- const currentInputId = this.getBoxId(inputIdx);
194
- const nextInputId = this.getBoxId(inputIdx + 1);
195
- if (KeyboardUtil.ifSpacebar($event)) {
196
- $event.preventDefault();
197
- return;
198
- }
199
- if (KeyboardUtil.ifBackspace($event)) {
200
- if (!inputTarget.value) {
201
- this._clearInput(prevInputId, inputIdx - 1);
202
- this._setSelected(prevInputId);
203
- } else this._clearInput(currentInputId, inputIdx);
204
- this._rebuildValue();
205
- return;
206
- }
207
- if (KeyboardUtil.ifDelete($event)) {
208
- if (!inputTarget.value) {
209
- this._clearInput(prevInputId, inputIdx - 1);
210
- this._setSelected(prevInputId);
211
- } else this._clearInput(currentInputId, inputIdx);
212
- this._rebuildValue();
213
- return;
214
- }
215
- if (this.ifValidKeyCode($event)) {
216
- inputTarget.value = $event.key;
217
- const ctrlName = this._getControlName(inputIdx);
218
- this.otpForm.controls[ctrlName]?.setValue($event.key);
219
- $event.preventDefault();
220
- this._setSelected(nextInputId);
221
- this._rebuildValue();
222
- }
223
- }
224
- onInput($event, inputIdx) {
225
- const inputTarget = $event.target;
226
- const currentVal = this._currentValSignal();
227
- const newVal = currentVal ? `${currentVal}${inputTarget.value}` : inputTarget.value;
228
- if (this.config().allowNumbersOnly && !this.validateNumber(newVal)) {
229
- inputTarget.value = "";
230
- $event.stopPropagation();
231
- this._clearInput(null, inputIdx);
232
- this._rebuildValue();
233
- }
234
- }
235
- onKeyUp($event, inputIdx) {
236
- if (KeyboardUtil.ifTab($event)) inputIdx -= 1;
237
- const nextInputId = this.getBoxId(inputIdx + 1);
238
- const prevInputId = this.getBoxId(inputIdx - 1);
239
- if (KeyboardUtil.ifRightArrow($event)) {
240
- $event.preventDefault();
241
- this._setSelected(nextInputId);
242
- return;
243
- }
244
- if (KeyboardUtil.ifLeftArrow($event)) {
245
- $event.preventDefault();
246
- this._setSelected(prevInputId);
247
- return;
248
- }
249
- if (!$event.target?.value) return;
250
- }
251
- validateNumber(val) {
252
- return !!val && /^[0-9]+$/.test(val);
253
- }
254
- getBoxId(idx) {
255
- return `otp_${idx}_${this.componentKey}`;
256
- }
257
- focusTo(eleId) {
258
- const ele = this._document.getElementById(eleId);
259
- if (ele) ele.focus();
260
- }
261
- setValue(value) {
262
- const cfg = this.config();
263
- if (cfg.allowNumbersOnly && isNaN(value)) return;
264
- this.otpForm.reset();
265
- if (!value) {
266
- this._rebuildValue();
267
- return;
268
- }
269
- value = value.toString().replace(/\s/g, "");
270
- Array.from(value).forEach((c, idx) => {
271
- if (this.otpForm.get(this._getControlName(idx))) this.otpForm.get(this._getControlName(idx)).setValue(c);
272
- });
273
- if (!cfg.disableAutoFocus) {
274
- const outerTimeoutId = setTimeout(() => {
275
- this._removePendingTimeout(outerTimeoutId);
276
- const containerItem = this._document.getElementById(`c_${this.componentKey}`);
277
- if (!containerItem) return;
278
- const indexOfElementToFocus = value.length < cfg.length ? value.length : cfg.length - 1;
279
- const ele = containerItem.getElementsByClassName("cmat-otp-input")[indexOfElementToFocus];
280
- if (ele) {
281
- const innerTimeoutId = setTimeout(() => {
282
- this._removePendingTimeout(innerTimeoutId);
283
- ele.focus();
284
- }, 1);
285
- this._pendingTimeouts.push(innerTimeoutId);
286
- }
287
- }, 0);
288
- this._pendingTimeouts.push(outerTimeoutId);
289
- }
290
- this._rebuildValue();
291
- }
292
- handlePaste(e) {
293
- const clipboardData = e.clipboardData ?? window.clipboardData;
294
- let pastedData = "";
295
- if (clipboardData) pastedData = clipboardData.getData("Text");
296
- e.stopPropagation();
297
- e.preventDefault();
298
- if (!pastedData || this.config().allowNumbersOnly && !this.validateNumber(pastedData)) return;
299
- this.setValue(pastedData);
300
- }
301
- getFormControl(key) {
302
- return this.otpForm.controls[key];
303
- }
304
- _removePendingTimeout(timeoutId) {
305
- const idx = this._pendingTimeouts.indexOf(timeoutId);
306
- if (idx !== -1) this._pendingTimeouts.splice(idx, 1);
307
- }
308
- _getControlName(idx) {
309
- return `ctrl_${idx}`;
310
- }
311
- _clearInput(eleId, inputIdx) {
312
- const ctrlName = this._getControlName(inputIdx);
313
- this.otpForm.controls[ctrlName]?.setValue(null);
314
- if (eleId) {
315
- const ele = this._document.getElementById(eleId);
316
- if (ele && ele instanceof HTMLInputElement) ele.value = "";
317
- }
318
- }
319
- _setSelected(eleId) {
320
- this.focusTo(eleId);
321
- const ele = this._document.getElementById(eleId);
322
- if (ele instanceof HTMLInputElement) {
323
- const timeoutId = setTimeout(() => {
324
- this._removePendingTimeout(timeoutId);
325
- ele.setSelectionRange(0, 1);
326
- }, 0);
327
- this._pendingTimeouts.push(timeoutId);
328
- }
329
- }
330
- ifValidKeyCode(event) {
331
- const inp = event.key;
332
- if (this.config()?.allowNumbersOnly) return this.validateNumber(inp);
333
- return /iPhone|iPad|iPod|Android/i.test(navigator.userAgent) || /^[a-zA-Z0-9%*_\-@#$!]$/.test(inp) && inp.length === 1;
334
- }
335
- _rebuildValue() {
336
- let val = null;
337
- const cfg = this.config();
338
- Object.keys(this.otpForm.controls).forEach((k) => {
339
- let ctrlVal = this.otpForm.controls[k].value;
340
- if (typeof ctrlVal === "string" && ctrlVal) {
341
- const isLengthExceed = ctrlVal.length > 1;
342
- ctrlVal = ctrlVal[0];
343
- const letterCase = cfg.letterCase?.toLocaleLowerCase();
344
- if (!cfg.allowNumbersOnly && (letterCase === "upper" || letterCase === "lower")) {
345
- ctrlVal = letterCase === "upper" ? ctrlVal.toUpperCase() : ctrlVal.toLowerCase();
346
- this.otpForm.controls[k].setValue(ctrlVal);
347
- } else if (isLengthExceed) this.otpForm.controls[k].setValue(ctrlVal);
348
- val = val === null ? ctrlVal : val + ctrlVal;
349
- }
350
- });
351
- if (this._currentValSignal() != val) {
352
- this._currentValSignal.set(val);
353
- this._onModelChange(val);
354
- this.onInputChange.emit(val);
355
- }
356
- }
357
- _rebuildForm() {
358
- this._valueChangesSub?.unsubscribe();
359
- this._valueChangesSub = null;
360
- this.otpForm = this._formBuilder.group({});
361
- for (let index = 0; index < this.config().length; index++) this.otpForm.addControl(this._getControlName(index), new FormControl());
362
- this._valueChangesSub = this.otpForm.valueChanges.pipe(takeUntilDestroyed(this._destroyRef)).subscribe(() => {
363
- Object.keys(this.otpForm.controls).forEach((k) => {
364
- const val = this.otpForm.controls[k].value;
365
- if (typeof val === "string" && val.length > 1) {
366
- if (val.length >= this.config().length) this.setValue(val);
367
- else this._rebuildValue();
368
- }
369
- });
370
- });
371
- }
372
- static {
373
- this.ɵfac = i0.ɵɵngDeclareFactory({
374
- minVersion: "12.0.0",
375
- version: "22.2.6",
376
- ngImport: i0,
377
- type: CmatOtpInputComponent,
378
- deps: [],
379
- target: i0.ɵɵFactoryTarget.Component
380
- });
381
- }
382
- static {
383
- this.ɵcmp = i0.ɵɵngDeclareComponent({
384
- minVersion: "17.0.0",
385
- version: "22.2.6",
386
- type: CmatOtpInputComponent,
387
- isStandalone: true,
388
- selector: "cmat-otp-input",
389
- inputs: {
390
- config: {
391
- classPropertyName: "config",
392
- publicName: "config",
393
- isSignal: true,
394
- isRequired: false,
395
- transformFunction: null
396
- },
397
- placeholder: {
398
- classPropertyName: "placeholder",
399
- publicName: "placeholder",
400
- isSignal: false,
401
- isRequired: false,
402
- transformFunction: null
403
- },
404
- required: {
405
- classPropertyName: "required",
406
- publicName: "required",
407
- isSignal: false,
408
- isRequired: false,
409
- transformFunction: null
410
- },
411
- disabled: {
412
- classPropertyName: "disabled",
413
- publicName: "disabled",
414
- isSignal: false,
415
- isRequired: false,
416
- transformFunction: null
417
- },
418
- value: {
419
- classPropertyName: "value",
420
- publicName: "value",
421
- isSignal: false,
422
- isRequired: false,
423
- transformFunction: null
424
- }
425
- },
426
- outputs: {
427
- onBlur: "onBlur",
428
- onInputChange: "onInputChange"
429
- },
430
- host: { properties: { "attr.id": "id" } },
431
- providers: [{
432
- provide: MatFormFieldControl,
433
- useExisting: CmatOtpInputComponent
434
- }],
435
- exportAs: ["cmatOtpInput"],
436
- ngImport: i0,
437
- template: "@if(otpForm.controls){\r\n<div class=\"cmat-otp-input-wrapper wrapper {{config().containerClass}}\" id=\"c_{{componentKey}}\"\r\n [attr.tabindex]=\"disabled ? -1 : 0\" [ngStyle]=\"config().containerStyles\" (focusin)=\"onFocusIn()\" (focusout)=\"onFocusOut()\">\r\n <div class=\"n-o-c\">\r\n @for (item of controlKeys(); track item) {\r\n <input #inp class=\"cmat-otp-input {{config().inputClass}}\" autocomplete=\"one-time-code\" [pattern]=\"config().allowNumbersOnly ? '\\\\d*' : ''\"\r\n [type]=\"inputType()\" [placeholder]=\"config().placeholder || ''\"\r\n [ngStyle]=\"config().inputStyles\" [id]=\"getBoxId($index)\"\r\n [ngClass]=\"{'error-input': (config().showError && errorState)}\"\r\n [formControl]=\"getFormControl(item)\" (paste)=\"handlePaste($event)\" (keyup)=\"onKeyUp($event,$index)\"\r\n (input)=\"onInput($event,$index)\" (keydown)=\"onKeyDown($event,$index)\">\r\n @if(config().separator && !$last){\r\n {{config().separator}}\r\n }\r\n }\r\n </div>\r\n</div>\r\n}",
438
- styles: [".cmat-otp-input{width:50px;height:50px;border-radius:4px;border:solid 1px;border-color:rgba(var(--cmat-text-hint-rgb),.5);text-align:center;font-size:32px}.cmat-otp-input:focus{background-color:var(--cmat-divider);border:solid 2px var(--cmat-primary)}.cmat-otp-input-wrapper .cmat-otp-input{margin:0 .51rem}.cmat-otp-input-wrapper .cmat-otp-input:first-child{margin-left:0}.cmat-otp-input-wrapper .cmat-otp-input:last-child{margin-right:0}.n-o-c{display:flex;align-items:center}.error-input{border-color:var(--cmat-warn)}@media screen and (max-width:767px){.cmat-otp-input{width:40px;font-size:24px;height:40px}}@media screen and (max-width:420px){.cmat-otp-input{width:30px;font-size:18px;height:30px}}\n"],
439
- dependencies: [
440
- {
441
- kind: "ngmodule",
442
- type: CommonModule
443
- },
444
- {
445
- kind: "directive",
446
- type: i1.NgClass,
447
- selector: "[ngClass]",
448
- inputs: ["class", "ngClass"]
449
- },
450
- {
451
- kind: "directive",
452
- type: i1.NgStyle,
453
- selector: "[ngStyle]",
454
- inputs: ["ngStyle"]
455
- },
456
- {
457
- kind: "ngmodule",
458
- type: ReactiveFormsModule
459
- },
460
- {
461
- kind: "directive",
462
- type: i2.DefaultValueAccessor,
463
- 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]"
464
- },
465
- {
466
- kind: "directive",
467
- type: i2.NgControlStatus,
468
- selector: "[formControlName],[ngModel],[formControl]"
469
- },
470
- {
471
- kind: "directive",
472
- type: i2.PatternValidator,
473
- selector: "[pattern][formControlName],[pattern][formControl],[pattern][ngModel]",
474
- inputs: ["pattern"]
475
- },
476
- {
477
- kind: "directive",
478
- type: i2.FormControlDirective,
479
- selector: "[formControl]",
480
- inputs: [
481
- "formControl",
482
- "disabled",
483
- "ngModel"
484
- ],
485
- outputs: ["ngModelChange"],
486
- exportAs: ["ngForm"]
487
- }
488
- ],
489
- changeDetection: i0.ChangeDetectionStrategy.OnPush,
490
- encapsulation: i0.ViewEncapsulation.None
491
- });
492
- }
493
- };
494
- i0.ɵɵngDeclareClassMetadata({
495
- minVersion: "12.0.0",
496
- version: "22.2.6",
497
- ngImport: i0,
498
- type: CmatOtpInputComponent,
499
- decorators: [{
500
- type: Component,
501
- args: [{
502
- selector: "cmat-otp-input",
503
- exportAs: "cmatOtpInput",
504
- imports: [CommonModule, ReactiveFormsModule],
505
- providers: [{
506
- provide: MatFormFieldControl,
507
- useExisting: CmatOtpInputComponent
508
- }],
509
- encapsulation: ViewEncapsulation.None,
510
- changeDetection: ChangeDetectionStrategy.OnPush,
511
- host: { "[attr.id]": "id" },
512
- template: "@if(otpForm.controls){\r\n<div class=\"cmat-otp-input-wrapper wrapper {{config().containerClass}}\" id=\"c_{{componentKey}}\"\r\n [attr.tabindex]=\"disabled ? -1 : 0\" [ngStyle]=\"config().containerStyles\" (focusin)=\"onFocusIn()\" (focusout)=\"onFocusOut()\">\r\n <div class=\"n-o-c\">\r\n @for (item of controlKeys(); track item) {\r\n <input #inp class=\"cmat-otp-input {{config().inputClass}}\" autocomplete=\"one-time-code\" [pattern]=\"config().allowNumbersOnly ? '\\\\d*' : ''\"\r\n [type]=\"inputType()\" [placeholder]=\"config().placeholder || ''\"\r\n [ngStyle]=\"config().inputStyles\" [id]=\"getBoxId($index)\"\r\n [ngClass]=\"{'error-input': (config().showError && errorState)}\"\r\n [formControl]=\"getFormControl(item)\" (paste)=\"handlePaste($event)\" (keyup)=\"onKeyUp($event,$index)\"\r\n (input)=\"onInput($event,$index)\" (keydown)=\"onKeyDown($event,$index)\">\r\n @if(config().separator && !$last){\r\n {{config().separator}}\r\n }\r\n }\r\n </div>\r\n</div>\r\n}",
513
- styles: [".cmat-otp-input{width:50px;height:50px;border-radius:4px;border:solid 1px;border-color:rgba(var(--cmat-text-hint-rgb),.5);text-align:center;font-size:32px}.cmat-otp-input:focus{background-color:var(--cmat-divider);border:solid 2px var(--cmat-primary)}.cmat-otp-input-wrapper .cmat-otp-input{margin:0 .51rem}.cmat-otp-input-wrapper .cmat-otp-input:first-child{margin-left:0}.cmat-otp-input-wrapper .cmat-otp-input:last-child{margin-right:0}.n-o-c{display:flex;align-items:center}.error-input{border-color:var(--cmat-warn)}@media screen and (max-width:767px){.cmat-otp-input{width:40px;font-size:24px;height:40px}}@media screen and (max-width:420px){.cmat-otp-input{width:30px;font-size:18px;height:30px}}\n"]
514
- }]
515
- }],
516
- ctorParameters: () => [],
517
- propDecorators: {
518
- config: [{
519
- type: i0.Input,
520
- args: [{
521
- isSignal: true,
522
- alias: "config",
523
- required: false
524
- }]
525
- }],
526
- onBlur: [{
527
- type: i0.Output,
528
- args: ["onBlur"]
529
- }],
530
- onInputChange: [{
531
- type: i0.Output,
532
- args: ["onInputChange"]
533
- }],
534
- placeholder: [{ type: Input }],
535
- required: [{ type: Input }],
536
- disabled: [{ type: Input }],
537
- value: [{ type: Input }]
538
- }
539
- });
540
- export { CmatOtpInputComponent };
541
-
542
- //# sourceMappingURL=cmat-components-opt-input.mjs.map
1
+ export { t as CmatOtpInputComponent } from "./public-api-BcmOSkgf.mjs";