@tsi-developpement/tsi-shared-ui 1.11.6 → 1.11.7

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.
@@ -8186,6 +8186,7 @@ class EditableGridComponent extends TsiInputBase {
8186
8186
  items.forEach(el => el.translatedHeader = this._localizePipe.transform(el.header ?? ""));
8187
8187
  this._columns = items;
8188
8188
  this.selectedColumns = [...items];
8189
+ this._reapplyRestoredColumnOrder();
8189
8190
  if (isObservable) {
8190
8191
  this._columnsChangedSubscription = value.changed.subscribe(event => {
8191
8192
  console.log("event changed => ", event);
@@ -8345,6 +8346,7 @@ class EditableGridComponent extends TsiInputBase {
8345
8346
  }
8346
8347
  restoreState(configuration) {
8347
8348
  let state = JSON.parse(configuration);
8349
+ this._restoredColumnOrder = state.columnOrder ?? this._restoredColumnOrder;
8348
8350
  if (this.dt) {
8349
8351
  this.columnWidth.setRemembered(state.columnWidths);
8350
8352
  this.dt.columnWidthsState = state.columnWidths;
@@ -8373,6 +8375,7 @@ class EditableGridComponent extends TsiInputBase {
8373
8375
  }
8374
8376
  resetSelectedColumns(configuration) {
8375
8377
  let state = JSON.parse(configuration);
8378
+ this._restoredColumnOrder = state.columnOrder ?? this._restoredColumnOrder;
8376
8379
  if (this.dt) {
8377
8380
  this.columnWidth.reset();
8378
8381
  this.columnWidth.setRemembered(state.columnWidths);
@@ -8438,6 +8441,7 @@ class EditableGridComponent extends TsiInputBase {
8438
8441
  newColumns.splice(event.newStartingIndex, 0, ...event.newItems);
8439
8442
  this._columns = newColumns;
8440
8443
  this.selectedColumns = this._columns.filter(c => prevSelected.has(c) || event.newItems.includes(c));
8444
+ this._reapplyRestoredColumnOrder();
8441
8445
  }
8442
8446
  break;
8443
8447
  }
@@ -8458,6 +8462,7 @@ class EditableGridComponent extends TsiInputBase {
8458
8462
  newColumns.splice(event.newStartingIndex, event.oldItems.length, ...event.newItems);
8459
8463
  this._columns = newColumns;
8460
8464
  this.selectedColumns = this._columns.filter(c => (prevSelected.has(c) && !removedOld.has(c)) || event.newItems.includes(c));
8465
+ this._reapplyRestoredColumnOrder();
8461
8466
  }
8462
8467
  break;
8463
8468
  }
@@ -8471,6 +8476,20 @@ class EditableGridComponent extends TsiInputBase {
8471
8476
  this._verifyGridRequirements();
8472
8477
  this._initCurrentRowNumberAndOrderByRowNumber();
8473
8478
  }
8479
+ /**
8480
+ * Re-applies the saved presentation after the columns changed, so only the saved columns render,
8481
+ * in the saved order. No-op until a layout is restored, or while none of its keys resolve yet
8482
+ * (keeps the default "all columns" instead of an empty grid). Widths need no re-apply: the
8483
+ * positional style PrimeNG wrote in restoreState matches again once the saved order is back.
8484
+ */
8485
+ _reapplyRestoredColumnOrder() {
8486
+ if (!this._restoredColumnOrder)
8487
+ return;
8488
+ const reorderedColumns = this.getReorderedColumns(this._restoredColumnOrder);
8489
+ if (reorderedColumns.length > 0) {
8490
+ this.selectedColumns = reorderedColumns;
8491
+ }
8492
+ }
8474
8493
  saveItems() {
8475
8494
  const clean = this._cleanGridDataForEmit();
8476
8495
  this.saveDataEventEmitter.emit(clean);
@@ -17949,8 +17968,7 @@ class TsiFormComponentBaseComponent extends AppBaseComponent {
17949
17968
  }
17950
17969
  async _fetchWorkflowEntityInformationCore() {
17951
17970
  await this.getEntityInformation(this.businessClass);
17952
- const requiresDescriminator = !!(this.entityInfo?.discriminatorClassName || this.entityInfo?.discriminatorPropertyName);
17953
- if (requiresDescriminator && !this.descriminatorValue) {
17971
+ if (this._isAwaitingDescriminator()) {
17954
17972
  return;
17955
17973
  }
17956
17974
  let request = new GetWorkflowInstanceInformationRequest();
@@ -17983,6 +18001,11 @@ class TsiFormComponentBaseComponent extends AppBaseComponent {
17983
18001
  this._fetchWorkflowEntityInformation()
17984
18002
  ]);
17985
18003
  }
18004
+ // The entity is discriminated but the discriminator isn't known yet: the componentDescriminator setter applies the config later.
18005
+ _isAwaitingDescriminator() {
18006
+ return !this.descriminatorValue
18007
+ && !!(this.entityInfo?.discriminatorClassName || this.entityInfo?.discriminatorPropertyName);
18008
+ }
17986
18009
  //#endregion traiter multiple combo
17987
18010
  getWorkflowEtatForm() {
17988
18011
  let workflowEtatForm = this._workflowConfigurationService.getWorkflowEtatFormFromCacheSync(this.businessClass, this.descriminatorValue)