@trismegisto/spine 2.1.2 → 3.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 (78) hide show
  1. package/README.md +74 -17
  2. package/fesm2022/trismegisto-spine-audit.mjs +264 -10
  3. package/fesm2022/trismegisto-spine-audit.mjs.map +1 -1
  4. package/fesm2022/trismegisto-spine-auto-service-apps.technical-BAKdkVdz.mjs +84 -0
  5. package/fesm2022/trismegisto-spine-auto-service-apps.technical-BAKdkVdz.mjs.map +1 -0
  6. package/fesm2022/trismegisto-spine-auto-service-apps.usage-CAXMP5r8.mjs +87 -0
  7. package/fesm2022/trismegisto-spine-auto-service-apps.usage-CAXMP5r8.mjs.map +1 -0
  8. package/fesm2022/{trismegisto-spine-auto-service-audit.technical-C901aIIQ.mjs → trismegisto-spine-auto-service-audit.technical-B75d4mh2.mjs} +6 -5
  9. package/fesm2022/trismegisto-spine-auto-service-audit.technical-B75d4mh2.mjs.map +1 -0
  10. package/fesm2022/{trismegisto-spine-auto-service-audit.usage-GIJ2RwuH.mjs → trismegisto-spine-auto-service-audit.usage-IdXMruv5.mjs} +9 -8
  11. package/fesm2022/trismegisto-spine-auto-service-audit.usage-IdXMruv5.mjs.map +1 -0
  12. package/fesm2022/{trismegisto-spine-auto-service-auto-service-audit.component-CCiz-q8o.mjs → trismegisto-spine-auto-service-auto-service-audit.component-BIL8tH1I.mjs} +4 -4
  13. package/fesm2022/{trismegisto-spine-auto-service-auto-service-audit.component-CCiz-q8o.mjs.map → trismegisto-spine-auto-service-auto-service-audit.component-BIL8tH1I.mjs.map} +1 -1
  14. package/fesm2022/{trismegisto-spine-auto-service-auto-service-client-picker.component-Z0wCANF6.mjs → trismegisto-spine-auto-service-auto-service-client-picker.component-CBt_0Uli.mjs} +3 -3
  15. package/fesm2022/{trismegisto-spine-auto-service-auto-service-client-picker.component-Z0wCANF6.mjs.map → trismegisto-spine-auto-service-auto-service-client-picker.component-CBt_0Uli.mjs.map} +1 -1
  16. package/fesm2022/{trismegisto-spine-auto-service-auto-service-client.component-C7SPavrX.mjs → trismegisto-spine-auto-service-auto-service-client.component-DAxhZC-a.mjs} +123 -27
  17. package/fesm2022/trismegisto-spine-auto-service-auto-service-client.component-DAxhZC-a.mjs.map +1 -0
  18. package/fesm2022/trismegisto-spine-auto-service-auto-service-delete-CoJYTtBU.mjs +87 -0
  19. package/fesm2022/trismegisto-spine-auto-service-auto-service-delete-CoJYTtBU.mjs.map +1 -0
  20. package/fesm2022/trismegisto-spine-auto-service-auto-service-groups.component-UVMGF7-B.mjs +544 -0
  21. package/fesm2022/trismegisto-spine-auto-service-auto-service-groups.component-UVMGF7-B.mjs.map +1 -0
  22. package/fesm2022/trismegisto-spine-auto-service-auto-service-login-attempts.component-Boi-kG0G.mjs +37 -0
  23. package/fesm2022/trismegisto-spine-auto-service-auto-service-login-attempts.component-Boi-kG0G.mjs.map +1 -0
  24. package/fesm2022/trismegisto-spine-auto-service-auto-service.component-DmLafUkX.mjs +943 -0
  25. package/fesm2022/trismegisto-spine-auto-service-auto-service.component-DmLafUkX.mjs.map +1 -0
  26. package/fesm2022/{trismegisto-spine-auto-service-client.technical-BHWhpyWv.mjs → trismegisto-spine-auto-service-client.technical-DP5G8i3o.mjs} +24 -3
  27. package/fesm2022/trismegisto-spine-auto-service-client.technical-DP5G8i3o.mjs.map +1 -0
  28. package/fesm2022/{trismegisto-spine-auto-service-client.usage-CM2WB2e2.mjs → trismegisto-spine-auto-service-client.usage-CcJANb20.mjs} +15 -6
  29. package/fesm2022/trismegisto-spine-auto-service-client.usage-CcJANb20.mjs.map +1 -0
  30. package/fesm2022/trismegisto-spine-auto-service-groups.technical-BlktCM70.mjs +65 -0
  31. package/fesm2022/trismegisto-spine-auto-service-groups.technical-BlktCM70.mjs.map +1 -0
  32. package/fesm2022/trismegisto-spine-auto-service-groups.usage-Cz5sCKgn.mjs +81 -0
  33. package/fesm2022/trismegisto-spine-auto-service-groups.usage-Cz5sCKgn.mjs.map +1 -0
  34. package/fesm2022/{trismegisto-spine-auto-service-home.component-vl3BPFnk.mjs → trismegisto-spine-auto-service-home.component-5_aji1hf.mjs} +5 -4
  35. package/fesm2022/trismegisto-spine-auto-service-home.component-5_aji1hf.mjs.map +1 -0
  36. package/fesm2022/trismegisto-spine-auto-service-login-attempts.technical-CasKIIws.mjs +37 -0
  37. package/fesm2022/trismegisto-spine-auto-service-login-attempts.technical-CasKIIws.mjs.map +1 -0
  38. package/fesm2022/trismegisto-spine-auto-service-login-attempts.usage-BMgLNu7W.mjs +60 -0
  39. package/fesm2022/trismegisto-spine-auto-service-login-attempts.usage-BMgLNu7W.mjs.map +1 -0
  40. package/fesm2022/trismegisto-spine-auto-service.mjs +49 -29
  41. package/fesm2022/trismegisto-spine-auto-service.mjs.map +1 -1
  42. package/fesm2022/trismegisto-spine-layout.mjs +1698 -156
  43. package/fesm2022/trismegisto-spine-layout.mjs.map +1 -1
  44. package/fesm2022/trismegisto-spine-shell.mjs +17 -1
  45. package/fesm2022/trismegisto-spine-shell.mjs.map +1 -1
  46. package/fesm2022/trismegisto-spine.mjs +1157 -85
  47. package/fesm2022/trismegisto-spine.mjs.map +1 -1
  48. package/package.json +6 -6
  49. package/types/trismegisto-spine-audit.d.ts +180 -5
  50. package/types/trismegisto-spine-audit.d.ts.map +1 -1
  51. package/types/trismegisto-spine-auto-service.d.ts +100 -7
  52. package/types/trismegisto-spine-auto-service.d.ts.map +1 -1
  53. package/types/trismegisto-spine-layout.d.ts +833 -13
  54. package/types/trismegisto-spine-layout.d.ts.map +1 -1
  55. package/types/trismegisto-spine-shell.d.ts +8 -0
  56. package/types/trismegisto-spine-shell.d.ts.map +1 -1
  57. package/types/trismegisto-spine.d.ts +491 -32
  58. package/types/trismegisto-spine.d.ts.map +1 -1
  59. package/fesm2022/trismegisto-spine-auto-service-apps.technical-ClMKB9cK.mjs +0 -48
  60. package/fesm2022/trismegisto-spine-auto-service-apps.technical-ClMKB9cK.mjs.map +0 -1
  61. package/fesm2022/trismegisto-spine-auto-service-apps.usage-Cf5SG-oQ.mjs +0 -55
  62. package/fesm2022/trismegisto-spine-auto-service-apps.usage-Cf5SG-oQ.mjs.map +0 -1
  63. package/fesm2022/trismegisto-spine-auto-service-audit.technical-C901aIIQ.mjs.map +0 -1
  64. package/fesm2022/trismegisto-spine-auto-service-audit.usage-GIJ2RwuH.mjs.map +0 -1
  65. package/fesm2022/trismegisto-spine-auto-service-auto-service-client.component-C7SPavrX.mjs.map +0 -1
  66. package/fesm2022/trismegisto-spine-auto-service-auto-service-delete-6Bk46MOf.mjs +0 -39
  67. package/fesm2022/trismegisto-spine-auto-service-auto-service-delete-6Bk46MOf.mjs.map +0 -1
  68. package/fesm2022/trismegisto-spine-auto-service-auto-service-groups.component-CqIVe2LU.mjs +0 -357
  69. package/fesm2022/trismegisto-spine-auto-service-auto-service-groups.component-CqIVe2LU.mjs.map +0 -1
  70. package/fesm2022/trismegisto-spine-auto-service-auto-service.component-BLN49F4a.mjs +0 -502
  71. package/fesm2022/trismegisto-spine-auto-service-auto-service.component-BLN49F4a.mjs.map +0 -1
  72. package/fesm2022/trismegisto-spine-auto-service-client.technical-BHWhpyWv.mjs.map +0 -1
  73. package/fesm2022/trismegisto-spine-auto-service-client.usage-CM2WB2e2.mjs.map +0 -1
  74. package/fesm2022/trismegisto-spine-auto-service-groups.technical-jQlwaQPn.mjs +0 -39
  75. package/fesm2022/trismegisto-spine-auto-service-groups.technical-jQlwaQPn.mjs.map +0 -1
  76. package/fesm2022/trismegisto-spine-auto-service-groups.usage-Bh7ig2zZ.mjs +0 -54
  77. package/fesm2022/trismegisto-spine-auto-service-groups.usage-Bh7ig2zZ.mjs.map +0 -1
  78. package/fesm2022/trismegisto-spine-auto-service-home.component-vl3BPFnk.mjs.map +0 -1
@@ -0,0 +1,544 @@
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 { AlertComponent, ButtonComponent, CheckboxComponent, ComboboxComponent, InputComponent, ModalComponent, TextareaComponent, TagComponent, AccountAvatarComponent, DataGridComponent, DataGridCellDirective, EMPTY_SELECTION, BadgeComponent, CardComponent, DividerComponent, IconButtonComponent, IconComponent, SelectComponent, HermesDialogService } from '@trismegisto/angular';
6
+ import { formatMessage } from '@trismegisto/primitives';
7
+ import { SPINE_MESSAGES } from '@trismegisto/spine';
8
+ import { a as autoServiceErrorText, A as AutoServiceDeleteFeedback } from './trismegisto-spine-auto-service-auto-service-delete-CoJYTtBU.mjs';
9
+ import { AutoServiceService } from './trismegisto-spine-auto-service.mjs';
10
+ import { A as AutoServiceClientPickerComponent } from './trismegisto-spine-auto-service-auto-service-client-picker.component-CBt_0Uli.mjs';
11
+ import * as i3 from '@angular/forms';
12
+ import { FormControl, Validators, ReactiveFormsModule, FormsModule } from '@angular/forms';
13
+
14
+ /** Limite do nome no servidor (1–100). */
15
+ const GROUP_NAME_MAX = 100;
16
+ /**
17
+ * Criar/editar grupo do projeto do client. Só os tipos `assignable` são oferecidos (o Administrador nunca é: é do grupo
18
+ * de administração, que é gerido só no painel central e não aparece no auto-serviço). Falha do servidor aparece no próprio modal, no idioma ativo.
19
+ * Mirror de admin/ui/.../groups/modals/groups-modal (argos-admin), sem o seletor de projeto.
20
+ */
21
+ class AutoServiceGroupModalComponent {
22
+ constructor() {
23
+ this.text = inject(SPINE_MESSAGES).autoService;
24
+ /** Telas com estado em campo comum, preenchido depois de `await`: marca a view ao terminar (app sem zone.js). */
25
+ this.cdr = inject(ChangeDetectorRef);
26
+ this.service = inject(AutoServiceService);
27
+ /** Grupo em edição; `null` cria. */
28
+ this.group = null;
29
+ this.clientId = '';
30
+ this.groupTypes = [];
31
+ this.open = false;
32
+ this.openChange = new EventEmitter();
33
+ /** O grupo gravado (o servidor devolve o grupo criado/alterado). */
34
+ this.saved = new EventEmitter();
35
+ this.nameMax = GROUP_NAME_MAX;
36
+ this.name = new FormControl('', { nonNullable: true, validators: [Validators.required, Validators.maxLength(GROUP_NAME_MAX)] });
37
+ this.typeId = new FormControl('', { nonNullable: true, validators: [Validators.required] });
38
+ this.description = new FormControl('', { nonNullable: true });
39
+ this.enabled = new FormControl(true, { nonNullable: true });
40
+ this.saving = false;
41
+ this.saveError = null;
42
+ /** Tipos que dá para escolher (`assignable`; o Administrador nunca). */
43
+ this.typeOptions = [];
44
+ }
45
+ get isEdit() { return !!this.group?.id; }
46
+ get canSave() {
47
+ if (this.saving)
48
+ return false;
49
+ return this.name.valid && !!this.name.value.trim() && this.typeId.valid;
50
+ }
51
+ ngOnChanges(changes) {
52
+ if (changes['groupTypes'] || changes['group']) {
53
+ this.typeOptions = this.groupTypes
54
+ .filter((t) => t.assignable !== false)
55
+ .map((t) => ({ value: t.id, label: t.name }));
56
+ }
57
+ if (changes['open'] && this.open)
58
+ this.resetForm();
59
+ }
60
+ resetForm() {
61
+ const g = this.isEdit ? this.group : null;
62
+ this.saveError = null;
63
+ this.name.reset(g?.name ?? '');
64
+ this.typeId.reset(g?.type?.id ?? '');
65
+ this.description.reset(g?.description ?? '');
66
+ this.enabled.reset(g ? !!g.enabled : true);
67
+ }
68
+ onModalOpenChange(value) { this.open = value; this.openChange.emit(value); }
69
+ close() { this.onModalOpenChange(false); }
70
+ async save() {
71
+ if (!this.canSave)
72
+ return;
73
+ this.saving = true;
74
+ this.saveError = null;
75
+ this.cdr.markForCheck();
76
+ // Descrição vazia vai como null na edição: o servidor só ignora campo ausente, e é assim que se apaga a descrição.
77
+ const description = this.description.value.trim();
78
+ try {
79
+ let saved;
80
+ if (this.isEdit && this.group) {
81
+ saved = await this.service.updateGroup(this.clientId, this.group.id, { name: this.name.value.trim(), type_id: this.typeId.value, description: description || null, enabled: this.enabled.value });
82
+ }
83
+ else {
84
+ saved = await this.service.createGroup(this.clientId, {
85
+ name: this.name.value.trim(), type_id: this.typeId.value, ...(description ? { description } : {}),
86
+ });
87
+ }
88
+ this.saved.emit(saved);
89
+ this.close();
90
+ }
91
+ catch (err) {
92
+ this.saveError = autoServiceErrorText(err, this.text, this.text.groupSaveError);
93
+ }
94
+ finally {
95
+ this.saving = false;
96
+ this.cdr.markForCheck();
97
+ }
98
+ }
99
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.24", ngImport: i0, type: AutoServiceGroupModalComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
100
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.24", type: AutoServiceGroupModalComponent, isStandalone: true, selector: "spine-auto-service-group-modal", inputs: { group: "group", clientId: "clientId", groupTypes: "groupTypes", open: "open" }, outputs: { openChange: "openChange", saved: "saved" }, usesOnChanges: true, ngImport: i0, template: "<hm-modal [open]=\"open\" (openChange)=\"onModalOpenChange($event)\" [heading]=\"isEdit ? text.editGroup : text.newGroup\" (closed)=\"close()\">\n <div class=\"form-stack\">\n <hm-alert *ngIf=\"saveError\" variant=\"error\">{{ saveError }}</hm-alert>\n <hm-input [formControl]=\"name\" [label]=\"text.groupName\" [maxLength]=\"nameMax\" />\n <hm-combobox [formControl]=\"typeId\" [options]=\"typeOptions\" [label]=\"text.groupType\" [placeholder]=\"text.groupTypePlaceholder\" />\n <hm-textarea [formControl]=\"description\" [label]=\"text.groupDescription\" />\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]=\"!canSave\" [loading]=\"saving\" (clicked)=\"save()\">{{ isEdit ? text.save : text.create }}</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: 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: CheckboxComponent, selector: "hm-checkbox", inputs: ["label", "labelHidden", "checked", "indeterminate"], outputs: ["checkedChange"] }, { 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: 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"] }, { kind: "component", type: TextareaComponent, selector: "hm-textarea", inputs: ["value", "label", "hint", "help", "placeholder", "maxLength", "rows", "autoGrow", "labelHidden", "loading", "maxRows", "submitKey"], outputs: ["valueChange", "submitted"] }], changeDetection: i0.ChangeDetectionStrategy.Eager }); }
101
+ }
102
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.24", ngImport: i0, type: AutoServiceGroupModalComponent, decorators: [{
103
+ type: Component,
104
+ args: [{ selector: 'spine-auto-service-group-modal', standalone: true, imports: [
105
+ CommonModule, ReactiveFormsModule, AlertComponent, ButtonComponent, CheckboxComponent, ComboboxComponent, InputComponent,
106
+ ModalComponent, TextareaComponent,
107
+ ], changeDetection: ChangeDetectionStrategy.Eager, template: "<hm-modal [open]=\"open\" (openChange)=\"onModalOpenChange($event)\" [heading]=\"isEdit ? text.editGroup : text.newGroup\" (closed)=\"close()\">\n <div class=\"form-stack\">\n <hm-alert *ngIf=\"saveError\" variant=\"error\">{{ saveError }}</hm-alert>\n <hm-input [formControl]=\"name\" [label]=\"text.groupName\" [maxLength]=\"nameMax\" />\n <hm-combobox [formControl]=\"typeId\" [options]=\"typeOptions\" [label]=\"text.groupType\" [placeholder]=\"text.groupTypePlaceholder\" />\n <hm-textarea [formControl]=\"description\" [label]=\"text.groupDescription\" />\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]=\"!canSave\" [loading]=\"saving\" (clicked)=\"save()\">{{ isEdit ? text.save : text.create }}</hm-button>\n </ng-container>\n</hm-modal>\n", styles: [".form-stack{display:flex;flex-direction:column;gap:var(--hm-space-sm)}\n"] }]
108
+ }], propDecorators: { group: [{
109
+ type: Input
110
+ }], clientId: [{
111
+ type: Input
112
+ }], groupTypes: [{
113
+ type: Input
114
+ }], open: [{
115
+ type: Input
116
+ }], openChange: [{
117
+ type: Output
118
+ }], saved: [{
119
+ type: Output
120
+ }] } });
121
+
122
+ // Mirror de admin/ui/.../groups/members/group-members.component.ts (argos-admin),
123
+ // adaptado pra falar com /auto-service/:clientId/groups/:groupId/members em vez de
124
+ // /admin/groups/:groupId/members.
125
+ class AutoServiceGroupMembersComponent {
126
+ /** Data e hora curtas no idioma ativo. */
127
+ formatDate(value) {
128
+ return value ? new Intl.DateTimeFormat(this.catalog.meta.locale, { dateStyle: 'short', timeStyle: 'short' }).format(new Date(value)) : '';
129
+ }
130
+ constructor(service) {
131
+ this.service = service;
132
+ this.catalog = inject(SPINE_MESSAGES);
133
+ this.text = inject(SPINE_MESSAGES).autoService;
134
+ /** Telas com estado em campo comum, preenchido depois de `await`: marca a view ao terminar (app sem zone.js). */
135
+ this.cdr = inject(ChangeDetectorRef);
136
+ this.clientId = '';
137
+ this.groupId = '';
138
+ this.refreshTrigger = 0;
139
+ this.countChange = new EventEmitter();
140
+ this.manageMembers = new EventEmitter();
141
+ this.members = [];
142
+ this.loading = false;
143
+ this.rowId = (m) => m.user_id;
144
+ this.columns = computed(() => [
145
+ { key: 'username', title: this.text.colUser, value: (m) => m.name || m.username, sortable: true },
146
+ {
147
+ key: 'joined_at',
148
+ title: this.text.colMemberSince,
149
+ value: (m) => (m.joined_at ? this.formatDate(m.joined_at) : '—'),
150
+ sortable: true,
151
+ },
152
+ ], ...(ngDevMode ? [{ debugName: "columns" }] : /* istanbul ignore next */ []));
153
+ }
154
+ ngOnChanges(changes) {
155
+ if (changes['groupId'] || changes['refreshTrigger']) {
156
+ this.load();
157
+ }
158
+ }
159
+ async load() {
160
+ if (!this.clientId || !this.groupId) {
161
+ this.members = [];
162
+ this.countChange.emit(0);
163
+ return;
164
+ }
165
+ this.loading = true;
166
+ try {
167
+ const res = await this.service.getGroupMembers(this.clientId, this.groupId);
168
+ this.members = res.members;
169
+ this.countChange.emit(this.members.length);
170
+ }
171
+ finally {
172
+ this.loading = false;
173
+ this.cdr.markForCheck();
174
+ }
175
+ }
176
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.24", ngImport: i0, type: AutoServiceGroupMembersComponent, deps: [{ token: AutoServiceService }], target: i0.ɵɵFactoryTarget.Component }); }
177
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.24", type: AutoServiceGroupMembersComponent, isStandalone: true, selector: "spine-auto-service-group-members", inputs: { clientId: "clientId", groupId: "groupId", refreshTrigger: "refreshTrigger" }, outputs: { countChange: "countChange", manageMembers: "manageMembers" }, usesOnChanges: true, ngImport: i0, template: "<hm-data-grid\n [columns]=\"columns()\"\n [rows]=\"members\"\n [rowId]=\"rowId\"\n [caption]=\"text.membersCaption\"\n [loading]=\"loading\"\n [emptyMessage]=\"text.noMembers\"\n>\n <hm-button dataGridActions icon=\"employee-group\" (clicked)=\"manageMembers.emit()\">{{ text.manageMembers }}</hm-button>\n <ng-template hmCell=\"username\" let-m>\n <div class=\"user-cell\">\n <hm-account-avatar class=\"user-cell__avatar\" [name]=\"m.name || m.username\" [imageUrl]=\"m.picture\"></hm-account-avatar>\n <div class=\"user-cell__body\">\n <div class=\"user-cell__name\">\n <b>{{ m.name || m.username }}</b>\n <hm-tag [name]=\"m.enabled ? text.active : text.inactive\" [color]=\"m.enabled ? 'success' : 'danger'\" />\n </div>\n <div class=\"user-cell__email\">\n <ng-container *ngIf=\"m.name\">{{ m.username }} \u00B7 </ng-container>{{ m.email }}\n </div>\n </div>\n </div>\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)}.as-secret{display:grid;gap:var(--hm-space-micro)}.as-secret__label{color:var(--hm-muted);font-size:var(--hm-font-size-xs)}.as-secret__row{display:flex;flex-wrap:wrap;align-items:center;gap:var(--hm-space-xs)}.as-secret__value{flex:1 1 240px;min-width:0;border:var(--hm-border-hairline) solid var(--hm-divider);border-radius:var(--hm-radius-control);padding:var(--hm-space-xs) var(--hm-space-sm);background:var(--hm-surface);color:var(--hm-text);font-family:var(--hm-font-mono);font-size:var(--hm-font-size-sm);overflow-wrap:anywhere;-webkit-user-select:all;user-select:all}:host{display:block}.user-cell{display:flex;align-items:center;gap:var(--hm-space-xs)}.user-cell__avatar{flex-shrink:0}.user-cell__body{min-width:0}.user-cell__name{display:flex;flex-wrap:wrap;align-items:center;gap:var(--hm-space-xs)}.user-cell__email{margin-top:var(--hm-space-micro);color:var(--hm-muted);font-size:var(--hm-font-size-xs)}\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: TagComponent, selector: "hm-tag", inputs: ["name", "color", "compact"] }, { kind: "component", type: AccountAvatarComponent, selector: "hm-account-avatar", inputs: ["name", "imageUrl", "size", "loading"] }, { 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"] }], changeDetection: i0.ChangeDetectionStrategy.Eager }); }
178
+ }
179
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.24", ngImport: i0, type: AutoServiceGroupMembersComponent, decorators: [{
180
+ type: Component,
181
+ args: [{ selector: 'spine-auto-service-group-members', standalone: true, imports: [CommonModule, ButtonComponent, TagComponent, AccountAvatarComponent, DataGridComponent, DataGridCellDirective], changeDetection: ChangeDetectionStrategy.Eager, template: "<hm-data-grid\n [columns]=\"columns()\"\n [rows]=\"members\"\n [rowId]=\"rowId\"\n [caption]=\"text.membersCaption\"\n [loading]=\"loading\"\n [emptyMessage]=\"text.noMembers\"\n>\n <hm-button dataGridActions icon=\"employee-group\" (clicked)=\"manageMembers.emit()\">{{ text.manageMembers }}</hm-button>\n <ng-template hmCell=\"username\" let-m>\n <div class=\"user-cell\">\n <hm-account-avatar class=\"user-cell__avatar\" [name]=\"m.name || m.username\" [imageUrl]=\"m.picture\"></hm-account-avatar>\n <div class=\"user-cell__body\">\n <div class=\"user-cell__name\">\n <b>{{ m.name || m.username }}</b>\n <hm-tag [name]=\"m.enabled ? text.active : text.inactive\" [color]=\"m.enabled ? 'success' : 'danger'\" />\n </div>\n <div class=\"user-cell__email\">\n <ng-container *ngIf=\"m.name\">{{ m.username }} \u00B7 </ng-container>{{ m.email }}\n </div>\n </div>\n </div>\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)}.as-secret{display:grid;gap:var(--hm-space-micro)}.as-secret__label{color:var(--hm-muted);font-size:var(--hm-font-size-xs)}.as-secret__row{display:flex;flex-wrap:wrap;align-items:center;gap:var(--hm-space-xs)}.as-secret__value{flex:1 1 240px;min-width:0;border:var(--hm-border-hairline) solid var(--hm-divider);border-radius:var(--hm-radius-control);padding:var(--hm-space-xs) var(--hm-space-sm);background:var(--hm-surface);color:var(--hm-text);font-family:var(--hm-font-mono);font-size:var(--hm-font-size-sm);overflow-wrap:anywhere;-webkit-user-select:all;user-select:all}:host{display:block}.user-cell{display:flex;align-items:center;gap:var(--hm-space-xs)}.user-cell__avatar{flex-shrink:0}.user-cell__body{min-width:0}.user-cell__name{display:flex;flex-wrap:wrap;align-items:center;gap:var(--hm-space-xs)}.user-cell__email{margin-top:var(--hm-space-micro);color:var(--hm-muted);font-size:var(--hm-font-size-xs)}\n"] }]
182
+ }], ctorParameters: () => [{ type: AutoServiceService }], propDecorators: { clientId: [{
183
+ type: Input
184
+ }], groupId: [{
185
+ type: Input
186
+ }], refreshTrigger: [{
187
+ type: Input
188
+ }], countChange: [{
189
+ type: Output
190
+ }], manageMembers: [{
191
+ type: Output
192
+ }] } });
193
+
194
+ const ROLE_OPTIONS = ['Administrador', 'Editor', 'Leitor'];
195
+ let searchSequence = 0;
196
+ class AutoServiceGroupMembersModalComponent {
197
+ /** Data e hora curtas no idioma ativo. */
198
+ formatDate(value) {
199
+ return value ? new Intl.DateTimeFormat(this.catalog.meta.locale, { dateStyle: 'short', timeStyle: 'short' }).format(new Date(value)) : '';
200
+ }
201
+ constructor(service) {
202
+ this.service = service;
203
+ this.catalog = inject(SPINE_MESSAGES);
204
+ this.text = inject(SPINE_MESSAGES).autoService;
205
+ /** Telas com estado em campo comum, preenchido depois de `await`: marca a view ao terminar (app sem zone.js). */
206
+ this.cdr = inject(ChangeDetectorRef);
207
+ this.fmt = formatMessage;
208
+ this.clientId = '';
209
+ this.groupId = '';
210
+ this.groupName = '';
211
+ this.open = false;
212
+ this.openChange = new EventEmitter();
213
+ this.saved = new EventEmitter();
214
+ this.roleOptions = ROLE_OPTIONS;
215
+ /** Liga o rótulo "Adicionar usuário" ao campo de busca. */
216
+ this.searchId = `spine-members-search-${++searchSequence}`;
217
+ this.loading = false;
218
+ this.saving = false;
219
+ /** Falha ao gravar (no idioma ativo); o que já tinha sido gravado fica — a lista é recarregada. */
220
+ this.saveError = null;
221
+ this.members = [];
222
+ /** Ids marcados pra remoção — o grid seleciona por id (não por objeto, ver `GridSelection`). */
223
+ this.checkedForRemovalIds = EMPTY_SELECTION;
224
+ this.originalRoles = new Map();
225
+ this.addSearch = '';
226
+ this.addSearchResults = [];
227
+ this.selectedToAdd = null;
228
+ this.selectedRole = null;
229
+ this.suggestions = [];
230
+ this.suggestionsPool = [];
231
+ this.suggestionsVisibleCount = 3;
232
+ this.rowId = (m) => m.user_id;
233
+ this.columns = computed(() => [
234
+ {
235
+ key: 'username',
236
+ title: this.text.colUser,
237
+ value: (m) => [m.name, m.username, m.email].filter(Boolean).join(' '),
238
+ sortable: true,
239
+ },
240
+ { key: 'role', title: this.text.colRole, value: (m) => m.role ?? '—' },
241
+ {
242
+ key: 'joined_at',
243
+ title: this.text.colAddedAt,
244
+ value: (m) => (m.joined_at ? this.formatDate(m.joined_at) : '—'),
245
+ sortable: true,
246
+ },
247
+ ], ...(ngDevMode ? [{ debugName: "columns" }] : /* istanbul ignore next */ []));
248
+ }
249
+ ngOnChanges(changes) { if (changes['open'] && this.open) {
250
+ this.resetAndLoad();
251
+ } }
252
+ onModalOpenChange(value) { this.open = value; this.openChange.emit(value); }
253
+ close() { this.onModalOpenChange(false); }
254
+ get checkedForRemoval() {
255
+ return this.members.filter((m) => this.checkedForRemovalIds.has(m.user_id));
256
+ }
257
+ get removalCount() { return this.checkedForRemovalIds.size; }
258
+ get hasMoreSuggestions() { return this.suggestionsVisibleCount < this.suggestionsPool.length; }
259
+ async resetAndLoad() {
260
+ this.addSearch = '';
261
+ this.addSearchResults = [];
262
+ this.selectedToAdd = null;
263
+ this.selectedRole = null;
264
+ this.checkedForRemovalIds = EMPTY_SELECTION;
265
+ this.saveError = null;
266
+ this.loading = true;
267
+ try {
268
+ const res = await this.service.getGroupMembers(this.clientId, this.groupId);
269
+ this.members = (res.members ?? []).map((m) => ({
270
+ user_id: m.user_id, username: m.username, email: m.email, name: m.name ?? null,
271
+ picture: m.picture ?? null, enabled: m.enabled, role: m.role ?? null,
272
+ joined_at: m.joined_at, added_by_username: m.added_by_username ?? null,
273
+ }));
274
+ this.originalRoles = new Map(this.members.map(m => [m.user_id, m.role ?? null]));
275
+ this.cdr.markForCheck();
276
+ await this.loadSuggestions();
277
+ }
278
+ finally {
279
+ this.loading = false;
280
+ this.cdr.markForCheck();
281
+ }
282
+ }
283
+ async loadSuggestions() {
284
+ if (!this.clientId) {
285
+ this.suggestionsPool = [];
286
+ this.suggestions = [];
287
+ return;
288
+ }
289
+ const res = await this.service.searchUsers(this.clientId, { limit: 30 });
290
+ const existingIds = new Set(this.members.map(m => m.user_id));
291
+ this.suggestionsPool = (res.users ?? []).filter((u) => !existingIds.has(u.id));
292
+ this.suggestionsVisibleCount = 3;
293
+ this.suggestions = this.suggestionsPool.slice(0, this.suggestionsVisibleCount);
294
+ }
295
+ showMoreSuggestions() { this.suggestionsVisibleCount += 3; this.suggestions = this.suggestionsPool.slice(0, this.suggestionsVisibleCount); }
296
+ onAddSearchChange(value) {
297
+ this.addSearch = value;
298
+ this.selectedToAdd = null;
299
+ clearTimeout(this.addSearchTimer);
300
+ if (value.trim().length < 2) {
301
+ this.addSearchResults = [];
302
+ return;
303
+ }
304
+ this.addSearchTimer = setTimeout(async () => {
305
+ const res = await this.service.searchUsers(this.clientId, { search: value.trim(), limit: 10 });
306
+ const existingIds = new Set(this.members.map(m => m.user_id));
307
+ this.addSearchResults = (res.users ?? []).filter((u) => !existingIds.has(u.id));
308
+ this.cdr.markForCheck();
309
+ }, 300);
310
+ }
311
+ selectCandidate(user) { this.selectedToAdd = user; this.addSearch = user.username; this.addSearchResults = []; }
312
+ clearSelectedToAdd() { this.selectedToAdd = null; this.addSearch = ''; this.addSearchResults = []; }
313
+ addSelectedMember() {
314
+ if (!this.selectedToAdd)
315
+ return;
316
+ const user = this.selectedToAdd;
317
+ this.members = [{
318
+ user_id: user.id, username: user.username, email: user.email, name: user.name ?? null, picture: user.picture ?? null, enabled: user.enabled,
319
+ role: this.selectedRole, joined_at: null, added_by_username: null, new: true,
320
+ }, ...this.members];
321
+ this.suggestionsPool = this.suggestionsPool.filter(u => u.id !== user.id);
322
+ this.suggestions = this.suggestionsPool.slice(0, this.suggestionsVisibleCount);
323
+ this.clearSelectedToAdd();
324
+ this.selectedRole = null;
325
+ }
326
+ removeStagedNew(member) { this.members = this.members.filter(m => m.user_id !== member.user_id); }
327
+ /** `[(selection)]` do grid: separa o que ainda é staged (nunca existiu no servidor — remove
328
+ * na hora, não "marca pra remover") do que já existe (fica marcado, removido só no Salvar). */
329
+ onSelectionChange(ids) {
330
+ const cleaned = this.members.filter((m) => ids.has(m.user_id));
331
+ const stillNew = cleaned.filter((m) => m.new);
332
+ for (const m of stillNew)
333
+ this.removeStagedNew(m);
334
+ this.checkedForRemovalIds = new Set([...ids].filter((id) => !stillNew.some((m) => m.user_id === id)));
335
+ }
336
+ isMarkedForRemoval(member) { return this.checkedForRemovalIds.has(member.user_id); }
337
+ undoRemoval(member) {
338
+ const next = new Set(this.checkedForRemovalIds);
339
+ next.delete(member.user_id);
340
+ this.checkedForRemovalIds = next;
341
+ }
342
+ async save() {
343
+ this.saving = true;
344
+ this.saveError = null;
345
+ try {
346
+ const toAdd = this.members.filter(m => m.new);
347
+ for (const m of toAdd) {
348
+ await this.service.addGroupMember(this.clientId, this.groupId, m.user_id, m.role ?? null);
349
+ }
350
+ for (const m of this.checkedForRemoval) {
351
+ await this.service.removeGroupMember(this.clientId, this.groupId, m.user_id);
352
+ }
353
+ const removedIds = this.checkedForRemovalIds;
354
+ const roleChanges = this.members.filter(m => !m.new && !removedIds.has(m.user_id) && (m.role ?? null) !== (this.originalRoles.get(m.user_id) ?? null));
355
+ for (const m of roleChanges) {
356
+ await this.service.updateGroupMemberRole(this.clientId, this.groupId, m.user_id, m.role ?? null);
357
+ }
358
+ this.saved.emit();
359
+ this.close();
360
+ }
361
+ catch (err) {
362
+ // Parte pode ter sido gravada (as chamadas são em sequência): recarrega para mostrar o estado real.
363
+ this.saveError = autoServiceErrorText(err, this.text, this.text.membersSaveError);
364
+ this.saved.emit();
365
+ const error = this.saveError;
366
+ await this.resetAndLoad().catch(() => undefined);
367
+ this.saveError = error;
368
+ }
369
+ finally {
370
+ this.saving = false;
371
+ this.cdr.markForCheck();
372
+ }
373
+ }
374
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.24", ngImport: i0, type: AutoServiceGroupMembersModalComponent, deps: [{ token: AutoServiceService }], target: i0.ɵɵFactoryTarget.Component }); }
375
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.24", type: AutoServiceGroupMembersModalComponent, isStandalone: true, selector: "spine-auto-service-group-members-modal", inputs: { clientId: "clientId", groupId: "groupId", groupName: "groupName", open: "open" }, outputs: { openChange: "openChange", saved: "saved" }, usesOnChanges: true, ngImport: i0, template: "<hm-modal [open]=\"open\" (openChange)=\"onModalOpenChange($event)\" [heading]=\"fmt(text.membersHeading, { group: groupName })\" size=\"large\" (closed)=\"close()\">\n <div class=\"as-stack\">\n <hm-alert *ngIf=\"saveError\" variant=\"error\">{{ saveError }}</hm-alert>\n <hm-card>\n <div class=\"add-section__row\">\n <!-- Busca com lista de candidatos pr\u00F3pria (vem da API a cada tecla): o r\u00F3tulo \u00E9 o que antes era o\n t\u00EDtulo do card. -->\n <div class=\"add-field\">\n <label class=\"add-field__label\" [attr.for]=\"searchId\">{{ text.addUser }}</label>\n <div class=\"add-search\">\n <hm-icon shape=\"search\" size=\"16\"></hm-icon>\n <input type=\"text\" [id]=\"searchId\" [placeholder]=\"text.userSearch\"\n [ngModel]=\"addSearch\" (ngModelChange)=\"onAddSearchChange($event)\" />\n <hm-icon shape=\"times\" size=\"14\" *ngIf=\"addSearch\" class=\"add-search__clear\" (click)=\"clearSelectedToAdd()\"></hm-icon>\n\n <div class=\"add-search__results\" *ngIf=\"addSearchResults.length\">\n <button type=\"button\" class=\"add-search__result\" *ngFor=\"let u of addSearchResults\" (click)=\"selectCandidate(u)\">\n <b>{{ u.name || u.username }}</b>\n <span class=\"muted\"><ng-container *ngIf=\"u.name\">{{ u.username }} \u00B7 </ng-container>{{ u.email }}</span>\n </button>\n </div>\n </div>\n </div>\n\n <hm-select class=\"add-section__role\" [label]=\"text.role\" [value]=\"selectedRole ?? ''\" (valueChange)=\"selectedRole = $event || null\">\n <option value=\"\">{{ text.pickRole }}</option>\n <option *ngFor=\"let r of roleOptions\" [value]=\"r\">{{ r }}</option>\n </hm-select>\n\n <hm-button [disabled]=\"!selectedToAdd\" (clicked)=\"addSelectedMember()\">\n {{ text.add }}\n </hm-button>\n </div>\n\n <div class=\"suggestions\" *ngIf=\"suggestions.length\">\n <hm-divider [label]=\"text.suggestions\" />\n <div class=\"suggestions__row\">\n <button type=\"button\" class=\"suggestion-card\" *ngFor=\"let u of suggestions\" (click)=\"selectCandidate(u)\">\n <b>{{ u.name || u.username }}</b>\n <span class=\"muted\"><ng-container *ngIf=\"u.name\">{{ u.username }} \u00B7 </ng-container>{{ u.email }}</span>\n </button>\n <hm-button *ngIf=\"hasMoreSuggestions\" emphasis=\"minimal\" (clicked)=\"showMoreSuggestions()\">\n {{ text.moreSuggestions }}\n </hm-button>\n </div>\n </div>\n </hm-card>\n\n <div class=\"members-split\">\n <div class=\"members-split__grid\">\n <hm-data-grid\n [columns]=\"columns()\"\n [rows]=\"members\"\n [rowId]=\"rowId\"\n [caption]=\"fmt(text.membersOf, { group: groupName })\"\n [loading]=\"loading\"\n [selectable]=\"true\"\n [selection]=\"checkedForRemovalIds\"\n (selectionChange)=\"onSelectionChange($event)\"\n [emptyMessage]=\"text.noMembersShort\"\n >\n <ng-template hmCell=\"username\" let-m>\n <div class=\"user-cell\">\n <hm-account-avatar class=\"user-cell__avatar\" [name]=\"m.name || m.username\" [imageUrl]=\"m.picture\"></hm-account-avatar>\n <div class=\"user-cell__body\">\n <div class=\"user-cell__name\">\n <b>{{ m.name || m.username }}</b>\n <hm-tag *ngIf=\"m.new\" [name]=\"text.newMember\" color=\"info\" />\n </div>\n <div class=\"user-cell__email\">\n <ng-container *ngIf=\"m.name\">{{ m.username }} \u00B7 </ng-container>{{ m.email }}\n </div>\n </div>\n </div>\n </ng-template>\n\n <ng-template hmCell=\"role\" let-m>\n <hm-select class=\"role-cell\" [label]=\"text.colRole\" labelHidden [disabled]=\"isMarkedForRemoval(m)\"\n [value]=\"m.role ?? ''\" (valueChange)=\"m.role = $event || null\">\n <option value=\"\">\u2014</option>\n <option *ngFor=\"let r of roleOptions\" [value]=\"r\">{{ r }}</option>\n </hm-select>\n </ng-template>\n\n <ng-template hmCell=\"joined_at\" let-m>\n <ng-container *ngIf=\"m.joined_at\">\n {{ formatDate(m.joined_at) }}\n <div class=\"muted\" *ngIf=\"m.added_by_username\">{{ fmt(text.addedBy, { user: m.added_by_username }) }}</div>\n </ng-container>\n <ng-container *ngIf=\"!m.joined_at\">\u2014</ng-container>\n </ng-template>\n </hm-data-grid>\n </div>\n\n <div class=\"members-split__removal\">\n <hm-card class=\"removal-card\">\n <div class=\"removal-header\">\n <hm-icon shape=\"trash\"></hm-icon> {{ text.removal }} <hm-badge [value]=\"removalCount\" intent=\"danger\" />\n </div>\n\n <div class=\"removal-empty\" *ngIf=\"removalCount === 0\">\n <hm-icon shape=\"employee-group\" size=\"xxl\"></hm-icon>\n <p class=\"muted\">{{ text.removalEmpty }}</p>\n </div>\n\n <div class=\"removal-item\" *ngFor=\"let m of checkedForRemoval\">\n <div class=\"user-cell\">\n <hm-account-avatar class=\"user-cell__avatar\" [name]=\"m.name || m.username\"></hm-account-avatar>\n <div class=\"user-cell__body\">\n <b>{{ m.name || m.username }}</b>\n <div class=\"user-cell__email\">\n <ng-container *ngIf=\"m.name\">{{ m.username }} \u00B7 </ng-container>{{ m.email }}\n </div>\n </div>\n </div>\n <hm-icon-button emphasis=\"subtle\" icon=\"undo\" [label]=\"text.undoRemoval\" (clicked)=\"undoRemoval(m)\" />\n </div>\n </hm-card>\n </div>\n </div>\n </div>\n\n <ng-container footer>\n <hm-button emphasis=\"medium\" (clicked)=\"close()\">{{ text.cancel }}</hm-button>\n <hm-button [loading]=\"saving\" [disabled]=\"saving\" (clicked)=\"save()\" icon=\"floppy\">\n {{ text.saveChanges }}\n </hm-button>\n </ng-container>\n</hm-modal>\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)}.as-secret{display:grid;gap:var(--hm-space-micro)}.as-secret__label{color:var(--hm-muted);font-size:var(--hm-font-size-xs)}.as-secret__row{display:flex;flex-wrap:wrap;align-items:center;gap:var(--hm-space-xs)}.as-secret__value{flex:1 1 240px;min-width:0;border:var(--hm-border-hairline) solid var(--hm-divider);border-radius:var(--hm-radius-control);padding:var(--hm-space-xs) var(--hm-space-sm);background:var(--hm-surface);color:var(--hm-text);font-family:var(--hm-font-mono);font-size:var(--hm-font-size-sm);overflow-wrap:anywhere;-webkit-user-select:all;user-select:all}:host{display:contents}.add-section__row{display:flex;flex-wrap:wrap;align-items:flex-end;gap:var(--hm-space-sm)}.add-section__role{flex:0 1 14rem}.add-field{display:flex;flex:1 1 20rem;flex-direction:column;gap:var(--hm-space-micro);min-inline-size:0}.add-field__label{color:var(--hm-text);font-size:var(--hm-font-size-sm);font-weight:var(--hm-font-weight-semibold)}.add-search{position:relative;display:flex;align-items:center;gap:var(--hm-space-xs);height:var(--hm-control-height);padding:0 var(--hm-space-sm);border:var(--hm-border-hairline) solid var(--hm-border);border-radius:var(--hm-radius-control);background:var(--hm-surface-raised);color:var(--hm-muted)}.add-search:focus-within{border-color:var(--hm-action);outline:2px solid var(--hm-focus-color);outline-offset:1px}.add-search input{flex:1;height:100%;border:none;outline:none;background:transparent;color:var(--hm-text);font:inherit;font-size:var(--hm-font-size-sm)}.add-search input::placeholder{color:var(--hm-placeholder)}.add-search__clear{flex-shrink:0;cursor:pointer}.add-search__results{position:absolute;top:calc(100% + var(--hm-space-micro));right:0;left:0;z-index:20;max-height:14rem;overflow-y:auto;border:var(--hm-border-hairline) solid var(--hm-border);border-radius:var(--hm-radius-control);background:var(--hm-surface);box-shadow:var(--hm-shadow-overlay)}.add-search__result{display:flex;flex-direction:column;gap:var(--hm-space-micro);width:100%;padding:var(--hm-space-xs) var(--hm-space-sm);border:none;border-bottom:var(--hm-border-hairline) solid var(--hm-divider);background:transparent;color:var(--hm-text);font:inherit;font-size:var(--hm-font-size-sm);text-align:start;cursor:pointer}.add-search__result:last-child{border-bottom:none}.add-search__result:hover{background:var(--hm-hover)}.suggestions{display:flex;flex-direction:column;gap:var(--hm-space-sm);margin-top:var(--hm-space-sm)}.suggestions__row{display:flex;flex-wrap:wrap;align-items:center;gap:var(--hm-space-xs)}.suggestion-card{display:flex;flex-direction:column;gap:var(--hm-space-micro);padding:var(--hm-space-xs) var(--hm-space-sm);border:var(--hm-border-hairline) solid var(--hm-border);border-radius:var(--hm-radius-control);background:var(--hm-surface);color:var(--hm-text);font:inherit;font-size:var(--hm-font-size-sm);text-align:start;cursor:pointer}.suggestion-card:hover{border-color:var(--hm-action)}.members-split{display:flex;flex-wrap:wrap;align-items:stretch;gap:var(--hm-space-md)}.members-split__grid{flex:2 1 30rem;min-width:0}.members-split__removal{flex:1 1 17rem;min-width:0}.role-cell{display:block;min-inline-size:10rem}.user-cell{display:flex;align-items:center;gap:var(--hm-space-xs)}.user-cell__avatar{flex-shrink:0}.user-cell__body{min-width:0}.user-cell__name{display:flex;flex-wrap:wrap;align-items:center;gap:var(--hm-space-xs)}.user-cell__email{margin-top:var(--hm-space-micro);color:var(--hm-muted);font-size:var(--hm-font-size-xs)}.removal-card{display:block;height:100%}.removal-header{display:flex;align-items:center;gap:var(--hm-space-xs);margin-bottom:var(--hm-space-sm);color:var(--hm-danger);font-weight:var(--hm-font-weight-semibold)}.removal-empty{display:flex;flex-direction:column;align-items:center;gap:var(--hm-space-sm);padding:var(--hm-space-xl) var(--hm-space-sm);color:var(--hm-muted);text-align:center}.removal-empty p{max-width:16rem;margin:0}.removal-item{display:flex;align-items:center;justify-content:space-between;gap:var(--hm-space-xs);padding:var(--hm-space-xs) 0;border-bottom:var(--hm-border-hairline) solid var(--hm-divider)}.removal-item:last-child{border-bottom:none}\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: FormsModule }, { kind: "directive", type: i3.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i3.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i3.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: AccountAvatarComponent, selector: "hm-account-avatar", inputs: ["name", "imageUrl", "size", "loading"] }, { kind: "component", type: AlertComponent, selector: "hm-alert", inputs: ["variant", "appearance", "heading", "closable", "size", "showIcon", "link", "linkLabel", "linkTarget", "dismissKey", "duration"], outputs: ["closed"] }, { kind: "component", type: BadgeComponent, selector: "hm-badge", inputs: ["value", "max", "dot", "intent", "label"] }, { 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: 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: DividerComponent, selector: "hm-divider", inputs: ["orientation", "label", "labelAlign", "emphasis", "thickness", "spacing", "decorative"] }, { kind: "component", type: IconButtonComponent, selector: "hm-icon-button", inputs: ["label", "icon", "solid", "iconDirection", "emphasis", "intent", "size", "disabled", "toggle", "pressed", "keyShortcuts"], outputs: ["pressedChange", "clicked"] }, { kind: "component", type: IconComponent, selector: "hm-icon", inputs: ["shape", "direction", "size", "solid", "badge", "status", "flip", "inverse", "label"] }, { kind: "component", type: ModalComponent, selector: "hm-modal", inputs: ["open", "heading", "size", "closeLabel", "closable", "beforeClose"], outputs: ["openChange", "closed"] }, { kind: "component", type: SelectComponent, selector: "hm-select", inputs: ["value", "label", "labelHidden", "hint"], outputs: ["valueChange"] }, { kind: "component", type: TagComponent, selector: "hm-tag", inputs: ["name", "color", "compact"] }], changeDetection: i0.ChangeDetectionStrategy.Eager }); }
376
+ }
377
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.24", ngImport: i0, type: AutoServiceGroupMembersModalComponent, decorators: [{
378
+ type: Component,
379
+ args: [{ selector: 'spine-auto-service-group-members-modal', standalone: true, imports: [
380
+ CommonModule, FormsModule, AccountAvatarComponent, AlertComponent, BadgeComponent, ButtonComponent, CardComponent, DataGridComponent,
381
+ DataGridCellDirective, DividerComponent, IconButtonComponent, IconComponent, ModalComponent, SelectComponent, TagComponent,
382
+ ], changeDetection: ChangeDetectionStrategy.Eager, template: "<hm-modal [open]=\"open\" (openChange)=\"onModalOpenChange($event)\" [heading]=\"fmt(text.membersHeading, { group: groupName })\" size=\"large\" (closed)=\"close()\">\n <div class=\"as-stack\">\n <hm-alert *ngIf=\"saveError\" variant=\"error\">{{ saveError }}</hm-alert>\n <hm-card>\n <div class=\"add-section__row\">\n <!-- Busca com lista de candidatos pr\u00F3pria (vem da API a cada tecla): o r\u00F3tulo \u00E9 o que antes era o\n t\u00EDtulo do card. -->\n <div class=\"add-field\">\n <label class=\"add-field__label\" [attr.for]=\"searchId\">{{ text.addUser }}</label>\n <div class=\"add-search\">\n <hm-icon shape=\"search\" size=\"16\"></hm-icon>\n <input type=\"text\" [id]=\"searchId\" [placeholder]=\"text.userSearch\"\n [ngModel]=\"addSearch\" (ngModelChange)=\"onAddSearchChange($event)\" />\n <hm-icon shape=\"times\" size=\"14\" *ngIf=\"addSearch\" class=\"add-search__clear\" (click)=\"clearSelectedToAdd()\"></hm-icon>\n\n <div class=\"add-search__results\" *ngIf=\"addSearchResults.length\">\n <button type=\"button\" class=\"add-search__result\" *ngFor=\"let u of addSearchResults\" (click)=\"selectCandidate(u)\">\n <b>{{ u.name || u.username }}</b>\n <span class=\"muted\"><ng-container *ngIf=\"u.name\">{{ u.username }} \u00B7 </ng-container>{{ u.email }}</span>\n </button>\n </div>\n </div>\n </div>\n\n <hm-select class=\"add-section__role\" [label]=\"text.role\" [value]=\"selectedRole ?? ''\" (valueChange)=\"selectedRole = $event || null\">\n <option value=\"\">{{ text.pickRole }}</option>\n <option *ngFor=\"let r of roleOptions\" [value]=\"r\">{{ r }}</option>\n </hm-select>\n\n <hm-button [disabled]=\"!selectedToAdd\" (clicked)=\"addSelectedMember()\">\n {{ text.add }}\n </hm-button>\n </div>\n\n <div class=\"suggestions\" *ngIf=\"suggestions.length\">\n <hm-divider [label]=\"text.suggestions\" />\n <div class=\"suggestions__row\">\n <button type=\"button\" class=\"suggestion-card\" *ngFor=\"let u of suggestions\" (click)=\"selectCandidate(u)\">\n <b>{{ u.name || u.username }}</b>\n <span class=\"muted\"><ng-container *ngIf=\"u.name\">{{ u.username }} \u00B7 </ng-container>{{ u.email }}</span>\n </button>\n <hm-button *ngIf=\"hasMoreSuggestions\" emphasis=\"minimal\" (clicked)=\"showMoreSuggestions()\">\n {{ text.moreSuggestions }}\n </hm-button>\n </div>\n </div>\n </hm-card>\n\n <div class=\"members-split\">\n <div class=\"members-split__grid\">\n <hm-data-grid\n [columns]=\"columns()\"\n [rows]=\"members\"\n [rowId]=\"rowId\"\n [caption]=\"fmt(text.membersOf, { group: groupName })\"\n [loading]=\"loading\"\n [selectable]=\"true\"\n [selection]=\"checkedForRemovalIds\"\n (selectionChange)=\"onSelectionChange($event)\"\n [emptyMessage]=\"text.noMembersShort\"\n >\n <ng-template hmCell=\"username\" let-m>\n <div class=\"user-cell\">\n <hm-account-avatar class=\"user-cell__avatar\" [name]=\"m.name || m.username\" [imageUrl]=\"m.picture\"></hm-account-avatar>\n <div class=\"user-cell__body\">\n <div class=\"user-cell__name\">\n <b>{{ m.name || m.username }}</b>\n <hm-tag *ngIf=\"m.new\" [name]=\"text.newMember\" color=\"info\" />\n </div>\n <div class=\"user-cell__email\">\n <ng-container *ngIf=\"m.name\">{{ m.username }} \u00B7 </ng-container>{{ m.email }}\n </div>\n </div>\n </div>\n </ng-template>\n\n <ng-template hmCell=\"role\" let-m>\n <hm-select class=\"role-cell\" [label]=\"text.colRole\" labelHidden [disabled]=\"isMarkedForRemoval(m)\"\n [value]=\"m.role ?? ''\" (valueChange)=\"m.role = $event || null\">\n <option value=\"\">\u2014</option>\n <option *ngFor=\"let r of roleOptions\" [value]=\"r\">{{ r }}</option>\n </hm-select>\n </ng-template>\n\n <ng-template hmCell=\"joined_at\" let-m>\n <ng-container *ngIf=\"m.joined_at\">\n {{ formatDate(m.joined_at) }}\n <div class=\"muted\" *ngIf=\"m.added_by_username\">{{ fmt(text.addedBy, { user: m.added_by_username }) }}</div>\n </ng-container>\n <ng-container *ngIf=\"!m.joined_at\">\u2014</ng-container>\n </ng-template>\n </hm-data-grid>\n </div>\n\n <div class=\"members-split__removal\">\n <hm-card class=\"removal-card\">\n <div class=\"removal-header\">\n <hm-icon shape=\"trash\"></hm-icon> {{ text.removal }} <hm-badge [value]=\"removalCount\" intent=\"danger\" />\n </div>\n\n <div class=\"removal-empty\" *ngIf=\"removalCount === 0\">\n <hm-icon shape=\"employee-group\" size=\"xxl\"></hm-icon>\n <p class=\"muted\">{{ text.removalEmpty }}</p>\n </div>\n\n <div class=\"removal-item\" *ngFor=\"let m of checkedForRemoval\">\n <div class=\"user-cell\">\n <hm-account-avatar class=\"user-cell__avatar\" [name]=\"m.name || m.username\"></hm-account-avatar>\n <div class=\"user-cell__body\">\n <b>{{ m.name || m.username }}</b>\n <div class=\"user-cell__email\">\n <ng-container *ngIf=\"m.name\">{{ m.username }} \u00B7 </ng-container>{{ m.email }}\n </div>\n </div>\n </div>\n <hm-icon-button emphasis=\"subtle\" icon=\"undo\" [label]=\"text.undoRemoval\" (clicked)=\"undoRemoval(m)\" />\n </div>\n </hm-card>\n </div>\n </div>\n </div>\n\n <ng-container footer>\n <hm-button emphasis=\"medium\" (clicked)=\"close()\">{{ text.cancel }}</hm-button>\n <hm-button [loading]=\"saving\" [disabled]=\"saving\" (clicked)=\"save()\" icon=\"floppy\">\n {{ text.saveChanges }}\n </hm-button>\n </ng-container>\n</hm-modal>\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)}.as-secret{display:grid;gap:var(--hm-space-micro)}.as-secret__label{color:var(--hm-muted);font-size:var(--hm-font-size-xs)}.as-secret__row{display:flex;flex-wrap:wrap;align-items:center;gap:var(--hm-space-xs)}.as-secret__value{flex:1 1 240px;min-width:0;border:var(--hm-border-hairline) solid var(--hm-divider);border-radius:var(--hm-radius-control);padding:var(--hm-space-xs) var(--hm-space-sm);background:var(--hm-surface);color:var(--hm-text);font-family:var(--hm-font-mono);font-size:var(--hm-font-size-sm);overflow-wrap:anywhere;-webkit-user-select:all;user-select:all}:host{display:contents}.add-section__row{display:flex;flex-wrap:wrap;align-items:flex-end;gap:var(--hm-space-sm)}.add-section__role{flex:0 1 14rem}.add-field{display:flex;flex:1 1 20rem;flex-direction:column;gap:var(--hm-space-micro);min-inline-size:0}.add-field__label{color:var(--hm-text);font-size:var(--hm-font-size-sm);font-weight:var(--hm-font-weight-semibold)}.add-search{position:relative;display:flex;align-items:center;gap:var(--hm-space-xs);height:var(--hm-control-height);padding:0 var(--hm-space-sm);border:var(--hm-border-hairline) solid var(--hm-border);border-radius:var(--hm-radius-control);background:var(--hm-surface-raised);color:var(--hm-muted)}.add-search:focus-within{border-color:var(--hm-action);outline:2px solid var(--hm-focus-color);outline-offset:1px}.add-search input{flex:1;height:100%;border:none;outline:none;background:transparent;color:var(--hm-text);font:inherit;font-size:var(--hm-font-size-sm)}.add-search input::placeholder{color:var(--hm-placeholder)}.add-search__clear{flex-shrink:0;cursor:pointer}.add-search__results{position:absolute;top:calc(100% + var(--hm-space-micro));right:0;left:0;z-index:20;max-height:14rem;overflow-y:auto;border:var(--hm-border-hairline) solid var(--hm-border);border-radius:var(--hm-radius-control);background:var(--hm-surface);box-shadow:var(--hm-shadow-overlay)}.add-search__result{display:flex;flex-direction:column;gap:var(--hm-space-micro);width:100%;padding:var(--hm-space-xs) var(--hm-space-sm);border:none;border-bottom:var(--hm-border-hairline) solid var(--hm-divider);background:transparent;color:var(--hm-text);font:inherit;font-size:var(--hm-font-size-sm);text-align:start;cursor:pointer}.add-search__result:last-child{border-bottom:none}.add-search__result:hover{background:var(--hm-hover)}.suggestions{display:flex;flex-direction:column;gap:var(--hm-space-sm);margin-top:var(--hm-space-sm)}.suggestions__row{display:flex;flex-wrap:wrap;align-items:center;gap:var(--hm-space-xs)}.suggestion-card{display:flex;flex-direction:column;gap:var(--hm-space-micro);padding:var(--hm-space-xs) var(--hm-space-sm);border:var(--hm-border-hairline) solid var(--hm-border);border-radius:var(--hm-radius-control);background:var(--hm-surface);color:var(--hm-text);font:inherit;font-size:var(--hm-font-size-sm);text-align:start;cursor:pointer}.suggestion-card:hover{border-color:var(--hm-action)}.members-split{display:flex;flex-wrap:wrap;align-items:stretch;gap:var(--hm-space-md)}.members-split__grid{flex:2 1 30rem;min-width:0}.members-split__removal{flex:1 1 17rem;min-width:0}.role-cell{display:block;min-inline-size:10rem}.user-cell{display:flex;align-items:center;gap:var(--hm-space-xs)}.user-cell__avatar{flex-shrink:0}.user-cell__body{min-width:0}.user-cell__name{display:flex;flex-wrap:wrap;align-items:center;gap:var(--hm-space-xs)}.user-cell__email{margin-top:var(--hm-space-micro);color:var(--hm-muted);font-size:var(--hm-font-size-xs)}.removal-card{display:block;height:100%}.removal-header{display:flex;align-items:center;gap:var(--hm-space-xs);margin-bottom:var(--hm-space-sm);color:var(--hm-danger);font-weight:var(--hm-font-weight-semibold)}.removal-empty{display:flex;flex-direction:column;align-items:center;gap:var(--hm-space-sm);padding:var(--hm-space-xl) var(--hm-space-sm);color:var(--hm-muted);text-align:center}.removal-empty p{max-width:16rem;margin:0}.removal-item{display:flex;align-items:center;justify-content:space-between;gap:var(--hm-space-xs);padding:var(--hm-space-xs) 0;border-bottom:var(--hm-border-hairline) solid var(--hm-divider)}.removal-item:last-child{border-bottom:none}\n"] }]
383
+ }], ctorParameters: () => [{ type: AutoServiceService }], propDecorators: { clientId: [{
384
+ type: Input
385
+ }], groupId: [{
386
+ type: Input
387
+ }], groupName: [{
388
+ type: Input
389
+ }], open: [{
390
+ type: Input
391
+ }], openChange: [{
392
+ type: Output
393
+ }], saved: [{
394
+ type: Output
395
+ }] } });
396
+
397
+ /**
398
+ * Grupos do projeto do client: tabela (Nome/Tipo/Situação) com criar, editar e excluir; o grupo aberto mostra o
399
+ * resumo e os membros. O grupo de administração do projeto (`is_admin`) é gerido só no painel central (Argos): o
400
+ * servidor não o devolve no auto-serviço e, se um servidor antigo devolver, a tela descarta. Mirror de admin/ui/.../features/admin/groups (argos-admin), escopado em `/auto-service/:clientId`.
401
+ */
402
+ class AutoServiceGroupsComponent {
403
+ constructor() {
404
+ this.text = inject(SPINE_MESSAGES).autoService;
405
+ /** Telas com estado em campo comum, preenchido depois de `await`: marca a view ao terminar (app sem zone.js). */
406
+ this.cdr = inject(ChangeDetectorRef);
407
+ this.dialogs = inject(HermesDialogService);
408
+ this.deletion = inject(AutoServiceDeleteFeedback);
409
+ this.service = inject(AutoServiceService);
410
+ this.client = null;
411
+ this.groups = [];
412
+ this.groupTypes = [];
413
+ this.loading = false;
414
+ /** Grupo aberto (resumo + membros embaixo da tabela). */
415
+ this.group = null;
416
+ this.memberCount = 0;
417
+ this.showMembersModal = false;
418
+ this.membersVersion = 0;
419
+ /** Grupo do modal de criar/editar; `null` cria. */
420
+ this.modalGroup = null;
421
+ this.showGroupModal = false;
422
+ this.rowId = (g) => g.id;
423
+ this.columns = computed(() => [
424
+ { key: 'name', title: this.text.colName, value: (g) => g.name, sortable: true },
425
+ { key: 'type', title: this.text.colType, value: (g) => g.type?.name ?? '—', sortable: true },
426
+ { key: 'status', title: this.text.colStatus, value: (g) => (g.enabled ? this.text.active : this.text.inactive), sortable: true },
427
+ ], ...(ngDevMode ? [{ debugName: "columns" }] : /* istanbul ignore next */ []));
428
+ this.rowActions = computed(() => [
429
+ { id: 'edit', icon: 'pencil', label: this.text.edit },
430
+ {
431
+ id: 'delete', icon: 'trash', label: this.text.delete, danger: true, separatorAbove: true,
432
+ confirm: (g) => ({ heading: this.text.confirmDeleteGroupHeading, message: formatMessage(this.text.confirmDeleteGroup, { name: g.name }) }),
433
+ },
434
+ ], ...(ngDevMode ? [{ debugName: "rowActions" }] : /* istanbul ignore next */ []));
435
+ }
436
+ onClientChange(c) {
437
+ this.client = c;
438
+ this.group = null;
439
+ this.groups = [];
440
+ void this.load();
441
+ }
442
+ /** Cor do selo do tipo de grupo (`hm-tag`): quanto mais alto o nível, mais "quente". O texto do
443
+ * selo é o nome do tipo — a cor só reforça (WCAG 1.4.1). */
444
+ levelTagColor(level) {
445
+ if (!level)
446
+ return 'neutral';
447
+ if (level >= 50)
448
+ return 'danger';
449
+ if (level >= 40)
450
+ return 'warning';
451
+ if (level >= 30)
452
+ return 'info';
453
+ if (level >= 20)
454
+ return 'success';
455
+ return 'neutral';
456
+ }
457
+ openGroupLabel(g) { return formatMessage(this.text.openGroup, { name: g.name }); }
458
+ /** Grupos (do tipo de nível mais alto para o mais baixo) e os tipos do realm, juntos. */
459
+ async load() {
460
+ const client = this.client;
461
+ if (!client) {
462
+ this.groups = [];
463
+ this.groupTypes = [];
464
+ return;
465
+ }
466
+ this.loading = true;
467
+ this.cdr.markForCheck();
468
+ try {
469
+ // Sem os tipos (admin-server sem `group-types`) a lista abre igual; só o modal fica sem tipo para escolher.
470
+ const [groups, types] = await Promise.all([
471
+ this.service.getGroups(client.id),
472
+ this.service.getGroupTypes(client.id).catch(() => ({ group_types: [] })),
473
+ ]);
474
+ if (this.client?.id !== client.id)
475
+ return;
476
+ // O grupo de administração não é do auto-serviço; servidor antigo ainda o devolve.
477
+ this.groups = (groups.groups ?? []).filter((g) => !g.is_admin).sort((a, b) => (b.type?.level ?? 0) - (a.type?.level ?? 0));
478
+ this.groupTypes = types.group_types ?? [];
479
+ // O grupo aberto acompanha o que o servidor devolveu (nome/descrição novos) ou fecha se sumiu.
480
+ if (this.group)
481
+ this.group = this.groups.find((g) => g.id === this.group.id) ?? null;
482
+ }
483
+ finally {
484
+ this.loading = false;
485
+ this.cdr.markForCheck();
486
+ }
487
+ }
488
+ openGroup(g) {
489
+ if (this.group?.id !== g.id)
490
+ this.memberCount = 0;
491
+ this.group = g;
492
+ this.cdr.markForCheck();
493
+ }
494
+ openCreate() { this.modalGroup = null; this.showGroupModal = true; this.cdr.markForCheck(); }
495
+ openEdit(g) { this.modalGroup = g; this.showGroupModal = true; this.cdr.markForCheck(); }
496
+ async onGroupSaved(saved) {
497
+ await this.load();
498
+ // Recém-criado já abre, para incluir os membros em seguida.
499
+ const fresh = this.groups.find((g) => g.id === saved?.id);
500
+ if (fresh)
501
+ this.group = fresh;
502
+ this.cdr.markForCheck();
503
+ }
504
+ /** Botão Excluir do resumo: confirma e exclui. A ação da tabela já confirma pelo `confirm` dela. */
505
+ async confirmDelete(g) {
506
+ const ok = await this.dialogs.confirm({
507
+ heading: this.text.confirmDeleteGroupHeading,
508
+ message: formatMessage(this.text.confirmDeleteGroup, { name: g.name }),
509
+ confirmLabel: this.text.delete,
510
+ danger: true,
511
+ });
512
+ if (ok)
513
+ await this.deleteGroup(g);
514
+ }
515
+ async deleteGroup(g) {
516
+ if (!this.client)
517
+ return;
518
+ if (!(await this.deletion.run(() => this.service.deleteGroup(this.client.id, g.id))))
519
+ return;
520
+ if (this.group?.id === g.id)
521
+ this.group = null;
522
+ await this.load();
523
+ }
524
+ onAction(e) {
525
+ if (e.action === 'edit')
526
+ this.openEdit(e.row);
527
+ if (e.action === 'delete')
528
+ void this.deleteGroup(e.row);
529
+ }
530
+ openMembers() { this.showMembersModal = true; }
531
+ onMembersSaved() { this.membersVersion++; }
532
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.24", ngImport: i0, type: AutoServiceGroupsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
533
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.24", type: AutoServiceGroupsComponent, isStandalone: true, selector: "spine-auto-service-groups", 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\n <ng-container *ngIf=\"client\">\n <!-- Clicar na linha (ou no nome, pelo teclado) abre o grupo embaixo da tabela. -->\n <hm-data-grid\n [columns]=\"columns()\"\n [rows]=\"groups\"\n [rowId]=\"rowId\"\n [caption]=\"text.groupsCaption\"\n [loading]=\"loading\"\n [rowActions]=\"rowActions()\"\n [emptyMessage]=\"text.noGroups\"\n rowClickable\n (rowClicked)=\"openGroup($event)\"\n (actionTriggered)=\"onAction($event)\"\n >\n <hm-button dataGridActions icon=\"plus\" (clicked)=\"openCreate()\">{{ text.newGroup }}</hm-button>\n <ng-template hmCell=\"name\" let-g>\n <span class=\"name-cell\">\n <button type=\"button\" class=\"name-cell__open\" [attr.aria-label]=\"openGroupLabel(g)\"\n [attr.aria-current]=\"group?.id === g.id ? 'true' : null\" (click)=\"openGroup(g)\">{{ g.name }}</button>\n </span>\n </ng-template>\n <ng-template hmCell=\"type\" let-g>\n <hm-tag *ngIf=\"g.type?.name; else noType\" [name]=\"g.type.name\" [color]=\"levelTagColor(g.type?.level)\" />\n <ng-template #noType>\u2014</ng-template>\n </ng-template>\n <ng-template hmCell=\"status\" let-g>\n <hm-tag [name]=\"g.enabled ? text.active : text.inactive\" [color]=\"g.enabled ? 'success' : 'danger'\" />\n </ng-template>\n </hm-data-grid>\n\n <ng-container *ngIf=\"group as g\">\n <hm-card>\n <div class=\"as-summary\">\n <div class=\"as-summary__info\">\n <p class=\"as-summary__title group-title\">\n {{ g.name }}\n <hm-tag *ngIf=\"g.type?.name\" [name]=\"g.type!.name\" [color]=\"levelTagColor(g.type?.level)\" />\n <hm-tag [name]=\"g.enabled ? text.active : text.inactive\" [color]=\"g.enabled ? 'success' : 'danger'\" />\n </p>\n <p class=\"as-summary__detail\">{{ g.description || text.noDescription }}</p>\n </div>\n <div class=\"as-actions\">\n <hm-button emphasis=\"medium\" icon=\"pencil\" (clicked)=\"openEdit(g)\">{{ text.edit }}</hm-button>\n <hm-button intent=\"danger\" emphasis=\"medium\" icon=\"trash\" (clicked)=\"confirmDelete(g)\">{{ text.delete }}</hm-button>\n </div>\n </div>\n </hm-card>\n\n <spine-auto-service-group-members [clientId]=\"client.id\" [groupId]=\"g.id\" [refreshTrigger]=\"membersVersion\"\n (countChange)=\"memberCount = $event\" (manageMembers)=\"openMembers()\"></spine-auto-service-group-members>\n\n <spine-auto-service-group-members-modal [clientId]=\"client.id\" [groupId]=\"g.id\" [groupName]=\"g.name\"\n [open]=\"showMembersModal\" (openChange)=\"showMembersModal = $event\" (saved)=\"onMembersSaved()\">\n </spine-auto-service-group-members-modal>\n </ng-container>\n\n <spine-auto-service-group-modal [clientId]=\"client.id\" [group]=\"modalGroup\" [groupTypes]=\"groupTypes\"\n [open]=\"showGroupModal\" (openChange)=\"showGroupModal = $event\" (saved)=\"onGroupSaved($event)\">\n </spine-auto-service-group-modal>\n </ng-container>\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)}.as-secret{display:grid;gap:var(--hm-space-micro)}.as-secret__label{color:var(--hm-muted);font-size:var(--hm-font-size-xs)}.as-secret__row{display:flex;flex-wrap:wrap;align-items:center;gap:var(--hm-space-xs)}.as-secret__value{flex:1 1 240px;min-width:0;border:var(--hm-border-hairline) solid var(--hm-divider);border-radius:var(--hm-radius-control);padding:var(--hm-space-xs) var(--hm-space-sm);background:var(--hm-surface);color:var(--hm-text);font-family:var(--hm-font-mono);font-size:var(--hm-font-size-sm);overflow-wrap:anywhere;-webkit-user-select:all;user-select:all}:host{display:block}.name-cell{display:inline-flex;flex-wrap:wrap;align-items:center;gap:var(--hm-space-xs)}.name-cell__open{padding:0;border:0;background:none;color:inherit;font:inherit;font-weight:var(--hm-font-weight-semibold);text-align:start;cursor:pointer}.name-cell__open:hover,.name-cell__open[aria-current=true]{text-decoration:underline}.name-cell__open:focus-visible{border-radius:var(--hm-radius-micro);outline:var(--hm-border-thin) solid var(--hm-accent);outline-offset:var(--hm-space-micro)}\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: CardComponent, selector: "hm-card", inputs: ["heading", "icon", "selected", "fill", "media", "mediaAlt", "mediaDecorative", "mediaPosition"] }, { 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"] }, { kind: "component", type: AutoServiceClientPickerComponent, selector: "spine-auto-service-client-picker", outputs: ["clientChange"] }, { kind: "component", type: AutoServiceGroupModalComponent, selector: "spine-auto-service-group-modal", inputs: ["group", "clientId", "groupTypes", "open"], outputs: ["openChange", "saved"] }, { kind: "component", type: AutoServiceGroupMembersComponent, selector: "spine-auto-service-group-members", inputs: ["clientId", "groupId", "refreshTrigger"], outputs: ["countChange", "manageMembers"] }, { kind: "component", type: AutoServiceGroupMembersModalComponent, selector: "spine-auto-service-group-members-modal", inputs: ["clientId", "groupId", "groupName", "open"], outputs: ["openChange", "saved"] }], changeDetection: i0.ChangeDetectionStrategy.Eager }); }
534
+ }
535
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.24", ngImport: i0, type: AutoServiceGroupsComponent, decorators: [{
536
+ type: Component,
537
+ args: [{ selector: 'spine-auto-service-groups', standalone: true, imports: [
538
+ CommonModule, ButtonComponent, CardComponent, DataGridComponent, DataGridCellDirective, TagComponent,
539
+ AutoServiceClientPickerComponent, AutoServiceGroupModalComponent, AutoServiceGroupMembersComponent, AutoServiceGroupMembersModalComponent,
540
+ ], 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\n <ng-container *ngIf=\"client\">\n <!-- Clicar na linha (ou no nome, pelo teclado) abre o grupo embaixo da tabela. -->\n <hm-data-grid\n [columns]=\"columns()\"\n [rows]=\"groups\"\n [rowId]=\"rowId\"\n [caption]=\"text.groupsCaption\"\n [loading]=\"loading\"\n [rowActions]=\"rowActions()\"\n [emptyMessage]=\"text.noGroups\"\n rowClickable\n (rowClicked)=\"openGroup($event)\"\n (actionTriggered)=\"onAction($event)\"\n >\n <hm-button dataGridActions icon=\"plus\" (clicked)=\"openCreate()\">{{ text.newGroup }}</hm-button>\n <ng-template hmCell=\"name\" let-g>\n <span class=\"name-cell\">\n <button type=\"button\" class=\"name-cell__open\" [attr.aria-label]=\"openGroupLabel(g)\"\n [attr.aria-current]=\"group?.id === g.id ? 'true' : null\" (click)=\"openGroup(g)\">{{ g.name }}</button>\n </span>\n </ng-template>\n <ng-template hmCell=\"type\" let-g>\n <hm-tag *ngIf=\"g.type?.name; else noType\" [name]=\"g.type.name\" [color]=\"levelTagColor(g.type?.level)\" />\n <ng-template #noType>\u2014</ng-template>\n </ng-template>\n <ng-template hmCell=\"status\" let-g>\n <hm-tag [name]=\"g.enabled ? text.active : text.inactive\" [color]=\"g.enabled ? 'success' : 'danger'\" />\n </ng-template>\n </hm-data-grid>\n\n <ng-container *ngIf=\"group as g\">\n <hm-card>\n <div class=\"as-summary\">\n <div class=\"as-summary__info\">\n <p class=\"as-summary__title group-title\">\n {{ g.name }}\n <hm-tag *ngIf=\"g.type?.name\" [name]=\"g.type!.name\" [color]=\"levelTagColor(g.type?.level)\" />\n <hm-tag [name]=\"g.enabled ? text.active : text.inactive\" [color]=\"g.enabled ? 'success' : 'danger'\" />\n </p>\n <p class=\"as-summary__detail\">{{ g.description || text.noDescription }}</p>\n </div>\n <div class=\"as-actions\">\n <hm-button emphasis=\"medium\" icon=\"pencil\" (clicked)=\"openEdit(g)\">{{ text.edit }}</hm-button>\n <hm-button intent=\"danger\" emphasis=\"medium\" icon=\"trash\" (clicked)=\"confirmDelete(g)\">{{ text.delete }}</hm-button>\n </div>\n </div>\n </hm-card>\n\n <spine-auto-service-group-members [clientId]=\"client.id\" [groupId]=\"g.id\" [refreshTrigger]=\"membersVersion\"\n (countChange)=\"memberCount = $event\" (manageMembers)=\"openMembers()\"></spine-auto-service-group-members>\n\n <spine-auto-service-group-members-modal [clientId]=\"client.id\" [groupId]=\"g.id\" [groupName]=\"g.name\"\n [open]=\"showMembersModal\" (openChange)=\"showMembersModal = $event\" (saved)=\"onMembersSaved()\">\n </spine-auto-service-group-members-modal>\n </ng-container>\n\n <spine-auto-service-group-modal [clientId]=\"client.id\" [group]=\"modalGroup\" [groupTypes]=\"groupTypes\"\n [open]=\"showGroupModal\" (openChange)=\"showGroupModal = $event\" (saved)=\"onGroupSaved($event)\">\n </spine-auto-service-group-modal>\n </ng-container>\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)}.as-secret{display:grid;gap:var(--hm-space-micro)}.as-secret__label{color:var(--hm-muted);font-size:var(--hm-font-size-xs)}.as-secret__row{display:flex;flex-wrap:wrap;align-items:center;gap:var(--hm-space-xs)}.as-secret__value{flex:1 1 240px;min-width:0;border:var(--hm-border-hairline) solid var(--hm-divider);border-radius:var(--hm-radius-control);padding:var(--hm-space-xs) var(--hm-space-sm);background:var(--hm-surface);color:var(--hm-text);font-family:var(--hm-font-mono);font-size:var(--hm-font-size-sm);overflow-wrap:anywhere;-webkit-user-select:all;user-select:all}:host{display:block}.name-cell{display:inline-flex;flex-wrap:wrap;align-items:center;gap:var(--hm-space-xs)}.name-cell__open{padding:0;border:0;background:none;color:inherit;font:inherit;font-weight:var(--hm-font-weight-semibold);text-align:start;cursor:pointer}.name-cell__open:hover,.name-cell__open[aria-current=true]{text-decoration:underline}.name-cell__open:focus-visible{border-radius:var(--hm-radius-micro);outline:var(--hm-border-thin) solid var(--hm-accent);outline-offset:var(--hm-space-micro)}\n"] }]
541
+ }] });
542
+
543
+ export { AutoServiceGroupsComponent };
544
+ //# sourceMappingURL=trismegisto-spine-auto-service-auto-service-groups.component-UVMGF7-B.mjs.map