@praxisui/crud 9.0.0-beta.45 → 9.0.0-beta.47

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.
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "schemaVersion": "1.0.0",
3
- "generatedAt": "2026-07-07T23:17:36.844Z",
3
+ "generatedAt": "2026-07-08T03:07:40.937Z",
4
4
  "packageName": "@praxisui/crud",
5
- "packageVersion": "9.0.0-beta.45",
5
+ "packageVersion": "9.0.0-beta.47",
6
6
  "sourceRegistry": "praxis-component-registry-ingestion",
7
7
  "sourceRegistryVersion": "1.0.0",
8
8
  "componentCount": 2,
@@ -68,6 +68,27 @@ function getCrudDrawerAdapterToken() {
68
68
  }
69
69
  const CRUD_DRAWER_ADAPTER = getCrudDrawerAdapterToken();
70
70
 
71
+ function isCrudDebugEnabled$1() {
72
+ try {
73
+ if (globalThis.__PRAXIS_DEBUG_CRUD__) {
74
+ return true;
75
+ }
76
+ if (typeof localStorage !== 'undefined') {
77
+ return localStorage.getItem('praxis.debug.crud') === 'true';
78
+ }
79
+ }
80
+ catch { }
81
+ return false;
82
+ }
83
+ function debugCrudLauncher(message, ...data) {
84
+ if (!isCrudDebugEnabled$1()) {
85
+ return;
86
+ }
87
+ try {
88
+ console.debug(message, ...data);
89
+ }
90
+ catch { }
91
+ }
71
92
  class CrudLauncherService {
72
93
  router = inject(Router);
73
94
  dialog = inject(DialogService);
@@ -85,7 +106,9 @@ class CrudLauncherService {
85
106
  async launch(action, row, metadata, componentKeyId, drawerCallbacks, runtime) {
86
107
  // Carregar overrides de CRUD (se houver) e mesclar em uma cópia local
87
108
  const merged = await this.mergeCrudOverrides(metadata, action, componentKeyId || undefined);
109
+ merged.action = this.normalizeActionForLaunch(merged.action);
88
110
  const mode = this.resolveOpenMode(merged.action, merged.metadata);
111
+ debugCrudLauncher('[CRUD:Launcher] mode=', mode, 'action=', action);
89
112
  if (mode === 'route') {
90
113
  if (!merged.action.route) {
91
114
  throw new Error(`Route not provided for action ${merged.action.action}`);
@@ -117,6 +140,13 @@ class CrudLauncherService {
117
140
  return { mode };
118
141
  }
119
142
  const modalCfg = { ...(merged.metadata.defaults?.modal || {}) };
143
+ debugCrudLauncher('[CRUD:Launcher] opening dialog with:', {
144
+ action: merged.action.action,
145
+ formId: actionForLaunch.formId,
146
+ inputs,
147
+ modalCfg,
148
+ resourcePath: merged.metadata.resource?.path ?? merged.metadata.table?.resourcePath,
149
+ });
120
150
  const drawerMode = mode === 'drawer';
121
151
  const panelClasses = mergeClassList(['pfx-dialog-pane', drawerMode ? 'pfx-drawer-pane' : 'pfx-dialog-frosted'], modalCfg.panelClass);
122
152
  // Backdrop style presets
@@ -268,6 +298,7 @@ class CrudLauncherService {
268
298
  return inputs;
269
299
  }
270
300
  resolveActionForLaunch(action, metadata) {
301
+ action = this.normalizeActionForLaunch(action);
271
302
  if (action.formId) {
272
303
  return action;
273
304
  }
@@ -275,7 +306,16 @@ class CrudLauncherService {
275
306
  return action;
276
307
  }
277
308
  const formId = this.buildInferredFormId(action, metadata);
278
- return formId ? { ...action, formId } : action;
309
+ return formId
310
+ ? {
311
+ ...action,
312
+ formId,
313
+ form: {
314
+ ...(action.form || {}),
315
+ layoutPolicy: action.form?.layoutPolicy ?? this.defaultInferredLayoutPolicy(action),
316
+ },
317
+ }
318
+ : action;
279
319
  }
280
320
  resolveSubmitUrlTemplate(submitUrl, row, metadata) {
281
321
  const template = String(submitUrl || '').trim();
@@ -320,6 +360,7 @@ class CrudLauncherService {
320
360
  return {
321
361
  apiEndpointKey: action.form?.apiEndpointKey ?? null,
322
362
  apiUrlEntry: action.form?.apiUrlEntry ?? null,
363
+ layoutPolicy: action.form?.layoutPolicy ?? null,
323
364
  };
324
365
  }
325
366
  const idField = String(metadata.resource?.idField ?? 'id');
@@ -362,9 +403,20 @@ class CrudLauncherService {
362
403
  return `${sanitizedResource || 'crud'}-${String(action.action || '').trim().toLowerCase()}`;
363
404
  }
364
405
  isCanonicalCrudAction(actionName) {
365
- const normalized = String(actionName || '').trim().toLowerCase();
406
+ const normalized = this.normalizeCrudOperationName(actionName);
366
407
  return normalized === 'create' || normalized === 'view' || normalized === 'edit' || normalized === 'delete';
367
408
  }
409
+ normalizeActionForLaunch(action) {
410
+ const normalized = this.normalizeCrudOperationName(action.action);
411
+ return normalized === action.action ? action : { ...action, action: normalized };
412
+ }
413
+ normalizeCrudOperationName(actionName) {
414
+ const normalized = String(actionName || '').trim().toLowerCase();
415
+ if (['add', 'novo', 'new', 'incluir', 'inserir'].includes(normalized)) {
416
+ return 'create';
417
+ }
418
+ return normalized;
419
+ }
368
420
  isExplicitCrudAction(action) {
369
421
  if (action.mode === 'explicit') {
370
422
  return true;
@@ -373,6 +425,19 @@ class CrudLauncherService {
373
425
  String(action.form?.submitUrl || '').trim() ||
374
426
  String(action.form?.submitMethod || '').trim());
375
427
  }
428
+ defaultInferredLayoutPolicy(action) {
429
+ const operation = this.normalizeCrudOperationName(action.action);
430
+ if (operation !== 'create' && operation !== 'edit') {
431
+ return null;
432
+ }
433
+ return {
434
+ source: 'schema',
435
+ intent: 'command',
436
+ preset: 'groupedCommand',
437
+ persistence: 'transient',
438
+ schemaType: 'request',
439
+ };
440
+ }
376
441
  async mergeCrudOverrides(metadata, action, componentKeyId) {
377
442
  try {
378
443
  if (!componentKeyId)
@@ -3677,12 +3742,12 @@ class PraxisCrudComponent {
3677
3742
  document.activeElement?.blur();
3678
3743
  const normalizedAction = this.normalizeCrudActionName(action);
3679
3744
  const contextualRow = row ?? this.resolveSelectedRowForAction(normalizedAction);
3680
- let actionMeta = this.resolvedMetadata.actions?.find((candidate) => candidate.action === normalizedAction);
3745
+ let actionMeta = this.resolvedMetadata.actions?.find((candidate) => this.normalizeCrudActionName(candidate.action) === normalizedAction);
3681
3746
  if (!actionMeta && normalizedAction !== action) {
3682
3747
  actionMeta = this.resolvedMetadata.actions?.find((candidate) => candidate.action === action);
3683
3748
  }
3684
3749
  if (!actionMeta) {
3685
- const ctxAction = this.tableCrudContext?.actions?.find((candidate) => candidate.action === normalizedAction || candidate.action === action);
3750
+ const ctxAction = this.tableCrudContext?.actions?.find((candidate) => this.normalizeCrudActionName(candidate.action) === normalizedAction);
3686
3751
  if (ctxAction) {
3687
3752
  actionMeta = {
3688
3753
  action: this.normalizeCrudActionName(ctxAction.action),
@@ -3697,7 +3762,7 @@ class PraxisCrudComponent {
3697
3762
  }
3698
3763
  const effectiveAction = {
3699
3764
  ...(actionMeta || { action: normalizedAction }),
3700
- action: this.normalizeCrudActionName(actionMeta?.action || normalizedAction),
3765
+ action: this.normalizeCrudActionName(actionMeta?.action ?? normalizedAction),
3701
3766
  };
3702
3767
  if (!this.hasExplicitOpenBinding(effectiveAction)) {
3703
3768
  const openedByDiscovery = await this.tryOpenDiscoveredCrudSurface(effectiveAction.action, contextualRow, runtimeEvent);
@@ -4891,6 +4956,27 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImpo
4891
4956
  args: [PraxisTable]
4892
4957
  }] } });
4893
4958
 
4959
+ function isCrudDebugEnabled() {
4960
+ try {
4961
+ if (globalThis.__PRAXIS_DEBUG_CRUD__) {
4962
+ return true;
4963
+ }
4964
+ if (typeof localStorage !== 'undefined') {
4965
+ return localStorage.getItem('praxis.debug.crud') === 'true';
4966
+ }
4967
+ }
4968
+ catch { }
4969
+ return false;
4970
+ }
4971
+ function debugCrudHost(message, data) {
4972
+ if (!isCrudDebugEnabled()) {
4973
+ return;
4974
+ }
4975
+ try {
4976
+ console.debug(message, data);
4977
+ }
4978
+ catch { }
4979
+ }
4894
4980
  class DynamicFormDialogHostComponent {
4895
4981
  dialogRef;
4896
4982
  data;
@@ -4978,7 +5064,7 @@ class DynamicFormDialogHostComponent {
4978
5064
  const defaults = (this.data.action?.back || this.data.metadata?.defaults?.back) || {};
4979
5065
  this.backDefaults = defaults;
4980
5066
  this.backConfig = { ...defaults };
4981
- console.debug('[CRUD:Host] constructed', {
5067
+ debugCrudHost('[CRUD:Host] constructed', {
4982
5068
  action: this.data?.action,
4983
5069
  resourcePath: this.resourcePath,
4984
5070
  resourceId: this.resourceId,
@@ -5179,7 +5265,7 @@ class DynamicFormDialogHostComponent {
5179
5265
  width: saved?.width ?? this.modal.width,
5180
5266
  height: saved?.height ?? this.modal.height,
5181
5267
  };
5182
- console.debug('[CRUD:Host] ngOnInit', {
5268
+ debugCrudHost('[CRUD:Host] ngOnInit', {
5183
5269
  initialSize: this.initialSize,
5184
5270
  startMaximized: this.modal.startMaximized,
5185
5271
  fullscreenBreakpoint: this.modal.fullscreenBreakpoint,
package/package.json CHANGED
@@ -1,20 +1,20 @@
1
1
  {
2
2
  "name": "@praxisui/crud",
3
- "version": "9.0.0-beta.45",
3
+ "version": "9.0.0-beta.47",
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": "^21.0.0",
7
7
  "@angular/core": "^21.0.0",
8
- "@praxisui/dynamic-form": "^9.0.0-beta.45",
9
- "@praxisui/table": "^9.0.0-beta.45",
10
- "@praxisui/core": "^9.0.0-beta.45",
11
- "@praxisui/dynamic-fields": "^9.0.0-beta.45",
12
- "@praxisui/settings-panel": "^9.0.0-beta.45",
8
+ "@praxisui/dynamic-form": "^9.0.0-beta.47",
9
+ "@praxisui/table": "^9.0.0-beta.47",
10
+ "@praxisui/core": "^9.0.0-beta.47",
11
+ "@praxisui/dynamic-fields": "^9.0.0-beta.47",
12
+ "@praxisui/settings-panel": "^9.0.0-beta.47",
13
13
  "@angular/cdk": "^21.0.0",
14
14
  "@angular/forms": "^21.0.0",
15
15
  "@angular/material": "^21.0.0",
16
16
  "@angular/router": "^21.0.0",
17
- "@praxisui/ai": "^9.0.0-beta.45",
17
+ "@praxisui/ai": "^9.0.0-beta.47",
18
18
  "rxjs": "~7.8.0"
19
19
  },
20
20
  "dependencies": {
@@ -335,7 +335,10 @@ declare class CrudLauncherService {
335
335
  };
336
336
  private buildInferredFormId;
337
337
  private isCanonicalCrudAction;
338
+ private normalizeActionForLaunch;
339
+ private normalizeCrudOperationName;
338
340
  private isExplicitCrudAction;
341
+ private defaultInferredLayoutPolicy;
339
342
  private mergeCrudOverrides;
340
343
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<CrudLauncherService, never>;
341
344
  static ɵprov: _angular_core.ɵɵInjectableDeclaration<CrudLauncherService>;