@praxisui/table 8.0.0-beta.30 → 8.0.0-beta.31
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.
- package/README.md +41 -4
- package/fesm2022/{praxisui-table-praxisui-table-DFBE5wpp.mjs → praxisui-table-praxisui-table-qO5EkftZ.mjs} +691 -34
- package/fesm2022/praxisui-table-table-agentic-authoring-turn-flow-CretQI6Z.mjs +847 -0
- package/fesm2022/{praxisui-table-table-ai.adapter-7THXe94D.mjs → praxisui-table-table-ai.adapter-DkMHa90r.mjs} +215 -94
- package/fesm2022/praxisui-table.mjs +1 -1
- package/index.d.ts +26 -8
- package/package.json +10 -10
- package/src/lib/praxis-table.json-api.md +2 -1
- package/fesm2022/praxisui-table-table-agentic-authoring-turn-flow-EigJf8mp.mjs +0 -335
|
@@ -1 +1 @@
|
|
|
1
|
-
export { A as AnalyticsTableConfigAdapterService, G as AnalyticsTableContractService, E as AnalyticsTableStatsApiService, B as BOOLEAN_PRESETS, V as BehaviorConfigEditorComponent, C as CURRENCY_PRESETS, W as ColumnsConfigEditorComponent, D as DATE_PRESETS, y as DataFormatterComponent, x as DataFormattingService, a4 as FORMULA_TEMPLATES, F as FilterConfigService, a0 as FilterSettingsComponent, a3 as FormulaGeneratorService, $ as JsonConfigEditorComponent, Y as MessagesLocalizationEditorComponent, N as NUMBER_PRESETS, w as PERCENTAGE_PRESETS, t as PRAXIS_FILTER_COMPONENT_METADATA, P as PRAXIS_TABLE_AUTHORING_MANIFEST, a5 as PRAXIS_TABLE_COMPONENT_METADATA, s as PraxisFilter, v as PraxisFilterWidgetConfigEditor, o as PraxisTable, q as PraxisTableConfigEditor, X as PraxisTableInlineAuthoringEditorComponent, p as PraxisTableToolbar, r as PraxisTableWidgetConfigEditor, S as STRING_PRESETS, a as TABLE_AI_CAPABILITIES, l as TABLE_COMPONENT_AI_CAPABILITIES, f as TABLE_COMPONENT_EDIT_PLAN_ALLOWED_CHANGE_KINDS, j as TABLE_COMPONENT_EDIT_PLAN_BATCH_KIND, e as TABLE_COMPONENT_EDIT_PLAN_EXPECTED_PATHS, h as TABLE_COMPONENT_EDIT_PLAN_JSON_SCHEMA, k as TABLE_COMPONENT_EDIT_PLAN_KIND, i as TABLE_COMPONENT_EDIT_PLAN_VERSION, d as TASK_PRESETS, z as TableDefaultsProvider, a1 as TableRulesEditorComponent, Z as ToolbarActionsEditorComponent, _ as ValueMappingEditorComponent, a2 as VisualFormulaBuilderComponent, R as buildTableApplyPlan, m as coerceTableComponentEditPlan, c as coerceTableComponentEditPlans, n as compileTableComponentEditPlan, b as compileTableComponentEditPlans, K as createTableAuthoringDocument, H as getActionId, a8 as getEnum, a7 as getTableCapabilities, g as getTableComponentEditPlanCapabilities, I as isTableRendererSupportedByRichContentP0, J as mapTableRendererToRichContentP0, M as normalizeTableAuthoringDocument, L as parseLegacyOrTableDocument, u as providePraxisFilterMetadata, a6 as providePraxisTableMetadata, U as serializeTableAuthoringDocument, Q as toCanonicalTableConfig, O as validateTableAuthoringDocument } from './praxisui-table-praxisui-table-
|
|
1
|
+
export { A as AnalyticsTableConfigAdapterService, G as AnalyticsTableContractService, E as AnalyticsTableStatsApiService, B as BOOLEAN_PRESETS, V as BehaviorConfigEditorComponent, C as CURRENCY_PRESETS, W as ColumnsConfigEditorComponent, D as DATE_PRESETS, y as DataFormatterComponent, x as DataFormattingService, a4 as FORMULA_TEMPLATES, F as FilterConfigService, a0 as FilterSettingsComponent, a3 as FormulaGeneratorService, $ as JsonConfigEditorComponent, Y as MessagesLocalizationEditorComponent, N as NUMBER_PRESETS, w as PERCENTAGE_PRESETS, t as PRAXIS_FILTER_COMPONENT_METADATA, P as PRAXIS_TABLE_AUTHORING_MANIFEST, a5 as PRAXIS_TABLE_COMPONENT_METADATA, s as PraxisFilter, v as PraxisFilterWidgetConfigEditor, o as PraxisTable, q as PraxisTableConfigEditor, X as PraxisTableInlineAuthoringEditorComponent, p as PraxisTableToolbar, r as PraxisTableWidgetConfigEditor, S as STRING_PRESETS, a as TABLE_AI_CAPABILITIES, l as TABLE_COMPONENT_AI_CAPABILITIES, f as TABLE_COMPONENT_EDIT_PLAN_ALLOWED_CHANGE_KINDS, j as TABLE_COMPONENT_EDIT_PLAN_BATCH_KIND, e as TABLE_COMPONENT_EDIT_PLAN_EXPECTED_PATHS, h as TABLE_COMPONENT_EDIT_PLAN_JSON_SCHEMA, k as TABLE_COMPONENT_EDIT_PLAN_KIND, i as TABLE_COMPONENT_EDIT_PLAN_VERSION, d as TASK_PRESETS, z as TableDefaultsProvider, a1 as TableRulesEditorComponent, Z as ToolbarActionsEditorComponent, _ as ValueMappingEditorComponent, a2 as VisualFormulaBuilderComponent, R as buildTableApplyPlan, m as coerceTableComponentEditPlan, c as coerceTableComponentEditPlans, n as compileTableComponentEditPlan, b as compileTableComponentEditPlans, K as createTableAuthoringDocument, H as getActionId, a8 as getEnum, a7 as getTableCapabilities, g as getTableComponentEditPlanCapabilities, I as isTableRendererSupportedByRichContentP0, J as mapTableRendererToRichContentP0, M as normalizeTableAuthoringDocument, L as parseLegacyOrTableDocument, u as providePraxisFilterMetadata, a6 as providePraxisTableMetadata, U as serializeTableAuthoringDocument, Q as toCanonicalTableConfig, O as validateTableAuthoringDocument } from './praxisui-table-praxisui-table-qO5EkftZ.mjs';
|
package/index.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import * as _praxisui_core from '@praxisui/core';
|
|
2
|
+
import { TableConfig, LoggerService, PraxisI18nService, GlobalConfigService, AsyncConfigStorage, FieldMetadata, SchemaIdParams, FormConfig, GenericCrudService, DynamicFormService, SchemaNormalizerService, ComponentKeyService, ComponentDocMeta, PraxisTextValue, PraxisAnalyticsProjection, PraxisDataQueryContext, ApiUrlConfig, LoadingState, RestApiLinks, ColumnDefinition, RichBlockNode, ConnectionStorage, LoadingOrchestrator, GlobalActionService, PraxisLoadingRenderer, TableDetailRichListNode, TableDetailCardGridNode, TableDetailCardGridCardNode, TableDetailTimelineNode, JsonLogicDataRecord, TableDetailListItemAction, TableDetailActionBarNode, TableDetailActionBarAction, TableDetailRefNode, TableDetailTemplateRefNode, TableDetailDiagramEmbedNode, TableDetailEmbedAction, GlobalActionRef, PraxisRuntimeGlobalActionEffect, ResourceActionCatalogItem, ResourceSurfaceCatalogItem, JsonLogicExpression, GlobalActionCatalogEntry, IconPickerService, SurfaceOpenPayload, GlobalActionField, FieldDefinition, PraxisRuntimeConditionalEffectRule, PraxisJsonLogicService, TableConfigService, SettingsValueProvider as SettingsValueProvider$1, AnalyticsSchemaContractService, AnalyticsPresentationResolver, RichPresenterNode, RichComposeNode, ComponentAuthoringManifest, AiCapabilityCategory, AiValueKind, AiCapability, AiCapabilityCatalog } from '@praxisui/core';
|
|
1
3
|
import * as i0 from '@angular/core';
|
|
2
4
|
import { OnDestroy, EventEmitter, ElementRef, OnInit, OnChanges, AfterViewInit, DoCheck, DestroyRef, ChangeDetectorRef, NgZone, SimpleChanges, Provider, AfterContentInit, Injector } from '@angular/core';
|
|
3
5
|
import { ActivatedRoute } from '@angular/router';
|
|
@@ -9,8 +11,6 @@ import { SelectionModel } from '@angular/cdk/collections';
|
|
|
9
11
|
import { CdkDragDrop, CdkDragEnd, CdkDrag, CdkDropList } from '@angular/cdk/drag-drop';
|
|
10
12
|
import { BehaviorSubject, Subscription, Observable } from 'rxjs';
|
|
11
13
|
import { SettingsPanelService, SettingsValueProvider } from '@praxisui/settings-panel';
|
|
12
|
-
import * as _praxisui_core from '@praxisui/core';
|
|
13
|
-
import { TableConfig, LoggerService, PraxisI18nService, GlobalConfigService, AsyncConfigStorage, FieldMetadata, SchemaIdParams, FormConfig, GenericCrudService, DynamicFormService, SchemaNormalizerService, ComponentKeyService, ComponentDocMeta, PraxisTextValue, PraxisAnalyticsProjection, PraxisDataQueryContext, ApiUrlConfig, LoadingState, RestApiLinks, ColumnDefinition, RichBlockNode, ConnectionStorage, LoadingOrchestrator, GlobalActionService, PraxisLoadingRenderer, TableDetailRichListNode, TableDetailCardGridNode, TableDetailCardGridCardNode, TableDetailTimelineNode, JsonLogicDataRecord, TableDetailListItemAction, TableDetailActionBarNode, TableDetailActionBarAction, TableDetailRefNode, TableDetailTemplateRefNode, TableDetailDiagramEmbedNode, TableDetailEmbedAction, GlobalActionRef, PraxisRuntimeGlobalActionEffect, ResourceActionCatalogItem, ResourceSurfaceCatalogItem, JsonLogicExpression, GlobalActionCatalogEntry, IconPickerService, SurfaceOpenPayload, GlobalActionField, FieldDefinition, PraxisRuntimeConditionalEffectRule, PraxisJsonLogicService, TableConfigService, SettingsValueProvider as SettingsValueProvider$1, AnalyticsSchemaContractService, AnalyticsPresentationResolver, RichPresenterNode, RichComposeNode, ComponentAuthoringManifest, AiCapabilityCategory, AiValueKind, AiCapability, AiCapabilityCatalog } from '@praxisui/core';
|
|
14
14
|
import { FormGroup, FormControl, FormBuilder } from '@angular/forms';
|
|
15
15
|
import { MatDialog } from '@angular/material/dialog';
|
|
16
16
|
import { CdkOverlayOrigin, ConnectedPosition } from '@angular/cdk/overlay';
|
|
@@ -835,6 +835,10 @@ type SchemaFieldHint = {
|
|
|
835
835
|
optionValueKey?: string;
|
|
836
836
|
enumValues?: string[];
|
|
837
837
|
};
|
|
838
|
+
type FilterSchemaFieldHint = SchemaFieldHint & {
|
|
839
|
+
relatedColumnFields?: string[];
|
|
840
|
+
relatedColumnLabels?: string[];
|
|
841
|
+
};
|
|
838
842
|
type PraxisDataQueryContextBridge = {
|
|
839
843
|
filters?: Record<string, unknown> | null;
|
|
840
844
|
sort?: string[] | null;
|
|
@@ -986,6 +990,7 @@ declare class PraxisTable implements OnInit, OnChanges, AfterViewInit, AfterCont
|
|
|
986
990
|
afterBulkDelete: EventEmitter<any>;
|
|
987
991
|
bulkDeleteError: EventEmitter<any>;
|
|
988
992
|
schemaStatusChange: EventEmitter<any>;
|
|
993
|
+
configChange: EventEmitter<_praxisui_core.TableConfigModern>;
|
|
989
994
|
metadataChange: EventEmitter<any>;
|
|
990
995
|
loadingStateChange: EventEmitter<LoadingState>;
|
|
991
996
|
collectionLinksChange: EventEmitter<RestApiLinks | null>;
|
|
@@ -1059,6 +1064,7 @@ declare class PraxisTable implements OnInit, OnChanges, AfterViewInit, AfterCont
|
|
|
1059
1064
|
private readonly collectionExport;
|
|
1060
1065
|
private readonly paginatorIntl;
|
|
1061
1066
|
private schemaFieldsSnapshot;
|
|
1067
|
+
private filterSchemaFieldsSnapshot;
|
|
1062
1068
|
private runtimeSchemaMeta;
|
|
1063
1069
|
schemaError: boolean;
|
|
1064
1070
|
dataError: boolean;
|
|
@@ -1153,6 +1159,8 @@ declare class PraxisTable implements OnInit, OnChanges, AfterViewInit, AfterCont
|
|
|
1153
1159
|
get hostColumnBordersClass(): boolean;
|
|
1154
1160
|
trackByRow(index: number, item: any): any;
|
|
1155
1161
|
getSchemaFieldsSnapshot(): SchemaFieldHint[];
|
|
1162
|
+
getFilterSchemaFieldsSnapshot(): FilterSchemaFieldHint[];
|
|
1163
|
+
ensureFilterSchemaFieldsSnapshot(): Promise<void>;
|
|
1156
1164
|
aiAdapter: any;
|
|
1157
1165
|
private aiAdapterLoadStarted;
|
|
1158
1166
|
private aiAssistantOpenAfterAdapterLoad;
|
|
@@ -1204,6 +1212,9 @@ declare class PraxisTable implements OnInit, OnChanges, AfterViewInit, AfterCont
|
|
|
1204
1212
|
private recomputeLocalView;
|
|
1205
1213
|
private resolveLocalSortField;
|
|
1206
1214
|
private setSchemaFieldsSnapshot;
|
|
1215
|
+
private setFilterSchemaFieldsSnapshot;
|
|
1216
|
+
private resolveFilterSchemaRelatedColumns;
|
|
1217
|
+
private normalizeFieldAlias;
|
|
1207
1218
|
private normalizeSchemaOptions;
|
|
1208
1219
|
private normalizeEnumValues;
|
|
1209
1220
|
private normalizeSchemaKey;
|
|
@@ -1227,6 +1238,11 @@ declare class PraxisTable implements OnInit, OnChanges, AfterViewInit, AfterCont
|
|
|
1227
1238
|
private ensureAiAdapterLoaded;
|
|
1228
1239
|
openAiAssistant(): void;
|
|
1229
1240
|
aiAssistantTriggerTestId(position: string): string;
|
|
1241
|
+
hasMinimizedAiAssistantSession(): boolean;
|
|
1242
|
+
aiAssistantTriggerIcon(): string;
|
|
1243
|
+
aiAssistantTriggerBadge(): string;
|
|
1244
|
+
aiAssistantTriggerLabel(): string;
|
|
1245
|
+
aiAssistantTriggerTooltip(): string;
|
|
1230
1246
|
openAiAssistantFromSession(session: PraxisAssistantSessionSnapshot): void;
|
|
1231
1247
|
closeAiAssistant(): void;
|
|
1232
1248
|
onAiAssistantPromptChange(prompt: string): void;
|
|
@@ -1575,6 +1591,7 @@ declare class PraxisTable implements OnInit, OnChanges, AfterViewInit, AfterCont
|
|
|
1575
1591
|
*/
|
|
1576
1592
|
private verifyServerSchemaVersion;
|
|
1577
1593
|
private loadSchema;
|
|
1594
|
+
private loadFilterSchemaSnapshot;
|
|
1578
1595
|
private convertFieldToColumn;
|
|
1579
1596
|
/**
|
|
1580
1597
|
* Apply automatic renderer hints based on schema field metadata.
|
|
@@ -1877,6 +1894,7 @@ declare class PraxisTable implements OnInit, OnChanges, AfterViewInit, AfterCont
|
|
|
1877
1894
|
private deriveAvatarInitials;
|
|
1878
1895
|
getAvatarInitials(row: any, column: ColumnDefinition): string;
|
|
1879
1896
|
getAvatarRichContentNodes(row: any, column: ColumnDefinition): RichBlockNode[];
|
|
1897
|
+
private getAvatarRichContentStyle;
|
|
1880
1898
|
getAvatarShape(row: any, column: ColumnDefinition): 'square' | 'rounded' | 'circle' | undefined;
|
|
1881
1899
|
getAvatarStyle(row: any, column: ColumnDefinition): Record<string, string> | null;
|
|
1882
1900
|
getToggleState(row: any, column: ColumnDefinition): boolean;
|
|
@@ -2002,7 +2020,7 @@ declare class PraxisTable implements OnInit, OnChanges, AfterViewInit, AfterCont
|
|
|
2002
2020
|
private scheduleRowDiscoveryMarkForCheck;
|
|
2003
2021
|
ngOnDestroy(): void;
|
|
2004
2022
|
static ɵfac: i0.ɵɵFactoryDeclaration<PraxisTable, [null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, { optional: true; }, { optional: true; }, { optional: true; }, { optional: true; }]>;
|
|
2005
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<PraxisTable, "praxis-table", never, { "config": { "alias": "config"; "required": false; }; "resourcePath": { "alias": "resourcePath"; "required": false; }; "data": { "alias": "data"; "required": false; }; "tableId": { "alias": "tableId"; "required": true; }; "componentInstanceId": { "alias": "componentInstanceId"; "required": false; }; "title": { "alias": "title"; "required": false; }; "subtitle": { "alias": "subtitle"; "required": false; }; "icon": { "alias": "icon"; "required": false; }; "autoDelete": { "alias": "autoDelete"; "required": false; }; "notifyIfOutdated": { "alias": "notifyIfOutdated"; "required": false; }; "snoozeMs": { "alias": "snoozeMs"; "required": false; }; "autoOpenSettingsOnOutdated": { "alias": "autoOpenSettingsOnOutdated"; "required": false; }; "crudContext": { "alias": "crudContext"; "required": false; }; "filterCriteria": { "alias": "filterCriteria"; "required": false; }; "queryContext": { "alias": "queryContext"; "required": false; }; "horizontalScroll": { "alias": "horizontalScroll"; "required": false; }; "enableCustomization": { "alias": "enableCustomization"; "required": false; }; "dense": { "alias": "dense"; "required": false; }; }, { "rowClick": "rowClick"; "rowDoubleClick": "rowDoubleClick"; "rowExpansionChange": "rowExpansionChange"; "rowAction": "rowAction"; "toolbarAction": "toolbarAction"; "bulkAction": "bulkAction"; "exportAction": "exportAction"; "columnReorder": "columnReorder"; "columnReorderAttempt": "columnReorderAttempt"; "beforeDelete": "beforeDelete"; "afterDelete": "afterDelete"; "deleteError": "deleteError"; "beforeBulkDelete": "beforeBulkDelete"; "afterBulkDelete": "afterBulkDelete"; "bulkDeleteError": "bulkDeleteError"; "schemaStatusChange": "schemaStatusChange"; "metadataChange": "metadataChange"; "loadingStateChange": "loadingStateChange"; "collectionLinksChange": "collectionLinksChange"; "selectionChange": "selectionChange"; }, ["toolbar", "projectedFilter"], ["[advancedFilter]", "[toolbar]", "[advancedFilter]", "[toolbar]", "[advancedFilter]", "[toolbar]"], true, never>;
|
|
2023
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<PraxisTable, "praxis-table", never, { "config": { "alias": "config"; "required": false; }; "resourcePath": { "alias": "resourcePath"; "required": false; }; "data": { "alias": "data"; "required": false; }; "tableId": { "alias": "tableId"; "required": true; }; "componentInstanceId": { "alias": "componentInstanceId"; "required": false; }; "title": { "alias": "title"; "required": false; }; "subtitle": { "alias": "subtitle"; "required": false; }; "icon": { "alias": "icon"; "required": false; }; "autoDelete": { "alias": "autoDelete"; "required": false; }; "notifyIfOutdated": { "alias": "notifyIfOutdated"; "required": false; }; "snoozeMs": { "alias": "snoozeMs"; "required": false; }; "autoOpenSettingsOnOutdated": { "alias": "autoOpenSettingsOnOutdated"; "required": false; }; "crudContext": { "alias": "crudContext"; "required": false; }; "filterCriteria": { "alias": "filterCriteria"; "required": false; }; "queryContext": { "alias": "queryContext"; "required": false; }; "horizontalScroll": { "alias": "horizontalScroll"; "required": false; }; "enableCustomization": { "alias": "enableCustomization"; "required": false; }; "dense": { "alias": "dense"; "required": false; }; }, { "rowClick": "rowClick"; "rowDoubleClick": "rowDoubleClick"; "rowExpansionChange": "rowExpansionChange"; "rowAction": "rowAction"; "toolbarAction": "toolbarAction"; "bulkAction": "bulkAction"; "exportAction": "exportAction"; "columnReorder": "columnReorder"; "columnReorderAttempt": "columnReorderAttempt"; "beforeDelete": "beforeDelete"; "afterDelete": "afterDelete"; "deleteError": "deleteError"; "beforeBulkDelete": "beforeBulkDelete"; "afterBulkDelete": "afterBulkDelete"; "bulkDeleteError": "bulkDeleteError"; "schemaStatusChange": "schemaStatusChange"; "configChange": "configChange"; "metadataChange": "metadataChange"; "loadingStateChange": "loadingStateChange"; "collectionLinksChange": "collectionLinksChange"; "selectionChange": "selectionChange"; }, ["toolbar", "projectedFilter"], ["[advancedFilter]", "[toolbar]", "[advancedFilter]", "[toolbar]", "[advancedFilter]", "[toolbar]"], true, never>;
|
|
2006
2024
|
static ngAcceptInputType_enableCustomization: unknown;
|
|
2007
2025
|
}
|
|
2008
2026
|
|
|
@@ -3982,9 +4000,9 @@ type ComponentEditPlanCapability = {
|
|
|
3982
4000
|
declare const TABLE_COMPONENT_EDIT_PLAN_KIND = "praxis.table.component-edit-plan";
|
|
3983
4001
|
declare const TABLE_COMPONENT_EDIT_PLAN_BATCH_KIND = "praxis.table.component-edit-plan.batch";
|
|
3984
4002
|
declare const TABLE_COMPONENT_EDIT_PLAN_VERSION = "1.0";
|
|
3985
|
-
type TableComponentEditChangeKind = 'set_column_format' | 'set_column_header' | 'set_column_visibility' | 'set_column_filterable' | 'set_column_sortable' | 'set_column_width' | 'set_column_align' | 'set_column_sticky' | 'set_column_conditional_style' | 'set_column_computed' | 'set_column_value_mapping' | 'set_column_renderer' | 'set_column_badge_renderer' | 'set_column_conditional_badge_renderers' | 'set_row_conditional_renderer' | 'configure_table_filtering' | 'configure_table_pagination' | 'configure_table_selection' | 'configure_table_sorting' | 'configure_toolbar' | 'configure_export' | 'set_table_density' | 'set_toolbar_visibility';
|
|
3986
|
-
type TableComponentEditOperationId = 'column.format.set' | 'column.header.set' | 'column.visibility.set' | 'column.filterable.set' | 'column.sortable.set' | 'column.width.set' | 'column.align.set' | 'column.sticky.set' | 'column.renderer.set' | 'column.valueMapping.set' | 'column.conditionalStyle.add' | 'column.conditionalRenderer.add' | 'column.computed.add' | 'row.conditionalRenderer.add' | 'behavior.filtering.configure' | 'behavior.pagination.configure' | 'behavior.selection.configure' | 'behavior.sorting.configure' | 'toolbar.configure' | 'export.configure' | 'appearance.density.set' | 'toolbar.visibility.set';
|
|
3987
|
-
declare const TABLE_COMPONENT_EDIT_PLAN_ALLOWED_CHANGE_KINDS: readonly ["set_column_format", "set_column_header", "set_column_visibility", "set_column_filterable", "set_column_sortable", "set_column_width", "set_column_align", "set_column_sticky", "set_column_conditional_style", "set_column_computed", "set_column_value_mapping", "set_column_renderer", "set_column_badge_renderer", "set_column_conditional_badge_renderers", "set_row_conditional_renderer", "configure_table_filtering", "configure_table_pagination", "configure_table_selection", "configure_table_sorting", "configure_toolbar", "configure_export", "set_table_density", "set_toolbar_visibility"];
|
|
4003
|
+
type TableComponentEditChangeKind = 'set_column_format' | 'set_column_header' | 'set_column_visibility' | 'set_column_filterable' | 'set_column_sortable' | 'set_column_width' | 'set_column_align' | 'set_column_sticky' | 'set_column_conditional_style' | 'set_row_conditional_style' | 'set_column_computed' | 'set_column_value_mapping' | 'set_column_renderer' | 'set_column_badge_renderer' | 'set_column_conditional_badge_renderers' | 'set_row_conditional_renderer' | 'configure_table_filtering' | 'configure_advanced_filters' | 'add_advanced_filter_fields' | 'remove_advanced_filter_fields' | 'configure_table_pagination' | 'configure_table_selection' | 'configure_table_sorting' | 'configure_toolbar' | 'add_toolbar_action' | 'configure_export' | 'set_table_density' | 'set_toolbar_visibility';
|
|
4004
|
+
type TableComponentEditOperationId = 'column.format.set' | 'column.header.set' | 'column.visibility.set' | 'column.filterable.set' | 'column.sortable.set' | 'column.width.set' | 'column.align.set' | 'column.sticky.set' | 'column.renderer.set' | 'column.valueMapping.set' | 'column.conditionalStyle.add' | 'row.styleRule.add' | 'column.conditionalRenderer.add' | 'column.computed.add' | 'row.conditionalRenderer.add' | 'behavior.filtering.configure' | 'filter.advanced.configure' | 'filter.advanced.fields.add' | 'filter.advanced.fields.remove' | 'behavior.pagination.configure' | 'behavior.selection.configure' | 'behavior.sorting.configure' | 'toolbar.configure' | 'toolbar.action.add' | 'export.configure' | 'appearance.density.set' | 'toolbar.visibility.set';
|
|
4005
|
+
declare const TABLE_COMPONENT_EDIT_PLAN_ALLOWED_CHANGE_KINDS: readonly ["set_column_format", "set_column_header", "set_column_visibility", "set_column_filterable", "set_column_sortable", "set_column_width", "set_column_align", "set_column_sticky", "set_column_conditional_style", "set_row_conditional_style", "set_column_computed", "set_column_value_mapping", "set_column_renderer", "set_column_badge_renderer", "set_column_conditional_badge_renderers", "set_row_conditional_renderer", "configure_table_filtering", "configure_advanced_filters", "add_advanced_filter_fields", "remove_advanced_filter_fields", "configure_table_pagination", "configure_table_selection", "configure_table_sorting", "configure_toolbar", "add_toolbar_action", "configure_export", "set_table_density", "set_toolbar_visibility"];
|
|
3988
4006
|
declare const TABLE_COMPONENT_EDIT_PLAN_EXPECTED_PATHS: Record<TableComponentEditChangeKind, string>;
|
|
3989
4007
|
interface TableComponentEditPlan {
|
|
3990
4008
|
kind?: typeof TABLE_COMPONENT_EDIT_PLAN_KIND;
|
|
@@ -4026,7 +4044,7 @@ declare const TABLE_COMPONENT_EDIT_PLAN_JSON_SCHEMA: {
|
|
|
4026
4044
|
readonly $defs: {
|
|
4027
4045
|
readonly changeKind: {
|
|
4028
4046
|
readonly type: "string";
|
|
4029
|
-
readonly enum: readonly ["set_column_format", "set_column_header", "set_column_visibility", "set_column_filterable", "set_column_sortable", "set_column_width", "set_column_align", "set_column_sticky", "set_column_conditional_style", "set_column_computed", "set_column_value_mapping", "set_column_renderer", "set_column_badge_renderer", "set_column_conditional_badge_renderers", "set_row_conditional_renderer", "configure_table_filtering", "configure_table_pagination", "configure_table_selection", "configure_table_sorting", "configure_toolbar", "configure_export", "set_table_density", "set_toolbar_visibility"];
|
|
4047
|
+
readonly enum: readonly ["set_column_format", "set_column_header", "set_column_visibility", "set_column_filterable", "set_column_sortable", "set_column_width", "set_column_align", "set_column_sticky", "set_column_conditional_style", "set_row_conditional_style", "set_column_computed", "set_column_value_mapping", "set_column_renderer", "set_column_badge_renderer", "set_column_conditional_badge_renderers", "set_row_conditional_renderer", "configure_table_filtering", "configure_advanced_filters", "add_advanced_filter_fields", "remove_advanced_filter_fields", "configure_table_pagination", "configure_table_selection", "configure_table_sorting", "configure_toolbar", "add_toolbar_action", "configure_export", "set_table_density", "set_toolbar_visibility"];
|
|
4030
4048
|
};
|
|
4031
4049
|
readonly capabilityPath: {
|
|
4032
4050
|
readonly type: "string";
|
|
@@ -4082,7 +4100,7 @@ declare const TABLE_COMPONENT_EDIT_PLAN_JSON_SCHEMA: {
|
|
|
4082
4100
|
readonly const: "praxis-table";
|
|
4083
4101
|
};
|
|
4084
4102
|
readonly operationId: {
|
|
4085
|
-
readonly enum: readonly ["column.format.set", "column.header.set", "column.visibility.set", "column.filterable.set", "column.sortable.set", "column.width.set", "column.align.set", "column.sticky.set", "column.renderer.set", "column.valueMapping.set", "column.conditionalStyle.add", "column.conditionalRenderer.add", "column.computed.add", "row.conditionalRenderer.add", "behavior.filtering.configure", "behavior.pagination.configure", "behavior.selection.configure", "behavior.sorting.configure", "toolbar.configure", "export.configure", "appearance.density.set", "toolbar.visibility.set"];
|
|
4103
|
+
readonly enum: readonly ["column.format.set", "column.header.set", "column.visibility.set", "column.filterable.set", "column.sortable.set", "column.width.set", "column.align.set", "column.sticky.set", "column.renderer.set", "column.valueMapping.set", "column.conditionalStyle.add", "row.styleRule.add", "column.conditionalRenderer.add", "column.computed.add", "row.conditionalRenderer.add", "behavior.filtering.configure", "filter.advanced.configure", "filter.advanced.fields.add", "filter.advanced.fields.remove", "behavior.pagination.configure", "behavior.selection.configure", "behavior.sorting.configure", "toolbar.configure", "toolbar.action.add", "export.configure", "appearance.density.set", "toolbar.visibility.set"];
|
|
4086
4104
|
};
|
|
4087
4105
|
readonly target: true;
|
|
4088
4106
|
readonly input: true;
|
package/package.json
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@praxisui/table",
|
|
3
|
-
"version": "8.0.0-beta.
|
|
3
|
+
"version": "8.0.0-beta.31",
|
|
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": "^20.0.0",
|
|
7
7
|
"@angular/core": "^20.0.0",
|
|
8
|
-
"@praxisui/ai": "^8.0.0-beta.
|
|
9
|
-
"@praxisui/core": "^8.0.0-beta.
|
|
10
|
-
"@praxisui/dynamic-fields": "^8.0.0-beta.
|
|
11
|
-
"@praxisui/dynamic-form": "^8.0.0-beta.
|
|
12
|
-
"@praxisui/metadata-editor": "^8.0.0-beta.
|
|
13
|
-
"@praxisui/rich-content": "^8.0.0-beta.
|
|
14
|
-
"@praxisui/settings-panel": "^8.0.0-beta.
|
|
15
|
-
"@praxisui/table-rule-builder": "^8.0.0-beta.
|
|
8
|
+
"@praxisui/ai": "^8.0.0-beta.31",
|
|
9
|
+
"@praxisui/core": "^8.0.0-beta.31",
|
|
10
|
+
"@praxisui/dynamic-fields": "^8.0.0-beta.31",
|
|
11
|
+
"@praxisui/dynamic-form": "^8.0.0-beta.31",
|
|
12
|
+
"@praxisui/metadata-editor": "^8.0.0-beta.31",
|
|
13
|
+
"@praxisui/rich-content": "^8.0.0-beta.31",
|
|
14
|
+
"@praxisui/settings-panel": "^8.0.0-beta.31",
|
|
15
|
+
"@praxisui/table-rule-builder": "^8.0.0-beta.31",
|
|
16
16
|
"@angular/cdk": "^20.0.0",
|
|
17
17
|
"@angular/forms": "^20.0.0",
|
|
18
18
|
"@angular/material": "^20.0.0",
|
|
19
19
|
"@angular/router": "^20.0.0",
|
|
20
|
-
"@praxisui/dialog": "^8.0.0-beta.
|
|
20
|
+
"@praxisui/dialog": "^8.0.0-beta.31",
|
|
21
21
|
"rxjs": "~7.8.0"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
@@ -385,6 +385,7 @@ row selection through table affordances.
|
|
|
385
385
|
| `afterBulkDelete` | `rows[]` | Depois de bulk delete com sucesso. | Partial | Preservado da documentação anterior. |
|
|
386
386
|
| `bulkDeleteError` | `{ rows, error }` | Erro em operação de delete em lote. | Partial | Preservado da documentação anterior. |
|
|
387
387
|
| `schemaStatusChange` | `{ outdated, serverHash?, lastVerifiedAt?, trigger?, tableId? }` | Verificação de versão de schema concluída. | Partial | Usado para notificação de drift entre runtime e servidor. |
|
|
388
|
+
| `configChange` | `TableConfig` | Configuração materializada pelo runtime/editor/assistente. | Active | Permite que o host sincronize mudanças feitas por authoring em tempo de execução. |
|
|
388
389
|
| `metadataChange` | `{ trigger, meta, tableId? }` | Metadados operacionais atualizados pelo runtime/editor. | Partial | Emite contexto de trigger e a carga corrente de `config.meta`. |
|
|
389
390
|
| `loadingStateChange` | `LoadingState` | Mudança de estado (`config/schema/data/render`). | Active | Emitido por `emitLoadingState()`. |
|
|
390
391
|
|
|
@@ -810,7 +811,7 @@ Frontend (UI):
|
|
|
810
811
|
| `praxis-table-toolbar` | Barra superior/inferior com acoes, bulk e export | `toolbar`, `actions`, `export`, `behavior.filtering.*` |
|
|
811
812
|
| `praxis-filter` | Filtro avancado acoplado a toolbar | `behavior.filtering.advancedFilters.*`, `behavior.filtering.debounceTime`, `resourcePath` |
|
|
812
813
|
| `praxis-empty-state-card` | Estado inicial quando nao ha conexao remota | exibido quando nao ha `resourcePath` valido |
|
|
813
|
-
| `PraxisAiAssistantShellComponent` | Copiloto semantico opcional nos slots de toolbar | habilitado pelo runtime com turn orchestration e contexto seguro (nao exposto no JSON) |
|
|
814
|
+
| `PraxisAiAssistantShellComponent` | Copiloto semantico opcional nos slots de toolbar | habilitado pelo runtime com turn orchestration e contexto seguro; ao minimizar, a sessao fica no registry com `presence: "origin-anchor"` e o affordance volta ao gatilho da tabela (nao exposto no JSON) |
|
|
814
815
|
| Angular Material + CDK | Base de tabela, menus, selecao e virtual scroll | `behavior.pagination.*`, `behavior.selection.*`, `behavior.virtualization.*`, `appearance.spacing.*` |
|
|
815
816
|
|
|
816
817
|
Backend e contratos:
|
|
@@ -1,335 +0,0 @@
|
|
|
1
|
-
import { firstValueFrom } from 'rxjs';
|
|
2
|
-
|
|
3
|
-
class TableAgenticAuthoringTurnFlow {
|
|
4
|
-
adapter;
|
|
5
|
-
aiApi;
|
|
6
|
-
mode = 'config';
|
|
7
|
-
constructor(adapter, aiApi) {
|
|
8
|
-
this.adapter = adapter;
|
|
9
|
-
this.aiApi = aiApi;
|
|
10
|
-
}
|
|
11
|
-
async submit(request) {
|
|
12
|
-
const prompt = (request.prompt ?? '').trim();
|
|
13
|
-
if (!prompt) {
|
|
14
|
-
return {
|
|
15
|
-
state: 'listening',
|
|
16
|
-
phase: 'capture',
|
|
17
|
-
statusText: '',
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
const componentId = this.adapter.componentId || request.componentId || 'praxis-table';
|
|
21
|
-
const componentType = this.adapter.componentType || request.componentType || 'table';
|
|
22
|
-
const currentState = this.toAiJsonObject(this.adapter.getCurrentConfig());
|
|
23
|
-
const dataProfile = this.optionalJsonObject(this.adapter.getDataProfile?.());
|
|
24
|
-
const runtimeState = this.optionalJsonObject(this.adapter.getRuntimeState?.());
|
|
25
|
-
const schemaFields = this.adapter.getSchemaFields?.()
|
|
26
|
-
?.map((field) => this.toAiJsonObject(field))
|
|
27
|
-
.filter((field) => Object.keys(field).length > 0);
|
|
28
|
-
const contextHints = this.mergeJsonObjects(this.optionalJsonObject(this.adapter.getAuthoringContext?.()), this.optionalJsonObject(request.action?.contextHints));
|
|
29
|
-
const response = await firstValueFrom(this.aiApi.getPatch({
|
|
30
|
-
componentId,
|
|
31
|
-
componentType,
|
|
32
|
-
userPrompt: prompt,
|
|
33
|
-
sessionId: request.sessionId,
|
|
34
|
-
clientTurnId: request.clientTurnId,
|
|
35
|
-
messages: this.toChatMessages(request.messages, prompt),
|
|
36
|
-
currentState,
|
|
37
|
-
currentStateDigest: this.buildCurrentStateDigest(currentState, dataProfile),
|
|
38
|
-
uiContextRef: {
|
|
39
|
-
componentId,
|
|
40
|
-
componentType,
|
|
41
|
-
},
|
|
42
|
-
...(dataProfile ? { dataProfile } : {}),
|
|
43
|
-
...(runtimeState ? { runtimeState } : {}),
|
|
44
|
-
...(schemaFields?.length ? { schemaFields } : {}),
|
|
45
|
-
...(contextHints ? { contextHints } : {}),
|
|
46
|
-
}));
|
|
47
|
-
return this.toTurnResult(this.compileAdapterResponse(response), request);
|
|
48
|
-
}
|
|
49
|
-
async apply(request) {
|
|
50
|
-
const patch = this.toRecord(request.pendingPatch);
|
|
51
|
-
if (!patch) {
|
|
52
|
-
return {
|
|
53
|
-
state: 'error',
|
|
54
|
-
phase: 'apply',
|
|
55
|
-
assistantMessage: 'Nao ha alteracao de tabela pronta para aplicar.',
|
|
56
|
-
errorText: 'Nao ha alteracao de tabela pronta para aplicar.',
|
|
57
|
-
canApply: false,
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
const result = await this.adapter.applyPatch(patch, request.prompt);
|
|
61
|
-
if (!result.success) {
|
|
62
|
-
return {
|
|
63
|
-
state: 'error',
|
|
64
|
-
phase: 'apply',
|
|
65
|
-
assistantMessage: result.error || 'Nao foi possivel aplicar as alteracoes na tabela.',
|
|
66
|
-
errorText: result.error || 'Nao foi possivel aplicar as alteracoes na tabela.',
|
|
67
|
-
canApply: true,
|
|
68
|
-
pendingPatch: patch,
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
return {
|
|
72
|
-
state: 'success',
|
|
73
|
-
phase: 'summarize',
|
|
74
|
-
assistantMessage: 'Alteracoes aplicadas na tabela.',
|
|
75
|
-
statusText: 'Alteracoes aplicadas na tabela.',
|
|
76
|
-
canApply: false,
|
|
77
|
-
pendingPatch: null,
|
|
78
|
-
diagnostics: result.warnings?.length ? { warnings: result.warnings } : undefined,
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
cancel() {
|
|
82
|
-
return Promise.resolve({
|
|
83
|
-
state: 'listening',
|
|
84
|
-
phase: 'capture',
|
|
85
|
-
assistantMessage: 'Solicitacao cancelada.',
|
|
86
|
-
statusText: '',
|
|
87
|
-
canApply: false,
|
|
88
|
-
pendingPatch: null,
|
|
89
|
-
pendingClarification: null,
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
retry(request) {
|
|
93
|
-
const lastPrompt = [...(request.messages ?? [])].reverse()
|
|
94
|
-
.find((message) => message.role === 'user')?.text;
|
|
95
|
-
return this.submit({
|
|
96
|
-
...request,
|
|
97
|
-
prompt: lastPrompt ?? request.prompt,
|
|
98
|
-
action: { kind: 'retry' },
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
toTurnResult(response, request) {
|
|
102
|
-
if (!response) {
|
|
103
|
-
return {
|
|
104
|
-
state: 'error',
|
|
105
|
-
phase: 'capture',
|
|
106
|
-
assistantMessage: 'Resposta vazia da IA.',
|
|
107
|
-
errorText: 'Resposta vazia da IA.',
|
|
108
|
-
};
|
|
109
|
-
}
|
|
110
|
-
if (response.sessionId && response.sessionId !== request.sessionId) {
|
|
111
|
-
request = { ...request, sessionId: response.sessionId };
|
|
112
|
-
}
|
|
113
|
-
if (response.type === 'clarification') {
|
|
114
|
-
const questions = this.toClarificationQuestions(response);
|
|
115
|
-
return {
|
|
116
|
-
state: 'clarification',
|
|
117
|
-
phase: 'clarify',
|
|
118
|
-
sessionId: response.sessionId ?? request.sessionId,
|
|
119
|
-
assistantMessage: response.message || 'Preciso de mais detalhes para continuar.',
|
|
120
|
-
clarificationQuestions: questions,
|
|
121
|
-
quickReplies: this.toQuickReplies(response),
|
|
122
|
-
canApply: false,
|
|
123
|
-
};
|
|
124
|
-
}
|
|
125
|
-
if (response.type === 'info') {
|
|
126
|
-
const message = response.message || response.explanation || 'Informacao gerada.';
|
|
127
|
-
return {
|
|
128
|
-
state: 'success',
|
|
129
|
-
phase: 'summarize',
|
|
130
|
-
sessionId: response.sessionId ?? request.sessionId,
|
|
131
|
-
assistantMessage: message,
|
|
132
|
-
statusText: message,
|
|
133
|
-
quickReplies: this.toQuickReplies(response),
|
|
134
|
-
canApply: false,
|
|
135
|
-
};
|
|
136
|
-
}
|
|
137
|
-
if (response.type === 'error') {
|
|
138
|
-
const message = response.message || 'Falha ao gerar alteracao de tabela.';
|
|
139
|
-
return {
|
|
140
|
-
state: 'error',
|
|
141
|
-
phase: 'capture',
|
|
142
|
-
sessionId: response.sessionId ?? request.sessionId,
|
|
143
|
-
assistantMessage: message,
|
|
144
|
-
errorText: message,
|
|
145
|
-
diagnostics: response.warnings?.length ? { warnings: response.warnings } : undefined,
|
|
146
|
-
};
|
|
147
|
-
}
|
|
148
|
-
if (response.patch && Object.keys(response.patch).length > 0) {
|
|
149
|
-
const warnings = response.warnings?.filter(Boolean) ?? [];
|
|
150
|
-
return {
|
|
151
|
-
state: 'review',
|
|
152
|
-
phase: 'review',
|
|
153
|
-
sessionId: response.sessionId ?? request.sessionId,
|
|
154
|
-
assistantMessage: response.explanation || 'Proposta de alteracao pronta para revisar.',
|
|
155
|
-
statusText: 'Revise a proposta antes de aplicar.',
|
|
156
|
-
canApply: true,
|
|
157
|
-
pendingPatch: response.patch,
|
|
158
|
-
preview: {
|
|
159
|
-
kind: 'table-config-patch',
|
|
160
|
-
diff: response.diff ?? [],
|
|
161
|
-
},
|
|
162
|
-
diagnostics: warnings.length ? { warnings } : undefined,
|
|
163
|
-
};
|
|
164
|
-
}
|
|
165
|
-
return {
|
|
166
|
-
state: 'success',
|
|
167
|
-
phase: 'summarize',
|
|
168
|
-
sessionId: response.sessionId ?? request.sessionId,
|
|
169
|
-
assistantMessage: response.message || response.explanation || 'Nenhuma alteracao necessaria.',
|
|
170
|
-
statusText: response.message || response.explanation || 'Nenhuma alteracao necessaria.',
|
|
171
|
-
canApply: false,
|
|
172
|
-
};
|
|
173
|
-
}
|
|
174
|
-
compileAdapterResponse(response) {
|
|
175
|
-
const compiled = this.adapter.compileAiResponse?.(response);
|
|
176
|
-
if (!compiled && response.patch && Object.keys(response.patch).length > 0) {
|
|
177
|
-
return {
|
|
178
|
-
type: 'error',
|
|
179
|
-
message: 'A tabela exige componentEditPlan validado pelo manifesto antes de gerar patch local.',
|
|
180
|
-
warnings: [
|
|
181
|
-
'free-table-patch-rejected',
|
|
182
|
-
'Use componentEditPlan validado contra PRAXIS_TABLE_AUTHORING_MANIFEST.',
|
|
183
|
-
],
|
|
184
|
-
};
|
|
185
|
-
}
|
|
186
|
-
if (!compiled) {
|
|
187
|
-
return response;
|
|
188
|
-
}
|
|
189
|
-
if (compiled.type === 'error') {
|
|
190
|
-
return {
|
|
191
|
-
type: 'error',
|
|
192
|
-
message: compiled.message || 'O componentEditPlan da tabela nao passou na validacao de capacidades.',
|
|
193
|
-
warnings: compiled.warnings,
|
|
194
|
-
};
|
|
195
|
-
}
|
|
196
|
-
const warnings = [
|
|
197
|
-
...(response.warnings ?? []),
|
|
198
|
-
...(compiled.warnings ?? []),
|
|
199
|
-
];
|
|
200
|
-
return {
|
|
201
|
-
...response,
|
|
202
|
-
...compiled,
|
|
203
|
-
patch: compiled.patch,
|
|
204
|
-
warnings: warnings.length ? warnings : undefined,
|
|
205
|
-
};
|
|
206
|
-
}
|
|
207
|
-
toChatMessages(messages, prompt) {
|
|
208
|
-
const supported = (messages ?? [])
|
|
209
|
-
.filter((message) => message.role === 'user' || message.role === 'assistant' || message.role === 'system')
|
|
210
|
-
.map((message) => ({
|
|
211
|
-
role: message.role,
|
|
212
|
-
content: message.text,
|
|
213
|
-
}))
|
|
214
|
-
.filter((message) => message.content.trim().length > 0);
|
|
215
|
-
return supported.length ? supported : [{ role: 'user', content: prompt }];
|
|
216
|
-
}
|
|
217
|
-
toClarificationQuestions(response) {
|
|
218
|
-
const labels = response.questions?.length
|
|
219
|
-
? response.questions
|
|
220
|
-
: response.message
|
|
221
|
-
? [response.message]
|
|
222
|
-
: ['Qual ajuste voce quer aplicar na tabela?'];
|
|
223
|
-
const options = this.toQuickReplies(response).map((reply) => ({
|
|
224
|
-
id: reply.id,
|
|
225
|
-
label: reply.label,
|
|
226
|
-
value: reply.prompt,
|
|
227
|
-
}));
|
|
228
|
-
return labels.map((label, index) => ({
|
|
229
|
-
id: `table-clarification-${index + 1}`,
|
|
230
|
-
type: options.length ? 'single-choice' : 'text',
|
|
231
|
-
label,
|
|
232
|
-
allowCustom: true,
|
|
233
|
-
options,
|
|
234
|
-
}));
|
|
235
|
-
}
|
|
236
|
-
toQuickReplies(response) {
|
|
237
|
-
const payloads = response.optionPayloads ?? [];
|
|
238
|
-
if (payloads.length) {
|
|
239
|
-
return payloads
|
|
240
|
-
.map((option, index) => {
|
|
241
|
-
const label = option.label?.trim() || option.value?.trim() || `Opcao ${index + 1}`;
|
|
242
|
-
const prompt = option.value?.trim() || option.example?.trim() || label;
|
|
243
|
-
return {
|
|
244
|
-
id: `option-${index + 1}`,
|
|
245
|
-
label,
|
|
246
|
-
prompt,
|
|
247
|
-
kind: 'clarification-option',
|
|
248
|
-
description: this.optionDescription(option),
|
|
249
|
-
icon: this.optionIcon(option),
|
|
250
|
-
tone: this.optionTone(option),
|
|
251
|
-
presentation: this.optionPresentation(option),
|
|
252
|
-
contextHints: this.optionContextHints(option),
|
|
253
|
-
};
|
|
254
|
-
});
|
|
255
|
-
}
|
|
256
|
-
return (response.options ?? [])
|
|
257
|
-
.filter((option) => !!option?.trim())
|
|
258
|
-
.map((option, index) => ({
|
|
259
|
-
id: `option-${index + 1}`,
|
|
260
|
-
label: option.trim(),
|
|
261
|
-
prompt: option.trim(),
|
|
262
|
-
kind: 'clarification-option',
|
|
263
|
-
}));
|
|
264
|
-
}
|
|
265
|
-
optionContextHints(option) {
|
|
266
|
-
return this.toRecord(option.contextHints);
|
|
267
|
-
}
|
|
268
|
-
optionPresentation(option) {
|
|
269
|
-
const hints = this.optionContextHints(option);
|
|
270
|
-
return this.toRecord(hints?.['presentation']);
|
|
271
|
-
}
|
|
272
|
-
optionDescription(option) {
|
|
273
|
-
const presentation = this.optionPresentation(option);
|
|
274
|
-
const value = presentation?.['description'];
|
|
275
|
-
return typeof value === 'string' && value.trim() ? value.trim() : null;
|
|
276
|
-
}
|
|
277
|
-
optionIcon(option) {
|
|
278
|
-
const presentation = this.optionPresentation(option);
|
|
279
|
-
const value = presentation?.['icon'];
|
|
280
|
-
return typeof value === 'string' && value.trim() ? value.trim() : null;
|
|
281
|
-
}
|
|
282
|
-
optionTone(option) {
|
|
283
|
-
const presentation = this.optionPresentation(option);
|
|
284
|
-
const value = presentation?.['tone'];
|
|
285
|
-
return typeof value === 'string' && value.trim() ? value.trim() : null;
|
|
286
|
-
}
|
|
287
|
-
buildCurrentStateDigest(currentState, dataProfile) {
|
|
288
|
-
const columns = Array.isArray(currentState['columns'])
|
|
289
|
-
? currentState['columns']
|
|
290
|
-
.map((column) => this.toRecord(column)?.['field'])
|
|
291
|
-
.filter((field) => typeof field === 'string' && field.length > 0)
|
|
292
|
-
: undefined;
|
|
293
|
-
const rowCount = typeof dataProfile?.['rowCount'] === 'number' ? dataProfile['rowCount'] : undefined;
|
|
294
|
-
return {
|
|
295
|
-
...(columns?.length ? { columns } : {}),
|
|
296
|
-
...(rowCount !== undefined ? { rowCount } : {}),
|
|
297
|
-
};
|
|
298
|
-
}
|
|
299
|
-
optionalJsonObject(value) {
|
|
300
|
-
if (value === undefined || value === null) {
|
|
301
|
-
return undefined;
|
|
302
|
-
}
|
|
303
|
-
const object = this.toAiJsonObject(value);
|
|
304
|
-
return Object.keys(object).length ? object : undefined;
|
|
305
|
-
}
|
|
306
|
-
mergeJsonObjects(base, overlay) {
|
|
307
|
-
if (!base)
|
|
308
|
-
return overlay;
|
|
309
|
-
if (!overlay)
|
|
310
|
-
return base;
|
|
311
|
-
return {
|
|
312
|
-
...base,
|
|
313
|
-
...overlay,
|
|
314
|
-
};
|
|
315
|
-
}
|
|
316
|
-
toAiJsonObject(value) {
|
|
317
|
-
const record = this.toRecord(value);
|
|
318
|
-
if (!record) {
|
|
319
|
-
return {};
|
|
320
|
-
}
|
|
321
|
-
try {
|
|
322
|
-
return JSON.parse(JSON.stringify(record));
|
|
323
|
-
}
|
|
324
|
-
catch {
|
|
325
|
-
return {};
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
toRecord(value) {
|
|
329
|
-
return value && typeof value === 'object' && !Array.isArray(value)
|
|
330
|
-
? value
|
|
331
|
-
: null;
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
export { TableAgenticAuthoringTurnFlow };
|