@colijnit/corecomponents_v12 260.1.0 → 260.1.2

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.
@@ -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.appendChild(domElem);
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) {
@@ -11917,6 +11919,19 @@ ListOfValuesModule.decorators = [
11917
11919
  },] }
11918
11920
  ];
11919
11921
 
11922
+ // Values are corresponding dictionary keys in text_nl.
11923
+ var BatchDeliveryCategory;
11924
+ (function (BatchDeliveryCategory) {
11925
+ BatchDeliveryCategory["Overview"] = "OVERVIEW";
11926
+ BatchDeliveryCategory["Purchase"] = "COST_OF_SALES";
11927
+ BatchDeliveryCategory["Allocate"] = "ALLOCATION";
11928
+ BatchDeliveryCategory["Logistics"] = "LOGISTICS";
11929
+ BatchDeliveryCategory["DeliveryOrder"] = "DELIVERY_ORDER";
11930
+ BatchDeliveryCategory["Invoice"] = "INVOICE";
11931
+ BatchDeliveryCategory["ToPick"] = "TO_PICK";
11932
+ BatchDeliveryCategory["Picked"] = "PICKED";
11933
+ })(BatchDeliveryCategory || (BatchDeliveryCategory = {}));
11934
+
11920
11935
  class ListOfIconsComponent {
11921
11936
  constructor(iconCacheService, icons) {
11922
11937
  this.iconCacheService = iconCacheService;
@@ -11928,8 +11943,8 @@ class ListOfIconsComponent {
11928
11943
  this.showSubCategories = false;
11929
11944
  this._collection = [];
11930
11945
  this.subCategories = [
11931
- { icon: this.iconCacheService.getIcon(this.Icon.BoxesPackingRegular), label: 'To be picked' },
11932
- { icon: this.iconCacheService.getIcon(this.Icon.RegularBoxesPackingCircleCheck), label: 'Picked' }
11946
+ { icon: this.iconCacheService.getIcon(this.Icon.BoxesPackingRegular), label: BatchDeliveryCategory.ToPick },
11947
+ { icon: this.iconCacheService.getIcon(this.Icon.RegularBoxesPackingCircleCheck), label: BatchDeliveryCategory.Picked }
11933
11948
  ];
11934
11949
  }
11935
11950
  set collection(value) {
@@ -11950,7 +11965,7 @@ class ListOfIconsComponent {
11950
11965
  this.showMenu = !this.showMenu;
11951
11966
  }
11952
11967
  selectItem(item) {
11953
- if (item.label.toUpperCase() === 'LOGISTICS' || item.label.toUpperCase() === 'LOGISTIEK') {
11968
+ if (item.label === BatchDeliveryCategory.Logistics) {
11954
11969
  this.showSubCategories = !this.showSubCategories;
11955
11970
  return;
11956
11971
  }
@@ -11981,12 +11996,17 @@ ListOfIconsComponent.decorators = [
11981
11996
  <div class="icon-item" *ngFor="let item of collection" (click)="selectItem(item)"
11982
11997
  [class.active]="item === activeItem">
11983
11998
  <co-icon [iconData]="item.icon" [style.width.px]="iconSize" [style.height.px]="iconSize"></co-icon>
11984
- <div class="label">{{ item.label }}</div>
11999
+ <div class="label" [textContent]="item.label | coreLocalize"></div>
11985
12000
  </div>
11986
12001
  <div class="picking-type-wrapper" *ngIf="showSubCategories">
11987
12002
  <div class="button-wrapper" *ngFor="let subCategory of subCategories" (click)="handlePickingCategoryClicked(subCategory)">
11988
- <co-icon class="co-transaction-button-bar-icon" [iconData]="subCategory.icon"></co-icon>
11989
- <span class="button-title">{{subCategory.label}}</span>
12003
+ <co-icon
12004
+ class="co-transaction-button-bar-icon"
12005
+ [iconData]="subCategory.icon"
12006
+ [style.width.px]="iconSize"
12007
+ [style.height.px]="iconSize">
12008
+ </co-icon>
12009
+ <span class="button-title" [textContent]="subCategory.label | coreLocalize"></span>
11990
12010
  </div>
11991
12011
  </div>
11992
12012
  </div>
@@ -12014,7 +12034,8 @@ ListOfIconsModule.decorators = [
12014
12034
  CommonModule,
12015
12035
  FormsModule,
12016
12036
  IconModule,
12017
- ClickoutsideModule
12037
+ ClickoutsideModule,
12038
+ CoreComponentsTranslationModule
12018
12039
  ],
12019
12040
  declarations: [
12020
12041
  ListOfIconsComponent
@@ -12428,6 +12449,8 @@ class FilterItemComponent {
12428
12449
  this.isLoading = false;
12429
12450
  this._collection = [];
12430
12451
  this._mode = this.modes.Filterlist;
12452
+ this._defaultSet = false;
12453
+ this._collectionSubject = new BehaviorSubject(undefined);
12431
12454
  }
12432
12455
  set mode(value) {
12433
12456
  this._mode = value;
@@ -12442,6 +12465,7 @@ class FilterItemComponent {
12442
12465
  this.filteredCollection = (_a = this._collection) === null || _a === void 0 ? void 0 : _a.slice();
12443
12466
  //reset the model in case there was no collection to set its values on when it was set.
12444
12467
  this.model = this._model;
12468
+ this._collectionSubject.next(this._collection);
12445
12469
  }
12446
12470
  get collection() {
12447
12471
  return this._collection;
@@ -12469,6 +12493,14 @@ class FilterItemComponent {
12469
12493
  if (this.checkBoxToTextModel === undefined || this.checkBoxToTextModel === null) {
12470
12494
  this.checkBoxToTextModel = false;
12471
12495
  }
12496
+ this._collectionSubscription = this._collectionSubject.subscribe((collection) => {
12497
+ if (!this._defaultSet && collection) {
12498
+ this._applyDefaultFilters();
12499
+ }
12500
+ });
12501
+ }
12502
+ ngOnDestroy() {
12503
+ this._collectionSubscription.unsubscribe();
12472
12504
  }
12473
12505
  setToInitialLimit() {
12474
12506
  this.limitTo = this.initialLimit;
@@ -12938,6 +12970,199 @@ class FilterItemComponent {
12938
12970
  this.dateRangeEnd = undefined;
12939
12971
  }
12940
12972
  }
12973
+ _applyDefaultForFilterList() {
12974
+ const defaultString = this.defaultValue.toString();
12975
+ const codes = defaultString.split(',').map(code => code.trim());
12976
+ codes.forEach(code => {
12977
+ const item = this._collection.find(i => i.code.toString() === code);
12978
+ if (item) {
12979
+ item.checked = true;
12980
+ }
12981
+ });
12982
+ this._createModelForFilterList();
12983
+ this.modelChange.emit(this._model);
12984
+ this.showButton = true;
12985
+ }
12986
+ _applyDefaultForStringCollectionList() {
12987
+ const defaultString = this.defaultValue.toString();
12988
+ const codes = defaultString.split(',').map(code => code.trim());
12989
+ codes.forEach(code => {
12990
+ const item = this._collection.find(i => i.code.toString() === code);
12991
+ if (item) {
12992
+ item.checked = true;
12993
+ }
12994
+ });
12995
+ this._createModelForStringCollectionList();
12996
+ this.modelChange.emit(this._model);
12997
+ this.showButton = true;
12998
+ }
12999
+ _applyDefaultForSingleSelectList() {
13000
+ const defaultCode = this.defaultValue.toString().trim();
13001
+ const item = this._collection.find(i => i.code.toString() === defaultCode);
13002
+ if (item) {
13003
+ item.checked = true;
13004
+ this._createModelForSingleSelectList();
13005
+ this.modelChange.emit(this._model);
13006
+ this.showButton = true;
13007
+ }
13008
+ }
13009
+ _applyDefaultForSelectListWithNumberOutput() {
13010
+ const defaultNumber = Number(this.defaultValue);
13011
+ if (!isNaN(defaultNumber) && defaultNumber > 0) {
13012
+ // Decode the number to determine which items should be checked
13013
+ for (const item of this._collection) {
13014
+ const itemCode = Number(item.code);
13015
+ const modValue = (defaultNumber % (2 * itemCode));
13016
+ item.checked = (modValue >= itemCode);
13017
+ }
13018
+ this._createModelForSelectListWithNumberOutput();
13019
+ this.modelChange.emit(this._model);
13020
+ this.showButton = true;
13021
+ }
13022
+ }
13023
+ _applyDefaultForSlider() {
13024
+ const defaultString = this.defaultValue.toString();
13025
+ const [min, max] = defaultString.split('-').map(s => Number(s.trim()));
13026
+ if (!isNaN(min) && !isNaN(max)) {
13027
+ this.sliderMin = min;
13028
+ this.sliderMax = max;
13029
+ this._createModelForSliderMode();
13030
+ this.modelChange.emit(this._model);
13031
+ this.showButton = true;
13032
+ }
13033
+ }
13034
+ _applyDefaultForCheckboxToText() {
13035
+ const defaultString = this.defaultValue.toString().toUpperCase();
13036
+ this.checkBoxToTextModel = (defaultString === 'J' || defaultString === 'Y' || defaultString === 'TRUE');
13037
+ if (this.mode === this.modes.CheckboxToText) {
13038
+ this._createModelForCheckboxToText();
13039
+ }
13040
+ else {
13041
+ this._createModelForCheckboxToSimpleText();
13042
+ }
13043
+ this.modelChange.emit(this._model);
13044
+ this.showButton = true;
13045
+ }
13046
+ _applyDefaultForCheckboxToBinary() {
13047
+ const defaultValue = Number(this.defaultValue);
13048
+ this.checkBoxToTextModel = (!isNaN(defaultValue) && defaultValue >= 1);
13049
+ this._createModelForCheckboxToBinary();
13050
+ this.modelChange.emit(this._model);
13051
+ this.showButton = true;
13052
+ }
13053
+ _applyDefaultForDateField() {
13054
+ const defaultString = this.defaultValue.toString();
13055
+ if (defaultString.match(/^\d{2}-\d{2}-\d{4}$/)) {
13056
+ // dd-MM-yyyy format
13057
+ const [dd, mm, yyyy] = defaultString.split('-');
13058
+ this.dateFieldValue = new Date(+yyyy, +mm - 1, +dd);
13059
+ }
13060
+ else if (defaultString.match(/^\d{4}-\d{2}-\d{2}$/)) {
13061
+ // yyyy-MM-dd format
13062
+ const [yyyy, mm, dd] = defaultString.split('-');
13063
+ this.dateFieldValue = new Date(+yyyy, +mm - 1, +dd);
13064
+ }
13065
+ else {
13066
+ // Try parsing as standard date
13067
+ const date = new Date(defaultString);
13068
+ if (!isNaN(date.getTime())) {
13069
+ this.dateFieldValue = date;
13070
+ }
13071
+ }
13072
+ if (this.dateFieldValue) {
13073
+ this._createModelForDateField(this.dateFieldValue);
13074
+ this.modelChange.emit(this._model);
13075
+ this.showButton = true;
13076
+ }
13077
+ }
13078
+ _applyDefaultForDateRangeField() {
13079
+ const defaultString = this.defaultValue.toString();
13080
+ if (defaultString.includes('&')) {
13081
+ // Format: "startDate & endDate"
13082
+ const [startStr, endStr] = defaultString.split('&').map(s => s.trim());
13083
+ const parseDate = (dateStr) => {
13084
+ if (dateStr.match(/^\d{2}-\d{2}-\d{4}$/)) {
13085
+ const [dd, mm, yyyy] = dateStr.split('-');
13086
+ return new Date(+yyyy, +mm - 1, +dd);
13087
+ }
13088
+ else if (dateStr.match(/^\d{4}-\d{2}-\d{2}$/)) {
13089
+ const [yyyy, mm, dd] = dateStr.split('-');
13090
+ return new Date(+yyyy, +mm - 1, +dd);
13091
+ }
13092
+ return null;
13093
+ };
13094
+ const startDate = parseDate(startStr);
13095
+ const endDate = parseDate(endStr);
13096
+ if (startDate && endDate) {
13097
+ this.dateRangeStart = startDate;
13098
+ this.dateRangeEnd = endDate;
13099
+ this._createModelForDateRange([this.dateRangeStart, this.dateRangeEnd]);
13100
+ this.modelChange.emit(this._model);
13101
+ this.showButton = true;
13102
+ }
13103
+ }
13104
+ }
13105
+ _applyDefaultForTextField() {
13106
+ this._model = this.defaultValue.toString();
13107
+ this.modelChange.emit(this._model);
13108
+ this.showButton = true;
13109
+ }
13110
+ _applyDefaultForCheckbox() {
13111
+ const defaultString = this.defaultValue.toString().toLowerCase();
13112
+ this._model = (defaultString === 'true' || defaultString === '1' || defaultString === 'yes');
13113
+ this.modelChange.emit(this._model);
13114
+ this.showButton = true;
13115
+ }
13116
+ _applyDefaultFilters() {
13117
+ var _a;
13118
+ const modeWithoutCollection = this.mode === this.modes.DateField ||
13119
+ this.mode === this.modes.DateRangeField ||
13120
+ this.mode === this.modes.Slider;
13121
+ const canApplyDefaults = (modeWithoutCollection || (!modeWithoutCollection && this.collection && this.collection.length > 0)) &&
13122
+ this.defaultValue &&
13123
+ !(((_a = this._model) === null || _a === void 0 ? void 0 : _a.length) || this._model > 0);
13124
+ if (!canApplyDefaults) {
13125
+ return;
13126
+ }
13127
+ switch (this.mode) {
13128
+ case this.modes.Filterlist:
13129
+ this._applyDefaultForFilterList();
13130
+ break;
13131
+ case this.modes.SelectListWithStringCollectionOutput:
13132
+ this._applyDefaultForStringCollectionList();
13133
+ break;
13134
+ case this.modes.SingleSelectList:
13135
+ this._applyDefaultForSingleSelectList();
13136
+ break;
13137
+ case this.modes.SelectListWithNumberOutput:
13138
+ this._applyDefaultForSelectListWithNumberOutput();
13139
+ break;
13140
+ case this.modes.Slider:
13141
+ case this.modes.NullableSlider:
13142
+ this._applyDefaultForSlider();
13143
+ break;
13144
+ case this.modes.CheckboxToText:
13145
+ case this.modes.CheckboxToSimpleText:
13146
+ this._applyDefaultForCheckboxToText();
13147
+ break;
13148
+ case this.modes.CheckboxToBinary:
13149
+ this._applyDefaultForCheckboxToBinary();
13150
+ break;
13151
+ case this.modes.DateField:
13152
+ this._applyDefaultForDateField();
13153
+ break;
13154
+ case this.modes.DateRangeField:
13155
+ this._applyDefaultForDateRangeField();
13156
+ break;
13157
+ case this.modes.TextField:
13158
+ this._applyDefaultForTextField();
13159
+ break;
13160
+ case this.modes.Checkbox:
13161
+ this._applyDefaultForCheckbox();
13162
+ break;
13163
+ }
13164
+ this._defaultSet = true;
13165
+ }
12941
13166
  }
12942
13167
  FilterItemComponent.decorators = [
12943
13168
  { type: Component, args: [{