@colijnit/corecomponents_v12 255.1.11 → 255.1.13

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 (32) hide show
  1. package/bundles/colijnit-corecomponents_v12.umd.js +376 -17
  2. package/bundles/colijnit-corecomponents_v12.umd.js.map +1 -1
  3. package/colijnit-corecomponents_v12.metadata.json +1 -1
  4. package/esm2015/lib/components/calendar/calendar-template.component.js +6 -4
  5. package/esm2015/lib/components/hour-scheduling/components/hour-scheduling-test-object/hour-scheduling-test-object.component.js +2 -2
  6. package/esm2015/lib/components/hour-scheduling/hour-scheduling.component.js +24 -12
  7. package/esm2015/lib/components/hour-scheduling-expandable/components/hour-scheduling-expandable-template/hour-scheduling-expandable-template.component.js +55 -0
  8. package/esm2015/lib/components/hour-scheduling-expandable/hour-scheduling-expandable.component.js +316 -0
  9. package/esm2015/lib/components/hour-scheduling-expandable/hour-scheduling-expandable.module.js +25 -0
  10. package/esm2015/lib/components/input-number-picker/input-number-picker.component.js +2 -1
  11. package/esm2015/lib/core/enum/core-components-icon.enum.js +1 -1
  12. package/esm2015/lib/core/enum/filterItem-mode.enum.js +3 -3
  13. package/esm2015/public-api.js +5 -1
  14. package/fesm2015/colijnit-corecomponents_v12.js +420 -17
  15. package/fesm2015/colijnit-corecomponents_v12.js.map +1 -1
  16. package/lib/components/hour-scheduling/components/hour-scheduling-test-object/style/_layout.scss +2 -0
  17. package/lib/components/hour-scheduling/components/hour-scheduling-test-object/style/_theme.scss +2 -2
  18. package/lib/components/hour-scheduling/hour-scheduling.component.d.ts +4 -3
  19. package/lib/components/hour-scheduling/style/_layout.scss +2 -0
  20. package/lib/components/hour-scheduling-expandable/components/hour-scheduling-expandable-template/hour-scheduling-expandable-template.component.d.ts +10 -0
  21. package/lib/components/hour-scheduling-expandable/components/hour-scheduling-expandable-template/style/_layout.scss +4 -0
  22. package/lib/components/hour-scheduling-expandable/components/hour-scheduling-expandable-template/style/_material-definition.scss +0 -0
  23. package/lib/components/hour-scheduling-expandable/components/hour-scheduling-expandable-template/style/_theme.scss +4 -0
  24. package/lib/components/hour-scheduling-expandable/components/hour-scheduling-expandable-template/style/material.scss +4 -0
  25. package/lib/components/hour-scheduling-expandable/hour-scheduling-expandable.component.d.ts +76 -0
  26. package/lib/components/hour-scheduling-expandable/hour-scheduling-expandable.module.d.ts +2 -0
  27. package/lib/components/hour-scheduling-expandable/style/_layout.scss +103 -0
  28. package/lib/components/hour-scheduling-expandable/style/_material-definition.scss +0 -0
  29. package/lib/components/hour-scheduling-expandable/style/_theme.scss +4 -0
  30. package/lib/components/hour-scheduling-expandable/style/material.scss +4 -0
  31. package/package.json +1 -1
  32. package/public-api.d.ts +4 -0
@@ -5712,13 +5712,13 @@
5712
5712
  exports.FilterItemMode = void 0;
5713
5713
  (function (FilterItemMode) {
5714
5714
  //This mode makes the Filter display a multi select list
5715
- // Input will be passed along directly as a string with the following syntax: "?>='choice 1', ?<='choice2'"
5715
+ // Input will be passed along directly as a string with the following syntax: "?='choice 1', ?='choice2'"
5716
5716
  FilterItemMode["Filterlist"] = "filterlist";
5717
5717
  //This mode makes the Filter display a single select list
5718
5718
  // Input will be passed along directly as a simple string.
5719
5719
  FilterItemMode["SingleSelectList"] = "singleSelectList";
5720
5720
  //This mode makes the Filter display a multi select list
5721
- // Input will be passed along directly as a simple string.
5721
+ // Input will be passed along directly as a simple collection of strings.
5722
5722
  FilterItemMode["SelectListWithStringCollectionOutput"] = "selectListWithStringCollectionOutput";
5723
5723
  //This mode makes the Filter display a multi select list
5724
5724
  // Available choices will need to have their identifying value be a number. The summation of all these numbers will be passed along.
@@ -7013,9 +7013,11 @@
7013
7013
  this.showYearSelection = true;
7014
7014
  };
7015
7015
  CalendarTemplateComponent.prototype.selectDate = function (day) {
7016
- this.selectedDate = day;
7017
- this._fillDatesBetweenSelected();
7018
- this.dateSelected.emit(new Date(this.selectedDate));
7016
+ if (day) {
7017
+ this.selectedDate = day;
7018
+ this._fillDatesBetweenSelected();
7019
+ this.dateSelected.emit(new Date(this.selectedDate));
7020
+ }
7019
7021
  };
7020
7022
  CalendarTemplateComponent.prototype.selectMonth = function (month) {
7021
7023
  this.showSelectedMonth = month;
@@ -8007,7 +8009,7 @@
8007
8009
  InputNumberPickerComponent.decorators = [
8008
8010
  { type: i0.Component, args: [{
8009
8011
  selector: 'co-input-number-picker',
8010
- template: "\n <div class=\"icon-wrapper\" *ngIf=\"leftIconData\">\n <co-icon class=\"input-number-picker-icon\" [iconData]=\"leftIconData\" (click)=\"iconClick.emit($event)\"></co-icon>\n <div class=\"spacer\"></div>\n </div>\n <div class=\"button-wrapper\">\n <co-button *ngIf=\"showButtons\" class=\"minus-operator\" [class.select]=\"minSelected\" tabindex=\"-1\"\n [disabled]=\"readonly\"\n [iconData]=\"iconCacheService.getIcon(minusIcon)\"\n (mousedown)=\"onMinusMouseDown($event)\"\n (mouseup)=\"stopAutoCounting()\" (mouseleave)=\"stopAutoCounting()\"></co-button>\n </div>\n <input type=\"text\"\n [tabIndex]=\"readonly ? -1 : 0\"\n [ngModel]=\"model\"\n [readonly]=\"readonly\"\n [disabled]=\"disabled\"\n [required]=\"required\"\n (ngModelChange)=\"handleChangeModel($event)\"\n (keydown)=\"handleInputKeyDown($event)\"\n (blur)=\"handleBlur()\"/>\n <div class=\"button-wrapper\">\n <co-button *ngIf=\"showButtons\" class=\"plus-operator\" [class.select]=\"plusSelected\" tabindex=\"-1\"\n [disabled]=\"readonly\"\n [iconData]=\"iconCacheService.getIcon(plusIcon)\"\n (mousedown)=\"onPlusMouseDown($event)\"\n (mouseup)=\"stopAutoCounting()\" (mouseleave)=\"stopAutoCounting()\"></co-button>\n </div>\n ",
8012
+ template: "\n <div class=\"icon-wrapper\" *ngIf=\"leftIconData\">\n <co-icon class=\"input-number-picker-icon\" [iconData]=\"leftIconData\" (click)=\"iconClick.emit($event)\"></co-icon>\n <div class=\"spacer\"></div>\n </div>\n <div class=\"button-wrapper\">\n <co-button *ngIf=\"showButtons\" class=\"minus-operator\" [class.select]=\"minSelected\" tabindex=\"-1\"\n [disabled]=\"readonly\"\n [iconData]=\"iconCacheService.getIcon(minusIcon)\"\n (mousedown)=\"onMinusMouseDown($event)\"\n (mouseup)=\"stopAutoCounting()\" (mouseleave)=\"stopAutoCounting()\"></co-button>\n </div>\n <input type=\"text\"\n [tabIndex]=\"readonly ? -1 : 0\"\n [ngModel]=\"model\"\n [readonly]=\"readonly\"\n [disabled]=\"disabled\"\n [required]=\"required\"\n [placeholder]=\"label\"\n (ngModelChange)=\"handleChangeModel($event)\"\n (keydown)=\"handleInputKeyDown($event)\"\n (blur)=\"handleBlur()\"/>\n <div class=\"button-wrapper\">\n <co-button *ngIf=\"showButtons\" class=\"plus-operator\" [class.select]=\"plusSelected\" tabindex=\"-1\"\n [disabled]=\"readonly\"\n [iconData]=\"iconCacheService.getIcon(plusIcon)\"\n (mousedown)=\"onPlusMouseDown($event)\"\n (mouseup)=\"stopAutoCounting()\" (mouseleave)=\"stopAutoCounting()\"></co-button>\n </div>\n ",
8011
8013
  providers: [
8012
8014
  OverlayService, {
8013
8015
  provide: SCREEN_CONFIG_ADAPTER_COMPONENT_INTERFACE_NAME, useExisting: i0.forwardRef(function () { return InputNumberPickerComponent; })
@@ -14117,10 +14119,11 @@
14117
14119
  ];
14118
14120
 
14119
14121
  var HourSchedulingComponent = /** @class */ (function () {
14120
- function HourSchedulingComponent(cdRef, datePipe) {
14122
+ function HourSchedulingComponent(cdRef, datePipe, zone) {
14123
+ var _this = this;
14121
14124
  this.cdRef = cdRef;
14122
14125
  this.datePipe = datePipe;
14123
- this.showClass = true;
14126
+ this.zone = zone;
14124
14127
  this.hourLabels = [];
14125
14128
  this.scheduledObjects = {};
14126
14129
  this.activeHour = null;
@@ -14129,14 +14132,16 @@
14129
14132
  this.customTemplateUsed = false;
14130
14133
  this.timeChangeEvent = new i0.EventEmitter();
14131
14134
  this.newObjectPlanEvent = new i0.EventEmitter();
14132
- document.addEventListener('click', this.onDocumentClick.bind(this));
14135
+ this.showClass = true;
14136
+ document.addEventListener('click', function () { return _this.onDocumentClick; });
14133
14137
  }
14134
14138
  HourSchedulingComponent.prototype.ngOnInit = function () {
14135
14139
  this.generateTimeBlocks();
14136
14140
  this.generateScheduledObjects();
14137
14141
  };
14138
14142
  HourSchedulingComponent.prototype.ngOnDestroy = function () {
14139
- document.removeEventListener('click', this.onDocumentClick.bind(this));
14143
+ var _this = this;
14144
+ document.removeEventListener('click', function () { return _this.onDocumentClick; });
14140
14145
  };
14141
14146
  HourSchedulingComponent.prototype.generateTimeBlocks = function () {
14142
14147
  var startUnix = !this.childProp ? this.dateToUnixEpoch(new Date(this.schedule[this.startTimeProp])) : this.dateToUnixEpoch(new Date(this.schedule[this.childProp][this.startTimeProp]));
@@ -14182,12 +14187,21 @@
14182
14187
  };
14183
14188
  HourSchedulingComponent.prototype.onDragOver = function (event) {
14184
14189
  event.preventDefault();
14185
- var currentTarget = event.currentTarget;
14186
- currentTarget.classList.add('drag-over');
14190
+ event.stopPropagation();
14191
+ this.zone.runOutsideAngular(function () {
14192
+ var currentTarget = event.currentTarget;
14193
+ if (!currentTarget.classList.contains('drag-over')) {
14194
+ currentTarget.classList.add('drag-over');
14195
+ }
14196
+ });
14187
14197
  };
14188
14198
  HourSchedulingComponent.prototype.onDragLeave = function (event) {
14189
- var currentTarget = event.currentTarget;
14190
- currentTarget.classList.remove('drag-over'); // Remove 'drag-over' class
14199
+ event.preventDefault();
14200
+ event.stopPropagation();
14201
+ this.zone.runOutsideAngular(function () {
14202
+ var currentTarget = event.currentTarget;
14203
+ currentTarget.classList.remove('drag-over');
14204
+ });
14191
14205
  };
14192
14206
  HourSchedulingComponent.prototype.onDrop = function (event, hour) {
14193
14207
  var _c;
@@ -14285,12 +14299,14 @@
14285
14299
  { type: i0.Component, args: [{
14286
14300
  selector: 'co-hour-scheduling',
14287
14301
  template: "\n <div class=\"time-block\" *ngFor=\"let hour of hourLabels\">\n <div class=\"hour-label\"><span [textContent]=\"hour\"></span></div>\n <div class=\"object-display\">\n <div class=\"first-half-hour object-half\"\n [ngClass]=\"{'has-objects': scheduledObjects[hour]?.length > 0, 'active': activeHalfHour === hour + '-firstHalf'}\"\n (dragover)=\"onDragOver($event)\"\n (dragleave)=\"onDragLeave($event)\"\n (click)=\"onObjectDisplayClick(hour, 'firstHalf')\"\n (drop)=\"onDrop($event, hour)\">\n <ng-container *ngIf=\"!customTemplateUsed\">\n <ng-container *ngIf=\"scheduledObjects[hour]\">\n <span class=\"hidden-hour-label\" [hidden]=\"true\" [textContent]=\"hour\"></span>\n <div\n *ngFor=\"let obj of scheduledObjects[hour]\"\n class=\"scheduled-object\"\n [draggable]=\"true\"\n (dragstart)=\"onDragStart($event, obj)\"\n >\n <span class=\"hidden-hour-label\" [hidden]=\"true\" [textContent]=\"addMinutes(hour)\"></span>\n <span class=\"title\" [textContent]=\"obj.title\"></span>\n <span class=\"sub-title\" [textContent]=\"obj.subTitle\"></span>\n </div>\n </ng-container>\n </ng-container>\n\n <ng-container *ngIf=\"customTemplateUsed\">\n <ng-template\n [ngTemplateOutlet]=\"customTemplate\"\n [ngTemplateOutletContext]=\"{\n hour: hour,\n hiddenHour: hour,\n objects: scheduledObjects[hour]\n }\"\n >\n </ng-template>\n </ng-container>\n </div>\n\n <div class=\"second-half-hour object-half\"\n [ngClass]=\"{'has-objects': scheduledObjects[addMinutes(hour)]?.length > 0, 'active': activeHalfHour === hour + '-secondHalf'}\"\n (dragover)=\"onDragOver($event)\"\n (dragleave)=\"onDragLeave($event)\"\n (click)=\"onObjectDisplayClick(hour, 'secondHalf')\"\n (drop)=\"onDrop($event, addMinutes(hour))\">\n <ng-container *ngIf=\"!customTemplateUsed\">\n <ng-container *ngIf=\"scheduledObjects[addMinutes(hour)]\">\n <div\n *ngFor=\"let obj of scheduledObjects[addMinutes(hour)]\"\n class=\"scheduled-object\"\n [draggable]=\"true\"\n (dragstart)=\"onDragStart($event, obj)\"\n >\n <span class=\"title\" [textContent]=\"obj.title\"></span>\n <span class=\"sub-title\" [textContent]=\"obj.subTitle\"></span>\n <span class=\"hidden-hour-label\" [hidden]=\"true\" [textContent]=\"addMinutes(hour)\"></span>\n </div>\n </ng-container>\n </ng-container>\n\n <ng-container *ngIf=\"customTemplateUsed\">\n <ng-template\n [ngTemplateOutlet]=\"customTemplate\"\n [ngTemplateOutletContext]=\"{\n hour: hour,\n hiddenHour: addMinutes(hour),\n objects: scheduledObjects[addMinutes(hour)]\n }\"\n >\n </ng-template>\n </ng-container>\n </div>\n\n\n </div>\n </div>\n ",
14302
+ changeDetection: i0.ChangeDetectionStrategy.OnPush,
14288
14303
  encapsulation: i0.ViewEncapsulation.None
14289
14304
  },] }
14290
14305
  ];
14291
14306
  HourSchedulingComponent.ctorParameters = function () { return [
14292
14307
  { type: i0.ChangeDetectorRef },
14293
- { type: common.DatePipe }
14308
+ { type: common.DatePipe },
14309
+ { type: i0.NgZone }
14294
14310
  ]; };
14295
14311
  HourSchedulingComponent.propDecorators = {
14296
14312
  schedule: [{ type: i0.Input }],
@@ -14303,7 +14319,324 @@
14303
14319
  idProp: [{ type: i0.Input }],
14304
14320
  timeChangeEvent: [{ type: i0.Output }],
14305
14321
  newObjectPlanEvent: [{ type: i0.Output }],
14306
- generateTimeBlocks: [{ type: i0.HostBinding, args: ['class.co-hour-scheduling',] }]
14322
+ showClass: [{ type: i0.HostBinding, args: ['class.co-hour-scheduling',] }]
14323
+ };
14324
+
14325
+ var HourSchedulingExpandableComponent = /** @class */ (function () {
14326
+ function HourSchedulingExpandableComponent(cdRef, datePipe, eRef) {
14327
+ this.cdRef = cdRef;
14328
+ this.datePipe = datePipe;
14329
+ this.eRef = eRef;
14330
+ this.hourLabels = [];
14331
+ this.scheduledObjects = [];
14332
+ this.resizing = false;
14333
+ this.currentResizingObject = null;
14334
+ this.currentDraggingObject = null;
14335
+ this.MIN_HEIGHT = 30;
14336
+ this._schedule = {};
14337
+ this.timeChangeEvent = new i0.EventEmitter();
14338
+ this.newObjectPlanEvent = new i0.EventEmitter();
14339
+ this.showClass = true;
14340
+ }
14341
+ Object.defineProperty(HourSchedulingExpandableComponent.prototype, "schedule", {
14342
+ get: function () {
14343
+ return this._schedule;
14344
+ },
14345
+ set: function (value) {
14346
+ if (value && value !== this._schedule) {
14347
+ this.renderObjects();
14348
+ }
14349
+ this._schedule = value;
14350
+ },
14351
+ enumerable: false,
14352
+ configurable: true
14353
+ });
14354
+ HourSchedulingExpandableComponent.prototype.onResize = function (event) {
14355
+ event.target.innerWidth;
14356
+ };
14357
+ HourSchedulingExpandableComponent.prototype.clickOut = function (event) {
14358
+ if (!this.eRef.nativeElement.contains(event.target)) {
14359
+ this.handleDeselectAll();
14360
+ }
14361
+ };
14362
+ HourSchedulingExpandableComponent.prototype.ngOnInit = function () {
14363
+ this.generateTimeBlocks();
14364
+ if (this.schedule) {
14365
+ this.renderObjects();
14366
+ }
14367
+ this._calculateSchedulingObjectProperties();
14368
+ };
14369
+ // Calculate properties for each scheduled object to determine resizer visibility
14370
+ HourSchedulingExpandableComponent.prototype._calculateSchedulingObjectProperties = function () {
14371
+ var _this = this;
14372
+ var scheduleStart = this.convertDateToEuropean(this.schedule[this.childProp][this.startTimeProp]);
14373
+ var scheduleEnd = this.convertDateToEuropean(this.schedule[this.childProp][this.endTimeProp]);
14374
+ this.scheduledObjects.forEach(function (obj) {
14375
+ obj.showTopResizer = _this.timeDifference(scheduleStart, obj.start) > 0; // Show top resizer if the start time differs
14376
+ obj.showBottomResizer = _this.timeDifference(scheduleEnd, obj.end) > 0; // Show bottom resizer if the end time differs
14377
+ });
14378
+ };
14379
+ // Find the next object in the scheduledObjects list
14380
+ HourSchedulingExpandableComponent.prototype._findNextObject = function (currentObject) {
14381
+ var currentIndex = this.scheduledObjects.indexOf(currentObject);
14382
+ if (currentIndex >= 0 && currentIndex < this.scheduledObjects.length - 1) {
14383
+ return this.scheduledObjects[currentIndex + 1]; // The next object in the list
14384
+ }
14385
+ return null; // No next object (it's the last one)
14386
+ };
14387
+ // Find the previous object in the scheduledObjects list
14388
+ HourSchedulingExpandableComponent.prototype._findPreviousObject = function (currentObject) {
14389
+ var currentIndex = this.scheduledObjects.indexOf(currentObject);
14390
+ if (currentIndex > 0) {
14391
+ return this.scheduledObjects[currentIndex - 1]; // The previous object in the list
14392
+ }
14393
+ return null; // No previous object (it's the first one)
14394
+ };
14395
+ HourSchedulingExpandableComponent.prototype.renderObjects = function () {
14396
+ var _this = this;
14397
+ if (this.schedule) {
14398
+ if (this.scheduledObjects.length > 1) {
14399
+ this.scheduledObjects = [];
14400
+ }
14401
+ var objects = this.schedule[this.objectsProp];
14402
+ var schedulingObjects_1 = [];
14403
+ if (objects && objects.length > 0) {
14404
+ objects.forEach(function (object) {
14405
+ var topDifference = _this.timeDifference(_this.schedule[_this.childProp][_this.startTimeProp], object[_this.startTimeProp]);
14406
+ schedulingObjects_1.push({
14407
+ title: object['title'],
14408
+ subTitle: object['subTitle'],
14409
+ start: _this.convertDateToEuropean(object[_this.startTimeProp]),
14410
+ end: _this.convertDateToEuropean(object[_this.endTimeProp]),
14411
+ id: object[_this.idProp],
14412
+ height: _this.timeDifference(object[_this.startTimeProp], object[_this.endTimeProp]),
14413
+ top: topDifference,
14414
+ selected: false
14415
+ });
14416
+ });
14417
+ }
14418
+ this.scheduledObjects = schedulingObjects_1;
14419
+ }
14420
+ };
14421
+ HourSchedulingExpandableComponent.prototype.onSelectBlock = function (obj) {
14422
+ this.scheduledObjects.filter(function (obj) { return obj.selected; }).forEach(function (selectedObj) {
14423
+ selectedObj.selected = false;
14424
+ });
14425
+ obj.selected = true;
14426
+ this.currentResizingObject = obj;
14427
+ };
14428
+ HourSchedulingExpandableComponent.prototype.onDragStartCustom = function (obj) {
14429
+ this.currentDraggingObject = obj;
14430
+ };
14431
+ HourSchedulingExpandableComponent.prototype.handleDrop = function (dragEvent, hour) {
14432
+ var _this = this;
14433
+ if (this.currentDraggingObject) {
14434
+ //The order was scheduled and needs to be moved
14435
+ var start = this.currentDraggingObject.start;
14436
+ var hourSplit = hour.split(":");
14437
+ start.setHours(parseInt(hourSplit[0]));
14438
+ start.setMinutes(parseInt(hourSplit[1]));
14439
+ var scheduledObject = this.scheduledObjects.find(function (scheduledObject) { return scheduledObject.id === _this.currentDraggingObject.id; });
14440
+ scheduledObject.start = start;
14441
+ var originalObject = this.schedule[this.objectsProp].find(function (object) { return object[_this.idProp] === _this.currentDraggingObject.id; });
14442
+ originalObject[this.startTimeProp] = start;
14443
+ var end = this.addMinutes(originalObject[this.startTimeProp], this.currentDraggingObject.height);
14444
+ originalObject[this.endTimeProp] = end;
14445
+ scheduledObject.end = end;
14446
+ scheduledObject.top = this.timeDifference(this.schedule[this.childProp][this.startTimeProp], scheduledObject.start);
14447
+ scheduledObject.height = this.timeDifference(scheduledObject.start, scheduledObject.end);
14448
+ this.timeChangeEvent.emit(originalObject);
14449
+ this.currentDraggingObject = undefined;
14450
+ }
14451
+ else {
14452
+ var parsed = this.tryParseJSONObject(dragEvent.dataTransfer.getData("text"));
14453
+ if (!parsed) {
14454
+ this.newObjectPlanEvent.emit({ currentHour: hour, data: parsed.toString() });
14455
+ }
14456
+ }
14457
+ };
14458
+ HourSchedulingExpandableComponent.prototype.allowDrop = function (event, hour) {
14459
+ event.preventDefault();
14460
+ event.stopPropagation();
14461
+ if (this.currentDraggingObject) {
14462
+ var newStartDate_1 = this.convertDateToEuropean(this.currentDraggingObject.start);
14463
+ var hourSplit = hour.split(":");
14464
+ newStartDate_1.setHours(parseInt(hourSplit[0]));
14465
+ newStartDate_1.setHours(parseInt(hourSplit[1]));
14466
+ if (this.scheduledObjects.find(function (scheduledObject) { return scheduledObject.start === newStartDate_1; })) {
14467
+ return false;
14468
+ }
14469
+ else {
14470
+ return true;
14471
+ }
14472
+ }
14473
+ };
14474
+ // Triggered when resizing starts
14475
+ HourSchedulingExpandableComponent.prototype.onResizeStart = function (event, obj, direction) {
14476
+ this.resizing = true;
14477
+ this.resizeDirection = direction;
14478
+ this.currentResizingObject = obj;
14479
+ this.initialY = event.clientY;
14480
+ this.initialHeight = obj.height || 0;
14481
+ this.initialTop = obj.top || 0;
14482
+ // Listen to mousemove and mouseup events globally
14483
+ document.addEventListener('mousemove', this.onResizing.bind(this));
14484
+ document.addEventListener('mouseup', this.onResizeEnd.bind(this));
14485
+ };
14486
+ // Handle resizing with snapping to 30px increments and minimum height restriction
14487
+ HourSchedulingExpandableComponent.prototype.onResizing = function (event) {
14488
+ if (!this.resizing || !this.currentResizingObject)
14489
+ return;
14490
+ var deltaY = event.clientY - this.initialY;
14491
+ var snappedDeltaY = Math.round(deltaY / 30) * 30;
14492
+ if (this.resizeDirection === 'bottom') {
14493
+ var nextObject = this._findNextObject(this.currentResizingObject);
14494
+ var maxHeight = nextObject ? nextObject.top - this.currentResizingObject.top : Infinity;
14495
+ // Block expanding beyond the next object and shrinking below 30px
14496
+ var newHeight = Math.max(this.initialHeight + snappedDeltaY, this.MIN_HEIGHT);
14497
+ this.currentResizingObject.height = Math.min(newHeight, maxHeight);
14498
+ }
14499
+ else if (this.resizeDirection === 'top') {
14500
+ var previousObject = this._findPreviousObject(this.currentResizingObject);
14501
+ var minTop = previousObject ? previousObject.top + previousObject.height : 0;
14502
+ var newHeight = Math.max(this.initialHeight - snappedDeltaY, this.MIN_HEIGHT);
14503
+ var newTop = this.initialTop + (this.initialHeight - newHeight);
14504
+ // Block moving above the previous object's bottom and shrinking below MIN_HEIGHT
14505
+ if (newHeight >= this.MIN_HEIGHT && newTop >= minTop) {
14506
+ this.currentResizingObject.top = newTop;
14507
+ this.currentResizingObject.height = newHeight;
14508
+ }
14509
+ }
14510
+ // Ensure change detection happens
14511
+ this.cdRef.detectChanges();
14512
+ };
14513
+ // Triggered when resizing ends
14514
+ HourSchedulingExpandableComponent.prototype.onResizeEnd = function (event) {
14515
+ var _this = this;
14516
+ var object = this.currentResizingObject;
14517
+ if (object && object.selected) {
14518
+ var originalObject = this.schedule[this.objectsProp].find(function (scheduledObject) { return scheduledObject[_this.idProp] === object.id; });
14519
+ if (originalObject) {
14520
+ // Start date calculation first
14521
+ originalObject[this.startTimeProp] = this.addMinutes(this.convertDateToEuropean(this.schedule[this.childProp][this.startTimeProp]), object.top);
14522
+ // Then end date calculation based on the height of the object
14523
+ originalObject[this.endTimeProp] = this.addMinutes(this.convertDateToEuropean(originalObject[this.startTimeProp]), object.height);
14524
+ }
14525
+ this.timeChangeEvent.emit(originalObject);
14526
+ this.resizing = false;
14527
+ this.currentResizingObject.selected = false;
14528
+ this.currentResizingObject = null;
14529
+ }
14530
+ // Remove global event listeners
14531
+ document.removeEventListener('mousemove', this.onResizing.bind(this));
14532
+ document.removeEventListener('mouseup', this.onResizeEnd.bind(this));
14533
+ };
14534
+ HourSchedulingExpandableComponent.prototype.timeDifference = function (date1, date2) {
14535
+ var difference = this.convertDateToEuropean(date1).getTime() / 1000 - this.convertDateToEuropean(date2).getTime() / 1000;
14536
+ return Math.abs(difference / 60);
14537
+ };
14538
+ HourSchedulingExpandableComponent.prototype.generateTimeBlocks = function () {
14539
+ var startUnix = !this.childProp ? this.dateToUnixEpoch(this.convertDateToEuropean(this.schedule[this.startTimeProp])) : this.dateToUnixEpoch(this.convertDateToEuropean(this.schedule[this.childProp][this.startTimeProp]));
14540
+ var endUnix = !this.childProp ? this.dateToUnixEpoch(this.convertDateToEuropean(this.schedule[this.endTimeProp])) : this.dateToUnixEpoch(this.convertDateToEuropean(this.schedule[this.childProp][this.endTimeProp]));
14541
+ var interval = 60 * 60;
14542
+ for (var hourCount = startUnix; hourCount <= endUnix; hourCount += interval) {
14543
+ var hour = new Date(hourCount * 1000);
14544
+ var hourString = hour.getHours() + ":" + (hour.getMinutes() === 0 ? '00' : hour.getMinutes());
14545
+ this.hourLabels.push(hourString);
14546
+ }
14547
+ };
14548
+ HourSchedulingExpandableComponent.prototype.dateToUnixEpoch = function (date) {
14549
+ return Math.floor(date.getTime()) / 1000;
14550
+ };
14551
+ HourSchedulingExpandableComponent.prototype.addMinutes = function (date, minutes) {
14552
+ return new Date(date.getTime() + minutes * 60000);
14553
+ };
14554
+ HourSchedulingExpandableComponent.prototype.tryParseJSONObject = function (jsonString) {
14555
+ try {
14556
+ var o = JSON.parse(jsonString);
14557
+ if (o && typeof o === "object") {
14558
+ return o;
14559
+ }
14560
+ }
14561
+ catch (e) {
14562
+ }
14563
+ return false;
14564
+ };
14565
+ HourSchedulingExpandableComponent.prototype.addHalfHour = function (hour) {
14566
+ var split = hour.split(":");
14567
+ split[1] = "30";
14568
+ return split.join(':');
14569
+ };
14570
+ HourSchedulingExpandableComponent.prototype.convertTZ = function (date, tzString) {
14571
+ return new Date((typeof date === "string" ? new Date(date) : date).toLocaleString("en-US", { timeZone: tzString }));
14572
+ };
14573
+ HourSchedulingExpandableComponent.prototype.convertDateToEuropean = function (date) {
14574
+ return this.convertTZ(date, 'Europe/Amsterdam');
14575
+ };
14576
+ HourSchedulingExpandableComponent.prototype.handleDeselectAll = function () {
14577
+ this.scheduledObjects.forEach(function (scheduledObject) {
14578
+ if (scheduledObject.selected) {
14579
+ scheduledObject.selected = false;
14580
+ }
14581
+ });
14582
+ };
14583
+ return HourSchedulingExpandableComponent;
14584
+ }());
14585
+ HourSchedulingExpandableComponent.decorators = [
14586
+ { type: i0.Component, args: [{
14587
+ selector: 'co-hour-scheduling-expandable',
14588
+ template: "\n <div class=\"wrapper\">\n <div class=\"time-block\" *ngFor=\"let hour of hourLabels\">\n <div class=\"hour-label\"><span [textContent]=\"hour\"></span></div>\n\n <div class=\"object-display\">\n <div class=\"first-half-hour object-half\" (dragover)=\"allowDrop($event, hour)\"\n (drop)=\"handleDrop($event, hour)\">\n </div>\n\n <div class=\"second-half-hour object-half\" (dragover)=\"allowDrop($event, addHalfHour(hour))\"\n (drop)=\"handleDrop($event, addHalfHour(hour))\">\n </div>\n </div>\n </div>\n\n <div class=\"scheduled-objects\" >\n <ng-container>\n <ng-template\n [ngTemplateOutlet]=\"customTemplate\"\n [ngTemplateOutletContext]=\"{\n objects: scheduledObjects,\n onSelectBlock: this.onSelectBlock.bind(this),\n onResizeStart: this.onResizeStart.bind(this),\n onDragStartCustom: this.onDragStartCustom.bind(this)\n\n }\"\n >\n <ng-content></ng-content>\n </ng-template>\n </ng-container>\n </div>\n\n </div>\n\n ",
14589
+ changeDetection: i0.ChangeDetectionStrategy.OnPush,
14590
+ encapsulation: i0.ViewEncapsulation.None
14591
+ },] }
14592
+ ];
14593
+ HourSchedulingExpandableComponent.ctorParameters = function () { return [
14594
+ { type: i0.ChangeDetectorRef },
14595
+ { type: common.DatePipe },
14596
+ { type: i0.ElementRef }
14597
+ ]; };
14598
+ HourSchedulingExpandableComponent.propDecorators = {
14599
+ schedule: [{ type: i0.Input }],
14600
+ startTimeProp: [{ type: i0.Input }],
14601
+ endTimeProp: [{ type: i0.Input }],
14602
+ objectsProp: [{ type: i0.Input }],
14603
+ childProp: [{ type: i0.Input }],
14604
+ customTemplate: [{ type: i0.Input }],
14605
+ idProp: [{ type: i0.Input }],
14606
+ timeChangeEvent: [{ type: i0.Output }],
14607
+ newObjectPlanEvent: [{ type: i0.Output }],
14608
+ showClass: [{ type: i0.HostBinding, args: ['class.co-hour-scheduling-expandable',] }],
14609
+ onResize: [{ type: i0.HostListener, args: ['window:resize', ['$event'],] }],
14610
+ clickOut: [{ type: i0.HostListener, args: ['document:click', ['$event'],] }]
14611
+ };
14612
+
14613
+ var HourSchedulingExpandableTemplateComponent = /** @class */ (function () {
14614
+ function HourSchedulingExpandableTemplateComponent() {
14615
+ this.objects = [];
14616
+ }
14617
+ HourSchedulingExpandableTemplateComponent.prototype.showClass = function () {
14618
+ return true;
14619
+ };
14620
+ HourSchedulingExpandableTemplateComponent.prototype.onExpandableDragStart = function (event, obj, onDragStartCustom) {
14621
+ onDragStartCustom === null || onDragStartCustom === void 0 ? void 0 : onDragStartCustom.call(obj);
14622
+ event.dataTransfer.setData("text", JSON.stringify({ obj: obj }));
14623
+ };
14624
+ return HourSchedulingExpandableTemplateComponent;
14625
+ }());
14626
+ HourSchedulingExpandableTemplateComponent.decorators = [
14627
+ { type: i0.Component, args: [{
14628
+ selector: "co-hour-scheduling-expandable-template",
14629
+ template: "\n <div\n *ngFor=\"let obj of objects\"\n [class]=\"'custom-scheduled-object'\"\n [class.selected]=\"obj['selected']\"\n [draggable]=\"!obj['selected']\"\n [style.--height]=\"obj['height'] + 'px'\"\n [style.--top]=\"obj['top'] + 'px'\"\n (click)=\"onSelectBlock(obj)\"\n (dragstart)=\"onExpandableDragStart($event, obj, onDragStartCustom(obj) )\">\n\n <div\n *ngIf=\"obj['selected'] && obj['showTopResizer']\"\n class=\"top-resizer\"\n (mousedown)=\"onResizeStart($event, obj, 'top')\"></div>\n <ng-template\n [ngTemplateOutlet]=\"objectTemplate\"\n [ngTemplateOutletContext]=\"{\n object: obj\n }\"\n >\n </ng-template>\n <div *ngIf=\"obj['selected'] && obj['showBottomResizer']\"\n class=\"bottom-resizer\"\n (mousedown)=\"onResizeStart($event, obj, 'bottom')\"></div>\n </div>\n ",
14630
+ encapsulation: i0.ViewEncapsulation.None
14631
+ },] }
14632
+ ];
14633
+ HourSchedulingExpandableTemplateComponent.propDecorators = {
14634
+ objectTemplate: [{ type: i0.Input }],
14635
+ objects: [{ type: i0.Input }],
14636
+ onDragStartCustom: [{ type: i0.Input }],
14637
+ onResizeStart: [{ type: i0.Input }],
14638
+ onSelectBlock: [{ type: i0.Input }],
14639
+ showClass: [{ type: i0.HostBinding, args: ["class.co-hour-scheduling-expandable-template",] }]
14307
14640
  };
14308
14641
 
14309
14642
  var HourSchedulingTestObjectComponent = /** @class */ (function () {
@@ -14322,7 +14655,7 @@
14322
14655
  },] }
14323
14656
  ];
14324
14657
  HourSchedulingTestObjectComponent.propDecorators = {
14325
- showClass: [{ type: i0.HostBinding, args: ["class.co-test-object",] }],
14658
+ showClass: [{ type: i0.HostBinding, args: ["class.co-hour-scheduling-test-object",] }],
14326
14659
  title: [{ type: i0.Input }],
14327
14660
  subTitle: [{ type: i0.Input }]
14328
14661
  };
@@ -14349,6 +14682,29 @@
14349
14682
  },] }
14350
14683
  ];
14351
14684
 
14685
+ var HourSchedulingExpandableComponentModule = /** @class */ (function () {
14686
+ function HourSchedulingExpandableComponentModule() {
14687
+ }
14688
+ return HourSchedulingExpandableComponentModule;
14689
+ }());
14690
+ HourSchedulingExpandableComponentModule.decorators = [
14691
+ { type: i0.NgModule, args: [{
14692
+ imports: [
14693
+ common.CommonModule,
14694
+ HourSchedulingComponentModule,
14695
+ ],
14696
+ declarations: [
14697
+ HourSchedulingExpandableComponent,
14698
+ HourSchedulingExpandableTemplateComponent
14699
+ ],
14700
+ exports: [
14701
+ HourSchedulingExpandableComponent,
14702
+ HourSchedulingExpandableTemplateComponent
14703
+ ],
14704
+ providers: [common.DatePipe]
14705
+ },] }
14706
+ ];
14707
+
14352
14708
  /*
14353
14709
  * Public API Surface of corecomponents
14354
14710
  */
@@ -14407,6 +14763,9 @@
14407
14763
  exports.GridToolbarModule = GridToolbarModule;
14408
14764
  exports.HourSchedulingComponent = HourSchedulingComponent;
14409
14765
  exports.HourSchedulingComponentModule = HourSchedulingComponentModule;
14766
+ exports.HourSchedulingExpandableComponent = HourSchedulingExpandableComponent;
14767
+ exports.HourSchedulingExpandableComponentModule = HourSchedulingExpandableComponentModule;
14768
+ exports.HourSchedulingExpandableTemplateComponent = HourSchedulingExpandableTemplateComponent;
14410
14769
  exports.IconCacheService = IconCacheService;
14411
14770
  exports.IconCollapseHandleComponent = IconCollapseHandleComponent;
14412
14771
  exports.IconCollapseHandleModule = IconCollapseHandleModule;