mis-crystal-design-system 2.9.9 → 3.0.1
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.
- package/bundles/mis-crystal-design-system-timepicker.umd.js +643 -0
- package/bundles/mis-crystal-design-system-timepicker.umd.js.map +1 -0
- package/bundles/mis-crystal-design-system-timepicker.umd.min.js +16 -0
- package/bundles/mis-crystal-design-system-timepicker.umd.min.js.map +1 -0
- package/bundles/mis-crystal-design-system-timerangepicker.umd.js +211 -0
- package/bundles/mis-crystal-design-system-timerangepicker.umd.js.map +1 -0
- package/bundles/mis-crystal-design-system-timerangepicker.umd.min.js +2 -0
- package/bundles/mis-crystal-design-system-timerangepicker.umd.min.js.map +1 -0
- package/esm2015/timepicker/index.js +2 -0
- package/esm2015/timepicker/mis-crystal-design-system-timepicker.js +6 -0
- package/esm2015/timepicker/public_api.js +3 -0
- package/esm2015/timepicker/time.namespace.js +2 -0
- package/esm2015/timepicker/timepicker.component.js +202 -0
- package/esm2015/timepicker/timepicker.directive.js +62 -0
- package/esm2015/timepicker/timepicker.module.js +20 -0
- package/esm2015/timerangepicker/index.js +2 -0
- package/esm2015/timerangepicker/mis-crystal-design-system-timerangepicker.js +5 -0
- package/esm2015/timerangepicker/public_api.js +3 -0
- package/esm2015/timerangepicker/timerange.namespace.js +2 -0
- package/esm2015/timerangepicker/timerangepicker.component.js +157 -0
- package/esm2015/timerangepicker/timerangepicker.module.js +18 -0
- package/fesm2015/mis-crystal-design-system-timepicker.js +285 -0
- package/fesm2015/mis-crystal-design-system-timepicker.js.map +1 -0
- package/fesm2015/mis-crystal-design-system-timerangepicker.js +181 -0
- package/fesm2015/mis-crystal-design-system-timerangepicker.js.map +1 -0
- package/package.json +1 -1
- package/timepicker/index.d.ts +1 -0
- package/timepicker/mis-crystal-design-system-timepicker.d.ts +5 -0
- package/timepicker/mis-crystal-design-system-timepicker.metadata.json +1 -0
- package/timepicker/package.json +11 -0
- package/timepicker/public_api.d.ts +2 -0
- package/timepicker/time.namespace.d.ts +5 -0
- package/timepicker/timepicker.component.d.ts +40 -0
- package/timepicker/timepicker.directive.d.ts +16 -0
- package/timepicker/timepicker.module.d.ts +4 -0
- package/timerangepicker/index.d.ts +1 -0
- package/timerangepicker/mis-crystal-design-system-timerangepicker.d.ts +4 -0
- package/timerangepicker/mis-crystal-design-system-timerangepicker.metadata.json +1 -0
- package/timerangepicker/package.json +11 -0
- package/timerangepicker/public_api.d.ts +2 -0
- package/timerangepicker/timerange.namespace.d.ts +12 -0
- package/timerangepicker/timerangepicker.component.d.ts +32 -0
- package/timerangepicker/timerangepicker.module.d.ts +4 -0
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
import { EventEmitter, Directive, TemplateRef, ViewContainerRef, Input, Output, Component, ViewChild, ViewChildren, NgModule } from '@angular/core';
|
|
2
|
+
import * as moment from 'moment-timezone';
|
|
3
|
+
import { tz } from 'moment-timezone';
|
|
4
|
+
import { ConnectionPositionPair, OverlayConfig, Overlay, OverlayModule } from '@angular/cdk/overlay';
|
|
5
|
+
import { TemplatePortal } from '@angular/cdk/portal';
|
|
6
|
+
import { CommonModule } from '@angular/common';
|
|
7
|
+
import { FormsModule } from '@angular/forms';
|
|
8
|
+
import { ToolTipModule } from 'mis-crystal-design-system/tooltip';
|
|
9
|
+
|
|
10
|
+
class TimepickerDirective {
|
|
11
|
+
constructor(templateRef, overlay, viewContainerRef) {
|
|
12
|
+
this.templateRef = templateRef;
|
|
13
|
+
this.overlay = overlay;
|
|
14
|
+
this.viewContainerRef = viewContainerRef;
|
|
15
|
+
this.openStatus = false;
|
|
16
|
+
this.statusEmitter = new EventEmitter();
|
|
17
|
+
}
|
|
18
|
+
set createOverlayOnInput(openStatus) {
|
|
19
|
+
this.openStatus = openStatus;
|
|
20
|
+
if (this.originEl && this.openStatus)
|
|
21
|
+
this.createOverlay(this.originEl);
|
|
22
|
+
}
|
|
23
|
+
;
|
|
24
|
+
createOverlay(origin) {
|
|
25
|
+
const positions = [
|
|
26
|
+
new ConnectionPositionPair({ originX: "start", originY: "bottom" }, { overlayX: "start", overlayY: "top" }, 0, 4),
|
|
27
|
+
new ConnectionPositionPair({ originX: "end", originY: "bottom" }, { overlayX: "end", overlayY: "top" }, 0, 4)
|
|
28
|
+
];
|
|
29
|
+
const overlayConfig = new OverlayConfig({
|
|
30
|
+
hasBackdrop: true,
|
|
31
|
+
backdropClass: "cdk-overlay-transparent-backdrop",
|
|
32
|
+
positionStrategy: this.overlay
|
|
33
|
+
.position()
|
|
34
|
+
//connecting the dropdown overlay to the input element
|
|
35
|
+
.flexibleConnectedTo(origin)
|
|
36
|
+
.withPositions([...positions])
|
|
37
|
+
.withPush(true)
|
|
38
|
+
});
|
|
39
|
+
this.overlayRef = this.overlay.create(overlayConfig);
|
|
40
|
+
const dropdownPortal = new TemplatePortal(this.templateRef, this.viewContainerRef);
|
|
41
|
+
this.overlayRef.attach(dropdownPortal);
|
|
42
|
+
this.overlayRef.backdropClick().subscribe(resp => {
|
|
43
|
+
this.openStatus = false;
|
|
44
|
+
this.statusEmitter.emit(false);
|
|
45
|
+
this.overlayRef.detach();
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
destroyOverlay() {
|
|
49
|
+
this.overlayRef.detach();
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
TimepickerDirective.decorators = [
|
|
53
|
+
{ type: Directive, args: [{
|
|
54
|
+
selector: '[libTimepicker]'
|
|
55
|
+
},] }
|
|
56
|
+
];
|
|
57
|
+
TimepickerDirective.ctorParameters = () => [
|
|
58
|
+
{ type: TemplateRef },
|
|
59
|
+
{ type: Overlay },
|
|
60
|
+
{ type: ViewContainerRef }
|
|
61
|
+
];
|
|
62
|
+
TimepickerDirective.propDecorators = {
|
|
63
|
+
originEl: [{ type: Input, args: ['originEl',] }],
|
|
64
|
+
statusEmitter: [{ type: Output }],
|
|
65
|
+
createOverlayOnInput: [{ type: Input, args: ['openStatus',] }]
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
class TimePickerComponent {
|
|
69
|
+
constructor() {
|
|
70
|
+
this.openStatus = false;
|
|
71
|
+
this.isHighlighted = 0;
|
|
72
|
+
this.isInvalid = false;
|
|
73
|
+
this.timeIntervals = [];
|
|
74
|
+
this.shouldScroll = false;
|
|
75
|
+
this.userInputFlag = false;
|
|
76
|
+
this.clockFormat = 12;
|
|
77
|
+
this.timezone = "Asia/Kolkata";
|
|
78
|
+
this.height = "max-content";
|
|
79
|
+
this.inputWidth = "100px";
|
|
80
|
+
this.interval = 15;
|
|
81
|
+
this.dateAsEpoch = moment().valueOf();
|
|
82
|
+
this.rangeValidity = true;
|
|
83
|
+
this.timeEmitter = new EventEmitter();
|
|
84
|
+
}
|
|
85
|
+
// gets all the li elements from the dropdown and scrolls to the highlighted element
|
|
86
|
+
set timeIntervalRefs(intervals) {
|
|
87
|
+
intervals.forEach(interval => {
|
|
88
|
+
if (interval.nativeElement.classList[0] === "highlight") {
|
|
89
|
+
const highlighted = interval.nativeElement;
|
|
90
|
+
setTimeout(() => highlighted.scrollIntoView({ behavior: "smooth", block: "center" }));
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
ngOnInit() {
|
|
95
|
+
this.timeFormat = this.clockFormat === 12 ? "hh:mm a" : "HH:mm";
|
|
96
|
+
this.populateDropdown();
|
|
97
|
+
this.chosenTime = this.timeIntervals[0];
|
|
98
|
+
this.calculateClosestInterval(this.chosenTime);
|
|
99
|
+
const chosenTimeMoment = this.getMoment(this.chosenTime);
|
|
100
|
+
this.emitTime({
|
|
101
|
+
valid: !this.isInvalid,
|
|
102
|
+
time: this.chosenTime,
|
|
103
|
+
epoch: chosenTimeMoment.valueOf()
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
ngOnChanges() {
|
|
107
|
+
tz.setDefault(this.timezone);
|
|
108
|
+
this.currTime = moment().format();
|
|
109
|
+
if (this.timeFormat) {
|
|
110
|
+
// if the first interval is >= the chosen time
|
|
111
|
+
// then only update the value of chosen time
|
|
112
|
+
// else it remains the same
|
|
113
|
+
const chosenTimeMoment = this.getMoment(this.chosenTime);
|
|
114
|
+
if (this.firstInterval >= chosenTimeMoment.valueOf() && this.rangeValidity && !this.userInputFlag) {
|
|
115
|
+
this.chosenTime = moment(this.firstInterval).format(this.timeFormat);
|
|
116
|
+
}
|
|
117
|
+
if (!this.userInputFlag)
|
|
118
|
+
this.populateDropdown();
|
|
119
|
+
this.userInputFlag = false;
|
|
120
|
+
this.isInvalid = !this.checkTimeValidity(this.chosenTime.trim());
|
|
121
|
+
this.emitTime({
|
|
122
|
+
valid: !this.isInvalid,
|
|
123
|
+
time: this.chosenTime,
|
|
124
|
+
epoch: chosenTimeMoment.valueOf()
|
|
125
|
+
});
|
|
126
|
+
this.calculateClosestInterval(this.chosenTime);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
emitTime(data) {
|
|
130
|
+
this.timeEmitter.emit(data);
|
|
131
|
+
}
|
|
132
|
+
// function to get moment object when time is given in string
|
|
133
|
+
getMoment(time) {
|
|
134
|
+
return moment(`${moment(this.dateAsEpoch).format("DD-MM-YYYY")} ${time}`, `'DD-MM-YYYY' ${this.timeFormat}`);
|
|
135
|
+
}
|
|
136
|
+
// gets a boolean from overlay event to close the dropdown
|
|
137
|
+
closeDropdown(val) {
|
|
138
|
+
this.openStatus = val;
|
|
139
|
+
}
|
|
140
|
+
// toggle timepicker dropdown
|
|
141
|
+
openDropdown() {
|
|
142
|
+
this.openStatus = true;
|
|
143
|
+
}
|
|
144
|
+
checkTimeValidity(time) {
|
|
145
|
+
const RE12 = /^(([0][1-9]|1[0-2]):([0-5][0-9])( )?(am|pm|AM|PM))$/i;
|
|
146
|
+
const RE24 = /^([01][0-9]|2[0-3]):[0-5][0-9]$/;
|
|
147
|
+
const RE = this.clockFormat === 12 ? RE12 : RE24;
|
|
148
|
+
const timeMoment = this.getMoment(time);
|
|
149
|
+
let flag = false;
|
|
150
|
+
// if the first interval is set to the start of the day
|
|
151
|
+
// then we don't check its validity against the current time
|
|
152
|
+
if (this.firstInterval &&
|
|
153
|
+
moment(this.firstInterval).format(this.timeFormat).valueOf() === moment().startOf("d").format(this.timeFormat).valueOf()) {
|
|
154
|
+
flag = time.match(RE) ? true : false;
|
|
155
|
+
}
|
|
156
|
+
else {
|
|
157
|
+
flag = time.match(RE) && timeMoment.isAfter(moment()) ? true : false;
|
|
158
|
+
}
|
|
159
|
+
return flag;
|
|
160
|
+
}
|
|
161
|
+
// update chosen time as soon as the user clicks on an interval
|
|
162
|
+
onTimeSelect(time) {
|
|
163
|
+
this.isInvalid = !this.checkTimeValidity(time.trim());
|
|
164
|
+
if (!this.isInvalid) {
|
|
165
|
+
this.chosenTime = time;
|
|
166
|
+
this.calculateClosestInterval(this.chosenTime);
|
|
167
|
+
}
|
|
168
|
+
const timeMoment = this.getMoment(time);
|
|
169
|
+
this.emitTime({
|
|
170
|
+
valid: !this.isInvalid,
|
|
171
|
+
time: time,
|
|
172
|
+
epoch: timeMoment.valueOf()
|
|
173
|
+
});
|
|
174
|
+
this.openStatus = false;
|
|
175
|
+
if (this.timepickerDirective)
|
|
176
|
+
this.timepickerDirective.destroyOverlay();
|
|
177
|
+
}
|
|
178
|
+
// checks validity of time on input change and calculates the closest interval
|
|
179
|
+
onTimeChange(time) {
|
|
180
|
+
this.isInvalid = !this.checkTimeValidity(time.trim());
|
|
181
|
+
if (!this.isInvalid) {
|
|
182
|
+
this.userInputFlag = true;
|
|
183
|
+
this.calculateClosestInterval(time);
|
|
184
|
+
}
|
|
185
|
+
const timeMoment = this.getMoment(time);
|
|
186
|
+
this.emitTime({
|
|
187
|
+
valid: !this.isInvalid,
|
|
188
|
+
time: time,
|
|
189
|
+
epoch: timeMoment.valueOf()
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
calculateClosestInterval(time) {
|
|
193
|
+
const intervalMS = this.interval * 60 * 1000;
|
|
194
|
+
const chosenDate = moment(this.dateAsEpoch).format("DD-MM-YYYY");
|
|
195
|
+
// converting time passed as parameter to moment object and adding date
|
|
196
|
+
const parsedTimeWithDate = moment(`${chosenDate} ${time}`, `DD-MM-YYYY ${this.timeFormat}`);
|
|
197
|
+
// converting moment object to epoch so that calculations for rounding off are easier to do
|
|
198
|
+
const currEpoch = parsedTimeWithDate.valueOf();
|
|
199
|
+
const offset = currEpoch % intervalMS;
|
|
200
|
+
const roundedEpoch = offset >= intervalMS / 2 ? currEpoch + (intervalMS - offset) : currEpoch - offset;
|
|
201
|
+
// finding the index of element that needs to be highlighted
|
|
202
|
+
this.timeIntervals.forEach((interval, index, array) => {
|
|
203
|
+
const intervalObj = moment(`${chosenDate} ${interval}`, `DD-MM-YYYY ${this.timeFormat}`);
|
|
204
|
+
if (intervalObj.valueOf() === roundedEpoch)
|
|
205
|
+
this.isHighlighted = index;
|
|
206
|
+
if (array.length === 1)
|
|
207
|
+
this.isHighlighted = 0;
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
// populates the dropdown according to the first interval received
|
|
211
|
+
populateDropdown() {
|
|
212
|
+
this.timeIntervals = [];
|
|
213
|
+
// if picker is used as an individual component
|
|
214
|
+
if (!this.firstInterval) {
|
|
215
|
+
// firstInterval is initialised according to the current time
|
|
216
|
+
// if the date is same as the current date
|
|
217
|
+
if (moment(this.dateAsEpoch).format("DD-MM-YYYY") === moment().format("DD-MM-YYYY")) {
|
|
218
|
+
const offset = this.interval - (moment().minutes() % this.interval);
|
|
219
|
+
this.firstInterval = moment().add(offset, "m").valueOf();
|
|
220
|
+
}
|
|
221
|
+
// else the firstInterval is initialised as start of day
|
|
222
|
+
else {
|
|
223
|
+
this.firstInterval = moment().startOf("d").valueOf();
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
const dateAsString = moment(this.dateAsEpoch).format('DD-MM-YYYY');
|
|
227
|
+
const intervalAsString = moment(this.firstInterval).format(this.timeFormat);
|
|
228
|
+
const start = moment(`${dateAsString} ${intervalAsString}`, `DD-MM-YYYY ${this.timeFormat}`);
|
|
229
|
+
const end = moment(`${dateAsString}`, 'DD-MM-YYYY').endOf('d');
|
|
230
|
+
while (start.valueOf() < end.valueOf()) {
|
|
231
|
+
this.timeIntervals.push(start.format(this.timeFormat));
|
|
232
|
+
start.add(this.interval, "m");
|
|
233
|
+
}
|
|
234
|
+
// if the start time is equal to the interval just before midnight
|
|
235
|
+
// and the start date = end date
|
|
236
|
+
// push 11:59pm only
|
|
237
|
+
if (this.timeIntervals.length === 0) {
|
|
238
|
+
this.chosenTime = moment().endOf("d").format(this.timeFormat);
|
|
239
|
+
this.timeIntervals.push(moment().endOf("d").format(this.timeFormat));
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
TimePickerComponent.decorators = [
|
|
244
|
+
{ type: Component, args: [{
|
|
245
|
+
selector: "mis-timepicker",
|
|
246
|
+
template: "<div class=\"timepicker-container\" [ngStyle]=\"{ height: height }\">\n <input\n type=\"text\"\n [(ngModel)]=\"chosenTime\"\n (ngModelChange)=\"onTimeChange(chosenTime)\"\n [ngClass]=\"{ invalid: isInvalid || !rangeValidity }\"\n [ngStyle]=\"{ width: inputWidth }\"\n (click)=\"openDropdown()\"\n misToolTip\n [showToolTip]=\"isInvalid || !rangeValidity\"\n [text]=\"'Invalid Time'\"\n [position]=\"'top'\"\n [showOnHover]=\"false\"\n #input\n cdkOverlayOrigin\n class=\"p\"\n />\n\n <ng-template #dropdownContainer libDropdownScroll libTimepicker [originEl]=\"input\" [openStatus]=\"openStatus\" (statusEmitter)=\"closeDropdown($event)\">\n <div *ngIf=\"openStatus\" class=\"timepicker-dropdown\" [ngStyle]=\"{ width: dropdownWidth || inputWidth }\">\n <ul #dropdown>\n <li #timeInterval (click)=\"onTimeSelect(interval)\" *ngFor=\"let interval of timeIntervals; index as i\" [ngClass]=\"{ highlight: i === isHighlighted }\">\n {{ interval }}\n <div class=\"ic-ui-check-24 selected-icon\" *ngIf=\"interval === chosenTime\"></div>\n </li>\n </ul>\n </div>\n </ng-template>\n</div>\n",
|
|
247
|
+
styles: [".h1{font-size:40px;line-height:48px}.h1,.h2{font-weight:400;letter-spacing:0}.h2{font-size:32px;line-height:40px}.h3{font-size:28px;line-height:36px}.h3,.h4{font-weight:400;letter-spacing:0}.h4{font-size:24px;line-height:32px}.h5-b{font-weight:700;letter-spacing:.25px}.h5,.h5-b{font-size:20px;line-height:28px}.h5{font-weight:400;letter-spacing:.15px}.h6-b{font-weight:700}.h6,.h6-b{font-size:16px;letter-spacing:0;line-height:24px}.h6,.p{font-weight:400}.p{font-size:16px;letter-spacing:0;line-height:180%}.h7-b{font-weight:700;letter-spacing:.25px}.h7,.h7-b{font-size:14px;line-height:20px}.h7{font-weight:400;letter-spacing:.2px}.h8-b{font-weight:700;letter-spacing:.25px}.h8,.h8-b{font-size:12px;line-height:18px}.h8{letter-spacing:.2px}.h8,.h9{font-weight:400}.h9{font-size:10px;letter-spacing:0;line-height:15px}.btn-lg-b{font-weight:700;letter-spacing:.5px}.btn-lg,.btn-lg-b{font-size:16px;line-height:24px}.btn-lg{font-weight:400;letter-spacing:.2px}.btn-sm{font-size:14px;font-weight:400;letter-spacing:.25px;line-height:20px}.btn-link{font-size:16px;line-height:24px}.btn-link,.display-1{font-weight:400;letter-spacing:0}.display-1{font-size:48px;line-height:56px}.display-2{font-size:14px;font-weight:400;letter-spacing:.5px;line-height:20px}*{box-sizing:border-box;font-family:Lato}.timepicker-container{display:inline-block;position:relative}input{text-align:center;border:none;border-bottom:1px solid #e0e0e0;outline:none;height:100%;width:100px;padding:4px 16px}input:hover{background:#f5f7fc}input:active,input:focus{background:#e6ebf7;border-bottom:1px solid #0937b2}.timepicker-dropdown{position:absolute;top:calc(100% + 4px);left:0;max-height:200px;overflow-y:auto;border:1px solid #e0e0e0;box-shadow:0 12px 24px rgba(0,0,0,.12),0 4px 8px rgba(0,0,0,.12);border-radius:4px;padding:8px;background:#fff}.timepicker-dropdown::-webkit-scrollbar{display:none}.timepicker-dropdown ul{margin:0;padding:0}.timepicker-dropdown li{text-align:start;list-style:none;padding:6px 12px;cursor:pointer;font-size:16px;color:#181f33;display:flex;justify-content:space-between;align-items:center}.timepicker-dropdown li:hover{background:#f5f7fc;border-radius:6px}.timepicker-dropdown li .selected-icon{font-weight:900}.highlight{background-color:#f5f7fc;border-radius:6px}.invalid{background:#fae1ea!important;border-bottom:1px solid #b00020!important}"]
|
|
248
|
+
},] }
|
|
249
|
+
];
|
|
250
|
+
TimePickerComponent.ctorParameters = () => [];
|
|
251
|
+
TimePickerComponent.propDecorators = {
|
|
252
|
+
clockFormat: [{ type: Input }],
|
|
253
|
+
timezone: [{ type: Input }],
|
|
254
|
+
height: [{ type: Input }],
|
|
255
|
+
inputWidth: [{ type: Input }],
|
|
256
|
+
dropdownWidth: [{ type: Input }],
|
|
257
|
+
interval: [{ type: Input }],
|
|
258
|
+
dateAsEpoch: [{ type: Input }],
|
|
259
|
+
firstInterval: [{ type: Input }],
|
|
260
|
+
rangeValidity: [{ type: Input }],
|
|
261
|
+
timeEmitter: [{ type: Output }],
|
|
262
|
+
input: [{ type: ViewChild, args: ["input", { static: true },] }],
|
|
263
|
+
timepickerDirective: [{ type: ViewChild, args: [TimepickerDirective,] }],
|
|
264
|
+
timeIntervalRefs: [{ type: ViewChildren, args: ["timeInterval",] }]
|
|
265
|
+
};
|
|
266
|
+
|
|
267
|
+
class TimePickerModule {
|
|
268
|
+
static forRoot() {
|
|
269
|
+
return { ngModule: TimePickerModule, providers: [] };
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
TimePickerModule.decorators = [
|
|
273
|
+
{ type: NgModule, args: [{
|
|
274
|
+
declarations: [TimePickerComponent, TimepickerDirective],
|
|
275
|
+
imports: [CommonModule, FormsModule, ToolTipModule, OverlayModule],
|
|
276
|
+
exports: [TimePickerComponent]
|
|
277
|
+
},] }
|
|
278
|
+
];
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* Generated bundle index. Do not edit.
|
|
282
|
+
*/
|
|
283
|
+
|
|
284
|
+
export { TimePickerComponent, TimePickerModule, TimepickerDirective as ɵa };
|
|
285
|
+
//# sourceMappingURL=mis-crystal-design-system-timepicker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mis-crystal-design-system-timepicker.js","sources":["../../../projects/mis-components/timepicker/timepicker.directive.ts","../../../projects/mis-components/timepicker/timepicker.component.ts","../../../projects/mis-components/timepicker/timepicker.module.ts","../../../projects/mis-components/timepicker/mis-crystal-design-system-timepicker.ts"],"sourcesContent":["import { Directive, Output, TemplateRef } from '@angular/core';\nimport { EventEmitter, Input, ViewContainerRef } from \"@angular/core\";\nimport { ConnectionPositionPair, Overlay, OverlayConfig, OverlayRef } from \"@angular/cdk/overlay\";\nimport { TemplatePortal } from \"@angular/cdk/portal\";\n\n@Directive({\n selector: '[libTimepicker]'\n})\nexport class TimepickerDirective {\n private openStatus: boolean = false;\n @Input('originEl') originEl : any;\n @Output() statusEmitter = new EventEmitter<boolean>(); \n\n @Input('openStatus') set createOverlayOnInput(openStatus){\n this.openStatus = openStatus;\n if(this.originEl && this.openStatus) this.createOverlay(this.originEl);\n }; \n private overlayRef!: OverlayRef;\n constructor(private templateRef: TemplateRef<Element>, private overlay: Overlay, private viewContainerRef: ViewContainerRef) {}\n\n createOverlay(origin: any): void {\n const positions = [\n new ConnectionPositionPair({ originX: \"start\", originY: \"bottom\" }, { overlayX: \"start\", overlayY: \"top\" }, 0, 4),\n new ConnectionPositionPair({ originX: \"end\", originY: \"bottom\" }, { overlayX: \"end\", overlayY: \"top\" }, 0, 4)\n ];\n\n const overlayConfig = new OverlayConfig({\n hasBackdrop: true,\n backdropClass: \"cdk-overlay-transparent-backdrop\",\n positionStrategy: this.overlay\n .position()\n //connecting the dropdown overlay to the input element\n .flexibleConnectedTo(origin)\n .withPositions([...positions])\n .withPush(true)\n });\n\n this.overlayRef = this.overlay.create(overlayConfig);\n const dropdownPortal = new TemplatePortal(this.templateRef, this.viewContainerRef);\n this.overlayRef.attach(dropdownPortal);\n this.overlayRef.backdropClick().subscribe(resp => {\n this.openStatus = false;\n this.statusEmitter.emit(false);\n this.overlayRef.detach();\n });\n }\n\n destroyOverlay(){\n this.overlayRef.detach();\n }\n \n}\n","import { Component, ElementRef, EventEmitter, Input, Output, ViewChild, ViewChildren } from \"@angular/core\";\nimport * as moment from \"moment-timezone\";\nimport { ITime } from \"./time.namespace\";\nimport { TimepickerDirective } from \"./timepicker.directive\";\n\n@Component({\n selector: \"mis-timepicker\",\n templateUrl: \"./timepicker.component.html\",\n styleUrls: [\"./timepicker.component.scss\"]\n})\nexport class TimePickerComponent {\n currTime!: string;\n chosenTime: string;\n openStatus: boolean = false;\n isHighlighted: number = 0;\n isInvalid: boolean = false;\n timeIntervals: string[] = [];\n shouldScroll: boolean = false;\n userInputFlag: boolean = false;\n\n @Input() clockFormat: number = 12;\n timeFormat!: string;\n\n @Input() timezone: string = \"Asia/Kolkata\";\n @Input() height: string = \"max-content\";\n @Input() inputWidth: string = \"100px\";\n @Input() dropdownWidth?: string;\n @Input() interval: number = 15;\n @Input() dateAsEpoch: number = moment().valueOf();\n @Input() firstInterval!: number;\n @Input() rangeValidity: boolean = true;\n\n @Output() timeEmitter = new EventEmitter<ITime>();\n @ViewChild(\"input\", { static: true }) input: ElementRef;\n @ViewChild(TimepickerDirective) timepickerDirective: TimepickerDirective;\n\n // gets all the li elements from the dropdown and scrolls to the highlighted element\n @ViewChildren(\"timeInterval\") set timeIntervalRefs(intervals) {\n intervals.forEach(interval => {\n if (interval.nativeElement.classList[0] === \"highlight\") {\n const highlighted = interval.nativeElement;\n setTimeout(() => highlighted.scrollIntoView({ behavior: \"smooth\", block: \"center\" }));\n }\n });\n }\n\n constructor(){}\n ngOnInit(): void {\n this.timeFormat = this.clockFormat === 12 ? \"hh:mm a\" : \"HH:mm\";\n this.populateDropdown();\n this.chosenTime = this.timeIntervals[0];\n this.calculateClosestInterval(this.chosenTime);\n\n const chosenTimeMoment = this.getMoment(this.chosenTime);\n this.emitTime({\n valid: !this.isInvalid,\n time: this.chosenTime,\n epoch: chosenTimeMoment.valueOf()\n });\n }\n\n ngOnChanges(): void {\n moment.tz.setDefault(this.timezone);\n this.currTime = moment().format();\n if (this.timeFormat) {\n // if the first interval is >= the chosen time\n // then only update the value of chosen time\n // else it remains the same\n const chosenTimeMoment = this.getMoment(this.chosenTime);\n\n if (this.firstInterval >= chosenTimeMoment.valueOf() && this.rangeValidity && !this.userInputFlag) {\n this.chosenTime = moment(this.firstInterval).format(this.timeFormat);\n }\n if (!this.userInputFlag) this.populateDropdown();\n this.userInputFlag = false;\n this.isInvalid = !this.checkTimeValidity(this.chosenTime.trim());\n this.emitTime({\n valid: !this.isInvalid,\n time: this.chosenTime,\n epoch: chosenTimeMoment.valueOf()\n });\n this.calculateClosestInterval(this.chosenTime);\n }\n }\n\n emitTime(data: ITime): void {\n this.timeEmitter.emit(data);\n }\n\n // function to get moment object when time is given in string\n getMoment(time: string){\n return moment(`${moment(this.dateAsEpoch).format(\"DD-MM-YYYY\")} ${time}`, `'DD-MM-YYYY' ${this.timeFormat}`)\n }\n\n // gets a boolean from overlay event to close the dropdown\n closeDropdown(val: boolean) {\n this.openStatus = val;\n }\n\n // toggle timepicker dropdown\n openDropdown(): void {\n this.openStatus = true;\n }\n\n checkTimeValidity(time: string): 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 = this.getMoment(time);\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 (\n this.firstInterval &&\n moment(this.firstInterval).format(this.timeFormat).valueOf() === moment().startOf(\"d\").format(this.timeFormat).valueOf()\n ) {\n flag = time.match(RE) ? true : false;\n } else {\n flag = time.match(RE) && timeMoment.isAfter(moment()) ? true: false;\n }\n\n return flag;\n }\n\n // update chosen time as soon as the user clicks on an interval\n onTimeSelect(time: string): void {\n this.isInvalid = !this.checkTimeValidity(time.trim());\n if (!this.isInvalid) {\n this.chosenTime = time;\n this.calculateClosestInterval(this.chosenTime);\n }\n\n const timeMoment = this.getMoment(time);\n this.emitTime({\n valid: !this.isInvalid,\n time: time,\n epoch: timeMoment.valueOf() \n });\n this.openStatus = false;\n if (this.timepickerDirective) this.timepickerDirective.destroyOverlay();\n }\n\n // checks validity of time on input change and calculates the closest interval\n onTimeChange(time: string): void {\n this.isInvalid = !this.checkTimeValidity(time.trim());\n if (!this.isInvalid) {\n this.userInputFlag = true;\n this.calculateClosestInterval(time);\n }\n const timeMoment = this.getMoment(time);\n this.emitTime({\n valid: !this.isInvalid,\n time: time,\n epoch: timeMoment.valueOf() \n });\n }\n\n calculateClosestInterval(time: string): void {\n const intervalMS = this.interval * 60 * 1000;\n const chosenDate = moment(this.dateAsEpoch).format(\"DD-MM-YYYY\");\n\n // converting time passed as parameter to moment object and adding date\n const parsedTimeWithDate = moment(`${chosenDate} ${time}`, `DD-MM-YYYY ${this.timeFormat}`);\n\n // converting moment object to epoch so that calculations for rounding off are easier to do\n const currEpoch = parsedTimeWithDate.valueOf();\n\n const offset = currEpoch % intervalMS;\n const roundedEpoch = offset >= intervalMS / 2 ? currEpoch + (intervalMS - offset) : currEpoch - offset;\n\n // finding the index of element that needs to be highlighted\n this.timeIntervals.forEach((interval, index, array) => {\n const intervalObj = moment(`${chosenDate} ${interval}`, `DD-MM-YYYY ${this.timeFormat}`);\n if (intervalObj.valueOf() === roundedEpoch) this.isHighlighted = index;\n if (array.length === 1) this.isHighlighted = 0;\n });\n }\n\n // populates the dropdown according to the first interval received\n populateDropdown(): void {\n this.timeIntervals = [];\n\n // if picker is used as an individual component\n if (!this.firstInterval) {\n // firstInterval is initialised according to the current time\n // if the date is same as the current date\n if (moment(this.dateAsEpoch).format(\"DD-MM-YYYY\") === moment().format(\"DD-MM-YYYY\")) {\n const offset = this.interval - (moment().minutes() % this.interval);\n this.firstInterval = moment().add(offset, \"m\").valueOf();\n }\n\n // else the firstInterval is initialised as start of day\n else {\n this.firstInterval = moment().startOf(\"d\").valueOf();\n }\n }\n\n const dateAsString = moment(this.dateAsEpoch).format('DD-MM-YYYY');\n const intervalAsString = moment(this.firstInterval).format(this.timeFormat);\n const start = moment(`${dateAsString} ${intervalAsString}`, `DD-MM-YYYY ${this.timeFormat}`);\n const end = moment(`${dateAsString}`, 'DD-MM-YYYY').endOf('d');\n\n while (start.valueOf() < end.valueOf()) {\n this.timeIntervals.push(start.format(this.timeFormat));\n start.add(this.interval, \"m\");\n }\n\n // if the start time is equal to the interval just before midnight\n // and the start date = end date\n // push 11:59pm only\n if (this.timeIntervals.length === 0) {\n this.chosenTime = moment().endOf(\"d\").format(this.timeFormat);\n this.timeIntervals.push(moment().endOf(\"d\").format(this.timeFormat));\n }\n }\n}\n","import { NgModule, ModuleWithProviders } from \"@angular/core\";\nimport { CommonModule } from '@angular/common';\nimport { FormsModule } from '@angular/forms';\nimport { TimePickerComponent } from \"./timepicker.component\";\nimport { ToolTipModule } from \"mis-crystal-design-system/tooltip\";\nimport { OverlayModule } from '@angular/cdk/overlay';\nimport { TimepickerDirective } from './timepicker.directive';\n\n@NgModule({\n declarations: [TimePickerComponent, TimepickerDirective],\n imports: [CommonModule, FormsModule, ToolTipModule, OverlayModule],\n exports: [TimePickerComponent]\n})\nexport class TimePickerModule {\n static forRoot(): ModuleWithProviders<TimePickerModule> {\n return { ngModule: TimePickerModule, providers: [] };\n }\n}","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n\nexport {TimepickerDirective as ɵa} from './timepicker.directive';"],"names":["moment.tz"],"mappings":";;;;;;;;;MAQa,mBAAmB;IAU9B,YAAoB,WAAiC,EAAU,OAAgB,EAAU,gBAAkC;QAAvG,gBAAW,GAAX,WAAW,CAAsB;QAAU,YAAO,GAAP,OAAO,CAAS;QAAU,qBAAgB,GAAhB,gBAAgB,CA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CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;SAC/B;;;;QAKD,IAAI,IAAI,CAAC,aAAa,CAAC,MAAM,KAAK,CAAC,EAAE;YACnC,IAAI,CAAC,UAAU,GAAG,MAAM,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;YAC9D,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC;SACtE;KACF;;;YAnNF,SAAS,SAAC;gBACT,QAAQ,EAAE,gBAAgB;gBAC1B,oqCAA0C;;aAE3C;;;;0BAWE,KAAK;uBAGL,KAAK;qBACL,KAAK;yBACL,KAAK;4BACL,KAAK;uBACL,KAAK;0BACL,KAAK;4BACL,KAAK;4BACL,KAAK;0BAEL,MAAM;oBACN,SAAS,SAAC,OAAO,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE;kCACnC,SAAS,SAAC,mBAAmB;+BAG7B,YAAY,SAAC,cAAc;;;MCxBjB,gBAAgB;IAC3B,OAAO,OAAO;QACZ,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC;KACtD;;;YARF,QAAQ,SAAC;gBACR,YAAY,EAAE,CAAC,mBAAmB,EAAE,mBAAmB,CAAC;gBACxD,OAAO,EAAE,CAAC,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,aAAa,CAAC;gBAClE,OAAO,EAAE,CAAC,mBAAmB,CAAC;aAC/B;;;ACZD;;;;;;"}
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import { EventEmitter, Component, ChangeDetectorRef, Input, Output, NgModule } from '@angular/core';
|
|
2
|
+
import * as moment from 'moment-timezone';
|
|
3
|
+
import { tz } from 'moment-timezone';
|
|
4
|
+
import { CommonModule } from '@angular/common';
|
|
5
|
+
import { FormsModule } from '@angular/forms';
|
|
6
|
+
import { TimePickerModule } from 'mis-crystal-design-system/timepicker';
|
|
7
|
+
|
|
8
|
+
class TimeRangePickerComponent {
|
|
9
|
+
constructor(cdr) {
|
|
10
|
+
this.cdr = cdr;
|
|
11
|
+
this.inputWidth = "100px";
|
|
12
|
+
this.height = "46px";
|
|
13
|
+
this.timezone = "Asia/Kolkata";
|
|
14
|
+
this.startDateEpoch = moment().tz(this.timezone).valueOf();
|
|
15
|
+
this.endDateEpoch = moment().tz(this.timezone).valueOf();
|
|
16
|
+
this.clockFormat = 12;
|
|
17
|
+
this.interval = 15;
|
|
18
|
+
this.timeRangeEmitter = new EventEmitter();
|
|
19
|
+
this.firstIntervalForStartPicker = moment().valueOf();
|
|
20
|
+
this.firstIntervalForEndPicker = moment().valueOf();
|
|
21
|
+
this.rangeValidity = true;
|
|
22
|
+
}
|
|
23
|
+
ngOnInit() {
|
|
24
|
+
this.timeFormat = this.clockFormat === 12 ? "hh:mm a" : "HH:mm";
|
|
25
|
+
}
|
|
26
|
+
ngOnChanges() {
|
|
27
|
+
tz.setDefault(this.timezone);
|
|
28
|
+
this.startDate = moment(this.startDateEpoch).format("DD-MM-YYYY");
|
|
29
|
+
this.endDate = moment(this.endDateEpoch).format("DD-MM-YYYY");
|
|
30
|
+
this.currDate = moment().format("DD-MM-YYYY");
|
|
31
|
+
this.setFirstIntervals();
|
|
32
|
+
}
|
|
33
|
+
// calculate the first interval of the picker
|
|
34
|
+
setFirstIntervals() {
|
|
35
|
+
const minutes = moment().minutes();
|
|
36
|
+
const offset = this.interval - (minutes % this.interval);
|
|
37
|
+
// first interval for the start picker will be the one closest to the current time
|
|
38
|
+
// if the start date is equal to the curr date
|
|
39
|
+
if (this.startDate === this.currDate) {
|
|
40
|
+
this.firstIntervalForStartPicker = moment().add(offset, "m").valueOf();
|
|
41
|
+
this.startTime = {
|
|
42
|
+
valid: true,
|
|
43
|
+
time: moment().add(offset, "m").format(this.timeFormat),
|
|
44
|
+
epoch: moment().add(offset, "m").valueOf()
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
this.firstIntervalForStartPicker = moment().startOf("d").valueOf();
|
|
49
|
+
this.startTime = {
|
|
50
|
+
valid: true,
|
|
51
|
+
time: moment().startOf("d").format(this.timeFormat),
|
|
52
|
+
epoch: moment().startOf("d").valueOf()
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
// for the end picker if the startDate and the endDate is same
|
|
56
|
+
// the first interval is set one interval ahead of the first interval for start picker
|
|
57
|
+
// else if the dates are different we set it to the start of the day
|
|
58
|
+
if (this.startDate === this.endDate) {
|
|
59
|
+
this.firstIntervalForEndPicker = moment().add(offset, "m").add(this.interval, "m").valueOf();
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
this.firstIntervalForEndPicker = moment().startOf("d").valueOf();
|
|
63
|
+
}
|
|
64
|
+
this.endTime = {
|
|
65
|
+
valid: true,
|
|
66
|
+
time: moment(this.firstIntervalForEndPicker).format(this.timeFormat),
|
|
67
|
+
epoch: this.firstIntervalForEndPicker
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
emitTimeRange(data) {
|
|
71
|
+
this.timeRangeEmitter.emit(data);
|
|
72
|
+
}
|
|
73
|
+
//handlers catch the emitted values and run validation
|
|
74
|
+
startPickerHandler(time) {
|
|
75
|
+
this.startTime = time;
|
|
76
|
+
// if the start time changes and the start date is the same as the end date
|
|
77
|
+
// and the start time >= end time
|
|
78
|
+
// update the first interval of end picker according to the time set in start picker
|
|
79
|
+
if (this.startDate === this.endDate) {
|
|
80
|
+
let minutes = moment(this.startTime.time, this.timeFormat).minutes();
|
|
81
|
+
let offset = this.interval - (minutes % this.interval);
|
|
82
|
+
this.firstIntervalForEndPicker = moment(`${this.startDate} ${this.startTime.time}`, `'DD-MM-YYYY' ${this.timeFormat}`)
|
|
83
|
+
.add(offset, "m")
|
|
84
|
+
.valueOf();
|
|
85
|
+
const intervalAsString = moment(this.firstIntervalForEndPicker).format(this.timeFormat);
|
|
86
|
+
const endOfDayAsString = moment(moment(`${this.startDate}`, `DD-MM-YYYY ${this.timeFormat}`).endOf("d").add(1, "m")).format(this.timeFormat);
|
|
87
|
+
if (intervalAsString === endOfDayAsString) {
|
|
88
|
+
this.firstIntervalForEndPicker = moment(`${this.startDate} ${this.startTime.time}`, `'DD-MM-YYYY' ${this.timeFormat}`).endOf("d").valueOf();
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
const validity = this.checkTimeValidity(this.startTime.time.trim(), this.startDateEpoch) && this.checkTimeValidity(this.endTime.time.trim(), this.endDateEpoch);
|
|
92
|
+
this.emitTimeRange({
|
|
93
|
+
valid: validity && this.rangeValidity,
|
|
94
|
+
startTime: this.startTime.time,
|
|
95
|
+
endTime: this.endTime.time,
|
|
96
|
+
startEpoch: moment(`${this.startDate} ${this.startTime.time}`, `DD-MM-YYYY ${this.timeFormat}`).valueOf(),
|
|
97
|
+
endEpoch: moment(`${this.endDate} ${this.endTime.time}`, `DD-MM-YYYY ${this.timeFormat}`).valueOf()
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
endPickerHandler(time) {
|
|
101
|
+
this.endTime = time;
|
|
102
|
+
const validity = this.checkTimeValidity(this.startTime.time.trim(), this.startDateEpoch) && this.checkTimeValidity(this.endTime.time.trim(), this.endDateEpoch);
|
|
103
|
+
this.emitTimeRange({
|
|
104
|
+
valid: validity && this.rangeValidity,
|
|
105
|
+
startTime: this.startTime.time,
|
|
106
|
+
endTime: this.endTime.time,
|
|
107
|
+
startEpoch: moment(`${this.startDate} ${this.startTime.time}`, `DD-MM-YYYY ${this.timeFormat}`).valueOf(),
|
|
108
|
+
endEpoch: moment(`${this.endDate} ${this.endTime.time}`, `DD-MM-YYYY ${this.timeFormat}`).valueOf()
|
|
109
|
+
});
|
|
110
|
+
this.rangeValidation();
|
|
111
|
+
}
|
|
112
|
+
checkTimeValidity(time, date) {
|
|
113
|
+
const RE12 = /^(([0][1-9]|1[0-2]):([0-5][0-9])( )?(am|pm|AM|PM))$/i;
|
|
114
|
+
const RE24 = /^([01][0-9]|2[0-3]):[0-5][0-9]$/;
|
|
115
|
+
const RE = this.clockFormat === 12 ? RE12 : RE24;
|
|
116
|
+
const timeMoment = moment(`${moment(date).format("DD-MM-YYYY")} ${time}`, `'DD-MM-YYYY' ${this.timeFormat}`);
|
|
117
|
+
const startDate = moment(this.startDateEpoch).format("DD-MM-YYYY");
|
|
118
|
+
const endDate = moment(this.endDateEpoch).format("DD-MM-YYYY");
|
|
119
|
+
let flag = false;
|
|
120
|
+
// if the first interval is set to the start of the day
|
|
121
|
+
// then we don't check its validity against the current time
|
|
122
|
+
if (startDate !== endDate) {
|
|
123
|
+
flag = time.match(RE) ? true : false;
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
flag = time.match(RE) && timeMoment.isAfter(moment()) ? true : false;
|
|
127
|
+
}
|
|
128
|
+
return flag;
|
|
129
|
+
}
|
|
130
|
+
// validates end picker's input according to the start picker's input
|
|
131
|
+
rangeValidation() {
|
|
132
|
+
const validity = this.checkTimeValidity(this.startTime.time.trim(), this.startDateEpoch) && this.checkTimeValidity(this.endTime.time.trim(), this.endDateEpoch);
|
|
133
|
+
if (validity && this.startDate === this.endDate) {
|
|
134
|
+
const startMoment = moment(this.startTime.time, this.timeFormat);
|
|
135
|
+
const endMoment = moment(this.endTime.time, this.timeFormat);
|
|
136
|
+
this.rangeValidity = endMoment.diff(startMoment, "m") >= 1 ? true : false;
|
|
137
|
+
this.cdr.detectChanges();
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
TimeRangePickerComponent.decorators = [
|
|
142
|
+
{ type: Component, args: [{
|
|
143
|
+
selector: "mis-timerangepicker",
|
|
144
|
+
template: "<div class=\"rangepicker-container\">\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]=\"'200px'\"\n [dropdownWidth]=\"dropdownWidth\"\n ></mis-timepicker>\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]=\"'200px'\"\n [dropdownWidth]=\"dropdownWidth\"\n ></mis-timepicker>\n</div>\n",
|
|
145
|
+
styles: [".rangepicker-container{display:flex;gap:1rem}"]
|
|
146
|
+
},] }
|
|
147
|
+
];
|
|
148
|
+
TimeRangePickerComponent.ctorParameters = () => [
|
|
149
|
+
{ type: ChangeDetectorRef }
|
|
150
|
+
];
|
|
151
|
+
TimeRangePickerComponent.propDecorators = {
|
|
152
|
+
inputWidth: [{ type: Input }],
|
|
153
|
+
dropdownWidth: [{ type: Input }],
|
|
154
|
+
height: [{ type: Input }],
|
|
155
|
+
timezone: [{ type: Input }],
|
|
156
|
+
startDateEpoch: [{ type: Input }],
|
|
157
|
+
endDateEpoch: [{ type: Input }],
|
|
158
|
+
clockFormat: [{ type: Input }],
|
|
159
|
+
interval: [{ type: Input }],
|
|
160
|
+
timeRangeEmitter: [{ type: Output }]
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
class TimeRangePickerModule {
|
|
164
|
+
static forRoot() {
|
|
165
|
+
return { ngModule: TimeRangePickerModule, providers: [] };
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
TimeRangePickerModule.decorators = [
|
|
169
|
+
{ type: NgModule, args: [{
|
|
170
|
+
declarations: [TimeRangePickerComponent],
|
|
171
|
+
imports: [CommonModule, FormsModule, TimePickerModule],
|
|
172
|
+
exports: [TimeRangePickerComponent]
|
|
173
|
+
},] }
|
|
174
|
+
];
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Generated bundle index. Do not edit.
|
|
178
|
+
*/
|
|
179
|
+
|
|
180
|
+
export { TimeRangePickerComponent, TimeRangePickerModule };
|
|
181
|
+
//# sourceMappingURL=mis-crystal-design-system-timerangepicker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mis-crystal-design-system-timerangepicker.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 } 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() clockFormat: number = 12;\n @Input() interval: number = 15;\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\n constructor(private cdr: ChangeDetectorRef) {}\n\n ngOnInit() {\n this.timeFormat = this.clockFormat === 12 ? \"hh:mm a\" : \"HH:mm\";\n }\n\n ngOnChanges() {\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.currDate) {\n this.firstIntervalForStartPicker = moment().add(offset, \"m\").valueOf();\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().startOf(\"d\").valueOf();\n this.startTime = {\n valid: true,\n time: moment().startOf(\"d\").format(this.timeFormat),\n epoch: moment().startOf(\"d\").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\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 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\n const validity =\n this.checkTimeValidity(this.startTime.time.trim(), this.startDateEpoch) && this.checkTimeValidity(this.endTime.time.trim(), this.endDateEpoch);\n \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 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.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 this.rangeValidation();\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 const startDate = moment(this.startDateEpoch).format(\"DD-MM-YYYY\");\n const endDate = moment(this.endDateEpoch).format(\"DD-MM-YYYY\");\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 (startDate !== endDate) {\n flag = time.match(RE) ? true : false;\n } else {\n flag = time.match(RE) && timeMoment.isAfter(moment()) ? true : false;\n }\n\n return flag;\n }\n\n // validates end picker's input according to the start picker's input\n rangeValidation() {\n const validity =\n this.checkTimeValidity(this.startTime.time.trim(), this.startDateEpoch) && this.checkTimeValidity(this.endTime.time.trim(), this.endDateEpoch);\n\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.tz"],"mappings":";;;;;;;MASa,wBAAwB;IAqBnC,YAAoB,GAAsB;QAAtB,QAAG,GAAH,GAAG,CAAmB;QApBjC,eAAU,GAAW,OAAO,CAAC;QAE7B,WAAM,GAAW,MAAM,CAAC;QACxB,aAAQ,GAAW,cAAc,CAAC;QAClC,mBAAc,GAAW,MAAM,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,OAAO,EAAE,CAAC;QAC9D,iBAAY,GAAW,MAAM,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,OAAO,EAAE,CAAC;QAC5D,gBAAW,GAAW,EAAE,CAAC;QACzB,a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@@ -0,0 +1 @@
|
|
|
1
|
+
{"__symbolic":"module","version":4,"metadata":{"TimePickerComponent":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":5,"character":1},"arguments":[{"selector":"mis-timepicker","template":"<div class=\"timepicker-container\" [ngStyle]=\"{ height: height }\">\n <input\n type=\"text\"\n [(ngModel)]=\"chosenTime\"\n (ngModelChange)=\"onTimeChange(chosenTime)\"\n [ngClass]=\"{ invalid: isInvalid || !rangeValidity }\"\n [ngStyle]=\"{ width: inputWidth }\"\n (click)=\"openDropdown()\"\n misToolTip\n [showToolTip]=\"isInvalid || !rangeValidity\"\n [text]=\"'Invalid Time'\"\n [position]=\"'top'\"\n [showOnHover]=\"false\"\n #input\n cdkOverlayOrigin\n class=\"p\"\n />\n\n <ng-template #dropdownContainer libDropdownScroll libTimepicker [originEl]=\"input\" [openStatus]=\"openStatus\" (statusEmitter)=\"closeDropdown($event)\">\n <div *ngIf=\"openStatus\" class=\"timepicker-dropdown\" [ngStyle]=\"{ width: dropdownWidth || inputWidth }\">\n <ul #dropdown>\n <li #timeInterval (click)=\"onTimeSelect(interval)\" *ngFor=\"let interval of timeIntervals; index as i\" [ngClass]=\"{ highlight: i === isHighlighted }\">\n {{ interval }}\n <div class=\"ic-ui-check-24 selected-icon\" *ngIf=\"interval === chosenTime\"></div>\n </li>\n </ul>\n </div>\n </ng-template>\n</div>\n","styles":[".h1{font-size:40px;line-height:48px}.h1,.h2{font-weight:400;letter-spacing:0}.h2{font-size:32px;line-height:40px}.h3{font-size:28px;line-height:36px}.h3,.h4{font-weight:400;letter-spacing:0}.h4{font-size:24px;line-height:32px}.h5-b{font-weight:700;letter-spacing:.25px}.h5,.h5-b{font-size:20px;line-height:28px}.h5{font-weight:400;letter-spacing:.15px}.h6-b{font-weight:700}.h6,.h6-b{font-size:16px;letter-spacing:0;line-height:24px}.h6,.p{font-weight:400}.p{font-size:16px;letter-spacing:0;line-height:180%}.h7-b{font-weight:700;letter-spacing:.25px}.h7,.h7-b{font-size:14px;line-height:20px}.h7{font-weight:400;letter-spacing:.2px}.h8-b{font-weight:700;letter-spacing:.25px}.h8,.h8-b{font-size:12px;line-height:18px}.h8{letter-spacing:.2px}.h8,.h9{font-weight:400}.h9{font-size:10px;letter-spacing:0;line-height:15px}.btn-lg-b{font-weight:700;letter-spacing:.5px}.btn-lg,.btn-lg-b{font-size:16px;line-height:24px}.btn-lg{font-weight:400;letter-spacing:.2px}.btn-sm{font-size:14px;font-weight:400;letter-spacing:.25px;line-height:20px}.btn-link{font-size:16px;line-height:24px}.btn-link,.display-1{font-weight:400;letter-spacing:0}.display-1{font-size:48px;line-height:56px}.display-2{font-size:14px;font-weight:400;letter-spacing:.5px;line-height:20px}*{box-sizing:border-box;font-family:Lato}.timepicker-container{display:inline-block;position:relative}input{text-align:center;border:none;border-bottom:1px solid #e0e0e0;outline:none;height:100%;width:100px;padding:4px 16px}input:hover{background:#f5f7fc}input:active,input:focus{background:#e6ebf7;border-bottom:1px solid #0937b2}.timepicker-dropdown{position:absolute;top:calc(100% + 4px);left:0;max-height:200px;overflow-y:auto;border:1px solid #e0e0e0;box-shadow:0 12px 24px rgba(0,0,0,.12),0 4px 8px rgba(0,0,0,.12);border-radius:4px;padding:8px;background:#fff}.timepicker-dropdown::-webkit-scrollbar{display:none}.timepicker-dropdown ul{margin:0;padding:0}.timepicker-dropdown li{text-align:start;list-style:none;padding:6px 12px;cursor:pointer;font-size:16px;color:#181f33;display:flex;justify-content:space-between;align-items:center}.timepicker-dropdown li:hover{background:#f5f7fc;border-radius:6px}.timepicker-dropdown li .selected-icon{font-weight:900}.highlight{background-color:#f5f7fc;border-radius:6px}.invalid{background:#fae1ea!important;border-bottom:1px solid #b00020!important}"]}]}],"members":{"clockFormat":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":20,"character":3}}]}],"timezone":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":23,"character":3}}]}],"height":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":24,"character":3}}]}],"inputWidth":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":25,"character":3}}]}],"dropdownWidth":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":26,"character":3}}]}],"interval":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":27,"character":3}}]}],"dateAsEpoch":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":28,"character":3}}]}],"firstInterval":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":29,"character":3}}]}],"rangeValidity":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":30,"character":3}}]}],"timeEmitter":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":32,"character":3}}]}],"input":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"ViewChild","line":33,"character":3},"arguments":["input",{"static":true}]}]}],"timepickerDirective":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"ViewChild","line":34,"character":3},"arguments":[{"__symbolic":"reference","name":"ɵa"}]}]}],"timeIntervalRefs":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"ViewChildren","line":37,"character":3},"arguments":["timeInterval"]}]}],"__ctor__":[{"__symbolic":"constructor"}],"ngOnInit":[{"__symbolic":"method"}],"ngOnChanges":[{"__symbolic":"method"}],"emitTime":[{"__symbolic":"method"}],"getMoment":[{"__symbolic":"method"}],"closeDropdown":[{"__symbolic":"method"}],"openDropdown":[{"__symbolic":"method"}],"checkTimeValidity":[{"__symbolic":"method"}],"onTimeSelect":[{"__symbolic":"method"}],"onTimeChange":[{"__symbolic":"method"}],"calculateClosestInterval":[{"__symbolic":"method"}],"populateDropdown":[{"__symbolic":"method"}]}},"TimePickerModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":8,"character":1},"arguments":[{"declarations":[{"__symbolic":"reference","name":"TimePickerComponent"},{"__symbolic":"reference","name":"ɵa"}],"imports":[{"__symbolic":"reference","module":"@angular/common","name":"CommonModule","line":10,"character":12},{"__symbolic":"reference","module":"@angular/forms","name":"FormsModule","line":10,"character":26},{"__symbolic":"reference","module":"mis-crystal-design-system/tooltip","name":"ToolTipModule","line":10,"character":39},{"__symbolic":"reference","module":"@angular/cdk/overlay","name":"OverlayModule","line":10,"character":54}],"exports":[{"__symbolic":"reference","name":"TimePickerComponent"}]}]}],"members":{},"statics":{"forRoot":{"__symbolic":"function","parameters":[],"value":{"ngModule":{"__symbolic":"reference","name":"TimePickerModule"},"providers":[]}}}},"ɵa":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive","line":5,"character":1},"arguments":[{"selector":"[libTimepicker]"}]}],"members":{"originEl":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":10,"character":3},"arguments":["originEl"]}]}],"statusEmitter":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":11,"character":3}}]}],"createOverlayOnInput":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":13,"character":3},"arguments":["openStatus"]}]}],"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"TemplateRef","module":"@angular/core","arguments":[{"__symbolic":"error","message":"Could not resolve type","line":18,"character":47,"context":{"typeName":"Element"},"module":"./timepicker.directive"}]},{"__symbolic":"reference","module":"@angular/cdk/overlay","name":"Overlay","line":18,"character":74},{"__symbolic":"reference","module":"@angular/core","name":"ViewContainerRef","line":18,"character":109}]}],"createOverlay":[{"__symbolic":"method"}],"destroyOverlay":[{"__symbolic":"method"}]}}},"origins":{"TimePickerComponent":"./timepicker.component","TimePickerModule":"./timepicker.module","ɵa":"./timepicker.directive"},"importAs":"mis-crystal-design-system/timepicker"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"main": "../bundles/mis-crystal-design-system-timepicker.umd.js",
|
|
3
|
+
"module": "../fesm2015/mis-crystal-design-system-timepicker.js",
|
|
4
|
+
"es2015": "../fesm2015/mis-crystal-design-system-timepicker.js",
|
|
5
|
+
"esm2015": "../esm2015/timepicker/mis-crystal-design-system-timepicker.js",
|
|
6
|
+
"fesm2015": "../fesm2015/mis-crystal-design-system-timepicker.js",
|
|
7
|
+
"typings": "mis-crystal-design-system-timepicker.d.ts",
|
|
8
|
+
"metadata": "mis-crystal-design-system-timepicker.metadata.json",
|
|
9
|
+
"sideEffects": false,
|
|
10
|
+
"name": "mis-crystal-design-system/timepicker"
|
|
11
|
+
}
|