@colijnit/corecomponents_v12 259.1.11 → 259.1.12
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 +94 -34
- 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 +17 -7
- package/fesm2015/colijnit-corecomponents_v12.js +59 -31
- 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
- package/colijnit-corecomponents_v12-259.1.10.tgz +0 -0
|
@@ -9321,7 +9321,8 @@ SimpleGridColumnDirective.propDecorators = {
|
|
|
9321
9321
|
};
|
|
9322
9322
|
|
|
9323
9323
|
class BaseSimpleGridComponent {
|
|
9324
|
-
constructor() {
|
|
9324
|
+
constructor(changeDetection) {
|
|
9325
|
+
this.changeDetection = changeDetection;
|
|
9325
9326
|
this.MIN_COLUMN_WIDTH = 50;
|
|
9326
9327
|
this.dataChanged = new Subject();
|
|
9327
9328
|
this.dragDropEnabled = false;
|
|
@@ -9337,6 +9338,7 @@ class BaseSimpleGridComponent {
|
|
|
9337
9338
|
this.emitDragDrop = false;
|
|
9338
9339
|
this.onDrop = new EventEmitter();
|
|
9339
9340
|
this.selectRow = new EventEmitter();
|
|
9341
|
+
this.deselectRow = new EventEmitter();
|
|
9340
9342
|
this.dblClickRow = new EventEmitter();
|
|
9341
9343
|
this.saveRow = new EventEmitter();
|
|
9342
9344
|
this.deleteRow = new EventEmitter();
|
|
@@ -9414,40 +9416,52 @@ class BaseSimpleGridComponent {
|
|
|
9414
9416
|
return row.singleColumnIndex;
|
|
9415
9417
|
}
|
|
9416
9418
|
prepareDataRow(row, index) {
|
|
9419
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
9420
|
+
});
|
|
9417
9421
|
}
|
|
9418
9422
|
_setColumns(columns) {
|
|
9419
9423
|
this.columns.push(...columns);
|
|
9420
9424
|
this.columns.sort((a, b) => a.order < b.order ? -1 : 1);
|
|
9421
9425
|
}
|
|
9422
9426
|
_prepareData() {
|
|
9423
|
-
|
|
9424
|
-
|
|
9425
|
-
|
|
9426
|
-
this.disabledRows.length = 0;
|
|
9427
|
-
if (this.columns && this.columns.length > 0) {
|
|
9428
|
-
this.headerColumns = this.columns.filter(c => !c.singleColumn);
|
|
9429
|
-
this.headerColumnsCopy = this.headerColumns;
|
|
9430
|
-
let singleColumnIndex = -1;
|
|
9431
|
-
for (let i = 0; i < this.columns.length; i++) {
|
|
9432
|
-
if (this.columns[i].singleColumn) {
|
|
9433
|
-
singleColumnIndex = i;
|
|
9434
|
-
break;
|
|
9435
|
-
}
|
|
9427
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
9428
|
+
if (this._prepared) {
|
|
9429
|
+
return;
|
|
9436
9430
|
}
|
|
9437
|
-
|
|
9438
|
-
if (
|
|
9439
|
-
|
|
9440
|
-
|
|
9441
|
-
|
|
9442
|
-
|
|
9443
|
-
|
|
9431
|
+
this.disabledRows.length = 0;
|
|
9432
|
+
if (this.columns && this.columns.length > 0) {
|
|
9433
|
+
this.headerColumns = this.columns.filter(c => !c.singleColumn);
|
|
9434
|
+
this.headerColumnsCopy = this.headerColumns;
|
|
9435
|
+
let singleColumnIndex = -1;
|
|
9436
|
+
for (let i = 0; i < this.columns.length; i++) {
|
|
9437
|
+
if (this.columns[i].singleColumn) {
|
|
9438
|
+
singleColumnIndex = i;
|
|
9439
|
+
break;
|
|
9440
|
+
}
|
|
9441
|
+
}
|
|
9442
|
+
// first check if there's single column data
|
|
9443
|
+
if (this.data && this.data.length > 0) {
|
|
9444
|
+
if (singleColumnIndex > -1) {
|
|
9445
|
+
const field = this.columns[singleColumnIndex].field;
|
|
9446
|
+
for (let i = 0; i < this.data.length; i++) { // then mark row as single column row
|
|
9447
|
+
if (this.data[i][field] !== undefined && this.data[i][field] !== null && this.data[i][field] !== "") {
|
|
9448
|
+
// bit nasty to add prop, but cool for now
|
|
9449
|
+
this.data[i].singleColumnIndex = singleColumnIndex;
|
|
9450
|
+
}
|
|
9451
|
+
yield this.prepareDataRow(this.data[i], i);
|
|
9452
|
+
}
|
|
9453
|
+
}
|
|
9454
|
+
else {
|
|
9455
|
+
for (let j = 0; j < this.data.length; j++) {
|
|
9456
|
+
yield this.prepareDataRow(this.data[j], j);
|
|
9457
|
+
}
|
|
9444
9458
|
}
|
|
9445
|
-
this.prepareDataRow(this.data[i], i);
|
|
9446
9459
|
}
|
|
9460
|
+
this._prepared = true;
|
|
9447
9461
|
}
|
|
9448
|
-
this.
|
|
9449
|
-
|
|
9450
|
-
|
|
9462
|
+
this._resizeColumnsToFit();
|
|
9463
|
+
this.changeDetection.detectChanges();
|
|
9464
|
+
});
|
|
9451
9465
|
}
|
|
9452
9466
|
_resizeColumnsToFit() {
|
|
9453
9467
|
const calculateColumns = this.columns.filter(c => !c.autoFit && !c.width);
|
|
@@ -9467,6 +9481,9 @@ class BaseSimpleGridComponent {
|
|
|
9467
9481
|
BaseSimpleGridComponent.decorators = [
|
|
9468
9482
|
{ type: Directive }
|
|
9469
9483
|
];
|
|
9484
|
+
BaseSimpleGridComponent.ctorParameters = () => [
|
|
9485
|
+
{ type: ChangeDetectorRef }
|
|
9486
|
+
];
|
|
9470
9487
|
BaseSimpleGridComponent.propDecorators = {
|
|
9471
9488
|
content: [{ type: ContentChildren, args: [SimpleGridColumnDirective,] }],
|
|
9472
9489
|
data: [{ type: Input }],
|
|
@@ -9481,6 +9498,7 @@ BaseSimpleGridComponent.propDecorators = {
|
|
|
9481
9498
|
extraColumns: [{ type: Input }],
|
|
9482
9499
|
onDrop: [{ type: Output }],
|
|
9483
9500
|
selectRow: [{ type: Output }],
|
|
9501
|
+
deselectRow: [{ type: Output }],
|
|
9484
9502
|
dblClickRow: [{ type: Output }],
|
|
9485
9503
|
saveRow: [{ type: Output }],
|
|
9486
9504
|
deleteRow: [{ type: Output }],
|
|
@@ -9491,14 +9509,15 @@ BaseSimpleGridComponent.propDecorators = {
|
|
|
9491
9509
|
};
|
|
9492
9510
|
|
|
9493
9511
|
class SimpleGridComponent extends BaseSimpleGridComponent {
|
|
9494
|
-
constructor(icons,
|
|
9495
|
-
super();
|
|
9512
|
+
constructor(icons, changeDetection, _formMaster) {
|
|
9513
|
+
super(changeDetection);
|
|
9496
9514
|
this.icons = icons;
|
|
9497
|
-
this.
|
|
9515
|
+
this.changeDetection = changeDetection;
|
|
9498
9516
|
this._formMaster = _formMaster;
|
|
9499
9517
|
this.defaultTextAlign = ColumnAlign.Left;
|
|
9500
9518
|
this.showAdd = false;
|
|
9501
9519
|
this.showDelete = false;
|
|
9520
|
+
this.deselectAllowed = false;
|
|
9502
9521
|
this.editOnCellClick = true;
|
|
9503
9522
|
this.rightToolbar = false;
|
|
9504
9523
|
this.showGridSettings = false;
|
|
@@ -9540,7 +9559,7 @@ class SimpleGridComponent extends BaseSimpleGridComponent {
|
|
|
9540
9559
|
this._nextAvailableCellToEdit(!event.shiftKey, this.editCellIndex)
|
|
9541
9560
|
.then((index) => {
|
|
9542
9561
|
this.editCellIndex = index;
|
|
9543
|
-
this.
|
|
9562
|
+
this.changeDetection.markForCheck();
|
|
9544
9563
|
});
|
|
9545
9564
|
this._detectChanges();
|
|
9546
9565
|
}
|
|
@@ -9683,6 +9702,12 @@ class SimpleGridComponent extends BaseSimpleGridComponent {
|
|
|
9683
9702
|
this.selectRow.next(this.data[absoluteIndex]);
|
|
9684
9703
|
}
|
|
9685
9704
|
}
|
|
9705
|
+
else if (this.selectedRowIndex === index && this.deselectAllowed && ((this.editing && this.validateAndSave()) || !this.editing)) {
|
|
9706
|
+
this.selectedRowIndex = -1;
|
|
9707
|
+
if (emit) {
|
|
9708
|
+
this.deselectRow.next();
|
|
9709
|
+
}
|
|
9710
|
+
}
|
|
9686
9711
|
this._detectChanges();
|
|
9687
9712
|
}
|
|
9688
9713
|
handleDblClickRow(event, index, row) {
|
|
@@ -9881,7 +9906,9 @@ class SimpleGridComponent extends BaseSimpleGridComponent {
|
|
|
9881
9906
|
return hasSelectedTrue ? items.filter(item => item.selected === true) : items;
|
|
9882
9907
|
}
|
|
9883
9908
|
prepareDataRow(row, index) {
|
|
9884
|
-
this
|
|
9909
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
9910
|
+
yield this.isRowDisabled(row, index);
|
|
9911
|
+
});
|
|
9885
9912
|
}
|
|
9886
9913
|
_resetDblClick() {
|
|
9887
9914
|
setTimeout(() => {
|
|
@@ -10018,7 +10045,7 @@ class SimpleGridComponent extends BaseSimpleGridComponent {
|
|
|
10018
10045
|
this._detectChanges();
|
|
10019
10046
|
}
|
|
10020
10047
|
_detectChanges() {
|
|
10021
|
-
this.
|
|
10048
|
+
this.changeDetection.detectChanges();
|
|
10022
10049
|
}
|
|
10023
10050
|
_resetEdit() {
|
|
10024
10051
|
this._newRow = false;
|
|
@@ -10219,6 +10246,7 @@ SimpleGridComponent.propDecorators = {
|
|
|
10219
10246
|
rowElements: [{ type: ViewChildren, args: ['rowElement',] }],
|
|
10220
10247
|
showAdd: [{ type: Input }],
|
|
10221
10248
|
showDelete: [{ type: Input }],
|
|
10249
|
+
deselectAllowed: [{ type: Input }],
|
|
10222
10250
|
editOnCellClick: [{ type: Input }],
|
|
10223
10251
|
rightToolbar: [{ type: Input }],
|
|
10224
10252
|
showGridSettings: [{ type: Input }],
|