cloud-ide-element 1.0.64 → 1.0.66
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 +110 -51
- package/fesm2022/cloud-ide-element.mjs.map +1 -1
- package/index.d.ts +30 -1
- package/package.json +1 -1
|
@@ -4499,46 +4499,20 @@ class CideEleFileImageDirective {
|
|
|
4499
4499
|
}
|
|
4500
4500
|
displayImage(fileData) {
|
|
4501
4501
|
const imgElement = this.elementRef.nativeElement;
|
|
4502
|
-
//
|
|
4503
|
-
|
|
4504
|
-
|
|
4505
|
-
|
|
4506
|
-
|
|
4507
|
-
|
|
4508
|
-
// If you have a direct URL to the file, use it
|
|
4509
|
-
imgElement.src = fileData.cyfm_path;
|
|
4510
|
-
imgElement.alt = fileData.cyfm_alt_text || this.altText;
|
|
4511
|
-
console.log('✅ [FileImageDirective] Image loaded from path:', fileData.cyfm_path);
|
|
4512
|
-
}
|
|
4513
|
-
else if (fileData.cyfm_file_base64) {
|
|
4514
|
-
// If base64 data is available, use it
|
|
4515
|
-
let base64Data = fileData.cyfm_file_base64;
|
|
4516
|
-
if (!base64Data.startsWith('data:')) {
|
|
4517
|
-
const mimeType = fileData.cyfm_type || 'image/jpeg';
|
|
4518
|
-
base64Data = `data:${mimeType};base64,${base64Data}`;
|
|
4519
|
-
}
|
|
4520
|
-
imgElement.src = base64Data;
|
|
4521
|
-
imgElement.alt = fileData.cyfm_alt_text || this.altText;
|
|
4522
|
-
console.log('✅ [FileImageDirective] Image loaded from base64 data');
|
|
4523
|
-
}
|
|
4524
|
-
else {
|
|
4525
|
-
console.warn('⚠️ [FileImageDirective] No image data available for file:', fileData.cyfm_name);
|
|
4502
|
+
// Use base64 data directly
|
|
4503
|
+
if (fileData.cyfm_file_base64) {
|
|
4504
|
+
let base64Data = fileData.cyfm_file_base64;
|
|
4505
|
+
if (!base64Data.startsWith('data:')) {
|
|
4506
|
+
const mimeType = fileData.cyfm_type || 'image/jpeg';
|
|
4507
|
+
base64Data = `data:${mimeType};base64,${base64Data}`;
|
|
4526
4508
|
}
|
|
4509
|
+
imgElement.src = base64Data;
|
|
4510
|
+
imgElement.alt = fileData.cyfm_alt_text || this.altText;
|
|
4511
|
+
console.log('✅ [FileImageDirective] Image loaded from base64 data');
|
|
4527
4512
|
}
|
|
4528
4513
|
else {
|
|
4529
|
-
console.warn('⚠️ [FileImageDirective]
|
|
4530
|
-
}
|
|
4531
|
-
}
|
|
4532
|
-
isImageFile(fileName, fileType) {
|
|
4533
|
-
if (fileType && fileType.startsWith('image/')) {
|
|
4534
|
-
return true;
|
|
4535
|
-
}
|
|
4536
|
-
if (fileName) {
|
|
4537
|
-
const imageExtensions = ['.jpg', '.jpeg', '.png', '.gif', '.bmp', '.webp', '.svg'];
|
|
4538
|
-
const lowerFileName = fileName.toLowerCase();
|
|
4539
|
-
return imageExtensions.some(ext => lowerFileName.endsWith(ext));
|
|
4514
|
+
console.warn('⚠️ [FileImageDirective] No base64 data available for file');
|
|
4540
4515
|
}
|
|
4541
|
-
return false;
|
|
4542
4516
|
}
|
|
4543
4517
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.7", ngImport: i0, type: CideEleFileImageDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
4544
4518
|
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.1.7", type: CideEleFileImageDirective, isStandalone: true, selector: "[cideEleFileImage]", inputs: { fileId: "fileId", altText: "altText" }, ngImport: i0 });
|
|
@@ -5593,10 +5567,17 @@ class CideEleDataGridComponent {
|
|
|
5593
5567
|
const baseOrder = Math.min(...this.displayedData.map(item => this.getItemOrder(item)));
|
|
5594
5568
|
const newOrderValue = baseOrder + index;
|
|
5595
5569
|
currentEntry.newPosition = newOrderValue;
|
|
5570
|
+
// IMPORTANT: Update the actual sequence value in the item itself
|
|
5571
|
+
this.setNestedValue(item, dragDropConfig.orderField, newOrderValue);
|
|
5596
5572
|
}
|
|
5597
5573
|
else {
|
|
5598
5574
|
// Fallback to index-based position
|
|
5599
|
-
|
|
5575
|
+
const newOrderValue = index + 1;
|
|
5576
|
+
currentEntry.newPosition = newOrderValue;
|
|
5577
|
+
// Update the actual sequence value in the item itself
|
|
5578
|
+
if (dragDropConfig?.orderField) {
|
|
5579
|
+
this.setNestedValue(item, dragDropConfig.orderField, newOrderValue);
|
|
5580
|
+
}
|
|
5600
5581
|
}
|
|
5601
5582
|
this.rowOrderMap.set(itemId, currentEntry);
|
|
5602
5583
|
}
|
|
@@ -5684,6 +5665,23 @@ class CideEleDataGridComponent {
|
|
|
5684
5665
|
.sort((a, b) => a.newPosition - b.newPosition)
|
|
5685
5666
|
.map(orderedItem => orderedItem.item);
|
|
5686
5667
|
}
|
|
5668
|
+
/**
|
|
5669
|
+
* Get only the items that have actually changed order
|
|
5670
|
+
*/
|
|
5671
|
+
getChangedOrders() {
|
|
5672
|
+
const changedItems = [];
|
|
5673
|
+
// Get the full dataset from the config
|
|
5674
|
+
const fullData = this.mergedConfig().data || [];
|
|
5675
|
+
// Check each item to see if its position has changed
|
|
5676
|
+
this.rowOrderMap.forEach((orderInfo, itemId) => {
|
|
5677
|
+
const item = fullData.find(dataItem => this.getItemId(dataItem) === itemId);
|
|
5678
|
+
if (item && orderInfo.oldPosition !== orderInfo.newPosition) {
|
|
5679
|
+
changedItems.push(item);
|
|
5680
|
+
console.log('🔍 Item changed order:', itemId, 'from', orderInfo.oldPosition, 'to', orderInfo.newPosition);
|
|
5681
|
+
}
|
|
5682
|
+
});
|
|
5683
|
+
return changedItems;
|
|
5684
|
+
}
|
|
5687
5685
|
/**
|
|
5688
5686
|
* Update local data order for visual reordering (LOCAL ONLY)
|
|
5689
5687
|
*/
|
|
@@ -5735,25 +5733,32 @@ class CideEleDataGridComponent {
|
|
|
5735
5733
|
console.log('🔍 Reset clicked, row order map reset locally, visual display reverted');
|
|
5736
5734
|
}
|
|
5737
5735
|
else if (action.key === 'save-order') {
|
|
5738
|
-
|
|
5739
|
-
|
|
5740
|
-
|
|
5741
|
-
|
|
5742
|
-
|
|
5743
|
-
|
|
5744
|
-
|
|
5745
|
-
|
|
5746
|
-
|
|
5747
|
-
|
|
5736
|
+
// Check if there are any actual changes before proceeding
|
|
5737
|
+
const hasActualChanges = this.checkIfOrderChanged();
|
|
5738
|
+
if (!hasActualChanges) {
|
|
5739
|
+
console.log('🔍 No actual order changes detected, skipping save');
|
|
5740
|
+
this.hasOrderChanged.set(false);
|
|
5741
|
+
return;
|
|
5742
|
+
}
|
|
5743
|
+
// Get only the changed orders and emit them BEFORE clearing local data
|
|
5744
|
+
const changedOrders = this.getChangedOrders();
|
|
5745
|
+
if (changedOrders.length > 0) {
|
|
5746
|
+
console.log('🔍 Emitting rowReorder event with changed orders only:', changedOrders);
|
|
5747
|
+
console.log('🔍 Number of changed records:', changedOrders.length, 'out of', this.getCurrentOrderFromMap().length, 'total records');
|
|
5748
5748
|
// Use the expected GridEvent structure for rowReorder
|
|
5749
5749
|
this.emitEvent('rowReorder', {
|
|
5750
|
-
sourceItem:
|
|
5750
|
+
sourceItem: changedOrders[0], // First changed item as source
|
|
5751
5751
|
sourceIndex: 0, // First position as source
|
|
5752
|
-
targetItem:
|
|
5753
|
-
targetIndex:
|
|
5754
|
-
newOrder:
|
|
5752
|
+
targetItem: changedOrders[changedOrders.length - 1], // Last changed item as target
|
|
5753
|
+
targetIndex: changedOrders.length - 1, // Last position as target
|
|
5754
|
+
newOrder: changedOrders, // Only the records whose order actually changed
|
|
5755
|
+
allOrders: this.getCurrentOrderFromMap() // Complete order for reference
|
|
5755
5756
|
});
|
|
5756
5757
|
}
|
|
5758
|
+
// DON'T clear the local data or reset the order map here
|
|
5759
|
+
// Let the parent component handle the data refresh after API call
|
|
5760
|
+
// The local data will be cleared when new data arrives via ngOnChanges
|
|
5761
|
+
console.log('🔍 Save clicked, rowReorder event emitted, preserving local data until API response');
|
|
5757
5762
|
}
|
|
5758
5763
|
if (this.actionHandlers[action.onClick]) {
|
|
5759
5764
|
this.actionHandlers[action.onClick](item, action);
|
|
@@ -5779,6 +5784,60 @@ class CideEleDataGridComponent {
|
|
|
5779
5784
|
return current && typeof current === 'object' ? current[key] : undefined;
|
|
5780
5785
|
}, obj);
|
|
5781
5786
|
}
|
|
5787
|
+
/**
|
|
5788
|
+
* Set a nested value in an object using dot notation
|
|
5789
|
+
* @param obj The object to modify
|
|
5790
|
+
* @param path The dot notation path (e.g., 'contact.email')
|
|
5791
|
+
* @param value The value to set
|
|
5792
|
+
* @example
|
|
5793
|
+
* const obj = { contact: { email: 'old@example.com' } };
|
|
5794
|
+
* setNestedValue(obj, 'contact.email', 'new@example.com');
|
|
5795
|
+
* // obj.contact.email === 'new@example.com'
|
|
5796
|
+
*/
|
|
5797
|
+
setNestedValue(obj, path, value) {
|
|
5798
|
+
const keys = path.split('.');
|
|
5799
|
+
const lastKey = keys.pop();
|
|
5800
|
+
const target = keys.reduce((current, key) => {
|
|
5801
|
+
if (current && typeof current === 'object') {
|
|
5802
|
+
if (!current[key]) {
|
|
5803
|
+
current[key] = {};
|
|
5804
|
+
}
|
|
5805
|
+
return current[key];
|
|
5806
|
+
}
|
|
5807
|
+
return undefined;
|
|
5808
|
+
}, obj);
|
|
5809
|
+
if (target && typeof target === 'object') {
|
|
5810
|
+
target[lastKey] = value;
|
|
5811
|
+
}
|
|
5812
|
+
}
|
|
5813
|
+
/**
|
|
5814
|
+
* Compare two order arrays to check if they are different
|
|
5815
|
+
* This method can be used by parent components to check if order has actually changed
|
|
5816
|
+
* @param currentOrder Current order array
|
|
5817
|
+
* @param originalOrder Original order array
|
|
5818
|
+
* @returns true if orders are different, false if they are the same
|
|
5819
|
+
*/
|
|
5820
|
+
compareOrders(currentOrder, originalOrder) {
|
|
5821
|
+
console.log('🔍 DataGrid: Comparing orders - current length:', currentOrder.length, 'original length:', originalOrder.length);
|
|
5822
|
+
// If lengths are different, there are changes
|
|
5823
|
+
if (currentOrder.length !== originalOrder.length) {
|
|
5824
|
+
console.log('🔍 DataGrid: Lengths are different, returning true');
|
|
5825
|
+
return true;
|
|
5826
|
+
}
|
|
5827
|
+
// Compare the order of items by their IDs (not just their sequence values)
|
|
5828
|
+
// This will detect if items have been reordered even if sequence values are the same
|
|
5829
|
+
for (let i = 0; i < currentOrder.length; i++) {
|
|
5830
|
+
const currentItem = currentOrder[i];
|
|
5831
|
+
const originalItem = originalOrder[i];
|
|
5832
|
+
console.log('🔍 DataGrid: Position', i, '- Current ID:', currentItem.id, 'Original ID:', originalItem.id);
|
|
5833
|
+
if (currentItem.id !== originalItem.id) {
|
|
5834
|
+
console.log('🔍 DataGrid: Different item at position', i, 'returning true');
|
|
5835
|
+
return true;
|
|
5836
|
+
}
|
|
5837
|
+
}
|
|
5838
|
+
console.log('🔍 DataGrid: No differences found, returning false');
|
|
5839
|
+
return false;
|
|
5840
|
+
}
|
|
5782
5841
|
formatValue(value, column) {
|
|
5783
5842
|
if (column.formatter) {
|
|
5784
5843
|
if (column.formatter.type === 'custom' && column.formatter.customFunction) {
|