@praxisui/crud 3.0.0-beta.9 → 4.0.0-beta.0

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/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as _praxisui_core from '@praxisui/core';
2
- import { ApiEndpoint, TableConfig, FormConfig, BackConfig, RowAction, ToolbarAction, LoadingState, GenericCrudService, AsyncConfigStorage, ComponentDocMeta, AiCapabilityCategory, AiValueKind, AiCapability, AiCapabilityCatalog } from '@praxisui/core';
2
+ import { ApiEndpoint, TableConfig, PraxisDataQueryContext, FormConfig, BackConfig, RowAction, ToolbarAction, ResourceActionCatalogItem, LoadingState, RestApiLinks, ApiUrlEntry, GenericCrudService, AsyncConfigStorage, ComponentDocMeta, AiCapabilityCategory, AiValueKind, AiCapability, AiCapabilityCatalog } from '@praxisui/core';
3
3
  export { BackConfig } from '@praxisui/core';
4
4
  import * as i0 from '@angular/core';
5
5
  import { NgZone, OnChanges, EventEmitter, SimpleChanges, OnInit, Provider } from '@angular/core';
@@ -61,6 +61,8 @@ interface CrudMetadata {
61
61
  resource?: CrudResource;
62
62
  data?: any[] | null;
63
63
  table: TableConfig;
64
+ queryContext?: PraxisDataQueryContext | null;
65
+ filterCriteria?: Record<string, unknown> | null;
64
66
  form?: FormConfig;
65
67
  defaults?: CrudDefaults;
66
68
  actions?: CrudAction[];
@@ -82,17 +84,31 @@ interface CrudMetadataAssertionOptions {
82
84
  }
83
85
  declare function assertCrudMetadata(meta: CrudMetadata, options?: CrudMetadataAssertionOptions): void;
84
86
 
87
+ type CrudActionRuntimeEvent = {
88
+ actionConfig?: ResourceActionCatalogItem | null;
89
+ };
90
+ type CrudContextAction = {
91
+ action: string;
92
+ label?: string;
93
+ formId?: string;
94
+ route?: string;
95
+ openMode?: 'modal' | 'drawer' | 'route';
96
+ };
97
+ type CrudContextValue = {
98
+ tableId: string;
99
+ componentKeyId?: string;
100
+ resourcePath?: string;
101
+ endpointKey?: ApiEndpoint;
102
+ defaults?: CrudMetadata['defaults'];
103
+ actions?: CrudContextAction[];
104
+ idField?: string;
105
+ };
85
106
  declare class PraxisCrudComponent implements OnChanges {
86
- /** JSON inline ou chave/URL resolvida pelo MetadataResolver */
87
107
  metadata: CrudMetadata | string;
88
- /** Identificador obrigatório do CRUD (base para tabela/formulário) */
89
108
  crudId: string;
90
- /** Identificador opcional para instâncias múltiplas */
91
109
  componentInstanceId?: string;
92
110
  context?: Record<string, unknown>;
93
- /** Encaminha o modo de edição de layout para a tabela interna */
94
111
  enableCustomization: boolean;
95
- /** CTA: usado pelo Builder para abrir configuração de metadados quando vazio */
96
112
  configureRequested: EventEmitter<void>;
97
113
  afterOpen: EventEmitter<{
98
114
  mode: FormOpenMode;
@@ -107,73 +123,97 @@ declare class PraxisCrudComponent implements OnChanges {
107
123
  id: string | number;
108
124
  }>;
109
125
  error: EventEmitter<unknown>;
110
- /**
111
- * Emits the live PraxisTable configuration snapshot after runtime hydration or
112
- * metadata refreshes. This reflects the effective table state in memory,
113
- * deduplicated by structural JSON equality, and is intended for external hosts
114
- * that need to mirror the table editor/runtime state.
115
- */
116
126
  tableRuntimeConfigChange: EventEmitter<_praxisui_core.TableConfigModern>;
117
127
  resolvedMetadata: CrudMetadata;
118
- /** Configuração efetiva da tabela com melhorias automáticas (ex.: botão Adicionar). */
119
128
  effectiveTableConfig?: TableConfig;
120
- /** Config passado ao PraxisTable — sempre definido (fallback seguro). */
121
129
  tableConfigForBinding: TableConfig;
130
+ tableQueryContext: Record<string, unknown> | null;
131
+ tableFilterCriteria: Record<string, unknown>;
132
+ tableCrudContext?: CrudContextValue;
122
133
  private readonly launcher;
123
134
  private readonly destroyRef;
135
+ private readonly cdr;
124
136
  private table;
125
137
  private readonly storage;
126
138
  private readonly snack;
139
+ private readonly i18n;
140
+ private readonly resourceDiscovery;
141
+ private readonly actionOpenAdapter;
142
+ private readonly surfaceOpenAdapter;
127
143
  private readonly global;
144
+ private readonly surfaceService;
128
145
  private readonly componentKeys;
129
146
  private readonly route;
130
147
  private warnedMissingId;
131
148
  private lastEmittedTableRuntimeConfigJson;
132
- /**
133
- * Stable CRUD context passed to PraxisTable.
134
- * Previously this was created via a getter, producing a new object each CD tick
135
- * and causing excessive re-renders. Now we compute it only when metadata changes.
136
- */
137
- tableCrudContext?: {
138
- tableId: string;
139
- componentKeyId?: string;
140
- resourcePath?: string;
141
- defaults?: any;
142
- actions?: Array<{
143
- action: string;
144
- label?: string;
145
- formId?: string;
146
- route?: string;
147
- openMode?: 'modal' | 'drawer' | 'route';
148
- }>;
149
- };
149
+ private lastAssignedTableConfigJson;
150
+ private lastAssignedTableCrudContextJson;
151
+ private lastAppliedResourceIdentity;
152
+ private tableCollectionLinks;
153
+ private collectionCapabilities;
154
+ private collectionCapabilitiesRequestHref;
155
+ private collectionCapabilitiesResolvedHref;
156
+ private collectionCapabilitiesRequestSeq;
150
157
  onResetPreferences(): void;
151
158
  ngOnChanges(changes: SimpleChanges): void;
152
- onAction(action: string, row?: Record<string, unknown>): Promise<void>;
153
- private refreshTable;
159
+ onAction(action: string, row?: Record<string, unknown>, runtimeEvent?: CrudActionRuntimeEvent): Promise<void>;
154
160
  getCurrentTableConfigSnapshot(): TableConfig | null;
155
161
  onTableMetadataChange(): void;
156
162
  onTableLoadingStateChange(state: LoadingState): void;
157
- private emitTableRuntimeConfigSnapshot;
163
+ onCollectionLinksChange(links: RestApiLinks | null | undefined): void;
158
164
  resolveResourcePath(meta?: CrudMetadata): string;
159
- resolveLocalData(meta?: CrudMetadata): any[] | null;
160
- resolveTableData(meta?: CrudMetadata): any[] | null;
165
+ resolveLocalData(meta?: CrudMetadata): unknown[] | null;
166
+ resolveTableData(meta?: CrudMetadata): unknown[] | null;
161
167
  shouldRenderTable(meta?: CrudMetadata): boolean;
162
- private getIdField;
168
+ getEmptyStateTitle(): string;
169
+ getEmptyStateDescription(): string;
170
+ getEmptyStatePrimaryAction(): string;
163
171
  onConfigureRequested(): void;
164
- /**
165
- * Constrói uma configuração de tabela efetiva a partir dos metadados,
166
- * adicionando automaticamente a ação de "Adicionar" na toolbar quando aplicável.
167
- * - Evita duplicidade se a toolbar já tiver ação equivalente.
168
- * - Garante visibilidade da toolbar quando a ação é injetada.
169
- */
172
+ private refreshTable;
173
+ private emitTableRuntimeConfigSnapshot;
174
+ private applyResolvedCrudState;
175
+ private assignTableConfigForBinding;
176
+ private assignTableCrudContext;
177
+ private safeSerialize;
178
+ private syncRuntimeBindings;
179
+ private resolveQueryContext;
180
+ private resolveFilterCriteria;
181
+ private tryOpenDiscoveredCrudSurface;
182
+ private resolveDiscoveredSurfaceCatalog;
183
+ private tryOpenDiscoveredWorkflowAction;
184
+ private resolveDiscoveredActionCatalog;
185
+ private selectDiscoveredWorkflowAction;
186
+ private resolveProvidedWorkflowAction;
187
+ private selectSurfaceForCrudAction;
188
+ private getPreferredSurfaceIdsForCrudAction;
189
+ private isDiscoveryManagedCrudAction;
190
+ private isWritableCrudSurface;
191
+ private isReadableCrudSurface;
192
+ private resolveRowResourceId;
193
+ private mapSurfacePresentationToCrudMode;
194
+ private handleDiscoveredSurfaceResult;
170
195
  private buildEffectiveTableConfig;
171
- /** Heurística leve para identificar ações do tipo "adicionar/criar" */
172
196
  private isAddLike;
173
- /** Builds a stable CRUD context object for PraxisTable based on metadata. */
174
197
  private buildTableCrudContext;
198
+ private resolveCreateToolbarAction;
199
+ private resolveContextCrudActions;
200
+ private resolveCollectionWorkflowCrudActions;
201
+ private resolveCollectionWorkflowToolbarActions;
202
+ private supportsCreateCapability;
203
+ private supportsViewCapability;
204
+ private supportsEditCapability;
205
+ private supportsDeleteCapability;
206
+ private hasCanonicalOperation;
207
+ private resolveCollectionCapabilitiesHref;
208
+ private resolveCrudResourceIdentity;
209
+ private buildDiscoveryOptions;
210
+ private resolveDiscoveryApiEntry;
211
+ private isRecord;
212
+ private getIdField;
175
213
  private componentKeyId;
176
214
  private warnMissingId;
215
+ private getCrudActionLabel;
216
+ private tx;
177
217
  static ɵfac: i0.ɵɵFactoryDeclaration<PraxisCrudComponent, never>;
178
218
  static ɵcmp: i0.ɵɵComponentDeclaration<PraxisCrudComponent, "praxis-crud", never, { "metadata": { "alias": "metadata"; "required": true; }; "crudId": { "alias": "crudId"; "required": true; }; "componentInstanceId": { "alias": "componentInstanceId"; "required": false; }; "context": { "alias": "context"; "required": false; }; "enableCustomization": { "alias": "enableCustomization"; "required": false; }; }, { "configureRequested": "configureRequested"; "afterOpen": "afterOpen"; "afterClose": "afterClose"; "afterSave": "afterSave"; "afterDelete": "afterDelete"; "error": "error"; "tableRuntimeConfigChange": "tableRuntimeConfigChange"; }, never, never, true, never>;
179
219
  }
@@ -221,6 +261,11 @@ declare class DynamicFormDialogHostComponent implements OnInit {
221
261
  private destroyRef;
222
262
  resourcePath?: string;
223
263
  resourceId?: string | number;
264
+ schemaUrl?: string | null;
265
+ submitUrl?: string | null;
266
+ submitMethod?: string | null;
267
+ apiEndpointKey?: ApiEndpoint | string | null;
268
+ apiUrlEntry?: ApiUrlEntry | null;
224
269
  mode: 'create' | 'edit' | 'view';
225
270
  backConfig?: BackConfig;
226
271
  private idField;
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@praxisui/crud",
3
- "version": "3.0.0-beta.9",
3
+ "version": "4.0.0-beta.0",
4
4
  "description": "CRUD building blocks for Praxis UI: integrates dynamic forms and tables with unified configuration and services.",
5
5
  "peerDependencies": {
6
6
  "@angular/common": "^20.1.0",
7
7
  "@angular/core": "^20.1.0",
8
- "@praxisui/dynamic-form": "^3.0.0-beta.9",
9
- "@praxisui/table": "^3.0.0-beta.9",
10
- "@praxisui/core": "^3.0.0-beta.9",
11
- "@praxisui/dynamic-fields": "^3.0.0-beta.9",
12
- "@praxisui/settings-panel": "^3.0.0-beta.9"
8
+ "@praxisui/dynamic-form": "^4.0.0-beta.0",
9
+ "@praxisui/table": "^4.0.0-beta.0",
10
+ "@praxisui/core": "^4.0.0-beta.0",
11
+ "@praxisui/dynamic-fields": "^4.0.0-beta.0",
12
+ "@praxisui/settings-panel": "^4.0.0-beta.0"
13
13
  },
14
14
  "dependencies": {
15
15
  "tslib": "^2.3.0"