@colijnit/corecomponents_v12 262.1.4 → 262.1.5
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.
|
@@ -11623,6 +11623,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
|
|
|
11623
11623
|
|
|
11624
11624
|
class BaseSimpleGridComponent {
|
|
11625
11625
|
changeDetection;
|
|
11626
|
+
differs;
|
|
11626
11627
|
MIN_COLUMN_WIDTH = 50;
|
|
11627
11628
|
dataChanged = new Subject();
|
|
11628
11629
|
set content(columnComponents) {
|
|
@@ -11632,6 +11633,7 @@ class BaseSimpleGridComponent {
|
|
|
11632
11633
|
set data(value) {
|
|
11633
11634
|
this._data = value;
|
|
11634
11635
|
this._prepareData();
|
|
11636
|
+
this._currentDataJSON = JSON.stringify(this._data);
|
|
11635
11637
|
this.dataChanged.next();
|
|
11636
11638
|
}
|
|
11637
11639
|
get data() {
|
|
@@ -11683,11 +11685,21 @@ class BaseSimpleGridComponent {
|
|
|
11683
11685
|
_data = [];
|
|
11684
11686
|
_exportData = [];
|
|
11685
11687
|
disabledRows = [];
|
|
11688
|
+
rowsWithAddedClasses = new Map();
|
|
11686
11689
|
_columnForResize;
|
|
11687
|
-
|
|
11690
|
+
_headersPrepared = false;
|
|
11688
11691
|
_startMousePositionX;
|
|
11689
|
-
|
|
11692
|
+
_currentDataJSON;
|
|
11693
|
+
constructor(changeDetection, differs) {
|
|
11690
11694
|
this.changeDetection = changeDetection;
|
|
11695
|
+
this.differs = differs;
|
|
11696
|
+
}
|
|
11697
|
+
ngDoCheck() {
|
|
11698
|
+
const dataJSON = JSON.stringify(this.data);
|
|
11699
|
+
if (dataJSON !== this._currentDataJSON) {
|
|
11700
|
+
this.dataHasChanged();
|
|
11701
|
+
this._currentDataJSON = dataJSON;
|
|
11702
|
+
}
|
|
11691
11703
|
}
|
|
11692
11704
|
handleSizerMouseDown(event, column) {
|
|
11693
11705
|
this._setWidthOfAllColumns();
|
|
@@ -11717,10 +11729,13 @@ class BaseSimpleGridComponent {
|
|
|
11717
11729
|
}
|
|
11718
11730
|
}
|
|
11719
11731
|
isSingleColumnRow(row) {
|
|
11720
|
-
return row.hasOwnProperty('singleColumnIndex');
|
|
11732
|
+
return row && row.hasOwnProperty('singleColumnIndex');
|
|
11721
11733
|
}
|
|
11722
11734
|
singleColumnIndex(row) {
|
|
11723
|
-
return row.singleColumnIndex;
|
|
11735
|
+
return row ? row.singleColumnIndex : 0;
|
|
11736
|
+
}
|
|
11737
|
+
dataHasChanged() {
|
|
11738
|
+
this._prepareDataRows();
|
|
11724
11739
|
}
|
|
11725
11740
|
async prepareDataRow(row, index) {
|
|
11726
11741
|
}
|
|
@@ -11729,41 +11744,42 @@ class BaseSimpleGridComponent {
|
|
|
11729
11744
|
this.columns.sort((a, b) => a.order < b.order ? -1 : 1);
|
|
11730
11745
|
}
|
|
11731
11746
|
async _prepareData() {
|
|
11732
|
-
if (this._prepared) {
|
|
11733
|
-
return;
|
|
11734
|
-
}
|
|
11735
11747
|
this.disabledRows.length = 0;
|
|
11736
|
-
if (this.columns && this.columns.length > 0) {
|
|
11748
|
+
if (this.columns && this.columns.length > 0 && !this._headersPrepared) {
|
|
11737
11749
|
this.headerColumns = this.columns.filter(c => !c.singleColumn);
|
|
11738
11750
|
this.headerColumnsCopy = this.headerColumns;
|
|
11739
|
-
|
|
11740
|
-
|
|
11741
|
-
|
|
11742
|
-
|
|
11743
|
-
|
|
11744
|
-
|
|
11751
|
+
this._headersPrepared = true;
|
|
11752
|
+
}
|
|
11753
|
+
await this._prepareDataRows();
|
|
11754
|
+
this._resizeColumnsToFit();
|
|
11755
|
+
this.changeDetection.detectChanges();
|
|
11756
|
+
}
|
|
11757
|
+
async _prepareDataRows() {
|
|
11758
|
+
let singleColumnIndex = -1;
|
|
11759
|
+
for (let i = 0; i < this.columns.length; i++) {
|
|
11760
|
+
if (this.columns[i].singleColumn) {
|
|
11761
|
+
singleColumnIndex = i;
|
|
11762
|
+
break;
|
|
11745
11763
|
}
|
|
11746
|
-
|
|
11747
|
-
|
|
11748
|
-
|
|
11749
|
-
|
|
11750
|
-
|
|
11751
|
-
|
|
11752
|
-
|
|
11753
|
-
|
|
11754
|
-
|
|
11755
|
-
await this.prepareDataRow(this.data[i], i);
|
|
11764
|
+
}
|
|
11765
|
+
// first check if there's single column data
|
|
11766
|
+
if (this.data && this.data.length > 0) {
|
|
11767
|
+
if (singleColumnIndex > -1) {
|
|
11768
|
+
const field = this.columns[singleColumnIndex].field;
|
|
11769
|
+
for (let i = 0; i < this.data.length; i++) { // then mark row as single column row
|
|
11770
|
+
if (this.data[i][field] !== undefined && this.data[i][field] !== null && this.data[i][field] !== "") {
|
|
11771
|
+
// bit nasty to add prop, but cool for now
|
|
11772
|
+
this.data[i].singleColumnIndex = singleColumnIndex;
|
|
11756
11773
|
}
|
|
11774
|
+
await this.prepareDataRow(this.data[i], i);
|
|
11757
11775
|
}
|
|
11758
|
-
|
|
11759
|
-
|
|
11760
|
-
|
|
11761
|
-
|
|
11776
|
+
}
|
|
11777
|
+
else {
|
|
11778
|
+
for (let j = 0; j < this.data.length; j++) {
|
|
11779
|
+
await this.prepareDataRow(this.data[j], j);
|
|
11762
11780
|
}
|
|
11763
11781
|
}
|
|
11764
|
-
this._prepared = true;
|
|
11765
11782
|
}
|
|
11766
|
-
this._resizeColumnsToFit();
|
|
11767
11783
|
this.changeDetection.detectChanges();
|
|
11768
11784
|
}
|
|
11769
11785
|
_resizeColumnsToFit() {
|
|
@@ -11780,12 +11796,12 @@ class BaseSimpleGridComponent {
|
|
|
11780
11796
|
}
|
|
11781
11797
|
});
|
|
11782
11798
|
}
|
|
11783
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: BaseSimpleGridComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
11799
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: BaseSimpleGridComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i0.IterableDiffers }], target: i0.ɵɵFactoryTarget.Directive });
|
|
11784
11800
|
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.16", type: BaseSimpleGridComponent, isStandalone: true, inputs: { data: "data", exportData: "exportData", dragDropEnabled: "dragDropEnabled", resizable: "resizable", inlineEdit: "inlineEdit", showEdit: "showEdit", showToolbar: "showToolbar", autoAddRow: "autoAddRow", useCustomExcelExport: "useCustomExcelExport", emitDragDrop: "emitDragDrop", extraColumns: "extraColumns" }, outputs: { onDrop: "onDrop", selectRow: "selectRow", deselectRow: "deselectRow", dblClickRow: "dblClickRow", saveRow: "saveRow", deleteRow: "deleteRow", addRow: "addRow", rowVisible: "rowVisible", paginationPageChange: "paginationPageChange", customExcelExport: "customExcelExport" }, host: { listeners: { "document:mousemove": "handleMouseMove($event)", "document:mouseup": "handleMouseUp($event)" } }, queries: [{ propertyName: "content", predicate: SimpleGridColumnDirective }], ngImport: i0 });
|
|
11785
11801
|
}
|
|
11786
11802
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: BaseSimpleGridComponent, decorators: [{
|
|
11787
11803
|
type: Directive
|
|
11788
|
-
}], ctorParameters: () => [{ type: i0.ChangeDetectorRef }], propDecorators: { content: [{
|
|
11804
|
+
}], ctorParameters: () => [{ type: i0.ChangeDetectorRef }, { type: i0.IterableDiffers }], propDecorators: { content: [{
|
|
11789
11805
|
type: ContentChildren,
|
|
11790
11806
|
args: [SimpleGridColumnDirective]
|
|
11791
11807
|
}], data: [{
|
|
@@ -12415,6 +12431,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
|
|
|
12415
12431
|
class SimpleGridComponent extends BaseSimpleGridComponent {
|
|
12416
12432
|
icons;
|
|
12417
12433
|
changeDetection;
|
|
12434
|
+
differs;
|
|
12418
12435
|
_formMaster;
|
|
12419
12436
|
defaultTextAlign = ColumnAlign.Left;
|
|
12420
12437
|
scrollDirections = ScrollDirection;
|
|
@@ -12433,6 +12450,7 @@ class SimpleGridComponent extends BaseSimpleGridComponent {
|
|
|
12433
12450
|
showGridSettings = false;
|
|
12434
12451
|
rowsPerPage = 50;
|
|
12435
12452
|
rowDisabledFn;
|
|
12453
|
+
rowConditionalClassFn;
|
|
12436
12454
|
showColumnSort = false;
|
|
12437
12455
|
showRowButtons = false;
|
|
12438
12456
|
resetPageOnDataChange = true;
|
|
@@ -12481,10 +12499,11 @@ class SimpleGridComponent extends BaseSimpleGridComponent {
|
|
|
12481
12499
|
_newRowReference;
|
|
12482
12500
|
IconCacheService = IconCacheService;
|
|
12483
12501
|
CoreComponentsIcon = CoreComponentsIcon;
|
|
12484
|
-
constructor(icons, changeDetection, _formMaster) {
|
|
12485
|
-
super(changeDetection);
|
|
12502
|
+
constructor(icons, changeDetection, differs, _formMaster) {
|
|
12503
|
+
super(changeDetection, differs);
|
|
12486
12504
|
this.icons = icons;
|
|
12487
12505
|
this.changeDetection = changeDetection;
|
|
12506
|
+
this.differs = differs;
|
|
12488
12507
|
this._formMaster = _formMaster;
|
|
12489
12508
|
this.dataChanged.subscribe(() => {
|
|
12490
12509
|
if (this.resetPageOnDataChange) {
|
|
@@ -12518,6 +12537,22 @@ class SimpleGridComponent extends BaseSimpleGridComponent {
|
|
|
12518
12537
|
return false;
|
|
12519
12538
|
}
|
|
12520
12539
|
}
|
|
12540
|
+
getRowConditionalClasses(idx) {
|
|
12541
|
+
return this.rowsWithAddedClasses.get(idx);
|
|
12542
|
+
}
|
|
12543
|
+
async doesRowHaveConditionalClasses(row, index) {
|
|
12544
|
+
if (this.rowConditionalClassFn && (typeof this.rowConditionalClassFn === 'function')) {
|
|
12545
|
+
const classes = await this.rowConditionalClassFn.call(this, row);
|
|
12546
|
+
if (classes && (classes.length > 0)) {
|
|
12547
|
+
this.rowsWithAddedClasses.set(index, classes);
|
|
12548
|
+
}
|
|
12549
|
+
else {
|
|
12550
|
+
if (this.rowsWithAddedClasses.has(index)) {
|
|
12551
|
+
this.rowsWithAddedClasses.delete(index);
|
|
12552
|
+
}
|
|
12553
|
+
}
|
|
12554
|
+
}
|
|
12555
|
+
}
|
|
12521
12556
|
async addNewRow() {
|
|
12522
12557
|
if (this.inlineEdit) {
|
|
12523
12558
|
const valid = this.validateAndSave();
|
|
@@ -12828,13 +12863,15 @@ class SimpleGridComponent extends BaseSimpleGridComponent {
|
|
|
12828
12863
|
get isNewRow() {
|
|
12829
12864
|
return this._newRow;
|
|
12830
12865
|
}
|
|
12866
|
+
async prepareDataRow(row, index) {
|
|
12867
|
+
console.log('Row changes, rechecking rows for classes');
|
|
12868
|
+
await this.isRowDisabled(row, index);
|
|
12869
|
+
await this.doesRowHaveConditionalClasses(row, index);
|
|
12870
|
+
}
|
|
12831
12871
|
_filterSelectedOrReturnAll(items) {
|
|
12832
12872
|
const hasSelectedTrue = items.some(item => item.selected === true);
|
|
12833
12873
|
return hasSelectedTrue ? items.filter(item => item.selected === true) : items;
|
|
12834
12874
|
}
|
|
12835
|
-
async prepareDataRow(row, index) {
|
|
12836
|
-
await this.isRowDisabled(row, index);
|
|
12837
|
-
}
|
|
12838
12875
|
_resetDblClick() {
|
|
12839
12876
|
setTimeout(() => {
|
|
12840
12877
|
this._doubleClicked = false;
|
|
@@ -12988,8 +13025,8 @@ class SimpleGridComponent extends BaseSimpleGridComponent {
|
|
|
12988
13025
|
behavior: "smooth"
|
|
12989
13026
|
});
|
|
12990
13027
|
}
|
|
12991
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: SimpleGridComponent, deps: [{ token: IconCacheService }, { token: i0.ChangeDetectorRef }, { token: FormMasterService }], target: i0.ɵɵFactoryTarget.Component });
|
|
12992
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.16", type: SimpleGridComponent, isStandalone: false, selector: "co-simple-grid", inputs: { showAdd: "showAdd", showDelete: "showDelete", deselectAllowed: "deselectAllowed", editOnCellClick: "editOnCellClick", rightToolbar: "rightToolbar", showGridSettings: "showGridSettings", rowsPerPage: "rowsPerPage", rowDisabledFn: "rowDisabledFn", showColumnSort: "showColumnSort", showRowButtons: "showRowButtons", resetPageOnDataChange: "resetPageOnDataChange", scrollOnRowAction: "scrollOnRowAction", scrollDirection: "scrollDirection", canRowBeEdittedFn: "canRowBeEdittedFn" }, host: { listeners: { "keydown": "handleKeyDown($event)" }, properties: { "class.co-simple-grid": "this.showClass" } }, providers: [FormMasterService], viewQueries: [{ propertyName: "headerCells", predicate: ["headerCell"], descendants: true }, { propertyName: "rowElements", predicate: ["rowElement"], descendants: true }], usesInheritance: true, ngImport: i0, template: `
|
|
13028
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: SimpleGridComponent, deps: [{ token: IconCacheService }, { token: i0.ChangeDetectorRef }, { token: i0.IterableDiffers }, { token: FormMasterService }], target: i0.ɵɵFactoryTarget.Component });
|
|
13029
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.16", type: SimpleGridComponent, isStandalone: false, selector: "co-simple-grid", inputs: { showAdd: "showAdd", showDelete: "showDelete", deselectAllowed: "deselectAllowed", editOnCellClick: "editOnCellClick", rightToolbar: "rightToolbar", showGridSettings: "showGridSettings", rowsPerPage: "rowsPerPage", rowDisabledFn: "rowDisabledFn", rowConditionalClassFn: "rowConditionalClassFn", showColumnSort: "showColumnSort", showRowButtons: "showRowButtons", resetPageOnDataChange: "resetPageOnDataChange", scrollOnRowAction: "scrollOnRowAction", scrollDirection: "scrollDirection", canRowBeEdittedFn: "canRowBeEdittedFn" }, host: { listeners: { "keydown": "handleKeyDown($event)" }, properties: { "class.co-simple-grid": "this.showClass" } }, providers: [FormMasterService], viewQueries: [{ propertyName: "headerCells", predicate: ["headerCell"], descendants: true }, { propertyName: "rowElements", predicate: ["rowElement"], descendants: true }], usesInheritance: true, ngImport: i0, template: `
|
|
12993
13030
|
@if (showToolbar) {
|
|
12994
13031
|
<co-grid-toolbar
|
|
12995
13032
|
[class.right]="rightToolbar"
|
|
@@ -13115,6 +13152,7 @@ class SimpleGridComponent extends BaseSimpleGridComponent {
|
|
|
13115
13152
|
[class.selected]="rowIndex === selectedRowIndex && !editing" observeVisibility
|
|
13116
13153
|
[class.disabled]="getIsRowDisabled(rowIndex)"
|
|
13117
13154
|
[class.editing]="rowIndex === editRowIndex"
|
|
13155
|
+
[ngClass]="getRowConditionalClasses(rowIndex)"
|
|
13118
13156
|
cdkDrag
|
|
13119
13157
|
(click)="handleClickRow($event, rowIndex)" (dblclick)="handleDblClickRow($event, rowIndex, row)"
|
|
13120
13158
|
(visibilityChange)="rowVisible.next(row)"
|
|
@@ -13321,6 +13359,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
|
|
|
13321
13359
|
[class.selected]="rowIndex === selectedRowIndex && !editing" observeVisibility
|
|
13322
13360
|
[class.disabled]="getIsRowDisabled(rowIndex)"
|
|
13323
13361
|
[class.editing]="rowIndex === editRowIndex"
|
|
13362
|
+
[ngClass]="getRowConditionalClasses(rowIndex)"
|
|
13324
13363
|
cdkDrag
|
|
13325
13364
|
(click)="handleClickRow($event, rowIndex)" (dblclick)="handleDblClickRow($event, rowIndex, row)"
|
|
13326
13365
|
(visibilityChange)="rowVisible.next(row)"
|
|
@@ -13401,7 +13440,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
|
|
|
13401
13440
|
encapsulation: ViewEncapsulation.None,
|
|
13402
13441
|
standalone: false
|
|
13403
13442
|
}]
|
|
13404
|
-
}], ctorParameters: () => [{ type: IconCacheService }, { type: i0.ChangeDetectorRef }, { type: FormMasterService }], propDecorators: { headerCells: [{
|
|
13443
|
+
}], ctorParameters: () => [{ type: IconCacheService }, { type: i0.ChangeDetectorRef }, { type: i0.IterableDiffers }, { type: FormMasterService }], propDecorators: { headerCells: [{
|
|
13405
13444
|
type: ViewChildren,
|
|
13406
13445
|
args: ['headerCell']
|
|
13407
13446
|
}], rowElements: [{
|
|
@@ -13423,6 +13462,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
|
|
|
13423
13462
|
type: Input
|
|
13424
13463
|
}], rowDisabledFn: [{
|
|
13425
13464
|
type: Input
|
|
13465
|
+
}], rowConditionalClassFn: [{
|
|
13466
|
+
type: Input
|
|
13426
13467
|
}], showColumnSort: [{
|
|
13427
13468
|
type: Input
|
|
13428
13469
|
}], showRowButtons: [{
|