iss-ctrl 0.0.21 → 0.0.22

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 (141) hide show
  1. package/README.md +33 -0
  2. package/fesm2022/iss-ctrl-attachment.viewer-DVUL39xd.mjs +110 -0
  3. package/fesm2022/iss-ctrl-attachment.viewer-DVUL39xd.mjs.map +1 -0
  4. package/fesm2022/iss-ctrl-base.mjs +663 -0
  5. package/fesm2022/iss-ctrl-base.mjs.map +1 -0
  6. package/fesm2022/iss-ctrl-checkbox.field-Dj5EGLUr.mjs +92 -0
  7. package/fesm2022/iss-ctrl-checkbox.field-Dj5EGLUr.mjs.map +1 -0
  8. package/fesm2022/iss-ctrl-checkbox.mjs +143 -0
  9. package/fesm2022/iss-ctrl-checkbox.mjs.map +1 -0
  10. package/fesm2022/iss-ctrl-checkbox.viewer-C3SEUszR.mjs +31 -0
  11. package/fesm2022/iss-ctrl-checkbox.viewer-C3SEUszR.mjs.map +1 -0
  12. package/fesm2022/iss-ctrl-chips.field-BLLAjBbP.mjs +76 -0
  13. package/fesm2022/iss-ctrl-chips.field-BLLAjBbP.mjs.map +1 -0
  14. package/fesm2022/iss-ctrl-chips.mjs +168 -0
  15. package/fesm2022/iss-ctrl-chips.mjs.map +1 -0
  16. package/fesm2022/iss-ctrl-chips.viewer-BcKT2hcq.mjs +38 -0
  17. package/fesm2022/iss-ctrl-chips.viewer-BcKT2hcq.mjs.map +1 -0
  18. package/fesm2022/iss-ctrl-date-picker.field-BSpXukpO.mjs +98 -0
  19. package/fesm2022/iss-ctrl-date-picker.field-BSpXukpO.mjs.map +1 -0
  20. package/fesm2022/iss-ctrl-date-picker.mjs +200 -0
  21. package/fesm2022/iss-ctrl-date-picker.mjs.map +1 -0
  22. package/fesm2022/iss-ctrl-date-picker.viewer-Dsmsf91t.mjs +40 -0
  23. package/fesm2022/iss-ctrl-date-picker.viewer-Dsmsf91t.mjs.map +1 -0
  24. package/fesm2022/iss-ctrl-date-range-picker.field-CjNHU1RW.mjs +97 -0
  25. package/fesm2022/iss-ctrl-date-range-picker.field-CjNHU1RW.mjs.map +1 -0
  26. package/fesm2022/iss-ctrl-date-range-picker.mjs +307 -0
  27. package/fesm2022/iss-ctrl-date-range-picker.mjs.map +1 -0
  28. package/fesm2022/iss-ctrl-date-range-picker.viewer-tmTQGPFh.mjs +41 -0
  29. package/fesm2022/iss-ctrl-date-range-picker.viewer-tmTQGPFh.mjs.map +1 -0
  30. package/fesm2022/iss-ctrl-datetime-picker.field-DGMY9PaU.mjs +98 -0
  31. package/fesm2022/iss-ctrl-datetime-picker.field-DGMY9PaU.mjs.map +1 -0
  32. package/fesm2022/iss-ctrl-datetime-picker.mjs +226 -0
  33. package/fesm2022/iss-ctrl-datetime-picker.mjs.map +1 -0
  34. package/fesm2022/iss-ctrl-datetime-picker.viewer-BeUyEBKo.mjs +42 -0
  35. package/fesm2022/iss-ctrl-datetime-picker.viewer-BeUyEBKo.mjs.map +1 -0
  36. package/fesm2022/iss-ctrl-file-picker.field-CbepZaX6.mjs +210 -0
  37. package/fesm2022/iss-ctrl-file-picker.field-CbepZaX6.mjs.map +1 -0
  38. package/fesm2022/iss-ctrl-file-picker.mjs +272 -0
  39. package/fesm2022/iss-ctrl-file-picker.mjs.map +1 -0
  40. package/fesm2022/iss-ctrl-input.field-Ctlf3OCN.mjs +104 -0
  41. package/fesm2022/iss-ctrl-input.field-Ctlf3OCN.mjs.map +1 -0
  42. package/fesm2022/iss-ctrl-input.mjs +204 -0
  43. package/fesm2022/iss-ctrl-input.mjs.map +1 -0
  44. package/fesm2022/iss-ctrl-input.viewer-BOZnW0_e.mjs +22 -0
  45. package/fesm2022/iss-ctrl-input.viewer-BOZnW0_e.mjs.map +1 -0
  46. package/fesm2022/iss-ctrl-iss-ctrl-DvnkwSMG.mjs +1789 -0
  47. package/fesm2022/iss-ctrl-iss-ctrl-DvnkwSMG.mjs.map +1 -0
  48. package/fesm2022/{iss-ctrl-load-event-bOt6IlIo.mjs → iss-ctrl-load-event-CuZ7pMjk.mjs} +4 -3
  49. package/fesm2022/iss-ctrl-load-event-CuZ7pMjk.mjs.map +1 -0
  50. package/fesm2022/{iss-ctrl-load-options-event-CxyAyNMe.mjs → iss-ctrl-load-options-event-B10rhdqh.mjs} +3 -3
  51. package/fesm2022/{iss-ctrl-load-options-event-CxyAyNMe.mjs.map → iss-ctrl-load-options-event-B10rhdqh.mjs.map} +1 -1
  52. package/fesm2022/{iss-ctrl-load-value-event-DJKJ5S3h.mjs → iss-ctrl-load-value-event-C-aRgKLx.mjs} +3 -3
  53. package/fesm2022/{iss-ctrl-load-value-event-DJKJ5S3h.mjs.map → iss-ctrl-load-value-event-C-aRgKLx.mjs.map} +1 -1
  54. package/fesm2022/iss-ctrl-mobile.field-DXVYT3q-.mjs +77 -0
  55. package/fesm2022/iss-ctrl-mobile.field-DXVYT3q-.mjs.map +1 -0
  56. package/fesm2022/iss-ctrl-mobile.mjs +2465 -0
  57. package/fesm2022/iss-ctrl-mobile.mjs.map +1 -0
  58. package/fesm2022/iss-ctrl-mobile.viewer-DQgxAcR-.mjs +22 -0
  59. package/fesm2022/iss-ctrl-mobile.viewer-DQgxAcR-.mjs.map +1 -0
  60. package/fesm2022/{iss-ctrl-note.field-B_Lbp28X.mjs → iss-ctrl-note.field-C8X9-mgD.mjs} +2 -2
  61. package/fesm2022/{iss-ctrl-note.field-B_Lbp28X.mjs.map → iss-ctrl-note.field-C8X9-mgD.mjs.map} +1 -1
  62. package/fesm2022/iss-ctrl-plate.field-aI81tAOV.mjs +92 -0
  63. package/fesm2022/iss-ctrl-plate.field-aI81tAOV.mjs.map +1 -0
  64. package/fesm2022/iss-ctrl-plate.mjs +491 -0
  65. package/fesm2022/iss-ctrl-plate.mjs.map +1 -0
  66. package/fesm2022/iss-ctrl-plate.viewer-B8PUBLH8.mjs +179 -0
  67. package/fesm2022/iss-ctrl-plate.viewer-B8PUBLH8.mjs.map +1 -0
  68. package/fesm2022/iss-ctrl-radio.field-B_JjPIlb.mjs +96 -0
  69. package/fesm2022/iss-ctrl-radio.field-B_JjPIlb.mjs.map +1 -0
  70. package/fesm2022/iss-ctrl-radio.mjs +101 -0
  71. package/fesm2022/iss-ctrl-radio.mjs.map +1 -0
  72. package/fesm2022/iss-ctrl-radio.viewer-EiDliZro.mjs +30 -0
  73. package/fesm2022/iss-ctrl-radio.viewer-EiDliZro.mjs.map +1 -0
  74. package/fesm2022/{iss-ctrl-replace-api-keys-C0XYQW4i.mjs → iss-ctrl-replace-api-keys-DLnagkOr.mjs} +2 -2
  75. package/fesm2022/{iss-ctrl-replace-api-keys-C0XYQW4i.mjs.map → iss-ctrl-replace-api-keys-DLnagkOr.mjs.map} +1 -1
  76. package/fesm2022/iss-ctrl-select.field-DoU4G_8t.mjs +87 -0
  77. package/fesm2022/iss-ctrl-select.field-DoU4G_8t.mjs.map +1 -0
  78. package/fesm2022/iss-ctrl-select.mjs +387 -0
  79. package/fesm2022/iss-ctrl-select.mjs.map +1 -0
  80. package/fesm2022/iss-ctrl-select.viewer-Dv9M-lG-.mjs +30 -0
  81. package/fesm2022/iss-ctrl-select.viewer-Dv9M-lG-.mjs.map +1 -0
  82. package/fesm2022/{iss-ctrl-set-value-event-CgXhi0Bv.mjs → iss-ctrl-set-value-event-Dhw0Vj5J.mjs} +2 -2
  83. package/fesm2022/{iss-ctrl-set-value-event-CgXhi0Bv.mjs.map → iss-ctrl-set-value-event-Dhw0Vj5J.mjs.map} +1 -1
  84. package/fesm2022/iss-ctrl-slide-toggle.field-TVVbAr6p.mjs +85 -0
  85. package/fesm2022/iss-ctrl-slide-toggle.field-TVVbAr6p.mjs.map +1 -0
  86. package/fesm2022/iss-ctrl-slide-toggle.mjs +72 -0
  87. package/fesm2022/iss-ctrl-slide-toggle.mjs.map +1 -0
  88. package/fesm2022/iss-ctrl-slide-toggle.viewer-hsIHwDj3.mjs +34 -0
  89. package/fesm2022/iss-ctrl-slide-toggle.viewer-hsIHwDj3.mjs.map +1 -0
  90. package/fesm2022/{iss-ctrl-table.field-B5FxF6hn.mjs → iss-ctrl-table.field-E0r9w0os.mjs} +142 -140
  91. package/fesm2022/iss-ctrl-table.field-E0r9w0os.mjs.map +1 -0
  92. package/fesm2022/iss-ctrl-textarea.field-CmHPDpk-.mjs +82 -0
  93. package/fesm2022/iss-ctrl-textarea.field-CmHPDpk-.mjs.map +1 -0
  94. package/fesm2022/iss-ctrl-textarea.mjs +115 -0
  95. package/fesm2022/iss-ctrl-textarea.mjs.map +1 -0
  96. package/fesm2022/iss-ctrl-textarea.viewer-CpmLauik.mjs +22 -0
  97. package/fesm2022/iss-ctrl-textarea.viewer-CpmLauik.mjs.map +1 -0
  98. package/fesm2022/iss-ctrl-time-picker.field-Cb0I5Ut1.mjs +77 -0
  99. package/fesm2022/iss-ctrl-time-picker.field-Cb0I5Ut1.mjs.map +1 -0
  100. package/fesm2022/iss-ctrl-time-picker.mjs +170 -0
  101. package/fesm2022/iss-ctrl-time-picker.mjs.map +1 -0
  102. package/fesm2022/iss-ctrl-time-picker.viewer-CJeFLrdI.mjs +22 -0
  103. package/fesm2022/iss-ctrl-time-picker.viewer-CJeFLrdI.mjs.map +1 -0
  104. package/fesm2022/iss-ctrl-toggle-button.field-Bj8WrkB-.mjs +105 -0
  105. package/fesm2022/iss-ctrl-toggle-button.field-Bj8WrkB-.mjs.map +1 -0
  106. package/fesm2022/iss-ctrl-toggle-button.mjs +156 -0
  107. package/fesm2022/iss-ctrl-toggle-button.mjs.map +1 -0
  108. package/fesm2022/iss-ctrl-toggle-button.viewer-CC-8_Dy4.mjs +30 -0
  109. package/fesm2022/iss-ctrl-toggle-button.viewer-CC-8_Dy4.mjs.map +1 -0
  110. package/fesm2022/iss-ctrl-tokens.mjs +25 -0
  111. package/fesm2022/iss-ctrl-tokens.mjs.map +1 -0
  112. package/fesm2022/{iss-ctrl-trigger-based-on-json-value-2v1kLVHZ.mjs → iss-ctrl-trigger-based-on-json-value-D9rTXVD1.mjs} +2 -2
  113. package/fesm2022/{iss-ctrl-trigger-based-on-json-value-2v1kLVHZ.mjs.map → iss-ctrl-trigger-based-on-json-value-D9rTXVD1.mjs.map} +1 -1
  114. package/fesm2022/{iss-ctrl-user-picker.field-BH63sZ-X.mjs → iss-ctrl-user-picker.field-BIzB5ZX6.mjs} +151 -150
  115. package/fesm2022/iss-ctrl-user-picker.field-BIzB5ZX6.mjs.map +1 -0
  116. package/fesm2022/iss-ctrl.mjs +3 -1
  117. package/fesm2022/iss-ctrl.mjs.map +1 -1
  118. package/package.json +69 -1
  119. package/types/iss-ctrl-base.d.ts +306 -0
  120. package/types/iss-ctrl-checkbox.d.ts +45 -0
  121. package/types/iss-ctrl-chips.d.ts +41 -0
  122. package/types/iss-ctrl-date-picker.d.ts +75 -0
  123. package/types/iss-ctrl-date-range-picker.d.ts +95 -0
  124. package/types/iss-ctrl-datetime-picker.d.ts +77 -0
  125. package/types/iss-ctrl-file-picker.d.ts +95 -0
  126. package/types/iss-ctrl-input.d.ts +76 -0
  127. package/types/iss-ctrl-mobile.d.ts +91 -0
  128. package/types/iss-ctrl-plate.d.ts +54 -0
  129. package/types/iss-ctrl-radio.d.ts +34 -0
  130. package/types/iss-ctrl-select.d.ts +75 -0
  131. package/types/iss-ctrl-slide-toggle.d.ts +26 -0
  132. package/types/iss-ctrl-textarea.d.ts +30 -0
  133. package/types/iss-ctrl-time-picker.d.ts +48 -0
  134. package/types/iss-ctrl-toggle-button.d.ts +41 -0
  135. package/types/iss-ctrl-tokens.d.ts +21 -0
  136. package/types/iss-ctrl.d.ts +120 -1810
  137. package/fesm2022/iss-ctrl-iss-ctrl-BKu6a5HF.mjs +0 -9683
  138. package/fesm2022/iss-ctrl-iss-ctrl-BKu6a5HF.mjs.map +0 -1
  139. package/fesm2022/iss-ctrl-load-event-bOt6IlIo.mjs.map +0 -1
  140. package/fesm2022/iss-ctrl-table.field-B5FxF6hn.mjs.map +0 -1
  141. package/fesm2022/iss-ctrl-user-picker.field-BH63sZ-X.mjs.map +0 -1
@@ -0,0 +1,97 @@
1
+ import * as i0 from '@angular/core';
2
+ import { Component } from '@angular/core';
3
+ import * as i1 from '@angular/forms';
4
+ import { ReactiveFormsModule } from '@angular/forms';
5
+ import { F as FieldBase, V as VIEW_PROVIDER, b as FieldViewer } from './iss-ctrl-iss-ctrl-DvnkwSMG.mjs';
6
+ import { DateRangePickerControl } from 'iss-ctrl/date-range-picker';
7
+ import { DateRangePickerViewer } from './iss-ctrl-date-range-picker.viewer-tmTQGPFh.mjs';
8
+
9
+ /**
10
+ * `<iss-field-date-range-picker>` — a start and end date in one field.
11
+ *
12
+ * Rendered by the outlet for fields of type `date_range`. In `edit` mode it renders
13
+ * {@link DateRangePickerControl} plus the validation message; in `view` mode the matching viewer.
14
+ *
15
+ * ### Supported `config` keys
16
+ * | Key | Type | Description |
17
+ * | --- | --- | --- |
18
+ * | `minDate` | `Date` | Earliest selectable date. |
19
+ * | `maxDate` | `Date` | Latest selectable date. |
20
+ * | `readonly` | `boolean` | Shows the value but blocks interaction. |
21
+ * | `hijriCalendar` | `boolean` | Renders an Umm al-Qura Hijri calendar while the emitted value stays Gregorian. |
22
+ * | `emitHijri` | `boolean` | Emits the Hijri date instead of the Gregorian one. Implies `hijriCalendar`. |
23
+ *
24
+ * ### Other field members used
25
+ * `label()`
26
+ *
27
+ * Every field also honours `visible`, `mode`, `validation`, `asyncValidation` and
28
+ * `events` — see {@link IssField} for the full model and {@link FieldConfig} for all keys.
29
+ *
30
+ * A half-filled range is treated as no value at all.
31
+ *
32
+ * @example
33
+ * ```json
34
+ * { "name": "period", "type": "date_range", "label": "Period" }
35
+ * ```
36
+ */
37
+ class DateRangePickerField extends FieldBase {
38
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DateRangePickerField, deps: null, target: i0.ɵɵFactoryTarget.Component });
39
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.9", type: DateRangePickerField, isStandalone: true, selector: "iss-field-date-range-picker", usesInheritance: true, ngImport: i0, template: `
40
+ @if (field.visible()) {
41
+ @if (field.mode() === "edit") {
42
+ <iss-ctrl-date-range-picker
43
+ [formControlName]="field.name"
44
+ [minDate]="field.config.minDate() ?? null"
45
+ [maxDate]="field.config.maxDate() ?? null"
46
+ [readonly]="field.config.readonly() ?? false"
47
+ [hijriCalendar]="field.config.hijriCalendar() ?? false"
48
+ [emitHijri]="field.config.emitHijri() ?? false"
49
+ >
50
+ <label>{{ field.label() }}</label>
51
+ </iss-ctrl-date-range-picker>
52
+ } @else {
53
+ <iss-field-viewer>
54
+ <label>{{ field.label() }}</label>
55
+ <iss-viewer-date-range-picker [field]="field"/>
56
+ </iss-field-viewer>
57
+ }
58
+ }
59
+ `, isInline: true, dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: DateRangePickerControl, selector: "iss-ctrl-date-range-picker", inputs: ["disabledDays", "minDate", "maxDate", "hijriCalendar", "emitHijri"], outputs: ["onDateRangeObjectChange"] }, { kind: "component", type: DateRangePickerViewer, selector: "iss-viewer-date-range-picker" }, { kind: "component", type: FieldViewer, selector: "iss-field-viewer" }], viewProviders: [VIEW_PROVIDER] });
60
+ }
61
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DateRangePickerField, decorators: [{
62
+ type: Component,
63
+ args: [{
64
+ selector: "iss-field-date-range-picker",
65
+ viewProviders: [VIEW_PROVIDER],
66
+ imports: [
67
+ ReactiveFormsModule,
68
+ DateRangePickerControl,
69
+ DateRangePickerViewer,
70
+ FieldViewer
71
+ ],
72
+ template: `
73
+ @if (field.visible()) {
74
+ @if (field.mode() === "edit") {
75
+ <iss-ctrl-date-range-picker
76
+ [formControlName]="field.name"
77
+ [minDate]="field.config.minDate() ?? null"
78
+ [maxDate]="field.config.maxDate() ?? null"
79
+ [readonly]="field.config.readonly() ?? false"
80
+ [hijriCalendar]="field.config.hijriCalendar() ?? false"
81
+ [emitHijri]="field.config.emitHijri() ?? false"
82
+ >
83
+ <label>{{ field.label() }}</label>
84
+ </iss-ctrl-date-range-picker>
85
+ } @else {
86
+ <iss-field-viewer>
87
+ <label>{{ field.label() }}</label>
88
+ <iss-viewer-date-range-picker [field]="field"/>
89
+ </iss-field-viewer>
90
+ }
91
+ }
92
+ `
93
+ }]
94
+ }] });
95
+
96
+ export { DateRangePickerField };
97
+ //# sourceMappingURL=iss-ctrl-date-range-picker.field-CjNHU1RW.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"iss-ctrl-date-range-picker.field-CjNHU1RW.mjs","sources":["../../../projects/iss/src/components/controls/date-range-picker/date-range-picker.field.ts"],"sourcesContent":["import { Component } from \"@angular/core\";\nimport { ReactiveFormsModule } from \"@angular/forms\";\nimport { VIEW_PROVIDER } from \"../../../shared/constants/view-provider.const\";\nimport { FieldViewer } from \"../../shared/field-viewer\";\nimport { FieldBase } from \"../base/field-base\";\nimport { DateRangePickerControl } from \"iss-ctrl/date-range-picker\";\nimport { DateRangePickerViewer } from \"./date-range-picker.viewer\";\n\n/**\n * `<iss-field-date-range-picker>` — a start and end date in one field.\n *\n * Rendered by the outlet for fields of type `date_range`. In `edit` mode it renders\n * {@link DateRangePickerControl} plus the validation message; in `view` mode the matching viewer.\n *\n * ### Supported `config` keys\n * | Key | Type | Description |\n * | --- | --- | --- |\n * | `minDate` | `Date` | Earliest selectable date. |\n * | `maxDate` | `Date` | Latest selectable date. |\n * | `readonly` | `boolean` | Shows the value but blocks interaction. |\n * | `hijriCalendar` | `boolean` | Renders an Umm al-Qura Hijri calendar while the emitted value stays Gregorian. |\n * | `emitHijri` | `boolean` | Emits the Hijri date instead of the Gregorian one. Implies `hijriCalendar`. |\n *\n * ### Other field members used\n * `label()`\n *\n * Every field also honours `visible`, `mode`, `validation`, `asyncValidation` and\n * `events` — see {@link IssField} for the full model and {@link FieldConfig} for all keys.\n *\n * A half-filled range is treated as no value at all.\n *\n * @example\n * ```json\n * { \"name\": \"period\", \"type\": \"date_range\", \"label\": \"Period\" }\n * ```\n */\n@Component({\n selector: \"iss-field-date-range-picker\",\n viewProviders: [VIEW_PROVIDER],\n imports: [\n ReactiveFormsModule,\n DateRangePickerControl,\n DateRangePickerViewer,\n FieldViewer\n ],\n template: `\n @if (field.visible()) {\n @if (field.mode() === \"edit\") {\n <iss-ctrl-date-range-picker\n [formControlName]=\"field.name\"\n [minDate]=\"field.config.minDate() ?? null\"\n [maxDate]=\"field.config.maxDate() ?? null\"\n [readonly]=\"field.config.readonly() ?? false\"\n [hijriCalendar]=\"field.config.hijriCalendar() ?? false\"\n [emitHijri]=\"field.config.emitHijri() ?? false\"\n >\n <label>{{ field.label() }}</label>\n </iss-ctrl-date-range-picker>\n } @else {\n <iss-field-viewer>\n <label>{{ field.label() }}</label>\n <iss-viewer-date-range-picker [field]=\"field\"/>\n </iss-field-viewer>\n }\n }\n `\n})\nexport class DateRangePickerField extends FieldBase {}\n"],"names":[],"mappings":";;;;;;;;AAQA;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BG;AAgCG,MAAO,oBAAqB,SAAQ,SAAS,CAAA;uGAAtC,oBAAoB,EAAA,IAAA,EAAA,IAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;AAApB,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,oBAAoB,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,6BAAA,EAAA,eAAA,EAAA,IAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,EAtBrB;;;;;;;;;;;;;;;;;;;;GAoBT,EAAA,QAAA,EAAA,IAAA,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,UAAA,EAAA,IAAA,EAzBC,mBAAmB,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAA,EAAA,CAAA,eAAA,EAAA,QAAA,EAAA,2CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAA,EAAA,CAAA,eAAA,EAAA,QAAA,EAAA,mBAAA,EAAA,MAAA,EAAA,CAAA,iBAAA,EAAA,UAAA,EAAA,SAAA,CAAA,EAAA,OAAA,EAAA,CAAA,eAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EACnB,sBAAsB,EAAA,QAAA,EAAA,4BAAA,EAAA,MAAA,EAAA,CAAA,cAAA,EAAA,SAAA,EAAA,SAAA,EAAA,eAAA,EAAA,WAAA,CAAA,EAAA,OAAA,EAAA,CAAA,yBAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EACtB,qBAAqB,yEACrB,WAAW,EAAA,QAAA,EAAA,kBAAA,EAAA,CAAA,EAAA,aAAA,EALE,CAAC,aAAa,CAAC,EAAA,CAAA;;2FA6BnB,oBAAoB,EAAA,UAAA,EAAA,CAAA;kBA/BhC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,6BAA6B;oBACvC,aAAa,EAAE,CAAC,aAAa,CAAC;AAC9B,oBAAA,OAAO,EAAE;wBACP,mBAAmB;wBACnB,sBAAsB;wBACtB,qBAAqB;wBACrB;AACD,qBAAA;AACD,oBAAA,QAAQ,EAAE;;;;;;;;;;;;;;;;;;;;AAoBT,EAAA;AACF,iBAAA;;;;;"}
@@ -0,0 +1,307 @@
1
+ import * as i0 from '@angular/core';
2
+ import { input, output, inject, effect, Component } from '@angular/core';
3
+ import * as i3 from '@angular/forms';
4
+ import { FormGroup, FormControl, ReactiveFormsModule, NG_VALUE_ACCESSOR } from '@angular/forms';
5
+ import { DateAdapter } from '@angular/material/core';
6
+ import * as i2 from '@angular/material/datepicker';
7
+ import { MatDatepickerModule } from '@angular/material/datepicker';
8
+ import * as i1 from '@angular/material/form-field';
9
+ import { MatFormFieldModule } from '@angular/material/form-field';
10
+ import { MatIcon } from '@angular/material/icon';
11
+ import { format } from 'date-fns';
12
+ import { Subscription } from 'rxjs';
13
+ import { ControlBase, parseHijriDate, formatHijriDate, provideIssDateAdapter } from 'iss-ctrl/base';
14
+
15
+ /**
16
+ * `<iss-ctrl-date-range-picker>` — a start/end date range in one field.
17
+ *
18
+ * A half-filled range is not a value: clearing either endpoint clears the form value and
19
+ * emits `null`. The form value is a `yyyy-MM-dd` string pair; `(onDateRangeObjectChange)`
20
+ * emits the same range as a {@link DateRangeEmission} object.
21
+ *
22
+ * @example
23
+ * ```html
24
+ * <iss-ctrl-date-range-picker formControlName="period" (onDateRangeObjectChange)="apply($event)">
25
+ * <label>Period</label>
26
+ * </iss-ctrl-date-range-picker>
27
+ * ```
28
+ *
29
+ * ### Own inputs
30
+ * | Property | Type | Default | Description |
31
+ * | --- | --- | --- | --- |
32
+ * | `minDate` | `Date \| null` | `null` | Earliest selectable date. |
33
+ * | `maxDate` | `Date \| null` | `null` | Latest selectable date. |
34
+ * | `disabledDays` | `number[]` | `[]` | Week days to block, `0` = Sunday … `6` = Saturday. |
35
+ * | `hijriCalendar` | `boolean` | `false` | Shows an Umm al-Qura Hijri calendar; the value stays Gregorian. |
36
+ * | `emitHijri` | `boolean` | `false` | Emits both endpoints as Hijri dates. Implies `hijriCalendar`. |
37
+ *
38
+ * ### Hijri dates
39
+ * `hijriCalendar` only changes what the user sees; the emitted range stays Gregorian until
40
+ * `emitHijri` is on as well, at which point both endpoints carry Hijri dates. `duration` is
41
+ * a count of days either way, and `minDate`/`maxDate` stay Gregorian.
42
+ *
43
+ * ### Inherited from {@link ControlBase}
44
+ * `formControlName` · `readonly` · `className` · `(onChange)`
45
+ *
46
+ * ### Outputs
47
+ * - `(onDateRangeObjectChange)` — `DateRangeEmission | null`, the range as an object.
48
+ *
49
+ * Projects `<label>` into the floating label; omit it to render the control without one.
50
+ */
51
+ class DateRangePickerControl extends ControlBase {
52
+ /**
53
+ * Week days that cannot be selected — `0` is Sunday through `6` for Saturday.
54
+ */
55
+ disabledDays = input([], ...(ngDevMode ? [{ debugName: "disabledDays" }] : /* istanbul ignore next */ []));
56
+ /**
57
+ * Earliest selectable date.
58
+ */
59
+ minDate = input(null, ...(ngDevMode ? [{ debugName: "minDate" }] : /* istanbul ignore next */ []));
60
+ /**
61
+ * Latest selectable date.
62
+ */
63
+ maxDate = input(null, ...(ngDevMode ? [{ debugName: "maxDate" }] : /* istanbul ignore next */ []));
64
+ /**
65
+ * Renders the calendar as an Umm al-Qura Hijri calendar, leaving the emitted range Gregorian.
66
+ */
67
+ hijriCalendar = input(false, ...(ngDevMode ? [{ debugName: "hijriCalendar" }] : /* istanbul ignore next */ []));
68
+ /**
69
+ * Emits both endpoints as Hijri dates. Implies {@link hijriCalendar}.
70
+ */
71
+ emitHijri = input(false, ...(ngDevMode ? [{ debugName: "emitHijri" }] : /* istanbul ignore next */ []));
72
+ /**
73
+ * Emits the selected range as an object, or `null` while the range is incomplete.
74
+ */
75
+ onDateRangeObjectChange = output();
76
+ /**
77
+ * The `start`/`end` form group backing the range input. Internal state.
78
+ */
79
+ range = new FormGroup({
80
+ start: new FormControl(null),
81
+ end: new FormControl(null),
82
+ });
83
+ #sub = new Subscription();
84
+ #dateAdapter = inject(DateAdapter);
85
+ // the adapter is provided by this component, so switching it here leaves every other
86
+ // picker on the form on its own calendar
87
+ #hijriEffectRef = effect(() => this.#dateAdapter.setHijri(this.isHijri()), ...(ngDevMode ? [{ debugName: "#hijriEffectRef" }] : /* istanbul ignore next */ []));
88
+ /**
89
+ * Whether this picker is currently showing the Hijri calendar.
90
+ */
91
+ isHijri() {
92
+ return this.hijriCalendar() || this.emitHijri();
93
+ }
94
+ ngOnInit() {
95
+ this.#sub.add(this.range.valueChanges.subscribe((values) => {
96
+ if (this.readonly()) {
97
+ return;
98
+ }
99
+ if (!values.start || !values.end) {
100
+ // an incomplete range is not a value, clearing one endpoint must clear the form value
101
+ this.emitValue(null);
102
+ this.onDateRangeObjectChange.emit(null);
103
+ return;
104
+ }
105
+ this.emitValue(this.#getEmissionValue(values.start, values.end));
106
+ this.onDateRangeObjectChange.emit(this.#getEmissionObject(values.start, values.end));
107
+ }));
108
+ }
109
+ setDisabledState(isDisabled) {
110
+ super.setDisabledState(isDisabled);
111
+ // the template binds `range`, disabling ctrl alone leaves the inputs live
112
+ if (isDisabled) {
113
+ this.range.disable({ emitEvent: false });
114
+ }
115
+ else {
116
+ this.range.enable({ emitEvent: false });
117
+ }
118
+ }
119
+ clear(event) {
120
+ if (this.readonly()) {
121
+ return;
122
+ }
123
+ event.stopImmediatePropagation();
124
+ this.ctrl.setValue(null);
125
+ this.range.setValue({
126
+ start: null,
127
+ end: null,
128
+ });
129
+ this.propagateValue(null);
130
+ this.emitOnChangeEvent(null);
131
+ }
132
+ writeValue(value) {
133
+ if (typeof value !== "string" || !value) {
134
+ this.ctrl.setValue(null, { emitEvent: false });
135
+ this.range.reset({ start: null, end: null }, { emitEvent: false });
136
+ return;
137
+ }
138
+ const valArr = value.split(",");
139
+ const valObj = {
140
+ // a Hijri endpoint read back from the form is `1447-03-15`, which is not the day
141
+ // the adapter would deserialize it as
142
+ start: this.#readEndpoint(valArr[0]),
143
+ end: this.#readEndpoint(valArr[1]),
144
+ };
145
+ this.range.patchValue(valObj, { emitEvent: false });
146
+ }
147
+ ngOnDestroy() {
148
+ this.#sub.unsubscribe();
149
+ }
150
+ // the endpoints live on `range`; `ctrl` only holds the emitted value of a complete range
151
+ isEmpty() {
152
+ const { start, end } = this.range.getRawValue();
153
+ return !start && !end;
154
+ }
155
+ openPicker(picker) {
156
+ if (this.readonly()) {
157
+ return;
158
+ }
159
+ picker.open();
160
+ this.markAsTouched();
161
+ }
162
+ calendarDaysFilter = (d) => {
163
+ const day = (d || new Date()).getDay();
164
+ return !(this.disabledDays().includes(day));
165
+ };
166
+ #getDuration(startDate, endDate) {
167
+ const start = new Date(startDate).getTime();
168
+ const end = new Date(endDate).getTime();
169
+ return Math.ceil((end - start) / (1000 * 60 * 60 * 24) + 1);
170
+ }
171
+ #readEndpoint(value) {
172
+ if (!value) {
173
+ return null;
174
+ }
175
+ return this.emitHijri() ? parseHijriDate(value) : value;
176
+ }
177
+ #getFormatedDate(date) {
178
+ if (this.emitHijri()) {
179
+ return `${formatHijriDate(date)}${format(date, "'T'HH:mm:ss")}`;
180
+ }
181
+ return format(date, "yyyy-MM-dd'T'HH:mm:ss");
182
+ }
183
+ #getFormatedEndDate(endDate) {
184
+ const inputDate = new Date(new Date(endDate).setHours(23, 59, 59));
185
+ return this.#getFormatedDate(inputDate);
186
+ }
187
+ #getEmissionValue(start, end) {
188
+ const formatedStart = this.#getFormatedDate(start);
189
+ const formatedEnd = this.#getFormatedEndDate(end);
190
+ return `${formatedStart},${formatedEnd}`;
191
+ }
192
+ #getEmissionObject(start, end) {
193
+ return {
194
+ duration: this.#getDuration(start, end),
195
+ start: this.#getFormatedDate(start),
196
+ end: this.#getFormatedEndDate(end)
197
+ };
198
+ }
199
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DateRangePickerControl, deps: null, target: i0.ɵɵFactoryTarget.Component });
200
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.9", type: DateRangePickerControl, isStandalone: true, selector: "iss-ctrl-date-range-picker", inputs: { disabledDays: { classPropertyName: "disabledDays", publicName: "disabledDays", isSignal: true, isRequired: false, transformFunction: null }, minDate: { classPropertyName: "minDate", publicName: "minDate", isSignal: true, isRequired: false, transformFunction: null }, maxDate: { classPropertyName: "maxDate", publicName: "maxDate", isSignal: true, isRequired: false, transformFunction: null }, hijriCalendar: { classPropertyName: "hijriCalendar", publicName: "hijriCalendar", isSignal: true, isRequired: false, transformFunction: null }, emitHijri: { classPropertyName: "emitHijri", publicName: "emitHijri", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onDateRangeObjectChange: "onDateRangeObjectChange" }, providers: [
201
+ provideIssDateAdapter(),
202
+ { provide: NG_VALUE_ACCESSOR, useExisting: DateRangePickerControl, multi: true },
203
+ ], usesInheritance: true, ngImport: i0, template: `
204
+ <mat-form-field floatLabel="auto" class="">
205
+
206
+ <!-- Always rendered: upgrade.scss shows the floating label only while the projected <label> carries text, so an omitted or empty one collapses on its own. -->
207
+ <mat-label class="fs-16 fc-dark-gray">
208
+ <ng-content select="label"></ng-content>
209
+ </mat-label>
210
+ <mat-date-range-input
211
+ [formGroup]="range"
212
+ [rangePicker]="picker"
213
+ [min]="minDate()"
214
+ [max]="maxDate()"
215
+ [dateFilter]="calendarDaysFilter"
216
+ >
217
+ <input
218
+ matStartDate
219
+ [errorStateMatcher]="errorStateMatcher"
220
+ formControlName="start"
221
+ [readonly]="readonly()"
222
+ placeholder="dd/mm/yyyy"
223
+ (click)="openPicker(picker)"
224
+ />
225
+ <input
226
+ matEndDate
227
+ [errorStateMatcher]="errorStateMatcher"
228
+ formControlName="end"
229
+ [readonly]="readonly()"
230
+ placeholder="dd/mm/yyyy"
231
+ (click)="openPicker(picker)"
232
+ />
233
+ </mat-date-range-input>
234
+ @if (range.getRawValue().start || range.getRawValue().end) {
235
+ <mat-icon matSuffix style="cursor: pointer" (click)="clear($event)">close</mat-icon>
236
+ }
237
+ <mat-datepicker-toggle matSuffix [for]="picker" [disabled]="readonly()"></mat-datepicker-toggle>
238
+ <mat-date-range-picker #picker [panelClass]="isHijri() ? 'iss-hijri-calendar' : ''"></mat-date-range-picker>
239
+
240
+ </mat-form-field>
241
+ `, isInline: true, dependencies: [{ kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i1.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i1.MatLabel, selector: "mat-label" }, { kind: "directive", type: i1.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "ngmodule", type: MatDatepickerModule }, { kind: "component", type: i2.MatDatepickerToggle, selector: "mat-datepicker-toggle", inputs: ["for", "tabIndex", "aria-label", "disabled", "disableRipple"], exportAs: ["matDatepickerToggle"] }, { kind: "component", type: i2.MatDateRangeInput, selector: "mat-date-range-input", inputs: ["rangePicker", "required", "dateFilter", "min", "max", "disabled", "separator", "comparisonStart", "comparisonEnd"], exportAs: ["matDateRangeInput"] }, { kind: "directive", type: i2.MatStartDate, selector: "input[matStartDate]", outputs: ["dateChange", "dateInput"] }, { kind: "directive", type: i2.MatEndDate, selector: "input[matEndDate]", outputs: ["dateChange", "dateInput"] }, { kind: "component", type: i2.MatDateRangePicker, selector: "mat-date-range-picker", exportAs: ["matDateRangePicker"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i3.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i3.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i3.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }] });
242
+ }
243
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DateRangePickerControl, decorators: [{
244
+ type: Component,
245
+ args: [{
246
+ selector: "iss-ctrl-date-range-picker",
247
+ imports: [
248
+ MatFormFieldModule,
249
+ MatDatepickerModule,
250
+ ReactiveFormsModule,
251
+ MatIcon,
252
+ ],
253
+ providers: [
254
+ provideIssDateAdapter(),
255
+ { provide: NG_VALUE_ACCESSOR, useExisting: DateRangePickerControl, multi: true },
256
+ ],
257
+ template: `
258
+ <mat-form-field floatLabel="auto" class="">
259
+
260
+ <!-- Always rendered: upgrade.scss shows the floating label only while the projected <label> carries text, so an omitted or empty one collapses on its own. -->
261
+ <mat-label class="fs-16 fc-dark-gray">
262
+ <ng-content select="label"></ng-content>
263
+ </mat-label>
264
+ <mat-date-range-input
265
+ [formGroup]="range"
266
+ [rangePicker]="picker"
267
+ [min]="minDate()"
268
+ [max]="maxDate()"
269
+ [dateFilter]="calendarDaysFilter"
270
+ >
271
+ <input
272
+ matStartDate
273
+ [errorStateMatcher]="errorStateMatcher"
274
+ formControlName="start"
275
+ [readonly]="readonly()"
276
+ placeholder="dd/mm/yyyy"
277
+ (click)="openPicker(picker)"
278
+ />
279
+ <input
280
+ matEndDate
281
+ [errorStateMatcher]="errorStateMatcher"
282
+ formControlName="end"
283
+ [readonly]="readonly()"
284
+ placeholder="dd/mm/yyyy"
285
+ (click)="openPicker(picker)"
286
+ />
287
+ </mat-date-range-input>
288
+ @if (range.getRawValue().start || range.getRawValue().end) {
289
+ <mat-icon matSuffix style="cursor: pointer" (click)="clear($event)">close</mat-icon>
290
+ }
291
+ <mat-datepicker-toggle matSuffix [for]="picker" [disabled]="readonly()"></mat-datepicker-toggle>
292
+ <mat-date-range-picker #picker [panelClass]="isHijri() ? 'iss-hijri-calendar' : ''"></mat-date-range-picker>
293
+
294
+ </mat-form-field>
295
+ `
296
+ }]
297
+ }], propDecorators: { disabledDays: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabledDays", required: false }] }], minDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "minDate", required: false }] }], maxDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxDate", required: false }] }], hijriCalendar: [{ type: i0.Input, args: [{ isSignal: true, alias: "hijriCalendar", required: false }] }], emitHijri: [{ type: i0.Input, args: [{ isSignal: true, alias: "emitHijri", required: false }] }], onDateRangeObjectChange: [{ type: i0.Output, args: ["onDateRangeObjectChange"] }] } });
298
+
299
+ // The date-range-picker control. Its field and viewer stay in the primary entry point and reach it
300
+ // from there, so the control ships only to an app that renders it or imports it directly.
301
+
302
+ /**
303
+ * Generated bundle index. Do not edit.
304
+ */
305
+
306
+ export { DateRangePickerControl };
307
+ //# sourceMappingURL=iss-ctrl-date-range-picker.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"iss-ctrl-date-range-picker.mjs","sources":["../../../projects/iss/date-range-picker/src/date-range-picker.control.ts","../../../projects/iss/date-range-picker/src/public-api.ts","../../../projects/iss/date-range-picker/src/iss-ctrl-date-range-picker.ts"],"sourcesContent":["import { Component, effect, inject, input, InputSignal, OnDestroy, OnInit, output, OutputEmitterRef } from \"@angular/core\";\nimport { FormControl, FormGroup, NG_VALUE_ACCESSOR, ReactiveFormsModule } from \"@angular/forms\";\nimport { DateAdapter } from \"@angular/material/core\";\nimport { MatDatepickerModule } from \"@angular/material/datepicker\";\nimport { MatFormFieldModule } from \"@angular/material/form-field\";\nimport { MatIcon } from \"@angular/material/icon\";\nimport { format } from \"date-fns\";\nimport { Subscription } from \"rxjs\";\nimport { IssDateAdapter, provideIssDateAdapter } from \"iss-ctrl/base\";\nimport { formatHijriDate, parseHijriDate } from \"iss-ctrl/base\";\nimport { ControlBase } from \"iss-ctrl/base\";\nimport { DateRangeEmission } from \"./date-range-emission\";\n\n/**\n * `<iss-ctrl-date-range-picker>` — a start/end date range in one field.\n *\n * A half-filled range is not a value: clearing either endpoint clears the form value and\n * emits `null`. The form value is a `yyyy-MM-dd` string pair; `(onDateRangeObjectChange)`\n * emits the same range as a {@link DateRangeEmission} object.\n *\n * @example\n * ```html\n * <iss-ctrl-date-range-picker formControlName=\"period\" (onDateRangeObjectChange)=\"apply($event)\">\n * <label>Period</label>\n * </iss-ctrl-date-range-picker>\n * ```\n *\n * ### Own inputs\n * | Property | Type | Default | Description |\n * | --- | --- | --- | --- |\n * | `minDate` | `Date \\| null` | `null` | Earliest selectable date. |\n * | `maxDate` | `Date \\| null` | `null` | Latest selectable date. |\n * | `disabledDays` | `number[]` | `[]` | Week days to block, `0` = Sunday … `6` = Saturday. |\n * | `hijriCalendar` | `boolean` | `false` | Shows an Umm al-Qura Hijri calendar; the value stays Gregorian. |\n * | `emitHijri` | `boolean` | `false` | Emits both endpoints as Hijri dates. Implies `hijriCalendar`. |\n *\n * ### Hijri dates\n * `hijriCalendar` only changes what the user sees; the emitted range stays Gregorian until\n * `emitHijri` is on as well, at which point both endpoints carry Hijri dates. `duration` is\n * a count of days either way, and `minDate`/`maxDate` stay Gregorian.\n *\n * ### Inherited from {@link ControlBase}\n * `formControlName` · `readonly` · `className` · `(onChange)`\n *\n * ### Outputs\n * - `(onDateRangeObjectChange)` — `DateRangeEmission | null`, the range as an object.\n *\n * Projects `<label>` into the floating label; omit it to render the control without one.\n */\n@Component({\n selector: \"iss-ctrl-date-range-picker\",\n imports: [\n MatFormFieldModule,\n MatDatepickerModule,\n ReactiveFormsModule,\n MatIcon,\n ],\n providers: [\n provideIssDateAdapter(),\n { provide: NG_VALUE_ACCESSOR, useExisting: DateRangePickerControl, multi: true },\n ],\n template: `\n <mat-form-field floatLabel=\"auto\" class=\"\">\n\n <!-- Always rendered: upgrade.scss shows the floating label only while the projected <label> carries text, so an omitted or empty one collapses on its own. -->\n <mat-label class=\"fs-16 fc-dark-gray\">\n <ng-content select=\"label\"></ng-content>\n </mat-label>\n <mat-date-range-input\n [formGroup]=\"range\"\n [rangePicker]=\"picker\"\n [min]=\"minDate()\"\n [max]=\"maxDate()\"\n [dateFilter]=\"calendarDaysFilter\"\n >\n <input\n matStartDate\n [errorStateMatcher]=\"errorStateMatcher\"\n formControlName=\"start\"\n [readonly]=\"readonly()\"\n placeholder=\"dd/mm/yyyy\"\n (click)=\"openPicker(picker)\"\n />\n <input\n matEndDate\n [errorStateMatcher]=\"errorStateMatcher\"\n formControlName=\"end\"\n [readonly]=\"readonly()\"\n placeholder=\"dd/mm/yyyy\"\n (click)=\"openPicker(picker)\"\n />\n </mat-date-range-input>\n @if (range.getRawValue().start || range.getRawValue().end) {\n <mat-icon matSuffix style=\"cursor: pointer\" (click)=\"clear($event)\">close</mat-icon>\n }\n <mat-datepicker-toggle matSuffix [for]=\"picker\" [disabled]=\"readonly()\"></mat-datepicker-toggle>\n <mat-date-range-picker #picker [panelClass]=\"isHijri() ? 'iss-hijri-calendar' : ''\"></mat-date-range-picker>\n\n </mat-form-field>\n `\n})\nexport class DateRangePickerControl extends ControlBase implements OnInit, OnDestroy {\n /**\n * Week days that cannot be selected — `0` is Sunday through `6` for Saturday.\n */\n disabledDays: InputSignal<number[]> = input<number[]>([]);\n /**\n * Earliest selectable date.\n */\n minDate: InputSignal<Date | null> = input<Date | null>(null);\n /**\n * Latest selectable date.\n */\n maxDate: InputSignal<Date | null> = input<Date | null>(null);\n /**\n * Renders the calendar as an Umm al-Qura Hijri calendar, leaving the emitted range Gregorian.\n */\n hijriCalendar: InputSignal<boolean> = input(false);\n /**\n * Emits both endpoints as Hijri dates. Implies {@link hijriCalendar}.\n */\n emitHijri: InputSignal<boolean> = input(false);\n /**\n * Emits the selected range as an object, or `null` while the range is incomplete.\n */\n onDateRangeObjectChange: OutputEmitterRef<DateRangeEmission | null> = output();\n /**\n * The `start`/`end` form group backing the range input. Internal state.\n */\n readonly range: FormGroup = new FormGroup({\n start: new FormControl(null),\n end: new FormControl(null),\n });\n #sub: Subscription = new Subscription();\n #dateAdapter: IssDateAdapter = inject(DateAdapter) as IssDateAdapter;\n // the adapter is provided by this component, so switching it here leaves every other\n // picker on the form on its own calendar\n #hijriEffectRef = effect(() => this.#dateAdapter.setHijri(this.isHijri()));\n\n /**\n * Whether this picker is currently showing the Hijri calendar.\n */\n isHijri(): boolean {\n return this.hijriCalendar() || this.emitHijri();\n }\n\n ngOnInit(): void {\n this.#sub.add(\n this.range.valueChanges.subscribe((values) => {\n if (this.readonly()) {\n return;\n }\n if (!values.start || !values.end) {\n // an incomplete range is not a value, clearing one endpoint must clear the form value\n this.emitValue(null);\n this.onDateRangeObjectChange.emit(null);\n return;\n }\n this.emitValue(this.#getEmissionValue(values.start, values.end));\n this.onDateRangeObjectChange.emit(this.#getEmissionObject(values.start, values.end));\n })\n );\n }\n\n override setDisabledState(isDisabled: boolean): void {\n super.setDisabledState(isDisabled);\n // the template binds `range`, disabling ctrl alone leaves the inputs live\n if (isDisabled) {\n this.range.disable({ emitEvent: false });\n } else {\n this.range.enable({ emitEvent: false });\n }\n }\n\n clear(event: MouseEvent) {\n if (this.readonly()) {\n return;\n }\n event.stopImmediatePropagation();\n this.ctrl.setValue(null);\n this.range.setValue({\n start: null,\n end: null,\n });\n this.propagateValue(null);\n this.emitOnChangeEvent(null);\n }\n\n override writeValue(value: string | FormData | null) {\n if (typeof value !== \"string\" || !value) {\n this.ctrl.setValue(null, { emitEvent: false });\n this.range.reset({ start: null, end: null }, { emitEvent: false });\n return;\n }\n\n const valArr: string[] = value.split(\",\");\n const valObj = {\n // a Hijri endpoint read back from the form is `1447-03-15`, which is not the day\n // the adapter would deserialize it as\n start: this.#readEndpoint(valArr[0]),\n end: this.#readEndpoint(valArr[1]),\n };\n this.range.patchValue(valObj, { emitEvent: false });\n }\n\n ngOnDestroy(): void {\n this.#sub.unsubscribe();\n }\n\n // the endpoints live on `range`; `ctrl` only holds the emitted value of a complete range\n protected override isEmpty(): boolean {\n const { start, end } = this.range.getRawValue();\n return !start && !end;\n }\n\n protected openPicker(picker: any): void {\n if (this.readonly()) {\n return;\n }\n picker.open();\n this.markAsTouched();\n }\n\n protected calendarDaysFilter = (d: Date | null): boolean => {\n const day: number = (d || new Date()).getDay();\n return !(this.disabledDays().includes(day));\n };\n\n #getDuration(startDate: Date, endDate: Date) {\n const start: number = new Date(startDate).getTime();\n const end: number = new Date(endDate).getTime();\n return Math.ceil((end - start) / (1000 * 60 * 60 * 24) + 1);\n }\n\n #readEndpoint(value: string | undefined): Date | string | null {\n if (!value) {\n return null;\n }\n return this.emitHijri() ? parseHijriDate(value) : value;\n }\n\n #getFormatedDate(date: Date) {\n if (this.emitHijri()) {\n return `${formatHijriDate(date)}${format(date, \"'T'HH:mm:ss\")}`;\n }\n return format(date, \"yyyy-MM-dd'T'HH:mm:ss\");\n }\n\n #getFormatedEndDate(endDate: Date) {\n const inputDate: Date = new Date(new Date(endDate).setHours(23, 59, 59));\n return this.#getFormatedDate(inputDate);\n }\n\n #getEmissionValue(start: Date, end: Date): string {\n const formatedStart: string = this.#getFormatedDate(start);\n const formatedEnd: string = this.#getFormatedEndDate(end);\n return `${formatedStart},${formatedEnd}`;\n }\n\n #getEmissionObject(start: Date, end: Date): DateRangeEmission {\n return {\n duration: this.#getDuration(start, end),\n start: this.#getFormatedDate(start),\n end: this.#getFormatedEndDate(end)\n };\n }\n}\n","// The date-range-picker control. Its field and viewer stay in the primary entry point and reach it\n// from there, so the control ships only to an app that renders it or imports it directly.\n\nexport * from \"./date-range-emission\";\nexport * from \"./date-range-picker.control\";\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAaA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCG;AAqDG,MAAO,sBAAuB,SAAQ,WAAW,CAAA;AACrD;;AAEG;AACH,IAAA,YAAY,GAA0B,KAAK,CAAW,EAAE,mFAAC;AACzD;;AAEG;AACH,IAAA,OAAO,GAA6B,KAAK,CAAc,IAAI,8EAAC;AAC5D;;AAEG;AACH,IAAA,OAAO,GAA6B,KAAK,CAAc,IAAI,8EAAC;AAC5D;;AAEG;AAC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AAA,YAAA,EAAA,QAAA,EAAA,qBAAA,EAAA,OAAA,EAAA,CAAA,YAAA,EAAA,WAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAA,EAAA,CAAA,UAAA,EAAA,QAAA,EAAA,mBAAA,EAAA,OAAA,EAAA,CAAA,YAAA,EAAA,WAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAA,EAAA,CAAA,kBAAA,EAAA,QAAA,EAAA,uBAAA,EAAA,QAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,UAAA,EAAA,IAAA,EACnB,mBAAmB,g3BACnB,OAAO,EAAA,QAAA,EAAA,UAAA,EAAA,MAAA,EAAA,CAAA,OAAA,EAAA,QAAA,EAAA,SAAA,EAAA,SAAA,EAAA,UAAA,CAAA,EAAA,QAAA,EAAA,CAAA,SAAA,CAAA,EAAA,CAAA,EAAA,CAAA;;2FA8CE,sBAAsB,EAAA,UAAA,EAAA,CAAA;kBApDlC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,4BAA4B;AACtC,oBAAA,OAAO,EAAE;wBACP,kBAAkB;wBAClB,mBAAmB;wBACnB,mBAAmB;wBACnB,OAAO;AACR,qBAAA;AACD,oBAAA,SAAS,EAAE;AACT,wBAAA,qBAAqB,EAAE;wBACvB,EAAE,OAAO,EAAE,iBAAiB,EAAE,WAAW,wBAAwB,EAAE,KAAK,EAAE,IAAI,EAAE;AACjF,qBAAA;AACD,oBAAA,QAAQ,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCT,EAAA;AACF,iBAAA;;;ACpGD;AACA;;ACDA;;AAEG;;;;"}
@@ -0,0 +1,41 @@
1
+ import { DatePipe } from '@angular/common';
2
+ import * as i0 from '@angular/core';
3
+ import { Component } from '@angular/core';
4
+ import { ViewerBase, toHijriDisplay } from 'iss-ctrl/base';
5
+
6
+ class DateRangePickerViewer extends ViewerBase {
7
+ dateRange = [];
8
+ // a range picked on the Hijri calendar reads back as Hijri dates, whichever calendar its
9
+ // stored value is in
10
+ hijriDates = [];
11
+ ngOnInit() {
12
+ this.dateRange = this.field().ctrlValue().split(",").map((val) => val.trim());
13
+ this.hijriDates = this.dateRange.map((date) => toHijriDisplay(date, {
14
+ hijriCalendar: this.field().config?.hijriCalendar(),
15
+ emitHijri: this.field().config?.emitHijri(),
16
+ }));
17
+ }
18
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DateRangePickerViewer, deps: null, target: i0.ɵɵFactoryTarget.Component });
19
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.9", type: DateRangePickerViewer, isStandalone: true, selector: "iss-viewer-date-range-picker", usesInheritance: true, ngImport: i0, template: `
20
+ @for (date of dateRange; track date; let last = $last) {
21
+ <span> {{ hijriDates[$index] ?? (date | date: 'dd/MM/yyyy') }} {{ last ? '' : '- ' }} </span>
22
+ }
23
+ `, isInline: true, dependencies: [{ kind: "pipe", type: DatePipe, name: "date" }] });
24
+ }
25
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DateRangePickerViewer, decorators: [{
26
+ type: Component,
27
+ args: [{
28
+ selector: "iss-viewer-date-range-picker",
29
+ imports: [
30
+ DatePipe
31
+ ],
32
+ template: `
33
+ @for (date of dateRange; track date; let last = $last) {
34
+ <span> {{ hijriDates[$index] ?? (date | date: 'dd/MM/yyyy') }} {{ last ? '' : '- ' }} </span>
35
+ }
36
+ `
37
+ }]
38
+ }] });
39
+
40
+ export { DateRangePickerViewer };
41
+ //# sourceMappingURL=iss-ctrl-date-range-picker.viewer-tmTQGPFh.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"iss-ctrl-date-range-picker.viewer-tmTQGPFh.mjs","sources":["../../../projects/iss/src/components/controls/date-range-picker/date-range-picker.viewer.ts"],"sourcesContent":["import { DatePipe } from \"@angular/common\";\nimport { Component, OnInit } from \"@angular/core\";\nimport { toHijriDisplay } from \"iss-ctrl/base\";\nimport { ViewerBase } from \"iss-ctrl/base\";\n\n@Component({\n selector: \"iss-viewer-date-range-picker\",\n imports: [\n DatePipe\n ],\n template: `\n @for (date of dateRange; track date; let last = $last) {\n <span> {{ hijriDates[$index] ?? (date | date: 'dd/MM/yyyy') }} {{ last ? '' : '- ' }} </span>\n }\n `\n})\nexport class DateRangePickerViewer extends ViewerBase implements OnInit {\n dateRange: string[] = [];\n // a range picked on the Hijri calendar reads back as Hijri dates, whichever calendar its\n // stored value is in\n hijriDates: (string | null)[] = [];\n\n ngOnInit() {\n this.dateRange = this.field().ctrlValue().split(\",\").map((val: any) => val.trim());\n this.hijriDates = this.dateRange.map((date: string) => toHijriDisplay(date, {\n hijriCalendar: this.field().config?.hijriCalendar(),\n emitHijri: this.field().config?.emitHijri(),\n }));\n }\n}\n"],"names":[],"mappings":";;;;;AAgBM,MAAO,qBAAsB,SAAQ,UAAU,CAAA;IACnD,SAAS,GAAa,EAAE;;;IAGxB,UAAU,GAAsB,EAAE;IAElC,QAAQ,GAAA;AACN,QAAA,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC,SAAS,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAQ,KAAK,GAAG,CAAC,IAAI,EAAE,CAAC;AAClF,QAAA,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,IAAY,KAAK,cAAc,CAAC,IAAI,EAAE;YAC1E,aAAa,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC,MAAM,EAAE,aAAa,EAAE;YACnD,SAAS,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE;AAC5C,SAAA,CAAC,CAAC;IACL;uGAZW,qBAAqB,EAAA,IAAA,EAAA,IAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;AAArB,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,qBAAqB,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,8BAAA,EAAA,eAAA,EAAA,IAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,EANtB;;;;AAIT,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,MAAA,EAAA,IAAA,EANC,QAAQ,EAAA,IAAA,EAAA,MAAA,EAAA,CAAA,EAAA,CAAA;;2FAQC,qBAAqB,EAAA,UAAA,EAAA,CAAA;kBAXjC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,8BAA8B;AACxC,oBAAA,OAAO,EAAE;wBACP;AACD,qBAAA;AACD,oBAAA,QAAQ,EAAE;;;;AAIT,EAAA;AACF,iBAAA;;;;;"}
@@ -0,0 +1,98 @@
1
+ import * as i0 from '@angular/core';
2
+ import { Component } from '@angular/core';
3
+ import * as i1 from '@angular/forms';
4
+ import { ReactiveFormsModule } from '@angular/forms';
5
+ import { F as FieldBase, V as VIEW_PROVIDER, a as ValidationMessage, b as FieldViewer } from './iss-ctrl-iss-ctrl-DvnkwSMG.mjs';
6
+ import { DatetimePickerControl } from 'iss-ctrl/datetime-picker';
7
+ import { DatePickerTimeViewer } from './iss-ctrl-datetime-picker.viewer-BeUyEBKo.mjs';
8
+
9
+ /**
10
+ * `<iss-field-datetime-picker>` — a date and a time in one field.
11
+ *
12
+ * Rendered by the outlet for fields of type `datetime`. In `edit` mode it renders
13
+ * {@link DatetimePickerControl} plus the validation message; in `view` mode the matching viewer.
14
+ *
15
+ * ### Supported `config` keys
16
+ * | Key | Type | Description |
17
+ * | --- | --- | --- |
18
+ * | `minDate` | `Date` | Earliest selectable date. |
19
+ * | `maxDate` | `Date` | Latest selectable date. |
20
+ * | `readonly` | `boolean` | Shows the value but blocks interaction. |
21
+ * | `hijriCalendar` | `boolean` | Renders an Umm al-Qura Hijri calendar while the emitted value stays Gregorian. |
22
+ * | `emitHijri` | `boolean` | Emits the Hijri date instead of the Gregorian one. Implies `hijriCalendar`. |
23
+ *
24
+ * ### Other field members used
25
+ * `label()`
26
+ *
27
+ * Every field also honours `visible`, `mode`, `validation`, `asyncValidation` and
28
+ * `events` — see {@link IssField} for the full model and {@link FieldConfig} for all keys.
29
+ *
30
+ * @example
31
+ * ```json
32
+ * { "name": "scheduledAt", "type": "datetime", "label": "Scheduled at" }
33
+ * ```
34
+ */
35
+ class DatetimePickerField extends FieldBase {
36
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DatetimePickerField, deps: null, target: i0.ɵɵFactoryTarget.Component });
37
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.9", type: DatetimePickerField, isStandalone: true, selector: "iss-field-datetime-picker", usesInheritance: true, ngImport: i0, template: `
38
+ @if (field.visible()) {
39
+ @if (field.mode() === "edit") {
40
+ <iss-ctrl-datetime-picker
41
+ [formControlName]="field.name"
42
+ [minDate]="field.config.minDate() ?? null"
43
+ [maxDate]="field.config.maxDate() ?? null"
44
+ [readonly]="field.config.readonly() ?? false"
45
+ [hijriCalendar]="field.config.hijriCalendar() ?? false"
46
+ [emitHijri]="field.config.emitHijri() ?? false"
47
+ >
48
+ <label>{{ field.label() }}</label>
49
+ </iss-ctrl-datetime-picker>
50
+ <iss-validation-message-viewer [errors]="ctrl.errors" [showMessage]="!ctrl.untouched"/>
51
+ } @else {
52
+ <iss-field-viewer>
53
+ <label>{{ field.label() }}</label>
54
+ <iss-viewer-datetime-picker [field]="field"/>
55
+ </iss-field-viewer>
56
+ }
57
+ }
58
+ `, isInline: true, dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: DatetimePickerControl, selector: "iss-ctrl-datetime-picker", inputs: ["disabledDays", "minDate", "maxDate", "minTime", "maxTime", "hijriCalendar", "emitHijri"] }, { kind: "component", type: ValidationMessage, selector: "iss-validation-message-viewer", inputs: ["errors", "showMessage"] }, { kind: "component", type: DatePickerTimeViewer, selector: "iss-viewer-datetime-picker" }, { kind: "component", type: FieldViewer, selector: "iss-field-viewer" }], viewProviders: [VIEW_PROVIDER] });
59
+ }
60
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DatetimePickerField, decorators: [{
61
+ type: Component,
62
+ args: [{
63
+ selector: "iss-field-datetime-picker",
64
+ viewProviders: [VIEW_PROVIDER],
65
+ imports: [
66
+ ReactiveFormsModule,
67
+ DatetimePickerControl,
68
+ ValidationMessage,
69
+ DatePickerTimeViewer,
70
+ FieldViewer
71
+ ],
72
+ template: `
73
+ @if (field.visible()) {
74
+ @if (field.mode() === "edit") {
75
+ <iss-ctrl-datetime-picker
76
+ [formControlName]="field.name"
77
+ [minDate]="field.config.minDate() ?? null"
78
+ [maxDate]="field.config.maxDate() ?? null"
79
+ [readonly]="field.config.readonly() ?? false"
80
+ [hijriCalendar]="field.config.hijriCalendar() ?? false"
81
+ [emitHijri]="field.config.emitHijri() ?? false"
82
+ >
83
+ <label>{{ field.label() }}</label>
84
+ </iss-ctrl-datetime-picker>
85
+ <iss-validation-message-viewer [errors]="ctrl.errors" [showMessage]="!ctrl.untouched"/>
86
+ } @else {
87
+ <iss-field-viewer>
88
+ <label>{{ field.label() }}</label>
89
+ <iss-viewer-datetime-picker [field]="field"/>
90
+ </iss-field-viewer>
91
+ }
92
+ }
93
+ `
94
+ }]
95
+ }] });
96
+
97
+ export { DatetimePickerField };
98
+ //# sourceMappingURL=iss-ctrl-datetime-picker.field-DGMY9PaU.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"iss-ctrl-datetime-picker.field-DGMY9PaU.mjs","sources":["../../../projects/iss/src/components/controls/datetime-picker/datetime-picker.field.ts"],"sourcesContent":["import { Component } from \"@angular/core\";\nimport { ReactiveFormsModule } from \"@angular/forms\";\nimport { VIEW_PROVIDER } from \"../../../shared/constants/view-provider.const\";\nimport { FieldViewer } from \"../../shared/field-viewer\";\nimport { ValidationMessage } from \"../../shared/validation-message\";\nimport { FieldBase } from \"../base/field-base\";\nimport { DatetimePickerControl } from \"iss-ctrl/datetime-picker\";\nimport { DatePickerTimeViewer } from \"./datetime-picker.viewer\";\n\n/**\n * `<iss-field-datetime-picker>` — a date and a time in one field.\n *\n * Rendered by the outlet for fields of type `datetime`. In `edit` mode it renders\n * {@link DatetimePickerControl} plus the validation message; in `view` mode the matching viewer.\n *\n * ### Supported `config` keys\n * | Key | Type | Description |\n * | --- | --- | --- |\n * | `minDate` | `Date` | Earliest selectable date. |\n * | `maxDate` | `Date` | Latest selectable date. |\n * | `readonly` | `boolean` | Shows the value but blocks interaction. |\n * | `hijriCalendar` | `boolean` | Renders an Umm al-Qura Hijri calendar while the emitted value stays Gregorian. |\n * | `emitHijri` | `boolean` | Emits the Hijri date instead of the Gregorian one. Implies `hijriCalendar`. |\n *\n * ### Other field members used\n * `label()`\n *\n * Every field also honours `visible`, `mode`, `validation`, `asyncValidation` and\n * `events` — see {@link IssField} for the full model and {@link FieldConfig} for all keys.\n *\n * @example\n * ```json\n * { \"name\": \"scheduledAt\", \"type\": \"datetime\", \"label\": \"Scheduled at\" }\n * ```\n */\n@Component({\n selector: \"iss-field-datetime-picker\",\n viewProviders: [VIEW_PROVIDER],\n imports: [\n ReactiveFormsModule,\n DatetimePickerControl,\n ValidationMessage,\n DatePickerTimeViewer,\n FieldViewer\n ],\n template: `\n @if (field.visible()) {\n @if (field.mode() === \"edit\") {\n <iss-ctrl-datetime-picker\n [formControlName]=\"field.name\"\n [minDate]=\"field.config.minDate() ?? null\"\n [maxDate]=\"field.config.maxDate() ?? null\"\n [readonly]=\"field.config.readonly() ?? false\"\n [hijriCalendar]=\"field.config.hijriCalendar() ?? false\"\n [emitHijri]=\"field.config.emitHijri() ?? false\"\n >\n <label>{{ field.label() }}</label>\n </iss-ctrl-datetime-picker>\n <iss-validation-message-viewer [errors]=\"ctrl.errors\" [showMessage]=\"!ctrl.untouched\"/>\n } @else {\n <iss-field-viewer>\n <label>{{ field.label() }}</label>\n <iss-viewer-datetime-picker [field]=\"field\"/>\n </iss-field-viewer>\n }\n }\n `\n})\nexport class DatetimePickerField extends FieldBase {}\n"],"names":[],"mappings":";;;;;;;;AASA;;;;;;;;;;;;;;;;;;;;;;;;;AAyBG;AAkCG,MAAO,mBAAoB,SAAQ,SAAS,CAAA;uGAArC,mBAAmB,EAAA,IAAA,EAAA,IAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;AAAnB,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,mBAAmB,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,2BAAA,EAAA,eAAA,EAAA,IAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,EAvBpB;;;;;;;;;;;;;;;;;;;;;AAqBT,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,UAAA,EAAA,IAAA,EA3BC,mBAAmB,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAA,EAAA,CAAA,eAAA,EAAA,QAAA,EAAA,2CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,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