@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.
@@ -6555,9 +6555,14 @@ class CalendarTemplateComponent {
6555
6555
  }
6556
6556
  selectDate(day) {
6557
6557
  if (day) {
6558
- this.selectedDate = day;
6559
- this._fillDatesBetweenSelected();
6560
- if (this.doubleCalendar) {
6558
+ if (!this.doubleCalendar) {
6559
+ // Single calendar → select and close
6560
+ this.selectedDate = day;
6561
+ this.setAndClose();
6562
+ }
6563
+ else {
6564
+ this.selectedDate = day;
6565
+ this._fillDatesBetweenSelected();
6561
6566
  this.dateSelected.emit(new Date(this.selectedDate));
6562
6567
  }
6563
6568
  }
@@ -6757,8 +6762,8 @@ CalendarTemplateComponent.decorators = [
6757
6762
  </div>
6758
6763
  </div>
6759
6764
  <div class="calendar-action-buttons" *ngIf="showButtons">
6760
- <span class="set-and-close-button" (click)="setAndClose()">Instellen</span>
6761
- <span class="clear-date-button" (click)="clearDate()">Wissen</span>
6765
+ <span class="set-and-close-button" *ngIf="this.doubleCalendar" (click)="setAndClose()">Instellen</span>
6766
+ <span class="clear-date-button" *ngIf="this.selectedDate" (click)="clearDate()">Wissen</span>
6762
6767
  <span class="cancel-button" (click)="closeDate()">Annuleren</span>
6763
6768
  </div>
6764
6769
  </div>
@@ -14682,7 +14687,14 @@ HourSchedulingExpandableComponent.propDecorators = {
14682
14687
 
14683
14688
  class HourSchedulingExpandableTemplateComponent {
14684
14689
  constructor() {
14685
- this.objects = [];
14690
+ this.layouts = [];
14691
+ }
14692
+ set objects(objects) {
14693
+ this._objects = objects;
14694
+ this.layouts = this.calculateLeftAndWidthOfObjects();
14695
+ }
14696
+ get objects() {
14697
+ return this._objects;
14686
14698
  }
14687
14699
  showClass() {
14688
14700
  return true;
@@ -14691,42 +14703,67 @@ class HourSchedulingExpandableTemplateComponent {
14691
14703
  onDragStartCustom === null || onDragStartCustom === void 0 ? void 0 : onDragStartCustom.call(obj);
14692
14704
  event.dataTransfer.setData("text", JSON.stringify({ obj }));
14693
14705
  }
14694
- leftForObject(index, objects) {
14695
- if (index === 0) {
14696
- return 0;
14697
- }
14698
- else {
14699
- return index * this.widthForObject(index, objects);
14700
- }
14701
- }
14702
- widthForObject(index, objects) {
14703
- if (objects.length > 1) {
14704
- return 100 / objects.length;
14705
- }
14706
- if (objects.length === 1) {
14707
- return 100;
14708
- }
14706
+ calculateLeftAndWidthOfObjects() {
14707
+ const layoutData = new Array(this._objects.length);
14708
+ // Helper: check if two time ranges overlap
14709
+ const isOverlapping = (startA, endA, startB, endB) => {
14710
+ return startA < endB && startB < endA;
14711
+ };
14712
+ // Step 1: build overlap groups
14713
+ const overlapGroups = [];
14714
+ const processed = new Set();
14715
+ for (let i = 0; i < this._objects.length; i++) {
14716
+ if (processed.has(i))
14717
+ continue;
14718
+ const group = [i];
14719
+ const objA = this._objects[i];
14720
+ const startA = new Date(objA.start);
14721
+ const endA = new Date(objA.end);
14722
+ for (let j = i + 1; j < this._objects.length; j++) {
14723
+ const objB = this._objects[j];
14724
+ const startB = new Date(objB.start);
14725
+ const endB = new Date(objB.end);
14726
+ if (isOverlapping(startA, endA, startB, endB)) {
14727
+ group.push(j);
14728
+ processed.add(j);
14729
+ }
14730
+ }
14731
+ group.forEach(index => processed.add(index));
14732
+ overlapGroups.push(group);
14733
+ }
14734
+ // Step 2: assign layout per group
14735
+ overlapGroups.forEach(group => {
14736
+ const total = group.length;
14737
+ const width = 100 / total;
14738
+ group.forEach((objectIndex, i) => {
14739
+ layoutData[objectIndex] = {
14740
+ leftPercent: i * width,
14741
+ widthPercent: width
14742
+ };
14743
+ });
14744
+ });
14745
+ return layoutData;
14709
14746
  }
14710
14747
  }
14711
14748
  HourSchedulingExpandableTemplateComponent.decorators = [
14712
14749
  { type: Component, args: [{
14713
14750
  selector: "co-hour-scheduling-expandable-template",
14714
14751
  template: `
14715
- <div class="row">
14752
+
14716
14753
  <div
14717
14754
  *ngFor="let obj of objects"
14718
14755
  [class]="'custom-scheduled-object'"
14719
- [class.selected]="obj['selected']"
14720
- [draggable]="!obj['selected']"
14721
- [style.--height]="obj['height'] + 'px'"
14722
- [style.--top]="obj['top'] + 'px'"
14723
- [style.--left]="leftForObject(objects.indexOf(obj), objects) + '%'"
14724
- [style.--width]="widthForObject(objects.indexOf(obj), objects) + '%'"
14756
+ [class.selected]="obj.selected"
14757
+ [draggable]="!obj.selected"
14758
+ [style.--height]="obj.height + 'px'"
14759
+ [style.--top]="obj.top + 'px'"
14760
+ [style.--left]="layouts[objects.indexOf(obj)].leftPercent + '%'"
14761
+ [style.--width]="layouts[objects.indexOf(obj)].widthPercent + '%'"
14725
14762
  (click)="onSelectBlock(obj)"
14726
14763
  (dragstart)="onExpandableDragStart($event, obj, onDragStartCustom(obj) )">
14727
14764
 
14728
14765
  <div
14729
- *ngIf="obj['selected']"
14766
+ *ngIf="obj.selected"
14730
14767
  class="top-resizer"
14731
14768
  (mousedown)="onResizeStart($event, obj, 'top')"></div>
14732
14769
  <ng-template
@@ -14736,11 +14773,10 @@ HourSchedulingExpandableTemplateComponent.decorators = [
14736
14773
  }"
14737
14774
  >
14738
14775
  </ng-template>
14739
- <div *ngIf="obj['selected']"
14776
+ <div *ngIf="obj.selected"
14740
14777
  class="bottom-resizer"
14741
14778
  (mousedown)="onResizeStart($event, obj, 'bottom')"></div>
14742
14779
  </div>
14743
- </div>
14744
14780
  `,
14745
14781
  encapsulation: ViewEncapsulation.None
14746
14782
  },] }
@@ -14751,6 +14787,8 @@ HourSchedulingExpandableTemplateComponent.propDecorators = {
14751
14787
  onDragStartCustom: [{ type: Input }],
14752
14788
  onResizeStart: [{ type: Input }],
14753
14789
  onSelectBlock: [{ type: Input }],
14790
+ startTimeProp: [{ type: Input }],
14791
+ endTimeProp: [{ type: Input }],
14754
14792
  showClass: [{ type: HostBinding, args: ["class.co-hour-scheduling-expandable-template",] }]
14755
14793
  };
14756
14794