cmat 0.0.111 → 0.0.113

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (256) hide show
  1. package/fesm2022/cmat-components-adapter.mjs +531 -536
  2. package/fesm2022/cmat-components-adapter.mjs.map +1 -1
  3. package/fesm2022/cmat-components-breadcrumb.mjs +521 -356
  4. package/fesm2022/cmat-components-breadcrumb.mjs.map +1 -1
  5. package/fesm2022/cmat-components-card.mjs +150 -42
  6. package/fesm2022/cmat-components-card.mjs.map +1 -1
  7. package/fesm2022/cmat-components-carousel.mjs +1120 -629
  8. package/fesm2022/cmat-components-carousel.mjs.map +1 -1
  9. package/fesm2022/cmat-components-cascade.mjs +861 -441
  10. package/fesm2022/cmat-components-cascade.mjs.map +1 -1
  11. package/fesm2022/cmat-components-chip-input.mjs +580 -335
  12. package/fesm2022/cmat-components-chip-input.mjs.map +1 -1
  13. package/fesm2022/cmat-components-code-editor.mjs +197 -105
  14. package/fesm2022/cmat-components-code-editor.mjs.map +1 -1
  15. package/fesm2022/cmat-components-color-picker.mjs +1762 -825
  16. package/fesm2022/cmat-components-color-picker.mjs.map +1 -1
  17. package/fesm2022/cmat-components-custom-formly.mjs +5196 -2531
  18. package/fesm2022/cmat-components-custom-formly.mjs.map +1 -1
  19. package/fesm2022/cmat-components-data-picker.mjs +1901 -1073
  20. package/fesm2022/cmat-components-data-picker.mjs.map +1 -1
  21. package/fesm2022/cmat-components-date-range.mjs +701 -456
  22. package/fesm2022/cmat-components-date-range.mjs.map +1 -1
  23. package/fesm2022/cmat-components-date-time-display.mjs +137 -30
  24. package/fesm2022/cmat-components-date-time-display.mjs.map +1 -1
  25. package/fesm2022/cmat-components-drawer.mjs +410 -258
  26. package/fesm2022/cmat-components-drawer.mjs.map +1 -1
  27. package/fesm2022/cmat-components-empty-state.mjs +201 -41
  28. package/fesm2022/cmat-components-empty-state.mjs.map +1 -1
  29. package/fesm2022/cmat-components-file-preview.mjs +198 -35
  30. package/fesm2022/cmat-components-file-preview.mjs.map +1 -1
  31. package/fesm2022/cmat-components-filter-toolbar.mjs +320 -72
  32. package/fesm2022/cmat-components-filter-toolbar.mjs.map +1 -1
  33. package/fesm2022/cmat-components-form-actions.mjs +102 -26
  34. package/fesm2022/cmat-components-form-actions.mjs.map +1 -1
  35. package/fesm2022/cmat-components-fullscreen.mjs +167 -47
  36. package/fesm2022/cmat-components-fullscreen.mjs.map +1 -1
  37. package/fesm2022/cmat-components-highlight.mjs +203 -112
  38. package/fesm2022/cmat-components-highlight.mjs.map +1 -1
  39. package/fesm2022/cmat-components-image-viewer.mjs +489 -215
  40. package/fesm2022/cmat-components-image-viewer.mjs.map +1 -1
  41. package/fesm2022/cmat-components-inline-loading.mjs +117 -27
  42. package/fesm2022/cmat-components-inline-loading.mjs.map +1 -1
  43. package/fesm2022/cmat-components-json-editor.mjs +276 -230
  44. package/fesm2022/cmat-components-json-editor.mjs.map +1 -1
  45. package/fesm2022/cmat-components-knob-input.mjs +615 -420
  46. package/fesm2022/cmat-components-knob-input.mjs.map +1 -1
  47. package/fesm2022/cmat-components-loading-overlay.mjs +53 -25
  48. package/fesm2022/cmat-components-loading-overlay.mjs.map +1 -1
  49. package/fesm2022/cmat-components-masonry.mjs +120 -40
  50. package/fesm2022/cmat-components-masonry.mjs.map +1 -1
  51. package/fesm2022/cmat-components-material-color-picker.mjs +332 -155
  52. package/fesm2022/cmat-components-material-color-picker.mjs.map +1 -1
  53. package/fesm2022/cmat-components-material-datetimepicker.mjs +4283 -2504
  54. package/fesm2022/cmat-components-material-datetimepicker.mjs.map +1 -1
  55. package/fesm2022/cmat-components-navigation.mjs +3080 -1404
  56. package/fesm2022/cmat-components-navigation.mjs.map +1 -1
  57. package/fesm2022/cmat-components-opt-input.mjs +540 -466
  58. package/fesm2022/cmat-components-opt-input.mjs.map +1 -1
  59. package/fesm2022/cmat-components-org-chart.mjs +528 -125
  60. package/fesm2022/cmat-components-org-chart.mjs.map +1 -1
  61. package/fesm2022/cmat-components-page-header.mjs +141 -32
  62. package/fesm2022/cmat-components-page-header.mjs.map +1 -1
  63. package/fesm2022/cmat-components-pagination.mjs +866 -534
  64. package/fesm2022/cmat-components-pagination.mjs.map +1 -1
  65. package/fesm2022/cmat-components-password-strength.mjs +873 -434
  66. package/fesm2022/cmat-components-password-strength.mjs.map +1 -1
  67. package/fesm2022/cmat-components-popover.mjs +1012 -731
  68. package/fesm2022/cmat-components-popover.mjs.map +1 -1
  69. package/fesm2022/cmat-components-progress-bar.mjs +98 -35
  70. package/fesm2022/cmat-components-progress-bar.mjs.map +1 -1
  71. package/fesm2022/cmat-components-qrcode.mjs +463 -287
  72. package/fesm2022/cmat-components-qrcode.mjs.map +1 -1
  73. package/fesm2022/cmat-components-rating.mjs +377 -203
  74. package/fesm2022/cmat-components-rating.mjs.map +1 -1
  75. package/fesm2022/cmat-components-rich-text-editor.mjs +153 -39
  76. package/fesm2022/cmat-components-rich-text-editor.mjs.map +1 -1
  77. package/fesm2022/cmat-components-select-search.mjs +926 -496
  78. package/fesm2022/cmat-components-select-search.mjs.map +1 -1
  79. package/fesm2022/cmat-components-select-table.mjs +1280 -842
  80. package/fesm2022/cmat-components-select-table.mjs.map +1 -1
  81. package/fesm2022/cmat-components-select-tree.mjs +998 -690
  82. package/fesm2022/cmat-components-select-tree.mjs.map +1 -1
  83. package/fesm2022/cmat-components-skeleton.mjs +143 -57
  84. package/fesm2022/cmat-components-skeleton.mjs.map +1 -1
  85. package/fesm2022/cmat-components-speed-dial.mjs +457 -303
  86. package/fesm2022/cmat-components-speed-dial.mjs.map +1 -1
  87. package/fesm2022/cmat-components-status-tag.mjs +136 -44
  88. package/fesm2022/cmat-components-status-tag.mjs.map +1 -1
  89. package/fesm2022/cmat-components-table-toolbar.mjs +120 -28
  90. package/fesm2022/cmat-components-table-toolbar.mjs.map +1 -1
  91. package/fesm2022/cmat-components-timeline.mjs +464 -168
  92. package/fesm2022/cmat-components-timeline.mjs.map +1 -1
  93. package/fesm2022/cmat-components-toast.mjs +346 -262
  94. package/fesm2022/cmat-components-toast.mjs.map +1 -1
  95. package/fesm2022/cmat-components-transfer-picker.mjs +1427 -593
  96. package/fesm2022/cmat-components-transfer-picker.mjs.map +1 -1
  97. package/fesm2022/cmat-components-treetable.mjs +372 -112
  98. package/fesm2022/cmat-components-treetable.mjs.map +1 -1
  99. package/fesm2022/cmat-components-upload.mjs +904 -410
  100. package/fesm2022/cmat-components-upload.mjs.map +1 -1
  101. package/fesm2022/cmat-components-x6-angular-shape.mjs +153 -170
  102. package/fesm2022/cmat-components-x6-angular-shape.mjs.map +1 -1
  103. package/fesm2022/cmat-directives-animate-on-scroll.mjs +220 -138
  104. package/fesm2022/cmat-directives-animate-on-scroll.mjs.map +1 -1
  105. package/fesm2022/cmat-directives-arrow-cursor.mjs +246 -193
  106. package/fesm2022/cmat-directives-arrow-cursor.mjs.map +1 -1
  107. package/fesm2022/cmat-directives-autofocus.mjs +43 -25
  108. package/fesm2022/cmat-directives-autofocus.mjs.map +1 -1
  109. package/fesm2022/cmat-directives-data-exporter.mjs +537 -338
  110. package/fesm2022/cmat-directives-data-exporter.mjs.map +1 -1
  111. package/fesm2022/cmat-directives-debounce.mjs +162 -76
  112. package/fesm2022/cmat-directives-debounce.mjs.map +1 -1
  113. package/fesm2022/cmat-directives-digit-only.mjs +457 -356
  114. package/fesm2022/cmat-directives-digit-only.mjs.map +1 -1
  115. package/fesm2022/cmat-directives-equal-validator.mjs +70 -53
  116. package/fesm2022/cmat-directives-equal-validator.mjs.map +1 -1
  117. package/fesm2022/cmat-directives-seamless-auto-scroll.mjs +180 -132
  118. package/fesm2022/cmat-directives-seamless-auto-scroll.mjs.map +1 -1
  119. package/fesm2022/cmat-lib-mock-api.mjs +207 -195
  120. package/fesm2022/cmat-lib-mock-api.mjs.map +1 -1
  121. package/fesm2022/cmat-pipes-bytes.mjs +50 -30
  122. package/fesm2022/cmat-pipes-bytes.mjs.map +1 -1
  123. package/fesm2022/cmat-pipes-date-format.mjs +41 -25
  124. package/fesm2022/cmat-pipes-date-format.mjs.map +1 -1
  125. package/fesm2022/cmat-pipes-find-by-key.mjs +44 -26
  126. package/fesm2022/cmat-pipes-find-by-key.mjs.map +1 -1
  127. package/fesm2022/cmat-pipes-group-by.mjs +50 -38
  128. package/fesm2022/cmat-pipes-group-by.mjs.map +1 -1
  129. package/fesm2022/cmat-pipes-keys.mjs +44 -31
  130. package/fesm2022/cmat-pipes-keys.mjs.map +1 -1
  131. package/fesm2022/cmat-pipes-secure.mjs +60 -49
  132. package/fesm2022/cmat-pipes-secure.mjs.map +1 -1
  133. package/fesm2022/cmat-pipes-uppercase.mjs +39 -22
  134. package/fesm2022/cmat-pipes-uppercase.mjs.map +1 -1
  135. package/fesm2022/cmat-reports.mjs +2761 -0
  136. package/fesm2022/cmat-reports.mjs.map +1 -0
  137. package/fesm2022/cmat-services-alert.mjs +249 -277
  138. package/fesm2022/cmat-services-alert.mjs.map +1 -1
  139. package/fesm2022/cmat-services-config.mjs +110 -81
  140. package/fesm2022/cmat-services-config.mjs.map +1 -1
  141. package/fesm2022/cmat-services-confirmation.mjs +184 -73
  142. package/fesm2022/cmat-services-confirmation.mjs.map +1 -1
  143. package/fesm2022/cmat-services-data.mjs +136 -125
  144. package/fesm2022/cmat-services-data.mjs.map +1 -1
  145. package/fesm2022/cmat-services-export-as.mjs +165 -183
  146. package/fesm2022/cmat-services-export-as.mjs.map +1 -1
  147. package/fesm2022/cmat-services-loading.mjs +116 -95
  148. package/fesm2022/cmat-services-loading.mjs.map +1 -1
  149. package/fesm2022/cmat-services-local-storage.mjs +75 -66
  150. package/fesm2022/cmat-services-local-storage.mjs.map +1 -1
  151. package/fesm2022/cmat-services-media-watcher.mjs +69 -64
  152. package/fesm2022/cmat-services-media-watcher.mjs.map +1 -1
  153. package/fesm2022/cmat-services-platform.mjs +48 -45
  154. package/fesm2022/cmat-services-platform.mjs.map +1 -1
  155. package/fesm2022/cmat-services-print.mjs +984 -1109
  156. package/fesm2022/cmat-services-print.mjs.map +1 -1
  157. package/fesm2022/cmat-services-splash-screen.mjs +53 -38
  158. package/fesm2022/cmat-services-splash-screen.mjs.map +1 -1
  159. package/fesm2022/cmat-services-title.mjs +57 -47
  160. package/fesm2022/cmat-services-title.mjs.map +1 -1
  161. package/fesm2022/cmat-services-translation.mjs +79 -68
  162. package/fesm2022/cmat-services-translation.mjs.map +1 -1
  163. package/fesm2022/cmat-services-utils.mjs +424 -517
  164. package/fesm2022/cmat-services-utils.mjs.map +1 -1
  165. package/fesm2022/cmat-validators.mjs +23 -33
  166. package/fesm2022/cmat-validators.mjs.map +1 -1
  167. package/fesm2022/cmat-version.mjs +12 -16
  168. package/fesm2022/cmat-version.mjs.map +1 -1
  169. package/fesm2022/cmat.mjs +39805 -22511
  170. package/fesm2022/cmat.mjs.map +1 -1
  171. package/package.json +5 -1
  172. package/types/cmat-components-adapter.d.ts +145 -156
  173. package/types/cmat-components-breadcrumb.d.ts +108 -86
  174. package/types/cmat-components-card.d.ts +34 -18
  175. package/types/cmat-components-carousel.d.ts +251 -134
  176. package/types/cmat-components-cascade.d.ts +158 -117
  177. package/types/cmat-components-chip-input.d.ts +105 -71
  178. package/types/cmat-components-code-editor.d.ts +59 -34
  179. package/types/cmat-components-color-picker.d.ts +378 -236
  180. package/types/cmat-components-custom-formly.d.ts +776 -814
  181. package/types/cmat-components-data-picker.d.ts +502 -360
  182. package/types/cmat-components-date-range.d.ts +106 -77
  183. package/types/cmat-components-date-time-display.d.ts +36 -13
  184. package/types/cmat-components-drawer.d.ts +91 -61
  185. package/types/cmat-components-empty-state.d.ts +47 -17
  186. package/types/cmat-components-file-preview.d.ts +42 -14
  187. package/types/cmat-components-filter-toolbar.d.ts +57 -25
  188. package/types/cmat-components-form-actions.d.ts +18 -10
  189. package/types/cmat-components-fullscreen.d.ts +21 -13
  190. package/types/cmat-components-highlight.d.ts +33 -26
  191. package/types/cmat-components-image-viewer.d.ts +119 -58
  192. package/types/cmat-components-inline-loading.d.ts +24 -11
  193. package/types/cmat-components-json-editor.d.ts +39 -28
  194. package/types/cmat-components-knob-input.d.ts +172 -101
  195. package/types/cmat-components-loading-overlay.d.ts +8 -11
  196. package/types/cmat-components-masonry.d.ts +27 -14
  197. package/types/cmat-components-material-color-picker.d.ts +56 -42
  198. package/types/cmat-components-material-datetimepicker.d.ts +817 -454
  199. package/types/cmat-components-navigation.d.ts +295 -221
  200. package/types/cmat-components-opt-input.d.ts +111 -90
  201. package/types/cmat-components-org-chart.d.ts +53 -35
  202. package/types/cmat-components-page-header.d.ts +37 -14
  203. package/types/cmat-components-pagination.d.ts +144 -107
  204. package/types/cmat-components-password-strength.d.ts +197 -86
  205. package/types/cmat-components-popover.d.ts +264 -166
  206. package/types/cmat-components-progress-bar.d.ts +17 -14
  207. package/types/cmat-components-qrcode.d.ts +111 -42
  208. package/types/cmat-components-rating.d.ts +105 -59
  209. package/types/cmat-components-rich-text-editor.d.ts +39 -16
  210. package/types/cmat-components-select-search.d.ts +195 -99
  211. package/types/cmat-components-select-table.d.ts +241 -142
  212. package/types/cmat-components-select-tree.d.ts +185 -118
  213. package/types/cmat-components-skeleton.d.ts +55 -32
  214. package/types/cmat-components-speed-dial.d.ts +86 -61
  215. package/types/cmat-components-status-tag.d.ts +42 -24
  216. package/types/cmat-components-table-toolbar.d.ts +30 -12
  217. package/types/cmat-components-timeline.d.ts +83 -51
  218. package/types/cmat-components-toast.d.ts +84 -85
  219. package/types/cmat-components-transfer-picker.d.ts +228 -181
  220. package/types/cmat-components-treetable.d.ts +63 -39
  221. package/types/cmat-components-upload.d.ts +205 -106
  222. package/types/cmat-components-x6-angular-shape.d.ts +29 -37
  223. package/types/cmat-directives-animate-on-scroll.d.ts +48 -30
  224. package/types/cmat-directives-arrow-cursor.d.ts +55 -35
  225. package/types/cmat-directives-autofocus.d.ts +8 -11
  226. package/types/cmat-directives-data-exporter.d.ts +71 -40
  227. package/types/cmat-directives-debounce.d.ts +31 -28
  228. package/types/cmat-directives-digit-only.d.ts +90 -53
  229. package/types/cmat-directives-equal-validator.d.ts +11 -14
  230. package/types/cmat-directives-seamless-auto-scroll.d.ts +42 -29
  231. package/types/cmat-lib-mock-api.d.ts +46 -55
  232. package/types/cmat-pipes-bytes.d.ts +7 -10
  233. package/types/cmat-pipes-date-format.d.ts +7 -10
  234. package/types/cmat-pipes-find-by-key.d.ts +8 -12
  235. package/types/cmat-pipes-group-by.d.ts +11 -15
  236. package/types/cmat-pipes-keys.d.ts +10 -13
  237. package/types/cmat-pipes-secure.d.ts +14 -17
  238. package/types/cmat-pipes-uppercase.d.ts +7 -10
  239. package/types/cmat-reports.d.ts +1138 -0
  240. package/types/cmat-services-alert.d.ts +80 -87
  241. package/types/cmat-services-config.d.ts +37 -43
  242. package/types/cmat-services-confirmation.d.ts +31 -37
  243. package/types/cmat-services-data.d.ts +18 -21
  244. package/types/cmat-services-export-as.d.ts +28 -33
  245. package/types/cmat-services-loading.d.ts +27 -31
  246. package/types/cmat-services-local-storage.d.ts +17 -21
  247. package/types/cmat-services-media-watcher.d.ts +14 -18
  248. package/types/cmat-services-platform.d.ts +8 -11
  249. package/types/cmat-services-print.d.ts +97 -102
  250. package/types/cmat-services-splash-screen.d.ts +11 -14
  251. package/types/cmat-services-title.d.ts +9 -12
  252. package/types/cmat-services-translation.d.ts +19 -22
  253. package/types/cmat-services-utils.d.ts +76 -80
  254. package/types/cmat-validators.d.ts +5 -8
  255. package/types/cmat-version.d.ts +8 -10
  256. package/types/cmat.d.ts +7551 -5204
@@ -1,457 +1,702 @@
1
- import { Overlay } from '@angular/cdk/overlay';
2
- import { TemplatePortal } from '@angular/cdk/portal';
3
- import { NgClass } from '@angular/common';
4
- import * as i0 from '@angular/core';
5
- import { input, output, signal, computed, viewChild, inject, ViewContainerRef, effect, untracked, forwardRef, ChangeDetectionStrategy, ViewEncapsulation, Component } from '@angular/core';
6
- import * as i1 from '@angular/forms';
7
- import { FormControl, Validators, FormsModule, ReactiveFormsModule, NG_VALUE_ACCESSOR } from '@angular/forms';
8
- import * as i2 from '@angular/material/button';
9
- import { MatButtonModule } from '@angular/material/button';
10
- import { MatMonthView } from '@angular/material/datepicker';
11
- import * as i4 from '@angular/material/form-field';
12
- import { MatFormFieldModule } from '@angular/material/form-field';
13
- import * as i3 from '@angular/material/icon';
14
- import { MatIconModule } from '@angular/material/icon';
15
- import * as i5 from '@angular/material/input';
16
- import { MatInputModule } from '@angular/material/input';
17
- import dayjs from 'dayjs';
18
- import isBetween from 'dayjs/plugin/isBetween';
19
-
20
- class CmatDateRangeComponent {
21
- constructor() {
22
- this.controlClass = input('', /* @ts-ignore */
23
- ...(ngDevMode ? [{ debugName: "controlClass" }] : /* istanbul ignore next */ []));
24
- this.dateFormat = input('YYYY/MM/DD', /* @ts-ignore */
25
- ...(ngDevMode ? [{ debugName: "dateFormat" }] : /* istanbul ignore next */ []));
26
- this.timeFormat = input('HH:mm', { ...(ngDevMode ? { debugName: "timeFormat" } : /* istanbul ignore next */ {}), transform: (value) => value === '12' ? 'hh:mmA' : 'HH:mm' });
27
- this.readonly = input(false, /* @ts-ignore */
28
- ...(ngDevMode ? [{ debugName: "readonly" }] : /* istanbul ignore next */ []));
29
- this.timeRange = input(true, /* @ts-ignore */
30
- ...(ngDevMode ? [{ debugName: "timeRange" }] : /* istanbul ignore next */ []));
31
- this.range = input(null, /* @ts-ignore */
32
- ...(ngDevMode ? [{ debugName: "range" }] : /* istanbul ignore next */ []));
33
- this.rangeChanged = output();
34
- this.activeDates = signal({
35
- month1: dayjs(),
36
- month2: dayjs().add(1, 'month'),
37
- }, /* @ts-ignore */
38
- ...(ngDevMode ? [{ debugName: "activeDates" }] : /* istanbul ignore next */ []));
39
- this.setWhichDate = signal('start', /* @ts-ignore */
40
- ...(ngDevMode ? [{ debugName: "setWhichDate" }] : /* istanbul ignore next */ []));
41
- this.rangeDisplay = computed(() => {
42
- const r = this._range();
43
- if (r.start && r.end) {
44
- const start = r.start.clone();
45
- const end = r.end.clone();
46
- return {
47
- startDate: start.format(this.dateFormat()),
48
- startTime: this.timeRange() ? start.format(this.timeFormat()) : null,
49
- endDate: end.format(this.dateFormat()),
50
- endTime: this.timeRange() ? end.format(this.timeFormat()) : null,
51
- };
52
- }
53
- return undefined;
54
- }, /* @ts-ignore */
55
- ...(ngDevMode ? [{ debugName: "rangeDisplay" }] : /* istanbul ignore next */ []));
56
- this.dateClassFn = computed(() => {
57
- const r = this._range();
58
- return (date) => {
59
- if (r.start && r.end) {
60
- if (date.isSame(r.start, 'day') && date.isSame(r.end, 'day')) {
61
- return ['cmat-date-range', 'cmat-date-range-start', 'cmat-date-range-end'];
62
- }
63
- if (date.isSame(r.start, 'day')) {
64
- return ['cmat-date-range', 'cmat-date-range-start'];
65
- }
66
- if (date.isSame(r.end, 'day')) {
67
- return ['cmat-date-range', 'cmat-date-range-end'];
68
- }
69
- if (date.isBetween(r.start, r.end, 'day')) {
70
- return ['cmat-date-range', 'cmat-date-range-mid'];
71
- }
72
- }
73
- else if (r.start && date.isSame(r.start, 'day')) {
74
- return ['cmat-date-range', 'cmat-date-range-start'];
75
- }
76
- return [];
77
- };
78
- }, /* @ts-ignore */
79
- ...(ngDevMode ? [{ debugName: "dateClassFn" }] : /* istanbul ignore next */ []));
80
- this.dateFilterFn = computed(() => {
81
- const which = this.setWhichDate();
82
- const r = this._range();
83
- return (date) => {
84
- return !(which === 'end' && r.start && date.isBefore(r.start, 'day'));
85
- };
86
- }, /* @ts-ignore */
87
- ...(ngDevMode ? [{ debugName: "dateFilterFn" }] : /* istanbul ignore next */ []));
88
- this._matMonthView1 = viewChild('matMonthView1', /* @ts-ignore */
89
- ...(ngDevMode ? [{ debugName: "_matMonthView1" }] : /* istanbul ignore next */ []));
90
- this._matMonthView2 = viewChild('matMonthView2', /* @ts-ignore */
91
- ...(ngDevMode ? [{ debugName: "_matMonthView2" }] : /* istanbul ignore next */ []));
92
- this._pickerPanelOrigin = viewChild('pickerPanelOrigin', /* @ts-ignore */
93
- ...(ngDevMode ? [{ debugName: "_pickerPanelOrigin" }] : /* istanbul ignore next */ []));
94
- this._pickerPanel = viewChild('pickerPanel', /* @ts-ignore */
95
- ...(ngDevMode ? [{ debugName: "_pickerPanel" }] : /* istanbul ignore next */ []));
96
- this._overlay = inject(Overlay);
97
- this._viewContainerRef = inject(ViewContainerRef);
98
- this._overlayRef = null;
99
- this._range = signal({
100
- start: null,
101
- end: null,
102
- }, /* @ts-ignore */
103
- ...(ngDevMode ? [{ debugName: "_range" }] : /* istanbul ignore next */ []));
104
- this._programmaticChange = false;
105
- this._rangeInputFirstRun = true;
106
- this._timeRangeFirstRun = true;
107
- this._emittingChange = false;
108
- this._timeRegExp = new RegExp('^(0[0-9]|1[0-9]|2[0-4]|[0-9]):([0-5][0-9])(A|(?:AM)|P|(?:PM))?$', 'i');
109
- this._onChange = () => { };
110
- this._onTouched = () => { };
111
- dayjs.extend(isBetween);
112
- effect(() => {
113
- const rangeValue = this.range();
114
- if (this._rangeInputFirstRun) {
115
- this._rangeInputFirstRun = false;
116
- return;
117
- }
118
- untracked(() => {
119
- this._setRangeFromInput(rangeValue);
120
- });
121
- });
122
- effect(() => {
123
- const tr = this.timeRange();
124
- if (this._timeRangeFirstRun) {
125
- this._timeRangeFirstRun = false;
126
- return;
127
- }
128
- untracked(() => {
129
- if (!tr && this._range().start && this._range().end) {
130
- this._setRangeFromInput({
131
- start: this._range().start.clone().startOf('day').toISOString(),
132
- end: this._range().end.clone().endOf('day').toISOString(),
133
- });
134
- }
135
- });
136
- });
137
- }
138
- registerOnChange(fn) {
139
- this._onChange = fn;
140
- }
141
- registerOnTouched(fn) {
142
- this._onTouched = fn;
143
- }
144
- writeValue(range) {
145
- this._programmaticChange = true;
146
- this._setRangeFromInput(range);
147
- }
148
- ngOnInit() {
149
- this._init();
150
- }
151
- ngOnDestroy() {
152
- if (this._overlayRef) {
153
- this._overlayRef.dispose();
154
- this._overlayRef = null;
155
- }
156
- }
157
- openPickerPanel() {
158
- if (this.readonly())
159
- return;
160
- const origin = this._pickerPanelOrigin();
161
- if (!origin)
162
- return;
163
- const overlayRef = this._overlay.create({
164
- panelClass: 'cmat-date-range-panel',
165
- backdropClass: '',
166
- hasBackdrop: true,
167
- scrollStrategy: this._overlay.scrollStrategies.reposition(),
168
- positionStrategy: this._overlay
169
- .position()
170
- .flexibleConnectedTo(origin)
171
- .withPositions([
172
- {
173
- originX: 'start',
174
- originY: 'bottom',
175
- overlayX: 'start',
176
- overlayY: 'top',
177
- offsetY: 8,
178
- },
179
- {
180
- originX: 'start',
181
- originY: 'top',
182
- overlayX: 'start',
183
- overlayY: 'bottom',
184
- offsetY: -8,
185
- },
186
- ]),
187
- });
188
- this._overlayRef = overlayRef;
189
- const templatePortal = new TemplatePortal(this._pickerPanel(), this._viewContainerRef);
190
- overlayRef.backdropClick().subscribe(() => {
191
- if (templatePortal?.isAttached) {
192
- templatePortal.detach();
193
- }
194
- if (overlayRef?.hasAttached()) {
195
- overlayRef.detach();
196
- overlayRef.dispose();
197
- }
198
- this._overlayRef = null;
199
- });
200
- overlayRef.attach(templatePortal);
201
- }
202
- getMonthLabel(month) {
203
- const dates = this.activeDates();
204
- if (month === 1) {
205
- return dates.month1?.clone().format('YYYY MMMM') ?? '';
206
- }
207
- return dates.month2?.clone().format('YYYY MMMM') ?? '';
208
- }
209
- onActiveDateChange(month, date) {
210
- this.activeDates.update((dates) => {
211
- if (month === 1) {
212
- return { month1: date, month2: dates.month2 };
213
- }
214
- return { month1: dates.month1, month2: date };
215
- });
216
- }
217
- onSelectedDateChange(date) {
218
- if (!date)
219
- return;
220
- const whichDate = this.setWhichDate();
221
- const r = this._range();
222
- const newRange = {
223
- start: (whichDate === 'start'
224
- ? (r.start ?? dayjs()).clone().year(date.year()).month(date.month()).date(date.date())
225
- : r.start ?? date).toISOString(),
226
- end: (whichDate === 'end'
227
- ? (r.end ?? dayjs()).clone().year(date.year()).month(date.month()).date(date.date())
228
- : r.end ?? date).toISOString(),
229
- whichDate,
230
- };
231
- this.setWhichDate.set(whichDate === 'start' ? 'end' : 'start');
232
- this._setRangeFromInput(newRange);
233
- }
234
- prev() {
235
- this.activeDates.update(dates => ({
236
- month1: dayjs(dates.month1).subtract(1, 'month'),
237
- month2: dayjs(dates.month2).subtract(1, 'month'),
238
- }));
239
- }
240
- next() {
241
- this.activeDates.update(dates => ({
242
- month1: dayjs(dates.month1).add(1, 'month'),
243
- month2: dayjs(dates.month2).add(1, 'month'),
244
- }));
245
- }
246
- updateStartTime(event) {
247
- const input = event.target;
248
- const value = input?.value ?? '';
249
- const parsedTime = this._parseTime(value);
250
- const formControl = this.startTimeFormControl;
251
- if (formControl?.invalid) {
252
- const r = this._range();
253
- if (r.start) {
254
- formControl.setValue(r.start.clone().format(this.timeFormat()));
255
- }
256
- return;
257
- }
258
- const r = this._range();
259
- if (r.start && r.end) {
260
- let startDate = r.start
261
- .clone()
262
- .hour(parsedTime.hour())
263
- .minute(parsedTime.minute());
264
- if (startDate.isAfter(r.end)) {
265
- const endDateHours = r.end.hour();
266
- const endDateMinutes = r.end.minute();
267
- startDate.hour(endDateHours).minute(endDateMinutes);
268
- }
269
- this._setRangeFromInput({
270
- start: startDate.toISOString(),
271
- end: r.end.clone().toISOString(),
272
- whichDate: 'start',
273
- });
274
- }
275
- }
276
- updateEndTime(event) {
277
- const input = event.target;
278
- const value = input?.value ?? '';
279
- const parsedTime = this._parseTime(value);
280
- const formControl = this.endTimeFormControl;
281
- if (formControl?.invalid) {
282
- const r = this._range();
283
- if (r.end) {
284
- formControl.setValue(r.end.clone().format(this.timeFormat()));
285
- }
286
- return;
287
- }
288
- const r = this._range();
289
- if (r.start && r.end) {
290
- let endDate = r.end
291
- .clone()
292
- .hour(parsedTime.hour())
293
- .minute(parsedTime.minute());
294
- if (endDate.isBefore(r.start)) {
295
- const startDateHours = r.start.hour();
296
- const startDateMinutes = r.start.minute();
297
- endDate.hour(startDateHours).minute(startDateMinutes);
298
- }
299
- this._setRangeFromInput({
300
- start: r.start.clone().toISOString(),
301
- end: endDate.toISOString(),
302
- whichDate: 'end',
303
- });
304
- }
305
- }
306
- _setRangeFromInput(value) {
307
- if (!(value?.start && value.end)) {
308
- this._range.set({ start: null, end: null });
309
- this.activeDates.set({
310
- month1: dayjs(),
311
- month2: dayjs().add(1, 'month'),
312
- });
313
- return;
314
- }
315
- const whichDate = value.whichDate ?? null;
316
- const start = dayjs(value.start);
317
- const end = dayjs(value.end);
318
- const currentRange = this._range();
319
- let newStart = currentRange.start;
320
- let newEnd = currentRange.end;
321
- if (whichDate === 'start') {
322
- newStart = start.clone();
323
- if (newEnd && newStart.isAfter(newEnd)) {
324
- newEnd = start
325
- .clone()
326
- .hour(newEnd.hour())
327
- .minute(newEnd.minute())
328
- .second(newEnd.second());
329
- if (!newStart.isBefore(newEnd)) {
330
- newEnd = start.clone();
331
- }
332
- }
333
- }
334
- if (whichDate === 'end') {
335
- newEnd = end.clone();
336
- if (newStart?.isAfter(newEnd)) {
337
- newStart = end
338
- .clone()
339
- .hour(newStart.hour())
340
- .minute(newStart.minute())
341
- .second(newStart.second());
342
- if (!newEnd.isAfter(newStart)) {
343
- newStart = end.clone();
344
- }
345
- }
346
- }
347
- if (!whichDate) {
348
- newStart = start.clone();
349
- newEnd = start.isBefore(end) ? end.clone() : start.clone();
350
- }
351
- this._range.set({ start: newStart, end: newEnd });
352
- if (newStart && newEnd) {
353
- const rangeOutput = {
354
- start: newStart.toISOString(),
355
- end: newEnd.toISOString(),
356
- };
357
- if (!this._programmaticChange && !this._emittingChange) {
358
- this._emittingChange = true;
359
- try {
360
- this.rangeChanged.emit(rangeOutput);
361
- this._onTouched();
362
- this._onChange(rangeOutput);
363
- }
364
- finally {
365
- setTimeout(() => {
366
- this._emittingChange = false;
367
- }, 0);
368
- }
369
- }
370
- this.activeDates.set({
371
- month1: newStart.clone(),
372
- month2: newStart.clone().add(1, 'month'),
373
- });
374
- const timeFmt = this.timeFormat();
375
- const startCtrl = this.startTimeFormControl;
376
- const endCtrl = this.endTimeFormControl;
377
- if (startCtrl && startCtrl.value !== newStart.clone().format(timeFmt)) {
378
- startCtrl.setValue(newStart.clone().format(timeFmt));
379
- }
380
- if (endCtrl && endCtrl.value !== newEnd.clone().format(timeFmt)) {
381
- endCtrl.setValue(newEnd.clone().format(timeFmt));
382
- }
383
- }
384
- const matMonthView1 = this._matMonthView1();
385
- const matMonthView2 = this._matMonthView2();
386
- if (matMonthView1 && matMonthView2) {
387
- const newDateClassFn = this.dateClassFn();
388
- const newDateFilterFn = this.dateFilterFn();
389
- matMonthView1.dateClass = newDateClassFn;
390
- matMonthView2.dateClass = newDateClassFn;
391
- matMonthView1.dateFilter = newDateFilterFn;
392
- matMonthView2.dateFilter = newDateFilterFn;
393
- matMonthView1.ngAfterContentInit();
394
- matMonthView2.ngAfterContentInit();
395
- }
396
- this._programmaticChange = false;
397
- }
398
- _init() {
399
- this.startTimeFormControl =
400
- new FormControl('', [Validators.pattern(this._timeRegExp)]);
401
- this.endTimeFormControl =
402
- new FormControl('', [Validators.pattern(this._timeRegExp)]);
403
- this._programmaticChange = true;
404
- const rangeValue = this.range();
405
- if (rangeValue) {
406
- this._setRangeFromInput(rangeValue);
407
- }
408
- else {
409
- this._setRangeFromInput({
410
- start: dayjs().startOf('day').toISOString(),
411
- end: dayjs().add(1, 'day').endOf('day').toISOString(),
412
- });
413
- }
414
- }
415
- _parseTime(value) {
416
- const timeArr = value.split(this._timeRegExp).filter(part => part !== '');
417
- const meridiem = timeArr[2] || null;
418
- if (meridiem) {
419
- return dayjs(value, 'hh:mmA').second(0);
420
- }
421
- return dayjs(value, 'HH:mm').second(0);
422
- }
423
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.0", ngImport: i0, type: CmatDateRangeComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
424
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.2.0", type: CmatDateRangeComponent, isStandalone: true, selector: "cmat-date-range", inputs: { controlClass: { classPropertyName: "controlClass", publicName: "controlClass", isSignal: true, isRequired: false, transformFunction: null }, dateFormat: { classPropertyName: "dateFormat", publicName: "dateFormat", isSignal: true, isRequired: false, transformFunction: null }, timeFormat: { classPropertyName: "timeFormat", publicName: "timeFormat", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, timeRange: { classPropertyName: "timeRange", publicName: "timeRange", isSignal: true, isRequired: false, transformFunction: null }, range: { classPropertyName: "range", publicName: "range", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { rangeChanged: "rangeChanged" }, providers: [
425
- {
426
- provide: NG_VALUE_ACCESSOR,
427
- useExisting: forwardRef(() => CmatDateRangeComponent),
428
- multi: true,
429
- },
430
- ], viewQueries: [{ propertyName: "_matMonthView1", first: true, predicate: ["matMonthView1"], descendants: true, isSignal: true }, { propertyName: "_matMonthView2", first: true, predicate: ["matMonthView2"], descendants: true, isSignal: true }, { propertyName: "_pickerPanelOrigin", first: true, predicate: ["pickerPanelOrigin"], descendants: true, isSignal: true }, { propertyName: "_pickerPanel", first: true, predicate: ["pickerPanel"], descendants: true, isSignal: true }], exportAs: ["cmatDateRange"], ngImport: i0, template: "<div #pickerPanelOrigin role=\"presentation\" class=\"range\" (click)=\"openPickerPanel()\">\r\n\r\n <div class=\"start\" [ngClass]=\"controlClass()\">\r\n <div class=\"date\">{{rangeDisplay()?.startDate}}</div>\r\n @if (rangeDisplay()?.startTime) {\r\n <div class=\"time\">{{rangeDisplay()?.startTime}}</div>\r\n }\r\n </div>\r\n\r\n <div class=\"separator\">-</div>\r\n\r\n <div class=\"end\" [ngClass]=\"controlClass()\">\r\n <div class=\"date\">{{rangeDisplay()?.endDate}}</div>\r\n @if (rangeDisplay()?.endTime) {\r\n <div class=\"time\">{{rangeDisplay()?.endTime}}</div>\r\n }\r\n </div>\r\n\r\n</div>\r\n\r\n<ng-template #pickerPanel>\r\n\r\n <!-- Start -->\r\n <div class=\"start\">\r\n\r\n <div class=\"month\">\r\n <div class=\"month-header\">\r\n <button type=\"button\" class=\"previous-button\" matIconButton tabindex=\"1\" (click)=\"prev()\">\r\n <mat-icon [svgIcon]=\"'heroicons_outline:chevron-left'\"></mat-icon>\r\n </button>\r\n <div class=\"month-label\">{{getMonthLabel(1)}}</div>\r\n </div>\r\n <mat-month-view #matMonthView1 [dateFilter]=\"dateFilterFn()\" [dateClass]=\"dateClassFn()\"\r\n [activeDate]=\"activeDates().month1\" (activeDateChange)=\"onActiveDateChange(1, $event)\"\r\n (click)=\"$event.stopImmediatePropagation()\"\r\n (selectedChange)=\"onSelectedDateChange($event)\">\r\n </mat-month-view>\r\n </div>\r\n\r\n @if (timeRange()) {\r\n <mat-form-field class=\"time start-time\">\r\n <input matInput tabindex=\"3\" [autocomplete]=\"'off'\" [formControl]=\"startTimeFormControl\"\r\n (blur)=\"updateStartTime($event)\">\r\n <mat-label>\u5F00\u59CB\u65F6\u95F4</mat-label>\r\n </mat-form-field>\r\n }\r\n\r\n </div>\r\n\r\n <!-- End -->\r\n <div class=\"end\">\r\n\r\n <div class=\"month\">\r\n <div class=\"month-header\">\r\n <div class=\"month-label\">{{getMonthLabel(2)}}</div>\r\n <button type=\"button\" class=\"next-button\" matIconButton tabindex=\"2\" (click)=\"next()\">\r\n <mat-icon [svgIcon]=\"'heroicons_outline:chevron-right'\"></mat-icon>\r\n </button>\r\n </div>\r\n <mat-month-view #matMonthView2 [dateFilter]=\"dateFilterFn()\" [dateClass]=\"dateClassFn()\"\r\n [activeDate]=\"activeDates().month2\" (activeDateChange)=\"onActiveDateChange(2, $event)\"\r\n (click)=\"$event.stopImmediatePropagation()\"\r\n (selectedChange)=\"onSelectedDateChange($event)\">\r\n </mat-month-view>\r\n </div>\r\n\r\n @if (timeRange()) {\r\n <mat-form-field class=\"time end-time\">\r\n <input matInput tabindex=\"4\" [formControl]=\"endTimeFormControl\" (blur)=\"updateEndTime($event)\">\r\n <mat-label>\u7ED3\u675F\u65F6\u95F4</mat-label>\r\n </mat-form-field>\r\n }\r\n\r\n </div>\r\n\r\n </ng-template>", styles: ["cmat-date-range{display:flex;width:100%}cmat-date-range .range{display:flex;width:100%;align-items:center;height:48px;min-height:48px;max-height:48px;cursor:pointer}cmat-date-range .range .start,cmat-date-range .range .end{display:flex;align-items:center;height:100%;padding:0 16px;border-radius:6px;border-width:1px;line-height:1}cmat-date-range .range .date{white-space:nowrap}cmat-date-range .range .date+.time{margin-left:8px}cmat-date-range .range .time{white-space:nowrap}cmat-date-range .separator{margin:0 auto;width:6px}.cmat-date-range-panel{border-radius:12px;padding:24px}.cmat-date-range-panel .start,.cmat-date-range-panel .end{display:flex;flex-direction:column}.cmat-date-range-panel .start .month,.cmat-date-range-panel .end .month{max-width:196px;min-width:196px;width:196px}.cmat-date-range-panel .start .month .month-header,.cmat-date-range-panel .end .month .month-header{position:relative;display:flex;align-items:center;justify-content:center;height:32px;margin-bottom:16px}.cmat-date-range-panel .start .month .month-header .previous-button,.cmat-date-range-panel .start .month .month-header .next-button,.cmat-date-range-panel .end .month .month-header .previous-button,.cmat-date-range-panel .end .month .month-header .next-button{position:absolute;width:24px!important;height:24px!important;min-height:24px!important;max-height:24px!important;line-height:24px!important}.cmat-date-range-panel .start .month .month-header .previous-button,.cmat-date-range-panel .end .month .month-header .previous-button{left:0}.cmat-date-range-panel .start .month .month-header .next-button,.cmat-date-range-panel .end .month .month-header .next-button{right:0}.cmat-date-range-panel .start .month .month-header .month-label,.cmat-date-range-panel .end .month .month-header .month-label{font-weight:500}.cmat-date-range-panel .start .month mat-month-view,.cmat-date-range-panel .end .month mat-month-view{display:flex;min-height:188px}.cmat-date-range-panel .start .month mat-month-view .mat-calendar-table,.cmat-date-range-panel .end .month mat-month-view .mat-calendar-table{width:100%;border-collapse:collapse}.cmat-date-range-panel .start .month mat-month-view .mat-calendar-table tbody tr[aria-hidden=true],.cmat-date-range-panel .end .month mat-month-view .mat-calendar-table tbody tr[aria-hidden=true]{display:none!important}.cmat-date-range-panel .start .month mat-month-view .mat-calendar-table tbody tr:first-child td:first-child[aria-hidden=true],.cmat-date-range-panel .end .month mat-month-view .mat-calendar-table tbody tr:first-child td:first-child[aria-hidden=true]{visibility:hidden;pointer-events:none;opacity:0}.cmat-date-range-panel .start .month mat-month-view .mat-calendar-table tbody tr td .mat-calendar-body-cell-content,.cmat-date-range-panel .end .month mat-month-view .mat-calendar-table tbody tr td .mat-calendar-body-cell-content{background-color:transparent!important}.cmat-date-range-panel .start .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-today,.cmat-date-range-panel .end .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-today{border:none!important}.cmat-date-range-panel .start .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-cell,.cmat-date-range-panel .end .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-cell{width:28px!important;height:28px!important;padding:2px!important}.cmat-date-range-panel .start .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-cell.cmat-date-range:before,.cmat-date-range-panel .end .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-cell.cmat-date-range:before{content:\"\";position:absolute;inset:2px 0}.cmat-date-range-panel .start .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-cell.cmat-date-range.cmat-date-range-start:before,.cmat-date-range-panel .end .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-cell.cmat-date-range.cmat-date-range-start:before{border-radius:999px 0 0 999px}.cmat-date-range-panel .start .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-cell.cmat-date-range.cmat-date-range-start.cmat-date-range-end:before,.cmat-date-range-panel .end .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-cell.cmat-date-range.cmat-date-range-start.cmat-date-range-end:before{right:2px;border-radius:999px}.cmat-date-range-panel .start .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-cell.cmat-date-range.cmat-date-range-end:before,.cmat-date-range-panel .end .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-cell.cmat-date-range.cmat-date-range-end:before{border-radius:0 999px 999px 0}.cmat-date-range-panel .start .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-cell .mat-calendar-body-cell-content,.cmat-date-range-panel .end .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-cell .mat-calendar-body-cell-content{position:relative;top:0;left:0;width:24px;height:24px;font-size:12px}.cmat-date-range-panel .time{width:100%;max-width:196px}.cmat-date-range-panel .start{align-items:flex-start;margin-right:20px}.cmat-date-range-panel .start .month .month-label{margin-left:8px}.cmat-date-range-panel .end{align-items:flex-end;margin-left:20px}.cmat-date-range-panel .end .month .month-label{margin-right:8px}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox]):not([ngNoCva])[formControlName],textarea:not([ngNoCva])[formControlName],input:not([type=checkbox]):not([ngNoCva])[formControl],textarea:not([ngNoCva])[formControl],input:not([type=checkbox]):not([ngNoCva])[ngModel],textarea:not([ngNoCva])[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i2.MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i4.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i4.MatLabel, selector: "mat-label" }, { kind: "component", type: MatMonthView, selector: "mat-month-view", inputs: ["activeDate", "selected", "minDate", "maxDate", "dateFilter", "dateClass", "comparisonStart", "comparisonEnd", "startDateAccessibleName", "endDateAccessibleName", "activeDrag"], outputs: ["selectedChange", "_userSelection", "dragStarted", "dragEnded", "activeDateChange"], exportAs: ["matMonthView"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i5.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
431
- }
432
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.0", ngImport: i0, type: CmatDateRangeComponent, decorators: [{
433
- type: Component,
434
- args: [{ selector: 'cmat-date-range', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, exportAs: 'cmatDateRange', providers: [
435
- {
436
- provide: NG_VALUE_ACCESSOR,
437
- useExisting: forwardRef(() => CmatDateRangeComponent),
438
- multi: true,
439
- },
440
- ], imports: [
441
- FormsModule,
442
- ReactiveFormsModule,
443
- MatButtonModule,
444
- MatIconModule,
445
- MatFormFieldModule,
446
- MatMonthView,
447
- MatInputModule,
448
- NgClass,
449
- ], template: "<div #pickerPanelOrigin role=\"presentation\" class=\"range\" (click)=\"openPickerPanel()\">\r\n\r\n <div class=\"start\" [ngClass]=\"controlClass()\">\r\n <div class=\"date\">{{rangeDisplay()?.startDate}}</div>\r\n @if (rangeDisplay()?.startTime) {\r\n <div class=\"time\">{{rangeDisplay()?.startTime}}</div>\r\n }\r\n </div>\r\n\r\n <div class=\"separator\">-</div>\r\n\r\n <div class=\"end\" [ngClass]=\"controlClass()\">\r\n <div class=\"date\">{{rangeDisplay()?.endDate}}</div>\r\n @if (rangeDisplay()?.endTime) {\r\n <div class=\"time\">{{rangeDisplay()?.endTime}}</div>\r\n }\r\n </div>\r\n\r\n</div>\r\n\r\n<ng-template #pickerPanel>\r\n\r\n <!-- Start -->\r\n <div class=\"start\">\r\n\r\n <div class=\"month\">\r\n <div class=\"month-header\">\r\n <button type=\"button\" class=\"previous-button\" matIconButton tabindex=\"1\" (click)=\"prev()\">\r\n <mat-icon [svgIcon]=\"'heroicons_outline:chevron-left'\"></mat-icon>\r\n </button>\r\n <div class=\"month-label\">{{getMonthLabel(1)}}</div>\r\n </div>\r\n <mat-month-view #matMonthView1 [dateFilter]=\"dateFilterFn()\" [dateClass]=\"dateClassFn()\"\r\n [activeDate]=\"activeDates().month1\" (activeDateChange)=\"onActiveDateChange(1, $event)\"\r\n (click)=\"$event.stopImmediatePropagation()\"\r\n (selectedChange)=\"onSelectedDateChange($event)\">\r\n </mat-month-view>\r\n </div>\r\n\r\n @if (timeRange()) {\r\n <mat-form-field class=\"time start-time\">\r\n <input matInput tabindex=\"3\" [autocomplete]=\"'off'\" [formControl]=\"startTimeFormControl\"\r\n (blur)=\"updateStartTime($event)\">\r\n <mat-label>\u5F00\u59CB\u65F6\u95F4</mat-label>\r\n </mat-form-field>\r\n }\r\n\r\n </div>\r\n\r\n <!-- End -->\r\n <div class=\"end\">\r\n\r\n <div class=\"month\">\r\n <div class=\"month-header\">\r\n <div class=\"month-label\">{{getMonthLabel(2)}}</div>\r\n <button type=\"button\" class=\"next-button\" matIconButton tabindex=\"2\" (click)=\"next()\">\r\n <mat-icon [svgIcon]=\"'heroicons_outline:chevron-right'\"></mat-icon>\r\n </button>\r\n </div>\r\n <mat-month-view #matMonthView2 [dateFilter]=\"dateFilterFn()\" [dateClass]=\"dateClassFn()\"\r\n [activeDate]=\"activeDates().month2\" (activeDateChange)=\"onActiveDateChange(2, $event)\"\r\n (click)=\"$event.stopImmediatePropagation()\"\r\n (selectedChange)=\"onSelectedDateChange($event)\">\r\n </mat-month-view>\r\n </div>\r\n\r\n @if (timeRange()) {\r\n <mat-form-field class=\"time end-time\">\r\n <input matInput tabindex=\"4\" [formControl]=\"endTimeFormControl\" (blur)=\"updateEndTime($event)\">\r\n <mat-label>\u7ED3\u675F\u65F6\u95F4</mat-label>\r\n </mat-form-field>\r\n }\r\n\r\n </div>\r\n\r\n </ng-template>", styles: ["cmat-date-range{display:flex;width:100%}cmat-date-range .range{display:flex;width:100%;align-items:center;height:48px;min-height:48px;max-height:48px;cursor:pointer}cmat-date-range .range .start,cmat-date-range .range .end{display:flex;align-items:center;height:100%;padding:0 16px;border-radius:6px;border-width:1px;line-height:1}cmat-date-range .range .date{white-space:nowrap}cmat-date-range .range .date+.time{margin-left:8px}cmat-date-range .range .time{white-space:nowrap}cmat-date-range .separator{margin:0 auto;width:6px}.cmat-date-range-panel{border-radius:12px;padding:24px}.cmat-date-range-panel .start,.cmat-date-range-panel .end{display:flex;flex-direction:column}.cmat-date-range-panel .start .month,.cmat-date-range-panel .end .month{max-width:196px;min-width:196px;width:196px}.cmat-date-range-panel .start .month .month-header,.cmat-date-range-panel .end .month .month-header{position:relative;display:flex;align-items:center;justify-content:center;height:32px;margin-bottom:16px}.cmat-date-range-panel .start .month .month-header .previous-button,.cmat-date-range-panel .start .month .month-header .next-button,.cmat-date-range-panel .end .month .month-header .previous-button,.cmat-date-range-panel .end .month .month-header .next-button{position:absolute;width:24px!important;height:24px!important;min-height:24px!important;max-height:24px!important;line-height:24px!important}.cmat-date-range-panel .start .month .month-header .previous-button,.cmat-date-range-panel .end .month .month-header .previous-button{left:0}.cmat-date-range-panel .start .month .month-header .next-button,.cmat-date-range-panel .end .month .month-header .next-button{right:0}.cmat-date-range-panel .start .month .month-header .month-label,.cmat-date-range-panel .end .month .month-header .month-label{font-weight:500}.cmat-date-range-panel .start .month mat-month-view,.cmat-date-range-panel .end .month mat-month-view{display:flex;min-height:188px}.cmat-date-range-panel .start .month mat-month-view .mat-calendar-table,.cmat-date-range-panel .end .month mat-month-view .mat-calendar-table{width:100%;border-collapse:collapse}.cmat-date-range-panel .start .month mat-month-view .mat-calendar-table tbody tr[aria-hidden=true],.cmat-date-range-panel .end .month mat-month-view .mat-calendar-table tbody tr[aria-hidden=true]{display:none!important}.cmat-date-range-panel .start .month mat-month-view .mat-calendar-table tbody tr:first-child td:first-child[aria-hidden=true],.cmat-date-range-panel .end .month mat-month-view .mat-calendar-table tbody tr:first-child td:first-child[aria-hidden=true]{visibility:hidden;pointer-events:none;opacity:0}.cmat-date-range-panel .start .month mat-month-view .mat-calendar-table tbody tr td .mat-calendar-body-cell-content,.cmat-date-range-panel .end .month mat-month-view .mat-calendar-table tbody tr td .mat-calendar-body-cell-content{background-color:transparent!important}.cmat-date-range-panel .start .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-today,.cmat-date-range-panel .end .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-today{border:none!important}.cmat-date-range-panel .start .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-cell,.cmat-date-range-panel .end .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-cell{width:28px!important;height:28px!important;padding:2px!important}.cmat-date-range-panel .start .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-cell.cmat-date-range:before,.cmat-date-range-panel .end .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-cell.cmat-date-range:before{content:\"\";position:absolute;inset:2px 0}.cmat-date-range-panel .start .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-cell.cmat-date-range.cmat-date-range-start:before,.cmat-date-range-panel .end .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-cell.cmat-date-range.cmat-date-range-start:before{border-radius:999px 0 0 999px}.cmat-date-range-panel .start .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-cell.cmat-date-range.cmat-date-range-start.cmat-date-range-end:before,.cmat-date-range-panel .end .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-cell.cmat-date-range.cmat-date-range-start.cmat-date-range-end:before{right:2px;border-radius:999px}.cmat-date-range-panel .start .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-cell.cmat-date-range.cmat-date-range-end:before,.cmat-date-range-panel .end .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-cell.cmat-date-range.cmat-date-range-end:before{border-radius:0 999px 999px 0}.cmat-date-range-panel .start .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-cell .mat-calendar-body-cell-content,.cmat-date-range-panel .end .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-cell .mat-calendar-body-cell-content{position:relative;top:0;left:0;width:24px;height:24px;font-size:12px}.cmat-date-range-panel .time{width:100%;max-width:196px}.cmat-date-range-panel .start{align-items:flex-start;margin-right:20px}.cmat-date-range-panel .start .month .month-label{margin-left:8px}.cmat-date-range-panel .end{align-items:flex-end;margin-left:20px}.cmat-date-range-panel .end .month .month-label{margin-right:8px}\n"] }]
450
- }], ctorParameters: () => [], propDecorators: { controlClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "controlClass", required: false }] }], dateFormat: [{ type: i0.Input, args: [{ isSignal: true, alias: "dateFormat", required: false }] }], timeFormat: [{ type: i0.Input, args: [{ isSignal: true, alias: "timeFormat", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], timeRange: [{ type: i0.Input, args: [{ isSignal: true, alias: "timeRange", required: false }] }], range: [{ type: i0.Input, args: [{ isSignal: true, alias: "range", required: false }] }], rangeChanged: [{ type: i0.Output, args: ["rangeChanged"] }], _matMonthView1: [{ type: i0.ViewChild, args: ['matMonthView1', { isSignal: true }] }], _matMonthView2: [{ type: i0.ViewChild, args: ['matMonthView2', { isSignal: true }] }], _pickerPanelOrigin: [{ type: i0.ViewChild, args: ['pickerPanelOrigin', { isSignal: true }] }], _pickerPanel: [{ type: i0.ViewChild, args: ['pickerPanel', { isSignal: true }] }] } });
451
-
452
- /**
453
- * Generated bundle index. Do not edit.
454
- */
455
-
1
+ import { Overlay } from "@angular/cdk/overlay";
2
+ import { TemplatePortal } from "@angular/cdk/portal";
3
+ import { NgClass } from "@angular/common";
4
+ import * as i0 from "@angular/core";
5
+ import { ChangeDetectionStrategy, Component, ViewContainerRef, ViewEncapsulation, computed, effect, forwardRef, inject, input, output, signal, untracked, viewChild } from "@angular/core";
6
+ import * as i1 from "@angular/forms";
7
+ import { FormControl, FormsModule, NG_VALUE_ACCESSOR, ReactiveFormsModule, Validators } from "@angular/forms";
8
+ import * as i2 from "@angular/material/button";
9
+ import { MatButtonModule } from "@angular/material/button";
10
+ import { MatMonthView } from "@angular/material/datepicker";
11
+ import * as i4 from "@angular/material/form-field";
12
+ import { MatFormFieldModule } from "@angular/material/form-field";
13
+ import * as i3 from "@angular/material/icon";
14
+ import { MatIconModule } from "@angular/material/icon";
15
+ import * as i5 from "@angular/material/input";
16
+ import { MatInputModule } from "@angular/material/input";
17
+ import dayjs from "dayjs";
18
+ import isBetween from "dayjs/plugin/isBetween";
19
+ var CmatDateRangeComponent = class CmatDateRangeComponent {
20
+ constructor() {
21
+ this.controlClass = input("", ...ngDevMode ? [{ debugName: "controlClass" }] : /* istanbul ignore next */ []);
22
+ this.dateFormat = input("YYYY/MM/DD", ...ngDevMode ? [{ debugName: "dateFormat" }] : /* istanbul ignore next */ []);
23
+ this.timeFormat = input("HH:mm", {
24
+ ...ngDevMode ? { debugName: "timeFormat" } : /* istanbul ignore next */ {},
25
+ transform: (value) => value === "12" ? "hh:mmA" : "HH:mm"
26
+ });
27
+ this.readonly = input(false, ...ngDevMode ? [{ debugName: "readonly" }] : /* istanbul ignore next */ []);
28
+ this.timeRange = input(true, ...ngDevMode ? [{ debugName: "timeRange" }] : /* istanbul ignore next */ []);
29
+ this.range = input(null, ...ngDevMode ? [{ debugName: "range" }] : /* istanbul ignore next */ []);
30
+ this.rangeChanged = output();
31
+ this.activeDates = signal({
32
+ month1: dayjs(),
33
+ month2: dayjs().add(1, "month")
34
+ }, ...ngDevMode ? [{ debugName: "activeDates" }] : /* istanbul ignore next */ []);
35
+ this.setWhichDate = signal("start", ...ngDevMode ? [{ debugName: "setWhichDate" }] : /* istanbul ignore next */ []);
36
+ this.rangeDisplay = computed(() => {
37
+ const r = this._range();
38
+ if (r.start && r.end) {
39
+ const start = r.start.clone();
40
+ const end = r.end.clone();
41
+ return {
42
+ startDate: start.format(this.dateFormat()),
43
+ startTime: this.timeRange() ? start.format(this.timeFormat()) : null,
44
+ endDate: end.format(this.dateFormat()),
45
+ endTime: this.timeRange() ? end.format(this.timeFormat()) : null
46
+ };
47
+ }
48
+ }, ...ngDevMode ? [{ debugName: "rangeDisplay" }] : /* istanbul ignore next */ []);
49
+ this.dateClassFn = computed(() => {
50
+ const r = this._range();
51
+ return (date) => {
52
+ if (r.start && r.end) {
53
+ if (date.isSame(r.start, "day") && date.isSame(r.end, "day")) return [
54
+ "cmat-date-range",
55
+ "cmat-date-range-start",
56
+ "cmat-date-range-end"
57
+ ];
58
+ if (date.isSame(r.start, "day")) return ["cmat-date-range", "cmat-date-range-start"];
59
+ if (date.isSame(r.end, "day")) return ["cmat-date-range", "cmat-date-range-end"];
60
+ if (date.isBetween(r.start, r.end, "day")) return ["cmat-date-range", "cmat-date-range-mid"];
61
+ } else if (r.start && date.isSame(r.start, "day")) return ["cmat-date-range", "cmat-date-range-start"];
62
+ return [];
63
+ };
64
+ }, ...ngDevMode ? [{ debugName: "dateClassFn" }] : /* istanbul ignore next */ []);
65
+ this.dateFilterFn = computed(() => {
66
+ const which = this.setWhichDate();
67
+ const r = this._range();
68
+ return (date) => {
69
+ return !(which === "end" && r.start && date.isBefore(r.start, "day"));
70
+ };
71
+ }, ...ngDevMode ? [{ debugName: "dateFilterFn" }] : /* istanbul ignore next */ []);
72
+ this._matMonthView1 = viewChild("matMonthView1", ...ngDevMode ? [{ debugName: "_matMonthView1" }] : /* istanbul ignore next */ []);
73
+ this._matMonthView2 = viewChild("matMonthView2", ...ngDevMode ? [{ debugName: "_matMonthView2" }] : /* istanbul ignore next */ []);
74
+ this._pickerPanelOrigin = viewChild("pickerPanelOrigin", ...ngDevMode ? [{ debugName: "_pickerPanelOrigin" }] : /* istanbul ignore next */ []);
75
+ this._pickerPanel = viewChild("pickerPanel", ...ngDevMode ? [{ debugName: "_pickerPanel" }] : /* istanbul ignore next */ []);
76
+ this._overlay = inject(Overlay);
77
+ this._viewContainerRef = inject(ViewContainerRef);
78
+ this._overlayRef = null;
79
+ this._range = signal({
80
+ start: null,
81
+ end: null
82
+ }, ...ngDevMode ? [{ debugName: "_range" }] : /* istanbul ignore next */ []);
83
+ this._programmaticChange = false;
84
+ this._rangeInputFirstRun = true;
85
+ this._timeRangeFirstRun = true;
86
+ this._emittingChange = false;
87
+ this._timeRegExp = /* @__PURE__ */ new RegExp("^(0[0-9]|1[0-9]|2[0-4]|[0-9]):([0-5][0-9])(A|(?:AM)|P|(?:PM))?$", "i");
88
+ this._onChange = () => {};
89
+ this._onTouched = () => {};
90
+ dayjs.extend(isBetween);
91
+ effect(() => {
92
+ const rangeValue = this.range();
93
+ if (this._rangeInputFirstRun) {
94
+ this._rangeInputFirstRun = false;
95
+ return;
96
+ }
97
+ untracked(() => {
98
+ this._setRangeFromInput(rangeValue);
99
+ });
100
+ });
101
+ effect(() => {
102
+ const tr = this.timeRange();
103
+ if (this._timeRangeFirstRun) {
104
+ this._timeRangeFirstRun = false;
105
+ return;
106
+ }
107
+ untracked(() => {
108
+ if (!tr && this._range().start && this._range().end) this._setRangeFromInput({
109
+ start: this._range().start.clone().startOf("day").toISOString(),
110
+ end: this._range().end.clone().endOf("day").toISOString()
111
+ });
112
+ });
113
+ });
114
+ }
115
+ registerOnChange(fn) {
116
+ this._onChange = fn;
117
+ }
118
+ registerOnTouched(fn) {
119
+ this._onTouched = fn;
120
+ }
121
+ writeValue(range) {
122
+ this._programmaticChange = true;
123
+ this._setRangeFromInput(range);
124
+ }
125
+ ngOnInit() {
126
+ this._init();
127
+ }
128
+ ngOnDestroy() {
129
+ if (this._overlayRef) {
130
+ this._overlayRef.dispose();
131
+ this._overlayRef = null;
132
+ }
133
+ }
134
+ openPickerPanel() {
135
+ if (this.readonly()) return;
136
+ const origin = this._pickerPanelOrigin();
137
+ if (!origin) return;
138
+ const overlayRef = this._overlay.create({
139
+ panelClass: "cmat-date-range-panel",
140
+ backdropClass: "",
141
+ hasBackdrop: true,
142
+ scrollStrategy: this._overlay.scrollStrategies.reposition(),
143
+ positionStrategy: this._overlay.position().flexibleConnectedTo(origin).withPositions([{
144
+ originX: "start",
145
+ originY: "bottom",
146
+ overlayX: "start",
147
+ overlayY: "top",
148
+ offsetY: 8
149
+ }, {
150
+ originX: "start",
151
+ originY: "top",
152
+ overlayX: "start",
153
+ overlayY: "bottom",
154
+ offsetY: -8
155
+ }])
156
+ });
157
+ this._overlayRef = overlayRef;
158
+ const templatePortal = new TemplatePortal(this._pickerPanel(), this._viewContainerRef);
159
+ overlayRef.backdropClick().subscribe(() => {
160
+ if (templatePortal?.isAttached) templatePortal.detach();
161
+ if (overlayRef?.hasAttached()) {
162
+ overlayRef.detach();
163
+ overlayRef.dispose();
164
+ }
165
+ this._overlayRef = null;
166
+ });
167
+ overlayRef.attach(templatePortal);
168
+ }
169
+ getMonthLabel(month) {
170
+ const dates = this.activeDates();
171
+ if (month === 1) return dates.month1?.clone().format("YYYY MMMM") ?? "";
172
+ return dates.month2?.clone().format("YYYY MMMM") ?? "";
173
+ }
174
+ onActiveDateChange(month, date) {
175
+ this.activeDates.update((dates) => {
176
+ if (month === 1) return {
177
+ month1: date,
178
+ month2: dates.month2
179
+ };
180
+ return {
181
+ month1: dates.month1,
182
+ month2: date
183
+ };
184
+ });
185
+ }
186
+ onSelectedDateChange(date) {
187
+ if (!date) return;
188
+ const whichDate = this.setWhichDate();
189
+ const r = this._range();
190
+ const newRange = {
191
+ start: (whichDate === "start" ? (r.start ?? dayjs()).clone().year(date.year()).month(date.month()).date(date.date()) : r.start ?? date).toISOString(),
192
+ end: (whichDate === "end" ? (r.end ?? dayjs()).clone().year(date.year()).month(date.month()).date(date.date()) : r.end ?? date).toISOString(),
193
+ whichDate
194
+ };
195
+ this.setWhichDate.set(whichDate === "start" ? "end" : "start");
196
+ this._setRangeFromInput(newRange);
197
+ }
198
+ prev() {
199
+ this.activeDates.update((dates) => ({
200
+ month1: dayjs(dates.month1).subtract(1, "month"),
201
+ month2: dayjs(dates.month2).subtract(1, "month")
202
+ }));
203
+ }
204
+ next() {
205
+ this.activeDates.update((dates) => ({
206
+ month1: dayjs(dates.month1).add(1, "month"),
207
+ month2: dayjs(dates.month2).add(1, "month")
208
+ }));
209
+ }
210
+ updateStartTime(event) {
211
+ const value = event.target?.value ?? "";
212
+ const parsedTime = this._parseTime(value);
213
+ const formControl = this.startTimeFormControl;
214
+ if (formControl?.invalid) {
215
+ const r = this._range();
216
+ if (r.start) formControl.setValue(r.start.clone().format(this.timeFormat()));
217
+ return;
218
+ }
219
+ const r = this._range();
220
+ if (r.start && r.end) {
221
+ let startDate = r.start.clone().hour(parsedTime.hour()).minute(parsedTime.minute());
222
+ if (startDate.isAfter(r.end)) {
223
+ const endDateHours = r.end.hour();
224
+ const endDateMinutes = r.end.minute();
225
+ startDate.hour(endDateHours).minute(endDateMinutes);
226
+ }
227
+ this._setRangeFromInput({
228
+ start: startDate.toISOString(),
229
+ end: r.end.clone().toISOString(),
230
+ whichDate: "start"
231
+ });
232
+ }
233
+ }
234
+ updateEndTime(event) {
235
+ const value = event.target?.value ?? "";
236
+ const parsedTime = this._parseTime(value);
237
+ const formControl = this.endTimeFormControl;
238
+ if (formControl?.invalid) {
239
+ const r = this._range();
240
+ if (r.end) formControl.setValue(r.end.clone().format(this.timeFormat()));
241
+ return;
242
+ }
243
+ const r = this._range();
244
+ if (r.start && r.end) {
245
+ let endDate = r.end.clone().hour(parsedTime.hour()).minute(parsedTime.minute());
246
+ if (endDate.isBefore(r.start)) {
247
+ const startDateHours = r.start.hour();
248
+ const startDateMinutes = r.start.minute();
249
+ endDate.hour(startDateHours).minute(startDateMinutes);
250
+ }
251
+ this._setRangeFromInput({
252
+ start: r.start.clone().toISOString(),
253
+ end: endDate.toISOString(),
254
+ whichDate: "end"
255
+ });
256
+ }
257
+ }
258
+ _setRangeFromInput(value) {
259
+ if (!(value?.start && value.end)) {
260
+ this._range.set({
261
+ start: null,
262
+ end: null
263
+ });
264
+ this.activeDates.set({
265
+ month1: dayjs(),
266
+ month2: dayjs().add(1, "month")
267
+ });
268
+ return;
269
+ }
270
+ const whichDate = value.whichDate ?? null;
271
+ const start = dayjs(value.start);
272
+ const end = dayjs(value.end);
273
+ const currentRange = this._range();
274
+ let newStart = currentRange.start;
275
+ let newEnd = currentRange.end;
276
+ if (whichDate === "start") {
277
+ newStart = start.clone();
278
+ if (newEnd && newStart.isAfter(newEnd)) {
279
+ newEnd = start.clone().hour(newEnd.hour()).minute(newEnd.minute()).second(newEnd.second());
280
+ if (!newStart.isBefore(newEnd)) newEnd = start.clone();
281
+ }
282
+ }
283
+ if (whichDate === "end") {
284
+ newEnd = end.clone();
285
+ if (newStart?.isAfter(newEnd)) {
286
+ newStart = end.clone().hour(newStart.hour()).minute(newStart.minute()).second(newStart.second());
287
+ if (!newEnd.isAfter(newStart)) newStart = end.clone();
288
+ }
289
+ }
290
+ if (!whichDate) {
291
+ newStart = start.clone();
292
+ newEnd = start.isBefore(end) ? end.clone() : start.clone();
293
+ }
294
+ this._range.set({
295
+ start: newStart,
296
+ end: newEnd
297
+ });
298
+ if (newStart && newEnd) {
299
+ const rangeOutput = {
300
+ start: newStart.toISOString(),
301
+ end: newEnd.toISOString()
302
+ };
303
+ if (!this._programmaticChange && !this._emittingChange) {
304
+ this._emittingChange = true;
305
+ try {
306
+ this.rangeChanged.emit(rangeOutput);
307
+ this._onTouched();
308
+ this._onChange(rangeOutput);
309
+ } finally {
310
+ setTimeout(() => {
311
+ this._emittingChange = false;
312
+ }, 0);
313
+ }
314
+ }
315
+ this.activeDates.set({
316
+ month1: newStart.clone(),
317
+ month2: newStart.clone().add(1, "month")
318
+ });
319
+ const timeFmt = this.timeFormat();
320
+ const startCtrl = this.startTimeFormControl;
321
+ const endCtrl = this.endTimeFormControl;
322
+ if (startCtrl && startCtrl.value !== newStart.clone().format(timeFmt)) startCtrl.setValue(newStart.clone().format(timeFmt));
323
+ if (endCtrl && endCtrl.value !== newEnd.clone().format(timeFmt)) endCtrl.setValue(newEnd.clone().format(timeFmt));
324
+ }
325
+ const matMonthView1 = this._matMonthView1();
326
+ const matMonthView2 = this._matMonthView2();
327
+ if (matMonthView1 && matMonthView2) {
328
+ const newDateClassFn = this.dateClassFn();
329
+ const newDateFilterFn = this.dateFilterFn();
330
+ matMonthView1.dateClass = newDateClassFn;
331
+ matMonthView2.dateClass = newDateClassFn;
332
+ matMonthView1.dateFilter = newDateFilterFn;
333
+ matMonthView2.dateFilter = newDateFilterFn;
334
+ matMonthView1.ngAfterContentInit();
335
+ matMonthView2.ngAfterContentInit();
336
+ }
337
+ this._programmaticChange = false;
338
+ }
339
+ _init() {
340
+ this.startTimeFormControl = new FormControl("", [Validators.pattern(this._timeRegExp)]);
341
+ this.endTimeFormControl = new FormControl("", [Validators.pattern(this._timeRegExp)]);
342
+ this._programmaticChange = true;
343
+ const rangeValue = this.range();
344
+ if (rangeValue) this._setRangeFromInput(rangeValue);
345
+ else this._setRangeFromInput({
346
+ start: dayjs().startOf("day").toISOString(),
347
+ end: dayjs().add(1, "day").endOf("day").toISOString()
348
+ });
349
+ }
350
+ _parseTime(value) {
351
+ if (value.split(this._timeRegExp).filter((part) => part !== "")[2] || null) return dayjs(value, "hh:mmA").second(0);
352
+ return dayjs(value, "HH:mm").second(0);
353
+ }
354
+ static {
355
+ this.ɵfac = i0.ɵɵngDeclareFactory({
356
+ minVersion: "12.0.0",
357
+ version: "22.2.3",
358
+ ngImport: i0,
359
+ type: CmatDateRangeComponent,
360
+ deps: [],
361
+ target: i0.ɵɵFactoryTarget.Component
362
+ });
363
+ }
364
+ static {
365
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
366
+ minVersion: "17.0.0",
367
+ version: "22.2.3",
368
+ type: CmatDateRangeComponent,
369
+ isStandalone: true,
370
+ selector: "cmat-date-range",
371
+ inputs: {
372
+ controlClass: {
373
+ classPropertyName: "controlClass",
374
+ publicName: "controlClass",
375
+ isSignal: true,
376
+ isRequired: false,
377
+ transformFunction: null
378
+ },
379
+ dateFormat: {
380
+ classPropertyName: "dateFormat",
381
+ publicName: "dateFormat",
382
+ isSignal: true,
383
+ isRequired: false,
384
+ transformFunction: null
385
+ },
386
+ timeFormat: {
387
+ classPropertyName: "timeFormat",
388
+ publicName: "timeFormat",
389
+ isSignal: true,
390
+ isRequired: false,
391
+ transformFunction: null
392
+ },
393
+ readonly: {
394
+ classPropertyName: "readonly",
395
+ publicName: "readonly",
396
+ isSignal: true,
397
+ isRequired: false,
398
+ transformFunction: null
399
+ },
400
+ timeRange: {
401
+ classPropertyName: "timeRange",
402
+ publicName: "timeRange",
403
+ isSignal: true,
404
+ isRequired: false,
405
+ transformFunction: null
406
+ },
407
+ range: {
408
+ classPropertyName: "range",
409
+ publicName: "range",
410
+ isSignal: true,
411
+ isRequired: false,
412
+ transformFunction: null
413
+ }
414
+ },
415
+ outputs: { rangeChanged: "rangeChanged" },
416
+ providers: [{
417
+ provide: NG_VALUE_ACCESSOR,
418
+ useExisting: forwardRef(() => CmatDateRangeComponent),
419
+ multi: true
420
+ }],
421
+ viewQueries: [
422
+ {
423
+ propertyName: "_matMonthView1",
424
+ first: true,
425
+ predicate: ["matMonthView1"],
426
+ descendants: true,
427
+ isSignal: true
428
+ },
429
+ {
430
+ propertyName: "_matMonthView2",
431
+ first: true,
432
+ predicate: ["matMonthView2"],
433
+ descendants: true,
434
+ isSignal: true
435
+ },
436
+ {
437
+ propertyName: "_pickerPanelOrigin",
438
+ first: true,
439
+ predicate: ["pickerPanelOrigin"],
440
+ descendants: true,
441
+ isSignal: true
442
+ },
443
+ {
444
+ propertyName: "_pickerPanel",
445
+ first: true,
446
+ predicate: ["pickerPanel"],
447
+ descendants: true,
448
+ isSignal: true
449
+ }
450
+ ],
451
+ exportAs: ["cmatDateRange"],
452
+ ngImport: i0,
453
+ template: "<div #pickerPanelOrigin role=\"presentation\" class=\"range\" (click)=\"openPickerPanel()\">\r\n\r\n <div class=\"start\" [ngClass]=\"controlClass()\">\r\n <div class=\"date\">{{rangeDisplay()?.startDate}}</div>\r\n @if (rangeDisplay()?.startTime) {\r\n <div class=\"time\">{{rangeDisplay()?.startTime}}</div>\r\n }\r\n </div>\r\n\r\n <div class=\"separator\">-</div>\r\n\r\n <div class=\"end\" [ngClass]=\"controlClass()\">\r\n <div class=\"date\">{{rangeDisplay()?.endDate}}</div>\r\n @if (rangeDisplay()?.endTime) {\r\n <div class=\"time\">{{rangeDisplay()?.endTime}}</div>\r\n }\r\n </div>\r\n\r\n</div>\r\n\r\n<ng-template #pickerPanel>\r\n\r\n <!-- Start -->\r\n <div class=\"start\">\r\n\r\n <div class=\"month\">\r\n <div class=\"month-header\">\r\n <button type=\"button\" class=\"previous-button\" matIconButton tabindex=\"1\" (click)=\"prev()\">\r\n <mat-icon [svgIcon]=\"'heroicons_outline:chevron-left'\"></mat-icon>\r\n </button>\r\n <div class=\"month-label\">{{getMonthLabel(1)}}</div>\r\n </div>\r\n <mat-month-view #matMonthView1 [dateFilter]=\"dateFilterFn()\" [dateClass]=\"dateClassFn()\"\r\n [activeDate]=\"activeDates().month1\" (activeDateChange)=\"onActiveDateChange(1, $event)\"\r\n (click)=\"$event.stopImmediatePropagation()\"\r\n (selectedChange)=\"onSelectedDateChange($event)\">\r\n </mat-month-view>\r\n </div>\r\n\r\n @if (timeRange()) {\r\n <mat-form-field class=\"time start-time\">\r\n <input matInput tabindex=\"3\" [autocomplete]=\"'off'\" [formControl]=\"startTimeFormControl\"\r\n (blur)=\"updateStartTime($event)\">\r\n <mat-label>开始时间</mat-label>\r\n </mat-form-field>\r\n }\r\n\r\n </div>\r\n\r\n <!-- End -->\r\n <div class=\"end\">\r\n\r\n <div class=\"month\">\r\n <div class=\"month-header\">\r\n <div class=\"month-label\">{{getMonthLabel(2)}}</div>\r\n <button type=\"button\" class=\"next-button\" matIconButton tabindex=\"2\" (click)=\"next()\">\r\n <mat-icon [svgIcon]=\"'heroicons_outline:chevron-right'\"></mat-icon>\r\n </button>\r\n </div>\r\n <mat-month-view #matMonthView2 [dateFilter]=\"dateFilterFn()\" [dateClass]=\"dateClassFn()\"\r\n [activeDate]=\"activeDates().month2\" (activeDateChange)=\"onActiveDateChange(2, $event)\"\r\n (click)=\"$event.stopImmediatePropagation()\"\r\n (selectedChange)=\"onSelectedDateChange($event)\">\r\n </mat-month-view>\r\n </div>\r\n\r\n @if (timeRange()) {\r\n <mat-form-field class=\"time end-time\">\r\n <input matInput tabindex=\"4\" [formControl]=\"endTimeFormControl\" (blur)=\"updateEndTime($event)\">\r\n <mat-label>结束时间</mat-label>\r\n </mat-form-field>\r\n }\r\n\r\n </div>\r\n\r\n </ng-template>",
454
+ styles: ["cmat-date-range{display:flex;width:100%}cmat-date-range .range{display:flex;width:100%;align-items:center;height:48px;min-height:48px;max-height:48px;cursor:pointer}cmat-date-range .range .start,cmat-date-range .range .end{display:flex;align-items:center;height:100%;padding:0 16px;border-radius:6px;border-width:1px;line-height:1}cmat-date-range .range .date{white-space:nowrap}cmat-date-range .range .date+.time{margin-left:8px}cmat-date-range .range .time{white-space:nowrap}cmat-date-range .separator{margin:0 auto;width:6px}.cmat-date-range-panel{border-radius:12px;padding:24px}.cmat-date-range-panel .start,.cmat-date-range-panel .end{display:flex;flex-direction:column}.cmat-date-range-panel .start .month,.cmat-date-range-panel .end .month{max-width:196px;min-width:196px;width:196px}.cmat-date-range-panel .start .month .month-header,.cmat-date-range-panel .end .month .month-header{position:relative;display:flex;align-items:center;justify-content:center;height:32px;margin-bottom:16px}.cmat-date-range-panel .start .month .month-header .previous-button,.cmat-date-range-panel .start .month .month-header .next-button,.cmat-date-range-panel .end .month .month-header .previous-button,.cmat-date-range-panel .end .month .month-header .next-button{position:absolute;width:24px!important;height:24px!important;min-height:24px!important;max-height:24px!important;line-height:24px!important}.cmat-date-range-panel .start .month .month-header .previous-button,.cmat-date-range-panel .end .month .month-header .previous-button{left:0}.cmat-date-range-panel .start .month .month-header .next-button,.cmat-date-range-panel .end .month .month-header .next-button{right:0}.cmat-date-range-panel .start .month .month-header .month-label,.cmat-date-range-panel .end .month .month-header .month-label{font-weight:500}.cmat-date-range-panel .start .month mat-month-view,.cmat-date-range-panel .end .month mat-month-view{display:flex;min-height:188px}.cmat-date-range-panel .start .month mat-month-view .mat-calendar-table,.cmat-date-range-panel .end .month mat-month-view .mat-calendar-table{width:100%;border-collapse:collapse}.cmat-date-range-panel .start .month mat-month-view .mat-calendar-table tbody tr[aria-hidden=true],.cmat-date-range-panel .end .month mat-month-view .mat-calendar-table tbody tr[aria-hidden=true]{display:none!important}.cmat-date-range-panel .start .month mat-month-view .mat-calendar-table tbody tr:first-child td:first-child[aria-hidden=true],.cmat-date-range-panel .end .month mat-month-view .mat-calendar-table tbody tr:first-child td:first-child[aria-hidden=true]{visibility:hidden;pointer-events:none;opacity:0}.cmat-date-range-panel .start .month mat-month-view .mat-calendar-table tbody tr td .mat-calendar-body-cell-content,.cmat-date-range-panel .end .month mat-month-view .mat-calendar-table tbody tr td .mat-calendar-body-cell-content{background-color:transparent!important}.cmat-date-range-panel .start .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-today,.cmat-date-range-panel .end .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-today{border:none!important}.cmat-date-range-panel .start .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-cell,.cmat-date-range-panel .end .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-cell{width:28px!important;height:28px!important;padding:2px!important}.cmat-date-range-panel .start .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-cell.cmat-date-range:before,.cmat-date-range-panel .end .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-cell.cmat-date-range:before{content:\"\";position:absolute;inset:2px 0}.cmat-date-range-panel .start .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-cell.cmat-date-range.cmat-date-range-start:before,.cmat-date-range-panel .end .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-cell.cmat-date-range.cmat-date-range-start:before{border-radius:999px 0 0 999px}.cmat-date-range-panel .start .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-cell.cmat-date-range.cmat-date-range-start.cmat-date-range-end:before,.cmat-date-range-panel .end .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-cell.cmat-date-range.cmat-date-range-start.cmat-date-range-end:before{right:2px;border-radius:999px}.cmat-date-range-panel .start .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-cell.cmat-date-range.cmat-date-range-end:before,.cmat-date-range-panel .end .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-cell.cmat-date-range.cmat-date-range-end:before{border-radius:0 999px 999px 0}.cmat-date-range-panel .start .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-cell .mat-calendar-body-cell-content,.cmat-date-range-panel .end .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-cell .mat-calendar-body-cell-content{position:relative;top:0;left:0;width:24px;height:24px;font-size:12px}.cmat-date-range-panel .time{width:100%;max-width:196px}.cmat-date-range-panel .start{align-items:flex-start;margin-right:20px}.cmat-date-range-panel .start .month .month-label{margin-left:8px}.cmat-date-range-panel .end{align-items:flex-end;margin-left:20px}.cmat-date-range-panel .end .month .month-label{margin-right:8px}\n"],
455
+ dependencies: [
456
+ {
457
+ kind: "ngmodule",
458
+ type: FormsModule
459
+ },
460
+ {
461
+ kind: "directive",
462
+ type: i1.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: i1.NgControlStatus,
468
+ selector: "[formControlName],[ngModel],[formControl]"
469
+ },
470
+ {
471
+ kind: "ngmodule",
472
+ type: ReactiveFormsModule
473
+ },
474
+ {
475
+ kind: "directive",
476
+ type: i1.FormControlDirective,
477
+ selector: "[formControl]",
478
+ inputs: [
479
+ "formControl",
480
+ "disabled",
481
+ "ngModel"
482
+ ],
483
+ outputs: ["ngModelChange"],
484
+ exportAs: ["ngForm"]
485
+ },
486
+ {
487
+ kind: "ngmodule",
488
+ type: MatButtonModule
489
+ },
490
+ {
491
+ kind: "component",
492
+ type: i2.MatIconButton,
493
+ selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]",
494
+ exportAs: ["matButton", "matAnchor"]
495
+ },
496
+ {
497
+ kind: "ngmodule",
498
+ type: MatIconModule
499
+ },
500
+ {
501
+ kind: "component",
502
+ type: i3.MatIcon,
503
+ selector: "mat-icon",
504
+ inputs: [
505
+ "color",
506
+ "inline",
507
+ "svgIcon",
508
+ "fontSet",
509
+ "fontIcon"
510
+ ],
511
+ exportAs: ["matIcon"]
512
+ },
513
+ {
514
+ kind: "ngmodule",
515
+ type: MatFormFieldModule
516
+ },
517
+ {
518
+ kind: "component",
519
+ type: i4.MatFormField,
520
+ selector: "mat-form-field",
521
+ inputs: [
522
+ "hideRequiredMarker",
523
+ "color",
524
+ "floatLabel",
525
+ "appearance",
526
+ "subscriptSizing",
527
+ "hintLabel"
528
+ ],
529
+ exportAs: ["matFormField"]
530
+ },
531
+ {
532
+ kind: "directive",
533
+ type: i4.MatLabel,
534
+ selector: "mat-label"
535
+ },
536
+ {
537
+ kind: "component",
538
+ type: MatMonthView,
539
+ selector: "mat-month-view",
540
+ inputs: [
541
+ "activeDate",
542
+ "selected",
543
+ "minDate",
544
+ "maxDate",
545
+ "dateFilter",
546
+ "dateClass",
547
+ "comparisonStart",
548
+ "comparisonEnd",
549
+ "startDateAccessibleName",
550
+ "endDateAccessibleName",
551
+ "activeDrag"
552
+ ],
553
+ outputs: [
554
+ "selectedChange",
555
+ "_userSelection",
556
+ "dragStarted",
557
+ "dragEnded",
558
+ "activeDateChange"
559
+ ],
560
+ exportAs: ["matMonthView"]
561
+ },
562
+ {
563
+ kind: "ngmodule",
564
+ type: MatInputModule
565
+ },
566
+ {
567
+ kind: "directive",
568
+ type: i5.MatInput,
569
+ selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]",
570
+ inputs: [
571
+ "disabled",
572
+ "id",
573
+ "placeholder",
574
+ "name",
575
+ "required",
576
+ "type",
577
+ "errorStateMatcher",
578
+ "aria-describedby",
579
+ "value",
580
+ "readonly",
581
+ "disabledInteractive"
582
+ ],
583
+ exportAs: ["matInput"]
584
+ },
585
+ {
586
+ kind: "directive",
587
+ type: NgClass,
588
+ selector: "[ngClass]",
589
+ inputs: ["class", "ngClass"]
590
+ }
591
+ ],
592
+ changeDetection: i0.ChangeDetectionStrategy.OnPush,
593
+ encapsulation: i0.ViewEncapsulation.None
594
+ });
595
+ }
596
+ };
597
+ i0.ɵɵngDeclareClassMetadata({
598
+ minVersion: "12.0.0",
599
+ version: "22.2.3",
600
+ ngImport: i0,
601
+ type: CmatDateRangeComponent,
602
+ decorators: [{
603
+ type: Component,
604
+ args: [{
605
+ selector: "cmat-date-range",
606
+ encapsulation: ViewEncapsulation.None,
607
+ changeDetection: ChangeDetectionStrategy.OnPush,
608
+ exportAs: "cmatDateRange",
609
+ providers: [{
610
+ provide: NG_VALUE_ACCESSOR,
611
+ useExisting: forwardRef(() => CmatDateRangeComponent),
612
+ multi: true
613
+ }],
614
+ imports: [
615
+ FormsModule,
616
+ ReactiveFormsModule,
617
+ MatButtonModule,
618
+ MatIconModule,
619
+ MatFormFieldModule,
620
+ MatMonthView,
621
+ MatInputModule,
622
+ NgClass
623
+ ],
624
+ template: "<div #pickerPanelOrigin role=\"presentation\" class=\"range\" (click)=\"openPickerPanel()\">\r\n\r\n <div class=\"start\" [ngClass]=\"controlClass()\">\r\n <div class=\"date\">{{rangeDisplay()?.startDate}}</div>\r\n @if (rangeDisplay()?.startTime) {\r\n <div class=\"time\">{{rangeDisplay()?.startTime}}</div>\r\n }\r\n </div>\r\n\r\n <div class=\"separator\">-</div>\r\n\r\n <div class=\"end\" [ngClass]=\"controlClass()\">\r\n <div class=\"date\">{{rangeDisplay()?.endDate}}</div>\r\n @if (rangeDisplay()?.endTime) {\r\n <div class=\"time\">{{rangeDisplay()?.endTime}}</div>\r\n }\r\n </div>\r\n\r\n</div>\r\n\r\n<ng-template #pickerPanel>\r\n\r\n <!-- Start -->\r\n <div class=\"start\">\r\n\r\n <div class=\"month\">\r\n <div class=\"month-header\">\r\n <button type=\"button\" class=\"previous-button\" matIconButton tabindex=\"1\" (click)=\"prev()\">\r\n <mat-icon [svgIcon]=\"'heroicons_outline:chevron-left'\"></mat-icon>\r\n </button>\r\n <div class=\"month-label\">{{getMonthLabel(1)}}</div>\r\n </div>\r\n <mat-month-view #matMonthView1 [dateFilter]=\"dateFilterFn()\" [dateClass]=\"dateClassFn()\"\r\n [activeDate]=\"activeDates().month1\" (activeDateChange)=\"onActiveDateChange(1, $event)\"\r\n (click)=\"$event.stopImmediatePropagation()\"\r\n (selectedChange)=\"onSelectedDateChange($event)\">\r\n </mat-month-view>\r\n </div>\r\n\r\n @if (timeRange()) {\r\n <mat-form-field class=\"time start-time\">\r\n <input matInput tabindex=\"3\" [autocomplete]=\"'off'\" [formControl]=\"startTimeFormControl\"\r\n (blur)=\"updateStartTime($event)\">\r\n <mat-label>开始时间</mat-label>\r\n </mat-form-field>\r\n }\r\n\r\n </div>\r\n\r\n <!-- End -->\r\n <div class=\"end\">\r\n\r\n <div class=\"month\">\r\n <div class=\"month-header\">\r\n <div class=\"month-label\">{{getMonthLabel(2)}}</div>\r\n <button type=\"button\" class=\"next-button\" matIconButton tabindex=\"2\" (click)=\"next()\">\r\n <mat-icon [svgIcon]=\"'heroicons_outline:chevron-right'\"></mat-icon>\r\n </button>\r\n </div>\r\n <mat-month-view #matMonthView2 [dateFilter]=\"dateFilterFn()\" [dateClass]=\"dateClassFn()\"\r\n [activeDate]=\"activeDates().month2\" (activeDateChange)=\"onActiveDateChange(2, $event)\"\r\n (click)=\"$event.stopImmediatePropagation()\"\r\n (selectedChange)=\"onSelectedDateChange($event)\">\r\n </mat-month-view>\r\n </div>\r\n\r\n @if (timeRange()) {\r\n <mat-form-field class=\"time end-time\">\r\n <input matInput tabindex=\"4\" [formControl]=\"endTimeFormControl\" (blur)=\"updateEndTime($event)\">\r\n <mat-label>结束时间</mat-label>\r\n </mat-form-field>\r\n }\r\n\r\n </div>\r\n\r\n </ng-template>",
625
+ styles: ["cmat-date-range{display:flex;width:100%}cmat-date-range .range{display:flex;width:100%;align-items:center;height:48px;min-height:48px;max-height:48px;cursor:pointer}cmat-date-range .range .start,cmat-date-range .range .end{display:flex;align-items:center;height:100%;padding:0 16px;border-radius:6px;border-width:1px;line-height:1}cmat-date-range .range .date{white-space:nowrap}cmat-date-range .range .date+.time{margin-left:8px}cmat-date-range .range .time{white-space:nowrap}cmat-date-range .separator{margin:0 auto;width:6px}.cmat-date-range-panel{border-radius:12px;padding:24px}.cmat-date-range-panel .start,.cmat-date-range-panel .end{display:flex;flex-direction:column}.cmat-date-range-panel .start .month,.cmat-date-range-panel .end .month{max-width:196px;min-width:196px;width:196px}.cmat-date-range-panel .start .month .month-header,.cmat-date-range-panel .end .month .month-header{position:relative;display:flex;align-items:center;justify-content:center;height:32px;margin-bottom:16px}.cmat-date-range-panel .start .month .month-header .previous-button,.cmat-date-range-panel .start .month .month-header .next-button,.cmat-date-range-panel .end .month .month-header .previous-button,.cmat-date-range-panel .end .month .month-header .next-button{position:absolute;width:24px!important;height:24px!important;min-height:24px!important;max-height:24px!important;line-height:24px!important}.cmat-date-range-panel .start .month .month-header .previous-button,.cmat-date-range-panel .end .month .month-header .previous-button{left:0}.cmat-date-range-panel .start .month .month-header .next-button,.cmat-date-range-panel .end .month .month-header .next-button{right:0}.cmat-date-range-panel .start .month .month-header .month-label,.cmat-date-range-panel .end .month .month-header .month-label{font-weight:500}.cmat-date-range-panel .start .month mat-month-view,.cmat-date-range-panel .end .month mat-month-view{display:flex;min-height:188px}.cmat-date-range-panel .start .month mat-month-view .mat-calendar-table,.cmat-date-range-panel .end .month mat-month-view .mat-calendar-table{width:100%;border-collapse:collapse}.cmat-date-range-panel .start .month mat-month-view .mat-calendar-table tbody tr[aria-hidden=true],.cmat-date-range-panel .end .month mat-month-view .mat-calendar-table tbody tr[aria-hidden=true]{display:none!important}.cmat-date-range-panel .start .month mat-month-view .mat-calendar-table tbody tr:first-child td:first-child[aria-hidden=true],.cmat-date-range-panel .end .month mat-month-view .mat-calendar-table tbody tr:first-child td:first-child[aria-hidden=true]{visibility:hidden;pointer-events:none;opacity:0}.cmat-date-range-panel .start .month mat-month-view .mat-calendar-table tbody tr td .mat-calendar-body-cell-content,.cmat-date-range-panel .end .month mat-month-view .mat-calendar-table tbody tr td .mat-calendar-body-cell-content{background-color:transparent!important}.cmat-date-range-panel .start .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-today,.cmat-date-range-panel .end .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-today{border:none!important}.cmat-date-range-panel .start .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-cell,.cmat-date-range-panel .end .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-cell{width:28px!important;height:28px!important;padding:2px!important}.cmat-date-range-panel .start .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-cell.cmat-date-range:before,.cmat-date-range-panel .end .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-cell.cmat-date-range:before{content:\"\";position:absolute;inset:2px 0}.cmat-date-range-panel .start .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-cell.cmat-date-range.cmat-date-range-start:before,.cmat-date-range-panel .end .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-cell.cmat-date-range.cmat-date-range-start:before{border-radius:999px 0 0 999px}.cmat-date-range-panel .start .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-cell.cmat-date-range.cmat-date-range-start.cmat-date-range-end:before,.cmat-date-range-panel .end .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-cell.cmat-date-range.cmat-date-range-start.cmat-date-range-end:before{right:2px;border-radius:999px}.cmat-date-range-panel .start .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-cell.cmat-date-range.cmat-date-range-end:before,.cmat-date-range-panel .end .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-cell.cmat-date-range.cmat-date-range-end:before{border-radius:0 999px 999px 0}.cmat-date-range-panel .start .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-cell .mat-calendar-body-cell-content,.cmat-date-range-panel .end .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-cell .mat-calendar-body-cell-content{position:relative;top:0;left:0;width:24px;height:24px;font-size:12px}.cmat-date-range-panel .time{width:100%;max-width:196px}.cmat-date-range-panel .start{align-items:flex-start;margin-right:20px}.cmat-date-range-panel .start .month .month-label{margin-left:8px}.cmat-date-range-panel .end{align-items:flex-end;margin-left:20px}.cmat-date-range-panel .end .month .month-label{margin-right:8px}\n"]
626
+ }]
627
+ }],
628
+ ctorParameters: () => [],
629
+ propDecorators: {
630
+ controlClass: [{
631
+ type: i0.Input,
632
+ args: [{
633
+ isSignal: true,
634
+ alias: "controlClass",
635
+ required: false
636
+ }]
637
+ }],
638
+ dateFormat: [{
639
+ type: i0.Input,
640
+ args: [{
641
+ isSignal: true,
642
+ alias: "dateFormat",
643
+ required: false
644
+ }]
645
+ }],
646
+ timeFormat: [{
647
+ type: i0.Input,
648
+ args: [{
649
+ isSignal: true,
650
+ alias: "timeFormat",
651
+ required: false
652
+ }]
653
+ }],
654
+ readonly: [{
655
+ type: i0.Input,
656
+ args: [{
657
+ isSignal: true,
658
+ alias: "readonly",
659
+ required: false
660
+ }]
661
+ }],
662
+ timeRange: [{
663
+ type: i0.Input,
664
+ args: [{
665
+ isSignal: true,
666
+ alias: "timeRange",
667
+ required: false
668
+ }]
669
+ }],
670
+ range: [{
671
+ type: i0.Input,
672
+ args: [{
673
+ isSignal: true,
674
+ alias: "range",
675
+ required: false
676
+ }]
677
+ }],
678
+ rangeChanged: [{
679
+ type: i0.Output,
680
+ args: ["rangeChanged"]
681
+ }],
682
+ _matMonthView1: [{
683
+ type: i0.ViewChild,
684
+ args: ["matMonthView1", { isSignal: true }]
685
+ }],
686
+ _matMonthView2: [{
687
+ type: i0.ViewChild,
688
+ args: ["matMonthView2", { isSignal: true }]
689
+ }],
690
+ _pickerPanelOrigin: [{
691
+ type: i0.ViewChild,
692
+ args: ["pickerPanelOrigin", { isSignal: true }]
693
+ }],
694
+ _pickerPanel: [{
695
+ type: i0.ViewChild,
696
+ args: ["pickerPanel", { isSignal: true }]
697
+ }]
698
+ }
699
+ });
456
700
  export { CmatDateRangeComponent };
457
- //# sourceMappingURL=cmat-components-date-range.mjs.map
701
+
702
+ //# sourceMappingURL=cmat-components-date-range.mjs.map