@shival99/z-ui 2.0.72 → 2.0.74
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 [];
|
|
@@ -9199,7 +9213,6 @@ class ZTableComponent {
|
|
|
9199
9213
|
right: this.columnPinning().right,
|
|
9200
9214
|
},
|
|
9201
9215
|
columnVisibility: this.columnVisibility(),
|
|
9202
|
-
groupingColumnId: this.groupingColumnIds()[0] ?? null,
|
|
9203
9216
|
groupingColumnIds: this.groupingColumnIds(),
|
|
9204
9217
|
columnInfo,
|
|
9205
9218
|
showHeaderFooterShadow: this.showHeaderFooterShadow(),
|
|
@@ -9266,14 +9279,6 @@ class ZTableComponent {
|
|
|
9266
9279
|
if (config.groupingColumnIds) {
|
|
9267
9280
|
this.groupingColumnIds.set(config.groupingColumnIds.filter(columnId => this.canGroupColumn(columnId)));
|
|
9268
9281
|
}
|
|
9269
|
-
if (!config.groupingColumnIds && config.groupingColumnId === null) {
|
|
9270
|
-
this.groupingColumnIds.set([]);
|
|
9271
|
-
}
|
|
9272
|
-
if (!config.groupingColumnIds &&
|
|
9273
|
-
typeof config.groupingColumnId === 'string' &&
|
|
9274
|
-
this.canGroupColumn(config.groupingColumnId)) {
|
|
9275
|
-
this.groupingColumnIds.set([config.groupingColumnId]);
|
|
9276
|
-
}
|
|
9277
9282
|
if (typeof config.showHeaderFooterShadow === 'boolean') {
|
|
9278
9283
|
this.showHeaderFooterShadow.set(config.showHeaderFooterShadow);
|
|
9279
9284
|
}
|
|
@@ -9418,8 +9423,23 @@ class ZTableComponent {
|
|
|
9418
9423
|
if (formatter) {
|
|
9419
9424
|
return formatter({ value, columnId, rows });
|
|
9420
9425
|
}
|
|
9426
|
+
const date = this._getGroupDate(value);
|
|
9427
|
+
if (date) {
|
|
9428
|
+
return formatDate(date, 'dd/MM/yyyy | HH:mm:ss', 'en-US');
|
|
9429
|
+
}
|
|
9421
9430
|
return this._getGroupLabel(value);
|
|
9422
9431
|
}
|
|
9432
|
+
_getGroupDate(value) {
|
|
9433
|
+
if (value instanceof Date) {
|
|
9434
|
+
return Number.isNaN(value.getTime()) ? null : value;
|
|
9435
|
+
}
|
|
9436
|
+
if (typeof value !== 'string' ||
|
|
9437
|
+
!/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}(?::\d{2}(?:\.\d{1,3})?)?(?:Z|[+-]\d{2}:\d{2})?$/.test(value)) {
|
|
9438
|
+
return null;
|
|
9439
|
+
}
|
|
9440
|
+
const date = new Date(value);
|
|
9441
|
+
return Number.isNaN(date.getTime()) ? null : date;
|
|
9442
|
+
}
|
|
9423
9443
|
_getGroupLabel(value) {
|
|
9424
9444
|
if (value === null || value === undefined || value === '') {
|
|
9425
9445
|
return this._zTranslate.translate('i18n_z_ui_table_group_empty')();
|