@colijnit/corecomponents_v12 257.1.37 → 257.1.38
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 +97 -36
- package/bundles/colijnit-corecomponents_v12.umd.js.map +1 -1
- package/colijnit-corecomponents_v12.metadata.json +1 -1
- package/esm2015/lib/components/simple-grid/base-simple-grid.component.js +46 -27
- package/esm2015/lib/components/simple-grid/simple-grid.component.js +20 -9
- package/fesm2015/colijnit-corecomponents_v12.js +62 -33
- 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
|
@@ -9339,7 +9339,8 @@ SimpleGridColumnDirective.propDecorators = {
|
|
|
9339
9339
|
};
|
|
9340
9340
|
|
|
9341
9341
|
class BaseSimpleGridComponent {
|
|
9342
|
-
constructor() {
|
|
9342
|
+
constructor(changeDetection) {
|
|
9343
|
+
this.changeDetection = changeDetection;
|
|
9343
9344
|
this.MIN_COLUMN_WIDTH = 50;
|
|
9344
9345
|
this.dataChanged = new Subject();
|
|
9345
9346
|
this.dragDropEnabled = false;
|
|
@@ -9355,6 +9356,7 @@ class BaseSimpleGridComponent {
|
|
|
9355
9356
|
this.emitDragDrop = false;
|
|
9356
9357
|
this.onDrop = new EventEmitter();
|
|
9357
9358
|
this.selectRow = new EventEmitter();
|
|
9359
|
+
this.deselectRow = new EventEmitter();
|
|
9358
9360
|
this.dblClickRow = new EventEmitter();
|
|
9359
9361
|
this.saveRow = new EventEmitter();
|
|
9360
9362
|
this.deleteRow = new EventEmitter();
|
|
@@ -9432,40 +9434,52 @@ class BaseSimpleGridComponent {
|
|
|
9432
9434
|
return row.singleColumnIndex;
|
|
9433
9435
|
}
|
|
9434
9436
|
prepareDataRow(row, index) {
|
|
9437
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
9438
|
+
});
|
|
9435
9439
|
}
|
|
9436
9440
|
_setColumns(columns) {
|
|
9437
9441
|
this.columns.push(...columns);
|
|
9438
9442
|
this.columns.sort((a, b) => a.order < b.order ? -1 : 1);
|
|
9439
9443
|
}
|
|
9440
9444
|
_prepareData() {
|
|
9441
|
-
|
|
9442
|
-
|
|
9443
|
-
|
|
9444
|
-
this.disabledRows.length = 0;
|
|
9445
|
-
if (this.columns && this.columns.length > 0) {
|
|
9446
|
-
this.headerColumns = this.columns.filter(c => !c.singleColumn);
|
|
9447
|
-
this.headerColumnsCopy = this.headerColumns;
|
|
9448
|
-
let singleColumnIndex = -1;
|
|
9449
|
-
for (let i = 0; i < this.columns.length; i++) {
|
|
9450
|
-
if (this.columns[i].singleColumn) {
|
|
9451
|
-
singleColumnIndex = i;
|
|
9452
|
-
break;
|
|
9453
|
-
}
|
|
9445
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
9446
|
+
if (this._prepared) {
|
|
9447
|
+
return;
|
|
9454
9448
|
}
|
|
9455
|
-
|
|
9456
|
-
if (
|
|
9457
|
-
|
|
9458
|
-
|
|
9459
|
-
|
|
9460
|
-
|
|
9461
|
-
|
|
9449
|
+
this.disabledRows.length = 0;
|
|
9450
|
+
if (this.columns && this.columns.length > 0) {
|
|
9451
|
+
this.headerColumns = this.columns.filter(c => !c.singleColumn);
|
|
9452
|
+
this.headerColumnsCopy = this.headerColumns;
|
|
9453
|
+
let singleColumnIndex = -1;
|
|
9454
|
+
for (let i = 0; i < this.columns.length; i++) {
|
|
9455
|
+
if (this.columns[i].singleColumn) {
|
|
9456
|
+
singleColumnIndex = i;
|
|
9457
|
+
break;
|
|
9458
|
+
}
|
|
9459
|
+
}
|
|
9460
|
+
// first check if there's single column data
|
|
9461
|
+
if (this.data && this.data.length > 0) {
|
|
9462
|
+
if (singleColumnIndex > -1) {
|
|
9463
|
+
const field = this.columns[singleColumnIndex].field;
|
|
9464
|
+
for (let i = 0; i < this.data.length; i++) { // then mark row as single column row
|
|
9465
|
+
if (this.data[i][field] !== undefined && this.data[i][field] !== null && this.data[i][field] !== "") {
|
|
9466
|
+
// bit nasty to add prop, but cool for now
|
|
9467
|
+
this.data[i].singleColumnIndex = singleColumnIndex;
|
|
9468
|
+
}
|
|
9469
|
+
yield this.prepareDataRow(this.data[i], i);
|
|
9470
|
+
}
|
|
9471
|
+
}
|
|
9472
|
+
else {
|
|
9473
|
+
for (let j = 0; j < this.data.length; j++) {
|
|
9474
|
+
yield this.prepareDataRow(this.data[j], j);
|
|
9475
|
+
}
|
|
9462
9476
|
}
|
|
9463
|
-
this.prepareDataRow(this.data[i], i);
|
|
9464
9477
|
}
|
|
9478
|
+
this._prepared = true;
|
|
9465
9479
|
}
|
|
9466
|
-
this.
|
|
9467
|
-
|
|
9468
|
-
|
|
9480
|
+
this._resizeColumnsToFit();
|
|
9481
|
+
this.changeDetection.detectChanges();
|
|
9482
|
+
});
|
|
9469
9483
|
}
|
|
9470
9484
|
_resizeColumnsToFit() {
|
|
9471
9485
|
const calculateColumns = this.columns.filter(c => !c.autoFit && !c.width);
|
|
@@ -9485,6 +9499,9 @@ class BaseSimpleGridComponent {
|
|
|
9485
9499
|
BaseSimpleGridComponent.decorators = [
|
|
9486
9500
|
{ type: Directive }
|
|
9487
9501
|
];
|
|
9502
|
+
BaseSimpleGridComponent.ctorParameters = () => [
|
|
9503
|
+
{ type: ChangeDetectorRef }
|
|
9504
|
+
];
|
|
9488
9505
|
BaseSimpleGridComponent.propDecorators = {
|
|
9489
9506
|
content: [{ type: ContentChildren, args: [SimpleGridColumnDirective,] }],
|
|
9490
9507
|
data: [{ type: Input }],
|
|
@@ -9499,6 +9516,7 @@ BaseSimpleGridComponent.propDecorators = {
|
|
|
9499
9516
|
extraColumns: [{ type: Input }],
|
|
9500
9517
|
onDrop: [{ type: Output }],
|
|
9501
9518
|
selectRow: [{ type: Output }],
|
|
9519
|
+
deselectRow: [{ type: Output }],
|
|
9502
9520
|
dblClickRow: [{ type: Output }],
|
|
9503
9521
|
saveRow: [{ type: Output }],
|
|
9504
9522
|
deleteRow: [{ type: Output }],
|
|
@@ -9631,15 +9649,16 @@ ExcelExportService.decorators = [
|
|
|
9631
9649
|
];
|
|
9632
9650
|
|
|
9633
9651
|
class SimpleGridComponent extends BaseSimpleGridComponent {
|
|
9634
|
-
constructor(icons,
|
|
9635
|
-
super();
|
|
9652
|
+
constructor(icons, changeDetection, _formMaster, excelExportService) {
|
|
9653
|
+
super(changeDetection);
|
|
9636
9654
|
this.icons = icons;
|
|
9637
|
-
this.
|
|
9655
|
+
this.changeDetection = changeDetection;
|
|
9638
9656
|
this._formMaster = _formMaster;
|
|
9639
9657
|
this.excelExportService = excelExportService;
|
|
9640
9658
|
this.defaultTextAlign = ColumnAlign.Left;
|
|
9641
9659
|
this.showAdd = false;
|
|
9642
9660
|
this.showDelete = false;
|
|
9661
|
+
this.deselectAllowed = false;
|
|
9643
9662
|
this.editOnCellClick = true;
|
|
9644
9663
|
this.rightToolbar = false;
|
|
9645
9664
|
this.showGridSettings = false;
|
|
@@ -9677,7 +9696,7 @@ class SimpleGridComponent extends BaseSimpleGridComponent {
|
|
|
9677
9696
|
this._nextAvailableCellToEdit(!event.shiftKey, this.editCellIndex)
|
|
9678
9697
|
.then((index) => {
|
|
9679
9698
|
this.editCellIndex = index;
|
|
9680
|
-
this.
|
|
9699
|
+
this.changeDetection.markForCheck();
|
|
9681
9700
|
});
|
|
9682
9701
|
this._detectChanges();
|
|
9683
9702
|
}
|
|
@@ -9776,9 +9795,16 @@ class SimpleGridComponent extends BaseSimpleGridComponent {
|
|
|
9776
9795
|
selectTheRow(index, emit = true) {
|
|
9777
9796
|
if (this.selectedRowIndex === -1 || (this.selectedRowIndex !== index && ((this.editing && this.validateAndSave()) || !this.editing))) {
|
|
9778
9797
|
this.selectedRowIndex = index;
|
|
9798
|
+
const absoluteIndex = this.rowsPerPage ? (this.currentPage - 1) * this.rowsPerPage + index : index;
|
|
9799
|
+
if (emit) {
|
|
9800
|
+
this.selectRow.next(this.data[absoluteIndex]);
|
|
9801
|
+
}
|
|
9779
9802
|
}
|
|
9780
|
-
if (
|
|
9781
|
-
this.
|
|
9803
|
+
else if (this.selectedRowIndex === index && this.deselectAllowed && ((this.editing && this.validateAndSave()) || !this.editing)) {
|
|
9804
|
+
this.selectedRowIndex = -1;
|
|
9805
|
+
if (emit) {
|
|
9806
|
+
this.deselectRow.next();
|
|
9807
|
+
}
|
|
9782
9808
|
}
|
|
9783
9809
|
this._detectChanges();
|
|
9784
9810
|
}
|
|
@@ -9959,7 +9985,9 @@ class SimpleGridComponent extends BaseSimpleGridComponent {
|
|
|
9959
9985
|
return hasSelectedTrue ? items.filter(item => item.selected === true) : items;
|
|
9960
9986
|
}
|
|
9961
9987
|
prepareDataRow(row, index) {
|
|
9962
|
-
this
|
|
9988
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
9989
|
+
yield this.isRowDisabled(row, index);
|
|
9990
|
+
});
|
|
9963
9991
|
}
|
|
9964
9992
|
_resetDblClick() {
|
|
9965
9993
|
setTimeout(() => {
|
|
@@ -10088,7 +10116,7 @@ class SimpleGridComponent extends BaseSimpleGridComponent {
|
|
|
10088
10116
|
this.currentPage = page;
|
|
10089
10117
|
}
|
|
10090
10118
|
_detectChanges() {
|
|
10091
|
-
this.
|
|
10119
|
+
this.changeDetection.detectChanges();
|
|
10092
10120
|
}
|
|
10093
10121
|
_resetEdit() {
|
|
10094
10122
|
this._newRow = false;
|
|
@@ -10267,6 +10295,7 @@ SimpleGridComponent.propDecorators = {
|
|
|
10267
10295
|
headerCells: [{ type: ViewChildren, args: ['headerCell',] }],
|
|
10268
10296
|
showAdd: [{ type: Input }],
|
|
10269
10297
|
showDelete: [{ type: Input }],
|
|
10298
|
+
deselectAllowed: [{ type: Input }],
|
|
10270
10299
|
editOnCellClick: [{ type: Input }],
|
|
10271
10300
|
rightToolbar: [{ type: Input }],
|
|
10272
10301
|
showGridSettings: [{ type: Input }],
|