@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.
@@ -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) {
@@ -12845,6 +12847,8 @@
12845
12847
  this.isLoading = false;
12846
12848
  this._collection = [];
12847
12849
  this._mode = this.modes.Filterlist;
12850
+ this._defaultSet = false;
12851
+ this._collectionSubject = new rxjs.BehaviorSubject(undefined);
12848
12852
  }
12849
12853
  Object.defineProperty(FilterItemComponent.prototype, "mode", {
12850
12854
  get: function () {
@@ -12867,6 +12871,7 @@
12867
12871
  this.filteredCollection = (_a = this._collection) === null || _a === void 0 ? void 0 : _a.slice();
12868
12872
  //reset the model in case there was no collection to set its values on when it was set.
12869
12873
  this.model = this._model;
12874
+ this._collectionSubject.next(this._collection);
12870
12875
  },
12871
12876
  enumerable: false,
12872
12877
  configurable: true
@@ -12901,11 +12906,20 @@
12901
12906
  configurable: true
12902
12907
  });
12903
12908
  FilterItemComponent.prototype.ngOnInit = function () {
12909
+ var _this = this;
12904
12910
  this.setToInitialLimit();
12905
12911
  this.showButton = this.valueSelected();
12906
12912
  if (this.checkBoxToTextModel === undefined || this.checkBoxToTextModel === null) {
12907
12913
  this.checkBoxToTextModel = false;
12908
12914
  }
12915
+ this._collectionSubscription = this._collectionSubject.subscribe(function (collection) {
12916
+ if (!_this._defaultSet && collection) {
12917
+ _this._applyDefaultFilters();
12918
+ }
12919
+ });
12920
+ };
12921
+ FilterItemComponent.prototype.ngOnDestroy = function () {
12922
+ this._collectionSubscription.unsubscribe();
12909
12923
  };
12910
12924
  FilterItemComponent.prototype.setToInitialLimit = function () {
12911
12925
  this.limitTo = this.initialLimit;
@@ -13424,6 +13438,212 @@
13424
13438
  this.dateRangeEnd = undefined;
13425
13439
  }
13426
13440
  };
13441
+ FilterItemComponent.prototype._applyDefaultForFilterList = function () {
13442
+ var _this = this;
13443
+ var defaultString = this.defaultValue.toString();
13444
+ var codes = defaultString.split(',').map(function (code) { return code.trim(); });
13445
+ codes.forEach(function (code) {
13446
+ var item = _this._collection.find(function (i) { return i.code.toString() === code; });
13447
+ if (item) {
13448
+ item.checked = true;
13449
+ }
13450
+ });
13451
+ this._createModelForFilterList();
13452
+ this.modelChange.emit(this._model);
13453
+ this.showButton = true;
13454
+ };
13455
+ FilterItemComponent.prototype._applyDefaultForStringCollectionList = 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._createModelForStringCollectionList();
13466
+ this.modelChange.emit(this._model);
13467
+ this.showButton = true;
13468
+ };
13469
+ FilterItemComponent.prototype._applyDefaultForSingleSelectList = function () {
13470
+ var defaultCode = this.defaultValue.toString().trim();
13471
+ var item = this._collection.find(function (i) { return i.code.toString() === defaultCode; });
13472
+ if (item) {
13473
+ item.checked = true;
13474
+ this._createModelForSingleSelectList();
13475
+ this.modelChange.emit(this._model);
13476
+ this.showButton = true;
13477
+ }
13478
+ };
13479
+ FilterItemComponent.prototype._applyDefaultForSelectListWithNumberOutput = function () {
13480
+ var e_3, _g;
13481
+ var defaultNumber = Number(this.defaultValue);
13482
+ if (!isNaN(defaultNumber) && defaultNumber > 0) {
13483
+ try {
13484
+ // Decode the number to determine which items should be checked
13485
+ for (var _h = __values(this._collection), _j = _h.next(); !_j.done; _j = _h.next()) {
13486
+ var item = _j.value;
13487
+ var itemCode = Number(item.code);
13488
+ var modValue = (defaultNumber % (2 * itemCode));
13489
+ item.checked = (modValue >= itemCode);
13490
+ }
13491
+ }
13492
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
13493
+ finally {
13494
+ try {
13495
+ if (_j && !_j.done && (_g = _h.return)) _g.call(_h);
13496
+ }
13497
+ finally { if (e_3) throw e_3.error; }
13498
+ }
13499
+ this._createModelForSelectListWithNumberOutput();
13500
+ this.modelChange.emit(this._model);
13501
+ this.showButton = true;
13502
+ }
13503
+ };
13504
+ FilterItemComponent.prototype._applyDefaultForSlider = function () {
13505
+ var defaultString = this.defaultValue.toString();
13506
+ var _g = __read(defaultString.split('-').map(function (s) { return Number(s.trim()); }), 2), min = _g[0], max = _g[1];
13507
+ if (!isNaN(min) && !isNaN(max)) {
13508
+ this.sliderMin = min;
13509
+ this.sliderMax = max;
13510
+ this._createModelForSliderMode();
13511
+ this.modelChange.emit(this._model);
13512
+ this.showButton = true;
13513
+ }
13514
+ };
13515
+ FilterItemComponent.prototype._applyDefaultForCheckboxToText = function () {
13516
+ var defaultString = this.defaultValue.toString().toUpperCase();
13517
+ this.checkBoxToTextModel = (defaultString === 'J' || defaultString === 'Y' || defaultString === 'TRUE');
13518
+ if (this.mode === this.modes.CheckboxToText) {
13519
+ this._createModelForCheckboxToText();
13520
+ }
13521
+ else {
13522
+ this._createModelForCheckboxToSimpleText();
13523
+ }
13524
+ this.modelChange.emit(this._model);
13525
+ this.showButton = true;
13526
+ };
13527
+ FilterItemComponent.prototype._applyDefaultForCheckboxToBinary = function () {
13528
+ var defaultValue = Number(this.defaultValue);
13529
+ this.checkBoxToTextModel = (!isNaN(defaultValue) && defaultValue >= 1);
13530
+ this._createModelForCheckboxToBinary();
13531
+ this.modelChange.emit(this._model);
13532
+ this.showButton = true;
13533
+ };
13534
+ FilterItemComponent.prototype._applyDefaultForDateField = function () {
13535
+ var defaultString = this.defaultValue.toString();
13536
+ if (defaultString.match(/^\d{2}-\d{2}-\d{4}$/)) {
13537
+ // dd-MM-yyyy format
13538
+ var _g = __read(defaultString.split('-'), 3), dd = _g[0], mm = _g[1], yyyy = _g[2];
13539
+ this.dateFieldValue = new Date(+yyyy, +mm - 1, +dd);
13540
+ }
13541
+ else if (defaultString.match(/^\d{4}-\d{2}-\d{2}$/)) {
13542
+ // yyyy-MM-dd format
13543
+ var _h = __read(defaultString.split('-'), 3), yyyy = _h[0], mm = _h[1], dd = _h[2];
13544
+ this.dateFieldValue = new Date(+yyyy, +mm - 1, +dd);
13545
+ }
13546
+ else {
13547
+ // Try parsing as standard date
13548
+ var date = new Date(defaultString);
13549
+ if (!isNaN(date.getTime())) {
13550
+ this.dateFieldValue = date;
13551
+ }
13552
+ }
13553
+ if (this.dateFieldValue) {
13554
+ this._createModelForDateField(this.dateFieldValue);
13555
+ this.modelChange.emit(this._model);
13556
+ this.showButton = true;
13557
+ }
13558
+ };
13559
+ FilterItemComponent.prototype._applyDefaultForDateRangeField = function () {
13560
+ var defaultString = this.defaultValue.toString();
13561
+ if (defaultString.includes('&')) {
13562
+ // Format: "startDate & endDate"
13563
+ var _g = __read(defaultString.split('&').map(function (s) { return s.trim(); }), 2), startStr = _g[0], endStr = _g[1];
13564
+ var parseDate = function (dateStr) {
13565
+ if (dateStr.match(/^\d{2}-\d{2}-\d{4}$/)) {
13566
+ var _g = __read(dateStr.split('-'), 3), dd = _g[0], mm = _g[1], yyyy = _g[2];
13567
+ return new Date(+yyyy, +mm - 1, +dd);
13568
+ }
13569
+ else if (dateStr.match(/^\d{4}-\d{2}-\d{2}$/)) {
13570
+ var _h = __read(dateStr.split('-'), 3), yyyy = _h[0], mm = _h[1], dd = _h[2];
13571
+ return new Date(+yyyy, +mm - 1, +dd);
13572
+ }
13573
+ return null;
13574
+ };
13575
+ var startDate = parseDate(startStr);
13576
+ var endDate = parseDate(endStr);
13577
+ if (startDate && endDate) {
13578
+ this.dateRangeStart = startDate;
13579
+ this.dateRangeEnd = endDate;
13580
+ this._createModelForDateRange([this.dateRangeStart, this.dateRangeEnd]);
13581
+ this.modelChange.emit(this._model);
13582
+ this.showButton = true;
13583
+ }
13584
+ }
13585
+ };
13586
+ FilterItemComponent.prototype._applyDefaultForTextField = function () {
13587
+ this._model = this.defaultValue.toString();
13588
+ this.modelChange.emit(this._model);
13589
+ this.showButton = true;
13590
+ };
13591
+ FilterItemComponent.prototype._applyDefaultForCheckbox = function () {
13592
+ var defaultString = this.defaultValue.toString().toLowerCase();
13593
+ this._model = (defaultString === 'true' || defaultString === '1' || defaultString === 'yes');
13594
+ this.modelChange.emit(this._model);
13595
+ this.showButton = true;
13596
+ };
13597
+ FilterItemComponent.prototype._applyDefaultFilters = function () {
13598
+ var _a;
13599
+ var modeWithoutCollection = this.mode === this.modes.DateField ||
13600
+ this.mode === this.modes.DateRangeField ||
13601
+ this.mode === this.modes.Slider;
13602
+ var canApplyDefaults = (modeWithoutCollection || (!modeWithoutCollection && this.collection && this.collection.length > 0)) &&
13603
+ this.defaultValue &&
13604
+ !(((_a = this._model) === null || _a === void 0 ? void 0 : _a.length) || this._model > 0);
13605
+ if (!canApplyDefaults) {
13606
+ return;
13607
+ }
13608
+ switch (this.mode) {
13609
+ case this.modes.Filterlist:
13610
+ this._applyDefaultForFilterList();
13611
+ break;
13612
+ case this.modes.SelectListWithStringCollectionOutput:
13613
+ this._applyDefaultForStringCollectionList();
13614
+ break;
13615
+ case this.modes.SingleSelectList:
13616
+ this._applyDefaultForSingleSelectList();
13617
+ break;
13618
+ case this.modes.SelectListWithNumberOutput:
13619
+ this._applyDefaultForSelectListWithNumberOutput();
13620
+ break;
13621
+ case this.modes.Slider:
13622
+ case this.modes.NullableSlider:
13623
+ this._applyDefaultForSlider();
13624
+ break;
13625
+ case this.modes.CheckboxToText:
13626
+ case this.modes.CheckboxToSimpleText:
13627
+ this._applyDefaultForCheckboxToText();
13628
+ break;
13629
+ case this.modes.CheckboxToBinary:
13630
+ this._applyDefaultForCheckboxToBinary();
13631
+ break;
13632
+ case this.modes.DateField:
13633
+ this._applyDefaultForDateField();
13634
+ break;
13635
+ case this.modes.DateRangeField:
13636
+ this._applyDefaultForDateRangeField();
13637
+ break;
13638
+ case this.modes.TextField:
13639
+ this._applyDefaultForTextField();
13640
+ break;
13641
+ case this.modes.Checkbox:
13642
+ this._applyDefaultForCheckbox();
13643
+ break;
13644
+ }
13645
+ this._defaultSet = true;
13646
+ };
13427
13647
  return FilterItemComponent;
13428
13648
  }());
13429
13649
  FilterItemComponent.decorators = [