@ascentgl/ads-ui 21.79.0 → 21.80.0
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.
|
@@ -7280,11 +7280,16 @@ class AdsColumnSortFilterMenuComponent {
|
|
|
7280
7280
|
}
|
|
7281
7281
|
});
|
|
7282
7282
|
this.optionSubscriptions.push(subscription);
|
|
7283
|
-
// Build the label:
|
|
7284
|
-
|
|
7285
|
-
//
|
|
7286
|
-
if
|
|
7287
|
-
|
|
7283
|
+
// Build the label:
|
|
7284
|
+
// When showDateOnly is enabled, the rawValue is already a trimmed date-only string
|
|
7285
|
+
// from the table component — use it directly to avoid re-parsing and timezone shift.
|
|
7286
|
+
// Otherwise, use formatter if provided, or convert to string.
|
|
7287
|
+
let label;
|
|
7288
|
+
if (showDateOnly) {
|
|
7289
|
+
label = String(rawValue ?? '');
|
|
7290
|
+
}
|
|
7291
|
+
else {
|
|
7292
|
+
label = formatter ? formatter(rawValue) : String(rawValue ?? '');
|
|
7288
7293
|
}
|
|
7289
7294
|
return {
|
|
7290
7295
|
value: key,
|
|
@@ -7314,26 +7319,6 @@ class AdsColumnSortFilterMenuComponent {
|
|
|
7314
7319
|
return String(value);
|
|
7315
7320
|
}
|
|
7316
7321
|
}
|
|
7317
|
-
/**
|
|
7318
|
-
* @ignore - Trim a date-time string to date-only.
|
|
7319
|
-
* Handles common formatted patterns like "01/09/26, 02:00 AM" or "01/09/2026 14:30".
|
|
7320
|
-
* Strips everything after the date portion (comma+time, space+time).
|
|
7321
|
-
*/
|
|
7322
|
-
trimToDateOnly(value) {
|
|
7323
|
-
// Already date-only (e.g., "01/09/2026") — no comma, no time pattern
|
|
7324
|
-
// Match patterns: "MM/DD/YY, HH:MM AM/PM" or "MM/DD/YYYY HH:MM" etc.
|
|
7325
|
-
// Strip from the comma or from the space before time digits
|
|
7326
|
-
const commaIdx = value.indexOf(',');
|
|
7327
|
-
if (commaIdx > 0) {
|
|
7328
|
-
return value.substring(0, commaIdx).trim();
|
|
7329
|
-
}
|
|
7330
|
-
// Match "date space time" pattern (e.g., "01/09/2026 14:30")
|
|
7331
|
-
const match = value.match(/^(\d{1,2}\/\d{1,2}\/\d{2,4})\s+\d/);
|
|
7332
|
-
if (match) {
|
|
7333
|
-
return match[1];
|
|
7334
|
-
}
|
|
7335
|
-
return value;
|
|
7336
|
-
}
|
|
7337
7322
|
/** @ignore */
|
|
7338
7323
|
setupSearchSubscription() {
|
|
7339
7324
|
this.searchControl.valueChanges.pipe(takeUntil$1(this.destroy$)).subscribe((value) => {
|
|
@@ -8120,63 +8105,40 @@ class AdsTableComponent {
|
|
|
8120
8105
|
}
|
|
8121
8106
|
}
|
|
8122
8107
|
// ============ Custom Sort/Filter Menu Methods ============
|
|
8123
|
-
/**
|
|
8124
|
-
*
|
|
8125
|
-
*
|
|
8108
|
+
/**
|
|
8109
|
+
* @ignore - Get the effective filter formatter for a given column field.
|
|
8110
|
+
* When showDateOnly is true, wraps the base formatter to trim date-time output
|
|
8111
|
+
* to date-only. This ensures the dedup key, stored filter values, and
|
|
8112
|
+
* doesExternalFilterPass comparison all use date-only strings — so selecting
|
|
8113
|
+
* a date in the filter menu matches ALL rows for that date regardless of time.
|
|
8126
8114
|
*/
|
|
8127
8115
|
getFilterValueFormatterForField(field) {
|
|
8128
8116
|
const config = this.columnSortFilterConfigs.find(c => c.field === field);
|
|
8129
8117
|
if (!config)
|
|
8130
8118
|
return undefined;
|
|
8131
8119
|
const baseFormatter = config.filterValueFormatter;
|
|
8132
|
-
|
|
8133
|
-
if (!baseFormatter && !showDateOnly) {
|
|
8120
|
+
if (!baseFormatter)
|
|
8134
8121
|
return undefined;
|
|
8135
|
-
|
|
8136
|
-
if (showDateOnly) {
|
|
8137
|
-
// When showDateOnly is true, use the base formatter (if any) then trim to date-only
|
|
8122
|
+
if (config.showDateOnly) {
|
|
8138
8123
|
return (value) => {
|
|
8139
|
-
const formatted = baseFormatter
|
|
8124
|
+
const formatted = baseFormatter(value);
|
|
8140
8125
|
return this.trimToDateOnly(formatted);
|
|
8141
8126
|
};
|
|
8142
8127
|
}
|
|
8143
8128
|
return baseFormatter;
|
|
8144
8129
|
}
|
|
8145
8130
|
/**
|
|
8146
|
-
* @ignore -
|
|
8147
|
-
*
|
|
8148
|
-
|
|
8149
|
-
formatDateDefault(value) {
|
|
8150
|
-
if (value === null || value === undefined)
|
|
8151
|
-
return '';
|
|
8152
|
-
const str = String(value);
|
|
8153
|
-
try {
|
|
8154
|
-
const date = new Date(str);
|
|
8155
|
-
if (isNaN(date.getTime()))
|
|
8156
|
-
return str;
|
|
8157
|
-
return date.toLocaleDateString('en-US', {
|
|
8158
|
-
month: '2-digit',
|
|
8159
|
-
day: '2-digit',
|
|
8160
|
-
year: 'numeric',
|
|
8161
|
-
});
|
|
8162
|
-
}
|
|
8163
|
-
catch {
|
|
8164
|
-
return str;
|
|
8165
|
-
}
|
|
8166
|
-
}
|
|
8167
|
-
/**
|
|
8168
|
-
* @ignore - Trim a date-time string to date-only.
|
|
8169
|
-
* Strips time portion from common formatted date-time patterns.
|
|
8131
|
+
* @ignore - Trim a formatted date-time string to date-only.
|
|
8132
|
+
* Handles: "01/15/2026, 21:00" → "01/15/2026"
|
|
8133
|
+
* "01/15/2026 21:00" → "01/15/2026"
|
|
8170
8134
|
*/
|
|
8171
8135
|
trimToDateOnly(value) {
|
|
8172
8136
|
if (!value)
|
|
8173
8137
|
return value;
|
|
8174
|
-
// "MM/DD/YY, HH:MM AM/PM" — strip from comma
|
|
8175
8138
|
const commaIdx = value.indexOf(',');
|
|
8176
8139
|
if (commaIdx > 0) {
|
|
8177
8140
|
return value.substring(0, commaIdx).trim();
|
|
8178
8141
|
}
|
|
8179
|
-
// "MM/DD/YYYY HH:MM" — strip from space before time digits
|
|
8180
8142
|
const match = value.match(/^(\d{1,2}\/\d{1,2}\/\d{2,4})\s+\d/);
|
|
8181
8143
|
if (match) {
|
|
8182
8144
|
return match[1];
|