@one-paragon/angular-utilities 2.5.4-beta.7 → 2.6.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.
|
@@ -1182,12 +1182,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImpor
|
|
|
1182
1182
|
// <div *customGroupRow="'category'; let group">
|
|
1183
1183
|
// Category: {{group.groupHeaderDisplay}} - {{group.length}} products
|
|
1184
1184
|
// </div>
|
|
1185
|
+
//
|
|
1186
|
+
// <!-- Custom group row for multiple grouping keys -->
|
|
1187
|
+
// <div *customGroupRow="['category', 'status']; let group">
|
|
1188
|
+
// Multi-key template: {{group.groupHeaderDisplay}} ({{group.length}} items)
|
|
1189
|
+
// </div>
|
|
1185
1190
|
class CustomGroupRowDirective {
|
|
1186
1191
|
constructor() {
|
|
1187
1192
|
this.templateRef = inject(TemplateRef);
|
|
1188
1193
|
/**
|
|
1189
|
-
* Optional grouping key. If provided, this custom row will only apply when data is grouped by this key.
|
|
1194
|
+
* Optional grouping key(s). If provided, this custom row will only apply when data is grouped by this key or keys.
|
|
1190
1195
|
* If not provided (or null), this custom row will apply to all groupings.
|
|
1196
|
+
* Can be a single Path<T> or an array of Path<T> values.
|
|
1191
1197
|
*/
|
|
1192
1198
|
this.$customGroupRow = input(null, { alias: 'customGroupRow', transform: (val) => val === '' ? null : val });
|
|
1193
1199
|
/**
|
|
@@ -1201,7 +1207,7 @@ class CustomGroupRowDirective {
|
|
|
1201
1207
|
this.$priority = input(0, { alias: 'customGroupRowPriority' });
|
|
1202
1208
|
this.$inited = signal(false);
|
|
1203
1209
|
/**
|
|
1204
|
-
* Gets the grouping key this directive applies to, or null for all groupings
|
|
1210
|
+
* Gets the grouping key(s) this directive applies to, or null for all groupings
|
|
1205
1211
|
*/
|
|
1206
1212
|
this.$groupingKey = computed(() => this.$customGroupRow());
|
|
1207
1213
|
/**
|
|
@@ -1223,7 +1229,13 @@ class CustomGroupRowDirective {
|
|
|
1223
1229
|
*/
|
|
1224
1230
|
appliesTo(groupingKey) {
|
|
1225
1231
|
const targetKey = this.$groupingKey();
|
|
1226
|
-
|
|
1232
|
+
if (targetKey === null) {
|
|
1233
|
+
return true; // Apply to all groupings
|
|
1234
|
+
}
|
|
1235
|
+
if (Array.isArray(targetKey)) {
|
|
1236
|
+
return targetKey.includes(groupingKey);
|
|
1237
|
+
}
|
|
1238
|
+
return targetKey === groupingKey;
|
|
1227
1239
|
}
|
|
1228
1240
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: CustomGroupRowDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
1229
1241
|
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.0.3", type: CustomGroupRowDirective, isStandalone: true, selector: "[customGroupRow]", inputs: { $customGroupRow: { classPropertyName: "$customGroupRow", publicName: "customGroupRow", isSignal: true, isRequired: false, transformFunction: null }, $customGroupRowTableRef: { classPropertyName: "$customGroupRowTableRef", publicName: "customGroupRowTableRef", isSignal: true, isRequired: false, transformFunction: null }, $priority: { classPropertyName: "$priority", publicName: "customGroupRowPriority", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 }); }
|
|
@@ -5013,7 +5025,12 @@ class GenericTableComponent {
|
|
|
5013
5025
|
const customGroupRows = this.state.$props().customGroupRows || [];
|
|
5014
5026
|
// Find the best matching custom group row template
|
|
5015
5027
|
// First, look for exact key matches, then for global templates (null key)
|
|
5016
|
-
const exactMatches = customGroupRows.filter(cgr =>
|
|
5028
|
+
const exactMatches = customGroupRows.filter(cgr => {
|
|
5029
|
+
if (!cgr.appliesTo(groupingKey))
|
|
5030
|
+
return false;
|
|
5031
|
+
const key = cgr.$groupingKey();
|
|
5032
|
+
return key === groupingKey || (Array.isArray(key) && key.includes(groupingKey));
|
|
5033
|
+
});
|
|
5017
5034
|
const globalMatches = customGroupRows.filter(cgr => cgr.appliesTo(groupingKey) && cgr.$groupingKey() === null);
|
|
5018
5035
|
// Sort by priority (higher priority first)
|
|
5019
5036
|
const allMatches = [...exactMatches, ...globalMatches].sort((a, b) => b.$priority() - a.$priority());
|