@colijnit/corecomponents_v12 258.1.3 → 258.1.5

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.
@@ -7109,9 +7109,14 @@
7109
7109
  };
7110
7110
  CalendarTemplateComponent.prototype.selectDate = function (day) {
7111
7111
  if (day) {
7112
- this.selectedDate = day;
7113
- this._fillDatesBetweenSelected();
7114
- if (this.doubleCalendar) {
7112
+ if (!this.doubleCalendar) {
7113
+ // Single calendar → select and close
7114
+ this.selectedDate = day;
7115
+ this.setAndClose();
7116
+ }
7117
+ else {
7118
+ this.selectedDate = day;
7119
+ this._fillDatesBetweenSelected();
7115
7120
  this.dateSelected.emit(new Date(this.selectedDate));
7116
7121
  }
7117
7122
  }
@@ -7247,7 +7252,7 @@
7247
7252
  CalendarTemplateComponent.decorators = [
7248
7253
  { type: i0.Component, args: [{
7249
7254
  selector: "calendar-template",
7250
- template: "\n <div class=\"calendar\">\n <div class=\"selected-date-display\">\n <span *ngIf=\"selectedDate\" class=\"selected-date-year\">\n {{ selectedDate.getFullYear() }}\n </span>\n <span *ngIf=\"selectedDate\" class=\"selected-date-day\">\n {{ selectedDate | date: 'EEE d MMM' }}\n </span>\n <span *ngIf=\"!selectedDate\" class=\"no-date-selected\" [textContent]=\"'Selecteer datum'\"></span>\n </div>\n <div class=\"calendar-header\" *ngIf=\"monthSelection || yearSelection\">\n <co-icon class=\"calendar-change-month-button\" [icon]=\"icons.ArrowPointLeft\" (click)=\"prevMonth()\"></co-icon>\n\n <div class=\"calendar-header-title-wrapper\">\n <span class=\"calendar-header-title\" [textContent]=\"monthSelection ? monthHeader : yearHeader\"\n (click)=\"monthSelection ? openMonthSelection() : openYearSelection()\"\n ></span>\n </div>\n\n <co-icon class=\"calendar-change-month-button\" [icon]=\"icons.ArrowPointRight\" (click)=\"nextMonth()\"></co-icon>\n </div>\n\n <div class=\"selection-grid month\" *ngIf=\"showMonthSelection\">\n <div *ngFor=\"let month of monthSelectionNames\"\n class=\"calendar-month-or-year\"\n (click)=\"selectMonth(month)\">\n <ng-container *ngIf=\"month\">\n <div class=\"month\" [textContent]=\"month\"></div>\n </ng-container>\n </div>\n </div>\n\n <div class=\"selection-grid year\" *ngIf=\"showYearSelection\">\n <div *ngFor=\"let year of yearSelectionYears\"\n class=\"calendar-month-or-year\"\n (click)=\"selectYear(year)\"\n [textContent]=\"year\">\n <ng-container *ngIf=\"year\">\n <div class=\"year\" [textContent]=\"year\"></div>\n </ng-container>\n </div>\n </div>\n <div class=\"calendar-wrapper\">\n <div class=\"week-wrapper\" *ngIf=\"showWeekNumbers && showCalendarBody\">\n <div class=\"week-number\" [textContent]=\"'W'\"></div>\n <div class=\"week-number\" *ngFor=\"let weekNumber of weekNumbers\">\n {{ weekNumber }}\n </div>\n </div>\n <div class=\"calendar-body\" *ngIf=\"showCalendarBody\">\n <div class=\"day-names\">\n <div class=\"weekday\" *ngFor=\"let dayName of dayNames\" [textContent]=\"dayName\"></div>\n </div>\n <div *ngFor=\"let day of daysInMonth\" class=\"calendar-day\"\n [class.highlighted-day]=\"daysToHighlight.includes(day)\"\n [class.selected-day]=\"selectedDate && (day && day.getTime() === selectedDate.getTime()) ||\n secondSelectedDate && (day && day.getTime() === secondSelectedDate.getTime()) ||\n temporarySelectedSecondaryDate && (day && day.getTime() === temporarySelectedSecondaryDate.getTime())\"\n (click)=\"selectDate(day)\"\n (mouseover)=\"handleMouseOverDay(day)\">\n <!-- Day number -->\n <ng-container *ngIf=\"day\">\n <div class=\"day-number\" [textContent]=\"day.getDate()\"></div>\n </ng-container>\n </div>\n </div>\n </div>\n <div class=\"calendar-action-buttons\" *ngIf=\"showButtons\">\n <span class=\"set-and-close-button\" (click)=\"setAndClose()\">Instellen</span>\n <span class=\"clear-date-button\" (click)=\"clearDate()\">Wissen</span>\n <span class=\"cancel-button\" (click)=\"closeDate()\">Annuleren</span>\n </div>\n </div>\n ",
7255
+ template: "\n <div class=\"calendar\">\n <div class=\"selected-date-display\">\n <span *ngIf=\"selectedDate\" class=\"selected-date-year\">\n {{ selectedDate.getFullYear() }}\n </span>\n <span *ngIf=\"selectedDate\" class=\"selected-date-day\">\n {{ selectedDate | date: 'EEE d MMM' }}\n </span>\n <span *ngIf=\"!selectedDate\" class=\"no-date-selected\" [textContent]=\"'Selecteer datum'\"></span>\n </div>\n <div class=\"calendar-header\" *ngIf=\"monthSelection || yearSelection\">\n <co-icon class=\"calendar-change-month-button\" [icon]=\"icons.ArrowPointLeft\" (click)=\"prevMonth()\"></co-icon>\n\n <div class=\"calendar-header-title-wrapper\">\n <span class=\"calendar-header-title\" [textContent]=\"monthSelection ? monthHeader : yearHeader\"\n (click)=\"monthSelection ? openMonthSelection() : openYearSelection()\"\n ></span>\n </div>\n\n <co-icon class=\"calendar-change-month-button\" [icon]=\"icons.ArrowPointRight\" (click)=\"nextMonth()\"></co-icon>\n </div>\n\n <div class=\"selection-grid month\" *ngIf=\"showMonthSelection\">\n <div *ngFor=\"let month of monthSelectionNames\"\n class=\"calendar-month-or-year\"\n (click)=\"selectMonth(month)\">\n <ng-container *ngIf=\"month\">\n <div class=\"month\" [textContent]=\"month\"></div>\n </ng-container>\n </div>\n </div>\n\n <div class=\"selection-grid year\" *ngIf=\"showYearSelection\">\n <div *ngFor=\"let year of yearSelectionYears\"\n class=\"calendar-month-or-year\"\n (click)=\"selectYear(year)\"\n [textContent]=\"year\">\n <ng-container *ngIf=\"year\">\n <div class=\"year\" [textContent]=\"year\"></div>\n </ng-container>\n </div>\n </div>\n <div class=\"calendar-wrapper\">\n <div class=\"week-wrapper\" *ngIf=\"showWeekNumbers && showCalendarBody\">\n <div class=\"week-number\" [textContent]=\"'W'\"></div>\n <div class=\"week-number\" *ngFor=\"let weekNumber of weekNumbers\">\n {{ weekNumber }}\n </div>\n </div>\n <div class=\"calendar-body\" *ngIf=\"showCalendarBody\">\n <div class=\"day-names\">\n <div class=\"weekday\" *ngFor=\"let dayName of dayNames\" [textContent]=\"dayName\"></div>\n </div>\n <div *ngFor=\"let day of daysInMonth\" class=\"calendar-day\"\n [class.highlighted-day]=\"daysToHighlight.includes(day)\"\n [class.selected-day]=\"selectedDate && (day && day.getTime() === selectedDate.getTime()) ||\n secondSelectedDate && (day && day.getTime() === secondSelectedDate.getTime()) ||\n temporarySelectedSecondaryDate && (day && day.getTime() === temporarySelectedSecondaryDate.getTime())\"\n (click)=\"selectDate(day)\"\n (mouseover)=\"handleMouseOverDay(day)\">\n <!-- Day number -->\n <ng-container *ngIf=\"day\">\n <div class=\"day-number\" [textContent]=\"day.getDate()\"></div>\n </ng-container>\n </div>\n </div>\n </div>\n <div class=\"calendar-action-buttons\" *ngIf=\"showButtons\">\n <span class=\"set-and-close-button\" *ngIf=\"this.doubleCalendar\" (click)=\"setAndClose()\">Instellen</span>\n <span class=\"clear-date-button\" *ngIf=\"this.selectedDate\" (click)=\"clearDate()\">Wissen</span>\n <span class=\"cancel-button\" (click)=\"closeDate()\">Annuleren</span>\n </div>\n </div>\n ",
7251
7256
  encapsulation: i0.ViewEncapsulation.None
7252
7257
  },] }
7253
7258
  ];
@@ -14982,8 +14987,19 @@
14982
14987
 
14983
14988
  var HourSchedulingExpandableTemplateComponent = /** @class */ (function () {
14984
14989
  function HourSchedulingExpandableTemplateComponent() {
14985
- this.objects = [];
14990
+ this.layouts = [];
14986
14991
  }
14992
+ Object.defineProperty(HourSchedulingExpandableTemplateComponent.prototype, "objects", {
14993
+ get: function () {
14994
+ return this._objects;
14995
+ },
14996
+ set: function (objects) {
14997
+ this._objects = objects;
14998
+ this.layouts = this.calculateLeftAndWidthOfObjects();
14999
+ },
15000
+ enumerable: false,
15001
+ configurable: true
15002
+ });
14987
15003
  HourSchedulingExpandableTemplateComponent.prototype.showClass = function () {
14988
15004
  return true;
14989
15005
  };
@@ -14991,28 +15007,53 @@
14991
15007
  onDragStartCustom === null || onDragStartCustom === void 0 ? void 0 : onDragStartCustom.call(obj);
14992
15008
  event.dataTransfer.setData("text", JSON.stringify({ obj: obj }));
14993
15009
  };
14994
- HourSchedulingExpandableTemplateComponent.prototype.leftForObject = function (index, objects) {
14995
- if (index === 0) {
14996
- return 0;
14997
- }
14998
- else {
14999
- return index * this.widthForObject(index, objects);
15000
- }
15001
- };
15002
- HourSchedulingExpandableTemplateComponent.prototype.widthForObject = function (index, objects) {
15003
- if (objects.length > 1) {
15004
- return 100 / objects.length;
15005
- }
15006
- if (objects.length === 1) {
15007
- return 100;
15008
- }
15010
+ HourSchedulingExpandableTemplateComponent.prototype.calculateLeftAndWidthOfObjects = function () {
15011
+ var layoutData = new Array(this._objects.length);
15012
+ // Helper: check if two time ranges overlap
15013
+ var isOverlapping = function (startA, endA, startB, endB) {
15014
+ return startA < endB && startB < endA;
15015
+ };
15016
+ // Step 1: build overlap groups
15017
+ var overlapGroups = [];
15018
+ var processed = new Set();
15019
+ for (var i = 0; i < this._objects.length; i++) {
15020
+ if (processed.has(i))
15021
+ continue;
15022
+ var group = [i];
15023
+ var objA = this._objects[i];
15024
+ var startA = new Date(objA.start);
15025
+ var endA = new Date(objA.end);
15026
+ for (var j = i + 1; j < this._objects.length; j++) {
15027
+ var objB = this._objects[j];
15028
+ var startB = new Date(objB.start);
15029
+ var endB = new Date(objB.end);
15030
+ if (isOverlapping(startA, endA, startB, endB)) {
15031
+ group.push(j);
15032
+ processed.add(j);
15033
+ }
15034
+ }
15035
+ group.forEach(function (index) { return processed.add(index); });
15036
+ overlapGroups.push(group);
15037
+ }
15038
+ // Step 2: assign layout per group
15039
+ overlapGroups.forEach(function (group) {
15040
+ var total = group.length;
15041
+ var width = 100 / total;
15042
+ group.forEach(function (objectIndex, i) {
15043
+ layoutData[objectIndex] = {
15044
+ leftPercent: i * width,
15045
+ widthPercent: width
15046
+ };
15047
+ });
15048
+ });
15049
+ return layoutData;
15009
15050
  };
15010
15051
  return HourSchedulingExpandableTemplateComponent;
15011
15052
  }());
15012
15053
  HourSchedulingExpandableTemplateComponent.decorators = [
15013
15054
  { type: i0.Component, args: [{
15014
15055
  selector: "co-hour-scheduling-expandable-template",
15015
- template: "\n <div class=\"row\">\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 [style.--left]=\"leftForObject(objects.indexOf(obj), objects) + '%'\"\n [style.--width]=\"widthForObject(objects.indexOf(obj), objects) + '%'\"\n (click)=\"onSelectBlock(obj)\"\n (dragstart)=\"onExpandableDragStart($event, obj, onDragStartCustom(obj) )\">\n\n <div\n *ngIf=\"obj['selected']\"\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']\"\n class=\"bottom-resizer\"\n (mousedown)=\"onResizeStart($event, obj, 'bottom')\"></div>\n </div>\n </div>\n ",
15056
+ template: "\n \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 [style.--left]=\"layouts[objects.indexOf(obj)].leftPercent + '%'\"\n [style.--width]=\"layouts[objects.indexOf(obj)].widthPercent + '%'\"\n (click)=\"onSelectBlock(obj)\"\n (dragstart)=\"onExpandableDragStart($event, obj, onDragStartCustom(obj) )\">\n\n <div\n *ngIf=\"obj.selected\"\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\"\n class=\"bottom-resizer\"\n (mousedown)=\"onResizeStart($event, obj, 'bottom')\"></div>\n </div>\n ",
15016
15057
  encapsulation: i0.ViewEncapsulation.None
15017
15058
  },] }
15018
15059
  ];
@@ -15022,6 +15063,8 @@
15022
15063
  onDragStartCustom: [{ type: i0.Input }],
15023
15064
  onResizeStart: [{ type: i0.Input }],
15024
15065
  onSelectBlock: [{ type: i0.Input }],
15066
+ startTimeProp: [{ type: i0.Input }],
15067
+ endTimeProp: [{ type: i0.Input }],
15025
15068
  showClass: [{ type: i0.HostBinding, args: ["class.co-hour-scheduling-expandable-template",] }]
15026
15069
  };
15027
15070