cloud-ide-element 1.1.266 → 1.1.267
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.
|
@@ -10999,7 +10999,11 @@ class CideEleDataGridComponent {
|
|
|
10999
10999
|
// Client-side pagination
|
|
11000
11000
|
const pageSize = this.mergedConfig().pagination?.pageSize || 10;
|
|
11001
11001
|
this.pageSize.set(pageSize);
|
|
11002
|
-
|
|
11002
|
+
// When tree is enabled, data is root nodes only; use full node count for "X of Y"
|
|
11003
|
+
const totalCount = this.mergedConfig().tree?.enabled
|
|
11004
|
+
? this.flattenAllDataForOrderTracking(data).length
|
|
11005
|
+
: data.length;
|
|
11006
|
+
this.totalItems.set(totalCount);
|
|
11003
11007
|
// For client-side pagination, apply filters
|
|
11004
11008
|
this.applyFilters();
|
|
11005
11009
|
}
|
|
@@ -11149,23 +11153,33 @@ class CideEleDataGridComponent {
|
|
|
11149
11153
|
// ===== Data Processing =====
|
|
11150
11154
|
applyFilters() {
|
|
11151
11155
|
let filtered = [...this.internalData()];
|
|
11156
|
+
const query = this.searchQuery()?.toLowerCase();
|
|
11157
|
+
const treeEnabled = this.mergedConfig().tree?.enabled;
|
|
11158
|
+
const searchActive = !this.serverSidePagination && query && this.mergedConfig().search.enabled;
|
|
11152
11159
|
// Apply search filter only for client-side pagination
|
|
11153
|
-
|
|
11154
|
-
|
|
11155
|
-
|
|
11156
|
-
|
|
11160
|
+
if (searchActive) {
|
|
11161
|
+
if (treeEnabled) {
|
|
11162
|
+
// Search in full tree (all levels) so child entities are findable
|
|
11163
|
+
const fullFlat = this.flattenAllDataForOrderTracking(this.internalData());
|
|
11164
|
+
filtered = fullFlat.filter(item => this.mergedConfig().search.searchableColumns.some(columnKey => {
|
|
11165
|
+
const value = this.getNestedValue(item, columnKey);
|
|
11166
|
+
return String(value || '')?.toLowerCase()?.includes(query);
|
|
11167
|
+
}));
|
|
11168
|
+
}
|
|
11169
|
+
else {
|
|
11157
11170
|
filtered = filtered.filter(item => this.mergedConfig().search.searchableColumns.some(columnKey => {
|
|
11158
11171
|
const value = this.getNestedValue(item, columnKey);
|
|
11159
11172
|
return String(value || '')?.toLowerCase()?.includes(query);
|
|
11160
11173
|
}));
|
|
11161
11174
|
}
|
|
11162
11175
|
}
|
|
11163
|
-
// Flatten tree structure for display
|
|
11164
|
-
if (
|
|
11176
|
+
// Flatten tree structure for display when tree is enabled (unless we already have flat search results)
|
|
11177
|
+
if (treeEnabled && !searchActive) {
|
|
11165
11178
|
filtered = this.flattenTreeForDisplay(filtered);
|
|
11166
11179
|
}
|
|
11167
|
-
// Apply column filters
|
|
11168
|
-
|
|
11180
|
+
// Apply column filters (when tree + search, pass matching count for totalItems)
|
|
11181
|
+
const totalOverride = treeEnabled && searchActive ? filtered.length : undefined;
|
|
11182
|
+
this.applyFiltersToData(filtered, totalOverride);
|
|
11169
11183
|
// Apply sorting
|
|
11170
11184
|
this.applySortsToData();
|
|
11171
11185
|
}
|
|
@@ -11297,13 +11311,14 @@ class CideEleDataGridComponent {
|
|
|
11297
11311
|
const itemMap = new Map();
|
|
11298
11312
|
const processedItems = new Set();
|
|
11299
11313
|
const rootItems = [];
|
|
11314
|
+
const defaultExpanded = !!treeConfig.defaultExpandAll;
|
|
11300
11315
|
// First pass: create tree items with default properties and level key
|
|
11301
11316
|
data.forEach(item => {
|
|
11302
11317
|
const treeItem = {
|
|
11303
11318
|
...item,
|
|
11304
11319
|
[levelKey]: 0,
|
|
11305
11320
|
level: 0, // Always add 'level' property for consistent access
|
|
11306
|
-
[expandedKey]:
|
|
11321
|
+
[expandedKey]: defaultExpanded,
|
|
11307
11322
|
[hasChildrenKey]: false,
|
|
11308
11323
|
[childrenKey]: []
|
|
11309
11324
|
};
|
|
@@ -12802,7 +12817,7 @@ class CideEleDataGridComponent {
|
|
|
12802
12817
|
// Reapply sorting after filtering
|
|
12803
12818
|
this.applySortsToData();
|
|
12804
12819
|
}
|
|
12805
|
-
applyFiltersToData(data) {
|
|
12820
|
+
applyFiltersToData(data, totalCountOverride) {
|
|
12806
12821
|
let filtered = data ? [...data] : [...this.internalData()];
|
|
12807
12822
|
const filters = this.columnFilters();
|
|
12808
12823
|
filters.forEach(filter => {
|
|
@@ -12832,8 +12847,14 @@ class CideEleDataGridComponent {
|
|
|
12832
12847
|
});
|
|
12833
12848
|
});
|
|
12834
12849
|
this.filteredData.set(filtered);
|
|
12835
|
-
|
|
12836
|
-
|
|
12850
|
+
// When tree is enabled, use full tree count for totalItems unless override (e.g. search result count) is provided
|
|
12851
|
+
const totalCount = totalCountOverride !== undefined
|
|
12852
|
+
? totalCountOverride
|
|
12853
|
+
: this.mergedConfig().tree?.enabled
|
|
12854
|
+
? this.flattenAllDataForOrderTracking(this.internalData()).length
|
|
12855
|
+
: filtered.length;
|
|
12856
|
+
this.totalItems.set(totalCount);
|
|
12857
|
+
this.totalPages.set(Math.ceil(totalCount / this.pageSize()));
|
|
12837
12858
|
}
|
|
12838
12859
|
// ===== Utility Methods =====
|
|
12839
12860
|
emitEvent(type, data, column, action) {
|