@senior-gestao-relacionamento/angular-components 2.0.0 → 2.1.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 (30) hide show
  1. package/esm2022/lib/components/schedule/entities/participant-lookup.interface.mjs +2 -0
  2. package/esm2022/lib/components/schedule/entities/schedule-type.interface.mjs +2 -0
  3. package/esm2022/lib/components/schedule/entities/schedule.interface.mjs +2 -0
  4. package/esm2022/lib/components/schedule/enums/schedule.enums.mjs +65 -0
  5. package/esm2022/lib/components/schedule/helpers/schedule-date.helpers.mjs +109 -0
  6. package/esm2022/lib/components/schedule/helpers/schedule-display.helpers.mjs +108 -0
  7. package/esm2022/lib/components/schedule/schedule-detail/schedule-detail.component.mjs +79 -0
  8. package/esm2022/lib/components/schedule/schedule-form/schedule-form.component.mjs +737 -0
  9. package/esm2022/lib/components/schedule/services/schedule-type.service.mjs +33 -0
  10. package/esm2022/lib/components/schedule/services/schedule.service.mjs +66 -0
  11. package/esm2022/lib/config/provide-angular-components-translations.mjs +42 -0
  12. package/esm2022/lib/i18n/en-US.json +101 -0
  13. package/esm2022/lib/i18n/es-ES.json +101 -0
  14. package/esm2022/lib/i18n/pt-BR.json +101 -0
  15. package/esm2022/public-api.mjs +9 -1
  16. package/fesm2022/senior-gestao-relacionamento-angular-components.mjs +1511 -3
  17. package/fesm2022/senior-gestao-relacionamento-angular-components.mjs.map +1 -1
  18. package/lib/components/schedule/entities/participant-lookup.interface.d.ts +38 -0
  19. package/lib/components/schedule/entities/schedule-type.interface.d.ts +10 -0
  20. package/lib/components/schedule/entities/schedule.interface.d.ts +70 -0
  21. package/lib/components/schedule/enums/schedule.enums.d.ts +56 -0
  22. package/lib/components/schedule/helpers/schedule-date.helpers.d.ts +9 -0
  23. package/lib/components/schedule/helpers/schedule-display.helpers.d.ts +17 -0
  24. package/lib/components/schedule/schedule-detail/schedule-detail.component.d.ts +43 -0
  25. package/lib/components/schedule/schedule-form/schedule-form.component.d.ts +139 -0
  26. package/lib/components/schedule/services/schedule-type.service.d.ts +19 -0
  27. package/lib/components/schedule/services/schedule.service.d.ts +57 -0
  28. package/lib/config/provide-angular-components-translations.d.ts +20 -0
  29. package/package.json +3 -2
  30. package/public-api.d.ts +9 -0
@@ -0,0 +1,139 @@
1
+ import { EventEmitter, OnInit } from '@angular/core';
2
+ import { FormBuilder, FormGroup } from '@angular/forms';
3
+ import { DynamicFormComponent, DynamicFormFieldConfig, TranslationService } from '@seniorsistemas/components-ai';
4
+ import { CurrentCollaboratorService } from '../../../services/current-collaborator/current-collaborator.service';
5
+ import { ScheduleService } from '../services/schedule.service';
6
+ import { ScheduleTypeService } from '../services/schedule-type.service';
7
+ import { ScheduleParticipant } from '../entities/schedule.interface';
8
+ import { ParticipantLookup, ParticipantOrigin } from '../entities/participant-lookup.interface';
9
+ import { ScheduleType } from '../entities/schedule-type.interface';
10
+ import { PrioritySeverity, ConfirmationSeverity } from '../helpers/schedule-display.helpers';
11
+ import * as i0 from "@angular/core";
12
+ export declare class ScheduleFormComponent implements OnInit {
13
+ private readonly fb;
14
+ private readonly scheduleService;
15
+ private readonly scheduleTypeService;
16
+ private readonly currentCollaboratorService;
17
+ private readonly t;
18
+ visible: boolean;
19
+ selectedDate: Date;
20
+ visibleChange: EventEmitter<boolean>;
21
+ saved: EventEmitter<string>;
22
+ detailFormComponent: DynamicFormComponent;
23
+ scheduleDetailFields: DynamicFormFieldConfig[];
24
+ entityDataForForm: Record<string, unknown> | null;
25
+ scheduleForm: FormGroup;
26
+ isEditing: boolean;
27
+ currentCollaboratorId: string | null;
28
+ scheduleTypes: ScheduleType[];
29
+ participants: ScheduleParticipant[];
30
+ participantsLoading: boolean;
31
+ recurrenceDescription: string;
32
+ /** S2933: Mark as readonly */
33
+ private readonly recurrenceChange$;
34
+ participantSuggestions: ParticipantLookup[];
35
+ selectedParticipantLookup: ParticipantLookup | null;
36
+ addedParticipants: ParticipantLookup[];
37
+ priorityOptions: {
38
+ label: string;
39
+ value: string;
40
+ }[];
41
+ recurrenceOptions: {
42
+ label: string;
43
+ value: string;
44
+ }[];
45
+ weekDayOptions: {
46
+ label: string;
47
+ value: string;
48
+ }[];
49
+ repeatWhenOptions: {
50
+ label: string;
51
+ value: string;
52
+ }[];
53
+ ordinalOptions: {
54
+ label: string;
55
+ value: string;
56
+ }[];
57
+ monthOptions: {
58
+ label: string;
59
+ value: string;
60
+ }[];
61
+ /** S2933: Mark constructor-injected services as readonly */
62
+ constructor(fb: FormBuilder, scheduleService: ScheduleService, scheduleTypeService: ScheduleTypeService, currentCollaboratorService: CurrentCollaboratorService, t: TranslationService);
63
+ ngOnInit(): void;
64
+ private loadCollaborator;
65
+ private initOptions;
66
+ private initDetailFields;
67
+ onDetailFormReady(form: FormGroup): void;
68
+ /** S121: Add braces to all if statements */
69
+ private addRecurrenceControls;
70
+ /**
71
+ * S1541: Break setupRecurrenceFormWatchers into smaller helpers
72
+ * to reduce cyclomatic complexity
73
+ */
74
+ private setupRecurrenceFormWatchers;
75
+ private watchRecurrenceChanges;
76
+ private handleRecurrenceWeekDays;
77
+ private handleRecurrenceMonthlyYearly;
78
+ private handleRecurrenceYearlyMonth;
79
+ private watchRepeatWhenChanges;
80
+ private watchWithRecurrenceChanges;
81
+ private onRecurrenceEnabled;
82
+ private onRecurrenceDisabled;
83
+ private initForm;
84
+ private setupRecurrenceDescriptionWatcher;
85
+ private fetchRecurrenceDescription;
86
+ private buildRecurrencePayload;
87
+ private buildDateTimePayload;
88
+ private buildNullableRecurrenceFields;
89
+ private loadScheduleTypes;
90
+ openNew(): void;
91
+ openEdit(scheduleId: string): void;
92
+ private loadParticipants;
93
+ private participantToLookup;
94
+ onSearchParticipants(event: {
95
+ query: string;
96
+ }): void;
97
+ onSelectParticipant(participant: ParticipantLookup): void;
98
+ onRemoveParticipant(participant: ParticipantLookup): void;
99
+ /**
100
+ * S1541: Break onSave into smaller helpers to reduce complexity
101
+ * S121/S2681: Add braces to all if statements
102
+ */
103
+ onSave(): void;
104
+ private buildSavePayload;
105
+ private clearRecurrencePayload;
106
+ onCancel(): void;
107
+ private buildManageParticipantsPayload;
108
+ /**
109
+ * S1541: Break cleanRecurrenceFields into smaller helpers
110
+ * S121/S2681: Add braces to all if statements
111
+ */
112
+ private cleanRecurrenceFields;
113
+ private cleanDailyWeeklyFields;
114
+ private cleanMonthlyFields;
115
+ private cleanYearlyFields;
116
+ private cleanRepeatWhenFields;
117
+ private resetRecurrenceDefaults;
118
+ get showRecurrenceFields(): boolean;
119
+ get currentRecurrence(): string;
120
+ get currentRepeatWhen(): string;
121
+ get showWeekDays(): boolean;
122
+ get showRepeatWhen(): boolean;
123
+ get showRepeatWhenDay(): boolean;
124
+ get showOrdinalFields(): boolean;
125
+ get showMonthField(): boolean;
126
+ getOriginLabel(o: ParticipantOrigin): string;
127
+ getOriginIcon(o: ParticipantOrigin): string;
128
+ getParticipantName(p: ScheduleParticipant): string;
129
+ getParticipantType(p: ScheduleParticipant): string;
130
+ getParticipantTypeIcon(p: ScheduleParticipant): string;
131
+ getPrioritySeverity(p: string): PrioritySeverity;
132
+ getPriorityLabel(p: string): string;
133
+ getConfirmationSeverity(c: string): ConfirmationSeverity;
134
+ getConfirmationLabel(c: string): string;
135
+ private getDefaultStartTime;
136
+ private getDefaultEndTime;
137
+ static ɵfac: i0.ɵɵFactoryDeclaration<ScheduleFormComponent, never>;
138
+ static ɵcmp: i0.ɵɵComponentDeclaration<ScheduleFormComponent, "s-schedule-form", never, { "visible": { "alias": "visible"; "required": false; }; "selectedDate": { "alias": "selectedDate"; "required": false; }; }, { "visibleChange": "visibleChange"; "saved": "saved"; }, never, never, true, never>;
139
+ }
@@ -0,0 +1,19 @@
1
+ import { HttpClient } from '@angular/common/http';
2
+ import { Observable } from 'rxjs';
3
+ import { ScheduleType } from '../entities/schedule-type.interface';
4
+ import * as i0 from "@angular/core";
5
+ export declare class ScheduleTypeService {
6
+ private readonly http;
7
+ private readonly entityUrl;
8
+ constructor(http: HttpClient);
9
+ list(params?: {
10
+ size?: number;
11
+ filterQuery?: string;
12
+ }): Observable<{
13
+ contents: ScheduleType[];
14
+ totalElements: number;
15
+ }>;
16
+ get(id: string): Observable<ScheduleType>;
17
+ static ɵfac: i0.ɵɵFactoryDeclaration<ScheduleTypeService, never>;
18
+ static ɵprov: i0.ɵɵInjectableDeclaration<ScheduleTypeService>;
19
+ }
@@ -0,0 +1,57 @@
1
+ import { HttpClient } from '@angular/common/http';
2
+ import { Observable } from 'rxjs';
3
+ import { Schedule, RecurrenceDatesRecord, ScheduleParticipant } from '../entities/schedule.interface';
4
+ import { ParticipantLookup, ScheduleSummaryByDate } from '../entities/participant-lookup.interface';
5
+ import * as i0 from "@angular/core";
6
+ interface GetRecurrencesByDateResponse {
7
+ dates: RecurrenceDatesRecord[];
8
+ schedules: ScheduleSummaryByDate[];
9
+ }
10
+ export declare class ScheduleService {
11
+ private readonly http;
12
+ private readonly entityUrl;
13
+ private readonly actionsUrl;
14
+ private readonly queriesUrl;
15
+ constructor(http: HttpClient);
16
+ get(id: string): Observable<Schedule>;
17
+ insert(entity: Record<string, unknown>): Observable<Record<string, unknown>>;
18
+ update(id: string, entity: Record<string, unknown>): Observable<Record<string, unknown>>;
19
+ delete(id: string): Observable<void>;
20
+ getRecurrencesByDate(startDate: string, endDate: string): Observable<GetRecurrencesByDateResponse>;
21
+ generateRecurrenceDescription(payload: Record<string, unknown>): Observable<{
22
+ description: string;
23
+ }>;
24
+ acceptSchedule(scheduleId: string, participantId?: string, date?: string): Observable<{
25
+ accepted: boolean;
26
+ }>;
27
+ rejectSchedule(scheduleId: string, participantId?: string, date?: string): Observable<{
28
+ rejected: boolean;
29
+ }>;
30
+ cancelSchedule(scheduleId: string, date?: string): Observable<{
31
+ accepted: boolean;
32
+ }>;
33
+ manageParticipants(scheduleId: string, participants: {
34
+ accountsId?: string[];
35
+ accountContactsId?: string[];
36
+ collaboratorsId?: string[];
37
+ externalParticipantsId?: string[];
38
+ }): Observable<void>;
39
+ listParticipants(scheduleId: string): Observable<{
40
+ contents: ScheduleParticipant[];
41
+ }>;
42
+ searchParticipantLookup(filter: string, size?: number, offset?: number): Observable<{
43
+ contents: ParticipantLookup[];
44
+ totalElements: number;
45
+ totalPages: number;
46
+ }>;
47
+ list(params?: {
48
+ size?: number;
49
+ filterQuery?: string;
50
+ }): Observable<{
51
+ contents: Record<string, unknown>[];
52
+ totalElements: number;
53
+ }>;
54
+ static ɵfac: i0.ɵɵFactoryDeclaration<ScheduleService, never>;
55
+ static ɵprov: i0.ɵɵInjectableDeclaration<ScheduleService>;
56
+ }
57
+ export {};
@@ -0,0 +1,20 @@
1
+ import { Provider } from '@angular/core';
2
+ /**
3
+ * Cria um TranslationLoader que combina as traduções do angular-components
4
+ * com as traduções da aplicação consumidora.
5
+ *
6
+ * Uso no app.config.ts:
7
+ * ```ts
8
+ * import { provideAngularComponentsTranslations } from '@senior-gestao-relacionamento/angular-components';
9
+ *
10
+ * export const appConfig = {
11
+ * providers: [
12
+ * provideAngularComponentsTranslations(async (language) => {
13
+ * const translations = await import(`../locale/${language}.json`);
14
+ * return translations.default || translations;
15
+ * })
16
+ * ]
17
+ * };
18
+ * ```
19
+ */
20
+ export declare function provideAngularComponentsTranslations(appLoader?: (language: string) => Promise<Record<string, string>>): Provider;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@senior-gestao-relacionamento/angular-components",
3
- "version": "2.0.0",
3
+ "version": "2.1.0",
4
4
  "description": "Biblioteca de componentes reutilizáveis para aplicações Angular do CRM Senior Sistemas",
5
5
  "keywords": [
6
6
  "angular",
@@ -26,7 +26,8 @@
26
26
  "primeng": "^18.0.0",
27
27
  "primeicons": "^7.0.0",
28
28
  "@primeuix/themes": "^2.0.0",
29
- "rxjs": "~7.8.0"
29
+ "rxjs": "~7.8.0",
30
+ "@seniorsistemas/components-ai": ">=2.0.2"
30
31
  },
31
32
  "dependencies": {
32
33
  "tslib": "^2.3.0"
package/public-api.d.ts CHANGED
@@ -1,4 +1,13 @@
1
1
  export { AngularComponentsModule } from './lib/angular-components.module';
2
2
  export { StorageService } from './lib/services/storage/storage.service';
3
3
  export { CurrentCollaboratorService } from './lib/services/current-collaborator/current-collaborator.service';
4
+ export { provideAngularComponentsTranslations } from './lib/config/provide-angular-components-translations';
4
5
  export type { Collaborator, CollaboratorLeader, CollaboratorBranch, Branch, Company, JobTitle } from './lib/services/current-collaborator/models/collaborator.model';
6
+ export { ScheduleFormComponent } from './lib/components/schedule/schedule-form/schedule-form.component';
7
+ export { ScheduleDetailComponent } from './lib/components/schedule/schedule-detail/schedule-detail.component';
8
+ export { ScheduleService } from './lib/components/schedule/services/schedule.service';
9
+ export { ScheduleTypeService } from './lib/components/schedule/services/schedule-type.service';
10
+ export type { Schedule, ScheduleRecurrenceItem, RecurrenceDatesRecord, ScheduleParticipant } from './lib/components/schedule/entities/schedule.interface';
11
+ export type { ScheduleType } from './lib/components/schedule/entities/schedule-type.interface';
12
+ export type { ParticipantLookup, ParticipantOrigin, ScheduleSummaryByDate } from './lib/components/schedule/entities/participant-lookup.interface';
13
+ export { SchedulePriority, ScheduleRecurrence, WeekDay, Month, RepeatWhen, OrdinalWeekDay, ParticipantConfirmation, Status } from './lib/components/schedule/enums/schedule.enums';