mis-crystal-design-system 4.0.38 → 4.0.39-test-R

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 (115) hide show
  1. package/action-list/mis-crystal-design-system-action-list.metadata.json +1 -1
  2. package/bundles/mis-crystal-design-system-action-list.umd.js +495 -641
  3. package/bundles/mis-crystal-design-system-action-list.umd.js.map +1 -1
  4. package/bundles/mis-crystal-design-system-action-list.umd.min.js +15 -1
  5. package/bundles/mis-crystal-design-system-action-list.umd.min.js.map +1 -1
  6. package/bundles/mis-crystal-design-system-analytics.umd.js +409 -555
  7. package/bundles/mis-crystal-design-system-analytics.umd.js.map +1 -1
  8. package/bundles/mis-crystal-design-system-analytics.umd.min.js +15 -1
  9. package/bundles/mis-crystal-design-system-analytics.umd.min.js.map +1 -1
  10. package/bundles/mis-crystal-design-system-checkbox.umd.js +1 -1
  11. package/bundles/mis-crystal-design-system-checkbox.umd.min.js +1 -1
  12. package/bundles/mis-crystal-design-system-checkbox.umd.min.js.map +1 -1
  13. package/bundles/mis-crystal-design-system-datepicker_v2.umd.js +690 -836
  14. package/bundles/mis-crystal-design-system-datepicker_v2.umd.js.map +1 -1
  15. package/bundles/mis-crystal-design-system-datepicker_v2.umd.min.js +15 -1
  16. package/bundles/mis-crystal-design-system-datepicker_v2.umd.min.js.map +1 -1
  17. package/bundles/mis-crystal-design-system-daterangepicker_v2.umd.js +450 -891
  18. package/bundles/mis-crystal-design-system-daterangepicker_v2.umd.js.map +1 -1
  19. package/bundles/mis-crystal-design-system-daterangepicker_v2.umd.min.js +1 -1
  20. package/bundles/mis-crystal-design-system-daterangepicker_v2.umd.min.js.map +1 -1
  21. package/bundles/mis-crystal-design-system-dropdown.umd.js +502 -648
  22. package/bundles/mis-crystal-design-system-dropdown.umd.js.map +1 -1
  23. package/bundles/mis-crystal-design-system-dropdown.umd.min.js +15 -1
  24. package/bundles/mis-crystal-design-system-dropdown.umd.min.js.map +1 -1
  25. package/bundles/mis-crystal-design-system-dynamic-form.umd.js +723 -869
  26. package/bundles/mis-crystal-design-system-dynamic-form.umd.js.map +1 -1
  27. package/bundles/mis-crystal-design-system-dynamic-form.umd.min.js +15 -1
  28. package/bundles/mis-crystal-design-system-dynamic-form.umd.min.js.map +1 -1
  29. package/bundles/mis-crystal-design-system-input.umd.js +1 -1
  30. package/bundles/mis-crystal-design-system-input.umd.min.js +1 -1
  31. package/bundles/mis-crystal-design-system-input.umd.min.js.map +1 -1
  32. package/bundles/mis-crystal-design-system-loader.umd.js +1 -1
  33. package/bundles/mis-crystal-design-system-loader.umd.min.js +1 -1
  34. package/bundles/mis-crystal-design-system-loader.umd.min.js.map +1 -1
  35. package/bundles/mis-crystal-design-system-multi-select-dropdown.umd.js +610 -756
  36. package/bundles/mis-crystal-design-system-multi-select-dropdown.umd.js.map +1 -1
  37. package/bundles/mis-crystal-design-system-multi-select-dropdown.umd.min.js +15 -1
  38. package/bundles/mis-crystal-design-system-multi-select-dropdown.umd.min.js.map +1 -1
  39. package/bundles/mis-crystal-design-system-nested-multi-select-dropdown.umd.js +623 -769
  40. package/bundles/mis-crystal-design-system-nested-multi-select-dropdown.umd.js.map +1 -1
  41. package/bundles/mis-crystal-design-system-nested-multi-select-dropdown.umd.min.js +15 -1
  42. package/bundles/mis-crystal-design-system-nested-multi-select-dropdown.umd.min.js.map +1 -1
  43. package/bundles/mis-crystal-design-system-ske-loader.umd.js +1 -1
  44. package/bundles/mis-crystal-design-system-ske-loader.umd.min.js +1 -1
  45. package/bundles/mis-crystal-design-system-ske-loader.umd.min.js.map +1 -1
  46. package/bundles/mis-crystal-design-system-specificdatepicker.umd.js +961 -1107
  47. package/bundles/mis-crystal-design-system-specificdatepicker.umd.js.map +1 -1
  48. package/bundles/mis-crystal-design-system-specificdatepicker.umd.min.js +15 -1
  49. package/bundles/mis-crystal-design-system-specificdatepicker.umd.min.js.map +1 -1
  50. package/bundles/mis-crystal-design-system-table.umd.js +768 -914
  51. package/bundles/mis-crystal-design-system-table.umd.js.map +1 -1
  52. package/bundles/mis-crystal-design-system-table.umd.min.js +15 -1
  53. package/bundles/mis-crystal-design-system-table.umd.min.js.map +1 -1
  54. package/bundles/mis-crystal-design-system-timepicker.umd.js +670 -816
  55. package/bundles/mis-crystal-design-system-timepicker.umd.js.map +1 -1
  56. package/bundles/mis-crystal-design-system-timepicker.umd.min.js +15 -1
  57. package/bundles/mis-crystal-design-system-timepicker.umd.min.js.map +1 -1
  58. package/bundles/mis-crystal-design-system-timerangepicker.umd.js +47 -30
  59. package/bundles/mis-crystal-design-system-timerangepicker.umd.js.map +1 -1
  60. package/bundles/mis-crystal-design-system-timerangepicker.umd.min.js +1 -1
  61. package/bundles/mis-crystal-design-system-timerangepicker.umd.min.js.map +1 -1
  62. package/bundles/mis-crystal-design-system-virtual-scroll.umd.js +457 -603
  63. package/bundles/mis-crystal-design-system-virtual-scroll.umd.js.map +1 -1
  64. package/bundles/mis-crystal-design-system-virtual-scroll.umd.min.js +15 -1
  65. package/bundles/mis-crystal-design-system-virtual-scroll.umd.min.js.map +1 -1
  66. package/bundles/mis-crystal-design-system-widgets.umd.js +462 -608
  67. package/bundles/mis-crystal-design-system-widgets.umd.js.map +1 -1
  68. package/bundles/mis-crystal-design-system-widgets.umd.min.js +15 -1
  69. package/bundles/mis-crystal-design-system-widgets.umd.min.js.map +1 -1
  70. package/checkbox/mis-crystal-design-system-checkbox.metadata.json +1 -1
  71. package/datepicker_v2/mis-crystal-design-system-datepicker_v2.metadata.json +1 -1
  72. package/daterangepicker_v2/mis-crystal-design-system-daterangepicker_v2.metadata.json +1 -1
  73. package/dropdown/mis-crystal-design-system-dropdown.metadata.json +1 -1
  74. package/dynamic-form/mis-crystal-design-system-dynamic-form.metadata.json +1 -1
  75. package/esm2015/action-list/action-list.component.js +1 -1
  76. package/esm2015/checkbox/checkbox.component.js +1 -1
  77. package/esm2015/datepicker_v2/tz-dp-container/tz-dp-container.component.js +1 -1
  78. package/esm2015/daterangepicker_v2/tz-drp-container/tz-drp-container.component.js +11 -9
  79. package/esm2015/dropdown/dropdown.component.js +1 -1
  80. package/esm2015/dynamic-form/dynamic-form.component.js +1 -1
  81. package/esm2015/input/mis-input.component.js +1 -1
  82. package/esm2015/loader/loader.component.js +1 -1
  83. package/esm2015/multi-select-dropdown/multi-select-dropdown.component.js +1 -1
  84. package/esm2015/nested-multi-select-dropdown/nested-multi-select-dropdown.component.js +1 -1
  85. package/esm2015/ske-loader/ske-loader.component.js +1 -1
  86. package/esm2015/specificdatepicker/tz-sdp-container/tz-sdp-container.component.js +1 -1
  87. package/esm2015/table/table.component.js +1 -1
  88. package/esm2015/timepicker/timepicker.component.js +2 -2
  89. package/esm2015/timerangepicker/timerangepicker.component.js +48 -31
  90. package/fesm2015/mis-crystal-design-system-action-list.js +1 -1
  91. package/fesm2015/mis-crystal-design-system-checkbox.js +1 -1
  92. package/fesm2015/mis-crystal-design-system-datepicker_v2.js +1 -1
  93. package/fesm2015/mis-crystal-design-system-daterangepicker_v2.js +10 -8
  94. package/fesm2015/mis-crystal-design-system-daterangepicker_v2.js.map +1 -1
  95. package/fesm2015/mis-crystal-design-system-dropdown.js +1 -1
  96. package/fesm2015/mis-crystal-design-system-dynamic-form.js +1 -1
  97. package/fesm2015/mis-crystal-design-system-input.js +1 -1
  98. package/fesm2015/mis-crystal-design-system-loader.js +1 -1
  99. package/fesm2015/mis-crystal-design-system-multi-select-dropdown.js +1 -1
  100. package/fesm2015/mis-crystal-design-system-nested-multi-select-dropdown.js +1 -1
  101. package/fesm2015/mis-crystal-design-system-ske-loader.js +1 -1
  102. package/fesm2015/mis-crystal-design-system-specificdatepicker.js +1 -1
  103. package/fesm2015/mis-crystal-design-system-table.js +1 -1
  104. package/fesm2015/mis-crystal-design-system-timepicker.js +1 -1
  105. package/fesm2015/mis-crystal-design-system-timepicker.js.map +1 -1
  106. package/fesm2015/mis-crystal-design-system-timerangepicker.js +47 -30
  107. package/fesm2015/mis-crystal-design-system-timerangepicker.js.map +1 -1
  108. package/input/mis-crystal-design-system-input.metadata.json +1 -1
  109. package/loader/mis-crystal-design-system-loader.metadata.json +1 -1
  110. package/multi-select-dropdown/mis-crystal-design-system-multi-select-dropdown.metadata.json +1 -1
  111. package/nested-multi-select-dropdown/mis-crystal-design-system-nested-multi-select-dropdown.metadata.json +1 -1
  112. package/package.json +1 -1
  113. package/ske-loader/mis-crystal-design-system-ske-loader.metadata.json +1 -1
  114. package/specificdatepicker/mis-crystal-design-system-specificdatepicker.metadata.json +1 -1
  115. package/table/mis-crystal-design-system-table.metadata.json +1 -1
@@ -58,45 +58,62 @@
58
58
  TimeRangePickerComponent.prototype.setFirstIntervals = function () {
59
59
  var minutes = moment__namespace().minutes();
60
60
  var offset = this.interval - (minutes % this.interval);
61
- // first interval for the start picker will be the one closest to the current time
62
- // if the start date is equal to the curr date
63
- if (this.startDate === this.endDate) {
64
- var currentTime = moment__namespace().valueOf();
65
- // if current time >= 11:45 the start picker will show
66
- // current time instead of next closest interval
67
- if (currentTime >= moment__namespace().endOf("d").subtract(15, "m").valueOf()) {
68
- this.firstIntervalForStartPicker = currentTime;
61
+ // start date, 22 MAY === current date, 22 MAY
62
+ if (this.startDate === this.currDate) {
63
+ var currentTime = moment__namespace(this.startDateEpoch).valueOf();
64
+ // start date, 22 MAY === current date, 22 MAY === end date, 22 MAY
65
+ if (this.startDate === this.endDate) {
66
+ // current time is in last interval
67
+ if (currentTime >= moment__namespace(this.startDateEpoch).endOf("d").subtract(this.interval, "m").valueOf()) {
68
+ this.firstIntervalForStartPicker = currentTime;
69
+ this.firstIntervalForEndPicker = moment__namespace(this.endDateEpoch).endOf("d").valueOf();
70
+ }
71
+ // current time isn't in last interval
72
+ else {
73
+ this.firstIntervalForStartPicker = moment__namespace().add(offset, "m").valueOf();
74
+ this.firstIntervalForEndPicker = moment__namespace().add(offset, "m").add(this.interval, "m").valueOf();
75
+ }
69
76
  }
77
+ // start date, 22 MAY === current date, 22 MAY !== end date, 30 MAY
70
78
  else {
71
- this.firstIntervalForStartPicker = moment__namespace().add(offset, "m").valueOf();
79
+ // current time is in last interval
80
+ if (currentTime >= moment__namespace(this.startDateEpoch).endOf("d").subtract(this.interval, "m").valueOf()) {
81
+ this.firstIntervalForStartPicker = currentTime;
82
+ this.firstIntervalForEndPicker = moment__namespace(this.endDateEpoch).endOf("d").valueOf();
83
+ }
84
+ // current time isn't in last interval
85
+ else {
86
+ this.firstIntervalForStartPicker = moment__namespace().add(offset, "m").valueOf();
87
+ this.firstIntervalForEndPicker = moment__namespace(this.endDateEpoch).valueOf();
88
+ }
72
89
  }
73
- this.startTime = {
74
- valid: true,
75
- time: moment__namespace().add(offset, "m").format(this.timeFormat),
76
- epoch: moment__namespace().add(offset, "m").valueOf()
77
- };
78
- }
79
- else {
80
- this.firstIntervalForStartPicker = moment__namespace(this.startDateEpoch).startOf("d").valueOf();
81
- this.startTime = {
82
- valid: true,
83
- time: this.givenStartTime ? moment__namespace(this.givenStartTime).format(this.timeFormat) : moment__namespace(this.startDateEpoch).startOf('d').add(offset, "m").format(this.timeFormat),
84
- epoch: this.givenStartTime ? this.givenStartTime : moment__namespace(this.startDateEpoch).startOf('d').add(offset, "m").valueOf()
85
- };
86
- }
87
- // for the end picker if the startDate and the endDate is same
88
- // the first interval is set one interval ahead of the first interval for start picker
89
- // else if the dates are different we set it to the start of the day
90
- if (this.startDate === this.endDate) {
91
- this.firstIntervalForEndPicker = moment__namespace().add(offset, "m").add(this.interval, "m").valueOf();
92
90
  }
91
+ // start date, 30 MAY !== current date, 22 MAY
93
92
  else {
94
- this.firstIntervalForEndPicker = moment__namespace().startOf("d").valueOf();
93
+ // start date === end Date
94
+ if (this.startDate === this.endDate) {
95
+ this.firstIntervalForStartPicker = moment__namespace(this.startDateEpoch).startOf("d").valueOf();
96
+ this.firstIntervalForEndPicker = moment__namespace(this.endDateEpoch).add(this.interval, "m").valueOf();
97
+ }
98
+ // start date !== end date
99
+ else {
100
+ this.firstIntervalForStartPicker = moment__namespace(this.startDateEpoch).startOf("d").valueOf();
101
+ this.firstIntervalForEndPicker = moment__namespace(this.startDateEpoch).startOf("d").valueOf();
102
+ }
95
103
  }
104
+ if (this.givenStartTime)
105
+ this.firstIntervalForStartPicker = this.givenStartTime;
106
+ if (this.givenEndTime)
107
+ this.firstIntervalForEndPicker = this.givenEndTime;
108
+ this.startTime = {
109
+ valid: true,
110
+ time: moment__namespace(this.firstIntervalForStartPicker).format(this.timeFormat),
111
+ epoch: moment__namespace(this.firstIntervalForStartPicker).valueOf()
112
+ };
96
113
  this.endTime = {
97
114
  valid: true,
98
115
  time: moment__namespace(this.firstIntervalForEndPicker).format(this.timeFormat),
99
- epoch: this.firstIntervalForEndPicker
116
+ epoch: moment__namespace(this.firstIntervalForEndPicker).valueOf()
100
117
  };
101
118
  };
102
119
  TimeRangePickerComponent.prototype.emitTimeRange = function (data) {
@@ -1 +1 @@
1
- {"version":3,"file":"mis-crystal-design-system-timerangepicker.umd.js","sources":["../../../projects/mis-components/timerangepicker/timerangepicker.component.ts","../../../projects/mis-components/timerangepicker/timerangepicker.module.ts","../../../projects/mis-components/timerangepicker/mis-crystal-design-system-timerangepicker.ts"],"sourcesContent":["import { Component, Input, ChangeDetectorRef, Output, EventEmitter } from \"@angular/core\";\nimport * as moment from \"moment-timezone\";\nimport { ITimeRange, ITime, TDirection } from \"./timerange.namespace\";\n\n@Component({\n selector: \"mis-timerangepicker\",\n templateUrl: \"./timerangepicker.component.html\",\n styleUrls: [\"./timerangepicker.component.scss\"]\n})\nexport class TimeRangePickerComponent {\n @Input() inputWidth: string = \"100px\";\n @Input() dropdownWidth?: string;\n @Input() height: string = \"46px\";\n @Input() timezone: string = \"Asia/Kolkata\";\n @Input() startDateEpoch: number = moment().tz(this.timezone).valueOf();\n @Input() endDateEpoch: number = moment().tz(this.timezone).valueOf();\n @Input() givenStartTime: number;\n @Input() givenEndTime: number;\n @Input() clockFormat: number = 12;\n @Input() interval: number = 15;\n @Input() showTooltip: boolean = true;\n @Input() direction: TDirection = 'row';\n @Input() gap: string = '1rem';\n\n @Output() timeRangeEmitter = new EventEmitter<ITimeRange>();\n\n startDate!: string;\n endDate!: string;\n currDate!: string;\n timeFormat!: string;\n firstIntervalForStartPicker: number = moment().valueOf();\n firstIntervalForEndPicker: number = moment().valueOf();\n startTime!: ITime;\n endTime!: ITime;\n rangeValidity: boolean = true;\n triggerChange: boolean = true;\n\n constructor(private cdr: ChangeDetectorRef) {}\n\n ngOnInit() {}\n\n ngOnChanges() {\n this.timeFormat = this.clockFormat === 12 ? \"hh:mm a\" : \"HH:mm\";\n moment.tz.setDefault(this.timezone);\n this.startDate = moment(this.startDateEpoch).format(\"DD-MM-YYYY\");\n this.endDate = moment(this.endDateEpoch).format(\"DD-MM-YYYY\");\n this.currDate = moment().format(\"DD-MM-YYYY\");\n this.setFirstIntervals();\n }\n\n // calculate the first interval of the picker\n setFirstIntervals(): void {\n const minutes = moment().minutes();\n const offset = this.interval - (minutes % this.interval);\n\n // first interval for the start picker will be the one closest to the current time\n // if the start date is equal to the curr date\n if (this.startDate === this.endDate) {\n const currentTime = moment().valueOf();\n\n // if current time >= 11:45 the start picker will show\n // current time instead of next closest interval\n if ( currentTime >= moment().endOf(\"d\").subtract(15, \"m\").valueOf()){\n this.firstIntervalForStartPicker = currentTime;\n } else {\n this.firstIntervalForStartPicker = moment().add(offset, \"m\").valueOf();\n }\n this.startTime = {\n valid: true,\n time: moment().add(offset, \"m\").format(this.timeFormat),\n epoch: moment().add(offset, \"m\").valueOf()\n };\n } else {\n this.firstIntervalForStartPicker = moment(this.startDateEpoch).startOf(\"d\").valueOf();\n this.startTime = {\n valid: true,\n time: this.givenStartTime ? moment(this.givenStartTime).format(this.timeFormat) : moment(this.startDateEpoch).startOf('d').add(offset, \"m\").format(this.timeFormat),\n epoch: this.givenStartTime ? this.givenStartTime : moment(this.startDateEpoch).startOf('d').add(offset, \"m\").valueOf()\n };\n }\n\n // for the end picker if the startDate and the endDate is same\n // the first interval is set one interval ahead of the first interval for start picker\n // else if the dates are different we set it to the start of the day\n if (this.startDate === this.endDate) {\n this.firstIntervalForEndPicker = moment().add(offset, \"m\").add(this.interval, \"m\").valueOf();\n } else {\n this.firstIntervalForEndPicker = moment().startOf(\"d\").valueOf();\n }\n\n this.endTime = {\n valid: true,\n time: moment(this.firstIntervalForEndPicker).format(this.timeFormat),\n epoch: this.firstIntervalForEndPicker\n };\n }\n\n emitTimeRange(data: ITimeRange): void {\n this.timeRangeEmitter.emit(data);\n }\n\n //handlers catch the emitted values and run validation\n startPickerHandler(time: ITime): void {\n this.startTime = time;\n this.rangeValidity = true;\n // if the start time changes and the start date is the same as the end date\n // and the start time >= end time\n // update the first interval of end picker according to the time set in start picker\n if (this.startDate === this.endDate) {\n let minutes = moment(this.startTime.time, this.timeFormat).minutes();\n let offset = this.interval - (minutes % this.interval);\n this.firstIntervalForEndPicker = moment(`${this.startDate} ${this.startTime.time}`, `'DD-MM-YYYY' ${this.timeFormat}`)\n .add(offset, \"m\")\n .valueOf();\n\n // if the first interval == 12:00am, set it as 11:59pm\n const intervalAsString = moment(this.firstIntervalForEndPicker).format(this.timeFormat);\n const endOfDayAsString = moment(moment(`${this.startDate}`, `DD-MM-YYYY ${this.timeFormat}`).endOf(\"d\").add(1, \"m\")).format(this.timeFormat);\n if (intervalAsString === endOfDayAsString) {\n this.firstIntervalForEndPicker = moment(`${this.startDate} ${this.startTime.time}`, `'DD-MM-YYYY' ${this.timeFormat}`).endOf(\"d\").valueOf();\n }\n\n } else {\n const validity =\n this.checkTimeValidity(this.startTime.time.trim(), this.startDateEpoch) &&\n this.checkTimeValidity(this.endTime.time.trim(), this.endDateEpoch);\n\n this.rangeValidation(validity);\n this.emitTimeRange({\n valid: validity && this.rangeValidity,\n startTime: this.startTime.time,\n endTime: this.endTime.time,\n startEpoch: moment(`${this.startDate} ${this.startTime.time}`, `DD-MM-YYYY ${this.timeFormat}`).valueOf(),\n endEpoch: moment(`${this.endDate} ${this.endTime.time}`, `DD-MM-YYYY ${this.timeFormat}`).valueOf()\n });\n }\n\n this.triggerChange = !this.triggerChange;\n }\n\n endPickerHandler(time: ITime): void {\n this.endTime = time;\n\n const validity =\n this.checkTimeValidity(this.startTime.time.trim(), this.startDateEpoch) && this.checkTimeValidity(this.endTime.time.trim(), this.endDateEpoch);\n\n this.rangeValidation(validity);\n this.emitTimeRange({\n valid: validity && this.rangeValidity,\n startTime: this.startTime.time,\n endTime: this.endTime.time,\n startEpoch: moment(`${this.startDate} ${this.startTime.time}`, `DD-MM-YYYY ${this.timeFormat}`).valueOf(),\n endEpoch: moment(`${this.endDate} ${this.endTime.time}`, `DD-MM-YYYY ${this.timeFormat}`).valueOf()\n });\n }\n\n checkTimeValidity(time: string, date: number): boolean {\n const RE12 = /^(([0][1-9]|1[0-2]):([0-5][0-9])( )?(am|pm|AM|PM))$/i;\n const RE24 = /^([01][0-9]|2[0-3]):[0-5][0-9]$/;\n const RE = this.clockFormat === 12 ? RE12 : RE24;\n\n const timeMoment = moment(`${moment(date).format(\"DD-MM-YYYY\")} ${time}`, `'DD-MM-YYYY' ${this.timeFormat}`);\n let flag: boolean = false;\n\n // if the first interval is set to the start of the day\n // then we don't check its validity against the current time\n if ((this.givenStartTime && this.givenEndTime) || (this.startDate !== this.endDate && this.startDate !== this.currDate)) {\n flag = time.match(RE) ? true : false;\n } else {\n flag = time.match(RE) && timeMoment.diff(moment(), \"m\") >= 0 ? true : false;\n }\n\n return flag;\n }\n\n // validates end picker's input according to the start picker's input\n rangeValidation(validity: boolean) {\n if (validity && this.startDate === this.endDate) {\n const startMoment = moment(this.startTime.time, this.timeFormat);\n const endMoment = moment(this.endTime.time, this.timeFormat);\n this.rangeValidity = endMoment.diff(startMoment, \"m\") >= 1 ? true : false;\n this.cdr.detectChanges();\n }\n }\n}\n","import { NgModule, ModuleWithProviders } from \"@angular/core\";\nimport { CommonModule } from '@angular/common';\nimport { FormsModule } from '@angular/forms';\nimport { TimeRangePickerComponent } from \"./timerangepicker.component\";\nimport { TimePickerModule } from \"mis-crystal-design-system/timepicker\";\n\n@NgModule({\n declarations: [TimeRangePickerComponent],\n imports: [CommonModule, FormsModule, TimePickerModule],\n exports: [TimeRangePickerComponent]\n})\nexport class TimeRangePickerModule {\n static forRoot(): ModuleWithProviders<TimeRangePickerModule> {\n return { ngModule: TimeRangePickerModule, providers: [] };\n }\n}","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["moment","EventEmitter","moment.tz","Component","ChangeDetectorRef","Input","Output","NgModule","CommonModule","FormsModule","TimePickerModule"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAqCE,kCAAoB,GAAsB;YAAtB,QAAG,GAAH,GAAG,CAAmB;YA3BjC,eAAU,GAAW,OAAO,CAAC;YAE7B,WAAM,GAAW,MAAM,CAAC;YACxB,aAAQ,GAAW,cAAc,CAAC;YAClC,mBAAc,GAAWA,iBAAM,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,OAAO,EAAE,CAAC;YAC9D,iBAAY,GAAWA,iBAAM,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,OAAO,EAAE,CAAC;YAG5D,gBAAW,GAAW,EAAE,CAAC;YACzB,aAAQ,GAAW,EAAE,CAAC;YACtB,gBAAW,GAAY,IAAI,CAAC;YAC5B,cAAS,GAAe,KAAK,CAAC;YAC9B,QAAG,GAAW,MAAM,CAAC;YAEpB,qBAAgB,GAAG,IAAIC,iBAAY,EAAc,CAAC;YAM5D,gCAA2B,GAAWD,iBAAM,EAAE,CAAC,OAAO,EAAE,CAAC;YACzD,8BAAyB,GAAWA,iBAAM,EAAE,CAAC,OAAO,EAAE,CAAC;YAGvD,kBAAa,GAAY,IAAI,CAAC;YAC9B,kBAAa,GAAY,IAAI,CAAC;SAEgB;QAE9C,2CAAQ,GAAR,eAAa;QAEb,8CAAW,GAAX;YACE,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,WAAW,KAAK,E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EAAE,SAAS,EAAE,EAAE,EAAE,CAAC;SAC3D;;;;gBARFC,aAAQ,SAAC;oBACR,YAAY,EAAE,CAAC,wBAAwB,CAAC;oBACxC,OAAO,EAAE,CAACC,mBAAY,EAAEC,iBAAW,EAAEC,2BAAgB,CAAC;oBACtD,OAAO,EAAE,CAAC,wBAAwB,CAAC;iBACpC;;;ICVD;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"mis-crystal-design-system-timerangepicker.umd.js","sources":["../../../projects/mis-components/timerangepicker/timerangepicker.component.ts","../../../projects/mis-components/timerangepicker/timerangepicker.module.ts","../../../projects/mis-components/timerangepicker/mis-crystal-design-system-timerangepicker.ts"],"sourcesContent":["import { Component, Input, ChangeDetectorRef, Output, EventEmitter } from \"@angular/core\";\nimport * as moment from \"moment-timezone\";\nimport { ITimeRange, ITime, TDirection } from \"./timerange.namespace\";\n\n@Component({\n selector: \"mis-timerangepicker\",\n templateUrl: \"./timerangepicker.component.html\",\n styleUrls: [\"./timerangepicker.component.scss\"]\n})\nexport class TimeRangePickerComponent {\n @Input() inputWidth: string = \"100px\";\n @Input() dropdownWidth?: string;\n @Input() height: string = \"46px\";\n @Input() timezone: string = \"Asia/Kolkata\";\n @Input() startDateEpoch: number = moment().tz(this.timezone).valueOf();\n @Input() endDateEpoch: number = moment().tz(this.timezone).valueOf();\n @Input() givenStartTime: number;\n @Input() givenEndTime: number;\n @Input() clockFormat: number = 12;\n @Input() interval: number = 15;\n @Input() showTooltip: boolean = true;\n @Input() direction: TDirection = 'row';\n @Input() gap: string = '1rem';\n\n @Output() timeRangeEmitter = new EventEmitter<ITimeRange>();\n\n startDate!: string;\n endDate!: string;\n currDate!: string;\n timeFormat!: string;\n firstIntervalForStartPicker: number = moment().valueOf();\n firstIntervalForEndPicker: number = moment().valueOf();\n startTime!: ITime;\n endTime!: ITime;\n rangeValidity: boolean = true;\n triggerChange: boolean = true;\n\n constructor(private cdr: ChangeDetectorRef) {}\n\n ngOnInit() {}\n\n ngOnChanges() {\n this.timeFormat = this.clockFormat === 12 ? \"hh:mm a\" : \"HH:mm\";\n moment.tz.setDefault(this.timezone);\n this.startDate = moment(this.startDateEpoch).format(\"DD-MM-YYYY\");\n this.endDate = moment(this.endDateEpoch).format(\"DD-MM-YYYY\");\n this.currDate = moment().format(\"DD-MM-YYYY\");\n this.setFirstIntervals();\n }\n\n // calculate the first interval of the picker\n setFirstIntervals(): void {\n const minutes = moment().minutes();\n const offset = this.interval - (minutes % this.interval);\n\n // start date, 22 MAY === current date, 22 MAY\n if( this.startDate === this.currDate ){\n const currentTime = moment(this.startDateEpoch).valueOf();\n\n // start date, 22 MAY === current date, 22 MAY === end date, 22 MAY\n if(this.startDate === this.endDate){\n\n // current time is in last interval\n if( currentTime >= moment(this.startDateEpoch).endOf(\"d\").subtract(this.interval,\"m\").valueOf()){\n this.firstIntervalForStartPicker = currentTime;\n this.firstIntervalForEndPicker = moment(this.endDateEpoch).endOf(\"d\").valueOf();\n }\n // current time isn't in last interval\n else {\n this.firstIntervalForStartPicker = moment().add(offset, \"m\").valueOf();\n this.firstIntervalForEndPicker = moment().add(offset, \"m\").add(this.interval, \"m\").valueOf();\n }\n } \n // start date, 22 MAY === current date, 22 MAY !== end date, 30 MAY\n else {\n // current time is in last interval\n if( currentTime >= moment(this.startDateEpoch).endOf(\"d\").subtract(this.interval,\"m\").valueOf()){\n this.firstIntervalForStartPicker = currentTime;\n this.firstIntervalForEndPicker = moment(this.endDateEpoch).endOf(\"d\").valueOf();\n }\n // current time isn't in last interval\n else {\n this.firstIntervalForStartPicker = moment().add(offset, \"m\").valueOf();\n this.firstIntervalForEndPicker = moment(this.endDateEpoch).valueOf();\n }\n }\n }\n // start date, 30 MAY !== current date, 22 MAY\n else {\n // start date === end Date\n if( this.startDate === this.endDate){\n this.firstIntervalForStartPicker = moment(this.startDateEpoch).startOf(\"d\").valueOf();\n this.firstIntervalForEndPicker = moment(this.endDateEpoch).add(this.interval, \"m\").valueOf();\n } \n // start date !== end date\n else {\n this.firstIntervalForStartPicker = moment(this.startDateEpoch).startOf(\"d\").valueOf();\n this.firstIntervalForEndPicker = moment(this.startDateEpoch).startOf(\"d\").valueOf();\n }\n\n }\n\n if(this.givenStartTime)\n this.firstIntervalForStartPicker = this.givenStartTime;\n \n if(this.givenEndTime)\n this.firstIntervalForEndPicker = this.givenEndTime;\n \n this.startTime = {\n valid: true,\n time: moment(this.firstIntervalForStartPicker).format(this.timeFormat),\n epoch: moment(this.firstIntervalForStartPicker).valueOf()\n };\n\n this.endTime = {\n valid: true,\n time: moment(this.firstIntervalForEndPicker).format(this.timeFormat),\n epoch: moment(this.firstIntervalForEndPicker).valueOf()\n };\n }\n\n emitTimeRange(data: ITimeRange): void {\n this.timeRangeEmitter.emit(data);\n }\n\n //handlers catch the emitted values and run validation\n startPickerHandler(time: ITime): void {\n this.startTime = time;\n this.rangeValidity = true;\n // if the start time changes and the start date is the same as the end date\n // and the start time >= end time\n // update the first interval of end picker according to the time set in start picker\n if (this.startDate === this.endDate) {\n let minutes = moment(this.startTime.time, this.timeFormat).minutes();\n let offset = this.interval - (minutes % this.interval);\n this.firstIntervalForEndPicker = moment(`${this.startDate} ${this.startTime.time}`, `'DD-MM-YYYY' ${this.timeFormat}`)\n .add(offset, \"m\")\n .valueOf();\n\n // if the first interval == 12:00am, set it as 11:59pm\n const intervalAsString = moment(this.firstIntervalForEndPicker).format(this.timeFormat);\n const endOfDayAsString = moment(moment(`${this.startDate}`, `DD-MM-YYYY ${this.timeFormat}`).endOf(\"d\").add(1, \"m\")).format(this.timeFormat);\n if (intervalAsString === endOfDayAsString) {\n this.firstIntervalForEndPicker = moment(`${this.startDate} ${this.startTime.time}`, `'DD-MM-YYYY' ${this.timeFormat}`).endOf(\"d\").valueOf();\n }\n\n } else {\n const validity =\n this.checkTimeValidity(this.startTime.time.trim(), this.startDateEpoch) &&\n this.checkTimeValidity(this.endTime.time.trim(), this.endDateEpoch);\n\n this.rangeValidation(validity);\n this.emitTimeRange({\n valid: validity && this.rangeValidity,\n startTime: this.startTime.time,\n endTime: this.endTime.time,\n startEpoch: moment(`${this.startDate} ${this.startTime.time}`, `DD-MM-YYYY ${this.timeFormat}`).valueOf(),\n endEpoch: moment(`${this.endDate} ${this.endTime.time}`, `DD-MM-YYYY ${this.timeFormat}`).valueOf()\n });\n }\n\n this.triggerChange = !this.triggerChange;\n }\n\n endPickerHandler(time: ITime): void {\n this.endTime = time;\n\n const validity =\n this.checkTimeValidity(this.startTime.time.trim(), this.startDateEpoch) && this.checkTimeValidity(this.endTime.time.trim(), this.endDateEpoch);\n\n this.rangeValidation(validity);\n this.emitTimeRange({\n valid: validity && this.rangeValidity,\n startTime: this.startTime.time,\n endTime: this.endTime.time,\n startEpoch: moment(`${this.startDate} ${this.startTime.time}`, `DD-MM-YYYY ${this.timeFormat}`).valueOf(),\n endEpoch: moment(`${this.endDate} ${this.endTime.time}`, `DD-MM-YYYY ${this.timeFormat}`).valueOf()\n });\n }\n\n checkTimeValidity(time: string, date: number): boolean {\n const RE12 = /^(([0][1-9]|1[0-2]):([0-5][0-9])( )?(am|pm|AM|PM))$/i;\n const RE24 = /^([01][0-9]|2[0-3]):[0-5][0-9]$/;\n const RE = this.clockFormat === 12 ? RE12 : RE24;\n\n const timeMoment = moment(`${moment(date).format(\"DD-MM-YYYY\")} ${time}`, `'DD-MM-YYYY' ${this.timeFormat}`);\n let flag: boolean = false;\n\n // if the first interval is set to the start of the day\n // then we don't check its validity against the current time\n if ((this.givenStartTime && this.givenEndTime) || (this.startDate !== this.endDate && this.startDate !== this.currDate)) {\n flag = time.match(RE) ? true : false;\n } else {\n flag = time.match(RE) && timeMoment.diff(moment(), \"m\") >= 0 ? true : false;\n }\n\n return flag;\n }\n\n // validates end picker's input according to the start picker's input\n rangeValidation(validity: boolean) {\n if (validity && this.startDate === this.endDate) {\n const startMoment = moment(this.startTime.time, this.timeFormat);\n const endMoment = moment(this.endTime.time, this.timeFormat);\n this.rangeValidity = endMoment.diff(startMoment, \"m\") >= 1 ? true : false;\n this.cdr.detectChanges();\n }\n }\n}\n","import { NgModule, ModuleWithProviders } from \"@angular/core\";\nimport { CommonModule } from '@angular/common';\nimport { FormsModule } from '@angular/forms';\nimport { TimeRangePickerComponent } from \"./timerangepicker.component\";\nimport { TimePickerModule } from \"mis-crystal-design-system/timepicker\";\n\n@NgModule({\n declarations: [TimeRangePickerComponent],\n imports: [CommonModule, FormsModule, TimePickerModule],\n exports: [TimeRangePickerComponent]\n})\nexport class TimeRangePickerModule {\n static forRoot(): ModuleWithProviders<TimeRangePickerModule> {\n return { ngModule: TimeRangePickerModule, providers: [] };\n }\n}","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["moment","EventEmitter","moment.tz","Component","ChangeDetectorRef","Input","Output","NgModule","CommonModule","FormsModule","TimePickerModule"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAqCE,kCAAoB,GAAsB;YAAtB,QAAG,GAAH,GAAG,CAAmB;YA3BjC,eAAU,GAAW,OAAO,CAAC;YAE7B,WAAM,GAAW,MAAM,CAAC;YACxB,aAAQ,GAAW,cAAc,CAAC;YAClC,mBAAc,GAAWA,iBAAM,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,OAAO,EAAE,CAAC;YAC9D,iBAAY,GAAWA,iBAAM,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,OAAO,EAAE,CAAC;YAG5D,gBAAW,GAAW,EAAE,CAAC;YACzB,aAAQ,GAAW,EAAE,CAAC;YACtB,gBAAW,GAAY,IAAI,CAAC;YAC5B,cAAS,GAAe,KAAK,CAAC;YAC9B,QAAG,GAAW,MAAM,CAAC;YAEpB,qBAAgB,GAAG,IAAIC,iBAAY,EAAc,CAAC;YAM5D,gCAA2B,GAAWD,iBAAM,EAAE,CAAC,OAAO,EAAE,CAAC;YACzD,8BAAyB,GAAWA,iBAAM,EAAE,CAAC,OAAO,EAAE,CAAC;YAGv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2 @@
1
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/core"),require("moment-timezone"),require("@angular/common"),require("@angular/forms"),require("mis-crystal-design-system/timepicker")):"function"==typeof define&&define.amd?define("mis-crystal-design-system/timerangepicker",["exports","@angular/core","moment-timezone","@angular/common","@angular/forms","mis-crystal-design-system/timepicker"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self)["mis-crystal-design-system"]=t["mis-crystal-design-system"]||{},t["mis-crystal-design-system"].timerangepicker={}),t.ng.core,t.moment,t.ng.common,t.ng.forms,t["mis-crystal-design-system"].timepicker)}(this,(function(t,e,i,r,a,n){"use strict";function s(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach((function(i){if("default"!==i){var r=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,r.get?r:{enumerable:!0,get:function(){return t[i]}})}})),e.default=t,Object.freeze(e)}var m=s(i),o=function(){function t(t){this.cdr=t,this.inputWidth="100px",this.height="46px",this.timezone="Asia/Kolkata",this.startDateEpoch=m().tz(this.timezone).valueOf(),this.endDateEpoch=m().tz(this.timezone).valueOf(),this.clockFormat=12,this.interval=15,this.showTooltip=!0,this.direction="row",this.gap="1rem",this.timeRangeEmitter=new e.EventEmitter,this.firstIntervalForStartPicker=m().valueOf(),this.firstIntervalForEndPicker=m().valueOf(),this.rangeValidity=!0,this.triggerChange=!0}return t.prototype.ngOnInit=function(){},t.prototype.ngOnChanges=function(){this.timeFormat=12===this.clockFormat?"hh:mm a":"HH:mm",i.tz.setDefault(this.timezone),this.startDate=m(this.startDateEpoch).format("DD-MM-YYYY"),this.endDate=m(this.endDateEpoch).format("DD-MM-YYYY"),this.currDate=m().format("DD-MM-YYYY"),this.setFirstIntervals()},t.prototype.setFirstIntervals=function(){var t=m().minutes(),e=this.interval-t%this.interval;if(this.startDate===this.endDate){var i=m().valueOf();i>=m().endOf("d").subtract(15,"m").valueOf()?this.firstIntervalForStartPicker=i:this.firstIntervalForStartPicker=m().add(e,"m").valueOf(),this.startTime={valid:!0,time:m().add(e,"m").format(this.timeFormat),epoch:m().add(e,"m").valueOf()}}else this.firstIntervalForStartPicker=m(this.startDateEpoch).startOf("d").valueOf(),this.startTime={valid:!0,time:this.givenStartTime?m(this.givenStartTime).format(this.timeFormat):m(this.startDateEpoch).startOf("d").add(e,"m").format(this.timeFormat),epoch:this.givenStartTime?this.givenStartTime:m(this.startDateEpoch).startOf("d").add(e,"m").valueOf()};this.startDate===this.endDate?this.firstIntervalForEndPicker=m().add(e,"m").add(this.interval,"m").valueOf():this.firstIntervalForEndPicker=m().startOf("d").valueOf(),this.endTime={valid:!0,time:m(this.firstIntervalForEndPicker).format(this.timeFormat),epoch:this.firstIntervalForEndPicker}},t.prototype.emitTimeRange=function(t){this.timeRangeEmitter.emit(t)},t.prototype.startPickerHandler=function(t){if(this.startTime=t,this.rangeValidity=!0,this.startDate===this.endDate){var e=m(this.startTime.time,this.timeFormat).minutes(),i=this.interval-e%this.interval;this.firstIntervalForEndPicker=m(this.startDate+" "+this.startTime.time,"'DD-MM-YYYY' "+this.timeFormat).add(i,"m").valueOf(),m(this.firstIntervalForEndPicker).format(this.timeFormat)===m(m(""+this.startDate,"DD-MM-YYYY "+this.timeFormat).endOf("d").add(1,"m")).format(this.timeFormat)&&(this.firstIntervalForEndPicker=m(this.startDate+" "+this.startTime.time,"'DD-MM-YYYY' "+this.timeFormat).endOf("d").valueOf())}else{var r=this.checkTimeValidity(this.startTime.time.trim(),this.startDateEpoch)&&this.checkTimeValidity(this.endTime.time.trim(),this.endDateEpoch);this.rangeValidation(r),this.emitTimeRange({valid:r&&this.rangeValidity,startTime:this.startTime.time,endTime:this.endTime.time,startEpoch:m(this.startDate+" "+this.startTime.time,"DD-MM-YYYY "+this.timeFormat).valueOf(),endEpoch:m(this.endDate+" "+this.endTime.time,"DD-MM-YYYY "+this.timeFormat).valueOf()})}this.triggerChange=!this.triggerChange},t.prototype.endPickerHandler=function(t){this.endTime=t;var e=this.checkTimeValidity(this.startTime.time.trim(),this.startDateEpoch)&&this.checkTimeValidity(this.endTime.time.trim(),this.endDateEpoch);this.rangeValidation(e),this.emitTimeRange({valid:e&&this.rangeValidity,startTime:this.startTime.time,endTime:this.endTime.time,startEpoch:m(this.startDate+" "+this.startTime.time,"DD-MM-YYYY "+this.timeFormat).valueOf(),endEpoch:m(this.endDate+" "+this.endTime.time,"DD-MM-YYYY "+this.timeFormat).valueOf()})},t.prototype.checkTimeValidity=function(t,e){var i=12===this.clockFormat?/^(([0][1-9]|1[0-2]):([0-5][0-9])( )?(am|pm|AM|PM))$/i:/^([01][0-9]|2[0-3]):[0-5][0-9]$/,r=m(m(e).format("DD-MM-YYYY")+" "+t,"'DD-MM-YYYY' "+this.timeFormat);return this.givenStartTime&&this.givenEndTime||this.startDate!==this.endDate&&this.startDate!==this.currDate?!!t.match(i):!!(t.match(i)&&r.diff(m(),"m")>=0)},t.prototype.rangeValidation=function(t){if(t&&this.startDate===this.endDate){var e=m(this.startTime.time,this.timeFormat),i=m(this.endTime.time,this.timeFormat);this.rangeValidity=i.diff(e,"m")>=1,this.cdr.detectChanges()}},t}();o.decorators=[{type:e.Component,args:[{selector:"mis-timerangepicker",template:'<div class="rangepicker-container" [ngStyle]="{\'flexDirection\': direction, \'gap\': gap}">\n <mis-timepicker\n [clockFormat]="clockFormat"\n [interval]="interval"\n [dateAsEpoch]="startDateEpoch"\n [firstInterval]="firstIntervalForStartPicker"\n (timeEmitter)="startPickerHandler($event)"\n [timezone]="timezone"\n [height]="height"\n [inputWidth]="inputWidth"\n [dropdownWidth]="dropdownWidth"\n [showTooltip]="showTooltip"\n [givenTime]="givenStartTime"\n ></mis-timepicker>\n <p *ngIf="direction === \'row\'">-</p>\n <mis-timepicker\n [clockFormat]="clockFormat"\n [interval]="interval"\n [dateAsEpoch]="endDateEpoch"\n [firstInterval]="firstIntervalForEndPicker"\n (timeEmitter)="endPickerHandler($event)"\n [rangeValidity]="rangeValidity"\n [timezone]="timezone"\n [height]="height"\n [inputWidth]="inputWidth"\n [dropdownWidth]="dropdownWidth"\n [showTooltip]="showTooltip"\n [givenTime]="givenEndTime"\n [triggerChange]="triggerChange"\n ></mis-timepicker>\n</div>\n',styles:[".rangepicker-container{display:flex;gap:1rem;align-items:center}p{margin:0;display:inline-flex;align-items:center}"]}]}],o.ctorParameters=function(){return[{type:e.ChangeDetectorRef}]},o.propDecorators={inputWidth:[{type:e.Input}],dropdownWidth:[{type:e.Input}],height:[{type:e.Input}],timezone:[{type:e.Input}],startDateEpoch:[{type:e.Input}],endDateEpoch:[{type:e.Input}],givenStartTime:[{type:e.Input}],givenEndTime:[{type:e.Input}],clockFormat:[{type:e.Input}],interval:[{type:e.Input}],showTooltip:[{type:e.Input}],direction:[{type:e.Input}],gap:[{type:e.Input}],timeRangeEmitter:[{type:e.Output}]};var h=function(){function t(){}return t.forRoot=function(){return{ngModule:t,providers:[]}},t}();h.decorators=[{type:e.NgModule,args:[{declarations:[o],imports:[r.CommonModule,a.FormsModule,n.TimePickerModule],exports:[o]}]}],t.TimeRangePickerComponent=o,t.TimeRangePickerModule=h,Object.defineProperty(t,"__esModule",{value:!0})}));
1
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/core"),require("moment-timezone"),require("@angular/common"),require("@angular/forms"),require("mis-crystal-design-system/timepicker")):"function"==typeof define&&define.amd?define("mis-crystal-design-system/timerangepicker",["exports","@angular/core","moment-timezone","@angular/common","@angular/forms","mis-crystal-design-system/timepicker"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self)["mis-crystal-design-system"]=t["mis-crystal-design-system"]||{},t["mis-crystal-design-system"].timerangepicker={}),t.ng.core,t.moment,t.ng.common,t.ng.forms,t["mis-crystal-design-system"].timepicker)}(this,(function(t,e,i,r,a,n){"use strict";function s(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach((function(i){if("default"!==i){var r=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,r.get?r:{enumerable:!0,get:function(){return t[i]}})}})),e.default=t,Object.freeze(e)}var o=s(i),h=function(){function t(t){this.cdr=t,this.inputWidth="100px",this.height="46px",this.timezone="Asia/Kolkata",this.startDateEpoch=o().tz(this.timezone).valueOf(),this.endDateEpoch=o().tz(this.timezone).valueOf(),this.clockFormat=12,this.interval=15,this.showTooltip=!0,this.direction="row",this.gap="1rem",this.timeRangeEmitter=new e.EventEmitter,this.firstIntervalForStartPicker=o().valueOf(),this.firstIntervalForEndPicker=o().valueOf(),this.rangeValidity=!0,this.triggerChange=!0}return t.prototype.ngOnInit=function(){},t.prototype.ngOnChanges=function(){this.timeFormat=12===this.clockFormat?"hh:mm a":"HH:mm",i.tz.setDefault(this.timezone),this.startDate=o(this.startDateEpoch).format("DD-MM-YYYY"),this.endDate=o(this.endDateEpoch).format("DD-MM-YYYY"),this.currDate=o().format("DD-MM-YYYY"),this.setFirstIntervals()},t.prototype.setFirstIntervals=function(){var t=o().minutes(),e=this.interval-t%this.interval;if(this.startDate===this.currDate){var i=o(this.startDateEpoch).valueOf();this.startDate===this.endDate?i>=o(this.startDateEpoch).endOf("d").subtract(this.interval,"m").valueOf()?(this.firstIntervalForStartPicker=i,this.firstIntervalForEndPicker=o(this.endDateEpoch).endOf("d").valueOf()):(this.firstIntervalForStartPicker=o().add(e,"m").valueOf(),this.firstIntervalForEndPicker=o().add(e,"m").add(this.interval,"m").valueOf()):i>=o(this.startDateEpoch).endOf("d").subtract(this.interval,"m").valueOf()?(this.firstIntervalForStartPicker=i,this.firstIntervalForEndPicker=o(this.endDateEpoch).endOf("d").valueOf()):(this.firstIntervalForStartPicker=o().add(e,"m").valueOf(),this.firstIntervalForEndPicker=o(this.endDateEpoch).valueOf())}else this.startDate===this.endDate?(this.firstIntervalForStartPicker=o(this.startDateEpoch).startOf("d").valueOf(),this.firstIntervalForEndPicker=o(this.endDateEpoch).add(this.interval,"m").valueOf()):(this.firstIntervalForStartPicker=o(this.startDateEpoch).startOf("d").valueOf(),this.firstIntervalForEndPicker=o(this.startDateEpoch).startOf("d").valueOf());this.givenStartTime&&(this.firstIntervalForStartPicker=this.givenStartTime),this.givenEndTime&&(this.firstIntervalForEndPicker=this.givenEndTime),this.startTime={valid:!0,time:o(this.firstIntervalForStartPicker).format(this.timeFormat),epoch:o(this.firstIntervalForStartPicker).valueOf()},this.endTime={valid:!0,time:o(this.firstIntervalForEndPicker).format(this.timeFormat),epoch:o(this.firstIntervalForEndPicker).valueOf()}},t.prototype.emitTimeRange=function(t){this.timeRangeEmitter.emit(t)},t.prototype.startPickerHandler=function(t){if(this.startTime=t,this.rangeValidity=!0,this.startDate===this.endDate){var e=o(this.startTime.time,this.timeFormat).minutes(),i=this.interval-e%this.interval;this.firstIntervalForEndPicker=o(this.startDate+" "+this.startTime.time,"'DD-MM-YYYY' "+this.timeFormat).add(i,"m").valueOf(),o(this.firstIntervalForEndPicker).format(this.timeFormat)===o(o(""+this.startDate,"DD-MM-YYYY "+this.timeFormat).endOf("d").add(1,"m")).format(this.timeFormat)&&(this.firstIntervalForEndPicker=o(this.startDate+" "+this.startTime.time,"'DD-MM-YYYY' "+this.timeFormat).endOf("d").valueOf())}else{var r=this.checkTimeValidity(this.startTime.time.trim(),this.startDateEpoch)&&this.checkTimeValidity(this.endTime.time.trim(),this.endDateEpoch);this.rangeValidation(r),this.emitTimeRange({valid:r&&this.rangeValidity,startTime:this.startTime.time,endTime:this.endTime.time,startEpoch:o(this.startDate+" "+this.startTime.time,"DD-MM-YYYY "+this.timeFormat).valueOf(),endEpoch:o(this.endDate+" "+this.endTime.time,"DD-MM-YYYY "+this.timeFormat).valueOf()})}this.triggerChange=!this.triggerChange},t.prototype.endPickerHandler=function(t){this.endTime=t;var e=this.checkTimeValidity(this.startTime.time.trim(),this.startDateEpoch)&&this.checkTimeValidity(this.endTime.time.trim(),this.endDateEpoch);this.rangeValidation(e),this.emitTimeRange({valid:e&&this.rangeValidity,startTime:this.startTime.time,endTime:this.endTime.time,startEpoch:o(this.startDate+" "+this.startTime.time,"DD-MM-YYYY "+this.timeFormat).valueOf(),endEpoch:o(this.endDate+" "+this.endTime.time,"DD-MM-YYYY "+this.timeFormat).valueOf()})},t.prototype.checkTimeValidity=function(t,e){var i=12===this.clockFormat?/^(([0][1-9]|1[0-2]):([0-5][0-9])( )?(am|pm|AM|PM))$/i:/^([01][0-9]|2[0-3]):[0-5][0-9]$/,r=o(o(e).format("DD-MM-YYYY")+" "+t,"'DD-MM-YYYY' "+this.timeFormat);return this.givenStartTime&&this.givenEndTime||this.startDate!==this.endDate&&this.startDate!==this.currDate?!!t.match(i):!!(t.match(i)&&r.diff(o(),"m")>=0)},t.prototype.rangeValidation=function(t){if(t&&this.startDate===this.endDate){var e=o(this.startTime.time,this.timeFormat),i=o(this.endTime.time,this.timeFormat);this.rangeValidity=i.diff(e,"m")>=1,this.cdr.detectChanges()}},t}();h.decorators=[{type:e.Component,args:[{selector:"mis-timerangepicker",template:'<div class="rangepicker-container" [ngStyle]="{\'flexDirection\': direction, \'gap\': gap}">\n <mis-timepicker\n [clockFormat]="clockFormat"\n [interval]="interval"\n [dateAsEpoch]="startDateEpoch"\n [firstInterval]="firstIntervalForStartPicker"\n (timeEmitter)="startPickerHandler($event)"\n [timezone]="timezone"\n [height]="height"\n [inputWidth]="inputWidth"\n [dropdownWidth]="dropdownWidth"\n [showTooltip]="showTooltip"\n [givenTime]="givenStartTime"\n ></mis-timepicker>\n <p *ngIf="direction === \'row\'">-</p>\n <mis-timepicker\n [clockFormat]="clockFormat"\n [interval]="interval"\n [dateAsEpoch]="endDateEpoch"\n [firstInterval]="firstIntervalForEndPicker"\n (timeEmitter)="endPickerHandler($event)"\n [rangeValidity]="rangeValidity"\n [timezone]="timezone"\n [height]="height"\n [inputWidth]="inputWidth"\n [dropdownWidth]="dropdownWidth"\n [showTooltip]="showTooltip"\n [givenTime]="givenEndTime"\n [triggerChange]="triggerChange"\n ></mis-timepicker>\n</div>\n',styles:[".rangepicker-container{display:flex;gap:1rem;align-items:center}p{margin:0;display:inline-flex;align-items:center}"]}]}],h.ctorParameters=function(){return[{type:e.ChangeDetectorRef}]},h.propDecorators={inputWidth:[{type:e.Input}],dropdownWidth:[{type:e.Input}],height:[{type:e.Input}],timezone:[{type:e.Input}],startDateEpoch:[{type:e.Input}],endDateEpoch:[{type:e.Input}],givenStartTime:[{type:e.Input}],givenEndTime:[{type:e.Input}],clockFormat:[{type:e.Input}],interval:[{type:e.Input}],showTooltip:[{type:e.Input}],direction:[{type:e.Input}],gap:[{type:e.Input}],timeRangeEmitter:[{type:e.Output}]};var m=function(){function t(){}return t.forRoot=function(){return{ngModule:t,providers:[]}},t}();m.decorators=[{type:e.NgModule,args:[{declarations:[h],imports:[r.CommonModule,a.FormsModule,n.TimePickerModule],exports:[h]}]}],t.TimeRangePickerComponent=h,t.TimeRangePickerModule=m,Object.defineProperty(t,"__esModule",{value:!0})}));
2
2
  //# sourceMappingURL=mis-crystal-design-system-timerangepicker.umd.min.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../projects/mis-components/timerangepicker/timerangepicker.component.ts","../../../projects/mis-components/timerangepicker/timerangepicker.module.ts"],"names":["TimeRangePickerComponent","cdr","this","inputWidth","height","timezone","startDateEpoch","moment","tz","valueOf","endDateEpoch","clockFormat","interval","showTooltip","direction","gap","timeRangeEmitter","EventEmitter","firstIntervalForStartPicker","firstIntervalForEndPicker","rangeValidity","triggerChange","prototype","ngOnInit","ngOnChanges","timeFormat","moment.tz","setDefault","startDate","format","endDate","currDate","setFirstIntervals","minutes","offset","currentTime","endOf","subtract","add","startTime","valid","time","epoch","startOf","givenStartTime","endTime","emitTimeRange","data","emit","startPickerHandler","validity","checkTimeValidity","trim","rangeValidation","startEpoch","endEpoch","endPickerHandler","date","RE","timeMoment","givenEndTime","match","diff","startMoment","endMoment","detectChanges","Component","args","selector","template","ChangeDetectorRef","Input","Output","TimeRangePickerModule","forRoot","ngModule","providers","NgModule","declarations","imports","CommonModule","FormsModule","TimeP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,QAAS,CAACnF","sourcesContent":["import { Component, Input, ChangeDetectorRef, Output, EventEmitter } from \"@angular/core\";\nimport * as moment from \"moment-timezone\";\nimport { ITimeRange, ITime, TDirection } from \"./timerange.namespace\";\n\n@Component({\n selector: \"mis-timerangepicker\",\n templateUrl: \"./timerangepicker.component.html\",\n styleUrls: [\"./timerangepicker.component.scss\"]\n})\nexport class TimeRangePickerComponent {\n @Input() inputWidth: string = \"100px\";\n @Input() dropdownWidth?: string;\n @Input() height: string = \"46px\";\n @Input() timezone: string = \"Asia/Kolkata\";\n @Input() startDateEpoch: number = moment().tz(this.timezone).valueOf();\n @Input() endDateEpoch: number = moment().tz(this.timezone).valueOf();\n @Input() givenStartTime: number;\n @Input() givenEndTime: number;\n @Input() clockFormat: number = 12;\n @Input() interval: number = 15;\n @Input() showTooltip: boolean = true;\n @Input() direction: TDirection = 'row';\n @Input() gap: string = '1rem';\n\n @Output() timeRangeEmitter = new EventEmitter<ITimeRange>();\n\n startDate!: string;\n endDate!: string;\n currDate!: string;\n timeFormat!: string;\n firstIntervalForStartPicker: number = moment().valueOf();\n firstIntervalForEndPicker: number = moment().valueOf();\n startTime!: ITime;\n endTime!: ITime;\n rangeValidity: boolean = true;\n triggerChange: boolean = true;\n\n constructor(private cdr: ChangeDetectorRef) {}\n\n ngOnInit() {}\n\n ngOnChanges() {\n this.timeFormat = this.clockFormat === 12 ? \"hh:mm a\" : \"HH:mm\";\n moment.tz.setDefault(this.timezone);\n this.startDate = moment(this.startDateEpoch).format(\"DD-MM-YYYY\");\n this.endDate = moment(this.endDateEpoch).format(\"DD-MM-YYYY\");\n this.currDate = moment().format(\"DD-MM-YYYY\");\n this.setFirstIntervals();\n }\n\n // calculate the first interval of the picker\n setFirstIntervals(): void {\n const minutes = moment().minutes();\n const offset = this.interval - (minutes % this.interval);\n\n // first interval for the start picker will be the one closest to the current time\n // if the start date is equal to the curr date\n if (this.startDate === this.endDate) {\n const currentTime = moment().valueOf();\n\n // if current time >= 11:45 the start picker will show\n // current time instead of next closest interval\n if ( currentTime >= moment().endOf(\"d\").subtract(15, \"m\").valueOf()){\n this.firstIntervalForStartPicker = currentTime;\n } else {\n this.firstIntervalForStartPicker = moment().add(offset, \"m\").valueOf();\n }\n this.startTime = {\n valid: true,\n time: moment().add(offset, \"m\").format(this.timeFormat),\n epoch: moment().add(offset, \"m\").valueOf()\n };\n } else {\n this.firstIntervalForStartPicker = moment(this.startDateEpoch).startOf(\"d\").valueOf();\n this.startTime = {\n valid: true,\n time: this.givenStartTime ? moment(this.givenStartTime).format(this.timeFormat) : moment(this.startDateEpoch).startOf('d').add(offset, \"m\").format(this.timeFormat),\n epoch: this.givenStartTime ? this.givenStartTime : moment(this.startDateEpoch).startOf('d').add(offset, \"m\").valueOf()\n };\n }\n\n // for the end picker if the startDate and the endDate is same\n // the first interval is set one interval ahead of the first interval for start picker\n // else if the dates are different we set it to the start of the day\n if (this.startDate === this.endDate) {\n this.firstIntervalForEndPicker = moment().add(offset, \"m\").add(this.interval, \"m\").valueOf();\n } else {\n this.firstIntervalForEndPicker = moment().startOf(\"d\").valueOf();\n }\n\n this.endTime = {\n valid: true,\n time: moment(this.firstIntervalForEndPicker).format(this.timeFormat),\n epoch: this.firstIntervalForEndPicker\n };\n }\n\n emitTimeRange(data: ITimeRange): void {\n this.timeRangeEmitter.emit(data);\n }\n\n //handlers catch the emitted values and run validation\n startPickerHandler(time: ITime): void {\n this.startTime = time;\n this.rangeValidity = true;\n // if the start time changes and the start date is the same as the end date\n // and the start time >= end time\n // update the first interval of end picker according to the time set in start picker\n if (this.startDate === this.endDate) {\n let minutes = moment(this.startTime.time, this.timeFormat).minutes();\n let offset = this.interval - (minutes % this.interval);\n this.firstIntervalForEndPicker = moment(`${this.startDate} ${this.startTime.time}`, `'DD-MM-YYYY' ${this.timeFormat}`)\n .add(offset, \"m\")\n .valueOf();\n\n // if the first interval == 12:00am, set it as 11:59pm\n const intervalAsString = moment(this.firstIntervalForEndPicker).format(this.timeFormat);\n const endOfDayAsString = moment(moment(`${this.startDate}`, `DD-MM-YYYY ${this.timeFormat}`).endOf(\"d\").add(1, \"m\")).format(this.timeFormat);\n if (intervalAsString === endOfDayAsString) {\n this.firstIntervalForEndPicker = moment(`${this.startDate} ${this.startTime.time}`, `'DD-MM-YYYY' ${this.timeFormat}`).endOf(\"d\").valueOf();\n }\n\n } else {\n const validity =\n this.checkTimeValidity(this.startTime.time.trim(), this.startDateEpoch) &&\n this.checkTimeValidity(this.endTime.time.trim(), this.endDateEpoch);\n\n this.rangeValidation(validity);\n this.emitTimeRange({\n valid: validity && this.rangeValidity,\n startTime: this.startTime.time,\n endTime: this.endTime.time,\n startEpoch: moment(`${this.startDate} ${this.startTime.time}`, `DD-MM-YYYY ${this.timeFormat}`).valueOf(),\n endEpoch: moment(`${this.endDate} ${this.endTime.time}`, `DD-MM-YYYY ${this.timeFormat}`).valueOf()\n });\n }\n\n this.triggerChange = !this.triggerChange;\n }\n\n endPickerHandler(time: ITime): void {\n this.endTime = time;\n\n const validity =\n this.checkTimeValidity(this.startTime.time.trim(), this.startDateEpoch) && this.checkTimeValidity(this.endTime.time.trim(), this.endDateEpoch);\n\n this.rangeValidation(validity);\n this.emitTimeRange({\n valid: validity && this.rangeValidity,\n startTime: this.startTime.time,\n endTime: this.endTime.time,\n startEpoch: moment(`${this.startDate} ${this.startTime.time}`, `DD-MM-YYYY ${this.timeFormat}`).valueOf(),\n endEpoch: moment(`${this.endDate} ${this.endTime.time}`, `DD-MM-YYYY ${this.timeFormat}`).valueOf()\n });\n }\n\n checkTimeValidity(time: string, date: number): boolean {\n const RE12 = /^(([0][1-9]|1[0-2]):([0-5][0-9])( )?(am|pm|AM|PM))$/i;\n const RE24 = /^([01][0-9]|2[0-3]):[0-5][0-9]$/;\n const RE = this.clockFormat === 12 ? RE12 : RE24;\n\n const timeMoment = moment(`${moment(date).format(\"DD-MM-YYYY\")} ${time}`, `'DD-MM-YYYY' ${this.timeFormat}`);\n let flag: boolean = false;\n\n // if the first interval is set to the start of the day\n // then we don't check its validity against the current time\n if ((this.givenStartTime && this.givenEndTime) || (this.startDate !== this.endDate && this.startDate !== this.currDate)) {\n flag = time.match(RE) ? true : false;\n } else {\n flag = time.match(RE) && timeMoment.diff(moment(), \"m\") >= 0 ? true : false;\n }\n\n return flag;\n }\n\n // validates end picker's input according to the start picker's input\n rangeValidation(validity: boolean) {\n if (validity && this.startDate === this.endDate) {\n const startMoment = moment(this.startTime.time, this.timeFormat);\n const endMoment = moment(this.endTime.time, this.timeFormat);\n this.rangeValidity = endMoment.diff(startMoment, \"m\") >= 1 ? true : false;\n this.cdr.detectChanges();\n }\n }\n}\n","import { NgModule, ModuleWithProviders } from \"@angular/core\";\nimport { CommonModule } from '@angular/common';\nimport { FormsModule } from '@angular/forms';\nimport { TimeRangePickerComponent } from \"./timerangepicker.component\";\nimport { TimePickerModule } from \"mis-crystal-design-system/timepicker\";\n\n@NgModule({\n declarations: [TimeRangePickerComponent],\n imports: [CommonModule, FormsModule, TimePickerModule],\n exports: [TimeRangePickerComponent]\n})\nexport class TimeRangePickerModule {\n static forRoot(): ModuleWithProviders<TimeRangePickerModule> {\n return { ngModule: TimeRangePickerModule, providers: [] };\n }\n}"]}
1
+ {"version":3,"sources":["../../../projects/mis-components/timerangepicker/timerangepicker.component.ts","../../../projects/mis-components/timerangepicker/timerangepicker.module.ts"],"names":["TimeRangePickerComponent","cdr","this","inputWidth","height","timezone","startDateEpoch","moment","tz","valueOf","endDateEpoch","clockFormat","interval","showTooltip","direction","gap","timeRangeEmitter","EventEmitter","firstIntervalForStartPicker","firstIntervalForEndPicker","rangeValidity","triggerChange","prototype","ngOnInit","ngOnChanges","timeFormat","moment.tz","setDefault","startDate","format","endDate","currDate","setFirstIntervals","minutes","offset","currentTime","endOf","subtract","add","startOf","givenStartTime","givenEndTime","startTime","valid","time","epoch","endTime","emitTimeRange","data","emit","startPickerHandler","validity","checkTimeValidity","trim","rangeValidation","startEpoch","endEpoch","endPickerHandler","date","RE","timeMoment","match","diff","startMoment","endMoment","detectChanges","Component","args","selector","template","ChangeDetectorRef","Input","Output","TimeRangePickerModule","forRoot","ngModule","providers","NgModule","declarations","imports","CommonModule","FormsModule","TimePickerModule","exports"],"mappings":"8hCAqCE,SAAAA,EAAoBC,GAAAC,KAAAD,IAAAA,EA3BXC,KAAAC,WAAqB,QAErBD,KAAAE,OAAiB,OACjBF,KAAAG,SAAmB,eACnBH,KAAAI,eAAyBC,IAASC,GAAGN,KAAKG,UAAUI,UACpDP,KAAAQ,aAAuBH,IAASC,GAAGN,KAAKG,UAAUI,UAGlDP,KAAAS,YAAsB,GACtBT,KAAAU,SAAmB,GACnBV,KAAAW,aAAuB,EACvBX,KAAAY,UAAwB,MACxBZ,KAAAa,IAAc,OAEbb,KAAAc,iBAAmB,IAAIC,EAAAA,aAMjCf,KAAAgB,4BAAsCX,IAASE,UAC/CP,KAAAiB,0BAAoCZ,IAASE,UAG7CP,KAAAkB,eAAyB,EACzBlB,KAAAmB,eAAyB,SAIzBrB,EAAAsB,UAAAC,SAAA,aAEAvB,EAAAsB,UAAAE,YAAA,WACEtB,KAAKuB,WAAkC,KAArBvB,KAAKS,YAAqB,UAAY,QACxDe,EAAAA,GAAUC,WAAWzB,KAAKG,UAC1BH,KAAK0B,UAAYrB,EAAOL,KAAKI,gBAAgBuB,OAAO,cACpD3B,KAAK4B,QAAUvB,EAAOL,KAAKQ,cAAcmB,OAAO,cAChD3B,KAAK6B,SAAWxB,IAASsB,OAAO,cAChC3B,KAAK8B,qBAIPhC,EAAAsB,UAAAU,kBAAA,WACE,IAAMC,EAAU1B,IAAS0B,UACnBC,EAAShC,KAAKU,SAAYqB,EAAU/B,KAAKU,SAG/C,GAAIV,KAAK0B,YAAc1B,KAAK6B,SAAU,CACpC,IAAMI,EAAc5B,EAAOL,KAAKI,gBAAgBG,UAG7CP,KAAK0B,YAAc1B,KAAK4B,QAGrBK,GAAe5B,EAAOL,KAAKI,gBAAgB8B,MAAM,KAAKC,SAASnC,KAA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,EACzD7D,KAAKD,IAAIgE,2CAzMdC,EAAAA,UAASC,KAAA,CAAC,CACTC,SAAU,sBACVC,SAAA,0sCANyBC,EAAAA,yDAUxBC,EAAAA,6BACAA,EAAAA,sBACAA,EAAAA,wBACAA,EAAAA,8BACAA,EAAAA,4BACAA,EAAAA,8BACAA,EAAAA,4BACAA,EAAAA,2BACAA,EAAAA,wBACAA,EAAAA,2BACAA,EAAAA,yBACAA,EAAAA,mBACAA,EAAAA,gCAEAC,EAAAA,2BCbH,SAAAC,YACSA,EAAAC,QAAP,WACE,MAAO,CAAEC,SAAUF,EAAuBG,UAAW,8BAPxDC,EAAAA,SAAQV,KAAA,CAAC,CACRW,aAAc,CAAC9E,GACf+E,QAAS,CAACC,EAAAA,aAAcC,EAAAA,YAAaC,EAAAA,kBACrCC,QAAS,CAACnF","sourcesContent":["import { Component, Input, ChangeDetectorRef, Output, EventEmitter } from \"@angular/core\";\nimport * as moment from \"moment-timezone\";\nimport { ITimeRange, ITime, TDirection } from \"./timerange.namespace\";\n\n@Component({\n selector: \"mis-timerangepicker\",\n templateUrl: \"./timerangepicker.component.html\",\n styleUrls: [\"./timerangepicker.component.scss\"]\n})\nexport class TimeRangePickerComponent {\n @Input() inputWidth: string = \"100px\";\n @Input() dropdownWidth?: string;\n @Input() height: string = \"46px\";\n @Input() timezone: string = \"Asia/Kolkata\";\n @Input() startDateEpoch: number = moment().tz(this.timezone).valueOf();\n @Input() endDateEpoch: number = moment().tz(this.timezone).valueOf();\n @Input() givenStartTime: number;\n @Input() givenEndTime: number;\n @Input() clockFormat: number = 12;\n @Input() interval: number = 15;\n @Input() showTooltip: boolean = true;\n @Input() direction: TDirection = 'row';\n @Input() gap: string = '1rem';\n\n @Output() timeRangeEmitter = new EventEmitter<ITimeRange>();\n\n startDate!: string;\n endDate!: string;\n currDate!: string;\n timeFormat!: string;\n firstIntervalForStartPicker: number = moment().valueOf();\n firstIntervalForEndPicker: number = moment().valueOf();\n startTime!: ITime;\n endTime!: ITime;\n rangeValidity: boolean = true;\n triggerChange: boolean = true;\n\n constructor(private cdr: ChangeDetectorRef) {}\n\n ngOnInit() {}\n\n ngOnChanges() {\n this.timeFormat = this.clockFormat === 12 ? \"hh:mm a\" : \"HH:mm\";\n moment.tz.setDefault(this.timezone);\n this.startDate = moment(this.startDateEpoch).format(\"DD-MM-YYYY\");\n this.endDate = moment(this.endDateEpoch).format(\"DD-MM-YYYY\");\n this.currDate = moment().format(\"DD-MM-YYYY\");\n this.setFirstIntervals();\n }\n\n // calculate the first interval of the picker\n setFirstIntervals(): void {\n const minutes = moment().minutes();\n const offset = this.interval - (minutes % this.interval);\n\n // start date, 22 MAY === current date, 22 MAY\n if( this.startDate === this.currDate ){\n const currentTime = moment(this.startDateEpoch).valueOf();\n\n // start date, 22 MAY === current date, 22 MAY === end date, 22 MAY\n if(this.startDate === this.endDate){\n\n // current time is in last interval\n if( currentTime >= moment(this.startDateEpoch).endOf(\"d\").subtract(this.interval,\"m\").valueOf()){\n this.firstIntervalForStartPicker = currentTime;\n this.firstIntervalForEndPicker = moment(this.endDateEpoch).endOf(\"d\").valueOf();\n }\n // current time isn't in last interval\n else {\n this.firstIntervalForStartPicker = moment().add(offset, \"m\").valueOf();\n this.firstIntervalForEndPicker = moment().add(offset, \"m\").add(this.interval, \"m\").valueOf();\n }\n } \n // start date, 22 MAY === current date, 22 MAY !== end date, 30 MAY\n else {\n // current time is in last interval\n if( currentTime >= moment(this.startDateEpoch).endOf(\"d\").subtract(this.interval,\"m\").valueOf()){\n this.firstIntervalForStartPicker = currentTime;\n this.firstIntervalForEndPicker = moment(this.endDateEpoch).endOf(\"d\").valueOf();\n }\n // current time isn't in last interval\n else {\n this.firstIntervalForStartPicker = moment().add(offset, \"m\").valueOf();\n this.firstIntervalForEndPicker = moment(this.endDateEpoch).valueOf();\n }\n }\n }\n // start date, 30 MAY !== current date, 22 MAY\n else {\n // start date === end Date\n if( this.startDate === this.endDate){\n this.firstIntervalForStartPicker = moment(this.startDateEpoch).startOf(\"d\").valueOf();\n this.firstIntervalForEndPicker = moment(this.endDateEpoch).add(this.interval, \"m\").valueOf();\n } \n // start date !== end date\n else {\n this.firstIntervalForStartPicker = moment(this.startDateEpoch).startOf(\"d\").valueOf();\n this.firstIntervalForEndPicker = moment(this.startDateEpoch).startOf(\"d\").valueOf();\n }\n\n }\n\n if(this.givenStartTime)\n this.firstIntervalForStartPicker = this.givenStartTime;\n \n if(this.givenEndTime)\n this.firstIntervalForEndPicker = this.givenEndTime;\n \n this.startTime = {\n valid: true,\n time: moment(this.firstIntervalForStartPicker).format(this.timeFormat),\n epoch: moment(this.firstIntervalForStartPicker).valueOf()\n };\n\n this.endTime = {\n valid: true,\n time: moment(this.firstIntervalForEndPicker).format(this.timeFormat),\n epoch: moment(this.firstIntervalForEndPicker).valueOf()\n };\n }\n\n emitTimeRange(data: ITimeRange): void {\n this.timeRangeEmitter.emit(data);\n }\n\n //handlers catch the emitted values and run validation\n startPickerHandler(time: ITime): void {\n this.startTime = time;\n this.rangeValidity = true;\n // if the start time changes and the start date is the same as the end date\n // and the start time >= end time\n // update the first interval of end picker according to the time set in start picker\n if (this.startDate === this.endDate) {\n let minutes = moment(this.startTime.time, this.timeFormat).minutes();\n let offset = this.interval - (minutes % this.interval);\n this.firstIntervalForEndPicker = moment(`${this.startDate} ${this.startTime.time}`, `'DD-MM-YYYY' ${this.timeFormat}`)\n .add(offset, \"m\")\n .valueOf();\n\n // if the first interval == 12:00am, set it as 11:59pm\n const intervalAsString = moment(this.firstIntervalForEndPicker).format(this.timeFormat);\n const endOfDayAsString = moment(moment(`${this.startDate}`, `DD-MM-YYYY ${this.timeFormat}`).endOf(\"d\").add(1, \"m\")).format(this.timeFormat);\n if (intervalAsString === endOfDayAsString) {\n this.firstIntervalForEndPicker = moment(`${this.startDate} ${this.startTime.time}`, `'DD-MM-YYYY' ${this.timeFormat}`).endOf(\"d\").valueOf();\n }\n\n } else {\n const validity =\n this.checkTimeValidity(this.startTime.time.trim(), this.startDateEpoch) &&\n this.checkTimeValidity(this.endTime.time.trim(), this.endDateEpoch);\n\n this.rangeValidation(validity);\n this.emitTimeRange({\n valid: validity && this.rangeValidity,\n startTime: this.startTime.time,\n endTime: this.endTime.time,\n startEpoch: moment(`${this.startDate} ${this.startTime.time}`, `DD-MM-YYYY ${this.timeFormat}`).valueOf(),\n endEpoch: moment(`${this.endDate} ${this.endTime.time}`, `DD-MM-YYYY ${this.timeFormat}`).valueOf()\n });\n }\n\n this.triggerChange = !this.triggerChange;\n }\n\n endPickerHandler(time: ITime): void {\n this.endTime = time;\n\n const validity =\n this.checkTimeValidity(this.startTime.time.trim(), this.startDateEpoch) && this.checkTimeValidity(this.endTime.time.trim(), this.endDateEpoch);\n\n this.rangeValidation(validity);\n this.emitTimeRange({\n valid: validity && this.rangeValidity,\n startTime: this.startTime.time,\n endTime: this.endTime.time,\n startEpoch: moment(`${this.startDate} ${this.startTime.time}`, `DD-MM-YYYY ${this.timeFormat}`).valueOf(),\n endEpoch: moment(`${this.endDate} ${this.endTime.time}`, `DD-MM-YYYY ${this.timeFormat}`).valueOf()\n });\n }\n\n checkTimeValidity(time: string, date: number): boolean {\n const RE12 = /^(([0][1-9]|1[0-2]):([0-5][0-9])( )?(am|pm|AM|PM))$/i;\n const RE24 = /^([01][0-9]|2[0-3]):[0-5][0-9]$/;\n const RE = this.clockFormat === 12 ? RE12 : RE24;\n\n const timeMoment = moment(`${moment(date).format(\"DD-MM-YYYY\")} ${time}`, `'DD-MM-YYYY' ${this.timeFormat}`);\n let flag: boolean = false;\n\n // if the first interval is set to the start of the day\n // then we don't check its validity against the current time\n if ((this.givenStartTime && this.givenEndTime) || (this.startDate !== this.endDate && this.startDate !== this.currDate)) {\n flag = time.match(RE) ? true : false;\n } else {\n flag = time.match(RE) && timeMoment.diff(moment(), \"m\") >= 0 ? true : false;\n }\n\n return flag;\n }\n\n // validates end picker's input according to the start picker's input\n rangeValidation(validity: boolean) {\n if (validity && this.startDate === this.endDate) {\n const startMoment = moment(this.startTime.time, this.timeFormat);\n const endMoment = moment(this.endTime.time, this.timeFormat);\n this.rangeValidity = endMoment.diff(startMoment, \"m\") >= 1 ? true : false;\n this.cdr.detectChanges();\n }\n }\n}\n","import { NgModule, ModuleWithProviders } from \"@angular/core\";\nimport { CommonModule } from '@angular/common';\nimport { FormsModule } from '@angular/forms';\nimport { TimeRangePickerComponent } from \"./timerangepicker.component\";\nimport { TimePickerModule } from \"mis-crystal-design-system/timepicker\";\n\n@NgModule({\n declarations: [TimeRangePickerComponent],\n imports: [CommonModule, FormsModule, TimePickerModule],\n exports: [TimeRangePickerComponent]\n})\nexport class TimeRangePickerModule {\n static forRoot(): ModuleWithProviders<TimeRangePickerModule> {\n return { ngModule: TimeRangePickerModule, providers: [] };\n }\n}"]}