@praxisui/crud 1.0.0-beta.5 → 1.0.0-beta.52

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,9 +1,9 @@
1
1
  import * as i0 from '@angular/core';
2
- import { NgZone, OnChanges, EventEmitter, SimpleChanges, OnInit, Provider, InjectionToken } from '@angular/core';
2
+ import { NgZone, OnChanges, EventEmitter, SimpleChanges, OnInit, Provider } from '@angular/core';
3
3
  import { MatDialogConfig, MatDialogRef, MatDialog } from '@angular/material/dialog';
4
4
  export { MAT_DIALOG_DATA as DIALOG_DATA } from '@angular/material/dialog';
5
5
  import { ComponentType } from '@angular/cdk/portal';
6
- import { ApiEndpoint, TableConfig, FormConfig, BackConfig, RowAction, ToolbarAction, GenericCrudService, ConfigStorage, ComponentDocMeta } from '@praxisui/core';
6
+ import { ApiEndpoint, TableConfig, FormConfig, BackConfig, RowAction, ToolbarAction, GenericCrudService, AsyncConfigStorage, ComponentDocMeta, AiCapabilityCategory, AiValueKind, AiCapability, AiCapabilityCatalog } from '@praxisui/core';
7
7
  export { BackConfig } from '@praxisui/core';
8
8
  import { PraxisDynamicForm } from '@praxisui/dynamic-form';
9
9
 
@@ -58,6 +58,7 @@ interface CrudResource {
58
58
  interface CrudMetadata {
59
59
  component: 'praxis-crud';
60
60
  resource?: CrudResource;
61
+ data?: any[] | null;
61
62
  table: TableConfig;
62
63
  form?: FormConfig;
63
64
  defaults?: CrudDefaults;
@@ -75,13 +76,18 @@ interface CrudHeaderConfig {
75
76
  breadcrumbs?: boolean;
76
77
  divider?: boolean;
77
78
  }
78
- declare function assertCrudMetadata(meta: CrudMetadata): void;
79
+ interface CrudMetadataAssertionOptions {
80
+ allowDeferredActionBindings?: boolean;
81
+ }
82
+ declare function assertCrudMetadata(meta: CrudMetadata, options?: CrudMetadataAssertionOptions): void;
79
83
 
80
84
  declare class PraxisCrudComponent implements OnChanges {
81
- /** Habilita visual de debug para alinhamento/layouot */
82
- debugLayout: boolean;
83
85
  /** JSON inline ou chave/URL resolvida pelo MetadataResolver */
84
86
  metadata: CrudMetadata | string;
87
+ /** Identificador obrigatório do CRUD (base para tabela/formulário) */
88
+ crudId: string;
89
+ /** Identificador opcional para instâncias múltiplas */
90
+ componentInstanceId?: string;
85
91
  context?: Record<string, unknown>;
86
92
  /** Encaminha o modo de edição de layout para a tabela interna */
87
93
  editModeEnabled: boolean;
@@ -103,10 +109,17 @@ declare class PraxisCrudComponent implements OnChanges {
103
109
  resolvedMetadata: CrudMetadata;
104
110
  /** Configuração efetiva da tabela com melhorias automáticas (ex.: botão Adicionar). */
105
111
  effectiveTableConfig?: TableConfig;
112
+ /** Config passado ao PraxisTable — sempre definido (fallback seguro). */
113
+ tableConfigForBinding: TableConfig;
106
114
  private readonly launcher;
115
+ private readonly destroyRef;
107
116
  private table;
108
117
  private readonly storage;
109
118
  private readonly snack;
119
+ private readonly global;
120
+ private readonly componentKeys;
121
+ private readonly route;
122
+ private warnedMissingId;
110
123
  /**
111
124
  * Stable CRUD context passed to PraxisTable.
112
125
  * Previously this was created via a getter, producing a new object each CD tick
@@ -114,6 +127,7 @@ declare class PraxisCrudComponent implements OnChanges {
114
127
  */
115
128
  tableCrudContext?: {
116
129
  tableId: string;
130
+ componentKeyId?: string;
117
131
  resourcePath?: string;
118
132
  defaults?: any;
119
133
  actions?: Array<{
@@ -121,13 +135,17 @@ declare class PraxisCrudComponent implements OnChanges {
121
135
  label?: string;
122
136
  formId?: string;
123
137
  route?: string;
124
- openMode?: 'modal' | 'route';
138
+ openMode?: 'modal' | 'drawer' | 'route';
125
139
  }>;
126
140
  };
127
141
  onResetPreferences(): void;
128
142
  ngOnChanges(changes: SimpleChanges): void;
129
143
  onAction(action: string, row?: Record<string, unknown>): Promise<void>;
130
144
  private refreshTable;
145
+ resolveResourcePath(meta?: CrudMetadata): string;
146
+ resolveLocalData(meta?: CrudMetadata): any[] | null;
147
+ resolveTableData(meta?: CrudMetadata): any[] | null;
148
+ shouldRenderTable(meta?: CrudMetadata): boolean;
131
149
  private getIdField;
132
150
  onConfigureRequested(): void;
133
151
  /**
@@ -141,8 +159,16 @@ declare class PraxisCrudComponent implements OnChanges {
141
159
  private isAddLike;
142
160
  /** Builds a stable CRUD context object for PraxisTable based on metadata. */
143
161
  private buildTableCrudContext;
162
+ private componentKeyId;
163
+ private warnMissingId;
144
164
  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>;
165
+ 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; }; "editModeEnabled": { "alias": "editModeEnabled"; "required": false; }; }, { "configureRequested": "configureRequested"; "afterOpen": "afterOpen"; "afterClose": "afterClose"; "afterSave": "afterSave"; "afterDelete": "afterDelete"; "error": "error"; }, never, never, true, never>;
166
+ }
167
+
168
+ type CrudDrawerResultType = 'save' | 'delete' | 'close';
169
+ interface CrudDrawerResult {
170
+ type: CrudDrawerResultType;
171
+ data?: Record<string, unknown>;
146
172
  }
147
173
 
148
174
  declare class CrudLauncherService {
@@ -151,7 +177,10 @@ declare class CrudLauncherService {
151
177
  private readonly storage;
152
178
  private readonly global;
153
179
  private readonly drawerAdapter;
154
- launch(action: CrudAction, row: Record<string, unknown> | undefined, metadata: CrudMetadata): Promise<{
180
+ launch(action: CrudAction, row: Record<string, unknown> | undefined, metadata: CrudMetadata, componentKeyId?: string | null, drawerCallbacks?: {
181
+ onClose?: () => void;
182
+ onResult?: (result: CrudDrawerResult) => void;
183
+ }): Promise<{
155
184
  mode: FormOpenMode;
156
185
  ref?: DialogRef<any>;
157
186
  }>;
@@ -175,6 +204,7 @@ declare class DynamicFormDialogHostComponent implements OnInit {
175
204
  private initialSize;
176
205
  private rememberState;
177
206
  private stateKey?;
207
+ private backDefaults;
178
208
  private destroyRef;
179
209
  resourcePath?: string;
180
210
  resourceId?: string | number;
@@ -182,12 +212,13 @@ declare class DynamicFormDialogHostComponent implements OnInit {
182
212
  backConfig?: BackConfig;
183
213
  private idField;
184
214
  texts: Record<string, string>;
185
- constructor(dialogRef: DialogRef<DynamicFormDialogHostComponent>, data: any, dialogService: DialogService, crud: GenericCrudService<any>, configStorage: ConfigStorage);
215
+ constructor(dialogRef: DialogRef<DynamicFormDialogHostComponent>, data: any, dialogService: DialogService, crud: GenericCrudService<any>, configStorage: AsyncConfigStorage);
186
216
  ngOnInit(): void;
187
217
  onSave(result: unknown): void;
188
218
  onCancel(): void;
189
219
  toggleMaximize(initial?: boolean): void;
190
220
  private saveState;
221
+ private applySavedState;
191
222
  static ɵfac: i0.ɵɵFactoryDeclaration<DynamicFormDialogHostComponent, never>;
192
223
  static ɵcmp: i0.ɵɵComponentDeclaration<DynamicFormDialogHostComponent, "praxis-dynamic-form-dialog-host", never, {}, {}, never, never, true, never>;
193
224
  }
@@ -210,15 +241,31 @@ declare class CrudPageHeaderComponent {
210
241
  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
242
  }
212
243
 
213
- interface CrudDrawerOpenConfig {
214
- action: CrudAction;
215
- metadata: CrudMetadata;
216
- inputs: Record<string, unknown>;
244
+ /**
245
+ * Capabilities catalog for CrudMetadata (Praxis CRUD).
246
+ */
247
+
248
+ declare module '@praxisui/core' {
249
+ interface AiCapabilityCategoryMap {
250
+ meta: true;
251
+ resource: true;
252
+ table: true;
253
+ form: true;
254
+ defaults: true;
255
+ actions: true;
256
+ i18n: true;
257
+ navigation: true;
258
+ }
259
+ }
260
+ type CapabilityCategory = AiCapabilityCategory;
261
+ type ValueKind = AiValueKind;
262
+ interface Capability extends AiCapability {
263
+ category: CapabilityCategory;
217
264
  }
218
- interface CrudDrawerAdapter {
219
- open(config: CrudDrawerOpenConfig): Promise<void> | void;
265
+ interface CapabilityCatalog extends AiCapabilityCatalog {
266
+ capabilities: Capability[];
220
267
  }
221
- declare const CRUD_DRAWER_ADAPTER: InjectionToken<CrudDrawerAdapter>;
268
+ declare const CRUD_AI_CAPABILITIES: CapabilityCatalog;
222
269
 
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 };
270
+ export { CRUD_AI_CAPABILITIES, CrudLauncherService, CrudPageHeaderComponent, DialogService, DynamicFormDialogHostComponent, PRAXIS_CRUD_COMPONENT_METADATA, PraxisCrudComponent, assertCrudMetadata, providePraxisCrudMetadata };
271
+ 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.5",
3
+ "version": "1.0.0-beta.52",
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.5",
9
- "@praxisui/table": "^1.0.0-beta.5",
10
- "@praxisui/core": "^1.0.0-beta.5",
11
- "@praxisui/dynamic-fields": "^1.0.0-beta.5",
12
- "@praxisui/settings-panel": "^1.0.0-beta.5"
8
+ "@praxisui/dynamic-form": "^1.0.0-beta.52",
9
+ "@praxisui/table": "^1.0.0-beta.52",
10
+ "@praxisui/core": "^1.0.0-beta.52",
11
+ "@praxisui/dynamic-fields": "^1.0.0-beta.52",
12
+ "@praxisui/settings-panel": "^1.0.0-beta.52"
13
13
  },
14
14
  "dependencies": {
15
15
  "tslib": "^2.3.0"
@@ -20,11 +20,11 @@
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://github.com/codexrodrigues/praxis-ui-angular#readme",
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",
@@ -44,6 +44,10 @@
44
44
  ".": {
45
45
  "types": "./index.d.ts",
46
46
  "default": "./fesm2022/praxisui-crud.mjs"
47
+ },
48
+ "./drawer-adapter": {
49
+ "types": "./drawer-adapter/index.d.ts",
50
+ "default": "./fesm2022/praxisui-crud-drawer-adapter.mjs"
47
51
  }
48
52
  }
49
53
  }