@colijnit/corecomponents_v12 260.1.0 → 260.1.1
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 +225 -5
- package/bundles/colijnit-corecomponents_v12.umd.js.map +1 -1
- package/colijnit-corecomponents_v12.metadata.json +1 -1
- package/esm2015/lib/components/filter-item/filter-item.component.js +207 -2
- package/esm2015/lib/components/input-date-picker/input-date-picker.component.js +2 -2
- package/esm2015/lib/components/list-of-values/list-of-values.component.js +2 -2
- package/esm2015/lib/components/simple-grid/simple-grid.component.js +2 -2
- package/esm2015/lib/service/overlay.service.js +5 -3
- package/fesm2015/colijnit-corecomponents_v12.js +211 -5
- package/fesm2015/colijnit-corecomponents_v12.js.map +1 -1
- package/lib/components/filter-item/filter-item.component.d.ts +20 -4
- package/lib/service/overlay.service.d.ts +2 -2
- package/package.json +1 -1
|
@@ -1695,7 +1695,8 @@ class OverlayService {
|
|
|
1695
1695
|
this._injector = _injector;
|
|
1696
1696
|
this._componentRefs = new Map();
|
|
1697
1697
|
}
|
|
1698
|
-
createComponent(compClass, inputs, events) {
|
|
1698
|
+
createComponent(compClass, inputs, events, parentRef) {
|
|
1699
|
+
var _a;
|
|
1699
1700
|
if (this._componentRefExists(compClass)) {
|
|
1700
1701
|
this._removeComponentRef(compClass);
|
|
1701
1702
|
}
|
|
@@ -1719,7 +1720,8 @@ class OverlayService {
|
|
|
1719
1720
|
this._appRef.attachView(componentRef.hostView);
|
|
1720
1721
|
const domElem = componentRef.hostView
|
|
1721
1722
|
.rootNodes[0];
|
|
1722
|
-
document.body
|
|
1723
|
+
const container = (_a = parentRef === null || parentRef === void 0 ? void 0 : parentRef.nativeElement) !== null && _a !== void 0 ? _a : document.body;
|
|
1724
|
+
container.appendChild(domElem);
|
|
1723
1725
|
componentRef.onDestroy(() => {
|
|
1724
1726
|
this._appRef.detachView(componentRef.hostView);
|
|
1725
1727
|
});
|
|
@@ -5462,7 +5464,7 @@ class InputDatePickerComponent extends BaseInputDatePickerDirective {
|
|
|
5462
5464
|
}, {
|
|
5463
5465
|
dateSelected: (event) => this.handleDateSelected(event),
|
|
5464
5466
|
clickedOutside: () => this.toggleCalendar(false) // Close when clicked outside
|
|
5465
|
-
});
|
|
5467
|
+
}, this.elementRef);
|
|
5466
5468
|
}
|
|
5467
5469
|
else {
|
|
5468
5470
|
this.overlayService.removeComponent(this._calendarComponentRef);
|
|
@@ -10318,7 +10320,7 @@ SimpleGridComponent.decorators = [
|
|
|
10318
10320
|
(click)="cancelEditRow(); $event.stopPropagation() "></co-button>
|
|
10319
10321
|
</div>
|
|
10320
10322
|
</ng-container>
|
|
10321
|
-
<ng-container *ngIf="!(inlineEdit && showRowButtons)">
|
|
10323
|
+
<ng-container *ngIf="!(inlineEdit && showRowButtons) && showDelete">
|
|
10322
10324
|
<div class="icons-container">
|
|
10323
10325
|
<co-icon class="icon-item icon-delete"
|
|
10324
10326
|
[iconData]="icons.getIcon(Icons.TrashBin)" *ngIf="hoveredRowIndex === rowIndex"
|
|
@@ -11619,7 +11621,7 @@ class ListOfValuesComponent extends BaseInputComponent {
|
|
|
11619
11621
|
modelChange: (value) => this.optionChosen(value),
|
|
11620
11622
|
closePopup: () => this.closePopup(),
|
|
11621
11623
|
keyDown: (event) => this.handleInputKeyDown(event)
|
|
11622
|
-
});
|
|
11624
|
+
}, this.elementRef);
|
|
11623
11625
|
this.keepFocussed = true;
|
|
11624
11626
|
}
|
|
11625
11627
|
removeOptionFromModel(chip) {
|
|
@@ -12428,6 +12430,8 @@ class FilterItemComponent {
|
|
|
12428
12430
|
this.isLoading = false;
|
|
12429
12431
|
this._collection = [];
|
|
12430
12432
|
this._mode = this.modes.Filterlist;
|
|
12433
|
+
this._defaultSet = false;
|
|
12434
|
+
this._collectionSubject = new BehaviorSubject(undefined);
|
|
12431
12435
|
}
|
|
12432
12436
|
set mode(value) {
|
|
12433
12437
|
this._mode = value;
|
|
@@ -12442,6 +12446,7 @@ class FilterItemComponent {
|
|
|
12442
12446
|
this.filteredCollection = (_a = this._collection) === null || _a === void 0 ? void 0 : _a.slice();
|
|
12443
12447
|
//reset the model in case there was no collection to set its values on when it was set.
|
|
12444
12448
|
this.model = this._model;
|
|
12449
|
+
this._collectionSubject.next(this._collection);
|
|
12445
12450
|
}
|
|
12446
12451
|
get collection() {
|
|
12447
12452
|
return this._collection;
|
|
@@ -12469,6 +12474,14 @@ class FilterItemComponent {
|
|
|
12469
12474
|
if (this.checkBoxToTextModel === undefined || this.checkBoxToTextModel === null) {
|
|
12470
12475
|
this.checkBoxToTextModel = false;
|
|
12471
12476
|
}
|
|
12477
|
+
this._collectionSubscription = this._collectionSubject.subscribe((collection) => {
|
|
12478
|
+
if (!this._defaultSet && collection) {
|
|
12479
|
+
this._applyDefaultFilters();
|
|
12480
|
+
}
|
|
12481
|
+
});
|
|
12482
|
+
}
|
|
12483
|
+
ngOnDestroy() {
|
|
12484
|
+
this._collectionSubscription.unsubscribe();
|
|
12472
12485
|
}
|
|
12473
12486
|
setToInitialLimit() {
|
|
12474
12487
|
this.limitTo = this.initialLimit;
|
|
@@ -12938,6 +12951,199 @@ class FilterItemComponent {
|
|
|
12938
12951
|
this.dateRangeEnd = undefined;
|
|
12939
12952
|
}
|
|
12940
12953
|
}
|
|
12954
|
+
_applyDefaultForFilterList() {
|
|
12955
|
+
const defaultString = this.defaultValue.toString();
|
|
12956
|
+
const codes = defaultString.split(',').map(code => code.trim());
|
|
12957
|
+
codes.forEach(code => {
|
|
12958
|
+
const item = this._collection.find(i => i.code.toString() === code);
|
|
12959
|
+
if (item) {
|
|
12960
|
+
item.checked = true;
|
|
12961
|
+
}
|
|
12962
|
+
});
|
|
12963
|
+
this._createModelForFilterList();
|
|
12964
|
+
this.modelChange.emit(this._model);
|
|
12965
|
+
this.showButton = true;
|
|
12966
|
+
}
|
|
12967
|
+
_applyDefaultForStringCollectionList() {
|
|
12968
|
+
const defaultString = this.defaultValue.toString();
|
|
12969
|
+
const codes = defaultString.split(',').map(code => code.trim());
|
|
12970
|
+
codes.forEach(code => {
|
|
12971
|
+
const item = this._collection.find(i => i.code.toString() === code);
|
|
12972
|
+
if (item) {
|
|
12973
|
+
item.checked = true;
|
|
12974
|
+
}
|
|
12975
|
+
});
|
|
12976
|
+
this._createModelForStringCollectionList();
|
|
12977
|
+
this.modelChange.emit(this._model);
|
|
12978
|
+
this.showButton = true;
|
|
12979
|
+
}
|
|
12980
|
+
_applyDefaultForSingleSelectList() {
|
|
12981
|
+
const defaultCode = this.defaultValue.toString().trim();
|
|
12982
|
+
const item = this._collection.find(i => i.code.toString() === defaultCode);
|
|
12983
|
+
if (item) {
|
|
12984
|
+
item.checked = true;
|
|
12985
|
+
this._createModelForSingleSelectList();
|
|
12986
|
+
this.modelChange.emit(this._model);
|
|
12987
|
+
this.showButton = true;
|
|
12988
|
+
}
|
|
12989
|
+
}
|
|
12990
|
+
_applyDefaultForSelectListWithNumberOutput() {
|
|
12991
|
+
const defaultNumber = Number(this.defaultValue);
|
|
12992
|
+
if (!isNaN(defaultNumber) && defaultNumber > 0) {
|
|
12993
|
+
// Decode the number to determine which items should be checked
|
|
12994
|
+
for (const item of this._collection) {
|
|
12995
|
+
const itemCode = Number(item.code);
|
|
12996
|
+
const modValue = (defaultNumber % (2 * itemCode));
|
|
12997
|
+
item.checked = (modValue >= itemCode);
|
|
12998
|
+
}
|
|
12999
|
+
this._createModelForSelectListWithNumberOutput();
|
|
13000
|
+
this.modelChange.emit(this._model);
|
|
13001
|
+
this.showButton = true;
|
|
13002
|
+
}
|
|
13003
|
+
}
|
|
13004
|
+
_applyDefaultForSlider() {
|
|
13005
|
+
const defaultString = this.defaultValue.toString();
|
|
13006
|
+
const [min, max] = defaultString.split('-').map(s => Number(s.trim()));
|
|
13007
|
+
if (!isNaN(min) && !isNaN(max)) {
|
|
13008
|
+
this.sliderMin = min;
|
|
13009
|
+
this.sliderMax = max;
|
|
13010
|
+
this._createModelForSliderMode();
|
|
13011
|
+
this.modelChange.emit(this._model);
|
|
13012
|
+
this.showButton = true;
|
|
13013
|
+
}
|
|
13014
|
+
}
|
|
13015
|
+
_applyDefaultForCheckboxToText() {
|
|
13016
|
+
const defaultString = this.defaultValue.toString().toUpperCase();
|
|
13017
|
+
this.checkBoxToTextModel = (defaultString === 'J' || defaultString === 'Y' || defaultString === 'TRUE');
|
|
13018
|
+
if (this.mode === this.modes.CheckboxToText) {
|
|
13019
|
+
this._createModelForCheckboxToText();
|
|
13020
|
+
}
|
|
13021
|
+
else {
|
|
13022
|
+
this._createModelForCheckboxToSimpleText();
|
|
13023
|
+
}
|
|
13024
|
+
this.modelChange.emit(this._model);
|
|
13025
|
+
this.showButton = true;
|
|
13026
|
+
}
|
|
13027
|
+
_applyDefaultForCheckboxToBinary() {
|
|
13028
|
+
const defaultValue = Number(this.defaultValue);
|
|
13029
|
+
this.checkBoxToTextModel = (!isNaN(defaultValue) && defaultValue >= 1);
|
|
13030
|
+
this._createModelForCheckboxToBinary();
|
|
13031
|
+
this.modelChange.emit(this._model);
|
|
13032
|
+
this.showButton = true;
|
|
13033
|
+
}
|
|
13034
|
+
_applyDefaultForDateField() {
|
|
13035
|
+
const defaultString = this.defaultValue.toString();
|
|
13036
|
+
if (defaultString.match(/^\d{2}-\d{2}-\d{4}$/)) {
|
|
13037
|
+
// dd-MM-yyyy format
|
|
13038
|
+
const [dd, mm, yyyy] = defaultString.split('-');
|
|
13039
|
+
this.dateFieldValue = new Date(+yyyy, +mm - 1, +dd);
|
|
13040
|
+
}
|
|
13041
|
+
else if (defaultString.match(/^\d{4}-\d{2}-\d{2}$/)) {
|
|
13042
|
+
// yyyy-MM-dd format
|
|
13043
|
+
const [yyyy, mm, dd] = defaultString.split('-');
|
|
13044
|
+
this.dateFieldValue = new Date(+yyyy, +mm - 1, +dd);
|
|
13045
|
+
}
|
|
13046
|
+
else {
|
|
13047
|
+
// Try parsing as standard date
|
|
13048
|
+
const date = new Date(defaultString);
|
|
13049
|
+
if (!isNaN(date.getTime())) {
|
|
13050
|
+
this.dateFieldValue = date;
|
|
13051
|
+
}
|
|
13052
|
+
}
|
|
13053
|
+
if (this.dateFieldValue) {
|
|
13054
|
+
this._createModelForDateField(this.dateFieldValue);
|
|
13055
|
+
this.modelChange.emit(this._model);
|
|
13056
|
+
this.showButton = true;
|
|
13057
|
+
}
|
|
13058
|
+
}
|
|
13059
|
+
_applyDefaultForDateRangeField() {
|
|
13060
|
+
const defaultString = this.defaultValue.toString();
|
|
13061
|
+
if (defaultString.includes('&')) {
|
|
13062
|
+
// Format: "startDate & endDate"
|
|
13063
|
+
const [startStr, endStr] = defaultString.split('&').map(s => s.trim());
|
|
13064
|
+
const parseDate = (dateStr) => {
|
|
13065
|
+
if (dateStr.match(/^\d{2}-\d{2}-\d{4}$/)) {
|
|
13066
|
+
const [dd, mm, yyyy] = dateStr.split('-');
|
|
13067
|
+
return new Date(+yyyy, +mm - 1, +dd);
|
|
13068
|
+
}
|
|
13069
|
+
else if (dateStr.match(/^\d{4}-\d{2}-\d{2}$/)) {
|
|
13070
|
+
const [yyyy, mm, dd] = dateStr.split('-');
|
|
13071
|
+
return new Date(+yyyy, +mm - 1, +dd);
|
|
13072
|
+
}
|
|
13073
|
+
return null;
|
|
13074
|
+
};
|
|
13075
|
+
const startDate = parseDate(startStr);
|
|
13076
|
+
const endDate = parseDate(endStr);
|
|
13077
|
+
if (startDate && endDate) {
|
|
13078
|
+
this.dateRangeStart = startDate;
|
|
13079
|
+
this.dateRangeEnd = endDate;
|
|
13080
|
+
this._createModelForDateRange([this.dateRangeStart, this.dateRangeEnd]);
|
|
13081
|
+
this.modelChange.emit(this._model);
|
|
13082
|
+
this.showButton = true;
|
|
13083
|
+
}
|
|
13084
|
+
}
|
|
13085
|
+
}
|
|
13086
|
+
_applyDefaultForTextField() {
|
|
13087
|
+
this._model = this.defaultValue.toString();
|
|
13088
|
+
this.modelChange.emit(this._model);
|
|
13089
|
+
this.showButton = true;
|
|
13090
|
+
}
|
|
13091
|
+
_applyDefaultForCheckbox() {
|
|
13092
|
+
const defaultString = this.defaultValue.toString().toLowerCase();
|
|
13093
|
+
this._model = (defaultString === 'true' || defaultString === '1' || defaultString === 'yes');
|
|
13094
|
+
this.modelChange.emit(this._model);
|
|
13095
|
+
this.showButton = true;
|
|
13096
|
+
}
|
|
13097
|
+
_applyDefaultFilters() {
|
|
13098
|
+
var _a;
|
|
13099
|
+
const modeWithoutCollection = this.mode === this.modes.DateField ||
|
|
13100
|
+
this.mode === this.modes.DateRangeField ||
|
|
13101
|
+
this.mode === this.modes.Slider;
|
|
13102
|
+
const canApplyDefaults = (modeWithoutCollection || (!modeWithoutCollection && this.collection && this.collection.length > 0)) &&
|
|
13103
|
+
this.defaultValue &&
|
|
13104
|
+
!(((_a = this._model) === null || _a === void 0 ? void 0 : _a.length) || this._model > 0);
|
|
13105
|
+
if (!canApplyDefaults) {
|
|
13106
|
+
return;
|
|
13107
|
+
}
|
|
13108
|
+
switch (this.mode) {
|
|
13109
|
+
case this.modes.Filterlist:
|
|
13110
|
+
this._applyDefaultForFilterList();
|
|
13111
|
+
break;
|
|
13112
|
+
case this.modes.SelectListWithStringCollectionOutput:
|
|
13113
|
+
this._applyDefaultForStringCollectionList();
|
|
13114
|
+
break;
|
|
13115
|
+
case this.modes.SingleSelectList:
|
|
13116
|
+
this._applyDefaultForSingleSelectList();
|
|
13117
|
+
break;
|
|
13118
|
+
case this.modes.SelectListWithNumberOutput:
|
|
13119
|
+
this._applyDefaultForSelectListWithNumberOutput();
|
|
13120
|
+
break;
|
|
13121
|
+
case this.modes.Slider:
|
|
13122
|
+
case this.modes.NullableSlider:
|
|
13123
|
+
this._applyDefaultForSlider();
|
|
13124
|
+
break;
|
|
13125
|
+
case this.modes.CheckboxToText:
|
|
13126
|
+
case this.modes.CheckboxToSimpleText:
|
|
13127
|
+
this._applyDefaultForCheckboxToText();
|
|
13128
|
+
break;
|
|
13129
|
+
case this.modes.CheckboxToBinary:
|
|
13130
|
+
this._applyDefaultForCheckboxToBinary();
|
|
13131
|
+
break;
|
|
13132
|
+
case this.modes.DateField:
|
|
13133
|
+
this._applyDefaultForDateField();
|
|
13134
|
+
break;
|
|
13135
|
+
case this.modes.DateRangeField:
|
|
13136
|
+
this._applyDefaultForDateRangeField();
|
|
13137
|
+
break;
|
|
13138
|
+
case this.modes.TextField:
|
|
13139
|
+
this._applyDefaultForTextField();
|
|
13140
|
+
break;
|
|
13141
|
+
case this.modes.Checkbox:
|
|
13142
|
+
this._applyDefaultForCheckbox();
|
|
13143
|
+
break;
|
|
13144
|
+
}
|
|
13145
|
+
this._defaultSet = true;
|
|
13146
|
+
}
|
|
12941
13147
|
}
|
|
12942
13148
|
FilterItemComponent.decorators = [
|
|
12943
13149
|
{ type: Component, args: [{
|