@ng-forge/dynamic-forms-ionic 0.5.0 → 0.5.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": "@ng-forge/dynamic-forms-ionic",
3
- "version": "0.5.0",
3
+ "version": "0.5.2",
4
4
  "description": "Ionic integration for @ng-forge/dynamic-forms. Pre-built Ionic form components for mobile and desktop.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -1,4 +1,4 @@
1
- import { FormEvent, FieldDef, LogicConfig, FieldComponent, DynamicText, FormEventConstructor, ArrayItemContext, CheckedFieldComponent, FieldMeta, ValidationMessages, ValueFieldComponent, ValueType, FieldOption, FieldTypeDefinition, NarrowFields, RegisteredFieldTypes, InferFormValue, FormConfig } from '@ng-forge/dynamic-forms';
1
+ import { FormEvent, NextPageEvent, PreviousPageEvent, AppendArrayItemEvent, ArrayAllowedChildren, PrependArrayItemEvent, InsertArrayItemEvent, RemoveAtIndexEvent, PopArrayItemEvent, ShiftArrayItemEvent, FieldComponent, DynamicText, FormEventConstructor, ArrayItemContext, CheckedFieldComponent, FieldMeta, ValidationMessages, ValueFieldComponent, ValueType, FieldOption, FieldTypeDefinition, NarrowFields, RegisteredFieldTypes, InferFormValue, FormConfig } from '@ng-forge/dynamic-forms';
2
2
  import * as _ng_forge_dynamic_forms_integration from '@ng-forge/dynamic-forms/integration';
3
3
  import { ButtonField, EventArgs, CheckboxField, DatepickerField, DatepickerProps, InputMeta, InputField, InputProps, MultiCheckboxField, RadioField, SelectField, SelectProps, SliderField, TextareaField, TextareaProps, TextareaMeta, ToggleField } from '@ng-forge/dynamic-forms/integration';
4
4
  import * as _angular_core from '@angular/core';
@@ -20,66 +20,97 @@ type IonicButtonComponent<TEvent extends FormEvent> = FieldComponent<IonicButton
20
20
  * Specific button field types with preconfigured events
21
21
  */
22
22
  /** Submit button field - automatically disabled when form is invalid */
23
- interface IonicSubmitButtonField extends Omit<FieldDef<IonicButtonProps>, 'event'> {
23
+ type IonicSubmitButtonField = Omit<IonicButtonField<SubmitEvent>, 'event' | 'type' | 'eventArgs'> & {
24
24
  type: 'submit';
25
- key: string;
26
- label: string;
27
- disabled?: boolean;
28
- className?: string;
29
- props?: IonicButtonProps;
30
- /** Logic rules for dynamic disabled state (overrides form-level defaults) */
31
- logic?: LogicConfig[];
32
- }
25
+ };
33
26
  /** Next page button field - with preconfigured NextPageEvent */
34
- interface IonicNextButtonField extends Omit<FieldDef<IonicButtonProps>, 'event'> {
27
+ type IonicNextButtonField = Omit<IonicButtonField<NextPageEvent>, 'event' | 'type' | 'eventArgs'> & {
35
28
  type: 'next';
36
- key: string;
37
- label: string;
38
- disabled?: boolean;
39
- className?: string;
40
- props?: IonicButtonProps;
41
- /** Logic rules for dynamic disabled state (overrides form-level defaults) */
42
- logic?: LogicConfig[];
43
- }
29
+ };
44
30
  /** Previous page button field - with preconfigured PreviousPageEvent */
45
- interface IonicPreviousButtonField extends Omit<FieldDef<IonicButtonProps>, 'event'> {
31
+ type IonicPreviousButtonField = Omit<IonicButtonField<PreviousPageEvent>, 'event' | 'type' | 'eventArgs'> & {
46
32
  type: 'previous';
47
- key: string;
48
- label: string;
49
- disabled?: boolean;
50
- className?: string;
51
- props?: IonicButtonProps;
52
- }
53
- /** Add array item button field - with preconfigured AddArrayItemEvent */
54
- interface AddArrayItemButtonField extends Omit<FieldDef<IonicButtonProps>, 'event'> {
33
+ };
34
+ /** Add array item button field - dispatches AppendArrayItemEvent */
35
+ type AddArrayItemButtonField = Omit<IonicButtonField<AppendArrayItemEvent>, 'event' | 'type' | 'eventArgs'> & {
55
36
  type: 'addArrayItem';
56
- key: string;
57
- label: string;
58
- disabled?: boolean;
59
- className?: string;
60
- props?: IonicButtonProps;
61
37
  /**
62
38
  * The key of the array field to add items to.
63
39
  * Required when the button is placed outside the array.
64
40
  * When inside an array, this is automatically determined from context.
65
41
  */
66
42
  arrayKey?: string;
67
- }
68
- /** Remove array item button field - with preconfigured RemoveArrayItemEvent */
69
- interface RemoveArrayItemButtonField extends Omit<FieldDef<IonicButtonProps>, 'event'> {
43
+ /**
44
+ * Template for the new array item. REQUIRED.
45
+ * - Single field (ArrayAllowedChildren): Creates a primitive item (field's value is extracted directly)
46
+ * - Array of fields (ArrayAllowedChildren[]): Creates an object item (fields merged into object)
47
+ */
48
+ template: ArrayAllowedChildren | readonly ArrayAllowedChildren[];
49
+ };
50
+ /** Prepend array item button field - dispatches PrependArrayItemEvent (adds at beginning) */
51
+ type PrependArrayItemButtonField = Omit<IonicButtonField<PrependArrayItemEvent>, 'event' | 'type' | 'eventArgs'> & {
52
+ type: 'prependArrayItem';
53
+ /**
54
+ * The key of the array field to prepend items to.
55
+ * Required when the button is placed outside the array.
56
+ * When inside an array, this is automatically determined from context.
57
+ */
58
+ arrayKey?: string;
59
+ /**
60
+ * Template for the new array item. REQUIRED.
61
+ * - Single field (ArrayAllowedChildren): Creates a primitive item (field's value is extracted directly)
62
+ * - Array of fields (ArrayAllowedChildren[]): Creates an object item (fields merged into object)
63
+ */
64
+ template: ArrayAllowedChildren | readonly ArrayAllowedChildren[];
65
+ };
66
+ /** Insert array item button field - dispatches InsertArrayItemEvent (adds at specific index) */
67
+ type InsertArrayItemButtonField = Omit<IonicButtonField<InsertArrayItemEvent>, 'event' | 'type' | 'eventArgs'> & {
68
+ type: 'insertArrayItem';
69
+ /**
70
+ * The key of the array field to insert items into.
71
+ * Required when the button is placed outside the array.
72
+ * When inside an array, this is automatically determined from context.
73
+ */
74
+ arrayKey?: string;
75
+ /**
76
+ * The index at which to insert the new item.
77
+ */
78
+ index: number;
79
+ /**
80
+ * Template for the new array item. REQUIRED.
81
+ * - Single field (ArrayAllowedChildren): Creates a primitive item (field's value is extracted directly)
82
+ * - Array of fields (ArrayAllowedChildren[]): Creates an object item (fields merged into object)
83
+ */
84
+ template: ArrayAllowedChildren | readonly ArrayAllowedChildren[];
85
+ };
86
+ /** Remove array item button field - dispatches RemoveAtIndexEvent or PopArrayItemEvent */
87
+ type RemoveArrayItemButtonField = Omit<IonicButtonField<RemoveAtIndexEvent>, 'event' | 'type' | 'eventArgs'> & {
70
88
  type: 'removeArrayItem';
71
- key: string;
72
- label: string;
73
- disabled?: boolean;
74
- className?: string;
75
- props?: IonicButtonProps;
76
89
  /**
77
90
  * The key of the array field to remove items from.
78
91
  * Required when the button is placed outside the array.
79
92
  * When inside an array, this is automatically determined from context.
80
93
  */
81
94
  arrayKey?: string;
82
- }
95
+ };
96
+ /** Pop array item button field - dispatches PopArrayItemEvent (removes last item) */
97
+ type PopArrayItemButtonField = Omit<IonicButtonField<PopArrayItemEvent>, 'event' | 'type' | 'eventArgs'> & {
98
+ type: 'popArrayItem';
99
+ /**
100
+ * The key of the array field to remove the last item from.
101
+ * REQUIRED - must specify which array to pop from.
102
+ */
103
+ arrayKey: string;
104
+ };
105
+ /** Shift array item button field - dispatches ShiftArrayItemEvent (removes first item) */
106
+ type ShiftArrayItemButtonField = Omit<IonicButtonField<ShiftArrayItemEvent>, 'event' | 'type' | 'eventArgs'> & {
107
+ type: 'shiftArrayItem';
108
+ /**
109
+ * The key of the array field to remove the first item from.
110
+ * REQUIRED - must specify which array to shift from.
111
+ */
112
+ arrayKey: string;
113
+ };
83
114
 
84
115
  declare class IonicButtonFieldComponent<TEvent extends FormEvent> implements IonicButtonComponent<TEvent> {
85
116
  private readonly eventBus;
@@ -624,7 +655,11 @@ declare const IonicField: {
624
655
  readonly Next: "next";
625
656
  readonly Previous: "previous";
626
657
  readonly AddArrayItem: "addArrayItem";
658
+ readonly PrependArrayItem: "prependArrayItem";
659
+ readonly InsertArrayItem: "insertArrayItem";
627
660
  readonly RemoveArrayItem: "removeArrayItem";
661
+ readonly PopArrayItem: "popArrayItem";
662
+ readonly ShiftArrayItem: "shiftArrayItem";
628
663
  readonly Textarea: "textarea";
629
664
  readonly Radio: "radio";
630
665
  readonly MultiCheckbox: "multi-checkbox";
@@ -702,7 +737,11 @@ declare module '@ng-forge/dynamic-forms' {
702
737
  slider: IonicSliderField;
703
738
  toggle: IonicToggleField;
704
739
  addArrayItem: AddArrayItemButtonField;
740
+ prependArrayItem: PrependArrayItemButtonField;
741
+ insertArrayItem: InsertArrayItemButtonField;
705
742
  removeArrayItem: RemoveArrayItemButtonField;
743
+ popArrayItem: PopArrayItemButtonField;
744
+ shiftArrayItem: ShiftArrayItemButtonField;
706
745
  }
707
746
  }
708
747
 
@@ -773,4 +812,4 @@ declare module '@ng-forge/dynamic-forms' {
773
812
  }
774
813
 
775
814
  export { IONIC_CONFIG, IONIC_FIELD_TYPES, IonicButtonFieldComponent, IonicCheckboxFieldComponent, IonicDatepickerFieldComponent, IonicField, IonicInputFieldComponent, IonicMultiCheckboxFieldComponent, IonicRadioFieldComponent, IonicSelectFieldComponent, IonicSliderFieldComponent, IonicTextareaFieldComponent, IonicToggleFieldComponent, withIonicFields };
776
- export type { AddArrayItemButtonField, IonicButtonField, IonicButtonProps, IonicCheckboxComponent, IonicCheckboxField, IonicCheckboxProps, IonicConfig, IonicDatepickerComponent, IonicDatepickerField, IonicDatepickerProps, IonicFieldType, IonicFormConfig, IonicFormProps, IonicInputComponent, IonicInputField, IonicInputProps, IonicMultiCheckboxComponent, IonicMultiCheckboxField, IonicMultiCheckboxProps, IonicNextButtonField, IonicPreviousButtonField, IonicRadioComponent, IonicRadioField, IonicRadioProps, IonicSelectComponent, IonicSelectField, IonicSelectProps, IonicSliderComponent, IonicSliderField, IonicSliderProps, IonicSubmitButtonField, IonicTextareaComponent, IonicTextareaField, IonicTextareaProps, IonicToggleComponent, IonicToggleField, IonicToggleProps, RemoveArrayItemButtonField };
815
+ export type { AddArrayItemButtonField, InsertArrayItemButtonField, IonicButtonField, IonicButtonProps, IonicCheckboxComponent, IonicCheckboxField, IonicCheckboxProps, IonicConfig, IonicDatepickerComponent, IonicDatepickerField, IonicDatepickerProps, IonicFieldType, IonicFormConfig, IonicFormProps, IonicInputComponent, IonicInputField, IonicInputProps, IonicMultiCheckboxComponent, IonicMultiCheckboxField, IonicMultiCheckboxProps, IonicNextButtonField, IonicPreviousButtonField, IonicRadioComponent, IonicRadioField, IonicRadioProps, IonicSelectComponent, IonicSelectField, IonicSelectProps, IonicSliderComponent, IonicSliderField, IonicSliderProps, IonicSubmitButtonField, IonicTextareaComponent, IonicTextareaField, IonicTextareaProps, IonicToggleComponent, IonicToggleField, IonicToggleProps, PopArrayItemButtonField, PrependArrayItemButtonField, RemoveArrayItemButtonField, ShiftArrayItemButtonField };