@igo2/common 21.0.0-next.32 → 21.0.0-next.34

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.
@@ -1 +1 @@
1
- {"version":3,"file":"igo2-common.mjs","sources":["../../../packages/common/src/public_api.ts","../../../packages/common/src/igo2-common.ts"],"sourcesContent":["/*\n * Public API Surface of common\n */\n\nexport { IgoHomeButtonModule } from '@igo2/common/home-button';\nexport { IgoImageModule } from '@igo2/common/image';\nexport { IgoInteractiveTourModule } from '@igo2/common/interactive-tour';\nexport { IgoJsonDialogModule } from '@igo2/common/json-dialog';\nexport { IgoKeyValueModule } from '@igo2/common/keyvalue';\nexport {\n IgoFormDialogModule,\n IgoFormFormModule,\n IgoFormFieldModule,\n IgoFormGroupModule,\n IgoFormModule\n} from '@igo2/common/form';\nexport { IgoListModule } from '@igo2/common/list';\nexport { IgoPanelModule } from '@igo2/common/panel';\nexport { IgoSelectValueDialogModule } from '@igo2/common/select-value-dialog';\nexport { IgoSidenavModule } from '@igo2/common/sidenav';\nexport { IgoSpinnerModule } from '@igo2/common/spinner';\nexport { IgoStopPropagationModule } from '@igo2/common/stop-propagation';\nexport { IgoTableModule } from '@igo2/common/table';\nexport { IgoToolModule, IgoToolboxModule } from '@igo2/common/tool';\nexport { IgoWidgetModule, IgoWidgetOutletModule } from '@igo2/common/widget';\nexport {\n IgoWorkspaceModule,\n IgoWorkspaceSelectorModule,\n IgoWorkspaceWidgetOutletModule\n} from '@igo2/common/workspace';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA;;AAEG;;ACFH;;AAEG"}
1
+ {"version":3,"file":"igo2-common.mjs","sources":["../../../packages/common/src/public_api.ts","../../../packages/common/src/igo2-common.ts"],"sourcesContent":["/*\n * Public API Surface of common\n */\n\nexport { IgoHomeButtonModule } from '@igo2/common/home-button';\nexport { IgoImageModule } from '@igo2/common/image';\nexport { IgoInteractiveTourModule } from '@igo2/common/interactive-tour';\nexport { IgoJsonDialogModule } from '@igo2/common/json-dialog';\nexport { IgoKeyValueModule } from '@igo2/common/keyvalue';\nexport {\n IgoFormDialogModule,\n IgoFormFormModule,\n IgoFormFieldModule,\n IgoFormGroupModule,\n IgoFormModule\n} from '@igo2/common/form';\nexport { IgoListModule } from '@igo2/common/list';\nexport { IgoPanelModule } from '@igo2/common/panel';\nexport { IgoSidenavModule } from '@igo2/common/sidenav';\nexport { IgoSpinnerModule } from '@igo2/common/spinner';\nexport { IgoStopPropagationModule } from '@igo2/common/stop-propagation';\nexport { IgoTableModule } from '@igo2/common/table';\nexport { IgoToolModule, IgoToolboxModule } from '@igo2/common/tool';\nexport { IgoWidgetModule, IgoWidgetOutletModule } from '@igo2/common/widget';\nexport {\n IgoWorkspaceModule,\n IgoWorkspaceSelectorModule,\n IgoWorkspaceWidgetOutletModule\n} from '@igo2/common/workspace';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;AAEG;;ACFH;;AAEG"}
@@ -15,13 +15,6 @@
15
15
  "maxLevel": "The maximum hierarchical level is reached ({{value}})"
16
16
  }
17
17
  },
18
- "selectValueDialog": {
19
- "cancelButtonText": "Cancel",
20
- "processButtonText": "Select",
21
- "multipleTitle": "Please, select values",
22
- "title": "Please, select a value",
23
- "selectFieldText": "Options"
24
- },
25
18
  "formDialog": {
26
19
  "cancelButtonText": "Cancel",
27
20
  "processButtonText": "Submit",
@@ -15,13 +15,6 @@
15
15
  "maxLevel": "Le maximum de niveau hiérarchique est atteint ({{value}})"
16
16
  }
17
17
  },
18
- "selectValueDialog": {
19
- "cancelButtonText": "Annuler",
20
- "processButtonText": "Sélectionner",
21
- "multipleTitle": "Veuiller sélectionner une ou plusieurs valeurs",
22
- "title": "Veuiller sélectionner une valeur",
23
- "selectFieldText": "Options"
24
- },
25
18
  "formDialog": {
26
19
  "cancelButtonText": "Annuler",
27
20
  "processButtonText": "Confirmer",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@igo2/common",
3
- "version": "21.0.0-next.32",
3
+ "version": "21.0.0-next.34",
4
4
  "description": "IGO Library",
5
5
  "author": "IGO Community",
6
6
  "keywords": [
@@ -135,10 +135,6 @@
135
135
  "types": "./types/igo2-common-resizable-bar.d.ts",
136
136
  "default": "./fesm2022/igo2-common-resizable-bar.mjs"
137
137
  },
138
- "./select-value-dialog": {
139
- "types": "./types/igo2-common-select-value-dialog.d.ts",
140
- "default": "./fesm2022/igo2-common-select-value-dialog.mjs"
141
- },
142
138
  "./sidenav": {
143
139
  "types": "./types/igo2-common-sidenav.d.ts",
144
140
  "default": "./fesm2022/igo2-common-sidenav.mjs"
@@ -186,8 +182,8 @@
186
182
  "@angular/material": "^21.0.0",
187
183
  "@angular/platform-browser": "^21.0.0",
188
184
  "@floating-ui/utils": "^0.2.0",
189
- "@igo2/core": "^21.0.0-next.32",
190
- "@igo2/utils": "^21.0.0-next.32",
185
+ "@igo2/core": "^21.0.0-next.34",
186
+ "@igo2/utils": "^21.0.0-next.34",
191
187
  "angular-shepherd": "^22.0.0",
192
188
  "ngx-color": "^10.1.0",
193
189
  "scroll-into-view-if-needed": "^3.1.0",
@@ -3,6 +3,7 @@ import * as _angular_core from '@angular/core';
3
3
  import { OnChanges, ElementRef, SimpleChanges, OnInit, OnDestroy, ModuleWithProviders } from '@angular/core';
4
4
  import { ValidatorFn, UntypedFormControl, UntypedFormGroup, FormGroup, FormControl, AbstractControl } from '@angular/forms';
5
5
  import { BehaviorSubject, Observable } from 'rxjs';
6
+ import { MatCheckboxChange } from '@angular/material/checkbox';
6
7
  import * as i1 from '@angular/material/dialog';
7
8
  import { MatDialogConfig, MatDialogRef } from '@angular/material/dialog';
8
9
  import { LanguageService } from '@igo2/core/language';
@@ -60,8 +61,15 @@ interface FormFieldInputs {
60
61
  interface FormFieldSelectInputs extends FormFieldInputs {
61
62
  choices: BehaviorSubject<FormFieldSelectChoice[]> | FormFieldSelectChoice[];
62
63
  }
64
+ interface FormFieldChoiceInputs extends FormFieldInputs {
65
+ choices: FormFieldSelectChoice[];
66
+ }
67
+ interface FormFieldCheckboxInputs extends FormFieldChoiceInputs {
68
+ maxSelected?: number;
69
+ }
70
+ type FormFieldRadiobuttonInputs = FormFieldChoiceInputs;
63
71
  interface FormFieldSelectChoice {
64
- value: any;
72
+ value: unknown;
65
73
  title: string;
66
74
  }
67
75
 
@@ -195,6 +203,37 @@ declare class FormFieldComponent {
195
203
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<FormFieldComponent, "igo-form-field", never, { "field": { "alias": "field"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
196
204
  }
197
205
 
206
+ declare class FormFieldCheckboxComponent implements OnInit, OnDestroy {
207
+ private errorStateMatcher;
208
+ private parentForm;
209
+ private parentFormGroup;
210
+ readonly disabled: _angular_core.WritableSignal<boolean>;
211
+ private readonly showErrorState;
212
+ private selectedValues;
213
+ private destroy$;
214
+ readonly choices: _angular_core.InputSignal<_igo2_common_form.FormFieldSelectChoice[]>;
215
+ readonly formControl: _angular_core.InputSignal<UntypedFormControl>;
216
+ readonly showLabel: _angular_core.InputSignal<boolean>;
217
+ readonly placeholder: _angular_core.InputSignal<string | undefined>;
218
+ readonly errors: _angular_core.InputSignal<Record<string, string> | undefined>;
219
+ readonly maxSelected: _angular_core.InputSignal<number | undefined>;
220
+ readonly disableSwitch: _angular_core.InputSignal<boolean>;
221
+ get required(): boolean;
222
+ ngOnInit(): void;
223
+ ngOnDestroy(): void;
224
+ getErrorMessage(): string;
225
+ showError(): boolean;
226
+ isChecked(value: unknown): boolean;
227
+ onChoiceChange(value: unknown, event: MatCheckboxChange): void;
228
+ onDisableSwitchClick(): void;
229
+ private normalizeValue;
230
+ private syncState;
231
+ private toggleDisabled;
232
+ private maxSelectedValidator;
233
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<FormFieldCheckboxComponent, never>;
234
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<FormFieldCheckboxComponent, "igo-form-field-checkbox", never, { "choices": { "alias": "choices"; "required": true; "isSignal": true; }; "formControl": { "alias": "formControl"; "required": true; "isSignal": true; }; "showLabel": { "alias": "showLabel"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "errors": { "alias": "errors"; "required": false; "isSignal": true; }; "maxSelected": { "alias": "maxSelected"; "required": false; "isSignal": true; }; "disableSwitch": { "alias": "disableSwitch"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
235
+ }
236
+
198
237
  declare class FormFieldDatetimeComponent implements OnInit, OnDestroy {
199
238
  readonly disabled: _angular_core.WritableSignal<boolean>;
200
239
  readonly dateTimeGroup: FormGroup<{
@@ -320,6 +359,31 @@ declare class FormFieldNumberComponent implements OnInit {
320
359
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<FormFieldNumberComponent, "igo-form-field-number", never, { "formControl": { "alias": "formControl"; "required": true; "isSignal": true; }; "showLabel": { "alias": "showLabel"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "errors": { "alias": "errors"; "required": false; "isSignal": true; }; "disableSwitch": { "alias": "disableSwitch"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
321
360
  }
322
361
 
362
+ declare class FormFieldRadiobuttonComponent implements OnInit, OnDestroy {
363
+ private errorStateMatcher;
364
+ private parentForm;
365
+ private parentFormGroup;
366
+ readonly disabled: _angular_core.WritableSignal<boolean>;
367
+ private readonly showErrorState;
368
+ private destroy$;
369
+ readonly choices: _angular_core.InputSignal<_igo2_common_form.FormFieldSelectChoice[]>;
370
+ readonly formControl: _angular_core.InputSignal<UntypedFormControl>;
371
+ readonly showLabel: _angular_core.InputSignal<boolean>;
372
+ readonly placeholder: _angular_core.InputSignal<string | undefined>;
373
+ readonly errors: _angular_core.InputSignal<Record<string, string> | undefined>;
374
+ readonly disableSwitch: _angular_core.InputSignal<boolean>;
375
+ get required(): boolean;
376
+ ngOnInit(): void;
377
+ ngOnDestroy(): void;
378
+ getErrorMessage(): string;
379
+ showError(): boolean;
380
+ onDisableSwitchClick(): void;
381
+ private syncState;
382
+ private toggleDisabled;
383
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<FormFieldRadiobuttonComponent, never>;
384
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<FormFieldRadiobuttonComponent, "igo-form-field-radiobutton", never, { "choices": { "alias": "choices"; "required": true; "isSignal": true; }; "formControl": { "alias": "formControl"; "required": true; "isSignal": true; }; "showLabel": { "alias": "showLabel"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "errors": { "alias": "errors"; "required": false; "isSignal": true; }; "disableSwitch": { "alias": "disableSwitch"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
385
+ }
386
+
323
387
  /**
324
388
  * This component renders a select field
325
389
  */
@@ -457,16 +521,46 @@ declare class FormFieldTextareaComponent implements OnInit {
457
521
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<FormFieldTextareaComponent, "igo-form-field-textarea", never, { "formControl": { "alias": "formControl"; "required": true; "isSignal": true; }; "showLabel": { "alias": "showLabel"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "errors": { "alias": "errors"; "required": false; "isSignal": true; }; "disableSwitch": { "alias": "disableSwitch"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
458
522
  }
459
523
 
460
- declare const FORM_DIRECTIVES: readonly [typeof _igo2_common_form.FormFieldComponent, typeof _igo2_common_form.FormFieldDatetimeComponent, typeof _igo2_common_form.FormFieldNumberComponent, typeof _igo2_common_form.FormFieldSelectComponent, typeof _igo2_common_form.FormFieldTextComponent, typeof _igo2_common_form.FormFieldTextareaComponent, typeof FormGroupComponent, typeof FormComponent];
524
+ declare const FORM_DIRECTIVES: readonly [typeof _igo2_common_form.FormFieldComponent, typeof _igo2_common_form.FormFieldCheckboxComponent, typeof _igo2_common_form.FormFieldDatetimeComponent, typeof _igo2_common_form.FormFieldNumberComponent, typeof _igo2_common_form.FormFieldRadiobuttonComponent, typeof _igo2_common_form.FormFieldSelectComponent, typeof _igo2_common_form.FormFieldTextComponent, typeof _igo2_common_form.FormFieldTextareaComponent, typeof FormGroupComponent, typeof FormComponent];
461
525
  /**
462
526
  * @deprecated import the components directly or FORM_DIRECTIVES for every components/directives
463
527
  */
464
528
  declare class IgoFormModule {
465
529
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<IgoFormModule, never>;
466
- static ɵmod: _angular_core.ɵɵNgModuleDeclaration<IgoFormModule, never, [typeof FormFieldComponent, typeof FormFieldDatetimeComponent, typeof FormFieldNumberComponent, typeof FormFieldSelectComponent, typeof FormFieldTextComponent, typeof FormFieldTextareaComponent, typeof FormGroupComponent, typeof FormComponent], [typeof FormFieldComponent, typeof FormFieldDatetimeComponent, typeof FormFieldNumberComponent, typeof FormFieldSelectComponent, typeof FormFieldTextComponent, typeof FormFieldTextareaComponent, typeof FormGroupComponent, typeof FormComponent]>;
530
+ static ɵmod: _angular_core.ɵɵNgModuleDeclaration<IgoFormModule, never, [typeof FormFieldComponent, typeof FormFieldCheckboxComponent, typeof FormFieldDatetimeComponent, typeof FormFieldNumberComponent, typeof FormFieldRadiobuttonComponent, typeof FormFieldSelectComponent, typeof FormFieldTextComponent, typeof FormFieldTextareaComponent, typeof FormGroupComponent, typeof FormComponent], [typeof FormFieldComponent, typeof FormFieldCheckboxComponent, typeof FormFieldDatetimeComponent, typeof FormFieldNumberComponent, typeof FormFieldRadiobuttonComponent, typeof FormFieldSelectComponent, typeof FormFieldTextComponent, typeof FormFieldTextareaComponent, typeof FormGroupComponent, typeof FormComponent]>;
467
531
  static ɵinj: _angular_core.ɵɵInjectorDeclaration<IgoFormModule>;
468
532
  }
469
533
 
534
+ interface FormStepperLabels {
535
+ nextButton: string;
536
+ previousButton: string;
537
+ processButton: string;
538
+ cancelButton: string;
539
+ /** Supports `{{current}}` and `{{total}}` placeholders. */
540
+ stepCounter: string;
541
+ }
542
+ interface FormStepperFormConfig {
543
+ formFieldConfigs?: FormFieldConfig[];
544
+ formGroupsConfigs?: FormGroupsConfig[];
545
+ }
546
+ interface FormStepperStepContext {
547
+ data: Readonly<Record<string, unknown>>;
548
+ stepIndex: number;
549
+ steps: readonly FormStepperStepConfig[];
550
+ }
551
+ type FormStepperStepFormConfigResolver = (context: FormStepperStepContext) => FormStepperFormConfig;
552
+ interface FormStepperStepConfig {
553
+ label: string;
554
+ title?: string;
555
+ notice?: string;
556
+ form: FormStepperFormConfig | FormStepperStepFormConfigResolver;
557
+ }
558
+ interface FormStepperConfig {
559
+ steps: FormStepperStepConfig[];
560
+ }
561
+
562
+ declare function buildFormFromConfig(formService: FormService, formConfig?: FormStepperFormConfig): Form;
563
+ declare function markFormAsTouched(form: Form): void;
470
564
  declare function formControlIsRequired(control: AbstractControl): boolean;
471
565
  declare function getDefaultErrorMessages(): Record<string, string>;
472
566
  declare function getControlErrorMessage(control: AbstractControl, messages: Record<string, string>): string;
@@ -508,20 +602,63 @@ declare function IgoFormFieldComponent(type: string): (cls: any) => any;
508
602
  */
509
603
  declare class IgoFormFieldModule {
510
604
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<IgoFormFieldModule, never>;
511
- static ɵmod: _angular_core.ɵɵNgModuleDeclaration<IgoFormFieldModule, never, [typeof FormFieldComponent, typeof FormFieldDatetimeComponent, typeof FormFieldNumberComponent, typeof FormFieldSelectComponent, typeof FormFieldTextComponent, typeof FormFieldTextareaComponent], [typeof FormFieldComponent, typeof FormFieldDatetimeComponent, typeof FormFieldNumberComponent, typeof FormFieldSelectComponent, typeof FormFieldTextComponent, typeof FormFieldTextareaComponent]>;
605
+ static ɵmod: _angular_core.ɵɵNgModuleDeclaration<IgoFormFieldModule, never, [typeof FormFieldComponent, typeof FormFieldCheckboxComponent, typeof FormFieldDatetimeComponent, typeof FormFieldNumberComponent, typeof FormFieldRadiobuttonComponent, typeof FormFieldSelectComponent, typeof FormFieldTextComponent, typeof FormFieldTextareaComponent], [typeof FormFieldComponent, typeof FormFieldCheckboxComponent, typeof FormFieldDatetimeComponent, typeof FormFieldNumberComponent, typeof FormFieldRadiobuttonComponent, typeof FormFieldSelectComponent, typeof FormFieldTextComponent, typeof FormFieldTextareaComponent]>;
512
606
  static ɵinj: _angular_core.ɵɵInjectorDeclaration<IgoFormFieldModule>;
513
607
  }
514
608
 
515
- declare const FORM_FIELD_DIRECTIVES: readonly [typeof FormFieldComponent, typeof FormFieldDatetimeComponent, typeof FormFieldNumberComponent, typeof FormFieldSelectComponent, typeof FormFieldTextComponent, typeof FormFieldTextareaComponent];
609
+ declare const FORM_FIELD_DIRECTIVES: readonly [typeof FormFieldComponent, typeof FormFieldCheckboxComponent, typeof FormFieldDatetimeComponent, typeof FormFieldNumberComponent, typeof FormFieldRadiobuttonComponent, typeof FormFieldSelectComponent, typeof FormFieldTextComponent, typeof FormFieldTextareaComponent];
516
610
 
517
- interface FormDialogFormConfig {
518
- formFieldConfigs?: FormFieldConfig[];
519
- formGroupsConfigs?: FormGroupsConfig[];
611
+ declare class FormStepperComponent {
612
+ private readonly formService;
613
+ readonly steps: _angular_core.InputSignal<FormStepperStepConfig[]>;
614
+ readonly initialData: _angular_core.InputSignal<Record<string, unknown>>;
615
+ readonly notice: _angular_core.InputSignal<string | undefined>;
616
+ readonly labels: _angular_core.InputSignalWithTransform<FormStepperLabels, Partial<FormStepperLabels> | undefined>;
617
+ readonly showCancelButton: _angular_core.InputSignal<boolean>;
618
+ readonly completed: _angular_core.OutputEmitterRef<Record<string, unknown>>;
619
+ readonly cancelled: _angular_core.OutputEmitterRef<void>;
620
+ readonly dataChange: _angular_core.OutputEmitterRef<Record<string, unknown>>;
621
+ readonly stepIndex: _angular_core.WritableSignal<number>;
622
+ private readonly stepResults;
623
+ readonly activeStep: _angular_core.Signal<FormStepperStepConfig>;
624
+ readonly activeContextData: _angular_core.Signal<Record<string, unknown>>;
625
+ readonly activeFormData: _angular_core.Signal<Record<string, unknown>>;
626
+ readonly activeForm: _angular_core.Signal<Form>;
627
+ readonly activeNotice: _angular_core.Signal<string | undefined>;
628
+ readonly stepCount: _angular_core.Signal<number>;
629
+ readonly stepNumber: _angular_core.Signal<number>;
630
+ readonly resolvedLabels: _angular_core.Signal<FormStepperLabels>;
631
+ readonly stepCounterLabel: _angular_core.Signal<string>;
632
+ readonly progressWidth: _angular_core.Signal<string>;
633
+ readonly maxNavigableStepIndex: _angular_core.Signal<number>;
634
+ readonly isLastStep: _angular_core.Signal<boolean>;
635
+ onSubmitStep(stepData: Record<string, unknown>): void;
636
+ previous(): void;
637
+ cancel(): void;
638
+ reset(): void;
639
+ onSelectedIndexChange(index: number): void;
640
+ isCompletedStep(index: number): boolean;
641
+ isEditableStep(index: number): boolean;
642
+ private buildAggregateData;
643
+ private buildAggregateDataFrom;
644
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<FormStepperComponent, never>;
645
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<FormStepperComponent, "igo-form-stepper", never, { "steps": { "alias": "steps"; "required": true; "isSignal": true; }; "initialData": { "alias": "initialData"; "required": false; "isSignal": true; }; "notice": { "alias": "notice"; "required": false; "isSignal": true; }; "labels": { "alias": "labels"; "required": false; "isSignal": true; }; "showCancelButton": { "alias": "showCancelButton"; "required": false; "isSignal": true; }; }, { "completed": "completed"; "cancelled": "cancelled"; "dataChange": "dataChange"; }, never, never, true, never>;
520
646
  }
647
+
648
+ type FormDialogFormConfig = FormStepperFormConfig;
649
+ type FormDialogStepContext = FormStepperStepContext;
650
+ type FormDialogStepFormConfigResolver = FormStepperStepFormConfigResolver;
651
+ type FormDialogStepConfig = FormStepperStepConfig;
652
+ type FormDialogStepperConfig = FormStepperConfig;
521
653
  interface FormDialogData extends FormDialogOptions, FormDialogFormConfig {
522
654
  }
655
+ interface FormDialogStepperOptions extends FormDialogOptions {
656
+ labels?: Partial<FormStepperLabels>;
657
+ }
658
+ interface FormDialogStepperData extends FormDialogStepperOptions, FormDialogStepperConfig {
659
+ }
523
660
  interface FormDialogOptions extends MatDialogConfig {
524
- data$?: BehaviorSubject<Record<string, any>>;
661
+ data$?: BehaviorSubject<Record<string, unknown>>;
525
662
  title?: string;
526
663
  processButtonText?: string;
527
664
  cancelButtonText?: string;
@@ -533,8 +670,8 @@ declare class FormDialogComponent {
533
670
  dialogRef: MatDialogRef<FormDialogComponent, any>;
534
671
  private formService;
535
672
  data: FormDialogData;
536
- form$: BehaviorSubject<Form | undefined>;
537
- data$: BehaviorSubject<Record<string, any>>;
673
+ form$: BehaviorSubject<_igo2_common_form.Form | undefined>;
674
+ data$: BehaviorSubject<Record<string, unknown>>;
538
675
  constructor();
539
676
  onSubmit(data: Record<string, unknown>): void;
540
677
  cancel(): void;
@@ -542,6 +679,20 @@ declare class FormDialogComponent {
542
679
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<FormDialogComponent, "igo-form-dialog", never, {}, {}, never, never, true, never>;
543
680
  }
544
681
 
682
+ declare const DEFAULT_FORM_STEPPER_DIALOG_TITLE = "Veuillez remplir le formulaire";
683
+ declare class FormStepperDialogComponent {
684
+ readonly formStepper: _angular_core.Signal<FormStepperComponent | undefined>;
685
+ readonly dialogRef: MatDialogRef<FormStepperDialogComponent, any>;
686
+ readonly data: FormDialogStepperData;
687
+ readonly initialData: Record<string, unknown>;
688
+ constructor();
689
+ onDataChange(data: Record<string, unknown>): void;
690
+ cancel(): void;
691
+ onCompleted(data: Record<string, unknown>): void;
692
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<FormStepperDialogComponent, never>;
693
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<FormStepperDialogComponent, "igo-form-stepper-dialog", never, {}, {}, never, never, true, never>;
694
+ }
695
+
545
696
  /**
546
697
  * @deprecated import the FlexibleComponent directly
547
698
  */
@@ -551,16 +702,17 @@ declare class IgoFormDialogModule {
551
702
  */
552
703
  static forRoot(): ModuleWithProviders<IgoFormDialogModule>;
553
704
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<IgoFormDialogModule, never>;
554
- static ɵmod: _angular_core.ɵɵNgModuleDeclaration<IgoFormDialogModule, never, [typeof i1.MatDialogModule, typeof FormDialogComponent], [typeof FormDialogComponent]>;
705
+ static ɵmod: _angular_core.ɵɵNgModuleDeclaration<IgoFormDialogModule, never, [typeof i1.MatDialogModule, typeof FormDialogComponent, typeof FormStepperComponent, typeof FormStepperDialogComponent], [typeof FormDialogComponent, typeof FormStepperComponent, typeof FormStepperDialogComponent]>;
555
706
  static ɵinj: _angular_core.ɵɵInjectorDeclaration<IgoFormDialogModule>;
556
707
  }
557
708
 
558
709
  declare class FormDialogService {
559
710
  private dialog;
560
- open(formDialogConfig?: FormDialogFormConfig, options?: FormDialogOptions): Observable<Record<string, any>>;
711
+ open<T extends Record<string, unknown> = Record<string, unknown>>(formDialogConfig?: FormDialogFormConfig, options?: FormDialogOptions): Observable<T | undefined>;
712
+ openStepper<T extends Record<string, unknown> = Record<string, unknown>>(formDialogStepperConfig: FormStepperConfig, options?: FormDialogStepperOptions): Observable<T | undefined>;
561
713
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<FormDialogService, never>;
562
714
  static ɵprov: _angular_core.ɵɵInjectableDeclaration<FormDialogService>;
563
715
  }
564
716
 
565
- export { FORM_DIRECTIVES, FORM_FIELD_DIRECTIVES, FormComponent, FormDialogComponent, FormDialogService, FormFieldComponent, FormFieldDatetimeComponent, FormFieldNumberComponent, FormFieldSelectComponent, FormFieldService, FormFieldTextComponent, FormFieldTextareaComponent, FormGroupComponent, FormService, IgoFormDialogModule, IgoFormFieldComponent, IgoFormFieldModule, IgoFormFormModule, IgoFormGroupModule, IgoFormModule, formControlIsRequired, getAllFormFields, getControlErrorMessage, getDefaultErrorMessages, getFormFieldByName };
566
- export type { Form, FormDialogData, FormDialogFormConfig, FormDialogOptions, FormField, FormFieldConfig, FormFieldGroup, FormFieldGroupConfig, FormFieldGroupOptions, FormFieldInputs, FormFieldOptions, FormFieldSelectChoice, FormFieldSelectInputs, FormFieldSubscribers, FormGroupsConfig };
717
+ export { DEFAULT_FORM_STEPPER_DIALOG_TITLE, FORM_DIRECTIVES, FORM_FIELD_DIRECTIVES, FormComponent, FormDialogComponent, FormDialogService, FormFieldCheckboxComponent, FormFieldComponent, FormFieldDatetimeComponent, FormFieldNumberComponent, FormFieldRadiobuttonComponent, FormFieldSelectComponent, FormFieldService, FormFieldTextComponent, FormFieldTextareaComponent, FormGroupComponent, FormService, FormStepperComponent, FormStepperDialogComponent, IgoFormDialogModule, IgoFormFieldComponent, IgoFormFieldModule, IgoFormFormModule, IgoFormGroupModule, IgoFormModule, buildFormFromConfig, formControlIsRequired, getAllFormFields, getControlErrorMessage, getDefaultErrorMessages, getFormFieldByName, markFormAsTouched };
718
+ export type { Form, FormDialogData, FormDialogFormConfig, FormDialogOptions, FormDialogStepConfig, FormDialogStepContext, FormDialogStepFormConfigResolver, FormDialogStepperConfig, FormDialogStepperData, FormDialogStepperOptions, FormField, FormFieldCheckboxInputs, FormFieldChoiceInputs, FormFieldConfig, FormFieldGroup, FormFieldGroupConfig, FormFieldGroupOptions, FormFieldInputs, FormFieldOptions, FormFieldRadiobuttonInputs, FormFieldSelectChoice, FormFieldSelectInputs, FormFieldSubscribers, FormGroupsConfig, FormStepperConfig, FormStepperFormConfig, FormStepperLabels, FormStepperStepConfig, FormStepperStepContext, FormStepperStepFormConfigResolver };
@@ -6,7 +6,6 @@ export { IgoKeyValueModule } from '@igo2/common/keyvalue';
6
6
  export { IgoFormDialogModule, IgoFormFieldModule, IgoFormFormModule, IgoFormGroupModule, IgoFormModule } from '@igo2/common/form';
7
7
  export { IgoListModule } from '@igo2/common/list';
8
8
  export { IgoPanelModule } from '@igo2/common/panel';
9
- export { IgoSelectValueDialogModule } from '@igo2/common/select-value-dialog';
10
9
  export { IgoSidenavModule } from '@igo2/common/sidenav';
11
10
  export { IgoSpinnerModule } from '@igo2/common/spinner';
12
11
  export { IgoStopPropagationModule } from '@igo2/common/stop-propagation';
@@ -1,155 +0,0 @@
1
- import { AsyncPipe } from '@angular/common';
2
- import * as i0 from '@angular/core';
3
- import { inject, Component, Injectable, NgModule } from '@angular/core';
4
- import * as i1 from '@angular/forms';
5
- import { UntypedFormBuilder, FormsModule, ReactiveFormsModule } from '@angular/forms';
6
- import * as i4 from '@angular/material/button';
7
- import { MatButtonModule } from '@angular/material/button';
8
- import * as i2 from '@angular/material/checkbox';
9
- import { MatCheckboxModule } from '@angular/material/checkbox';
10
- import { MatDialogRef, MAT_DIALOG_DATA, MatDialogTitle, MatDialogActions, MatDialog } from '@angular/material/dialog';
11
- import * as i3 from '@angular/material/radio';
12
- import { MatRadioModule } from '@angular/material/radio';
13
- import { LanguageService, IgoLanguageModule } from '@igo2/core/language';
14
- import { BehaviorSubject } from 'rxjs';
15
- import * as i5 from '@ngx-translate/core';
16
-
17
- var SelectValueDialogType;
18
- (function (SelectValueDialogType) {
19
- SelectValueDialogType["Radio"] = "radio";
20
- SelectValueDialogType["Checkbox"] = "checkbox";
21
- })(SelectValueDialogType || (SelectValueDialogType = {}));
22
-
23
- class SelectValueCheckRadioDialogComponent {
24
- formBuilder = inject(UntypedFormBuilder);
25
- languageService = inject(LanguageService);
26
- dialogRef = inject(MatDialogRef);
27
- data = inject(MAT_DIALOG_DATA, { optional: true });
28
- formGroup;
29
- isDisabled$ = new BehaviorSubject(true);
30
- constructor() {
31
- this.data = this.data || {};
32
- this.formGroup = this.formBuilder.group(this.getFg());
33
- this.data.selectFieldText =
34
- this.data.selectFieldText ??
35
- 'igo.common.selectValueDialog.selectFieldText';
36
- this.data.processButtonText =
37
- this.data.processButtonText ??
38
- 'igo.common.selectValueDialog.processButtonText';
39
- this.data.cancelButtonText =
40
- this.data.cancelButtonText ??
41
- 'igo.common.selectValueDialog.cancelButtonText';
42
- this.data.title =
43
- this.data.title ?? 'igo.common.selectValueDialog.multipleTitle';
44
- if (this.data.type === SelectValueDialogType.Radio) {
45
- this.data.title = 'igo.common.selectValueDialog.title';
46
- }
47
- }
48
- ngOnInit() {
49
- this.formGroup.valueChanges.subscribe(() => this.canProcess());
50
- }
51
- getFg() {
52
- const a = {};
53
- if (this.data && this.data.choices) {
54
- this.data.choices.map((l) => (a[l.value] = false));
55
- }
56
- return a;
57
- }
58
- canProcess() {
59
- if (!this.data || !this.data.choices) {
60
- return;
61
- }
62
- const choices = this.data.choices.map((l) => l.value);
63
- const selectedIds = [];
64
- choices.map((l) => this.formGroup.value[l] ? selectedIds.push(l) : undefined);
65
- selectedIds.length
66
- ? this.isDisabled$.next(false)
67
- : this.isDisabled$.next(true);
68
- }
69
- save() {
70
- if (!this.data || !this.data.choices) {
71
- this.dialogRef.close();
72
- return;
73
- }
74
- const choices = this.data.choices.map((l) => l.value);
75
- const selectedChoices = [];
76
- choices.map((l) => this.formGroup.value[l] ? selectedChoices.push(l) : undefined);
77
- this.dialogRef.close({ choices: selectedChoices });
78
- }
79
- cancel() {
80
- this.dialogRef.close();
81
- }
82
- onChange(e) {
83
- const choices = {};
84
- this.data?.choices.forEach((l) => (choices[l.value] = false));
85
- choices[e.value] = true;
86
- this.formGroup.setValue(choices);
87
- }
88
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: SelectValueCheckRadioDialogComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
89
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.23", type: SelectValueCheckRadioDialogComponent, isStandalone: true, selector: "igo-select-value-check-radio-dialog", ngImport: i0, template: "<h1 mat-dialog-title>{{ data?.title | translate }}</h1>\n\n<form class=\"igo-form\" [formGroup]=\"formGroup\">\n <section class=\"choices-section\">\n @for (choice of data?.choices; track choice; let i = $index) {\n @if (data?.type === 'checkbox') {\n <mat-checkbox formControlName=\"{{ choice.value }}\">{{\n choice.title || choice.value\n }}</mat-checkbox>\n }\n }\n\n @if (data?.type === 'radio') {\n <mat-radio-group (change)=\"onChange($event)\">\n @for (choice of data?.choices; track choice) {\n <mat-radio-button [value]=\"choice.value\">\n {{ choice.title || choice.value }}\n </mat-radio-button>\n }\n </mat-radio-group>\n }\n </section>\n <div mat-dialog-actions>\n <div class=\"button-group\">\n <button matButton=\"elevated\" type=\"button\" (click)=\"cancel()\">\n {{ data?.cancelButtonText | translate }}\n </button>\n <button\n [disabled]=\"isDisabled$ | async\"\n id=\"processBtnDialog\"\n matButton=\"elevated\"\n type=\"button\"\n color=\"primary\"\n (click)=\"save()\"\n >\n {{ data?.processButtonText | translate }}\n </button>\n </div>\n </div>\n</form>\n", styles: [":host::ng-deep div[mat-dialog-actions]{margin:10px 0 0}:host::ng-deep section.choices-section{max-width:auto;display:grid;grid-template-columns:auto auto;grid-gap:0px;padding:5px}\n"], dependencies: [{ kind: "directive", type: MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "ngmodule", type: MatCheckboxModule }, { kind: "component", type: i2.MatCheckbox, selector: "mat-checkbox", inputs: ["aria-label", "aria-labelledby", "aria-describedby", "aria-expanded", "aria-controls", "aria-owns", "id", "required", "labelPosition", "name", "value", "disableRipple", "tabIndex", "color", "disabledInteractive", "checked", "disabled", "indeterminate"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }, { kind: "ngmodule", type: MatRadioModule }, { kind: "directive", type: i3.MatRadioGroup, selector: "mat-radio-group", inputs: ["color", "name", "labelPosition", "value", "selected", "disabled", "required", "disabledInteractive"], outputs: ["change"], exportAs: ["matRadioGroup"] }, { kind: "component", type: i3.MatRadioButton, selector: "mat-radio-button", inputs: ["id", "name", "aria-label", "aria-labelledby", "aria-describedby", "disableRipple", "tabIndex", "checked", "value", "labelPosition", "disabled", "required", "color", "disabledInteractive"], outputs: ["change"], exportAs: ["matRadioButton"] }, { kind: "directive", type: MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i4.MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "ngmodule", type: IgoLanguageModule }, { kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "pipe", type: i5.TranslatePipe, name: "translate" }] });
90
- }
91
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: SelectValueCheckRadioDialogComponent, decorators: [{
92
- type: Component,
93
- args: [{ selector: 'igo-select-value-check-radio-dialog', imports: [
94
- MatDialogTitle,
95
- FormsModule,
96
- ReactiveFormsModule,
97
- MatCheckboxModule,
98
- MatRadioModule,
99
- MatDialogActions,
100
- MatButtonModule,
101
- AsyncPipe,
102
- IgoLanguageModule
103
- ], template: "<h1 mat-dialog-title>{{ data?.title | translate }}</h1>\n\n<form class=\"igo-form\" [formGroup]=\"formGroup\">\n <section class=\"choices-section\">\n @for (choice of data?.choices; track choice; let i = $index) {\n @if (data?.type === 'checkbox') {\n <mat-checkbox formControlName=\"{{ choice.value }}\">{{\n choice.title || choice.value\n }}</mat-checkbox>\n }\n }\n\n @if (data?.type === 'radio') {\n <mat-radio-group (change)=\"onChange($event)\">\n @for (choice of data?.choices; track choice) {\n <mat-radio-button [value]=\"choice.value\">\n {{ choice.title || choice.value }}\n </mat-radio-button>\n }\n </mat-radio-group>\n }\n </section>\n <div mat-dialog-actions>\n <div class=\"button-group\">\n <button matButton=\"elevated\" type=\"button\" (click)=\"cancel()\">\n {{ data?.cancelButtonText | translate }}\n </button>\n <button\n [disabled]=\"isDisabled$ | async\"\n id=\"processBtnDialog\"\n matButton=\"elevated\"\n type=\"button\"\n color=\"primary\"\n (click)=\"save()\"\n >\n {{ data?.processButtonText | translate }}\n </button>\n </div>\n </div>\n</form>\n", styles: [":host::ng-deep div[mat-dialog-actions]{margin:10px 0 0}:host::ng-deep section.choices-section{max-width:auto;display:grid;grid-template-columns:auto auto;grid-gap:0px;padding:5px}\n"] }]
104
- }], ctorParameters: () => [] });
105
-
106
- class SelectValueDialogService {
107
- dialog = inject(MatDialog);
108
- open(choices, options) {
109
- const data = {
110
- choices,
111
- ...options
112
- };
113
- const dialogRef = this.dialog.open(SelectValueCheckRadioDialogComponent, {
114
- disableClose: false,
115
- data,
116
- ...options
117
- });
118
- return dialogRef.afterClosed();
119
- }
120
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: SelectValueDialogService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
121
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: SelectValueDialogService });
122
- }
123
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: SelectValueDialogService, decorators: [{
124
- type: Injectable
125
- }] });
126
-
127
- class IgoSelectValueDialogModule {
128
- /**
129
- * @deprecated it has no effect
130
- */
131
- static forRoot() {
132
- return {
133
- ngModule: IgoSelectValueDialogModule,
134
- providers: []
135
- };
136
- }
137
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: IgoSelectValueDialogModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
138
- static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.2.23", ngImport: i0, type: IgoSelectValueDialogModule, imports: [SelectValueCheckRadioDialogComponent], exports: [SelectValueCheckRadioDialogComponent] });
139
- static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: IgoSelectValueDialogModule, providers: [SelectValueDialogService], imports: [SelectValueCheckRadioDialogComponent] });
140
- }
141
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: IgoSelectValueDialogModule, decorators: [{
142
- type: NgModule,
143
- args: [{
144
- imports: [SelectValueCheckRadioDialogComponent],
145
- exports: [SelectValueCheckRadioDialogComponent],
146
- providers: [SelectValueDialogService]
147
- }]
148
- }] });
149
-
150
- /**
151
- * Generated bundle index. Do not edit.
152
- */
153
-
154
- export { IgoSelectValueDialogModule, SelectValueCheckRadioDialogComponent, SelectValueDialogService, SelectValueDialogType };
155
- //# sourceMappingURL=igo2-common-select-value-dialog.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"igo2-common-select-value-dialog.mjs","sources":["../../../packages/common/select-value-dialog/src/select-value-dialog.enums.ts","../../../packages/common/select-value-dialog/src/select-value-check-radio-dialog.component.ts","../../../packages/common/select-value-dialog/src/select-value-check-radio-dialog.component.html","../../../packages/common/select-value-dialog/src/select-value-dialog.service.ts","../../../packages/common/select-value-dialog/src/select-value-dialog.module.ts","../../../packages/common/select-value-dialog/src/igo2-common-select-value-dialog.ts"],"sourcesContent":["export enum SelectValueDialogType {\n Radio = 'radio',\n Checkbox = 'checkbox'\n}\n","import { AsyncPipe } from '@angular/common';\nimport { Component, OnInit, inject } from '@angular/core';\nimport {\n FormsModule,\n ReactiveFormsModule,\n UntypedFormBuilder,\n UntypedFormGroup\n} from '@angular/forms';\nimport { MatButtonModule } from '@angular/material/button';\nimport { MatCheckboxModule } from '@angular/material/checkbox';\nimport {\n MAT_DIALOG_DATA,\n MatDialogActions,\n MatDialogRef,\n MatDialogTitle\n} from '@angular/material/dialog';\nimport { MatRadioChange, MatRadioModule } from '@angular/material/radio';\n\nimport { LanguageService } from '@igo2/core/language';\nimport { IgoLanguageModule } from '@igo2/core/language';\n\nimport { BehaviorSubject } from 'rxjs';\n\nimport { SelectValueDialogType } from './select-value-dialog.enums';\nimport { SelectValueData } from './select-value-dialog.interface';\n\n@Component({\n selector: 'igo-select-value-check-radio-dialog',\n templateUrl: './select-value-check-radio-dialog.component.html',\n styleUrls: ['./select-value-check-radio-dialog.component.scss'],\n imports: [\n MatDialogTitle,\n FormsModule,\n ReactiveFormsModule,\n MatCheckboxModule,\n MatRadioModule,\n MatDialogActions,\n MatButtonModule,\n AsyncPipe,\n IgoLanguageModule\n ]\n})\nexport class SelectValueCheckRadioDialogComponent implements OnInit {\n private formBuilder = inject(UntypedFormBuilder);\n languageService = inject(LanguageService);\n dialogRef =\n inject<MatDialogRef<SelectValueCheckRadioDialogComponent>>(MatDialogRef);\n data = inject<SelectValueData>(MAT_DIALOG_DATA, { optional: true });\n\n public formGroup: UntypedFormGroup;\n public isDisabled$ = new BehaviorSubject<boolean>(true);\n\n constructor() {\n this.data = this.data || ({} as SelectValueData);\n this.formGroup = this.formBuilder.group(this.getFg());\n this.data.selectFieldText =\n this.data.selectFieldText ??\n 'igo.common.selectValueDialog.selectFieldText';\n this.data.processButtonText =\n this.data.processButtonText ??\n 'igo.common.selectValueDialog.processButtonText';\n this.data.cancelButtonText =\n this.data.cancelButtonText ??\n 'igo.common.selectValueDialog.cancelButtonText';\n this.data.title =\n this.data.title ?? 'igo.common.selectValueDialog.multipleTitle';\n if (this.data.type === SelectValueDialogType.Radio) {\n this.data.title = 'igo.common.selectValueDialog.title';\n }\n }\n\n ngOnInit() {\n this.formGroup.valueChanges.subscribe(() => this.canProcess());\n }\n\n getFg() {\n const a: Record<string, boolean> = {};\n if (this.data && this.data.choices) {\n this.data.choices.map((l) => (a[l.value] = false));\n }\n return a;\n }\n\n canProcess() {\n if (!this.data || !this.data.choices) {\n return;\n }\n const choices = this.data.choices.map((l) => l.value);\n const selectedIds = [];\n choices.map((l) =>\n this.formGroup.value[l] ? selectedIds.push(l) : undefined\n );\n selectedIds.length\n ? this.isDisabled$.next(false)\n : this.isDisabled$.next(true);\n }\n\n save() {\n if (!this.data || !this.data.choices) {\n this.dialogRef.close();\n return;\n }\n const choices = this.data.choices.map((l) => l.value);\n\n const selectedChoices: string[] = [];\n choices.map((l) =>\n this.formGroup.value[l] ? selectedChoices.push(l) : undefined\n );\n this.dialogRef.close({ choices: selectedChoices });\n }\n\n cancel() {\n this.dialogRef.close();\n }\n\n onChange(e: MatRadioChange) {\n const choices: Record<string, boolean> = {};\n this.data?.choices.forEach((l) => (choices[l.value] = false));\n choices[e.value] = true;\n this.formGroup.setValue(choices);\n }\n}\n","<h1 mat-dialog-title>{{ data?.title | translate }}</h1>\n\n<form class=\"igo-form\" [formGroup]=\"formGroup\">\n <section class=\"choices-section\">\n @for (choice of data?.choices; track choice; let i = $index) {\n @if (data?.type === 'checkbox') {\n <mat-checkbox formControlName=\"{{ choice.value }}\">{{\n choice.title || choice.value\n }}</mat-checkbox>\n }\n }\n\n @if (data?.type === 'radio') {\n <mat-radio-group (change)=\"onChange($event)\">\n @for (choice of data?.choices; track choice) {\n <mat-radio-button [value]=\"choice.value\">\n {{ choice.title || choice.value }}\n </mat-radio-button>\n }\n </mat-radio-group>\n }\n </section>\n <div mat-dialog-actions>\n <div class=\"button-group\">\n <button matButton=\"elevated\" type=\"button\" (click)=\"cancel()\">\n {{ data?.cancelButtonText | translate }}\n </button>\n <button\n [disabled]=\"isDisabled$ | async\"\n id=\"processBtnDialog\"\n matButton=\"elevated\"\n type=\"button\"\n color=\"primary\"\n (click)=\"save()\"\n >\n {{ data?.processButtonText | translate }}\n </button>\n </div>\n </div>\n</form>\n","import { Injectable, inject } from '@angular/core';\nimport { MatDialog } from '@angular/material/dialog';\n\nimport { Observable } from 'rxjs';\n\nimport { SelectValueCheckRadioDialogComponent } from './select-value-check-radio-dialog.component';\nimport {\n Choice,\n SelectValueData,\n SelectValueDialogOptions\n} from './select-value-dialog.interface';\n\n@Injectable()\nexport class SelectValueDialogService {\n private dialog = inject(MatDialog);\n\n public open(\n choices: Choice[],\n options?: SelectValueDialogOptions\n ): Observable<any> {\n const data: SelectValueData = {\n choices,\n ...options\n };\n\n const dialogRef = this.dialog.open(SelectValueCheckRadioDialogComponent, {\n disableClose: false,\n data,\n ...options\n });\n return dialogRef.afterClosed();\n }\n}\n","import { ModuleWithProviders, NgModule } from '@angular/core';\n\nimport { SelectValueCheckRadioDialogComponent } from './select-value-check-radio-dialog.component';\nimport { SelectValueDialogService } from './select-value-dialog.service';\n\n@NgModule({\n imports: [SelectValueCheckRadioDialogComponent],\n exports: [SelectValueCheckRadioDialogComponent],\n providers: [SelectValueDialogService]\n})\nexport class IgoSelectValueDialogModule {\n /**\n * @deprecated it has no effect\n */\n static forRoot(): ModuleWithProviders<IgoSelectValueDialogModule> {\n return {\n ngModule: IgoSelectValueDialogModule,\n providers: []\n };\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;IAAY;AAAZ,CAAA,UAAY,qBAAqB,EAAA;AAC/B,IAAA,qBAAA,CAAA,OAAA,CAAA,GAAA,OAAe;AACf,IAAA,qBAAA,CAAA,UAAA,CAAA,GAAA,UAAqB;AACvB,CAAC,EAHW,qBAAqB,KAArB,qBAAqB,GAAA,EAAA,CAAA,CAAA;;MC0CpB,oCAAoC,CAAA;AACvC,IAAA,WAAW,GAAG,MAAM,CAAC,kBAAkB,CAAC;AAChD,IAAA,eAAe,GAAG,MAAM,CAAC,eAAe,CAAC;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A,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,0BAA0B,EAAA,SAAA,EAF1B,CAAC,wBAAwB,CAAC,YAF3B,oCAAoC,CAAA,EAAA,CAAA;;4FAInC,0BAA0B,EAAA,UAAA,EAAA,CAAA;kBALtC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACR,OAAO,EAAE,CAAC,oCAAoC,CAAC;oBAC/C,OAAO,EAAE,CAAC,oCAAoC,CAAC;oBAC/C,SAAS,EAAE,CAAC,wBAAwB;AACrC,iBAAA;;;ACTD;;AAEG;;"}
@@ -1,65 +0,0 @@
1
- import * as i0 from '@angular/core';
2
- import { OnInit, ModuleWithProviders } from '@angular/core';
3
- import { UntypedFormGroup } from '@angular/forms';
4
- import { MatDialogConfig, MatDialogRef } from '@angular/material/dialog';
5
- import { MatRadioChange } from '@angular/material/radio';
6
- import { LanguageService } from '@igo2/core/language';
7
- import { BehaviorSubject, Observable } from 'rxjs';
8
-
9
- declare enum SelectValueDialogType {
10
- Radio = "radio",
11
- Checkbox = "checkbox"
12
- }
13
-
14
- interface Choice {
15
- value: any;
16
- title: any;
17
- }
18
- interface SelectValueData extends SelectValueDialogOptions {
19
- choices: Choice[];
20
- }
21
- interface SelectValueDialogOptions extends MatDialogConfig {
22
- type?: SelectValueDialogType;
23
- title?: string;
24
- processButtonText?: string;
25
- cancelButtonText?: string;
26
- selectFieldText?: string;
27
- }
28
-
29
- declare class SelectValueCheckRadioDialogComponent implements OnInit {
30
- private formBuilder;
31
- languageService: LanguageService;
32
- dialogRef: MatDialogRef<SelectValueCheckRadioDialogComponent, any>;
33
- data: SelectValueData | null;
34
- formGroup: UntypedFormGroup;
35
- isDisabled$: BehaviorSubject<boolean>;
36
- constructor();
37
- ngOnInit(): void;
38
- getFg(): Record<string, boolean>;
39
- canProcess(): void;
40
- save(): void;
41
- cancel(): void;
42
- onChange(e: MatRadioChange): void;
43
- static ɵfac: i0.ɵɵFactoryDeclaration<SelectValueCheckRadioDialogComponent, never>;
44
- static ɵcmp: i0.ɵɵComponentDeclaration<SelectValueCheckRadioDialogComponent, "igo-select-value-check-radio-dialog", never, {}, {}, never, never, true, never>;
45
- }
46
-
47
- declare class IgoSelectValueDialogModule {
48
- /**
49
- * @deprecated it has no effect
50
- */
51
- static forRoot(): ModuleWithProviders<IgoSelectValueDialogModule>;
52
- static ɵfac: i0.ɵɵFactoryDeclaration<IgoSelectValueDialogModule, never>;
53
- static ɵmod: i0.ɵɵNgModuleDeclaration<IgoSelectValueDialogModule, never, [typeof SelectValueCheckRadioDialogComponent], [typeof SelectValueCheckRadioDialogComponent]>;
54
- static ɵinj: i0.ɵɵInjectorDeclaration<IgoSelectValueDialogModule>;
55
- }
56
-
57
- declare class SelectValueDialogService {
58
- private dialog;
59
- open(choices: Choice[], options?: SelectValueDialogOptions): Observable<any>;
60
- static ɵfac: i0.ɵɵFactoryDeclaration<SelectValueDialogService, never>;
61
- static ɵprov: i0.ɵɵInjectableDeclaration<SelectValueDialogService>;
62
- }
63
-
64
- export { IgoSelectValueDialogModule, SelectValueCheckRadioDialogComponent, SelectValueDialogService, SelectValueDialogType };
65
- export type { Choice, SelectValueData, SelectValueDialogOptions };