@colijnit/corecomponents_v12 255.1.6 → 255.1.8
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/colijnit-corecomponents_v12.umd.js +58 -19
- package/bundles/colijnit-corecomponents_v12.umd.js.map +1 -1
- package/colijnit-corecomponents_v12-255.1.7.tgz +0 -0
- package/colijnit-corecomponents_v12.metadata.json +1 -1
- package/esm2015/lib/components/hour-scheduling/hour-scheduling.component.js +76 -29
- package/esm2015/lib/components/hour-scheduling/hour-scheduling.module.js +4 -3
- package/esm2015/lib/components/list-of-values/list-of-values.component.js +4 -2
- package/fesm2015/colijnit-corecomponents_v12.js +79 -30
- package/fesm2015/colijnit-corecomponents_v12.js.map +1 -1
- package/lib/components/hour-scheduling/hour-scheduling.component.d.ts +14 -4
- package/lib/components/list-of-values/list-of-values.component.d.ts +1 -0
- package/package.json +1 -1
|
@@ -11497,6 +11497,7 @@
|
|
|
11497
11497
|
_this.multiselect = false;
|
|
11498
11498
|
_this.displayField = 'description';
|
|
11499
11499
|
_this.searchDisabled = false;
|
|
11500
|
+
_this.showChips = true;
|
|
11500
11501
|
_this.isSelectOpen = false;
|
|
11501
11502
|
_this.state = 'default';
|
|
11502
11503
|
_this.selectedModels = [];
|
|
@@ -11672,7 +11673,7 @@
|
|
|
11672
11673
|
ListOfValuesComponent.decorators = [
|
|
11673
11674
|
{ type: i0.Component, args: [{
|
|
11674
11675
|
selector: 'co-list-of-values',
|
|
11675
|
-
template: "\n <co-input-text aria-haspopup=\"listbox\" [attr.aria-expanded]=\"isSelectOpen\" aria-controls=\"lov-popup\" role=\"combobox\"\n class=\"no-focus-line\"\n overlayParent\n #parentForOverlay=\"overlayParent\" type=\"text\" [id]=\"label\"\n [model]=\"multiselect ? selectedModels : selectedModel\"\n [placeholder]=\"label\"\n [readonly]=\"readonly\"\n [disabled]=\"disabled\"\n [required]=\"required\"\n [noClickFocus]=\"false\"\n [leftIconData]=\"leftIconData\"\n [rightIcon]=\"isSelectOpen ? icons.ChevronUpRegular : icons.ChevronDownRegular\"\n [showClearButton]=\"true\"\n [useContent]=\"multiselect\"\n [customHeight]=\"multiselect\"\n [keepFocussed]=\"keepFocussed\"\n (modelChange)=\"handleInputModelChange($event)\"\n (click)=\"openPopup()\"\n (rightIconClick)=\"toggleSelect()\"\n (keydown)=\"handleInputKeyDown($event)\"\n (clearIconClick)=\"clearModel($event)\"\n (blur)=\"checkModel()\"\n >\n <ng-container *ngIf=\"multiselect\">\n <div class=\"multiselect-chips-wrapper\">\n <div class=\"chips\" *ngFor=\"let chip of model\">\n <span class=\"chips-description\" [textContent]=\"chip[displayField]\"></span>\n <co-icon class=\"remove-chip-icon\" [icon]=\"icons.CrossSkinny\" (click)=\"removeOptionFromModel(chip)\"></co-icon>\n </div>\n </div>\n </ng-container>\n </co-input-text>\n ",
|
|
11676
|
+
template: "\n <co-input-text aria-haspopup=\"listbox\" [attr.aria-expanded]=\"isSelectOpen\" aria-controls=\"lov-popup\" role=\"combobox\"\n class=\"no-focus-line\"\n overlayParent\n #parentForOverlay=\"overlayParent\" type=\"text\" [id]=\"label\"\n [model]=\"multiselect ? selectedModels : selectedModel\"\n [placeholder]=\"label\"\n [readonly]=\"readonly\"\n [disabled]=\"disabled\"\n [required]=\"required\"\n [noClickFocus]=\"false\"\n [leftIconData]=\"leftIconData\"\n [rightIcon]=\"isSelectOpen ? icons.ChevronUpRegular : icons.ChevronDownRegular\"\n [showClearButton]=\"true\"\n [useContent]=\"multiselect\"\n [customHeight]=\"multiselect\"\n [keepFocussed]=\"keepFocussed\"\n (modelChange)=\"handleInputModelChange($event)\"\n (click)=\"openPopup()\"\n (rightIconClick)=\"toggleSelect()\"\n (keydown)=\"handleInputKeyDown($event)\"\n (clearIconClick)=\"clearModel($event)\"\n (blur)=\"checkModel()\"\n >\n <ng-container *ngIf=\"multiselect && showChips\">\n <div class=\"multiselect-chips-wrapper\">\n <div class=\"chips\" *ngFor=\"let chip of model\">\n <span class=\"chips-description\" [textContent]=\"chip[displayField]\"></span>\n <co-icon class=\"remove-chip-icon\" [icon]=\"icons.CrossSkinny\" (click)=\"removeOptionFromModel(chip)\"></co-icon>\n </div>\n </div>\n </ng-container>\n </co-input-text>\n ",
|
|
11676
11677
|
providers: [
|
|
11677
11678
|
OverlayService,
|
|
11678
11679
|
{
|
|
@@ -11694,6 +11695,7 @@
|
|
|
11694
11695
|
label: [{ type: i0.Input }],
|
|
11695
11696
|
customCssClass: [{ type: i0.Input }],
|
|
11696
11697
|
searchDisabled: [{ type: i0.Input }],
|
|
11698
|
+
showChips: [{ type: i0.Input }],
|
|
11697
11699
|
showClass: [{ type: i0.HostBinding, args: ['class.co-list-of-values',] }]
|
|
11698
11700
|
};
|
|
11699
11701
|
|
|
@@ -14115,8 +14117,9 @@
|
|
|
14115
14117
|
];
|
|
14116
14118
|
|
|
14117
14119
|
var HourSchedulingComponent = /** @class */ (function () {
|
|
14118
|
-
function HourSchedulingComponent(cdRef) {
|
|
14120
|
+
function HourSchedulingComponent(cdRef, _datepipe) {
|
|
14119
14121
|
this.cdRef = cdRef;
|
|
14122
|
+
this._datepipe = _datepipe;
|
|
14120
14123
|
this.showClass = true;
|
|
14121
14124
|
this.customTemplateUsed = false;
|
|
14122
14125
|
this.hours = [];
|
|
@@ -14124,21 +14127,28 @@
|
|
|
14124
14127
|
this.draggedObject = null;
|
|
14125
14128
|
}
|
|
14126
14129
|
HourSchedulingComponent.prototype.ngOnInit = function () {
|
|
14130
|
+
if (!this.childProp) {
|
|
14131
|
+
this.startTime = parseInt(this._datepipe.transform(new Date(this.schedule[this.startTimeProp]).toISOString(), 'H:mm'));
|
|
14132
|
+
this.endTime = parseInt(this._datepipe.transform(new Date(this.schedule[this.endTimeProp]).toISOString(), 'H:mm'));
|
|
14133
|
+
}
|
|
14134
|
+
else {
|
|
14135
|
+
this.startTime = parseInt(this._datepipe.transform(new Date(this.schedule[this.childProp][this.startTimeProp]).toISOString(), 'H:mm'));
|
|
14136
|
+
this.endTime = parseInt(this._datepipe.transform(new Date(this.schedule[this.childProp][this.endTimeProp]).toISOString(), 'H:mm'));
|
|
14137
|
+
}
|
|
14127
14138
|
this.generateTimeBlocks();
|
|
14128
14139
|
};
|
|
14129
14140
|
HourSchedulingComponent.prototype.generateTimeBlocks = function () {
|
|
14130
|
-
var startTime = this.schedule[this.startTimeProp];
|
|
14131
|
-
var endTime = this.schedule[this.endTimeProp];
|
|
14132
14141
|
var objectsList = this.schedule[this.objectsProp];
|
|
14133
|
-
for (var hour = startTime; hour <= endTime; hour++) {
|
|
14142
|
+
for (var hour = this.startTime; hour <= this.endTime; hour++) {
|
|
14134
14143
|
this.hours.push(this.formatHour(hour));
|
|
14135
|
-
this.scheduledObjects[this.formatHour(hour)] = this.
|
|
14144
|
+
this.scheduledObjects[this.formatHour(hour)] = this._getObjectsForHour(hour, objectsList);
|
|
14136
14145
|
}
|
|
14137
14146
|
};
|
|
14138
|
-
HourSchedulingComponent.prototype.
|
|
14147
|
+
HourSchedulingComponent.prototype._getObjectsForHour = function (hour, objectsList) {
|
|
14148
|
+
var _this = this;
|
|
14139
14149
|
var objectsForHour = [];
|
|
14140
14150
|
objectsList.forEach(function (obj) {
|
|
14141
|
-
if (obj.
|
|
14151
|
+
if (_this.convertToHourNotation(obj[_this.startTimeProp]) === hour) {
|
|
14142
14152
|
objectsForHour.push(Object.assign({}, obj));
|
|
14143
14153
|
}
|
|
14144
14154
|
});
|
|
@@ -14152,49 +14162,77 @@
|
|
|
14152
14162
|
var currentHourSpan = currentTarget.parentElement.parentElement.querySelector('.hour-label span');
|
|
14153
14163
|
var currentHour = currentHourSpan.textContent;
|
|
14154
14164
|
this.draggedObject = obj;
|
|
14155
|
-
event.dataTransfer.setData('text', JSON.stringify({ obj:
|
|
14165
|
+
event.dataTransfer.setData('text', JSON.stringify({ obj: this.draggedObject, currentHour: currentHour }));
|
|
14166
|
+
};
|
|
14167
|
+
HourSchedulingComponent.prototype.onCustomDragStart = function (event, obj) {
|
|
14168
|
+
this.onDragStart(event, obj);
|
|
14156
14169
|
};
|
|
14157
14170
|
HourSchedulingComponent.prototype.onDragOver = function (event) {
|
|
14158
14171
|
event.preventDefault();
|
|
14159
14172
|
};
|
|
14160
14173
|
HourSchedulingComponent.prototype.onDrop = function (event, hour) {
|
|
14174
|
+
var _a;
|
|
14161
14175
|
var _this = this;
|
|
14162
14176
|
event.preventDefault();
|
|
14177
|
+
event.stopPropagation();
|
|
14163
14178
|
var data = JSON.parse(event.dataTransfer.getData('text'));
|
|
14179
|
+
if (!data || !data.obj) {
|
|
14180
|
+
return;
|
|
14181
|
+
}
|
|
14164
14182
|
var newStartHour = parseInt(hour.split(':')[0], 10);
|
|
14165
14183
|
var newEndHour = newStartHour + 1;
|
|
14166
|
-
data.obj.
|
|
14167
|
-
|
|
14168
|
-
var
|
|
14169
|
-
|
|
14184
|
+
var originalStartHour = this.convertToHourNotation(data.obj[this.startTimeProp]);
|
|
14185
|
+
// Get the unique identifier value from the object using the `idProp`
|
|
14186
|
+
var objId = data.obj[this.idProp];
|
|
14187
|
+
// Ensure we create a new object to avoid mutation issues
|
|
14188
|
+
var updatedObject = Object.assign(Object.assign({}, data.obj), { start: newStartHour, end: newEndHour });
|
|
14189
|
+
var updatedObject2 = Object.assign(Object.assign({}, data.obj), (_a = {}, _a[this.startTimeProp] = this.createDate(newStartHour), _a[this.endTimeProp] = this.createDate(newEndHour), _a));
|
|
14190
|
+
// Remove the object from its old hour block using its unique id
|
|
14191
|
+
var originalHourBlock = this.formatHour(originalStartHour);
|
|
14192
|
+
this.scheduledObjects[originalHourBlock] = this.scheduledObjects[originalHourBlock].filter(function (o) { return o[_this.idProp] !== objId; });
|
|
14193
|
+
// Add the object to the new hour block
|
|
14170
14194
|
var newHourBlock = this.formatHour(newStartHour);
|
|
14171
14195
|
if (!this.scheduledObjects[newHourBlock]) {
|
|
14172
14196
|
this.scheduledObjects[newHourBlock] = [];
|
|
14173
14197
|
}
|
|
14174
|
-
this.scheduledObjects[newHourBlock].push(
|
|
14198
|
+
this.scheduledObjects[newHourBlock].push(updatedObject2);
|
|
14199
|
+
// Clear the dragged object
|
|
14175
14200
|
this.draggedObject = null;
|
|
14201
|
+
// Trigger change detection to update the view
|
|
14176
14202
|
this.cdRef.detectChanges();
|
|
14177
14203
|
};
|
|
14204
|
+
HourSchedulingComponent.prototype.convertToHourNotation = function (date) {
|
|
14205
|
+
return parseInt(this._datepipe.transform(new Date(date).toISOString(), 'H:mm'));
|
|
14206
|
+
};
|
|
14207
|
+
HourSchedulingComponent.prototype.createDate = function (hours) {
|
|
14208
|
+
var date = new Date();
|
|
14209
|
+
date.setHours(hours);
|
|
14210
|
+
date.setMinutes(0, 0, 0);
|
|
14211
|
+
return date;
|
|
14212
|
+
};
|
|
14178
14213
|
return HourSchedulingComponent;
|
|
14179
14214
|
}());
|
|
14180
14215
|
HourSchedulingComponent.decorators = [
|
|
14181
14216
|
{ type: i0.Component, args: [{
|
|
14182
14217
|
selector: 'co-hour-scheduling',
|
|
14183
|
-
template: "\n <div class=\"time-block\" *ngFor=\"let hour of hours\">\n <div class=\"hour-label\"><span [textContent]=\"hour\"></span></div>\n <div
|
|
14218
|
+
template: "\n <div class=\"time-block\" *ngFor=\"let hour of hours\">\n <div class=\"hour-label\"><span [textContent]=\"hour\"></span></div>\n <div\n class=\"object-display\"\n (dragover)=\"onDragOver($event)\"\n (drop)=\"onDrop($event, hour)\"\n >\n <ng-container *ngIf=\"!customTemplateUsed\">\n <ng-container *ngIf=\"scheduledObjects[hour]\">\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=\"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 objects: scheduledObjects[hour]\n }\"\n >\n </ng-template>\n </ng-container>\n </div>\n </div>\n ",
|
|
14184
14219
|
encapsulation: i0.ViewEncapsulation.None
|
|
14185
14220
|
},] }
|
|
14186
14221
|
];
|
|
14187
14222
|
HourSchedulingComponent.ctorParameters = function () { return [
|
|
14188
|
-
{ type: i0.ChangeDetectorRef }
|
|
14223
|
+
{ type: i0.ChangeDetectorRef },
|
|
14224
|
+
{ type: common.DatePipe }
|
|
14189
14225
|
]; };
|
|
14190
14226
|
HourSchedulingComponent.propDecorators = {
|
|
14191
|
-
showClass: [{ type: i0.HostBinding, args: ['class.co-hour-scheduling',] }],
|
|
14192
14227
|
schedule: [{ type: i0.Input }],
|
|
14193
14228
|
startTimeProp: [{ type: i0.Input }],
|
|
14194
14229
|
endTimeProp: [{ type: i0.Input }],
|
|
14195
14230
|
objectsProp: [{ type: i0.Input }],
|
|
14231
|
+
childProp: [{ type: i0.Input }],
|
|
14196
14232
|
customTemplate: [{ type: i0.Input }],
|
|
14197
|
-
customTemplateUsed: [{ type: i0.Input }]
|
|
14233
|
+
customTemplateUsed: [{ type: i0.Input }],
|
|
14234
|
+
idProp: [{ type: i0.Input }],
|
|
14235
|
+
generateTimeBlocks: [{ type: i0.HostBinding, args: ['class.co-hour-scheduling',] }]
|
|
14198
14236
|
};
|
|
14199
14237
|
|
|
14200
14238
|
var HourSchedulingTestObjectComponent = /** @class */ (function () {
|
|
@@ -14235,7 +14273,8 @@
|
|
|
14235
14273
|
exports: [
|
|
14236
14274
|
HourSchedulingComponent,
|
|
14237
14275
|
HourSchedulingTestObjectComponent
|
|
14238
|
-
]
|
|
14276
|
+
],
|
|
14277
|
+
providers: [common.DatePipe]
|
|
14239
14278
|
},] }
|
|
14240
14279
|
];
|
|
14241
14280
|
|