valtech-components 2.0.1016 → 2.0.1017
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/esm2022/lib/components/molecules/multi-select-search/multi-select-search.component.mjs +14 -37
- package/esm2022/lib/components/molecules/permission-selector/permission-selector.component.mjs +156 -0
- package/esm2022/lib/components/molecules/permission-selector/types.mjs +2 -0
- package/esm2022/lib/components/molecules/select-search/select-search.component.mjs +3 -15
- package/esm2022/lib/components/organisms/api-keys-modal/api-keys-modal.component.mjs +59 -35
- package/esm2022/lib/components/organisms/invite-member-modal/invite-member-modal.component.mjs +7 -6
- package/esm2022/lib/components/organisms/organization-view/organization-view.component.mjs +17 -4
- package/esm2022/lib/services/org/permission-catalog.service.mjs +1 -1
- package/esm2022/lib/version.mjs +2 -2
- package/esm2022/public-api.mjs +3 -1
- package/fesm2022/valtech-components.mjs +276 -124
- package/fesm2022/valtech-components.mjs.map +1 -1
- package/lib/components/molecules/permission-selector/permission-selector.component.d.ts +46 -0
- package/lib/components/molecules/permission-selector/types.d.ts +15 -0
- package/lib/components/organisms/api-keys-modal/api-keys-modal.component.d.ts +17 -1
- package/lib/services/org/permission-catalog.service.d.ts +6 -0
- package/lib/version.d.ts +1 -1
- package/package.json +1 -1
- package/public-api.d.ts +2 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { LocalizedLabel } from '../../../services/org/permission-catalog.service';
|
|
2
|
+
import { PermissionSelectorResource } from './types';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
/**
|
|
5
|
+
* `val-permission-selector` — selector de permisos agrupado por recurso.
|
|
6
|
+
*
|
|
7
|
+
* Presentacional: recibe el catálogo (YA filtrado por el consumer — sin `internal`,
|
|
8
|
+
* sin otras apps) y emite los códigos `resource:action` seleccionados. Agrupa por
|
|
9
|
+
* recurso con su label legible (del backend), una fila por recurso con checkbox
|
|
10
|
+
* "Todos" (tri-estado) y un chip por acción. Bilingüe vía `locale` + los labels del
|
|
11
|
+
* catálogo; las pocas etiquetas propias (Todos / vacío) se auto-registran (es/en).
|
|
12
|
+
*
|
|
13
|
+
* Pensado para el modal de creación de API Key (asignar permisos a la key) y
|
|
14
|
+
* reusable en cualquier UI que asigne permisos (roles custom, etc.).
|
|
15
|
+
*/
|
|
16
|
+
export declare class PermissionSelectorComponent {
|
|
17
|
+
private i18n;
|
|
18
|
+
/** Catálogo YA filtrado (sin internal, sin otras apps). */
|
|
19
|
+
readonly permissions: import("@angular/core").InputSignal<PermissionSelectorResource[]>;
|
|
20
|
+
/** Labels de acción (es/en) por código de acción — del catálogo del backend. */
|
|
21
|
+
readonly actionLabels: import("@angular/core").InputSignal<Record<string, LocalizedLabel>>;
|
|
22
|
+
/** Idioma activo (es/en). Si no se pasa, usa el de `I18nService`. */
|
|
23
|
+
readonly locale: import("@angular/core").InputSignal<string>;
|
|
24
|
+
/** Permisos seleccionados (`resource:action`). Two-way (`model`). */
|
|
25
|
+
readonly selected: import("@angular/core").ModelSignal<string[]>;
|
|
26
|
+
constructor();
|
|
27
|
+
private readonly activeLocale;
|
|
28
|
+
readonly groups: import("@angular/core").Signal<{
|
|
29
|
+
resource: string;
|
|
30
|
+
label: string;
|
|
31
|
+
actions: {
|
|
32
|
+
action: string;
|
|
33
|
+
code: string;
|
|
34
|
+
label: string;
|
|
35
|
+
checked: boolean;
|
|
36
|
+
}[];
|
|
37
|
+
checkedCount: number;
|
|
38
|
+
all: boolean;
|
|
39
|
+
some: boolean;
|
|
40
|
+
}[]>;
|
|
41
|
+
toggleAction(code: string): void;
|
|
42
|
+
toggleGroup(resource: string): void;
|
|
43
|
+
protected tt(key: string): string;
|
|
44
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<PermissionSelectorComponent, never>;
|
|
45
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<PermissionSelectorComponent, "val-permission-selector", never, { "permissions": { "alias": "permissions"; "required": false; "isSignal": true; }; "actionLabels": { "alias": "actionLabels"; "required": false; "isSignal": true; }; "locale": { "alias": "locale"; "required": false; "isSignal": true; }; "selected": { "alias": "selected"; "required": false; "isSignal": true; }; }, { "selected": "selectedChange"; }, never, never, true, never>;
|
|
46
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { LocalizedLabel } from '../../../services/org/permission-catalog.service';
|
|
2
|
+
/**
|
|
3
|
+
* Un recurso del catálogo de permisos tal como lo consume `val-permission-selector`.
|
|
4
|
+
* Mismo shape que `PermissionResource` del catálogo del backend (resource + actions
|
|
5
|
+
* + label opcional). El consumer pasa el catálogo YA filtrado (sin `internal`, sin
|
|
6
|
+
* otras apps) — el selector no decide visibilidad, solo renderiza y selecciona.
|
|
7
|
+
*/
|
|
8
|
+
export interface PermissionSelectorResource {
|
|
9
|
+
resource: string;
|
|
10
|
+
actions: string[];
|
|
11
|
+
/** Nombre legible del recurso (es/en). Fallback al `resource` crudo. */
|
|
12
|
+
label?: LocalizedLabel;
|
|
13
|
+
scope?: string;
|
|
14
|
+
appId?: string;
|
|
15
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { OnInit } from '@angular/core';
|
|
2
2
|
import { FormMetadata, FormSubmit } from '../../types';
|
|
3
3
|
import { ClientApiKey, ClientApiKeyWithSecret } from '../../../services/apikeys/types';
|
|
4
|
+
import { LocalizedLabel, PermissionResource } from '../../../services/org/permission-catalog.service';
|
|
4
5
|
import * as i0 from "@angular/core";
|
|
5
6
|
/**
|
|
6
7
|
* `val-api-keys-modal` — gestión de Client API Keys org-scopeadas (ADR-023 fase 6).
|
|
@@ -12,14 +13,21 @@ import * as i0 from "@angular/core";
|
|
|
12
13
|
export declare class ApiKeysModalComponent implements OnInit {
|
|
13
14
|
private i18n;
|
|
14
15
|
private apiKeys;
|
|
16
|
+
private catalog;
|
|
17
|
+
private auth;
|
|
15
18
|
/** Inyectado por `ModalService.open`. */
|
|
16
19
|
_modalRef?: {
|
|
17
20
|
dismiss: (data?: unknown, role?: string) => void;
|
|
18
21
|
};
|
|
19
22
|
/** Namespace i18n. */
|
|
20
23
|
i18nNamespace: string;
|
|
24
|
+
/** Permisos del catálogo YA filtrados (sin internal, sin otras apps). */
|
|
25
|
+
readonly catalogPermissions: import("@angular/core").WritableSignal<PermissionResource[]>;
|
|
26
|
+
/** Labels de acción (es/en) del backend, para el selector. */
|
|
27
|
+
readonly actionLabels: import("@angular/core").WritableSignal<Record<string, LocalizedLabel>>;
|
|
28
|
+
/** Permisos seleccionados para la nueva key (`resource:action`). */
|
|
29
|
+
readonly selectedPerms: import("@angular/core").WritableSignal<string[]>;
|
|
21
30
|
readonly keys: import("@angular/core").WritableSignal<ClientApiKey[]>;
|
|
22
|
-
readonly availablePermissions: import("@angular/core").WritableSignal<string[]>;
|
|
23
31
|
readonly loading: import("@angular/core").WritableSignal<boolean>;
|
|
24
32
|
readonly showCreate: import("@angular/core").WritableSignal<boolean>;
|
|
25
33
|
readonly submitting: import("@angular/core").WritableSignal<boolean>;
|
|
@@ -34,6 +42,14 @@ export declare class ApiKeysModalComponent implements OnInit {
|
|
|
34
42
|
readonly createForm: import("@angular/core").Signal<FormMetadata>;
|
|
35
43
|
constructor();
|
|
36
44
|
ngOnInit(): void;
|
|
45
|
+
/**
|
|
46
|
+
* Carga el catálogo de permisos y lo filtra a lo asignable a una API Key de la
|
|
47
|
+
* org: descarta `scope:internal` (el backend ya los omite para no-staff) y los
|
|
48
|
+
* permisos de OTRAS apps (`appId !== appId del catálogo`). Quedan los permisos de
|
|
49
|
+
* org (users/roles/rbac) + los de la app actual.
|
|
50
|
+
*/
|
|
51
|
+
private loadCatalog;
|
|
52
|
+
private activeOrgId;
|
|
37
53
|
private refresh;
|
|
38
54
|
openCreate(): void;
|
|
39
55
|
onCreateSubmit(event: FormSubmit): void;
|
|
@@ -3,16 +3,22 @@ import { Observable } from 'rxjs';
|
|
|
3
3
|
import { ValtechAuthConfig } from '../auth/types';
|
|
4
4
|
import * as i0 from "@angular/core";
|
|
5
5
|
export type PermissionScope = 'app' | 'org' | 'internal';
|
|
6
|
+
/** Etiqueta legible por idioma (es/en). El backend es autoritativo (ADR-024). */
|
|
7
|
+
export type LocalizedLabel = Record<string, string>;
|
|
6
8
|
export interface PermissionResource {
|
|
7
9
|
resource: string;
|
|
8
10
|
scope: PermissionScope;
|
|
9
11
|
appId?: string;
|
|
10
12
|
actions: string[];
|
|
13
|
+
/** Nombre legible del recurso (es/en), provisto por el backend. */
|
|
14
|
+
label?: LocalizedLabel;
|
|
11
15
|
}
|
|
12
16
|
export interface PermissionCatalogResponse {
|
|
13
17
|
operationId: string;
|
|
14
18
|
appId: string;
|
|
15
19
|
permissions: PermissionResource[];
|
|
20
|
+
/** Nombre legible (es/en) por acción, transversal a los recursos. */
|
|
21
|
+
actionLabels?: Record<string, LocalizedLabel>;
|
|
16
22
|
}
|
|
17
23
|
/**
|
|
18
24
|
* Consume el catálogo de permisos del backend (`GET /org/{orgId}/permissions-catalog`).
|
package/lib/version.d.ts
CHANGED
package/package.json
CHANGED
package/public-api.d.ts
CHANGED
|
@@ -185,6 +185,8 @@ export * from './lib/components/molecules/invitation-card/invitation-card.compon
|
|
|
185
185
|
export * from './lib/components/molecules/invitation-card/types';
|
|
186
186
|
export * from './lib/components/molecules/member-card/member-card.component';
|
|
187
187
|
export * from './lib/components/molecules/member-card/types';
|
|
188
|
+
export * from './lib/components/molecules/permission-selector/permission-selector.component';
|
|
189
|
+
export * from './lib/components/molecules/permission-selector/types';
|
|
188
190
|
export * from './lib/components/molecules/username-input/username-input.component';
|
|
189
191
|
export * from './lib/components/molecules/username-input/types';
|
|
190
192
|
export * from './lib/components/molecules/linked-providers/linked-providers.component';
|