cloud-ide-element 1.1.86 → 1.1.87
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.
- package/fesm2022/cloud-ide-element.mjs +64 -138
- package/fesm2022/cloud-ide-element.mjs.map +1 -1
- package/index.d.ts +2 -2
- package/package.json +1 -1
|
@@ -9634,7 +9634,9 @@ class CideEleDataGridComponent {
|
|
|
9634
9634
|
*/
|
|
9635
9635
|
getItemId(item) {
|
|
9636
9636
|
if (item && typeof item === 'object') {
|
|
9637
|
-
|
|
9637
|
+
// Use trackBy from config, fallback to '_id' if not specified
|
|
9638
|
+
const trackBy = this.mergedConfig().trackBy || '_id';
|
|
9639
|
+
const id = this.getNestedValue(item, trackBy);
|
|
9638
9640
|
return id ? String(id) : null;
|
|
9639
9641
|
}
|
|
9640
9642
|
return null;
|
|
@@ -9768,26 +9770,13 @@ class CideEleDataGridComponent {
|
|
|
9768
9770
|
valueA = '';
|
|
9769
9771
|
if (valueB === null || valueB === undefined)
|
|
9770
9772
|
valueB = '';
|
|
9771
|
-
// Handle objects -
|
|
9773
|
+
// Handle objects - convert to string for comparison
|
|
9774
|
+
// The consuming component should normalize data before passing to grid
|
|
9772
9775
|
if (typeof valueA === 'object' && valueA !== null && !Array.isArray(valueA) && !(valueA instanceof Date)) {
|
|
9773
|
-
|
|
9774
|
-
const displayProps = ['name', 'title', 'label', 'text', 'display_text', 'user_fullname', 'sygms_title'];
|
|
9775
|
-
for (const prop of displayProps) {
|
|
9776
|
-
if (objA[prop] !== undefined && objA[prop] !== null) {
|
|
9777
|
-
valueA = objA[prop];
|
|
9778
|
-
break;
|
|
9779
|
-
}
|
|
9780
|
-
}
|
|
9776
|
+
valueA = String(valueA);
|
|
9781
9777
|
}
|
|
9782
9778
|
if (typeof valueB === 'object' && valueB !== null && !Array.isArray(valueB) && !(valueB instanceof Date)) {
|
|
9783
|
-
|
|
9784
|
-
const displayProps = ['name', 'title', 'label', 'text', 'display_text', 'user_fullname', 'sygms_title'];
|
|
9785
|
-
for (const prop of displayProps) {
|
|
9786
|
-
if (objB[prop] !== undefined && objB[prop] !== null) {
|
|
9787
|
-
valueB = objB[prop];
|
|
9788
|
-
break;
|
|
9789
|
-
}
|
|
9790
|
-
}
|
|
9779
|
+
valueB = String(valueB);
|
|
9791
9780
|
}
|
|
9792
9781
|
// Convert to strings for comparison
|
|
9793
9782
|
const strA = String(valueA || '').toLowerCase();
|
|
@@ -9917,13 +9906,12 @@ class CideEleDataGridComponent {
|
|
|
9917
9906
|
const childExists = parentChildren.some(child => String(this.getNestedValue(child, primaryKey) || '') === itemId);
|
|
9918
9907
|
if (!childExists) {
|
|
9919
9908
|
// Calculate level based on parent - automatically set level key
|
|
9920
|
-
const parentLevel = this.getNestedValue(parent,
|
|
9909
|
+
const parentLevel = this.getNestedValue(parent, levelKey) || 0;
|
|
9921
9910
|
const childLevel = parentLevel + 1;
|
|
9922
9911
|
// Update child item with correct level
|
|
9923
9912
|
const updatedTreeItem = {
|
|
9924
9913
|
...treeItem,
|
|
9925
|
-
[levelKey]: childLevel
|
|
9926
|
-
level: childLevel // Always add 'level' property for consistent access
|
|
9914
|
+
[levelKey]: childLevel
|
|
9927
9915
|
};
|
|
9928
9916
|
itemMap.set(itemId, updatedTreeItem);
|
|
9929
9917
|
// Add updated child to parent's children array
|
|
@@ -9947,8 +9935,7 @@ class CideEleDataGridComponent {
|
|
|
9947
9935
|
// This is a root item - automatically set level to 0
|
|
9948
9936
|
const updatedRootItem = {
|
|
9949
9937
|
...treeItem,
|
|
9950
|
-
[levelKey]: 0
|
|
9951
|
-
level: 0 // Always add 'level' property for consistent access
|
|
9938
|
+
[levelKey]: 0
|
|
9952
9939
|
};
|
|
9953
9940
|
itemMap.set(itemId, updatedRootItem);
|
|
9954
9941
|
if (!rootItems.some(rootItem => String(this.getNestedValue(rootItem, primaryKey) || '') === itemId)) {
|
|
@@ -10184,13 +10171,15 @@ class CideEleDataGridComponent {
|
|
|
10184
10171
|
return updatedItem;
|
|
10185
10172
|
}
|
|
10186
10173
|
// Check children recursively
|
|
10187
|
-
const
|
|
10174
|
+
const { childrenKey = 'children' } = treeConfig;
|
|
10175
|
+
const children = this.getNestedValue(treeItem, childrenKey) || [];
|
|
10188
10176
|
if (children.length > 0) {
|
|
10189
10177
|
const updatedChildren = updateItemInTree(children);
|
|
10190
|
-
|
|
10191
|
-
...treeItem
|
|
10192
|
-
children: updatedChildren
|
|
10178
|
+
const updatedItem = {
|
|
10179
|
+
...treeItem
|
|
10193
10180
|
};
|
|
10181
|
+
this.setNestedValue(updatedItem, childrenKey, updatedChildren);
|
|
10182
|
+
return updatedItem;
|
|
10194
10183
|
}
|
|
10195
10184
|
return treeItem;
|
|
10196
10185
|
});
|
|
@@ -10414,20 +10403,14 @@ class CideEleDataGridComponent {
|
|
|
10414
10403
|
* Get item level in tree
|
|
10415
10404
|
*/
|
|
10416
10405
|
getItemLevel(item) {
|
|
10417
|
-
//
|
|
10418
|
-
|
|
10419
|
-
|
|
10420
|
-
|
|
10421
|
-
const
|
|
10422
|
-
|
|
10423
|
-
const { levelKey = 'level' } = treeConfig;
|
|
10424
|
-
level = this.getNestedValue(item, levelKey) || 0;
|
|
10425
|
-
}
|
|
10426
|
-
else {
|
|
10427
|
-
level = 0;
|
|
10428
|
-
}
|
|
10406
|
+
// Get level from tree config level key
|
|
10407
|
+
const treeConfig = this.getTreeConfig();
|
|
10408
|
+
if (treeConfig) {
|
|
10409
|
+
const { levelKey = 'level' } = treeConfig;
|
|
10410
|
+
const itemLevel = this.getNestedValue(item, levelKey);
|
|
10411
|
+
return itemLevel !== undefined && itemLevel !== null ? itemLevel : 0;
|
|
10429
10412
|
}
|
|
10430
|
-
return
|
|
10413
|
+
return 0;
|
|
10431
10414
|
}
|
|
10432
10415
|
/**
|
|
10433
10416
|
* Check if item is expanded
|
|
@@ -10630,10 +10613,11 @@ class CideEleDataGridComponent {
|
|
|
10630
10613
|
return actualOrder;
|
|
10631
10614
|
}
|
|
10632
10615
|
// Final fallback to index-based calculation
|
|
10616
|
+
const trackBy = this.mergedConfig().trackBy || '_id';
|
|
10633
10617
|
const currentIndex = this.displayedData.findIndex(currentItem => {
|
|
10634
10618
|
if (item && currentItem && typeof item === 'object' && typeof currentItem === 'object') {
|
|
10635
|
-
const itemId = item
|
|
10636
|
-
const currentItemId = currentItem
|
|
10619
|
+
const itemId = this.getNestedValue(item, trackBy);
|
|
10620
|
+
const currentItemId = this.getNestedValue(currentItem, trackBy);
|
|
10637
10621
|
return itemId && currentItemId && itemId === currentItemId;
|
|
10638
10622
|
}
|
|
10639
10623
|
return item === currentItem;
|
|
@@ -11204,30 +11188,15 @@ class CideEleDataGridComponent {
|
|
|
11204
11188
|
* Tries common field patterns based on column key
|
|
11205
11189
|
*/
|
|
11206
11190
|
extractValueFromRowForTemplateColumn(row, column) {
|
|
11207
|
-
// Try common patterns based on column key
|
|
11208
11191
|
const rowData = row;
|
|
11209
|
-
// If column key is 'details', try common detail/display fields
|
|
11210
|
-
if (column.key === 'details' || column.key.includes('detail')) {
|
|
11211
|
-
// Try display_text, name, title fields
|
|
11212
|
-
if (rowData['fdlds_display_text'])
|
|
11213
|
-
return rowData['fdlds_display_text'];
|
|
11214
|
-
if (rowData['display_text'])
|
|
11215
|
-
return rowData['display_text'];
|
|
11216
|
-
if (rowData['name'])
|
|
11217
|
-
return rowData['name'];
|
|
11218
|
-
if (rowData['title'])
|
|
11219
|
-
return rowData['title'];
|
|
11220
|
-
}
|
|
11221
11192
|
// Try to find a field that matches the column key pattern
|
|
11222
|
-
//
|
|
11193
|
+
// Try variations like: key, key_text, key_name, key_title, key_display
|
|
11223
11194
|
const keyVariations = [
|
|
11224
11195
|
column.key,
|
|
11225
11196
|
`${column.key}_text`,
|
|
11226
11197
|
`${column.key}_name`,
|
|
11227
11198
|
`${column.key}_title`,
|
|
11228
|
-
`${column.key}_display
|
|
11229
|
-
`fdlds_${column.key}`,
|
|
11230
|
-
`${column.key.replace('details', 'display_text')}`
|
|
11199
|
+
`${column.key}_display`
|
|
11231
11200
|
];
|
|
11232
11201
|
for (const variation of keyVariations) {
|
|
11233
11202
|
if (rowData[variation] !== undefined && rowData[variation] !== null) {
|
|
@@ -11235,12 +11204,14 @@ class CideEleDataGridComponent {
|
|
|
11235
11204
|
}
|
|
11236
11205
|
}
|
|
11237
11206
|
// Try to find any string field in the row that might be a display value
|
|
11207
|
+
// Skip ID fields using trackBy from config
|
|
11208
|
+
const trackBy = this.mergedConfig().trackBy || '_id';
|
|
11238
11209
|
for (const key in rowData) {
|
|
11239
11210
|
if (rowData.hasOwnProperty(key)) {
|
|
11240
11211
|
const value = rowData[key];
|
|
11241
11212
|
if (value !== null && value !== undefined && typeof value === 'string' && value.trim() !== '') {
|
|
11242
|
-
// Skip
|
|
11243
|
-
if (
|
|
11213
|
+
// Skip ID fields - use trackBy from config
|
|
11214
|
+
if (key !== trackBy && !key.toLowerCase().includes('id')) {
|
|
11244
11215
|
return value;
|
|
11245
11216
|
}
|
|
11246
11217
|
}
|
|
@@ -11250,16 +11221,19 @@ class CideEleDataGridComponent {
|
|
|
11250
11221
|
}
|
|
11251
11222
|
/**
|
|
11252
11223
|
* Get a stable key for filter value comparison
|
|
11253
|
-
* Handles objects by using
|
|
11224
|
+
* Handles objects by using trackBy/primaryKey or JSON stringification
|
|
11254
11225
|
*/
|
|
11255
11226
|
getFilterValueKey(value) {
|
|
11256
11227
|
if (value === null || value === undefined)
|
|
11257
11228
|
return 'null';
|
|
11258
11229
|
if (typeof value === 'object' && value !== null && !Array.isArray(value)) {
|
|
11259
11230
|
const obj = value;
|
|
11260
|
-
// Use
|
|
11261
|
-
|
|
11262
|
-
|
|
11231
|
+
// Use trackBy or primaryKey from config for object comparison
|
|
11232
|
+
const trackBy = this.mergedConfig().trackBy;
|
|
11233
|
+
const treeConfig = this.mergedConfig().tree;
|
|
11234
|
+
const primaryKey = treeConfig?.primaryKey || trackBy;
|
|
11235
|
+
if (primaryKey && primaryKey in obj && obj[primaryKey] !== undefined) {
|
|
11236
|
+
return `obj_${String(obj[primaryKey])}`;
|
|
11263
11237
|
}
|
|
11264
11238
|
// Otherwise use JSON string for comparison
|
|
11265
11239
|
try {
|
|
@@ -11278,34 +11252,21 @@ class CideEleDataGridComponent {
|
|
|
11278
11252
|
return value ? 'Yes' : 'No';
|
|
11279
11253
|
if (value instanceof Date)
|
|
11280
11254
|
return value.toLocaleDateString();
|
|
11281
|
-
// Handle objects -
|
|
11255
|
+
// Handle objects - convert to string generically
|
|
11256
|
+
// The consuming component should normalize data before passing to grid
|
|
11282
11257
|
if (typeof value === 'object' && value !== null && !Array.isArray(value)) {
|
|
11258
|
+
// Try to get first string property (excluding ID fields)
|
|
11283
11259
|
const obj = value;
|
|
11284
|
-
// Try common display property names in order of preference
|
|
11285
|
-
const displayProperties = [
|
|
11286
|
-
'name', 'title', 'label', 'text', 'display_text',
|
|
11287
|
-
'user_fullname', 'fullname', 'full_name',
|
|
11288
|
-
'sygms_title', 'sygmt_title',
|
|
11289
|
-
'user_name', 'username',
|
|
11290
|
-
'email', 'description'
|
|
11291
|
-
];
|
|
11292
|
-
for (const prop of displayProperties) {
|
|
11293
|
-
if (obj[prop] !== undefined && obj[prop] !== null && typeof obj[prop] !== 'object') {
|
|
11294
|
-
return String(obj[prop]);
|
|
11295
|
-
}
|
|
11296
|
-
}
|
|
11297
|
-
// If no display property found, try to get first string property
|
|
11298
11260
|
for (const key in obj) {
|
|
11299
11261
|
if (obj.hasOwnProperty(key) && typeof obj[key] === 'string' && obj[key] !== '') {
|
|
11300
|
-
|
|
11262
|
+
// Skip ID fields
|
|
11263
|
+
if (!key.toLowerCase().includes('id') && !key.toLowerCase().includes('_id')) {
|
|
11264
|
+
return String(obj[key]);
|
|
11265
|
+
}
|
|
11301
11266
|
}
|
|
11302
11267
|
}
|
|
11303
|
-
//
|
|
11304
|
-
|
|
11305
|
-
return String(obj['_id']);
|
|
11306
|
-
}
|
|
11307
|
-
// If still no value, return a generic label
|
|
11308
|
-
return '(Object)';
|
|
11268
|
+
// If no suitable string property found, convert to string
|
|
11269
|
+
return String(value);
|
|
11309
11270
|
}
|
|
11310
11271
|
// Handle arrays
|
|
11311
11272
|
if (Array.isArray(value)) {
|
|
@@ -11456,10 +11417,15 @@ class CideEleDataGridComponent {
|
|
|
11456
11417
|
* Extract ID from foreign key value generically
|
|
11457
11418
|
* Handles both string IDs and nested objects (e.g., { _id: "...", name: "..." })
|
|
11458
11419
|
* @param foreignKeyValue - The foreign key value (can be string, object, or null/undefined)
|
|
11459
|
-
* @param primaryKey - The primary key field name (defaults to '_id')
|
|
11420
|
+
* @param primaryKey - The primary key field name (from tree config or defaults to trackBy or '_id')
|
|
11460
11421
|
* @returns The extracted ID as a string, or empty string if not found
|
|
11461
11422
|
*/
|
|
11462
|
-
extractIdFromForeignKey(foreignKeyValue, primaryKey
|
|
11423
|
+
extractIdFromForeignKey(foreignKeyValue, primaryKey) {
|
|
11424
|
+
// Get primary key from tree config or trackBy, fallback to '_id'
|
|
11425
|
+
if (!primaryKey) {
|
|
11426
|
+
const treeConfig = this.mergedConfig().tree;
|
|
11427
|
+
primaryKey = treeConfig?.primaryKey || this.mergedConfig().trackBy || '_id';
|
|
11428
|
+
}
|
|
11463
11429
|
if (foreignKeyValue === null || foreignKeyValue === undefined) {
|
|
11464
11430
|
return '';
|
|
11465
11431
|
}
|
|
@@ -11773,36 +11739,10 @@ class CideEleDataGridComponent {
|
|
|
11773
11739
|
if (column.formatter) {
|
|
11774
11740
|
displayValue = this.formatValue(displayValue, column);
|
|
11775
11741
|
}
|
|
11776
|
-
// If display value is still an object,
|
|
11742
|
+
// If display value is still an object, convert to string
|
|
11743
|
+
// The consuming component should normalize data before passing to grid
|
|
11777
11744
|
if (typeof displayValue === 'object' && displayValue !== null && !Array.isArray(displayValue) && !(displayValue instanceof Date)) {
|
|
11778
|
-
|
|
11779
|
-
const obj = displayValue;
|
|
11780
|
-
if (obj['name']) {
|
|
11781
|
-
displayValue = obj['name'];
|
|
11782
|
-
}
|
|
11783
|
-
else if (obj['title']) {
|
|
11784
|
-
displayValue = obj['title'];
|
|
11785
|
-
}
|
|
11786
|
-
else if (obj['acabrn_name']) {
|
|
11787
|
-
displayValue = obj['acabrn_name'];
|
|
11788
|
-
}
|
|
11789
|
-
else if (obj['acacpm_alise_title']) {
|
|
11790
|
-
displayValue = obj['acacpm_alise_title'];
|
|
11791
|
-
}
|
|
11792
|
-
else if (obj['acacpm_name']) {
|
|
11793
|
-
displayValue = obj['acacpm_name'];
|
|
11794
|
-
}
|
|
11795
|
-
else {
|
|
11796
|
-
displayValue = String(displayValue);
|
|
11797
|
-
}
|
|
11798
|
-
}
|
|
11799
|
-
// Handle null/undefined/empty values for optional fields (e.g., optional specialization)
|
|
11800
|
-
// Use a consistent label for null/undefined values to group them together
|
|
11801
|
-
if (displayValue === null || displayValue === undefined || displayValue === '') {
|
|
11802
|
-
displayValue = 'No Specialization';
|
|
11803
|
-
}
|
|
11804
|
-
if (rawValue === null || rawValue === undefined || rawValue === '') {
|
|
11805
|
-
rawValue = 'No Specialization';
|
|
11745
|
+
displayValue = String(displayValue);
|
|
11806
11746
|
}
|
|
11807
11747
|
const groupKey = `${groupColumnKey}:${this.getFilterValueKey(rawValue)}`;
|
|
11808
11748
|
const existing = groups.get(groupKey);
|
|
@@ -12088,32 +12028,18 @@ class CideEleDataGridComponent {
|
|
|
12088
12028
|
// Handle objects - extract display text
|
|
12089
12029
|
if (typeof value === 'object' && !Array.isArray(value) && !(value instanceof Date)) {
|
|
12090
12030
|
const obj = value;
|
|
12091
|
-
// Try
|
|
12092
|
-
|
|
12093
|
-
'name', 'title', 'label', 'text', 'display_text',
|
|
12094
|
-
'user_fullname', 'fullname', 'full_name',
|
|
12095
|
-
'sygms_title', 'sygmt_title',
|
|
12096
|
-
'user_name', 'username',
|
|
12097
|
-
'email', 'description'
|
|
12098
|
-
];
|
|
12099
|
-
for (const prop of displayProperties) {
|
|
12100
|
-
if (obj[prop] !== undefined && obj[prop] !== null && typeof obj[prop] !== 'object') {
|
|
12101
|
-
return String(obj[prop]);
|
|
12102
|
-
}
|
|
12103
|
-
}
|
|
12104
|
-
// Try first string property
|
|
12031
|
+
// Try to get first string property (excluding ID fields)
|
|
12032
|
+
// The consuming component should normalize data before passing to grid
|
|
12105
12033
|
for (const key in obj) {
|
|
12106
12034
|
if (obj.hasOwnProperty(key) && typeof obj[key] === 'string' && obj[key] !== '') {
|
|
12107
|
-
|
|
12035
|
+
// Skip ID fields
|
|
12036
|
+
if (!key.toLowerCase().includes('id') && !key.toLowerCase().includes('_id')) {
|
|
12108
12037
|
return String(obj[key]);
|
|
12109
12038
|
}
|
|
12110
12039
|
}
|
|
12111
12040
|
}
|
|
12112
|
-
//
|
|
12113
|
-
|
|
12114
|
-
return String(obj['_id']);
|
|
12115
|
-
}
|
|
12116
|
-
return '';
|
|
12041
|
+
// If no suitable string property found, convert to string
|
|
12042
|
+
return String(value);
|
|
12117
12043
|
}
|
|
12118
12044
|
// Handle arrays
|
|
12119
12045
|
if (Array.isArray(value)) {
|