@colijnit/corecomponents_v12 258.1.21 → 258.1.23
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.
- package/bundles/colijnit-corecomponents_v12.umd.js +98 -38
- package/bundles/colijnit-corecomponents_v12.umd.js.map +1 -1
- package/colijnit-corecomponents_v12.metadata.json +1 -1
- package/esm2015/lib/components/input-number-picker/input-number-picker.component.js +2 -2
- package/esm2015/lib/components/simple-grid/base-simple-grid.component.js +46 -27
- package/esm2015/lib/components/simple-grid/simple-grid.component.js +191 -181
- package/fesm2015/colijnit-corecomponents_v12.js +234 -206
- package/fesm2015/colijnit-corecomponents_v12.js.map +1 -1
- package/lib/components/simple-grid/base-simple-grid.component.d.ts +5 -2
- package/lib/components/simple-grid/simple-grid.component.d.ts +4 -3
- package/package.json +1 -1
|
@@ -7698,7 +7698,7 @@ InputNumberPickerComponent.decorators = [
|
|
|
7698
7698
|
</div>
|
|
7699
7699
|
<div class="input-wrapper">
|
|
7700
7700
|
<span class='permanent-label' [textContent]="label" *ngIf="showPermanentLabel"></span>
|
|
7701
|
-
<input type="
|
|
7701
|
+
<input type="number"
|
|
7702
7702
|
[tabIndex]="readonly ? -1 : 0"
|
|
7703
7703
|
[ngModel]="model"
|
|
7704
7704
|
[readonly]="readonly"
|
|
@@ -9340,7 +9340,8 @@ SimpleGridColumnDirective.propDecorators = {
|
|
|
9340
9340
|
};
|
|
9341
9341
|
|
|
9342
9342
|
class BaseSimpleGridComponent {
|
|
9343
|
-
constructor() {
|
|
9343
|
+
constructor(changeDetection) {
|
|
9344
|
+
this.changeDetection = changeDetection;
|
|
9344
9345
|
this.MIN_COLUMN_WIDTH = 50;
|
|
9345
9346
|
this.dataChanged = new Subject();
|
|
9346
9347
|
this.dragDropEnabled = false;
|
|
@@ -9356,6 +9357,7 @@ class BaseSimpleGridComponent {
|
|
|
9356
9357
|
this.emitDragDrop = false;
|
|
9357
9358
|
this.onDrop = new EventEmitter();
|
|
9358
9359
|
this.selectRow = new EventEmitter();
|
|
9360
|
+
this.deselectRow = new EventEmitter();
|
|
9359
9361
|
this.dblClickRow = new EventEmitter();
|
|
9360
9362
|
this.saveRow = new EventEmitter();
|
|
9361
9363
|
this.deleteRow = new EventEmitter();
|
|
@@ -9433,40 +9435,52 @@ class BaseSimpleGridComponent {
|
|
|
9433
9435
|
return row.singleColumnIndex;
|
|
9434
9436
|
}
|
|
9435
9437
|
prepareDataRow(row, index) {
|
|
9438
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
9439
|
+
});
|
|
9436
9440
|
}
|
|
9437
9441
|
_setColumns(columns) {
|
|
9438
9442
|
this.columns.push(...columns);
|
|
9439
9443
|
this.columns.sort((a, b) => a.order < b.order ? -1 : 1);
|
|
9440
9444
|
}
|
|
9441
9445
|
_prepareData() {
|
|
9442
|
-
|
|
9443
|
-
|
|
9444
|
-
|
|
9445
|
-
this.disabledRows.length = 0;
|
|
9446
|
-
if (this.columns && this.columns.length > 0) {
|
|
9447
|
-
this.headerColumns = this.columns.filter(c => !c.singleColumn);
|
|
9448
|
-
this.headerColumnsCopy = this.headerColumns;
|
|
9449
|
-
let singleColumnIndex = -1;
|
|
9450
|
-
for (let i = 0; i < this.columns.length; i++) {
|
|
9451
|
-
if (this.columns[i].singleColumn) {
|
|
9452
|
-
singleColumnIndex = i;
|
|
9453
|
-
break;
|
|
9454
|
-
}
|
|
9446
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
9447
|
+
if (this._prepared) {
|
|
9448
|
+
return;
|
|
9455
9449
|
}
|
|
9456
|
-
|
|
9457
|
-
if (
|
|
9458
|
-
|
|
9459
|
-
|
|
9460
|
-
|
|
9461
|
-
|
|
9462
|
-
|
|
9450
|
+
this.disabledRows.length = 0;
|
|
9451
|
+
if (this.columns && this.columns.length > 0) {
|
|
9452
|
+
this.headerColumns = this.columns.filter(c => !c.singleColumn);
|
|
9453
|
+
this.headerColumnsCopy = this.headerColumns;
|
|
9454
|
+
let singleColumnIndex = -1;
|
|
9455
|
+
for (let i = 0; i < this.columns.length; i++) {
|
|
9456
|
+
if (this.columns[i].singleColumn) {
|
|
9457
|
+
singleColumnIndex = i;
|
|
9458
|
+
break;
|
|
9463
9459
|
}
|
|
9464
|
-
this.prepareDataRow(this.data[i], i);
|
|
9465
9460
|
}
|
|
9461
|
+
// first check if there's single column data
|
|
9462
|
+
if (this.data && this.data.length > 0) {
|
|
9463
|
+
if (singleColumnIndex > -1) {
|
|
9464
|
+
const field = this.columns[singleColumnIndex].field;
|
|
9465
|
+
for (let i = 0; i < this.data.length; i++) { // then mark row as single column row
|
|
9466
|
+
if (this.data[i][field] !== undefined && this.data[i][field] !== null && this.data[i][field] !== "") {
|
|
9467
|
+
// bit nasty to add prop, but cool for now
|
|
9468
|
+
this.data[i].singleColumnIndex = singleColumnIndex;
|
|
9469
|
+
}
|
|
9470
|
+
yield this.prepareDataRow(this.data[i], i);
|
|
9471
|
+
}
|
|
9472
|
+
}
|
|
9473
|
+
else {
|
|
9474
|
+
for (let j = 0; j < this.data.length; j++) {
|
|
9475
|
+
yield this.prepareDataRow(this.data[j], j);
|
|
9476
|
+
}
|
|
9477
|
+
}
|
|
9478
|
+
}
|
|
9479
|
+
this._prepared = true;
|
|
9466
9480
|
}
|
|
9467
|
-
this.
|
|
9468
|
-
|
|
9469
|
-
|
|
9481
|
+
this._resizeColumnsToFit();
|
|
9482
|
+
this.changeDetection.detectChanges();
|
|
9483
|
+
});
|
|
9470
9484
|
}
|
|
9471
9485
|
_resizeColumnsToFit() {
|
|
9472
9486
|
const calculateColumns = this.columns.filter(c => !c.autoFit && !c.width);
|
|
@@ -9486,6 +9500,9 @@ class BaseSimpleGridComponent {
|
|
|
9486
9500
|
BaseSimpleGridComponent.decorators = [
|
|
9487
9501
|
{ type: Directive }
|
|
9488
9502
|
];
|
|
9503
|
+
BaseSimpleGridComponent.ctorParameters = () => [
|
|
9504
|
+
{ type: ChangeDetectorRef }
|
|
9505
|
+
];
|
|
9489
9506
|
BaseSimpleGridComponent.propDecorators = {
|
|
9490
9507
|
content: [{ type: ContentChildren, args: [SimpleGridColumnDirective,] }],
|
|
9491
9508
|
data: [{ type: Input }],
|
|
@@ -9500,6 +9517,7 @@ BaseSimpleGridComponent.propDecorators = {
|
|
|
9500
9517
|
extraColumns: [{ type: Input }],
|
|
9501
9518
|
onDrop: [{ type: Output }],
|
|
9502
9519
|
selectRow: [{ type: Output }],
|
|
9520
|
+
deselectRow: [{ type: Output }],
|
|
9503
9521
|
dblClickRow: [{ type: Output }],
|
|
9504
9522
|
saveRow: [{ type: Output }],
|
|
9505
9523
|
deleteRow: [{ type: Output }],
|
|
@@ -9510,14 +9528,15 @@ BaseSimpleGridComponent.propDecorators = {
|
|
|
9510
9528
|
};
|
|
9511
9529
|
|
|
9512
9530
|
class SimpleGridComponent extends BaseSimpleGridComponent {
|
|
9513
|
-
constructor(icons,
|
|
9514
|
-
super();
|
|
9531
|
+
constructor(icons, changeDetection, _formMaster) {
|
|
9532
|
+
super(changeDetection);
|
|
9515
9533
|
this.icons = icons;
|
|
9516
|
-
this.
|
|
9534
|
+
this.changeDetection = changeDetection;
|
|
9517
9535
|
this._formMaster = _formMaster;
|
|
9518
9536
|
this.defaultTextAlign = ColumnAlign.Left;
|
|
9519
9537
|
this.showAdd = false;
|
|
9520
9538
|
this.showDelete = false;
|
|
9539
|
+
this.deselectAllowed = false;
|
|
9521
9540
|
this.editOnCellClick = true;
|
|
9522
9541
|
this.rightToolbar = false;
|
|
9523
9542
|
this.showGridSettings = false;
|
|
@@ -9559,7 +9578,7 @@ class SimpleGridComponent extends BaseSimpleGridComponent {
|
|
|
9559
9578
|
this._nextAvailableCellToEdit(!event.shiftKey, this.editCellIndex)
|
|
9560
9579
|
.then((index) => {
|
|
9561
9580
|
this.editCellIndex = index;
|
|
9562
|
-
this.
|
|
9581
|
+
this.changeDetection.markForCheck();
|
|
9563
9582
|
});
|
|
9564
9583
|
this._detectChanges();
|
|
9565
9584
|
}
|
|
@@ -9697,10 +9716,16 @@ class SimpleGridComponent extends BaseSimpleGridComponent {
|
|
|
9697
9716
|
selectTheRow(index, emit = true) {
|
|
9698
9717
|
if (this.selectedRowIndex === -1 || (this.selectedRowIndex !== index && ((this.editing && this.validateAndSave()) || !this.editing))) {
|
|
9699
9718
|
this.selectedRowIndex = index;
|
|
9719
|
+
const absoluteIndex = this.rowsPerPage ? (this.currentPage - 1) * this.rowsPerPage + index : index;
|
|
9720
|
+
if (emit) {
|
|
9721
|
+
this.selectRow.next(this.data[absoluteIndex]);
|
|
9722
|
+
}
|
|
9700
9723
|
}
|
|
9701
|
-
|
|
9702
|
-
|
|
9703
|
-
|
|
9724
|
+
else if (this.selectedRowIndex === index && this.deselectAllowed && ((this.editing && this.validateAndSave()) || !this.editing)) {
|
|
9725
|
+
this.selectedRowIndex = -1;
|
|
9726
|
+
if (emit) {
|
|
9727
|
+
this.deselectRow.next();
|
|
9728
|
+
}
|
|
9704
9729
|
}
|
|
9705
9730
|
this._detectChanges();
|
|
9706
9731
|
}
|
|
@@ -9888,7 +9913,9 @@ class SimpleGridComponent extends BaseSimpleGridComponent {
|
|
|
9888
9913
|
return hasSelectedTrue ? items.filter(item => item.selected === true) : items;
|
|
9889
9914
|
}
|
|
9890
9915
|
prepareDataRow(row, index) {
|
|
9891
|
-
this
|
|
9916
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
9917
|
+
yield this.isRowDisabled(row, index);
|
|
9918
|
+
});
|
|
9892
9919
|
}
|
|
9893
9920
|
_resetDblClick() {
|
|
9894
9921
|
setTimeout(() => {
|
|
@@ -10034,7 +10061,7 @@ class SimpleGridComponent extends BaseSimpleGridComponent {
|
|
|
10034
10061
|
this.currentPage = page;
|
|
10035
10062
|
}
|
|
10036
10063
|
_detectChanges() {
|
|
10037
|
-
this.
|
|
10064
|
+
this.changeDetection.detectChanges();
|
|
10038
10065
|
}
|
|
10039
10066
|
_resetEdit() {
|
|
10040
10067
|
this._newRow = false;
|
|
@@ -10051,177 +10078,177 @@ class SimpleGridComponent extends BaseSimpleGridComponent {
|
|
|
10051
10078
|
SimpleGridComponent.decorators = [
|
|
10052
10079
|
{ type: Component, args: [{
|
|
10053
10080
|
selector: 'co-simple-grid',
|
|
10054
|
-
template: `
|
|
10055
|
-
<co-grid-toolbar
|
|
10056
|
-
*ngIf="showToolbar" [class.right]="rightToolbar"
|
|
10057
|
-
[showEdit]="showEdit"
|
|
10058
|
-
[showAdd]="showAdd"
|
|
10059
|
-
[showDelete]="showDelete"
|
|
10060
|
-
[deleteEnabled]="selectedRowIndex > -1"
|
|
10061
|
-
(addClick)="addNewRow()"
|
|
10062
|
-
(editClick)="editRow($event)"
|
|
10063
|
-
(saveClick)="validateAndSave()"
|
|
10064
|
-
(cancelClick)="cancelEditRow()"
|
|
10065
|
-
(deleteClick)="removeRow()">
|
|
10066
|
-
</co-grid-toolbar>
|
|
10067
|
-
|
|
10068
|
-
<table
|
|
10069
|
-
id="simple-grid-table"
|
|
10070
|
-
class="simple-grid-table"
|
|
10071
|
-
[clickOutside]="editing"
|
|
10072
|
-
(clickOutside)="handleClickOutsideRow()">
|
|
10073
|
-
<colgroup>
|
|
10074
|
-
<col
|
|
10075
|
-
*ngFor="let column of headerColumnsCopy; let index = index"
|
|
10076
|
-
[class.simple-grid-column-auto-fit]="column.autoFit"
|
|
10077
|
-
[style.width.px]="column.width"
|
|
10078
|
-
[style.min-width.px]="MIN_COLUMN_WIDTH">
|
|
10079
|
-
</colgroup>
|
|
10080
|
-
<thead>
|
|
10081
|
-
<tr>
|
|
10082
|
-
<th
|
|
10083
|
-
scope="col"
|
|
10084
|
-
#headerCell
|
|
10085
|
-
class="simple-grid-column-header"
|
|
10086
|
-
*ngFor="let column of headerColumnsCopy; let index = index">
|
|
10087
|
-
<div
|
|
10088
|
-
class="simple-grid-column-header-wrapper"
|
|
10089
|
-
[class.resizable]="resizable"
|
|
10090
|
-
[class.selected]="column.isSelected"
|
|
10091
|
-
[ngClass]="column.textAlign ? column.textAlign : defaultTextAlign">
|
|
10092
|
-
<ng-container *ngIf="column.headerTemplate; else noHeaderTemplate">
|
|
10093
|
-
<ng-container [ngTemplateOutlet]="column.headerTemplate"></ng-container>
|
|
10094
|
-
</ng-container>
|
|
10095
|
-
<ng-template #noHeaderTemplate>
|
|
10096
|
-
<div
|
|
10097
|
-
class="simple-grid-column-header-label"
|
|
10098
|
-
[ngClass]="column.textAlign ? column.textAlign : defaultTextAlign"
|
|
10099
|
-
[class.with-menu]="showGridSettings"
|
|
10100
|
-
[class.with-sort]="showColumnSort"
|
|
10101
|
-
[textContent]="column.headerText || ' '"
|
|
10102
|
-
(click)="showColumnSort ? sortColumn(column, column.field) : toggleColumnMenu(column)">
|
|
10103
|
-
</div>
|
|
10104
|
-
|
|
10105
|
-
<div class="sort-column" *ngIf="showColumnSort">
|
|
10106
|
-
<co-button
|
|
10107
|
-
(click)="sortColumn(column, column?.field)"
|
|
10108
|
-
[iconData]="icons.getIcon(Icons.ArrowUpArrowDown)">
|
|
10109
|
-
</co-button>
|
|
10110
|
-
</div>
|
|
10111
|
-
|
|
10112
|
-
<div class="column-menu" *ngIf="column.isSelected">
|
|
10113
|
-
<h3 [textContent]="'COLUMN_OPTIONS' | coreLocalize"></h3>
|
|
10114
|
-
<ul>
|
|
10115
|
-
<li (click)="hideColumn(column)">Hide Column</li>
|
|
10116
|
-
<li (click)="sortColumn(column, column.field)">Sort Column</li>
|
|
10117
|
-
</ul>
|
|
10118
|
-
</div>
|
|
10119
|
-
</ng-template>
|
|
10120
|
-
<div
|
|
10121
|
-
*ngIf="resizable && column.resizable"
|
|
10122
|
-
class="simple-grid-column-sizer"
|
|
10123
|
-
(mousedown)="handleSizerMouseDown($event, column)">
|
|
10124
|
-
</div>
|
|
10125
|
-
</div>
|
|
10126
|
-
</th>
|
|
10127
|
-
</tr>
|
|
10128
|
-
|
|
10129
|
-
<div *ngIf="showGridSettings" class="grid-settings">
|
|
10130
|
-
<co-button
|
|
10131
|
-
[class.selected]="isSettingsMenuOpen"
|
|
10132
|
-
[iconData]="icons.getIcon(Icons.CogWheels)"
|
|
10133
|
-
(click)="toggleSettingsMenu()">
|
|
10134
|
-
</co-button>
|
|
10135
|
-
|
|
10136
|
-
<div class="settings-menu" *ngIf="isSettingsMenuOpen">
|
|
10137
|
-
<h3 [textContent]="'GRID_OPTIONS' | coreLocalize"></h3>
|
|
10138
|
-
<ul>
|
|
10139
|
-
<li (click)="exportToExcel()">Export to Excel</li>
|
|
10140
|
-
<li *ngIf="headerColumnsCopy.length !== headerColumns.length" (click)="showAllColumns()">
|
|
10141
|
-
Show All Columns
|
|
10142
|
-
</li>
|
|
10143
|
-
</ul>
|
|
10144
|
-
</div>
|
|
10145
|
-
</div>
|
|
10146
|
-
</thead>
|
|
10147
|
-
<tbody
|
|
10148
|
-
#dropList cdkDropList cdkDropListOrientation="vertical"
|
|
10149
|
-
class="simple-grid-drag-drop-list"
|
|
10150
|
-
[cdkDropListDisabled]="!dragDropEnabled || editing"
|
|
10151
|
-
[cdkDropListData]="data"
|
|
10152
|
-
[cdkDropListEnterPredicate]="handleCanDragDrop"
|
|
10153
|
-
(cdkDropListDropped)="handleDrop($event)">
|
|
10154
|
-
<co-form class="simple-grid-row-form">
|
|
10155
|
-
<tr
|
|
10156
|
-
#rowElement
|
|
10157
|
-
class="simple-grid-row"
|
|
10158
|
-
[class.selected]="rowIndex === selectedRowIndex && !editing" observeVisibility
|
|
10159
|
-
[class.disabled]="getIsRowDisabled(rowIndex)"
|
|
10160
|
-
[class.editing]="rowIndex === editRowIndex"
|
|
10161
|
-
*ngFor="let row of (!!rowsPerPage ? (data | paginate: {itemsPerPage: rowsPerPage, currentPage: currentPage}) : data); last as last; let rowIndex = index"
|
|
10162
|
-
cdkDrag
|
|
10163
|
-
(click)="handleClickRow($event, rowIndex)" (dblclick)="handleDblClickRow($event, rowIndex, row)"
|
|
10164
|
-
(visibilityChange)="rowVisible.next(row)"
|
|
10165
|
-
(mouseenter)="hoveredRowIndex = rowIndex"
|
|
10166
|
-
(mouseleave)="hoveredRowIndex = -1"
|
|
10167
|
-
>
|
|
10168
|
-
<ng-container *ngIf="isSingleColumnRow(row)">
|
|
10169
|
-
<td class="simple-grid-single-column-cell" [attr.colspan]="headerColumnsCopy.length">
|
|
10170
|
-
<co-simple-grid-cell
|
|
10171
|
-
[column]="columns[singleColumnIndex(row)]"
|
|
10172
|
-
[row]="row"
|
|
10173
|
-
[editMode]="false">
|
|
10174
|
-
</co-simple-grid-cell>
|
|
10175
|
-
</td>
|
|
10176
|
-
</ng-container>
|
|
10177
|
-
<ng-container *ngIf="!isSingleColumnRow(row)">
|
|
10178
|
-
<ng-container *ngFor="let column of headerColumnsCopy; let columnIndex = index">
|
|
10179
|
-
<td class="simple-grid-column-cell" *ngIf="columnIndex !== singleColumnIndex(row)">
|
|
10180
|
-
<co-simple-grid-cell
|
|
10181
|
-
[column]="column"
|
|
10182
|
-
[row]="row"
|
|
10183
|
-
[editMode]="inlineEdit && editing && rowIndex === editRowIndex"
|
|
10184
|
-
[fieldEditMode]="editCellIndex === columnIndex && rowIndex === editRowIndex"
|
|
10185
|
-
(cellClick)="handleCellClick($event, row, rowIndex, columnIndex)">
|
|
10186
|
-
</co-simple-grid-cell>
|
|
10187
|
-
<div *ngIf="column.resizable" class="simple-grid-column-sizer-placeholder"></div>
|
|
10188
|
-
</td>
|
|
10189
|
-
</ng-container>
|
|
10190
|
-
<ng-container *ngIf="inlineEdit && showRowButtons">
|
|
10191
|
-
<div class="icons-container" *ngIf="!editing">
|
|
10192
|
-
<co-icon class="icon-item icon-edit"
|
|
10193
|
-
[iconData]="icons.getIcon(Icons.PenToSquareSolid)" *ngIf="hoveredRowIndex === rowIndex"
|
|
10194
|
-
(click)="editRow($event, true, rowIndex); $event.stopPropagation()"></co-icon>
|
|
10195
|
-
<co-icon class="icon-item icon-delete"
|
|
10196
|
-
[iconData]="icons.getIcon(Icons.TrashBin)" *ngIf="hoveredRowIndex === rowIndex"
|
|
10197
|
-
(click)="selectTheRow(rowIndex); removeRow();"></co-icon>
|
|
10198
|
-
</div>
|
|
10199
|
-
<div class="icons-container">
|
|
10200
|
-
<co-button class="save-button"
|
|
10201
|
-
*ngIf="editing && (selectedRowIndex === rowIndex || (isNewRow && rowIndex === editRowIndex))"
|
|
10202
|
-
[iconData]="icons.getIcon(Icons.CheckDuotone)"
|
|
10203
|
-
(click)="validateAndSave(); $event.stopPropagation()"></co-button>
|
|
10204
|
-
<co-button class="close-button"
|
|
10205
|
-
*ngIf="editing && (selectedRowIndex === rowIndex || (isNewRow && rowIndex === editRowIndex))"
|
|
10206
|
-
[iconData]="icons.getIcon(Icons.CrossSkinny)"
|
|
10207
|
-
(click)="cancelEditRow(); $event.stopPropagation() "></co-button>
|
|
10208
|
-
</div>
|
|
10209
|
-
</ng-container>
|
|
10210
|
-
</ng-container>
|
|
10211
|
-
</tr>
|
|
10212
|
-
</co-form>
|
|
10213
|
-
</tbody>
|
|
10214
|
-
</table>
|
|
10215
|
-
<co-pagination-bar
|
|
10216
|
-
*ngIf="data?.length > rowsPerPage" class="pagination-bar"
|
|
10217
|
-
[itemsPerPage]="rowsPerPage"
|
|
10218
|
-
[currentPage]="currentPage"
|
|
10219
|
-
[totalItems]="data.length"
|
|
10220
|
-
[autoHide]="true"
|
|
10221
|
-
(previousClick)="goToPreviousPage()"
|
|
10222
|
-
(nextClick)="goToNextPage()"
|
|
10223
|
-
(pageClick)="setCurrentPage($event)">
|
|
10224
|
-
</co-pagination-bar>
|
|
10081
|
+
template: `
|
|
10082
|
+
<co-grid-toolbar
|
|
10083
|
+
*ngIf="showToolbar" [class.right]="rightToolbar"
|
|
10084
|
+
[showEdit]="showEdit"
|
|
10085
|
+
[showAdd]="showAdd"
|
|
10086
|
+
[showDelete]="showDelete"
|
|
10087
|
+
[deleteEnabled]="selectedRowIndex > -1"
|
|
10088
|
+
(addClick)="addNewRow()"
|
|
10089
|
+
(editClick)="editRow($event)"
|
|
10090
|
+
(saveClick)="validateAndSave()"
|
|
10091
|
+
(cancelClick)="cancelEditRow()"
|
|
10092
|
+
(deleteClick)="removeRow()">
|
|
10093
|
+
</co-grid-toolbar>
|
|
10094
|
+
|
|
10095
|
+
<table
|
|
10096
|
+
id="simple-grid-table"
|
|
10097
|
+
class="simple-grid-table"
|
|
10098
|
+
[clickOutside]="editing"
|
|
10099
|
+
(clickOutside)="handleClickOutsideRow()">
|
|
10100
|
+
<colgroup>
|
|
10101
|
+
<col
|
|
10102
|
+
*ngFor="let column of headerColumnsCopy; let index = index"
|
|
10103
|
+
[class.simple-grid-column-auto-fit]="column.autoFit"
|
|
10104
|
+
[style.width.px]="column.width"
|
|
10105
|
+
[style.min-width.px]="MIN_COLUMN_WIDTH">
|
|
10106
|
+
</colgroup>
|
|
10107
|
+
<thead>
|
|
10108
|
+
<tr>
|
|
10109
|
+
<th
|
|
10110
|
+
scope="col"
|
|
10111
|
+
#headerCell
|
|
10112
|
+
class="simple-grid-column-header"
|
|
10113
|
+
*ngFor="let column of headerColumnsCopy; let index = index">
|
|
10114
|
+
<div
|
|
10115
|
+
class="simple-grid-column-header-wrapper"
|
|
10116
|
+
[class.resizable]="resizable"
|
|
10117
|
+
[class.selected]="column.isSelected"
|
|
10118
|
+
[ngClass]="column.textAlign ? column.textAlign : defaultTextAlign">
|
|
10119
|
+
<ng-container *ngIf="column.headerTemplate; else noHeaderTemplate">
|
|
10120
|
+
<ng-container [ngTemplateOutlet]="column.headerTemplate"></ng-container>
|
|
10121
|
+
</ng-container>
|
|
10122
|
+
<ng-template #noHeaderTemplate>
|
|
10123
|
+
<div
|
|
10124
|
+
class="simple-grid-column-header-label"
|
|
10125
|
+
[ngClass]="column.textAlign ? column.textAlign : defaultTextAlign"
|
|
10126
|
+
[class.with-menu]="showGridSettings"
|
|
10127
|
+
[class.with-sort]="showColumnSort"
|
|
10128
|
+
[textContent]="column.headerText || ' '"
|
|
10129
|
+
(click)="showColumnSort ? sortColumn(column, column.field) : toggleColumnMenu(column)">
|
|
10130
|
+
</div>
|
|
10131
|
+
|
|
10132
|
+
<div class="sort-column" *ngIf="showColumnSort">
|
|
10133
|
+
<co-button
|
|
10134
|
+
(click)="sortColumn(column, column?.field)"
|
|
10135
|
+
[iconData]="icons.getIcon(Icons.ArrowUpArrowDown)">
|
|
10136
|
+
</co-button>
|
|
10137
|
+
</div>
|
|
10138
|
+
|
|
10139
|
+
<div class="column-menu" *ngIf="column.isSelected">
|
|
10140
|
+
<h3 [textContent]="'COLUMN_OPTIONS' | coreLocalize"></h3>
|
|
10141
|
+
<ul>
|
|
10142
|
+
<li (click)="hideColumn(column)">Hide Column</li>
|
|
10143
|
+
<li (click)="sortColumn(column, column.field)">Sort Column</li>
|
|
10144
|
+
</ul>
|
|
10145
|
+
</div>
|
|
10146
|
+
</ng-template>
|
|
10147
|
+
<div
|
|
10148
|
+
*ngIf="resizable && column.resizable"
|
|
10149
|
+
class="simple-grid-column-sizer"
|
|
10150
|
+
(mousedown)="handleSizerMouseDown($event, column)">
|
|
10151
|
+
</div>
|
|
10152
|
+
</div>
|
|
10153
|
+
</th>
|
|
10154
|
+
</tr>
|
|
10155
|
+
|
|
10156
|
+
<div *ngIf="showGridSettings" class="grid-settings">
|
|
10157
|
+
<co-button
|
|
10158
|
+
[class.selected]="isSettingsMenuOpen"
|
|
10159
|
+
[iconData]="icons.getIcon(Icons.CogWheels)"
|
|
10160
|
+
(click)="toggleSettingsMenu()">
|
|
10161
|
+
</co-button>
|
|
10162
|
+
|
|
10163
|
+
<div class="settings-menu" *ngIf="isSettingsMenuOpen">
|
|
10164
|
+
<h3 [textContent]="'GRID_OPTIONS' | coreLocalize"></h3>
|
|
10165
|
+
<ul>
|
|
10166
|
+
<li (click)="exportToExcel()">Export to Excel</li>
|
|
10167
|
+
<li *ngIf="headerColumnsCopy.length !== headerColumns.length" (click)="showAllColumns()">
|
|
10168
|
+
Show All Columns
|
|
10169
|
+
</li>
|
|
10170
|
+
</ul>
|
|
10171
|
+
</div>
|
|
10172
|
+
</div>
|
|
10173
|
+
</thead>
|
|
10174
|
+
<tbody
|
|
10175
|
+
#dropList cdkDropList cdkDropListOrientation="vertical"
|
|
10176
|
+
class="simple-grid-drag-drop-list"
|
|
10177
|
+
[cdkDropListDisabled]="!dragDropEnabled || editing"
|
|
10178
|
+
[cdkDropListData]="data"
|
|
10179
|
+
[cdkDropListEnterPredicate]="handleCanDragDrop"
|
|
10180
|
+
(cdkDropListDropped)="handleDrop($event)">
|
|
10181
|
+
<co-form class="simple-grid-row-form">
|
|
10182
|
+
<tr
|
|
10183
|
+
#rowElement
|
|
10184
|
+
class="simple-grid-row"
|
|
10185
|
+
[class.selected]="rowIndex === selectedRowIndex && !editing" observeVisibility
|
|
10186
|
+
[class.disabled]="getIsRowDisabled(rowIndex)"
|
|
10187
|
+
[class.editing]="rowIndex === editRowIndex"
|
|
10188
|
+
*ngFor="let row of (!!rowsPerPage ? (data | paginate: {itemsPerPage: rowsPerPage, currentPage: currentPage}) : data); last as last; let rowIndex = index"
|
|
10189
|
+
cdkDrag
|
|
10190
|
+
(click)="handleClickRow($event, rowIndex)" (dblclick)="handleDblClickRow($event, rowIndex, row)"
|
|
10191
|
+
(visibilityChange)="rowVisible.next(row)"
|
|
10192
|
+
(mouseenter)="hoveredRowIndex = rowIndex"
|
|
10193
|
+
(mouseleave)="hoveredRowIndex = -1"
|
|
10194
|
+
>
|
|
10195
|
+
<ng-container *ngIf="isSingleColumnRow(row)">
|
|
10196
|
+
<td class="simple-grid-single-column-cell" [attr.colspan]="headerColumnsCopy.length">
|
|
10197
|
+
<co-simple-grid-cell
|
|
10198
|
+
[column]="columns[singleColumnIndex(row)]"
|
|
10199
|
+
[row]="row"
|
|
10200
|
+
[editMode]="false">
|
|
10201
|
+
</co-simple-grid-cell>
|
|
10202
|
+
</td>
|
|
10203
|
+
</ng-container>
|
|
10204
|
+
<ng-container *ngIf="!isSingleColumnRow(row)">
|
|
10205
|
+
<ng-container *ngFor="let column of headerColumnsCopy; let columnIndex = index">
|
|
10206
|
+
<td class="simple-grid-column-cell" *ngIf="columnIndex !== singleColumnIndex(row)">
|
|
10207
|
+
<co-simple-grid-cell
|
|
10208
|
+
[column]="column"
|
|
10209
|
+
[row]="row"
|
|
10210
|
+
[editMode]="inlineEdit && editing && rowIndex === editRowIndex"
|
|
10211
|
+
[fieldEditMode]="editCellIndex === columnIndex && rowIndex === editRowIndex"
|
|
10212
|
+
(cellClick)="handleCellClick($event, row, rowIndex, columnIndex)">
|
|
10213
|
+
</co-simple-grid-cell>
|
|
10214
|
+
<div *ngIf="column.resizable" class="simple-grid-column-sizer-placeholder"></div>
|
|
10215
|
+
</td>
|
|
10216
|
+
</ng-container>
|
|
10217
|
+
<ng-container *ngIf="inlineEdit && showRowButtons">
|
|
10218
|
+
<div class="icons-container" *ngIf="!editing">
|
|
10219
|
+
<co-icon class="icon-item icon-edit"
|
|
10220
|
+
[iconData]="icons.getIcon(Icons.PenToSquareSolid)" *ngIf="hoveredRowIndex === rowIndex"
|
|
10221
|
+
(click)="editRow($event, true, rowIndex); $event.stopPropagation()"></co-icon>
|
|
10222
|
+
<co-icon class="icon-item icon-delete"
|
|
10223
|
+
[iconData]="icons.getIcon(Icons.TrashBin)" *ngIf="hoveredRowIndex === rowIndex"
|
|
10224
|
+
(click)="selectTheRow(rowIndex); removeRow();"></co-icon>
|
|
10225
|
+
</div>
|
|
10226
|
+
<div class="icons-container">
|
|
10227
|
+
<co-button class="save-button"
|
|
10228
|
+
*ngIf="editing && (selectedRowIndex === rowIndex || (isNewRow && rowIndex === editRowIndex))"
|
|
10229
|
+
[iconData]="icons.getIcon(Icons.CheckDuotone)"
|
|
10230
|
+
(click)="validateAndSave(); $event.stopPropagation()"></co-button>
|
|
10231
|
+
<co-button class="close-button"
|
|
10232
|
+
*ngIf="editing && (selectedRowIndex === rowIndex || (isNewRow && rowIndex === editRowIndex))"
|
|
10233
|
+
[iconData]="icons.getIcon(Icons.CrossSkinny)"
|
|
10234
|
+
(click)="cancelEditRow(); $event.stopPropagation() "></co-button>
|
|
10235
|
+
</div>
|
|
10236
|
+
</ng-container>
|
|
10237
|
+
</ng-container>
|
|
10238
|
+
</tr>
|
|
10239
|
+
</co-form>
|
|
10240
|
+
</tbody>
|
|
10241
|
+
</table>
|
|
10242
|
+
<co-pagination-bar
|
|
10243
|
+
*ngIf="data?.length > rowsPerPage" class="pagination-bar"
|
|
10244
|
+
[itemsPerPage]="rowsPerPage"
|
|
10245
|
+
[currentPage]="currentPage"
|
|
10246
|
+
[totalItems]="data.length"
|
|
10247
|
+
[autoHide]="true"
|
|
10248
|
+
(previousClick)="goToPreviousPage()"
|
|
10249
|
+
(nextClick)="goToNextPage()"
|
|
10250
|
+
(pageClick)="setCurrentPage($event)">
|
|
10251
|
+
</co-pagination-bar>
|
|
10225
10252
|
`,
|
|
10226
10253
|
providers: [FormMasterService],
|
|
10227
10254
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
@@ -10238,6 +10265,7 @@ SimpleGridComponent.propDecorators = {
|
|
|
10238
10265
|
rowElements: [{ type: ViewChildren, args: ['rowElement',] }],
|
|
10239
10266
|
showAdd: [{ type: Input }],
|
|
10240
10267
|
showDelete: [{ type: Input }],
|
|
10268
|
+
deselectAllowed: [{ type: Input }],
|
|
10241
10269
|
editOnCellClick: [{ type: Input }],
|
|
10242
10270
|
rightToolbar: [{ type: Input }],
|
|
10243
10271
|
showGridSettings: [{ type: Input }],
|