cloud-ide-element 1.1.85 → 1.1.86

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.
@@ -9897,7 +9897,8 @@ class CideEleDataGridComponent {
9897
9897
  itemsToProcess.forEach(item => {
9898
9898
  const itemId = String(this.getNestedValue(item, primaryKey) || '');
9899
9899
  const parentIdValue = this.getNestedValue(item, foreignKey);
9900
- const parentId = parentIdValue !== null && parentIdValue !== undefined ? String(parentIdValue) : '';
9900
+ // Extract parent ID generically - handle both string IDs and nested objects
9901
+ const parentId = this.extractIdFromForeignKey(parentIdValue, primaryKey);
9901
9902
  const treeItem = itemMap.get(itemId);
9902
9903
  // Skip if already processed
9903
9904
  if (processedItems.has(itemId)) {
@@ -9906,7 +9907,8 @@ class CideEleDataGridComponent {
9906
9907
  if (treeItem && parentId && itemMap.has(parentId)) {
9907
9908
  // This is a child item - check if parent is processed or is a root
9908
9909
  const parent = itemMap.get(parentId);
9909
- const parentParentId = this.getNestedValue(parent, foreignKey);
9910
+ const parentParentIdValue = this.getNestedValue(parent, foreignKey);
9911
+ const parentParentId = this.extractIdFromForeignKey(parentParentIdValue, primaryKey);
9910
9912
  const isParentRoot = !parentParentId || parentParentId === null || parentParentId === undefined;
9911
9913
  if (isParentRoot || processedItems.has(parentId)) {
9912
9914
  // Parent is processed or is root, we can process this child
@@ -10013,7 +10015,8 @@ class CideEleDataGridComponent {
10013
10015
  // Get parent information
10014
10016
  const itemId = String(this.getNestedValue(item, primaryKey) || '');
10015
10017
  const parentIdValue = this.getNestedValue(item, foreignKey);
10016
- const parentId = parentIdValue !== null && parentIdValue !== undefined ? String(parentIdValue) : '';
10018
+ // Extract parent ID generically - handle both string IDs and nested objects
10019
+ const parentId = this.extractIdFromForeignKey(parentIdValue, primaryKey);
10017
10020
  // If no parent, this is a root item (level 0)
10018
10021
  if (!parentId || !itemMap.has(parentId)) {
10019
10022
  return 0;
@@ -10122,7 +10125,8 @@ class CideEleDataGridComponent {
10122
10125
  return;
10123
10126
  }
10124
10127
  const parentIdValue = this.getNestedValue(item, foreignKey);
10125
- const parentId = parentIdValue !== null && parentIdValue !== undefined ? String(parentIdValue) : '';
10128
+ // Extract parent ID generically - handle both string IDs and nested objects
10129
+ const parentId = this.extractIdFromForeignKey(parentIdValue, primaryKey);
10126
10130
  if (parentId) {
10127
10131
  // Item has a parent - try to find parent
10128
10132
  const parent = findParentInResult(parentId);
@@ -11448,6 +11452,30 @@ class CideEleDataGridComponent {
11448
11452
  return current && typeof current === 'object' ? current[key] : undefined;
11449
11453
  }, obj);
11450
11454
  }
11455
+ /**
11456
+ * Extract ID from foreign key value generically
11457
+ * Handles both string IDs and nested objects (e.g., { _id: "...", name: "..." })
11458
+ * @param foreignKeyValue - The foreign key value (can be string, object, or null/undefined)
11459
+ * @param primaryKey - The primary key field name (defaults to '_id')
11460
+ * @returns The extracted ID as a string, or empty string if not found
11461
+ */
11462
+ extractIdFromForeignKey(foreignKeyValue, primaryKey = '_id') {
11463
+ if (foreignKeyValue === null || foreignKeyValue === undefined) {
11464
+ return '';
11465
+ }
11466
+ // If it's already a string, return it
11467
+ if (typeof foreignKeyValue === 'string') {
11468
+ return foreignKeyValue.trim();
11469
+ }
11470
+ // If it's an object, extract the ID using the primary key
11471
+ if (typeof foreignKeyValue === 'object' && foreignKeyValue !== null) {
11472
+ const id = foreignKeyValue[primaryKey];
11473
+ if (id !== null && id !== undefined) {
11474
+ return String(id);
11475
+ }
11476
+ }
11477
+ return '';
11478
+ }
11451
11479
  /**
11452
11480
  * Set a nested value in an object using dot notation
11453
11481
  * @param obj The object to modify
@@ -11745,9 +11773,36 @@ class CideEleDataGridComponent {
11745
11773
  if (column.formatter) {
11746
11774
  displayValue = this.formatValue(displayValue, column);
11747
11775
  }
11748
- // If display value is still an object, convert to string
11776
+ // If display value is still an object, try to extract a meaningful value
11749
11777
  if (typeof displayValue === 'object' && displayValue !== null && !Array.isArray(displayValue) && !(displayValue instanceof Date)) {
11750
- displayValue = String(displayValue);
11778
+ // Try to get a name/title property from the object
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';
11751
11806
  }
11752
11807
  const groupKey = `${groupColumnKey}:${this.getFilterValueKey(rawValue)}`;
11753
11808
  const existing = groups.get(groupKey);