@tsi-developpement/tsi-shared-ui 1.10.20 → 1.10.21

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.
@@ -8492,11 +8492,23 @@ class EditableGridComponent extends TsiInputBase {
8492
8492
  if (this._isAutoRowNumber) {
8493
8493
  duplicatedRow[this._autoRowNumberField] = this._nextRowNumber();
8494
8494
  }
8495
- this.gridData.push(duplicatedRow);
8496
- this.isDirty = true;
8497
8495
  if (this.editableTable?.sortField && this.editableTable.sortOrder) {
8498
- this.editableTable?.value.push(duplicatedRow);
8496
+ const tableIndex = this.editableTable.value.indexOf(item, 0);
8497
+ if (tableIndex > -1) {
8498
+ this.editableTable.value.splice(tableIndex + 1, 0, duplicatedRow);
8499
+ }
8500
+ else {
8501
+ this.editableTable.value.push(duplicatedRow);
8502
+ }
8503
+ }
8504
+ const dataIndex = this.gridData.indexOf(item, 0);
8505
+ if (dataIndex > -1) {
8506
+ this.gridData.splice(dataIndex + 1, 0, duplicatedRow);
8499
8507
  }
8508
+ else {
8509
+ this.gridData.push(duplicatedRow);
8510
+ }
8511
+ this.isDirty = true;
8500
8512
  this.refreshSort();
8501
8513
  if (updateSelection) {
8502
8514
  this.selectedItem = duplicatedRow;
@@ -8505,7 +8517,7 @@ class EditableGridComponent extends TsiInputBase {
8505
8517
  : duplicatedRow;
8506
8518
  }
8507
8519
  const result = {
8508
- rowNumber: this.gridData.length - 1,
8520
+ rowNumber: this.gridData.indexOf(duplicatedRow),
8509
8521
  data: duplicatedRow
8510
8522
  };
8511
8523
  if (!skipEmit) {