@shival99/z-ui 2.0.72 → 2.0.73
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.
|
@@ -8976,7 +8976,7 @@ class ZTableComponent {
|
|
|
8976
8976
|
this._skipNextConfigSave = true;
|
|
8977
8977
|
}
|
|
8978
8978
|
const config = this.zConfig();
|
|
8979
|
-
const nextOrder = this.
|
|
8979
|
+
const nextOrder = this._getDefaultColumnOrder();
|
|
8980
8980
|
const nextVisibility = config.initialState?.columnVisibility ?? {};
|
|
8981
8981
|
const nextPinning = this._defaultColumnPinning();
|
|
8982
8982
|
const initialGroupingColumnIds = this._getInitialGroupingColumnIds(true);
|
|
@@ -8989,17 +8989,31 @@ class ZTableComponent {
|
|
|
8989
8989
|
if (initialGroupingColumnIds.length > 0) {
|
|
8990
8990
|
this._moveGroupingColumnsToLeadingDataPosition(initialGroupingColumnIds);
|
|
8991
8991
|
}
|
|
8992
|
+
const resetOrder = this.columnOrder();
|
|
8992
8993
|
this.collapsedGroupIds.set(new Set());
|
|
8993
8994
|
this.showHeaderFooterShadow.set(config.showHeaderShadow ?? config.showFooterShadow ?? true);
|
|
8994
8995
|
this.showHorizontalBorder.set(config.showHorizontalBorder ?? true);
|
|
8995
8996
|
this.showVerticalBorder.set(config.showVerticalBorder ?? true);
|
|
8996
|
-
this.pendingVisibleColumns.set(
|
|
8997
|
-
|
|
8998
|
-
.filter(column => nextVisibility[column.id] !== false)
|
|
8999
|
-
.map(column => column.id));
|
|
9000
|
-
this.pendingColumnOrder.set(nextOrder);
|
|
8997
|
+
this.pendingVisibleColumns.set(resetOrder.filter(columnId => nextVisibility[columnId] !== false));
|
|
8998
|
+
this.pendingColumnOrder.set(resetOrder);
|
|
9001
8999
|
this._scheduleFitColumnWidths();
|
|
9002
9000
|
}
|
|
9001
|
+
_getDefaultColumnOrder() {
|
|
9002
|
+
const columnIds = [];
|
|
9003
|
+
const collectLeafColumnIds = (columns) => {
|
|
9004
|
+
for (const column of columns) {
|
|
9005
|
+
if ('columns' in column && column.columns?.length) {
|
|
9006
|
+
collectLeafColumnIds(column.columns);
|
|
9007
|
+
continue;
|
|
9008
|
+
}
|
|
9009
|
+
if (column.id) {
|
|
9010
|
+
columnIds.push(column.id);
|
|
9011
|
+
}
|
|
9012
|
+
}
|
|
9013
|
+
};
|
|
9014
|
+
collectLeafColumnIds(this._columns());
|
|
9015
|
+
return columnIds;
|
|
9016
|
+
}
|
|
9003
9017
|
_getInitialGroupingColumnIds(includeLegacyColumnsFallback = false) {
|
|
9004
9018
|
if (!this.canUseGrouping()) {
|
|
9005
9019
|
return [];
|
|
@@ -9418,8 +9432,23 @@ class ZTableComponent {
|
|
|
9418
9432
|
if (formatter) {
|
|
9419
9433
|
return formatter({ value, columnId, rows });
|
|
9420
9434
|
}
|
|
9435
|
+
const date = this._getGroupDate(value);
|
|
9436
|
+
if (date) {
|
|
9437
|
+
return formatDate(date, 'dd/MM/yyyy | HH:mm:ss', 'en-US');
|
|
9438
|
+
}
|
|
9421
9439
|
return this._getGroupLabel(value);
|
|
9422
9440
|
}
|
|
9441
|
+
_getGroupDate(value) {
|
|
9442
|
+
if (value instanceof Date) {
|
|
9443
|
+
return Number.isNaN(value.getTime()) ? null : value;
|
|
9444
|
+
}
|
|
9445
|
+
if (typeof value !== 'string' ||
|
|
9446
|
+
!/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}(?::\d{2}(?:\.\d{1,3})?)?(?:Z|[+-]\d{2}:\d{2})?$/.test(value)) {
|
|
9447
|
+
return null;
|
|
9448
|
+
}
|
|
9449
|
+
const date = new Date(value);
|
|
9450
|
+
return Number.isNaN(date.getTime()) ? null : date;
|
|
9451
|
+
}
|
|
9423
9452
|
_getGroupLabel(value) {
|
|
9424
9453
|
if (value === null || value === undefined || value === '') {
|
|
9425
9454
|
return this._zTranslate.translate('i18n_z_ui_table_group_empty')();
|