@messaia/cdk 20.1.2 → 20.2.1

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/index.d.ts CHANGED
@@ -5022,6 +5022,10 @@ interface IGenericFormBaseComponent<TEntity extends IEntity | any> extends IBase
5022
5022
  * Gets form value
5023
5023
  */
5024
5024
  get formValue(): TEntity | any;
5025
+ /**
5026
+ * Array of field sets that organize related fields.
5027
+ */
5028
+ fieldSets?: string[];
5025
5029
  /**
5026
5030
  * Loads an item by ID
5027
5031
  */
@@ -5579,9 +5583,15 @@ declare class FormFieldDefinition<TEntity = any, TProperty = any> {
5579
5583
  required?: ((x?: TEntity, f?: FormGroup, ctx?: IGenericFormBaseComponent<TEntity>) => boolean | boolean);
5580
5584
  /**
5581
5585
  * The row number indicating the display position of the field.
5586
+ * Can be a fixed number or a callback returning a number.
5587
+ *
5588
+ * @param x The entity associated with the field.
5589
+ * @param f The FormGroup containing this field.
5590
+ * @param ctx The context of the generic form component.
5591
+ * @returns The row number for display.
5582
5592
  * Defaults to 1.
5583
5593
  */
5584
- row: number;
5594
+ row: number | ((x?: TEntity, f?: FormGroup, ctx?: IGenericFormBaseComponent<TEntity>) => number);
5585
5595
  /**
5586
5596
  * The number of rows for multi-line input fields (e.g., text area).
5587
5597
  */
@@ -5927,6 +5937,13 @@ declare abstract class GenericFormBaseComponent<TEntity extends IEntity, TServic
5927
5937
  */
5928
5938
  get form(): NgForm | FormGroup | undefined;
5929
5939
  set form(form: NgForm | FormGroup | undefined);
5940
+ /**
5941
+ * @property List of field sets.
5942
+ * @description The `fieldSets` array is used to filter and group form fields based on specific sets,
5943
+ * allowing dynamic field rendering.
5944
+ * @type {string[]}
5945
+ */
5946
+ fieldSets?: string[];
5930
5947
  /**
5931
5948
  * Gets the form value.
5932
5949
  */
@@ -6175,7 +6192,7 @@ declare abstract class GenericFormBaseComponent<TEntity extends IEntity, TServic
6175
6192
  */
6176
6193
  handleKeyboardEvent(event: KeyboardEvent): void;
6177
6194
  static ɵfac: i0.ɵɵFactoryDeclaration<GenericFormBaseComponent<any, any>, never>;
6178
- static ɵdir: i0.ɵɵDirectiveDeclaration<GenericFormBaseComponent<any, any>, never, never, { "id": { "alias": "id"; "required": false; }; "_item": { "alias": "_item"; "required": false; }; "item": { "alias": "item"; "required": false; }; "includes": { "alias": "includes"; "required": false; }; "updateIncludes": { "alias": "updateIncludes"; "required": false; }; "projection": { "alias": "projection"; "required": false; }; "query": { "alias": "query"; "required": false; }; "readonly": { "alias": "readonly"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "form": { "alias": "form"; "required": false; }; }, {}, never, never, true, never>;
6195
+ static ɵdir: i0.ɵɵDirectiveDeclaration<GenericFormBaseComponent<any, any>, never, never, { "id": { "alias": "id"; "required": false; }; "_item": { "alias": "_item"; "required": false; }; "item": { "alias": "item"; "required": false; }; "includes": { "alias": "includes"; "required": false; }; "updateIncludes": { "alias": "updateIncludes"; "required": false; }; "projection": { "alias": "projection"; "required": false; }; "query": { "alias": "query"; "required": false; }; "readonly": { "alias": "readonly"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "form": { "alias": "form"; "required": false; }; "fieldSets": { "alias": "fieldSets"; "required": false; }; }, {}, never, never, true, never>;
6179
6196
  }
6180
6197
 
6181
6198
  declare abstract class GenericFormComponent<TEntity extends IEntity, TService extends GenericService<TEntity>> extends GenericFormBaseComponent<TEntity, TService> {
@@ -10587,24 +10604,51 @@ declare function Form<T = any>(formDefinition?: Partial<FormDefinition<T>>): Fun
10587
10604
  */
10588
10605
  declare function FormField<TEntity = any, TProperty = any>(args: Partial<FormFieldDefinition<TEntity, TProperty>>): Function;
10589
10606
  /**
10590
- * Property decorator to create form fields
10591
- * @param args
10592
- * @returns
10607
+ * Property decorator to create and register form field groups.
10608
+ *
10609
+ * This decorator can be applied to a class property to automatically
10610
+ * generate and register form groups based on the provided type and arguments.
10611
+ *
10612
+ * @param type The class type whose decorated properties will be grouped.
10613
+ * @param args Optional partial configuration to customize the resulting FormFieldGroupDefinition.
10614
+ * @param context Optional context object to influence form group generation, e.g., for conditional fields.
10615
+ * @returns A property decorator function.
10593
10616
  */
10594
- declare function FormFieldGroup<T = any>(type: Type$1<T>, args?: Partial<FormFieldGroupDefinition<T>>): Function;
10617
+ declare function FormFieldGroup<T = any>(type: Type$1<T>, args?: Partial<FormFieldGroupDefinition<T>>, context?: any): Function;
10595
10618
 
10596
10619
  /**
10597
- * Gets classes decoarated with @Form
10598
- * @param origin
10599
- * @returns
10620
+ * Retrieves the form definition for a given object decorated with @Form.
10621
+ *
10622
+ * This function reads metadata defined via decorators on the class
10623
+ * to build a FormDefinition instance, including field groups and
10624
+ * an optional API endpoint.
10625
+ *
10626
+ * @template TEntity The type of the entity associated with the form.
10627
+ * @param origin The entity instance for which to retrieve the form definition. Must not be undefined.
10628
+ * @param form Optional NgForm or FormGroup associated with the entity.
10629
+ * @param context Optional context object to customize form definition generation,
10630
+ * e.g., for conditional fields or groups.
10631
+ * @returns The FormDefinition object containing field groups and endpoint metadata.
10632
+ * @throws Error if the `origin` argument is not provided.
10600
10633
  */
10601
- declare function getFormDefinition(origin?: object): FormDefinition;
10634
+ declare function getFormDefinition<TEntity>(origin: TEntity, form?: FormGroup, context?: any): FormDefinition;
10602
10635
  /**
10603
- * Gets poperties decoarated with @FormField grouped by row
10604
- * @param instance
10605
- * @returns
10636
+ * Retrieves properties decorated with @FormField, grouped by row.
10637
+ *
10638
+ * This function reads metadata from the instance (or type) to generate
10639
+ * an array of FormFieldGroupDefinition objects. It can use additional
10640
+ * arguments, the form instance, or a context object to customize group creation.
10641
+ *
10642
+ * @template TEntity The type of the entity associated with the form fields.
10643
+ * @param instance The instance of the object containing decorated properties.
10644
+ * @param type Optional constructor of the class; used if instance is not provided.
10645
+ * @param args Optional partial configuration to customize the resulting FormFieldGroupDefinition.
10646
+ * @param form Optional NgForm or FormGroup associated with the entity, for dynamic field logic.
10647
+ * @param context Optional context object for conditional logic or dynamic modifications
10648
+ * when generating form groups.
10649
+ * @returns An array of FormFieldGroupDefinition objects representing the grouped form fields.
10606
10650
  */
10607
- declare function getFormGroups<T = any>(instance?: T, type?: Type$1<T>, args?: Partial<FormFieldGroupDefinition<T>>): FormFieldGroupDefinition[];
10651
+ declare function getFormGroups<TEntity = any>(instance?: TEntity, type?: Type$1<TEntity>, args?: Partial<FormFieldGroupDefinition<TEntity>>, form?: FormGroup, context?: any): FormFieldGroupDefinition[];
10608
10652
 
10609
10653
  declare abstract class AbstractSelectFormField<T> extends AbstractMatFormField<T> implements OnInit {
10610
10654
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@messaia/cdk",
3
- "version": "20.1.2",
3
+ "version": "20.2.1",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^20.0.0",
6
6
  "@angular/core": "^20.0.0"