@acorex/platform 21.0.0-next.18 → 21.0.0-next.19

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.
@@ -5275,6 +5275,9 @@ class AXPTabListConverter extends AXPBaseRelatedEntityConverter {
5275
5275
  // Don't evaluate actions here - keep expression strings for lazy evaluation at execution time
5276
5276
  // This ensures actions use the latest context data when executed
5277
5277
  const actions = await evaluateExpressions(relatedEntity.actions);
5278
+ console.time('tab-list-converter1');
5279
+ await new Promise((resolve) => setTimeout(resolve, 500));
5280
+ console.timeEnd('tab-list-converter2');
5278
5281
  return {
5279
5282
  id: entityDef?.name ?? '',
5280
5283
  title: relatedEntity.title ?? entityDef?.title ?? '',
@@ -10882,8 +10885,6 @@ class AXPEntityListWidgetViewComponent extends AXPValueWidgetComponent {
10882
10885
  this.list = viewChild('list', ...(ngDevMode ? [{ debugName: "list" }] : []));
10883
10886
  this.allWidgets = viewChildren(AXPWidgetRendererDirective, ...(ngDevMode ? [{ debugName: "allWidgets" }] : []));
10884
10887
  this.listWidget = linkedSignal(() => this.allWidgets().find((widget) => widget.node()?.type === AXPWidgetsCatalog.dataList), ...(ngDevMode ? [{ debugName: "listWidget" }] : []));
10885
- // Cached instance reference to ensure consistency with the first created instance
10886
- this.listWidgetInstance = signal(null, ...(ngDevMode ? [{ debugName: "listWidgetInstance" }] : []));
10887
10888
  this.toolbarWidget = computed(() => this.allWidgets().find((widget) => widget.node()?.type === AXPWidgetsCatalog.listToolbar), ...(ngDevMode ? [{ debugName: "toolbarWidget" }] : []));
10888
10889
  this.selectedItems = signal([], ...(ngDevMode ? [{ debugName: "selectedItems" }] : []));
10889
10890
  this.toolbarNode = signal(null, ...(ngDevMode ? [{ debugName: "toolbarNode" }] : []));
@@ -10965,18 +10966,17 @@ class AXPEntityListWidgetViewComponent extends AXPValueWidgetComponent {
10965
10966
  //TODO: this is a temporary solution to handle the query changes; this should be removed when the query changes are handled in the widget core;
10966
10967
  if (this.getValue()?.toolbar) {
10967
10968
  this.queries = this.getValue()?.toolbar;
10968
- // Use cached instance or get from listWidget
10969
- const listInstance = this.listWidgetInstance() || this.listWidget()?.instance;
10970
- // const dataSource = this.listWidget()?.options()['dataSource'] as AXDataSource;
10971
- const dataSource = listInstance?.options()?.['dataSource'];
10972
- const isMounted = this.isMounted();
10973
- if (!this.hasRequiredDependencies(dataSource, this.queries, listInstance)) {
10974
- return;
10975
- }
10976
- untracked(() => {
10977
- this.handleQueryChanges(this.queries, dataSource, listInstance, isMounted);
10978
- });
10979
10969
  }
10970
+ const listInstance = this.listWidget()?.instance;
10971
+ // const dataSource = this.listWidget()?.options()['dataSource'] as AXDataSource;
10972
+ const dataSource = listInstance?.options()?.['dataSource'];
10973
+ const isMounted = this.isMounted();
10974
+ if (!this.hasRequiredDependencies(dataSource, this.queries, listInstance)) {
10975
+ return;
10976
+ }
10977
+ untracked(() => {
10978
+ this.handleQueryChanges(this.queries, dataSource, listInstance, isMounted);
10979
+ });
10980
10980
  }, ...(ngDevMode ? [{ debugName: "#effect" }] : []));
10981
10981
  //#endregion
10982
10982
  this.context = {};
@@ -11108,8 +11108,7 @@ class AXPEntityListWidgetViewComponent extends AXPValueWidgetComponent {
11108
11108
  if (!changeTracker.isColumnsChanged) {
11109
11109
  return;
11110
11110
  }
11111
- // Use cached instance or get from listWidget
11112
- const listInstance = this.listWidgetInstance() || this.listWidget()?.instance;
11111
+ const listInstance = this.listWidget()?.instance;
11113
11112
  const toolbarState = this.getValue()?.toolbar;
11114
11113
  if (!listInstance || !toolbarState?.columns) {
11115
11114
  return;
@@ -11175,8 +11174,7 @@ class AXPEntityListWidgetViewComponent extends AXPValueWidgetComponent {
11175
11174
  .pipe(takeUntil(this.destroyed))
11176
11175
  .subscribe((event) => {
11177
11176
  if (event.payload.entity == this.entitySource()) {
11178
- const instance = this.listWidgetInstance() || this.listWidget()?.instance;
11179
- instance?.call('refresh');
11177
+ this.listWidget()?.instance.call('refresh');
11180
11178
  }
11181
11179
  });
11182
11180
  this.eventService
@@ -11184,36 +11182,21 @@ class AXPEntityListWidgetViewComponent extends AXPValueWidgetComponent {
11184
11182
  .pipe(takeUntil(this.destroyed))
11185
11183
  .subscribe((e) => {
11186
11184
  if (e.data.name == `${this.entity()?.module}.${this.entity()?.name}`) {
11187
- const instance = this.listWidgetInstance() || this.listWidget()?.instance;
11188
- instance?.call('refresh');
11185
+ this.listWidget()?.instance.call('refresh');
11189
11186
  }
11190
11187
  });
11191
- // Wait for the widget to be available using listWidget signal
11192
- // Poll until the widget instance is ready to ensure we use the first created instance
11193
- let attempts = 0;
11194
- const maxAttempts = 50; // 5 seconds max wait (50 * 100ms)
11195
- while (attempts < maxAttempts) {
11196
- const widgetDirective = this.listWidget();
11197
- if (widgetDirective?.instance) {
11198
- const listWidgetInstance = widgetDirective.instance;
11199
- // Cache the instance for consistent usage across all methods
11200
- this.listWidgetInstance.set(listWidgetInstance);
11201
- if (listWidgetInstance?.api && typeof listWidgetInstance.api === 'function') {
11202
- const onSelectionChange = listWidgetInstance.api()['onSelectionChange'];
11203
- if (onSelectionChange) {
11204
- onSelectionChange.pipe(takeUntil(this.destroyed)).subscribe((e) => {
11205
- this.selectedItems.set(e);
11206
- });
11207
- }
11208
- }
11209
- break;
11188
+ const listWidget = (await this.layoutService.waitForWidget(`${this.entitySource()}-tab-list_table`, 500));
11189
+ if (listWidget?.api && typeof listWidget.api === 'function') {
11190
+ const onSelectionChange = listWidget.api()['onSelectionChange'];
11191
+ if (onSelectionChange) {
11192
+ onSelectionChange.pipe(takeUntil(this.destroyed)).subscribe((e) => {
11193
+ this.selectedItems.set(e);
11194
+ });
11210
11195
  }
11211
- await new Promise((resolve) => setTimeout(resolve, 100));
11212
- attempts++;
11213
11196
  }
11214
11197
  }
11215
11198
  ngOnDestroy() {
11216
- this.listWidgetInstance.set(null);
11199
+ this.listWidget.set(undefined);
11217
11200
  this.destroyed.next();
11218
11201
  this.destroyed.complete();
11219
11202
  }