@praxisui/crud 1.0.0-beta.8 → 3.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,10 +1,11 @@
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';
3
+ export { BackConfig } from '@praxisui/core';
1
4
  import * as i0 from '@angular/core';
2
- import { NgZone, OnChanges, EventEmitter, SimpleChanges, OnInit, Provider, InjectionToken } from '@angular/core';
5
+ import { NgZone, OnChanges, EventEmitter, SimpleChanges, OnInit, Provider } from '@angular/core';
3
6
  import { MatDialogConfig, MatDialogRef, MatDialog } from '@angular/material/dialog';
4
7
  export { MAT_DIALOG_DATA as DIALOG_DATA } from '@angular/material/dialog';
5
8
  import { ComponentType } from '@angular/cdk/portal';
6
- import { ApiEndpoint, TableConfig, FormConfig, BackConfig, RowAction, ToolbarAction, GenericCrudService, ConfigStorage, ComponentDocMeta } from '@praxisui/core';
7
- export { BackConfig } from '@praxisui/core';
8
9
  import { PraxisDynamicForm } from '@praxisui/dynamic-form';
9
10
 
10
11
  type DialogRef<T = any, R = any> = MatDialogRef<T, R>;
@@ -58,6 +59,7 @@ interface CrudResource {
58
59
  interface CrudMetadata {
59
60
  component: 'praxis-crud';
60
61
  resource?: CrudResource;
62
+ data?: any[] | null;
61
63
  table: TableConfig;
62
64
  form?: FormConfig;
63
65
  defaults?: CrudDefaults;
@@ -75,16 +77,21 @@ interface CrudHeaderConfig {
75
77
  breadcrumbs?: boolean;
76
78
  divider?: boolean;
77
79
  }
78
- declare function assertCrudMetadata(meta: CrudMetadata): void;
80
+ interface CrudMetadataAssertionOptions {
81
+ allowDeferredActionBindings?: boolean;
82
+ }
83
+ declare function assertCrudMetadata(meta: CrudMetadata, options?: CrudMetadataAssertionOptions): void;
79
84
 
80
85
  declare class PraxisCrudComponent implements OnChanges {
81
- /** Habilita visual de debug para alinhamento/layouot */
82
- debugLayout: boolean;
83
86
  /** JSON inline ou chave/URL resolvida pelo MetadataResolver */
84
87
  metadata: CrudMetadata | string;
88
+ /** Identificador obrigatório do CRUD (base para tabela/formulário) */
89
+ crudId: string;
90
+ /** Identificador opcional para instâncias múltiplas */
91
+ componentInstanceId?: string;
85
92
  context?: Record<string, unknown>;
86
93
  /** Encaminha o modo de edição de layout para a tabela interna */
87
- editModeEnabled: boolean;
94
+ enableCustomization: boolean;
88
95
  /** CTA: usado pelo Builder para abrir configuração de metadados quando vazio */
89
96
  configureRequested: EventEmitter<void>;
90
97
  afterOpen: EventEmitter<{
@@ -100,13 +107,28 @@ declare class PraxisCrudComponent implements OnChanges {
100
107
  id: string | number;
101
108
  }>;
102
109
  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
+ tableRuntimeConfigChange: EventEmitter<_praxisui_core.TableConfigModern>;
103
117
  resolvedMetadata: CrudMetadata;
104
118
  /** Configuração efetiva da tabela com melhorias automáticas (ex.: botão Adicionar). */
105
119
  effectiveTableConfig?: TableConfig;
120
+ /** Config passado ao PraxisTable — sempre definido (fallback seguro). */
121
+ tableConfigForBinding: TableConfig;
106
122
  private readonly launcher;
123
+ private readonly destroyRef;
107
124
  private table;
108
125
  private readonly storage;
109
126
  private readonly snack;
127
+ private readonly global;
128
+ private readonly componentKeys;
129
+ private readonly route;
130
+ private warnedMissingId;
131
+ private lastEmittedTableRuntimeConfigJson;
110
132
  /**
111
133
  * Stable CRUD context passed to PraxisTable.
112
134
  * Previously this was created via a getter, producing a new object each CD tick
@@ -114,6 +136,7 @@ declare class PraxisCrudComponent implements OnChanges {
114
136
  */
115
137
  tableCrudContext?: {
116
138
  tableId: string;
139
+ componentKeyId?: string;
117
140
  resourcePath?: string;
118
141
  defaults?: any;
119
142
  actions?: Array<{
@@ -121,13 +144,21 @@ declare class PraxisCrudComponent implements OnChanges {
121
144
  label?: string;
122
145
  formId?: string;
123
146
  route?: string;
124
- openMode?: 'modal' | 'route';
147
+ openMode?: 'modal' | 'drawer' | 'route';
125
148
  }>;
126
149
  };
127
150
  onResetPreferences(): void;
128
151
  ngOnChanges(changes: SimpleChanges): void;
129
152
  onAction(action: string, row?: Record<string, unknown>): Promise<void>;
130
153
  private refreshTable;
154
+ getCurrentTableConfigSnapshot(): TableConfig | null;
155
+ onTableMetadataChange(): void;
156
+ onTableLoadingStateChange(state: LoadingState): void;
157
+ private emitTableRuntimeConfigSnapshot;
158
+ resolveResourcePath(meta?: CrudMetadata): string;
159
+ resolveLocalData(meta?: CrudMetadata): any[] | null;
160
+ resolveTableData(meta?: CrudMetadata): any[] | null;
161
+ shouldRenderTable(meta?: CrudMetadata): boolean;
131
162
  private getIdField;
132
163
  onConfigureRequested(): void;
133
164
  /**
@@ -141,8 +172,16 @@ declare class PraxisCrudComponent implements OnChanges {
141
172
  private isAddLike;
142
173
  /** Builds a stable CRUD context object for PraxisTable based on metadata. */
143
174
  private buildTableCrudContext;
175
+ private componentKeyId;
176
+ private warnMissingId;
144
177
  static ɵfac: i0.ɵɵFactoryDeclaration<PraxisCrudComponent, never>;
145
- static ɵcmp: i0.ɵɵComponentDeclaration<PraxisCrudComponent, "praxis-crud", never, { "debugLayout": { "alias": "debugLayout"; "required": false; }; "metadata": { "alias": "metadata"; "required": true; }; "context": { "alias": "context"; "required": false; }; "editModeEnabled": { "alias": "editModeEnabled"; "required": false; }; }, { "configureRequested": "configureRequested"; "afterOpen": "afterOpen"; "afterClose": "afterClose"; "afterSave": "afterSave"; "afterDelete": "afterDelete"; "error": "error"; }, never, never, true, never>;
178
+ 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
+ }
180
+
181
+ type CrudDrawerResultType = 'save' | 'delete' | 'close';
182
+ interface CrudDrawerResult {
183
+ type: CrudDrawerResultType;
184
+ data?: Record<string, unknown>;
146
185
  }
147
186
 
148
187
  declare class CrudLauncherService {
@@ -151,7 +190,10 @@ declare class CrudLauncherService {
151
190
  private readonly storage;
152
191
  private readonly global;
153
192
  private readonly drawerAdapter;
154
- launch(action: CrudAction, row: Record<string, unknown> | undefined, metadata: CrudMetadata): Promise<{
193
+ launch(action: CrudAction, row: Record<string, unknown> | undefined, metadata: CrudMetadata, componentKeyId?: string | null, drawerCallbacks?: {
194
+ onClose?: () => void;
195
+ onResult?: (result: CrudDrawerResult) => void;
196
+ }): Promise<{
155
197
  mode: FormOpenMode;
156
198
  ref?: DialogRef<any>;
157
199
  }>;
@@ -175,6 +217,7 @@ declare class DynamicFormDialogHostComponent implements OnInit {
175
217
  private initialSize;
176
218
  private rememberState;
177
219
  private stateKey?;
220
+ private backDefaults;
178
221
  private destroyRef;
179
222
  resourcePath?: string;
180
223
  resourceId?: string | number;
@@ -182,12 +225,13 @@ declare class DynamicFormDialogHostComponent implements OnInit {
182
225
  backConfig?: BackConfig;
183
226
  private idField;
184
227
  texts: Record<string, string>;
185
- constructor(dialogRef: DialogRef<DynamicFormDialogHostComponent>, data: any, dialogService: DialogService, crud: GenericCrudService<any>, configStorage: ConfigStorage);
228
+ constructor(dialogRef: DialogRef<DynamicFormDialogHostComponent>, data: any, dialogService: DialogService, crud: GenericCrudService<any>, configStorage: AsyncConfigStorage);
186
229
  ngOnInit(): void;
187
230
  onSave(result: unknown): void;
188
231
  onCancel(): void;
189
232
  toggleMaximize(initial?: boolean): void;
190
233
  private saveState;
234
+ private applySavedState;
191
235
  static ɵfac: i0.ɵɵFactoryDeclaration<DynamicFormDialogHostComponent, never>;
192
236
  static ɵcmp: i0.ɵɵComponentDeclaration<DynamicFormDialogHostComponent, "praxis-dynamic-form-dialog-host", never, {}, {}, never, never, true, never>;
193
237
  }
@@ -210,15 +254,31 @@ declare class CrudPageHeaderComponent {
210
254
  static ɵcmp: i0.ɵɵComponentDeclaration<CrudPageHeaderComponent, "praxis-crud-page-header", never, { "title": { "alias": "title"; "required": false; }; "backLabel": { "alias": "backLabel"; "required": false; }; "showBack": { "alias": "showBack"; "required": false; }; "variant": { "alias": "variant"; "required": false; }; "sticky": { "alias": "sticky"; "required": false; }; "divider": { "alias": "divider"; "required": false; }; "returnTo": { "alias": "returnTo"; "required": false; }; }, {}, never, ["*"], true, never>;
211
255
  }
212
256
 
213
- interface CrudDrawerOpenConfig {
214
- action: CrudAction;
215
- metadata: CrudMetadata;
216
- inputs: Record<string, unknown>;
257
+ /**
258
+ * Capabilities catalog for CrudMetadata (Praxis CRUD).
259
+ */
260
+
261
+ declare module '@praxisui/core' {
262
+ interface AiCapabilityCategoryMap {
263
+ meta: true;
264
+ resource: true;
265
+ table: true;
266
+ form: true;
267
+ defaults: true;
268
+ actions: true;
269
+ i18n: true;
270
+ navigation: true;
271
+ }
272
+ }
273
+ type CapabilityCategory = AiCapabilityCategory;
274
+ type ValueKind = AiValueKind;
275
+ interface Capability extends AiCapability {
276
+ category: CapabilityCategory;
217
277
  }
218
- interface CrudDrawerAdapter {
219
- open(config: CrudDrawerOpenConfig): Promise<void> | void;
278
+ interface CapabilityCatalog extends AiCapabilityCatalog {
279
+ capabilities: Capability[];
220
280
  }
221
- declare const CRUD_DRAWER_ADAPTER: InjectionToken<CrudDrawerAdapter>;
281
+ declare const CRUD_AI_CAPABILITIES: CapabilityCatalog;
222
282
 
223
- export { CRUD_DRAWER_ADAPTER, CrudLauncherService, CrudPageHeaderComponent, DialogService, DynamicFormDialogHostComponent, PRAXIS_CRUD_COMPONENT_METADATA, PraxisCrudComponent, assertCrudMetadata, providePraxisCrudMetadata };
224
- export type { CrudAction, CrudDefaults, CrudDrawerAdapter, CrudDrawerOpenConfig, CrudHeaderConfig, CrudHeaderVariant, CrudMetadata, CrudParamMapping, CrudResource, DialogConfig, DialogRef, FormOpenMode };
283
+ export { CRUD_AI_CAPABILITIES, CrudLauncherService, CrudPageHeaderComponent, DialogService, DynamicFormDialogHostComponent, PRAXIS_CRUD_COMPONENT_METADATA, PraxisCrudComponent, assertCrudMetadata, providePraxisCrudMetadata };
284
+ export type { Capability, CapabilityCatalog, CapabilityCategory, CrudAction, CrudDefaults, CrudHeaderConfig, CrudHeaderVariant, CrudMetadata, CrudMetadataAssertionOptions, CrudParamMapping, CrudResource, DialogConfig, DialogRef, FormOpenMode, ValueKind };
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@praxisui/crud",
3
- "version": "1.0.0-beta.8",
3
+ "version": "3.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": "^1.0.0-beta.8",
9
- "@praxisui/table": "^1.0.0-beta.8",
10
- "@praxisui/core": "^1.0.0-beta.8",
11
- "@praxisui/dynamic-fields": "^1.0.0-beta.8",
12
- "@praxisui/settings-panel": "^1.0.0-beta.8"
8
+ "@praxisui/dynamic-form": "^3.0.0-beta.0",
9
+ "@praxisui/table": "^3.0.0-beta.0",
10
+ "@praxisui/core": "^3.0.0-beta.0",
11
+ "@praxisui/dynamic-fields": "^3.0.0-beta.0",
12
+ "@praxisui/settings-panel": "^3.0.0-beta.0"
13
13
  },
14
14
  "dependencies": {
15
15
  "tslib": "^2.3.0"
@@ -20,19 +20,20 @@
20
20
  },
21
21
  "repository": {
22
22
  "type": "git",
23
- "url": "https://github.com/codexrodrigues/praxis"
23
+ "url": "https://github.com/codexrodrigues/praxis-ui-angular"
24
24
  },
25
- "homepage": "https://github.com/codexrodrigues/praxis#readme",
25
+ "homepage": "https://praxisui.dev",
26
26
  "bugs": {
27
- "url": "https://github.com/codexrodrigues/praxis/issues"
27
+ "url": "https://github.com/codexrodrigues/praxis-ui-angular/issues"
28
28
  },
29
29
  "keywords": [
30
30
  "angular",
31
31
  "praxisui",
32
32
  "crud",
33
+ "admin",
34
+ "backoffice",
33
35
  "forms",
34
- "table",
35
- "ui"
36
+ "table"
36
37
  ],
37
38
  "sideEffects": false,
38
39
  "module": "fesm2022/praxisui-crud.mjs",
@@ -44,6 +45,10 @@
44
45
  ".": {
45
46
  "types": "./index.d.ts",
46
47
  "default": "./fesm2022/praxisui-crud.mjs"
48
+ },
49
+ "./drawer-adapter": {
50
+ "types": "./drawer-adapter/index.d.ts",
51
+ "default": "./fesm2022/praxisui-crud-drawer-adapter.mjs"
47
52
  }
48
53
  }
49
54
  }