@praxisui/crud 8.0.0-beta.7 → 8.0.0-beta.9
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/fesm2022/praxisui-crud.mjs +34 -7
- package/index.d.ts +3 -2
- package/package.json +6 -6
|
@@ -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.
|
|
3709
|
+
if (!this.surfaceService) {
|
|
3710
3710
|
return false;
|
|
3711
3711
|
}
|
|
3712
|
-
const
|
|
3713
|
-
|
|
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 (!
|
|
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
|
|
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)
|
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.
|
|
3
|
+
"version": "8.0.0-beta.9",
|
|
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.
|
|
9
|
-
"@praxisui/table": "^8.0.0-beta.
|
|
10
|
-
"@praxisui/core": "^8.0.0-beta.
|
|
11
|
-
"@praxisui/dynamic-fields": "^8.0.0-beta.
|
|
12
|
-
"@praxisui/settings-panel": "^8.0.0-beta.
|
|
8
|
+
"@praxisui/dynamic-form": "^8.0.0-beta.9",
|
|
9
|
+
"@praxisui/table": "^8.0.0-beta.9",
|
|
10
|
+
"@praxisui/core": "^8.0.0-beta.9",
|
|
11
|
+
"@praxisui/dynamic-fields": "^8.0.0-beta.9",
|
|
12
|
+
"@praxisui/settings-panel": "^8.0.0-beta.9"
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"tslib": "^2.3.0"
|