@praxisui/crud 9.0.0-beta.42 → 9.0.0-beta.43

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-07T12:05:35.013Z",
3
+ "generatedAt": "2026-07-07T19:18:40.145Z",
4
4
  "packageName": "@praxisui/crud",
5
- "packageVersion": "9.0.0-beta.42",
5
+ "packageVersion": "9.0.0-beta.43",
6
6
  "sourceRegistry": "praxis-component-registry-ingestion",
7
7
  "sourceRegistryVersion": "1.0.0",
8
8
  "componentCount": 2,
@@ -86,7 +86,6 @@ class CrudLauncherService {
86
86
  // Carregar overrides de CRUD (se houver) e mesclar em uma cópia local
87
87
  const merged = await this.mergeCrudOverrides(metadata, action, componentKeyId || undefined);
88
88
  const mode = this.resolveOpenMode(merged.action, merged.metadata);
89
- console.debug('[CRUD:Launcher] mode=', mode, 'action=', action);
90
89
  if (mode === 'route') {
91
90
  if (!merged.action.route) {
92
91
  throw new Error(`Route not provided for action ${merged.action.action}`);
@@ -118,13 +117,6 @@ class CrudLauncherService {
118
117
  return { mode };
119
118
  }
120
119
  const modalCfg = { ...(merged.metadata.defaults?.modal || {}) };
121
- console.debug('[CRUD:Launcher] opening dialog with:', {
122
- action: merged.action.action,
123
- formId: actionForLaunch.formId,
124
- inputs,
125
- modalCfg,
126
- resourcePath: merged.metadata.resource?.path ?? merged.metadata.table?.resourcePath,
127
- });
128
120
  const drawerMode = mode === 'drawer';
129
121
  const panelClasses = mergeClassList(['pfx-dialog-pane', drawerMode ? 'pfx-drawer-pane' : 'pfx-dialog-frosted'], modalCfg.panelClass);
130
122
  // Backdrop style presets
@@ -3683,29 +3675,36 @@ class PraxisCrudComponent {
3683
3675
  async onAction(action, row, runtimeEvent) {
3684
3676
  try {
3685
3677
  document.activeElement?.blur();
3686
- const contextualRow = row ?? this.resolveSelectedRowForAction(action);
3687
- let actionMeta = this.resolvedMetadata.actions?.find((candidate) => candidate.action === action);
3678
+ const normalizedAction = this.normalizeCrudActionName(action);
3679
+ const contextualRow = row ?? this.resolveSelectedRowForAction(normalizedAction);
3680
+ let actionMeta = this.resolvedMetadata.actions?.find((candidate) => candidate.action === normalizedAction);
3681
+ if (!actionMeta && normalizedAction !== action) {
3682
+ actionMeta = this.resolvedMetadata.actions?.find((candidate) => candidate.action === action);
3683
+ }
3688
3684
  if (!actionMeta) {
3689
- const ctxAction = this.tableCrudContext?.actions?.find((candidate) => candidate.action === action);
3685
+ const ctxAction = this.tableCrudContext?.actions?.find((candidate) => candidate.action === normalizedAction || candidate.action === action);
3690
3686
  if (ctxAction) {
3691
3687
  actionMeta = {
3692
- action: ctxAction.action,
3688
+ action: this.normalizeCrudActionName(ctxAction.action),
3693
3689
  openMode: ctxAction.openMode,
3694
3690
  formId: ctxAction.formId,
3695
3691
  route: ctxAction.route,
3696
3692
  };
3697
3693
  }
3698
3694
  else {
3699
- actionMeta = { action };
3695
+ actionMeta = { action: normalizedAction };
3700
3696
  }
3701
3697
  }
3702
- const effectiveAction = (actionMeta || { action });
3698
+ const effectiveAction = {
3699
+ ...(actionMeta || { action: normalizedAction }),
3700
+ action: this.normalizeCrudActionName(actionMeta?.action || normalizedAction),
3701
+ };
3703
3702
  if (!this.hasExplicitOpenBinding(effectiveAction)) {
3704
- const openedByDiscovery = await this.tryOpenDiscoveredCrudSurface(action, contextualRow, runtimeEvent);
3703
+ const openedByDiscovery = await this.tryOpenDiscoveredCrudSurface(effectiveAction.action, contextualRow, runtimeEvent);
3705
3704
  if (openedByDiscovery) {
3706
3705
  return;
3707
3706
  }
3708
- const handledByWorkflowAction = await this.tryOpenDiscoveredWorkflowAction(action, contextualRow, runtimeEvent);
3707
+ const handledByWorkflowAction = await this.tryOpenDiscoveredWorkflowAction(effectiveAction.action, contextualRow, runtimeEvent);
3709
3708
  if (handledByWorkflowAction) {
3710
3709
  return;
3711
3710
  }
@@ -4350,12 +4349,18 @@ class PraxisCrudComponent {
4350
4349
  }
4351
4350
  return cfg.toolbar;
4352
4351
  };
4353
- const hasToolbarAdd = (cfg.toolbar?.actions || []).some((action) => this.isAddLike(action));
4352
+ const hasToolbarAdd = (cfg.toolbar?.actions || []).some((action) => this.shouldCanonicalizeToolbarCreateAction(action));
4354
4353
  const addAction = this.resolveCreateToolbarAction(meta, capabilities);
4355
4354
  if (addAction) {
4356
4355
  if (hasToolbarAdd) {
4357
4356
  const toolbar = ensureToolbar();
4358
4357
  toolbar.visible = true;
4358
+ toolbar.actions = (toolbar.actions || []).map((action) => this.shouldCanonicalizeToolbarCreateAction(action)
4359
+ ? {
4360
+ ...action,
4361
+ action: 'create',
4362
+ }
4363
+ : action);
4359
4364
  }
4360
4365
  else {
4361
4366
  const toolbar = ensureToolbar();
@@ -4490,6 +4495,28 @@ class PraxisCrudComponent {
4490
4495
  }
4491
4496
  return false;
4492
4497
  }
4498
+ normalizeCrudActionName(action) {
4499
+ const raw = String(action || '').trim();
4500
+ const normalized = raw.toLowerCase();
4501
+ return this.isCreateActionAliasName(normalized) ? 'create' : raw;
4502
+ }
4503
+ shouldCanonicalizeToolbarCreateAction(action) {
4504
+ if (!action)
4505
+ return false;
4506
+ const normalize = (value) => String(value || '').trim().toLowerCase();
4507
+ const explicitId = normalize(action.action || action.id || action.code || action.key || action.name || action.type);
4508
+ if (this.isCreateActionAliasName(explicitId))
4509
+ return true;
4510
+ if (explicitId)
4511
+ return false;
4512
+ const icon = normalize(action.icon);
4513
+ const label = normalize(action.label);
4514
+ return ((icon === 'add' || icon === 'add_circle' || icon === 'add_box') &&
4515
+ (label === 'adicionar' || label === 'novo' || label === 'criar' || label === 'incluir'));
4516
+ }
4517
+ isCreateActionAliasName(actionName) {
4518
+ return ['create', 'add', 'novo', 'new', 'incluir', 'inserir'].includes(actionName);
4519
+ }
4493
4520
  buildTableCrudContext(meta, capabilities) {
4494
4521
  if (!meta)
4495
4522
  return undefined;
package/package.json CHANGED
@@ -1,20 +1,20 @@
1
1
  {
2
2
  "name": "@praxisui/crud",
3
- "version": "9.0.0-beta.42",
3
+ "version": "9.0.0-beta.43",
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.42",
9
- "@praxisui/table": "^9.0.0-beta.42",
10
- "@praxisui/core": "^9.0.0-beta.42",
11
- "@praxisui/dynamic-fields": "^9.0.0-beta.42",
12
- "@praxisui/settings-panel": "^9.0.0-beta.42",
8
+ "@praxisui/dynamic-form": "^9.0.0-beta.43",
9
+ "@praxisui/table": "^9.0.0-beta.43",
10
+ "@praxisui/core": "^9.0.0-beta.43",
11
+ "@praxisui/dynamic-fields": "^9.0.0-beta.43",
12
+ "@praxisui/settings-panel": "^9.0.0-beta.43",
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.42",
17
+ "@praxisui/ai": "^9.0.0-beta.43",
18
18
  "rxjs": "~7.8.0"
19
19
  },
20
20
  "dependencies": {
@@ -262,6 +262,9 @@ declare class PraxisCrudComponent implements OnChanges {
262
262
  private handleDiscoveredSurfaceResult;
263
263
  private buildEffectiveTableConfig;
264
264
  private isAddLike;
265
+ private normalizeCrudActionName;
266
+ private shouldCanonicalizeToolbarCreateAction;
267
+ private isCreateActionAliasName;
265
268
  private buildTableCrudContext;
266
269
  private readonly openCrudAuthoringFromTable;
267
270
  private applyCrudAuthoringPayload;