@ng-forge/dynamic-forms-bootstrap 0.5.1 → 0.6.0

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-bootstrap",
3
- "version": "0.5.1",
3
+ "version": "0.6.0",
4
4
  "description": "Bootstrap 5 integration for @ng-forge/dynamic-forms. Pre-built Bootstrap form components.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -31,7 +31,7 @@
31
31
  "@angular/common": "~21.1.0",
32
32
  "@angular/core": "~21.1.0",
33
33
  "@angular/forms": "~21.1.0",
34
- "@ng-forge/dynamic-forms": "~0.5.0",
34
+ "@ng-forge/dynamic-forms": "~0.6.0",
35
35
  "rxjs": ">=7.0.0"
36
36
  },
37
37
  "module": "fesm2022/ng-forge-dynamic-forms-bootstrap.mjs",
@@ -1,4 +1,4 @@
1
- import { FormEvent, FieldDef, LogicConfig, FieldComponent, DynamicText, FormEventConstructor, ArrayItemContext, CheckedFieldComponent, ValidationMessages, FieldMeta, 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, ValidationMessages, FieldMeta, 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';
@@ -19,66 +19,97 @@ type BsButtonComponent<TEvent extends FormEvent> = FieldComponent<BsButtonField<
19
19
  * Specific button field types with preconfigured events
20
20
  */
21
21
  /** Submit button field - automatically disabled when form is invalid */
22
- interface BsSubmitButtonField extends Omit<FieldDef<BsButtonProps>, 'event'> {
22
+ type BsSubmitButtonField = Omit<BsButtonField<SubmitEvent>, 'event' | 'type' | 'eventArgs'> & {
23
23
  type: 'submit';
24
- key: string;
25
- label: string;
26
- disabled?: boolean;
27
- className?: string;
28
- props?: BsButtonProps;
29
- /** Logic rules for dynamic disabled state (overrides form-level defaults) */
30
- logic?: LogicConfig[];
31
- }
24
+ };
32
25
  /** Next page button field - with preconfigured NextPageEvent */
33
- interface BsNextButtonField extends Omit<FieldDef<BsButtonProps>, 'event'> {
26
+ type BsNextButtonField = Omit<BsButtonField<NextPageEvent>, 'event' | 'type' | 'eventArgs'> & {
34
27
  type: 'next';
35
- key: string;
36
- label: string;
37
- disabled?: boolean;
38
- className?: string;
39
- props?: BsButtonProps;
40
- /** Logic rules for dynamic disabled state (overrides form-level defaults) */
41
- logic?: LogicConfig[];
42
- }
28
+ };
43
29
  /** Previous page button field - with preconfigured PreviousPageEvent */
44
- interface BsPreviousButtonField extends Omit<FieldDef<BsButtonProps>, 'event'> {
30
+ type BsPreviousButtonField = Omit<BsButtonField<PreviousPageEvent>, 'event' | 'type' | 'eventArgs'> & {
45
31
  type: 'previous';
46
- key: string;
47
- label: string;
48
- disabled?: boolean;
49
- className?: string;
50
- props?: BsButtonProps;
51
- }
52
- /** Add array item button field - with preconfigured AddArrayItemEvent */
53
- interface AddArrayItemButtonField extends Omit<FieldDef<BsButtonProps>, 'event'> {
32
+ };
33
+ /** Add array item button field - dispatches AppendArrayItemEvent */
34
+ type AddArrayItemButtonField = Omit<BsButtonField<AppendArrayItemEvent>, 'event' | 'type' | 'eventArgs'> & {
54
35
  type: 'addArrayItem';
55
- key: string;
56
- label: string;
57
- disabled?: boolean;
58
- className?: string;
59
- props?: BsButtonProps;
60
36
  /**
61
37
  * The key of the array field to add items to.
62
38
  * Required when the button is placed outside the array.
63
39
  * When inside an array, this is automatically determined from context.
64
40
  */
65
41
  arrayKey?: string;
66
- }
67
- /** Remove array item button field - with preconfigured RemoveArrayItemEvent */
68
- interface RemoveArrayItemButtonField extends Omit<FieldDef<BsButtonProps>, 'event'> {
42
+ /**
43
+ * Template for the new array item. REQUIRED.
44
+ * - Single field (ArrayAllowedChildren): Creates a primitive item (field's value is extracted directly)
45
+ * - Array of fields (ArrayAllowedChildren[]): Creates an object item (fields merged into object)
46
+ */
47
+ template: ArrayAllowedChildren | readonly ArrayAllowedChildren[];
48
+ };
49
+ /** Prepend array item button field - dispatches PrependArrayItemEvent (adds at beginning) */
50
+ type PrependArrayItemButtonField = Omit<BsButtonField<PrependArrayItemEvent>, 'event' | 'type' | 'eventArgs'> & {
51
+ type: 'prependArrayItem';
52
+ /**
53
+ * The key of the array field to prepend items to.
54
+ * Required when the button is placed outside the array.
55
+ * When inside an array, this is automatically determined from context.
56
+ */
57
+ arrayKey?: string;
58
+ /**
59
+ * Template for the new array item. REQUIRED.
60
+ * - Single field (ArrayAllowedChildren): Creates a primitive item (field's value is extracted directly)
61
+ * - Array of fields (ArrayAllowedChildren[]): Creates an object item (fields merged into object)
62
+ */
63
+ template: ArrayAllowedChildren | readonly ArrayAllowedChildren[];
64
+ };
65
+ /** Insert array item button field - dispatches InsertArrayItemEvent (adds at specific index) */
66
+ type InsertArrayItemButtonField = Omit<BsButtonField<InsertArrayItemEvent>, 'event' | 'type' | 'eventArgs'> & {
67
+ type: 'insertArrayItem';
68
+ /**
69
+ * The key of the array field to insert items into.
70
+ * Required when the button is placed outside the array.
71
+ * When inside an array, this is automatically determined from context.
72
+ */
73
+ arrayKey?: string;
74
+ /**
75
+ * The index at which to insert the new item.
76
+ */
77
+ index: number;
78
+ /**
79
+ * Template for the new array item. REQUIRED.
80
+ * - Single field (ArrayAllowedChildren): Creates a primitive item (field's value is extracted directly)
81
+ * - Array of fields (ArrayAllowedChildren[]): Creates an object item (fields merged into object)
82
+ */
83
+ template: ArrayAllowedChildren | readonly ArrayAllowedChildren[];
84
+ };
85
+ /** Remove array item button field - dispatches RemoveAtIndexEvent or PopArrayItemEvent */
86
+ type RemoveArrayItemButtonField = Omit<BsButtonField<RemoveAtIndexEvent>, 'event' | 'type' | 'eventArgs'> & {
69
87
  type: 'removeArrayItem';
70
- key: string;
71
- label: string;
72
- disabled?: boolean;
73
- className?: string;
74
- props?: BsButtonProps;
75
88
  /**
76
89
  * The key of the array field to remove items from.
77
90
  * Required when the button is placed outside the array.
78
91
  * When inside an array, this is automatically determined from context.
79
92
  */
80
93
  arrayKey?: string;
81
- }
94
+ };
95
+ /** Pop array item button field - dispatches PopArrayItemEvent (removes last item) */
96
+ type PopArrayItemButtonField = Omit<BsButtonField<PopArrayItemEvent>, 'event' | 'type' | 'eventArgs'> & {
97
+ type: 'popArrayItem';
98
+ /**
99
+ * The key of the array field to remove the last item from.
100
+ * REQUIRED - must specify which array to pop from.
101
+ */
102
+ arrayKey: string;
103
+ };
104
+ /** Shift array item button field - dispatches ShiftArrayItemEvent (removes first item) */
105
+ type ShiftArrayItemButtonField = Omit<BsButtonField<ShiftArrayItemEvent>, 'event' | 'type' | 'eventArgs'> & {
106
+ type: 'shiftArrayItem';
107
+ /**
108
+ * The key of the array field to remove the first item from.
109
+ * REQUIRED - must specify which array to shift from.
110
+ */
111
+ arrayKey: string;
112
+ };
82
113
 
83
114
  declare class BsButtonFieldComponent<TEvent extends FormEvent> implements BsButtonComponent<TEvent> {
84
115
  private readonly eventBus;
@@ -572,7 +603,11 @@ declare const BsField: {
572
603
  readonly Next: "next";
573
604
  readonly Previous: "previous";
574
605
  readonly AddArrayItem: "addArrayItem";
606
+ readonly PrependArrayItem: "prependArrayItem";
607
+ readonly InsertArrayItem: "insertArrayItem";
575
608
  readonly RemoveArrayItem: "removeArrayItem";
609
+ readonly PopArrayItem: "popArrayItem";
610
+ readonly ShiftArrayItem: "shiftArrayItem";
576
611
  readonly Textarea: "textarea";
577
612
  readonly Radio: "radio";
578
613
  readonly MultiCheckbox: "multi-checkbox";
@@ -643,7 +678,11 @@ declare module '@ng-forge/dynamic-forms' {
643
678
  next: BsNextButtonField;
644
679
  previous: BsPreviousButtonField;
645
680
  addArrayItem: AddArrayItemButtonField;
681
+ prependArrayItem: PrependArrayItemButtonField;
682
+ insertArrayItem: InsertArrayItemButtonField;
646
683
  removeArrayItem: RemoveArrayItemButtonField;
684
+ popArrayItem: PopArrayItemButtonField;
685
+ shiftArrayItem: ShiftArrayItemButtonField;
647
686
  textarea: BsTextareaField;
648
687
  radio: BsRadioField<unknown>;
649
688
  'multi-checkbox': BsMultiCheckboxField<unknown>;
@@ -699,4 +738,4 @@ type FieldTypeDefinitionsWithConfig = FieldTypeDefinition[] & {
699
738
  declare function withBootstrapFields(config?: BootstrapConfig): FieldTypeDefinitionsWithConfig;
700
739
 
701
740
  export { BOOTSTRAP_CONFIG, BOOTSTRAP_FIELD_TYPES, BsButtonFieldComponent, BsCheckboxFieldComponent, BsDatepickerFieldComponent, BsField, BsInputFieldComponent, BsMultiCheckboxFieldComponent, BsRadioFieldComponent, BsSelectFieldComponent, BsSliderFieldComponent, BsTextareaFieldComponent, BsToggleFieldComponent, withBootstrapFields };
702
- export type { AddArrayItemButtonField, BootstrapConfig, BsButtonField, BsButtonProps, BsCheckboxComponent, BsCheckboxField, BsCheckboxProps, BsDatepickerComponent, BsDatepickerField, BsDatepickerProps, BsFieldType, BsFormConfig, BsFormProps, BsInputComponent, BsInputField, BsInputProps, BsMultiCheckboxComponent, BsMultiCheckboxField, BsMultiCheckboxProps, BsNextButtonField, BsPreviousButtonField, BsRadioComponent, BsRadioField, BsRadioProps, BsSelectComponent, BsSelectField, BsSelectProps, BsSliderComponent, BsSliderField, BsSliderProps, BsSubmitButtonField, BsTextareaComponent, BsTextareaField, BsTextareaProps, BsToggleComponent, BsToggleField, BsToggleProps, RemoveArrayItemButtonField };
741
+ export type { AddArrayItemButtonField, BootstrapConfig, BsButtonField, BsButtonProps, BsCheckboxComponent, BsCheckboxField, BsCheckboxProps, BsDatepickerComponent, BsDatepickerField, BsDatepickerProps, BsFieldType, BsFormConfig, BsFormProps, BsInputComponent, BsInputField, BsInputProps, BsMultiCheckboxComponent, BsMultiCheckboxField, BsMultiCheckboxProps, BsNextButtonField, BsPreviousButtonField, BsRadioComponent, BsRadioField, BsRadioProps, BsSelectComponent, BsSelectField, BsSelectProps, BsSliderComponent, BsSliderField, BsSliderProps, BsSubmitButtonField, BsTextareaComponent, BsTextareaField, BsTextareaProps, BsToggleComponent, BsToggleField, BsToggleProps, InsertArrayItemButtonField, PopArrayItemButtonField, PrependArrayItemButtonField, RemoveArrayItemButtonField, ShiftArrayItemButtonField };