@colijnit/corecomponents_v12 262.1.17 → 262.1.18
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.
|
@@ -11432,6 +11432,7 @@ class BaseSimpleGridComponent {
|
|
|
11432
11432
|
}
|
|
11433
11433
|
set data(value) {
|
|
11434
11434
|
this._data = value;
|
|
11435
|
+
this.repeatSortOnDataChange();
|
|
11435
11436
|
this._prepareData();
|
|
11436
11437
|
this._currentDataJSON = JSON.stringify(this._data);
|
|
11437
11438
|
this.dataChanged.next();
|
|
@@ -11539,6 +11540,14 @@ class BaseSimpleGridComponent {
|
|
|
11539
11540
|
}
|
|
11540
11541
|
async prepareDataRow(row, index) {
|
|
11541
11542
|
}
|
|
11543
|
+
repeatSortOnDataChange() {
|
|
11544
|
+
}
|
|
11545
|
+
setData(value) {
|
|
11546
|
+
this._data = value;
|
|
11547
|
+
this._prepareData();
|
|
11548
|
+
this._currentDataJSON = JSON.stringify(this._data);
|
|
11549
|
+
this.dataChanged.next();
|
|
11550
|
+
}
|
|
11542
11551
|
_setColumns(columns) {
|
|
11543
11552
|
this.columns.push(...columns);
|
|
11544
11553
|
this.columns.sort((a, b) => a.order < b.order ? -1 : 1);
|
|
@@ -12252,6 +12261,7 @@ class SimpleGridComponent extends BaseSimpleGridComponent {
|
|
|
12252
12261
|
_formMaster;
|
|
12253
12262
|
defaultTextAlign = ColumnAlign.Left;
|
|
12254
12263
|
scrollDirections = ScrollDirection;
|
|
12264
|
+
_previouslySortedColumn;
|
|
12255
12265
|
set headerCells(cells) {
|
|
12256
12266
|
const headerElements = cells.toArray();
|
|
12257
12267
|
for (let i = 0; i < headerElements.length; i++) {
|
|
@@ -12560,14 +12570,18 @@ class SimpleGridComponent extends BaseSimpleGridComponent {
|
|
|
12560
12570
|
return obj !== col;
|
|
12561
12571
|
});
|
|
12562
12572
|
}
|
|
12563
|
-
sortColumn(col, columnValue) {
|
|
12573
|
+
sortColumn(col, columnValue, preserveSortDirection) {
|
|
12564
12574
|
col.isSelected = false;
|
|
12565
12575
|
if (this.sortColumnValue === columnValue) {
|
|
12566
|
-
|
|
12576
|
+
if (!preserveSortDirection) {
|
|
12577
|
+
this.sortDirection = this.sortDirection === 'asc' ? 'desc' : 'asc';
|
|
12578
|
+
}
|
|
12567
12579
|
}
|
|
12568
12580
|
else {
|
|
12569
12581
|
this.sortColumnValue = columnValue;
|
|
12570
|
-
|
|
12582
|
+
if (!preserveSortDirection) {
|
|
12583
|
+
this.sortDirection = 'asc';
|
|
12584
|
+
}
|
|
12571
12585
|
}
|
|
12572
12586
|
const direction = this.sortDirection === 'asc' ? 1 : -1;
|
|
12573
12587
|
const sorted = [...this.data].sort((a, b) => {
|
|
@@ -12596,9 +12610,15 @@ class SimpleGridComponent extends BaseSimpleGridComponent {
|
|
|
12596
12610
|
}
|
|
12597
12611
|
return (valA > valB ? 1 : valA < valB ? -1 : 0) * direction;
|
|
12598
12612
|
});
|
|
12599
|
-
this.
|
|
12613
|
+
this.setData(sorted);
|
|
12614
|
+
this._previouslySortedColumn = col;
|
|
12600
12615
|
this._detectChanges();
|
|
12601
12616
|
}
|
|
12617
|
+
repeatSortOnDataChange() {
|
|
12618
|
+
if (this._previouslySortedColumn) {
|
|
12619
|
+
this.sortColumn(this._previouslySortedColumn, this.sortColumnValue, true);
|
|
12620
|
+
}
|
|
12621
|
+
}
|
|
12602
12622
|
showAllColumns() {
|
|
12603
12623
|
this.isSettingsMenuOpen = false;
|
|
12604
12624
|
this.headerColumnsCopy = this.headerColumns;
|