@colijnit/corecomponents_v12 255.1.3 → 255.1.4

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.
@@ -14090,6 +14090,131 @@
14090
14090
  },] }
14091
14091
  ];
14092
14092
 
14093
+ var HourSchedulingComponent = /** @class */ (function () {
14094
+ function HourSchedulingComponent(cdRef) {
14095
+ this.cdRef = cdRef;
14096
+ this.showClass = true;
14097
+ this.customTemplateUsed = false;
14098
+ this.hours = [];
14099
+ this.scheduledObjects = {};
14100
+ this.draggedObject = null;
14101
+ }
14102
+ HourSchedulingComponent.prototype.ngOnInit = function () {
14103
+ this.generateTimeBlocks();
14104
+ };
14105
+ HourSchedulingComponent.prototype.generateTimeBlocks = function () {
14106
+ var startTime = this.schedule[this.startTimeProp];
14107
+ var endTime = this.schedule[this.endTimeProp];
14108
+ var objectsList = this.schedule[this.objectsProp];
14109
+ for (var hour = startTime; hour <= endTime; hour++) {
14110
+ this.hours.push(this.formatHour(hour));
14111
+ this.scheduledObjects[this.formatHour(hour)] = this.getObjectsForHour(hour, objectsList);
14112
+ }
14113
+ };
14114
+ HourSchedulingComponent.prototype.getObjectsForHour = function (hour, objectsList) {
14115
+ var objectsForHour = [];
14116
+ objectsList.forEach(function (obj) {
14117
+ if (obj.start === hour) {
14118
+ objectsForHour.push(Object.assign({}, obj));
14119
+ }
14120
+ });
14121
+ return objectsForHour;
14122
+ };
14123
+ HourSchedulingComponent.prototype.formatHour = function (hour) {
14124
+ return hour + ":00";
14125
+ };
14126
+ HourSchedulingComponent.prototype.onDragStart = function (event, obj) {
14127
+ var currentTarget = event.currentTarget;
14128
+ var currentHourSpan = currentTarget.parentElement.parentElement.querySelector('.hour-label span');
14129
+ var currentHour = currentHourSpan.textContent;
14130
+ this.draggedObject = obj;
14131
+ event.dataTransfer.setData('text', JSON.stringify({ obj: obj, currentHour: currentHour }));
14132
+ };
14133
+ HourSchedulingComponent.prototype.onDragOver = function (event) {
14134
+ event.preventDefault();
14135
+ };
14136
+ HourSchedulingComponent.prototype.onDrop = function (event, hour) {
14137
+ var _this = this;
14138
+ event.preventDefault();
14139
+ var data = JSON.parse(event.dataTransfer.getData('text'));
14140
+ var newStartHour = parseInt(hour.split(':')[0], 10);
14141
+ var newEndHour = newStartHour + 1;
14142
+ data.obj.start = newStartHour;
14143
+ data.obj.end = newEndHour;
14144
+ var currentHourBlock = data.currentHour;
14145
+ this.scheduledObjects[currentHourBlock] = this.scheduledObjects[currentHourBlock].filter(function (o) { return o !== _this.draggedObject; });
14146
+ var newHourBlock = this.formatHour(newStartHour);
14147
+ if (!this.scheduledObjects[newHourBlock]) {
14148
+ this.scheduledObjects[newHourBlock] = [];
14149
+ }
14150
+ this.scheduledObjects[newHourBlock].push(data.obj);
14151
+ this.draggedObject = null;
14152
+ this.cdRef.detectChanges();
14153
+ };
14154
+ return HourSchedulingComponent;
14155
+ }());
14156
+ HourSchedulingComponent.decorators = [
14157
+ { type: i0.Component, args: [{
14158
+ selector: 'co-hour-scheduling',
14159
+ template: "\n <div class=\"time-block\" *ngFor=\"let hour of hours\">\n <div class=\"hour-label\"><span [textContent]=\"hour\"></span></div>\n <div class=\"object-display\"\n (dragover)=\"onDragOver($event)\"\n (drop)=\"onDrop($event, hour)\">\n <ng-container *ngIf=\"!customTemplateUsed\">\n <ng-container *ngIf=\"scheduledObjects[hour]\">\n <div *ngFor=\"let obj of scheduledObjects[hour]\" class=\"scheduled-object\"\n [draggable]=\"true\"\n (dragstart)=\"onDragStart($event, obj)\">\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 <ng-template #customContent *ngIf=\"customTemplateUsed\">\n <ng-container *ngTemplateOutlet=\"customTemplate; context: { objects: scheduledObjects[hour] }\">\n </ng-container>\n </ng-template>\n </div>\n </div>\n ",
14160
+ encapsulation: i0.ViewEncapsulation.None
14161
+ },] }
14162
+ ];
14163
+ HourSchedulingComponent.ctorParameters = function () { return [
14164
+ { type: i0.ChangeDetectorRef }
14165
+ ]; };
14166
+ HourSchedulingComponent.propDecorators = {
14167
+ showClass: [{ type: i0.HostBinding, args: ['class.co-hour-scheduling',] }],
14168
+ schedule: [{ type: i0.Input }],
14169
+ startTimeProp: [{ type: i0.Input }],
14170
+ endTimeProp: [{ type: i0.Input }],
14171
+ objectsProp: [{ type: i0.Input }],
14172
+ customTemplate: [{ type: i0.Input }],
14173
+ customTemplateUsed: [{ type: i0.Input }]
14174
+ };
14175
+
14176
+ var HourSchedulingTestObjectComponent = /** @class */ (function () {
14177
+ function HourSchedulingTestObjectComponent() {
14178
+ }
14179
+ HourSchedulingTestObjectComponent.prototype.showClass = function () {
14180
+ return true;
14181
+ };
14182
+ return HourSchedulingTestObjectComponent;
14183
+ }());
14184
+ HourSchedulingTestObjectComponent.decorators = [
14185
+ { type: i0.Component, args: [{
14186
+ selector: "co-hour-scheduling-test-object",
14187
+ template: "\n <span [textContent]=\"title\"></span>\n <span [textContent]=\"subTitle\"></span>\n ",
14188
+ encapsulation: i0.ViewEncapsulation.None
14189
+ },] }
14190
+ ];
14191
+ HourSchedulingTestObjectComponent.propDecorators = {
14192
+ showClass: [{ type: i0.HostBinding, args: ["class.co-test-object",] }],
14193
+ title: [{ type: i0.Input }],
14194
+ subTitle: [{ type: i0.Input }]
14195
+ };
14196
+
14197
+ var HourSchedulingComponentModule = /** @class */ (function () {
14198
+ function HourSchedulingComponentModule() {
14199
+ }
14200
+ return HourSchedulingComponentModule;
14201
+ }());
14202
+ HourSchedulingComponentModule.decorators = [
14203
+ { type: i0.NgModule, args: [{
14204
+ imports: [
14205
+ common.CommonModule
14206
+ ],
14207
+ declarations: [
14208
+ HourSchedulingComponent,
14209
+ HourSchedulingTestObjectComponent,
14210
+ ],
14211
+ exports: [
14212
+ HourSchedulingComponent,
14213
+ HourSchedulingTestObjectComponent
14214
+ ]
14215
+ },] }
14216
+ ];
14217
+
14093
14218
  /*
14094
14219
  * Public API Surface of corecomponents
14095
14220
  */
@@ -14146,6 +14271,8 @@
14146
14271
  exports.GridToolbarButtonModule = GridToolbarButtonModule;
14147
14272
  exports.GridToolbarComponent = GridToolbarComponent;
14148
14273
  exports.GridToolbarModule = GridToolbarModule;
14274
+ exports.HourSchedulingComponent = HourSchedulingComponent;
14275
+ exports.HourSchedulingComponentModule = HourSchedulingComponentModule;
14149
14276
  exports.IconCacheService = IconCacheService;
14150
14277
  exports.IconCollapseHandleComponent = IconCollapseHandleComponent;
14151
14278
  exports.IconCollapseHandleModule = IconCollapseHandleModule;
@@ -14238,6 +14365,7 @@
14238
14365
  exports["ɵbl"] = TooltipModule;
14239
14366
  exports["ɵbm"] = TooltipComponent;
14240
14367
  exports["ɵbn"] = TooltipDirective;
14368
+ exports["ɵbo"] = HourSchedulingTestObjectComponent;
14241
14369
  exports["ɵc"] = MD_RIPPLE_GLOBAL_OPTIONS;
14242
14370
  exports["ɵd"] = CoRippleDirective;
14243
14371
  exports["ɵe"] = CoViewportRulerService;