@praxisui/table 8.0.0-beta.54 → 8.0.0-beta.56

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,74 @@ 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
+ if (href && this.hasFreshRowCapabilitySnapshot(href)) {
38811
38812
  return;
38812
38813
  }
38813
- const inFlight = this.rowCapabilityInFlightByHref.get(href);
38814
+ if (!href && surfaceHref && this.hasFreshRowCapabilitySnapshot(surfaceHref)) {
38815
+ return;
38816
+ }
38817
+ if (!href && !surfaceHref) {
38818
+ return;
38819
+ }
38820
+ const cacheHref = href ?? surfaceHref;
38821
+ if (!cacheHref) {
38822
+ return;
38823
+ }
38824
+ const inFlight = this.rowCapabilityInFlightByHref.get(cacheHref);
38814
38825
  if (inFlight) {
38815
38826
  await inFlight;
38816
38827
  return;
38817
38828
  }
38818
38829
  try {
38819
- const snapshot = await firstValueFrom(this.resourceDiscovery.getCapabilities(rowLinks, this.buildRowDiscoveryOptions())
38830
+ if (href) {
38831
+ const snapshot = await firstValueFrom(this.resourceDiscovery.getCapabilities(rowLinks, this.buildRowDiscoveryOptions())
38832
+ .pipe(take$1(1)));
38833
+ this.clearRowCapabilityError(href);
38834
+ this.rememberRowCapabilitySnapshot(href, snapshot);
38835
+ if (row && typeof row === 'object') {
38836
+ this.rowContextRuntimeByRef.delete(row);
38837
+ }
38838
+ if (snapshot.surfaces?.length || !surfaceHref) {
38839
+ return;
38840
+ }
38841
+ }
38842
+ }
38843
+ catch (error) {
38844
+ if (href) {
38845
+ this.rememberRowCapabilityError(href);
38846
+ }
38847
+ this.warnLog('[PraxisTable] Nao foi possivel preparar surfaces de registro para contexto AI', error);
38848
+ }
38849
+ if (!surfaceHref) {
38850
+ return;
38851
+ }
38852
+ try {
38853
+ const catalog = await firstValueFrom(this.resourceDiscovery.getSurfaces(rowLinks, this.buildRowDiscoveryOptions())
38820
38854
  .pipe(take$1(1)));
38821
- this.clearRowCapabilityError(href);
38822
- this.rememberRowCapabilitySnapshot(href, snapshot);
38855
+ this.clearRowCapabilityError(surfaceHref);
38856
+ this.rememberRowCapabilitySnapshot(surfaceHref, this.buildCapabilitySnapshotFromSurfaceCatalog(catalog));
38823
38857
  if (row && typeof row === 'object') {
38824
38858
  this.rowContextRuntimeByRef.delete(row);
38825
38859
  }
38826
38860
  }
38827
38861
  catch (error) {
38828
- this.rememberRowCapabilityError(href);
38829
- this.warnLog('[PraxisTable] Nao foi possivel preparar surfaces de registro para contexto AI', error);
38862
+ this.rememberRowCapabilityError(surfaceHref);
38863
+ this.warnLog('[PraxisTable] Nao foi possivel preparar catalogo de surfaces de registro para contexto AI', error);
38830
38864
  }
38831
38865
  }
38866
+ buildCapabilitySnapshotFromSurfaceCatalog(catalog) {
38867
+ return {
38868
+ resourceKey: catalog.resourceKey,
38869
+ resourcePath: catalog.resourcePath,
38870
+ group: catalog.group,
38871
+ resourceId: catalog.resourceId,
38872
+ canonicalOperations: {},
38873
+ operations: {},
38874
+ surfaces: Array.isArray(catalog.surfaces) ? catalog.surfaces : [],
38875
+ actions: [],
38876
+ };
38877
+ }
38832
38878
  buildAiAssistantResourceSurfaceContexts() {
38833
38879
  const selectedRows = this.getSelectedRowsSnapshot();
38834
38880
  if (!selectedRows.length || !this.resourcePath) {
@@ -39528,7 +39574,7 @@ class PraxisTable {
39528
39574
  if (this.aiAdapter || this.aiAdapterLoadStarted)
39529
39575
  return;
39530
39576
  this.aiAdapterLoadStarted = true;
39531
- import('./praxisui-table-table-ai.adapter-B3KQThqg.mjs')
39577
+ import('./praxisui-table-table-ai.adapter-Cb0SlfHg.mjs')
39532
39578
  .then(({ TableAiAdapter }) => {
39533
39579
  this.aiAdapter = new TableAiAdapter(this);
39534
39580
  this.initializeAiAssistantController();
@@ -39678,7 +39724,7 @@ class PraxisTable {
39678
39724
  initializeAiAssistantController() {
39679
39725
  if (!this.aiAdapter || this.aiAssistantController)
39680
39726
  return;
39681
- import('./praxisui-table-table-agentic-authoring-turn-flow-B075RDUj.mjs')
39727
+ import('./praxisui-table-table-agentic-authoring-turn-flow-EmXDCUna.mjs')
39682
39728
  .then(({ TableAgenticAuthoringTurnFlow }) => {
39683
39729
  if (this.aiAssistantController || !this.aiAdapter)
39684
39730
  return;
@@ -46445,6 +46491,14 @@ class PraxisTable {
46445
46491
  return null;
46446
46492
  }
46447
46493
  }
46494
+ resolveRowSurfaceDiscoveryHref(rowLinks) {
46495
+ try {
46496
+ return this.resourceDiscovery.resolveLinkHref(rowLinks, 'surfaces', this.buildRowDiscoveryOptions());
46497
+ }
46498
+ catch {
46499
+ return null;
46500
+ }
46501
+ }
46448
46502
  prefetchRowDiscovery(rows) {
46449
46503
  if (!Array.isArray(rows) || !rows.length || !this.shouldPrefetchRowDiscovery()) {
46450
46504
  return;
@@ -46566,10 +46620,14 @@ class PraxisTable {
46566
46620
  return null;
46567
46621
  }
46568
46622
  const href = this.resolveRowDiscoveryHref(rowLinks, 'capabilities');
46569
- if (!href || !this.hasFreshRowCapabilitySnapshot(href)) {
46570
- return null;
46623
+ if (href && this.hasFreshRowCapabilitySnapshot(href)) {
46624
+ return this.rowCapabilitySnapshotByHref.get(href) || null;
46571
46625
  }
46572
- return this.rowCapabilitySnapshotByHref.get(href) || null;
46626
+ const surfaceHref = this.resolveRowSurfaceDiscoveryHref(rowLinks);
46627
+ if (surfaceHref && this.hasFreshRowCapabilitySnapshot(surfaceHref)) {
46628
+ return this.rowCapabilitySnapshotByHref.get(surfaceHref) || null;
46629
+ }
46630
+ return null;
46573
46631
  }
46574
46632
  hasResolvedRowActionCatalog(row) {
46575
46633
  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-KAnwisrq.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-CLcLxit9.mjs';
5
5
 
6
6
  const TABLE_COMPONENT_CONTEXT_PACK = {
7
7
  version: 'v1',
@@ -2573,6 +2573,9 @@ class TableAiAdapter extends BaseAiAdapter {
2573
2573
  coerceTableRuntimeOperationBatch(source) {
2574
2574
  if (!source)
2575
2575
  return null;
2576
+ const textual = this.coerceTableRuntimeOperationBatchFromText(source);
2577
+ if (textual)
2578
+ return textual;
2576
2579
  const nestedPatch = this.toRecord(source['patch']);
2577
2580
  if (nestedPatch) {
2578
2581
  const nested = this.coerceTableRuntimeOperationBatch(nestedPatch);
@@ -2609,6 +2612,50 @@ class TableAiAdapter extends BaseAiAdapter {
2609
2612
  operations,
2610
2613
  };
2611
2614
  }
2615
+ coerceTableRuntimeOperationBatchFromText(source) {
2616
+ for (const key of ['message', 'assistantMessage', 'content', 'explanation']) {
2617
+ const text = this.stringValue(source[key]);
2618
+ if (!text || !text.includes(TABLE_RUNTIME_OPERATION_PATCH_KEY) || !text.includes('operationId')) {
2619
+ continue;
2620
+ }
2621
+ const parsed = this.parseRuntimeOperationJsonFromText(text);
2622
+ if (!parsed || parsed === source) {
2623
+ continue;
2624
+ }
2625
+ const batch = this.coerceTableRuntimeOperationBatch(parsed);
2626
+ if (batch)
2627
+ return batch;
2628
+ }
2629
+ return null;
2630
+ }
2631
+ parseRuntimeOperationJsonFromText(text) {
2632
+ const candidates = this.extractJsonObjectCandidates(text);
2633
+ for (const candidate of candidates) {
2634
+ try {
2635
+ const parsed = JSON.parse(candidate);
2636
+ const record = this.toRecord(parsed);
2637
+ if (record)
2638
+ return record;
2639
+ }
2640
+ catch {
2641
+ continue;
2642
+ }
2643
+ }
2644
+ return null;
2645
+ }
2646
+ extractJsonObjectCandidates(text) {
2647
+ const candidates = [];
2648
+ const fenced = text.match(/```(?:json)?\s*([\s\S]*?)```/iu);
2649
+ if (fenced?.[1]) {
2650
+ candidates.push(fenced[1].trim());
2651
+ }
2652
+ const firstBrace = text.indexOf('{');
2653
+ const lastBrace = text.lastIndexOf('}');
2654
+ if (firstBrace >= 0 && lastBrace > firstBrace) {
2655
+ candidates.push(text.slice(firstBrace, lastBrace + 1).trim());
2656
+ }
2657
+ return candidates.filter((candidate, index, values) => !!candidate && values.indexOf(candidate) === index);
2658
+ }
2612
2659
  coerceTableRuntimeOperation(value) {
2613
2660
  const record = this.toRecord(value);
2614
2661
  if (!record)
@@ -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-KAnwisrq.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-CLcLxit9.mjs';
package/package.json CHANGED
@@ -1,23 +1,23 @@
1
1
  {
2
2
  "name": "@praxisui/table",
3
- "version": "8.0.0-beta.54",
3
+ "version": "8.0.0-beta.56",
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.54",
9
- "@praxisui/core": "^8.0.0-beta.54",
10
- "@praxisui/dynamic-fields": "^8.0.0-beta.54",
11
- "@praxisui/dynamic-form": "^8.0.0-beta.54",
12
- "@praxisui/metadata-editor": "^8.0.0-beta.54",
13
- "@praxisui/rich-content": "^8.0.0-beta.54",
14
- "@praxisui/settings-panel": "^8.0.0-beta.54",
15
- "@praxisui/table-rule-builder": "^8.0.0-beta.54",
8
+ "@praxisui/ai": "^8.0.0-beta.56",
9
+ "@praxisui/core": "^8.0.0-beta.56",
10
+ "@praxisui/dynamic-fields": "^8.0.0-beta.56",
11
+ "@praxisui/dynamic-form": "^8.0.0-beta.56",
12
+ "@praxisui/metadata-editor": "^8.0.0-beta.56",
13
+ "@praxisui/rich-content": "^8.0.0-beta.56",
14
+ "@praxisui/settings-panel": "^8.0.0-beta.56",
15
+ "@praxisui/table-rule-builder": "^8.0.0-beta.56",
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.54",
20
+ "@praxisui/dialog": "^8.0.0-beta.56",
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;