@colijnit/corecomponents_v12 259.1.0 → 259.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.
@@ -13,6 +13,7 @@ import { CSS3DObject, CSS3DRenderer } from 'three/examples/jsm/renderers/CSS3DRe
13
13
  import * as TWEEN from '@tweenjs/tween.js';
14
14
  import 'hammerjs';
15
15
  import { DragDropModule, moveItemInArray } from '@angular/cdk/drag-drop';
16
+ import { CoDocument } from '@colijnit/mainapi/build/model/co-document.bo';
16
17
  import * as i1 from '@angular/cdk/overlay';
17
18
  import { OverlayConfig, Overlay } from '@angular/cdk/overlay';
18
19
  import { ComponentPortal } from '@angular/cdk/portal';
@@ -5014,7 +5015,7 @@ GridToolbarComponent.decorators = [
5014
5015
  <co-icon *ngIf="showEdit" [iconData]="iconsService.getIcon(icons.RotateLeftSolid)" [title]="'cancel'" (click)="cancelClick.emit()"></co-icon>
5015
5016
  <co-icon *ngIf="showEdit" [iconData]="iconsService.getIcon(icons.FloppyDiskSolid)" [title]="'save'" (click)="saveClick.emit()"></co-icon>
5016
5017
  <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>-->
5018
+ <co-icon *ngIf="showDelete" [iconData]="iconsService.getIcon(icons.TrashCanSolid)" [title]="'delete'" [class.disabled]="!deleteEnabled" (click)="handleDeleteClick()"></co-icon>
5018
5019
  </div>
5019
5020
  `,
5020
5021
  encapsulation: ViewEncapsulation.None
@@ -8093,146 +8094,6 @@ var FileTypeInternal;
8093
8094
  FileTypeInternal[FileTypeInternal["Undefined"] = 8] = "Undefined";
8094
8095
  })(FileTypeInternal || (FileTypeInternal = {}));
8095
8096
 
8096
- // DOM_BESTANDSSOORT
8097
- var FileType;
8098
- (function (FileType) {
8099
- // DOC: Document
8100
- FileType["Document"] = "DOC";
8101
- // IMG: Afbeelding
8102
- FileType["Image"] = "IMG";
8103
- // SDWEB: Digitale handtekening
8104
- FileType["DigitalSignature"] = "SDWEB";
8105
- })(FileType || (FileType = {}));
8106
-
8107
- var CoDocumentImageDisplayKind;
8108
- (function (CoDocumentImageDisplayKind) {
8109
- CoDocumentImageDisplayKind["NormalImage"] = "N";
8110
- CoDocumentImageDisplayKind["LayeredImage"] = "L";
8111
- CoDocumentImageDisplayKind["Avatar"] = "A";
8112
- })(CoDocumentImageDisplayKind || (CoDocumentImageDisplayKind = {}));
8113
-
8114
- var ObjectRightType;
8115
- (function (ObjectRightType) {
8116
- ObjectRightType[ObjectRightType["NoAccess"] = 0] = "NoAccess";
8117
- ObjectRightType[ObjectRightType["ReadOnly"] = 1] = "ReadOnly";
8118
- ObjectRightType[ObjectRightType["ReadWrite"] = 2] = "ReadWrite";
8119
- })(ObjectRightType || (ObjectRightType = {}));
8120
-
8121
- // See DocumentDTO.
8122
- class CoDocument {
8123
- constructor() {
8124
- // @ComplexArray(CoDocumentRight)
8125
- this.rights = [];
8126
- this.retailFormulas = [];
8127
- //
8128
- // @NoDbField()
8129
- // @ComplexField(Subject)
8130
- this.documentBodyChange = new Subject();
8131
- }
8132
- set documentId(value) {
8133
- this._documentId = value;
8134
- // this._idObject.docId = value;
8135
- }
8136
- get documentId() {
8137
- return this._documentId;
8138
- }
8139
- set documentBody(documentBody) {
8140
- const prev = this._documentBody;
8141
- this._documentBody = documentBody;
8142
- if (prev !== this._documentBody) {
8143
- this.documentBodyChange.next(this._documentBody);
8144
- }
8145
- }
8146
- get documentBody() {
8147
- return this._documentBody;
8148
- }
8149
- // @NoDbField()
8150
- // public idForLink: number;
8151
- // The internal file type of this document (the MimeType iOneJS uses internally)
8152
- get fileTypeInternal() {
8153
- if (!this._fileTypeInternal) {
8154
- const fileType = FileUtils.FileNameToFileTypeInternal(this.fileName);
8155
- if (fileType) {
8156
- this._fileTypeInternal = fileType;
8157
- }
8158
- }
8159
- return this._fileTypeInternal;
8160
- }
8161
- /**
8162
- * The mimetype of this document: uses database-fetched this.mimeType, or calculates / guesses the mime type of the document
8163
- * if that was not set.
8164
- */
8165
- get mimeTypeInternal() {
8166
- if (this._mimeTypeInternal) {
8167
- return this._mimeTypeInternal;
8168
- }
8169
- else {
8170
- this._initMimetypeInternal();
8171
- return this._mimeTypeInternal;
8172
- }
8173
- }
8174
- set mimeTypeInternal(value) {
8175
- this._mimeTypeInternal = value;
8176
- }
8177
- // Gives either the document-(prio) or the thumbnail body. Or undefined if not exist.
8178
- get bodyAsDataUri() {
8179
- if (this._documentBody) {
8180
- return this.documentBodyAsDataUri;
8181
- }
8182
- else if (this.thumbnailBody) {
8183
- return this.thumbnailBodyAsDataUri;
8184
- }
8185
- }
8186
- // The body of this document as a data uri. The data uri also contains the mimetype in its string, and the fact that it's base64.
8187
- get documentBodyAsDataUri() {
8188
- try {
8189
- return FileUtils.DocumentBodyToDataUri(this.documentBody, this.mimeTypeInternal);
8190
- }
8191
- catch (error) {
8192
- return "";
8193
- }
8194
- }
8195
- // The Thumbnailbody of this document as a data uri. The data uri also contains the mimetype in its string, and the fact that it's base64.
8196
- get thumbnailBodyAsDataUri() {
8197
- try {
8198
- return FileUtils.DocumentBodyToDataUri(this.thumbnailBody, this.mimeTypeInternal);
8199
- }
8200
- catch (error) {
8201
- return "";
8202
- }
8203
- }
8204
- get isAvatar() {
8205
- return this.imageDisplayKind === CoDocumentImageDisplayKind.Avatar;
8206
- }
8207
- //
8208
- // @NoDbField()
8209
- // private _idObject: any = {};
8210
- get readonly() {
8211
- return this.rightLevel === ObjectRightType.ReadOnly;
8212
- }
8213
- getId() {
8214
- return this.documentId;
8215
- }
8216
- // Returns whether this is an image document or not.
8217
- isImageDocument() {
8218
- return (this.fileTypeInternal === FileTypeInternal.Image);
8219
- }
8220
- // @BoSerializerStep()
8221
- preventOverridingThumbnailToEmpty() {
8222
- if (!this.thumbnailBody) {
8223
- this.thumbnailBody = this._documentBody;
8224
- }
8225
- }
8226
- // POSTCONDITION: this._mimeTypeInternal contains, to our best abilities, the true mimeType of this document, a-la "image/jpg"
8227
- _initMimetypeInternal() {
8228
- // if no fileType, default to FileType.Image for internal mimetype initialization
8229
- if ((this.fileType === FileType.Image || !this.fileType) && this.fileName) {
8230
- const fileExtension = this.fileName.substr(this.fileName.lastIndexOf(".") + 1);
8231
- this._mimeTypeInternal = "image/" + fileExtension;
8232
- }
8233
- }
8234
- }
8235
-
8236
8097
  // for refcode CV_DOCUMENTATIE.DOC_TYPE
8237
8098
  var CoDocumentType;
8238
8099
  (function (CoDocumentType) {
@@ -8244,6 +8105,17 @@ var CoDocumentType;
8244
8105
  CoDocumentType["SaveAsLinkOnDefaultLocation"] = "LW";
8245
8106
  })(CoDocumentType || (CoDocumentType = {}));
8246
8107
 
8108
+ // DOM_BESTANDSSOORT
8109
+ var FileType;
8110
+ (function (FileType) {
8111
+ // DOC: Document
8112
+ FileType["Document"] = "DOC";
8113
+ // IMG: Afbeelding
8114
+ FileType["Image"] = "IMG";
8115
+ // SDWEB: Digitale handtekening
8116
+ FileType["DigitalSignature"] = "SDWEB";
8117
+ })(FileType || (FileType = {}));
8118
+
8247
8119
  const MaxUploadSize = 3145728; // 3Mb
8248
8120
  // @dynamic
8249
8121
  class FileUtils {
@@ -9620,6 +9492,7 @@ class SimpleGridComponent extends BaseSimpleGridComponent {
9620
9492
  this.showGridSettings = false;
9621
9493
  this.rowsPerPage = 50;
9622
9494
  this.showColumnSort = false;
9495
+ this.showRowButtons = false;
9623
9496
  this.editing = false;
9624
9497
  this.isSettingsMenuOpen = false;
9625
9498
  this.editRowIndex = -1;
@@ -9698,26 +9571,37 @@ class SimpleGridComponent extends BaseSimpleGridComponent {
9698
9571
  return __awaiter(this, void 0, void 0, function* () {
9699
9572
  if (this.inlineEdit) {
9700
9573
  const valid = this.validateAndSave();
9701
- // this._detectChanges();
9702
9574
  if (valid) {
9703
- this.data.push({});
9575
+ this._newRowReference = {};
9576
+ this.data.push(this._newRowReference);
9704
9577
  this._detectChanges();
9705
9578
  this._newRow = true;
9706
9579
  this.editing = true;
9707
9580
  if (this.rowsPerPage && this.data.length > this.rowsPerPage) {
9708
- // navigate to the last page to the new row
9581
+ // navigate to last page
9709
9582
  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);
9583
+ const relativeIndex = (this.data.length - 1) % this.rowsPerPage;
9584
+ this.selectedRowIndex = relativeIndex;
9585
+ this.editRowIndex = relativeIndex;
9586
+ // store reference
9587
+ this.rowToEdit = this._newRowReference;
9588
+ this.editCellIndex = yield this._nextAvailableCellToEdit(true);
9589
+ setTimeout(() => {
9590
+ var _a, _b;
9591
+ const el = (_b = (_a = this.rowElements) === null || _a === void 0 ? void 0 : _a.last) === null || _b === void 0 ? void 0 : _b.nativeElement;
9592
+ if (el) {
9593
+ el.scrollIntoView({ behavior: 'smooth', block: 'center' });
9594
+ }
9595
+ }, 200);
9596
+ // reset reference to the new row after editCellIndex
9597
+ this.rowToEdit = this._newRowReference;
9714
9598
  }
9715
9599
  else {
9716
9600
  this.editRowIndex = this.data.length - 1;
9717
- this.rowToEdit = this.data[this.editRowIndex];
9601
+ this.rowToEdit = this._newRowReference;
9718
9602
  this.editCellIndex = yield this._nextAvailableCellToEdit(true);
9719
- this._detectChanges();
9720
9603
  }
9604
+ this._detectChanges();
9721
9605
  }
9722
9606
  }
9723
9607
  else {
@@ -9751,22 +9635,41 @@ class SimpleGridComponent extends BaseSimpleGridComponent {
9751
9635
  this._detectChanges();
9752
9636
  }
9753
9637
  removeRow() {
9754
- this.deleteRow.next(this.data[this.selectedRowIndex]);
9638
+ let absoluteIndex = this.selectedRowIndex;
9639
+ if (this.rowsPerPage) {
9640
+ absoluteIndex = (this.currentPage - 1) * this.rowsPerPage + this.selectedRowIndex;
9641
+ }
9642
+ this.deleteRow.next(this.data[absoluteIndex]);
9643
+ if (this.currentPage !== 1) {
9644
+ this.currentPage = 1;
9645
+ this.selectedRowIndex = -1;
9646
+ window.scrollTo({ top: 0, behavior: 'smooth' });
9647
+ }
9648
+ this._detectChanges();
9755
9649
  }
9756
- handleClickRow(event, index, row) {
9757
- setTimeout(() => {
9758
- if (this._doubleClicked) {
9759
- return;
9760
- }
9761
- this.selectTheRow(index);
9762
- }, 200);
9650
+ handleClickRow(event, index) {
9651
+ if (this.inlineEdit && this.showRowButtons && !this.editing) {
9652
+ this.editing = false;
9653
+ }
9654
+ else {
9655
+ setTimeout(() => {
9656
+ if (this._doubleClicked) {
9657
+ return;
9658
+ }
9659
+ this.selectTheRow(index);
9660
+ if (this.inlineEdit && !this.showRowButtons) {
9661
+ this.editRow(event, true, index);
9662
+ }
9663
+ }, 200);
9664
+ }
9763
9665
  }
9764
9666
  selectTheRow(index, emit = true) {
9765
9667
  if (this.selectedRowIndex === -1 || (this.selectedRowIndex !== index && ((this.editing && this.validateAndSave()) || !this.editing))) {
9766
9668
  this.selectedRowIndex = index;
9767
- }
9768
- if (emit) {
9769
- this.selectRow.next(this.data[this.selectedRowIndex]);
9669
+ const absoluteIndex = this.rowsPerPage ? (this.currentPage - 1) * this.rowsPerPage + index : index;
9670
+ if (emit) {
9671
+ this.selectRow.next(this.data[absoluteIndex]);
9672
+ }
9770
9673
  }
9771
9674
  this._detectChanges();
9772
9675
  }
@@ -9784,7 +9687,7 @@ class SimpleGridComponent extends BaseSimpleGridComponent {
9784
9687
  this._doubleClicked = true;
9785
9688
  this.dblClickRow.next(this.data[index]);
9786
9689
  this.selectTheRow(index, false);
9787
- if (this.inlineEdit) {
9690
+ if (this.inlineEdit && !this.showRowButtons) {
9788
9691
  this.editRow(event);
9789
9692
  }
9790
9693
  }
@@ -9794,12 +9697,12 @@ class SimpleGridComponent extends BaseSimpleGridComponent {
9794
9697
  editRow(event, selectCell = true, rowIndex) {
9795
9698
  return __awaiter(this, void 0, void 0, function* () {
9796
9699
  if (rowIndex !== undefined) {
9797
- this.selectTheRow(rowIndex, false);
9700
+ this.selectTheRow(rowIndex);
9798
9701
  }
9702
+ this.editing = true;
9799
9703
  this.editRowIndex = this.selectedRowIndex;
9800
9704
  this.rowToEdit = this.data[this.editRowIndex];
9801
- this.editing = true;
9802
- if (selectCell) {
9705
+ if (this.showRowButtons && this.inlineEdit && selectCell) {
9803
9706
  this.editCellIndex = yield this._nextAvailableCellToEdit(true);
9804
9707
  }
9805
9708
  this._detectChanges();
@@ -9812,12 +9715,10 @@ class SimpleGridComponent extends BaseSimpleGridComponent {
9812
9715
  this.selectedRowIndex = -1;
9813
9716
  return;
9814
9717
  }
9815
- this.selectTheRow(rowIndex, false);
9816
9718
  if (this.inlineEdit) {
9817
9719
  this.editRowIndex = rowIndex;
9818
9720
  this.editCellIndex = cellIndex;
9819
9721
  this.editing = true;
9820
- this.editRow(event, false);
9821
9722
  }
9822
9723
  }
9823
9724
  else {
@@ -10065,9 +9966,26 @@ class SimpleGridComponent extends BaseSimpleGridComponent {
10065
9966
  });
10066
9967
  }
10067
9968
  _saveRow(stopediting = true) {
10068
- // emit saveEvent
10069
- if (this.rowToEdit) {
10070
- this.saveRow.next(this.rowToEdit);
9969
+ if (this._newRow) {
9970
+ this.saveRow.next(this._newRowReference);
9971
+ this._newRowReference = null; // clear
9972
+ }
9973
+ else {
9974
+ let index = -1; // existing row
9975
+ if (this.rowsPerPage) {
9976
+ index = (this.currentPage - 1) * this.rowsPerPage + this.editRowIndex;
9977
+ }
9978
+ else {
9979
+ index = this.editRowIndex;
9980
+ }
9981
+ if (index >= 0 && index < this.data.length) {
9982
+ this.saveRow.next(this.data[index]);
9983
+ }
9984
+ }
9985
+ if (this.currentPage !== 1) {
9986
+ this.currentPage = 1;
9987
+ this.selectedRowIndex = -1;
9988
+ window.scrollTo({ top: 0, behavior: 'smooth' });
10071
9989
  }
10072
9990
  this._newRow = false;
10073
9991
  if (stopediting) {
@@ -10103,175 +10021,176 @@ SimpleGridComponent.decorators = [
10103
10021
  { type: Component, args: [{
10104
10022
  selector: 'co-simple-grid',
10105
10023
  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>
10024
+ <co-grid-toolbar
10025
+ *ngIf="showToolbar" [class.right]="rightToolbar"
10026
+ [showEdit]="showEdit"
10027
+ [showAdd]="showAdd"
10028
+ [showDelete]="showDelete"
10029
+ [deleteEnabled]="selectedRowIndex > -1"
10030
+ (addClick)="addNewRow()"
10031
+ (editClick)="editRow($event)"
10032
+ (saveClick)="validateAndSave()"
10033
+ (cancelClick)="cancelEditRow()"
10034
+ (deleteClick)="removeRow()">
10035
+ </co-grid-toolbar>
10118
10036
 
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>
10037
+ <table
10038
+ id="simple-grid-table"
10039
+ class="simple-grid-table"
10040
+ [clickOutside]="editing"
10041
+ (clickOutside)="handleClickOutsideRow()">
10042
+ <colgroup>
10043
+ <col
10044
+ *ngFor="let column of headerColumnsCopy; let index = index"
10045
+ [class.simple-grid-column-auto-fit]="column.autoFit"
10046
+ [style.width.px]="column.width"
10047
+ [style.min-width.px]="MIN_COLUMN_WIDTH">
10048
+ </colgroup>
10049
+ <thead>
10050
+ <tr>
10051
+ <th
10052
+ scope="col"
10053
+ #headerCell
10054
+ class="simple-grid-column-header"
10055
+ *ngFor="let column of headerColumnsCopy; let index = index">
10056
+ <div
10057
+ class="simple-grid-column-header-wrapper"
10058
+ [class.resizable]="resizable"
10059
+ [class.selected]="column.isSelected"
10060
+ [ngClass]="column.textAlign ? column.textAlign : defaultTextAlign">
10061
+ <ng-container *ngIf="column.headerTemplate; else noHeaderTemplate">
10062
+ <ng-container [ngTemplateOutlet]="column.headerTemplate"></ng-container>
10063
+ </ng-container>
10064
+ <ng-template #noHeaderTemplate>
10065
+ <div
10066
+ class="simple-grid-column-header-label"
10067
+ [ngClass]="column.textAlign ? column.textAlign : defaultTextAlign"
10068
+ [class.with-menu]="showGridSettings"
10069
+ [class.with-sort]="showColumnSort"
10070
+ [textContent]="column.headerText || '&nbsp;'"
10071
+ (click)="showColumnSort ? sortColumn(column, column.field) : toggleColumnMenu(column)">
10072
+ </div>
10155
10073
 
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>
10074
+ <div class="sort-column" *ngIf="showColumnSort">
10075
+ <co-button
10076
+ (click)="sortColumn(column, column?.field)"
10077
+ [iconData]="icons.getIcon(Icons.ArrowUpArrowDown)">
10078
+ </co-button>
10079
+ </div>
10162
10080
 
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>
10081
+ <div class="column-menu" *ngIf="column.isSelected">
10082
+ <h3 [textContent]="'COLUMN_OPTIONS' | coreLocalize"></h3>
10083
+ <ul>
10084
+ <li (click)="hideColumn(column)">Hide Column</li>
10085
+ <li (click)="sortColumn(column, column.field)">Sort Column</li>
10086
+ </ul>
10087
+ </div>
10088
+ </ng-template>
10089
+ <div
10090
+ *ngIf="resizable && column.resizable"
10091
+ class="simple-grid-column-sizer"
10092
+ (mousedown)="handleSizerMouseDown($event, column)">
10093
+ </div>
10094
+ </div>
10095
+ </th>
10096
+ </tr>
10179
10097
 
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>
10098
+ <div *ngIf="showGridSettings" class="grid-settings">
10099
+ <co-button
10100
+ [class.selected]="isSettingsMenuOpen"
10101
+ [iconData]="icons.getIcon(Icons.CogWheels)"
10102
+ (click)="toggleSettingsMenu()">
10103
+ </co-button>
10186
10104
 
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>
10105
+ <div class="settings-menu" *ngIf="isSettingsMenuOpen">
10106
+ <h3 [textContent]="'GRID_OPTIONS' | coreLocalize"></h3>
10107
+ <ul>
10108
+ <li (click)="exportToExcel()">Export to Excel</li>
10109
+ <li *ngIf="headerColumnsCopy.length !== headerColumns.length" (click)="showAllColumns()">
10110
+ Show All Columns
10111
+ </li>
10112
+ </ul>
10113
+ </div>
10114
+ </div>
10115
+ </thead>
10116
+ <tbody
10117
+ #dropList cdkDropList cdkDropListOrientation="vertical"
10118
+ class="simple-grid-drag-drop-list"
10119
+ [cdkDropListDisabled]="!dragDropEnabled || editing"
10120
+ [cdkDropListData]="data"
10121
+ [cdkDropListEnterPredicate]="handleCanDragDrop"
10122
+ (cdkDropListDropped)="handleDrop($event)">
10123
+ <co-form class="simple-grid-row-form">
10124
+ <tr
10125
+ #rowElement
10126
+ class="simple-grid-row"
10127
+ [class.selected]="rowIndex === selectedRowIndex && !editing" observeVisibility
10128
+ [class.disabled]="getIsRowDisabled(rowIndex)"
10129
+ [class.editing]="rowIndex === editRowIndex"
10130
+ *ngFor="let row of (!!rowsPerPage ? (data | paginate: {itemsPerPage: rowsPerPage, currentPage: currentPage}) : data); last as last; let rowIndex = index"
10131
+ cdkDrag
10132
+ (click)="handleClickRow($event, rowIndex)" (dblclick)="handleDblClickRow($event, rowIndex, row)"
10133
+ (visibilityChange)="rowVisible.next(row)"
10134
+ (mouseenter)="hoveredRowIndex = rowIndex"
10135
+ (mouseleave)="hoveredRowIndex = -1"
10136
+ >
10137
+ <ng-container *ngIf="isSingleColumnRow(row)">
10138
+ <td class="simple-grid-single-column-cell" [attr.colspan]="headerColumnsCopy.length">
10139
+ <co-simple-grid-cell
10140
+ [column]="columns[singleColumnIndex(row)]"
10141
+ [row]="row"
10142
+ [editMode]="false">
10143
+ </co-simple-grid-cell>
10144
+ </td>
10145
+ </ng-container>
10146
+ <ng-container *ngIf="!isSingleColumnRow(row)">
10147
+ <ng-container *ngFor="let column of headerColumnsCopy; let columnIndex = index">
10148
+ <td class="simple-grid-column-cell" *ngIf="columnIndex !== singleColumnIndex(row)">
10149
+ <co-simple-grid-cell
10150
+ [column]="column"
10151
+ [row]="row"
10152
+ [editMode]="inlineEdit && editing && rowIndex === editRowIndex"
10153
+ [fieldEditMode]="editCellIndex === columnIndex && rowIndex === editRowIndex"
10154
+ (cellClick)="handleCellClick($event, row, rowIndex, columnIndex)">
10155
+ </co-simple-grid-cell>
10156
+ <div *ngIf="column.resizable" class="simple-grid-column-sizer-placeholder"></div>
10157
+ </td>
10158
+ </ng-container>
10159
+ <ng-container *ngIf="inlineEdit && showRowButtons">
10160
+ <div class="icons-container" *ngIf="!editing">
10161
+ <co-icon class="icon-item icon-edit"
10162
+ [iconData]="icons.getIcon(Icons.PenToSquareSolid)" *ngIf="hoveredRowIndex === rowIndex"
10163
+ (click)="editRow($event, true, rowIndex); $event.stopPropagation()"></co-icon>
10164
+ <co-icon class="icon-item icon-delete"
10165
+ [iconData]="icons.getIcon(Icons.TrashBin)" *ngIf="hoveredRowIndex === rowIndex"
10166
+ (click)="selectTheRow(rowIndex); removeRow();"></co-icon>
10195
10167
  </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>
10168
+ <div class="icons-container">
10169
+ <co-button class="save-button"
10170
+ *ngIf="editing && (selectedRowIndex === rowIndex || (isNewRow && rowIndex === editRowIndex))"
10171
+ [iconData]="icons.getIcon(Icons.CheckDuotone)"
10172
+ (click)="validateAndSave(); $event.stopPropagation()"></co-button>
10173
+ <co-button class="close-button"
10174
+ *ngIf="editing && (selectedRowIndex === rowIndex || (isNewRow && rowIndex === editRowIndex))"
10175
+ [iconData]="icons.getIcon(Icons.CrossSkinny)"
10176
+ (click)="cancelEditRow(); $event.stopPropagation() "></co-button>
10177
+ </div>
10178
+ </ng-container>
10179
+ </ng-container>
10180
+ </tr>
10181
+ </co-form>
10182
+ </tbody>
10183
+ </table>
10184
+ <co-pagination-bar
10185
+ *ngIf="data?.length > rowsPerPage" class="pagination-bar"
10186
+ [itemsPerPage]="rowsPerPage"
10187
+ [currentPage]="currentPage"
10188
+ [totalItems]="data.length"
10189
+ [autoHide]="true"
10190
+ (previousClick)="goToPreviousPage()"
10191
+ (nextClick)="goToNextPage()"
10192
+ (pageClick)="setCurrentPage($event)">
10193
+ </co-pagination-bar>
10275
10194
  `,
10276
10195
  providers: [FormMasterService],
10277
10196
  changeDetection: ChangeDetectionStrategy.OnPush,
@@ -10286,6 +10205,7 @@ SimpleGridComponent.ctorParameters = () => [
10286
10205
  ];
10287
10206
  SimpleGridComponent.propDecorators = {
10288
10207
  headerCells: [{ type: ViewChildren, args: ['headerCell',] }],
10208
+ rowElements: [{ type: ViewChildren, args: ['rowElement',] }],
10289
10209
  showAdd: [{ type: Input }],
10290
10210
  showDelete: [{ type: Input }],
10291
10211
  editOnCellClick: [{ type: Input }],
@@ -10294,6 +10214,7 @@ SimpleGridComponent.propDecorators = {
10294
10214
  rowsPerPage: [{ type: Input }],
10295
10215
  rowDisabledFn: [{ type: Input }],
10296
10216
  showColumnSort: [{ type: Input }],
10217
+ showRowButtons: [{ type: Input }],
10297
10218
  canRowBeEdittedFn: [{ type: Input }],
10298
10219
  showClass: [{ type: HostBinding, args: ['class.co-simple-grid',] }],
10299
10220
  handleKeyDown: [{ type: HostListener, args: ['keydown', ['$event'],] }]