@sotoa-ui/dynamic-form 0.0.1 → 0.0.2

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sotoa-ui/dynamic-form",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^20.1.0",
6
6
  "@angular/core": "^20.1.0"
@@ -1,7 +1,8 @@
1
1
  import * as i0 from '@angular/core';
2
- import { OnInit, DestroyRef, InputSignal, OutputEmitterRef } from '@angular/core';
3
- import { ValidatorFn, AsyncValidatorFn, FormGroup, FormControl, FormArray, AbstractControl } from '@angular/forms';
2
+ import { Type, OnInit, DestroyRef, InputSignal, OutputEmitterRef } from '@angular/core';
3
+ import { ValidatorFn, AsyncValidatorFn, FormGroup, FormControl, FormArray, ControlValueAccessor, AbstractControl } from '@angular/forms';
4
4
  import { Observable } from 'rxjs';
5
+ import { MatBadgePosition, MatBadgeSize } from '@angular/material/badge';
5
6
 
6
7
  interface AcCondition {
7
8
  type: 'condition';
@@ -398,7 +399,21 @@ interface AcFieldPasswordConfig extends AbstractControlConfig {
398
399
  prefixes?: AcAffix[];
399
400
  }
400
401
 
401
- type AcControlConfig = AcFieldCheckboxConfig | AcFieldInputConfig | AcFieldDateConfig | AcFieldTextareaConfig | AcFieldSelectConfig | AcFieldAutocompleteConfig | AcFieldRadioButtonConfig | AcFieldFileConfig | AcFieldEditorConfig | AcFieldToggleConfig | AcFieldPasswordConfig;
402
+ declare class AcCustomComponentField implements ControlValueAccessor {
403
+ field: AcFieldCustomConfig<any>;
404
+ group: FormGroup;
405
+ registerOnChange(fn: any): void;
406
+ registerOnTouched(fn: any): void;
407
+ writeValue(obj: any): void;
408
+ }
409
+
410
+ interface AcFieldCustomConfig<T> extends AbstractControlConfig {
411
+ type: 'customField';
412
+ component: Type<AcCustomComponentField>;
413
+ data?: T;
414
+ }
415
+
416
+ type AcControlConfig = AcFieldCheckboxConfig | AcFieldInputConfig | AcFieldDateConfig | AcFieldTextareaConfig | AcFieldSelectConfig | AcFieldAutocompleteConfig | AcFieldRadioButtonConfig | AcFieldFileConfig | AcFieldEditorConfig | AcFieldToggleConfig | AcFieldPasswordConfig | AcFieldCustomConfig<any>;
402
417
 
403
418
  declare class DynamicFormService {
404
419
  private readonly fb;
@@ -449,6 +464,22 @@ declare class AbstractControlFieldComponent<T extends AbstractControlConfig> ext
449
464
  static ɵcmp: i0.ɵɵComponentDeclaration<AbstractControlFieldComponent<any>, "ng-component", never, {}, {}, never, never, true, never>;
450
465
  }
451
466
 
467
+ interface AcBadgeOptions {
468
+ position?: MatBadgePosition;
469
+ size?: MatBadgeSize;
470
+ description?: string;
471
+ disabled?: boolean;
472
+ hidden?: boolean;
473
+ noOverlap?: boolean;
474
+ }
475
+ type AcButtonType = 'submit' | 'reset' | 'button' | 'link';
476
+ type AcMaterialButtonType = 'outlined' | 'elevated' | 'filled' | 'tonal' | 'icon' | 'fab' | 'mini-fab' | 'menu';
477
+ interface MatIconConfig {
478
+ fontIcon: string;
479
+ fontSet?: string;
480
+ ariaLabel?: string;
481
+ }
482
+
452
483
  interface AcDynamicForm {
453
484
  fields: (AcFieldConfig | AcTextConfig)[];
454
485
  buttons?: AcButton[];
@@ -473,6 +504,36 @@ interface AcButton {
473
504
  action?: (form: FormGroup) => void;
474
505
  }
475
506
 
507
+ interface AcDynamicFormModal {
508
+ title: string;
509
+ description?: string;
510
+ fields: AcFieldConfig[];
511
+ initialObject?: any;
512
+ validations?: AcValidator[];
513
+ updateOn?: 'change' | 'blur' | 'submit';
514
+ buttons?: any[];
515
+ className?: {
516
+ form?: string;
517
+ formContent?: string;
518
+ formButtons?: string;
519
+ };
520
+ }
521
+ interface AcModalFormButton {
522
+ type: AcButtonType;
523
+ matButtonType?: string;
524
+ matIcon?: string;
525
+ className?: string;
526
+ label?: string;
527
+ title?: string;
528
+ ariaLabel?: string;
529
+ disabledIfFormNoValid?: boolean;
530
+ action?: (form: FormGroup, initialObject: any) => Observable<AcModalFormResponse | boolean>;
531
+ }
532
+ interface AcModalFormResponse {
533
+ status: 'OK' | 'ERROR';
534
+ message?: string;
535
+ }
536
+
476
537
  interface AcField {
477
538
  path: string;
478
539
  field: AcFieldConfig | AcTextConfig;
@@ -579,4 +640,4 @@ declare class AcClassicDynamicFormComponent {
579
640
  }
580
641
 
581
642
  export { AbstractControlFieldComponent, AbstractFieldComponent, AcClassicDynamicFormComponent, AcDsfrDynamicFormComponent, AcMaterialDynamicFormComponent, AutocompleteAttribute, ConditionsService, DynamicFormService };
582
- export type { AbstractControlConfig, AbstractFieldConfig, AcAffix, AcArrayConfig, AcButton, AcControlConfig, AcDynamicForm, AcField, AcFieldCheckboxConfig, AcFieldConfig, AcFieldInputConfig, AcFieldPasswordConfig, AcFieldRadioButtonConfig, AcFieldSelectConfig, AcFieldTextareaConfig, AcFieldToggleConfig, AcGroupConfig, AcRowConfig, AcTextConfig, AcValidator, DynamicFormData, PathArrayInstance, UpdateOnType };
643
+ export type { AbstractControlConfig, AbstractFieldConfig, AcAffix, AcArrayConfig, AcBadgeOptions, AcButton, AcButtonType, AcControlConfig, AcDynamicForm, AcDynamicFormModal, AcField, AcFieldCheckboxConfig, AcFieldConfig, AcFieldCustomConfig, AcFieldInputConfig, AcFieldPasswordConfig, AcFieldRadioButtonConfig, AcFieldSelectConfig, AcFieldTextareaConfig, AcFieldToggleConfig, AcGroupConfig, AcMaterialButtonType, AcModalFormButton, AcModalFormResponse, AcRowConfig, AcTextConfig, AcValidator, DynamicFormData, MatIconConfig, PathArrayInstance, UpdateOnType };