@colijnit/corecomponents_v12 258.1.16 → 258.1.18

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.
@@ -1,7 +1,7 @@
1
1
  import { __awaiter, __decorate } from 'tslib';
2
2
  import * as i0 from '@angular/core';
3
3
  import { Input, Injectable, NgZone, Component, ViewEncapsulation, HostBinding, ComponentFactoryResolver, ApplicationRef, Injector, EventEmitter, Renderer2, ViewChildren, ElementRef, Output, Directive, ChangeDetectorRef, Optional, ViewChild, ViewContainerRef, HostListener, NgModule, SkipSelf, InjectionToken, Inject, forwardRef, ChangeDetectionStrategy, Pipe, ContentChildren, NO_ERRORS_SCHEMA, ContentChild } from '@angular/core';
4
- import { NgModel, FormGroup, FormsModule } from '@angular/forms';
4
+ import { NgModel, FormGroup, FormsModule, ReactiveFormsModule } from '@angular/forms';
5
5
  import { Subject, merge, fromEvent, BehaviorSubject } from 'rxjs';
6
6
  import { DomSanitizer, HammerGestureConfig, HammerModule, HAMMER_GESTURE_CONFIG } from '@angular/platform-browser';
7
7
  import { trigger, state, style, transition, animate, query, animateChild } from '@angular/animations';
@@ -5014,7 +5014,7 @@ GridToolbarComponent.decorators = [
5014
5014
  <co-icon *ngIf="showEdit" [iconData]="iconsService.getIcon(icons.RotateLeftSolid)" [title]="'cancel'" (click)="cancelClick.emit()"></co-icon>
5015
5015
  <co-icon *ngIf="showEdit" [iconData]="iconsService.getIcon(icons.FloppyDiskSolid)" [title]="'save'" (click)="saveClick.emit()"></co-icon>
5016
5016
  <co-icon *ngIf="showAdd || showEdit" [iconData]="iconsService.getIcon(icons.PlusSolid)" [title]="'add'" (click)="addClick.emit()"></co-icon>
5017
- <!-- <co-icon *ngIf="showDelete" [iconData]="iconsService.getIcon(icons.TrashCanSolid)" [title]="'delete'" [class.disabled]="!deleteEnabled" (click)="handleDeleteClick()"></co-icon>-->
5017
+ <co-icon *ngIf="showDelete" [iconData]="iconsService.getIcon(icons.TrashCanSolid)" [title]="'delete'" [class.disabled]="!deleteEnabled" (click)="handleDeleteClick()"></co-icon>
5018
5018
  </div>
5019
5019
  `,
5020
5020
  encapsulation: ViewEncapsulation.None
@@ -5423,6 +5423,17 @@ CalendarComponent.propDecorators = {
5423
5423
  };
5424
5424
 
5425
5425
  class InputDatePickerComponent extends BaseInputDatePickerDirective {
5426
+ constructor(formComponent, changeDetector, overlayService, componentFactoryResolver, formUserChangeListener, ngZoneWrapper, elementRef) {
5427
+ super(changeDetector, componentFactoryResolver, overlayService, formUserChangeListener, ngZoneWrapper, elementRef);
5428
+ this.formComponent = formComponent;
5429
+ this.changeDetector = changeDetector;
5430
+ this.overlayService = overlayService;
5431
+ this.componentFactoryResolver = componentFactoryResolver;
5432
+ this.formUserChangeListener = formUserChangeListener;
5433
+ this.ngZoneWrapper = ngZoneWrapper;
5434
+ this.elementRef = elementRef;
5435
+ super._markAsOnPush();
5436
+ }
5426
5437
  showClass() {
5427
5438
  return true;
5428
5439
  }
@@ -5528,6 +5539,15 @@ InputDatePickerComponent.decorators = [
5528
5539
  encapsulation: ViewEncapsulation.None
5529
5540
  },] }
5530
5541
  ];
5542
+ InputDatePickerComponent.ctorParameters = () => [
5543
+ { type: FormComponent, decorators: [{ type: Optional }] },
5544
+ { type: ChangeDetectorRef },
5545
+ { type: OverlayService },
5546
+ { type: ComponentFactoryResolver },
5547
+ { type: FormInputUserModelChangeListenerService },
5548
+ { type: NgZoneWrapperService },
5549
+ { type: ElementRef }
5550
+ ];
5531
5551
  InputDatePickerComponent.propDecorators = {
5532
5552
  showClass: [{ type: HostBinding, args: ['class.co-input-date',] }]
5533
5553
  };
@@ -6823,7 +6843,8 @@ InputDatePickerModule.decorators = [
6823
6843
  InputTextModule,
6824
6844
  CalendarModule,
6825
6845
  ClickoutsideModule,
6826
- OverlayModule
6846
+ OverlayModule,
6847
+ ReactiveFormsModule
6827
6848
  ],
6828
6849
  schemas: [
6829
6850
  NO_ERRORS_SCHEMA
@@ -9620,6 +9641,7 @@ class SimpleGridComponent extends BaseSimpleGridComponent {
9620
9641
  this.showGridSettings = false;
9621
9642
  this.rowsPerPage = 50;
9622
9643
  this.showColumnSort = false;
9644
+ this.showRowButtons = false;
9623
9645
  this.editing = false;
9624
9646
  this.isSettingsMenuOpen = false;
9625
9647
  this.editRowIndex = -1;
@@ -9698,26 +9720,37 @@ class SimpleGridComponent extends BaseSimpleGridComponent {
9698
9720
  return __awaiter(this, void 0, void 0, function* () {
9699
9721
  if (this.inlineEdit) {
9700
9722
  const valid = this.validateAndSave();
9701
- // this._detectChanges();
9702
9723
  if (valid) {
9703
- this.data.push({});
9724
+ this._newRowReference = {};
9725
+ this.data.push(this._newRowReference);
9704
9726
  this._detectChanges();
9705
9727
  this._newRow = true;
9706
9728
  this.editing = true;
9707
9729
  if (this.rowsPerPage && this.data.length > this.rowsPerPage) {
9708
- // navigate to the last page to the new row
9730
+ // navigate to last page
9709
9731
  this.currentPage = Math.ceil(this.data.length / this.rowsPerPage);
9710
- // select new row
9711
- const absoluteIndex = this.data.length - 1;
9712
- this.selectedRowIndex = this.rowsPerPage ? (absoluteIndex - ((this.currentPage - 1) * this.rowsPerPage)) : absoluteIndex;
9713
- this.editRow(null);
9732
+ const relativeIndex = (this.data.length - 1) % this.rowsPerPage;
9733
+ this.selectedRowIndex = relativeIndex;
9734
+ this.editRowIndex = relativeIndex;
9735
+ // store reference
9736
+ this.rowToEdit = this._newRowReference;
9737
+ this.editCellIndex = yield this._nextAvailableCellToEdit(true);
9738
+ setTimeout(() => {
9739
+ var _a, _b;
9740
+ const el = (_b = (_a = this.rowElements) === null || _a === void 0 ? void 0 : _a.last) === null || _b === void 0 ? void 0 : _b.nativeElement;
9741
+ if (el) {
9742
+ el.scrollIntoView({ behavior: 'smooth', block: 'center' });
9743
+ }
9744
+ }, 200);
9745
+ // reset reference to the new row after editCellIndex
9746
+ this.rowToEdit = this._newRowReference;
9714
9747
  }
9715
9748
  else {
9716
9749
  this.editRowIndex = this.data.length - 1;
9717
- this.rowToEdit = this.data[this.editRowIndex];
9750
+ this.rowToEdit = this._newRowReference;
9718
9751
  this.editCellIndex = yield this._nextAvailableCellToEdit(true);
9719
- this._detectChanges();
9720
9752
  }
9753
+ this._detectChanges();
9721
9754
  }
9722
9755
  }
9723
9756
  else {
@@ -9751,22 +9784,41 @@ class SimpleGridComponent extends BaseSimpleGridComponent {
9751
9784
  this._detectChanges();
9752
9785
  }
9753
9786
  removeRow() {
9754
- this.deleteRow.next(this.data[this.selectedRowIndex]);
9787
+ let absoluteIndex = this.selectedRowIndex;
9788
+ if (this.rowsPerPage) {
9789
+ absoluteIndex = (this.currentPage - 1) * this.rowsPerPage + this.selectedRowIndex;
9790
+ }
9791
+ this.deleteRow.next(this.data[absoluteIndex]);
9792
+ if (this.currentPage !== 1) {
9793
+ this.currentPage = 1;
9794
+ this.selectedRowIndex = -1;
9795
+ window.scrollTo({ top: 0, behavior: 'smooth' });
9796
+ }
9797
+ this._detectChanges();
9755
9798
  }
9756
- handleClickRow(event, index, row) {
9757
- setTimeout(() => {
9758
- if (this._doubleClicked) {
9759
- return;
9760
- }
9761
- this.selectTheRow(index);
9762
- }, 200);
9799
+ handleClickRow(event, index) {
9800
+ if (this.inlineEdit && this.showRowButtons && !this.editing) {
9801
+ this.editing = false;
9802
+ }
9803
+ else {
9804
+ setTimeout(() => {
9805
+ if (this._doubleClicked) {
9806
+ return;
9807
+ }
9808
+ this.selectTheRow(index);
9809
+ if (this.inlineEdit && !this.showRowButtons) {
9810
+ this.editRow(event, true, index);
9811
+ }
9812
+ }, 200);
9813
+ }
9763
9814
  }
9764
9815
  selectTheRow(index, emit = true) {
9765
9816
  if (this.selectedRowIndex === -1 || (this.selectedRowIndex !== index && ((this.editing && this.validateAndSave()) || !this.editing))) {
9766
9817
  this.selectedRowIndex = index;
9767
9818
  }
9819
+ const absoluteIndex = this.rowsPerPage ? (this.currentPage - 1) * this.rowsPerPage + index : index;
9768
9820
  if (emit) {
9769
- this.selectRow.next(this.data[this.selectedRowIndex]);
9821
+ this.selectRow.next(this.data[absoluteIndex]);
9770
9822
  }
9771
9823
  this._detectChanges();
9772
9824
  }
@@ -9784,7 +9836,7 @@ class SimpleGridComponent extends BaseSimpleGridComponent {
9784
9836
  this._doubleClicked = true;
9785
9837
  this.dblClickRow.next(this.data[index]);
9786
9838
  this.selectTheRow(index, false);
9787
- if (this.inlineEdit) {
9839
+ if (this.inlineEdit && !this.showRowButtons) {
9788
9840
  this.editRow(event);
9789
9841
  }
9790
9842
  }
@@ -9794,12 +9846,12 @@ class SimpleGridComponent extends BaseSimpleGridComponent {
9794
9846
  editRow(event, selectCell = true, rowIndex) {
9795
9847
  return __awaiter(this, void 0, void 0, function* () {
9796
9848
  if (rowIndex !== undefined) {
9797
- this.selectTheRow(rowIndex, false);
9849
+ this.selectTheRow(rowIndex);
9798
9850
  }
9851
+ this.editing = true;
9799
9852
  this.editRowIndex = this.selectedRowIndex;
9800
9853
  this.rowToEdit = this.data[this.editRowIndex];
9801
- this.editing = true;
9802
- if (selectCell) {
9854
+ if (this.showRowButtons && this.inlineEdit && selectCell) {
9803
9855
  this.editCellIndex = yield this._nextAvailableCellToEdit(true);
9804
9856
  }
9805
9857
  this._detectChanges();
@@ -9812,12 +9864,10 @@ class SimpleGridComponent extends BaseSimpleGridComponent {
9812
9864
  this.selectedRowIndex = -1;
9813
9865
  return;
9814
9866
  }
9815
- this.selectTheRow(rowIndex, false);
9816
9867
  if (this.inlineEdit) {
9817
9868
  this.editRowIndex = rowIndex;
9818
9869
  this.editCellIndex = cellIndex;
9819
9870
  this.editing = true;
9820
- this.editRow(event, false);
9821
9871
  }
9822
9872
  }
9823
9873
  else {
@@ -10065,9 +10115,26 @@ class SimpleGridComponent extends BaseSimpleGridComponent {
10065
10115
  });
10066
10116
  }
10067
10117
  _saveRow(stopediting = true) {
10068
- // emit saveEvent
10069
- if (this.rowToEdit) {
10070
- this.saveRow.next(this.rowToEdit);
10118
+ if (this._newRow) {
10119
+ this.saveRow.next(this._newRowReference);
10120
+ this._newRowReference = null; // clear
10121
+ }
10122
+ else {
10123
+ let index = -1; // existing row
10124
+ if (this.rowsPerPage) {
10125
+ index = (this.currentPage - 1) * this.rowsPerPage + this.editRowIndex;
10126
+ }
10127
+ else {
10128
+ index = this.editRowIndex;
10129
+ }
10130
+ if (index >= 0 && index < this.data.length) {
10131
+ this.saveRow.next(this.data[index]);
10132
+ }
10133
+ }
10134
+ if (this.currentPage !== 1) {
10135
+ this.currentPage = 1;
10136
+ this.selectedRowIndex = -1;
10137
+ window.scrollTo({ top: 0, behavior: 'smooth' });
10071
10138
  }
10072
10139
  this._newRow = false;
10073
10140
  if (stopediting) {
@@ -10103,175 +10170,176 @@ SimpleGridComponent.decorators = [
10103
10170
  { type: Component, args: [{
10104
10171
  selector: 'co-simple-grid',
10105
10172
  template: `
10106
- <co-grid-toolbar
10107
- *ngIf="showToolbar" [class.right]="rightToolbar"
10108
- [showEdit]="showEdit"
10109
- [showAdd]="showAdd"
10110
- [showDelete]="showDelete"
10111
- [deleteEnabled]="selectedRowIndex > -1"
10112
- (addClick)="addNewRow()"
10113
- (editClick)="editRow($event)"
10114
- (saveClick)="validateAndSave()"
10115
- (cancelClick)="cancelEditRow()"
10116
- (deleteClick)="removeRow()">
10117
- </co-grid-toolbar>
10173
+ <co-grid-toolbar
10174
+ *ngIf="showToolbar" [class.right]="rightToolbar"
10175
+ [showEdit]="showEdit"
10176
+ [showAdd]="showAdd"
10177
+ [showDelete]="showDelete"
10178
+ [deleteEnabled]="selectedRowIndex > -1"
10179
+ (addClick)="addNewRow()"
10180
+ (editClick)="editRow($event)"
10181
+ (saveClick)="validateAndSave()"
10182
+ (cancelClick)="cancelEditRow()"
10183
+ (deleteClick)="removeRow()">
10184
+ </co-grid-toolbar>
10118
10185
 
10119
- <table
10120
- id="simple-grid-table"
10121
- class="simple-grid-table"
10122
- [clickOutside]="editing"
10123
- (clickOutside)="handleClickOutsideRow()">
10124
- <colgroup>
10125
- <col
10126
- *ngFor="let column of headerColumnsCopy; let index = index"
10127
- [class.simple-grid-column-auto-fit]="column.autoFit"
10128
- [style.width.px]="column.width"
10129
- [style.min-width.px]="MIN_COLUMN_WIDTH">
10130
- </colgroup>
10131
- <thead>
10132
- <tr>
10133
- <th
10134
- scope="col"
10135
- #headerCell
10136
- class="simple-grid-column-header"
10137
- *ngFor="let column of headerColumnsCopy; let index = index">
10138
- <div
10139
- class="simple-grid-column-header-wrapper"
10140
- [class.resizable]="resizable"
10141
- [class.selected]="column.isSelected"
10142
- [ngClass]="column.textAlign ? column.textAlign : defaultTextAlign">
10143
- <ng-container *ngIf="column.headerTemplate; else noHeaderTemplate">
10144
- <ng-container [ngTemplateOutlet]="column.headerTemplate"></ng-container>
10145
- </ng-container>
10146
- <ng-template #noHeaderTemplate>
10147
- <div
10148
- class="simple-grid-column-header-label"
10149
- [ngClass]="column.textAlign ? column.textAlign : defaultTextAlign"
10150
- [class.with-menu]="showGridSettings"
10151
- [class.with-sort]="showColumnSort"
10152
- [textContent]="column.headerText || '&nbsp;'"
10153
- (click)="showColumnSort ? sortColumn(column, column.field) : toggleColumnMenu(column)">
10154
- </div>
10186
+ <table
10187
+ id="simple-grid-table"
10188
+ class="simple-grid-table"
10189
+ [clickOutside]="editing"
10190
+ (clickOutside)="handleClickOutsideRow()">
10191
+ <colgroup>
10192
+ <col
10193
+ *ngFor="let column of headerColumnsCopy; let index = index"
10194
+ [class.simple-grid-column-auto-fit]="column.autoFit"
10195
+ [style.width.px]="column.width"
10196
+ [style.min-width.px]="MIN_COLUMN_WIDTH">
10197
+ </colgroup>
10198
+ <thead>
10199
+ <tr>
10200
+ <th
10201
+ scope="col"
10202
+ #headerCell
10203
+ class="simple-grid-column-header"
10204
+ *ngFor="let column of headerColumnsCopy; let index = index">
10205
+ <div
10206
+ class="simple-grid-column-header-wrapper"
10207
+ [class.resizable]="resizable"
10208
+ [class.selected]="column.isSelected"
10209
+ [ngClass]="column.textAlign ? column.textAlign : defaultTextAlign">
10210
+ <ng-container *ngIf="column.headerTemplate; else noHeaderTemplate">
10211
+ <ng-container [ngTemplateOutlet]="column.headerTemplate"></ng-container>
10212
+ </ng-container>
10213
+ <ng-template #noHeaderTemplate>
10214
+ <div
10215
+ class="simple-grid-column-header-label"
10216
+ [ngClass]="column.textAlign ? column.textAlign : defaultTextAlign"
10217
+ [class.with-menu]="showGridSettings"
10218
+ [class.with-sort]="showColumnSort"
10219
+ [textContent]="column.headerText || '&nbsp;'"
10220
+ (click)="showColumnSort ? sortColumn(column, column.field) : toggleColumnMenu(column)">
10221
+ </div>
10155
10222
 
10156
- <div class="sort-column" *ngIf="showColumnSort">
10157
- <co-button
10158
- (click)="sortColumn(column, column?.field)"
10159
- [iconData]="icons.getIcon(Icons.ArrowUpArrowDown)">
10160
- </co-button>
10161
- </div>
10223
+ <div class="sort-column" *ngIf="showColumnSort">
10224
+ <co-button
10225
+ (click)="sortColumn(column, column?.field)"
10226
+ [iconData]="icons.getIcon(Icons.ArrowUpArrowDown)">
10227
+ </co-button>
10228
+ </div>
10162
10229
 
10163
- <div class="column-menu" *ngIf="column.isSelected">
10164
- <h3 [textContent]="'COLUMN_OPTIONS' | coreLocalize"></h3>
10165
- <ul>
10166
- <li (click)="hideColumn(column)">Hide Column</li>
10167
- <li (click)="sortColumn(column, column.field)">Sort Column</li>
10168
- </ul>
10169
- </div>
10170
- </ng-template>
10171
- <div
10172
- *ngIf="resizable && column.resizable"
10173
- class="simple-grid-column-sizer"
10174
- (mousedown)="handleSizerMouseDown($event, column)">
10175
- </div>
10176
- </div>
10177
- </th>
10178
- </tr>
10230
+ <div class="column-menu" *ngIf="column.isSelected">
10231
+ <h3 [textContent]="'COLUMN_OPTIONS' | coreLocalize"></h3>
10232
+ <ul>
10233
+ <li (click)="hideColumn(column)">Hide Column</li>
10234
+ <li (click)="sortColumn(column, column.field)">Sort Column</li>
10235
+ </ul>
10236
+ </div>
10237
+ </ng-template>
10238
+ <div
10239
+ *ngIf="resizable && column.resizable"
10240
+ class="simple-grid-column-sizer"
10241
+ (mousedown)="handleSizerMouseDown($event, column)">
10242
+ </div>
10243
+ </div>
10244
+ </th>
10245
+ </tr>
10179
10246
 
10180
- <div *ngIf="showGridSettings" class="grid-settings">
10181
- <co-button
10182
- [class.selected]="isSettingsMenuOpen"
10183
- [iconData]="icons.getIcon(Icons.CogWheels)"
10184
- (click)="toggleSettingsMenu()">
10185
- </co-button>
10247
+ <div *ngIf="showGridSettings" class="grid-settings">
10248
+ <co-button
10249
+ [class.selected]="isSettingsMenuOpen"
10250
+ [iconData]="icons.getIcon(Icons.CogWheels)"
10251
+ (click)="toggleSettingsMenu()">
10252
+ </co-button>
10186
10253
 
10187
- <div class="settings-menu" *ngIf="isSettingsMenuOpen">
10188
- <h3 [textContent]="'GRID_OPTIONS' | coreLocalize"></h3>
10189
- <ul>
10190
- <li (click)="exportToExcel()">Export to Excel</li>
10191
- <li *ngIf="headerColumnsCopy.length !== headerColumns.length" (click)="showAllColumns()">
10192
- Show All Columns
10193
- </li>
10194
- </ul>
10254
+ <div class="settings-menu" *ngIf="isSettingsMenuOpen">
10255
+ <h3 [textContent]="'GRID_OPTIONS' | coreLocalize"></h3>
10256
+ <ul>
10257
+ <li (click)="exportToExcel()">Export to Excel</li>
10258
+ <li *ngIf="headerColumnsCopy.length !== headerColumns.length" (click)="showAllColumns()">
10259
+ Show All Columns
10260
+ </li>
10261
+ </ul>
10262
+ </div>
10263
+ </div>
10264
+ </thead>
10265
+ <tbody
10266
+ #dropList cdkDropList cdkDropListOrientation="vertical"
10267
+ class="simple-grid-drag-drop-list"
10268
+ [cdkDropListDisabled]="!dragDropEnabled || editing"
10269
+ [cdkDropListData]="data"
10270
+ [cdkDropListEnterPredicate]="handleCanDragDrop"
10271
+ (cdkDropListDropped)="handleDrop($event)">
10272
+ <co-form class="simple-grid-row-form">
10273
+ <tr
10274
+ #rowElement
10275
+ class="simple-grid-row"
10276
+ [class.selected]="rowIndex === selectedRowIndex && !editing" observeVisibility
10277
+ [class.disabled]="getIsRowDisabled(rowIndex)"
10278
+ [class.editing]="rowIndex === editRowIndex"
10279
+ *ngFor="let row of (!!rowsPerPage ? (data | paginate: {itemsPerPage: rowsPerPage, currentPage: currentPage}) : data); last as last; let rowIndex = index"
10280
+ cdkDrag
10281
+ (click)="handleClickRow($event, rowIndex)" (dblclick)="handleDblClickRow($event, rowIndex, row)"
10282
+ (visibilityChange)="rowVisible.next(row)"
10283
+ (mouseenter)="hoveredRowIndex = rowIndex"
10284
+ (mouseleave)="hoveredRowIndex = -1"
10285
+ >
10286
+ <ng-container *ngIf="isSingleColumnRow(row)">
10287
+ <td class="simple-grid-single-column-cell" [attr.colspan]="headerColumnsCopy.length">
10288
+ <co-simple-grid-cell
10289
+ [column]="columns[singleColumnIndex(row)]"
10290
+ [row]="row"
10291
+ [editMode]="false">
10292
+ </co-simple-grid-cell>
10293
+ </td>
10294
+ </ng-container>
10295
+ <ng-container *ngIf="!isSingleColumnRow(row)">
10296
+ <ng-container *ngFor="let column of headerColumnsCopy; let columnIndex = index">
10297
+ <td class="simple-grid-column-cell" *ngIf="columnIndex !== singleColumnIndex(row)">
10298
+ <co-simple-grid-cell
10299
+ [column]="column"
10300
+ [row]="row"
10301
+ [editMode]="inlineEdit && editing && rowIndex === editRowIndex"
10302
+ [fieldEditMode]="editCellIndex === columnIndex && rowIndex === editRowIndex"
10303
+ (cellClick)="handleCellClick($event, row, rowIndex, columnIndex)">
10304
+ </co-simple-grid-cell>
10305
+ <div *ngIf="column.resizable" class="simple-grid-column-sizer-placeholder"></div>
10306
+ </td>
10307
+ </ng-container>
10308
+ <ng-container *ngIf="inlineEdit && showRowButtons">
10309
+ <div class="icons-container" *ngIf="!editing">
10310
+ <co-icon class="icon-item icon-edit"
10311
+ [iconData]="icons.getIcon(Icons.PenToSquareSolid)" *ngIf="hoveredRowIndex === rowIndex"
10312
+ (click)="editRow($event, true, rowIndex); $event.stopPropagation()"></co-icon>
10313
+ <co-icon class="icon-item icon-delete"
10314
+ [iconData]="icons.getIcon(Icons.TrashBin)" *ngIf="hoveredRowIndex === rowIndex"
10315
+ (click)="selectTheRow(rowIndex); removeRow();"></co-icon>
10195
10316
  </div>
10196
- </div>
10197
- </thead>
10198
- <tbody
10199
- #dropList cdkDropList cdkDropListOrientation="vertical"
10200
- class="simple-grid-drag-drop-list"
10201
- [cdkDropListDisabled]="!dragDropEnabled || editing"
10202
- [cdkDropListData]="data"
10203
- [cdkDropListEnterPredicate]="handleCanDragDrop"
10204
- (cdkDropListDropped)="handleDrop($event)">
10205
- <co-form class="simple-grid-row-form">
10206
- <tr
10207
- class="simple-grid-row"
10208
- [class.selected]="rowIndex === selectedRowIndex && !editing" observeVisibility
10209
- [class.disabled]="getIsRowDisabled(rowIndex)"
10210
- [class.editing]="rowIndex === editRowIndex"
10211
- *ngFor="let row of (!!rowsPerPage ? (data | paginate: {itemsPerPage: rowsPerPage, currentPage: currentPage}) : data); last as last; let rowIndex = index"
10212
- cdkDrag
10213
- (click)="handleClickRow($event, rowIndex, row)" (dblclick)="handleDblClickRow($event, rowIndex, row)"
10214
- (visibilityChange)="rowVisible.next(row)"
10215
- (mouseenter)="hoveredRowIndex = rowIndex"
10216
- (mouseleave)="hoveredRowIndex = -1"
10217
- >
10218
- <ng-container *ngIf="isSingleColumnRow(row)">
10219
- <td class="simple-grid-single-column-cell" [attr.colspan]="headerColumnsCopy.length">
10220
- <co-simple-grid-cell
10221
- [column]="columns[singleColumnIndex(row)]"
10222
- [row]="row"
10223
- [editMode]="false">
10224
- </co-simple-grid-cell>
10225
- </td>
10226
- </ng-container>
10227
- <ng-container *ngIf="!isSingleColumnRow(row)">
10228
- <ng-container *ngFor="let column of headerColumnsCopy; let columnIndex = index">
10229
- <td class="simple-grid-column-cell" *ngIf="columnIndex !== singleColumnIndex(row)">
10230
- <co-simple-grid-cell
10231
- [column]="column"
10232
- [row]="row"
10233
- [editMode]="inlineEdit && editing && rowIndex === editRowIndex"
10234
- [fieldEditMode]="editCellIndex === columnIndex && rowIndex === editRowIndex"
10235
- (cellClick)="handleCellClick($event, row, rowIndex, columnIndex)">
10236
- </co-simple-grid-cell>
10237
- <div *ngIf="column.resizable" class="simple-grid-column-sizer-placeholder"></div>
10238
- </td>
10239
- </ng-container>
10240
- <ng-container *ngIf="inlineEdit">
10241
- <div class="icons-container" *ngIf="!editing">
10242
- <co-icon class="icon-item icon-edit"
10243
- [iconData]="icons.getIcon(Icons.PenToSquareSolid)" *ngIf="hoveredRowIndex === rowIndex"
10244
- (click)="editRow($event, true, rowIndex); $event.stopPropagation()"></co-icon>
10245
- <co-icon class="icon-item icon-delete"
10246
- [iconData]="icons.getIcon(Icons.TrashBin)" *ngIf="hoveredRowIndex === rowIndex"
10247
- (click)="removeRow()"></co-icon>
10248
- </div>
10249
- <div class="icons-container">
10250
- <co-button class="save-button"
10251
- *ngIf="editing && (selectedRowIndex === rowIndex || (isNewRow && rowIndex === editRowIndex))"
10252
- [iconData]="icons.getIcon(Icons.CheckDuotone)"
10253
- (click)="validateAndSave(); $event.stopPropagation()"></co-button>
10254
- <co-button class="close-button"
10255
- *ngIf="editing && (selectedRowIndex === rowIndex || (isNewRow && rowIndex === editRowIndex))"
10256
- [iconData]="icons.getIcon(Icons.CrossSkinny)"
10257
- (click)="cancelEditRow(); $event.stopPropagation() "></co-button>
10258
- </div>
10259
- </ng-container>
10260
- </ng-container>
10261
- </tr>
10262
- </co-form>
10263
- </tbody>
10264
- </table>
10265
- <co-pagination-bar
10266
- *ngIf="data?.length > rowsPerPage" class="pagination-bar"
10267
- [itemsPerPage]="rowsPerPage"
10268
- [currentPage]="currentPage"
10269
- [totalItems]="data.length"
10270
- [autoHide]="true"
10271
- (previousClick)="goToPreviousPage()"
10272
- (nextClick)="goToNextPage()"
10273
- (pageClick)="setCurrentPage($event)">
10274
- </co-pagination-bar>
10317
+ <div class="icons-container">
10318
+ <co-button class="save-button"
10319
+ *ngIf="editing && (selectedRowIndex === rowIndex || (isNewRow && rowIndex === editRowIndex))"
10320
+ [iconData]="icons.getIcon(Icons.CheckDuotone)"
10321
+ (click)="validateAndSave(); $event.stopPropagation()"></co-button>
10322
+ <co-button class="close-button"
10323
+ *ngIf="editing && (selectedRowIndex === rowIndex || (isNewRow && rowIndex === editRowIndex))"
10324
+ [iconData]="icons.getIcon(Icons.CrossSkinny)"
10325
+ (click)="cancelEditRow(); $event.stopPropagation() "></co-button>
10326
+ </div>
10327
+ </ng-container>
10328
+ </ng-container>
10329
+ </tr>
10330
+ </co-form>
10331
+ </tbody>
10332
+ </table>
10333
+ <co-pagination-bar
10334
+ *ngIf="data?.length > rowsPerPage" class="pagination-bar"
10335
+ [itemsPerPage]="rowsPerPage"
10336
+ [currentPage]="currentPage"
10337
+ [totalItems]="data.length"
10338
+ [autoHide]="true"
10339
+ (previousClick)="goToPreviousPage()"
10340
+ (nextClick)="goToNextPage()"
10341
+ (pageClick)="setCurrentPage($event)">
10342
+ </co-pagination-bar>
10275
10343
  `,
10276
10344
  providers: [FormMasterService],
10277
10345
  changeDetection: ChangeDetectionStrategy.OnPush,
@@ -10286,6 +10354,7 @@ SimpleGridComponent.ctorParameters = () => [
10286
10354
  ];
10287
10355
  SimpleGridComponent.propDecorators = {
10288
10356
  headerCells: [{ type: ViewChildren, args: ['headerCell',] }],
10357
+ rowElements: [{ type: ViewChildren, args: ['rowElement',] }],
10289
10358
  showAdd: [{ type: Input }],
10290
10359
  showDelete: [{ type: Input }],
10291
10360
  editOnCellClick: [{ type: Input }],
@@ -10294,6 +10363,7 @@ SimpleGridComponent.propDecorators = {
10294
10363
  rowsPerPage: [{ type: Input }],
10295
10364
  rowDisabledFn: [{ type: Input }],
10296
10365
  showColumnSort: [{ type: Input }],
10366
+ showRowButtons: [{ type: Input }],
10297
10367
  canRowBeEdittedFn: [{ type: Input }],
10298
10368
  showClass: [{ type: HostBinding, args: ['class.co-simple-grid',] }],
10299
10369
  handleKeyDown: [{ type: HostListener, args: ['keydown', ['$event'],] }]
@@ -11396,8 +11466,15 @@ ListOfValuesPopupComponent.propDecorators = {
11396
11466
  };
11397
11467
 
11398
11468
  class ListOfValuesComponent extends BaseInputComponent {
11399
- constructor() {
11400
- super(...arguments);
11469
+ constructor(formComponent, changeDetector, overlayService, componentFactoryResolver, formUserChangeListener, ngZoneWrapper, elementRef) {
11470
+ super(changeDetector, componentFactoryResolver, overlayService, formUserChangeListener, ngZoneWrapper, elementRef);
11471
+ this.formComponent = formComponent;
11472
+ this.changeDetector = changeDetector;
11473
+ this.overlayService = overlayService;
11474
+ this.componentFactoryResolver = componentFactoryResolver;
11475
+ this.formUserChangeListener = formUserChangeListener;
11476
+ this.ngZoneWrapper = ngZoneWrapper;
11477
+ this.elementRef = elementRef;
11401
11478
  this.icons = CoreComponentsIcon;
11402
11479
  this.multiselect = false;
11403
11480
  this.largeCollection = false;
@@ -11411,6 +11488,7 @@ class ListOfValuesComponent extends BaseInputComponent {
11411
11488
  this.filteredCollection = [];
11412
11489
  this.isLoading = false;
11413
11490
  this._collection = [];
11491
+ super._markAsOnPush();
11414
11492
  }
11415
11493
  set model(value) {
11416
11494
  super.model = value;
@@ -11555,7 +11633,7 @@ class ListOfValuesComponent extends BaseInputComponent {
11555
11633
  }
11556
11634
  }
11557
11635
  }
11558
- this.model = option;
11636
+ this.setModel(option);
11559
11637
  this.modelChange.emit(this.model);
11560
11638
  this.detectChanges();
11561
11639
  }
@@ -11620,6 +11698,7 @@ ListOfValuesComponent.decorators = [
11620
11698
  [id]="label"
11621
11699
  [model]="multiselect ? selectedModels : selectedModel"
11622
11700
  [placeholder]="label"
11701
+ [myFormInputInstance]="this"
11623
11702
  [readonly]="readonly"
11624
11703
  [disabled]="disabled"
11625
11704
  [required]="required"
@@ -11645,7 +11724,7 @@ ListOfValuesComponent.decorators = [
11645
11724
  </div>
11646
11725
  </ng-container>
11647
11726
  </co-input-text>
11648
-
11727
+
11649
11728
  <co-input-text
11650
11729
  *ngIf="largeCollection"
11651
11730
  [model]="filterText"
@@ -11656,6 +11735,7 @@ ListOfValuesComponent.decorators = [
11656
11735
  (modelChange)="onModelChange($event)">
11657
11736
  </co-input-text>
11658
11737
  <div *ngIf="isLoading" class="filter-loader"><span></span></div>
11738
+ <input type="hidden" [ngModel]="model">
11659
11739
  `,
11660
11740
  providers: [
11661
11741
  OverlayService,
@@ -11667,6 +11747,15 @@ ListOfValuesComponent.decorators = [
11667
11747
  encapsulation: ViewEncapsulation.None
11668
11748
  },] }
11669
11749
  ];
11750
+ ListOfValuesComponent.ctorParameters = () => [
11751
+ { type: FormComponent, decorators: [{ type: Optional }] },
11752
+ { type: ChangeDetectorRef },
11753
+ { type: OverlayService },
11754
+ { type: ComponentFactoryResolver },
11755
+ { type: FormInputUserModelChangeListenerService },
11756
+ { type: NgZoneWrapperService },
11757
+ { type: ElementRef }
11758
+ ];
11670
11759
  ListOfValuesComponent.propDecorators = {
11671
11760
  model: [{ type: Input }],
11672
11761
  parentForOverlay: [{ type: ViewChild, args: ['parentForOverlay', { read: ElementRef },] }],