@praxisui/table 8.0.0-beta.55 → 8.0.0-beta.57

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.
@@ -38807,28 +38807,78 @@ class PraxisTable {
38807
38807
  return;
38808
38808
  }
38809
38809
  const href = this.resolveRowDiscoveryHref(rowLinks, 'capabilities');
38810
- if (!href || this.hasFreshRowCapabilitySnapshot(href)) {
38810
+ const surfaceHref = this.resolveRowSurfaceDiscoveryHref(rowLinks);
38811
+ const hasFreshCapabilitySnapshot = !!href && this.hasFreshRowCapabilitySnapshot(href);
38812
+ if (hasFreshCapabilitySnapshot) {
38813
+ const snapshot = this.rowCapabilitySnapshotByHref.get(href);
38814
+ if (snapshot?.surfaces?.length || !surfaceHref || this.hasFreshRowCapabilitySnapshot(surfaceHref)) {
38815
+ return;
38816
+ }
38817
+ }
38818
+ if (!href && surfaceHref && this.hasFreshRowCapabilitySnapshot(surfaceHref)) {
38819
+ return;
38820
+ }
38821
+ if (!href && !surfaceHref) {
38811
38822
  return;
38812
38823
  }
38813
- const inFlight = this.rowCapabilityInFlightByHref.get(href);
38824
+ const cacheHref = hasFreshCapabilitySnapshot ? surfaceHref : href ?? surfaceHref;
38825
+ if (!cacheHref) {
38826
+ return;
38827
+ }
38828
+ const inFlight = this.rowCapabilityInFlightByHref.get(cacheHref);
38814
38829
  if (inFlight) {
38815
38830
  await inFlight;
38816
38831
  return;
38817
38832
  }
38818
38833
  try {
38819
- const snapshot = await firstValueFrom(this.resourceDiscovery.getCapabilities(rowLinks, this.buildRowDiscoveryOptions())
38834
+ if (href && !hasFreshCapabilitySnapshot) {
38835
+ const snapshot = await firstValueFrom(this.resourceDiscovery.getCapabilities(rowLinks, this.buildRowDiscoveryOptions())
38836
+ .pipe(take$1(1)));
38837
+ this.clearRowCapabilityError(href);
38838
+ this.rememberRowCapabilitySnapshot(href, snapshot);
38839
+ if (row && typeof row === 'object') {
38840
+ this.rowContextRuntimeByRef.delete(row);
38841
+ }
38842
+ if (snapshot.surfaces?.length || !surfaceHref) {
38843
+ return;
38844
+ }
38845
+ }
38846
+ }
38847
+ catch (error) {
38848
+ if (href) {
38849
+ this.rememberRowCapabilityError(href);
38850
+ }
38851
+ this.warnLog('[PraxisTable] Nao foi possivel preparar surfaces de registro para contexto AI', error);
38852
+ }
38853
+ if (!surfaceHref) {
38854
+ return;
38855
+ }
38856
+ try {
38857
+ const catalog = await firstValueFrom(this.resourceDiscovery.getSurfaces(rowLinks, this.buildRowDiscoveryOptions())
38820
38858
  .pipe(take$1(1)));
38821
- this.clearRowCapabilityError(href);
38822
- this.rememberRowCapabilitySnapshot(href, snapshot);
38859
+ this.clearRowCapabilityError(surfaceHref);
38860
+ this.rememberRowCapabilitySnapshot(surfaceHref, this.buildCapabilitySnapshotFromSurfaceCatalog(catalog));
38823
38861
  if (row && typeof row === 'object') {
38824
38862
  this.rowContextRuntimeByRef.delete(row);
38825
38863
  }
38826
38864
  }
38827
38865
  catch (error) {
38828
- this.rememberRowCapabilityError(href);
38829
- this.warnLog('[PraxisTable] Nao foi possivel preparar surfaces de registro para contexto AI', error);
38866
+ this.rememberRowCapabilityError(surfaceHref);
38867
+ this.warnLog('[PraxisTable] Nao foi possivel preparar catalogo de surfaces de registro para contexto AI', error);
38830
38868
  }
38831
38869
  }
38870
+ buildCapabilitySnapshotFromSurfaceCatalog(catalog) {
38871
+ return {
38872
+ resourceKey: catalog.resourceKey,
38873
+ resourcePath: catalog.resourcePath,
38874
+ group: catalog.group,
38875
+ resourceId: catalog.resourceId,
38876
+ canonicalOperations: {},
38877
+ operations: {},
38878
+ surfaces: Array.isArray(catalog.surfaces) ? catalog.surfaces : [],
38879
+ actions: [],
38880
+ };
38881
+ }
38832
38882
  buildAiAssistantResourceSurfaceContexts() {
38833
38883
  const selectedRows = this.getSelectedRowsSnapshot();
38834
38884
  if (!selectedRows.length || !this.resourcePath) {
@@ -39528,7 +39578,7 @@ class PraxisTable {
39528
39578
  if (this.aiAdapter || this.aiAdapterLoadStarted)
39529
39579
  return;
39530
39580
  this.aiAdapterLoadStarted = true;
39531
- import('./praxisui-table-table-ai.adapter-CfqlZqod.mjs')
39581
+ import('./praxisui-table-table-ai.adapter-HW-Hh4ID.mjs')
39532
39582
  .then(({ TableAiAdapter }) => {
39533
39583
  this.aiAdapter = new TableAiAdapter(this);
39534
39584
  this.initializeAiAssistantController();
@@ -39678,7 +39728,7 @@ class PraxisTable {
39678
39728
  initializeAiAssistantController() {
39679
39729
  if (!this.aiAdapter || this.aiAssistantController)
39680
39730
  return;
39681
- import('./praxisui-table-table-agentic-authoring-turn-flow-B075RDUj.mjs')
39731
+ import('./praxisui-table-table-agentic-authoring-turn-flow-EmXDCUna.mjs')
39682
39732
  .then(({ TableAgenticAuthoringTurnFlow }) => {
39683
39733
  if (this.aiAssistantController || !this.aiAdapter)
39684
39734
  return;
@@ -46445,6 +46495,14 @@ class PraxisTable {
46445
46495
  return null;
46446
46496
  }
46447
46497
  }
46498
+ resolveRowSurfaceDiscoveryHref(rowLinks) {
46499
+ try {
46500
+ return this.resourceDiscovery.resolveLinkHref(rowLinks, 'surfaces', this.buildRowDiscoveryOptions());
46501
+ }
46502
+ catch {
46503
+ return null;
46504
+ }
46505
+ }
46448
46506
  prefetchRowDiscovery(rows) {
46449
46507
  if (!Array.isArray(rows) || !rows.length || !this.shouldPrefetchRowDiscovery()) {
46450
46508
  return;
@@ -46566,10 +46624,22 @@ class PraxisTable {
46566
46624
  return null;
46567
46625
  }
46568
46626
  const href = this.resolveRowDiscoveryHref(rowLinks, 'capabilities');
46569
- if (!href || !this.hasFreshRowCapabilitySnapshot(href)) {
46570
- return null;
46627
+ let capabilitySnapshot = null;
46628
+ if (href && this.hasFreshRowCapabilitySnapshot(href)) {
46629
+ capabilitySnapshot = this.rowCapabilitySnapshotByHref.get(href) || null;
46630
+ if (capabilitySnapshot?.surfaces?.length) {
46631
+ return capabilitySnapshot;
46632
+ }
46571
46633
  }
46572
- return this.rowCapabilitySnapshotByHref.get(href) || null;
46634
+ const surfaceHref = this.resolveRowSurfaceDiscoveryHref(rowLinks);
46635
+ if (surfaceHref && this.hasFreshRowCapabilitySnapshot(surfaceHref)) {
46636
+ const surfaceSnapshot = this.rowCapabilitySnapshotByHref.get(surfaceHref) || null;
46637
+ if (surfaceSnapshot?.surfaces?.length) {
46638
+ return surfaceSnapshot;
46639
+ }
46640
+ return capabilitySnapshot ?? surfaceSnapshot;
46641
+ }
46642
+ return capabilitySnapshot;
46573
46643
  }
46574
46644
  hasResolvedRowActionCatalog(row) {
46575
46645
  const rowLinks = this.getRowLinks(row);
@@ -554,6 +554,29 @@ class TableAgenticAuthoringTurnFlow {
554
554
  }
555
555
  compileAdapterResponse(response, request) {
556
556
  if (response.type === 'clarification' || response.type === 'info' || response.type === 'error') {
557
+ const compiledExecutable = this.responseMayContainRuntimeOperationEnvelope(response)
558
+ ? this.adapter.compileAiResponse?.(response)
559
+ : null;
560
+ if (compiledExecutable?.patch && Object.keys(compiledExecutable.patch).length > 0) {
561
+ const warnings = [
562
+ ...(response.warnings ?? []),
563
+ ...(compiledExecutable.warnings ?? []),
564
+ ];
565
+ const executableResponse = {
566
+ ...response,
567
+ patch: compiledExecutable.patch,
568
+ warnings: warnings.length ? warnings : undefined,
569
+ };
570
+ delete executableResponse.type;
571
+ return executableResponse;
572
+ }
573
+ if (compiledExecutable?.type === 'error') {
574
+ return {
575
+ type: 'error',
576
+ message: compiledExecutable.message || 'O componentEditPlan da tabela nao passou na validacao de capacidades.',
577
+ warnings: compiledExecutable.warnings,
578
+ };
579
+ }
557
580
  return response;
558
581
  }
559
582
  const compiled = this.adapter.compileAiResponse?.(response);
@@ -608,6 +631,18 @@ class TableAgenticAuthoringTurnFlow {
608
631
  warnings: warnings.length ? warnings : undefined,
609
632
  };
610
633
  }
634
+ responseMayContainRuntimeOperationEnvelope(response) {
635
+ const record = response;
636
+ if (record['tableRuntimeOperations'])
637
+ return true;
638
+ const patch = this.toRecord(record['patch']);
639
+ if (patch?.['tableRuntimeOperations'])
640
+ return true;
641
+ return ['message', 'assistantMessage', 'content', 'explanation'].some((key) => {
642
+ const value = this.stringValue(record[key]);
643
+ return value.includes('tableRuntimeOperations') && value.includes('operationId');
644
+ });
645
+ }
611
646
  isGovernedSelectedRecordFilterResponse(response) {
612
647
  return (response.warnings ?? []).some((warning) => [
613
648
  'selected-record-filter-request-materialized',
@@ -1,7 +1,7 @@
1
1
  import { firstValueFrom } from 'rxjs';
2
2
  import { BaseAiAdapter, createComponentAuthoringContext } from '@praxisui/ai';
3
3
  import { deepMerge } from '@praxisui/core';
4
- import { z as TABLE_COMPONENT_EDIT_PLAN_OPERATION_IDS, k as PRAXIS_TABLE_AUTHORING_MANIFEST, T as TABLE_AI_CAPABILITIES, R as coerceTableComponentEditPlans, W as compileTableComponentEditPlans, G as TASK_PRESETS, $ as getTableComponentEditPlanCapabilities, w as TABLE_COMPONENT_EDIT_PLAN_EXPECTED_PATHS, u as TABLE_COMPONENT_EDIT_PLAN_ALLOWED_CHANGE_KINDS, x as TABLE_COMPONENT_EDIT_PLAN_JSON_SCHEMA, E as TABLE_COMPONENT_EDIT_PLAN_VERSION, v as TABLE_COMPONENT_EDIT_PLAN_BATCH_KIND, y as TABLE_COMPONENT_EDIT_PLAN_KIND } from './praxisui-table-praxisui-table-B7_x2kDC.mjs';
4
+ import { z as TABLE_COMPONENT_EDIT_PLAN_OPERATION_IDS, k as PRAXIS_TABLE_AUTHORING_MANIFEST, T as TABLE_AI_CAPABILITIES, R as coerceTableComponentEditPlans, W as compileTableComponentEditPlans, G as TASK_PRESETS, $ as getTableComponentEditPlanCapabilities, w as TABLE_COMPONENT_EDIT_PLAN_EXPECTED_PATHS, u as TABLE_COMPONENT_EDIT_PLAN_ALLOWED_CHANGE_KINDS, x as TABLE_COMPONENT_EDIT_PLAN_JSON_SCHEMA, E as TABLE_COMPONENT_EDIT_PLAN_VERSION, v as TABLE_COMPONENT_EDIT_PLAN_BATCH_KIND, y as TABLE_COMPONENT_EDIT_PLAN_KIND } from './praxisui-table-praxisui-table-2nSPgkfc.mjs';
5
5
 
6
6
  const TABLE_COMPONENT_CONTEXT_PACK = {
7
7
  version: 'v1',
@@ -1 +1 @@
1
- export { A as AnalyticsTableConfigAdapterService, a as AnalyticsTableContractService, b as AnalyticsTableStatsApiService, B as BOOLEAN_PRESETS, c as BehaviorConfigEditorComponent, C as CURRENCY_PRESETS, d as ColumnsConfigEditorComponent, D as DATE_PRESETS, e as DataFormatterComponent, f as DataFormattingService, F as FORMULA_TEMPLATES, g as FilterConfigService, h as FilterSettingsComponent, i as FormulaGeneratorService, J as JsonConfigEditorComponent, M as MessagesLocalizationEditorComponent, N as NUMBER_PRESETS, P as PERCENTAGE_PRESETS, j as PRAXIS_FILTER_COMPONENT_METADATA, k as PRAXIS_TABLE_AUTHORING_MANIFEST, l as PRAXIS_TABLE_COMPONENT_METADATA, m as PraxisFilter, n as PraxisFilterWidgetConfigEditor, o as PraxisTable, p as PraxisTableConfigEditor, q as PraxisTableInlineAuthoringEditorComponent, r as PraxisTableToolbar, s as PraxisTableWidgetConfigEditor, S as STRING_PRESETS, T as TABLE_AI_CAPABILITIES, t as TABLE_COMPONENT_AI_CAPABILITIES, u as TABLE_COMPONENT_EDIT_PLAN_ALLOWED_CHANGE_KINDS, v as TABLE_COMPONENT_EDIT_PLAN_BATCH_KIND, w as TABLE_COMPONENT_EDIT_PLAN_EXPECTED_PATHS, x as TABLE_COMPONENT_EDIT_PLAN_JSON_SCHEMA, y as TABLE_COMPONENT_EDIT_PLAN_KIND, E as TABLE_COMPONENT_EDIT_PLAN_VERSION, G as TASK_PRESETS, H as TableDefaultsProvider, I as TableRulesEditorComponent, K as ToolbarActionsEditorComponent, V as ValueMappingEditorComponent, L as VisualFormulaBuilderComponent, O as buildTableApplyPlan, Q as coerceTableComponentEditPlan, R as coerceTableComponentEditPlans, U as compileTableComponentEditPlan, W as compileTableComponentEditPlans, X as createTableAuthoringDocument, Y as getActionId, Z as getEnum, _ as getTableCapabilities, $ as getTableComponentEditPlanCapabilities, a0 as isTableRendererSupportedByRichContentP0, a1 as mapTableRendererToRichContentP0, a2 as normalizeTableAuthoringDocument, a3 as parseLegacyOrTableDocument, a4 as providePraxisFilterMetadata, a5 as providePraxisTableMetadata, a6 as serializeTableAuthoringDocument, a7 as toCanonicalTableConfig, a8 as validateTableAuthoringDocument } from './praxisui-table-praxisui-table-B7_x2kDC.mjs';
1
+ export { A as AnalyticsTableConfigAdapterService, a as AnalyticsTableContractService, b as AnalyticsTableStatsApiService, B as BOOLEAN_PRESETS, c as BehaviorConfigEditorComponent, C as CURRENCY_PRESETS, d as ColumnsConfigEditorComponent, D as DATE_PRESETS, e as DataFormatterComponent, f as DataFormattingService, F as FORMULA_TEMPLATES, g as FilterConfigService, h as FilterSettingsComponent, i as FormulaGeneratorService, J as JsonConfigEditorComponent, M as MessagesLocalizationEditorComponent, N as NUMBER_PRESETS, P as PERCENTAGE_PRESETS, j as PRAXIS_FILTER_COMPONENT_METADATA, k as PRAXIS_TABLE_AUTHORING_MANIFEST, l as PRAXIS_TABLE_COMPONENT_METADATA, m as PraxisFilter, n as PraxisFilterWidgetConfigEditor, o as PraxisTable, p as PraxisTableConfigEditor, q as PraxisTableInlineAuthoringEditorComponent, r as PraxisTableToolbar, s as PraxisTableWidgetConfigEditor, S as STRING_PRESETS, T as TABLE_AI_CAPABILITIES, t as TABLE_COMPONENT_AI_CAPABILITIES, u as TABLE_COMPONENT_EDIT_PLAN_ALLOWED_CHANGE_KINDS, v as TABLE_COMPONENT_EDIT_PLAN_BATCH_KIND, w as TABLE_COMPONENT_EDIT_PLAN_EXPECTED_PATHS, x as TABLE_COMPONENT_EDIT_PLAN_JSON_SCHEMA, y as TABLE_COMPONENT_EDIT_PLAN_KIND, E as TABLE_COMPONENT_EDIT_PLAN_VERSION, G as TASK_PRESETS, H as TableDefaultsProvider, I as TableRulesEditorComponent, K as ToolbarActionsEditorComponent, V as ValueMappingEditorComponent, L as VisualFormulaBuilderComponent, O as buildTableApplyPlan, Q as coerceTableComponentEditPlan, R as coerceTableComponentEditPlans, U as compileTableComponentEditPlan, W as compileTableComponentEditPlans, X as createTableAuthoringDocument, Y as getActionId, Z as getEnum, _ as getTableCapabilities, $ as getTableComponentEditPlanCapabilities, a0 as isTableRendererSupportedByRichContentP0, a1 as mapTableRendererToRichContentP0, a2 as normalizeTableAuthoringDocument, a3 as parseLegacyOrTableDocument, a4 as providePraxisFilterMetadata, a5 as providePraxisTableMetadata, a6 as serializeTableAuthoringDocument, a7 as toCanonicalTableConfig, a8 as validateTableAuthoringDocument } from './praxisui-table-praxisui-table-2nSPgkfc.mjs';
package/package.json CHANGED
@@ -1,23 +1,23 @@
1
1
  {
2
2
  "name": "@praxisui/table",
3
- "version": "8.0.0-beta.55",
3
+ "version": "8.0.0-beta.57",
4
4
  "description": "Advanced data table for Angular (Praxis UI) with editing, filtering, sorting, virtualization, and settings panel integration.",
5
5
  "peerDependencies": {
6
6
  "@angular/common": "^21.0.0",
7
7
  "@angular/core": "^21.0.0",
8
- "@praxisui/ai": "^8.0.0-beta.55",
9
- "@praxisui/core": "^8.0.0-beta.55",
10
- "@praxisui/dynamic-fields": "^8.0.0-beta.55",
11
- "@praxisui/dynamic-form": "^8.0.0-beta.55",
12
- "@praxisui/metadata-editor": "^8.0.0-beta.55",
13
- "@praxisui/rich-content": "^8.0.0-beta.55",
14
- "@praxisui/settings-panel": "^8.0.0-beta.55",
15
- "@praxisui/table-rule-builder": "^8.0.0-beta.55",
8
+ "@praxisui/ai": "^8.0.0-beta.57",
9
+ "@praxisui/core": "^8.0.0-beta.57",
10
+ "@praxisui/dynamic-fields": "^8.0.0-beta.57",
11
+ "@praxisui/dynamic-form": "^8.0.0-beta.57",
12
+ "@praxisui/metadata-editor": "^8.0.0-beta.57",
13
+ "@praxisui/rich-content": "^8.0.0-beta.57",
14
+ "@praxisui/settings-panel": "^8.0.0-beta.57",
15
+ "@praxisui/table-rule-builder": "^8.0.0-beta.57",
16
16
  "@angular/cdk": "^21.0.0",
17
17
  "@angular/forms": "^21.0.0",
18
18
  "@angular/material": "^21.0.0",
19
19
  "@angular/router": "^21.0.0",
20
- "@praxisui/dialog": "^8.0.0-beta.55",
20
+ "@praxisui/dialog": "^8.0.0-beta.57",
21
21
  "rxjs": "~7.8.0"
22
22
  },
23
23
  "dependencies": {
@@ -1192,6 +1192,7 @@ declare class PraxisTable implements OnInit, OnChanges, AfterViewInit, AfterCont
1192
1192
  getAiAssistantRecordSurfacesContext(): RecordRelatedSurfaceContextPack | null;
1193
1193
  getAiAssistantSelectedRowsContext(): Record<string, any> | null;
1194
1194
  private ensureAiAssistantRowCapabilitySnapshot;
1195
+ private buildCapabilitySnapshotFromSurfaceCatalog;
1195
1196
  private buildAiAssistantResourceSurfaceContexts;
1196
1197
  private buildRecordRelatedSurfaceContextFromResourceSurface;
1197
1198
  private humanizeResourceSurfaceLabel;
@@ -1685,6 +1686,7 @@ declare class PraxisTable implements OnInit, OnChanges, AfterViewInit, AfterCont
1685
1686
  private buildRowDiscoveryOptions;
1686
1687
  private getRowLinks;
1687
1688
  private resolveRowDiscoveryHref;
1689
+ private resolveRowSurfaceDiscoveryHref;
1688
1690
  private prefetchRowDiscovery;
1689
1691
  private ensureRowDiscovery;
1690
1692
  private ensureRowCapabilitySnapshot;