@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.
@@ -2074,8 +2074,9 @@
2074
2074
  this._injector = _injector;
2075
2075
  this._componentRefs = new Map();
2076
2076
  }
2077
- OverlayService.prototype.createComponent = function (compClass, inputs, events) {
2077
+ OverlayService.prototype.createComponent = function (compClass, inputs, events, parentRef) {
2078
2078
  var _this = this;
2079
+ var _a;
2079
2080
  if (this._componentRefExists(compClass)) {
2080
2081
  this._removeComponentRef(compClass);
2081
2082
  }
@@ -2102,7 +2103,8 @@
2102
2103
  this._appRef.attachView(componentRef.hostView);
2103
2104
  var domElem = componentRef.hostView
2104
2105
  .rootNodes[0];
2105
- document.body.appendChild(domElem);
2106
+ var container = (_a = parentRef === null || parentRef === void 0 ? void 0 : parentRef.nativeElement) !== null && _a !== void 0 ? _a : document.body;
2107
+ container.appendChild(domElem);
2106
2108
  componentRef.onDestroy(function () {
2107
2109
  _this._appRef.detachView(componentRef.hostView);
2108
2110
  });
@@ -5992,7 +5994,7 @@
5992
5994
  }, {
5993
5995
  dateSelected: function (event) { return _this.handleDateSelected(event); },
5994
5996
  clickedOutside: function () { return _this.toggleCalendar(false); } // Close when clicked outside
5995
- });
5997
+ }, this.elementRef);
5996
5998
  }
5997
5999
  else {
5998
6000
  this.overlayService.removeComponent(this._calendarComponentRef);
@@ -10837,7 +10839,7 @@
10837
10839
  SimpleGridComponent.decorators = [
10838
10840
  { type: i0.Component, args: [{
10839
10841
  selector: 'co-simple-grid',
10840
- template: "\n <co-grid-toolbar\n *ngIf=\"showToolbar\" [class.right]=\"rightToolbar\"\n [showEdit]=\"showEdit\"\n [showAdd]=\"showAdd\"\n [showDelete]=\"showDelete\"\n [deleteEnabled]=\"selectedRowIndex > -1\"\n (addClick)=\"addNewRow()\"\n (editClick)=\"editRow($event)\"\n (saveClick)=\"validateAndSave()\"\n (cancelClick)=\"cancelEditRow()\"\n (deleteClick)=\"removeRow()\">\n </co-grid-toolbar>\n\n <table\n id=\"simple-grid-table\"\n class=\"simple-grid-table\"\n [clickOutside]=\"editing\"\n (clickOutside)=\"handleClickOutsideRow()\">\n <colgroup>\n <col\n *ngFor=\"let column of headerColumnsCopy; let index = index\"\n [class.simple-grid-column-auto-fit]=\"column.autoFit\"\n [style.width.px]=\"column.width\"\n [style.min-width.px]=\"MIN_COLUMN_WIDTH\">\n </colgroup>\n <thead>\n <tr>\n <th\n scope=\"col\"\n #headerCell\n class=\"simple-grid-column-header\"\n *ngFor=\"let column of headerColumnsCopy; let index = index\">\n <div\n class=\"simple-grid-column-header-wrapper\"\n [class.resizable]=\"resizable\"\n [class.selected]=\"column.isSelected\"\n [ngClass]=\"column.textAlign ? column.textAlign : defaultTextAlign\">\n <ng-container *ngIf=\"column.headerTemplate; else noHeaderTemplate\">\n <ng-container [ngTemplateOutlet]=\"column.headerTemplate\"></ng-container>\n </ng-container>\n <ng-template #noHeaderTemplate>\n <div\n class=\"simple-grid-column-header-label\"\n [ngClass]=\"column.textAlign ? column.textAlign : defaultTextAlign\"\n [class.with-menu]=\"showGridSettings\"\n [class.with-sort]=\"showColumnSort\"\n [textContent]=\"column.headerText || '&nbsp;'\" [title]=\"column.headerText\"\n (click)=\"showColumnSort ? sortColumn(column, column.field) : toggleColumnMenu(column)\">\n </div>\n\n <div class=\"sort-column\" *ngIf=\"showColumnSort\">\n <co-button\n (click)=\"sortColumn(column, column?.field)\"\n [iconData]=\"icons.getIcon(Icons.ArrowUpArrowDown)\">\n </co-button>\n </div>\n\n <div class=\"column-menu\" *ngIf=\"column.isSelected\">\n <h3 [textContent]=\"'COLUMN_OPTIONS' | coreLocalize\"></h3>\n <ul>\n <li (click)=\"hideColumn(column)\">Hide Column</li>\n <li (click)=\"sortColumn(column, column.field)\">Sort Column</li>\n </ul>\n </div>\n </ng-template>\n <div\n *ngIf=\"resizable && column.resizable\"\n class=\"simple-grid-column-sizer\"\n (mousedown)=\"handleSizerMouseDown($event, column)\">\n </div>\n </div>\n </th>\n </tr>\n\n <div *ngIf=\"showGridSettings\" class=\"grid-settings\">\n <co-button\n [class.selected]=\"isSettingsMenuOpen\"\n [iconData]=\"icons.getIcon(Icons.CogWheels)\"\n (click)=\"toggleSettingsMenu()\">\n </co-button>\n\n <div class=\"settings-menu\" *ngIf=\"isSettingsMenuOpen\">\n <h3 [textContent]=\"'GRID_OPTIONS' | coreLocalize\"></h3>\n <ul>\n <li (click)=\"exportToExcel()\">Export to Excel</li>\n <li *ngIf=\"headerColumnsCopy.length !== headerColumns.length\" (click)=\"showAllColumns()\">\n Show All Columns\n </li>\n </ul>\n </div>\n </div>\n </thead>\n <tbody\n #dropList cdkDropList cdkDropListOrientation=\"vertical\"\n class=\"simple-grid-drag-drop-list\"\n [cdkDropListDisabled]=\"!dragDropEnabled || editing\"\n [cdkDropListData]=\"data\"\n [cdkDropListEnterPredicate]=\"handleCanDragDrop\"\n (cdkDropListDropped)=\"handleDrop($event)\">\n <co-form class=\"simple-grid-row-form\">\n <tr\n #rowElement\n class=\"simple-grid-row\"\n [class.selected]=\"rowIndex === selectedRowIndex && !editing\" observeVisibility\n [class.disabled]=\"getIsRowDisabled(rowIndex)\"\n [class.editing]=\"rowIndex === editRowIndex\"\n *ngFor=\"let row of (!!rowsPerPage ? (data | paginate: {itemsPerPage: rowsPerPage, currentPage: currentPage}) : data); last as last; let rowIndex = index\"\n cdkDrag\n (click)=\"handleClickRow($event, rowIndex)\" (dblclick)=\"handleDblClickRow($event, rowIndex, row)\"\n (visibilityChange)=\"rowVisible.next(row)\"\n (mouseenter)=\"hoveredRowIndex = rowIndex\"\n (mouseleave)=\"hoveredRowIndex = -1\"\n >\n <ng-container *ngIf=\"isSingleColumnRow(row)\">\n <td class=\"simple-grid-single-column-cell\" [attr.colspan]=\"headerColumnsCopy.length\">\n <co-simple-grid-cell\n [column]=\"columns[singleColumnIndex(row)]\"\n [row]=\"row\"\n [editMode]=\"false\">\n </co-simple-grid-cell>\n </td>\n </ng-container>\n <ng-container *ngIf=\"!isSingleColumnRow(row)\">\n <ng-container *ngFor=\"let column of headerColumnsCopy; let columnIndex = index\">\n <td class=\"simple-grid-column-cell\" *ngIf=\"columnIndex !== singleColumnIndex(row)\">\n <co-simple-grid-cell\n [column]=\"column\"\n [row]=\"row\"\n [editMode]=\"inlineEdit && editing && rowIndex === editRowIndex\"\n [fieldEditMode]=\"editCellIndex === columnIndex && rowIndex === editRowIndex\"\n (cellClick)=\"handleCellClick($event, row, rowIndex, columnIndex)\">\n </co-simple-grid-cell>\n <div *ngIf=\"column.resizable\" class=\"simple-grid-column-sizer-placeholder\"></div>\n </td>\n </ng-container>\n <ng-container *ngIf=\"inlineEdit && showRowButtons\">\n <div class=\"icons-container\" *ngIf=\"!editing\">\n <co-icon class=\"icon-item icon-edit\"\n [iconData]=\"icons.getIcon(Icons.PenToSquareSolid)\" *ngIf=\"hoveredRowIndex === rowIndex\"\n (click)=\"editRow($event, true, rowIndex); $event.stopPropagation()\"></co-icon>\n <co-icon class=\"icon-item icon-delete\"\n [iconData]=\"icons.getIcon(Icons.TrashBin)\" *ngIf=\"hoveredRowIndex === rowIndex\"\n (click)=\"selectTheRow(rowIndex); removeRow();\"></co-icon>\n </div>\n <div class=\"icons-container\">\n <co-button class=\"save-button\"\n *ngIf=\"editing && (selectedRowIndex === rowIndex || (isNewRow && rowIndex === editRowIndex))\"\n [iconData]=\"icons.getIcon(Icons.CheckDuotone)\"\n (click)=\"validateAndSave(); $event.stopPropagation()\"></co-button>\n <co-button class=\"close-button\"\n *ngIf=\"editing && (selectedRowIndex === rowIndex || (isNewRow && rowIndex === editRowIndex))\"\n [iconData]=\"icons.getIcon(Icons.CrossSkinny)\"\n (click)=\"cancelEditRow(); $event.stopPropagation() \"></co-button>\n </div>\n </ng-container>\n <ng-container *ngIf=\"!(inlineEdit && showRowButtons)\">\n <div class=\"icons-container\">\n <co-icon class=\"icon-item icon-delete\"\n [iconData]=\"icons.getIcon(Icons.TrashBin)\" *ngIf=\"hoveredRowIndex === rowIndex\"\n (click)=\"selectTheRow(rowIndex); removeRow();\">\n </co-icon>\n </div>\n </ng-container>\n </ng-container>\n </tr>\n </co-form>\n </tbody>\n </table>\n <co-pagination-bar\n *ngIf=\"data?.length > rowsPerPage\" class=\"pagination-bar\"\n [itemsPerPage]=\"rowsPerPage\"\n [currentPage]=\"currentPage\"\n [totalItems]=\"data.length\"\n [autoHide]=\"true\"\n (previousClick)=\"goToPreviousPage()\"\n (nextClick)=\"goToNextPage()\"\n (pageClick)=\"setCurrentPage($event)\">\n </co-pagination-bar>\n ",
10842
+ template: "\n <co-grid-toolbar\n *ngIf=\"showToolbar\" [class.right]=\"rightToolbar\"\n [showEdit]=\"showEdit\"\n [showAdd]=\"showAdd\"\n [showDelete]=\"showDelete\"\n [deleteEnabled]=\"selectedRowIndex > -1\"\n (addClick)=\"addNewRow()\"\n (editClick)=\"editRow($event)\"\n (saveClick)=\"validateAndSave()\"\n (cancelClick)=\"cancelEditRow()\"\n (deleteClick)=\"removeRow()\">\n </co-grid-toolbar>\n\n <table\n id=\"simple-grid-table\"\n class=\"simple-grid-table\"\n [clickOutside]=\"editing\"\n (clickOutside)=\"handleClickOutsideRow()\">\n <colgroup>\n <col\n *ngFor=\"let column of headerColumnsCopy; let index = index\"\n [class.simple-grid-column-auto-fit]=\"column.autoFit\"\n [style.width.px]=\"column.width\"\n [style.min-width.px]=\"MIN_COLUMN_WIDTH\">\n </colgroup>\n <thead>\n <tr>\n <th\n scope=\"col\"\n #headerCell\n class=\"simple-grid-column-header\"\n *ngFor=\"let column of headerColumnsCopy; let index = index\">\n <div\n class=\"simple-grid-column-header-wrapper\"\n [class.resizable]=\"resizable\"\n [class.selected]=\"column.isSelected\"\n [ngClass]=\"column.textAlign ? column.textAlign : defaultTextAlign\">\n <ng-container *ngIf=\"column.headerTemplate; else noHeaderTemplate\">\n <ng-container [ngTemplateOutlet]=\"column.headerTemplate\"></ng-container>\n </ng-container>\n <ng-template #noHeaderTemplate>\n <div\n class=\"simple-grid-column-header-label\"\n [ngClass]=\"column.textAlign ? column.textAlign : defaultTextAlign\"\n [class.with-menu]=\"showGridSettings\"\n [class.with-sort]=\"showColumnSort\"\n [textContent]=\"column.headerText || '&nbsp;'\" [title]=\"column.headerText\"\n (click)=\"showColumnSort ? sortColumn(column, column.field) : toggleColumnMenu(column)\">\n </div>\n\n <div class=\"sort-column\" *ngIf=\"showColumnSort\">\n <co-button\n (click)=\"sortColumn(column, column?.field)\"\n [iconData]=\"icons.getIcon(Icons.ArrowUpArrowDown)\">\n </co-button>\n </div>\n\n <div class=\"column-menu\" *ngIf=\"column.isSelected\">\n <h3 [textContent]=\"'COLUMN_OPTIONS' | coreLocalize\"></h3>\n <ul>\n <li (click)=\"hideColumn(column)\">Hide Column</li>\n <li (click)=\"sortColumn(column, column.field)\">Sort Column</li>\n </ul>\n </div>\n </ng-template>\n <div\n *ngIf=\"resizable && column.resizable\"\n class=\"simple-grid-column-sizer\"\n (mousedown)=\"handleSizerMouseDown($event, column)\">\n </div>\n </div>\n </th>\n </tr>\n\n <div *ngIf=\"showGridSettings\" class=\"grid-settings\">\n <co-button\n [class.selected]=\"isSettingsMenuOpen\"\n [iconData]=\"icons.getIcon(Icons.CogWheels)\"\n (click)=\"toggleSettingsMenu()\">\n </co-button>\n\n <div class=\"settings-menu\" *ngIf=\"isSettingsMenuOpen\">\n <h3 [textContent]=\"'GRID_OPTIONS' | coreLocalize\"></h3>\n <ul>\n <li (click)=\"exportToExcel()\">Export to Excel</li>\n <li *ngIf=\"headerColumnsCopy.length !== headerColumns.length\" (click)=\"showAllColumns()\">\n Show All Columns\n </li>\n </ul>\n </div>\n </div>\n </thead>\n <tbody\n #dropList cdkDropList cdkDropListOrientation=\"vertical\"\n class=\"simple-grid-drag-drop-list\"\n [cdkDropListDisabled]=\"!dragDropEnabled || editing\"\n [cdkDropListData]=\"data\"\n [cdkDropListEnterPredicate]=\"handleCanDragDrop\"\n (cdkDropListDropped)=\"handleDrop($event)\">\n <co-form class=\"simple-grid-row-form\">\n <tr\n #rowElement\n class=\"simple-grid-row\"\n [class.selected]=\"rowIndex === selectedRowIndex && !editing\" observeVisibility\n [class.disabled]=\"getIsRowDisabled(rowIndex)\"\n [class.editing]=\"rowIndex === editRowIndex\"\n *ngFor=\"let row of (!!rowsPerPage ? (data | paginate: {itemsPerPage: rowsPerPage, currentPage: currentPage}) : data); last as last; let rowIndex = index\"\n cdkDrag\n (click)=\"handleClickRow($event, rowIndex)\" (dblclick)=\"handleDblClickRow($event, rowIndex, row)\"\n (visibilityChange)=\"rowVisible.next(row)\"\n (mouseenter)=\"hoveredRowIndex = rowIndex\"\n (mouseleave)=\"hoveredRowIndex = -1\"\n >\n <ng-container *ngIf=\"isSingleColumnRow(row)\">\n <td class=\"simple-grid-single-column-cell\" [attr.colspan]=\"headerColumnsCopy.length\">\n <co-simple-grid-cell\n [column]=\"columns[singleColumnIndex(row)]\"\n [row]=\"row\"\n [editMode]=\"false\">\n </co-simple-grid-cell>\n </td>\n </ng-container>\n <ng-container *ngIf=\"!isSingleColumnRow(row)\">\n <ng-container *ngFor=\"let column of headerColumnsCopy; let columnIndex = index\">\n <td class=\"simple-grid-column-cell\" *ngIf=\"columnIndex !== singleColumnIndex(row)\">\n <co-simple-grid-cell\n [column]=\"column\"\n [row]=\"row\"\n [editMode]=\"inlineEdit && editing && rowIndex === editRowIndex\"\n [fieldEditMode]=\"editCellIndex === columnIndex && rowIndex === editRowIndex\"\n (cellClick)=\"handleCellClick($event, row, rowIndex, columnIndex)\">\n </co-simple-grid-cell>\n <div *ngIf=\"column.resizable\" class=\"simple-grid-column-sizer-placeholder\"></div>\n </td>\n </ng-container>\n <ng-container *ngIf=\"inlineEdit && showRowButtons\">\n <div class=\"icons-container\" *ngIf=\"!editing\">\n <co-icon class=\"icon-item icon-edit\"\n [iconData]=\"icons.getIcon(Icons.PenToSquareSolid)\" *ngIf=\"hoveredRowIndex === rowIndex\"\n (click)=\"editRow($event, true, rowIndex); $event.stopPropagation()\"></co-icon>\n <co-icon class=\"icon-item icon-delete\"\n [iconData]=\"icons.getIcon(Icons.TrashBin)\" *ngIf=\"hoveredRowIndex === rowIndex\"\n (click)=\"selectTheRow(rowIndex); removeRow();\"></co-icon>\n </div>\n <div class=\"icons-container\">\n <co-button class=\"save-button\"\n *ngIf=\"editing && (selectedRowIndex === rowIndex || (isNewRow && rowIndex === editRowIndex))\"\n [iconData]=\"icons.getIcon(Icons.CheckDuotone)\"\n (click)=\"validateAndSave(); $event.stopPropagation()\"></co-button>\n <co-button class=\"close-button\"\n *ngIf=\"editing && (selectedRowIndex === rowIndex || (isNewRow && rowIndex === editRowIndex))\"\n [iconData]=\"icons.getIcon(Icons.CrossSkinny)\"\n (click)=\"cancelEditRow(); $event.stopPropagation() \"></co-button>\n </div>\n </ng-container>\n <ng-container *ngIf=\"!(inlineEdit && showRowButtons) && showDelete\">\n <div class=\"icons-container\">\n <co-icon class=\"icon-item icon-delete\"\n [iconData]=\"icons.getIcon(Icons.TrashBin)\" *ngIf=\"hoveredRowIndex === rowIndex\"\n (click)=\"selectTheRow(rowIndex); removeRow();\">\n </co-icon>\n </div>\n </ng-container>\n </ng-container>\n </tr>\n </co-form>\n </tbody>\n </table>\n <co-pagination-bar\n *ngIf=\"data?.length > rowsPerPage\" class=\"pagination-bar\"\n [itemsPerPage]=\"rowsPerPage\"\n [currentPage]=\"currentPage\"\n [totalItems]=\"data.length\"\n [autoHide]=\"true\"\n (previousClick)=\"goToPreviousPage()\"\n (nextClick)=\"goToNextPage()\"\n (pageClick)=\"setCurrentPage($event)\">\n </co-pagination-bar>\n ",
10841
10843
  providers: [FormMasterService],
10842
10844
  changeDetection: i0.ChangeDetectionStrategy.OnPush,
10843
10845
  encapsulation: i0.ViewEncapsulation.None
@@ -12116,7 +12118,7 @@
12116
12118
  modelChange: function (value) { return _this.optionChosen(value); },
12117
12119
  closePopup: function () { return _this.closePopup(); },
12118
12120
  keyDown: function (event) { return _this.handleInputKeyDown(event); }
12119
- });
12121
+ }, this.elementRef);
12120
12122
  this.keepFocussed = true;
12121
12123
  };
12122
12124
  ListOfValuesComponent.prototype.removeOptionFromModel = function (chip) {
@@ -12358,6 +12360,19 @@
12358
12360
  },] }
12359
12361
  ];
12360
12362
 
12363
+ // Values are corresponding dictionary keys in text_nl.
12364
+ var BatchDeliveryCategory;
12365
+ (function (BatchDeliveryCategory) {
12366
+ BatchDeliveryCategory["Overview"] = "OVERVIEW";
12367
+ BatchDeliveryCategory["Purchase"] = "COST_OF_SALES";
12368
+ BatchDeliveryCategory["Allocate"] = "ALLOCATION";
12369
+ BatchDeliveryCategory["Logistics"] = "LOGISTICS";
12370
+ BatchDeliveryCategory["DeliveryOrder"] = "DELIVERY_ORDER";
12371
+ BatchDeliveryCategory["Invoice"] = "INVOICE";
12372
+ BatchDeliveryCategory["ToPick"] = "TO_PICK";
12373
+ BatchDeliveryCategory["Picked"] = "PICKED";
12374
+ })(BatchDeliveryCategory || (BatchDeliveryCategory = {}));
12375
+
12361
12376
  var ListOfIconsComponent = /** @class */ (function () {
12362
12377
  function ListOfIconsComponent(iconCacheService, icons) {
12363
12378
  this.iconCacheService = iconCacheService;
@@ -12369,8 +12384,8 @@
12369
12384
  this.showSubCategories = false;
12370
12385
  this._collection = [];
12371
12386
  this.subCategories = [
12372
- { icon: this.iconCacheService.getIcon(this.Icon.BoxesPackingRegular), label: 'To be picked' },
12373
- { icon: this.iconCacheService.getIcon(this.Icon.RegularBoxesPackingCircleCheck), label: 'Picked' }
12387
+ { icon: this.iconCacheService.getIcon(this.Icon.BoxesPackingRegular), label: BatchDeliveryCategory.ToPick },
12388
+ { icon: this.iconCacheService.getIcon(this.Icon.RegularBoxesPackingCircleCheck), label: BatchDeliveryCategory.Picked }
12374
12389
  ];
12375
12390
  }
12376
12391
  Object.defineProperty(ListOfIconsComponent.prototype, "collection", {
@@ -12395,7 +12410,7 @@
12395
12410
  this.showMenu = !this.showMenu;
12396
12411
  };
12397
12412
  ListOfIconsComponent.prototype.selectItem = function (item) {
12398
- if (item.label.toUpperCase() === 'LOGISTICS' || item.label.toUpperCase() === 'LOGISTIEK') {
12413
+ if (item.label === BatchDeliveryCategory.Logistics) {
12399
12414
  this.showSubCategories = !this.showSubCategories;
12400
12415
  return;
12401
12416
  }
@@ -12417,7 +12432,7 @@
12417
12432
  ListOfIconsComponent.decorators = [
12418
12433
  { type: i0.Component, args: [{
12419
12434
  selector: 'co-list-of-icons',
12420
- template: "\n <div class=\"icon-item active\" [class.menu-opened]=\"showMenu\" (click)=\"toggleMenu()\">\n <co-icon [iconData]=\"activeItem.icon\" [style.width.px]=\"iconSize\" [style.height.px]=\"iconSize\"></co-icon>\n <co-icon *ngIf=\"!showMenu\" class=\"drop-arrow\" [iconData]=\"icons.getIcon(Icon.CaretDownSolid)\"></co-icon>\n <co-icon *ngIf=\"showMenu\" class=\"drop-arrow\" [iconData]=\"icons.getIcon(Icon.CaretUpSolid)\"></co-icon>\n </div>\n <div class=\"dropdown-menu\" *ngIf=\"showMenu\" (clickOutside)=\"onClickOutside()\">\n <div class=\"icon-item\" *ngFor=\"let item of collection\" (click)=\"selectItem(item)\"\n [class.active]=\"item === activeItem\">\n <co-icon [iconData]=\"item.icon\" [style.width.px]=\"iconSize\" [style.height.px]=\"iconSize\"></co-icon>\n <div class=\"label\">{{ item.label }}</div>\n </div>\n <div class=\"picking-type-wrapper\" *ngIf=\"showSubCategories\">\n <div class=\"button-wrapper\" *ngFor=\"let subCategory of subCategories\" (click)=\"handlePickingCategoryClicked(subCategory)\">\n <co-icon class=\"co-transaction-button-bar-icon\" [iconData]=\"subCategory.icon\"></co-icon>\n <span class=\"button-title\">{{subCategory.label}}</span>\n </div>\n </div>\n </div>\n ",
12435
+ template: "\n <div class=\"icon-item active\" [class.menu-opened]=\"showMenu\" (click)=\"toggleMenu()\">\n <co-icon [iconData]=\"activeItem.icon\" [style.width.px]=\"iconSize\" [style.height.px]=\"iconSize\"></co-icon>\n <co-icon *ngIf=\"!showMenu\" class=\"drop-arrow\" [iconData]=\"icons.getIcon(Icon.CaretDownSolid)\"></co-icon>\n <co-icon *ngIf=\"showMenu\" class=\"drop-arrow\" [iconData]=\"icons.getIcon(Icon.CaretUpSolid)\"></co-icon>\n </div>\n <div class=\"dropdown-menu\" *ngIf=\"showMenu\" (clickOutside)=\"onClickOutside()\">\n <div class=\"icon-item\" *ngFor=\"let item of collection\" (click)=\"selectItem(item)\"\n [class.active]=\"item === activeItem\">\n <co-icon [iconData]=\"item.icon\" [style.width.px]=\"iconSize\" [style.height.px]=\"iconSize\"></co-icon>\n <div class=\"label\" [textContent]=\"item.label | coreLocalize\"></div>\n </div>\n <div class=\"picking-type-wrapper\" *ngIf=\"showSubCategories\">\n <div class=\"button-wrapper\" *ngFor=\"let subCategory of subCategories\" (click)=\"handlePickingCategoryClicked(subCategory)\">\n <co-icon \n class=\"co-transaction-button-bar-icon\" \n [iconData]=\"subCategory.icon\" \n [style.width.px]=\"iconSize\" \n [style.height.px]=\"iconSize\">\n </co-icon>\n <span class=\"button-title\" [textContent]=\"subCategory.label | coreLocalize\"></span>\n </div>\n </div>\n </div>\n ",
12421
12436
  encapsulation: i0.ViewEncapsulation.None
12422
12437
  },] }
12423
12438
  ];
@@ -12444,7 +12459,8 @@
12444
12459
  common.CommonModule,
12445
12460
  forms.FormsModule,
12446
12461
  IconModule,
12447
- ClickoutsideModule
12462
+ ClickoutsideModule,
12463
+ CoreComponentsTranslationModule
12448
12464
  ],
12449
12465
  declarations: [
12450
12466
  ListOfIconsComponent
@@ -12845,6 +12861,8 @@
12845
12861
  this.isLoading = false;
12846
12862
  this._collection = [];
12847
12863
  this._mode = this.modes.Filterlist;
12864
+ this._defaultSet = false;
12865
+ this._collectionSubject = new rxjs.BehaviorSubject(undefined);
12848
12866
  }
12849
12867
  Object.defineProperty(FilterItemComponent.prototype, "mode", {
12850
12868
  get: function () {
@@ -12867,6 +12885,7 @@
12867
12885
  this.filteredCollection = (_a = this._collection) === null || _a === void 0 ? void 0 : _a.slice();
12868
12886
  //reset the model in case there was no collection to set its values on when it was set.
12869
12887
  this.model = this._model;
12888
+ this._collectionSubject.next(this._collection);
12870
12889
  },
12871
12890
  enumerable: false,
12872
12891
  configurable: true
@@ -12901,11 +12920,20 @@
12901
12920
  configurable: true
12902
12921
  });
12903
12922
  FilterItemComponent.prototype.ngOnInit = function () {
12923
+ var _this = this;
12904
12924
  this.setToInitialLimit();
12905
12925
  this.showButton = this.valueSelected();
12906
12926
  if (this.checkBoxToTextModel === undefined || this.checkBoxToTextModel === null) {
12907
12927
  this.checkBoxToTextModel = false;
12908
12928
  }
12929
+ this._collectionSubscription = this._collectionSubject.subscribe(function (collection) {
12930
+ if (!_this._defaultSet && collection) {
12931
+ _this._applyDefaultFilters();
12932
+ }
12933
+ });
12934
+ };
12935
+ FilterItemComponent.prototype.ngOnDestroy = function () {
12936
+ this._collectionSubscription.unsubscribe();
12909
12937
  };
12910
12938
  FilterItemComponent.prototype.setToInitialLimit = function () {
12911
12939
  this.limitTo = this.initialLimit;
@@ -13424,6 +13452,212 @@
13424
13452
  this.dateRangeEnd = undefined;
13425
13453
  }
13426
13454
  };
13455
+ FilterItemComponent.prototype._applyDefaultForFilterList = function () {
13456
+ var _this = this;
13457
+ var defaultString = this.defaultValue.toString();
13458
+ var codes = defaultString.split(',').map(function (code) { return code.trim(); });
13459
+ codes.forEach(function (code) {
13460
+ var item = _this._collection.find(function (i) { return i.code.toString() === code; });
13461
+ if (item) {
13462
+ item.checked = true;
13463
+ }
13464
+ });
13465
+ this._createModelForFilterList();
13466
+ this.modelChange.emit(this._model);
13467
+ this.showButton = true;
13468
+ };
13469
+ FilterItemComponent.prototype._applyDefaultForStringCollectionList = function () {
13470
+ var _this = this;
13471
+ var defaultString = this.defaultValue.toString();
13472
+ var codes = defaultString.split(',').map(function (code) { return code.trim(); });
13473
+ codes.forEach(function (code) {
13474
+ var item = _this._collection.find(function (i) { return i.code.toString() === code; });
13475
+ if (item) {
13476
+ item.checked = true;
13477
+ }
13478
+ });
13479
+ this._createModelForStringCollectionList();
13480
+ this.modelChange.emit(this._model);
13481
+ this.showButton = true;
13482
+ };
13483
+ FilterItemComponent.prototype._applyDefaultForSingleSelectList = function () {
13484
+ var defaultCode = this.defaultValue.toString().trim();
13485
+ var item = this._collection.find(function (i) { return i.code.toString() === defaultCode; });
13486
+ if (item) {
13487
+ item.checked = true;
13488
+ this._createModelForSingleSelectList();
13489
+ this.modelChange.emit(this._model);
13490
+ this.showButton = true;
13491
+ }
13492
+ };
13493
+ FilterItemComponent.prototype._applyDefaultForSelectListWithNumberOutput = function () {
13494
+ var e_3, _g;
13495
+ var defaultNumber = Number(this.defaultValue);
13496
+ if (!isNaN(defaultNumber) && defaultNumber > 0) {
13497
+ try {
13498
+ // Decode the number to determine which items should be checked
13499
+ for (var _h = __values(this._collection), _j = _h.next(); !_j.done; _j = _h.next()) {
13500
+ var item = _j.value;
13501
+ var itemCode = Number(item.code);
13502
+ var modValue = (defaultNumber % (2 * itemCode));
13503
+ item.checked = (modValue >= itemCode);
13504
+ }
13505
+ }
13506
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
13507
+ finally {
13508
+ try {
13509
+ if (_j && !_j.done && (_g = _h.return)) _g.call(_h);
13510
+ }
13511
+ finally { if (e_3) throw e_3.error; }
13512
+ }
13513
+ this._createModelForSelectListWithNumberOutput();
13514
+ this.modelChange.emit(this._model);
13515
+ this.showButton = true;
13516
+ }
13517
+ };
13518
+ FilterItemComponent.prototype._applyDefaultForSlider = function () {
13519
+ var defaultString = this.defaultValue.toString();
13520
+ var _g = __read(defaultString.split('-').map(function (s) { return Number(s.trim()); }), 2), min = _g[0], max = _g[1];
13521
+ if (!isNaN(min) && !isNaN(max)) {
13522
+ this.sliderMin = min;
13523
+ this.sliderMax = max;
13524
+ this._createModelForSliderMode();
13525
+ this.modelChange.emit(this._model);
13526
+ this.showButton = true;
13527
+ }
13528
+ };
13529
+ FilterItemComponent.prototype._applyDefaultForCheckboxToText = function () {
13530
+ var defaultString = this.defaultValue.toString().toUpperCase();
13531
+ this.checkBoxToTextModel = (defaultString === 'J' || defaultString === 'Y' || defaultString === 'TRUE');
13532
+ if (this.mode === this.modes.CheckboxToText) {
13533
+ this._createModelForCheckboxToText();
13534
+ }
13535
+ else {
13536
+ this._createModelForCheckboxToSimpleText();
13537
+ }
13538
+ this.modelChange.emit(this._model);
13539
+ this.showButton = true;
13540
+ };
13541
+ FilterItemComponent.prototype._applyDefaultForCheckboxToBinary = function () {
13542
+ var defaultValue = Number(this.defaultValue);
13543
+ this.checkBoxToTextModel = (!isNaN(defaultValue) && defaultValue >= 1);
13544
+ this._createModelForCheckboxToBinary();
13545
+ this.modelChange.emit(this._model);
13546
+ this.showButton = true;
13547
+ };
13548
+ FilterItemComponent.prototype._applyDefaultForDateField = function () {
13549
+ var defaultString = this.defaultValue.toString();
13550
+ if (defaultString.match(/^\d{2}-\d{2}-\d{4}$/)) {
13551
+ // dd-MM-yyyy format
13552
+ var _g = __read(defaultString.split('-'), 3), dd = _g[0], mm = _g[1], yyyy = _g[2];
13553
+ this.dateFieldValue = new Date(+yyyy, +mm - 1, +dd);
13554
+ }
13555
+ else if (defaultString.match(/^\d{4}-\d{2}-\d{2}$/)) {
13556
+ // yyyy-MM-dd format
13557
+ var _h = __read(defaultString.split('-'), 3), yyyy = _h[0], mm = _h[1], dd = _h[2];
13558
+ this.dateFieldValue = new Date(+yyyy, +mm - 1, +dd);
13559
+ }
13560
+ else {
13561
+ // Try parsing as standard date
13562
+ var date = new Date(defaultString);
13563
+ if (!isNaN(date.getTime())) {
13564
+ this.dateFieldValue = date;
13565
+ }
13566
+ }
13567
+ if (this.dateFieldValue) {
13568
+ this._createModelForDateField(this.dateFieldValue);
13569
+ this.modelChange.emit(this._model);
13570
+ this.showButton = true;
13571
+ }
13572
+ };
13573
+ FilterItemComponent.prototype._applyDefaultForDateRangeField = function () {
13574
+ var defaultString = this.defaultValue.toString();
13575
+ if (defaultString.includes('&')) {
13576
+ // Format: "startDate & endDate"
13577
+ var _g = __read(defaultString.split('&').map(function (s) { return s.trim(); }), 2), startStr = _g[0], endStr = _g[1];
13578
+ var parseDate = function (dateStr) {
13579
+ if (dateStr.match(/^\d{2}-\d{2}-\d{4}$/)) {
13580
+ var _g = __read(dateStr.split('-'), 3), dd = _g[0], mm = _g[1], yyyy = _g[2];
13581
+ return new Date(+yyyy, +mm - 1, +dd);
13582
+ }
13583
+ else if (dateStr.match(/^\d{4}-\d{2}-\d{2}$/)) {
13584
+ var _h = __read(dateStr.split('-'), 3), yyyy = _h[0], mm = _h[1], dd = _h[2];
13585
+ return new Date(+yyyy, +mm - 1, +dd);
13586
+ }
13587
+ return null;
13588
+ };
13589
+ var startDate = parseDate(startStr);
13590
+ var endDate = parseDate(endStr);
13591
+ if (startDate && endDate) {
13592
+ this.dateRangeStart = startDate;
13593
+ this.dateRangeEnd = endDate;
13594
+ this._createModelForDateRange([this.dateRangeStart, this.dateRangeEnd]);
13595
+ this.modelChange.emit(this._model);
13596
+ this.showButton = true;
13597
+ }
13598
+ }
13599
+ };
13600
+ FilterItemComponent.prototype._applyDefaultForTextField = function () {
13601
+ this._model = this.defaultValue.toString();
13602
+ this.modelChange.emit(this._model);
13603
+ this.showButton = true;
13604
+ };
13605
+ FilterItemComponent.prototype._applyDefaultForCheckbox = function () {
13606
+ var defaultString = this.defaultValue.toString().toLowerCase();
13607
+ this._model = (defaultString === 'true' || defaultString === '1' || defaultString === 'yes');
13608
+ this.modelChange.emit(this._model);
13609
+ this.showButton = true;
13610
+ };
13611
+ FilterItemComponent.prototype._applyDefaultFilters = function () {
13612
+ var _a;
13613
+ var modeWithoutCollection = this.mode === this.modes.DateField ||
13614
+ this.mode === this.modes.DateRangeField ||
13615
+ this.mode === this.modes.Slider;
13616
+ var canApplyDefaults = (modeWithoutCollection || (!modeWithoutCollection && this.collection && this.collection.length > 0)) &&
13617
+ this.defaultValue &&
13618
+ !(((_a = this._model) === null || _a === void 0 ? void 0 : _a.length) || this._model > 0);
13619
+ if (!canApplyDefaults) {
13620
+ return;
13621
+ }
13622
+ switch (this.mode) {
13623
+ case this.modes.Filterlist:
13624
+ this._applyDefaultForFilterList();
13625
+ break;
13626
+ case this.modes.SelectListWithStringCollectionOutput:
13627
+ this._applyDefaultForStringCollectionList();
13628
+ break;
13629
+ case this.modes.SingleSelectList:
13630
+ this._applyDefaultForSingleSelectList();
13631
+ break;
13632
+ case this.modes.SelectListWithNumberOutput:
13633
+ this._applyDefaultForSelectListWithNumberOutput();
13634
+ break;
13635
+ case this.modes.Slider:
13636
+ case this.modes.NullableSlider:
13637
+ this._applyDefaultForSlider();
13638
+ break;
13639
+ case this.modes.CheckboxToText:
13640
+ case this.modes.CheckboxToSimpleText:
13641
+ this._applyDefaultForCheckboxToText();
13642
+ break;
13643
+ case this.modes.CheckboxToBinary:
13644
+ this._applyDefaultForCheckboxToBinary();
13645
+ break;
13646
+ case this.modes.DateField:
13647
+ this._applyDefaultForDateField();
13648
+ break;
13649
+ case this.modes.DateRangeField:
13650
+ this._applyDefaultForDateRangeField();
13651
+ break;
13652
+ case this.modes.TextField:
13653
+ this._applyDefaultForTextField();
13654
+ break;
13655
+ case this.modes.Checkbox:
13656
+ this._applyDefaultForCheckbox();
13657
+ break;
13658
+ }
13659
+ this._defaultSet = true;
13660
+ };
13427
13661
  return FilterItemComponent;
13428
13662
  }());
13429
13663
  FilterItemComponent.decorators = [