@praxisui/crud 8.0.0-beta.1 → 8.0.0-beta.11

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.
@@ -3409,7 +3409,7 @@ class PraxisCrudComponent {
3409
3409
  async onAction(action, row, runtimeEvent) {
3410
3410
  try {
3411
3411
  document.activeElement?.blur();
3412
- const openedByDiscovery = await this.tryOpenDiscoveredCrudSurface(action, row);
3412
+ const openedByDiscovery = await this.tryOpenDiscoveredCrudSurface(action, row, runtimeEvent);
3413
3413
  if (openedByDiscovery) {
3414
3414
  return;
3415
3415
  }
@@ -3704,17 +3704,27 @@ class PraxisCrudComponent {
3704
3704
  resolveFilterCriteria(meta) {
3705
3705
  return this.isRecord(meta?.filterCriteria) ? { ...meta.filterCriteria } : {};
3706
3706
  }
3707
- async tryOpenDiscoveredCrudSurface(action, row) {
3707
+ async tryOpenDiscoveredCrudSurface(action, row, runtimeEvent) {
3708
3708
  const normalizedAction = String(action || '').trim().toLowerCase();
3709
- if (!this.isDiscoveryManagedCrudAction(normalizedAction) || !this.surfaceService) {
3709
+ if (!this.surfaceService) {
3710
3710
  return false;
3711
3711
  }
3712
- const catalog = await this.resolveDiscoveredSurfaceCatalog(normalizedAction, row);
3713
- const surface = this.selectSurfaceForCrudAction(normalizedAction, catalog?.surfaces || []);
3712
+ const providedSurface = this.resolveProvidedSurface(normalizedAction, runtimeEvent?.actionConfig);
3713
+ if (!providedSurface && !this.isDiscoveryManagedCrudAction(normalizedAction)) {
3714
+ return false;
3715
+ }
3716
+ const catalog = providedSurface
3717
+ ? null
3718
+ : await this.resolveDiscoveredSurfaceCatalog(normalizedAction, row);
3719
+ const surface = providedSurface || this.selectSurfaceForCrudAction(normalizedAction, catalog?.surfaces || []);
3714
3720
  const resourcePath = String(catalog?.resourcePath || this.resolveResourcePath(this.resolvedMetadata) || '').trim();
3715
- if (!catalog || !surface || !resourcePath) {
3721
+ if (!surface || !resourcePath) {
3716
3722
  return false;
3717
3723
  }
3724
+ if (surface.availability?.allowed === false) {
3725
+ this.snack.open(translateUnavailableWorkflowMessage(this.i18n, surface.availability), undefined, { duration: 2500 });
3726
+ return true;
3727
+ }
3718
3728
  let payload;
3719
3729
  try {
3720
3730
  payload = this.surfaceOpenAdapter.toPayload(surface, {
@@ -3722,7 +3732,7 @@ class PraxisCrudComponent {
3722
3732
  resourceId: this.resolveRowResourceId(row),
3723
3733
  endpointKey: this.resolvedMetadata?.resource?.endpointKey,
3724
3734
  apiUrlEntry: this.resolveDiscoveryApiEntry(),
3725
- group: catalog.group ?? null,
3735
+ group: catalog?.group ?? null,
3726
3736
  });
3727
3737
  }
3728
3738
  catch {
@@ -3880,6 +3890,23 @@ class PraxisCrudComponent {
3880
3890
  }
3881
3891
  return candidate;
3882
3892
  }
3893
+ resolveProvidedSurface(action, candidate) {
3894
+ if (!candidate || typeof candidate !== 'object') {
3895
+ return null;
3896
+ }
3897
+ const normalizedId = String(candidate.id || '').trim().toLowerCase();
3898
+ if (!normalizedId || normalizedId !== action) {
3899
+ return null;
3900
+ }
3901
+ const surface = candidate;
3902
+ if (!surface.kind || !surface.scope || !surface.path || !surface.method) {
3903
+ return null;
3904
+ }
3905
+ if (!this.isWritableCrudSurface(surface) && !this.isReadableCrudSurface(surface)) {
3906
+ return null;
3907
+ }
3908
+ return surface;
3909
+ }
3883
3910
  selectSurfaceForCrudAction(action, surfaces) {
3884
3911
  const candidates = surfaces
3885
3912
  .filter((surface) => surface.availability?.allowed !== false)
@@ -4412,7 +4439,7 @@ class PraxisCrudComponent {
4412
4439
  />
4413
4440
  }
4414
4441
  }
4415
- `, isInline: true, styles: [":host{display:block;width:100%;min-width:0;max-width:100%}\n"], dependencies: [{ kind: "component", type: PraxisTable, selector: "praxis-table", inputs: ["config", "resourcePath", "data", "tableId", "componentInstanceId", "title", "subtitle", "icon", "autoDelete", "notifyIfOutdated", "snoozeMs", "autoOpenSettingsOnOutdated", "crudContext", "filterCriteria", "queryContext", "enableCustomization", "dense"], outputs: ["rowClick", "rowDoubleClick", "rowExpansionChange", "rowAction", "toolbarAction", "bulkAction", "columnReorder", "columnReorderAttempt", "beforeDelete", "afterDelete", "deleteError", "beforeBulkDelete", "afterBulkDelete", "bulkDeleteError", "schemaStatusChange", "metadataChange", "loadingStateChange", "collectionLinksChange"] }, { kind: "component", type: EmptyStateCardComponent, selector: "praxis-empty-state-card", inputs: ["icon", "title", "description", "primaryAction", "secondaryActions", "inline", "tone"] }] });
4442
+ `, isInline: true, styles: [":host{display:block;width:100%;min-width:0;max-width:100%}\n"], dependencies: [{ kind: "component", type: PraxisTable, selector: "praxis-table", inputs: ["config", "resourcePath", "data", "tableId", "componentInstanceId", "title", "subtitle", "icon", "autoDelete", "notifyIfOutdated", "snoozeMs", "autoOpenSettingsOnOutdated", "crudContext", "filterCriteria", "queryContext", "enableCustomization", "dense"], outputs: ["rowClick", "rowDoubleClick", "rowExpansionChange", "rowAction", "toolbarAction", "bulkAction", "columnReorder", "columnReorderAttempt", "beforeDelete", "afterDelete", "deleteError", "beforeBulkDelete", "afterBulkDelete", "bulkDeleteError", "schemaStatusChange", "metadataChange", "loadingStateChange", "collectionLinksChange", "selectionChange"] }, { kind: "component", type: EmptyStateCardComponent, selector: "praxis-empty-state-card", inputs: ["icon", "title", "description", "primaryAction", "secondaryActions", "inline", "tone"] }] });
4416
4443
  }
4417
4444
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: PraxisCrudComponent, decorators: [{
4418
4445
  type: Component,
package/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as _praxisui_core from '@praxisui/core';
2
- import { ApiEndpoint, TableConfig, PraxisDataQueryContext, FormConfig, BackConfig, RowAction, ToolbarAction, ApiUrlEntry, ResourceActionCatalogItem, LoadingState, RestApiLinks, ResourceCapabilitySnapshot, GenericCrudService, AsyncConfigStorage, ComponentDocMeta, AiCapabilityCategory, AiValueKind, AiCapability, AiCapabilityCatalog, SettingsValueProvider } from '@praxisui/core';
2
+ import { ApiEndpoint, TableConfig, PraxisDataQueryContext, FormConfig, BackConfig, RowAction, ToolbarAction, ApiUrlEntry, ResourceActionCatalogItem, ResourceSurfaceCatalogItem, LoadingState, RestApiLinks, ResourceCapabilitySnapshot, GenericCrudService, AsyncConfigStorage, ComponentDocMeta, AiCapabilityCategory, AiValueKind, AiCapability, AiCapabilityCatalog, SettingsValueProvider } from '@praxisui/core';
3
3
  export { BackConfig } from '@praxisui/core';
4
4
  import * as _angular_core from '@angular/core';
5
5
  import { NgZone, OnChanges, EventEmitter, SimpleChanges, OnInit, Provider } from '@angular/core';
@@ -123,7 +123,7 @@ interface CrudValidationContext {
123
123
  }
124
124
 
125
125
  type CrudActionRuntimeEvent = {
126
- actionConfig?: ResourceActionCatalogItem | null;
126
+ actionConfig?: ResourceActionCatalogItem | ResourceSurfaceCatalogItem | null;
127
127
  };
128
128
  type CrudContextAction = {
129
129
  action: string;
@@ -230,6 +230,7 @@ declare class PraxisCrudComponent implements OnChanges {
230
230
  private resolveDiscoveredActionCatalog;
231
231
  private selectDiscoveredWorkflowAction;
232
232
  private resolveProvidedWorkflowAction;
233
+ private resolveProvidedSurface;
233
234
  private selectSurfaceForCrudAction;
234
235
  private getPreferredSurfaceIdsForCrudAction;
235
236
  private isDiscoveryManagedCrudAction;
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@praxisui/crud",
3
- "version": "8.0.0-beta.1",
3
+ "version": "8.0.0-beta.11",
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": "^8.0.0-beta.1",
9
- "@praxisui/table": "^8.0.0-beta.1",
10
- "@praxisui/core": "^8.0.0-beta.1",
11
- "@praxisui/dynamic-fields": "^8.0.0-beta.1",
12
- "@praxisui/settings-panel": "^8.0.0-beta.1"
8
+ "@praxisui/dynamic-form": "^8.0.0-beta.11",
9
+ "@praxisui/table": "^8.0.0-beta.11",
10
+ "@praxisui/core": "^8.0.0-beta.11",
11
+ "@praxisui/dynamic-fields": "^8.0.0-beta.11",
12
+ "@praxisui/settings-panel": "^8.0.0-beta.11"
13
13
  },
14
14
  "dependencies": {
15
15
  "tslib": "^2.3.0"