@trismegisto/spine 2.0.0

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.
Files changed (55) hide show
  1. package/LICENSE +56 -0
  2. package/README.md +207 -0
  3. package/fesm2022/trismegisto-spine-audit.mjs +1299 -0
  4. package/fesm2022/trismegisto-spine-audit.mjs.map +1 -0
  5. package/fesm2022/trismegisto-spine-auto-service-auto-service-audit.component-CCiz-q8o.mjs +37 -0
  6. package/fesm2022/trismegisto-spine-auto-service-auto-service-audit.component-CCiz-q8o.mjs.map +1 -0
  7. package/fesm2022/trismegisto-spine-auto-service-auto-service-client-picker.component-Z0wCANF6.mjs +51 -0
  8. package/fesm2022/trismegisto-spine-auto-service-auto-service-client-picker.component-Z0wCANF6.mjs.map +1 -0
  9. package/fesm2022/trismegisto-spine-auto-service-auto-service-client.component-BYkUOwWL.mjs +595 -0
  10. package/fesm2022/trismegisto-spine-auto-service-auto-service-client.component-BYkUOwWL.mjs.map +1 -0
  11. package/fesm2022/trismegisto-spine-auto-service-auto-service-groups.component-CqIVe2LU.mjs +357 -0
  12. package/fesm2022/trismegisto-spine-auto-service-auto-service-groups.component-CqIVe2LU.mjs.map +1 -0
  13. package/fesm2022/trismegisto-spine-auto-service-auto-service.component-B5tyJ2zY.mjs +477 -0
  14. package/fesm2022/trismegisto-spine-auto-service-auto-service.component-B5tyJ2zY.mjs.map +1 -0
  15. package/fesm2022/trismegisto-spine-auto-service-home.component-vl3BPFnk.mjs +238 -0
  16. package/fesm2022/trismegisto-spine-auto-service-home.component-vl3BPFnk.mjs.map +1 -0
  17. package/fesm2022/trismegisto-spine-auto-service.mjs +154 -0
  18. package/fesm2022/trismegisto-spine-auto-service.mjs.map +1 -0
  19. package/fesm2022/trismegisto-spine-graphql.mjs +347 -0
  20. package/fesm2022/trismegisto-spine-graphql.mjs.map +1 -0
  21. package/fesm2022/trismegisto-spine-layout.mjs +2848 -0
  22. package/fesm2022/trismegisto-spine-layout.mjs.map +1 -0
  23. package/fesm2022/trismegisto-spine-modal.mjs +141 -0
  24. package/fesm2022/trismegisto-spine-modal.mjs.map +1 -0
  25. package/fesm2022/trismegisto-spine-notification.mjs +122 -0
  26. package/fesm2022/trismegisto-spine-notification.mjs.map +1 -0
  27. package/fesm2022/trismegisto-spine-routing.mjs +398 -0
  28. package/fesm2022/trismegisto-spine-routing.mjs.map +1 -0
  29. package/fesm2022/trismegisto-spine-shell.mjs +409 -0
  30. package/fesm2022/trismegisto-spine-shell.mjs.map +1 -0
  31. package/fesm2022/trismegisto-spine-side-panel.mjs +142 -0
  32. package/fesm2022/trismegisto-spine-side-panel.mjs.map +1 -0
  33. package/fesm2022/trismegisto-spine.mjs +2574 -0
  34. package/fesm2022/trismegisto-spine.mjs.map +1 -0
  35. package/package.json +94 -0
  36. package/types/trismegisto-spine-audit.d.ts +948 -0
  37. package/types/trismegisto-spine-audit.d.ts.map +1 -0
  38. package/types/trismegisto-spine-auto-service.d.ts +110 -0
  39. package/types/trismegisto-spine-auto-service.d.ts.map +1 -0
  40. package/types/trismegisto-spine-graphql.d.ts +72 -0
  41. package/types/trismegisto-spine-graphql.d.ts.map +1 -0
  42. package/types/trismegisto-spine-layout.d.ts +1054 -0
  43. package/types/trismegisto-spine-layout.d.ts.map +1 -0
  44. package/types/trismegisto-spine-modal.d.ts +68 -0
  45. package/types/trismegisto-spine-modal.d.ts.map +1 -0
  46. package/types/trismegisto-spine-notification.d.ts +62 -0
  47. package/types/trismegisto-spine-notification.d.ts.map +1 -0
  48. package/types/trismegisto-spine-routing.d.ts +205 -0
  49. package/types/trismegisto-spine-routing.d.ts.map +1 -0
  50. package/types/trismegisto-spine-shell.d.ts +143 -0
  51. package/types/trismegisto-spine-shell.d.ts.map +1 -0
  52. package/types/trismegisto-spine-side-panel.d.ts +66 -0
  53. package/types/trismegisto-spine-side-panel.d.ts.map +1 -0
  54. package/types/trismegisto-spine.d.ts +1161 -0
  55. package/types/trismegisto-spine.d.ts.map +1 -0
@@ -0,0 +1,477 @@
1
+ import * as i0 from '@angular/core';
2
+ import { inject, ChangeDetectorRef, EventEmitter, Output, Input, ChangeDetectionStrategy, Component, computed } from '@angular/core';
3
+ import * as i2 from '@angular/common';
4
+ import { CommonModule } from '@angular/common';
5
+ import { A as AutoServiceClientPickerComponent } from './trismegisto-spine-auto-service-auto-service-client-picker.component-Z0wCANF6.mjs';
6
+ import * as i3 from '@angular/forms';
7
+ import { FormControl, Validators, ReactiveFormsModule, FormsModule } from '@angular/forms';
8
+ import { ButtonComponent, CheckboxComponent, InputComponent, ModalComponent, DataGridComponent, DataGridCellDirective, TagComponent, ComboboxComponent, DrawerComponent, IconComponent, AlertComponent, CardComponent, TabsComponent, TabComponent, TabContentDirective } from '@trismegisto/angular';
9
+ import { SPINE_MESSAGES } from '@trismegisto/spine';
10
+ import { AutoServiceService } from './trismegisto-spine-auto-service.mjs';
11
+ import { pluralMessage, formatMessage } from '@trismegisto/primitives';
12
+
13
+ class AutoServiceAppsModalComponent {
14
+ constructor(service) {
15
+ this.service = service;
16
+ this.text = inject(SPINE_MESSAGES).autoService;
17
+ /** Telas com estado em campo comum, preenchido depois de `await`: marca a view ao terminar (app sem zone.js). */
18
+ this.cdr = inject(ChangeDetectorRef);
19
+ this.app = null;
20
+ this.clientId = '';
21
+ this.open = false;
22
+ this.openChange = new EventEmitter();
23
+ this.saved = new EventEmitter();
24
+ this.name = new FormControl('', { nonNullable: true, validators: [Validators.required] });
25
+ this.grants = new FormControl('client_credentials', { nonNullable: true });
26
+ this.enabled = new FormControl(true, { nonNullable: true });
27
+ this.saving = false;
28
+ }
29
+ get isEdit() { return !!this.app?.id; }
30
+ ngOnChanges(changes) { if (changes['open'] && this.open) {
31
+ this.resetForm();
32
+ } }
33
+ resetForm() {
34
+ if (this.isEdit) {
35
+ this.name.setValue(this.app.name);
36
+ this.grants.setValue(this.app.allowed_grants?.join(', ') ?? '');
37
+ this.enabled.setValue(this.app.enabled);
38
+ }
39
+ else {
40
+ this.name.setValue('');
41
+ this.grants.setValue('client_credentials');
42
+ this.enabled.setValue(true);
43
+ }
44
+ }
45
+ onModalOpenChange(value) { this.open = value; this.openChange.emit(value); }
46
+ close() { this.onModalOpenChange(false); }
47
+ async save() {
48
+ this.saving = true;
49
+ try {
50
+ const allowed_grants = this.grants.value.split(',').map(s => s.trim()).filter(Boolean);
51
+ if (this.isEdit) {
52
+ await this.service.updateApp(this.clientId, this.app.id, { name: this.name.value, allowed_grants, enabled: this.enabled.value });
53
+ this.saved.emit();
54
+ }
55
+ else {
56
+ const res = await this.service.createApp(this.clientId, { name: this.name.value, allowed_grants });
57
+ this.saved.emit(res.secret);
58
+ }
59
+ this.close();
60
+ }
61
+ finally {
62
+ this.saving = false;
63
+ this.cdr.markForCheck();
64
+ }
65
+ }
66
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.24", ngImport: i0, type: AutoServiceAppsModalComponent, deps: [{ token: AutoServiceService }], target: i0.ɵɵFactoryTarget.Component }); }
67
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.24", type: AutoServiceAppsModalComponent, isStandalone: true, selector: "spine-auto-service-apps-modal", inputs: { app: "app", clientId: "clientId", open: "open" }, outputs: { openChange: "openChange", saved: "saved" }, usesOnChanges: true, ngImport: i0, template: "<hm-modal [open]=\"open\" (openChange)=\"onModalOpenChange($event)\" [heading]=\"isEdit ? text.editApp : text.newApp\" (closed)=\"close()\">\n <div class=\"form-stack\">\n <hm-input [formControl]=\"name\" [label]=\"text.name\" />\n <hm-input [formControl]=\"grants\" [label]=\"text.grants\" placeholder=\"client_credentials\" />\n <hm-checkbox *ngIf=\"isEdit\" [formControl]=\"enabled\" [label]=\"text.active\" />\n </div>\n\n <ng-container footer>\n <hm-button emphasis=\"medium\" (clicked)=\"close()\">{{ text.cancel }}</hm-button>\n <hm-button [disabled]=\"!name.value\" [loading]=\"saving\" (clicked)=\"save()\">{{ text.save }}</hm-button>\n </ng-container>\n</hm-modal>\n", styles: [".form-stack{display:flex;flex-direction:column;gap:var(--hm-space-sm)}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: ButtonComponent, selector: "hm-button", inputs: ["emphasis", "intent", "size", "type", "icon", "iconDirection", "iconEnd", "disabled", "loading", "busy", "loadingState", "block", "link", "newTab", "caret", "inMenu", "toggle", "pressed"], outputs: ["loadingStateChange", "pressedChange", "clicked"] }, { kind: "component", type: CheckboxComponent, selector: "hm-checkbox", inputs: ["label", "labelHidden", "checked", "indeterminate"], outputs: ["checkedChange"] }, { kind: "component", type: InputComponent, selector: "hm-input", inputs: ["value", "label", "type", "placeholder", "icon", "labelHidden", "hint", "prefix", "suffix", "prefixIcon", "mask", "maskValue", "min", "max", "step", "stepButtons", "maxLength", "autocomplete", "inputMode"], outputs: ["valueChange"] }, { kind: "component", type: ModalComponent, selector: "hm-modal", inputs: ["open", "heading", "size", "closeLabel", "closable", "beforeClose"], outputs: ["openChange", "closed"] }], changeDetection: i0.ChangeDetectionStrategy.Eager }); }
68
+ }
69
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.24", ngImport: i0, type: AutoServiceAppsModalComponent, decorators: [{
70
+ type: Component,
71
+ args: [{ selector: 'spine-auto-service-apps-modal', standalone: true, imports: [CommonModule, ReactiveFormsModule, ButtonComponent, CheckboxComponent, InputComponent, ModalComponent], changeDetection: ChangeDetectionStrategy.Eager, template: "<hm-modal [open]=\"open\" (openChange)=\"onModalOpenChange($event)\" [heading]=\"isEdit ? text.editApp : text.newApp\" (closed)=\"close()\">\n <div class=\"form-stack\">\n <hm-input [formControl]=\"name\" [label]=\"text.name\" />\n <hm-input [formControl]=\"grants\" [label]=\"text.grants\" placeholder=\"client_credentials\" />\n <hm-checkbox *ngIf=\"isEdit\" [formControl]=\"enabled\" [label]=\"text.active\" />\n </div>\n\n <ng-container footer>\n <hm-button emphasis=\"medium\" (clicked)=\"close()\">{{ text.cancel }}</hm-button>\n <hm-button [disabled]=\"!name.value\" [loading]=\"saving\" (clicked)=\"save()\">{{ text.save }}</hm-button>\n </ng-container>\n</hm-modal>\n", styles: [".form-stack{display:flex;flex-direction:column;gap:var(--hm-space-sm)}\n"] }]
72
+ }], ctorParameters: () => [{ type: AutoServiceService }], propDecorators: { app: [{
73
+ type: Input
74
+ }], clientId: [{
75
+ type: Input
76
+ }], open: [{
77
+ type: Input
78
+ }], openChange: [{
79
+ type: Output
80
+ }], saved: [{
81
+ type: Output
82
+ }] } });
83
+
84
+ class AutoServiceAppOperationsComponent {
85
+ constructor(service) {
86
+ this.service = service;
87
+ this.text = inject(SPINE_MESSAGES).autoService;
88
+ /** Telas com estado em campo comum, preenchido depois de `await`: marca a view ao terminar (app sem zone.js). */
89
+ this.cdr = inject(ChangeDetectorRef);
90
+ this.messages = inject(SPINE_MESSAGES);
91
+ this.clientId = '';
92
+ this.appId = '';
93
+ this.operations = [];
94
+ this.loading = false;
95
+ this.rowId = (op) => op.operation_id;
96
+ this.columns = computed(() => [
97
+ { key: 'identifier', title: this.text.colIdentifier, value: (op) => op.identifier, sortable: true },
98
+ { key: 'method', title: this.text.colMethod, value: (op) => op.method, sortable: true },
99
+ { key: 'level', title: this.text.colLevel, value: (op) => op.level, sortable: true },
100
+ { key: 'description', title: this.text.colDescription, value: (op) => op.description || '—' },
101
+ {
102
+ key: 'allowed_groups', title: this.text.colAllowedGroups,
103
+ value: (op) => op.allowed_groups?.length ? pluralMessage(this.text.groupCount, op.allowed_groups.length, this.messages.meta.locale) : '—',
104
+ },
105
+ ], ...(ngDevMode ? [{ debugName: "columns" }] : /* istanbul ignore next */ []));
106
+ }
107
+ ngOnChanges(changes) { if (changes['appId']) {
108
+ this.load();
109
+ } }
110
+ async load() {
111
+ if (!this.appId) {
112
+ this.operations = [];
113
+ return;
114
+ }
115
+ this.loading = true;
116
+ try {
117
+ const res = await this.service.getAppOperations(this.clientId, this.appId);
118
+ this.operations = res.operations;
119
+ }
120
+ finally {
121
+ this.loading = false;
122
+ this.cdr.markForCheck();
123
+ }
124
+ }
125
+ /** Nível da operação no selo: pública em verde, protegida em amarelo; o resto neutro. */
126
+ levelTagColor(level) {
127
+ if (level === 'public')
128
+ return 'success';
129
+ if (level === 'protected')
130
+ return 'warning';
131
+ return 'neutral';
132
+ }
133
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.24", ngImport: i0, type: AutoServiceAppOperationsComponent, deps: [{ token: AutoServiceService }], target: i0.ɵɵFactoryTarget.Component }); }
134
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.24", type: AutoServiceAppOperationsComponent, isStandalone: true, selector: "spine-auto-service-app-operations", inputs: { clientId: "clientId", appId: "appId" }, usesOnChanges: true, ngImport: i0, template: "<hm-data-grid\n [columns]=\"columns()\"\n [rows]=\"operations\"\n [rowId]=\"rowId\"\n [caption]=\"text.operationsCaption\"\n [loading]=\"loading\"\n [emptyMessage]=\"text.noOperations\"\n>\n <ng-template hmCell=\"identifier\" let-op>\n <code>{{ op.identifier }}</code>\n </ng-template>\n\n <ng-template hmCell=\"method\" let-op>\n <hm-tag [name]=\"op.method\" />\n </ng-template>\n\n <ng-template hmCell=\"level\" let-op>\n <hm-tag [name]=\"op.level\" [color]=\"levelTagColor(op.level)\" />\n </ng-template>\n</hm-data-grid>\n", styles: [".as-stack{display:flex;flex-direction:column;gap:var(--hm-space-md);min-inline-size:0}.as-actions{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:var(--hm-space-xs)}.as-field-row{display:flex;flex-wrap:wrap;align-items:flex-end;gap:var(--hm-space-sm)}.as-field-row>:first-child{flex:1 1 20rem;min-inline-size:0}.as-summary{display:flex;flex-wrap:wrap;align-items:center;gap:var(--hm-space-sm)}.as-summary__info{display:flex;flex:1 1 16rem;flex-direction:column;gap:var(--hm-space-micro);min-inline-size:0}.as-summary__title{display:flex;flex-wrap:wrap;align-items:center;gap:var(--hm-space-xs);margin:0;color:var(--hm-text);font-size:var(--hm-font-size-md);font-weight:var(--hm-font-weight-semibold)}.as-summary__detail{margin:0;color:var(--hm-muted);font-size:var(--hm-font-size-sm)}.muted{color:var(--hm-muted)}:host{display:block}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: DataGridComponent, selector: "hm-data-grid", inputs: ["columns", "rows", "rowId", "caption", "rowActions", "loading", "error", "emptyMessage", "noResultsMessage", "filterable", "paginated", "pageState", "pagination", "totalItems", "sort", "selectable", "selectionMode", "selection", "rowSelectable", "rowSelectableReason", "rowDetailDisabled", "rowDetailHidden", "virtual", "rowHeight", "pinnedColumns", "columnState", "pageSizes", "fillHeight", "maxHeight", "bordered", "rowState", "rowClickable", "remoteSearch", "remoteSort", "itemsLabel", "pageSizeLabel", "exportable", "exportFileName", "groupBy", "aggregates", "aggregateFormatter", "persistKey", "persistStorage", "advancedFilter", "filterQuery", "columnManager", "columnOrder", "searchTerm"], outputs: ["pageStateChange", "sortChange", "selectionChange", "pinnedColumnsChange", "columnStateChange", "actionTriggered", "detailToggled", "rowClicked", "clearFiltersRequested", "filteredChange", "searchTermChanged", "groupByChange", "filterQueryChange", "columnOrderChange", "searchTermChange", "detailPaneToggled"] }, { kind: "directive", type: DataGridCellDirective, selector: "ng-template[hmCell]", inputs: ["hmCell"] }, { kind: "component", type: TagComponent, selector: "hm-tag", inputs: ["name", "color", "compact"] }], changeDetection: i0.ChangeDetectionStrategy.Eager }); }
135
+ }
136
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.24", ngImport: i0, type: AutoServiceAppOperationsComponent, decorators: [{
137
+ type: Component,
138
+ args: [{ selector: 'spine-auto-service-app-operations', standalone: true, imports: [CommonModule, DataGridComponent, DataGridCellDirective, TagComponent], changeDetection: ChangeDetectionStrategy.Eager, template: "<hm-data-grid\n [columns]=\"columns()\"\n [rows]=\"operations\"\n [rowId]=\"rowId\"\n [caption]=\"text.operationsCaption\"\n [loading]=\"loading\"\n [emptyMessage]=\"text.noOperations\"\n>\n <ng-template hmCell=\"identifier\" let-op>\n <code>{{ op.identifier }}</code>\n </ng-template>\n\n <ng-template hmCell=\"method\" let-op>\n <hm-tag [name]=\"op.method\" />\n </ng-template>\n\n <ng-template hmCell=\"level\" let-op>\n <hm-tag [name]=\"op.level\" [color]=\"levelTagColor(op.level)\" />\n </ng-template>\n</hm-data-grid>\n", styles: [".as-stack{display:flex;flex-direction:column;gap:var(--hm-space-md);min-inline-size:0}.as-actions{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:var(--hm-space-xs)}.as-field-row{display:flex;flex-wrap:wrap;align-items:flex-end;gap:var(--hm-space-sm)}.as-field-row>:first-child{flex:1 1 20rem;min-inline-size:0}.as-summary{display:flex;flex-wrap:wrap;align-items:center;gap:var(--hm-space-sm)}.as-summary__info{display:flex;flex:1 1 16rem;flex-direction:column;gap:var(--hm-space-micro);min-inline-size:0}.as-summary__title{display:flex;flex-wrap:wrap;align-items:center;gap:var(--hm-space-xs);margin:0;color:var(--hm-text);font-size:var(--hm-font-size-md);font-weight:var(--hm-font-weight-semibold)}.as-summary__detail{margin:0;color:var(--hm-muted);font-size:var(--hm-font-size-sm)}.muted{color:var(--hm-muted)}:host{display:block}\n"] }]
139
+ }], ctorParameters: () => [{ type: AutoServiceService }], propDecorators: { clientId: [{
140
+ type: Input
141
+ }], appId: [{
142
+ type: Input
143
+ }] } });
144
+
145
+ class AutoServiceConsumerCreateComponent {
146
+ constructor(service) {
147
+ this.service = service;
148
+ this.text = inject(SPINE_MESSAGES).autoService;
149
+ /** Telas com estado em campo comum, preenchido depois de `await`: marca a view ao terminar (app sem zone.js). */
150
+ this.cdr = inject(ChangeDetectorRef);
151
+ this.clientId = '';
152
+ this.appId = '';
153
+ this.availableGroups = [];
154
+ this.open = false;
155
+ this.openChange = new EventEmitter();
156
+ this.created = new EventEmitter();
157
+ this.groupId = '';
158
+ this.saving = false;
159
+ }
160
+ get groupOptions() {
161
+ return this.availableGroups.map((g) => ({ value: g.id, label: g.type ? `${g.name} (${g.type.name})` : g.name }));
162
+ }
163
+ ngOnChanges(changes) { if (changes['open'] && this.open) {
164
+ this.groupId = '';
165
+ } }
166
+ onModalOpenChange(value) { this.open = value; this.openChange.emit(value); }
167
+ close() { this.onModalOpenChange(false); }
168
+ async save() {
169
+ if (!this.groupId)
170
+ return;
171
+ this.saving = true;
172
+ try {
173
+ await this.service.createAppConsumer(this.clientId, this.appId, this.groupId);
174
+ this.created.emit();
175
+ this.close();
176
+ }
177
+ finally {
178
+ this.saving = false;
179
+ this.cdr.markForCheck();
180
+ }
181
+ }
182
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.24", ngImport: i0, type: AutoServiceConsumerCreateComponent, deps: [{ token: AutoServiceService }], target: i0.ɵɵFactoryTarget.Component }); }
183
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.24", type: AutoServiceConsumerCreateComponent, isStandalone: true, selector: "spine-auto-service-consumer-create", inputs: { clientId: "clientId", appId: "appId", availableGroups: "availableGroups", open: "open" }, outputs: { openChange: "openChange", created: "created" }, usesOnChanges: true, ngImport: i0, template: "<hm-modal [open]=\"open\" (openChange)=\"onModalOpenChange($event)\" [heading]=\"text.newAccessHeading\" (closed)=\"close()\">\n <hm-combobox [label]=\"text.group\" [options]=\"groupOptions\" [value]=\"groupId\" (valueChange)=\"groupId = $event\"></hm-combobox>\n\n <ng-container footer>\n <hm-button emphasis=\"medium\" (clicked)=\"close()\">{{ text.cancel }}</hm-button>\n <hm-button [disabled]=\"!groupId\" [loading]=\"saving\" (clicked)=\"save()\">{{ text.create }}</hm-button>\n </ng-container>\n</hm-modal>\n", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: ButtonComponent, selector: "hm-button", inputs: ["emphasis", "intent", "size", "type", "icon", "iconDirection", "iconEnd", "disabled", "loading", "busy", "loadingState", "block", "link", "newTab", "caret", "inMenu", "toggle", "pressed"], outputs: ["loadingStateChange", "pressedChange", "clicked"] }, { kind: "component", type: ComboboxComponent, selector: "hm-combobox", inputs: ["label", "options", "value", "placeholder", "icon", "hint", "help", "size", "labelHidden", "clearable", "requiredManual", "loading", "allowCustomValue"], outputs: ["valueChange"] }, { kind: "component", type: ModalComponent, selector: "hm-modal", inputs: ["open", "heading", "size", "closeLabel", "closable", "beforeClose"], outputs: ["openChange", "closed"] }], changeDetection: i0.ChangeDetectionStrategy.Eager }); }
184
+ }
185
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.24", ngImport: i0, type: AutoServiceConsumerCreateComponent, decorators: [{
186
+ type: Component,
187
+ args: [{ selector: 'spine-auto-service-consumer-create', standalone: true, imports: [CommonModule, ButtonComponent, ComboboxComponent, ModalComponent], changeDetection: ChangeDetectionStrategy.Eager, template: "<hm-modal [open]=\"open\" (openChange)=\"onModalOpenChange($event)\" [heading]=\"text.newAccessHeading\" (closed)=\"close()\">\n <hm-combobox [label]=\"text.group\" [options]=\"groupOptions\" [value]=\"groupId\" (valueChange)=\"groupId = $event\"></hm-combobox>\n\n <ng-container footer>\n <hm-button emphasis=\"medium\" (clicked)=\"close()\">{{ text.cancel }}</hm-button>\n <hm-button [disabled]=\"!groupId\" [loading]=\"saving\" (clicked)=\"save()\">{{ text.create }}</hm-button>\n </ng-container>\n</hm-modal>\n" }]
188
+ }], ctorParameters: () => [{ type: AutoServiceService }], propDecorators: { clientId: [{
189
+ type: Input
190
+ }], appId: [{
191
+ type: Input
192
+ }], availableGroups: [{
193
+ type: Input
194
+ }], open: [{
195
+ type: Input
196
+ }], openChange: [{
197
+ type: Output
198
+ }], created: [{
199
+ type: Output
200
+ }] } });
201
+
202
+ class AutoServiceConsumerPermissionsComponent {
203
+ constructor(service) {
204
+ this.service = service;
205
+ this.text = inject(SPINE_MESSAGES).autoService;
206
+ /** Telas com estado em campo comum, preenchido depois de `await`: marca a view ao terminar (app sem zone.js). */
207
+ this.cdr = inject(ChangeDetectorRef);
208
+ this.fmt = formatMessage;
209
+ this.clientId = '';
210
+ this.appId = '';
211
+ this.consumer = null;
212
+ this.open = false;
213
+ this.openChange = new EventEmitter();
214
+ this.rows = [];
215
+ this.loading = false;
216
+ this.saving = false;
217
+ }
218
+ ngOnChanges(changes) { if (changes['open'] && this.open) {
219
+ this.reset();
220
+ } }
221
+ close() { this.open = false; this.openChange.emit(false); }
222
+ async reset() {
223
+ this.loading = true;
224
+ try {
225
+ const [opsRes, permsRes] = await Promise.all([
226
+ this.service.getAppOperations(this.clientId, this.appId),
227
+ this.service.getAppPermissions(this.clientId, this.consumer.consumer_id),
228
+ ]);
229
+ const operations = opsRes.operations ?? [];
230
+ const permissions = permsRes.permissions ?? [];
231
+ this.rows = operations.map((op) => {
232
+ const perm = permissions.find((p) => p.operation_id === op.operation_id);
233
+ return {
234
+ operation_id: op.operation_id, identifier: op.identifier, method: op.method, level: op.level,
235
+ description: op.description, permissionId: perm?.permission_id,
236
+ control: new FormControl(!!perm, { nonNullable: true }),
237
+ };
238
+ });
239
+ }
240
+ finally {
241
+ this.loading = false;
242
+ this.cdr.markForCheck();
243
+ }
244
+ }
245
+ get hasChanges() { return this.rows.some(r => r.control.value !== !!r.permissionId); }
246
+ async confirm() {
247
+ const toAdd = this.rows.filter(r => r.control.value && !r.permissionId);
248
+ const toRemove = this.rows.filter(r => !r.control.value && r.permissionId);
249
+ if (toAdd.length === 0 && toRemove.length === 0) {
250
+ this.close();
251
+ return;
252
+ }
253
+ this.saving = true;
254
+ try {
255
+ for (const r of toAdd) {
256
+ await this.service.addAppPermission(this.clientId, this.consumer.consumer_id, r.operation_id);
257
+ }
258
+ for (const r of toRemove) {
259
+ await this.service.removeAppPermission(this.clientId, this.consumer.consumer_id, r.permissionId);
260
+ }
261
+ this.close();
262
+ }
263
+ finally {
264
+ this.saving = false;
265
+ this.cdr.markForCheck();
266
+ }
267
+ }
268
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.24", ngImport: i0, type: AutoServiceConsumerPermissionsComponent, deps: [{ token: AutoServiceService }], target: i0.ɵɵFactoryTarget.Component }); }
269
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.24", type: AutoServiceConsumerPermissionsComponent, isStandalone: true, selector: "spine-auto-service-consumer-permissions", inputs: { clientId: "clientId", appId: "appId", consumer: "consumer", open: "open" }, outputs: { openChange: "openChange" }, usesOnChanges: true, ngImport: i0, template: "<hm-drawer [open]=\"open\" (openChange)=\"open = $event\" [heading]=\"fmt(text.operationsOf, { group: consumer?.group_name ?? '' })\" (closed)=\"close()\">\n <div *ngIf=\"loading\" class=\"loading-row\">{{ text.loading }}</div>\n\n <div class=\"op-list\" *ngIf=\"!loading\">\n <label class=\"op-row\" *ngFor=\"let row of rows\">\n <input type=\"checkbox\" class=\"hm-check\" [formControl]=\"row.control\" />\n <span class=\"op-row__body\">\n <code>{{ row.identifier }}</code>\n <hm-tag [name]=\"row.method\" />\n <hm-tag [name]=\"row.level\" />\n <span class=\"op-row__desc muted\" *ngIf=\"row.description\">{{ row.description }}</span>\n </span>\n </label>\n </div>\n\n <div class=\"empty-state\" *ngIf=\"!loading && rows.length === 0\">\n <hm-icon shape=\"filter-grid\" size=\"xl\"></hm-icon>\n <p>{{ text.noOperations }}</p>\n </div>\n\n <ng-container footer>\n <hm-button emphasis=\"medium\" (clicked)=\"close()\">{{ text.cancel }}</hm-button>\n <hm-button [disabled]=\"!hasChanges\" [loading]=\"saving\" (clicked)=\"confirm()\">{{ text.confirmChanges }}</hm-button>\n </ng-container>\n</hm-drawer>\n", styles: ["@charset \"UTF-8\";.as-stack{display:flex;flex-direction:column;gap:var(--hm-space-md);min-inline-size:0}.as-actions{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:var(--hm-space-xs)}.as-field-row{display:flex;flex-wrap:wrap;align-items:flex-end;gap:var(--hm-space-sm)}.as-field-row>:first-child{flex:1 1 20rem;min-inline-size:0}.as-summary{display:flex;flex-wrap:wrap;align-items:center;gap:var(--hm-space-sm)}.as-summary__info{display:flex;flex:1 1 16rem;flex-direction:column;gap:var(--hm-space-micro);min-inline-size:0}.as-summary__title{display:flex;flex-wrap:wrap;align-items:center;gap:var(--hm-space-xs);margin:0;color:var(--hm-text);font-size:var(--hm-font-size-md);font-weight:var(--hm-font-weight-semibold)}.as-summary__detail{margin:0;color:var(--hm-muted);font-size:var(--hm-font-size-sm)}.muted{color:var(--hm-muted)}.loading-row{display:flex;justify-content:center;padding:var(--hm-space-xl);color:var(--hm-muted)}.op-list{display:flex;flex-direction:column;gap:var(--hm-space-micro)}.op-row{display:flex;align-items:flex-start;gap:var(--hm-space-sm);padding:var(--hm-space-xs);border-radius:var(--hm-radius-control);cursor:pointer}.op-row:hover{background:var(--hm-hover)}.op-row input[type=checkbox]{margin-top:var(--hm-space-micro)}.op-row__body{display:flex;flex-wrap:wrap;align-items:center;gap:var(--hm-space-xs)}.op-row__desc{flex-basis:100%;font-size:var(--hm-font-size-xs)}.empty-state{display:flex;flex-direction:column;align-items:center;gap:var(--hm-space-xs);padding:var(--hm-space-xl);color:var(--hm-muted);text-align:center}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i3.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { kind: "directive", type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: ButtonComponent, selector: "hm-button", inputs: ["emphasis", "intent", "size", "type", "icon", "iconDirection", "iconEnd", "disabled", "loading", "busy", "loadingState", "block", "link", "newTab", "caret", "inMenu", "toggle", "pressed"], outputs: ["loadingStateChange", "pressedChange", "clicked"] }, { kind: "component", type: DrawerComponent, selector: "hm-drawer", inputs: ["open", "heading", "size", "position", "pinned", "closeLabel", "closable", "beforeClose"], outputs: ["openChange", "closed"] }, { kind: "component", type: IconComponent, selector: "hm-icon", inputs: ["shape", "direction", "size", "solid", "badge", "status", "flip", "inverse", "label"] }, { kind: "component", type: TagComponent, selector: "hm-tag", inputs: ["name", "color", "compact"] }], changeDetection: i0.ChangeDetectionStrategy.Eager }); }
270
+ }
271
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.24", ngImport: i0, type: AutoServiceConsumerPermissionsComponent, decorators: [{
272
+ type: Component,
273
+ args: [{ selector: 'spine-auto-service-consumer-permissions', standalone: true, imports: [CommonModule, ReactiveFormsModule, ButtonComponent, DrawerComponent, IconComponent, TagComponent], changeDetection: ChangeDetectionStrategy.Eager, template: "<hm-drawer [open]=\"open\" (openChange)=\"open = $event\" [heading]=\"fmt(text.operationsOf, { group: consumer?.group_name ?? '' })\" (closed)=\"close()\">\n <div *ngIf=\"loading\" class=\"loading-row\">{{ text.loading }}</div>\n\n <div class=\"op-list\" *ngIf=\"!loading\">\n <label class=\"op-row\" *ngFor=\"let row of rows\">\n <input type=\"checkbox\" class=\"hm-check\" [formControl]=\"row.control\" />\n <span class=\"op-row__body\">\n <code>{{ row.identifier }}</code>\n <hm-tag [name]=\"row.method\" />\n <hm-tag [name]=\"row.level\" />\n <span class=\"op-row__desc muted\" *ngIf=\"row.description\">{{ row.description }}</span>\n </span>\n </label>\n </div>\n\n <div class=\"empty-state\" *ngIf=\"!loading && rows.length === 0\">\n <hm-icon shape=\"filter-grid\" size=\"xl\"></hm-icon>\n <p>{{ text.noOperations }}</p>\n </div>\n\n <ng-container footer>\n <hm-button emphasis=\"medium\" (clicked)=\"close()\">{{ text.cancel }}</hm-button>\n <hm-button [disabled]=\"!hasChanges\" [loading]=\"saving\" (clicked)=\"confirm()\">{{ text.confirmChanges }}</hm-button>\n </ng-container>\n</hm-drawer>\n", styles: ["@charset \"UTF-8\";.as-stack{display:flex;flex-direction:column;gap:var(--hm-space-md);min-inline-size:0}.as-actions{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:var(--hm-space-xs)}.as-field-row{display:flex;flex-wrap:wrap;align-items:flex-end;gap:var(--hm-space-sm)}.as-field-row>:first-child{flex:1 1 20rem;min-inline-size:0}.as-summary{display:flex;flex-wrap:wrap;align-items:center;gap:var(--hm-space-sm)}.as-summary__info{display:flex;flex:1 1 16rem;flex-direction:column;gap:var(--hm-space-micro);min-inline-size:0}.as-summary__title{display:flex;flex-wrap:wrap;align-items:center;gap:var(--hm-space-xs);margin:0;color:var(--hm-text);font-size:var(--hm-font-size-md);font-weight:var(--hm-font-weight-semibold)}.as-summary__detail{margin:0;color:var(--hm-muted);font-size:var(--hm-font-size-sm)}.muted{color:var(--hm-muted)}.loading-row{display:flex;justify-content:center;padding:var(--hm-space-xl);color:var(--hm-muted)}.op-list{display:flex;flex-direction:column;gap:var(--hm-space-micro)}.op-row{display:flex;align-items:flex-start;gap:var(--hm-space-sm);padding:var(--hm-space-xs);border-radius:var(--hm-radius-control);cursor:pointer}.op-row:hover{background:var(--hm-hover)}.op-row input[type=checkbox]{margin-top:var(--hm-space-micro)}.op-row__body{display:flex;flex-wrap:wrap;align-items:center;gap:var(--hm-space-xs)}.op-row__desc{flex-basis:100%;font-size:var(--hm-font-size-xs)}.empty-state{display:flex;flex-direction:column;align-items:center;gap:var(--hm-space-xs);padding:var(--hm-space-xl);color:var(--hm-muted);text-align:center}\n"] }]
274
+ }], ctorParameters: () => [{ type: AutoServiceService }], propDecorators: { clientId: [{
275
+ type: Input
276
+ }], appId: [{
277
+ type: Input
278
+ }], consumer: [{
279
+ type: Input
280
+ }], open: [{
281
+ type: Input
282
+ }], openChange: [{
283
+ type: Output
284
+ }] } });
285
+
286
+ class AutoServiceAppAccessComponent {
287
+ constructor(service) {
288
+ this.service = service;
289
+ this.text = inject(SPINE_MESSAGES).autoService;
290
+ /** Telas com estado em campo comum, preenchido depois de `await`: marca a view ao terminar (app sem zone.js). */
291
+ this.cdr = inject(ChangeDetectorRef);
292
+ this.clientId = '';
293
+ this.appId = '';
294
+ this.entries = [];
295
+ this.availableGroups = [];
296
+ this.loading = false;
297
+ this.showCreate = false;
298
+ this.showPermissions = false;
299
+ this.activeConsumer = null;
300
+ this.rowId = (c) => c.consumer_id;
301
+ this.columns = computed(() => [
302
+ { key: 'group_name', title: this.text.colGroup, value: (c) => c.group_name, sortable: true },
303
+ { key: 'group_type_name', title: this.text.colType, value: (c) => c.group_type_name, sortable: true },
304
+ ], ...(ngDevMode ? [{ debugName: "columns" }] : /* istanbul ignore next */ []));
305
+ this.rowActions = computed(() => [
306
+ { id: 'permissions', icon: 'shield', label: this.text.manageOperations },
307
+ { id: 'delete', icon: 'trash', label: this.text.remove, danger: true, separatorAbove: true },
308
+ ], ...(ngDevMode ? [{ debugName: "rowActions" }] : /* istanbul ignore next */ []));
309
+ }
310
+ ngOnChanges(changes) {
311
+ if (changes['appId']) {
312
+ this.load();
313
+ }
314
+ if (changes['clientId']) {
315
+ this.loadGroups();
316
+ }
317
+ }
318
+ async load() {
319
+ if (!this.appId) {
320
+ this.entries = [];
321
+ return;
322
+ }
323
+ this.loading = true;
324
+ try {
325
+ const res = await this.service.getAppConsumers(this.clientId, this.appId);
326
+ this.entries = res.consumers;
327
+ }
328
+ finally {
329
+ this.loading = false;
330
+ this.cdr.markForCheck();
331
+ }
332
+ }
333
+ async loadGroups() {
334
+ if (!this.clientId) {
335
+ this.availableGroups = [];
336
+ return;
337
+ }
338
+ const res = await this.service.getGroups(this.clientId);
339
+ this.availableGroups = res.groups;
340
+ this.cdr.markForCheck();
341
+ }
342
+ openCreate() { this.showCreate = true; }
343
+ async onCreated() { await this.load(); }
344
+ async deleteConsumer(consumerId) { await this.service.deleteAppConsumer(this.clientId, consumerId); await this.load(); }
345
+ openPermissions(consumer) { this.activeConsumer = consumer; this.showPermissions = true; }
346
+ onAction(e) {
347
+ if (e.action === 'permissions')
348
+ this.openPermissions(e.row);
349
+ if (e.action === 'delete')
350
+ void this.deleteConsumer(e.row.consumer_id);
351
+ }
352
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.24", ngImport: i0, type: AutoServiceAppAccessComponent, deps: [{ token: AutoServiceService }], target: i0.ɵɵFactoryTarget.Component }); }
353
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.24", type: AutoServiceAppAccessComponent, isStandalone: true, selector: "spine-auto-service-app-access", inputs: { clientId: "clientId", appId: "appId" }, usesOnChanges: true, ngImport: i0, template: "<hm-data-grid\n [columns]=\"columns()\"\n [rows]=\"entries\"\n [rowId]=\"rowId\"\n [caption]=\"text.appAccessCaption\"\n [loading]=\"loading\"\n [rowActions]=\"rowActions()\"\n (actionTriggered)=\"onAction($event)\"\n [emptyMessage]=\"text.noAppAccess\"\n>\n <hm-button dataGridActions icon=\"plus\" (clicked)=\"openCreate()\">{{ text.newAccess }}</hm-button>\n</hm-data-grid>\n\n<spine-auto-service-consumer-create\n [clientId]=\"clientId\"\n [appId]=\"appId\"\n [availableGroups]=\"availableGroups\"\n [open]=\"showCreate\"\n (openChange)=\"showCreate = $event\"\n (created)=\"onCreated()\">\n</spine-auto-service-consumer-create>\n\n<spine-auto-service-consumer-permissions\n *ngIf=\"activeConsumer\"\n [clientId]=\"clientId\"\n [appId]=\"appId\"\n [consumer]=\"activeConsumer\"\n [open]=\"showPermissions\"\n (openChange)=\"showPermissions = $event\">\n</spine-auto-service-consumer-permissions>\n", styles: [".as-stack{display:flex;flex-direction:column;gap:var(--hm-space-md);min-inline-size:0}.as-actions{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:var(--hm-space-xs)}.as-field-row{display:flex;flex-wrap:wrap;align-items:flex-end;gap:var(--hm-space-sm)}.as-field-row>:first-child{flex:1 1 20rem;min-inline-size:0}.as-summary{display:flex;flex-wrap:wrap;align-items:center;gap:var(--hm-space-sm)}.as-summary__info{display:flex;flex:1 1 16rem;flex-direction:column;gap:var(--hm-space-micro);min-inline-size:0}.as-summary__title{display:flex;flex-wrap:wrap;align-items:center;gap:var(--hm-space-xs);margin:0;color:var(--hm-text);font-size:var(--hm-font-size-md);font-weight:var(--hm-font-weight-semibold)}.as-summary__detail{margin:0;color:var(--hm-muted);font-size:var(--hm-font-size-sm)}.muted{color:var(--hm-muted)}:host{display:block}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: ButtonComponent, selector: "hm-button", inputs: ["emphasis", "intent", "size", "type", "icon", "iconDirection", "iconEnd", "disabled", "loading", "busy", "loadingState", "block", "link", "newTab", "caret", "inMenu", "toggle", "pressed"], outputs: ["loadingStateChange", "pressedChange", "clicked"] }, { kind: "component", type: DataGridComponent, selector: "hm-data-grid", inputs: ["columns", "rows", "rowId", "caption", "rowActions", "loading", "error", "emptyMessage", "noResultsMessage", "filterable", "paginated", "pageState", "pagination", "totalItems", "sort", "selectable", "selectionMode", "selection", "rowSelectable", "rowSelectableReason", "rowDetailDisabled", "rowDetailHidden", "virtual", "rowHeight", "pinnedColumns", "columnState", "pageSizes", "fillHeight", "maxHeight", "bordered", "rowState", "rowClickable", "remoteSearch", "remoteSort", "itemsLabel", "pageSizeLabel", "exportable", "exportFileName", "groupBy", "aggregates", "aggregateFormatter", "persistKey", "persistStorage", "advancedFilter", "filterQuery", "columnManager", "columnOrder", "searchTerm"], outputs: ["pageStateChange", "sortChange", "selectionChange", "pinnedColumnsChange", "columnStateChange", "actionTriggered", "detailToggled", "rowClicked", "clearFiltersRequested", "filteredChange", "searchTermChanged", "groupByChange", "filterQueryChange", "columnOrderChange", "searchTermChange", "detailPaneToggled"] }, { kind: "component", type: AutoServiceConsumerCreateComponent, selector: "spine-auto-service-consumer-create", inputs: ["clientId", "appId", "availableGroups", "open"], outputs: ["openChange", "created"] }, { kind: "component", type: AutoServiceConsumerPermissionsComponent, selector: "spine-auto-service-consumer-permissions", inputs: ["clientId", "appId", "consumer", "open"], outputs: ["openChange"] }], changeDetection: i0.ChangeDetectionStrategy.Eager }); }
354
+ }
355
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.24", ngImport: i0, type: AutoServiceAppAccessComponent, decorators: [{
356
+ type: Component,
357
+ args: [{ selector: 'spine-auto-service-app-access', standalone: true, imports: [CommonModule, ButtonComponent, IconComponent, DataGridComponent, AutoServiceConsumerCreateComponent, AutoServiceConsumerPermissionsComponent], changeDetection: ChangeDetectionStrategy.Eager, template: "<hm-data-grid\n [columns]=\"columns()\"\n [rows]=\"entries\"\n [rowId]=\"rowId\"\n [caption]=\"text.appAccessCaption\"\n [loading]=\"loading\"\n [rowActions]=\"rowActions()\"\n (actionTriggered)=\"onAction($event)\"\n [emptyMessage]=\"text.noAppAccess\"\n>\n <hm-button dataGridActions icon=\"plus\" (clicked)=\"openCreate()\">{{ text.newAccess }}</hm-button>\n</hm-data-grid>\n\n<spine-auto-service-consumer-create\n [clientId]=\"clientId\"\n [appId]=\"appId\"\n [availableGroups]=\"availableGroups\"\n [open]=\"showCreate\"\n (openChange)=\"showCreate = $event\"\n (created)=\"onCreated()\">\n</spine-auto-service-consumer-create>\n\n<spine-auto-service-consumer-permissions\n *ngIf=\"activeConsumer\"\n [clientId]=\"clientId\"\n [appId]=\"appId\"\n [consumer]=\"activeConsumer\"\n [open]=\"showPermissions\"\n (openChange)=\"showPermissions = $event\">\n</spine-auto-service-consumer-permissions>\n", styles: [".as-stack{display:flex;flex-direction:column;gap:var(--hm-space-md);min-inline-size:0}.as-actions{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:var(--hm-space-xs)}.as-field-row{display:flex;flex-wrap:wrap;align-items:flex-end;gap:var(--hm-space-sm)}.as-field-row>:first-child{flex:1 1 20rem;min-inline-size:0}.as-summary{display:flex;flex-wrap:wrap;align-items:center;gap:var(--hm-space-sm)}.as-summary__info{display:flex;flex:1 1 16rem;flex-direction:column;gap:var(--hm-space-micro);min-inline-size:0}.as-summary__title{display:flex;flex-wrap:wrap;align-items:center;gap:var(--hm-space-xs);margin:0;color:var(--hm-text);font-size:var(--hm-font-size-md);font-weight:var(--hm-font-weight-semibold)}.as-summary__detail{margin:0;color:var(--hm-muted);font-size:var(--hm-font-size-sm)}.muted{color:var(--hm-muted)}:host{display:block}\n"] }]
358
+ }], ctorParameters: () => [{ type: AutoServiceService }], propDecorators: { clientId: [{
359
+ type: Input
360
+ }], appId: [{
361
+ type: Input
362
+ }] } });
363
+
364
+ class AutoServiceAppsComponent {
365
+ constructor(service) {
366
+ this.service = service;
367
+ this.text = inject(SPINE_MESSAGES).autoService;
368
+ /** Telas com estado em campo comum, preenchido depois de `await`: marca a view ao terminar (app sem zone.js). */
369
+ this.cdr = inject(ChangeDetectorRef);
370
+ this.clientId = '';
371
+ this.loadingOptions = false;
372
+ this.appOptions = [];
373
+ this.selectedAppId = '';
374
+ this.app = null;
375
+ this.searchingApp = false;
376
+ this.modalApp = null;
377
+ this.showAppModal = false;
378
+ this.activeTab = 'operations';
379
+ this.newSecret = null;
380
+ }
381
+ get appComboOptions() {
382
+ return this.appOptions.map((a) => ({ value: a.id, label: a.name }));
383
+ }
384
+ ngOnChanges(changes) { if (changes['clientId']) {
385
+ this.selectedAppId = '';
386
+ this.app = null;
387
+ this.loadAppOptions();
388
+ } }
389
+ async loadAppOptions() {
390
+ if (!this.clientId) {
391
+ this.appOptions = [];
392
+ return;
393
+ }
394
+ this.loadingOptions = true;
395
+ try {
396
+ const res = await this.service.getApps(this.clientId);
397
+ this.appOptions = res.apps;
398
+ }
399
+ finally {
400
+ this.loadingOptions = false;
401
+ this.cdr.markForCheck();
402
+ }
403
+ }
404
+ async searchApp() {
405
+ if (!this.selectedAppId)
406
+ return;
407
+ this.searchingApp = true;
408
+ try {
409
+ this.app = this.appOptions.find(a => a.id === this.selectedAppId) ?? null;
410
+ this.activeTab = 'operations';
411
+ }
412
+ finally {
413
+ this.searchingApp = false;
414
+ this.cdr.markForCheck();
415
+ }
416
+ }
417
+ setTab(tab) { this.activeTab = tab; }
418
+ openCreate() { this.modalApp = null; this.showAppModal = true; }
419
+ openEdit() { this.modalApp = this.app; this.showAppModal = true; }
420
+ async onAppSaved(secret) {
421
+ if (secret)
422
+ this.newSecret = secret;
423
+ await this.loadAppOptions();
424
+ if (this.app?.id) {
425
+ this.app = this.appOptions.find(a => a.id === this.app.id) ?? this.app;
426
+ }
427
+ this.cdr.markForCheck();
428
+ }
429
+ async toggleEnabled() {
430
+ if (!this.app)
431
+ return;
432
+ await this.service.updateApp(this.clientId, this.app.id, { enabled: !this.app.enabled });
433
+ await this.loadAppOptions();
434
+ this.app = this.appOptions.find(a => a.id === this.app.id) ?? this.app;
435
+ this.cdr.markForCheck();
436
+ }
437
+ async deleteApp() {
438
+ if (!this.app)
439
+ return;
440
+ await this.service.deleteApp(this.clientId, this.app.id);
441
+ this.app = null;
442
+ this.selectedAppId = '';
443
+ await this.loadAppOptions();
444
+ }
445
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.24", ngImport: i0, type: AutoServiceAppsComponent, deps: [{ token: AutoServiceService }], target: i0.ɵɵFactoryTarget.Component }); }
446
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.24", type: AutoServiceAppsComponent, isStandalone: true, selector: "spine-auto-service-apps", inputs: { clientId: "clientId" }, usesOnChanges: true, ngImport: i0, template: "<div class=\"as-stack\">\n <div class=\"as-actions\">\n <hm-button icon=\"plus\" (clicked)=\"openCreate()\">{{ text.register }}</hm-button>\n </div>\n\n <hm-alert *ngIf=\"newSecret\" variant=\"success\" [closable]=\"true\" (closed)=\"newSecret = null\">\n {{ text.secretCreated }} <strong>{{ newSecret }}</strong>\n </hm-alert>\n\n <hm-card>\n <div class=\"as-field-row\">\n <hm-combobox [label]=\"text.pickApp\" [options]=\"appComboOptions\"\n [value]=\"selectedAppId\" (valueChange)=\"selectedAppId = $event\" [disabled]=\"loadingOptions\">\n </hm-combobox>\n <hm-button [disabled]=\"!selectedAppId || searchingApp\" (clicked)=\"searchApp()\" icon=\"search\">{{ text.search }}</hm-button>\n </div>\n </hm-card>\n\n <ng-container *ngIf=\"app\">\n <hm-card>\n <div class=\"as-summary\">\n <div class=\"as-summary__info\">\n <p class=\"as-summary__title\">\n {{ app.name }}\n <hm-tag [name]=\"app.enabled ? text.active : text.inactive\" [color]=\"app.enabled ? 'success' : 'danger'\" />\n </p>\n <p class=\"as-summary__detail\">{{ app.allowed_grants?.join(', ') }}</p>\n </div>\n <div class=\"as-actions\">\n <hm-button emphasis=\"medium\" icon=\"pencil\" (clicked)=\"openEdit()\">{{ text.edit }}</hm-button>\n <hm-button emphasis=\"medium\" (clicked)=\"toggleEnabled()\">{{ app.enabled ? text.disable : text.enable }}</hm-button>\n <hm-button intent=\"danger\" emphasis=\"medium\" icon=\"trash\" (clicked)=\"deleteApp()\">{{ text.delete }}</hm-button>\n </div>\n </div>\n </hm-card>\n\n <!-- Conte\u00FAdo de cada aba \u00E9 pregui\u00E7oso (*hmTabContent): s\u00F3 busca na API quando a aba \u00E9 aberta. -->\n <hm-tabs [label]=\"text.appSections\" [active]=\"activeTab\" (activeChange)=\"setTab($any($event))\">\n <hm-tab id=\"operations\" [label]=\"text.tabOperations\">\n <spine-auto-service-app-operations *hmTabContent [clientId]=\"clientId\" [appId]=\"app.id\"></spine-auto-service-app-operations>\n </hm-tab>\n <hm-tab id=\"access\" [label]=\"text.tabAccesses\">\n <spine-auto-service-app-access *hmTabContent [clientId]=\"clientId\" [appId]=\"app.id\"></spine-auto-service-app-access>\n </hm-tab>\n </hm-tabs>\n </ng-container>\n</div>\n\n<spine-auto-service-apps-modal\n [app]=\"modalApp\"\n [clientId]=\"clientId\"\n [open]=\"showAppModal\"\n (openChange)=\"showAppModal = $event\"\n (saved)=\"onAppSaved($event)\">\n</spine-auto-service-apps-modal>\n", styles: [".as-stack{display:flex;flex-direction:column;gap:var(--hm-space-md);min-inline-size:0}.as-actions{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:var(--hm-space-xs)}.as-field-row{display:flex;flex-wrap:wrap;align-items:flex-end;gap:var(--hm-space-sm)}.as-field-row>:first-child{flex:1 1 20rem;min-inline-size:0}.as-summary{display:flex;flex-wrap:wrap;align-items:center;gap:var(--hm-space-sm)}.as-summary__info{display:flex;flex:1 1 16rem;flex-direction:column;gap:var(--hm-space-micro);min-inline-size:0}.as-summary__title{display:flex;flex-wrap:wrap;align-items:center;gap:var(--hm-space-xs);margin:0;color:var(--hm-text);font-size:var(--hm-font-size-md);font-weight:var(--hm-font-weight-semibold)}.as-summary__detail{margin:0;color:var(--hm-muted);font-size:var(--hm-font-size-sm)}.muted{color:var(--hm-muted)}:host{display:block}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: FormsModule }, { kind: "component", type: AlertComponent, selector: "hm-alert", inputs: ["variant", "appearance", "heading", "closable", "size", "showIcon", "link", "linkLabel", "linkTarget", "dismissKey", "duration"], outputs: ["closed"] }, { kind: "component", type: ButtonComponent, selector: "hm-button", inputs: ["emphasis", "intent", "size", "type", "icon", "iconDirection", "iconEnd", "disabled", "loading", "busy", "loadingState", "block", "link", "newTab", "caret", "inMenu", "toggle", "pressed"], outputs: ["loadingStateChange", "pressedChange", "clicked"] }, { kind: "component", type: CardComponent, selector: "hm-card", inputs: ["heading", "icon", "selected", "fill", "media", "mediaAlt", "mediaDecorative", "mediaPosition"] }, { kind: "component", type: ComboboxComponent, selector: "hm-combobox", inputs: ["label", "options", "value", "placeholder", "icon", "hint", "help", "size", "labelHidden", "clearable", "requiredManual", "loading", "allowCustomValue"], outputs: ["valueChange"] }, { kind: "component", type: TabsComponent, selector: "hm-tabs", inputs: ["label", "active", "orientation", "mode", "overflow", "fillHeight", "noPanelGap"], outputs: ["activeChange"] }, { kind: "component", type: TabComponent, selector: "hm-tab", inputs: ["id", "label", "disabled", "count", "route", "exact", "destroyOnHide"] }, { kind: "directive", type: TabContentDirective, selector: "ng-template[hmTabContent]" }, { kind: "component", type: TagComponent, selector: "hm-tag", inputs: ["name", "color", "compact"] }, { kind: "component", type: AutoServiceAppsModalComponent, selector: "spine-auto-service-apps-modal", inputs: ["app", "clientId", "open"], outputs: ["openChange", "saved"] }, { kind: "component", type: AutoServiceAppOperationsComponent, selector: "spine-auto-service-app-operations", inputs: ["clientId", "appId"] }, { kind: "component", type: AutoServiceAppAccessComponent, selector: "spine-auto-service-app-access", inputs: ["clientId", "appId"] }], changeDetection: i0.ChangeDetectionStrategy.Eager }); }
447
+ }
448
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.24", ngImport: i0, type: AutoServiceAppsComponent, decorators: [{
449
+ type: Component,
450
+ args: [{ selector: 'spine-auto-service-apps', standalone: true, imports: [
451
+ CommonModule, FormsModule, AlertComponent, ButtonComponent, CardComponent, ComboboxComponent, TabsComponent, TabComponent,
452
+ TabContentDirective, TagComponent,
453
+ AutoServiceAppsModalComponent, AutoServiceAppOperationsComponent, AutoServiceAppAccessComponent,
454
+ ], changeDetection: ChangeDetectionStrategy.Eager, template: "<div class=\"as-stack\">\n <div class=\"as-actions\">\n <hm-button icon=\"plus\" (clicked)=\"openCreate()\">{{ text.register }}</hm-button>\n </div>\n\n <hm-alert *ngIf=\"newSecret\" variant=\"success\" [closable]=\"true\" (closed)=\"newSecret = null\">\n {{ text.secretCreated }} <strong>{{ newSecret }}</strong>\n </hm-alert>\n\n <hm-card>\n <div class=\"as-field-row\">\n <hm-combobox [label]=\"text.pickApp\" [options]=\"appComboOptions\"\n [value]=\"selectedAppId\" (valueChange)=\"selectedAppId = $event\" [disabled]=\"loadingOptions\">\n </hm-combobox>\n <hm-button [disabled]=\"!selectedAppId || searchingApp\" (clicked)=\"searchApp()\" icon=\"search\">{{ text.search }}</hm-button>\n </div>\n </hm-card>\n\n <ng-container *ngIf=\"app\">\n <hm-card>\n <div class=\"as-summary\">\n <div class=\"as-summary__info\">\n <p class=\"as-summary__title\">\n {{ app.name }}\n <hm-tag [name]=\"app.enabled ? text.active : text.inactive\" [color]=\"app.enabled ? 'success' : 'danger'\" />\n </p>\n <p class=\"as-summary__detail\">{{ app.allowed_grants?.join(', ') }}</p>\n </div>\n <div class=\"as-actions\">\n <hm-button emphasis=\"medium\" icon=\"pencil\" (clicked)=\"openEdit()\">{{ text.edit }}</hm-button>\n <hm-button emphasis=\"medium\" (clicked)=\"toggleEnabled()\">{{ app.enabled ? text.disable : text.enable }}</hm-button>\n <hm-button intent=\"danger\" emphasis=\"medium\" icon=\"trash\" (clicked)=\"deleteApp()\">{{ text.delete }}</hm-button>\n </div>\n </div>\n </hm-card>\n\n <!-- Conte\u00FAdo de cada aba \u00E9 pregui\u00E7oso (*hmTabContent): s\u00F3 busca na API quando a aba \u00E9 aberta. -->\n <hm-tabs [label]=\"text.appSections\" [active]=\"activeTab\" (activeChange)=\"setTab($any($event))\">\n <hm-tab id=\"operations\" [label]=\"text.tabOperations\">\n <spine-auto-service-app-operations *hmTabContent [clientId]=\"clientId\" [appId]=\"app.id\"></spine-auto-service-app-operations>\n </hm-tab>\n <hm-tab id=\"access\" [label]=\"text.tabAccesses\">\n <spine-auto-service-app-access *hmTabContent [clientId]=\"clientId\" [appId]=\"app.id\"></spine-auto-service-app-access>\n </hm-tab>\n </hm-tabs>\n </ng-container>\n</div>\n\n<spine-auto-service-apps-modal\n [app]=\"modalApp\"\n [clientId]=\"clientId\"\n [open]=\"showAppModal\"\n (openChange)=\"showAppModal = $event\"\n (saved)=\"onAppSaved($event)\">\n</spine-auto-service-apps-modal>\n", styles: [".as-stack{display:flex;flex-direction:column;gap:var(--hm-space-md);min-inline-size:0}.as-actions{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:var(--hm-space-xs)}.as-field-row{display:flex;flex-wrap:wrap;align-items:flex-end;gap:var(--hm-space-sm)}.as-field-row>:first-child{flex:1 1 20rem;min-inline-size:0}.as-summary{display:flex;flex-wrap:wrap;align-items:center;gap:var(--hm-space-sm)}.as-summary__info{display:flex;flex:1 1 16rem;flex-direction:column;gap:var(--hm-space-micro);min-inline-size:0}.as-summary__title{display:flex;flex-wrap:wrap;align-items:center;gap:var(--hm-space-xs);margin:0;color:var(--hm-text);font-size:var(--hm-font-size-md);font-weight:var(--hm-font-weight-semibold)}.as-summary__detail{margin:0;color:var(--hm-muted);font-size:var(--hm-font-size-sm)}.muted{color:var(--hm-muted)}:host{display:block}\n"] }]
455
+ }], ctorParameters: () => [{ type: AutoServiceService }], propDecorators: { clientId: [{
456
+ type: Input
457
+ }] } });
458
+
459
+ /**
460
+ * Página "Aplicações" do auto-serviço: o seletor de client e as aplicações dele. A auditoria tem página
461
+ * própria no menu Administração (`AUTO_SERVICE_SCREENS.audit`) — a aba que existia aqui duplicava a tela.
462
+ */
463
+ class AutoServiceComponent {
464
+ constructor() {
465
+ this.client = null;
466
+ }
467
+ onClientChange(c) { this.client = c; }
468
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.24", ngImport: i0, type: AutoServiceComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
469
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.24", type: AutoServiceComponent, isStandalone: true, selector: "spine-auto-service", ngImport: i0, template: "<!-- T\u00EDtulo e descri\u00E7\u00E3o da tela v\u00EAm da barra da p\u00E1gina (nome + description do router). -->\n<div class=\"as-stack\">\n <spine-auto-service-client-picker (clientChange)=\"onClientChange($event)\"></spine-auto-service-client-picker>\n <spine-auto-service-apps *ngIf=\"client as c\" [clientId]=\"c.id\"></spine-auto-service-apps>\n</div>\n", styles: [".as-stack{display:flex;flex-direction:column;gap:var(--hm-space-md);min-inline-size:0}.as-actions{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:var(--hm-space-xs)}.as-field-row{display:flex;flex-wrap:wrap;align-items:flex-end;gap:var(--hm-space-sm)}.as-field-row>:first-child{flex:1 1 20rem;min-inline-size:0}.as-summary{display:flex;flex-wrap:wrap;align-items:center;gap:var(--hm-space-sm)}.as-summary__info{display:flex;flex:1 1 16rem;flex-direction:column;gap:var(--hm-space-micro);min-inline-size:0}.as-summary__title{display:flex;flex-wrap:wrap;align-items:center;gap:var(--hm-space-xs);margin:0;color:var(--hm-text);font-size:var(--hm-font-size-md);font-weight:var(--hm-font-weight-semibold)}.as-summary__detail{margin:0;color:var(--hm-muted);font-size:var(--hm-font-size-sm)}.muted{color:var(--hm-muted)}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: AutoServiceClientPickerComponent, selector: "spine-auto-service-client-picker", outputs: ["clientChange"] }, { kind: "component", type: AutoServiceAppsComponent, selector: "spine-auto-service-apps", inputs: ["clientId"] }], changeDetection: i0.ChangeDetectionStrategy.Eager }); }
470
+ }
471
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.24", ngImport: i0, type: AutoServiceComponent, decorators: [{
472
+ type: Component,
473
+ args: [{ selector: 'spine-auto-service', standalone: true, imports: [CommonModule, AutoServiceClientPickerComponent, AutoServiceAppsComponent], changeDetection: ChangeDetectionStrategy.Eager, template: "<!-- T\u00EDtulo e descri\u00E7\u00E3o da tela v\u00EAm da barra da p\u00E1gina (nome + description do router). -->\n<div class=\"as-stack\">\n <spine-auto-service-client-picker (clientChange)=\"onClientChange($event)\"></spine-auto-service-client-picker>\n <spine-auto-service-apps *ngIf=\"client as c\" [clientId]=\"c.id\"></spine-auto-service-apps>\n</div>\n", styles: [".as-stack{display:flex;flex-direction:column;gap:var(--hm-space-md);min-inline-size:0}.as-actions{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:var(--hm-space-xs)}.as-field-row{display:flex;flex-wrap:wrap;align-items:flex-end;gap:var(--hm-space-sm)}.as-field-row>:first-child{flex:1 1 20rem;min-inline-size:0}.as-summary{display:flex;flex-wrap:wrap;align-items:center;gap:var(--hm-space-sm)}.as-summary__info{display:flex;flex:1 1 16rem;flex-direction:column;gap:var(--hm-space-micro);min-inline-size:0}.as-summary__title{display:flex;flex-wrap:wrap;align-items:center;gap:var(--hm-space-xs);margin:0;color:var(--hm-text);font-size:var(--hm-font-size-md);font-weight:var(--hm-font-weight-semibold)}.as-summary__detail{margin:0;color:var(--hm-muted);font-size:var(--hm-font-size-sm)}.muted{color:var(--hm-muted)}\n"] }]
474
+ }] });
475
+
476
+ export { AutoServiceComponent };
477
+ //# sourceMappingURL=trismegisto-spine-auto-service-auto-service.component-B5tyJ2zY.mjs.map