valtech-components 4.0.995 → 4.0.997

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 (31) hide show
  1. package/esm2022/lib/components/molecules/date-input/date-input.component.mjs +3 -3
  2. package/esm2022/lib/components/molecules/file-input/file-input.component.mjs +3 -3
  3. package/esm2022/lib/components/molecules/hint/hint.component.mjs +3 -3
  4. package/esm2022/lib/components/molecules/password-input/password-input.component.mjs +3 -3
  5. package/esm2022/lib/components/molecules/pin-input/pin-input.component.mjs +3 -3
  6. package/esm2022/lib/components/molecules/text-input/text-input.component.mjs +3 -3
  7. package/esm2022/lib/components/organisms/form/form.component.mjs +124 -6
  8. package/esm2022/lib/components/organisms/survey-builder/survey-builder.component.mjs +58 -7
  9. package/esm2022/lib/components/organisms/survey-builder/survey-builder.i18n.mjs +19 -1
  10. package/esm2022/lib/components/organisms/survey-builder/types.mjs +1 -1
  11. package/esm2022/lib/components/organisms/survey-response/survey-response.component.mjs +150 -322
  12. package/esm2022/lib/components/organisms/survey-response/survey-response.i18n.mjs +5 -1
  13. package/esm2022/lib/components/types.mjs +4 -2
  14. package/esm2022/lib/services/forms/form-schema-builder.service.mjs +2 -1
  15. package/esm2022/lib/services/forms/types.mjs +1 -1
  16. package/esm2022/lib/services/requests/types.mjs +1 -1
  17. package/esm2022/lib/version.mjs +2 -2
  18. package/esm2022/public-api.mjs +1 -1
  19. package/fesm2022/valtech-components.mjs +574 -554
  20. package/fesm2022/valtech-components.mjs.map +1 -1
  21. package/lib/components/organisms/article/article.component.d.ts +3 -1
  22. package/lib/components/organisms/form/form.component.d.ts +9 -0
  23. package/lib/components/organisms/survey-builder/survey-builder.component.d.ts +5 -0
  24. package/lib/components/organisms/survey-builder/types.d.ts +2 -1
  25. package/lib/components/organisms/survey-response/survey-response.component.d.ts +22 -41
  26. package/lib/components/types.d.ts +4 -2
  27. package/lib/services/forms/types.d.ts +1 -1
  28. package/lib/services/requests/types.d.ts +9 -0
  29. package/lib/version.d.ts +1 -1
  30. package/package.json +1 -1
  31. package/public-api.d.ts +1 -1
@@ -90,7 +90,9 @@ export declare class ArticleComponent implements OnInit, AfterViewInit {
90
90
  actionType?: import("valtech-components").ActionType;
91
91
  expand?: "full" | "block";
92
92
  link?: string;
93
- href?: string;
93
+ href?: string; /**
94
+ * Obtiene los estilos de padding para el contenedor article
95
+ */
94
96
  routerLink?: string | any[];
95
97
  target?: "_blank" | "_self" | "_parent" | "_top";
96
98
  download?: string;
@@ -1,5 +1,6 @@
1
1
  import { DoCheck, ElementRef, EventEmitter, OnChanges, OnInit, SimpleChanges } from '@angular/core';
2
2
  import { FormBuilder, FormControl, FormGroup } from '@angular/forms';
3
+ import { EmojiRatingMetadata } from '../../atoms/emoji-rating/types';
3
4
  import { DatePickerMetadata } from '../../molecules/date-picker/types';
4
5
  import { TextareaInputMetadata } from '../../molecules/textarea-input/types';
5
6
  import { UsernameInputMetadata } from '../../molecules/username-input/types';
@@ -45,6 +46,7 @@ export declare class FormComponent implements OnInit, OnChanges, DoCheck {
45
46
  private selectPropMemo;
46
47
  private textInputPropMemo;
47
48
  private datePickerPropMemo;
49
+ private emojiRatingPropMemo;
48
50
  private fieldIdMemo;
49
51
  private fieldUid;
50
52
  private previousState;
@@ -129,6 +131,13 @@ export declare class FormComponent implements OnInit, OnChanges, DoCheck {
129
131
  * label/hint se omiten — val-form los renderiza vía .field-name/.field-description.
130
132
  */
131
133
  getDatePickerProp(field: InputMetadata): DatePickerMetadata;
134
+ getEmojiRatingProp(field: InputMetadata): EmojiRatingMetadata;
135
+ setBooleanValue(fieldName: string, value: boolean): void;
136
+ orderedOptions(field: InputMetadata): import("../../types").InputOption[];
137
+ isSimpleMultiSelected(fieldName: string, optionId: string): boolean;
138
+ setSimpleMultiSelected(fieldName: string, optionId: string, selected: boolean): void;
139
+ booleanYesLabel(): string;
140
+ booleanNoLabel(): string;
132
141
  /**
133
142
  * Adapter — convierte un `InputMetadata` (con type=TEXTAREA) a `TextareaInputMetadata`.
134
143
  * Defaults sensatos: autoGrow + counter habilitado, 4-12 rows.
@@ -38,6 +38,10 @@ export declare class SurveyBuilderComponent implements OnInit {
38
38
  private readonly errors;
39
39
  readonly titleControl: FormControl<string>;
40
40
  readonly subtitleControl: FormControl<string>;
41
+ readonly headerImageControl: FormControl<string>;
42
+ readonly successTitleControl: FormControl<string>;
43
+ readonly successMessageControl: FormControl<string>;
44
+ readonly successImageControl: FormControl<string>;
41
45
  readonly questions: import("@angular/core").WritableSignal<EditableFieldDef[]>;
42
46
  readonly editingId: import("@angular/core").WritableSignal<string>;
43
47
  readonly validationError: import("@angular/core").WritableSignal<string>;
@@ -67,6 +71,7 @@ export declare class SurveyBuilderComponent implements OnInit {
67
71
  applyQuestion(field: EditableFieldDef): void;
68
72
  save(): Promise<void>;
69
73
  private hydrate;
74
+ private presentationPayload;
70
75
  private rowFromField;
71
76
  static ɵfac: i0.ɵɵFactoryDeclaration<SurveyBuilderComponent, never>;
72
77
  static ɵcmp: i0.ɵɵComponentDeclaration<SurveyBuilderComponent, "val-survey-builder", never, { "props": { "alias": "props"; "required": false; }; }, { "saved": "saved"; "draft": "draft"; }, never, never, true, never>;
@@ -1,4 +1,4 @@
1
- import { EntityRef, FieldSchemaDef, RequestTypeConfig, RequestVisibility } from '../../../services/requests/types';
1
+ import { EntityRef, FieldSchemaDef, RequestTypeConfig, RequestTypePresentation, RequestVisibility } from '../../../services/requests/types';
2
2
  /**
3
3
  * Tipos de pregunta que ofrece una encuesta.
4
4
  *
@@ -85,5 +85,6 @@ export interface SurveyBuilderSaveEvent {
85
85
  export interface SurveyDraftEvent {
86
86
  label: string;
87
87
  subtitle: string;
88
+ presentation?: RequestTypePresentation;
88
89
  questions: FieldSchemaDef[];
89
90
  }
@@ -1,9 +1,10 @@
1
1
  import { EventEmitter, OnInit } from '@angular/core';
2
2
  import { FormControl } from '@angular/forms';
3
- import { FieldSchemaDef, RequestTypeConfig } from '../../../services/requests/types';
4
- import { InputMetadata, InputOption, InputType } from '../../types';
3
+ import { RequestTypeConfig } from '../../../services/requests/types';
4
+ import { InputOption, InputType } from '../../types';
5
5
  import { EmptyStateMetadata } from '../../molecules/empty-state/types';
6
6
  import { SurveyResponseMetadata, SurveyResponseSubmitEvent } from './types';
7
+ import { FormMetadata, FormSubmit } from '../../types';
7
8
  import * as i0 from "@angular/core";
8
9
  /**
9
10
  * val-survey-response
@@ -29,10 +30,12 @@ import * as i0 from "@angular/core";
29
30
  export declare class SurveyResponseComponent implements OnInit {
30
31
  props: SurveyResponseMetadata;
31
32
  readonly submitted: EventEmitter<SurveyResponseSubmitEvent>;
33
+ private formComponent?;
32
34
  private readonly i18n;
33
35
  private readonly auth;
34
36
  private readonly requests;
35
37
  private readonly errors;
38
+ private readonly formSchemas;
36
39
  readonly emojiType = "EMOJI_RATING";
37
40
  readonly selectType = InputType.SELECT;
38
41
  readonly loading: import("@angular/core").WritableSignal<boolean>;
@@ -40,26 +43,18 @@ export declare class SurveyResponseComponent implements OnInit {
40
43
  readonly sent: import("@angular/core").WritableSignal<boolean>;
41
44
  readonly sending: import("@angular/core").WritableSignal<boolean>;
42
45
  readonly typeConfig: import("@angular/core").WritableSignal<RequestTypeConfig>;
43
- readonly multiSelectError: import("@angular/core").WritableSignal<boolean>;
44
46
  readonly alreadyAnswered: import("@angular/core").WritableSignal<boolean>;
45
47
  readonly nameControl: FormControl<string>;
46
48
  readonly emailControl: FormControl<string>;
47
49
  private form;
48
- /**
49
- * Una casilla por opción de cada pregunta MULTI_SELECT, indexada
50
- * `"<pregunta>::<opcion>"`. Viven fuera del `form` porque el valor que viaja
51
- * al backend es UNA lista por pregunta, no N booleanos: se arma al enviar.
52
- */
53
- private readonly multiControls;
54
50
  constructor();
55
51
  ngOnInit(): Promise<void>;
56
- private buildForm;
57
- /** Preguntas ordenadas — el template las recorre en este orden. */
52
+ private configureIdentity;
53
+ private buildCompatibilityForm;
54
+ readonly formProps: import("@angular/core").Signal<FormMetadata>;
55
+ /** Preguntas ordenadas, expuestas para tests/hosts que inspeccionan el schema resuelto. */
58
56
  readonly questions: import("@angular/core").Signal<import("valtech-components").FieldSchemaDef[]>;
59
57
  questionControl(name: string): FormControl;
60
- booleanControl(name: string): FormControl<boolean>;
61
- optionControl(name: string, optionId: string): FormControl<boolean>;
62
- /** Opciones tal como las escribió quien creó la encuesta — no se traducen. */
63
58
  optionsOf(q: {
64
59
  options?: {
65
60
  id: string;
@@ -67,33 +62,8 @@ export declare class SurveyResponseComponent implements OnInit {
67
62
  order?: number;
68
63
  }[];
69
64
  }): InputOption[];
70
- /**
71
- * `val-radio-input` pide un `InputMetadata` completo (no `Partial`), así que
72
- * se arma acá en vez de en el template.
73
- */
74
- radioProps(q: FieldSchemaDef): InputMetadata;
75
- placeholderOf(q: {
76
- placeholderText?: string;
77
- placeholder?: string;
78
- }): string;
79
- hintOf(q: {
80
- hintText?: string;
81
- hint?: string;
82
- }): string;
83
- /**
84
- * Tipo del `<input>` para las preguntas que se responden escribiendo. Nada de
85
- * `parseInputType` de `FormSchemaBuilderService`: ese mapea al enum de
86
- * `val-form`, y acá no hay `val-form` de por medio (ver el comentario de
87
- * clase). Un tipo desconocido cae a texto, que siempre se puede responder.
88
- */
89
65
  inputTypeOf(type: string): 'text' | 'email' | 'number' | 'tel';
90
- /** Las opciones marcadas de una pregunta MULTI_SELECT, en el orden del schema. */
91
- private selectedOptions;
92
- questionLabel(q: {
93
- label?: string;
94
- labelKey?: string;
95
- name: string;
96
- }): string;
66
+ private surveySchemaForForm;
97
67
  /** Puede responder sin sesión si el tipo lo permite; si no, hace falta login. */
98
68
  readonly canRespond: import("@angular/core").Signal<boolean>;
99
69
  /**
@@ -105,10 +75,21 @@ export declare class SurveyResponseComponent implements OnInit {
105
75
  * encuesta; el formulario no cobra peaje por su cuenta.
106
76
  */
107
77
  needsIdentity(): boolean;
78
+ private needsIdentityFor;
108
79
  readonly submitState: import("@angular/core").Signal<"ENABLED" | "WORKING">;
109
- submit(): Promise<void>;
80
+ readonly multiSelectError: import("@angular/core").WritableSignal<boolean>;
81
+ private readonly optionControlMemo;
82
+ optionControl(name: string, optionId: string): FormControl<boolean>;
83
+ markInvalid(): void;
84
+ submit(event?: FormSubmit): Promise<void>;
85
+ private hasMissingRequiredMultiSelect;
110
86
  readonly alreadyAnsweredState: import("@angular/core").Signal<EmptyStateMetadata>;
111
87
  readonly sentState: import("@angular/core").Signal<EmptyStateMetadata>;
88
+ readonly successPresentation: import("@angular/core").Signal<{
89
+ title: string;
90
+ message: string;
91
+ imageUrl: string;
92
+ }>;
112
93
  readonly loadErrorState: import("@angular/core").Signal<EmptyStateMetadata>;
113
94
  readonly loginRequiredState: import("@angular/core").Signal<EmptyStateMetadata>;
114
95
  t(key: string): string;
@@ -65,12 +65,14 @@ export declare enum InputType {
65
65
  HANDLE = 23,
66
66
  ATTACHMENT = 24,
67
67
  DATE_PICKER = 25,
68
+ /** Escala corta de satisfacción con emojis. Usada por encuestas públicas. */
69
+ EMOJI_RATING = 26,
68
70
  /**
69
71
  * Opción única en chips (`val-chip-select`). Preferilo sobre CHECKBOX_RADIO
70
72
  * cuando las etiquetas son cortas y la pantalla es un teléfono: los radios se
71
73
  * apilan en vertical y su objetivo táctil es el círculo, no la etiqueta.
72
74
  */
73
- CHIP_SELECT = 26
75
+ CHIP_SELECT = 27
74
76
  }
75
77
  /**
76
78
  * Option for select, radio, etc. inputs.
@@ -144,7 +146,7 @@ export type InputMetadata = {
144
146
  [key: string]: string;
145
147
  };
146
148
  /** Initial value for the field */
147
- value?: string;
149
+ value?: any;
148
150
  /** Default value configuration - string for custom defaults, true for auto defaults */
149
151
  withDefault?: string | boolean;
150
152
  /** Field state */
@@ -39,7 +39,7 @@ export interface FieldSchemaDef {
39
39
  options?: FieldOption[];
40
40
  order: number;
41
41
  /** Initial value injected by consumers when rendering a configured form. */
42
- value?: string;
42
+ value?: any;
43
43
  }
44
44
  export interface FormSchemaConfig {
45
45
  schemaId: string;
@@ -55,6 +55,12 @@ export interface EntityRef {
55
55
  entityType: string;
56
56
  entityId: string;
57
57
  }
58
+ export interface RequestTypePresentation {
59
+ headerImageUrl?: string;
60
+ successTitle?: string;
61
+ successMessage?: string;
62
+ successImageUrl?: string;
63
+ }
58
64
  /** Quién puede leer un tipo de solicitud (y sus solicitudes públicas). */
59
65
  export type RequestVisibility = 'PUBLIC' | 'AUTHENTICATED' | 'ORG' | 'INTERNAL';
60
66
  export interface RequestTypeConfig {
@@ -66,6 +72,7 @@ export interface RequestTypeConfig {
66
72
  /** Bajada del enunciado (ej. encuestas). Label ya cubre el título. */
67
73
  subtitle?: string;
68
74
  entityRef?: EntityRef;
75
+ presentation?: RequestTypePresentation;
69
76
  createdBy?: RequestActor;
70
77
  /**
71
78
  * true = cada envío se agrega, no se revisa uno por uno (ej. encuestas).
@@ -145,6 +152,7 @@ export interface CreateRequestTypePayload {
145
152
  label: string;
146
153
  subtitle?: string;
147
154
  entityRef?: EntityRef;
155
+ presentation?: RequestTypePresentation;
148
156
  skipReview?: boolean;
149
157
  /**
150
158
  * true = el formulario NO pide nombre ni correo a quien responde sin sesión.
@@ -161,6 +169,7 @@ export interface UpdateRequestTypePayload {
161
169
  label: string;
162
170
  subtitle?: string;
163
171
  entityRef?: EntityRef;
172
+ presentation?: RequestTypePresentation;
164
173
  skipReview?: boolean;
165
174
  /**
166
175
  * true = el formulario NO pide nombre ni correo a quien responde sin sesión.
package/lib/version.d.ts CHANGED
@@ -2,4 +2,4 @@
2
2
  * Current version of valtech-components.
3
3
  * This is automatically updated during the publish process.
4
4
  */
5
- export declare const VERSION = "4.0.995";
5
+ export declare const VERSION = "4.0.997";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "valtech-components",
3
- "version": "4.0.995",
3
+ "version": "4.0.997",
4
4
  "private": false,
5
5
  "bin": {
6
6
  "valtech-firebase-config": "./src/lib/services/firebase/scripts/generate-sw-config.js"
package/public-api.d.ts CHANGED
@@ -560,7 +560,7 @@ export { ValtechErrorService, VALTECH_NETWORK_ERROR_KEY, } from './lib/services/
560
560
  export { ClientTelemetryService } from './lib/services/errors/client-telemetry.service';
561
561
  export * from './lib/services/forms';
562
562
  export { REQUEST_STATUSES } from './lib/services/requests/types';
563
- export type { AddCommentPayload, AppRequest, CreateRequestPayload, CreateRequestTypePayload, ListCommentsResponse, ListRequestsParams, ListRequestsResponse, ListRequestTypesResponse, RequestActor, RequestComment, RequestStatus, RequestTypeConfig, RequestVisibility, TransitionPayload, UpdateRequestPayload, UpdateRequestTypePayload, } from './lib/services/requests/types';
563
+ export type { AddCommentPayload, AppRequest, CreateRequestPayload, CreateRequestTypePayload, ListCommentsResponse, ListRequestsParams, ListRequestsResponse, ListRequestTypesResponse, RequestActor, RequestComment, RequestStatus, RequestTypeConfig, RequestTypePresentation, RequestVisibility, TransitionPayload, UpdateRequestPayload, UpdateRequestTypePayload, } from './lib/services/requests/types';
564
564
  export * from './lib/services/requests/request.service';
565
565
  export * from './lib/services/requests/request-form-builder.service';
566
566
  export * from './lib/services/requests/request-firestore.service';